import { shallowRef as En, watchEffect as Nv, readonly as Bv, unref as z, getCurrentScope as BM, onScopeDispose as UM, getCurrentInstance as dn, onMounted as Jt, nextTick as bt, watch as Qe, ref as Ee, defineComponent as Pe, openBlock as ve, createElementBlock as Ce, createElementVNode as Ne, warn as zM, isVNode as Uh, computed as ue, inject as pt, isRef as Zc, onBeforeUnmount as ei, onBeforeMount as kM, provide as sn, mergeProps as Ei, renderSlot as He, toRef as hi, onUnmounted as Uv, useAttrs as VM, useSlots as Xc, createCommentVNode as ke, Fragment as Ft, normalizeClass as Te, createBlock as Ve, withCtx as de, resolveDynamicComponent as Fn, withModifiers as Ut, createVNode as le, toDisplayString as gt, normalizeStyle as Rt, Transition as el, withDirectives as Lt, vShow as mn, reactive as jn, onActivated as GM, onUpdated as zd, cloneVNode as HM, Text as zv, Comment as WM, Teleport as jM, onDeactivated as $M, vModelRadio as kv, createTextVNode as rt, toRefs as Br, toHandlers as ZM, withKeys as ui, createSlots as XM, toRaw as Vv, resolveComponent as Vn, resolveDirective as YM, toHandlerKey as JM, renderList as Gn, vModelText as KM, h as ho, createApp as qM, markRaw as An } from "vue";
import { TreeControls as QM, CreateTooltipContent as ew, Tooltip as tw, DrawToolbar as nw } from "@abi-software/map-utilities";
import { defineStore as iw, mapState as Gv, mapStores as rw } from "pinia";
import { MapSvgIcon as sw, MapSvgSpriteColor as ow } from "@abi-software/svg-sprite";
import { AnnotationService as aw } from "@abi-software/sparc-annotation";
const Ji = (n, e, { checkForDefaultPrevented: t = !0 } = {}) => (r) => {
  const s = n == null ? void 0 : n(r);
  if (t === !1 || !s)
    return e == null ? void 0 : e(r);
};
var lw = Object.defineProperty, cw = Object.defineProperties, uw = Object.getOwnPropertyDescriptors, bp = Object.getOwnPropertySymbols, hw = Object.prototype.hasOwnProperty, dw = Object.prototype.propertyIsEnumerable, xp = (n, e, t) => e in n ? lw(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, fw = (n, e) => {
  for (var t in e || (e = {}))
    hw.call(e, t) && xp(n, t, e[t]);
  if (bp)
    for (var t of bp(e))
      dw.call(e, t) && xp(n, t, e[t]);
  return n;
}, pw = (n, e) => cw(n, uw(e));
function Mp(n, e) {
  var t;
  const i = En();
  return Nv(() => {
    i.value = n();
  }, pw(fw({}, e), {
    flush: (t = void 0) != null ? t : "sync"
  })), Bv(i);
}
var wp;
const en = typeof window < "u", mw = (n) => typeof n == "string", Hv = () => {
}, zh = en && ((wp = window == null ? void 0 : window.navigator) == null ? void 0 : wp.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Wv(n) {
  return typeof n == "function" ? n() : z(n);
}
function gw(n) {
  return n;
}
function Yc(n) {
  return BM() ? (UM(n), !0) : !1;
}
function vw(n, e = !0) {
  dn() ? Jt(n) : e ? n() : bt(n);
}
function er(n) {
  var e;
  const t = Wv(n);
  return (e = t == null ? void 0 : t.$el) != null ? e : t;
}
const tl = en ? window : void 0, yw = en ? window.document : void 0;
function un(...n) {
  let e, t, i, r;
  if (mw(n[0]) || Array.isArray(n[0]) ? ([t, i, r] = n, e = tl) : [e, t, i, r] = n, !e)
    return Hv;
  Array.isArray(t) || (t = [t]), Array.isArray(i) || (i = [i]);
  const s = [], o = () => {
    s.forEach((d) => d()), s.length = 0;
  }, a = (d, h, f, g) => (d.addEventListener(h, f, g), () => d.removeEventListener(h, f, g)), c = Qe(() => [er(e), Wv(r)], ([d, h]) => {
    o(), d && s.push(...t.flatMap((f) => i.map((g) => a(d, f, g, h))));
  }, { immediate: !0, flush: "post" }), l = () => {
    c(), o();
  };
  return Yc(l), l;
}
let Ap = !1;
function bw(n, e, t = {}) {
  const { window: i = tl, ignore: r = [], capture: s = !0, detectIframe: o = !1 } = t;
  if (!i)
    return;
  zh && !Ap && (Ap = !0, Array.from(i.document.body.children).forEach((f) => f.addEventListener("click", Hv)));
  let a = !0;
  const c = (f) => r.some((g) => {
    if (typeof g == "string")
      return Array.from(i.document.querySelectorAll(g)).some((p) => p === f.target || f.composedPath().includes(p));
    {
      const p = er(g);
      return p && (f.target === p || f.composedPath().includes(p));
    }
  }), d = [
    un(i, "click", (f) => {
      const g = er(n);
      if (!(!g || g === f.target || f.composedPath().includes(g))) {
        if (f.detail === 0 && (a = !c(f)), !a) {
          a = !0;
          return;
        }
        e(f);
      }
    }, { passive: !0, capture: s }),
    un(i, "pointerdown", (f) => {
      const g = er(n);
      g && (a = !f.composedPath().includes(g) && !c(f));
    }, { passive: !0 }),
    o && un(i, "blur", (f) => {
      var g;
      const p = er(n);
      ((g = i.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !(p != null && p.contains(i.document.activeElement)) && e(f);
    })
  ].filter(Boolean);
  return () => d.forEach((f) => f());
}
function jv(n, e = !1) {
  const t = Ee(), i = () => t.value = !!n();
  return i(), vw(i, e), t;
}
const Sp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _p = "__vueuse_ssr_handlers__";
Sp[_p] = Sp[_p] || {};
function xw({ document: n = yw } = {}) {
  if (!n)
    return Ee("visible");
  const e = Ee(n.visibilityState);
  return un(n, "visibilitychange", () => {
    e.value = n.visibilityState;
  }), e;
}
var Tp = Object.getOwnPropertySymbols, Mw = Object.prototype.hasOwnProperty, ww = Object.prototype.propertyIsEnumerable, Aw = (n, e) => {
  var t = {};
  for (var i in n)
    Mw.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
  if (n != null && Tp)
    for (var i of Tp(n))
      e.indexOf(i) < 0 && ww.call(n, i) && (t[i] = n[i]);
  return t;
};
function Jn(n, e, t = {}) {
  const i = t, { window: r = tl } = i, s = Aw(i, ["window"]);
  let o;
  const a = jv(() => r && "ResizeObserver" in r), c = () => {
    o && (o.disconnect(), o = void 0);
  }, l = Qe(() => er(n), (h) => {
    c(), a.value && r && h && (o = new ResizeObserver(e), o.observe(h, s));
  }, { immediate: !0, flush: "post" }), d = () => {
    c(), l();
  };
  return Yc(d), {
    isSupported: a,
    stop: d
  };
}
var Ep = Object.getOwnPropertySymbols, Sw = Object.prototype.hasOwnProperty, _w = Object.prototype.propertyIsEnumerable, Tw = (n, e) => {
  var t = {};
  for (var i in n)
    Sw.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
  if (n != null && Ep)
    for (var i of Ep(n))
      e.indexOf(i) < 0 && _w.call(n, i) && (t[i] = n[i]);
  return t;
};
function Ew(n, e, t = {}) {
  const i = t, { window: r = tl } = i, s = Tw(i, ["window"]);
  let o;
  const a = jv(() => r && "MutationObserver" in r), c = () => {
    o && (o.disconnect(), o = void 0);
  }, l = Qe(() => er(n), (h) => {
    c(), a.value && r && h && (o = new MutationObserver(e), o.observe(h, s));
  }, { immediate: !0 }), d = () => {
    c(), l();
  };
  return Yc(d), {
    isSupported: a,
    stop: d
  };
}
var Cp;
(function(n) {
  n.UP = "UP", n.RIGHT = "RIGHT", n.DOWN = "DOWN", n.LEFT = "LEFT", n.NONE = "NONE";
})(Cp || (Cp = {}));
var Cw = Object.defineProperty, Lp = Object.getOwnPropertySymbols, Lw = Object.prototype.hasOwnProperty, Rw = Object.prototype.propertyIsEnumerable, Rp = (n, e, t) => e in n ? Cw(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Fw = (n, e) => {
  for (var t in e || (e = {}))
    Lw.call(e, t) && Rp(n, t, e[t]);
  if (Lp)
    for (var t of Lp(e))
      Rw.call(e, t) && Rp(n, t, e[t]);
  return n;
};
const Pw = {
  easeInSine: [0.12, 0, 0.39, 0],
  easeOutSine: [0.61, 1, 0.88, 1],
  easeInOutSine: [0.37, 0, 0.63, 1],
  easeInQuad: [0.11, 0, 0.5, 0],
  easeOutQuad: [0.5, 1, 0.89, 1],
  easeInOutQuad: [0.45, 0, 0.55, 1],
  easeInCubic: [0.32, 0, 0.67, 0],
  easeOutCubic: [0.33, 1, 0.68, 1],
  easeInOutCubic: [0.65, 0, 0.35, 1],
  easeInQuart: [0.5, 0, 0.75, 0],
  easeOutQuart: [0.25, 1, 0.5, 1],
  easeInOutQuart: [0.76, 0, 0.24, 1],
  easeInQuint: [0.64, 0, 0.78, 0],
  easeOutQuint: [0.22, 1, 0.36, 1],
  easeInOutQuint: [0.83, 0, 0.17, 1],
  easeInExpo: [0.7, 0, 0.84, 0],
  easeOutExpo: [0.16, 1, 0.3, 1],
  easeInOutExpo: [0.87, 0, 0.13, 1],
  easeInCirc: [0.55, 0, 1, 0.45],
  easeOutCirc: [0, 0.55, 0.45, 1],
  easeInOutCirc: [0.85, 0, 0.15, 1],
  easeInBack: [0.36, 0, 0.66, -0.56],
  easeOutBack: [0.34, 1.56, 0.64, 1],
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
Fw({
  linear: gw
}, Pw);
function Iw({ window: n = tl } = {}) {
  if (!n)
    return Ee(!1);
  const e = Ee(n.document.hasFocus());
  return un(n, "blur", () => {
    e.value = !1;
  }), un(n, "focus", () => {
    e.value = !0;
  }), e;
}
const Ow = () => en && /firefox/i.test(window.navigator.userAgent);
/**
* @vue/shared v3.5.13
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/
process.env.NODE_ENV !== "production" && Object.freeze({});
process.env.NODE_ENV !== "production" && Object.freeze([]);
const Oa = () => {
}, Dw = Object.prototype.hasOwnProperty, Fp = (n, e) => Dw.call(n, e), Pn = Array.isArray, Sn = (n) => typeof n == "function", vn = (n) => typeof n == "string", Tn = (n) => n !== null && typeof n == "object", Nw = Object.prototype.toString, Bw = (n) => Nw.call(n), Pu = (n) => Bw(n).slice(8, -1), kd = (n) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (t) => e[t] || (e[t] = n(t));
}, Uw = /-(\w)/g, zw = kd(
  (n) => n.replace(Uw, (e, t) => t ? t.toUpperCase() : "")
), kw = /\B([A-Z])/g, Vw = kd(
  (n) => n.replace(kw, "-$1").toLowerCase()
), Gw = kd((n) => n.charAt(0).toUpperCase() + n.slice(1));
var $v = typeof global == "object" && global && global.Object === Object && global, Hw = typeof self == "object" && self && self.Object === Object && self, Bi = $v || Hw || Function("return this")(), Pi = Bi.Symbol, Zv = Object.prototype, Ww = Zv.hasOwnProperty, jw = Zv.toString, la = Pi ? Pi.toStringTag : void 0;
function $w(n) {
  var e = Ww.call(n, la), t = n[la];
  try {
    n[la] = void 0;
    var i = !0;
  } catch {
  }
  var r = jw.call(n);
  return i && (e ? n[la] = t : delete n[la]), r;
}
var Zw = Object.prototype, Xw = Zw.toString;
function Yw(n) {
  return Xw.call(n);
}
var Jw = "[object Null]", Kw = "[object Undefined]", Pp = Pi ? Pi.toStringTag : void 0;
function Zo(n) {
  return n == null ? n === void 0 ? Kw : Jw : Pp && Pp in Object(n) ? $w(n) : Yw(n);
}
function Mo(n) {
  return n != null && typeof n == "object";
}
var qw = "[object Symbol]";
function Jc(n) {
  return typeof n == "symbol" || Mo(n) && Zo(n) == qw;
}
function Qw(n, e) {
  for (var t = -1, i = n == null ? 0 : n.length, r = Array(i); ++t < i; )
    r[t] = e(n[t], t, n);
  return r;
}
var pi = Array.isArray, e1 = 1 / 0, Ip = Pi ? Pi.prototype : void 0, Op = Ip ? Ip.toString : void 0;
function Xv(n) {
  if (typeof n == "string")
    return n;
  if (pi(n))
    return Qw(n, Xv) + "";
  if (Jc(n))
    return Op ? Op.call(n) : "";
  var e = n + "";
  return e == "0" && 1 / n == -e1 ? "-0" : e;
}
var t1 = /\s/;
function n1(n) {
  for (var e = n.length; e-- && t1.test(n.charAt(e)); )
    ;
  return e;
}
var i1 = /^\s+/;
function r1(n) {
  return n && n.slice(0, n1(n) + 1).replace(i1, "");
}
function Ur(n) {
  var e = typeof n;
  return n != null && (e == "object" || e == "function");
}
var Dp = NaN, s1 = /^[-+]0x[0-9a-f]+$/i, o1 = /^0b[01]+$/i, a1 = /^0o[0-7]+$/i, l1 = parseInt;
function Np(n) {
  if (typeof n == "number")
    return n;
  if (Jc(n))
    return Dp;
  if (Ur(n)) {
    var e = typeof n.valueOf == "function" ? n.valueOf() : n;
    n = Ur(e) ? e + "" : e;
  }
  if (typeof n != "string")
    return n === 0 ? n : +n;
  n = r1(n);
  var t = o1.test(n);
  return t || a1.test(n) ? l1(n.slice(2), t ? 2 : 8) : s1.test(n) ? Dp : +n;
}
function Yv(n) {
  return n;
}
var c1 = "[object AsyncFunction]", u1 = "[object Function]", h1 = "[object GeneratorFunction]", d1 = "[object Proxy]";
function Jv(n) {
  if (!Ur(n))
    return !1;
  var e = Zo(n);
  return e == u1 || e == h1 || e == c1 || e == d1;
}
var Iu = Bi["__core-js_shared__"], Bp = function() {
  var n = /[^.]+$/.exec(Iu && Iu.keys && Iu.keys.IE_PROTO || "");
  return n ? "Symbol(src)_1." + n : "";
}();
function f1(n) {
  return !!Bp && Bp in n;
}
var p1 = Function.prototype, m1 = p1.toString;
function Os(n) {
  if (n != null) {
    try {
      return m1.call(n);
    } catch {
    }
    try {
      return n + "";
    } catch {
    }
  }
  return "";
}
var g1 = /[\\^$.*+?()[\]{}|]/g, v1 = /^\[object .+?Constructor\]$/, y1 = Function.prototype, b1 = Object.prototype, x1 = y1.toString, M1 = b1.hasOwnProperty, w1 = RegExp(
  "^" + x1.call(M1).replace(g1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function A1(n) {
  if (!Ur(n) || f1(n))
    return !1;
  var e = Jv(n) ? w1 : v1;
  return e.test(Os(n));
}
function S1(n, e) {
  return n == null ? void 0 : n[e];
}
function Ds(n, e) {
  var t = S1(n, e);
  return A1(t) ? t : void 0;
}
var kh = Ds(Bi, "WeakMap");
function _1(n, e, t) {
  switch (t.length) {
    case 0:
      return n.call(e);
    case 1:
      return n.call(e, t[0]);
    case 2:
      return n.call(e, t[0], t[1]);
    case 3:
      return n.call(e, t[0], t[1], t[2]);
  }
  return n.apply(e, t);
}
var T1 = 800, E1 = 16, C1 = Date.now;
function L1(n) {
  var e = 0, t = 0;
  return function() {
    var i = C1(), r = E1 - (i - t);
    if (t = i, r > 0) {
      if (++e >= T1)
        return arguments[0];
    } else
      e = 0;
    return n.apply(void 0, arguments);
  };
}
function R1(n) {
  return function() {
    return n;
  };
}
var Fc = function() {
  try {
    var n = Ds(Object, "defineProperty");
    return n({}, "", {}), n;
  } catch {
  }
}(), F1 = Fc ? function(n, e) {
  return Fc(n, "toString", {
    configurable: !0,
    enumerable: !1,
    value: R1(e),
    writable: !0
  });
} : Yv, P1 = L1(F1);
function I1(n, e, t, i) {
  n.length;
  for (var r = t + 1; r--; )
    if (e(n[r], r, n))
      return r;
  return -1;
}
var O1 = 9007199254740991, D1 = /^(?:0|[1-9]\d*)$/;
function Vd(n, e) {
  var t = typeof n;
  return e = e ?? O1, !!e && (t == "number" || t != "symbol" && D1.test(n)) && n > -1 && n % 1 == 0 && n < e;
}
function N1(n, e, t) {
  e == "__proto__" && Fc ? Fc(n, e, {
    configurable: !0,
    enumerable: !0,
    value: t,
    writable: !0
  }) : n[e] = t;
}
function Gd(n, e) {
  return n === e || n !== n && e !== e;
}
var B1 = Object.prototype, U1 = B1.hasOwnProperty;
function z1(n, e, t) {
  var i = n[e];
  (!(U1.call(n, e) && Gd(i, t)) || t === void 0 && !(e in n)) && N1(n, e, t);
}
var Up = Math.max;
function k1(n, e, t) {
  return e = Up(e === void 0 ? n.length - 1 : e, 0), function() {
    for (var i = arguments, r = -1, s = Up(i.length - e, 0), o = Array(s); ++r < s; )
      o[r] = i[e + r];
    r = -1;
    for (var a = Array(e + 1); ++r < e; )
      a[r] = i[r];
    return a[e] = t(o), _1(n, this, a);
  };
}
var V1 = 9007199254740991;
function Hd(n) {
  return typeof n == "number" && n > -1 && n % 1 == 0 && n <= V1;
}
function G1(n) {
  return n != null && Hd(n.length) && !Jv(n);
}
var H1 = Object.prototype;
function W1(n) {
  var e = n && n.constructor, t = typeof e == "function" && e.prototype || H1;
  return n === t;
}
function j1(n, e) {
  for (var t = -1, i = Array(n); ++t < n; )
    i[t] = e(t);
  return i;
}
var $1 = "[object Arguments]";
function zp(n) {
  return Mo(n) && Zo(n) == $1;
}
var Kv = Object.prototype, Z1 = Kv.hasOwnProperty, X1 = Kv.propertyIsEnumerable, Wd = zp(/* @__PURE__ */ function() {
  return arguments;
}()) ? zp : function(n) {
  return Mo(n) && Z1.call(n, "callee") && !X1.call(n, "callee");
};
function Y1() {
  return !1;
}
var qv = typeof exports == "object" && exports && !exports.nodeType && exports, kp = qv && typeof module == "object" && module && !module.nodeType && module, J1 = kp && kp.exports === qv, Vp = J1 ? Bi.Buffer : void 0, K1 = Vp ? Vp.isBuffer : void 0, Vh = K1 || Y1, q1 = "[object Arguments]", Q1 = "[object Array]", eA = "[object Boolean]", tA = "[object Date]", nA = "[object Error]", iA = "[object Function]", rA = "[object Map]", sA = "[object Number]", oA = "[object Object]", aA = "[object RegExp]", lA = "[object Set]", cA = "[object String]", uA = "[object WeakMap]", hA = "[object ArrayBuffer]", dA = "[object DataView]", fA = "[object Float32Array]", pA = "[object Float64Array]", mA = "[object Int8Array]", gA = "[object Int16Array]", vA = "[object Int32Array]", yA = "[object Uint8Array]", bA = "[object Uint8ClampedArray]", xA = "[object Uint16Array]", MA = "[object Uint32Array]", Et = {};
Et[fA] = Et[pA] = Et[mA] = Et[gA] = Et[vA] = Et[yA] = Et[bA] = Et[xA] = Et[MA] = !0;
Et[q1] = Et[Q1] = Et[hA] = Et[eA] = Et[dA] = Et[tA] = Et[nA] = Et[iA] = Et[rA] = Et[sA] = Et[oA] = Et[aA] = Et[lA] = Et[cA] = Et[uA] = !1;
function wA(n) {
  return Mo(n) && Hd(n.length) && !!Et[Zo(n)];
}
function AA(n) {
  return function(e) {
    return n(e);
  };
}
var Qv = typeof exports == "object" && exports && !exports.nodeType && exports, Ea = Qv && typeof module == "object" && module && !module.nodeType && module, SA = Ea && Ea.exports === Qv, Ou = SA && $v.process, Gp = function() {
  try {
    var n = Ea && Ea.require && Ea.require("util").types;
    return n || Ou && Ou.binding && Ou.binding("util");
  } catch {
  }
}(), Hp = Gp && Gp.isTypedArray, e0 = Hp ? AA(Hp) : wA, _A = Object.prototype, TA = _A.hasOwnProperty;
function EA(n, e) {
  var t = pi(n), i = !t && Wd(n), r = !t && !i && Vh(n), s = !t && !i && !r && e0(n), o = t || i || r || s, a = o ? j1(n.length, String) : [], c = a.length;
  for (var l in n)
    TA.call(n, l) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode.
    (l == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    r && (l == "offset" || l == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    s && (l == "buffer" || l == "byteLength" || l == "byteOffset") || // Skip index properties.
    Vd(l, c))) && a.push(l);
  return a;
}
function CA(n, e) {
  return function(t) {
    return n(e(t));
  };
}
var LA = CA(Object.keys, Object), RA = Object.prototype, FA = RA.hasOwnProperty;
function PA(n) {
  if (!W1(n))
    return LA(n);
  var e = [];
  for (var t in Object(n))
    FA.call(n, t) && t != "constructor" && e.push(t);
  return e;
}
function t0(n) {
  return G1(n) ? EA(n) : PA(n);
}
var IA = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, OA = /^\w*$/;
function jd(n, e) {
  if (pi(n))
    return !1;
  var t = typeof n;
  return t == "number" || t == "symbol" || t == "boolean" || n == null || Jc(n) ? !0 : OA.test(n) || !IA.test(n) || e != null && n in Object(e);
}
var Da = Ds(Object, "create");
function DA() {
  this.__data__ = Da ? Da(null) : {}, this.size = 0;
}
function NA(n) {
  var e = this.has(n) && delete this.__data__[n];
  return this.size -= e ? 1 : 0, e;
}
var BA = "__lodash_hash_undefined__", UA = Object.prototype, zA = UA.hasOwnProperty;
function kA(n) {
  var e = this.__data__;
  if (Da) {
    var t = e[n];
    return t === BA ? void 0 : t;
  }
  return zA.call(e, n) ? e[n] : void 0;
}
var VA = Object.prototype, GA = VA.hasOwnProperty;
function HA(n) {
  var e = this.__data__;
  return Da ? e[n] !== void 0 : GA.call(e, n);
}
var WA = "__lodash_hash_undefined__";
function jA(n, e) {
  var t = this.__data__;
  return this.size += this.has(n) ? 0 : 1, t[n] = Da && e === void 0 ? WA : e, this;
}
function _s(n) {
  var e = -1, t = n == null ? 0 : n.length;
  for (this.clear(); ++e < t; ) {
    var i = n[e];
    this.set(i[0], i[1]);
  }
}
_s.prototype.clear = DA;
_s.prototype.delete = NA;
_s.prototype.get = kA;
_s.prototype.has = HA;
_s.prototype.set = jA;
function $A() {
  this.__data__ = [], this.size = 0;
}
function Kc(n, e) {
  for (var t = n.length; t--; )
    if (Gd(n[t][0], e))
      return t;
  return -1;
}
var ZA = Array.prototype, XA = ZA.splice;
function YA(n) {
  var e = this.__data__, t = Kc(e, n);
  if (t < 0)
    return !1;
  var i = e.length - 1;
  return t == i ? e.pop() : XA.call(e, t, 1), --this.size, !0;
}
function JA(n) {
  var e = this.__data__, t = Kc(e, n);
  return t < 0 ? void 0 : e[t][1];
}
function KA(n) {
  return Kc(this.__data__, n) > -1;
}
function qA(n, e) {
  var t = this.__data__, i = Kc(t, n);
  return i < 0 ? (++this.size, t.push([n, e])) : t[i][1] = e, this;
}
function cr(n) {
  var e = -1, t = n == null ? 0 : n.length;
  for (this.clear(); ++e < t; ) {
    var i = n[e];
    this.set(i[0], i[1]);
  }
}
cr.prototype.clear = $A;
cr.prototype.delete = YA;
cr.prototype.get = JA;
cr.prototype.has = KA;
cr.prototype.set = qA;
var Na = Ds(Bi, "Map");
function QA() {
  this.size = 0, this.__data__ = {
    hash: new _s(),
    map: new (Na || cr)(),
    string: new _s()
  };
}
function eS(n) {
  var e = typeof n;
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? n !== "__proto__" : n === null;
}
function qc(n, e) {
  var t = n.__data__;
  return eS(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
}
function tS(n) {
  var e = qc(this, n).delete(n);
  return this.size -= e ? 1 : 0, e;
}
function nS(n) {
  return qc(this, n).get(n);
}
function iS(n) {
  return qc(this, n).has(n);
}
function rS(n, e) {
  var t = qc(this, n), i = t.size;
  return t.set(n, e), this.size += t.size == i ? 0 : 1, this;
}
function ur(n) {
  var e = -1, t = n == null ? 0 : n.length;
  for (this.clear(); ++e < t; ) {
    var i = n[e];
    this.set(i[0], i[1]);
  }
}
ur.prototype.clear = QA;
ur.prototype.delete = tS;
ur.prototype.get = nS;
ur.prototype.has = iS;
ur.prototype.set = rS;
var sS = "Expected a function";
function $d(n, e) {
  if (typeof n != "function" || e != null && typeof e != "function")
    throw new TypeError(sS);
  var t = function() {
    var i = arguments, r = e ? e.apply(this, i) : i[0], s = t.cache;
    if (s.has(r))
      return s.get(r);
    var o = n.apply(this, i);
    return t.cache = s.set(r, o) || s, o;
  };
  return t.cache = new ($d.Cache || ur)(), t;
}
$d.Cache = ur;
var oS = 500;
function aS(n) {
  var e = $d(n, function(i) {
    return t.size === oS && t.clear(), i;
  }), t = e.cache;
  return e;
}
var lS = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, cS = /\\(\\)?/g, uS = aS(function(n) {
  var e = [];
  return n.charCodeAt(0) === 46 && e.push(""), n.replace(lS, function(t, i, r, s) {
    e.push(r ? s.replace(cS, "$1") : i || t);
  }), e;
});
function hS(n) {
  return n == null ? "" : Xv(n);
}
function Qc(n, e) {
  return pi(n) ? n : jd(n, e) ? [n] : uS(hS(n));
}
var dS = 1 / 0;
function nl(n) {
  if (typeof n == "string" || Jc(n))
    return n;
  var e = n + "";
  return e == "0" && 1 / n == -dS ? "-0" : e;
}
function Zd(n, e) {
  e = Qc(e, n);
  for (var t = 0, i = e.length; n != null && t < i; )
    n = n[nl(e[t++])];
  return t && t == i ? n : void 0;
}
function Ki(n, e, t) {
  var i = n == null ? void 0 : Zd(n, e);
  return i === void 0 ? t : i;
}
function n0(n, e) {
  for (var t = -1, i = e.length, r = n.length; ++t < i; )
    n[r + t] = e[t];
  return n;
}
var Wp = Pi ? Pi.isConcatSpreadable : void 0;
function fS(n) {
  return pi(n) || Wd(n) || !!(Wp && n && n[Wp]);
}
function pS(n, e, t, i, r) {
  var s = -1, o = n.length;
  for (t || (t = fS), r || (r = []); ++s < o; ) {
    var a = n[s];
    t(a) ? n0(r, a) : r[r.length] = a;
  }
  return r;
}
function mS(n) {
  var e = n == null ? 0 : n.length;
  return e ? pS(n) : [];
}
function gS(n) {
  return P1(k1(n, void 0, mS), n + "");
}
function Si() {
  if (!arguments.length)
    return [];
  var n = arguments[0];
  return pi(n) ? n : [n];
}
function vS() {
  this.__data__ = new cr(), this.size = 0;
}
function yS(n) {
  var e = this.__data__, t = e.delete(n);
  return this.size = e.size, t;
}
function bS(n) {
  return this.__data__.get(n);
}
function xS(n) {
  return this.__data__.has(n);
}
var MS = 200;
function wS(n, e) {
  var t = this.__data__;
  if (t instanceof cr) {
    var i = t.__data__;
    if (!Na || i.length < MS - 1)
      return i.push([n, e]), this.size = ++t.size, this;
    t = this.__data__ = new ur(i);
  }
  return t.set(n, e), this.size = t.size, this;
}
function tr(n) {
  var e = this.__data__ = new cr(n);
  this.size = e.size;
}
tr.prototype.clear = vS;
tr.prototype.delete = yS;
tr.prototype.get = bS;
tr.prototype.has = xS;
tr.prototype.set = wS;
function AS(n, e) {
  for (var t = -1, i = n == null ? 0 : n.length, r = 0, s = []; ++t < i; ) {
    var o = n[t];
    e(o, t, n) && (s[r++] = o);
  }
  return s;
}
function SS() {
  return [];
}
var _S = Object.prototype, TS = _S.propertyIsEnumerable, jp = Object.getOwnPropertySymbols, ES = jp ? function(n) {
  return n == null ? [] : (n = Object(n), AS(jp(n), function(e) {
    return TS.call(n, e);
  }));
} : SS;
function CS(n, e, t) {
  var i = e(n);
  return pi(n) ? i : n0(i, t(n));
}
function $p(n) {
  return CS(n, t0, ES);
}
var Gh = Ds(Bi, "DataView"), Hh = Ds(Bi, "Promise"), Wh = Ds(Bi, "Set"), Zp = "[object Map]", LS = "[object Object]", Xp = "[object Promise]", Yp = "[object Set]", Jp = "[object WeakMap]", Kp = "[object DataView]", RS = Os(Gh), FS = Os(Na), PS = Os(Hh), IS = Os(Wh), OS = Os(kh), Cr = Zo;
(Gh && Cr(new Gh(new ArrayBuffer(1))) != Kp || Na && Cr(new Na()) != Zp || Hh && Cr(Hh.resolve()) != Xp || Wh && Cr(new Wh()) != Yp || kh && Cr(new kh()) != Jp) && (Cr = function(n) {
  var e = Zo(n), t = e == LS ? n.constructor : void 0, i = t ? Os(t) : "";
  if (i)
    switch (i) {
      case RS:
        return Kp;
      case FS:
        return Zp;
      case PS:
        return Xp;
      case IS:
        return Yp;
      case OS:
        return Jp;
    }
  return e;
});
var qp = Bi.Uint8Array, DS = "__lodash_hash_undefined__";
function NS(n) {
  return this.__data__.set(n, DS), this;
}
function BS(n) {
  return this.__data__.has(n);
}
function Pc(n) {
  var e = -1, t = n == null ? 0 : n.length;
  for (this.__data__ = new ur(); ++e < t; )
    this.add(n[e]);
}
Pc.prototype.add = Pc.prototype.push = NS;
Pc.prototype.has = BS;
function US(n, e) {
  for (var t = -1, i = n == null ? 0 : n.length; ++t < i; )
    if (e(n[t], t, n))
      return !0;
  return !1;
}
function zS(n, e) {
  return n.has(e);
}
var kS = 1, VS = 2;
function i0(n, e, t, i, r, s) {
  var o = t & kS, a = n.length, c = e.length;
  if (a != c && !(o && c > a))
    return !1;
  var l = s.get(n), d = s.get(e);
  if (l && d)
    return l == e && d == n;
  var h = -1, f = !0, g = t & VS ? new Pc() : void 0;
  for (s.set(n, e), s.set(e, n); ++h < a; ) {
    var p = n[h], u = e[h];
    if (i)
      var y = o ? i(u, p, h, e, n, s) : i(p, u, h, n, e, s);
    if (y !== void 0) {
      if (y)
        continue;
      f = !1;
      break;
    }
    if (g) {
      if (!US(e, function(v, m) {
        if (!zS(g, m) && (p === v || r(p, v, t, i, s)))
          return g.push(m);
      })) {
        f = !1;
        break;
      }
    } else if (!(p === u || r(p, u, t, i, s))) {
      f = !1;
      break;
    }
  }
  return s.delete(n), s.delete(e), f;
}
function GS(n) {
  var e = -1, t = Array(n.size);
  return n.forEach(function(i, r) {
    t[++e] = [r, i];
  }), t;
}
function HS(n) {
  var e = -1, t = Array(n.size);
  return n.forEach(function(i) {
    t[++e] = i;
  }), t;
}
var WS = 1, jS = 2, $S = "[object Boolean]", ZS = "[object Date]", XS = "[object Error]", YS = "[object Map]", JS = "[object Number]", KS = "[object RegExp]", qS = "[object Set]", QS = "[object String]", e_ = "[object Symbol]", t_ = "[object ArrayBuffer]", n_ = "[object DataView]", Qp = Pi ? Pi.prototype : void 0, Du = Qp ? Qp.valueOf : void 0;
function i_(n, e, t, i, r, s, o) {
  switch (t) {
    case n_:
      if (n.byteLength != e.byteLength || n.byteOffset != e.byteOffset)
        return !1;
      n = n.buffer, e = e.buffer;
    case t_:
      return !(n.byteLength != e.byteLength || !s(new qp(n), new qp(e)));
    case $S:
    case ZS:
    case JS:
      return Gd(+n, +e);
    case XS:
      return n.name == e.name && n.message == e.message;
    case KS:
    case QS:
      return n == e + "";
    case YS:
      var a = GS;
    case qS:
      var c = i & WS;
      if (a || (a = HS), n.size != e.size && !c)
        return !1;
      var l = o.get(n);
      if (l)
        return l == e;
      i |= jS, o.set(n, e);
      var d = i0(a(n), a(e), i, r, s, o);
      return o.delete(n), d;
    case e_:
      if (Du)
        return Du.call(n) == Du.call(e);
  }
  return !1;
}
var r_ = 1, s_ = Object.prototype, o_ = s_.hasOwnProperty;
function a_(n, e, t, i, r, s) {
  var o = t & r_, a = $p(n), c = a.length, l = $p(e), d = l.length;
  if (c != d && !o)
    return !1;
  for (var h = c; h--; ) {
    var f = a[h];
    if (!(o ? f in e : o_.call(e, f)))
      return !1;
  }
  var g = s.get(n), p = s.get(e);
  if (g && p)
    return g == e && p == n;
  var u = !0;
  s.set(n, e), s.set(e, n);
  for (var y = o; ++h < c; ) {
    f = a[h];
    var v = n[f], m = e[f];
    if (i)
      var x = o ? i(m, v, f, e, n, s) : i(v, m, f, n, e, s);
    if (!(x === void 0 ? v === m || r(v, m, t, i, s) : x)) {
      u = !1;
      break;
    }
    y || (y = f == "constructor");
  }
  if (u && !y) {
    var w = n.constructor, A = e.constructor;
    w != A && "constructor" in n && "constructor" in e && !(typeof w == "function" && w instanceof w && typeof A == "function" && A instanceof A) && (u = !1);
  }
  return s.delete(n), s.delete(e), u;
}
var l_ = 1, em = "[object Arguments]", tm = "[object Array]", _l = "[object Object]", c_ = Object.prototype, nm = c_.hasOwnProperty;
function u_(n, e, t, i, r, s) {
  var o = pi(n), a = pi(e), c = o ? tm : Cr(n), l = a ? tm : Cr(e);
  c = c == em ? _l : c, l = l == em ? _l : l;
  var d = c == _l, h = l == _l, f = c == l;
  if (f && Vh(n)) {
    if (!Vh(e))
      return !1;
    o = !0, d = !1;
  }
  if (f && !d)
    return s || (s = new tr()), o || e0(n) ? i0(n, e, t, i, r, s) : i_(n, e, c, t, i, r, s);
  if (!(t & l_)) {
    var g = d && nm.call(n, "__wrapped__"), p = h && nm.call(e, "__wrapped__");
    if (g || p) {
      var u = g ? n.value() : n, y = p ? e.value() : e;
      return s || (s = new tr()), r(u, y, t, i, s);
    }
  }
  return f ? (s || (s = new tr()), a_(n, e, t, i, r, s)) : !1;
}
function eu(n, e, t, i, r) {
  return n === e ? !0 : n == null || e == null || !Mo(n) && !Mo(e) ? n !== n && e !== e : u_(n, e, t, i, eu, r);
}
var h_ = 1, d_ = 2;
function f_(n, e, t, i) {
  var r = t.length, s = r;
  if (n == null)
    return !s;
  for (n = Object(n); r--; ) {
    var o = t[r];
    if (o[2] ? o[1] !== n[o[0]] : !(o[0] in n))
      return !1;
  }
  for (; ++r < s; ) {
    o = t[r];
    var a = o[0], c = n[a], l = o[1];
    if (o[2]) {
      if (c === void 0 && !(a in n))
        return !1;
    } else {
      var d = new tr(), h;
      if (!(h === void 0 ? eu(l, c, h_ | d_, i, d) : h))
        return !1;
    }
  }
  return !0;
}
function r0(n) {
  return n === n && !Ur(n);
}
function p_(n) {
  for (var e = t0(n), t = e.length; t--; ) {
    var i = e[t], r = n[i];
    e[t] = [i, r, r0(r)];
  }
  return e;
}
function s0(n, e) {
  return function(t) {
    return t == null ? !1 : t[n] === e && (e !== void 0 || n in Object(t));
  };
}
function m_(n) {
  var e = p_(n);
  return e.length == 1 && e[0][2] ? s0(e[0][0], e[0][1]) : function(t) {
    return t === n || f_(t, n, e);
  };
}
function g_(n, e) {
  return n != null && e in Object(n);
}
function v_(n, e, t) {
  e = Qc(e, n);
  for (var i = -1, r = e.length, s = !1; ++i < r; ) {
    var o = nl(e[i]);
    if (!(s = n != null && t(n, o)))
      break;
    n = n[o];
  }
  return s || ++i != r ? s : (r = n == null ? 0 : n.length, !!r && Hd(r) && Vd(o, r) && (pi(n) || Wd(n)));
}
function o0(n, e) {
  return n != null && v_(n, e, g_);
}
var y_ = 1, b_ = 2;
function x_(n, e) {
  return jd(n) && r0(e) ? s0(nl(n), e) : function(t) {
    var i = Ki(t, n);
    return i === void 0 && i === e ? o0(t, n) : eu(e, i, y_ | b_);
  };
}
function M_(n) {
  return function(e) {
    return e == null ? void 0 : e[n];
  };
}
function w_(n) {
  return function(e) {
    return Zd(e, n);
  };
}
function A_(n) {
  return jd(n) ? M_(nl(n)) : w_(n);
}
function S_(n) {
  return typeof n == "function" ? n : n == null ? Yv : typeof n == "object" ? pi(n) ? x_(n[0], n[1]) : m_(n) : A_(n);
}
var Nu = function() {
  return Bi.Date.now();
}, __ = "Expected a function", T_ = Math.max, E_ = Math.min;
function jh(n, e, t) {
  var i, r, s, o, a, c, l = 0, d = !1, h = !1, f = !0;
  if (typeof n != "function")
    throw new TypeError(__);
  e = Np(e) || 0, Ur(t) && (d = !!t.leading, h = "maxWait" in t, s = h ? T_(Np(t.maxWait) || 0, e) : s, f = "trailing" in t ? !!t.trailing : f);
  function g(M) {
    var R = i, L = r;
    return i = r = void 0, l = M, o = n.apply(L, R), o;
  }
  function p(M) {
    return l = M, a = setTimeout(v, e), d ? g(M) : o;
  }
  function u(M) {
    var R = M - c, L = M - l, _ = e - R;
    return h ? E_(_, s - L) : _;
  }
  function y(M) {
    var R = M - c, L = M - l;
    return c === void 0 || R >= e || R < 0 || h && L >= s;
  }
  function v() {
    var M = Nu();
    if (y(M))
      return m(M);
    a = setTimeout(v, u(M));
  }
  function m(M) {
    return a = void 0, f && i ? g(M) : (i = r = void 0, o);
  }
  function x() {
    a !== void 0 && clearTimeout(a), l = 0, i = c = r = a = void 0;
  }
  function w() {
    return a === void 0 ? o : m(Nu());
  }
  function A() {
    var M = Nu(), R = y(M);
    if (i = arguments, r = this, c = M, R) {
      if (a === void 0)
        return p(c);
      if (h)
        return clearTimeout(a), a = setTimeout(v, e), g(c);
    }
    return a === void 0 && (a = setTimeout(v, e)), o;
  }
  return A.cancel = x, A.flush = w, A;
}
function C_(n, e, t) {
  var i = n == null ? 0 : n.length;
  if (!i)
    return -1;
  var r = i - 1;
  return I1(n, S_(e), r);
}
function Ic(n) {
  for (var e = -1, t = n == null ? 0 : n.length, i = {}; ++e < t; ) {
    var r = n[e];
    i[r[0]] = r[1];
  }
  return i;
}
function $h(n, e) {
  return eu(n, e);
}
function Ci(n) {
  return n == null;
}
function L_(n) {
  return n === void 0;
}
function R_(n, e, t, i) {
  if (!Ur(n))
    return n;
  e = Qc(e, n);
  for (var r = -1, s = e.length, o = s - 1, a = n; a != null && ++r < s; ) {
    var c = nl(e[r]), l = t;
    if (c === "__proto__" || c === "constructor" || c === "prototype")
      return n;
    if (r != o) {
      var d = a[c];
      l = void 0, l === void 0 && (l = Ur(d) ? d : Vd(e[r + 1]) ? [] : {});
    }
    z1(a, c, l), a = a[c];
  }
  return n;
}
function F_(n, e, t) {
  for (var i = -1, r = e.length, s = {}; ++i < r; ) {
    var o = e[i], a = Zd(n, o);
    t(a, o) && R_(s, Qc(o, n), a);
  }
  return s;
}
function P_(n, e) {
  return F_(n, e, function(t, i) {
    return o0(n, i);
  });
}
var I_ = gS(function(n, e) {
  return n == null ? {} : P_(n, e);
});
const di = (n) => n === void 0, Ba = (n) => typeof n == "boolean", yt = (n) => typeof n == "number", ys = (n) => typeof Element > "u" ? !1 : n instanceof Element, im = (n) => Ci(n), O_ = (n) => vn(n) ? !Number.isNaN(Number(n)) : !1, D_ = (n = "") => n.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), Rr = (n) => Gw(n), rm = (n) => Object.keys(n);
class a0 extends Error {
  constructor(e) {
    super(e), this.name = "ElementPlusError";
  }
}
function Xo(n, e) {
  throw new a0(`[${n}] ${e}`);
}
function kt(n, e) {
  if (process.env.NODE_ENV !== "production") {
    const t = vn(n) ? new a0(`[${n}] ${e}`) : n;
    console.warn(t);
  }
}
const N_ = "utils/dom/style", l0 = (n = "") => n.split(" ").filter((e) => !!e.trim()), sm = (n, e) => {
  !n || !e.trim() || n.classList.add(...l0(e));
}, Oc = (n, e) => {
  !n || !e.trim() || n.classList.remove(...l0(e));
}, ca = (n, e) => {
  var t;
  if (!en || !n || !e)
    return "";
  let i = zw(e);
  i === "float" && (i = "cssFloat");
  try {
    const r = n.style[i];
    if (r)
      return r;
    const s = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(n, "");
    return s ? s[i] : "";
  } catch {
    return n.style[i];
  }
};
function Dc(n, e = "px") {
  if (!n)
    return "";
  if (yt(n) || O_(n))
    return `${n}${e}`;
  if (vn(n))
    return n;
  kt(N_, "binding value must be a string or number");
}
function B_(n, e) {
  if (!en)
    return;
  if (!e) {
    n.scrollTop = 0;
    return;
  }
  const t = [];
  let i = e.offsetParent;
  for (; i !== null && n !== i && n.contains(i); )
    t.push(i), i = i.offsetParent;
  const r = e.offsetTop + t.reduce((c, l) => c + l.offsetTop, 0), s = r + e.offsetHeight, o = n.scrollTop, a = o + n.clientHeight;
  r < o ? n.scrollTop = r : s > a && (n.scrollTop = s - n.clientHeight);
}
/*! Element Plus Icons Vue v2.3.1 */
var U_ = /* @__PURE__ */ Pe({
  name: "ArrowDown",
  __name: "arrow-down",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
      })
    ]));
  }
}), Xd = U_, z_ = /* @__PURE__ */ Pe({
  name: "ArrowLeft",
  __name: "arrow-left",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
      })
    ]));
  }
}), zr = z_, k_ = /* @__PURE__ */ Pe({
  name: "ArrowRight",
  __name: "arrow-right",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
      })
    ]));
  }
}), kr = k_, V_ = /* @__PURE__ */ Pe({
  name: "ArrowUp",
  __name: "arrow-up",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
      })
    ]));
  }
}), G_ = V_, H_ = /* @__PURE__ */ Pe({
  name: "CircleCheck",
  __name: "circle-check",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
      }),
      Ne("path", {
        fill: "currentColor",
        d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
      })
    ]));
  }
}), W_ = H_, j_ = /* @__PURE__ */ Pe({
  name: "CircleClose",
  __name: "circle-close",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
      }),
      Ne("path", {
        fill: "currentColor",
        d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
      })
    ]));
  }
}), Yd = j_, $_ = /* @__PURE__ */ Pe({
  name: "Close",
  __name: "close",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
      })
    ]));
  }
}), Zh = $_, Z_ = /* @__PURE__ */ Pe({
  name: "Delete",
  __name: "delete",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
      })
    ]));
  }
}), Nc = Z_, X_ = /* @__PURE__ */ Pe({
  name: "Hide",
  __name: "hide",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
      }),
      Ne("path", {
        fill: "currentColor",
        d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
      })
    ]));
  }
}), Y_ = X_, J_ = /* @__PURE__ */ Pe({
  name: "Loading",
  __name: "loading",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
      })
    ]));
  }
}), c0 = J_, K_ = /* @__PURE__ */ Pe({
  name: "Minus",
  __name: "minus",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
      })
    ]));
  }
}), q_ = K_, Q_ = /* @__PURE__ */ Pe({
  name: "Plus",
  __name: "plus",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
      })
    ]));
  }
}), tu = Q_, eT = /* @__PURE__ */ Pe({
  name: "View",
  __name: "view",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
      })
    ]));
  }
}), tT = eT, nT = /* @__PURE__ */ Pe({
  name: "WarningFilled",
  __name: "warning-filled",
  setup(n) {
    return (e, t) => (ve(), Ce("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      Ne("path", {
        fill: "currentColor",
        d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
      })
    ]));
  }
}), u0 = nT;
const h0 = "__epPropKey", Je = (n) => n, iT = (n) => Tn(n) && !!n[h0], nu = (n, e) => {
  if (!Tn(n) || iT(n))
    return n;
  const { values: t, required: i, default: r, type: s, validator: o } = n, c = {
    type: s,
    required: !!i,
    validator: t || o ? (l) => {
      let d = !1, h = [];
      if (t && (h = Array.from(t), Fp(n, "default") && h.push(r), d || (d = h.includes(l))), o && (d || (d = o(l))), !d && h.length > 0) {
        const f = [...new Set(h)].map((g) => JSON.stringify(g)).join(", ");
        zM(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${f}], got value ${JSON.stringify(l)}.`);
      }
      return d;
    } : void 0,
    [h0]: !0
  };
  return Fp(n, "default") && (c.default = r), c;
}, at = (n) => Ic(Object.entries(n).map(([e, t]) => [
  e,
  nu(t, e)
])), Vr = Je([
  String,
  Object,
  Function
]), d0 = {
  validating: c0,
  success: W_,
  error: Yd
}, on = (n, e) => {
  if (n.install = (t) => {
    for (const i of [n, ...Object.values(e ?? {})])
      t.component(i.name, i);
  }, e)
    for (const [t, i] of Object.entries(e))
      n[t] = i;
  return n;
}, rT = (n, e) => (n.install = (t) => {
  t.directive(e, n);
}, n), vi = (n) => (n.install = Oa, n), Li = {
  tab: "Tab",
  enter: "Enter",
  space: "Space",
  left: "ArrowLeft",
  up: "ArrowUp",
  right: "ArrowRight",
  down: "ArrowDown",
  esc: "Escape",
  delete: "Delete",
  backspace: "Backspace",
  numpadEnter: "NumpadEnter",
  pageUp: "PageUp",
  pageDown: "PageDown",
  home: "Home",
  end: "End"
}, At = "update:modelValue", hr = "change", bs = "input", f0 = ["", "default", "small", "large"], Sc = (n) => {
  const e = Pn(n) ? n : [n], t = [];
  return e.forEach((i) => {
    var r;
    Pn(i) ? t.push(...Sc(i)) : Uh(i) && Pn(i.children) ? t.push(...Sc(i.children)) : (t.push(i), Uh(i) && ((r = i.component) != null && r.subTree) && t.push(...Sc(i.component.subTree)));
  }), t;
}, sT = (n) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(n), qi = (n) => n, oT = ["class", "style"], aT = /^on[A-Z]/, lT = (n = {}) => {
  const { excludeListeners: e = !1, excludeKeys: t } = n, i = ue(() => ((t == null ? void 0 : t.value) || []).concat(oT)), r = dn();
  return r ? ue(() => {
    var s;
    return Ic(Object.entries((s = r.proxy) == null ? void 0 : s.$attrs).filter(([o]) => !i.value.includes(o) && !(e && aT.test(o))));
  }) : (kt("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), ue(() => ({})));
}, p0 = ({ from: n, replacement: e, scope: t, version: i, ref: r, type: s = "API" }, o) => {
  Qe(() => z(o), (a) => {
    a && kt(t, `[${s}] ${n} is about to be deprecated in version ${i}, please use ${e} instead.
For more detail, please visit: ${r}
`);
  }, {
    immediate: !0
  });
};
var cT = {
  name: "en",
  el: {
    breadcrumb: {
      label: "Breadcrumb"
    },
    colorpicker: {
      confirm: "OK",
      clear: "Clear",
      defaultLabel: "color picker",
      description: "current color is {color}. press enter to select a new color.",
      alphaLabel: "pick alpha value"
    },
    datepicker: {
      now: "Now",
      today: "Today",
      cancel: "Cancel",
      clear: "Clear",
      confirm: "OK",
      dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
      monthTablePrompt: "Use the arrow keys and enter to select the month",
      yearTablePrompt: "Use the arrow keys and enter to select the year",
      selectedDate: "Selected date",
      selectDate: "Select date",
      selectTime: "Select time",
      startDate: "Start Date",
      startTime: "Start Time",
      endDate: "End Date",
      endTime: "End Time",
      prevYear: "Previous Year",
      nextYear: "Next Year",
      prevMonth: "Previous Month",
      nextMonth: "Next Month",
      year: "",
      month1: "January",
      month2: "February",
      month3: "March",
      month4: "April",
      month5: "May",
      month6: "June",
      month7: "July",
      month8: "August",
      month9: "September",
      month10: "October",
      month11: "November",
      month12: "December",
      week: "week",
      weeks: {
        sun: "Sun",
        mon: "Mon",
        tue: "Tue",
        wed: "Wed",
        thu: "Thu",
        fri: "Fri",
        sat: "Sat"
      },
      weeksFull: {
        sun: "Sunday",
        mon: "Monday",
        tue: "Tuesday",
        wed: "Wednesday",
        thu: "Thursday",
        fri: "Friday",
        sat: "Saturday"
      },
      months: {
        jan: "Jan",
        feb: "Feb",
        mar: "Mar",
        apr: "Apr",
        may: "May",
        jun: "Jun",
        jul: "Jul",
        aug: "Aug",
        sep: "Sep",
        oct: "Oct",
        nov: "Nov",
        dec: "Dec"
      }
    },
    inputNumber: {
      decrease: "decrease number",
      increase: "increase number"
    },
    select: {
      loading: "Loading",
      noMatch: "No matching data",
      noData: "No data",
      placeholder: "Select"
    },
    mention: {
      loading: "Loading"
    },
    dropdown: {
      toggleDropdown: "Toggle Dropdown"
    },
    cascader: {
      noMatch: "No matching data",
      loading: "Loading",
      placeholder: "Select",
      noData: "No data"
    },
    pagination: {
      goto: "Go to",
      pagesize: "/page",
      total: "Total {total}",
      pageClassifier: "",
      page: "Page",
      prev: "Go to previous page",
      next: "Go to next page",
      currentPage: "page {pager}",
      prevPages: "Previous {pager} pages",
      nextPages: "Next {pager} pages",
      deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
    },
    dialog: {
      close: "Close this dialog"
    },
    drawer: {
      close: "Close this dialog"
    },
    messagebox: {
      title: "Message",
      confirm: "OK",
      cancel: "Cancel",
      error: "Illegal input",
      close: "Close this dialog"
    },
    upload: {
      deleteTip: "press delete to remove",
      delete: "Delete",
      preview: "Preview",
      continue: "Continue"
    },
    slider: {
      defaultLabel: "slider between {min} and {max}",
      defaultRangeStartLabel: "pick start value",
      defaultRangeEndLabel: "pick end value"
    },
    table: {
      emptyText: "No Data",
      confirmFilter: "Confirm",
      resetFilter: "Reset",
      clearFilter: "All",
      sumText: "Sum"
    },
    tour: {
      next: "Next",
      previous: "Previous",
      finish: "Finish"
    },
    tree: {
      emptyText: "No Data"
    },
    transfer: {
      noMatch: "No matching data",
      noData: "No data",
      titles: ["List 1", "List 2"],
      filterPlaceholder: "Enter keyword",
      noCheckedFormat: "{total} items",
      hasCheckedFormat: "{checked}/{total} checked"
    },
    image: {
      error: "FAILED"
    },
    pageHeader: {
      title: "Back"
    },
    popconfirm: {
      confirmButtonText: "Yes",
      cancelButtonText: "No"
    },
    carousel: {
      leftArrow: "Carousel arrow left",
      rightArrow: "Carousel arrow right",
      indicator: "Carousel switch to index {index}"
    }
  }
};
const uT = (n) => (e, t) => hT(e, t, z(n)), hT = (n, e, t) => Ki(t, n, n).replace(/\{(\w+)\}/g, (i, r) => {
  var s;
  return `${(s = e == null ? void 0 : e[r]) != null ? s : `{${r}}`}`;
}), dT = (n) => {
  const e = ue(() => z(n).name), t = Zc(n) ? n : Ee(n);
  return {
    lang: e,
    locale: t,
    t: uT(n)
  };
}, m0 = Symbol("localeContextKey"), iu = (n) => {
  const e = n || pt(m0, Ee());
  return dT(ue(() => e.value || cT));
}, _c = "el", fT = "is-", rs = (n, e, t, i, r) => {
  let s = `${n}-${e}`;
  return t && (s += `-${t}`), i && (s += `__${i}`), r && (s += `--${r}`), s;
}, g0 = Symbol("namespaceContextKey"), Jd = (n) => {
  const e = n || (dn() ? pt(g0, Ee(_c)) : Ee(_c));
  return ue(() => z(e) || _c);
}, nt = (n, e) => {
  const t = Jd(e);
  return {
    namespace: t,
    b: (u = "") => rs(t.value, n, u, "", ""),
    e: (u) => u ? rs(t.value, n, "", u, "") : "",
    m: (u) => u ? rs(t.value, n, "", "", u) : "",
    be: (u, y) => u && y ? rs(t.value, n, u, y, "") : "",
    em: (u, y) => u && y ? rs(t.value, n, "", u, y) : "",
    bm: (u, y) => u && y ? rs(t.value, n, u, "", y) : "",
    bem: (u, y, v) => u && y && v ? rs(t.value, n, u, y, v) : "",
    is: (u, ...y) => {
      const v = y.length >= 1 ? y[0] : !0;
      return u && v ? `${fT}${u}` : "";
    },
    cssVar: (u) => {
      const y = {};
      for (const v in u)
        u[v] && (y[`--${t.value}-${v}`] = u[v]);
      return y;
    },
    cssVarName: (u) => `--${t.value}-${u}`,
    cssVarBlock: (u) => {
      const y = {};
      for (const v in u)
        u[v] && (y[`--${t.value}-${n}-${v}`] = u[v]);
      return y;
    },
    cssVarBlockName: (u) => `--${t.value}-${n}-${u}`
  };
}, pT = nu({
  type: Je(Boolean),
  default: null
}), mT = nu({
  type: Je(Function)
}), gT = (n) => {
  const e = `update:${n}`, t = `onUpdate:${n}`, i = [e], r = {
    [n]: pT,
    [t]: mT
  };
  return {
    useModelToggle: ({
      indicator: o,
      toggleReason: a,
      shouldHideWhenRouteChanges: c,
      shouldProceed: l,
      onShow: d,
      onHide: h
    }) => {
      const f = dn(), { emit: g } = f, p = f.props, u = ue(() => Sn(p[t])), y = ue(() => p[n] === null), v = (R) => {
        o.value !== !0 && (o.value = !0, a && (a.value = R), Sn(d) && d(R));
      }, m = (R) => {
        o.value !== !1 && (o.value = !1, a && (a.value = R), Sn(h) && h(R));
      }, x = (R) => {
        if (p.disabled === !0 || Sn(l) && !l())
          return;
        const L = u.value && en;
        L && g(e, !0), (y.value || !L) && v(R);
      }, w = (R) => {
        if (p.disabled === !0 || !en)
          return;
        const L = u.value && en;
        L && g(e, !1), (y.value || !L) && m(R);
      }, A = (R) => {
        Ba(R) && (p.disabled && R ? u.value && g(e, !1) : o.value !== R && (R ? v() : m()));
      }, M = () => {
        o.value ? w() : x();
      };
      return Qe(() => p[n], A), c && f.appContext.config.globalProperties.$route !== void 0 && Qe(() => ({
        ...f.proxy.$route
      }), () => {
        c.value && o.value && w();
      }), Jt(() => {
        A(p[n]);
      }), {
        hide: w,
        show: x,
        toggle: M,
        hasUpdateHandler: u
      };
    },
    useModelToggleProps: r,
    useModelToggleEmits: i
  };
}, v0 = (n) => {
  const e = dn();
  return ue(() => {
    var t, i;
    return (i = (t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$props) == null ? void 0 : i[n];
  });
};
var On = "top", qn = "bottom", Qn = "right", Dn = "left", Kd = "auto", il = [On, qn, Qn, Dn], wo = "start", Ua = "end", vT = "clippingParents", y0 = "viewport", ua = "popper", yT = "reference", om = il.reduce(function(n, e) {
  return n.concat([e + "-" + wo, e + "-" + Ua]);
}, []), Yo = [].concat(il, [Kd]).reduce(function(n, e) {
  return n.concat([e, e + "-" + wo, e + "-" + Ua]);
}, []), bT = "beforeRead", xT = "read", MT = "afterRead", wT = "beforeMain", AT = "main", ST = "afterMain", _T = "beforeWrite", TT = "write", ET = "afterWrite", CT = [bT, xT, MT, wT, AT, ST, _T, TT, ET];
function Ii(n) {
  return n ? (n.nodeName || "").toLowerCase() : null;
}
function yi(n) {
  if (n == null) return window;
  if (n.toString() !== "[object Window]") {
    var e = n.ownerDocument;
    return e && e.defaultView || window;
  }
  return n;
}
function Ao(n) {
  var e = yi(n).Element;
  return n instanceof e || n instanceof Element;
}
function Kn(n) {
  var e = yi(n).HTMLElement;
  return n instanceof e || n instanceof HTMLElement;
}
function qd(n) {
  if (typeof ShadowRoot > "u") return !1;
  var e = yi(n).ShadowRoot;
  return n instanceof e || n instanceof ShadowRoot;
}
function LT(n) {
  var e = n.state;
  Object.keys(e.elements).forEach(function(t) {
    var i = e.styles[t] || {}, r = e.attributes[t] || {}, s = e.elements[t];
    !Kn(s) || !Ii(s) || (Object.assign(s.style, i), Object.keys(r).forEach(function(o) {
      var a = r[o];
      a === !1 ? s.removeAttribute(o) : s.setAttribute(o, a === !0 ? "" : a);
    }));
  });
}
function RT(n) {
  var e = n.state, t = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  return Object.assign(e.elements.popper.style, t.popper), e.styles = t, e.elements.arrow && Object.assign(e.elements.arrow.style, t.arrow), function() {
    Object.keys(e.elements).forEach(function(i) {
      var r = e.elements[i], s = e.attributes[i] || {}, o = Object.keys(e.styles.hasOwnProperty(i) ? e.styles[i] : t[i]), a = o.reduce(function(c, l) {
        return c[l] = "", c;
      }, {});
      !Kn(r) || !Ii(r) || (Object.assign(r.style, a), Object.keys(s).forEach(function(c) {
        r.removeAttribute(c);
      }));
    });
  };
}
var b0 = { name: "applyStyles", enabled: !0, phase: "write", fn: LT, effect: RT, requires: ["computeStyles"] };
function Ri(n) {
  return n.split("-")[0];
}
var xs = Math.max, Bc = Math.min, So = Math.round;
function _o(n, e) {
  e === void 0 && (e = !1);
  var t = n.getBoundingClientRect(), i = 1, r = 1;
  if (Kn(n) && e) {
    var s = n.offsetHeight, o = n.offsetWidth;
    o > 0 && (i = So(t.width) / o || 1), s > 0 && (r = So(t.height) / s || 1);
  }
  return { width: t.width / i, height: t.height / r, top: t.top / r, right: t.right / i, bottom: t.bottom / r, left: t.left / i, x: t.left / i, y: t.top / r };
}
function Qd(n) {
  var e = _o(n), t = n.offsetWidth, i = n.offsetHeight;
  return Math.abs(e.width - t) <= 1 && (t = e.width), Math.abs(e.height - i) <= 1 && (i = e.height), { x: n.offsetLeft, y: n.offsetTop, width: t, height: i };
}
function x0(n, e) {
  var t = e.getRootNode && e.getRootNode();
  if (n.contains(e)) return !0;
  if (t && qd(t)) {
    var i = e;
    do {
      if (i && n.isSameNode(i)) return !0;
      i = i.parentNode || i.host;
    } while (i);
  }
  return !1;
}
function sr(n) {
  return yi(n).getComputedStyle(n);
}
function FT(n) {
  return ["table", "td", "th"].indexOf(Ii(n)) >= 0;
}
function Xr(n) {
  return ((Ao(n) ? n.ownerDocument : n.document) || window.document).documentElement;
}
function ru(n) {
  return Ii(n) === "html" ? n : n.assignedSlot || n.parentNode || (qd(n) ? n.host : null) || Xr(n);
}
function am(n) {
  return !Kn(n) || sr(n).position === "fixed" ? null : n.offsetParent;
}
function PT(n) {
  var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1;
  if (t && Kn(n)) {
    var i = sr(n);
    if (i.position === "fixed") return null;
  }
  var r = ru(n);
  for (qd(r) && (r = r.host); Kn(r) && ["html", "body"].indexOf(Ii(r)) < 0; ) {
    var s = sr(r);
    if (s.transform !== "none" || s.perspective !== "none" || s.contain === "paint" || ["transform", "perspective"].indexOf(s.willChange) !== -1 || e && s.willChange === "filter" || e && s.filter && s.filter !== "none") return r;
    r = r.parentNode;
  }
  return null;
}
function rl(n) {
  for (var e = yi(n), t = am(n); t && FT(t) && sr(t).position === "static"; ) t = am(t);
  return t && (Ii(t) === "html" || Ii(t) === "body" && sr(t).position === "static") ? e : t || PT(n) || e;
}
function ef(n) {
  return ["top", "bottom"].indexOf(n) >= 0 ? "x" : "y";
}
function Ca(n, e, t) {
  return xs(n, Bc(e, t));
}
function IT(n, e, t) {
  var i = Ca(n, e, t);
  return i > t ? t : i;
}
function M0() {
  return { top: 0, right: 0, bottom: 0, left: 0 };
}
function w0(n) {
  return Object.assign({}, M0(), n);
}
function A0(n, e) {
  return e.reduce(function(t, i) {
    return t[i] = n, t;
  }, {});
}
var OT = function(n, e) {
  return n = typeof n == "function" ? n(Object.assign({}, e.rects, { placement: e.placement })) : n, w0(typeof n != "number" ? n : A0(n, il));
};
function DT(n) {
  var e, t = n.state, i = n.name, r = n.options, s = t.elements.arrow, o = t.modifiersData.popperOffsets, a = Ri(t.placement), c = ef(a), l = [Dn, Qn].indexOf(a) >= 0, d = l ? "height" : "width";
  if (!(!s || !o)) {
    var h = OT(r.padding, t), f = Qd(s), g = c === "y" ? On : Dn, p = c === "y" ? qn : Qn, u = t.rects.reference[d] + t.rects.reference[c] - o[c] - t.rects.popper[d], y = o[c] - t.rects.reference[c], v = rl(s), m = v ? c === "y" ? v.clientHeight || 0 : v.clientWidth || 0 : 0, x = u / 2 - y / 2, w = h[g], A = m - f[d] - h[p], M = m / 2 - f[d] / 2 + x, R = Ca(w, M, A), L = c;
    t.modifiersData[i] = (e = {}, e[L] = R, e.centerOffset = R - M, e);
  }
}
function NT(n) {
  var e = n.state, t = n.options, i = t.element, r = i === void 0 ? "[data-popper-arrow]" : i;
  r != null && (typeof r == "string" && (r = e.elements.popper.querySelector(r), !r) || !x0(e.elements.popper, r) || (e.elements.arrow = r));
}
var BT = { name: "arrow", enabled: !0, phase: "main", fn: DT, effect: NT, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function To(n) {
  return n.split("-")[1];
}
var UT = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function zT(n) {
  var e = n.x, t = n.y, i = window, r = i.devicePixelRatio || 1;
  return { x: So(e * r) / r || 0, y: So(t * r) / r || 0 };
}
function lm(n) {
  var e, t = n.popper, i = n.popperRect, r = n.placement, s = n.variation, o = n.offsets, a = n.position, c = n.gpuAcceleration, l = n.adaptive, d = n.roundOffsets, h = n.isFixed, f = o.x, g = f === void 0 ? 0 : f, p = o.y, u = p === void 0 ? 0 : p, y = typeof d == "function" ? d({ x: g, y: u }) : { x: g, y: u };
  g = y.x, u = y.y;
  var v = o.hasOwnProperty("x"), m = o.hasOwnProperty("y"), x = Dn, w = On, A = window;
  if (l) {
    var M = rl(t), R = "clientHeight", L = "clientWidth";
    if (M === yi(t) && (M = Xr(t), sr(M).position !== "static" && a === "absolute" && (R = "scrollHeight", L = "scrollWidth")), M = M, r === On || (r === Dn || r === Qn) && s === Ua) {
      w = qn;
      var _ = h && M === A && A.visualViewport ? A.visualViewport.height : M[R];
      u -= _ - i.height, u *= c ? 1 : -1;
    }
    if (r === Dn || (r === On || r === qn) && s === Ua) {
      x = Qn;
      var F = h && M === A && A.visualViewport ? A.visualViewport.width : M[L];
      g -= F - i.width, g *= c ? 1 : -1;
    }
  }
  var S = Object.assign({ position: a }, l && UT), T = d === !0 ? zT({ x: g, y: u }) : { x: g, y: u };
  if (g = T.x, u = T.y, c) {
    var E;
    return Object.assign({}, S, (E = {}, E[w] = m ? "0" : "", E[x] = v ? "0" : "", E.transform = (A.devicePixelRatio || 1) <= 1 ? "translate(" + g + "px, " + u + "px)" : "translate3d(" + g + "px, " + u + "px, 0)", E));
  }
  return Object.assign({}, S, (e = {}, e[w] = m ? u + "px" : "", e[x] = v ? g + "px" : "", e.transform = "", e));
}
function kT(n) {
  var e = n.state, t = n.options, i = t.gpuAcceleration, r = i === void 0 ? !0 : i, s = t.adaptive, o = s === void 0 ? !0 : s, a = t.roundOffsets, c = a === void 0 ? !0 : a, l = { placement: Ri(e.placement), variation: To(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: r, isFixed: e.options.strategy === "fixed" };
  e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, lm(Object.assign({}, l, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: o, roundOffsets: c })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, lm(Object.assign({}, l, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: c })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var S0 = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: kT, data: {} }, Tl = { passive: !0 };
function VT(n) {
  var e = n.state, t = n.instance, i = n.options, r = i.scroll, s = r === void 0 ? !0 : r, o = i.resize, a = o === void 0 ? !0 : o, c = yi(e.elements.popper), l = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  return s && l.forEach(function(d) {
    d.addEventListener("scroll", t.update, Tl);
  }), a && c.addEventListener("resize", t.update, Tl), function() {
    s && l.forEach(function(d) {
      d.removeEventListener("scroll", t.update, Tl);
    }), a && c.removeEventListener("resize", t.update, Tl);
  };
}
var _0 = { name: "eventListeners", enabled: !0, phase: "write", fn: function() {
}, effect: VT, data: {} }, GT = { left: "right", right: "left", bottom: "top", top: "bottom" };
function Tc(n) {
  return n.replace(/left|right|bottom|top/g, function(e) {
    return GT[e];
  });
}
var HT = { start: "end", end: "start" };
function cm(n) {
  return n.replace(/start|end/g, function(e) {
    return HT[e];
  });
}
function tf(n) {
  var e = yi(n), t = e.pageXOffset, i = e.pageYOffset;
  return { scrollLeft: t, scrollTop: i };
}
function nf(n) {
  return _o(Xr(n)).left + tf(n).scrollLeft;
}
function WT(n) {
  var e = yi(n), t = Xr(n), i = e.visualViewport, r = t.clientWidth, s = t.clientHeight, o = 0, a = 0;
  return i && (r = i.width, s = i.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (o = i.offsetLeft, a = i.offsetTop)), { width: r, height: s, x: o + nf(n), y: a };
}
function jT(n) {
  var e, t = Xr(n), i = tf(n), r = (e = n.ownerDocument) == null ? void 0 : e.body, s = xs(t.scrollWidth, t.clientWidth, r ? r.scrollWidth : 0, r ? r.clientWidth : 0), o = xs(t.scrollHeight, t.clientHeight, r ? r.scrollHeight : 0, r ? r.clientHeight : 0), a = -i.scrollLeft + nf(n), c = -i.scrollTop;
  return sr(r || t).direction === "rtl" && (a += xs(t.clientWidth, r ? r.clientWidth : 0) - s), { width: s, height: o, x: a, y: c };
}
function rf(n) {
  var e = sr(n), t = e.overflow, i = e.overflowX, r = e.overflowY;
  return /auto|scroll|overlay|hidden/.test(t + r + i);
}
function T0(n) {
  return ["html", "body", "#document"].indexOf(Ii(n)) >= 0 ? n.ownerDocument.body : Kn(n) && rf(n) ? n : T0(ru(n));
}
function La(n, e) {
  var t;
  e === void 0 && (e = []);
  var i = T0(n), r = i === ((t = n.ownerDocument) == null ? void 0 : t.body), s = yi(i), o = r ? [s].concat(s.visualViewport || [], rf(i) ? i : []) : i, a = e.concat(o);
  return r ? a : a.concat(La(ru(o)));
}
function Xh(n) {
  return Object.assign({}, n, { left: n.x, top: n.y, right: n.x + n.width, bottom: n.y + n.height });
}
function $T(n) {
  var e = _o(n);
  return e.top = e.top + n.clientTop, e.left = e.left + n.clientLeft, e.bottom = e.top + n.clientHeight, e.right = e.left + n.clientWidth, e.width = n.clientWidth, e.height = n.clientHeight, e.x = e.left, e.y = e.top, e;
}
function um(n, e) {
  return e === y0 ? Xh(WT(n)) : Ao(e) ? $T(e) : Xh(jT(Xr(n)));
}
function ZT(n) {
  var e = La(ru(n)), t = ["absolute", "fixed"].indexOf(sr(n).position) >= 0, i = t && Kn(n) ? rl(n) : n;
  return Ao(i) ? e.filter(function(r) {
    return Ao(r) && x0(r, i) && Ii(r) !== "body";
  }) : [];
}
function XT(n, e, t) {
  var i = e === "clippingParents" ? ZT(n) : [].concat(e), r = [].concat(i, [t]), s = r[0], o = r.reduce(function(a, c) {
    var l = um(n, c);
    return a.top = xs(l.top, a.top), a.right = Bc(l.right, a.right), a.bottom = Bc(l.bottom, a.bottom), a.left = xs(l.left, a.left), a;
  }, um(n, s));
  return o.width = o.right - o.left, o.height = o.bottom - o.top, o.x = o.left, o.y = o.top, o;
}
function E0(n) {
  var e = n.reference, t = n.element, i = n.placement, r = i ? Ri(i) : null, s = i ? To(i) : null, o = e.x + e.width / 2 - t.width / 2, a = e.y + e.height / 2 - t.height / 2, c;
  switch (r) {
    case On:
      c = { x: o, y: e.y - t.height };
      break;
    case qn:
      c = { x: o, y: e.y + e.height };
      break;
    case Qn:
      c = { x: e.x + e.width, y: a };
      break;
    case Dn:
      c = { x: e.x - t.width, y: a };
      break;
    default:
      c = { x: e.x, y: e.y };
  }
  var l = r ? ef(r) : null;
  if (l != null) {
    var d = l === "y" ? "height" : "width";
    switch (s) {
      case wo:
        c[l] = c[l] - (e[d] / 2 - t[d] / 2);
        break;
      case Ua:
        c[l] = c[l] + (e[d] / 2 - t[d] / 2);
        break;
    }
  }
  return c;
}
function za(n, e) {
  e === void 0 && (e = {});
  var t = e, i = t.placement, r = i === void 0 ? n.placement : i, s = t.boundary, o = s === void 0 ? vT : s, a = t.rootBoundary, c = a === void 0 ? y0 : a, l = t.elementContext, d = l === void 0 ? ua : l, h = t.altBoundary, f = h === void 0 ? !1 : h, g = t.padding, p = g === void 0 ? 0 : g, u = w0(typeof p != "number" ? p : A0(p, il)), y = d === ua ? yT : ua, v = n.rects.popper, m = n.elements[f ? y : d], x = XT(Ao(m) ? m : m.contextElement || Xr(n.elements.popper), o, c), w = _o(n.elements.reference), A = E0({ reference: w, element: v, strategy: "absolute", placement: r }), M = Xh(Object.assign({}, v, A)), R = d === ua ? M : w, L = { top: x.top - R.top + u.top, bottom: R.bottom - x.bottom + u.bottom, left: x.left - R.left + u.left, right: R.right - x.right + u.right }, _ = n.modifiersData.offset;
  if (d === ua && _) {
    var F = _[r];
    Object.keys(L).forEach(function(S) {
      var T = [Qn, qn].indexOf(S) >= 0 ? 1 : -1, E = [On, qn].indexOf(S) >= 0 ? "y" : "x";
      L[S] += F[E] * T;
    });
  }
  return L;
}
function YT(n, e) {
  e === void 0 && (e = {});
  var t = e, i = t.placement, r = t.boundary, s = t.rootBoundary, o = t.padding, a = t.flipVariations, c = t.allowedAutoPlacements, l = c === void 0 ? Yo : c, d = To(i), h = d ? a ? om : om.filter(function(p) {
    return To(p) === d;
  }) : il, f = h.filter(function(p) {
    return l.indexOf(p) >= 0;
  });
  f.length === 0 && (f = h);
  var g = f.reduce(function(p, u) {
    return p[u] = za(n, { placement: u, boundary: r, rootBoundary: s, padding: o })[Ri(u)], p;
  }, {});
  return Object.keys(g).sort(function(p, u) {
    return g[p] - g[u];
  });
}
function JT(n) {
  if (Ri(n) === Kd) return [];
  var e = Tc(n);
  return [cm(n), e, cm(e)];
}
function KT(n) {
  var e = n.state, t = n.options, i = n.name;
  if (!e.modifiersData[i]._skip) {
    for (var r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !0 : o, c = t.fallbackPlacements, l = t.padding, d = t.boundary, h = t.rootBoundary, f = t.altBoundary, g = t.flipVariations, p = g === void 0 ? !0 : g, u = t.allowedAutoPlacements, y = e.options.placement, v = Ri(y), m = v === y, x = c || (m || !p ? [Tc(y)] : JT(y)), w = [y].concat(x).reduce(function(j, te) {
      return j.concat(Ri(te) === Kd ? YT(e, { placement: te, boundary: d, rootBoundary: h, padding: l, flipVariations: p, allowedAutoPlacements: u }) : te);
    }, []), A = e.rects.reference, M = e.rects.popper, R = /* @__PURE__ */ new Map(), L = !0, _ = w[0], F = 0; F < w.length; F++) {
      var S = w[F], T = Ri(S), E = To(S) === wo, C = [On, qn].indexOf(T) >= 0, P = C ? "width" : "height", b = za(e, { placement: S, boundary: d, rootBoundary: h, altBoundary: f, padding: l }), I = C ? E ? Qn : Dn : E ? qn : On;
      A[P] > M[P] && (I = Tc(I));
      var D = Tc(I), N = [];
      if (s && N.push(b[T] <= 0), a && N.push(b[I] <= 0, b[D] <= 0), N.every(function(j) {
        return j;
      })) {
        _ = S, L = !1;
        break;
      }
      R.set(S, N);
    }
    if (L) for (var U = p ? 3 : 1, B = function(j) {
      var te = w.find(function(ee) {
        var ae = R.get(ee);
        if (ae) return ae.slice(0, j).every(function(H) {
          return H;
        });
      });
      if (te) return _ = te, "break";
    }, G = U; G > 0; G--) {
      var J = B(G);
      if (J === "break") break;
    }
    e.placement !== _ && (e.modifiersData[i]._skip = !0, e.placement = _, e.reset = !0);
  }
}
var qT = { name: "flip", enabled: !0, phase: "main", fn: KT, requiresIfExists: ["offset"], data: { _skip: !1 } };
function hm(n, e, t) {
  return t === void 0 && (t = { x: 0, y: 0 }), { top: n.top - e.height - t.y, right: n.right - e.width + t.x, bottom: n.bottom - e.height + t.y, left: n.left - e.width - t.x };
}
function dm(n) {
  return [On, Qn, qn, Dn].some(function(e) {
    return n[e] >= 0;
  });
}
function QT(n) {
  var e = n.state, t = n.name, i = e.rects.reference, r = e.rects.popper, s = e.modifiersData.preventOverflow, o = za(e, { elementContext: "reference" }), a = za(e, { altBoundary: !0 }), c = hm(o, i), l = hm(a, r, s), d = dm(c), h = dm(l);
  e.modifiersData[t] = { referenceClippingOffsets: c, popperEscapeOffsets: l, isReferenceHidden: d, hasPopperEscaped: h }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": d, "data-popper-escaped": h });
}
var eE = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: QT };
function tE(n, e, t) {
  var i = Ri(n), r = [Dn, On].indexOf(i) >= 0 ? -1 : 1, s = typeof t == "function" ? t(Object.assign({}, e, { placement: n })) : t, o = s[0], a = s[1];
  return o = o || 0, a = (a || 0) * r, [Dn, Qn].indexOf(i) >= 0 ? { x: a, y: o } : { x: o, y: a };
}
function nE(n) {
  var e = n.state, t = n.options, i = n.name, r = t.offset, s = r === void 0 ? [0, 0] : r, o = Yo.reduce(function(d, h) {
    return d[h] = tE(h, e.rects, s), d;
  }, {}), a = o[e.placement], c = a.x, l = a.y;
  e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += c, e.modifiersData.popperOffsets.y += l), e.modifiersData[i] = o;
}
var iE = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: nE };
function rE(n) {
  var e = n.state, t = n.name;
  e.modifiersData[t] = E0({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var C0 = { name: "popperOffsets", enabled: !0, phase: "read", fn: rE, data: {} };
function sE(n) {
  return n === "x" ? "y" : "x";
}
function oE(n) {
  var e = n.state, t = n.options, i = n.name, r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !1 : o, c = t.boundary, l = t.rootBoundary, d = t.altBoundary, h = t.padding, f = t.tether, g = f === void 0 ? !0 : f, p = t.tetherOffset, u = p === void 0 ? 0 : p, y = za(e, { boundary: c, rootBoundary: l, padding: h, altBoundary: d }), v = Ri(e.placement), m = To(e.placement), x = !m, w = ef(v), A = sE(w), M = e.modifiersData.popperOffsets, R = e.rects.reference, L = e.rects.popper, _ = typeof u == "function" ? u(Object.assign({}, e.rects, { placement: e.placement })) : u, F = typeof _ == "number" ? { mainAxis: _, altAxis: _ } : Object.assign({ mainAxis: 0, altAxis: 0 }, _), S = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, T = { x: 0, y: 0 };
  if (M) {
    if (s) {
      var E, C = w === "y" ? On : Dn, P = w === "y" ? qn : Qn, b = w === "y" ? "height" : "width", I = M[w], D = I + y[C], N = I - y[P], U = g ? -L[b] / 2 : 0, B = m === wo ? R[b] : L[b], G = m === wo ? -L[b] : -R[b], J = e.elements.arrow, j = g && J ? Qd(J) : { width: 0, height: 0 }, te = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : M0(), ee = te[C], ae = te[P], H = Ca(0, R[b], j[b]), Z = x ? R[b] / 2 - U - H - ee - F.mainAxis : B - H - ee - F.mainAxis, $ = x ? -R[b] / 2 + U + H + ae + F.mainAxis : G + H + ae + F.mainAxis, se = e.elements.arrow && rl(e.elements.arrow), k = se ? w === "y" ? se.clientTop || 0 : se.clientLeft || 0 : 0, W = (E = S == null ? void 0 : S[w]) != null ? E : 0, q = I + Z - W - k, ce = I + $ - W, oe = Ca(g ? Bc(D, q) : D, I, g ? xs(N, ce) : N);
      M[w] = oe, T[w] = oe - I;
    }
    if (a) {
      var V, O = w === "x" ? On : Dn, X = w === "x" ? qn : Qn, Y = M[A], ie = A === "y" ? "height" : "width", fe = Y + y[O], be = Y - y[X], Ae = [On, Dn].indexOf(v) !== -1, he = (V = S == null ? void 0 : S[A]) != null ? V : 0, xe = Ae ? fe : Y - R[ie] - L[ie] - he + F.altAxis, re = Ae ? Y + R[ie] + L[ie] - he - F.altAxis : be, me = g && Ae ? IT(xe, Y, re) : Ca(g ? xe : fe, Y, g ? re : be);
      M[A] = me, T[A] = me - Y;
    }
    e.modifiersData[i] = T;
  }
}
var aE = { name: "preventOverflow", enabled: !0, phase: "main", fn: oE, requiresIfExists: ["offset"] };
function lE(n) {
  return { scrollLeft: n.scrollLeft, scrollTop: n.scrollTop };
}
function cE(n) {
  return n === yi(n) || !Kn(n) ? tf(n) : lE(n);
}
function uE(n) {
  var e = n.getBoundingClientRect(), t = So(e.width) / n.offsetWidth || 1, i = So(e.height) / n.offsetHeight || 1;
  return t !== 1 || i !== 1;
}
function hE(n, e, t) {
  t === void 0 && (t = !1);
  var i = Kn(e), r = Kn(e) && uE(e), s = Xr(e), o = _o(n, r), a = { scrollLeft: 0, scrollTop: 0 }, c = { x: 0, y: 0 };
  return (i || !i && !t) && ((Ii(e) !== "body" || rf(s)) && (a = cE(e)), Kn(e) ? (c = _o(e, !0), c.x += e.clientLeft, c.y += e.clientTop) : s && (c.x = nf(s))), { x: o.left + a.scrollLeft - c.x, y: o.top + a.scrollTop - c.y, width: o.width, height: o.height };
}
function dE(n) {
  var e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), i = [];
  n.forEach(function(s) {
    e.set(s.name, s);
  });
  function r(s) {
    t.add(s.name);
    var o = [].concat(s.requires || [], s.requiresIfExists || []);
    o.forEach(function(a) {
      if (!t.has(a)) {
        var c = e.get(a);
        c && r(c);
      }
    }), i.push(s);
  }
  return n.forEach(function(s) {
    t.has(s.name) || r(s);
  }), i;
}
function fE(n) {
  var e = dE(n);
  return CT.reduce(function(t, i) {
    return t.concat(e.filter(function(r) {
      return r.phase === i;
    }));
  }, []);
}
function pE(n) {
  var e;
  return function() {
    return e || (e = new Promise(function(t) {
      Promise.resolve().then(function() {
        e = void 0, t(n());
      });
    })), e;
  };
}
function mE(n) {
  var e = n.reduce(function(t, i) {
    var r = t[i.name];
    return t[i.name] = r ? Object.assign({}, r, i, { options: Object.assign({}, r.options, i.options), data: Object.assign({}, r.data, i.data) }) : i, t;
  }, {});
  return Object.keys(e).map(function(t) {
    return e[t];
  });
}
var fm = { placement: "bottom", modifiers: [], strategy: "absolute" };
function pm() {
  for (var n = arguments.length, e = new Array(n), t = 0; t < n; t++) e[t] = arguments[t];
  return !e.some(function(i) {
    return !(i && typeof i.getBoundingClientRect == "function");
  });
}
function sf(n) {
  n === void 0 && (n = {});
  var e = n, t = e.defaultModifiers, i = t === void 0 ? [] : t, r = e.defaultOptions, s = r === void 0 ? fm : r;
  return function(o, a, c) {
    c === void 0 && (c = s);
    var l = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, fm, s), modifiersData: {}, elements: { reference: o, popper: a }, attributes: {}, styles: {} }, d = [], h = !1, f = { state: l, setOptions: function(u) {
      var y = typeof u == "function" ? u(l.options) : u;
      p(), l.options = Object.assign({}, s, l.options, y), l.scrollParents = { reference: Ao(o) ? La(o) : o.contextElement ? La(o.contextElement) : [], popper: La(a) };
      var v = fE(mE([].concat(i, l.options.modifiers)));
      return l.orderedModifiers = v.filter(function(m) {
        return m.enabled;
      }), g(), f.update();
    }, forceUpdate: function() {
      if (!h) {
        var u = l.elements, y = u.reference, v = u.popper;
        if (pm(y, v)) {
          l.rects = { reference: hE(y, rl(v), l.options.strategy === "fixed"), popper: Qd(v) }, l.reset = !1, l.placement = l.options.placement, l.orderedModifiers.forEach(function(L) {
            return l.modifiersData[L.name] = Object.assign({}, L.data);
          });
          for (var m = 0; m < l.orderedModifiers.length; m++) {
            if (l.reset === !0) {
              l.reset = !1, m = -1;
              continue;
            }
            var x = l.orderedModifiers[m], w = x.fn, A = x.options, M = A === void 0 ? {} : A, R = x.name;
            typeof w == "function" && (l = w({ state: l, options: M, name: R, instance: f }) || l);
          }
        }
      }
    }, update: pE(function() {
      return new Promise(function(u) {
        f.forceUpdate(), u(l);
      });
    }), destroy: function() {
      p(), h = !0;
    } };
    if (!pm(o, a)) return f;
    f.setOptions(c).then(function(u) {
      !h && c.onFirstUpdate && c.onFirstUpdate(u);
    });
    function g() {
      l.orderedModifiers.forEach(function(u) {
        var y = u.name, v = u.options, m = v === void 0 ? {} : v, x = u.effect;
        if (typeof x == "function") {
          var w = x({ state: l, name: y, instance: f, options: m }), A = function() {
          };
          d.push(w || A);
        }
      });
    }
    function p() {
      d.forEach(function(u) {
        return u();
      }), d = [];
    }
    return f;
  };
}
sf();
var gE = [_0, C0, S0, b0];
sf({ defaultModifiers: gE });
var vE = [_0, C0, S0, b0, iE, qT, aE, BT, eE], yE = sf({ defaultModifiers: vE });
const bE = (n, e, t = {}) => {
  const i = {
    name: "updateState",
    enabled: !0,
    phase: "write",
    fn: ({ state: c }) => {
      const l = xE(c);
      Object.assign(o.value, l);
    },
    requires: ["computeStyles"]
  }, r = ue(() => {
    const { onFirstUpdate: c, placement: l, strategy: d, modifiers: h } = z(t);
    return {
      onFirstUpdate: c,
      placement: l || "bottom",
      strategy: d || "absolute",
      modifiers: [
        ...h || [],
        i,
        { name: "applyStyles", enabled: !1 }
      ]
    };
  }), s = En(), o = Ee({
    styles: {
      popper: {
        position: z(r).strategy,
        left: "0",
        top: "0"
      },
      arrow: {
        position: "absolute"
      }
    },
    attributes: {}
  }), a = () => {
    s.value && (s.value.destroy(), s.value = void 0);
  };
  return Qe(r, (c) => {
    const l = z(s);
    l && l.setOptions(c);
  }, {
    deep: !0
  }), Qe([n, e], ([c, l]) => {
    a(), !(!c || !l) && (s.value = yE(c, l, z(r)));
  }), ei(() => {
    a();
  }), {
    state: ue(() => {
      var c;
      return { ...((c = z(s)) == null ? void 0 : c.state) || {} };
    }),
    styles: ue(() => z(o).styles),
    attributes: ue(() => z(o).attributes),
    update: () => {
      var c;
      return (c = z(s)) == null ? void 0 : c.update();
    },
    forceUpdate: () => {
      var c;
      return (c = z(s)) == null ? void 0 : c.forceUpdate();
    },
    instanceRef: ue(() => z(s))
  };
};
function xE(n) {
  const e = Object.keys(n.elements), t = Ic(e.map((r) => [r, n.styles[r] || {}])), i = Ic(e.map((r) => [r, n.attributes[r]]));
  return {
    styles: t,
    attributes: i
  };
}
function mm() {
  let n;
  const e = (i, r) => {
    t(), n = window.setTimeout(i, r);
  }, t = () => window.clearTimeout(n);
  return Yc(() => t()), {
    registerTimeout: e,
    cancelTimeout: t
  };
}
const Yh = {
  prefix: Math.floor(Math.random() * 1e4),
  current: 0
}, ME = Symbol("elIdInjection"), of = () => dn() ? pt(ME, Yh) : Yh, sl = (n) => {
  const e = of();
  !en && e === Yh && kt("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
usage: app.provide(ID_INJECTION_KEY, {
  prefix: number,
  current: number,
})`);
  const t = Jd();
  return ue(() => z(n) || `${t.value}-id-${e.prefix}-${e.current++}`);
};
let fo = [];
const gm = (n) => {
  const e = n;
  e.key === Li.esc && fo.forEach((t) => t(e));
}, wE = (n) => {
  Jt(() => {
    fo.length === 0 && document.addEventListener("keydown", gm), en && fo.push(n);
  }), ei(() => {
    fo = fo.filter((e) => e !== n), fo.length === 0 && en && document.removeEventListener("keydown", gm);
  });
};
let vm;
const L0 = () => {
  const n = Jd(), e = of(), t = ue(() => `${n.value}-popper-container-${e.prefix}`), i = ue(() => `#${t.value}`);
  return {
    id: t,
    selector: i
  };
}, AE = (n) => {
  const e = document.createElement("div");
  return e.id = n, document.body.appendChild(e), e;
}, SE = () => {
  const { id: n, selector: e } = L0();
  return kM(() => {
    en && (process.env.NODE_ENV === "test" || !vm || !document.body.querySelector(e.value)) && (vm = AE(n.value));
  }), {
    id: n,
    selector: e
  };
}, _E = at({
  showAfter: {
    type: Number,
    default: 0
  },
  hideAfter: {
    type: Number,
    default: 200
  },
  autoClose: {
    type: Number,
    default: 0
  }
}), TE = ({
  showAfter: n,
  hideAfter: e,
  autoClose: t,
  open: i,
  close: r
}) => {
  const { registerTimeout: s } = mm(), {
    registerTimeout: o,
    cancelTimeout: a
  } = mm();
  return {
    onOpen: (d) => {
      s(() => {
        i(d);
        const h = z(t);
        yt(h) && h > 0 && o(() => {
          r(d);
        }, h);
      }, z(n));
    },
    onClose: (d) => {
      a(), s(() => {
        r(d);
      }, z(e));
    }
  };
}, R0 = Symbol("elForwardRef"), EE = (n) => {
  sn(R0, {
    setForwardRef: (t) => {
      n.value = t;
    }
  });
}, CE = (n) => ({
  mounted(e) {
    n(e);
  },
  updated(e) {
    n(e);
  },
  unmounted() {
    n(null);
  }
}), ym = {
  current: 0
}, bm = Ee(0), F0 = 2e3, xm = Symbol("elZIndexContextKey"), P0 = Symbol("zIndexContextKey"), I0 = (n) => {
  const e = dn() ? pt(xm, ym) : ym, t = n || (dn() ? pt(P0, void 0) : void 0), i = ue(() => {
    const o = z(t);
    return yt(o) ? o : F0;
  }), r = ue(() => i.value + bm.value), s = () => (e.current++, bm.value = e.current, r.value);
  return !en && !pt(xm) && kt("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), {
    initialZIndex: i,
    currentZIndex: r,
    nextZIndex: s
  };
};
function LE(n) {
  let e;
  function t() {
    if (n.value == null)
      return;
    const { selectionStart: r, selectionEnd: s, value: o } = n.value;
    if (r == null || s == null)
      return;
    const a = o.slice(0, Math.max(0, r)), c = o.slice(Math.max(0, s));
    e = {
      selectionStart: r,
      selectionEnd: s,
      value: o,
      beforeTxt: a,
      afterTxt: c
    };
  }
  function i() {
    if (n.value == null || e == null)
      return;
    const { value: r } = n.value, { beforeTxt: s, afterTxt: o, selectionStart: a } = e;
    if (s == null || o == null || a == null)
      return;
    let c = r.length;
    if (r.endsWith(o))
      c = r.length - o.length;
    else if (r.startsWith(s))
      c = s.length;
    else {
      const l = s[a - 1], d = r.indexOf(l, a - 1);
      d !== -1 && (c = d + 1);
    }
    n.value.setSelectionRange(c, c);
  }
  return [t, i];
}
const RE = (n, e, t) => Sc(n.subTree).filter((s) => {
  var o;
  return Uh(s) && ((o = s.type) == null ? void 0 : o.name) === e && !!s.component;
}).map((s) => s.component.uid).map((s) => t[s]).filter((s) => !!s), FE = (n, e) => {
  const t = {}, i = En([]);
  return {
    children: i,
    addChild: (o) => {
      t[o.uid] = o, i.value = RE(n, e, t);
    },
    removeChild: (o) => {
      delete t[o], i.value = i.value.filter((a) => a.uid !== o);
    }
  };
}, Gr = nu({
  type: String,
  values: f0,
  required: !1
}), O0 = Symbol("size"), PE = () => {
  const n = pt(O0, {});
  return ue(() => z(n.size) || "");
};
function D0(n, {
  beforeFocus: e,
  afterFocus: t,
  beforeBlur: i,
  afterBlur: r
} = {}) {
  const s = dn(), { emit: o } = s, a = En(), c = Ee(!1), l = (f) => {
    Sn(e) && e(f) || c.value || (c.value = !0, o("focus", f), t == null || t());
  }, d = (f) => {
    var g;
    Sn(i) && i(f) || f.relatedTarget && ((g = a.value) != null && g.contains(f.relatedTarget)) || (c.value = !1, o("blur", f), r == null || r());
  }, h = () => {
    var f, g;
    (f = a.value) != null && f.contains(document.activeElement) && a.value !== document.activeElement || (g = n.value) == null || g.focus();
  };
  return Qe(a, (f) => {
    f && f.setAttribute("tabindex", "-1");
  }), un(a, "focus", l, !0), un(a, "blur", d, !0), un(a, "click", h, !0), process.env.NODE_ENV === "test" && Jt(() => {
    const f = ys(n.value) ? n.value : document.querySelector("input,textarea");
    f && (un(f, "focus", l, !0), un(f, "blur", d, !0));
  }), {
    isFocused: c,
    wrapperRef: a,
    handleFocus: l,
    handleBlur: d
  };
}
function N0({
  afterComposition: n,
  emit: e
}) {
  const t = Ee(!1), i = (a) => {
    e == null || e("compositionstart", a), t.value = !0;
  }, r = (a) => {
    var c;
    e == null || e("compositionupdate", a);
    const l = (c = a.target) == null ? void 0 : c.value, d = l[l.length - 1] || "";
    t.value = !sT(d);
  }, s = (a) => {
    e == null || e("compositionend", a), t.value && (t.value = !1, bt(() => n(a)));
  };
  return {
    isComposing: t,
    handleComposition: (a) => {
      a.type === "compositionend" ? s(a) : r(a);
    },
    handleCompositionStart: i,
    handleCompositionUpdate: r,
    handleCompositionEnd: s
  };
}
const B0 = Symbol("emptyValuesContextKey"), IE = "use-empty-values", OE = ["", void 0, null], DE = void 0, NE = at({
  emptyValues: Array,
  valueOnClear: {
    type: [String, Number, Boolean, Function],
    default: void 0,
    validator: (n) => Sn(n) ? !n() : !n
  }
}), BE = (n, e) => {
  const t = dn() ? pt(B0, Ee({})) : Ee({}), i = ue(() => n.emptyValues || t.value.emptyValues || OE), r = ue(() => Sn(n.valueOnClear) ? n.valueOnClear() : n.valueOnClear !== void 0 ? n.valueOnClear : Sn(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : DE), s = (o) => i.value.includes(o);
  return i.value.includes(r.value) || kt(IE, "value-on-clear should be a value of empty-values"), {
    emptyValues: i,
    valueOnClear: r,
    isEmptyValue: s
  };
}, UE = at({
  ariaLabel: String,
  ariaOrientation: {
    type: String,
    values: ["horizontal", "vertical", "undefined"]
  },
  ariaControls: String
}), Yr = (n) => I_(UE, n), U0 = Symbol(), Uc = Ee();
function af(n, e = void 0) {
  const t = dn() ? pt(U0, Uc) : Uc;
  return n ? ue(() => {
    var i, r;
    return (r = (i = t.value) == null ? void 0 : i[n]) != null ? r : e;
  }) : t;
}
function zE(n, e) {
  const t = af(), i = nt(n, ue(() => {
    var a;
    return ((a = t.value) == null ? void 0 : a.namespace) || _c;
  })), r = iu(ue(() => {
    var a;
    return (a = t.value) == null ? void 0 : a.locale;
  })), s = I0(ue(() => {
    var a;
    return ((a = t.value) == null ? void 0 : a.zIndex) || F0;
  })), o = ue(() => {
    var a;
    return z(e) || ((a = t.value) == null ? void 0 : a.size) || "";
  });
  return kE(ue(() => z(t) || {})), {
    ns: i,
    locale: r,
    zIndex: s,
    size: o
  };
}
const kE = (n, e, t = !1) => {
  var i;
  const r = !!dn(), s = r ? af() : void 0, o = (i = void 0) != null ? i : r ? sn : void 0;
  if (!o) {
    kt("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
    return;
  }
  const a = ue(() => {
    const c = z(n);
    return s != null && s.value ? VE(s.value, c) : c;
  });
  return o(U0, a), o(m0, ue(() => a.value.locale)), o(g0, ue(() => a.value.namespace)), o(P0, ue(() => a.value.zIndex)), o(O0, {
    size: ue(() => a.value.size || "")
  }), o(B0, ue(() => ({
    emptyValues: a.value.emptyValues,
    valueOnClear: a.value.valueOnClear
  }))), (t || !Uc.value) && (Uc.value = a.value), a;
}, VE = (n, e) => {
  const t = [.../* @__PURE__ */ new Set([...rm(n), ...rm(e)])], i = {};
  for (const r of t)
    i[r] = e[r] !== void 0 ? e[r] : n[r];
  return i;
};
var st = (n, e) => {
  const t = n.__vccOpts || n;
  for (const [i, r] of e)
    t[i] = r;
  return t;
};
const GE = at({
  size: {
    type: Je([Number, String])
  },
  color: {
    type: String
  }
}), HE = Pe({
  name: "ElIcon",
  inheritAttrs: !1
}), WE = /* @__PURE__ */ Pe({
  ...HE,
  props: GE,
  setup(n) {
    const e = n, t = nt("icon"), i = ue(() => {
      const { size: r, color: s } = e;
      return !r && !s ? {} : {
        fontSize: di(r) ? void 0 : Dc(r),
        "--color": s
      };
    });
    return (r, s) => (ve(), Ce("i", Ei({
      class: z(t).b(),
      style: z(i)
    }, r.$attrs), [
      He(r.$slots, "default")
    ], 16));
  }
});
var jE = /* @__PURE__ */ st(WE, [["__file", "icon.vue"]]);
const It = on(jE), lf = Symbol("formContextKey"), zc = Symbol("formItemContextKey"), Ns = (n, e = {}) => {
  const t = Ee(void 0), i = e.prop ? t : v0("size"), r = e.global ? t : PE(), s = e.form ? { size: void 0 } : pt(lf, void 0), o = e.formItem ? { size: void 0 } : pt(zc, void 0);
  return ue(() => i.value || z(n) || (o == null ? void 0 : o.size) || (s == null ? void 0 : s.size) || r.value || "");
}, ol = (n) => {
  const e = v0("disabled"), t = pt(lf, void 0);
  return ue(() => e.value || z(n) || (t == null ? void 0 : t.disabled) || !1);
}, Jo = () => {
  const n = pt(lf, void 0), e = pt(zc, void 0);
  return {
    form: n,
    formItem: e
  };
}, su = (n, {
  formItemContext: e,
  disableIdGeneration: t,
  disableIdManagement: i
}) => {
  t || (t = Ee(!1)), i || (i = Ee(!1));
  const r = Ee();
  let s;
  const o = ue(() => {
    var a;
    return !!(!(n.label || n.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1);
  });
  return Jt(() => {
    s = Qe([hi(n, "id"), t], ([a, c]) => {
      const l = a ?? (c ? void 0 : sl().value);
      l !== r.value && (e != null && e.removeInputId && (r.value && e.removeInputId(r.value), !(i != null && i.value) && !c && l && e.addInputId(l)), r.value = l);
    }, { immediate: !0 });
  }), Uv(() => {
    s && s(), e != null && e.removeInputId && r.value && e.removeInputId(r.value);
  }), {
    isLabeledByFormItem: o,
    inputId: r
  };
};
let ii;
const $E = `
  height:0 !important;
  visibility:hidden !important;
  ${Ow() ? "" : "overflow:hidden !important;"}
  position:absolute !important;
  z-index:-1000 !important;
  top:0 !important;
  right:0 !important;
`, ZE = [
  "letter-spacing",
  "line-height",
  "padding-top",
  "padding-bottom",
  "font-family",
  "font-weight",
  "font-size",
  "text-rendering",
  "text-transform",
  "width",
  "text-indent",
  "padding-left",
  "padding-right",
  "border-width",
  "box-sizing"
];
function XE(n) {
  const e = window.getComputedStyle(n), t = e.getPropertyValue("box-sizing"), i = Number.parseFloat(e.getPropertyValue("padding-bottom")) + Number.parseFloat(e.getPropertyValue("padding-top")), r = Number.parseFloat(e.getPropertyValue("border-bottom-width")) + Number.parseFloat(e.getPropertyValue("border-top-width"));
  return { contextStyle: ZE.map((o) => `${o}:${e.getPropertyValue(o)}`).join(";"), paddingSize: i, borderSize: r, boxSizing: t };
}
function Mm(n, e = 1, t) {
  var i;
  ii || (ii = document.createElement("textarea"), document.body.appendChild(ii));
  const { paddingSize: r, borderSize: s, boxSizing: o, contextStyle: a } = XE(n);
  ii.setAttribute("style", `${a};${$E}`), ii.value = n.value || n.placeholder || "";
  let c = ii.scrollHeight;
  const l = {};
  o === "border-box" ? c = c + s : o === "content-box" && (c = c - r), ii.value = "";
  const d = ii.scrollHeight - r;
  if (yt(e)) {
    let h = d * e;
    o === "border-box" && (h = h + r + s), c = Math.max(h, c), l.minHeight = `${h}px`;
  }
  if (yt(t)) {
    let h = d * t;
    o === "border-box" && (h = h + r + s), c = Math.min(h, c);
  }
  return l.height = `${c}px`, (i = ii.parentNode) == null || i.removeChild(ii), ii = void 0, l;
}
const YE = at({
  id: {
    type: String,
    default: void 0
  },
  size: Gr,
  disabled: Boolean,
  modelValue: {
    type: Je([
      String,
      Number,
      Object
    ]),
    default: ""
  },
  maxlength: {
    type: [String, Number]
  },
  minlength: {
    type: [String, Number]
  },
  type: {
    type: String,
    default: "text"
  },
  resize: {
    type: String,
    values: ["none", "both", "horizontal", "vertical"]
  },
  autosize: {
    type: Je([Boolean, Object]),
    default: !1
  },
  autocomplete: {
    type: String,
    default: "off"
  },
  formatter: {
    type: Function
  },
  parser: {
    type: Function
  },
  placeholder: {
    type: String
  },
  form: {
    type: String
  },
  readonly: Boolean,
  clearable: Boolean,
  showPassword: Boolean,
  showWordLimit: Boolean,
  suffixIcon: {
    type: Vr
  },
  prefixIcon: {
    type: Vr
  },
  containerRole: {
    type: String,
    default: void 0
  },
  tabindex: {
    type: [String, Number],
    default: 0
  },
  validateEvent: {
    type: Boolean,
    default: !0
  },
  inputStyle: {
    type: Je([Object, Array, String]),
    default: () => qi({})
  },
  autofocus: Boolean,
  rows: {
    type: Number,
    default: 2
  },
  ...Yr(["ariaLabel"])
}), JE = {
  [At]: (n) => vn(n),
  input: (n) => vn(n),
  change: (n) => vn(n),
  focus: (n) => n instanceof FocusEvent,
  blur: (n) => n instanceof FocusEvent,
  clear: () => !0,
  mouseleave: (n) => n instanceof MouseEvent,
  mouseenter: (n) => n instanceof MouseEvent,
  keydown: (n) => n instanceof Event,
  compositionstart: (n) => n instanceof CompositionEvent,
  compositionupdate: (n) => n instanceof CompositionEvent,
  compositionend: (n) => n instanceof CompositionEvent
}, KE = Pe({
  name: "ElInput",
  inheritAttrs: !1
}), qE = /* @__PURE__ */ Pe({
  ...KE,
  props: YE,
  emits: JE,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = VM(), s = Xc(), o = ue(() => {
      const he = {};
      return i.containerRole === "combobox" && (he["aria-haspopup"] = r["aria-haspopup"], he["aria-owns"] = r["aria-owns"], he["aria-expanded"] = r["aria-expanded"]), he;
    }), a = ue(() => [
      i.type === "textarea" ? y.b() : u.b(),
      u.m(g.value),
      u.is("disabled", p.value),
      u.is("exceed", J.value),
      {
        [u.b("group")]: s.prepend || s.append,
        [u.m("prefix")]: s.prefix || i.prefixIcon,
        [u.m("suffix")]: s.suffix || i.suffixIcon || i.clearable || i.showPassword,
        [u.bm("suffix", "password-clear")]: N.value && U.value,
        [u.b("hidden")]: i.type === "hidden"
      },
      r.class
    ]), c = ue(() => [
      u.e("wrapper"),
      u.is("focus", _.value)
    ]), l = lT({
      excludeKeys: ue(() => Object.keys(o.value))
    }), { form: d, formItem: h } = Jo(), { inputId: f } = su(i, {
      formItemContext: h
    }), g = Ns(), p = ol(), u = nt("input"), y = nt("textarea"), v = En(), m = En(), x = Ee(!1), w = Ee(!1), A = Ee(), M = En(i.inputStyle), R = ue(() => v.value || m.value), { wrapperRef: L, isFocused: _, handleFocus: F, handleBlur: S } = D0(R, {
      beforeFocus() {
        return p.value;
      },
      afterBlur() {
        var he;
        i.validateEvent && ((he = h == null ? void 0 : h.validate) == null || he.call(h, "blur").catch((xe) => kt(xe)));
      }
    }), T = ue(() => {
      var he;
      return (he = d == null ? void 0 : d.statusIcon) != null ? he : !1;
    }), E = ue(() => (h == null ? void 0 : h.validateState) || ""), C = ue(() => E.value && d0[E.value]), P = ue(() => w.value ? tT : Y_), b = ue(() => [
      r.style
    ]), I = ue(() => [
      i.inputStyle,
      M.value,
      { resize: i.resize }
    ]), D = ue(() => Ci(i.modelValue) ? "" : String(i.modelValue)), N = ue(() => i.clearable && !p.value && !i.readonly && !!D.value && (_.value || x.value)), U = ue(() => i.showPassword && !p.value && !i.readonly && !!D.value && (!!D.value || _.value)), B = ue(() => i.showWordLimit && !!i.maxlength && (i.type === "text" || i.type === "textarea") && !p.value && !i.readonly && !i.showPassword), G = ue(() => D.value.length), J = ue(() => !!B.value && G.value > Number(i.maxlength)), j = ue(() => !!s.suffix || !!i.suffixIcon || N.value || i.showPassword || B.value || !!E.value && T.value), [te, ee] = LE(v);
    Jn(m, (he) => {
      if (Z(), !B.value || i.resize !== "both")
        return;
      const xe = he[0], { width: re } = xe.contentRect;
      A.value = {
        right: `calc(100% - ${re + 15 + 6}px)`
      };
    });
    const ae = () => {
      const { type: he, autosize: xe } = i;
      if (!(!en || he !== "textarea" || !m.value))
        if (xe) {
          const re = Tn(xe) ? xe.minRows : void 0, me = Tn(xe) ? xe.maxRows : void 0, Me = Mm(m.value, re, me);
          M.value = {
            overflowY: "hidden",
            ...Me
          }, bt(() => {
            m.value.offsetHeight, M.value = Me;
          });
        } else
          M.value = {
            minHeight: Mm(m.value).minHeight
          };
    }, Z = ((he) => {
      let xe = !1;
      return () => {
        var re;
        if (xe || !i.autosize)
          return;
        ((re = m.value) == null ? void 0 : re.offsetParent) === null || (he(), xe = !0);
      };
    })(ae), $ = () => {
      const he = R.value, xe = i.formatter ? i.formatter(D.value) : D.value;
      !he || he.value === xe || (he.value = xe);
    }, se = async (he) => {
      te();
      let { value: xe } = he.target;
      if (i.formatter && (xe = i.parser ? i.parser(xe) : xe), !W.value) {
        if (xe === D.value) {
          $();
          return;
        }
        t(At, xe), t("input", xe), await bt(), $(), ee();
      }
    }, k = (he) => {
      t("change", he.target.value);
    }, {
      isComposing: W,
      handleCompositionStart: q,
      handleCompositionUpdate: ce,
      handleCompositionEnd: oe
    } = N0({ emit: t, afterComposition: se }), V = () => {
      w.value = !w.value, O();
    }, O = async () => {
      var he;
      await bt(), (he = R.value) == null || he.focus();
    }, X = () => {
      var he;
      return (he = R.value) == null ? void 0 : he.blur();
    }, Y = (he) => {
      x.value = !1, t("mouseleave", he);
    }, ie = (he) => {
      x.value = !0, t("mouseenter", he);
    }, fe = (he) => {
      t("keydown", he);
    }, be = () => {
      var he;
      (he = R.value) == null || he.select();
    }, Ae = () => {
      t(At, ""), t("change", ""), t("clear"), t("input", "");
    };
    return Qe(() => i.modelValue, () => {
      var he;
      bt(() => ae()), i.validateEvent && ((he = h == null ? void 0 : h.validate) == null || he.call(h, "change").catch((xe) => kt(xe)));
    }), Qe(D, () => $()), Qe(() => i.type, async () => {
      await bt(), $(), ae();
    }), Jt(() => {
      !i.formatter && i.parser && kt("ElInput", "If you set the parser, you also need to set the formatter."), $(), bt(ae);
    }), e({
      input: v,
      textarea: m,
      ref: R,
      textareaStyle: I,
      autosize: hi(i, "autosize"),
      isComposing: W,
      focus: O,
      blur: X,
      select: be,
      clear: Ae,
      resizeTextarea: ae
    }), (he, xe) => (ve(), Ce("div", Ei(z(o), {
      class: [
        z(a),
        {
          [z(u).bm("group", "append")]: he.$slots.append,
          [z(u).bm("group", "prepend")]: he.$slots.prepend
        }
      ],
      style: z(b),
      role: he.containerRole,
      onMouseenter: ie,
      onMouseleave: Y
    }), [
      ke(" input "),
      he.type !== "textarea" ? (ve(), Ce(Ft, { key: 0 }, [
        ke(" prepend slot "),
        he.$slots.prepend ? (ve(), Ce("div", {
          key: 0,
          class: Te(z(u).be("group", "prepend"))
        }, [
          He(he.$slots, "prepend")
        ], 2)) : ke("v-if", !0),
        Ne("div", {
          ref_key: "wrapperRef",
          ref: L,
          class: Te(z(c))
        }, [
          ke(" prefix slot "),
          he.$slots.prefix || he.prefixIcon ? (ve(), Ce("span", {
            key: 0,
            class: Te(z(u).e("prefix"))
          }, [
            Ne("span", {
              class: Te(z(u).e("prefix-inner"))
            }, [
              He(he.$slots, "prefix"),
              he.prefixIcon ? (ve(), Ve(z(It), {
                key: 0,
                class: Te(z(u).e("icon"))
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(he.prefixIcon)))
                ]),
                _: 1
              }, 8, ["class"])) : ke("v-if", !0)
            ], 2)
          ], 2)) : ke("v-if", !0),
          Ne("input", Ei({
            id: z(f),
            ref_key: "input",
            ref: v,
            class: z(u).e("inner")
          }, z(l), {
            minlength: he.minlength,
            maxlength: he.maxlength,
            type: he.showPassword ? w.value ? "text" : "password" : he.type,
            disabled: z(p),
            readonly: he.readonly,
            autocomplete: he.autocomplete,
            tabindex: he.tabindex,
            "aria-label": he.ariaLabel,
            placeholder: he.placeholder,
            style: he.inputStyle,
            form: he.form,
            autofocus: he.autofocus,
            onCompositionstart: z(q),
            onCompositionupdate: z(ce),
            onCompositionend: z(oe),
            onInput: se,
            onChange: k,
            onKeydown: fe
          }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
          ke(" suffix slot "),
          z(j) ? (ve(), Ce("span", {
            key: 1,
            class: Te(z(u).e("suffix"))
          }, [
            Ne("span", {
              class: Te(z(u).e("suffix-inner"))
            }, [
              !z(N) || !z(U) || !z(B) ? (ve(), Ce(Ft, { key: 0 }, [
                He(he.$slots, "suffix"),
                he.suffixIcon ? (ve(), Ve(z(It), {
                  key: 0,
                  class: Te(z(u).e("icon"))
                }, {
                  default: de(() => [
                    (ve(), Ve(Fn(he.suffixIcon)))
                  ]),
                  _: 1
                }, 8, ["class"])) : ke("v-if", !0)
              ], 64)) : ke("v-if", !0),
              z(N) ? (ve(), Ve(z(It), {
                key: 1,
                class: Te([z(u).e("icon"), z(u).e("clear")]),
                onMousedown: Ut(z(Oa), ["prevent"]),
                onClick: Ae
              }, {
                default: de(() => [
                  le(z(Yd))
                ]),
                _: 1
              }, 8, ["class", "onMousedown"])) : ke("v-if", !0),
              z(U) ? (ve(), Ve(z(It), {
                key: 2,
                class: Te([z(u).e("icon"), z(u).e("password")]),
                onClick: V
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(z(P))))
                ]),
                _: 1
              }, 8, ["class"])) : ke("v-if", !0),
              z(B) ? (ve(), Ce("span", {
                key: 3,
                class: Te(z(u).e("count"))
              }, [
                Ne("span", {
                  class: Te(z(u).e("count-inner"))
                }, gt(z(G)) + " / " + gt(he.maxlength), 3)
              ], 2)) : ke("v-if", !0),
              z(E) && z(C) && z(T) ? (ve(), Ve(z(It), {
                key: 4,
                class: Te([
                  z(u).e("icon"),
                  z(u).e("validateIcon"),
                  z(u).is("loading", z(E) === "validating")
                ])
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(z(C))))
                ]),
                _: 1
              }, 8, ["class"])) : ke("v-if", !0)
            ], 2)
          ], 2)) : ke("v-if", !0)
        ], 2),
        ke(" append slot "),
        he.$slots.append ? (ve(), Ce("div", {
          key: 1,
          class: Te(z(u).be("group", "append"))
        }, [
          He(he.$slots, "append")
        ], 2)) : ke("v-if", !0)
      ], 64)) : (ve(), Ce(Ft, { key: 1 }, [
        ke(" textarea "),
        Ne("textarea", Ei({
          id: z(f),
          ref_key: "textarea",
          ref: m,
          class: [z(y).e("inner"), z(u).is("focus", z(_))]
        }, z(l), {
          minlength: he.minlength,
          maxlength: he.maxlength,
          tabindex: he.tabindex,
          disabled: z(p),
          readonly: he.readonly,
          autocomplete: he.autocomplete,
          style: z(I),
          "aria-label": he.ariaLabel,
          placeholder: he.placeholder,
          form: he.form,
          autofocus: he.autofocus,
          rows: he.rows,
          onCompositionstart: z(q),
          onCompositionupdate: z(ce),
          onCompositionend: z(oe),
          onInput: se,
          onFocus: z(F),
          onBlur: z(S),
          onChange: k,
          onKeydown: fe
        }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
        z(B) ? (ve(), Ce("span", {
          key: 0,
          style: Rt(A.value),
          class: Te(z(u).e("count"))
        }, gt(z(G)) + " / " + gt(he.maxlength), 7)) : ke("v-if", !0)
      ], 64))
    ], 16, ["role"]));
  }
});
var QE = /* @__PURE__ */ st(qE, [["__file", "input.vue"]]);
const e2 = on(QE), Hs = 4, t2 = {
  vertical: {
    offset: "offsetHeight",
    scroll: "scrollTop",
    scrollSize: "scrollHeight",
    size: "height",
    key: "vertical",
    axis: "Y",
    client: "clientY",
    direction: "top"
  },
  horizontal: {
    offset: "offsetWidth",
    scroll: "scrollLeft",
    scrollSize: "scrollWidth",
    size: "width",
    key: "horizontal",
    axis: "X",
    client: "clientX",
    direction: "left"
  }
}, n2 = ({
  move: n,
  size: e,
  bar: t
}) => ({
  [t.size]: e,
  transform: `translate${t.axis}(${n}%)`
}), cf = Symbol("scrollbarContextKey"), i2 = at({
  vertical: Boolean,
  size: String,
  move: Number,
  ratio: {
    type: Number,
    required: !0
  },
  always: Boolean
}), r2 = "Thumb", s2 = /* @__PURE__ */ Pe({
  __name: "thumb",
  props: i2,
  setup(n) {
    const e = n, t = pt(cf), i = nt("scrollbar");
    t || Xo(r2, "can not inject scrollbar context");
    const r = Ee(), s = Ee(), o = Ee({}), a = Ee(!1);
    let c = !1, l = !1, d = en ? document.onselectstart : null;
    const h = ue(() => t2[e.vertical ? "vertical" : "horizontal"]), f = ue(() => n2({
      size: e.size,
      move: e.move,
      bar: h.value
    })), g = ue(() => r.value[h.value.offset] ** 2 / t.wrapElement[h.value.scrollSize] / e.ratio / s.value[h.value.offset]), p = (M) => {
      var R;
      if (M.stopPropagation(), M.ctrlKey || [1, 2].includes(M.button))
        return;
      (R = window.getSelection()) == null || R.removeAllRanges(), y(M);
      const L = M.currentTarget;
      L && (o.value[h.value.axis] = L[h.value.offset] - (M[h.value.client] - L.getBoundingClientRect()[h.value.direction]));
    }, u = (M) => {
      if (!s.value || !r.value || !t.wrapElement)
        return;
      const R = Math.abs(M.target.getBoundingClientRect()[h.value.direction] - M[h.value.client]), L = s.value[h.value.offset] / 2, _ = (R - L) * 100 * g.value / r.value[h.value.offset];
      t.wrapElement[h.value.scroll] = _ * t.wrapElement[h.value.scrollSize] / 100;
    }, y = (M) => {
      M.stopImmediatePropagation(), c = !0, document.addEventListener("mousemove", v), document.addEventListener("mouseup", m), d = document.onselectstart, document.onselectstart = () => !1;
    }, v = (M) => {
      if (!r.value || !s.value || c === !1)
        return;
      const R = o.value[h.value.axis];
      if (!R)
        return;
      const L = (r.value.getBoundingClientRect()[h.value.direction] - M[h.value.client]) * -1, _ = s.value[h.value.offset] - R, F = (L - _) * 100 * g.value / r.value[h.value.offset];
      t.wrapElement[h.value.scroll] = F * t.wrapElement[h.value.scrollSize] / 100;
    }, m = () => {
      c = !1, o.value[h.value.axis] = 0, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m), A(), l && (a.value = !1);
    }, x = () => {
      l = !1, a.value = !!e.size;
    }, w = () => {
      l = !0, a.value = c;
    };
    ei(() => {
      A(), document.removeEventListener("mouseup", m);
    });
    const A = () => {
      document.onselectstart !== d && (document.onselectstart = d);
    };
    return un(hi(t, "scrollbarElement"), "mousemove", x), un(hi(t, "scrollbarElement"), "mouseleave", w), (M, R) => (ve(), Ve(el, {
      name: z(i).b("fade"),
      persisted: ""
    }, {
      default: de(() => [
        Lt(Ne("div", {
          ref_key: "instance",
          ref: r,
          class: Te([z(i).e("bar"), z(i).is(z(h).key)]),
          onMousedown: u
        }, [
          Ne("div", {
            ref_key: "thumb",
            ref: s,
            class: Te(z(i).e("thumb")),
            style: Rt(z(f)),
            onMousedown: p
          }, null, 38)
        ], 34), [
          [mn, M.always || a.value]
        ])
      ]),
      _: 1
    }, 8, ["name"]));
  }
});
var wm = /* @__PURE__ */ st(s2, [["__file", "thumb.vue"]]);
const o2 = at({
  always: {
    type: Boolean,
    default: !0
  },
  minSize: {
    type: Number,
    required: !0
  }
}), a2 = /* @__PURE__ */ Pe({
  __name: "bar",
  props: o2,
  setup(n, { expose: e }) {
    const t = n, i = pt(cf), r = Ee(0), s = Ee(0), o = Ee(""), a = Ee(""), c = Ee(1), l = Ee(1);
    return e({
      handleScroll: (f) => {
        if (f) {
          const g = f.offsetHeight - Hs, p = f.offsetWidth - Hs;
          s.value = f.scrollTop * 100 / g * c.value, r.value = f.scrollLeft * 100 / p * l.value;
        }
      },
      update: () => {
        const f = i == null ? void 0 : i.wrapElement;
        if (!f)
          return;
        const g = f.offsetHeight - Hs, p = f.offsetWidth - Hs, u = g ** 2 / f.scrollHeight, y = p ** 2 / f.scrollWidth, v = Math.max(u, t.minSize), m = Math.max(y, t.minSize);
        c.value = u / (g - u) / (v / (g - v)), l.value = y / (p - y) / (m / (p - m)), a.value = v + Hs < g ? `${v}px` : "", o.value = m + Hs < p ? `${m}px` : "";
      }
    }), (f, g) => (ve(), Ce(Ft, null, [
      le(wm, {
        move: r.value,
        ratio: l.value,
        size: o.value,
        always: f.always
      }, null, 8, ["move", "ratio", "size", "always"]),
      le(wm, {
        move: s.value,
        ratio: c.value,
        size: a.value,
        vertical: "",
        always: f.always
      }, null, 8, ["move", "ratio", "size", "always"])
    ], 64));
  }
});
var l2 = /* @__PURE__ */ st(a2, [["__file", "bar.vue"]]);
const c2 = at({
  height: {
    type: [String, Number],
    default: ""
  },
  maxHeight: {
    type: [String, Number],
    default: ""
  },
  native: {
    type: Boolean,
    default: !1
  },
  wrapStyle: {
    type: Je([String, Object, Array]),
    default: ""
  },
  wrapClass: {
    type: [String, Array],
    default: ""
  },
  viewClass: {
    type: [String, Array],
    default: ""
  },
  viewStyle: {
    type: [String, Array, Object],
    default: ""
  },
  noresize: Boolean,
  tag: {
    type: String,
    default: "div"
  },
  always: Boolean,
  minSize: {
    type: Number,
    default: 20
  },
  tabindex: {
    type: [String, Number],
    default: void 0
  },
  id: String,
  role: String,
  ...Yr(["ariaLabel", "ariaOrientation"])
}), u2 = {
  scroll: ({
    scrollTop: n,
    scrollLeft: e
  }) => [n, e].every(yt)
}, Jh = "ElScrollbar", h2 = Pe({
  name: Jh
}), d2 = /* @__PURE__ */ Pe({
  ...h2,
  props: c2,
  emits: u2,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = nt("scrollbar");
    let s, o, a = 0, c = 0;
    const l = Ee(), d = Ee(), h = Ee(), f = Ee(), g = ue(() => {
      const A = {};
      return i.height && (A.height = Dc(i.height)), i.maxHeight && (A.maxHeight = Dc(i.maxHeight)), [i.wrapStyle, A];
    }), p = ue(() => [
      i.wrapClass,
      r.e("wrap"),
      { [r.em("wrap", "hidden-default")]: !i.native }
    ]), u = ue(() => [r.e("view"), i.viewClass]), y = () => {
      var A;
      d.value && ((A = f.value) == null || A.handleScroll(d.value), a = d.value.scrollTop, c = d.value.scrollLeft, t("scroll", {
        scrollTop: d.value.scrollTop,
        scrollLeft: d.value.scrollLeft
      }));
    };
    function v(A, M) {
      Tn(A) ? d.value.scrollTo(A) : yt(A) && yt(M) && d.value.scrollTo(A, M);
    }
    const m = (A) => {
      if (!yt(A)) {
        kt(Jh, "value must be a number");
        return;
      }
      d.value.scrollTop = A;
    }, x = (A) => {
      if (!yt(A)) {
        kt(Jh, "value must be a number");
        return;
      }
      d.value.scrollLeft = A;
    }, w = () => {
      var A;
      (A = f.value) == null || A.update();
    };
    return Qe(() => i.noresize, (A) => {
      A ? (s == null || s(), o == null || o()) : ({ stop: s } = Jn(h, w), o = un("resize", w));
    }, { immediate: !0 }), Qe(() => [i.maxHeight, i.height], () => {
      i.native || bt(() => {
        var A;
        w(), d.value && ((A = f.value) == null || A.handleScroll(d.value));
      });
    }), sn(cf, jn({
      scrollbarElement: l,
      wrapElement: d
    })), GM(() => {
      d.value && (d.value.scrollTop = a, d.value.scrollLeft = c);
    }), Jt(() => {
      i.native || bt(() => {
        w();
      });
    }), zd(() => w()), e({
      wrapRef: d,
      update: w,
      scrollTo: v,
      setScrollTop: m,
      setScrollLeft: x,
      handleScroll: y
    }), (A, M) => (ve(), Ce("div", {
      ref_key: "scrollbarRef",
      ref: l,
      class: Te(z(r).b())
    }, [
      Ne("div", {
        ref_key: "wrapRef",
        ref: d,
        class: Te(z(p)),
        style: Rt(z(g)),
        tabindex: A.tabindex,
        onScroll: y
      }, [
        (ve(), Ve(Fn(A.tag), {
          id: A.id,
          ref_key: "resizeRef",
          ref: h,
          class: Te(z(u)),
          style: Rt(A.viewStyle),
          role: A.role,
          "aria-label": A.ariaLabel,
          "aria-orientation": A.ariaOrientation
        }, {
          default: de(() => [
            He(A.$slots, "default")
          ]),
          _: 3
        }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
      ], 46, ["tabindex"]),
      A.native ? ke("v-if", !0) : (ve(), Ve(l2, {
        key: 0,
        ref_key: "barRef",
        ref: f,
        always: A.always,
        "min-size": A.minSize
      }, null, 8, ["always", "min-size"]))
    ], 2));
  }
});
var f2 = /* @__PURE__ */ st(d2, [["__file", "scrollbar.vue"]]);
const p2 = on(f2), uf = Symbol("popper"), z0 = Symbol("popperContent"), m2 = [
  "dialog",
  "grid",
  "group",
  "listbox",
  "menu",
  "navigation",
  "tooltip",
  "tree"
], k0 = at({
  role: {
    type: String,
    values: m2,
    default: "tooltip"
  }
}), g2 = Pe({
  name: "ElPopper",
  inheritAttrs: !1
}), v2 = /* @__PURE__ */ Pe({
  ...g2,
  props: k0,
  setup(n, { expose: e }) {
    const t = n, i = Ee(), r = Ee(), s = Ee(), o = Ee(), a = ue(() => t.role), c = {
      triggerRef: i,
      popperInstanceRef: r,
      contentRef: s,
      referenceRef: o,
      role: a
    };
    return e(c), sn(uf, c), (l, d) => He(l.$slots, "default");
  }
});
var y2 = /* @__PURE__ */ st(v2, [["__file", "popper.vue"]]);
const V0 = at({
  arrowOffset: {
    type: Number,
    default: 5
  }
}), b2 = Pe({
  name: "ElPopperArrow",
  inheritAttrs: !1
}), x2 = /* @__PURE__ */ Pe({
  ...b2,
  props: V0,
  setup(n, { expose: e }) {
    const t = n, i = nt("popper"), { arrowOffset: r, arrowRef: s, arrowStyle: o } = pt(z0, void 0);
    return Qe(() => t.arrowOffset, (a) => {
      r.value = a;
    }), ei(() => {
      s.value = void 0;
    }), e({
      arrowRef: s
    }), (a, c) => (ve(), Ce("span", {
      ref_key: "arrowRef",
      ref: s,
      class: Te(z(i).e("arrow")),
      style: Rt(z(o)),
      "data-popper-arrow": ""
    }, null, 6));
  }
});
var M2 = /* @__PURE__ */ st(x2, [["__file", "arrow.vue"]]);
const Bu = "ElOnlyChild", w2 = Pe({
  name: Bu,
  setup(n, {
    slots: e,
    attrs: t
  }) {
    var i;
    const r = pt(R0), s = CE((i = r == null ? void 0 : r.setForwardRef) != null ? i : Oa);
    return () => {
      var o;
      const a = (o = e.default) == null ? void 0 : o.call(e, t);
      if (!a)
        return null;
      if (a.length > 1)
        return kt(Bu, "requires exact only one valid child."), null;
      const c = G0(a);
      return c ? Lt(HM(c, t), [[s]]) : (kt(Bu, "no valid child node found"), null);
    };
  }
});
function G0(n) {
  if (!n)
    return null;
  const e = n;
  for (const t of e) {
    if (Tn(t))
      switch (t.type) {
        case WM:
          continue;
        case zv:
        case "svg":
          return Am(t);
        case Ft:
          return G0(t.children);
        default:
          return t;
      }
    return Am(t);
  }
  return null;
}
function Am(n) {
  const e = nt("only-child");
  return le("span", {
    class: e.e("content")
  }, [n]);
}
const H0 = at({
  virtualRef: {
    type: Je(Object)
  },
  virtualTriggering: Boolean,
  onMouseenter: {
    type: Je(Function)
  },
  onMouseleave: {
    type: Je(Function)
  },
  onClick: {
    type: Je(Function)
  },
  onKeydown: {
    type: Je(Function)
  },
  onFocus: {
    type: Je(Function)
  },
  onBlur: {
    type: Je(Function)
  },
  onContextmenu: {
    type: Je(Function)
  },
  id: String,
  open: Boolean
}), A2 = Pe({
  name: "ElPopperTrigger",
  inheritAttrs: !1
}), S2 = /* @__PURE__ */ Pe({
  ...A2,
  props: H0,
  setup(n, { expose: e }) {
    const t = n, { role: i, triggerRef: r } = pt(uf, void 0);
    EE(r);
    const s = ue(() => a.value ? t.id : void 0), o = ue(() => {
      if (i && i.value === "tooltip")
        return t.open && t.id ? t.id : void 0;
    }), a = ue(() => {
      if (i && i.value !== "tooltip")
        return i.value;
    }), c = ue(() => a.value ? `${t.open}` : void 0);
    let l;
    const d = [
      "onMouseenter",
      "onMouseleave",
      "onClick",
      "onKeydown",
      "onFocus",
      "onBlur",
      "onContextmenu"
    ];
    return Jt(() => {
      Qe(() => t.virtualRef, (h) => {
        h && (r.value = er(h));
      }, {
        immediate: !0
      }), Qe(r, (h, f) => {
        l == null || l(), l = void 0, ys(h) && (d.forEach((g) => {
          var p;
          const u = t[g];
          u && (h.addEventListener(g.slice(2).toLowerCase(), u), (p = f == null ? void 0 : f.removeEventListener) == null || p.call(f, g.slice(2).toLowerCase(), u));
        }), l = Qe([s, o, a, c], (g) => {
          [
            "aria-controls",
            "aria-describedby",
            "aria-haspopup",
            "aria-expanded"
          ].forEach((p, u) => {
            Ci(g[u]) ? h.removeAttribute(p) : h.setAttribute(p, g[u]);
          });
        }, { immediate: !0 })), ys(f) && [
          "aria-controls",
          "aria-describedby",
          "aria-haspopup",
          "aria-expanded"
        ].forEach((g) => f.removeAttribute(g));
      }, {
        immediate: !0
      });
    }), ei(() => {
      if (l == null || l(), l = void 0, r.value && ys(r.value)) {
        const h = r.value;
        d.forEach((f) => {
          const g = t[f];
          g && h.removeEventListener(f.slice(2).toLowerCase(), g);
        }), r.value = void 0;
      }
    }), e({
      triggerRef: r
    }), (h, f) => h.virtualTriggering ? ke("v-if", !0) : (ve(), Ve(z(w2), Ei({ key: 0 }, h.$attrs, {
      "aria-controls": z(s),
      "aria-describedby": z(o),
      "aria-expanded": z(c),
      "aria-haspopup": z(a)
    }), {
      default: de(() => [
        He(h.$slots, "default")
      ]),
      _: 3
    }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
  }
});
var _2 = /* @__PURE__ */ st(S2, [["__file", "trigger.vue"]]);
const Uu = "focus-trap.focus-after-trapped", zu = "focus-trap.focus-after-released", T2 = "focus-trap.focusout-prevented", Sm = {
  cancelable: !0,
  bubbles: !1
}, E2 = {
  cancelable: !0,
  bubbles: !1
}, _m = "focusAfterTrapped", Tm = "focusAfterReleased", C2 = Symbol("elFocusTrap"), hf = Ee(), ou = Ee(0), df = Ee(0);
let El = 0;
const W0 = (n) => {
  const e = [], t = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, {
    acceptNode: (i) => {
      const r = i.tagName === "INPUT" && i.type === "hidden";
      return i.disabled || i.hidden || r ? NodeFilter.FILTER_SKIP : i.tabIndex >= 0 || i === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
    }
  });
  for (; t.nextNode(); )
    e.push(t.currentNode);
  return e;
}, Em = (n, e) => {
  for (const t of n)
    if (!L2(t, e))
      return t;
}, L2 = (n, e) => {
  if (process.env.NODE_ENV === "test")
    return !1;
  if (getComputedStyle(n).visibility === "hidden")
    return !0;
  for (; n; ) {
    if (e && n === e)
      return !1;
    if (getComputedStyle(n).display === "none")
      return !0;
    n = n.parentElement;
  }
  return !1;
}, R2 = (n) => {
  const e = W0(n), t = Em(e, n), i = Em(e.reverse(), n);
  return [t, i];
}, F2 = (n) => n instanceof HTMLInputElement && "select" in n, Tr = (n, e) => {
  if (n && n.focus) {
    const t = document.activeElement;
    n.focus({ preventScroll: !0 }), df.value = window.performance.now(), n !== t && F2(n) && e && n.select();
  }
};
function Cm(n, e) {
  const t = [...n], i = n.indexOf(e);
  return i !== -1 && t.splice(i, 1), t;
}
const P2 = () => {
  let n = [];
  return {
    push: (i) => {
      const r = n[0];
      r && i !== r && r.pause(), n = Cm(n, i), n.unshift(i);
    },
    remove: (i) => {
      var r, s;
      n = Cm(n, i), (s = (r = n[0]) == null ? void 0 : r.resume) == null || s.call(r);
    }
  };
}, I2 = (n, e = !1) => {
  const t = document.activeElement;
  for (const i of n)
    if (Tr(i, e), document.activeElement !== t)
      return;
}, Lm = P2(), O2 = () => ou.value > df.value, Cl = () => {
  hf.value = "pointer", ou.value = window.performance.now();
}, Rm = () => {
  hf.value = "keyboard", ou.value = window.performance.now();
}, D2 = () => (Jt(() => {
  El === 0 && (document.addEventListener("mousedown", Cl), document.addEventListener("touchstart", Cl), document.addEventListener("keydown", Rm)), El++;
}), ei(() => {
  El--, El <= 0 && (document.removeEventListener("mousedown", Cl), document.removeEventListener("touchstart", Cl), document.removeEventListener("keydown", Rm));
}), {
  focusReason: hf,
  lastUserFocusTimestamp: ou,
  lastAutomatedFocusTimestamp: df
}), Ll = (n) => new CustomEvent(T2, {
  ...E2,
  detail: n
}), N2 = Pe({
  name: "ElFocusTrap",
  inheritAttrs: !1,
  props: {
    loop: Boolean,
    trapped: Boolean,
    focusTrapEl: Object,
    focusStartEl: {
      type: [Object, String],
      default: "first"
    }
  },
  emits: [
    _m,
    Tm,
    "focusin",
    "focusout",
    "focusout-prevented",
    "release-requested"
  ],
  setup(n, { emit: e }) {
    const t = Ee();
    let i, r;
    const { focusReason: s } = D2();
    wE((p) => {
      n.trapped && !o.paused && e("release-requested", p);
    });
    const o = {
      paused: !1,
      pause() {
        this.paused = !0;
      },
      resume() {
        this.paused = !1;
      }
    }, a = (p) => {
      if (!n.loop && !n.trapped || o.paused)
        return;
      const { key: u, altKey: y, ctrlKey: v, metaKey: m, currentTarget: x, shiftKey: w } = p, { loop: A } = n, M = u === Li.tab && !y && !v && !m, R = document.activeElement;
      if (M && R) {
        const L = x, [_, F] = R2(L);
        if (_ && F) {
          if (!w && R === F) {
            const T = Ll({
              focusReason: s.value
            });
            e("focusout-prevented", T), T.defaultPrevented || (p.preventDefault(), A && Tr(_, !0));
          } else if (w && [_, L].includes(R)) {
            const T = Ll({
              focusReason: s.value
            });
            e("focusout-prevented", T), T.defaultPrevented || (p.preventDefault(), A && Tr(F, !0));
          }
        } else if (R === L) {
          const T = Ll({
            focusReason: s.value
          });
          e("focusout-prevented", T), T.defaultPrevented || p.preventDefault();
        }
      }
    };
    sn(C2, {
      focusTrapRef: t,
      onKeydown: a
    }), Qe(() => n.focusTrapEl, (p) => {
      p && (t.value = p);
    }, { immediate: !0 }), Qe([t], ([p], [u]) => {
      p && (p.addEventListener("keydown", a), p.addEventListener("focusin", d), p.addEventListener("focusout", h)), u && (u.removeEventListener("keydown", a), u.removeEventListener("focusin", d), u.removeEventListener("focusout", h));
    });
    const c = (p) => {
      e(_m, p);
    }, l = (p) => e(Tm, p), d = (p) => {
      const u = z(t);
      if (!u)
        return;
      const y = p.target, v = p.relatedTarget, m = y && u.contains(y);
      n.trapped || v && u.contains(v) || (i = v), m && e("focusin", p), !o.paused && n.trapped && (m ? r = y : Tr(r, !0));
    }, h = (p) => {
      const u = z(t);
      if (!(o.paused || !u))
        if (n.trapped) {
          const y = p.relatedTarget;
          !Ci(y) && !u.contains(y) && setTimeout(() => {
            if (!o.paused && n.trapped) {
              const v = Ll({
                focusReason: s.value
              });
              e("focusout-prevented", v), v.defaultPrevented || Tr(r, !0);
            }
          }, 0);
        } else {
          const y = p.target;
          y && u.contains(y) || e("focusout", p);
        }
    };
    async function f() {
      await bt();
      const p = z(t);
      if (p) {
        Lm.push(o);
        const u = p.contains(document.activeElement) ? i : document.activeElement;
        if (i = u, !p.contains(u)) {
          const v = new Event(Uu, Sm);
          p.addEventListener(Uu, c), p.dispatchEvent(v), v.defaultPrevented || bt(() => {
            let m = n.focusStartEl;
            vn(m) || (Tr(m), document.activeElement !== m && (m = "first")), m === "first" && I2(W0(p), !0), (document.activeElement === u || m === "container") && Tr(p);
          });
        }
      }
    }
    function g() {
      const p = z(t);
      if (p) {
        p.removeEventListener(Uu, c);
        const u = new CustomEvent(zu, {
          ...Sm,
          detail: {
            focusReason: s.value
          }
        });
        p.addEventListener(zu, l), p.dispatchEvent(u), !u.defaultPrevented && (s.value == "keyboard" || !O2() || p.contains(document.activeElement)) && Tr(i ?? document.body), p.removeEventListener(zu, l), Lm.remove(o);
      }
    }
    return Jt(() => {
      n.trapped && f(), Qe(() => n.trapped, (p) => {
        p ? f() : g();
      });
    }), ei(() => {
      n.trapped && g(), t.value && (t.value.removeEventListener("keydown", a), t.value.removeEventListener("focusin", d), t.value.removeEventListener("focusout", h), t.value = void 0);
    }), {
      onKeydown: a
    };
  }
});
function B2(n, e, t, i, r, s) {
  return He(n.$slots, "default", { handleKeydown: n.onKeydown });
}
var U2 = /* @__PURE__ */ st(N2, [["render", B2], ["__file", "focus-trap.vue"]]);
const z2 = ["fixed", "absolute"], k2 = at({
  boundariesPadding: {
    type: Number,
    default: 0
  },
  fallbackPlacements: {
    type: Je(Array),
    default: void 0
  },
  gpuAcceleration: {
    type: Boolean,
    default: !0
  },
  offset: {
    type: Number,
    default: 12
  },
  placement: {
    type: String,
    values: Yo,
    default: "bottom"
  },
  popperOptions: {
    type: Je(Object),
    default: () => ({})
  },
  strategy: {
    type: String,
    values: z2,
    default: "absolute"
  }
}), j0 = at({
  ...k2,
  id: String,
  style: {
    type: Je([String, Array, Object])
  },
  className: {
    type: Je([String, Array, Object])
  },
  effect: {
    type: Je(String),
    default: "dark"
  },
  visible: Boolean,
  enterable: {
    type: Boolean,
    default: !0
  },
  pure: Boolean,
  focusOnShow: {
    type: Boolean,
    default: !1
  },
  trapping: {
    type: Boolean,
    default: !1
  },
  popperClass: {
    type: Je([String, Array, Object])
  },
  popperStyle: {
    type: Je([String, Array, Object])
  },
  referenceEl: {
    type: Je(Object)
  },
  triggerTargetEl: {
    type: Je(Object)
  },
  stopPopperMouseEvent: {
    type: Boolean,
    default: !0
  },
  virtualTriggering: Boolean,
  zIndex: Number,
  ...Yr(["ariaLabel"])
}), V2 = {
  mouseenter: (n) => n instanceof MouseEvent,
  mouseleave: (n) => n instanceof MouseEvent,
  focus: () => !0,
  blur: () => !0,
  close: () => !0
}, G2 = (n, e = []) => {
  const { placement: t, strategy: i, popperOptions: r } = n, s = {
    placement: t,
    strategy: i,
    ...r,
    modifiers: [...W2(n), ...e]
  };
  return j2(s, r == null ? void 0 : r.modifiers), s;
}, H2 = (n) => {
  if (en)
    return er(n);
};
function W2(n) {
  const { offset: e, gpuAcceleration: t, fallbackPlacements: i } = n;
  return [
    {
      name: "offset",
      options: {
        offset: [0, e ?? 12]
      }
    },
    {
      name: "preventOverflow",
      options: {
        padding: {
          top: 2,
          bottom: 2,
          left: 5,
          right: 5
        }
      }
    },
    {
      name: "flip",
      options: {
        padding: 5,
        fallbackPlacements: i
      }
    },
    {
      name: "computeStyles",
      options: {
        gpuAcceleration: t
      }
    }
  ];
}
function j2(n, e) {
  e && (n.modifiers = [...n.modifiers, ...e ?? []]);
}
const $2 = 0, Z2 = (n) => {
  const { popperInstanceRef: e, contentRef: t, triggerRef: i, role: r } = pt(uf, void 0), s = Ee(), o = Ee(), a = ue(() => ({
    name: "eventListeners",
    enabled: !!n.visible
  })), c = ue(() => {
    var v;
    const m = z(s), x = (v = z(o)) != null ? v : $2;
    return {
      name: "arrow",
      enabled: !L_(m),
      options: {
        element: m,
        padding: x
      }
    };
  }), l = ue(() => ({
    onFirstUpdate: () => {
      p();
    },
    ...G2(n, [
      z(c),
      z(a)
    ])
  })), d = ue(() => H2(n.referenceEl) || z(i)), { attributes: h, state: f, styles: g, update: p, forceUpdate: u, instanceRef: y } = bE(d, t, l);
  return Qe(y, (v) => e.value = v), Jt(() => {
    Qe(() => {
      var v;
      return (v = z(d)) == null ? void 0 : v.getBoundingClientRect();
    }, () => {
      p();
    });
  }), {
    attributes: h,
    arrowRef: s,
    contentRef: t,
    instanceRef: y,
    state: f,
    styles: g,
    role: r,
    forceUpdate: u,
    update: p
  };
}, X2 = (n, {
  attributes: e,
  styles: t,
  role: i
}) => {
  const { nextZIndex: r } = I0(), s = nt("popper"), o = ue(() => z(e).popper), a = Ee(yt(n.zIndex) ? n.zIndex : r()), c = ue(() => [
    s.b(),
    s.is("pure", n.pure),
    s.is(n.effect),
    n.popperClass
  ]), l = ue(() => [
    { zIndex: z(a) },
    z(t).popper,
    n.popperStyle || {}
  ]), d = ue(() => i.value === "dialog" ? "false" : void 0), h = ue(() => z(t).arrow || {});
  return {
    ariaModal: d,
    arrowStyle: h,
    contentAttrs: o,
    contentClass: c,
    contentStyle: l,
    contentZIndex: a,
    updateZIndex: () => {
      a.value = yt(n.zIndex) ? n.zIndex : r();
    }
  };
}, Y2 = (n, e) => {
  const t = Ee(!1), i = Ee();
  return {
    focusStartRef: i,
    trapped: t,
    onFocusAfterReleased: (l) => {
      var d;
      ((d = l.detail) == null ? void 0 : d.focusReason) !== "pointer" && (i.value = "first", e("blur"));
    },
    onFocusAfterTrapped: () => {
      e("focus");
    },
    onFocusInTrap: (l) => {
      n.visible && !t.value && (l.target && (i.value = l.target), t.value = !0);
    },
    onFocusoutPrevented: (l) => {
      n.trapping || (l.detail.focusReason === "pointer" && l.preventDefault(), t.value = !1);
    },
    onReleaseRequested: () => {
      t.value = !1, e("close");
    }
  };
}, J2 = Pe({
  name: "ElPopperContent"
}), K2 = /* @__PURE__ */ Pe({
  ...J2,
  props: j0,
  emits: V2,
  setup(n, { expose: e, emit: t }) {
    const i = n, {
      focusStartRef: r,
      trapped: s,
      onFocusAfterReleased: o,
      onFocusAfterTrapped: a,
      onFocusInTrap: c,
      onFocusoutPrevented: l,
      onReleaseRequested: d
    } = Y2(i, t), { attributes: h, arrowRef: f, contentRef: g, styles: p, instanceRef: u, role: y, update: v } = Z2(i), {
      ariaModal: m,
      arrowStyle: x,
      contentAttrs: w,
      contentClass: A,
      contentStyle: M,
      updateZIndex: R
    } = X2(i, {
      styles: p,
      attributes: h,
      role: y
    }), L = pt(zc, void 0), _ = Ee();
    sn(z0, {
      arrowStyle: x,
      arrowRef: f,
      arrowOffset: _
    }), L && sn(zc, {
      ...L,
      addInputId: Oa,
      removeInputId: Oa
    });
    let F;
    const S = (E = !0) => {
      v(), E && R();
    }, T = () => {
      S(!1), i.visible && i.focusOnShow ? s.value = !0 : i.visible === !1 && (s.value = !1);
    };
    return Jt(() => {
      Qe(() => i.triggerTargetEl, (E, C) => {
        F == null || F(), F = void 0;
        const P = z(E || g.value), b = z(C || g.value);
        ys(P) && (F = Qe([y, () => i.ariaLabel, m, () => i.id], (I) => {
          ["role", "aria-label", "aria-modal", "id"].forEach((D, N) => {
            Ci(I[N]) ? P.removeAttribute(D) : P.setAttribute(D, I[N]);
          });
        }, { immediate: !0 })), b !== P && ys(b) && ["role", "aria-label", "aria-modal", "id"].forEach((I) => {
          b.removeAttribute(I);
        });
      }, { immediate: !0 }), Qe(() => i.visible, T, { immediate: !0 });
    }), ei(() => {
      F == null || F(), F = void 0;
    }), e({
      popperContentRef: g,
      popperInstanceRef: u,
      updatePopper: S,
      contentStyle: M
    }), (E, C) => (ve(), Ce("div", Ei({
      ref_key: "contentRef",
      ref: g
    }, z(w), {
      style: z(M),
      class: z(A),
      tabindex: "-1",
      onMouseenter: (P) => E.$emit("mouseenter", P),
      onMouseleave: (P) => E.$emit("mouseleave", P)
    }), [
      le(z(U2), {
        trapped: z(s),
        "trap-on-focus-in": !0,
        "focus-trap-el": z(g),
        "focus-start-el": z(r),
        onFocusAfterTrapped: z(a),
        onFocusAfterReleased: z(o),
        onFocusin: z(c),
        onFocusoutPrevented: z(l),
        onReleaseRequested: z(d)
      }, {
        default: de(() => [
          He(E.$slots, "default")
        ]),
        _: 3
      }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
    ], 16, ["onMouseenter", "onMouseleave"]));
  }
});
var q2 = /* @__PURE__ */ st(K2, [["__file", "content.vue"]]);
const Q2 = on(y2), ff = Symbol("elTooltip"), kn = at({
  ..._E,
  ...j0,
  appendTo: {
    type: Je([String, Object])
  },
  content: {
    type: String,
    default: ""
  },
  rawContent: Boolean,
  persistent: Boolean,
  visible: {
    type: Je(Boolean),
    default: null
  },
  transition: String,
  teleported: {
    type: Boolean,
    default: !0
  },
  disabled: Boolean,
  ...Yr(["ariaLabel"])
}), ka = at({
  ...H0,
  disabled: Boolean,
  trigger: {
    type: Je([String, Array]),
    default: "hover"
  },
  triggerKeys: {
    type: Je(Array),
    default: () => [Li.enter, Li.space]
  }
}), {
  useModelToggleProps: eC,
  useModelToggleEmits: tC,
  useModelToggle: nC
} = gT("visible"), iC = at({
  ...k0,
  ...eC,
  ...kn,
  ...ka,
  ...V0,
  showArrow: {
    type: Boolean,
    default: !0
  }
}), rC = [
  ...tC,
  "before-show",
  "before-hide",
  "show",
  "hide",
  "open",
  "close"
], sC = (n, e) => Pn(n) ? n.includes(e) : n === e, Ws = (n, e, t) => (i) => {
  sC(z(n), e) && t(i);
}, oC = Pe({
  name: "ElTooltipTrigger"
}), aC = /* @__PURE__ */ Pe({
  ...oC,
  props: ka,
  setup(n, { expose: e }) {
    const t = n, i = nt("tooltip"), { controlled: r, id: s, open: o, onOpen: a, onClose: c, onToggle: l } = pt(ff, void 0), d = Ee(null), h = () => {
      if (z(r) || t.disabled)
        return !0;
    }, f = hi(t, "trigger"), g = Ji(h, Ws(f, "hover", a)), p = Ji(h, Ws(f, "hover", c)), u = Ji(h, Ws(f, "click", (w) => {
      w.button === 0 && l(w);
    })), y = Ji(h, Ws(f, "focus", a)), v = Ji(h, Ws(f, "focus", c)), m = Ji(h, Ws(f, "contextmenu", (w) => {
      w.preventDefault(), l(w);
    })), x = Ji(h, (w) => {
      const { code: A } = w;
      t.triggerKeys.includes(A) && (w.preventDefault(), l(w));
    });
    return e({
      triggerRef: d
    }), (w, A) => (ve(), Ve(z(_2), {
      id: z(s),
      "virtual-ref": w.virtualRef,
      open: z(o),
      "virtual-triggering": w.virtualTriggering,
      class: Te(z(i).e("trigger")),
      onBlur: z(v),
      onClick: z(u),
      onContextmenu: z(m),
      onFocus: z(y),
      onMouseenter: z(g),
      onMouseleave: z(p),
      onKeydown: z(x)
    }, {
      default: de(() => [
        He(w.$slots, "default")
      ]),
      _: 3
    }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
  }
});
var lC = /* @__PURE__ */ st(aC, [["__file", "trigger.vue"]]);
const cC = at({
  to: {
    type: Je([String, Object]),
    required: !0
  },
  disabled: Boolean
}), uC = /* @__PURE__ */ Pe({
  __name: "teleport",
  props: cC,
  setup(n) {
    return (e, t) => e.disabled ? He(e.$slots, "default", { key: 0 }) : (ve(), Ve(jM, {
      key: 1,
      to: e.to
    }, [
      He(e.$slots, "default")
    ], 8, ["to"]));
  }
});
var hC = /* @__PURE__ */ st(uC, [["__file", "teleport.vue"]]);
const dC = on(hC), fC = Pe({
  name: "ElTooltipContent",
  inheritAttrs: !1
}), pC = /* @__PURE__ */ Pe({
  ...fC,
  props: kn,
  setup(n, { expose: e }) {
    const t = n, { selector: i } = L0(), r = nt("tooltip"), s = Ee(null);
    let o;
    const {
      controlled: a,
      id: c,
      open: l,
      trigger: d,
      onClose: h,
      onOpen: f,
      onShow: g,
      onHide: p,
      onBeforeShow: u,
      onBeforeHide: y
    } = pt(ff, void 0), v = ue(() => t.transition || `${r.namespace.value}-fade-in-linear`), m = ue(() => process.env.NODE_ENV === "test" ? !0 : t.persistent);
    ei(() => {
      o == null || o();
    });
    const x = ue(() => z(m) ? !0 : z(l)), w = ue(() => t.disabled ? !1 : z(l)), A = ue(() => t.appendTo || i.value), M = ue(() => {
      var b;
      return (b = t.style) != null ? b : {};
    }), R = Ee(!0), L = () => {
      p(), R.value = !0;
    }, _ = () => {
      if (z(a))
        return !0;
    }, F = Ji(_, () => {
      t.enterable && z(d) === "hover" && f();
    }), S = Ji(_, () => {
      z(d) === "hover" && h();
    }), T = () => {
      var b, I;
      (I = (b = s.value) == null ? void 0 : b.updatePopper) == null || I.call(b), u == null || u();
    }, E = () => {
      y == null || y();
    }, C = () => {
      g(), o = bw(ue(() => {
        var b;
        return (b = s.value) == null ? void 0 : b.popperContentRef;
      }), () => {
        if (z(a))
          return;
        z(d) !== "hover" && h();
      });
    }, P = () => {
      t.virtualTriggering || h();
    };
    return Qe(() => z(l), (b) => {
      b ? R.value = !1 : o == null || o();
    }, {
      flush: "post"
    }), Qe(() => t.content, () => {
      var b, I;
      (I = (b = s.value) == null ? void 0 : b.updatePopper) == null || I.call(b);
    }), e({
      contentRef: s
    }), (b, I) => (ve(), Ve(z(dC), {
      disabled: !b.teleported,
      to: z(A)
    }, {
      default: de(() => [
        le(el, {
          name: z(v),
          onAfterLeave: L,
          onBeforeEnter: T,
          onAfterEnter: C,
          onBeforeLeave: E
        }, {
          default: de(() => [
            z(x) ? Lt((ve(), Ve(z(q2), Ei({
              key: 0,
              id: z(c),
              ref_key: "contentRef",
              ref: s
            }, b.$attrs, {
              "aria-label": b.ariaLabel,
              "aria-hidden": R.value,
              "boundaries-padding": b.boundariesPadding,
              "fallback-placements": b.fallbackPlacements,
              "gpu-acceleration": b.gpuAcceleration,
              offset: b.offset,
              placement: b.placement,
              "popper-options": b.popperOptions,
              strategy: b.strategy,
              effect: b.effect,
              enterable: b.enterable,
              pure: b.pure,
              "popper-class": b.popperClass,
              "popper-style": [b.popperStyle, z(M)],
              "reference-el": b.referenceEl,
              "trigger-target-el": b.triggerTargetEl,
              visible: z(w),
              "z-index": b.zIndex,
              onMouseenter: z(F),
              onMouseleave: z(S),
              onBlur: P,
              onClose: z(h)
            }), {
              default: de(() => [
                He(b.$slots, "default")
              ]),
              _: 3
            }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
              [mn, z(w)]
            ]) : ke("v-if", !0)
          ]),
          _: 3
        }, 8, ["name"])
      ]),
      _: 3
    }, 8, ["disabled", "to"]));
  }
});
var mC = /* @__PURE__ */ st(pC, [["__file", "content.vue"]]);
const gC = Pe({
  name: "ElTooltip"
}), vC = /* @__PURE__ */ Pe({
  ...gC,
  props: iC,
  emits: rC,
  setup(n, { expose: e, emit: t }) {
    const i = n;
    SE();
    const r = sl(), s = Ee(), o = Ee(), a = () => {
      var v;
      const m = z(s);
      m && ((v = m.popperInstanceRef) == null || v.update());
    }, c = Ee(!1), l = Ee(), { show: d, hide: h, hasUpdateHandler: f } = nC({
      indicator: c,
      toggleReason: l
    }), { onOpen: g, onClose: p } = TE({
      showAfter: hi(i, "showAfter"),
      hideAfter: hi(i, "hideAfter"),
      autoClose: hi(i, "autoClose"),
      open: d,
      close: h
    }), u = ue(() => Ba(i.visible) && !f.value);
    sn(ff, {
      controlled: u,
      id: r,
      open: Bv(c),
      trigger: hi(i, "trigger"),
      onOpen: (v) => {
        g(v);
      },
      onClose: (v) => {
        p(v);
      },
      onToggle: (v) => {
        z(c) ? p(v) : g(v);
      },
      onShow: () => {
        t("show", l.value);
      },
      onHide: () => {
        t("hide", l.value);
      },
      onBeforeShow: () => {
        t("before-show", l.value);
      },
      onBeforeHide: () => {
        t("before-hide", l.value);
      },
      updatePopper: a
    }), Qe(() => i.disabled, (v) => {
      v && c.value && (c.value = !1);
    });
    const y = (v) => {
      var m, x;
      const w = (x = (m = o.value) == null ? void 0 : m.contentRef) == null ? void 0 : x.popperContentRef, A = (v == null ? void 0 : v.relatedTarget) || document.activeElement;
      return w && w.contains(A);
    };
    return $M(() => c.value && h()), e({
      popperRef: s,
      contentRef: o,
      isFocusInsideContent: y,
      updatePopper: a,
      onOpen: g,
      onClose: p,
      hide: h
    }), (v, m) => (ve(), Ve(z(Q2), {
      ref_key: "popperRef",
      ref: s,
      role: v.role
    }, {
      default: de(() => [
        le(lC, {
          disabled: v.disabled,
          trigger: v.trigger,
          "trigger-keys": v.triggerKeys,
          "virtual-ref": v.virtualRef,
          "virtual-triggering": v.virtualTriggering
        }, {
          default: de(() => [
            v.$slots.default ? He(v.$slots, "default", { key: 0 }) : ke("v-if", !0)
          ]),
          _: 3
        }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
        le(mC, {
          ref_key: "contentRef",
          ref: o,
          "aria-label": v.ariaLabel,
          "boundaries-padding": v.boundariesPadding,
          content: v.content,
          disabled: v.disabled,
          effect: v.effect,
          enterable: v.enterable,
          "fallback-placements": v.fallbackPlacements,
          "hide-after": v.hideAfter,
          "gpu-acceleration": v.gpuAcceleration,
          offset: v.offset,
          persistent: v.persistent,
          "popper-class": v.popperClass,
          "popper-style": v.popperStyle,
          placement: v.placement,
          "popper-options": v.popperOptions,
          pure: v.pure,
          "raw-content": v.rawContent,
          "reference-el": v.referenceEl,
          "trigger-target-el": v.triggerTargetEl,
          "show-after": v.showAfter,
          strategy: v.strategy,
          teleported: v.teleported,
          transition: v.transition,
          "virtual-triggering": v.virtualTriggering,
          "z-index": v.zIndex,
          "append-to": v.appendTo
        }, {
          default: de(() => [
            He(v.$slots, "content", {}, () => [
              v.rawContent ? (ve(), Ce("span", {
                key: 0,
                innerHTML: v.content
              }, null, 8, ["innerHTML"])) : (ve(), Ce("span", { key: 1 }, gt(v.content), 1))
            ]),
            v.showArrow ? (ve(), Ve(z(M2), {
              key: 0,
              "arrow-offset": v.arrowOffset
            }, null, 8, ["arrow-offset"])) : ke("v-if", !0)
          ]),
          _: 3
        }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
      ]),
      _: 3
    }, 8, ["role"]));
  }
});
var yC = /* @__PURE__ */ st(vC, [["__file", "tooltip.vue"]]);
const pf = on(yC), $0 = Symbol("buttonGroupContextKey"), bC = (n, e) => {
  p0({
    from: "type.text",
    replacement: "link",
    version: "3.0.0",
    scope: "props",
    ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  }, ue(() => n.type === "text"));
  const t = pt($0, void 0), i = af("button"), { form: r } = Jo(), s = Ns(ue(() => t == null ? void 0 : t.size)), o = ol(), a = Ee(), c = Xc(), l = ue(() => n.type || (t == null ? void 0 : t.type) || ""), d = ue(() => {
    var p, u, y;
    return (y = (u = n.autoInsertSpace) != null ? u : (p = i.value) == null ? void 0 : p.autoInsertSpace) != null ? y : !1;
  }), h = ue(() => n.tag === "button" ? {
    ariaDisabled: o.value || n.loading,
    disabled: o.value || n.loading,
    autofocus: n.autofocus,
    type: n.nativeType
  } : {}), f = ue(() => {
    var p;
    const u = (p = c.default) == null ? void 0 : p.call(c);
    if (d.value && (u == null ? void 0 : u.length) === 1) {
      const y = u[0];
      if ((y == null ? void 0 : y.type) === zv) {
        const v = y.children;
        return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(v.trim());
      }
    }
    return !1;
  });
  return {
    _disabled: o,
    _size: s,
    _type: l,
    _ref: a,
    _props: h,
    shouldAddSpace: f,
    handleClick: (p) => {
      if (o.value || n.loading) {
        p.stopPropagation();
        return;
      }
      n.nativeType === "reset" && (r == null || r.resetFields()), e("click", p);
    }
  };
}, xC = [
  "default",
  "primary",
  "success",
  "warning",
  "info",
  "danger",
  "text",
  ""
], MC = ["button", "submit", "reset"], Kh = at({
  size: Gr,
  disabled: Boolean,
  type: {
    type: String,
    values: xC,
    default: ""
  },
  icon: {
    type: Vr
  },
  nativeType: {
    type: String,
    values: MC,
    default: "button"
  },
  loading: Boolean,
  loadingIcon: {
    type: Vr,
    default: () => c0
  },
  plain: Boolean,
  text: Boolean,
  link: Boolean,
  bg: Boolean,
  autofocus: Boolean,
  round: Boolean,
  circle: Boolean,
  color: String,
  dark: Boolean,
  autoInsertSpace: {
    type: Boolean,
    default: void 0
  },
  tag: {
    type: Je([String, Object]),
    default: "button"
  }
}), wC = {
  click: (n) => n instanceof MouseEvent
};
function yn(n, e) {
  AC(n) && (n = "100%");
  var t = SC(n);
  return n = e === 360 ? n : Math.min(e, Math.max(0, parseFloat(n))), t && (n = parseInt(String(n * e), 10) / 100), Math.abs(n - e) < 1e-6 ? 1 : (e === 360 ? n = (n < 0 ? n % e + e : n % e) / parseFloat(String(e)) : n = n % e / parseFloat(String(e)), n);
}
function Rl(n) {
  return Math.min(1, Math.max(0, n));
}
function AC(n) {
  return typeof n == "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
}
function SC(n) {
  return typeof n == "string" && n.indexOf("%") !== -1;
}
function Z0(n) {
  return n = parseFloat(n), (isNaN(n) || n < 0 || n > 1) && (n = 1), n;
}
function Fl(n) {
  return n <= 1 ? "".concat(Number(n) * 100, "%") : n;
}
function ms(n) {
  return n.length === 1 ? "0" + n : String(n);
}
function _C(n, e, t) {
  return {
    r: yn(n, 255) * 255,
    g: yn(e, 255) * 255,
    b: yn(t, 255) * 255
  };
}
function Fm(n, e, t) {
  n = yn(n, 255), e = yn(e, 255), t = yn(t, 255);
  var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = 0, a = (i + r) / 2;
  if (i === r)
    o = 0, s = 0;
  else {
    var c = i - r;
    switch (o = a > 0.5 ? c / (2 - i - r) : c / (i + r), i) {
      case n:
        s = (e - t) / c + (e < t ? 6 : 0);
        break;
      case e:
        s = (t - n) / c + 2;
        break;
      case t:
        s = (n - e) / c + 4;
        break;
    }
    s /= 6;
  }
  return { h: s, s: o, l: a };
}
function ku(n, e, t) {
  return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * (6 * t) : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * (2 / 3 - t) * 6 : n;
}
function TC(n, e, t) {
  var i, r, s;
  if (n = yn(n, 360), e = yn(e, 100), t = yn(t, 100), e === 0)
    r = t, s = t, i = t;
  else {
    var o = t < 0.5 ? t * (1 + e) : t + e - t * e, a = 2 * t - o;
    i = ku(a, o, n + 1 / 3), r = ku(a, o, n), s = ku(a, o, n - 1 / 3);
  }
  return { r: i * 255, g: r * 255, b: s * 255 };
}
function Pm(n, e, t) {
  n = yn(n, 255), e = yn(e, 255), t = yn(t, 255);
  var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = i, a = i - r, c = i === 0 ? 0 : a / i;
  if (i === r)
    s = 0;
  else {
    switch (i) {
      case n:
        s = (e - t) / a + (e < t ? 6 : 0);
        break;
      case e:
        s = (t - n) / a + 2;
        break;
      case t:
        s = (n - e) / a + 4;
        break;
    }
    s /= 6;
  }
  return { h: s, s: c, v: o };
}
function EC(n, e, t) {
  n = yn(n, 360) * 6, e = yn(e, 100), t = yn(t, 100);
  var i = Math.floor(n), r = n - i, s = t * (1 - e), o = t * (1 - r * e), a = t * (1 - (1 - r) * e), c = i % 6, l = [t, o, s, s, a, t][c], d = [a, t, t, o, s, s][c], h = [s, s, a, t, t, o][c];
  return { r: l * 255, g: d * 255, b: h * 255 };
}
function Im(n, e, t, i) {
  var r = [
    ms(Math.round(n).toString(16)),
    ms(Math.round(e).toString(16)),
    ms(Math.round(t).toString(16))
  ];
  return i && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join("");
}
function CC(n, e, t, i, r) {
  var s = [
    ms(Math.round(n).toString(16)),
    ms(Math.round(e).toString(16)),
    ms(Math.round(t).toString(16)),
    ms(LC(i))
  ];
  return r && s[0].startsWith(s[0].charAt(1)) && s[1].startsWith(s[1].charAt(1)) && s[2].startsWith(s[2].charAt(1)) && s[3].startsWith(s[3].charAt(1)) ? s[0].charAt(0) + s[1].charAt(0) + s[2].charAt(0) + s[3].charAt(0) : s.join("");
}
function LC(n) {
  return Math.round(parseFloat(n) * 255).toString(16);
}
function Om(n) {
  return zn(n) / 255;
}
function zn(n) {
  return parseInt(n, 16);
}
function RC(n) {
  return {
    r: n >> 16,
    g: (n & 65280) >> 8,
    b: n & 255
  };
}
var qh = {
  aliceblue: "#f0f8ff",
  antiquewhite: "#faebd7",
  aqua: "#00ffff",
  aquamarine: "#7fffd4",
  azure: "#f0ffff",
  beige: "#f5f5dc",
  bisque: "#ffe4c4",
  black: "#000000",
  blanchedalmond: "#ffebcd",
  blue: "#0000ff",
  blueviolet: "#8a2be2",
  brown: "#a52a2a",
  burlywood: "#deb887",
  cadetblue: "#5f9ea0",
  chartreuse: "#7fff00",
  chocolate: "#d2691e",
  coral: "#ff7f50",
  cornflowerblue: "#6495ed",
  cornsilk: "#fff8dc",
  crimson: "#dc143c",
  cyan: "#00ffff",
  darkblue: "#00008b",
  darkcyan: "#008b8b",
  darkgoldenrod: "#b8860b",
  darkgray: "#a9a9a9",
  darkgreen: "#006400",
  darkgrey: "#a9a9a9",
  darkkhaki: "#bdb76b",
  darkmagenta: "#8b008b",
  darkolivegreen: "#556b2f",
  darkorange: "#ff8c00",
  darkorchid: "#9932cc",
  darkred: "#8b0000",
  darksalmon: "#e9967a",
  darkseagreen: "#8fbc8f",
  darkslateblue: "#483d8b",
  darkslategray: "#2f4f4f",
  darkslategrey: "#2f4f4f",
  darkturquoise: "#00ced1",
  darkviolet: "#9400d3",
  deeppink: "#ff1493",
  deepskyblue: "#00bfff",
  dimgray: "#696969",
  dimgrey: "#696969",
  dodgerblue: "#1e90ff",
  firebrick: "#b22222",
  floralwhite: "#fffaf0",
  forestgreen: "#228b22",
  fuchsia: "#ff00ff",
  gainsboro: "#dcdcdc",
  ghostwhite: "#f8f8ff",
  goldenrod: "#daa520",
  gold: "#ffd700",
  gray: "#808080",
  green: "#008000",
  greenyellow: "#adff2f",
  grey: "#808080",
  honeydew: "#f0fff0",
  hotpink: "#ff69b4",
  indianred: "#cd5c5c",
  indigo: "#4b0082",
  ivory: "#fffff0",
  khaki: "#f0e68c",
  lavenderblush: "#fff0f5",
  lavender: "#e6e6fa",
  lawngreen: "#7cfc00",
  lemonchiffon: "#fffacd",
  lightblue: "#add8e6",
  lightcoral: "#f08080",
  lightcyan: "#e0ffff",
  lightgoldenrodyellow: "#fafad2",
  lightgray: "#d3d3d3",
  lightgreen: "#90ee90",
  lightgrey: "#d3d3d3",
  lightpink: "#ffb6c1",
  lightsalmon: "#ffa07a",
  lightseagreen: "#20b2aa",
  lightskyblue: "#87cefa",
  lightslategray: "#778899",
  lightslategrey: "#778899",
  lightsteelblue: "#b0c4de",
  lightyellow: "#ffffe0",
  lime: "#00ff00",
  limegreen: "#32cd32",
  linen: "#faf0e6",
  magenta: "#ff00ff",
  maroon: "#800000",
  mediumaquamarine: "#66cdaa",
  mediumblue: "#0000cd",
  mediumorchid: "#ba55d3",
  mediumpurple: "#9370db",
  mediumseagreen: "#3cb371",
  mediumslateblue: "#7b68ee",
  mediumspringgreen: "#00fa9a",
  mediumturquoise: "#48d1cc",
  mediumvioletred: "#c71585",
  midnightblue: "#191970",
  mintcream: "#f5fffa",
  mistyrose: "#ffe4e1",
  moccasin: "#ffe4b5",
  navajowhite: "#ffdead",
  navy: "#000080",
  oldlace: "#fdf5e6",
  olive: "#808000",
  olivedrab: "#6b8e23",
  orange: "#ffa500",
  orangered: "#ff4500",
  orchid: "#da70d6",
  palegoldenrod: "#eee8aa",
  palegreen: "#98fb98",
  paleturquoise: "#afeeee",
  palevioletred: "#db7093",
  papayawhip: "#ffefd5",
  peachpuff: "#ffdab9",
  peru: "#cd853f",
  pink: "#ffc0cb",
  plum: "#dda0dd",
  powderblue: "#b0e0e6",
  purple: "#800080",
  rebeccapurple: "#663399",
  red: "#ff0000",
  rosybrown: "#bc8f8f",
  royalblue: "#4169e1",
  saddlebrown: "#8b4513",
  salmon: "#fa8072",
  sandybrown: "#f4a460",
  seagreen: "#2e8b57",
  seashell: "#fff5ee",
  sienna: "#a0522d",
  silver: "#c0c0c0",
  skyblue: "#87ceeb",
  slateblue: "#6a5acd",
  slategray: "#708090",
  slategrey: "#708090",
  snow: "#fffafa",
  springgreen: "#00ff7f",
  steelblue: "#4682b4",
  tan: "#d2b48c",
  teal: "#008080",
  thistle: "#d8bfd8",
  tomato: "#ff6347",
  turquoise: "#40e0d0",
  violet: "#ee82ee",
  wheat: "#f5deb3",
  white: "#ffffff",
  whitesmoke: "#f5f5f5",
  yellow: "#ffff00",
  yellowgreen: "#9acd32"
};
function FC(n) {
  var e = { r: 0, g: 0, b: 0 }, t = 1, i = null, r = null, s = null, o = !1, a = !1;
  return typeof n == "string" && (n = OC(n)), typeof n == "object" && (Hi(n.r) && Hi(n.g) && Hi(n.b) ? (e = _C(n.r, n.g, n.b), o = !0, a = String(n.r).substr(-1) === "%" ? "prgb" : "rgb") : Hi(n.h) && Hi(n.s) && Hi(n.v) ? (i = Fl(n.s), r = Fl(n.v), e = EC(n.h, i, r), o = !0, a = "hsv") : Hi(n.h) && Hi(n.s) && Hi(n.l) && (i = Fl(n.s), s = Fl(n.l), e = TC(n.h, i, s), o = !0, a = "hsl"), Object.prototype.hasOwnProperty.call(n, "a") && (t = n.a)), t = Z0(t), {
    ok: o,
    format: n.format || a,
    r: Math.min(255, Math.max(e.r, 0)),
    g: Math.min(255, Math.max(e.g, 0)),
    b: Math.min(255, Math.max(e.b, 0)),
    a: t
  };
}
var PC = "[-\\+]?\\d+%?", IC = "[-\\+]?\\d*\\.\\d+%?", Fr = "(?:".concat(IC, ")|(?:").concat(PC, ")"), Vu = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?"), Gu = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?"), li = {
  CSS_UNIT: new RegExp(Fr),
  rgb: new RegExp("rgb" + Vu),
  rgba: new RegExp("rgba" + Gu),
  hsl: new RegExp("hsl" + Vu),
  hsla: new RegExp("hsla" + Gu),
  hsv: new RegExp("hsv" + Vu),
  hsva: new RegExp("hsva" + Gu),
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function OC(n) {
  if (n = n.trim().toLowerCase(), n.length === 0)
    return !1;
  var e = !1;
  if (qh[n])
    n = qh[n], e = !0;
  else if (n === "transparent")
    return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  var t = li.rgb.exec(n);
  return t ? { r: t[1], g: t[2], b: t[3] } : (t = li.rgba.exec(n), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = li.hsl.exec(n), t ? { h: t[1], s: t[2], l: t[3] } : (t = li.hsla.exec(n), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = li.hsv.exec(n), t ? { h: t[1], s: t[2], v: t[3] } : (t = li.hsva.exec(n), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = li.hex8.exec(n), t ? {
    r: zn(t[1]),
    g: zn(t[2]),
    b: zn(t[3]),
    a: Om(t[4]),
    format: e ? "name" : "hex8"
  } : (t = li.hex6.exec(n), t ? {
    r: zn(t[1]),
    g: zn(t[2]),
    b: zn(t[3]),
    format: e ? "name" : "hex"
  } : (t = li.hex4.exec(n), t ? {
    r: zn(t[1] + t[1]),
    g: zn(t[2] + t[2]),
    b: zn(t[3] + t[3]),
    a: Om(t[4] + t[4]),
    format: e ? "name" : "hex8"
  } : (t = li.hex3.exec(n), t ? {
    r: zn(t[1] + t[1]),
    g: zn(t[2] + t[2]),
    b: zn(t[3] + t[3]),
    format: e ? "name" : "hex"
  } : !1)))))))));
}
function Hi(n) {
  return !!li.CSS_UNIT.exec(String(n));
}
var DC = (
  /** @class */
  function() {
    function n(e, t) {
      e === void 0 && (e = ""), t === void 0 && (t = {});
      var i;
      if (e instanceof n)
        return e;
      typeof e == "number" && (e = RC(e)), this.originalInput = e;
      var r = FC(e);
      this.originalInput = e, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (i = t.format) !== null && i !== void 0 ? i : r.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok;
    }
    return n.prototype.isDark = function() {
      return this.getBrightness() < 128;
    }, n.prototype.isLight = function() {
      return !this.isDark();
    }, n.prototype.getBrightness = function() {
      var e = this.toRgb();
      return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3;
    }, n.prototype.getLuminance = function() {
      var e = this.toRgb(), t, i, r, s = e.r / 255, o = e.g / 255, a = e.b / 255;
      return s <= 0.03928 ? t = s / 12.92 : t = Math.pow((s + 0.055) / 1.055, 2.4), o <= 0.03928 ? i = o / 12.92 : i = Math.pow((o + 0.055) / 1.055, 2.4), a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * i + 0.0722 * r;
    }, n.prototype.getAlpha = function() {
      return this.a;
    }, n.prototype.setAlpha = function(e) {
      return this.a = Z0(e), this.roundA = Math.round(100 * this.a) / 100, this;
    }, n.prototype.isMonochrome = function() {
      var e = this.toHsl().s;
      return e === 0;
    }, n.prototype.toHsv = function() {
      var e = Pm(this.r, this.g, this.b);
      return { h: e.h * 360, s: e.s, v: e.v, a: this.a };
    }, n.prototype.toHsvString = function() {
      var e = Pm(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.v * 100);
      return this.a === 1 ? "hsv(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsva(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")");
    }, n.prototype.toHsl = function() {
      var e = Fm(this.r, this.g, this.b);
      return { h: e.h * 360, s: e.s, l: e.l, a: this.a };
    }, n.prototype.toHslString = function() {
      var e = Fm(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.l * 100);
      return this.a === 1 ? "hsl(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsla(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")");
    }, n.prototype.toHex = function(e) {
      return e === void 0 && (e = !1), Im(this.r, this.g, this.b, e);
    }, n.prototype.toHexString = function(e) {
      return e === void 0 && (e = !1), "#" + this.toHex(e);
    }, n.prototype.toHex8 = function(e) {
      return e === void 0 && (e = !1), CC(this.r, this.g, this.b, this.a, e);
    }, n.prototype.toHex8String = function(e) {
      return e === void 0 && (e = !1), "#" + this.toHex8(e);
    }, n.prototype.toHexShortString = function(e) {
      return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e);
    }, n.prototype.toRgb = function() {
      return {
        r: Math.round(this.r),
        g: Math.round(this.g),
        b: Math.round(this.b),
        a: this.a
      };
    }, n.prototype.toRgbString = function() {
      var e = Math.round(this.r), t = Math.round(this.g), i = Math.round(this.b);
      return this.a === 1 ? "rgb(".concat(e, ", ").concat(t, ", ").concat(i, ")") : "rgba(".concat(e, ", ").concat(t, ", ").concat(i, ", ").concat(this.roundA, ")");
    }, n.prototype.toPercentageRgb = function() {
      var e = function(t) {
        return "".concat(Math.round(yn(t, 255) * 100), "%");
      };
      return {
        r: e(this.r),
        g: e(this.g),
        b: e(this.b),
        a: this.a
      };
    }, n.prototype.toPercentageRgbString = function() {
      var e = function(t) {
        return Math.round(yn(t, 255) * 100);
      };
      return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")");
    }, n.prototype.toName = function() {
      if (this.a === 0)
        return "transparent";
      if (this.a < 1)
        return !1;
      for (var e = "#" + Im(this.r, this.g, this.b, !1), t = 0, i = Object.entries(qh); t < i.length; t++) {
        var r = i[t], s = r[0], o = r[1];
        if (e === o)
          return s;
      }
      return !1;
    }, n.prototype.toString = function(e) {
      var t = !!e;
      e = e ?? this.format;
      var i = !1, r = this.a < 1 && this.a >= 0, s = !t && r && (e.startsWith("hex") || e === "name");
      return s ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (i = this.toRgbString()), e === "prgb" && (i = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (i = this.toHexString()), e === "hex3" && (i = this.toHexString(!0)), e === "hex4" && (i = this.toHex8String(!0)), e === "hex8" && (i = this.toHex8String()), e === "name" && (i = this.toName()), e === "hsl" && (i = this.toHslString()), e === "hsv" && (i = this.toHsvString()), i || this.toHexString());
    }, n.prototype.toNumber = function() {
      return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
    }, n.prototype.clone = function() {
      return new n(this.toString());
    }, n.prototype.lighten = function(e) {
      e === void 0 && (e = 10);
      var t = this.toHsl();
      return t.l += e / 100, t.l = Rl(t.l), new n(t);
    }, n.prototype.brighten = function(e) {
      e === void 0 && (e = 10);
      var t = this.toRgb();
      return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), new n(t);
    }, n.prototype.darken = function(e) {
      e === void 0 && (e = 10);
      var t = this.toHsl();
      return t.l -= e / 100, t.l = Rl(t.l), new n(t);
    }, n.prototype.tint = function(e) {
      return e === void 0 && (e = 10), this.mix("white", e);
    }, n.prototype.shade = function(e) {
      return e === void 0 && (e = 10), this.mix("black", e);
    }, n.prototype.desaturate = function(e) {
      e === void 0 && (e = 10);
      var t = this.toHsl();
      return t.s -= e / 100, t.s = Rl(t.s), new n(t);
    }, n.prototype.saturate = function(e) {
      e === void 0 && (e = 10);
      var t = this.toHsl();
      return t.s += e / 100, t.s = Rl(t.s), new n(t);
    }, n.prototype.greyscale = function() {
      return this.desaturate(100);
    }, n.prototype.spin = function(e) {
      var t = this.toHsl(), i = (t.h + e) % 360;
      return t.h = i < 0 ? 360 + i : i, new n(t);
    }, n.prototype.mix = function(e, t) {
      t === void 0 && (t = 50);
      var i = this.toRgb(), r = new n(e).toRgb(), s = t / 100, o = {
        r: (r.r - i.r) * s + i.r,
        g: (r.g - i.g) * s + i.g,
        b: (r.b - i.b) * s + i.b,
        a: (r.a - i.a) * s + i.a
      };
      return new n(o);
    }, n.prototype.analogous = function(e, t) {
      e === void 0 && (e = 6), t === void 0 && (t = 30);
      var i = this.toHsl(), r = 360 / t, s = [this];
      for (i.h = (i.h - (r * e >> 1) + 720) % 360; --e; )
        i.h = (i.h + r) % 360, s.push(new n(i));
      return s;
    }, n.prototype.complement = function() {
      var e = this.toHsl();
      return e.h = (e.h + 180) % 360, new n(e);
    }, n.prototype.monochromatic = function(e) {
      e === void 0 && (e = 6);
      for (var t = this.toHsv(), i = t.h, r = t.s, s = t.v, o = [], a = 1 / e; e--; )
        o.push(new n({ h: i, s: r, v: s })), s = (s + a) % 1;
      return o;
    }, n.prototype.splitcomplement = function() {
      var e = this.toHsl(), t = e.h;
      return [
        this,
        new n({ h: (t + 72) % 360, s: e.s, l: e.l }),
        new n({ h: (t + 216) % 360, s: e.s, l: e.l })
      ];
    }, n.prototype.onBackground = function(e) {
      var t = this.toRgb(), i = new n(e).toRgb(), r = t.a + i.a * (1 - t.a);
      return new n({
        r: (t.r * t.a + i.r * i.a * (1 - t.a)) / r,
        g: (t.g * t.a + i.g * i.a * (1 - t.a)) / r,
        b: (t.b * t.a + i.b * i.a * (1 - t.a)) / r,
        a: r
      });
    }, n.prototype.triad = function() {
      return this.polyad(3);
    }, n.prototype.tetrad = function() {
      return this.polyad(4);
    }, n.prototype.polyad = function(e) {
      for (var t = this.toHsl(), i = t.h, r = [this], s = 360 / e, o = 1; o < e; o++)
        r.push(new n({ h: (i + o * s) % 360, s: t.s, l: t.l }));
      return r;
    }, n.prototype.equals = function(e) {
      return this.toRgbString() === new n(e).toRgbString();
    }, n;
  }()
);
function gr(n, e = 20) {
  return n.mix("#141414", e).toString();
}
function NC(n) {
  const e = ol(), t = nt("button");
  return ue(() => {
    let i = {}, r = n.color;
    if (r) {
      const s = r.match(/var\((.*?)\)/);
      s && (r = window.getComputedStyle(window.document.documentElement).getPropertyValue(s[1]));
      const o = new DC(r), a = n.dark ? o.tint(20).toString() : gr(o, 20);
      if (n.plain)
        i = t.cssVarBlock({
          "bg-color": n.dark ? gr(o, 90) : o.tint(90).toString(),
          "text-color": r,
          "border-color": n.dark ? gr(o, 50) : o.tint(50).toString(),
          "hover-text-color": `var(${t.cssVarName("color-white")})`,
          "hover-bg-color": r,
          "hover-border-color": r,
          "active-bg-color": a,
          "active-text-color": `var(${t.cssVarName("color-white")})`,
          "active-border-color": a
        }), e.value && (i[t.cssVarBlockName("disabled-bg-color")] = n.dark ? gr(o, 90) : o.tint(90).toString(), i[t.cssVarBlockName("disabled-text-color")] = n.dark ? gr(o, 50) : o.tint(50).toString(), i[t.cssVarBlockName("disabled-border-color")] = n.dark ? gr(o, 80) : o.tint(80).toString());
      else {
        const c = n.dark ? gr(o, 30) : o.tint(30).toString(), l = o.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`;
        if (i = t.cssVarBlock({
          "bg-color": r,
          "text-color": l,
          "border-color": r,
          "hover-bg-color": c,
          "hover-text-color": l,
          "hover-border-color": c,
          "active-bg-color": a,
          "active-border-color": a
        }), e.value) {
          const d = n.dark ? gr(o, 50) : o.tint(50).toString();
          i[t.cssVarBlockName("disabled-bg-color")] = d, i[t.cssVarBlockName("disabled-text-color")] = n.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, i[t.cssVarBlockName("disabled-border-color")] = d;
        }
      }
    }
    return i;
  });
}
const BC = Pe({
  name: "ElButton"
}), UC = /* @__PURE__ */ Pe({
  ...BC,
  props: Kh,
  emits: wC,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = NC(i), s = nt("button"), { _ref: o, _size: a, _type: c, _disabled: l, _props: d, shouldAddSpace: h, handleClick: f } = bC(i, t), g = ue(() => [
      s.b(),
      s.m(c.value),
      s.m(a.value),
      s.is("disabled", l.value),
      s.is("loading", i.loading),
      s.is("plain", i.plain),
      s.is("round", i.round),
      s.is("circle", i.circle),
      s.is("text", i.text),
      s.is("link", i.link),
      s.is("has-bg", i.bg)
    ]);
    return e({
      ref: o,
      size: a,
      type: c,
      disabled: l,
      shouldAddSpace: h
    }), (p, u) => (ve(), Ve(Fn(p.tag), Ei({
      ref_key: "_ref",
      ref: o
    }, z(d), {
      class: z(g),
      style: z(r),
      onClick: z(f)
    }), {
      default: de(() => [
        p.loading ? (ve(), Ce(Ft, { key: 0 }, [
          p.$slots.loading ? He(p.$slots, "loading", { key: 0 }) : (ve(), Ve(z(It), {
            key: 1,
            class: Te(z(s).is("loading"))
          }, {
            default: de(() => [
              (ve(), Ve(Fn(p.loadingIcon)))
            ]),
            _: 1
          }, 8, ["class"]))
        ], 64)) : p.icon || p.$slots.icon ? (ve(), Ve(z(It), { key: 1 }, {
          default: de(() => [
            p.icon ? (ve(), Ve(Fn(p.icon), { key: 0 })) : He(p.$slots, "icon", { key: 1 })
          ]),
          _: 3
        })) : ke("v-if", !0),
        p.$slots.default ? (ve(), Ce("span", {
          key: 2,
          class: Te({ [z(s).em("text", "expand")]: z(h) })
        }, [
          He(p.$slots, "default")
        ], 2)) : ke("v-if", !0)
      ]),
      _: 3
    }, 16, ["class", "style", "onClick"]));
  }
});
var zC = /* @__PURE__ */ st(UC, [["__file", "button.vue"]]);
const kC = {
  size: Kh.size,
  type: Kh.type
}, VC = Pe({
  name: "ElButtonGroup"
}), GC = /* @__PURE__ */ Pe({
  ...VC,
  props: kC,
  setup(n) {
    const e = n;
    sn($0, jn({
      size: hi(e, "size"),
      type: hi(e, "type")
    }));
    const t = nt("button");
    return (i, r) => (ve(), Ce("div", {
      class: Te(z(t).b("group"))
    }, [
      He(i.$slots, "default")
    ], 2));
  }
});
var X0 = /* @__PURE__ */ st(GC, [["__file", "button-group.vue"]]);
const Ko = on(zC, {
  ButtonGroup: X0
});
vi(X0);
var Lr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function HC(n) {
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
function au(n) {
  if (n.__esModule) return n;
  var e = n.default;
  if (typeof e == "function") {
    var t = function i() {
      return this instanceof i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
    };
    t.prototype = e.prototype;
  } else t = {};
  return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(n).forEach(function(i) {
    var r = Object.getOwnPropertyDescriptor(n, i);
    Object.defineProperty(t, i, r.get ? r : {
      enumerable: !0,
      get: function() {
        return n[i];
      }
    });
  }), t;
}
const Er = /* @__PURE__ */ new Map();
if (en) {
  let n;
  document.addEventListener("mousedown", (e) => n = e), document.addEventListener("mouseup", (e) => {
    if (n) {
      for (const t of Er.values())
        for (const { documentHandler: i } of t)
          i(e, n);
      n = void 0;
    }
  });
}
function Dm(n, e) {
  let t = [];
  return Array.isArray(e.arg) ? t = e.arg : ys(e.arg) && t.push(e.arg), function(i, r) {
    const s = e.instance.popperRef, o = i.target, a = r == null ? void 0 : r.target, c = !e || !e.instance, l = !o || !a, d = n.contains(o) || n.contains(a), h = n === o, f = t.length && t.some((p) => p == null ? void 0 : p.contains(o)) || t.length && t.includes(a), g = s && (s.contains(o) || s.contains(a));
    c || l || d || h || f || g || e.value(i, r);
  };
}
const WC = {
  beforeMount(n, e) {
    Er.has(n) || Er.set(n, []), Er.get(n).push({
      documentHandler: Dm(n, e),
      bindingFn: e.value
    });
  },
  updated(n, e) {
    Er.has(n) || Er.set(n, []);
    const t = Er.get(n), i = t.findIndex((s) => s.bindingFn === e.oldValue), r = {
      documentHandler: Dm(n, e),
      bindingFn: e.value
    };
    i >= 0 ? t.splice(i, 1, r) : t.push(r);
  },
  unmounted(n) {
    Er.delete(n);
  }
}, jC = 100, $C = 600, Nm = {
  beforeMount(n, e) {
    const t = e.value, { interval: i = jC, delay: r = $C } = Sn(t) ? {} : t;
    let s, o;
    const a = () => Sn(t) ? t() : t.handler(), c = () => {
      o && (clearTimeout(o), o = void 0), s && (clearInterval(s), s = void 0);
    };
    n.addEventListener("mousedown", (l) => {
      l.button === 0 && (c(), a(), document.addEventListener("mouseup", () => c(), {
        once: !0
      }), o = setTimeout(() => {
        s = setInterval(() => {
          a();
        }, i);
      }, r));
    });
  }
}, Y0 = at({
  modelValue: {
    type: [String, Number, Boolean],
    default: void 0
  },
  size: Gr,
  disabled: Boolean,
  label: {
    type: [String, Number, Boolean],
    default: void 0
  },
  value: {
    type: [String, Number, Boolean],
    default: void 0
  },
  name: {
    type: String,
    default: void 0
  }
}), ZC = at({
  ...Y0,
  border: Boolean
}), J0 = {
  [At]: (n) => vn(n) || yt(n) || Ba(n),
  [hr]: (n) => vn(n) || yt(n) || Ba(n)
}, K0 = Symbol("radioGroupKey"), q0 = (n, e) => {
  const t = Ee(), i = pt(K0, void 0), r = ue(() => !!i), s = ue(() => im(n.value) ? n.label : n.value), o = ue({
    get() {
      return r.value ? i.modelValue : n.modelValue;
    },
    set(h) {
      r.value ? i.changeEvent(h) : e && e(At, h), t.value.checked = n.modelValue === s.value;
    }
  }), a = Ns(ue(() => i == null ? void 0 : i.size)), c = ol(ue(() => i == null ? void 0 : i.disabled)), l = Ee(!1), d = ue(() => c.value || r.value && o.value !== s.value ? -1 : 0);
  return p0({
    from: "label act as value",
    replacement: "value",
    version: "3.0.0",
    scope: "el-radio",
    ref: "https://element-plus.org/en-US/component/radio.html"
  }, ue(() => r.value && im(n.value))), {
    radioRef: t,
    isGroup: r,
    radioGroup: i,
    focus: l,
    size: a,
    disabled: c,
    tabIndex: d,
    modelValue: o,
    actualValue: s
  };
}, XC = Pe({
  name: "ElRadio"
}), YC = /* @__PURE__ */ Pe({
  ...XC,
  props: ZC,
  emits: J0,
  setup(n, { emit: e }) {
    const t = n, i = nt("radio"), { radioRef: r, radioGroup: s, focus: o, size: a, disabled: c, modelValue: l, actualValue: d } = q0(t, e);
    function h() {
      bt(() => e("change", l.value));
    }
    return (f, g) => {
      var p;
      return ve(), Ce("label", {
        class: Te([
          z(i).b(),
          z(i).is("disabled", z(c)),
          z(i).is("focus", z(o)),
          z(i).is("bordered", f.border),
          z(i).is("checked", z(l) === z(d)),
          z(i).m(z(a))
        ])
      }, [
        Ne("span", {
          class: Te([
            z(i).e("input"),
            z(i).is("disabled", z(c)),
            z(i).is("checked", z(l) === z(d))
          ])
        }, [
          Lt(Ne("input", {
            ref_key: "radioRef",
            ref: r,
            "onUpdate:modelValue": (u) => Zc(l) ? l.value = u : null,
            class: Te(z(i).e("original")),
            value: z(d),
            name: f.name || ((p = z(s)) == null ? void 0 : p.name),
            disabled: z(c),
            checked: z(l) === z(d),
            type: "radio",
            onFocus: (u) => o.value = !0,
            onBlur: (u) => o.value = !1,
            onChange: h,
            onClick: Ut(() => {
            }, ["stop"])
          }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
            [kv, z(l)]
          ]),
          Ne("span", {
            class: Te(z(i).e("inner"))
          }, null, 2)
        ], 2),
        Ne("span", {
          class: Te(z(i).e("label")),
          onKeydown: Ut(() => {
          }, ["stop"])
        }, [
          He(f.$slots, "default", {}, () => [
            rt(gt(f.label), 1)
          ])
        ], 42, ["onKeydown"])
      ], 2);
    };
  }
});
var JC = /* @__PURE__ */ st(YC, [["__file", "radio.vue"]]);
const KC = at({
  ...Y0
}), qC = Pe({
  name: "ElRadioButton"
}), QC = /* @__PURE__ */ Pe({
  ...qC,
  props: KC,
  setup(n) {
    const e = n, t = nt("radio"), { radioRef: i, focus: r, size: s, disabled: o, modelValue: a, radioGroup: c, actualValue: l } = q0(e), d = ue(() => ({
      backgroundColor: (c == null ? void 0 : c.fill) || "",
      borderColor: (c == null ? void 0 : c.fill) || "",
      boxShadow: c != null && c.fill ? `-1px 0 0 0 ${c.fill}` : "",
      color: (c == null ? void 0 : c.textColor) || ""
    }));
    return (h, f) => {
      var g;
      return ve(), Ce("label", {
        class: Te([
          z(t).b("button"),
          z(t).is("active", z(a) === z(l)),
          z(t).is("disabled", z(o)),
          z(t).is("focus", z(r)),
          z(t).bm("button", z(s))
        ])
      }, [
        Lt(Ne("input", {
          ref_key: "radioRef",
          ref: i,
          "onUpdate:modelValue": (p) => Zc(a) ? a.value = p : null,
          class: Te(z(t).be("button", "original-radio")),
          value: z(l),
          type: "radio",
          name: h.name || ((g = z(c)) == null ? void 0 : g.name),
          disabled: z(o),
          onFocus: (p) => r.value = !0,
          onBlur: (p) => r.value = !1,
          onClick: Ut(() => {
          }, ["stop"])
        }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
          [kv, z(a)]
        ]),
        Ne("span", {
          class: Te(z(t).be("button", "inner")),
          style: Rt(z(a) === z(l) ? z(d) : {}),
          onKeydown: Ut(() => {
          }, ["stop"])
        }, [
          He(h.$slots, "default", {}, () => [
            rt(gt(h.label), 1)
          ])
        ], 46, ["onKeydown"])
      ], 2);
    };
  }
});
var Q0 = /* @__PURE__ */ st(QC, [["__file", "radio-button.vue"]]);
const eL = at({
  id: {
    type: String,
    default: void 0
  },
  size: Gr,
  disabled: Boolean,
  modelValue: {
    type: [String, Number, Boolean],
    default: void 0
  },
  fill: {
    type: String,
    default: ""
  },
  textColor: {
    type: String,
    default: ""
  },
  name: {
    type: String,
    default: void 0
  },
  validateEvent: {
    type: Boolean,
    default: !0
  },
  ...Yr(["ariaLabel"])
}), tL = J0, nL = Pe({
  name: "ElRadioGroup"
}), iL = /* @__PURE__ */ Pe({
  ...nL,
  props: eL,
  emits: tL,
  setup(n, { emit: e }) {
    const t = n, i = nt("radio"), r = sl(), s = Ee(), { formItem: o } = Jo(), { inputId: a, isLabeledByFormItem: c } = su(t, {
      formItemContext: o
    }), l = (h) => {
      e(At, h), bt(() => e("change", h));
    };
    Jt(() => {
      const h = s.value.querySelectorAll("[type=radio]"), f = h[0];
      !Array.from(h).some((g) => g.checked) && f && (f.tabIndex = 0);
    });
    const d = ue(() => t.name || r.value);
    return sn(K0, jn({
      ...Br(t),
      changeEvent: l,
      name: d
    })), Qe(() => t.modelValue, () => {
      t.validateEvent && (o == null || o.validate("change").catch((h) => kt(h)));
    }), (h, f) => (ve(), Ce("div", {
      id: z(a),
      ref_key: "radioGroupRef",
      ref: s,
      class: Te(z(i).b("group")),
      role: "radiogroup",
      "aria-label": z(c) ? void 0 : h.ariaLabel || "radio-group",
      "aria-labelledby": z(c) ? z(o).labelId : void 0
    }, [
      He(h.$slots, "default")
    ], 10, ["id", "aria-label", "aria-labelledby"]));
  }
});
var ey = /* @__PURE__ */ st(iL, [["__file", "radio-group.vue"]]);
const ty = on(JC, {
  RadioButton: Q0,
  RadioGroup: ey
}), ny = vi(ey);
vi(Q0);
const Qh = at({
  type: {
    type: String,
    values: ["primary", "success", "info", "warning", "danger"],
    default: "primary"
  },
  closable: Boolean,
  disableTransitions: Boolean,
  hit: Boolean,
  color: String,
  size: {
    type: String,
    values: f0
  },
  effect: {
    type: String,
    values: ["dark", "light", "plain"],
    default: "light"
  },
  round: Boolean
}), rL = {
  close: (n) => n instanceof MouseEvent,
  click: (n) => n instanceof MouseEvent
}, sL = Pe({
  name: "ElTag"
}), oL = /* @__PURE__ */ Pe({
  ...sL,
  props: Qh,
  emits: rL,
  setup(n, { emit: e }) {
    const t = n, i = Ns(), r = nt("tag"), s = ue(() => {
      const { type: l, hit: d, effect: h, closable: f, round: g } = t;
      return [
        r.b(),
        r.is("closable", f),
        r.m(l || "primary"),
        r.m(i.value),
        r.m(h),
        r.is("hit", d),
        r.is("round", g)
      ];
    }), o = (l) => {
      e("close", l);
    }, a = (l) => {
      e("click", l);
    }, c = (l) => {
      l.component.subTree.component.bum = null;
    };
    return (l, d) => l.disableTransitions ? (ve(), Ce("span", {
      key: 0,
      class: Te(z(s)),
      style: Rt({ backgroundColor: l.color }),
      onClick: a
    }, [
      Ne("span", {
        class: Te(z(r).e("content"))
      }, [
        He(l.$slots, "default")
      ], 2),
      l.closable ? (ve(), Ve(z(It), {
        key: 0,
        class: Te(z(r).e("close")),
        onClick: Ut(o, ["stop"])
      }, {
        default: de(() => [
          le(z(Zh))
        ]),
        _: 1
      }, 8, ["class", "onClick"])) : ke("v-if", !0)
    ], 6)) : (ve(), Ve(el, {
      key: 1,
      name: `${z(r).namespace.value}-zoom-in-center`,
      appear: "",
      onVnodeMounted: c
    }, {
      default: de(() => [
        Ne("span", {
          class: Te(z(s)),
          style: Rt({ backgroundColor: l.color }),
          onClick: a
        }, [
          Ne("span", {
            class: Te(z(r).e("content"))
          }, [
            He(l.$slots, "default")
          ], 2),
          l.closable ? (ve(), Ve(z(It), {
            key: 0,
            class: Te(z(r).e("close")),
            onClick: Ut(o, ["stop"])
          }, {
            default: de(() => [
              le(z(Zh))
            ]),
            _: 1
          }, 8, ["class", "onClick"])) : ke("v-if", !0)
        ], 6)
      ]),
      _: 3
    }, 8, ["name"]));
  }
});
var aL = /* @__PURE__ */ st(oL, [["__file", "tag.vue"]]);
const lL = on(aL), iy = Symbol("rowContextKey"), cL = [
  "start",
  "center",
  "end",
  "space-around",
  "space-between",
  "space-evenly"
], uL = ["top", "middle", "bottom"], hL = at({
  tag: {
    type: String,
    default: "div"
  },
  gutter: {
    type: Number,
    default: 0
  },
  justify: {
    type: String,
    values: cL,
    default: "start"
  },
  align: {
    type: String,
    values: uL
  }
}), dL = Pe({
  name: "ElRow"
}), fL = /* @__PURE__ */ Pe({
  ...dL,
  props: hL,
  setup(n) {
    const e = n, t = nt("row"), i = ue(() => e.gutter);
    sn(iy, {
      gutter: i
    });
    const r = ue(() => {
      const o = {};
      return e.gutter && (o.marginRight = o.marginLeft = `-${e.gutter / 2}px`), o;
    }), s = ue(() => [
      t.b(),
      t.is(`justify-${e.justify}`, e.justify !== "start"),
      t.is(`align-${e.align}`, !!e.align)
    ]);
    return (o, a) => (ve(), Ve(Fn(o.tag), {
      class: Te(z(s)),
      style: Rt(z(r))
    }, {
      default: de(() => [
        He(o.$slots, "default")
      ]),
      _: 3
    }, 8, ["class", "style"]));
  }
});
var pL = /* @__PURE__ */ st(fL, [["__file", "row.vue"]]);
const Ui = on(pL), mL = at({
  tag: {
    type: String,
    default: "div"
  },
  span: {
    type: Number,
    default: 24
  },
  offset: {
    type: Number,
    default: 0
  },
  pull: {
    type: Number,
    default: 0
  },
  push: {
    type: Number,
    default: 0
  },
  xs: {
    type: Je([Number, Object]),
    default: () => qi({})
  },
  sm: {
    type: Je([Number, Object]),
    default: () => qi({})
  },
  md: {
    type: Je([Number, Object]),
    default: () => qi({})
  },
  lg: {
    type: Je([Number, Object]),
    default: () => qi({})
  },
  xl: {
    type: Je([Number, Object]),
    default: () => qi({})
  }
}), gL = Pe({
  name: "ElCol"
}), vL = /* @__PURE__ */ Pe({
  ...gL,
  props: mL,
  setup(n) {
    const e = n, { gutter: t } = pt(iy, { gutter: ue(() => 0) }), i = nt("col"), r = ue(() => {
      const o = {};
      return t.value && (o.paddingLeft = o.paddingRight = `${t.value / 2}px`), o;
    }), s = ue(() => {
      const o = [];
      return ["span", "offset", "pull", "push"].forEach((l) => {
        const d = e[l];
        yt(d) && (l === "span" ? o.push(i.b(`${e[l]}`)) : d > 0 && o.push(i.b(`${l}-${e[l]}`)));
      }), ["xs", "sm", "md", "lg", "xl"].forEach((l) => {
        yt(e[l]) ? o.push(i.b(`${l}-${e[l]}`)) : Tn(e[l]) && Object.entries(e[l]).forEach(([d, h]) => {
          o.push(d !== "span" ? i.b(`${l}-${d}-${h}`) : i.b(`${l}-${h}`));
        });
      }), t.value && o.push(i.is("guttered")), [i.b(), o];
    });
    return (o, a) => (ve(), Ve(Fn(o.tag), {
      class: Te(z(s)),
      style: Rt(z(r))
    }, {
      default: de(() => [
        He(o.$slots, "default")
      ]),
      _: 3
    }, 8, ["class", "style"]));
  }
});
var yL = /* @__PURE__ */ st(vL, [["__file", "col.vue"]]);
const bi = on(yL), Bm = (n) => yt(n) || vn(n) || Pn(n), bL = at({
  accordion: Boolean,
  modelValue: {
    type: Je([Array, String, Number]),
    default: () => qi([])
  }
}), xL = {
  [At]: Bm,
  [hr]: Bm
}, ry = Symbol("collapseContextKey"), ML = (n, e) => {
  const t = Ee(Si(n.modelValue)), i = (s) => {
    t.value = s;
    const o = n.accordion ? t.value[0] : t.value;
    e(At, o), e(hr, o);
  }, r = (s) => {
    if (n.accordion)
      i([t.value[0] === s ? "" : s]);
    else {
      const o = [...t.value], a = o.indexOf(s);
      a > -1 ? o.splice(a, 1) : o.push(s), i(o);
    }
  };
  return Qe(() => n.modelValue, () => t.value = Si(n.modelValue), { deep: !0 }), sn(ry, {
    activeNames: t,
    handleItemClick: r
  }), {
    activeNames: t,
    setActiveNames: i
  };
}, wL = () => {
  const n = nt("collapse");
  return {
    rootKls: ue(() => n.b())
  };
}, AL = Pe({
  name: "ElCollapse"
}), SL = /* @__PURE__ */ Pe({
  ...AL,
  props: bL,
  emits: xL,
  setup(n, { expose: e, emit: t }) {
    const i = n, { activeNames: r, setActiveNames: s } = ML(i, t), { rootKls: o } = wL();
    return e({
      activeNames: r,
      setActiveNames: s
    }), (a, c) => (ve(), Ce("div", {
      class: Te(z(o))
    }, [
      He(a.$slots, "default")
    ], 2));
  }
});
var _L = /* @__PURE__ */ st(SL, [["__file", "collapse.vue"]]);
const TL = Pe({
  name: "ElCollapseTransition"
}), EL = /* @__PURE__ */ Pe({
  ...TL,
  setup(n) {
    const e = nt("collapse-transition"), t = (r) => {
      r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom;
    }, i = {
      beforeEnter(r) {
        r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.style.height && (r.dataset.elExistsHeight = r.style.height), r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0;
      },
      enter(r) {
        requestAnimationFrame(() => {
          r.dataset.oldOverflow = r.style.overflow, r.dataset.elExistsHeight ? r.style.maxHeight = r.dataset.elExistsHeight : r.scrollHeight !== 0 ? r.style.maxHeight = `${r.scrollHeight}px` : r.style.maxHeight = 0, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom, r.style.overflow = "hidden";
        });
      },
      afterEnter(r) {
        r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow;
      },
      enterCancelled(r) {
        t(r);
      },
      beforeLeave(r) {
        r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.dataset.oldOverflow = r.style.overflow, r.style.maxHeight = `${r.scrollHeight}px`, r.style.overflow = "hidden";
      },
      leave(r) {
        r.scrollHeight !== 0 && (r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0);
      },
      afterLeave(r) {
        t(r);
      },
      leaveCancelled(r) {
        t(r);
      }
    };
    return (r, s) => (ve(), Ve(el, Ei({
      name: z(e).b()
    }, ZM(i)), {
      default: de(() => [
        He(r.$slots, "default")
      ]),
      _: 3
    }, 16, ["name"]));
  }
});
var CL = /* @__PURE__ */ st(EL, [["__file", "collapse-transition.vue"]]);
const LL = on(CL), RL = at({
  title: {
    type: String,
    default: ""
  },
  name: {
    type: Je([String, Number]),
    default: void 0
  },
  icon: {
    type: Vr,
    default: kr
  },
  disabled: Boolean
}), FL = (n) => {
  const e = pt(ry), { namespace: t } = nt("collapse"), i = Ee(!1), r = Ee(!1), s = of(), o = ue(() => s.current++), a = ue(() => {
    var f;
    return (f = n.name) != null ? f : `${t.value}-id-${s.prefix}-${z(o)}`;
  }), c = ue(() => e == null ? void 0 : e.activeNames.value.includes(z(a)));
  return {
    focusing: i,
    id: o,
    isActive: c,
    handleFocus: () => {
      setTimeout(() => {
        r.value ? r.value = !1 : i.value = !0;
      }, 50);
    },
    handleHeaderClick: () => {
      n.disabled || (e == null || e.handleItemClick(z(a)), i.value = !1, r.value = !0);
    },
    handleEnterClick: () => {
      e == null || e.handleItemClick(z(a));
    }
  };
}, PL = (n, { focusing: e, isActive: t, id: i }) => {
  const r = nt("collapse"), s = ue(() => [
    r.b("item"),
    r.is("active", z(t)),
    r.is("disabled", n.disabled)
  ]), o = ue(() => [
    r.be("item", "header"),
    r.is("active", z(t)),
    { focusing: z(e) && !n.disabled }
  ]), a = ue(() => [
    r.be("item", "arrow"),
    r.is("active", z(t))
  ]), c = ue(() => r.be("item", "wrap")), l = ue(() => r.be("item", "content")), d = ue(() => r.b(`content-${z(i)}`)), h = ue(() => r.b(`head-${z(i)}`));
  return {
    arrowKls: a,
    headKls: o,
    rootKls: s,
    itemWrapperKls: c,
    itemContentKls: l,
    scopedContentId: d,
    scopedHeadId: h
  };
}, IL = Pe({
  name: "ElCollapseItem"
}), OL = /* @__PURE__ */ Pe({
  ...IL,
  props: RL,
  setup(n, { expose: e }) {
    const t = n, {
      focusing: i,
      id: r,
      isActive: s,
      handleFocus: o,
      handleHeaderClick: a,
      handleEnterClick: c
    } = FL(t), {
      arrowKls: l,
      headKls: d,
      rootKls: h,
      itemWrapperKls: f,
      itemContentKls: g,
      scopedContentId: p,
      scopedHeadId: u
    } = PL(t, { focusing: i, isActive: s, id: r });
    return e({
      isActive: s
    }), (y, v) => (ve(), Ce("div", {
      class: Te(z(h))
    }, [
      Ne("button", {
        id: z(u),
        class: Te(z(d)),
        "aria-expanded": z(s),
        "aria-controls": z(p),
        "aria-describedby": z(p),
        tabindex: y.disabled ? -1 : 0,
        type: "button",
        onClick: z(a),
        onKeydown: ui(Ut(z(c), ["stop", "prevent"]), ["space", "enter"]),
        onFocus: z(o),
        onBlur: (m) => i.value = !1
      }, [
        He(y.$slots, "title", {}, () => [
          rt(gt(y.title), 1)
        ]),
        He(y.$slots, "icon", { isActive: z(s) }, () => [
          le(z(It), {
            class: Te(z(l))
          }, {
            default: de(() => [
              (ve(), Ve(Fn(y.icon)))
            ]),
            _: 1
          }, 8, ["class"])
        ])
      ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
      le(z(LL), null, {
        default: de(() => [
          Lt(Ne("div", {
            id: z(p),
            role: "region",
            class: Te(z(f)),
            "aria-hidden": !z(s),
            "aria-labelledby": z(u)
          }, [
            Ne("div", {
              class: Te(z(g))
            }, [
              He(y.$slots, "default")
            ], 2)
          ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
            [mn, z(s)]
          ])
        ]),
        _: 3
      })
    ], 2));
  }
});
var sy = /* @__PURE__ */ st(OL, [["__file", "collapse-item.vue"]]);
const oy = on(_L, {
  CollapseItem: sy
}), ay = vi(sy), DL = Pe({
  name: "ElContainer"
}), NL = /* @__PURE__ */ Pe({
  ...DL,
  props: {
    direction: {
      type: String
    }
  },
  setup(n) {
    const e = n, t = Xc(), i = nt("container"), r = ue(() => e.direction === "vertical" ? !0 : e.direction === "horizontal" ? !1 : t && t.default ? t.default().some((o) => {
      const a = o.type.name;
      return a === "ElHeader" || a === "ElFooter";
    }) : !1);
    return (s, o) => (ve(), Ce("section", {
      class: Te([z(i).b(), z(i).is("vertical", z(r))])
    }, [
      He(s.$slots, "default")
    ], 2));
  }
});
var BL = /* @__PURE__ */ st(NL, [["__file", "container.vue"]]);
const UL = Pe({
  name: "ElAside"
}), zL = /* @__PURE__ */ Pe({
  ...UL,
  props: {
    width: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = nt("aside"), i = ue(() => e.width ? t.cssVarBlock({ width: e.width }) : {});
    return (r, s) => (ve(), Ce("aside", {
      class: Te(z(t).b()),
      style: Rt(z(i))
    }, [
      He(r.$slots, "default")
    ], 6));
  }
});
var ly = /* @__PURE__ */ st(zL, [["__file", "aside.vue"]]);
const kL = Pe({
  name: "ElFooter"
}), VL = /* @__PURE__ */ Pe({
  ...kL,
  props: {
    height: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = nt("footer"), i = ue(() => e.height ? t.cssVarBlock({ height: e.height }) : {});
    return (r, s) => (ve(), Ce("footer", {
      class: Te(z(t).b()),
      style: Rt(z(i))
    }, [
      He(r.$slots, "default")
    ], 6));
  }
});
var cy = /* @__PURE__ */ st(VL, [["__file", "footer.vue"]]);
const GL = Pe({
  name: "ElHeader"
}), HL = /* @__PURE__ */ Pe({
  ...GL,
  props: {
    height: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = nt("header"), i = ue(() => e.height ? t.cssVarBlock({
      height: e.height
    }) : {});
    return (r, s) => (ve(), Ce("header", {
      class: Te(z(t).b()),
      style: Rt(z(i))
    }, [
      He(r.$slots, "default")
    ], 6));
  }
});
var uy = /* @__PURE__ */ st(HL, [["__file", "header.vue"]]);
const WL = Pe({
  name: "ElMain"
}), jL = /* @__PURE__ */ Pe({
  ...WL,
  setup(n) {
    const e = nt("main");
    return (t, i) => (ve(), Ce("main", {
      class: Te(z(e).b())
    }, [
      He(t.$slots, "default")
    ], 2));
  }
});
var hy = /* @__PURE__ */ st(jL, [["__file", "main.vue"]]);
const zi = on(BL, {
  Aside: ly,
  Footer: cy,
  Header: uy,
  Main: hy
});
vi(ly);
const dy = vi(cy), $L = vi(uy), dr = vi(hy), ZL = /* @__PURE__ */ Pe({
  inheritAttrs: !1
});
function XL(n, e, t, i, r, s) {
  return He(n.$slots, "default");
}
var YL = /* @__PURE__ */ st(ZL, [["render", XL], ["__file", "collection.vue"]]);
const JL = /* @__PURE__ */ Pe({
  name: "ElCollectionItem",
  inheritAttrs: !1
});
function KL(n, e, t, i, r, s) {
  return He(n.$slots, "default");
}
var qL = /* @__PURE__ */ st(JL, [["render", KL], ["__file", "collection-item.vue"]]);
const QL = "data-el-collection-item", eR = (n) => {
  const e = `El${n}Collection`, t = `${e}Item`, i = Symbol(e), r = Symbol(t), s = {
    ...YL,
    name: e,
    setup() {
      const a = Ee(null), c = /* @__PURE__ */ new Map();
      sn(i, {
        itemMap: c,
        getItems: () => {
          const d = z(a);
          if (!d)
            return [];
          const h = Array.from(d.querySelectorAll(`[${QL}]`));
          return [...c.values()].sort((g, p) => h.indexOf(g.ref) - h.indexOf(p.ref));
        },
        collectionRef: a
      });
    }
  }, o = {
    ...qL,
    name: t,
    setup(a, { attrs: c }) {
      const l = Ee(null), d = pt(i, void 0);
      sn(r, {
        collectionItemRef: l
      }), Jt(() => {
        const h = z(l);
        h && d.itemMap.set(h, {
          ref: h,
          ...c
        });
      }), ei(() => {
        const h = z(l);
        d.itemMap.delete(h);
      });
    }
  };
  return {
    COLLECTION_INJECTION_KEY: i,
    COLLECTION_ITEM_INJECTION_KEY: r,
    ElCollection: s,
    ElCollectionItem: o
  };
}, Hu = at({
  trigger: ka.trigger,
  effect: {
    ...kn.effect,
    default: "light"
  },
  type: {
    type: Je(String)
  },
  placement: {
    type: Je(String),
    default: "bottom"
  },
  popperOptions: {
    type: Je(Object),
    default: () => ({})
  },
  id: String,
  size: {
    type: String,
    default: ""
  },
  splitButton: Boolean,
  hideOnClick: {
    type: Boolean,
    default: !0
  },
  loop: {
    type: Boolean,
    default: !0
  },
  showTimeout: {
    type: Number,
    default: 150
  },
  hideTimeout: {
    type: Number,
    default: 150
  },
  tabindex: {
    type: Je([Number, String]),
    default: 0
  },
  maxHeight: {
    type: Je([Number, String]),
    default: ""
  },
  popperClass: {
    type: String,
    default: ""
  },
  disabled: Boolean,
  role: {
    type: String,
    default: "menu"
  },
  buttonProps: {
    type: Je(Object)
  },
  teleported: kn.teleported
});
at({
  command: {
    type: [Object, String, Number],
    default: () => ({})
  },
  disabled: Boolean,
  divided: Boolean,
  textValue: String,
  icon: {
    type: Vr
  }
});
at({
  onKeydown: { type: Je(Function) }
});
eR("Dropdown");
const tR = at({
  id: {
    type: String,
    default: void 0
  },
  step: {
    type: Number,
    default: 1
  },
  stepStrictly: Boolean,
  max: {
    type: Number,
    default: Number.POSITIVE_INFINITY
  },
  min: {
    type: Number,
    default: Number.NEGATIVE_INFINITY
  },
  modelValue: Number,
  readonly: Boolean,
  disabled: Boolean,
  size: Gr,
  controls: {
    type: Boolean,
    default: !0
  },
  controlsPosition: {
    type: String,
    default: "",
    values: ["", "right"]
  },
  valueOnClear: {
    type: [String, Number, null],
    validator: (n) => n === null || yt(n) || ["min", "max"].includes(n),
    default: null
  },
  name: String,
  placeholder: String,
  precision: {
    type: Number,
    validator: (n) => n >= 0 && n === Number.parseInt(`${n}`, 10)
  },
  validateEvent: {
    type: Boolean,
    default: !0
  },
  ...Yr(["ariaLabel"])
}), nR = {
  [hr]: (n, e) => e !== n,
  blur: (n) => n instanceof FocusEvent,
  focus: (n) => n instanceof FocusEvent,
  [bs]: (n) => yt(n) || Ci(n),
  [At]: (n) => yt(n) || Ci(n)
}, iR = Pe({
  name: "ElInputNumber"
}), rR = /* @__PURE__ */ Pe({
  ...iR,
  props: tR,
  emits: nR,
  setup(n, { expose: e, emit: t }) {
    const i = n, { t: r } = iu(), s = nt("input-number"), o = Ee(), a = jn({
      currentValue: i.modelValue,
      userInput: null
    }), { formItem: c } = Jo(), l = ue(() => yt(i.modelValue) && i.modelValue <= i.min), d = ue(() => yt(i.modelValue) && i.modelValue >= i.max), h = ue(() => {
      const P = v(i.step);
      return di(i.precision) ? Math.max(v(i.modelValue), P) : (P > i.precision && kt("InputNumber", "precision should not be less than the decimal places of step"), i.precision);
    }), f = ue(() => i.controls && i.controlsPosition === "right"), g = Ns(), p = ol(), u = ue(() => {
      if (a.userInput !== null)
        return a.userInput;
      let P = a.currentValue;
      if (Ci(P))
        return "";
      if (yt(P)) {
        if (Number.isNaN(P))
          return "";
        di(i.precision) || (P = P.toFixed(i.precision));
      }
      return P;
    }), y = (P, b) => {
      if (di(b) && (b = h.value), b === 0)
        return Math.round(P);
      let I = String(P);
      const D = I.indexOf(".");
      if (D === -1 || !I.replace(".", "").split("")[D + b])
        return P;
      const B = I.length;
      return I.charAt(B - 1) === "5" && (I = `${I.slice(0, Math.max(0, B - 1))}6`), Number.parseFloat(Number(I).toFixed(b));
    }, v = (P) => {
      if (Ci(P))
        return 0;
      const b = P.toString(), I = b.indexOf(".");
      let D = 0;
      return I !== -1 && (D = b.length - I - 1), D;
    }, m = (P, b = 1) => yt(P) ? y(P + i.step * b) : a.currentValue, x = () => {
      if (i.readonly || p.value || d.value)
        return;
      const P = Number(u.value) || 0, b = m(P);
      M(b), t(bs, a.currentValue), E();
    }, w = () => {
      if (i.readonly || p.value || l.value)
        return;
      const P = Number(u.value) || 0, b = m(P, -1);
      M(b), t(bs, a.currentValue), E();
    }, A = (P, b) => {
      const { max: I, min: D, step: N, precision: U, stepStrictly: B, valueOnClear: G } = i;
      I < D && Xo("InputNumber", "min should not be greater than max.");
      let J = Number(P);
      if (Ci(P) || Number.isNaN(J))
        return null;
      if (P === "") {
        if (G === null)
          return null;
        J = vn(G) ? { min: D, max: I }[G] : G;
      }
      return B && (J = y(Math.round(J / N) * N, U), J !== P && b && t(At, J)), di(U) || (J = y(J, U)), (J > I || J < D) && (J = J > I ? I : D, b && t(At, J)), J;
    }, M = (P, b = !0) => {
      var I;
      const D = a.currentValue, N = A(P);
      if (!b) {
        t(At, N);
        return;
      }
      D === N && P || (a.userInput = null, t(At, N), D !== N && t(hr, N, D), i.validateEvent && ((I = c == null ? void 0 : c.validate) == null || I.call(c, "change").catch((U) => kt(U))), a.currentValue = N);
    }, R = (P) => {
      a.userInput = P;
      const b = P === "" ? null : Number(P);
      t(bs, b), M(b, !1);
    }, L = (P) => {
      const b = P !== "" ? Number(P) : "";
      (yt(b) && !Number.isNaN(b) || P === "") && M(b), E(), a.userInput = null;
    }, _ = () => {
      var P, b;
      (b = (P = o.value) == null ? void 0 : P.focus) == null || b.call(P);
    }, F = () => {
      var P, b;
      (b = (P = o.value) == null ? void 0 : P.blur) == null || b.call(P);
    }, S = (P) => {
      t("focus", P);
    }, T = (P) => {
      var b;
      a.userInput = null, t("blur", P), i.validateEvent && ((b = c == null ? void 0 : c.validate) == null || b.call(c, "blur").catch((I) => kt(I)));
    }, E = () => {
      a.currentValue !== i.modelValue && (a.currentValue = i.modelValue);
    }, C = (P) => {
      document.activeElement === P.target && P.preventDefault();
    };
    return Qe(() => i.modelValue, (P, b) => {
      const I = A(P, !0);
      a.userInput === null && I !== b && (a.currentValue = I);
    }, { immediate: !0 }), Jt(() => {
      var P;
      const { min: b, max: I, modelValue: D } = i, N = (P = o.value) == null ? void 0 : P.input;
      if (N.setAttribute("role", "spinbutton"), Number.isFinite(I) ? N.setAttribute("aria-valuemax", String(I)) : N.removeAttribute("aria-valuemax"), Number.isFinite(b) ? N.setAttribute("aria-valuemin", String(b)) : N.removeAttribute("aria-valuemin"), N.setAttribute("aria-valuenow", a.currentValue || a.currentValue === 0 ? String(a.currentValue) : ""), N.setAttribute("aria-disabled", String(p.value)), !yt(D) && D != null) {
        let U = Number(D);
        Number.isNaN(U) && (U = null), t(At, U);
      }
      N.addEventListener("wheel", C, { passive: !1 });
    }), zd(() => {
      var P, b;
      const I = (P = o.value) == null ? void 0 : P.input;
      I == null || I.setAttribute("aria-valuenow", `${(b = a.currentValue) != null ? b : ""}`);
    }), e({
      focus: _,
      blur: F
    }), (P, b) => (ve(), Ce("div", {
      class: Te([
        z(s).b(),
        z(s).m(z(g)),
        z(s).is("disabled", z(p)),
        z(s).is("without-controls", !P.controls),
        z(s).is("controls-right", z(f))
      ]),
      onDragstart: Ut(() => {
      }, ["prevent"])
    }, [
      P.controls ? Lt((ve(), Ce("span", {
        key: 0,
        role: "button",
        "aria-label": z(r)("el.inputNumber.decrease"),
        class: Te([z(s).e("decrease"), z(s).is("disabled", z(l))]),
        onKeydown: ui(w, ["enter"])
      }, [
        He(P.$slots, "decrease-icon", {}, () => [
          le(z(It), null, {
            default: de(() => [
              z(f) ? (ve(), Ve(z(Xd), { key: 0 })) : (ve(), Ve(z(q_), { key: 1 }))
            ]),
            _: 1
          })
        ])
      ], 42, ["aria-label", "onKeydown"])), [
        [z(Nm), w]
      ]) : ke("v-if", !0),
      P.controls ? Lt((ve(), Ce("span", {
        key: 1,
        role: "button",
        "aria-label": z(r)("el.inputNumber.increase"),
        class: Te([z(s).e("increase"), z(s).is("disabled", z(d))]),
        onKeydown: ui(x, ["enter"])
      }, [
        He(P.$slots, "increase-icon", {}, () => [
          le(z(It), null, {
            default: de(() => [
              z(f) ? (ve(), Ve(z(G_), { key: 0 })) : (ve(), Ve(z(tu), { key: 1 }))
            ]),
            _: 1
          })
        ])
      ], 42, ["aria-label", "onKeydown"])), [
        [z(Nm), x]
      ]) : ke("v-if", !0),
      le(z(e2), {
        id: P.id,
        ref_key: "input",
        ref: o,
        type: "number",
        step: P.step,
        "model-value": z(u),
        placeholder: P.placeholder,
        readonly: P.readonly,
        disabled: z(p),
        size: z(g),
        max: P.max,
        min: P.min,
        name: P.name,
        "aria-label": P.ariaLabel,
        "validate-event": !1,
        onKeydown: [
          ui(Ut(x, ["prevent"]), ["up"]),
          ui(Ut(w, ["prevent"]), ["down"])
        ],
        onBlur: T,
        onFocus: S,
        onInput: R,
        onChange: L
      }, XM({ _: 2 }, [
        P.$slots.prefix ? {
          name: "prefix",
          fn: de(() => [
            He(P.$slots, "prefix")
          ])
        } : void 0,
        P.$slots.suffix ? {
          name: "suffix",
          fn: de(() => [
            He(P.$slots, "suffix")
          ])
        } : void 0
      ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
    ], 42, ["onDragstart"]));
  }
});
var sR = /* @__PURE__ */ st(rR, [["__file", "input-number.vue"]]);
const fr = on(sR), fy = Symbol("ElSelectGroup"), lu = Symbol("ElSelect");
function oR(n, e) {
  const t = pt(lu), i = pt(fy, { disabled: !1 }), r = ue(() => d(Si(t.props.modelValue), n.value)), s = ue(() => {
    var g;
    if (t.props.multiple) {
      const p = Si((g = t.props.modelValue) != null ? g : []);
      return !r.value && p.length >= t.props.multipleLimit && t.props.multipleLimit > 0;
    } else
      return !1;
  }), o = ue(() => n.label || (Tn(n.value) ? "" : n.value)), a = ue(() => n.value || n.label || ""), c = ue(() => n.disabled || e.groupDisabled || s.value), l = dn(), d = (g = [], p) => {
    if (Tn(n.value)) {
      const u = t.props.valueKey;
      return g && g.some((y) => Vv(Ki(y, u)) === Ki(p, u));
    } else
      return g && g.includes(p);
  }, h = () => {
    !n.disabled && !i.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(l.proxy));
  }, f = (g) => {
    const p = new RegExp(D_(g), "i");
    e.visible = p.test(o.value) || n.created;
  };
  return Qe(() => o.value, () => {
    !n.created && !t.props.remote && t.setSelected();
  }), Qe(() => n.value, (g, p) => {
    const { remote: u, valueKey: y } = t.props;
    if (g !== p && (t.onOptionDestroy(p, l.proxy), t.onOptionCreate(l.proxy)), !n.created && !u) {
      if (y && Tn(g) && Tn(p) && g[y] === p[y])
        return;
      t.setSelected();
    }
  }), Qe(() => i.disabled, () => {
    e.groupDisabled = i.disabled;
  }, { immediate: !0 }), {
    select: t,
    currentLabel: o,
    currentValue: a,
    itemSelected: r,
    isDisabled: c,
    hoverItem: h,
    updateOption: f
  };
}
const aR = Pe({
  name: "ElOption",
  componentName: "ElOption",
  props: {
    value: {
      required: !0,
      type: [String, Number, Boolean, Object]
    },
    label: [String, Number],
    created: Boolean,
    disabled: Boolean
  },
  setup(n) {
    const e = nt("select"), t = sl(), i = ue(() => [
      e.be("dropdown", "item"),
      e.is("disabled", z(a)),
      e.is("selected", z(o)),
      e.is("hovering", z(f))
    ]), r = jn({
      index: -1,
      groupDisabled: !1,
      visible: !0,
      hover: !1
    }), {
      currentLabel: s,
      itemSelected: o,
      isDisabled: a,
      select: c,
      hoverItem: l,
      updateOption: d
    } = oR(n, r), { visible: h, hover: f } = Br(r), g = dn().proxy;
    c.onOptionCreate(g), ei(() => {
      const u = g.value, { selected: y } = c.states, m = (c.props.multiple ? y : [y]).some((x) => x.value === g.value);
      bt(() => {
        c.states.cachedOptions.get(u) === g && !m && c.states.cachedOptions.delete(u);
      }), c.onOptionDestroy(u, g);
    });
    function p() {
      a.value || c.handleOptionSelect(g);
    }
    return {
      ns: e,
      id: t,
      containerKls: i,
      currentLabel: s,
      itemSelected: o,
      isDisabled: a,
      select: c,
      hoverItem: l,
      updateOption: d,
      visible: h,
      hover: f,
      selectOptionClick: p,
      states: r
    };
  }
});
function lR(n, e, t, i, r, s) {
  return Lt((ve(), Ce("li", {
    id: n.id,
    class: Te(n.containerKls),
    role: "option",
    "aria-disabled": n.isDisabled || void 0,
    "aria-selected": n.itemSelected,
    onMouseenter: n.hoverItem,
    onClick: Ut(n.selectOptionClick, ["stop"])
  }, [
    He(n.$slots, "default", {}, () => [
      Ne("span", null, gt(n.currentLabel), 1)
    ])
  ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
    [mn, n.visible]
  ]);
}
var mf = /* @__PURE__ */ st(aR, [["render", lR], ["__file", "option.vue"]]);
const cR = Pe({
  name: "ElSelectDropdown",
  componentName: "ElSelectDropdown",
  setup() {
    const n = pt(lu), e = nt("select"), t = ue(() => n.props.popperClass), i = ue(() => n.props.multiple), r = ue(() => n.props.fitInputWidth), s = Ee("");
    function o() {
      var a;
      s.value = `${(a = n.selectRef) == null ? void 0 : a.offsetWidth}px`;
    }
    return Jt(() => {
      o(), Jn(n.selectRef, o);
    }), {
      ns: e,
      minWidth: s,
      popperClass: t,
      isMultiple: i,
      isFitInputWidth: r
    };
  }
});
function uR(n, e, t, i, r, s) {
  return ve(), Ce("div", {
    class: Te([n.ns.b("dropdown"), n.ns.is("multiple", n.isMultiple), n.popperClass]),
    style: Rt({ [n.isFitInputWidth ? "width" : "minWidth"]: n.minWidth })
  }, [
    n.$slots.header ? (ve(), Ce("div", {
      key: 0,
      class: Te(n.ns.be("dropdown", "header"))
    }, [
      He(n.$slots, "header")
    ], 2)) : ke("v-if", !0),
    He(n.$slots, "default"),
    n.$slots.footer ? (ve(), Ce("div", {
      key: 1,
      class: Te(n.ns.be("dropdown", "footer"))
    }, [
      He(n.$slots, "footer")
    ], 2)) : ke("v-if", !0)
  ], 6);
}
var hR = /* @__PURE__ */ st(cR, [["render", uR], ["__file", "select-dropdown.vue"]]);
const dR = 11, fR = (n, e) => {
  const { t } = iu(), i = sl(), r = nt("select"), s = nt("input"), o = jn({
    inputValue: "",
    options: /* @__PURE__ */ new Map(),
    cachedOptions: /* @__PURE__ */ new Map(),
    disabledOptions: /* @__PURE__ */ new Map(),
    optionValues: [],
    selected: [],
    selectionWidth: 0,
    calculatorWidth: 0,
    collapseItemWidth: 0,
    selectedLabel: "",
    hoveringIndex: -1,
    previousQuery: null,
    inputHovering: !1,
    menuVisibleOnFocus: !1,
    isBeforeHide: !1
  }), a = Ee(null), c = Ee(null), l = Ee(null), d = Ee(null), h = Ee(null), f = Ee(null), g = Ee(null), p = Ee(null), u = Ee(null), y = Ee(null), v = Ee(null), m = Ee(null), {
    isComposing: x,
    handleCompositionStart: w,
    handleCompositionUpdate: A,
    handleCompositionEnd: M
  } = N0({
    afterComposition: (ge) => re(ge)
  }), { wrapperRef: R, isFocused: L } = D0(h, {
    beforeFocus() {
      return b.value;
    },
    afterFocus() {
      n.automaticDropdown && !_.value && (_.value = !0, o.menuVisibleOnFocus = !0);
    },
    beforeBlur(ge) {
      var Se, Fe;
      return ((Se = l.value) == null ? void 0 : Se.isFocusInsideContent(ge)) || ((Fe = d.value) == null ? void 0 : Fe.isFocusInsideContent(ge));
    },
    afterBlur() {
      _.value = !1, o.menuVisibleOnFocus = !1;
    }
  }), _ = Ee(!1), F = Ee(), { form: S, formItem: T } = Jo(), { inputId: E } = su(n, {
    formItemContext: T
  }), { valueOnClear: C, isEmptyValue: P } = BE(n), b = ue(() => n.disabled || (S == null ? void 0 : S.disabled)), I = ue(() => Pn(n.modelValue) ? n.modelValue.length > 0 : !P(n.modelValue)), D = ue(() => n.clearable && !b.value && o.inputHovering && I.value), N = ue(() => n.remote && n.filterable && !n.remoteShowSuffix ? "" : n.suffixIcon), U = ue(() => r.is("reverse", N.value && _.value)), B = ue(() => (T == null ? void 0 : T.validateState) || ""), G = ue(() => d0[B.value]), J = ue(() => n.remote ? 300 : 0), j = ue(() => n.loading ? n.loadingText || t("el.select.loading") : n.remote && !o.inputValue && o.options.size === 0 ? !1 : n.filterable && o.inputValue && o.options.size > 0 && te.value === 0 ? n.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? n.noDataText || t("el.select.noData") : null), te = ue(() => ee.value.filter((ge) => ge.visible).length), ee = ue(() => {
    const ge = Array.from(o.options.values()), Se = [];
    return o.optionValues.forEach((Fe) => {
      const Ge = ge.findIndex((je) => je.value === Fe);
      Ge > -1 && Se.push(ge[Ge]);
    }), Se.length >= ge.length ? Se : ge;
  }), ae = ue(() => Array.from(o.cachedOptions.values())), H = ue(() => {
    const ge = ee.value.filter((Se) => !Se.created).some((Se) => Se.currentLabel === o.inputValue);
    return n.filterable && n.allowCreate && o.inputValue !== "" && !ge;
  }), Z = () => {
    n.filterable && Sn(n.filterMethod) || n.filterable && n.remote && Sn(n.remoteMethod) || ee.value.forEach((ge) => {
      var Se;
      (Se = ge.updateOption) == null || Se.call(ge, o.inputValue);
    });
  }, $ = Ns(), se = ue(() => ["small"].includes($.value) ? "small" : "default"), k = ue({
    get() {
      return _.value && j.value !== !1;
    },
    set(ge) {
      _.value = ge;
    }
  }), W = ue(() => {
    if (n.multiple && !di(n.modelValue))
      return Si(n.modelValue).length === 0 && !o.inputValue;
    const ge = Pn(n.modelValue) ? n.modelValue[0] : n.modelValue;
    return n.filterable || di(ge) ? !o.inputValue : !0;
  }), q = ue(() => {
    var ge;
    const Se = (ge = n.placeholder) != null ? ge : t("el.select.placeholder");
    return n.multiple || !I.value ? Se : o.selectedLabel;
  }), ce = ue(() => zh ? null : "mouseenter");
  Qe(() => n.modelValue, (ge, Se) => {
    n.multiple && n.filterable && !n.reserveKeyword && (o.inputValue = "", oe("")), O(), !$h(ge, Se) && n.validateEvent && (T == null || T.validate("change").catch((Fe) => kt(Fe)));
  }, {
    flush: "post",
    deep: !0
  }), Qe(() => _.value, (ge) => {
    ge ? oe(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = !0), e("visible-change", ge);
  }), Qe(() => o.options.entries(), () => {
    var ge;
    if (!en)
      return;
    const Se = ((ge = a.value) == null ? void 0 : ge.querySelectorAll("input")) || [];
    (!n.filterable && !n.defaultFirstOption && !di(n.modelValue) || !Array.from(Se).includes(document.activeElement)) && O(), n.defaultFirstOption && (n.filterable || n.remote) && te.value && V();
  }, {
    flush: "post"
  }), Qe(() => o.hoveringIndex, (ge) => {
    yt(ge) && ge > -1 ? F.value = ee.value[ge] || {} : F.value = {}, ee.value.forEach((Se) => {
      Se.hover = F.value === Se;
    });
  }), Nv(() => {
    o.isBeforeHide || Z();
  });
  const oe = (ge) => {
    o.previousQuery === ge || x.value || (o.previousQuery = ge, n.filterable && Sn(n.filterMethod) ? n.filterMethod(ge) : n.filterable && n.remote && Sn(n.remoteMethod) && n.remoteMethod(ge), n.defaultFirstOption && (n.filterable || n.remote) && te.value ? bt(V) : bt(Y));
  }, V = () => {
    const ge = ee.value.filter((Ge) => Ge.visible && !Ge.disabled && !Ge.states.groupDisabled), Se = ge.find((Ge) => Ge.created), Fe = ge[0];
    o.hoveringIndex = Mt(ee.value, Se || Fe);
  }, O = () => {
    if (n.multiple)
      o.selectedLabel = "";
    else {
      const Se = Pn(n.modelValue) ? n.modelValue[0] : n.modelValue, Fe = X(Se);
      o.selectedLabel = Fe.currentLabel, o.selected = [Fe];
      return;
    }
    const ge = [];
    di(n.modelValue) || Si(n.modelValue).forEach((Se) => {
      ge.push(X(Se));
    }), o.selected = ge;
  }, X = (ge) => {
    let Se;
    const Fe = Pu(ge).toLowerCase() === "object", Ge = Pu(ge).toLowerCase() === "null", je = Pu(ge).toLowerCase() === "undefined";
    for (let ft = o.cachedOptions.size - 1; ft >= 0; ft--) {
      const Vt = ae.value[ft];
      if (Fe ? Ki(Vt.value, n.valueKey) === Ki(ge, n.valueKey) : Vt.value === ge) {
        Se = {
          value: ge,
          currentLabel: Vt.currentLabel,
          get isDisabled() {
            return Vt.isDisabled;
          }
        };
        break;
      }
    }
    if (Se)
      return Se;
    const et = Fe ? ge.label : !Ge && !je ? ge : "";
    return {
      value: ge,
      currentLabel: et
    };
  }, Y = () => {
    o.hoveringIndex = ee.value.findIndex((ge) => o.selected.some((Se) => _e(Se) === _e(ge)));
  }, ie = () => {
    o.selectionWidth = c.value.getBoundingClientRect().width;
  }, fe = () => {
    o.calculatorWidth = f.value.getBoundingClientRect().width;
  }, be = () => {
    o.collapseItemWidth = v.value.getBoundingClientRect().width;
  }, Ae = () => {
    var ge, Se;
    (Se = (ge = l.value) == null ? void 0 : ge.updatePopper) == null || Se.call(ge);
  }, he = () => {
    var ge, Se;
    (Se = (ge = d.value) == null ? void 0 : ge.updatePopper) == null || Se.call(ge);
  }, xe = () => {
    o.inputValue.length > 0 && !_.value && (_.value = !0), oe(o.inputValue);
  }, re = (ge) => {
    if (o.inputValue = ge.target.value, n.remote)
      me();
    else
      return xe();
  }, me = jh(() => {
    xe();
  }, J.value), Me = (ge) => {
    $h(n.modelValue, ge) || e(hr, ge);
  }, De = (ge) => C_(ge, (Se) => !o.disabledOptions.has(Se)), Ie = (ge) => {
    if (n.multiple && ge.code !== Li.delete && ge.target.value.length <= 0) {
      const Se = Si(n.modelValue).slice(), Fe = De(Se);
      if (Fe < 0)
        return;
      const Ge = Se[Fe];
      Se.splice(Fe, 1), e(At, Se), Me(Se), e("remove-tag", Ge);
    }
  }, $e = (ge, Se) => {
    const Fe = o.selected.indexOf(Se);
    if (Fe > -1 && !b.value) {
      const Ge = Si(n.modelValue).slice();
      Ge.splice(Fe, 1), e(At, Ge), Me(Ge), e("remove-tag", Se.value);
    }
    ge.stopPropagation(), Pt();
  }, lt = (ge) => {
    ge.stopPropagation();
    const Se = n.multiple ? [] : C.value;
    if (n.multiple)
      for (const Fe of o.selected)
        Fe.isDisabled && Se.push(Fe.value);
    e(At, Se), Me(Se), o.hoveringIndex = -1, _.value = !1, e("clear"), Pt();
  }, qe = (ge) => {
    var Se;
    if (n.multiple) {
      const Fe = Si((Se = n.modelValue) != null ? Se : []).slice(), Ge = Mt(Fe, ge.value);
      Ge > -1 ? Fe.splice(Ge, 1) : (n.multipleLimit <= 0 || Fe.length < n.multipleLimit) && Fe.push(ge.value), e(At, Fe), Me(Fe), ge.created && oe(""), n.filterable && !n.reserveKeyword && (o.inputValue = "");
    } else
      e(At, ge.value), Me(ge.value), _.value = !1;
    Pt(), !_.value && bt(() => {
      Be(ge);
    });
  }, Mt = (ge = [], Se) => {
    if (!Tn(Se))
      return ge.indexOf(Se);
    const Fe = n.valueKey;
    let Ge = -1;
    return ge.some((je, et) => Vv(Ki(je, Fe)) === Ki(Se, Fe) ? (Ge = et, !0) : !1), Ge;
  }, Be = (ge) => {
    var Se, Fe, Ge, je, et;
    const Ye = Pn(ge) ? ge[0] : ge;
    let ft = null;
    if (Ye != null && Ye.value) {
      const Vt = ee.value.filter((ln) => ln.value === Ye.value);
      Vt.length > 0 && (ft = Vt[0].$el);
    }
    if (l.value && ft) {
      const Vt = (je = (Ge = (Fe = (Se = l.value) == null ? void 0 : Se.popperRef) == null ? void 0 : Fe.contentRef) == null ? void 0 : Ge.querySelector) == null ? void 0 : je.call(Ge, `.${r.be("dropdown", "wrap")}`);
      Vt && B_(Vt, ft);
    }
    (et = m.value) == null || et.handleScroll();
  }, it = (ge) => {
    o.options.set(ge.value, ge), o.cachedOptions.set(ge.value, ge), ge.disabled && o.disabledOptions.set(ge.value, ge);
  }, tt = (ge, Se) => {
    o.options.get(ge) === Se && o.options.delete(ge);
  }, qt = ue(() => {
    var ge, Se;
    return (Se = (ge = l.value) == null ? void 0 : ge.popperRef) == null ? void 0 : Se.contentRef;
  }), Qt = () => {
    o.isBeforeHide = !1, bt(() => Be(o.selected));
  }, Pt = () => {
    var ge;
    (ge = h.value) == null || ge.focus();
  }, Nt = () => {
    var ge;
    (ge = h.value) == null || ge.blur();
  }, Vi = (ge) => {
    lt(ge);
  }, Gi = () => {
    _.value = !1, L.value && Nt();
  }, ni = () => {
    o.inputValue.length > 0 ? o.inputValue = "" : _.value = !1;
  }, ts = () => {
    b.value || (zh && (o.inputHovering = !0), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = !1 : _.value = !_.value);
  }, ne = () => {
    _.value ? ee.value[o.hoveringIndex] && qe(ee.value[o.hoveringIndex]) : ts();
  }, _e = (ge) => Tn(ge.value) ? Ki(ge.value, n.valueKey) : ge.value, Oe = ue(() => ee.value.filter((ge) => ge.visible).every((ge) => ge.disabled)), Ze = ue(() => n.multiple ? n.collapseTags ? o.selected.slice(0, n.maxCollapseTags) : o.selected : []), ht = ue(() => n.multiple ? n.collapseTags ? o.selected.slice(n.maxCollapseTags) : [] : []), K = (ge) => {
    if (!_.value) {
      _.value = !0;
      return;
    }
    if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || x.value) && !Oe.value) {
      ge === "next" ? (o.hoveringIndex++, o.hoveringIndex === o.options.size && (o.hoveringIndex = 0)) : ge === "prev" && (o.hoveringIndex--, o.hoveringIndex < 0 && (o.hoveringIndex = o.options.size - 1));
      const Se = ee.value[o.hoveringIndex];
      (Se.disabled === !0 || Se.states.groupDisabled === !0 || !Se.visible) && K(ge), bt(() => Be(F.value));
    }
  }, ye = () => {
    if (!c.value)
      return 0;
    const ge = window.getComputedStyle(c.value);
    return Number.parseFloat(ge.gap || "6px");
  }, pe = ue(() => {
    const ge = ye();
    return { maxWidth: `${v.value && n.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - ge : o.selectionWidth}px` };
  }), we = ue(() => ({ maxWidth: `${o.selectionWidth}px` })), Le = ue(() => ({
    width: `${Math.max(o.calculatorWidth, dR)}px`
  }));
  return Jn(c, ie), Jn(f, fe), Jn(u, Ae), Jn(R, Ae), Jn(y, he), Jn(v, be), Jt(() => {
    O();
  }), {
    inputId: E,
    contentId: i,
    nsSelect: r,
    nsInput: s,
    states: o,
    isFocused: L,
    expanded: _,
    optionsArray: ee,
    hoverOption: F,
    selectSize: $,
    filteredOptionsCount: te,
    resetCalculatorWidth: fe,
    updateTooltip: Ae,
    updateTagTooltip: he,
    debouncedOnInputChange: me,
    onInput: re,
    deletePrevTag: Ie,
    deleteTag: $e,
    deleteSelected: lt,
    handleOptionSelect: qe,
    scrollToOption: Be,
    hasModelValue: I,
    shouldShowPlaceholder: W,
    currentPlaceholder: q,
    mouseEnterEventName: ce,
    showClose: D,
    iconComponent: N,
    iconReverse: U,
    validateState: B,
    validateIcon: G,
    showNewOption: H,
    updateOptions: Z,
    collapseTagSize: se,
    setSelected: O,
    selectDisabled: b,
    emptyText: j,
    handleCompositionStart: w,
    handleCompositionUpdate: A,
    handleCompositionEnd: M,
    onOptionCreate: it,
    onOptionDestroy: tt,
    handleMenuEnter: Qt,
    focus: Pt,
    blur: Nt,
    handleClearClick: Vi,
    handleClickOutside: Gi,
    handleEsc: ni,
    toggleMenu: ts,
    selectOption: ne,
    getValueKey: _e,
    navigateOptions: K,
    dropdownMenuVisible: k,
    showTagList: Ze,
    collapseTagList: ht,
    tagStyle: pe,
    collapseTagStyle: we,
    inputStyle: Le,
    popperRef: qt,
    inputRef: h,
    tooltipRef: l,
    tagTooltipRef: d,
    calculatorRef: f,
    prefixRef: g,
    suffixRef: p,
    selectRef: a,
    wrapperRef: R,
    selectionRef: c,
    scrollbarRef: m,
    menuRef: u,
    tagMenuRef: y,
    collapseItemRef: v
  };
};
var pR = Pe({
  name: "ElOptions",
  setup(n, { slots: e }) {
    const t = pt(lu);
    let i = [];
    return () => {
      var r, s;
      const o = (r = e.default) == null ? void 0 : r.call(e), a = [];
      function c(l) {
        Pn(l) && l.forEach((d) => {
          var h, f, g, p;
          const u = (h = (d == null ? void 0 : d.type) || {}) == null ? void 0 : h.name;
          u === "ElOptionGroup" ? c(!vn(d.children) && !Pn(d.children) && Sn((f = d.children) == null ? void 0 : f.default) ? (g = d.children) == null ? void 0 : g.default() : d.children) : u === "ElOption" ? a.push((p = d.props) == null ? void 0 : p.value) : Pn(d.children) && c(d.children);
        });
      }
      return o.length && c((s = o[0]) == null ? void 0 : s.children), $h(a, i) || (i = a, t && (t.states.optionValues = a)), o;
    };
  }
});
const mR = at({
  name: String,
  id: String,
  modelValue: {
    type: [Array, String, Number, Boolean, Object],
    default: void 0
  },
  autocomplete: {
    type: String,
    default: "off"
  },
  automaticDropdown: Boolean,
  size: Gr,
  effect: {
    type: Je(String),
    default: "light"
  },
  disabled: Boolean,
  clearable: Boolean,
  filterable: Boolean,
  allowCreate: Boolean,
  loading: Boolean,
  popperClass: {
    type: String,
    default: ""
  },
  popperOptions: {
    type: Je(Object),
    default: () => ({})
  },
  remote: Boolean,
  loadingText: String,
  noMatchText: String,
  noDataText: String,
  remoteMethod: Function,
  filterMethod: Function,
  multiple: Boolean,
  multipleLimit: {
    type: Number,
    default: 0
  },
  placeholder: {
    type: String
  },
  defaultFirstOption: Boolean,
  reserveKeyword: {
    type: Boolean,
    default: !0
  },
  valueKey: {
    type: String,
    default: "value"
  },
  collapseTags: Boolean,
  collapseTagsTooltip: Boolean,
  maxCollapseTags: {
    type: Number,
    default: 1
  },
  teleported: kn.teleported,
  persistent: {
    type: Boolean,
    default: !0
  },
  clearIcon: {
    type: Vr,
    default: Yd
  },
  fitInputWidth: Boolean,
  suffixIcon: {
    type: Vr,
    default: Xd
  },
  tagType: { ...Qh.type, default: "info" },
  tagEffect: { ...Qh.effect, default: "light" },
  validateEvent: {
    type: Boolean,
    default: !0
  },
  remoteShowSuffix: Boolean,
  placement: {
    type: Je(String),
    values: Yo,
    default: "bottom-start"
  },
  fallbackPlacements: {
    type: Je(Array),
    default: ["bottom-start", "top-start", "right", "left"]
  },
  appendTo: String,
  ...NE,
  ...Yr(["ariaLabel"])
}), Um = "ElSelect", gR = Pe({
  name: Um,
  componentName: Um,
  components: {
    ElSelectMenu: hR,
    ElOption: mf,
    ElOptions: pR,
    ElTag: lL,
    ElScrollbar: p2,
    ElTooltip: pf,
    ElIcon: It
  },
  directives: { ClickOutside: WC },
  props: mR,
  emits: [
    At,
    hr,
    "remove-tag",
    "clear",
    "visible-change",
    "focus",
    "blur"
  ],
  setup(n, { emit: e }) {
    const t = ue(() => {
      const { modelValue: s, multiple: o } = n, a = o ? [] : void 0;
      return Pn(s) ? o ? s : a : o ? a : s;
    }), i = jn({
      ...Br(n),
      modelValue: t
    }), r = fR(i, e);
    return sn(lu, jn({
      props: i,
      states: r.states,
      optionsArray: r.optionsArray,
      handleOptionSelect: r.handleOptionSelect,
      onOptionCreate: r.onOptionCreate,
      onOptionDestroy: r.onOptionDestroy,
      selectRef: r.selectRef,
      setSelected: r.setSelected
    })), {
      ...r,
      modelValue: t
    };
  }
});
function vR(n, e, t, i, r, s) {
  const o = Vn("el-tag"), a = Vn("el-tooltip"), c = Vn("el-icon"), l = Vn("el-option"), d = Vn("el-options"), h = Vn("el-scrollbar"), f = Vn("el-select-menu"), g = YM("click-outside");
  return Lt((ve(), Ce("div", {
    ref: "selectRef",
    class: Te([n.nsSelect.b(), n.nsSelect.m(n.selectSize)]),
    [JM(n.mouseEnterEventName)]: (p) => n.states.inputHovering = !0,
    onMouseleave: (p) => n.states.inputHovering = !1
  }, [
    le(a, {
      ref: "tooltipRef",
      visible: n.dropdownMenuVisible,
      placement: n.placement,
      teleported: n.teleported,
      "popper-class": [n.nsSelect.e("popper"), n.popperClass],
      "popper-options": n.popperOptions,
      "fallback-placements": n.fallbackPlacements,
      effect: n.effect,
      pure: "",
      trigger: "click",
      transition: `${n.nsSelect.namespace.value}-zoom-in-top`,
      "stop-popper-mouse-event": !1,
      "gpu-acceleration": !1,
      persistent: n.persistent,
      "append-to": n.appendTo,
      onBeforeShow: n.handleMenuEnter,
      onHide: (p) => n.states.isBeforeHide = !1
    }, {
      default: de(() => {
        var p;
        return [
          Ne("div", {
            ref: "wrapperRef",
            class: Te([
              n.nsSelect.e("wrapper"),
              n.nsSelect.is("focused", n.isFocused),
              n.nsSelect.is("hovering", n.states.inputHovering),
              n.nsSelect.is("filterable", n.filterable),
              n.nsSelect.is("disabled", n.selectDisabled)
            ]),
            onClick: Ut(n.toggleMenu, ["prevent"])
          }, [
            n.$slots.prefix ? (ve(), Ce("div", {
              key: 0,
              ref: "prefixRef",
              class: Te(n.nsSelect.e("prefix"))
            }, [
              He(n.$slots, "prefix")
            ], 2)) : ke("v-if", !0),
            Ne("div", {
              ref: "selectionRef",
              class: Te([
                n.nsSelect.e("selection"),
                n.nsSelect.is("near", n.multiple && !n.$slots.prefix && !!n.states.selected.length)
              ])
            }, [
              n.multiple ? He(n.$slots, "tag", { key: 0 }, () => [
                (ve(!0), Ce(Ft, null, Gn(n.showTagList, (u) => (ve(), Ce("div", {
                  key: n.getValueKey(u),
                  class: Te(n.nsSelect.e("selected-item"))
                }, [
                  le(o, {
                    closable: !n.selectDisabled && !u.isDisabled,
                    size: n.collapseTagSize,
                    type: n.tagType,
                    effect: n.tagEffect,
                    "disable-transitions": "",
                    style: Rt(n.tagStyle),
                    onClose: (y) => n.deleteTag(y, u)
                  }, {
                    default: de(() => [
                      Ne("span", {
                        class: Te(n.nsSelect.e("tags-text"))
                      }, [
                        He(n.$slots, "label", {
                          label: u.currentLabel,
                          value: u.value
                        }, () => [
                          rt(gt(u.currentLabel), 1)
                        ])
                      ], 2)
                    ]),
                    _: 2
                  }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
                ], 2))), 128)),
                n.collapseTags && n.states.selected.length > n.maxCollapseTags ? (ve(), Ve(a, {
                  key: 0,
                  ref: "tagTooltipRef",
                  disabled: n.dropdownMenuVisible || !n.collapseTagsTooltip,
                  "fallback-placements": ["bottom", "top", "right", "left"],
                  effect: n.effect,
                  placement: "bottom",
                  teleported: n.teleported
                }, {
                  default: de(() => [
                    Ne("div", {
                      ref: "collapseItemRef",
                      class: Te(n.nsSelect.e("selected-item"))
                    }, [
                      le(o, {
                        closable: !1,
                        size: n.collapseTagSize,
                        type: n.tagType,
                        effect: n.tagEffect,
                        "disable-transitions": "",
                        style: Rt(n.collapseTagStyle)
                      }, {
                        default: de(() => [
                          Ne("span", {
                            class: Te(n.nsSelect.e("tags-text"))
                          }, " + " + gt(n.states.selected.length - n.maxCollapseTags), 3)
                        ]),
                        _: 1
                      }, 8, ["size", "type", "effect", "style"])
                    ], 2)
                  ]),
                  content: de(() => [
                    Ne("div", {
                      ref: "tagMenuRef",
                      class: Te(n.nsSelect.e("selection"))
                    }, [
                      (ve(!0), Ce(Ft, null, Gn(n.collapseTagList, (u) => (ve(), Ce("div", {
                        key: n.getValueKey(u),
                        class: Te(n.nsSelect.e("selected-item"))
                      }, [
                        le(o, {
                          class: "in-tooltip",
                          closable: !n.selectDisabled && !u.isDisabled,
                          size: n.collapseTagSize,
                          type: n.tagType,
                          effect: n.tagEffect,
                          "disable-transitions": "",
                          onClose: (y) => n.deleteTag(y, u)
                        }, {
                          default: de(() => [
                            Ne("span", {
                              class: Te(n.nsSelect.e("tags-text"))
                            }, [
                              He(n.$slots, "label", {
                                label: u.currentLabel,
                                value: u.value
                              }, () => [
                                rt(gt(u.currentLabel), 1)
                              ])
                            ], 2)
                          ]),
                          _: 2
                        }, 1032, ["closable", "size", "type", "effect", "onClose"])
                      ], 2))), 128))
                    ], 2)
                  ]),
                  _: 3
                }, 8, ["disabled", "effect", "teleported"])) : ke("v-if", !0)
              ]) : ke("v-if", !0),
              n.selectDisabled ? ke("v-if", !0) : (ve(), Ce("div", {
                key: 1,
                class: Te([
                  n.nsSelect.e("selected-item"),
                  n.nsSelect.e("input-wrapper"),
                  n.nsSelect.is("hidden", !n.filterable)
                ])
              }, [
                Lt(Ne("input", {
                  id: n.inputId,
                  ref: "inputRef",
                  "onUpdate:modelValue": (u) => n.states.inputValue = u,
                  type: "text",
                  name: n.name,
                  class: Te([n.nsSelect.e("input"), n.nsSelect.is(n.selectSize)]),
                  disabled: n.selectDisabled,
                  autocomplete: n.autocomplete,
                  style: Rt(n.inputStyle),
                  role: "combobox",
                  readonly: !n.filterable,
                  spellcheck: "false",
                  "aria-activedescendant": ((p = n.hoverOption) == null ? void 0 : p.id) || "",
                  "aria-controls": n.contentId,
                  "aria-expanded": n.dropdownMenuVisible,
                  "aria-label": n.ariaLabel,
                  "aria-autocomplete": "none",
                  "aria-haspopup": "listbox",
                  onKeydown: [
                    ui(Ut((u) => n.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
                    ui(Ut((u) => n.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
                    ui(Ut(n.handleEsc, ["stop", "prevent"]), ["esc"]),
                    ui(Ut(n.selectOption, ["stop", "prevent"]), ["enter"]),
                    ui(Ut(n.deletePrevTag, ["stop"]), ["delete"])
                  ],
                  onCompositionstart: n.handleCompositionStart,
                  onCompositionupdate: n.handleCompositionUpdate,
                  onCompositionend: n.handleCompositionEnd,
                  onInput: n.onInput,
                  onClick: Ut(n.toggleMenu, ["stop"])
                }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
                  [KM, n.states.inputValue]
                ]),
                n.filterable ? (ve(), Ce("span", {
                  key: 0,
                  ref: "calculatorRef",
                  "aria-hidden": "true",
                  class: Te(n.nsSelect.e("input-calculator")),
                  textContent: gt(n.states.inputValue)
                }, null, 10, ["textContent"])) : ke("v-if", !0)
              ], 2)),
              n.shouldShowPlaceholder ? (ve(), Ce("div", {
                key: 2,
                class: Te([
                  n.nsSelect.e("selected-item"),
                  n.nsSelect.e("placeholder"),
                  n.nsSelect.is("transparent", !n.hasModelValue || n.expanded && !n.states.inputValue)
                ])
              }, [
                n.hasModelValue ? He(n.$slots, "label", {
                  key: 0,
                  label: n.currentPlaceholder,
                  value: n.modelValue
                }, () => [
                  Ne("span", null, gt(n.currentPlaceholder), 1)
                ]) : (ve(), Ce("span", { key: 1 }, gt(n.currentPlaceholder), 1))
              ], 2)) : ke("v-if", !0)
            ], 2),
            Ne("div", {
              ref: "suffixRef",
              class: Te(n.nsSelect.e("suffix"))
            }, [
              n.iconComponent && !n.showClose ? (ve(), Ve(c, {
                key: 0,
                class: Te([n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.iconReverse])
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(n.iconComponent)))
                ]),
                _: 1
              }, 8, ["class"])) : ke("v-if", !0),
              n.showClose && n.clearIcon ? (ve(), Ve(c, {
                key: 1,
                class: Te([
                  n.nsSelect.e("caret"),
                  n.nsSelect.e("icon"),
                  n.nsSelect.e("clear")
                ]),
                onClick: n.handleClearClick
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(n.clearIcon)))
                ]),
                _: 1
              }, 8, ["class", "onClick"])) : ke("v-if", !0),
              n.validateState && n.validateIcon ? (ve(), Ve(c, {
                key: 2,
                class: Te([n.nsInput.e("icon"), n.nsInput.e("validateIcon")])
              }, {
                default: de(() => [
                  (ve(), Ve(Fn(n.validateIcon)))
                ]),
                _: 1
              }, 8, ["class"])) : ke("v-if", !0)
            ], 2)
          ], 10, ["onClick"])
        ];
      }),
      content: de(() => [
        le(f, { ref: "menuRef" }, {
          default: de(() => [
            n.$slots.header ? (ve(), Ce("div", {
              key: 0,
              class: Te(n.nsSelect.be("dropdown", "header")),
              onClick: Ut(() => {
              }, ["stop"])
            }, [
              He(n.$slots, "header")
            ], 10, ["onClick"])) : ke("v-if", !0),
            Lt(le(h, {
              id: n.contentId,
              ref: "scrollbarRef",
              tag: "ul",
              "wrap-class": n.nsSelect.be("dropdown", "wrap"),
              "view-class": n.nsSelect.be("dropdown", "list"),
              class: Te([n.nsSelect.is("empty", n.filteredOptionsCount === 0)]),
              role: "listbox",
              "aria-label": n.ariaLabel,
              "aria-orientation": "vertical"
            }, {
              default: de(() => [
                n.showNewOption ? (ve(), Ve(l, {
                  key: 0,
                  value: n.states.inputValue,
                  created: !0
                }, null, 8, ["value"])) : ke("v-if", !0),
                le(d, null, {
                  default: de(() => [
                    He(n.$slots, "default")
                  ]),
                  _: 3
                })
              ]),
              _: 3
            }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
              [mn, n.states.options.size > 0 && !n.loading]
            ]),
            n.$slots.loading && n.loading ? (ve(), Ce("div", {
              key: 1,
              class: Te(n.nsSelect.be("dropdown", "loading"))
            }, [
              He(n.$slots, "loading")
            ], 2)) : n.loading || n.filteredOptionsCount === 0 ? (ve(), Ce("div", {
              key: 2,
              class: Te(n.nsSelect.be("dropdown", "empty"))
            }, [
              He(n.$slots, "empty", {}, () => [
                Ne("span", null, gt(n.emptyText), 1)
              ])
            ], 2)) : ke("v-if", !0),
            n.$slots.footer ? (ve(), Ce("div", {
              key: 3,
              class: Te(n.nsSelect.be("dropdown", "footer")),
              onClick: Ut(() => {
              }, ["stop"])
            }, [
              He(n.$slots, "footer")
            ], 10, ["onClick"])) : ke("v-if", !0)
          ]),
          _: 3
        }, 512)
      ]),
      _: 3
    }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"])
  ], 16, ["onMouseleave"])), [
    [g, n.handleClickOutside, n.popperRef]
  ]);
}
var yR = /* @__PURE__ */ st(gR, [["render", vR], ["__file", "select.vue"]]);
const bR = Pe({
  name: "ElOptionGroup",
  componentName: "ElOptionGroup",
  props: {
    label: String,
    disabled: Boolean
  },
  setup(n) {
    const e = nt("select"), t = Ee(null), i = dn(), r = Ee([]);
    sn(fy, jn({
      ...Br(n)
    }));
    const s = ue(() => r.value.some((l) => l.visible === !0)), o = (l) => {
      var d, h;
      return ((d = l.type) == null ? void 0 : d.name) === "ElOption" && !!((h = l.component) != null && h.proxy);
    }, a = (l) => {
      const d = Si(l), h = [];
      return d.forEach((f) => {
        var g, p;
        o(f) ? h.push(f.component.proxy) : (g = f.children) != null && g.length ? h.push(...a(f.children)) : (p = f.component) != null && p.subTree && h.push(...a(f.component.subTree));
      }), h;
    }, c = () => {
      r.value = a(i.subTree);
    };
    return Jt(() => {
      c();
    }), Ew(t, c, {
      attributes: !0,
      subtree: !0,
      childList: !0
    }), {
      groupRef: t,
      visible: s,
      ns: e
    };
  }
});
function xR(n, e, t, i, r, s) {
  return Lt((ve(), Ce("ul", {
    ref: "groupRef",
    class: Te(n.ns.be("group", "wrap"))
  }, [
    Ne("li", {
      class: Te(n.ns.be("group", "title"))
    }, gt(n.label), 3),
    Ne("li", null, [
      Ne("ul", {
        class: Te(n.ns.b("group"))
      }, [
        He(n.$slots, "default")
      ], 2)
    ])
  ], 2)), [
    [mn, n.visible]
  ]);
}
var py = /* @__PURE__ */ st(bR, [["render", xR], ["__file", "option-group.vue"]]);
const qo = on(yR, {
  Option: mf,
  OptionGroup: py
}), Qo = vi(mf);
vi(py);
const MR = at({
  trigger: ka.trigger,
  placement: Hu.placement,
  disabled: ka.disabled,
  visible: kn.visible,
  transition: kn.transition,
  popperOptions: Hu.popperOptions,
  tabindex: Hu.tabindex,
  content: kn.content,
  popperStyle: kn.popperStyle,
  popperClass: kn.popperClass,
  enterable: {
    ...kn.enterable,
    default: !0
  },
  effect: {
    ...kn.effect,
    default: "light"
  },
  teleported: kn.teleported,
  title: String,
  width: {
    type: [String, Number],
    default: 150
  },
  offset: {
    type: Number,
    default: void 0
  },
  showAfter: {
    type: Number,
    default: 0
  },
  hideAfter: {
    type: Number,
    default: 200
  },
  autoClose: {
    type: Number,
    default: 0
  },
  showArrow: {
    type: Boolean,
    default: !0
  },
  persistent: {
    type: Boolean,
    default: !0
  },
  "onUpdate:visible": {
    type: Function
  }
}), wR = {
  "update:visible": (n) => Ba(n),
  "before-enter": () => !0,
  "before-leave": () => !0,
  "after-enter": () => !0,
  "after-leave": () => !0
}, AR = "onUpdate:visible", SR = Pe({
  name: "ElPopover"
}), _R = /* @__PURE__ */ Pe({
  ...SR,
  props: MR,
  emits: wR,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = ue(() => i[AR]), s = nt("popover"), o = Ee(), a = ue(() => {
      var y;
      return (y = z(o)) == null ? void 0 : y.popperRef;
    }), c = ue(() => [
      {
        width: Dc(i.width)
      },
      i.popperStyle
    ]), l = ue(() => [s.b(), i.popperClass, { [s.m("plain")]: !!i.content }]), d = ue(() => i.transition === `${s.namespace.value}-fade-in-linear`), h = () => {
      var y;
      (y = o.value) == null || y.hide();
    }, f = () => {
      t("before-enter");
    }, g = () => {
      t("before-leave");
    }, p = () => {
      t("after-enter");
    }, u = () => {
      t("update:visible", !1), t("after-leave");
    };
    return e({
      popperRef: a,
      hide: h
    }), (y, v) => (ve(), Ve(z(pf), Ei({
      ref_key: "tooltipRef",
      ref: o
    }, y.$attrs, {
      trigger: y.trigger,
      placement: y.placement,
      disabled: y.disabled,
      visible: y.visible,
      transition: y.transition,
      "popper-options": y.popperOptions,
      tabindex: y.tabindex,
      content: y.content,
      offset: y.offset,
      "show-after": y.showAfter,
      "hide-after": y.hideAfter,
      "auto-close": y.autoClose,
      "show-arrow": y.showArrow,
      "aria-label": y.title,
      effect: y.effect,
      enterable: y.enterable,
      "popper-class": z(l),
      "popper-style": z(c),
      teleported: y.teleported,
      persistent: y.persistent,
      "gpu-acceleration": z(d),
      "onUpdate:visible": z(r),
      onBeforeShow: f,
      onBeforeHide: g,
      onShow: p,
      onHide: u
    }), {
      content: de(() => [
        y.title ? (ve(), Ce("div", {
          key: 0,
          class: Te(z(s).e("title")),
          role: "title"
        }, gt(y.title), 3)) : ke("v-if", !0),
        He(y.$slots, "default", {}, () => [
          rt(gt(y.content), 1)
        ])
      ]),
      default: de(() => [
        y.$slots.reference ? He(y.$slots, "reference", { key: 0 }) : ke("v-if", !0)
      ]),
      _: 3
    }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]));
  }
});
var TR = /* @__PURE__ */ st(_R, [["__file", "popover.vue"]]);
const zm = (n, e) => {
  const t = e.arg || e.value, i = t == null ? void 0 : t.popperRef;
  i && (i.triggerRef = n);
};
var ER = {
  mounted(n, e) {
    zm(n, e);
  },
  updated(n, e) {
    zm(n, e);
  }
};
const CR = "popover", LR = rT(ER, CR), cu = on(TR, {
  directive: LR
}), my = Symbol("sliderContextKey"), RR = at({
  modelValue: {
    type: Je([Number, Array]),
    default: 0
  },
  id: {
    type: String,
    default: void 0
  },
  min: {
    type: Number,
    default: 0
  },
  max: {
    type: Number,
    default: 100
  },
  step: {
    type: Number,
    default: 1
  },
  showInput: Boolean,
  showInputControls: {
    type: Boolean,
    default: !0
  },
  size: Gr,
  inputSize: Gr,
  showStops: Boolean,
  showTooltip: {
    type: Boolean,
    default: !0
  },
  formatTooltip: {
    type: Je(Function),
    default: void 0
  },
  disabled: Boolean,
  range: Boolean,
  vertical: Boolean,
  height: String,
  debounce: {
    type: Number,
    default: 300
  },
  rangeStartLabel: {
    type: String,
    default: void 0
  },
  rangeEndLabel: {
    type: String,
    default: void 0
  },
  formatValueText: {
    type: Je(Function),
    default: void 0
  },
  tooltipClass: {
    type: String,
    default: void 0
  },
  placement: {
    type: String,
    values: Yo,
    default: "top"
  },
  marks: {
    type: Je(Object)
  },
  validateEvent: {
    type: Boolean,
    default: !0
  },
  ...Yr(["ariaLabel"])
}), Wu = (n) => yt(n) || Pn(n) && n.every(yt), FR = {
  [At]: Wu,
  [bs]: Wu,
  [hr]: Wu
}, PR = (n, e, t) => {
  const i = Ee();
  return Jt(async () => {
    n.range ? (Array.isArray(n.modelValue) ? (e.firstValue = Math.max(n.min, n.modelValue[0]), e.secondValue = Math.min(n.max, n.modelValue[1])) : (e.firstValue = n.min, e.secondValue = n.max), e.oldValue = [e.firstValue, e.secondValue]) : (typeof n.modelValue != "number" || Number.isNaN(n.modelValue) ? e.firstValue = n.min : e.firstValue = Math.min(n.max, Math.max(n.min, n.modelValue)), e.oldValue = e.firstValue), un(window, "resize", t), await bt(), t();
  }), {
    sliderWrapper: i
  };
}, IR = (n) => ue(() => n.marks ? Object.keys(n.marks).map(Number.parseFloat).sort((t, i) => t - i).filter((t) => t <= n.max && t >= n.min).map((t) => ({
  point: t,
  position: (t - n.min) * 100 / (n.max - n.min),
  mark: n.marks[t]
})) : []), OR = (n, e, t) => {
  const { form: i, formItem: r } = Jo(), s = En(), o = Ee(), a = Ee(), c = {
    firstButton: o,
    secondButton: a
  }, l = ue(() => n.disabled || (i == null ? void 0 : i.disabled) || !1), d = ue(() => Math.min(e.firstValue, e.secondValue)), h = ue(() => Math.max(e.firstValue, e.secondValue)), f = ue(() => n.range ? `${100 * (h.value - d.value) / (n.max - n.min)}%` : `${100 * (e.firstValue - n.min) / (n.max - n.min)}%`), g = ue(() => n.range ? `${100 * (d.value - n.min) / (n.max - n.min)}%` : "0%"), p = ue(() => n.vertical ? { height: n.height } : {}), u = ue(() => n.vertical ? {
    height: f.value,
    bottom: g.value
  } : {
    width: f.value,
    left: g.value
  }), y = () => {
    s.value && (e.sliderSize = s.value[`client${n.vertical ? "Height" : "Width"}`]);
  }, v = (T) => {
    const E = n.min + T * (n.max - n.min) / 100;
    if (!n.range)
      return o;
    let C;
    return Math.abs(d.value - E) < Math.abs(h.value - E) ? C = e.firstValue < e.secondValue ? "firstButton" : "secondButton" : C = e.firstValue > e.secondValue ? "firstButton" : "secondButton", c[C];
  }, m = (T) => {
    const E = v(T);
    return E.value.setPosition(T), E;
  }, x = (T) => {
    e.firstValue = T ?? n.min, A(n.range ? [d.value, h.value] : T ?? n.min);
  }, w = (T) => {
    e.secondValue = T, n.range && A([d.value, h.value]);
  }, A = (T) => {
    t(At, T), t(bs, T);
  }, M = async () => {
    await bt(), t(hr, n.range ? [d.value, h.value] : n.modelValue);
  }, R = (T) => {
    var E, C, P, b, I, D;
    if (l.value || e.dragging)
      return;
    y();
    let N = 0;
    if (n.vertical) {
      const U = (P = (C = (E = T.touches) == null ? void 0 : E.item(0)) == null ? void 0 : C.clientY) != null ? P : T.clientY;
      N = (s.value.getBoundingClientRect().bottom - U) / e.sliderSize * 100;
    } else {
      const U = (D = (I = (b = T.touches) == null ? void 0 : b.item(0)) == null ? void 0 : I.clientX) != null ? D : T.clientX, B = s.value.getBoundingClientRect().left;
      N = (U - B) / e.sliderSize * 100;
    }
    if (!(N < 0 || N > 100))
      return m(N);
  };
  return {
    elFormItem: r,
    slider: s,
    firstButton: o,
    secondButton: a,
    sliderDisabled: l,
    minValue: d,
    maxValue: h,
    runwayStyle: p,
    barStyle: u,
    resetSize: y,
    setPosition: m,
    emitChange: M,
    onSliderWrapperPrevent: (T) => {
      var E, C;
      ((E = c.firstButton.value) != null && E.dragging || (C = c.secondButton.value) != null && C.dragging) && T.preventDefault();
    },
    onSliderClick: (T) => {
      R(T) && M();
    },
    onSliderDown: async (T) => {
      const E = R(T);
      E && (await bt(), E.value.onButtonDown(T));
    },
    onSliderMarkerDown: (T) => {
      l.value || e.dragging || m(T);
    },
    setFirstValue: x,
    setSecondValue: w
  };
}, { left: DR, down: NR, right: BR, up: UR, home: zR, end: kR, pageUp: VR, pageDown: GR } = Li, HR = (n, e, t) => {
  const i = Ee(), r = Ee(!1), s = ue(() => e.value instanceof Function), o = ue(() => s.value && e.value(n.modelValue) || n.modelValue), a = jh(() => {
    t.value && (r.value = !0);
  }, 50), c = jh(() => {
    t.value && (r.value = !1);
  }, 50);
  return {
    tooltip: i,
    tooltipVisible: r,
    formatValue: o,
    displayTooltip: a,
    hideTooltip: c
  };
}, WR = (n, e, t) => {
  const {
    disabled: i,
    min: r,
    max: s,
    step: o,
    showTooltip: a,
    precision: c,
    sliderSize: l,
    formatTooltip: d,
    emitChange: h,
    resetSize: f,
    updateDragging: g
  } = pt(my), { tooltip: p, tooltipVisible: u, formatValue: y, displayTooltip: v, hideTooltip: m } = HR(n, d, a), x = Ee(), w = ue(() => `${(n.modelValue - r.value) / (s.value - r.value) * 100}%`), A = ue(() => n.vertical ? { bottom: w.value } : { left: w.value }), M = () => {
    e.hovering = !0, v();
  }, R = () => {
    e.hovering = !1, e.dragging || m();
  }, L = (G) => {
    i.value || (G.preventDefault(), D(G), window.addEventListener("mousemove", N), window.addEventListener("touchmove", N), window.addEventListener("mouseup", U), window.addEventListener("touchend", U), window.addEventListener("contextmenu", U), x.value.focus());
  }, _ = (G) => {
    i.value || (e.newPosition = Number.parseFloat(w.value) + G / (s.value - r.value) * 100, B(e.newPosition), h());
  }, F = () => {
    _(-o.value);
  }, S = () => {
    _(o.value);
  }, T = () => {
    _(-o.value * 4);
  }, E = () => {
    _(o.value * 4);
  }, C = () => {
    i.value || (B(0), h());
  }, P = () => {
    i.value || (B(100), h());
  }, b = (G) => {
    let J = !0;
    [DR, NR].includes(G.key) ? F() : [BR, UR].includes(G.key) ? S() : G.key === zR ? C() : G.key === kR ? P() : G.key === GR ? T() : G.key === VR ? E() : J = !1, J && G.preventDefault();
  }, I = (G) => {
    let J, j;
    return G.type.startsWith("touch") ? (j = G.touches[0].clientY, J = G.touches[0].clientX) : (j = G.clientY, J = G.clientX), {
      clientX: J,
      clientY: j
    };
  }, D = (G) => {
    e.dragging = !0, e.isClick = !0;
    const { clientX: J, clientY: j } = I(G);
    n.vertical ? e.startY = j : e.startX = J, e.startPosition = Number.parseFloat(w.value), e.newPosition = e.startPosition;
  }, N = (G) => {
    if (e.dragging) {
      e.isClick = !1, v(), f();
      let J;
      const { clientX: j, clientY: te } = I(G);
      n.vertical ? (e.currentY = te, J = (e.startY - e.currentY) / l.value * 100) : (e.currentX = j, J = (e.currentX - e.startX) / l.value * 100), e.newPosition = e.startPosition + J, B(e.newPosition);
    }
  }, U = () => {
    e.dragging && (setTimeout(() => {
      e.dragging = !1, e.hovering || m(), e.isClick || B(e.newPosition), h();
    }, 0), window.removeEventListener("mousemove", N), window.removeEventListener("touchmove", N), window.removeEventListener("mouseup", U), window.removeEventListener("touchend", U), window.removeEventListener("contextmenu", U));
  }, B = async (G) => {
    if (G === null || Number.isNaN(+G))
      return;
    G < 0 ? G = 0 : G > 100 && (G = 100);
    const J = 100 / ((s.value - r.value) / o.value);
    let te = Math.round(G / J) * J * (s.value - r.value) * 0.01 + r.value;
    te = Number.parseFloat(te.toFixed(c.value)), te !== n.modelValue && t(At, te), !e.dragging && n.modelValue !== e.oldValue && (e.oldValue = n.modelValue), await bt(), e.dragging && v(), p.value.updatePopper();
  };
  return Qe(() => e.dragging, (G) => {
    g(G);
  }), un(x, "touchstart", L, { passive: !1 }), {
    disabled: i,
    button: x,
    tooltip: p,
    tooltipVisible: u,
    showTooltip: a,
    wrapperStyle: A,
    formatValue: y,
    handleMouseEnter: M,
    handleMouseLeave: R,
    onButtonDown: L,
    onKeyDown: b,
    setPosition: B
  };
}, jR = (n, e, t, i) => ({
  stops: ue(() => {
    if (!n.showStops || n.min > n.max)
      return [];
    if (n.step === 0)
      return kt("ElSlider", "step should not be 0."), [];
    const o = (n.max - n.min) / n.step, a = 100 * n.step / (n.max - n.min), c = Array.from({ length: o - 1 }).map((l, d) => (d + 1) * a);
    return n.range ? c.filter((l) => l < 100 * (t.value - n.min) / (n.max - n.min) || l > 100 * (i.value - n.min) / (n.max - n.min)) : c.filter((l) => l > 100 * (e.firstValue - n.min) / (n.max - n.min));
  }),
  getStopStyle: (o) => n.vertical ? { bottom: `${o}%` } : { left: `${o}%` }
}), $R = (n, e, t, i, r, s) => {
  const o = (l) => {
    r(At, l), r(bs, l);
  }, a = () => n.range ? ![t.value, i.value].every((l, d) => l === e.oldValue[d]) : n.modelValue !== e.oldValue, c = () => {
    var l, d;
    n.min > n.max && Xo("Slider", "min should not be greater than max.");
    const h = n.modelValue;
    n.range && Array.isArray(h) ? h[1] < n.min ? o([n.min, n.min]) : h[0] > n.max ? o([n.max, n.max]) : h[0] < n.min ? o([n.min, h[1]]) : h[1] > n.max ? o([h[0], n.max]) : (e.firstValue = h[0], e.secondValue = h[1], a() && (n.validateEvent && ((l = s == null ? void 0 : s.validate) == null || l.call(s, "change").catch((f) => kt(f))), e.oldValue = h.slice())) : !n.range && typeof h == "number" && !Number.isNaN(h) && (h < n.min ? o(n.min) : h > n.max ? o(n.max) : (e.firstValue = h, a() && (n.validateEvent && ((d = s == null ? void 0 : s.validate) == null || d.call(s, "change").catch((f) => kt(f))), e.oldValue = h)));
  };
  c(), Qe(() => e.dragging, (l) => {
    l || c();
  }), Qe(() => n.modelValue, (l, d) => {
    e.dragging || Array.isArray(l) && Array.isArray(d) && l.every((h, f) => h === d[f]) && e.firstValue === l[0] && e.secondValue === l[1] || c();
  }, {
    deep: !0
  }), Qe(() => [n.min, n.max], () => {
    c();
  });
}, ZR = at({
  modelValue: {
    type: Number,
    default: 0
  },
  vertical: Boolean,
  tooltipClass: String,
  placement: {
    type: String,
    values: Yo,
    default: "top"
  }
}), XR = {
  [At]: (n) => yt(n)
}, YR = Pe({
  name: "ElSliderButton"
}), JR = /* @__PURE__ */ Pe({
  ...YR,
  props: ZR,
  emits: XR,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = nt("slider"), s = jn({
      hovering: !1,
      dragging: !1,
      isClick: !1,
      startX: 0,
      currentX: 0,
      startY: 0,
      currentY: 0,
      startPosition: 0,
      newPosition: 0,
      oldValue: i.modelValue
    }), {
      disabled: o,
      button: a,
      tooltip: c,
      showTooltip: l,
      tooltipVisible: d,
      wrapperStyle: h,
      formatValue: f,
      handleMouseEnter: g,
      handleMouseLeave: p,
      onButtonDown: u,
      onKeyDown: y,
      setPosition: v
    } = WR(i, s, t), { hovering: m, dragging: x } = Br(s);
    return e({
      onButtonDown: u,
      onKeyDown: y,
      setPosition: v,
      hovering: m,
      dragging: x
    }), (w, A) => (ve(), Ce("div", {
      ref_key: "button",
      ref: a,
      class: Te([z(r).e("button-wrapper"), { hover: z(m), dragging: z(x) }]),
      style: Rt(z(h)),
      tabindex: z(o) ? -1 : 0,
      onMouseenter: z(g),
      onMouseleave: z(p),
      onMousedown: z(u),
      onFocus: z(g),
      onBlur: z(p),
      onKeydown: z(y)
    }, [
      le(z(pf), {
        ref_key: "tooltip",
        ref: c,
        visible: z(d),
        placement: w.placement,
        "fallback-placements": ["top", "bottom", "right", "left"],
        "stop-popper-mouse-event": !1,
        "popper-class": w.tooltipClass,
        disabled: !z(l),
        persistent: ""
      }, {
        content: de(() => [
          Ne("span", null, gt(z(f)), 1)
        ]),
        default: de(() => [
          Ne("div", {
            class: Te([z(r).e("button"), { hover: z(m), dragging: z(x) }])
          }, null, 2)
        ]),
        _: 1
      }, 8, ["visible", "placement", "popper-class", "disabled"])
    ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]));
  }
});
var km = /* @__PURE__ */ st(JR, [["__file", "button.vue"]]);
const KR = at({
  mark: {
    type: Je([String, Object]),
    default: void 0
  }
});
var qR = Pe({
  name: "ElSliderMarker",
  props: KR,
  setup(n) {
    const e = nt("slider"), t = ue(() => vn(n.mark) ? n.mark : n.mark.label), i = ue(() => vn(n.mark) ? void 0 : n.mark.style);
    return () => ho("div", {
      class: e.e("marks-text"),
      style: i.value
    }, t.value);
  }
});
const QR = Pe({
  name: "ElSlider"
}), e3 = /* @__PURE__ */ Pe({
  ...QR,
  props: RR,
  emits: FR,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = nt("slider"), { t: s } = iu(), o = jn({
      firstValue: 0,
      secondValue: 0,
      oldValue: 0,
      dragging: !1,
      sliderSize: 1
    }), {
      elFormItem: a,
      slider: c,
      firstButton: l,
      secondButton: d,
      sliderDisabled: h,
      minValue: f,
      maxValue: g,
      runwayStyle: p,
      barStyle: u,
      resetSize: y,
      emitChange: v,
      onSliderWrapperPrevent: m,
      onSliderClick: x,
      onSliderDown: w,
      onSliderMarkerDown: A,
      setFirstValue: M,
      setSecondValue: R
    } = OR(i, o, t), { stops: L, getStopStyle: _ } = jR(i, o, f, g), { inputId: F, isLabeledByFormItem: S } = su(i, {
      formItemContext: a
    }), T = Ns(), E = ue(() => i.inputSize || T.value), C = ue(() => i.ariaLabel || s("el.slider.defaultLabel", {
      min: i.min,
      max: i.max
    })), P = ue(() => i.range ? i.rangeStartLabel || s("el.slider.defaultRangeStartLabel") : C.value), b = ue(() => i.formatValueText ? i.formatValueText(J.value) : `${J.value}`), I = ue(() => i.rangeEndLabel || s("el.slider.defaultRangeEndLabel")), D = ue(() => i.formatValueText ? i.formatValueText(j.value) : `${j.value}`), N = ue(() => [
      r.b(),
      r.m(T.value),
      r.is("vertical", i.vertical),
      { [r.m("with-input")]: i.showInput }
    ]), U = IR(i);
    $R(i, o, f, g, t, a);
    const B = ue(() => {
      const ae = [i.min, i.max, i.step].map((H) => {
        const Z = `${H}`.split(".")[1];
        return Z ? Z.length : 0;
      });
      return Math.max.apply(null, ae);
    }), { sliderWrapper: G } = PR(i, o, y), { firstValue: J, secondValue: j, sliderSize: te } = Br(o), ee = (ae) => {
      o.dragging = ae;
    };
    return un(G, "touchstart", m, {
      passive: !1
    }), un(G, "touchmove", m, {
      passive: !1
    }), sn(my, {
      ...Br(i),
      sliderSize: te,
      disabled: h,
      precision: B,
      emitChange: v,
      resetSize: y,
      updateDragging: ee
    }), e({
      onSliderClick: x
    }), (ae, H) => {
      var Z, $;
      return ve(), Ce("div", {
        id: ae.range ? z(F) : void 0,
        ref_key: "sliderWrapper",
        ref: G,
        class: Te(z(N)),
        role: ae.range ? "group" : void 0,
        "aria-label": ae.range && !z(S) ? z(C) : void 0,
        "aria-labelledby": ae.range && z(S) ? (Z = z(a)) == null ? void 0 : Z.labelId : void 0
      }, [
        Ne("div", {
          ref_key: "slider",
          ref: c,
          class: Te([
            z(r).e("runway"),
            { "show-input": ae.showInput && !ae.range },
            z(r).is("disabled", z(h))
          ]),
          style: Rt(z(p)),
          onMousedown: z(w),
          onTouchstartPassive: z(w)
        }, [
          Ne("div", {
            class: Te(z(r).e("bar")),
            style: Rt(z(u))
          }, null, 6),
          le(km, {
            id: ae.range ? void 0 : z(F),
            ref_key: "firstButton",
            ref: l,
            "model-value": z(J),
            vertical: ae.vertical,
            "tooltip-class": ae.tooltipClass,
            placement: ae.placement,
            role: "slider",
            "aria-label": ae.range || !z(S) ? z(P) : void 0,
            "aria-labelledby": !ae.range && z(S) ? ($ = z(a)) == null ? void 0 : $.labelId : void 0,
            "aria-valuemin": ae.min,
            "aria-valuemax": ae.range ? z(j) : ae.max,
            "aria-valuenow": z(J),
            "aria-valuetext": z(b),
            "aria-orientation": ae.vertical ? "vertical" : "horizontal",
            "aria-disabled": z(h),
            "onUpdate:modelValue": z(M)
          }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
          ae.range ? (ve(), Ve(km, {
            key: 0,
            ref_key: "secondButton",
            ref: d,
            "model-value": z(j),
            vertical: ae.vertical,
            "tooltip-class": ae.tooltipClass,
            placement: ae.placement,
            role: "slider",
            "aria-label": z(I),
            "aria-valuemin": z(J),
            "aria-valuemax": ae.max,
            "aria-valuenow": z(j),
            "aria-valuetext": z(D),
            "aria-orientation": ae.vertical ? "vertical" : "horizontal",
            "aria-disabled": z(h),
            "onUpdate:modelValue": z(R)
          }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : ke("v-if", !0),
          ae.showStops ? (ve(), Ce("div", { key: 1 }, [
            (ve(!0), Ce(Ft, null, Gn(z(L), (se, k) => (ve(), Ce("div", {
              key: k,
              class: Te(z(r).e("stop")),
              style: Rt(z(_)(se))
            }, null, 6))), 128))
          ])) : ke("v-if", !0),
          z(U).length > 0 ? (ve(), Ce(Ft, { key: 2 }, [
            Ne("div", null, [
              (ve(!0), Ce(Ft, null, Gn(z(U), (se, k) => (ve(), Ce("div", {
                key: k,
                style: Rt(z(_)(se.position)),
                class: Te([z(r).e("stop"), z(r).e("marks-stop")])
              }, null, 6))), 128))
            ]),
            Ne("div", {
              class: Te(z(r).e("marks"))
            }, [
              (ve(!0), Ce(Ft, null, Gn(z(U), (se, k) => (ve(), Ve(z(qR), {
                key: k,
                mark: se.mark,
                style: Rt(z(_)(se.position)),
                onMousedown: Ut((W) => z(A)(se.position), ["stop"])
              }, null, 8, ["mark", "style", "onMousedown"]))), 128))
            ], 2)
          ], 64)) : ke("v-if", !0)
        ], 46, ["onMousedown", "onTouchstartPassive"]),
        ae.showInput && !ae.range ? (ve(), Ve(z(fr), {
          key: 0,
          ref: "input",
          "model-value": z(J),
          class: Te(z(r).e("input")),
          step: ae.step,
          disabled: z(h),
          controls: ae.showInputControls,
          min: ae.min,
          max: ae.max,
          precision: z(B),
          debounce: ae.debounce,
          size: z(E),
          "onUpdate:modelValue": z(M),
          onChange: z(v)
        }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : ke("v-if", !0)
      ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
    };
  }
});
var t3 = /* @__PURE__ */ st(e3, [["__file", "slider.vue"]]);
const ti = on(t3), uu = Symbol("tabsRootContextKey"), n3 = at({
  tabs: {
    type: Je(Array),
    default: () => qi([])
  }
}), gy = "ElTabBar", i3 = Pe({
  name: gy
}), r3 = /* @__PURE__ */ Pe({
  ...i3,
  props: n3,
  setup(n, { expose: e }) {
    const t = n, i = dn(), r = pt(uu);
    r || Xo(gy, "<el-tabs><el-tab-bar /></el-tabs>");
    const s = nt("tabs"), o = Ee(), a = Ee(), c = () => {
      let g = 0, p = 0;
      const u = ["top", "bottom"].includes(r.props.tabPosition) ? "width" : "height", y = u === "width" ? "x" : "y", v = y === "x" ? "left" : "top";
      return t.tabs.every((m) => {
        var x, w;
        const A = (w = (x = i.parent) == null ? void 0 : x.refs) == null ? void 0 : w[`tab-${m.uid}`];
        if (!A)
          return !1;
        if (!m.active)
          return !0;
        g = A[`offset${Rr(v)}`], p = A[`client${Rr(u)}`];
        const M = window.getComputedStyle(A);
        return u === "width" && (p -= Number.parseFloat(M.paddingLeft) + Number.parseFloat(M.paddingRight), g += Number.parseFloat(M.paddingLeft)), !1;
      }), {
        [u]: `${p}px`,
        transform: `translate${Rr(y)}(${g}px)`
      };
    }, l = () => a.value = c(), d = [], h = () => {
      var g;
      d.forEach((u) => u.stop()), d.length = 0;
      const p = (g = i.parent) == null ? void 0 : g.refs;
      if (p) {
        for (const u in p)
          if (u.startsWith("tab-")) {
            const y = p[u];
            y && d.push(Jn(y, l));
          }
      }
    };
    Qe(() => t.tabs, async () => {
      await bt(), l(), h();
    }, { immediate: !0 });
    const f = Jn(o, () => l());
    return ei(() => {
      d.forEach((g) => g.stop()), d.length = 0, f.stop();
    }), e({
      ref: o,
      update: l
    }), (g, p) => (ve(), Ce("div", {
      ref_key: "barRef",
      ref: o,
      class: Te([z(s).e("active-bar"), z(s).is(z(r).props.tabPosition)]),
      style: Rt(a.value)
    }, null, 6));
  }
});
var s3 = /* @__PURE__ */ st(r3, [["__file", "tab-bar.vue"]]);
const o3 = at({
  panes: {
    type: Je(Array),
    default: () => qi([])
  },
  currentName: {
    type: [String, Number],
    default: ""
  },
  editable: Boolean,
  type: {
    type: String,
    values: ["card", "border-card", ""],
    default: ""
  },
  stretch: Boolean
}), a3 = {
  tabClick: (n, e, t) => t instanceof Event,
  tabRemove: (n, e) => e instanceof Event
}, Vm = "ElTabNav", l3 = Pe({
  name: Vm,
  props: o3,
  emits: a3,
  setup(n, {
    expose: e,
    emit: t
  }) {
    const i = pt(uu);
    i || Xo(Vm, "<el-tabs><tab-nav /></el-tabs>");
    const r = nt("tabs"), s = xw(), o = Iw(), a = Ee(), c = Ee(), l = Ee(), d = Ee(), h = Ee(!1), f = Ee(0), g = Ee(!1), p = Ee(!0), u = ue(() => ["top", "bottom"].includes(i.props.tabPosition) ? "width" : "height"), y = ue(() => ({
      transform: `translate${u.value === "width" ? "X" : "Y"}(-${f.value}px)`
    })), v = () => {
      if (!a.value)
        return;
      const L = a.value[`offset${Rr(u.value)}`], _ = f.value;
      if (!_)
        return;
      const F = _ > L ? _ - L : 0;
      f.value = F;
    }, m = () => {
      if (!a.value || !c.value)
        return;
      const L = c.value[`offset${Rr(u.value)}`], _ = a.value[`offset${Rr(u.value)}`], F = f.value;
      if (L - F <= _)
        return;
      const S = L - F > _ * 2 ? F + _ : L - _;
      f.value = S;
    }, x = async () => {
      const L = c.value;
      if (!h.value || !l.value || !a.value || !L)
        return;
      await bt();
      const _ = l.value.querySelector(".is-active");
      if (!_)
        return;
      const F = a.value, S = ["top", "bottom"].includes(i.props.tabPosition), T = _.getBoundingClientRect(), E = F.getBoundingClientRect(), C = S ? L.offsetWidth - E.width : L.offsetHeight - E.height, P = f.value;
      let b = P;
      S ? (T.left < E.left && (b = P - (E.left - T.left)), T.right > E.right && (b = P + T.right - E.right)) : (T.top < E.top && (b = P - (E.top - T.top)), T.bottom > E.bottom && (b = P + (T.bottom - E.bottom))), b = Math.max(b, 0), f.value = Math.min(b, C);
    }, w = () => {
      var L;
      if (!c.value || !a.value)
        return;
      n.stretch && ((L = d.value) == null || L.update());
      const _ = c.value[`offset${Rr(u.value)}`], F = a.value[`offset${Rr(u.value)}`], S = f.value;
      F < _ ? (h.value = h.value || {}, h.value.prev = S, h.value.next = S + F < _, _ - S < F && (f.value = _ - F)) : (h.value = !1, S > 0 && (f.value = 0));
    }, A = (L) => {
      const _ = L.code, {
        up: F,
        down: S,
        left: T,
        right: E
      } = Li;
      if (![F, S, T, E].includes(_))
        return;
      const C = Array.from(L.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), P = C.indexOf(L.target);
      let b;
      _ === T || _ === F ? P === 0 ? b = C.length - 1 : b = P - 1 : P < C.length - 1 ? b = P + 1 : b = 0, C[b].focus({
        preventScroll: !0
      }), C[b].click(), M();
    }, M = () => {
      p.value && (g.value = !0);
    }, R = () => g.value = !1;
    return Qe(s, (L) => {
      L === "hidden" ? p.value = !1 : L === "visible" && setTimeout(() => p.value = !0, 50);
    }), Qe(o, (L) => {
      L ? setTimeout(() => p.value = !0, 50) : p.value = !1;
    }), Jn(l, w), Jt(() => setTimeout(() => x(), 0)), zd(() => w()), e({
      scrollToActiveTab: x,
      removeFocus: R
    }), () => {
      const L = h.value ? [le("span", {
        class: [r.e("nav-prev"), r.is("disabled", !h.value.prev)],
        onClick: v
      }, [le(It, null, {
        default: () => [le(zr, null, null)]
      })]), le("span", {
        class: [r.e("nav-next"), r.is("disabled", !h.value.next)],
        onClick: m
      }, [le(It, null, {
        default: () => [le(kr, null, null)]
      })])] : null, _ = n.panes.map((F, S) => {
        var T, E, C, P;
        const b = F.uid, I = F.props.disabled, D = (E = (T = F.props.name) != null ? T : F.index) != null ? E : `${S}`, N = !I && (F.isClosable || n.editable);
        F.index = `${S}`;
        const U = N ? le(It, {
          class: "is-icon-close",
          onClick: (J) => t("tabRemove", F, J)
        }, {
          default: () => [le(Zh, null, null)]
        }) : null, B = ((P = (C = F.slots).label) == null ? void 0 : P.call(C)) || F.props.label, G = !I && F.active ? 0 : -1;
        return le("div", {
          ref: `tab-${b}`,
          class: [r.e("item"), r.is(i.props.tabPosition), r.is("active", F.active), r.is("disabled", I), r.is("closable", N), r.is("focus", g.value)],
          id: `tab-${D}`,
          key: `tab-${b}`,
          "aria-controls": `pane-${D}`,
          role: "tab",
          "aria-selected": F.active,
          tabindex: G,
          onFocus: () => M(),
          onBlur: () => R(),
          onClick: (J) => {
            R(), t("tabClick", F, D, J);
          },
          onKeydown: (J) => {
            N && (J.code === Li.delete || J.code === Li.backspace) && t("tabRemove", F, J);
          }
        }, [B, U]);
      });
      return le("div", {
        ref: l,
        class: [r.e("nav-wrap"), r.is("scrollable", !!h.value), r.is(i.props.tabPosition)]
      }, [L, le("div", {
        class: r.e("nav-scroll"),
        ref: a
      }, [le("div", {
        class: [r.e("nav"), r.is(i.props.tabPosition), r.is("stretch", n.stretch && ["top", "bottom"].includes(i.props.tabPosition))],
        ref: c,
        style: y.value,
        role: "tablist",
        onKeydown: A
      }, [n.type ? null : le(s3, {
        ref: d,
        tabs: [...n.panes]
      }, null), _])])]);
    };
  }
}), c3 = at({
  type: {
    type: String,
    values: ["card", "border-card", ""],
    default: ""
  },
  closable: Boolean,
  addable: Boolean,
  modelValue: {
    type: [String, Number]
  },
  editable: Boolean,
  tabPosition: {
    type: String,
    values: ["top", "right", "bottom", "left"],
    default: "top"
  },
  beforeLeave: {
    type: Je(Function),
    default: () => !0
  },
  stretch: Boolean
}), ju = (n) => vn(n) || yt(n), u3 = {
  [At]: (n) => ju(n),
  tabClick: (n, e) => e instanceof Event,
  tabChange: (n) => ju(n),
  edit: (n, e) => ["remove", "add"].includes(e),
  tabRemove: (n) => ju(n),
  tabAdd: () => !0
}, h3 = Pe({
  name: "ElTabs",
  props: c3,
  emits: u3,
  setup(n, {
    emit: e,
    slots: t,
    expose: i
  }) {
    var r;
    const s = nt("tabs"), o = ue(() => ["left", "right"].includes(n.tabPosition)), {
      children: a,
      addChild: c,
      removeChild: l
    } = FE(dn(), "ElTabPane"), d = Ee(), h = Ee((r = n.modelValue) != null ? r : "0"), f = async (v, m = !1) => {
      var x, w, A;
      if (!(h.value === v || di(v)))
        try {
          await ((x = n.beforeLeave) == null ? void 0 : x.call(n, v, h.value)) !== !1 && (h.value = v, m && (e(At, v), e("tabChange", v)), (A = (w = d.value) == null ? void 0 : w.removeFocus) == null || A.call(w));
        } catch {
        }
    }, g = (v, m, x) => {
      v.props.disabled || (f(m, !0), e("tabClick", v, x));
    }, p = (v, m) => {
      v.props.disabled || di(v.props.name) || (m.stopPropagation(), e("edit", v.props.name, "remove"), e("tabRemove", v.props.name));
    }, u = () => {
      e("edit", void 0, "add"), e("tabAdd");
    };
    Qe(() => n.modelValue, (v) => f(v)), Qe(h, async () => {
      var v;
      await bt(), (v = d.value) == null || v.scrollToActiveTab();
    }), sn(uu, {
      props: n,
      currentName: h,
      registerPane: (v) => {
        a.value.push(v);
      },
      sortPane: c,
      unregisterPane: l
    }), i({
      currentName: h
    });
    const y = ({
      render: v
    }) => v();
    return () => {
      const v = t["add-icon"], m = n.editable || n.addable ? le("div", {
        class: [s.e("new-tab"), o.value && s.e("new-tab-vertical")],
        tabindex: "0",
        onClick: u,
        onKeydown: (A) => {
          A.code === Li.enter && u();
        }
      }, [v ? He(t, "add-icon") : le(It, {
        class: s.is("icon-plus")
      }, {
        default: () => [le(tu, null, null)]
      })]) : null, x = le("div", {
        class: [s.e("header"), o.value && s.e("header-vertical"), s.is(n.tabPosition)]
      }, [le(y, {
        render: () => {
          const A = a.value.some((M) => M.slots.label);
          return le(l3, {
            ref: d,
            currentName: h.value,
            editable: n.editable,
            type: n.type,
            panes: a.value,
            stretch: n.stretch,
            onTabClick: g,
            onTabRemove: p
          }, {
            $stable: !A
          });
        }
      }, null), m]), w = le("div", {
        class: s.e("content")
      }, [He(t, "default")]);
      return le("div", {
        class: [s.b(), s.m(n.tabPosition), {
          [s.m("card")]: n.type === "card",
          [s.m("border-card")]: n.type === "border-card"
        }]
      }, [w, x]);
    };
  }
}), d3 = at({
  label: {
    type: String,
    default: ""
  },
  name: {
    type: [String, Number]
  },
  closable: Boolean,
  disabled: Boolean,
  lazy: Boolean
}), vy = "ElTabPane", f3 = Pe({
  name: vy
}), p3 = /* @__PURE__ */ Pe({
  ...f3,
  props: d3,
  setup(n) {
    const e = n, t = dn(), i = Xc(), r = pt(uu);
    r || Xo(vy, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
    const s = nt("tab-pane"), o = Ee(), a = ue(() => e.closable || r.props.closable), c = Mp(() => {
      var g;
      return r.currentName.value === ((g = e.name) != null ? g : o.value);
    }), l = Ee(c.value), d = ue(() => {
      var g;
      return (g = e.name) != null ? g : o.value;
    }), h = Mp(() => !e.lazy || l.value || c.value);
    Qe(c, (g) => {
      g && (l.value = !0);
    });
    const f = jn({
      uid: t.uid,
      slots: i,
      props: e,
      paneName: d,
      active: c,
      index: o,
      isClosable: a
    });
    return r.registerPane(f), Jt(() => {
      r.sortPane(f);
    }), Uv(() => {
      r.unregisterPane(f.uid);
    }), (g, p) => z(h) ? Lt((ve(), Ce("div", {
      key: 0,
      id: `pane-${z(d)}`,
      class: Te(z(s).b()),
      role: "tabpanel",
      "aria-hidden": !z(c),
      "aria-labelledby": `tab-${z(d)}`
    }, [
      He(g.$slots, "default")
    ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
      [mn, z(c)]
    ]) : ke("v-if", !0);
  }
});
var yy = /* @__PURE__ */ st(p3, [["__file", "tab-pane.vue"]]);
const by = on(h3, {
  TabPane: yy
}), xy = vi(yy);
function m3(n) {
  let e;
  const t = Ee(!1), i = jn({
    ...n,
    originalPosition: "",
    originalOverflow: "",
    visible: !1
  });
  function r(f) {
    i.text = f;
  }
  function s() {
    const f = i.parent, g = h.ns;
    if (!f.vLoadingAddClassList) {
      let p = f.getAttribute("loading-number");
      p = Number.parseInt(p) - 1, p ? f.setAttribute("loading-number", p.toString()) : (Oc(f, g.bm("parent", "relative")), f.removeAttribute("loading-number")), Oc(f, g.bm("parent", "hidden"));
    }
    o(), d.unmount();
  }
  function o() {
    var f, g;
    (g = (f = h.$el) == null ? void 0 : f.parentNode) == null || g.removeChild(h.$el);
  }
  function a() {
    var f;
    n.beforeClose && !n.beforeClose() || (t.value = !0, clearTimeout(e), e = setTimeout(c, 400), i.visible = !1, (f = n.closed) == null || f.call(n));
  }
  function c() {
    if (!t.value)
      return;
    const f = i.parent;
    t.value = !1, f.vLoadingAddClassList = void 0, s();
  }
  const l = Pe({
    name: "ElLoading",
    setup(f, { expose: g }) {
      const { ns: p, zIndex: u } = zE("loading");
      return g({
        ns: p,
        zIndex: u
      }), () => {
        const y = i.spinner || i.svg, v = ho("svg", {
          class: "circular",
          viewBox: i.svgViewBox ? i.svgViewBox : "0 0 50 50",
          ...y ? { innerHTML: y } : {}
        }, [
          ho("circle", {
            class: "path",
            cx: "25",
            cy: "25",
            r: "20",
            fill: "none"
          })
        ]), m = i.text ? ho("p", { class: p.b("text") }, [i.text]) : void 0;
        return ho(el, {
          name: p.b("fade"),
          onAfterLeave: c
        }, {
          default: de(() => [
            Lt(le("div", {
              style: {
                backgroundColor: i.background || ""
              },
              class: [
                p.b("mask"),
                i.customClass,
                i.fullscreen ? "is-fullscreen" : ""
              ]
            }, [
              ho("div", {
                class: p.b("spinner")
              }, [v, m])
            ]), [[mn, i.visible]])
          ])
        });
      };
    }
  }), d = qM(l), h = d.mount(document.createElement("div"));
  return {
    ...Br(i),
    setText: r,
    removeElLoadingChild: o,
    close: a,
    handleAfterLeave: c,
    vm: h,
    get $el() {
      return h.$el;
    }
  };
}
let Pl;
const ed = function(n = {}) {
  if (!en)
    return;
  const e = g3(n);
  if (e.fullscreen && Pl)
    return Pl;
  const t = m3({
    ...e,
    closed: () => {
      var r;
      (r = e.closed) == null || r.call(e), e.fullscreen && (Pl = void 0);
    }
  });
  v3(e, e.parent, t), Gm(e, e.parent, t), e.parent.vLoadingAddClassList = () => Gm(e, e.parent, t);
  let i = e.parent.getAttribute("loading-number");
  return i ? i = `${Number.parseInt(i) + 1}` : i = "1", e.parent.setAttribute("loading-number", i), e.parent.appendChild(t.$el), bt(() => t.visible.value = e.visible), e.fullscreen && (Pl = t), t;
}, g3 = (n) => {
  var e, t, i, r;
  let s;
  return vn(n.target) ? s = (e = document.querySelector(n.target)) != null ? e : document.body : s = n.target || document.body, {
    parent: s === document.body || n.body ? document.body : s,
    background: n.background || "",
    svg: n.svg || "",
    svgViewBox: n.svgViewBox || "",
    spinner: n.spinner || !1,
    text: n.text || "",
    fullscreen: s === document.body && ((t = n.fullscreen) != null ? t : !0),
    lock: (i = n.lock) != null ? i : !1,
    customClass: n.customClass || "",
    visible: (r = n.visible) != null ? r : !0,
    beforeClose: n.beforeClose,
    closed: n.closed,
    target: s
  };
}, v3 = async (n, e, t) => {
  const { nextZIndex: i } = t.vm.zIndex || t.vm._.exposed.zIndex, r = {};
  if (n.fullscreen)
    t.originalPosition.value = ca(document.body, "position"), t.originalOverflow.value = ca(document.body, "overflow"), r.zIndex = i();
  else if (n.parent === document.body) {
    t.originalPosition.value = ca(document.body, "position"), await bt();
    for (const s of ["top", "left"]) {
      const o = s === "top" ? "scrollTop" : "scrollLeft";
      r[s] = `${n.target.getBoundingClientRect()[s] + document.body[o] + document.documentElement[o] - Number.parseInt(ca(document.body, `margin-${s}`), 10)}px`;
    }
    for (const s of ["height", "width"])
      r[s] = `${n.target.getBoundingClientRect()[s]}px`;
  } else
    t.originalPosition.value = ca(e, "position");
  for (const [s, o] of Object.entries(r))
    t.$el.style[s] = o;
}, Gm = (n, e, t) => {
  const i = t.vm.ns || t.vm._.exposed.ns;
  ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? Oc(e, i.bm("parent", "relative")) : sm(e, i.bm("parent", "relative")), n.fullscreen && n.lock ? sm(e, i.bm("parent", "hidden")) : Oc(e, i.bm("parent", "hidden"));
}, Ec = Symbol("ElLoading"), Hm = (n, e) => {
  var t, i, r, s;
  const o = e.instance, a = (f) => Tn(e.value) ? e.value[f] : void 0, c = (f) => {
    const g = vn(f) && (o == null ? void 0 : o[f]) || f;
    return g && Ee(g);
  }, l = (f) => c(a(f) || n.getAttribute(`element-loading-${Vw(f)}`)), d = (t = a("fullscreen")) != null ? t : e.modifiers.fullscreen, h = {
    text: l("text"),
    svg: l("svg"),
    svgViewBox: l("svgViewBox"),
    spinner: l("spinner"),
    background: l("background"),
    customClass: l("customClass"),
    fullscreen: d,
    target: (i = a("target")) != null ? i : d ? void 0 : n,
    body: (r = a("body")) != null ? r : e.modifiers.body,
    lock: (s = a("lock")) != null ? s : e.modifiers.lock
  };
  n[Ec] = {
    options: h,
    instance: ed(h)
  };
}, y3 = (n, e) => {
  for (const t of Object.keys(e))
    Zc(e[t]) && (e[t].value = n[t]);
}, td = {
  mounted(n, e) {
    e.value && Hm(n, e);
  },
  updated(n, e) {
    const t = n[Ec];
    e.oldValue !== e.value && (e.value && !e.oldValue ? Hm(n, e) : e.value && e.oldValue ? Tn(e.value) && y3(e.value, t.options) : t == null || t.instance.close());
  },
  unmounted(n) {
    var e;
    (e = n[Ec]) == null || e.instance.close(), n[Ec] = null;
  }
}, b3 = {
  install(n) {
    n.directive("loading", td), n.config.globalProperties.$loading = ed;
  },
  directive: td,
  service: ed
}, ki = (n, e) => {
  const t = n.__vccOpts || n;
  for (const [i, r] of e)
    t[i] = r;
  return t;
}, x3 = [
  { position: "top", mode: "vertical", text: "Begin interaction here to rotate on the x-axis" },
  { position: "bottom", mode: "vertical", text: "Begin interaction here to rotate on the x-axis" },
  { position: "left", mode: "horizontal", text: "Begin interaction here to rotate on the y-axis" },
  { position: "right", mode: "horizontal", text: "Begin interaction here to rotate on the y-axis" }
], M3 = {
  name: "ScaffoldOverlay",
  data: function() {
    return {
      lockRotationMode: !1,
      touchActive: !1,
      rotationOverlays: x3
    };
  },
  props: {
    /**
     * Experimental feature to restrict rotation at
     * one-axis based on position of the initial click
     */
    positionalRotation: {
      type: Boolean,
      default: !1
    }
  },
  methods: {
    contentMouseActive: function(n, e) {
      if (this.positionalRotation) {
        const t = this.$refs.topLayer;
        t && (e ? (this.lockRotationMode = !0, t.style.pointerEvents = "none", n.type === "touchstart" && (this.touchActive = !0)) : (this.lockRotationMode = !1, this.setRotationMode(void 0, "free"), t.style.pointerEvents = "auto", n.type === "touchend" && (this.touchActive = !1)));
      }
    },
    setRotationMode: function(n, e) {
      this.lockRotationMode || this.$emit("onRotationModeChange", e), n && (n.preventDefault(), n.stopPropagation());
    },
    skipWhenInBound: function(n) {
      if (this.positionalRotation) {
        const e = this.$refs.topLayer, t = this.$refs.contentLayer;
        if (e && t) {
          const i = e.style.pointerEvents;
          e.style.pointerEvents = "none";
          const r = document.elementFromPoint(n.clientX, n.clientY);
          e.style.pointerEvents = i, t.contains(r) && n.stopPropagation();
        }
      }
    },
    forwardEvent: function(n) {
      const e = this.$refs.topLayer;
      if (!e) return;
      const t = e.style.pointerEvents;
      e.style.pointerEvents = "none";
      const i = document.elementFromPoint(n.clientX, n.clientY);
      if (e.style.pointerEvents = t, i) {
        const r = new MouseEvent(
          n.type,
          {
            bubbles: n.bubbles,
            cancelable: n.cancelable,
            view: n.view,
            clientX: n.clientX,
            clientY: n.clientY,
            button: n.button
          }
        );
        i.dispatchEvent(r), n.stopPropagation();
      }
      n.preventDefault();
    },
    forwardTouchEvent: function(n) {
      const e = this.$refs.topLayer;
      if (!e) return;
      const t = e.style.pointerEvents;
      e.style.pointerEvents = "none";
      const i = n.changedTouches[0], r = i.clientX, s = i.clientY, o = document.elementFromPoint(r, s);
      if (e.style.pointerEvents = t, o) {
        const a = new Touch({
          identifier: i.identifier,
          target: o,
          clientX: i.clientX,
          clientY: i.clientY,
          pageX: i.pageX,
          pageY: i.pageY,
          screenX: i.screenX,
          screenY: i.screenY,
          radiusX: i.radiusX,
          radiusY: i.radiusY,
          rotationAngle: i.rotationAngle,
          force: i.force
        }), c = new TouchEvent(
          n.type,
          {
            bubbles: n.bubbles,
            cancelable: n.cancelable,
            composed: !0,
            view: n.view,
            touches: [a],
            targetTouches: [a],
            changedTouches: [a]
          }
        );
        o.dispatchEvent(c), n.stopPropagation();
      }
      n.preventDefault();
    }
  }
}, w3 = { ref: "overlay" }, A3 = ["onMousedown", "onTouchstart"];
function S3(n, e, t, i, r, s) {
  return ve(), Ce("div", w3, [
    Ne("div", {
      class: "content-layer",
      ref: "contentLayer",
      onMouseleaveCapture: e[0] || (e[0] = (...o) => s.skipWhenInBound && s.skipWhenInBound(...o)),
      onMousedownCapture: e[1] || (e[1] = (o) => s.contentMouseActive(o, !0)),
      onMouseupCapture: e[2] || (e[2] = (o) => s.contentMouseActive(o, !1)),
      onTouchstartCapture: e[3] || (e[3] = (o) => s.contentMouseActive(o, !0)),
      onTouchendCapture: e[4] || (e[4] = (o) => s.contentMouseActive(o, !1))
    }, [
      He(n.$slots, "default", {}, void 0, !0)
    ], 544),
    t.positionalRotation ? (ve(), Ce("div", {
      key: 0,
      ref: "topLayer",
      onMousemoveCapture: e[7] || (e[7] = (...o) => s.forwardEvent && s.forwardEvent(...o)),
      onMouseoverCapture: e[8] || (e[8] = (...o) => s.forwardEvent && s.forwardEvent(...o)),
      onTouchmoveCapture: e[9] || (e[9] = (...o) => s.forwardTouchEvent && s.forwardTouchEvent(...o)),
      onClickCapture: e[10] || (e[10] = (...o) => s.forwardEvent && s.forwardEvent(...o))
    }, [
      (ve(!0), Ce(Ft, null, Gn(n.rotationOverlays, (o) => (ve(), Ce("div", {
        key: o.position,
        class: Te(["rotation-overlay", o.position, n.touchActive ? "touch-active" : ""]),
        onMousedown: (a) => {
          s.setRotationMode(a, o.mode), s.forwardEvent(a);
        },
        onMouseup: e[5] || (e[5] = (...a) => s.forwardEvent && s.forwardEvent(...a)),
        onTouchstart: (a) => {
          s.setRotationMode(a, o.mode), s.forwardTouchEvent(a);
        },
        onTouchend: e[6] || (e[6] = (...a) => s.forwardTouchEvent && s.forwardTouchEvent(...a))
      }, [
        Ne("span", null, gt(o.text), 1)
      ], 42, A3))), 128))
    ], 544)) : ke("", !0)
  ], 512);
}
const My = /* @__PURE__ */ ki(M3, [["render", S3], ["__scopeId", "data-v-24f88254"]]);
var wy = { exports: {} }, Wm = {}, jm;
function _3() {
  return jm || (jm = 1, function(n) {
    var e = function() {
      try {
        return !!Symbol.iterator;
      } catch {
        return !1;
      }
    }, t = e(), i = function(l) {
      var d = {
        next: function() {
          var h = l.shift();
          return { done: h === void 0, value: h };
        }
      };
      return t && (d[Symbol.iterator] = function() {
        return d;
      }), d;
    }, r = function(l) {
      return encodeURIComponent(l).replace(/%20/g, "+");
    }, s = function(l) {
      return decodeURIComponent(String(l).replace(/\+/g, " "));
    }, o = function() {
      var l = function(h) {
        Object.defineProperty(this, "_entries", { writable: !0, value: {} });
        var f = typeof h;
        if (f !== "undefined") if (f === "string")
          h !== "" && this._fromString(h);
        else if (h instanceof l) {
          var g = this;
          h.forEach(function(v, m) {
            g.append(m, v);
          });
        } else if (h !== null && f === "object")
          if (Object.prototype.toString.call(h) === "[object Array]")
            for (var p = 0; p < h.length; p++) {
              var u = h[p];
              if (Object.prototype.toString.call(u) === "[object Array]" || u.length !== 2)
                this.append(u[0], u[1]);
              else
                throw new TypeError("Expected [string, any] as entry at index " + p + " of URLSearchParams's input");
            }
          else
            for (var y in h)
              h.hasOwnProperty(y) && this.append(y, h[y]);
        else
          throw new TypeError("Unsupported input's type for URLSearchParams");
      }, d = l.prototype;
      d.append = function(h, f) {
        h in this._entries ? this._entries[h].push(String(f)) : this._entries[h] = [String(f)];
      }, d.delete = function(h) {
        delete this._entries[h];
      }, d.get = function(h) {
        return h in this._entries ? this._entries[h][0] : null;
      }, d.getAll = function(h) {
        return h in this._entries ? this._entries[h].slice(0) : [];
      }, d.has = function(h) {
        return h in this._entries;
      }, d.set = function(h, f) {
        this._entries[h] = [String(f)];
      }, d.forEach = function(h, f) {
        var g;
        for (var p in this._entries)
          if (this._entries.hasOwnProperty(p)) {
            g = this._entries[p];
            for (var u = 0; u < g.length; u++)
              h.call(f, g[u], p, this);
          }
      }, d.keys = function() {
        var h = [];
        return this.forEach(function(f, g) {
          h.push(g);
        }), i(h);
      }, d.values = function() {
        var h = [];
        return this.forEach(function(f) {
          h.push(f);
        }), i(h);
      }, d.entries = function() {
        var h = [];
        return this.forEach(function(f, g) {
          h.push([g, f]);
        }), i(h);
      }, t && (d[Symbol.iterator] = d.entries), d.toString = function() {
        var h = [];
        return this.forEach(function(f, g) {
          h.push(r(g) + "=" + r(f));
        }), h.join("&");
      }, n.URLSearchParams = l;
    }, a = function() {
      try {
        var l = n.URLSearchParams;
        return new l("?a=1").toString() === "a=1" && typeof l.prototype.set == "function" && typeof l.prototype.entries == "function";
      } catch {
        return !1;
      }
    };
    a() || o();
    var c = n.URLSearchParams.prototype;
    typeof c.sort != "function" && (c.sort = function() {
      var l = this, d = [];
      this.forEach(function(f, g) {
        d.push([g, f]), l._entries || l.delete(g);
      }), d.sort(function(f, g) {
        return f[0] < g[0] ? -1 : f[0] > g[0] ? 1 : 0;
      }), l._entries && (l._entries = {});
      for (var h = 0; h < d.length; h++)
        this.append(d[h][0], d[h][1]);
    }), typeof c._fromString != "function" && Object.defineProperty(c, "_fromString", {
      enumerable: !1,
      configurable: !1,
      writable: !1,
      value: function(l) {
        if (this._entries)
          this._entries = {};
        else {
          var d = [];
          this.forEach(function(p, u) {
            d.push(u);
          });
          for (var h = 0; h < d.length; h++)
            this.delete(d[h]);
        }
        l = l.replace(/^\?/, "");
        for (var f = l.split("&"), g, h = 0; h < f.length; h++)
          g = f[h].split("="), this.append(
            s(g[0]),
            g.length > 1 ? s(g[1]) : ""
          );
      }
    });
  }(
    typeof Lr < "u" ? Lr : typeof window < "u" ? window : typeof self < "u" ? self : Lr
  ), function(n) {
    var e = function() {
      try {
        var r = new n.URL("b", "http://a");
        return r.pathname = "c d", r.href === "http://a/c%20d" && r.searchParams;
      } catch {
        return !1;
      }
    }, t = function() {
      var r = n.URL, s = function(c, l) {
        typeof c != "string" && (c = String(c)), l && typeof l != "string" && (l = String(l));
        var d = document, h;
        if (l && (n.location === void 0 || l !== n.location.href)) {
          l = l.toLowerCase(), d = document.implementation.createHTMLDocument(""), h = d.createElement("base"), h.href = l, d.head.appendChild(h);
          try {
            if (h.href.indexOf(l) !== 0) throw new Error(h.href);
          } catch (x) {
            throw new Error("URL unable to set base " + l + " due to " + x);
          }
        }
        var f = d.createElement("a");
        f.href = c, h && (d.body.appendChild(f), f.href = f.href);
        var g = d.createElement("input");
        if (g.type = "url", g.value = c, f.protocol === ":" || !/:/.test(f.href) || !g.checkValidity() && !l)
          throw new TypeError("Invalid URL");
        Object.defineProperty(this, "_anchorElement", {
          value: f
        });
        var p = new n.URLSearchParams(this.search), u = !0, y = !0, v = this;
        ["append", "delete", "set"].forEach(function(x) {
          var w = p[x];
          p[x] = function() {
            w.apply(p, arguments), u && (y = !1, v.search = p.toString(), y = !0);
          };
        }), Object.defineProperty(this, "searchParams", {
          value: p,
          enumerable: !0
        });
        var m = void 0;
        Object.defineProperty(this, "_updateSearchParams", {
          enumerable: !1,
          configurable: !1,
          writable: !1,
          value: function() {
            this.search !== m && (m = this.search, y && (u = !1, this.searchParams._fromString(this.search), u = !0));
          }
        });
      }, o = s.prototype, a = function(c) {
        Object.defineProperty(o, c, {
          get: function() {
            return this._anchorElement[c];
          },
          set: function(l) {
            this._anchorElement[c] = l;
          },
          enumerable: !0
        });
      };
      ["hash", "host", "hostname", "port", "protocol"].forEach(function(c) {
        a(c);
      }), Object.defineProperty(o, "search", {
        get: function() {
          return this._anchorElement.search;
        },
        set: function(c) {
          this._anchorElement.search = c, this._updateSearchParams();
        },
        enumerable: !0
      }), Object.defineProperties(o, {
        toString: {
          get: function() {
            var c = this;
            return function() {
              return c.href;
            };
          }
        },
        href: {
          get: function() {
            return this._anchorElement.href.replace(/\?$/, "");
          },
          set: function(c) {
            this._anchorElement.href = c, this._updateSearchParams();
          },
          enumerable: !0
        },
        pathname: {
          get: function() {
            return this._anchorElement.pathname.replace(/(^\/?)/, "/");
          },
          set: function(c) {
            this._anchorElement.pathname = c;
          },
          enumerable: !0
        },
        origin: {
          get: function() {
            var c = { "http:": 80, "https:": 443, "ftp:": 21 }[this._anchorElement.protocol], l = this._anchorElement.port != c && this._anchorElement.port !== "";
            return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (l ? ":" + this._anchorElement.port : "");
          },
          enumerable: !0
        },
        password: {
          // TODO
          get: function() {
            return "";
          },
          set: function(c) {
          },
          enumerable: !0
        },
        username: {
          // TODO
          get: function() {
            return "";
          },
          set: function(c) {
          },
          enumerable: !0
        }
      }), s.createObjectURL = function(c) {
        return r.createObjectURL.apply(r, arguments);
      }, s.revokeObjectURL = function(c) {
        return r.revokeObjectURL.apply(r, arguments);
      }, n.URL = s;
    };
    if (e() || t(), n.location !== void 0 && !("origin" in n.location)) {
      var i = function() {
        return n.location.protocol + "//" + n.location.hostname + (n.location.port ? ":" + n.location.port : "");
      };
      try {
        Object.defineProperty(n.location, "origin", {
          get: i,
          enumerable: !0
        });
      } catch {
        setInterval(function() {
          n.location.origin = i();
        }, 100);
      }
    }
  }(
    typeof Lr < "u" ? Lr : typeof window < "u" ? window : typeof self < "u" ? self : Lr
  )), Wm;
}
/**
 * @license
 * Copyright 2010-2021 Three.js Authors
 * SPDX-License-Identifier: MIT
 */
const gf = "130", T3 = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, E3 = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, Ay = 0, nd = 1, Sy = 2, C3 = 3, L3 = 0, vf = 1, _y = 2, po = 3, Hr = 0, jt = 1, Wr = 2, yf = 1, R3 = 2, nr = 0, vo = 1, id = 2, rd = 3, sd = 4, Ty = 5, ps = 100, Ey = 101, Cy = 102, od = 103, ad = 104, Ly = 200, Ry = 201, Fy = 202, Py = 203, bf = 204, xf = 205, Iy = 206, Oy = 207, Dy = 208, Ny = 209, By = 210, Uy = 0, zy = 1, ky = 2, kc = 3, Vy = 4, Gy = 5, Hy = 6, Wy = 7, al = 0, jy = 1, $y = 2, Ir = 0, Zy = 1, Xy = 2, Yy = 3, Jy = 4, Ky = 5, hu = 300, ll = 301, cl = 302, Vc = 303, Gc = 304, ea = 306, ul = 307, jr = 1e3, hn = 1001, Eo = 1002, $t = 1003, Va = 1004, F3 = 1004, Ga = 1005, P3 = 1005, zt = 1006, du = 1007, I3 = 1007, pr = 1008, O3 = 1008, Ts = 1009, qy = 1010, Qy = 1011, Ha = 1012, eb = 1013, Ra = 1014, Qi = 1015, Ms = 1016, tb = 1017, nb = 1018, ib = 1019, yo = 1020, rb = 1021, ir = 1022, Hn = 1023, sb = 1024, ob = 1025, ab = Hn, ws = 1026, Co = 1027, lb = 1028, cb = 1029, ub = 1030, hb = 1031, db = 1032, fb = 1033, ld = 33776, cd = 33777, ud = 33778, hd = 33779, dd = 35840, fd = 35841, pd = 35842, md = 35843, pb = 36196, gd = 37492, vd = 37496, mb = 37808, gb = 37809, vb = 37810, yb = 37811, bb = 37812, xb = 37813, Mb = 37814, wb = 37815, Ab = 37816, Sb = 37817, _b = 37818, Tb = 37819, Eb = 37820, Cb = 37821, Lb = 36492, Rb = 37840, Fb = 37841, Pb = 37842, Ib = 37843, Ob = 37844, Db = 37845, Nb = 37846, Bb = 37847, Ub = 37848, zb = 37849, kb = 37850, Vb = 37851, Gb = 37852, Hb = 37853, Wb = 2200, jb = 2201, $b = 2202, Lo = 2300, Es = 2301, Cc = 2302, gs = 2400, vs = 2401, Wa = 2402, fu = 2500, Mf = 2501, Zb = 0, Xb = 1, wf = 2, Cn = 3e3, Cs = 3001, pu = 3007, mu = 3002, Yb = 3003, Af = 3004, Sf = 3005, _f = 3006, Jb = 3200, Kb = 3201, Jr = 0, qb = 1, D3 = 0, Lc = 7680, N3 = 7681, B3 = 7682, U3 = 7683, z3 = 34055, k3 = 34056, V3 = 5386, G3 = 512, H3 = 513, W3 = 514, j3 = 515, $3 = 516, Z3 = 517, X3 = 518, Qb = 519, Ro = 35044, Fo = 35048, Y3 = 35040, J3 = 35045, K3 = 35049, q3 = 35041, Q3 = 35046, eF = 35050, tF = 35042, nF = "100", yd = "300 es";
class Kr {
  addEventListener(e, t) {
    this._listeners === void 0 && (this._listeners = {});
    const i = this._listeners;
    i[e] === void 0 && (i[e] = []), i[e].indexOf(t) === -1 && i[e].push(t);
  }
  hasEventListener(e, t) {
    if (this._listeners === void 0) return !1;
    const i = this._listeners;
    return i[e] !== void 0 && i[e].indexOf(t) !== -1;
  }
  removeEventListener(e, t) {
    if (this._listeners === void 0) return;
    const r = this._listeners[e];
    if (r !== void 0) {
      const s = r.indexOf(t);
      s !== -1 && r.splice(s, 1);
    }
  }
  dispatchEvent(e) {
    if (this._listeners === void 0) return;
    const i = this._listeners[e.type];
    if (i !== void 0) {
      e.target = this;
      const r = i.slice(0);
      for (let s = 0, o = r.length; s < o; s++)
        r[s].call(this, e);
      e.target = null;
    }
  }
}
const fn = [];
for (let n = 0; n < 256; n++)
  fn[n] = (n < 16 ? "0" : "") + n.toString(16);
let Il = 1234567;
const As = Math.PI / 180, ja = 180 / Math.PI;
function Wn() {
  const n = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0;
  return (fn[n & 255] + fn[n >> 8 & 255] + fn[n >> 16 & 255] + fn[n >> 24 & 255] + "-" + fn[e & 255] + fn[e >> 8 & 255] + "-" + fn[e >> 16 & 15 | 64] + fn[e >> 24 & 255] + "-" + fn[t & 63 | 128] + fn[t >> 8 & 255] + "-" + fn[t >> 16 & 255] + fn[t >> 24 & 255] + fn[i & 255] + fn[i >> 8 & 255] + fn[i >> 16 & 255] + fn[i >> 24 & 255]).toUpperCase();
}
function gn(n, e, t) {
  return Math.max(e, Math.min(t, n));
}
function Tf(n, e) {
  return (n % e + e) % e;
}
function iF(n, e, t, i, r) {
  return i + (n - e) * (r - i) / (t - e);
}
function rF(n, e, t) {
  return n !== e ? (t - n) / (e - n) : 0;
}
function Fa(n, e, t) {
  return (1 - t) * n + t * e;
}
function sF(n, e, t, i) {
  return Fa(n, e, 1 - Math.exp(-t * i));
}
function oF(n, e = 1) {
  return e - Math.abs(Tf(n, e * 2) - e);
}
function aF(n, e, t) {
  return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * (3 - 2 * n));
}
function lF(n, e, t) {
  return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * n * (n * (n * 6 - 15) + 10));
}
function cF(n, e) {
  return n + Math.floor(Math.random() * (e - n + 1));
}
function uF(n, e) {
  return n + Math.random() * (e - n);
}
function hF(n) {
  return n * (0.5 - Math.random());
}
function dF(n) {
  return n !== void 0 && (Il = n % 2147483647), Il = Il * 16807 % 2147483647, (Il - 1) / 2147483646;
}
function fF(n) {
  return n * As;
}
function pF(n) {
  return n * ja;
}
function bd(n) {
  return (n & n - 1) === 0 && n !== 0;
}
function ex(n) {
  return Math.pow(2, Math.ceil(Math.log(n) / Math.LN2));
}
function tx(n) {
  return Math.pow(2, Math.floor(Math.log(n) / Math.LN2));
}
function mF(n, e, t, i, r) {
  const s = Math.cos, o = Math.sin, a = s(t / 2), c = o(t / 2), l = s((e + i) / 2), d = o((e + i) / 2), h = s((e - i) / 2), f = o((e - i) / 2), g = s((i - e) / 2), p = o((i - e) / 2);
  switch (r) {
    case "XYX":
      n.set(a * d, c * h, c * f, a * l);
      break;
    case "YZY":
      n.set(c * f, a * d, c * h, a * l);
      break;
    case "ZXZ":
      n.set(c * h, c * f, a * d, a * l);
      break;
    case "XZX":
      n.set(a * d, c * p, c * g, a * l);
      break;
    case "YXY":
      n.set(c * g, a * d, c * p, a * l);
      break;
    case "ZYZ":
      n.set(c * p, c * g, a * d, a * l);
      break;
    default:
      console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r);
  }
}
var xd = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  DEG2RAD: As,
  RAD2DEG: ja,
  generateUUID: Wn,
  clamp: gn,
  euclideanModulo: Tf,
  mapLinear: iF,
  inverseLerp: rF,
  lerp: Fa,
  damp: sF,
  pingpong: oF,
  smoothstep: aF,
  smootherstep: lF,
  randInt: cF,
  randFloat: uF,
  randFloatSpread: hF,
  seededRandom: dF,
  degToRad: fF,
  radToDeg: pF,
  isPowerOfTwo: bd,
  ceilPowerOfTwo: ex,
  floorPowerOfTwo: tx,
  setQuaternionFromProperEuler: mF
});
class Re {
  constructor(e = 0, t = 0) {
    this.x = e, this.y = t;
  }
  get width() {
    return this.x;
  }
  set width(e) {
    this.x = e;
  }
  get height() {
    return this.y;
  }
  set height(e) {
    this.y = e;
  }
  set(e, t) {
    return this.x = e, this.y = t, this;
  }
  setScalar(e) {
    return this.x = e, this.y = e, this;
  }
  setX(e) {
    return this.x = e, this;
  }
  setY(e) {
    return this.y = e, this;
  }
  setComponent(e, t) {
    switch (e) {
      case 0:
        this.x = t;
        break;
      case 1:
        this.y = t;
        break;
      default:
        throw new Error("index is out of range: " + e);
    }
    return this;
  }
  getComponent(e) {
    switch (e) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      default:
        throw new Error("index is out of range: " + e);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y);
  }
  copy(e) {
    return this.x = e.x, this.y = e.y, this;
  }
  add(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this);
  }
  addScalar(e) {
    return this.x += e, this.y += e, this;
  }
  addVectors(e, t) {
    return this.x = e.x + t.x, this.y = e.y + t.y, this;
  }
  addScaledVector(e, t) {
    return this.x += e.x * t, this.y += e.y * t, this;
  }
  sub(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this);
  }
  subScalar(e) {
    return this.x -= e, this.y -= e, this;
  }
  subVectors(e, t) {
    return this.x = e.x - t.x, this.y = e.y - t.y, this;
  }
  multiply(e) {
    return this.x *= e.x, this.y *= e.y, this;
  }
  multiplyScalar(e) {
    return this.x *= e, this.y *= e, this;
  }
  divide(e) {
    return this.x /= e.x, this.y /= e.y, this;
  }
  divideScalar(e) {
    return this.multiplyScalar(1 / e);
  }
  applyMatrix3(e) {
    const t = this.x, i = this.y, r = e.elements;
    return this.x = r[0] * t + r[3] * i + r[6], this.y = r[1] * t + r[4] * i + r[7], this;
  }
  min(e) {
    return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this;
  }
  max(e) {
    return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this;
  }
  clamp(e, t) {
    return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this;
  }
  clampScalar(e, t) {
    return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this;
  }
  clampLength(e, t) {
    const i = this.length();
    return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i)));
  }
  floor() {
    return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this;
  }
  ceil() {
    return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this;
  }
  round() {
    return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
  }
  roundToZero() {
    return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this;
  }
  negate() {
    return this.x = -this.x, this.y = -this.y, this;
  }
  dot(e) {
    return this.x * e.x + this.y * e.y;
  }
  cross(e) {
    return this.x * e.y - this.y * e.x;
  }
  lengthSq() {
    return this.x * this.x + this.y * this.y;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  angle() {
    return Math.atan2(-this.y, -this.x) + Math.PI;
  }
  distanceTo(e) {
    return Math.sqrt(this.distanceToSquared(e));
  }
  distanceToSquared(e) {
    const t = this.x - e.x, i = this.y - e.y;
    return t * t + i * i;
  }
  manhattanDistanceTo(e) {
    return Math.abs(this.x - e.x) + Math.abs(this.y - e.y);
  }
  setLength(e) {
    return this.normalize().multiplyScalar(e);
  }
  lerp(e, t) {
    return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this;
  }
  lerpVectors(e, t, i) {
    return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this;
  }
  equals(e) {
    return e.x === this.x && e.y === this.y;
  }
  fromArray(e, t = 0) {
    return this.x = e[t], this.y = e[t + 1], this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this.x, e[t + 1] = this.y, e;
  }
  fromBufferAttribute(e, t, i) {
    return i !== void 0 && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this;
  }
  rotateAround(e, t) {
    const i = Math.cos(t), r = Math.sin(t), s = this.x - e.x, o = this.y - e.y;
    return this.x = s * i - o * r + e.x, this.y = s * r + o * i + e.y, this;
  }
  random() {
    return this.x = Math.random(), this.y = Math.random(), this;
  }
}
Re.prototype.isVector2 = !0;
class rn {
  constructor() {
    this.elements = [
      1,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      1
    ], arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.");
  }
  set(e, t, i, r, s, o, a, c, l) {
    const d = this.elements;
    return d[0] = e, d[1] = r, d[2] = a, d[3] = t, d[4] = s, d[5] = c, d[6] = i, d[7] = o, d[8] = l, this;
  }
  identity() {
    return this.set(
      1,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      1
    ), this;
  }
  copy(e) {
    const t = this.elements, i = e.elements;
    return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], this;
  }
  extractBasis(e, t, i) {
    return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), i.setFromMatrix3Column(this, 2), this;
  }
  setFromMatrix4(e) {
    const t = e.elements;
    return this.set(
      t[0],
      t[4],
      t[8],
      t[1],
      t[5],
      t[9],
      t[2],
      t[6],
      t[10]
    ), this;
  }
  multiply(e) {
    return this.multiplyMatrices(this, e);
  }
  premultiply(e) {
    return this.multiplyMatrices(e, this);
  }
  multiplyMatrices(e, t) {
    const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[3], c = i[6], l = i[1], d = i[4], h = i[7], f = i[2], g = i[5], p = i[8], u = r[0], y = r[3], v = r[6], m = r[1], x = r[4], w = r[7], A = r[2], M = r[5], R = r[8];
    return s[0] = o * u + a * m + c * A, s[3] = o * y + a * x + c * M, s[6] = o * v + a * w + c * R, s[1] = l * u + d * m + h * A, s[4] = l * y + d * x + h * M, s[7] = l * v + d * w + h * R, s[2] = f * u + g * m + p * A, s[5] = f * y + g * x + p * M, s[8] = f * v + g * w + p * R, this;
  }
  multiplyScalar(e) {
    const t = this.elements;
    return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this;
  }
  determinant() {
    const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8];
    return t * o * d - t * a * l - i * s * d + i * a * c + r * s * l - r * o * c;
  }
  invert() {
    const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = d * o - a * l, f = a * c - d * s, g = l * s - o * c, p = t * h + i * f + r * g;
    if (p === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
    const u = 1 / p;
    return e[0] = h * u, e[1] = (r * l - d * i) * u, e[2] = (a * i - r * o) * u, e[3] = f * u, e[4] = (d * t - r * c) * u, e[5] = (r * s - a * t) * u, e[6] = g * u, e[7] = (i * c - l * t) * u, e[8] = (o * t - i * s) * u, this;
  }
  transpose() {
    let e;
    const t = this.elements;
    return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this;
  }
  getNormalMatrix(e) {
    return this.setFromMatrix4(e).invert().transpose();
  }
  transposeIntoArray(e) {
    const t = this.elements;
    return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this;
  }
  setUvTransform(e, t, i, r, s, o, a) {
    const c = Math.cos(s), l = Math.sin(s);
    return this.set(
      i * c,
      i * l,
      -i * (c * o + l * a) + o + e,
      -r * l,
      r * c,
      -r * (-l * o + c * a) + a + t,
      0,
      0,
      1
    ), this;
  }
  scale(e, t) {
    const i = this.elements;
    return i[0] *= e, i[3] *= e, i[6] *= e, i[1] *= t, i[4] *= t, i[7] *= t, this;
  }
  rotate(e) {
    const t = Math.cos(e), i = Math.sin(e), r = this.elements, s = r[0], o = r[3], a = r[6], c = r[1], l = r[4], d = r[7];
    return r[0] = t * s + i * c, r[3] = t * o + i * l, r[6] = t * a + i * d, r[1] = -i * s + t * c, r[4] = -i * o + t * l, r[7] = -i * a + t * d, this;
  }
  translate(e, t) {
    const i = this.elements;
    return i[0] += e * i[2], i[3] += e * i[5], i[6] += e * i[8], i[1] += t * i[2], i[4] += t * i[5], i[7] += t * i[8], this;
  }
  equals(e) {
    const t = this.elements, i = e.elements;
    for (let r = 0; r < 9; r++)
      if (t[r] !== i[r]) return !1;
    return !0;
  }
  fromArray(e, t = 0) {
    for (let i = 0; i < 9; i++)
      this.elements[i] = e[i + t];
    return this;
  }
  toArray(e = [], t = 0) {
    const i = this.elements;
    return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e;
  }
  clone() {
    return new this.constructor().fromArray(this.elements);
  }
}
rn.prototype.isMatrix3 = !0;
let js;
class Bs {
  static getDataURL(e) {
    if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u")
      return e.src;
    let t;
    if (e instanceof HTMLCanvasElement)
      t = e;
    else {
      js === void 0 && (js = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), js.width = e.width, js.height = e.height;
      const i = js.getContext("2d");
      e instanceof ImageData ? i.putImageData(e, 0, 0) : i.drawImage(e, 0, 0, e.width, e.height), t = js;
    }
    return t.width > 2048 || t.height > 2048 ? (console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png");
  }
}
let gF = 0;
class Yt extends Kr {
  constructor(e = Yt.DEFAULT_IMAGE, t = Yt.DEFAULT_MAPPING, i = hn, r = hn, s = zt, o = pr, a = Hn, c = Ts, l = 1, d = Cn) {
    super(), Object.defineProperty(this, "id", { value: gF++ }), this.uuid = Wn(), this.name = "", this.image = e, this.mipmaps = [], this.mapping = t, this.wrapS = i, this.wrapT = r, this.magFilter = s, this.minFilter = o, this.anisotropy = l, this.format = a, this.internalFormat = null, this.type = c, this.offset = new Re(0, 0), this.repeat = new Re(1, 1), this.center = new Re(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new rn(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = d, this.version = 0, this.onUpdate = null;
  }
  updateMatrix() {
    this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.name = e.name, this.image = e.image, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.encoding = e.encoding, this;
  }
  toJSON(e) {
    const t = e === void 0 || typeof e == "string";
    if (!t && e.textures[this.uuid] !== void 0)
      return e.textures[this.uuid];
    const i = {
      metadata: {
        version: 4.5,
        type: "Texture",
        generator: "Texture.toJSON"
      },
      uuid: this.uuid,
      name: this.name,
      mapping: this.mapping,
      repeat: [this.repeat.x, this.repeat.y],
      offset: [this.offset.x, this.offset.y],
      center: [this.center.x, this.center.y],
      rotation: this.rotation,
      wrap: [this.wrapS, this.wrapT],
      format: this.format,
      type: this.type,
      encoding: this.encoding,
      minFilter: this.minFilter,
      magFilter: this.magFilter,
      anisotropy: this.anisotropy,
      flipY: this.flipY,
      premultiplyAlpha: this.premultiplyAlpha,
      unpackAlignment: this.unpackAlignment
    };
    if (this.image !== void 0) {
      const r = this.image;
      if (r.uuid === void 0 && (r.uuid = Wn()), !t && e.images[r.uuid] === void 0) {
        let s;
        if (Array.isArray(r)) {
          s = [];
          for (let o = 0, a = r.length; o < a; o++)
            r[o].isDataTexture ? s.push($u(r[o].image)) : s.push($u(r[o]));
        } else
          s = $u(r);
        e.images[r.uuid] = {
          uuid: r.uuid,
          url: s
        };
      }
      i.image = r.uuid;
    }
    return t || (e.textures[this.uuid] = i), i;
  }
  dispose() {
    this.dispatchEvent({ type: "dispose" });
  }
  transformUv(e) {
    if (this.mapping !== hu) return e;
    if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)
      switch (this.wrapS) {
        case jr:
          e.x = e.x - Math.floor(e.x);
          break;
        case hn:
          e.x = e.x < 0 ? 0 : 1;
          break;
        case Eo:
          Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x);
          break;
      }
    if (e.y < 0 || e.y > 1)
      switch (this.wrapT) {
        case jr:
          e.y = e.y - Math.floor(e.y);
          break;
        case hn:
          e.y = e.y < 0 ? 0 : 1;
          break;
        case Eo:
          Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y);
          break;
      }
    return this.flipY && (e.y = 1 - e.y), e;
  }
  set needsUpdate(e) {
    e === !0 && this.version++;
  }
}
Yt.DEFAULT_IMAGE = void 0;
Yt.DEFAULT_MAPPING = hu;
Yt.prototype.isTexture = !0;
function $u(n) {
  return typeof HTMLImageElement < "u" && n instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && n instanceof ImageBitmap ? Bs.getDataURL(n) : n.data ? {
    data: Array.prototype.slice.call(n.data),
    width: n.width,
    height: n.height,
    type: n.data.constructor.name
  } : (console.warn("THREE.Texture: Unable to serialize Texture."), {});
}
class xt {
  constructor(e = 0, t = 0, i = 0, r = 1) {
    this.x = e, this.y = t, this.z = i, this.w = r;
  }
  get width() {
    return this.z;
  }
  set width(e) {
    this.z = e;
  }
  get height() {
    return this.w;
  }
  set height(e) {
    this.w = e;
  }
  set(e, t, i, r) {
    return this.x = e, this.y = t, this.z = i, this.w = r, this;
  }
  setScalar(e) {
    return this.x = e, this.y = e, this.z = e, this.w = e, this;
  }
  setX(e) {
    return this.x = e, this;
  }
  setY(e) {
    return this.y = e, this;
  }
  setZ(e) {
    return this.z = e, this;
  }
  setW(e) {
    return this.w = e, this;
  }
  setComponent(e, t) {
    switch (e) {
      case 0:
        this.x = t;
        break;
      case 1:
        this.y = t;
        break;
      case 2:
        this.z = t;
        break;
      case 3:
        this.w = t;
        break;
      default:
        throw new Error("index is out of range: " + e);
    }
    return this;
  }
  getComponent(e) {
    switch (e) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      case 2:
        return this.z;
      case 3:
        return this.w;
      default:
        throw new Error("index is out of range: " + e);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y, this.z, this.w);
  }
  copy(e) {
    return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w !== void 0 ? e.w : 1, this;
  }
  add(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this);
  }
  addScalar(e) {
    return this.x += e, this.y += e, this.z += e, this.w += e, this;
  }
  addVectors(e, t) {
    return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this;
  }
  addScaledVector(e, t) {
    return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this;
  }
  sub(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this);
  }
  subScalar(e) {
    return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this;
  }
  subVectors(e, t) {
    return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this;
  }
  multiply(e) {
    return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this;
  }
  multiplyScalar(e) {
    return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this;
  }
  applyMatrix4(e) {
    const t = this.x, i = this.y, r = this.z, s = this.w, o = e.elements;
    return this.x = o[0] * t + o[4] * i + o[8] * r + o[12] * s, this.y = o[1] * t + o[5] * i + o[9] * r + o[13] * s, this.z = o[2] * t + o[6] * i + o[10] * r + o[14] * s, this.w = o[3] * t + o[7] * i + o[11] * r + o[15] * s, this;
  }
  divideScalar(e) {
    return this.multiplyScalar(1 / e);
  }
  setAxisAngleFromQuaternion(e) {
    this.w = 2 * Math.acos(e.w);
    const t = Math.sqrt(1 - e.w * e.w);
    return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this;
  }
  setAxisAngleFromRotationMatrix(e) {
    let t, i, r, s;
    const c = e.elements, l = c[0], d = c[4], h = c[8], f = c[1], g = c[5], p = c[9], u = c[2], y = c[6], v = c[10];
    if (Math.abs(d - f) < 0.01 && Math.abs(h - u) < 0.01 && Math.abs(p - y) < 0.01) {
      if (Math.abs(d + f) < 0.1 && Math.abs(h + u) < 0.1 && Math.abs(p + y) < 0.1 && Math.abs(l + g + v - 3) < 0.1)
        return this.set(1, 0, 0, 0), this;
      t = Math.PI;
      const x = (l + 1) / 2, w = (g + 1) / 2, A = (v + 1) / 2, M = (d + f) / 4, R = (h + u) / 4, L = (p + y) / 4;
      return x > w && x > A ? x < 0.01 ? (i = 0, r = 0.707106781, s = 0.707106781) : (i = Math.sqrt(x), r = M / i, s = R / i) : w > A ? w < 0.01 ? (i = 0.707106781, r = 0, s = 0.707106781) : (r = Math.sqrt(w), i = M / r, s = L / r) : A < 0.01 ? (i = 0.707106781, r = 0.707106781, s = 0) : (s = Math.sqrt(A), i = R / s, r = L / s), this.set(i, r, s, t), this;
    }
    let m = Math.sqrt((y - p) * (y - p) + (h - u) * (h - u) + (f - d) * (f - d));
    return Math.abs(m) < 1e-3 && (m = 1), this.x = (y - p) / m, this.y = (h - u) / m, this.z = (f - d) / m, this.w = Math.acos((l + g + v - 1) / 2), this;
  }
  min(e) {
    return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this;
  }
  max(e) {
    return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this;
  }
  clamp(e, t) {
    return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this;
  }
  clampScalar(e, t) {
    return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this;
  }
  clampLength(e, t) {
    const i = this.length();
    return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i)));
  }
  floor() {
    return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this;
  }
  ceil() {
    return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this;
  }
  round() {
    return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this;
  }
  roundToZero() {
    return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this;
  }
  negate() {
    return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this;
  }
  dot(e) {
    return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w;
  }
  lengthSq() {
    return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  setLength(e) {
    return this.normalize().multiplyScalar(e);
  }
  lerp(e, t) {
    return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this;
  }
  lerpVectors(e, t, i) {
    return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this.w = e.w + (t.w - e.w) * i, this;
  }
  equals(e) {
    return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w;
  }
  fromArray(e, t = 0) {
    return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e;
  }
  fromBufferAttribute(e, t, i) {
    return i !== void 0 && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this;
  }
  random() {
    return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this;
  }
}
xt.prototype.isVector4 = !0;
class fi extends Kr {
  constructor(e, t, i = {}) {
    super(), this.width = e, this.height = t, this.depth = 1, this.scissor = new xt(0, 0, e, t), this.scissorTest = !1, this.viewport = new xt(0, 0, e, t), this.texture = new Yt(void 0, i.mapping, i.wrapS, i.wrapT, i.magFilter, i.minFilter, i.format, i.type, i.anisotropy, i.encoding), this.texture.image = { width: e, height: t, depth: 1 }, this.texture.generateMipmaps = i.generateMipmaps !== void 0 ? i.generateMipmaps : !1, this.texture.minFilter = i.minFilter !== void 0 ? i.minFilter : zt, this.depthBuffer = i.depthBuffer !== void 0 ? i.depthBuffer : !0, this.stencilBuffer = i.stencilBuffer !== void 0 ? i.stencilBuffer : !1, this.depthTexture = i.depthTexture !== void 0 ? i.depthTexture : null;
  }
  setTexture(e) {
    e.image = {
      width: this.width,
      height: this.height,
      depth: this.depth
    }, this.texture = e;
  }
  setSize(e, t, i = 1) {
    (this.width !== e || this.height !== t || this.depth !== i) && (this.width = e, this.height = t, this.depth = i, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = i, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.texture.image = { ...this.texture.image }, this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this;
  }
  dispose() {
    this.dispatchEvent({ type: "dispose" });
  }
}
fi.prototype.isWebGLRenderTarget = !0;
class nx extends fi {
  constructor(e, t, i) {
    super(e, t);
    const r = this.texture;
    this.texture = [];
    for (let s = 0; s < i; s++)
      this.texture[s] = r.clone();
  }
  setSize(e, t, i = 1) {
    if (this.width !== e || this.height !== t || this.depth !== i) {
      this.width = e, this.height = t, this.depth = i;
      for (let r = 0, s = this.texture.length; r < s; r++)
        this.texture[r].image.width = e, this.texture[r].image.height = t, this.texture[r].image.depth = i;
      this.dispose();
    }
    return this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t), this;
  }
  copy(e) {
    this.dispose(), this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.set(0, 0, this.width, this.height), this.scissor.set(0, 0, this.width, this.height), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this.texture.length = 0;
    for (let t = 0, i = e.texture.length; t < i; t++)
      this.texture[t] = e.texture[t].clone();
    return this;
  }
}
nx.prototype.isWebGLMultipleRenderTargets = !0;
class Ef extends fi {
  constructor(e, t, i) {
    super(e, t, i), this.samples = 4;
  }
  copy(e) {
    return super.copy.call(this, e), this.samples = e.samples, this;
  }
}
Ef.prototype.isWebGLMultisampleRenderTarget = !0;
class bn {
  constructor(e = 0, t = 0, i = 0, r = 1) {
    this._x = e, this._y = t, this._z = i, this._w = r;
  }
  static slerp(e, t, i, r) {
    return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."), i.slerpQuaternions(e, t, r);
  }
  static slerpFlat(e, t, i, r, s, o, a) {
    let c = i[r + 0], l = i[r + 1], d = i[r + 2], h = i[r + 3];
    const f = s[o + 0], g = s[o + 1], p = s[o + 2], u = s[o + 3];
    if (a === 0) {
      e[t + 0] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h;
      return;
    }
    if (a === 1) {
      e[t + 0] = f, e[t + 1] = g, e[t + 2] = p, e[t + 3] = u;
      return;
    }
    if (h !== u || c !== f || l !== g || d !== p) {
      let y = 1 - a;
      const v = c * f + l * g + d * p + h * u, m = v >= 0 ? 1 : -1, x = 1 - v * v;
      if (x > Number.EPSILON) {
        const A = Math.sqrt(x), M = Math.atan2(A, v * m);
        y = Math.sin(y * M) / A, a = Math.sin(a * M) / A;
      }
      const w = a * m;
      if (c = c * y + f * w, l = l * y + g * w, d = d * y + p * w, h = h * y + u * w, y === 1 - a) {
        const A = 1 / Math.sqrt(c * c + l * l + d * d + h * h);
        c *= A, l *= A, d *= A, h *= A;
      }
    }
    e[t] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h;
  }
  static multiplyQuaternionsFlat(e, t, i, r, s, o) {
    const a = i[r], c = i[r + 1], l = i[r + 2], d = i[r + 3], h = s[o], f = s[o + 1], g = s[o + 2], p = s[o + 3];
    return e[t] = a * p + d * h + c * g - l * f, e[t + 1] = c * p + d * f + l * h - a * g, e[t + 2] = l * p + d * g + a * f - c * h, e[t + 3] = d * p - a * h - c * f - l * g, e;
  }
  get x() {
    return this._x;
  }
  set x(e) {
    this._x = e, this._onChangeCallback();
  }
  get y() {
    return this._y;
  }
  set y(e) {
    this._y = e, this._onChangeCallback();
  }
  get z() {
    return this._z;
  }
  set z(e) {
    this._z = e, this._onChangeCallback();
  }
  get w() {
    return this._w;
  }
  set w(e) {
    this._w = e, this._onChangeCallback();
  }
  set(e, t, i, r) {
    return this._x = e, this._y = t, this._z = i, this._w = r, this._onChangeCallback(), this;
  }
  clone() {
    return new this.constructor(this._x, this._y, this._z, this._w);
  }
  copy(e) {
    return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this;
  }
  setFromEuler(e, t) {
    if (!(e && e.isEuler))
      throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
    const i = e._x, r = e._y, s = e._z, o = e._order, a = Math.cos, c = Math.sin, l = a(i / 2), d = a(r / 2), h = a(s / 2), f = c(i / 2), g = c(r / 2), p = c(s / 2);
    switch (o) {
      case "XYZ":
        this._x = f * d * h + l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h - f * g * p;
        break;
      case "YXZ":
        this._x = f * d * h + l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h + f * g * p;
        break;
      case "ZXY":
        this._x = f * d * h - l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h - f * g * p;
        break;
      case "ZYX":
        this._x = f * d * h - l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h + f * g * p;
        break;
      case "YZX":
        this._x = f * d * h + l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h - f * g * p;
        break;
      case "XZY":
        this._x = f * d * h - l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h + f * g * p;
        break;
      default:
        console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + o);
    }
    return t !== !1 && this._onChangeCallback(), this;
  }
  setFromAxisAngle(e, t) {
    const i = t / 2, r = Math.sin(i);
    return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(i), this._onChangeCallback(), this;
  }
  setFromRotationMatrix(e) {
    const t = e.elements, i = t[0], r = t[4], s = t[8], o = t[1], a = t[5], c = t[9], l = t[2], d = t[6], h = t[10], f = i + a + h;
    if (f > 0) {
      const g = 0.5 / Math.sqrt(f + 1);
      this._w = 0.25 / g, this._x = (d - c) * g, this._y = (s - l) * g, this._z = (o - r) * g;
    } else if (i > a && i > h) {
      const g = 2 * Math.sqrt(1 + i - a - h);
      this._w = (d - c) / g, this._x = 0.25 * g, this._y = (r + o) / g, this._z = (s + l) / g;
    } else if (a > h) {
      const g = 2 * Math.sqrt(1 + a - i - h);
      this._w = (s - l) / g, this._x = (r + o) / g, this._y = 0.25 * g, this._z = (c + d) / g;
    } else {
      const g = 2 * Math.sqrt(1 + h - i - a);
      this._w = (o - r) / g, this._x = (s + l) / g, this._y = (c + d) / g, this._z = 0.25 * g;
    }
    return this._onChangeCallback(), this;
  }
  setFromUnitVectors(e, t) {
    let i = e.dot(t) + 1;
    return i < Number.EPSILON ? (i = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = i) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = i)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = i), this.normalize();
  }
  angleTo(e) {
    return 2 * Math.acos(Math.abs(gn(this.dot(e), -1, 1)));
  }
  rotateTowards(e, t) {
    const i = this.angleTo(e);
    if (i === 0) return this;
    const r = Math.min(1, t / i);
    return this.slerp(e, r), this;
  }
  identity() {
    return this.set(0, 0, 0, 1);
  }
  invert() {
    return this.conjugate();
  }
  conjugate() {
    return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this;
  }
  dot(e) {
    return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w;
  }
  lengthSq() {
    return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;
  }
  length() {
    return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);
  }
  normalize() {
    let e = this.length();
    return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this;
  }
  multiply(e, t) {
    return t !== void 0 ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e);
  }
  premultiply(e) {
    return this.multiplyQuaternions(e, this);
  }
  multiplyQuaternions(e, t) {
    const i = e._x, r = e._y, s = e._z, o = e._w, a = t._x, c = t._y, l = t._z, d = t._w;
    return this._x = i * d + o * a + r * l - s * c, this._y = r * d + o * c + s * a - i * l, this._z = s * d + o * l + i * c - r * a, this._w = o * d - i * a - r * c - s * l, this._onChangeCallback(), this;
  }
  slerp(e, t) {
    if (t === 0) return this;
    if (t === 1) return this.copy(e);
    const i = this._x, r = this._y, s = this._z, o = this._w;
    let a = o * e._w + i * e._x + r * e._y + s * e._z;
    if (a < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, a = -a) : this.copy(e), a >= 1)
      return this._w = o, this._x = i, this._y = r, this._z = s, this;
    const c = 1 - a * a;
    if (c <= Number.EPSILON) {
      const g = 1 - t;
      return this._w = g * o + t * this._w, this._x = g * i + t * this._x, this._y = g * r + t * this._y, this._z = g * s + t * this._z, this.normalize(), this._onChangeCallback(), this;
    }
    const l = Math.sqrt(c), d = Math.atan2(l, a), h = Math.sin((1 - t) * d) / l, f = Math.sin(t * d) / l;
    return this._w = o * h + this._w * f, this._x = i * h + this._x * f, this._y = r * h + this._y * f, this._z = s * h + this._z * f, this._onChangeCallback(), this;
  }
  slerpQuaternions(e, t, i) {
    this.copy(e).slerp(t, i);
  }
  equals(e) {
    return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w;
  }
  fromArray(e, t = 0) {
    return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e;
  }
  fromBufferAttribute(e, t) {
    return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this;
  }
  _onChange(e) {
    return this._onChangeCallback = e, this;
  }
  _onChangeCallback() {
  }
}
bn.prototype.isQuaternion = !0;
class Q {
  constructor(e = 0, t = 0, i = 0) {
    this.x = e, this.y = t, this.z = i;
  }
  set(e, t, i) {
    return i === void 0 && (i = this.z), this.x = e, this.y = t, this.z = i, this;
  }
  setScalar(e) {
    return this.x = e, this.y = e, this.z = e, this;
  }
  setX(e) {
    return this.x = e, this;
  }
  setY(e) {
    return this.y = e, this;
  }
  setZ(e) {
    return this.z = e, this;
  }
  setComponent(e, t) {
    switch (e) {
      case 0:
        this.x = t;
        break;
      case 1:
        this.y = t;
        break;
      case 2:
        this.z = t;
        break;
      default:
        throw new Error("index is out of range: " + e);
    }
    return this;
  }
  getComponent(e) {
    switch (e) {
      case 0:
        return this.x;
      case 1:
        return this.y;
      case 2:
        return this.z;
      default:
        throw new Error("index is out of range: " + e);
    }
  }
  clone() {
    return new this.constructor(this.x, this.y, this.z);
  }
  copy(e) {
    return this.x = e.x, this.y = e.y, this.z = e.z, this;
  }
  add(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this);
  }
  addScalar(e) {
    return this.x += e, this.y += e, this.z += e, this;
  }
  addVectors(e, t) {
    return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this;
  }
  addScaledVector(e, t) {
    return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this;
  }
  sub(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this);
  }
  subScalar(e) {
    return this.x -= e, this.y -= e, this.z -= e, this;
  }
  subVectors(e, t) {
    return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this;
  }
  multiply(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this);
  }
  multiplyScalar(e) {
    return this.x *= e, this.y *= e, this.z *= e, this;
  }
  multiplyVectors(e, t) {
    return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this;
  }
  applyEuler(e) {
    return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion($m.setFromEuler(e));
  }
  applyAxisAngle(e, t) {
    return this.applyQuaternion($m.setFromAxisAngle(e, t));
  }
  applyMatrix3(e) {
    const t = this.x, i = this.y, r = this.z, s = e.elements;
    return this.x = s[0] * t + s[3] * i + s[6] * r, this.y = s[1] * t + s[4] * i + s[7] * r, this.z = s[2] * t + s[5] * i + s[8] * r, this;
  }
  applyNormalMatrix(e) {
    return this.applyMatrix3(e).normalize();
  }
  applyMatrix4(e) {
    const t = this.x, i = this.y, r = this.z, s = e.elements, o = 1 / (s[3] * t + s[7] * i + s[11] * r + s[15]);
    return this.x = (s[0] * t + s[4] * i + s[8] * r + s[12]) * o, this.y = (s[1] * t + s[5] * i + s[9] * r + s[13]) * o, this.z = (s[2] * t + s[6] * i + s[10] * r + s[14]) * o, this;
  }
  applyQuaternion(e) {
    const t = this.x, i = this.y, r = this.z, s = e.x, o = e.y, a = e.z, c = e.w, l = c * t + o * r - a * i, d = c * i + a * t - s * r, h = c * r + s * i - o * t, f = -s * t - o * i - a * r;
    return this.x = l * c + f * -s + d * -a - h * -o, this.y = d * c + f * -o + h * -s - l * -a, this.z = h * c + f * -a + l * -o - d * -s, this;
  }
  project(e) {
    return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix);
  }
  unproject(e) {
    return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld);
  }
  transformDirection(e) {
    const t = this.x, i = this.y, r = this.z, s = e.elements;
    return this.x = s[0] * t + s[4] * i + s[8] * r, this.y = s[1] * t + s[5] * i + s[9] * r, this.z = s[2] * t + s[6] * i + s[10] * r, this.normalize();
  }
  divide(e) {
    return this.x /= e.x, this.y /= e.y, this.z /= e.z, this;
  }
  divideScalar(e) {
    return this.multiplyScalar(1 / e);
  }
  min(e) {
    return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this;
  }
  max(e) {
    return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this;
  }
  clamp(e, t) {
    return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this;
  }
  clampScalar(e, t) {
    return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this;
  }
  clampLength(e, t) {
    const i = this.length();
    return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i)));
  }
  floor() {
    return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this;
  }
  ceil() {
    return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this;
  }
  round() {
    return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this;
  }
  roundToZero() {
    return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this;
  }
  negate() {
    return this.x = -this.x, this.y = -this.y, this.z = -this.z, this;
  }
  dot(e) {
    return this.x * e.x + this.y * e.y + this.z * e.z;
  }
  // TODO lengthSquared?
  lengthSq() {
    return this.x * this.x + this.y * this.y + this.z * this.z;
  }
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
  }
  manhattanLength() {
    return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);
  }
  normalize() {
    return this.divideScalar(this.length() || 1);
  }
  setLength(e) {
    return this.normalize().multiplyScalar(e);
  }
  lerp(e, t) {
    return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this;
  }
  lerpVectors(e, t, i) {
    return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this;
  }
  cross(e, t) {
    return t !== void 0 ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(e, t)) : this.crossVectors(this, e);
  }
  crossVectors(e, t) {
    const i = e.x, r = e.y, s = e.z, o = t.x, a = t.y, c = t.z;
    return this.x = r * c - s * a, this.y = s * o - i * c, this.z = i * a - r * o, this;
  }
  projectOnVector(e) {
    const t = e.lengthSq();
    if (t === 0) return this.set(0, 0, 0);
    const i = e.dot(this) / t;
    return this.copy(e).multiplyScalar(i);
  }
  projectOnPlane(e) {
    return Zu.copy(this).projectOnVector(e), this.sub(Zu);
  }
  reflect(e) {
    return this.sub(Zu.copy(e).multiplyScalar(2 * this.dot(e)));
  }
  angleTo(e) {
    const t = Math.sqrt(this.lengthSq() * e.lengthSq());
    if (t === 0) return Math.PI / 2;
    const i = this.dot(e) / t;
    return Math.acos(gn(i, -1, 1));
  }
  distanceTo(e) {
    return Math.sqrt(this.distanceToSquared(e));
  }
  distanceToSquared(e) {
    const t = this.x - e.x, i = this.y - e.y, r = this.z - e.z;
    return t * t + i * i + r * r;
  }
  manhattanDistanceTo(e) {
    return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z);
  }
  setFromSpherical(e) {
    return this.setFromSphericalCoords(e.radius, e.phi, e.theta);
  }
  setFromSphericalCoords(e, t, i) {
    const r = Math.sin(t) * e;
    return this.x = r * Math.sin(i), this.y = Math.cos(t) * e, this.z = r * Math.cos(i), this;
  }
  setFromCylindrical(e) {
    return this.setFromCylindricalCoords(e.radius, e.theta, e.y);
  }
  setFromCylindricalCoords(e, t, i) {
    return this.x = e * Math.sin(t), this.y = i, this.z = e * Math.cos(t), this;
  }
  setFromMatrixPosition(e) {
    const t = e.elements;
    return this.x = t[12], this.y = t[13], this.z = t[14], this;
  }
  setFromMatrixScale(e) {
    const t = this.setFromMatrixColumn(e, 0).length(), i = this.setFromMatrixColumn(e, 1).length(), r = this.setFromMatrixColumn(e, 2).length();
    return this.x = t, this.y = i, this.z = r, this;
  }
  setFromMatrixColumn(e, t) {
    return this.fromArray(e.elements, t * 4);
  }
  setFromMatrix3Column(e, t) {
    return this.fromArray(e.elements, t * 3);
  }
  equals(e) {
    return e.x === this.x && e.y === this.y && e.z === this.z;
  }
  fromArray(e, t = 0) {
    return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e;
  }
  fromBufferAttribute(e, t, i) {
    return i !== void 0 && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this;
  }
  random() {
    return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this;
  }
}
Q.prototype.isVector3 = !0;
const Zu = /* @__PURE__ */ new Q(), $m = /* @__PURE__ */ new bn();
class Nn {
  constructor(e = new Q(1 / 0, 1 / 0, 1 / 0), t = new Q(-1 / 0, -1 / 0, -1 / 0)) {
    this.min = e, this.max = t;
  }
  set(e, t) {
    return this.min.copy(e), this.max.copy(t), this;
  }
  setFromArray(e) {
    let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0;
    for (let c = 0, l = e.length; c < l; c += 3) {
      const d = e[c], h = e[c + 1], f = e[c + 2];
      d < t && (t = d), h < i && (i = h), f < r && (r = f), d > s && (s = d), h > o && (o = h), f > a && (a = f);
    }
    return this.min.set(t, i, r), this.max.set(s, o, a), this;
  }
  setFromBufferAttribute(e) {
    let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0;
    for (let c = 0, l = e.count; c < l; c++) {
      const d = e.getX(c), h = e.getY(c), f = e.getZ(c);
      d < t && (t = d), h < i && (i = h), f < r && (r = f), d > s && (s = d), h > o && (o = h), f > a && (a = f);
    }
    return this.min.set(t, i, r), this.max.set(s, o, a), this;
  }
  setFromPoints(e) {
    this.makeEmpty();
    for (let t = 0, i = e.length; t < i; t++)
      this.expandByPoint(e[t]);
    return this;
  }
  setFromCenterAndSize(e, t) {
    const i = ha.copy(t).multiplyScalar(0.5);
    return this.min.copy(e).sub(i), this.max.copy(e).add(i), this;
  }
  setFromObject(e) {
    return this.makeEmpty(), this.expandByObject(e);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.min.copy(e.min), this.max.copy(e.max), this;
  }
  makeEmpty() {
    return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this;
  }
  isEmpty() {
    return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;
  }
  getCenter(e) {
    return this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5);
  }
  getSize(e) {
    return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min);
  }
  expandByPoint(e) {
    return this.min.min(e), this.max.max(e), this;
  }
  expandByVector(e) {
    return this.min.sub(e), this.max.add(e), this;
  }
  expandByScalar(e) {
    return this.min.addScalar(-e), this.max.addScalar(e), this;
  }
  expandByObject(e) {
    e.updateWorldMatrix(!1, !1);
    const t = e.geometry;
    t !== void 0 && (t.boundingBox === null && t.computeBoundingBox(), Xu.copy(t.boundingBox), Xu.applyMatrix4(e.matrixWorld), this.union(Xu));
    const i = e.children;
    for (let r = 0, s = i.length; r < s; r++)
      this.expandByObject(i[r]);
    return this;
  }
  containsPoint(e) {
    return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z);
  }
  containsBox(e) {
    return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z;
  }
  getParameter(e, t) {
    return t.set(
      (e.x - this.min.x) / (this.max.x - this.min.x),
      (e.y - this.min.y) / (this.max.y - this.min.y),
      (e.z - this.min.z) / (this.max.z - this.min.z)
    );
  }
  intersectsBox(e) {
    return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z);
  }
  intersectsSphere(e) {
    return this.clampPoint(e.center, ha), ha.distanceToSquared(e.center) <= e.radius * e.radius;
  }
  intersectsPlane(e) {
    let t, i;
    return e.normal.x > 0 ? (t = e.normal.x * this.min.x, i = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, i = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, i += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, i += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, i += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, i += e.normal.z * this.min.z), t <= -e.constant && i >= -e.constant;
  }
  intersectsTriangle(e) {
    if (this.isEmpty())
      return !1;
    this.getCenter(da), Ol.subVectors(this.max, da), $s.subVectors(e.a, da), Zs.subVectors(e.b, da), Xs.subVectors(e.c, da), vr.subVectors(Zs, $s), yr.subVectors(Xs, Zs), ss.subVectors($s, Xs);
    let t = [
      0,
      -vr.z,
      vr.y,
      0,
      -yr.z,
      yr.y,
      0,
      -ss.z,
      ss.y,
      vr.z,
      0,
      -vr.x,
      yr.z,
      0,
      -yr.x,
      ss.z,
      0,
      -ss.x,
      -vr.y,
      vr.x,
      0,
      -yr.y,
      yr.x,
      0,
      -ss.y,
      ss.x,
      0
    ];
    return !Yu(t, $s, Zs, Xs, Ol) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Yu(t, $s, Zs, Xs, Ol)) ? !1 : (Dl.crossVectors(vr, yr), t = [Dl.x, Dl.y, Dl.z], Yu(t, $s, Zs, Xs, Ol));
  }
  clampPoint(e, t) {
    return t.copy(e).clamp(this.min, this.max);
  }
  distanceToPoint(e) {
    return ha.copy(e).clamp(this.min, this.max).sub(e).length();
  }
  getBoundingSphere(e) {
    return this.getCenter(e.center), e.radius = this.getSize(ha).length() * 0.5, e;
  }
  intersect(e) {
    return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this;
  }
  union(e) {
    return this.min.min(e.min), this.max.max(e.max), this;
  }
  applyMatrix4(e) {
    return this.isEmpty() ? this : (Wi[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Wi[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Wi[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Wi[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Wi[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Wi[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Wi[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Wi[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Wi), this);
  }
  translate(e) {
    return this.min.add(e), this.max.add(e), this;
  }
  equals(e) {
    return e.min.equals(this.min) && e.max.equals(this.max);
  }
}
Nn.prototype.isBox3 = !0;
const Wi = [
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q(),
  /* @__PURE__ */ new Q()
], ha = /* @__PURE__ */ new Q(), Xu = /* @__PURE__ */ new Nn(), $s = /* @__PURE__ */ new Q(), Zs = /* @__PURE__ */ new Q(), Xs = /* @__PURE__ */ new Q(), vr = /* @__PURE__ */ new Q(), yr = /* @__PURE__ */ new Q(), ss = /* @__PURE__ */ new Q(), da = /* @__PURE__ */ new Q(), Ol = /* @__PURE__ */ new Q(), Dl = /* @__PURE__ */ new Q(), os = /* @__PURE__ */ new Q();
function Yu(n, e, t, i, r) {
  for (let s = 0, o = n.length - 3; s <= o; s += 3) {
    os.fromArray(n, s);
    const a = r.x * Math.abs(os.x) + r.y * Math.abs(os.y) + r.z * Math.abs(os.z), c = e.dot(os), l = t.dot(os), d = i.dot(os);
    if (Math.max(-Math.max(c, l, d), Math.min(c, l, d)) > a)
      return !1;
  }
  return !0;
}
const vF = /* @__PURE__ */ new Nn(), Zm = /* @__PURE__ */ new Q(), Ju = /* @__PURE__ */ new Q(), Ku = /* @__PURE__ */ new Q();
class mr {
  constructor(e = new Q(), t = -1) {
    this.center = e, this.radius = t;
  }
  set(e, t) {
    return this.center.copy(e), this.radius = t, this;
  }
  setFromPoints(e, t) {
    const i = this.center;
    t !== void 0 ? i.copy(t) : vF.setFromPoints(e).getCenter(i);
    let r = 0;
    for (let s = 0, o = e.length; s < o; s++)
      r = Math.max(r, i.distanceToSquared(e[s]));
    return this.radius = Math.sqrt(r), this;
  }
  copy(e) {
    return this.center.copy(e.center), this.radius = e.radius, this;
  }
  isEmpty() {
    return this.radius < 0;
  }
  makeEmpty() {
    return this.center.set(0, 0, 0), this.radius = -1, this;
  }
  containsPoint(e) {
    return e.distanceToSquared(this.center) <= this.radius * this.radius;
  }
  distanceToPoint(e) {
    return e.distanceTo(this.center) - this.radius;
  }
  intersectsSphere(e) {
    const t = this.radius + e.radius;
    return e.center.distanceToSquared(this.center) <= t * t;
  }
  intersectsBox(e) {
    return e.intersectsSphere(this);
  }
  intersectsPlane(e) {
    return Math.abs(e.distanceToPoint(this.center)) <= this.radius;
  }
  clampPoint(e, t) {
    const i = this.center.distanceToSquared(e);
    return t.copy(e), i > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t;
  }
  getBoundingBox(e) {
    return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e);
  }
  applyMatrix4(e) {
    return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this;
  }
  translate(e) {
    return this.center.add(e), this;
  }
  expandByPoint(e) {
    Ku.subVectors(e, this.center);
    const t = Ku.lengthSq();
    if (t > this.radius * this.radius) {
      const i = Math.sqrt(t), r = (i - this.radius) * 0.5;
      this.center.add(Ku.multiplyScalar(r / i)), this.radius += r;
    }
    return this;
  }
  union(e) {
    return Ju.subVectors(e.center, this.center).normalize().multiplyScalar(e.radius), this.expandByPoint(Zm.copy(e.center).add(Ju)), this.expandByPoint(Zm.copy(e.center).sub(Ju)), this;
  }
  equals(e) {
    return e.center.equals(this.center) && e.radius === this.radius;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
const ji = /* @__PURE__ */ new Q(), qu = /* @__PURE__ */ new Q(), Nl = /* @__PURE__ */ new Q(), br = /* @__PURE__ */ new Q(), Qu = /* @__PURE__ */ new Q(), Bl = /* @__PURE__ */ new Q(), eh = /* @__PURE__ */ new Q();
class qr {
  constructor(e = new Q(), t = new Q(0, 0, -1)) {
    this.origin = e, this.direction = t;
  }
  set(e, t) {
    return this.origin.copy(e), this.direction.copy(t), this;
  }
  copy(e) {
    return this.origin.copy(e.origin), this.direction.copy(e.direction), this;
  }
  at(e, t) {
    return t.copy(this.direction).multiplyScalar(e).add(this.origin);
  }
  lookAt(e) {
    return this.direction.copy(e).sub(this.origin).normalize(), this;
  }
  recast(e) {
    return this.origin.copy(this.at(e, ji)), this;
  }
  closestPointToPoint(e, t) {
    t.subVectors(e, this.origin);
    const i = t.dot(this.direction);
    return i < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(i).add(this.origin);
  }
  distanceToPoint(e) {
    return Math.sqrt(this.distanceSqToPoint(e));
  }
  distanceSqToPoint(e) {
    const t = ji.subVectors(e, this.origin).dot(this.direction);
    return t < 0 ? this.origin.distanceToSquared(e) : (ji.copy(this.direction).multiplyScalar(t).add(this.origin), ji.distanceToSquared(e));
  }
  distanceSqToSegment(e, t, i, r) {
    qu.copy(e).add(t).multiplyScalar(0.5), Nl.copy(t).sub(e).normalize(), br.copy(this.origin).sub(qu);
    const s = e.distanceTo(t) * 0.5, o = -this.direction.dot(Nl), a = br.dot(this.direction), c = -br.dot(Nl), l = br.lengthSq(), d = Math.abs(1 - o * o);
    let h, f, g, p;
    if (d > 0)
      if (h = o * c - a, f = o * a - c, p = s * d, h >= 0)
        if (f >= -p)
          if (f <= p) {
            const u = 1 / d;
            h *= u, f *= u, g = h * (h + o * f + 2 * a) + f * (o * h + f + 2 * c) + l;
          } else
            f = s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l;
        else
          f = -s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l;
      else
        f <= -p ? (h = Math.max(0, -(-o * s + a)), f = h > 0 ? -s : Math.min(Math.max(-s, -c), s), g = -h * h + f * (f + 2 * c) + l) : f <= p ? (h = 0, f = Math.min(Math.max(-s, -c), s), g = f * (f + 2 * c) + l) : (h = Math.max(0, -(o * s + a)), f = h > 0 ? s : Math.min(Math.max(-s, -c), s), g = -h * h + f * (f + 2 * c) + l);
    else
      f = o > 0 ? -s : s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l;
    return i && i.copy(this.direction).multiplyScalar(h).add(this.origin), r && r.copy(Nl).multiplyScalar(f).add(qu), g;
  }
  intersectSphere(e, t) {
    ji.subVectors(e.center, this.origin);
    const i = ji.dot(this.direction), r = ji.dot(ji) - i * i, s = e.radius * e.radius;
    if (r > s) return null;
    const o = Math.sqrt(s - r), a = i - o, c = i + o;
    return a < 0 && c < 0 ? null : a < 0 ? this.at(c, t) : this.at(a, t);
  }
  intersectsSphere(e) {
    return this.distanceSqToPoint(e.center) <= e.radius * e.radius;
  }
  distanceToPlane(e) {
    const t = e.normal.dot(this.direction);
    if (t === 0)
      return e.distanceToPoint(this.origin) === 0 ? 0 : null;
    const i = -(this.origin.dot(e.normal) + e.constant) / t;
    return i >= 0 ? i : null;
  }
  intersectPlane(e, t) {
    const i = this.distanceToPlane(e);
    return i === null ? null : this.at(i, t);
  }
  intersectsPlane(e) {
    const t = e.distanceToPoint(this.origin);
    return t === 0 || e.normal.dot(this.direction) * t < 0;
  }
  intersectBox(e, t) {
    let i, r, s, o, a, c;
    const l = 1 / this.direction.x, d = 1 / this.direction.y, h = 1 / this.direction.z, f = this.origin;
    return l >= 0 ? (i = (e.min.x - f.x) * l, r = (e.max.x - f.x) * l) : (i = (e.max.x - f.x) * l, r = (e.min.x - f.x) * l), d >= 0 ? (s = (e.min.y - f.y) * d, o = (e.max.y - f.y) * d) : (s = (e.max.y - f.y) * d, o = (e.min.y - f.y) * d), i > o || s > r || ((s > i || i !== i) && (i = s), (o < r || r !== r) && (r = o), h >= 0 ? (a = (e.min.z - f.z) * h, c = (e.max.z - f.z) * h) : (a = (e.max.z - f.z) * h, c = (e.min.z - f.z) * h), i > c || a > r) || ((a > i || i !== i) && (i = a), (c < r || r !== r) && (r = c), r < 0) ? null : this.at(i >= 0 ? i : r, t);
  }
  intersectsBox(e) {
    return this.intersectBox(e, ji) !== null;
  }
  intersectTriangle(e, t, i, r, s) {
    Qu.subVectors(t, e), Bl.subVectors(i, e), eh.crossVectors(Qu, Bl);
    let o = this.direction.dot(eh), a;
    if (o > 0) {
      if (r) return null;
      a = 1;
    } else if (o < 0)
      a = -1, o = -o;
    else
      return null;
    br.subVectors(this.origin, e);
    const c = a * this.direction.dot(Bl.crossVectors(br, Bl));
    if (c < 0)
      return null;
    const l = a * this.direction.dot(Qu.cross(br));
    if (l < 0 || c + l > o)
      return null;
    const d = -a * br.dot(eh);
    return d < 0 ? null : this.at(d / o, s);
  }
  applyMatrix4(e) {
    return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this;
  }
  equals(e) {
    return e.origin.equals(this.origin) && e.direction.equals(this.direction);
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
class Xe {
  constructor() {
    this.elements = [
      1,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      0,
      1
    ], arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.");
  }
  set(e, t, i, r, s, o, a, c, l, d, h, f, g, p, u, y) {
    const v = this.elements;
    return v[0] = e, v[4] = t, v[8] = i, v[12] = r, v[1] = s, v[5] = o, v[9] = a, v[13] = c, v[2] = l, v[6] = d, v[10] = h, v[14] = f, v[3] = g, v[7] = p, v[11] = u, v[15] = y, this;
  }
  identity() {
    return this.set(
      1,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  clone() {
    return new Xe().fromArray(this.elements);
  }
  copy(e) {
    const t = this.elements, i = e.elements;
    return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t[9] = i[9], t[10] = i[10], t[11] = i[11], t[12] = i[12], t[13] = i[13], t[14] = i[14], t[15] = i[15], this;
  }
  copyPosition(e) {
    const t = this.elements, i = e.elements;
    return t[12] = i[12], t[13] = i[13], t[14] = i[14], this;
  }
  setFromMatrix3(e) {
    const t = e.elements;
    return this.set(
      t[0],
      t[3],
      t[6],
      0,
      t[1],
      t[4],
      t[7],
      0,
      t[2],
      t[5],
      t[8],
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  extractBasis(e, t, i) {
    return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), i.setFromMatrixColumn(this, 2), this;
  }
  makeBasis(e, t, i) {
    return this.set(
      e.x,
      t.x,
      i.x,
      0,
      e.y,
      t.y,
      i.y,
      0,
      e.z,
      t.z,
      i.z,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  extractRotation(e) {
    const t = this.elements, i = e.elements, r = 1 / Ys.setFromMatrixColumn(e, 0).length(), s = 1 / Ys.setFromMatrixColumn(e, 1).length(), o = 1 / Ys.setFromMatrixColumn(e, 2).length();
    return t[0] = i[0] * r, t[1] = i[1] * r, t[2] = i[2] * r, t[3] = 0, t[4] = i[4] * s, t[5] = i[5] * s, t[6] = i[6] * s, t[7] = 0, t[8] = i[8] * o, t[9] = i[9] * o, t[10] = i[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
  }
  makeRotationFromEuler(e) {
    e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");
    const t = this.elements, i = e.x, r = e.y, s = e.z, o = Math.cos(i), a = Math.sin(i), c = Math.cos(r), l = Math.sin(r), d = Math.cos(s), h = Math.sin(s);
    if (e.order === "XYZ") {
      const f = o * d, g = o * h, p = a * d, u = a * h;
      t[0] = c * d, t[4] = -c * h, t[8] = l, t[1] = g + p * l, t[5] = f - u * l, t[9] = -a * c, t[2] = u - f * l, t[6] = p + g * l, t[10] = o * c;
    } else if (e.order === "YXZ") {
      const f = c * d, g = c * h, p = l * d, u = l * h;
      t[0] = f + u * a, t[4] = p * a - g, t[8] = o * l, t[1] = o * h, t[5] = o * d, t[9] = -a, t[2] = g * a - p, t[6] = u + f * a, t[10] = o * c;
    } else if (e.order === "ZXY") {
      const f = c * d, g = c * h, p = l * d, u = l * h;
      t[0] = f - u * a, t[4] = -o * h, t[8] = p + g * a, t[1] = g + p * a, t[5] = o * d, t[9] = u - f * a, t[2] = -o * l, t[6] = a, t[10] = o * c;
    } else if (e.order === "ZYX") {
      const f = o * d, g = o * h, p = a * d, u = a * h;
      t[0] = c * d, t[4] = p * l - g, t[8] = f * l + u, t[1] = c * h, t[5] = u * l + f, t[9] = g * l - p, t[2] = -l, t[6] = a * c, t[10] = o * c;
    } else if (e.order === "YZX") {
      const f = o * c, g = o * l, p = a * c, u = a * l;
      t[0] = c * d, t[4] = u - f * h, t[8] = p * h + g, t[1] = h, t[5] = o * d, t[9] = -a * d, t[2] = -l * d, t[6] = g * h + p, t[10] = f - u * h;
    } else if (e.order === "XZY") {
      const f = o * c, g = o * l, p = a * c, u = a * l;
      t[0] = c * d, t[4] = -h, t[8] = l * d, t[1] = f * h + u, t[5] = o * d, t[9] = g * h - p, t[2] = p * h - g, t[6] = a * d, t[10] = u * h + f;
    }
    return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
  }
  makeRotationFromQuaternion(e) {
    return this.compose(yF, e, bF);
  }
  lookAt(e, t, i) {
    const r = this.elements;
    return Bn.subVectors(e, t), Bn.lengthSq() === 0 && (Bn.z = 1), Bn.normalize(), xr.crossVectors(i, Bn), xr.lengthSq() === 0 && (Math.abs(i.z) === 1 ? Bn.x += 1e-4 : Bn.z += 1e-4, Bn.normalize(), xr.crossVectors(i, Bn)), xr.normalize(), Ul.crossVectors(Bn, xr), r[0] = xr.x, r[4] = Ul.x, r[8] = Bn.x, r[1] = xr.y, r[5] = Ul.y, r[9] = Bn.y, r[2] = xr.z, r[6] = Ul.z, r[10] = Bn.z, this;
  }
  multiply(e, t) {
    return t !== void 0 ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e);
  }
  premultiply(e) {
    return this.multiplyMatrices(e, this);
  }
  multiplyMatrices(e, t) {
    const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[4], c = i[8], l = i[12], d = i[1], h = i[5], f = i[9], g = i[13], p = i[2], u = i[6], y = i[10], v = i[14], m = i[3], x = i[7], w = i[11], A = i[15], M = r[0], R = r[4], L = r[8], _ = r[12], F = r[1], S = r[5], T = r[9], E = r[13], C = r[2], P = r[6], b = r[10], I = r[14], D = r[3], N = r[7], U = r[11], B = r[15];
    return s[0] = o * M + a * F + c * C + l * D, s[4] = o * R + a * S + c * P + l * N, s[8] = o * L + a * T + c * b + l * U, s[12] = o * _ + a * E + c * I + l * B, s[1] = d * M + h * F + f * C + g * D, s[5] = d * R + h * S + f * P + g * N, s[9] = d * L + h * T + f * b + g * U, s[13] = d * _ + h * E + f * I + g * B, s[2] = p * M + u * F + y * C + v * D, s[6] = p * R + u * S + y * P + v * N, s[10] = p * L + u * T + y * b + v * U, s[14] = p * _ + u * E + y * I + v * B, s[3] = m * M + x * F + w * C + A * D, s[7] = m * R + x * S + w * P + A * N, s[11] = m * L + x * T + w * b + A * U, s[15] = m * _ + x * E + w * I + A * B, this;
  }
  multiplyScalar(e) {
    const t = this.elements;
    return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this;
  }
  determinant() {
    const e = this.elements, t = e[0], i = e[4], r = e[8], s = e[12], o = e[1], a = e[5], c = e[9], l = e[13], d = e[2], h = e[6], f = e[10], g = e[14], p = e[3], u = e[7], y = e[11], v = e[15];
    return p * (+s * c * h - r * l * h - s * a * f + i * l * f + r * a * g - i * c * g) + u * (+t * c * g - t * l * f + s * o * f - r * o * g + r * l * d - s * c * d) + y * (+t * l * h - t * a * g - s * o * h + i * o * g + s * a * d - i * l * d) + v * (-r * a * d - t * c * h + t * a * f + r * o * h - i * o * f + i * c * d);
  }
  transpose() {
    const e = this.elements;
    let t;
    return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this;
  }
  setPosition(e, t, i) {
    const r = this.elements;
    return e.isVector3 ? (r[12] = e.x, r[13] = e.y, r[14] = e.z) : (r[12] = e, r[13] = t, r[14] = i), this;
  }
  invert() {
    const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = e[9], f = e[10], g = e[11], p = e[12], u = e[13], y = e[14], v = e[15], m = h * y * l - u * f * l + u * c * g - a * y * g - h * c * v + a * f * v, x = p * f * l - d * y * l - p * c * g + o * y * g + d * c * v - o * f * v, w = d * u * l - p * h * l + p * a * g - o * u * g - d * a * v + o * h * v, A = p * h * c - d * u * c - p * a * f + o * u * f + d * a * y - o * h * y, M = t * m + i * x + r * w + s * A;
    if (M === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    const R = 1 / M;
    return e[0] = m * R, e[1] = (u * f * s - h * y * s - u * r * g + i * y * g + h * r * v - i * f * v) * R, e[2] = (a * y * s - u * c * s + u * r * l - i * y * l - a * r * v + i * c * v) * R, e[3] = (h * c * s - a * f * s - h * r * l + i * f * l + a * r * g - i * c * g) * R, e[4] = x * R, e[5] = (d * y * s - p * f * s + p * r * g - t * y * g - d * r * v + t * f * v) * R, e[6] = (p * c * s - o * y * s - p * r * l + t * y * l + o * r * v - t * c * v) * R, e[7] = (o * f * s - d * c * s + d * r * l - t * f * l - o * r * g + t * c * g) * R, e[8] = w * R, e[9] = (p * h * s - d * u * s - p * i * g + t * u * g + d * i * v - t * h * v) * R, e[10] = (o * u * s - p * a * s + p * i * l - t * u * l - o * i * v + t * a * v) * R, e[11] = (d * a * s - o * h * s - d * i * l + t * h * l + o * i * g - t * a * g) * R, e[12] = A * R, e[13] = (d * u * r - p * h * r + p * i * f - t * u * f - d * i * y + t * h * y) * R, e[14] = (p * a * r - o * u * r - p * i * c + t * u * c + o * i * y - t * a * y) * R, e[15] = (o * h * r - d * a * r + d * i * c - t * h * c - o * i * f + t * a * f) * R, this;
  }
  scale(e) {
    const t = this.elements, i = e.x, r = e.y, s = e.z;
    return t[0] *= i, t[4] *= r, t[8] *= s, t[1] *= i, t[5] *= r, t[9] *= s, t[2] *= i, t[6] *= r, t[10] *= s, t[3] *= i, t[7] *= r, t[11] *= s, this;
  }
  getMaxScaleOnAxis() {
    const e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], i = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], r = e[8] * e[8] + e[9] * e[9] + e[10] * e[10];
    return Math.sqrt(Math.max(t, i, r));
  }
  makeTranslation(e, t, i) {
    return this.set(
      1,
      0,
      0,
      e,
      0,
      1,
      0,
      t,
      0,
      0,
      1,
      i,
      0,
      0,
      0,
      1
    ), this;
  }
  makeRotationX(e) {
    const t = Math.cos(e), i = Math.sin(e);
    return this.set(
      1,
      0,
      0,
      0,
      0,
      t,
      -i,
      0,
      0,
      i,
      t,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  makeRotationY(e) {
    const t = Math.cos(e), i = Math.sin(e);
    return this.set(
      t,
      0,
      i,
      0,
      0,
      1,
      0,
      0,
      -i,
      0,
      t,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  makeRotationZ(e) {
    const t = Math.cos(e), i = Math.sin(e);
    return this.set(
      t,
      -i,
      0,
      0,
      i,
      t,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  makeRotationAxis(e, t) {
    const i = Math.cos(t), r = Math.sin(t), s = 1 - i, o = e.x, a = e.y, c = e.z, l = s * o, d = s * a;
    return this.set(
      l * o + i,
      l * a - r * c,
      l * c + r * a,
      0,
      l * a + r * c,
      d * a + i,
      d * c - r * o,
      0,
      l * c - r * a,
      d * c + r * o,
      s * c * c + i,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  makeScale(e, t, i) {
    return this.set(
      e,
      0,
      0,
      0,
      0,
      t,
      0,
      0,
      0,
      0,
      i,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  makeShear(e, t, i, r, s, o) {
    return this.set(
      1,
      i,
      s,
      0,
      e,
      1,
      o,
      0,
      t,
      r,
      1,
      0,
      0,
      0,
      0,
      1
    ), this;
  }
  compose(e, t, i) {
    const r = this.elements, s = t._x, o = t._y, a = t._z, c = t._w, l = s + s, d = o + o, h = a + a, f = s * l, g = s * d, p = s * h, u = o * d, y = o * h, v = a * h, m = c * l, x = c * d, w = c * h, A = i.x, M = i.y, R = i.z;
    return r[0] = (1 - (u + v)) * A, r[1] = (g + w) * A, r[2] = (p - x) * A, r[3] = 0, r[4] = (g - w) * M, r[5] = (1 - (f + v)) * M, r[6] = (y + m) * M, r[7] = 0, r[8] = (p + x) * R, r[9] = (y - m) * R, r[10] = (1 - (f + u)) * R, r[11] = 0, r[12] = e.x, r[13] = e.y, r[14] = e.z, r[15] = 1, this;
  }
  decompose(e, t, i) {
    const r = this.elements;
    let s = Ys.set(r[0], r[1], r[2]).length();
    const o = Ys.set(r[4], r[5], r[6]).length(), a = Ys.set(r[8], r[9], r[10]).length();
    this.determinant() < 0 && (s = -s), e.x = r[12], e.y = r[13], e.z = r[14], ri.copy(this);
    const l = 1 / s, d = 1 / o, h = 1 / a;
    return ri.elements[0] *= l, ri.elements[1] *= l, ri.elements[2] *= l, ri.elements[4] *= d, ri.elements[5] *= d, ri.elements[6] *= d, ri.elements[8] *= h, ri.elements[9] *= h, ri.elements[10] *= h, t.setFromRotationMatrix(ri), i.x = s, i.y = o, i.z = a, this;
  }
  makePerspective(e, t, i, r, s, o) {
    o === void 0 && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");
    const a = this.elements, c = 2 * s / (t - e), l = 2 * s / (i - r), d = (t + e) / (t - e), h = (i + r) / (i - r), f = -(o + s) / (o - s), g = -2 * o * s / (o - s);
    return a[0] = c, a[4] = 0, a[8] = d, a[12] = 0, a[1] = 0, a[5] = l, a[9] = h, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = f, a[14] = g, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this;
  }
  makeOrthographic(e, t, i, r, s, o) {
    const a = this.elements, c = 1 / (t - e), l = 1 / (i - r), d = 1 / (o - s), h = (t + e) * c, f = (i + r) * l, g = (o + s) * d;
    return a[0] = 2 * c, a[4] = 0, a[8] = 0, a[12] = -h, a[1] = 0, a[5] = 2 * l, a[9] = 0, a[13] = -f, a[2] = 0, a[6] = 0, a[10] = -2 * d, a[14] = -g, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this;
  }
  equals(e) {
    const t = this.elements, i = e.elements;
    for (let r = 0; r < 16; r++)
      if (t[r] !== i[r]) return !1;
    return !0;
  }
  fromArray(e, t = 0) {
    for (let i = 0; i < 16; i++)
      this.elements[i] = e[i + t];
    return this;
  }
  toArray(e = [], t = 0) {
    const i = this.elements;
    return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e[t + 9] = i[9], e[t + 10] = i[10], e[t + 11] = i[11], e[t + 12] = i[12], e[t + 13] = i[13], e[t + 14] = i[14], e[t + 15] = i[15], e;
  }
}
Xe.prototype.isMatrix4 = !0;
const Ys = /* @__PURE__ */ new Q(), ri = /* @__PURE__ */ new Xe(), yF = /* @__PURE__ */ new Q(0, 0, 0), bF = /* @__PURE__ */ new Q(1, 1, 1), xr = /* @__PURE__ */ new Q(), Ul = /* @__PURE__ */ new Q(), Bn = /* @__PURE__ */ new Q(), Xm = /* @__PURE__ */ new Xe(), Ym = /* @__PURE__ */ new bn();
class Us {
  constructor(e = 0, t = 0, i = 0, r = Us.DefaultOrder) {
    this._x = e, this._y = t, this._z = i, this._order = r;
  }
  get x() {
    return this._x;
  }
  set x(e) {
    this._x = e, this._onChangeCallback();
  }
  get y() {
    return this._y;
  }
  set y(e) {
    this._y = e, this._onChangeCallback();
  }
  get z() {
    return this._z;
  }
  set z(e) {
    this._z = e, this._onChangeCallback();
  }
  get order() {
    return this._order;
  }
  set order(e) {
    this._order = e, this._onChangeCallback();
  }
  set(e, t, i, r = this._order) {
    return this._x = e, this._y = t, this._z = i, this._order = r, this._onChangeCallback(), this;
  }
  clone() {
    return new this.constructor(this._x, this._y, this._z, this._order);
  }
  copy(e) {
    return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this;
  }
  setFromRotationMatrix(e, t = this._order, i = !0) {
    const r = e.elements, s = r[0], o = r[4], a = r[8], c = r[1], l = r[5], d = r[9], h = r[2], f = r[6], g = r[10];
    switch (t) {
      case "XYZ":
        this._y = Math.asin(gn(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-d, g), this._z = Math.atan2(-o, s)) : (this._x = Math.atan2(f, l), this._z = 0);
        break;
      case "YXZ":
        this._x = Math.asin(-gn(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(a, g), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-h, s), this._z = 0);
        break;
      case "ZXY":
        this._x = Math.asin(gn(f, -1, 1)), Math.abs(f) < 0.9999999 ? (this._y = Math.atan2(-h, g), this._z = Math.atan2(-o, l)) : (this._y = 0, this._z = Math.atan2(c, s));
        break;
      case "ZYX":
        this._y = Math.asin(-gn(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(f, g), this._z = Math.atan2(c, s)) : (this._x = 0, this._z = Math.atan2(-o, l));
        break;
      case "YZX":
        this._z = Math.asin(gn(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-d, l), this._y = Math.atan2(-h, s)) : (this._x = 0, this._y = Math.atan2(a, g));
        break;
      case "XZY":
        this._z = Math.asin(-gn(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(f, l), this._y = Math.atan2(a, s)) : (this._x = Math.atan2(-d, g), this._y = 0);
        break;
      default:
        console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t);
    }
    return this._order = t, i === !0 && this._onChangeCallback(), this;
  }
  setFromQuaternion(e, t, i) {
    return Xm.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Xm, t, i);
  }
  setFromVector3(e, t = this._order) {
    return this.set(e.x, e.y, e.z, t);
  }
  reorder(e) {
    return Ym.setFromEuler(this), this.setFromQuaternion(Ym, e);
  }
  equals(e) {
    return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order;
  }
  fromArray(e) {
    return this._x = e[0], this._y = e[1], this._z = e[2], e[3] !== void 0 && (this._order = e[3]), this._onChangeCallback(), this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e;
  }
  toVector3(e) {
    return e ? e.set(this._x, this._y, this._z) : new Q(this._x, this._y, this._z);
  }
  _onChange(e) {
    return this._onChangeCallback = e, this;
  }
  _onChangeCallback() {
  }
}
Us.prototype.isEuler = !0;
Us.DefaultOrder = "XYZ";
Us.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
class Cf {
  constructor() {
    this.mask = 1;
  }
  set(e) {
    this.mask = 1 << e | 0;
  }
  enable(e) {
    this.mask |= 1 << e | 0;
  }
  enableAll() {
    this.mask = -1;
  }
  toggle(e) {
    this.mask ^= 1 << e | 0;
  }
  disable(e) {
    this.mask &= ~(1 << e | 0);
  }
  disableAll() {
    this.mask = 0;
  }
  test(e) {
    return (this.mask & e.mask) !== 0;
  }
}
let xF = 0;
const Jm = /* @__PURE__ */ new Q(), Js = /* @__PURE__ */ new bn(), $i = /* @__PURE__ */ new Xe(), zl = /* @__PURE__ */ new Q(), fa = /* @__PURE__ */ new Q(), MF = /* @__PURE__ */ new Q(), wF = /* @__PURE__ */ new bn(), Km = /* @__PURE__ */ new Q(1, 0, 0), qm = /* @__PURE__ */ new Q(0, 1, 0), Qm = /* @__PURE__ */ new Q(0, 0, 1), AF = { type: "added" }, eg = { type: "removed" };
class ut extends Kr {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: xF++ }), this.uuid = Wn(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = ut.DefaultUp.clone();
    const e = new Q(), t = new Us(), i = new bn(), r = new Q(1, 1, 1);
    function s() {
      i.setFromEuler(t, !1);
    }
    function o() {
      t.setFromQuaternion(i, void 0, !1);
    }
    t._onChange(s), i._onChange(o), Object.defineProperties(this, {
      position: {
        configurable: !0,
        enumerable: !0,
        value: e
      },
      rotation: {
        configurable: !0,
        enumerable: !0,
        value: t
      },
      quaternion: {
        configurable: !0,
        enumerable: !0,
        value: i
      },
      scale: {
        configurable: !0,
        enumerable: !0,
        value: r
      },
      modelViewMatrix: {
        value: new Xe()
      },
      normalMatrix: {
        value: new rn()
      }
    }), this.matrix = new Xe(), this.matrixWorld = new Xe(), this.matrixAutoUpdate = ut.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new Cf(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {};
  }
  onBeforeRender() {
  }
  onAfterRender() {
  }
  applyMatrix4(e) {
    this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale);
  }
  applyQuaternion(e) {
    return this.quaternion.premultiply(e), this;
  }
  setRotationFromAxisAngle(e, t) {
    this.quaternion.setFromAxisAngle(e, t);
  }
  setRotationFromEuler(e) {
    this.quaternion.setFromEuler(e, !0);
  }
  setRotationFromMatrix(e) {
    this.quaternion.setFromRotationMatrix(e);
  }
  setRotationFromQuaternion(e) {
    this.quaternion.copy(e);
  }
  rotateOnAxis(e, t) {
    return Js.setFromAxisAngle(e, t), this.quaternion.multiply(Js), this;
  }
  rotateOnWorldAxis(e, t) {
    return Js.setFromAxisAngle(e, t), this.quaternion.premultiply(Js), this;
  }
  rotateX(e) {
    return this.rotateOnAxis(Km, e);
  }
  rotateY(e) {
    return this.rotateOnAxis(qm, e);
  }
  rotateZ(e) {
    return this.rotateOnAxis(Qm, e);
  }
  translateOnAxis(e, t) {
    return Jm.copy(e).applyQuaternion(this.quaternion), this.position.add(Jm.multiplyScalar(t)), this;
  }
  translateX(e) {
    return this.translateOnAxis(Km, e);
  }
  translateY(e) {
    return this.translateOnAxis(qm, e);
  }
  translateZ(e) {
    return this.translateOnAxis(Qm, e);
  }
  localToWorld(e) {
    return e.applyMatrix4(this.matrixWorld);
  }
  worldToLocal(e) {
    return e.applyMatrix4($i.copy(this.matrixWorld).invert());
  }
  lookAt(e, t, i) {
    e.isVector3 ? zl.copy(e) : zl.set(e, t, i);
    const r = this.parent;
    this.updateWorldMatrix(!0, !1), fa.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? $i.lookAt(fa, zl, this.up) : $i.lookAt(zl, fa, this.up), this.quaternion.setFromRotationMatrix($i), r && ($i.extractRotation(r.matrixWorld), Js.setFromRotationMatrix($i), this.quaternion.premultiply(Js.invert()));
  }
  add(e) {
    if (arguments.length > 1) {
      for (let t = 0; t < arguments.length; t++)
        this.add(arguments[t]);
      return this;
    }
    return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.parent !== null && e.parent.remove(e), e.parent = this, this.children.push(e), e.dispatchEvent(AF)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this);
  }
  remove(e) {
    if (arguments.length > 1) {
      for (let i = 0; i < arguments.length; i++)
        this.remove(arguments[i]);
      return this;
    }
    const t = this.children.indexOf(e);
    return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(eg)), this;
  }
  removeFromParent() {
    const e = this.parent;
    return e !== null && e.remove(this), this;
  }
  clear() {
    for (let e = 0; e < this.children.length; e++) {
      const t = this.children[e];
      t.parent = null, t.dispatchEvent(eg);
    }
    return this.children.length = 0, this;
  }
  attach(e) {
    return this.updateWorldMatrix(!0, !1), $i.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), $i.multiply(e.parent.matrixWorld)), e.applyMatrix4($i), this.add(e), e.updateWorldMatrix(!1, !0), this;
  }
  getObjectById(e) {
    return this.getObjectByProperty("id", e);
  }
  getObjectByName(e) {
    return this.getObjectByProperty("name", e);
  }
  getObjectByProperty(e, t) {
    if (this[e] === t) return this;
    for (let i = 0, r = this.children.length; i < r; i++) {
      const o = this.children[i].getObjectByProperty(e, t);
      if (o !== void 0)
        return o;
    }
  }
  getWorldPosition(e) {
    return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld);
  }
  getWorldQuaternion(e) {
    return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(fa, e, MF), e;
  }
  getWorldScale(e) {
    return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(fa, wF, e), e;
  }
  getWorldDirection(e) {
    this.updateWorldMatrix(!0, !1);
    const t = this.matrixWorld.elements;
    return e.set(t[8], t[9], t[10]).normalize();
  }
  raycast() {
  }
  traverse(e) {
    e(this);
    const t = this.children;
    for (let i = 0, r = t.length; i < r; i++)
      t[i].traverse(e);
  }
  traverseVisible(e) {
    if (this.visible === !1) return;
    e(this);
    const t = this.children;
    for (let i = 0, r = t.length; i < r; i++)
      t[i].traverseVisible(e);
  }
  traverseAncestors(e) {
    const t = this.parent;
    t !== null && (e(t), t.traverseAncestors(e));
  }
  updateMatrix() {
    this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0;
  }
  updateMatrixWorld(e) {
    this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, e = !0);
    const t = this.children;
    for (let i = 0, r = t.length; i < r; i++)
      t[i].updateMatrixWorld(e);
  }
  updateWorldMatrix(e, t) {
    const i = this.parent;
    if (e === !0 && i !== null && i.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), t === !0) {
      const r = this.children;
      for (let s = 0, o = r.length; s < o; s++)
        r[s].updateWorldMatrix(!1, !0);
    }
  }
  toJSON(e) {
    const t = e === void 0 || typeof e == "string", i = {};
    t && (e = {
      geometries: {},
      materials: {},
      textures: {},
      images: {},
      shapes: {},
      skeletons: {},
      animations: {}
    }, i.metadata = {
      version: 4.5,
      type: "Object",
      generator: "Object3D.toJSON"
    });
    const r = {};
    r.uuid = this.uuid, r.type = this.type, this.name !== "" && (r.name = this.name), this.castShadow === !0 && (r.castShadow = !0), this.receiveShadow === !0 && (r.receiveShadow = !0), this.visible === !1 && (r.visible = !1), this.frustumCulled === !1 && (r.frustumCulled = !1), this.renderOrder !== 0 && (r.renderOrder = this.renderOrder), JSON.stringify(this.userData) !== "{}" && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), this.matrixAutoUpdate === !1 && (r.matrixAutoUpdate = !1), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON()));
    function s(a, c) {
      return a[c.uuid] === void 0 && (a[c.uuid] = c.toJSON(e)), c.uuid;
    }
    if (this.isScene)
      this.background && (this.background.isColor ? r.background = this.background.toJSON() : this.background.isTexture && (r.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && (r.environment = this.environment.toJSON(e).uuid);
    else if (this.isMesh || this.isLine || this.isPoints) {
      r.geometry = s(e.geometries, this.geometry);
      const a = this.geometry.parameters;
      if (a !== void 0 && a.shapes !== void 0) {
        const c = a.shapes;
        if (Array.isArray(c))
          for (let l = 0, d = c.length; l < d; l++) {
            const h = c[l];
            s(e.shapes, h);
          }
        else
          s(e.shapes, c);
      }
    }
    if (this.isSkinnedMesh && (r.bindMode = this.bindMode, r.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (s(e.skeletons, this.skeleton), r.skeleton = this.skeleton.uuid)), this.material !== void 0)
      if (Array.isArray(this.material)) {
        const a = [];
        for (let c = 0, l = this.material.length; c < l; c++)
          a.push(s(e.materials, this.material[c]));
        r.material = a;
      } else
        r.material = s(e.materials, this.material);
    if (this.children.length > 0) {
      r.children = [];
      for (let a = 0; a < this.children.length; a++)
        r.children.push(this.children[a].toJSON(e).object);
    }
    if (this.animations.length > 0) {
      r.animations = [];
      for (let a = 0; a < this.animations.length; a++) {
        const c = this.animations[a];
        r.animations.push(s(e.animations, c));
      }
    }
    if (t) {
      const a = o(e.geometries), c = o(e.materials), l = o(e.textures), d = o(e.images), h = o(e.shapes), f = o(e.skeletons), g = o(e.animations);
      a.length > 0 && (i.geometries = a), c.length > 0 && (i.materials = c), l.length > 0 && (i.textures = l), d.length > 0 && (i.images = d), h.length > 0 && (i.shapes = h), f.length > 0 && (i.skeletons = f), g.length > 0 && (i.animations = g);
    }
    return i.object = r, i;
    function o(a) {
      const c = [];
      for (const l in a) {
        const d = a[l];
        delete d.metadata, c.push(d);
      }
      return c;
    }
  }
  clone(e) {
    return new this.constructor().copy(this, e);
  }
  copy(e, t = !0) {
    if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0)
      for (let i = 0; i < e.children.length; i++) {
        const r = e.children[i];
        this.add(r.clone());
      }
    return this;
  }
}
ut.DefaultUp = new Q(0, 1, 0);
ut.DefaultMatrixAutoUpdate = !0;
ut.prototype.isObject3D = !0;
const si = /* @__PURE__ */ new Q(), Zi = /* @__PURE__ */ new Q(), th = /* @__PURE__ */ new Q(), Xi = /* @__PURE__ */ new Q(), Ks = /* @__PURE__ */ new Q(), qs = /* @__PURE__ */ new Q(), tg = /* @__PURE__ */ new Q(), nh = /* @__PURE__ */ new Q(), ih = /* @__PURE__ */ new Q(), rh = /* @__PURE__ */ new Q();
class Zt {
  constructor(e = new Q(), t = new Q(), i = new Q()) {
    this.a = e, this.b = t, this.c = i;
  }
  static getNormal(e, t, i, r) {
    r.subVectors(i, t), si.subVectors(e, t), r.cross(si);
    const s = r.lengthSq();
    return s > 0 ? r.multiplyScalar(1 / Math.sqrt(s)) : r.set(0, 0, 0);
  }
  // static/instance method to calculate barycentric coordinates
  // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
  static getBarycoord(e, t, i, r, s) {
    si.subVectors(r, t), Zi.subVectors(i, t), th.subVectors(e, t);
    const o = si.dot(si), a = si.dot(Zi), c = si.dot(th), l = Zi.dot(Zi), d = Zi.dot(th), h = o * l - a * a;
    if (h === 0)
      return s.set(-2, -1, -1);
    const f = 1 / h, g = (l * c - a * d) * f, p = (o * d - a * c) * f;
    return s.set(1 - g - p, p, g);
  }
  static containsPoint(e, t, i, r) {
    return this.getBarycoord(e, t, i, r, Xi), Xi.x >= 0 && Xi.y >= 0 && Xi.x + Xi.y <= 1;
  }
  static getUV(e, t, i, r, s, o, a, c) {
    return this.getBarycoord(e, t, i, r, Xi), c.set(0, 0), c.addScaledVector(s, Xi.x), c.addScaledVector(o, Xi.y), c.addScaledVector(a, Xi.z), c;
  }
  static isFrontFacing(e, t, i, r) {
    return si.subVectors(i, t), Zi.subVectors(e, t), si.cross(Zi).dot(r) < 0;
  }
  set(e, t, i) {
    return this.a.copy(e), this.b.copy(t), this.c.copy(i), this;
  }
  setFromPointsAndIndices(e, t, i, r) {
    return this.a.copy(e[t]), this.b.copy(e[i]), this.c.copy(e[r]), this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this;
  }
  getArea() {
    return si.subVectors(this.c, this.b), Zi.subVectors(this.a, this.b), si.cross(Zi).length() * 0.5;
  }
  getMidpoint(e) {
    return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
  }
  getNormal(e) {
    return Zt.getNormal(this.a, this.b, this.c, e);
  }
  getPlane(e) {
    return e.setFromCoplanarPoints(this.a, this.b, this.c);
  }
  getBarycoord(e, t) {
    return Zt.getBarycoord(e, this.a, this.b, this.c, t);
  }
  getUV(e, t, i, r, s) {
    return Zt.getUV(e, this.a, this.b, this.c, t, i, r, s);
  }
  containsPoint(e) {
    return Zt.containsPoint(e, this.a, this.b, this.c);
  }
  isFrontFacing(e) {
    return Zt.isFrontFacing(this.a, this.b, this.c, e);
  }
  intersectsBox(e) {
    return e.intersectsTriangle(this);
  }
  closestPointToPoint(e, t) {
    const i = this.a, r = this.b, s = this.c;
    let o, a;
    Ks.subVectors(r, i), qs.subVectors(s, i), nh.subVectors(e, i);
    const c = Ks.dot(nh), l = qs.dot(nh);
    if (c <= 0 && l <= 0)
      return t.copy(i);
    ih.subVectors(e, r);
    const d = Ks.dot(ih), h = qs.dot(ih);
    if (d >= 0 && h <= d)
      return t.copy(r);
    const f = c * h - d * l;
    if (f <= 0 && c >= 0 && d <= 0)
      return o = c / (c - d), t.copy(i).addScaledVector(Ks, o);
    rh.subVectors(e, s);
    const g = Ks.dot(rh), p = qs.dot(rh);
    if (p >= 0 && g <= p)
      return t.copy(s);
    const u = g * l - c * p;
    if (u <= 0 && l >= 0 && p <= 0)
      return a = l / (l - p), t.copy(i).addScaledVector(qs, a);
    const y = d * p - g * h;
    if (y <= 0 && h - d >= 0 && g - p >= 0)
      return tg.subVectors(s, r), a = (h - d) / (h - d + (g - p)), t.copy(r).addScaledVector(tg, a);
    const v = 1 / (y + u + f);
    return o = u * v, a = f * v, t.copy(i).addScaledVector(Ks, o).addScaledVector(qs, a);
  }
  equals(e) {
    return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
  }
}
let SF = 0;
class tn extends Kr {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: SF++ }), this.uuid = Wn(), this.name = "", this.type = "Material", this.fog = !0, this.blending = vo, this.side = Hr, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.blendSrc = bf, this.blendDst = xf, this.blendEquation = ps, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = kc, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = Qb, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = Lc, this.stencilZFail = Lc, this.stencilZPass = Lc, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaTest = 0, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0;
  }
  onBuild() {
  }
  onBeforeCompile() {
  }
  customProgramCacheKey() {
    return this.onBeforeCompile.toString();
  }
  setValues(e) {
    if (e !== void 0)
      for (const t in e) {
        const i = e[t];
        if (i === void 0) {
          console.warn("THREE.Material: '" + t + "' parameter is undefined.");
          continue;
        }
        if (t === "shading") {
          console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = i === yf;
          continue;
        }
        const r = this[t];
        if (r === void 0) {
          console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material.");
          continue;
        }
        r && r.isColor ? r.set(i) : r && r.isVector3 && i && i.isVector3 ? r.copy(i) : this[t] = i;
      }
  }
  toJSON(e) {
    const t = e === void 0 || typeof e == "string";
    t && (e = {
      textures: {},
      images: {}
    });
    const i = {
      metadata: {
        version: 4.5,
        type: "Material",
        generator: "Material.toJSON"
      }
    };
    i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen && this.sheen.isColor && (i.sheen = this.sheen.getHex()), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (i.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(e).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(e).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(e).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(e).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(e).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== vo && (i.blending = this.blending), this.side !== Hr && (i.side = this.side), this.vertexColors && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = this.transparent), i.depthFunc = this.depthFunc, i.depthTest = this.depthTest, i.depthWrite = this.depthWrite, i.colorWrite = this.colorWrite, i.stencilWrite = this.stencilWrite, i.stencilWriteMask = this.stencilWriteMask, i.stencilFunc = this.stencilFunc, i.stencilRef = this.stencilRef, i.stencilFuncMask = this.stencilFuncMask, i.stencilFail = this.stencilFail, i.stencilZFail = this.stencilZFail, i.stencilZPass = this.stencilZPass, this.rotation && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaToCoverage === !0 && (i.alphaToCoverage = this.alphaToCoverage), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = this.premultipliedAlpha), this.wireframe === !0 && (i.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.morphTargets === !0 && (i.morphTargets = !0), this.morphNormals === !0 && (i.morphNormals = !0), this.flatShading === !0 && (i.flatShading = this.flatShading), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), JSON.stringify(this.userData) !== "{}" && (i.userData = this.userData);
    function r(s) {
      const o = [];
      for (const a in s) {
        const c = s[a];
        delete c.metadata, o.push(c);
      }
      return o;
    }
    if (t) {
      const s = r(e.textures), o = r(e.images);
      s.length > 0 && (i.textures = s), o.length > 0 && (i.images = o);
    }
    return i;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    this.name = e.name, this.fog = e.fog, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite;
    const t = e.clippingPlanes;
    let i = null;
    if (t !== null) {
      const r = t.length;
      i = new Array(r);
      for (let s = 0; s !== r; ++s)
        i[s] = t[s].clone();
    }
    return this.clippingPlanes = i, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this;
  }
  dispose() {
    this.dispatchEvent({ type: "dispose" });
  }
  set needsUpdate(e) {
    e === !0 && this.version++;
  }
}
tn.prototype.isMaterial = !0;
const ix = {
  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,
  darkgreen: 25600,
  darkgrey: 11119017,
  darkkhaki: 12433259,
  darkmagenta: 9109643,
  darkolivegreen: 5597999,
  darkorange: 16747520,
  darkorchid: 10040012,
  darkred: 9109504,
  darksalmon: 15308410,
  darkseagreen: 9419919,
  darkslateblue: 4734347,
  darkslategray: 3100495,
  darkslategrey: 3100495,
  darkturquoise: 52945,
  darkviolet: 9699539,
  deeppink: 16716947,
  deepskyblue: 49151,
  dimgray: 6908265,
  dimgrey: 6908265,
  dodgerblue: 2003199,
  firebrick: 11674146,
  floralwhite: 16775920,
  forestgreen: 2263842,
  fuchsia: 16711935,
  gainsboro: 14474460,
  ghostwhite: 16316671,
  gold: 16766720,
  goldenrod: 14329120,
  gray: 8421504,
  green: 32768,
  greenyellow: 11403055,
  grey: 8421504,
  honeydew: 15794160,
  hotpink: 16738740,
  indianred: 13458524,
  indigo: 4915330,
  ivory: 16777200,
  khaki: 15787660,
  lavender: 15132410,
  lavenderblush: 16773365,
  lawngreen: 8190976,
  lemonchiffon: 16775885,
  lightblue: 11393254,
  lightcoral: 15761536,
  lightcyan: 14745599,
  lightgoldenrodyellow: 16448210,
  lightgray: 13882323,
  lightgreen: 9498256,
  lightgrey: 13882323,
  lightpink: 16758465,
  lightsalmon: 16752762,
  lightseagreen: 2142890,
  lightskyblue: 8900346,
  lightslategray: 7833753,
  lightslategrey: 7833753,
  lightsteelblue: 11584734,
  lightyellow: 16777184,
  lime: 65280,
  limegreen: 3329330,
  linen: 16445670,
  magenta: 16711935,
  maroon: 8388608,
  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
}, oi = { h: 0, s: 0, l: 0 }, kl = { h: 0, s: 0, l: 0 };
function sh(n, e, t) {
  return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * 6 * (2 / 3 - t) : n;
}
function oh(n) {
  return n < 0.04045 ? n * 0.0773993808 : Math.pow(n * 0.9478672986 + 0.0521327014, 2.4);
}
function ah(n) {
  return n < 31308e-7 ? n * 12.92 : 1.055 * Math.pow(n, 0.41666) - 0.055;
}
class Ue {
  constructor(e, t, i) {
    return t === void 0 && i === void 0 ? this.set(e) : this.setRGB(e, t, i);
  }
  set(e) {
    return e && e.isColor ? this.copy(e) : typeof e == "number" ? this.setHex(e) : typeof e == "string" && this.setStyle(e), this;
  }
  setScalar(e) {
    return this.r = e, this.g = e, this.b = e, this;
  }
  setHex(e) {
    return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, this;
  }
  setRGB(e, t, i) {
    return this.r = e, this.g = t, this.b = i, this;
  }
  setHSL(e, t, i) {
    if (e = Tf(e, 1), t = gn(t, 0, 1), i = gn(i, 0, 1), t === 0)
      this.r = this.g = this.b = i;
    else {
      const r = i <= 0.5 ? i * (1 + t) : i + t - i * t, s = 2 * i - r;
      this.r = sh(s, r, e + 1 / 3), this.g = sh(s, r, e), this.b = sh(s, r, e - 1 / 3);
    }
    return this;
  }
  setStyle(e) {
    function t(r) {
      r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored.");
    }
    let i;
    if (i = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)) {
      let r;
      const s = i[1], o = i[2];
      switch (s) {
        case "rgb":
        case "rgba":
          if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))
            return this.r = Math.min(255, parseInt(r[1], 10)) / 255, this.g = Math.min(255, parseInt(r[2], 10)) / 255, this.b = Math.min(255, parseInt(r[3], 10)) / 255, t(r[4]), this;
          if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))
            return this.r = Math.min(100, parseInt(r[1], 10)) / 100, this.g = Math.min(100, parseInt(r[2], 10)) / 100, this.b = Math.min(100, parseInt(r[3], 10)) / 100, t(r[4]), this;
          break;
        case "hsl":
        case "hsla":
          if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) {
            const a = parseFloat(r[1]) / 360, c = parseInt(r[2], 10) / 100, l = parseInt(r[3], 10) / 100;
            return t(r[4]), this.setHSL(a, c, l);
          }
          break;
      }
    } else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) {
      const r = i[1], s = r.length;
      if (s === 3)
        return this.r = parseInt(r.charAt(0) + r.charAt(0), 16) / 255, this.g = parseInt(r.charAt(1) + r.charAt(1), 16) / 255, this.b = parseInt(r.charAt(2) + r.charAt(2), 16) / 255, this;
      if (s === 6)
        return this.r = parseInt(r.charAt(0) + r.charAt(1), 16) / 255, this.g = parseInt(r.charAt(2) + r.charAt(3), 16) / 255, this.b = parseInt(r.charAt(4) + r.charAt(5), 16) / 255, this;
    }
    return e && e.length > 0 ? this.setColorName(e) : this;
  }
  setColorName(e) {
    const t = ix[e.toLowerCase()];
    return t !== void 0 ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e), this;
  }
  clone() {
    return new this.constructor(this.r, this.g, this.b);
  }
  copy(e) {
    return this.r = e.r, this.g = e.g, this.b = e.b, this;
  }
  copyGammaToLinear(e, t = 2) {
    return this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this;
  }
  copyLinearToGamma(e, t = 2) {
    const i = t > 0 ? 1 / t : 1;
    return this.r = Math.pow(e.r, i), this.g = Math.pow(e.g, i), this.b = Math.pow(e.b, i), this;
  }
  convertGammaToLinear(e) {
    return this.copyGammaToLinear(this, e), this;
  }
  convertLinearToGamma(e) {
    return this.copyLinearToGamma(this, e), this;
  }
  copySRGBToLinear(e) {
    return this.r = oh(e.r), this.g = oh(e.g), this.b = oh(e.b), this;
  }
  copyLinearToSRGB(e) {
    return this.r = ah(e.r), this.g = ah(e.g), this.b = ah(e.b), this;
  }
  convertSRGBToLinear() {
    return this.copySRGBToLinear(this), this;
  }
  convertLinearToSRGB() {
    return this.copyLinearToSRGB(this), this;
  }
  getHex() {
    return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0;
  }
  getHexString() {
    return ("000000" + this.getHex().toString(16)).slice(-6);
  }
  getHSL(e) {
    const t = this.r, i = this.g, r = this.b, s = Math.max(t, i, r), o = Math.min(t, i, r);
    let a, c;
    const l = (o + s) / 2;
    if (o === s)
      a = 0, c = 0;
    else {
      const d = s - o;
      switch (c = l <= 0.5 ? d / (s + o) : d / (2 - s - o), s) {
        case t:
          a = (i - r) / d + (i < r ? 6 : 0);
          break;
        case i:
          a = (r - t) / d + 2;
          break;
        case r:
          a = (t - i) / d + 4;
          break;
      }
      a /= 6;
    }
    return e.h = a, e.s = c, e.l = l, e;
  }
  getStyle() {
    return "rgb(" + (this.r * 255 | 0) + "," + (this.g * 255 | 0) + "," + (this.b * 255 | 0) + ")";
  }
  offsetHSL(e, t, i) {
    return this.getHSL(oi), oi.h += e, oi.s += t, oi.l += i, this.setHSL(oi.h, oi.s, oi.l), this;
  }
  add(e) {
    return this.r += e.r, this.g += e.g, this.b += e.b, this;
  }
  addColors(e, t) {
    return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this;
  }
  addScalar(e) {
    return this.r += e, this.g += e, this.b += e, this;
  }
  sub(e) {
    return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this;
  }
  multiply(e) {
    return this.r *= e.r, this.g *= e.g, this.b *= e.b, this;
  }
  multiplyScalar(e) {
    return this.r *= e, this.g *= e, this.b *= e, this;
  }
  lerp(e, t) {
    return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this;
  }
  lerpColors(e, t, i) {
    return this.r = e.r + (t.r - e.r) * i, this.g = e.g + (t.g - e.g) * i, this.b = e.b + (t.b - e.b) * i, this;
  }
  lerpHSL(e, t) {
    this.getHSL(oi), e.getHSL(kl);
    const i = Fa(oi.h, kl.h, t), r = Fa(oi.s, kl.s, t), s = Fa(oi.l, kl.l, t);
    return this.setHSL(i, r, s), this;
  }
  equals(e) {
    return e.r === this.r && e.g === this.g && e.b === this.b;
  }
  fromArray(e, t = 0) {
    return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this;
  }
  toArray(e = [], t = 0) {
    return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e;
  }
  fromBufferAttribute(e, t) {
    return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), e.normalized === !0 && (this.r /= 255, this.g /= 255, this.b /= 255), this;
  }
  toJSON() {
    return this.getHex();
  }
}
Ue.NAMES = ix;
Ue.prototype.isColor = !0;
Ue.prototype.r = 1;
Ue.prototype.g = 1;
Ue.prototype.b = 1;
class In extends tn {
  constructor(e) {
    super(), this.type = "MeshBasicMaterial", this.color = new Ue(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this;
  }
}
In.prototype.isMeshBasicMaterial = !0;
const St = /* @__PURE__ */ new Q(), Vl = /* @__PURE__ */ new Re();
class ot {
  constructor(e, t, i) {
    if (Array.isArray(e))
      throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
    this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = i === !0, this.usage = Ro, this.updateRange = { offset: 0, count: -1 }, this.version = 0;
  }
  onUploadCallback() {
  }
  set needsUpdate(e) {
    e === !0 && this.version++;
  }
  setUsage(e) {
    return this.usage = e, this;
  }
  copy(e) {
    return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this;
  }
  copyAt(e, t, i) {
    e *= this.itemSize, i *= t.itemSize;
    for (let r = 0, s = this.itemSize; r < s; r++)
      this.array[e + r] = t.array[i + r];
    return this;
  }
  copyArray(e) {
    return this.array.set(e), this;
  }
  copyColorsArray(e) {
    const t = this.array;
    let i = 0;
    for (let r = 0, s = e.length; r < s; r++) {
      let o = e[r];
      o === void 0 && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", r), o = new Ue()), t[i++] = o.r, t[i++] = o.g, t[i++] = o.b;
    }
    return this;
  }
  copyVector2sArray(e) {
    const t = this.array;
    let i = 0;
    for (let r = 0, s = e.length; r < s; r++) {
      let o = e[r];
      o === void 0 && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", r), o = new Re()), t[i++] = o.x, t[i++] = o.y;
    }
    return this;
  }
  copyVector3sArray(e) {
    const t = this.array;
    let i = 0;
    for (let r = 0, s = e.length; r < s; r++) {
      let o = e[r];
      o === void 0 && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", r), o = new Q()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z;
    }
    return this;
  }
  copyVector4sArray(e) {
    const t = this.array;
    let i = 0;
    for (let r = 0, s = e.length; r < s; r++) {
      let o = e[r];
      o === void 0 && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", r), o = new xt()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z, t[i++] = o.w;
    }
    return this;
  }
  applyMatrix3(e) {
    if (this.itemSize === 2)
      for (let t = 0, i = this.count; t < i; t++)
        Vl.fromBufferAttribute(this, t), Vl.applyMatrix3(e), this.setXY(t, Vl.x, Vl.y);
    else if (this.itemSize === 3)
      for (let t = 0, i = this.count; t < i; t++)
        St.fromBufferAttribute(this, t), St.applyMatrix3(e), this.setXYZ(t, St.x, St.y, St.z);
    return this;
  }
  applyMatrix4(e) {
    for (let t = 0, i = this.count; t < i; t++)
      St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.applyMatrix4(e), this.setXYZ(t, St.x, St.y, St.z);
    return this;
  }
  applyNormalMatrix(e) {
    for (let t = 0, i = this.count; t < i; t++)
      St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.applyNormalMatrix(e), this.setXYZ(t, St.x, St.y, St.z);
    return this;
  }
  transformDirection(e) {
    for (let t = 0, i = this.count; t < i; t++)
      St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.transformDirection(e), this.setXYZ(t, St.x, St.y, St.z);
    return this;
  }
  set(e, t = 0) {
    return this.array.set(e, t), this;
  }
  getX(e) {
    return this.array[e * this.itemSize];
  }
  setX(e, t) {
    return this.array[e * this.itemSize] = t, this;
  }
  getY(e) {
    return this.array[e * this.itemSize + 1];
  }
  setY(e, t) {
    return this.array[e * this.itemSize + 1] = t, this;
  }
  getZ(e) {
    return this.array[e * this.itemSize + 2];
  }
  setZ(e, t) {
    return this.array[e * this.itemSize + 2] = t, this;
  }
  getW(e) {
    return this.array[e * this.itemSize + 3];
  }
  setW(e, t) {
    return this.array[e * this.itemSize + 3] = t, this;
  }
  setXY(e, t, i) {
    return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this;
  }
  setXYZ(e, t, i, r) {
    return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this;
  }
  setXYZW(e, t, i, r, s) {
    return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this.array[e + 3] = s, this;
  }
  onUpload(e) {
    return this.onUploadCallback = e, this;
  }
  clone() {
    return new this.constructor(this.array, this.itemSize).copy(this);
  }
  toJSON() {
    const e = {
      itemSize: this.itemSize,
      type: this.array.constructor.name,
      array: Array.prototype.slice.call(this.array),
      normalized: this.normalized
    };
    return this.name !== "" && (e.name = this.name), this.usage !== Ro && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e;
  }
}
ot.prototype.isBufferAttribute = !0;
class rx extends ot {
  constructor(e, t, i) {
    super(new Int8Array(e), t, i);
  }
}
class sx extends ot {
  constructor(e, t, i) {
    super(new Uint8Array(e), t, i);
  }
}
class ox extends ot {
  constructor(e, t, i) {
    super(new Uint8ClampedArray(e), t, i);
  }
}
class ax extends ot {
  constructor(e, t, i) {
    super(new Int16Array(e), t, i);
  }
}
class gu extends ot {
  constructor(e, t, i) {
    super(new Uint16Array(e), t, i);
  }
}
class lx extends ot {
  constructor(e, t, i) {
    super(new Int32Array(e), t, i);
  }
}
class vu extends ot {
  constructor(e, t, i) {
    super(new Uint32Array(e), t, i);
  }
}
class cx extends ot {
  constructor(e, t, i) {
    super(new Uint16Array(e), t, i);
  }
}
cx.prototype.isFloat16BufferAttribute = !0;
class We extends ot {
  constructor(e, t, i) {
    super(new Float32Array(e), t, i);
  }
}
class ux extends ot {
  constructor(e, t, i) {
    super(new Float64Array(e), t, i);
  }
}
function hx(n) {
  if (n.length === 0) return -1 / 0;
  let e = n[0];
  for (let t = 1, i = n.length; t < i; ++t)
    n[t] > e && (e = n[t]);
  return e;
}
const _F = {
  Int8Array,
  Uint8Array,
  Uint8ClampedArray,
  Int16Array,
  Uint16Array,
  Int32Array,
  Uint32Array,
  Float32Array,
  Float64Array
};
function mo(n, e) {
  return new _F[n](e);
}
let TF = 0;
const Yn = /* @__PURE__ */ new Xe(), lh = /* @__PURE__ */ new ut(), Qs = /* @__PURE__ */ new Q(), Un = /* @__PURE__ */ new Nn(), pa = /* @__PURE__ */ new Nn(), cn = /* @__PURE__ */ new Q();
class Ke extends Kr {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: TF++ }), this.uuid = Wn(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {};
  }
  getIndex() {
    return this.index;
  }
  setIndex(e) {
    return Array.isArray(e) ? this.index = new (hx(e) > 65535 ? vu : gu)(e, 1) : this.index = e, this;
  }
  getAttribute(e) {
    return this.attributes[e];
  }
  setAttribute(e, t) {
    return this.attributes[e] = t, this;
  }
  deleteAttribute(e) {
    return delete this.attributes[e], this;
  }
  hasAttribute(e) {
    return this.attributes[e] !== void 0;
  }
  addGroup(e, t, i = 0) {
    this.groups.push({
      start: e,
      count: t,
      materialIndex: i
    });
  }
  clearGroups() {
    this.groups = [];
  }
  setDrawRange(e, t) {
    this.drawRange.start = e, this.drawRange.count = t;
  }
  applyMatrix4(e) {
    const t = this.attributes.position;
    t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0);
    const i = this.attributes.normal;
    if (i !== void 0) {
      const s = new rn().getNormalMatrix(e);
      i.applyNormalMatrix(s), i.needsUpdate = !0;
    }
    const r = this.attributes.tangent;
    return r !== void 0 && (r.transformDirection(e), r.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
  }
  applyQuaternion(e) {
    return Yn.makeRotationFromQuaternion(e), this.applyMatrix4(Yn), this;
  }
  rotateX(e) {
    return Yn.makeRotationX(e), this.applyMatrix4(Yn), this;
  }
  rotateY(e) {
    return Yn.makeRotationY(e), this.applyMatrix4(Yn), this;
  }
  rotateZ(e) {
    return Yn.makeRotationZ(e), this.applyMatrix4(Yn), this;
  }
  translate(e, t, i) {
    return Yn.makeTranslation(e, t, i), this.applyMatrix4(Yn), this;
  }
  scale(e, t, i) {
    return Yn.makeScale(e, t, i), this.applyMatrix4(Yn), this;
  }
  lookAt(e) {
    return lh.lookAt(e), lh.updateMatrix(), this.applyMatrix4(lh.matrix), this;
  }
  center() {
    return this.computeBoundingBox(), this.boundingBox.getCenter(Qs).negate(), this.translate(Qs.x, Qs.y, Qs.z), this;
  }
  setFromPoints(e) {
    const t = [];
    for (let i = 0, r = e.length; i < r; i++) {
      const s = e[i];
      t.push(s.x, s.y, s.z || 0);
    }
    return this.setAttribute("position", new We(t, 3)), this;
  }
  computeBoundingBox() {
    this.boundingBox === null && (this.boundingBox = new Nn());
    const e = this.attributes.position, t = this.morphAttributes.position;
    if (e && e.isGLBufferAttribute) {
      console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingBox.set(
        new Q(-1 / 0, -1 / 0, -1 / 0),
        new Q(1 / 0, 1 / 0, 1 / 0)
      );
      return;
    }
    if (e !== void 0) {
      if (this.boundingBox.setFromBufferAttribute(e), t)
        for (let i = 0, r = t.length; i < r; i++) {
          const s = t[i];
          Un.setFromBufferAttribute(s), this.morphTargetsRelative ? (cn.addVectors(this.boundingBox.min, Un.min), this.boundingBox.expandByPoint(cn), cn.addVectors(this.boundingBox.max, Un.max), this.boundingBox.expandByPoint(cn)) : (this.boundingBox.expandByPoint(Un.min), this.boundingBox.expandByPoint(Un.max));
        }
    } else
      this.boundingBox.makeEmpty();
    (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this);
  }
  computeBoundingSphere() {
    this.boundingSphere === null && (this.boundingSphere = new mr());
    const e = this.attributes.position, t = this.morphAttributes.position;
    if (e && e.isGLBufferAttribute) {
      console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingSphere.set(new Q(), 1 / 0);
      return;
    }
    if (e) {
      const i = this.boundingSphere.center;
      if (Un.setFromBufferAttribute(e), t)
        for (let s = 0, o = t.length; s < o; s++) {
          const a = t[s];
          pa.setFromBufferAttribute(a), this.morphTargetsRelative ? (cn.addVectors(Un.min, pa.min), Un.expandByPoint(cn), cn.addVectors(Un.max, pa.max), Un.expandByPoint(cn)) : (Un.expandByPoint(pa.min), Un.expandByPoint(pa.max));
        }
      Un.getCenter(i);
      let r = 0;
      for (let s = 0, o = e.count; s < o; s++)
        cn.fromBufferAttribute(e, s), r = Math.max(r, i.distanceToSquared(cn));
      if (t)
        for (let s = 0, o = t.length; s < o; s++) {
          const a = t[s], c = this.morphTargetsRelative;
          for (let l = 0, d = a.count; l < d; l++)
            cn.fromBufferAttribute(a, l), c && (Qs.fromBufferAttribute(e, l), cn.add(Qs)), r = Math.max(r, i.distanceToSquared(cn));
        }
      this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this);
    }
  }
  computeFaceNormals() {
  }
  computeTangents() {
    const e = this.index, t = this.attributes;
    if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) {
      console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");
      return;
    }
    const i = e.array, r = t.position.array, s = t.normal.array, o = t.uv.array, a = r.length / 3;
    t.tangent === void 0 && this.setAttribute("tangent", new ot(new Float32Array(4 * a), 4));
    const c = t.tangent.array, l = [], d = [];
    for (let F = 0; F < a; F++)
      l[F] = new Q(), d[F] = new Q();
    const h = new Q(), f = new Q(), g = new Q(), p = new Re(), u = new Re(), y = new Re(), v = new Q(), m = new Q();
    function x(F, S, T) {
      h.fromArray(r, F * 3), f.fromArray(r, S * 3), g.fromArray(r, T * 3), p.fromArray(o, F * 2), u.fromArray(o, S * 2), y.fromArray(o, T * 2), f.sub(h), g.sub(h), u.sub(p), y.sub(p);
      const E = 1 / (u.x * y.y - y.x * u.y);
      isFinite(E) && (v.copy(f).multiplyScalar(y.y).addScaledVector(g, -u.y).multiplyScalar(E), m.copy(g).multiplyScalar(u.x).addScaledVector(f, -y.x).multiplyScalar(E), l[F].add(v), l[S].add(v), l[T].add(v), d[F].add(m), d[S].add(m), d[T].add(m));
    }
    let w = this.groups;
    w.length === 0 && (w = [{
      start: 0,
      count: i.length
    }]);
    for (let F = 0, S = w.length; F < S; ++F) {
      const T = w[F], E = T.start, C = T.count;
      for (let P = E, b = E + C; P < b; P += 3)
        x(
          i[P + 0],
          i[P + 1],
          i[P + 2]
        );
    }
    const A = new Q(), M = new Q(), R = new Q(), L = new Q();
    function _(F) {
      R.fromArray(s, F * 3), L.copy(R);
      const S = l[F];
      A.copy(S), A.sub(R.multiplyScalar(R.dot(S))).normalize(), M.crossVectors(L, S);
      const E = M.dot(d[F]) < 0 ? -1 : 1;
      c[F * 4] = A.x, c[F * 4 + 1] = A.y, c[F * 4 + 2] = A.z, c[F * 4 + 3] = E;
    }
    for (let F = 0, S = w.length; F < S; ++F) {
      const T = w[F], E = T.start, C = T.count;
      for (let P = E, b = E + C; P < b; P += 3)
        _(i[P + 0]), _(i[P + 1]), _(i[P + 2]);
    }
  }
  computeVertexNormals() {
    const e = this.index, t = this.getAttribute("position");
    if (t !== void 0) {
      let i = this.getAttribute("normal");
      if (i === void 0)
        i = new ot(new Float32Array(t.count * 3), 3), this.setAttribute("normal", i);
      else
        for (let f = 0, g = i.count; f < g; f++)
          i.setXYZ(f, 0, 0, 0);
      const r = new Q(), s = new Q(), o = new Q(), a = new Q(), c = new Q(), l = new Q(), d = new Q(), h = new Q();
      if (e)
        for (let f = 0, g = e.count; f < g; f += 3) {
          const p = e.getX(f + 0), u = e.getX(f + 1), y = e.getX(f + 2);
          r.fromBufferAttribute(t, p), s.fromBufferAttribute(t, u), o.fromBufferAttribute(t, y), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), a.fromBufferAttribute(i, p), c.fromBufferAttribute(i, u), l.fromBufferAttribute(i, y), a.add(d), c.add(d), l.add(d), i.setXYZ(p, a.x, a.y, a.z), i.setXYZ(u, c.x, c.y, c.z), i.setXYZ(y, l.x, l.y, l.z);
        }
      else
        for (let f = 0, g = t.count; f < g; f += 3)
          r.fromBufferAttribute(t, f + 0), s.fromBufferAttribute(t, f + 1), o.fromBufferAttribute(t, f + 2), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), i.setXYZ(f + 0, d.x, d.y, d.z), i.setXYZ(f + 1, d.x, d.y, d.z), i.setXYZ(f + 2, d.x, d.y, d.z);
      this.normalizeNormals(), i.needsUpdate = !0;
    }
  }
  merge(e, t) {
    if (!(e && e.isBufferGeometry)) {
      console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e);
      return;
    }
    t === void 0 && (t = 0, console.warn(
      "THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."
    ));
    const i = this.attributes;
    for (const r in i) {
      if (e.attributes[r] === void 0) continue;
      const o = i[r].array, a = e.attributes[r], c = a.array, l = a.itemSize * t, d = Math.min(c.length, o.length - l);
      for (let h = 0, f = l; h < d; h++, f++)
        o[f] = c[h];
    }
    return this;
  }
  normalizeNormals() {
    const e = this.attributes.normal;
    for (let t = 0, i = e.count; t < i; t++)
      cn.fromBufferAttribute(e, t), cn.normalize(), e.setXYZ(t, cn.x, cn.y, cn.z);
  }
  toNonIndexed() {
    function e(a, c) {
      const l = a.array, d = a.itemSize, h = a.normalized, f = new l.constructor(c.length * d);
      let g = 0, p = 0;
      for (let u = 0, y = c.length; u < y; u++) {
        a.isInterleavedBufferAttribute ? g = c[u] * a.data.stride + a.offset : g = c[u] * d;
        for (let v = 0; v < d; v++)
          f[p++] = l[g++];
      }
      return new ot(f, d, h);
    }
    if (this.index === null)
      return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
    const t = new Ke(), i = this.index.array, r = this.attributes;
    for (const a in r) {
      const c = r[a], l = e(c, i);
      t.setAttribute(a, l);
    }
    const s = this.morphAttributes;
    for (const a in s) {
      const c = [], l = s[a];
      for (let d = 0, h = l.length; d < h; d++) {
        const f = l[d], g = e(f, i);
        c.push(g);
      }
      t.morphAttributes[a] = c;
    }
    t.morphTargetsRelative = this.morphTargetsRelative;
    const o = this.groups;
    for (let a = 0, c = o.length; a < c; a++) {
      const l = o[a];
      t.addGroup(l.start, l.count, l.materialIndex);
    }
    return t;
  }
  toJSON() {
    const e = {
      metadata: {
        version: 4.5,
        type: "BufferGeometry",
        generator: "BufferGeometry.toJSON"
      }
    };
    if (e.uuid = this.uuid, e.type = this.type, this.name !== "" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0) {
      const c = this.parameters;
      for (const l in c)
        c[l] !== void 0 && (e[l] = c[l]);
      return e;
    }
    e.data = { attributes: {} };
    const t = this.index;
    t !== null && (e.data.index = {
      type: t.array.constructor.name,
      array: Array.prototype.slice.call(t.array)
    });
    const i = this.attributes;
    for (const c in i) {
      const l = i[c];
      e.data.attributes[c] = l.toJSON(e.data);
    }
    const r = {};
    let s = !1;
    for (const c in this.morphAttributes) {
      const l = this.morphAttributes[c], d = [];
      for (let h = 0, f = l.length; h < f; h++) {
        const g = l[h];
        d.push(g.toJSON(e.data));
      }
      d.length > 0 && (r[c] = d, s = !0);
    }
    s && (e.data.morphAttributes = r, e.data.morphTargetsRelative = this.morphTargetsRelative);
    const o = this.groups;
    o.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(o)));
    const a = this.boundingSphere;
    return a !== null && (e.data.boundingSphere = {
      center: a.center.toArray(),
      radius: a.radius
    }), e;
  }
  clone() {
    return new Ke().copy(this);
  }
  copy(e) {
    this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null;
    const t = {};
    this.name = e.name;
    const i = e.index;
    i !== null && this.setIndex(i.clone(t));
    const r = e.attributes;
    for (const l in r) {
      const d = r[l];
      this.setAttribute(l, d.clone(t));
    }
    const s = e.morphAttributes;
    for (const l in s) {
      const d = [], h = s[l];
      for (let f = 0, g = h.length; f < g; f++)
        d.push(h[f].clone(t));
      this.morphAttributes[l] = d;
    }
    this.morphTargetsRelative = e.morphTargetsRelative;
    const o = e.groups;
    for (let l = 0, d = o.length; l < d; l++) {
      const h = o[l];
      this.addGroup(h.start, h.count, h.materialIndex);
    }
    const a = e.boundingBox;
    a !== null && (this.boundingBox = a.clone());
    const c = e.boundingSphere;
    return c !== null && (this.boundingSphere = c.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this;
  }
  dispose() {
    this.dispatchEvent({ type: "dispose" });
  }
}
Ke.prototype.isBufferGeometry = !0;
const ng = /* @__PURE__ */ new Xe(), eo = /* @__PURE__ */ new qr(), ch = /* @__PURE__ */ new mr(), Mr = /* @__PURE__ */ new Q(), wr = /* @__PURE__ */ new Q(), Ar = /* @__PURE__ */ new Q(), uh = /* @__PURE__ */ new Q(), hh = /* @__PURE__ */ new Q(), dh = /* @__PURE__ */ new Q(), Gl = /* @__PURE__ */ new Q(), Hl = /* @__PURE__ */ new Q(), Wl = /* @__PURE__ */ new Q(), jl = /* @__PURE__ */ new Re(), $l = /* @__PURE__ */ new Re(), Zl = /* @__PURE__ */ new Re(), fh = /* @__PURE__ */ new Q(), Xl = /* @__PURE__ */ new Q();
class Xt extends ut {
  constructor(e = new Ke(), t = new In()) {
    super(), this.type = "Mesh", this.geometry = e, this.material = t, this.updateMorphTargets();
  }
  copy(e) {
    return super.copy(e), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = e.material, this.geometry = e.geometry, this;
  }
  updateMorphTargets() {
    const e = this.geometry;
    if (e.isBufferGeometry) {
      const t = e.morphAttributes, i = Object.keys(t);
      if (i.length > 0) {
        const r = t[i[0]];
        if (r !== void 0) {
          this.morphTargetInfluences = [], this.morphTargetDictionary = {};
          for (let s = 0, o = r.length; s < o; s++) {
            const a = r[s].name || String(s);
            this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s;
          }
        }
      }
    } else {
      const t = e.morphTargets;
      t !== void 0 && t.length > 0 && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
    }
  }
  raycast(e, t) {
    const i = this.geometry, r = this.material, s = this.matrixWorld;
    if (r === void 0 || (i.boundingSphere === null && i.computeBoundingSphere(), ch.copy(i.boundingSphere), ch.applyMatrix4(s), e.ray.intersectsSphere(ch) === !1) || (ng.copy(s).invert(), eo.copy(e.ray).applyMatrix4(ng), i.boundingBox !== null && eo.intersectsBox(i.boundingBox) === !1))
      return;
    let o;
    if (i.isBufferGeometry) {
      const a = i.index, c = i.attributes.position, l = i.morphAttributes.position, d = i.morphTargetsRelative, h = i.attributes.uv, f = i.attributes.uv2, g = i.groups, p = i.drawRange;
      if (a !== null)
        if (Array.isArray(r))
          for (let u = 0, y = g.length; u < y; u++) {
            const v = g[u], m = r[v.materialIndex], x = Math.max(v.start, p.start), w = Math.min(v.start + v.count, p.start + p.count);
            for (let A = x, M = w; A < M; A += 3) {
              const R = a.getX(A), L = a.getX(A + 1), _ = a.getX(A + 2);
              o = Yl(this, m, e, eo, c, l, d, h, f, R, L, _), o && (o.faceIndex = Math.floor(A / 3), o.face.materialIndex = v.materialIndex, t.push(o));
            }
          }
        else {
          const u = Math.max(0, p.start), y = Math.min(a.count, p.start + p.count);
          for (let v = u, m = y; v < m; v += 3) {
            const x = a.getX(v), w = a.getX(v + 1), A = a.getX(v + 2);
            o = Yl(this, r, e, eo, c, l, d, h, f, x, w, A), o && (o.faceIndex = Math.floor(v / 3), t.push(o));
          }
        }
      else if (c !== void 0)
        if (Array.isArray(r))
          for (let u = 0, y = g.length; u < y; u++) {
            const v = g[u], m = r[v.materialIndex], x = Math.max(v.start, p.start), w = Math.min(v.start + v.count, p.start + p.count);
            for (let A = x, M = w; A < M; A += 3) {
              const R = A, L = A + 1, _ = A + 2;
              o = Yl(this, m, e, eo, c, l, d, h, f, R, L, _), o && (o.faceIndex = Math.floor(A / 3), o.face.materialIndex = v.materialIndex, t.push(o));
            }
          }
        else {
          const u = Math.max(0, p.start), y = Math.min(c.count, p.start + p.count);
          for (let v = u, m = y; v < m; v += 3) {
            const x = v, w = v + 1, A = v + 2;
            o = Yl(this, r, e, eo, c, l, d, h, f, x, w, A), o && (o.faceIndex = Math.floor(v / 3), t.push(o));
          }
        }
    } else i.isGeometry && console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
  }
}
Xt.prototype.isMesh = !0;
function EF(n, e, t, i, r, s, o, a) {
  let c;
  if (e.side === jt ? c = i.intersectTriangle(o, s, r, !0, a) : c = i.intersectTriangle(r, s, o, e.side !== Wr, a), c === null) return null;
  Xl.copy(a), Xl.applyMatrix4(n.matrixWorld);
  const l = t.ray.origin.distanceTo(Xl);
  return l < t.near || l > t.far ? null : {
    distance: l,
    point: Xl.clone(),
    object: n
  };
}
function Yl(n, e, t, i, r, s, o, a, c, l, d, h) {
  Mr.fromBufferAttribute(r, l), wr.fromBufferAttribute(r, d), Ar.fromBufferAttribute(r, h);
  const f = n.morphTargetInfluences;
  if (e.morphTargets && s && f) {
    Gl.set(0, 0, 0), Hl.set(0, 0, 0), Wl.set(0, 0, 0);
    for (let p = 0, u = s.length; p < u; p++) {
      const y = f[p], v = s[p];
      y !== 0 && (uh.fromBufferAttribute(v, l), hh.fromBufferAttribute(v, d), dh.fromBufferAttribute(v, h), o ? (Gl.addScaledVector(uh, y), Hl.addScaledVector(hh, y), Wl.addScaledVector(dh, y)) : (Gl.addScaledVector(uh.sub(Mr), y), Hl.addScaledVector(hh.sub(wr), y), Wl.addScaledVector(dh.sub(Ar), y)));
    }
    Mr.add(Gl), wr.add(Hl), Ar.add(Wl);
  }
  n.isSkinnedMesh && (n.boneTransform(l, Mr), n.boneTransform(d, wr), n.boneTransform(h, Ar));
  const g = EF(n, e, t, i, Mr, wr, Ar, fh);
  if (g) {
    a && (jl.fromBufferAttribute(a, l), $l.fromBufferAttribute(a, d), Zl.fromBufferAttribute(a, h), g.uv = Zt.getUV(fh, Mr, wr, Ar, jl, $l, Zl, new Re())), c && (jl.fromBufferAttribute(c, l), $l.fromBufferAttribute(c, d), Zl.fromBufferAttribute(c, h), g.uv2 = Zt.getUV(fh, Mr, wr, Ar, jl, $l, Zl, new Re()));
    const p = {
      a: l,
      b: d,
      c: h,
      normal: new Q(),
      materialIndex: 0
    };
    Zt.getNormal(Mr, wr, Ar, p.normal), g.face = p;
  }
  return g;
}
class or extends Ke {
  constructor(e = 1, t = 1, i = 1, r = 1, s = 1, o = 1) {
    super(), this.type = "BoxGeometry", this.parameters = {
      width: e,
      height: t,
      depth: i,
      widthSegments: r,
      heightSegments: s,
      depthSegments: o
    };
    const a = this;
    r = Math.floor(r), s = Math.floor(s), o = Math.floor(o);
    const c = [], l = [], d = [], h = [];
    let f = 0, g = 0;
    p("z", "y", "x", -1, -1, i, t, e, o, s, 0), p("z", "y", "x", 1, -1, i, t, -e, o, s, 1), p("x", "z", "y", 1, 1, e, i, t, r, o, 2), p("x", "z", "y", 1, -1, e, i, -t, r, o, 3), p("x", "y", "z", 1, -1, e, t, i, r, s, 4), p("x", "y", "z", -1, -1, e, t, -i, r, s, 5), this.setIndex(c), this.setAttribute("position", new We(l, 3)), this.setAttribute("normal", new We(d, 3)), this.setAttribute("uv", new We(h, 2));
    function p(u, y, v, m, x, w, A, M, R, L, _) {
      const F = w / R, S = A / L, T = w / 2, E = A / 2, C = M / 2, P = R + 1, b = L + 1;
      let I = 0, D = 0;
      const N = new Q();
      for (let U = 0; U < b; U++) {
        const B = U * S - E;
        for (let G = 0; G < P; G++) {
          const J = G * F - T;
          N[u] = J * m, N[y] = B * x, N[v] = C, l.push(N.x, N.y, N.z), N[u] = 0, N[y] = 0, N[v] = M > 0 ? 1 : -1, d.push(N.x, N.y, N.z), h.push(G / R), h.push(1 - U / L), I += 1;
        }
      }
      for (let U = 0; U < L; U++)
        for (let B = 0; B < R; B++) {
          const G = f + B + P * U, J = f + B + P * (U + 1), j = f + (B + 1) + P * (U + 1), te = f + (B + 1) + P * U;
          c.push(G, J, te), c.push(J, j, te), D += 6;
        }
      a.addGroup(g, D, _), g += D, f += I;
    }
  }
  static fromJSON(e) {
    return new or(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
  }
}
function Po(n) {
  const e = {};
  for (const t in n) {
    e[t] = {};
    for (const i in n[t]) {
      const r = n[t][i];
      r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? e[t][i] = r.clone() : Array.isArray(r) ? e[t][i] = r.slice() : e[t][i] = r;
    }
  }
  return e;
}
function wn(n) {
  const e = {};
  for (let t = 0; t < n.length; t++) {
    const i = Po(n[t]);
    for (const r in i)
      e[r] = i[r];
  }
  return e;
}
const dx = { clone: Po, merge: wn };
var CF = `void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`, LF = `void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;
class ar extends tn {
  constructor(e) {
    super(), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = CF, this.fragmentShader = LF, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.morphTargets = !1, this.morphNormals = !1, this.extensions = {
      derivatives: !1,
      // set to use derivatives
      fragDepth: !1,
      // set to use fragment depth values
      drawBuffers: !1,
      // set to use draw buffers
      shaderTextureLOD: !1
      // set to use shader texture LOD
    }, this.defaultAttributeValues = {
      color: [1, 1, 1],
      uv: [0, 0],
      uv2: [0, 0]
    }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && (e.attributes !== void 0 && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(e));
  }
  copy(e) {
    return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Po(e.uniforms), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.lights = e.lights, this.clipping = e.clipping, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    t.glslVersion = this.glslVersion, t.uniforms = {};
    for (const r in this.uniforms) {
      const o = this.uniforms[r].value;
      o && o.isTexture ? t.uniforms[r] = {
        type: "t",
        value: o.toJSON(e).uuid
      } : o && o.isColor ? t.uniforms[r] = {
        type: "c",
        value: o.getHex()
      } : o && o.isVector2 ? t.uniforms[r] = {
        type: "v2",
        value: o.toArray()
      } : o && o.isVector3 ? t.uniforms[r] = {
        type: "v3",
        value: o.toArray()
      } : o && o.isVector4 ? t.uniforms[r] = {
        type: "v4",
        value: o.toArray()
      } : o && o.isMatrix3 ? t.uniforms[r] = {
        type: "m3",
        value: o.toArray()
      } : o && o.isMatrix4 ? t.uniforms[r] = {
        type: "m4",
        value: o.toArray()
      } : t.uniforms[r] = {
        value: o
      };
    }
    Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader;
    const i = {};
    for (const r in this.extensions)
      this.extensions[r] === !0 && (i[r] = !0);
    return Object.keys(i).length > 0 && (t.extensions = i), t;
  }
}
ar.prototype.isShaderMaterial = !0;
class hl extends ut {
  constructor() {
    super(), this.type = "Camera", this.matrixWorldInverse = new Xe(), this.projectionMatrix = new Xe(), this.projectionMatrixInverse = new Xe();
  }
  copy(e, t) {
    return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this;
  }
  getWorldDirection(e) {
    this.updateWorldMatrix(!0, !1);
    const t = this.matrixWorld.elements;
    return e.set(-t[8], -t[9], -t[10]).normalize();
  }
  updateMatrixWorld(e) {
    super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert();
  }
  updateWorldMatrix(e, t) {
    super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert();
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
hl.prototype.isCamera = !0;
class nn extends hl {
  constructor(e = 50, t = 1, i = 0.1, r = 2e3) {
    super(), this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = i, this.far = r, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix();
  }
  copy(e, t) {
    return super.copy(e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = e.view === null ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this;
  }
  /**
   * Sets the FOV by focal length in respect to the current .filmGauge.
   *
   * The default film gauge is 35, so that the focal length can be specified for
   * a 35mm (full frame) camera.
   *
   * Values for focal length and film gauge must have the same unit.
   */
  setFocalLength(e) {
    const t = 0.5 * this.getFilmHeight() / e;
    this.fov = ja * 2 * Math.atan(t), this.updateProjectionMatrix();
  }
  /**
   * Calculates the focal length from the current .fov and .filmGauge.
   */
  getFocalLength() {
    const e = Math.tan(As * 0.5 * this.fov);
    return 0.5 * this.getFilmHeight() / e;
  }
  getEffectiveFOV() {
    return ja * 2 * Math.atan(
      Math.tan(As * 0.5 * this.fov) / this.zoom
    );
  }
  getFilmWidth() {
    return this.filmGauge * Math.min(this.aspect, 1);
  }
  getFilmHeight() {
    return this.filmGauge / Math.max(this.aspect, 1);
  }
  /**
   * Sets an offset in a larger frustum. This is useful for multi-window or
   * multi-monitor/multi-machine setups.
   *
   * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
   * the monitors are in grid like this
   *
   *   +---+---+---+
   *   | A | B | C |
   *   +---+---+---+
   *   | D | E | F |
   *   +---+---+---+
   *
   * then for each monitor you would call it like this
   *
   *   const w = 1920;
   *   const h = 1080;
   *   const fullWidth = w * 3;
   *   const fullHeight = h * 2;
   *
   *   --A--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
   *   --B--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
   *   --C--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
   *   --D--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
   *   --E--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
   *   --F--
   *   camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
   *
   *   Note there is no reason monitors have to be the same size or in a grid.
   */
  setViewOffset(e, t, i, r, s, o) {
    this.aspect = e / t, this.view === null && (this.view = {
      enabled: !0,
      fullWidth: 1,
      fullHeight: 1,
      offsetX: 0,
      offsetY: 0,
      width: 1,
      height: 1
    }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix();
  }
  clearViewOffset() {
    this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();
  }
  updateProjectionMatrix() {
    const e = this.near;
    let t = e * Math.tan(As * 0.5 * this.fov) / this.zoom, i = 2 * t, r = this.aspect * i, s = -0.5 * r;
    const o = this.view;
    if (this.view !== null && this.view.enabled) {
      const c = o.fullWidth, l = o.fullHeight;
      s += o.offsetX * r / c, t -= o.offsetY * i / l, r *= o.width / c, i *= o.height / l;
    }
    const a = this.filmOffset;
    a !== 0 && (s += e * a / this.getFilmWidth()), this.projectionMatrix.makePerspective(s, s + r, t, t - i, e, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, this.view !== null && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t;
  }
}
nn.prototype.isPerspectiveCamera = !0;
const to = 90, no = 1;
class yu extends ut {
  constructor(e, t, i) {
    if (super(), this.type = "CubeCamera", i.isWebGLCubeRenderTarget !== !0) {
      console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");
      return;
    }
    this.renderTarget = i;
    const r = new nn(to, no, e, t);
    r.layers = this.layers, r.up.set(0, -1, 0), r.lookAt(new Q(1, 0, 0)), this.add(r);
    const s = new nn(to, no, e, t);
    s.layers = this.layers, s.up.set(0, -1, 0), s.lookAt(new Q(-1, 0, 0)), this.add(s);
    const o = new nn(to, no, e, t);
    o.layers = this.layers, o.up.set(0, 0, 1), o.lookAt(new Q(0, 1, 0)), this.add(o);
    const a = new nn(to, no, e, t);
    a.layers = this.layers, a.up.set(0, 0, -1), a.lookAt(new Q(0, -1, 0)), this.add(a);
    const c = new nn(to, no, e, t);
    c.layers = this.layers, c.up.set(0, -1, 0), c.lookAt(new Q(0, 0, 1)), this.add(c);
    const l = new nn(to, no, e, t);
    l.layers = this.layers, l.up.set(0, -1, 0), l.lookAt(new Q(0, 0, -1)), this.add(l);
  }
  update(e, t) {
    this.parent === null && this.updateMatrixWorld();
    const i = this.renderTarget, [r, s, o, a, c, l] = this.children, d = e.xr.enabled, h = e.getRenderTarget();
    e.xr.enabled = !1;
    const f = i.texture.generateMipmaps;
    i.texture.generateMipmaps = !1, e.setRenderTarget(i, 0), e.render(t, r), e.setRenderTarget(i, 1), e.render(t, s), e.setRenderTarget(i, 2), e.render(t, o), e.setRenderTarget(i, 3), e.render(t, a), e.setRenderTarget(i, 4), e.render(t, c), i.texture.generateMipmaps = f, e.setRenderTarget(i, 5), e.render(t, l), e.setRenderTarget(h), e.xr.enabled = d;
  }
}
class ta extends Yt {
  constructor(e, t, i, r, s, o, a, c, l, d) {
    e = e !== void 0 ? e : [], t = t !== void 0 ? t : ll, a = a !== void 0 ? a : ir, super(e, t, i, r, s, o, a, c, l, d), this._needsFlipEnvMap = !0, this.flipY = !1;
  }
  get images() {
    return this.image;
  }
  set images(e) {
    this.image = e;
  }
}
ta.prototype.isCubeTexture = !0;
class bu extends fi {
  constructor(e, t, i) {
    Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"), t = i), super(e, e, t), t = t || {}, this.texture = new ta(void 0, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.encoding), this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : zt, this.texture._needsFlipEnvMap = !1;
  }
  fromEquirectangularTexture(e, t) {
    this.texture.type = t.type, this.texture.format = Hn, this.texture.encoding = t.encoding, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter;
    const i = {
      uniforms: {
        tEquirect: { value: null }
      },
      vertexShader: (
        /* glsl */
        `

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`
      ),
      fragmentShader: (
        /* glsl */
        `

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`
      )
    }, r = new or(5, 5, 5), s = new ar({
      name: "CubemapFromEquirect",
      uniforms: Po(i.uniforms),
      vertexShader: i.vertexShader,
      fragmentShader: i.fragmentShader,
      side: jt,
      blending: nr
    });
    s.uniforms.tEquirect.value = t;
    const o = new Xt(r, s), a = t.minFilter;
    return t.minFilter === pr && (t.minFilter = zt), new yu(1, 10, this).update(e, o), t.minFilter = a, o.geometry.dispose(), o.material.dispose(), this;
  }
  clear(e, t, i, r) {
    const s = e.getRenderTarget();
    for (let o = 0; o < 6; o++)
      e.setRenderTarget(this, o), e.clear(t, i, r);
    e.setRenderTarget(s);
  }
}
bu.prototype.isWebGLCubeRenderTarget = !0;
const ph = /* @__PURE__ */ new Q(), RF = /* @__PURE__ */ new Q(), FF = /* @__PURE__ */ new rn();
class wi {
  constructor(e = new Q(1, 0, 0), t = 0) {
    this.normal = e, this.constant = t;
  }
  set(e, t) {
    return this.normal.copy(e), this.constant = t, this;
  }
  setComponents(e, t, i, r) {
    return this.normal.set(e, t, i), this.constant = r, this;
  }
  setFromNormalAndCoplanarPoint(e, t) {
    return this.normal.copy(e), this.constant = -t.dot(this.normal), this;
  }
  setFromCoplanarPoints(e, t, i) {
    const r = ph.subVectors(i, t).cross(RF.subVectors(e, t)).normalize();
    return this.setFromNormalAndCoplanarPoint(r, e), this;
  }
  copy(e) {
    return this.normal.copy(e.normal), this.constant = e.constant, this;
  }
  normalize() {
    const e = 1 / this.normal.length();
    return this.normal.multiplyScalar(e), this.constant *= e, this;
  }
  negate() {
    return this.constant *= -1, this.normal.negate(), this;
  }
  distanceToPoint(e) {
    return this.normal.dot(e) + this.constant;
  }
  distanceToSphere(e) {
    return this.distanceToPoint(e.center) - e.radius;
  }
  projectPoint(e, t) {
    return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e);
  }
  intersectLine(e, t) {
    const i = e.delta(ph), r = this.normal.dot(i);
    if (r === 0)
      return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null;
    const s = -(e.start.dot(this.normal) + this.constant) / r;
    return s < 0 || s > 1 ? null : t.copy(i).multiplyScalar(s).add(e.start);
  }
  intersectsLine(e) {
    const t = this.distanceToPoint(e.start), i = this.distanceToPoint(e.end);
    return t < 0 && i > 0 || i < 0 && t > 0;
  }
  intersectsBox(e) {
    return e.intersectsPlane(this);
  }
  intersectsSphere(e) {
    return e.intersectsPlane(this);
  }
  coplanarPoint(e) {
    return e.copy(this.normal).multiplyScalar(-this.constant);
  }
  applyMatrix4(e, t) {
    const i = t || FF.getNormalMatrix(e), r = this.coplanarPoint(ph).applyMatrix4(e), s = this.normal.applyMatrix3(i).normalize();
    return this.constant = -r.dot(s), this;
  }
  translate(e) {
    return this.constant -= e.dot(this.normal), this;
  }
  equals(e) {
    return e.normal.equals(this.normal) && e.constant === this.constant;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
wi.prototype.isPlane = !0;
const io = /* @__PURE__ */ new mr(), Jl = /* @__PURE__ */ new Q();
class dl {
  constructor(e = new wi(), t = new wi(), i = new wi(), r = new wi(), s = new wi(), o = new wi()) {
    this.planes = [e, t, i, r, s, o];
  }
  set(e, t, i, r, s, o) {
    const a = this.planes;
    return a[0].copy(e), a[1].copy(t), a[2].copy(i), a[3].copy(r), a[4].copy(s), a[5].copy(o), this;
  }
  copy(e) {
    const t = this.planes;
    for (let i = 0; i < 6; i++)
      t[i].copy(e.planes[i]);
    return this;
  }
  setFromProjectionMatrix(e) {
    const t = this.planes, i = e.elements, r = i[0], s = i[1], o = i[2], a = i[3], c = i[4], l = i[5], d = i[6], h = i[7], f = i[8], g = i[9], p = i[10], u = i[11], y = i[12], v = i[13], m = i[14], x = i[15];
    return t[0].setComponents(a - r, h - c, u - f, x - y).normalize(), t[1].setComponents(a + r, h + c, u + f, x + y).normalize(), t[2].setComponents(a + s, h + l, u + g, x + v).normalize(), t[3].setComponents(a - s, h - l, u - g, x - v).normalize(), t[4].setComponents(a - o, h - d, u - p, x - m).normalize(), t[5].setComponents(a + o, h + d, u + p, x + m).normalize(), this;
  }
  intersectsObject(e) {
    const t = e.geometry;
    return t.boundingSphere === null && t.computeBoundingSphere(), io.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(io);
  }
  intersectsSprite(e) {
    return io.center.set(0, 0, 0), io.radius = 0.7071067811865476, io.applyMatrix4(e.matrixWorld), this.intersectsSphere(io);
  }
  intersectsSphere(e) {
    const t = this.planes, i = e.center, r = -e.radius;
    for (let s = 0; s < 6; s++)
      if (t[s].distanceToPoint(i) < r)
        return !1;
    return !0;
  }
  intersectsBox(e) {
    const t = this.planes;
    for (let i = 0; i < 6; i++) {
      const r = t[i];
      if (Jl.x = r.normal.x > 0 ? e.max.x : e.min.x, Jl.y = r.normal.y > 0 ? e.max.y : e.min.y, Jl.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(Jl) < 0)
        return !1;
    }
    return !0;
  }
  containsPoint(e) {
    const t = this.planes;
    for (let i = 0; i < 6; i++)
      if (t[i].distanceToPoint(e) < 0)
        return !1;
    return !0;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
function fx() {
  let n = null, e = !1, t = null, i = null;
  function r(s, o) {
    t(s, o), i = n.requestAnimationFrame(r);
  }
  return {
    start: function() {
      e !== !0 && t !== null && (i = n.requestAnimationFrame(r), e = !0);
    },
    stop: function() {
      n.cancelAnimationFrame(i), e = !1;
    },
    setAnimationLoop: function(s) {
      t = s;
    },
    setContext: function(s) {
      n = s;
    }
  };
}
function PF(n, e) {
  const t = e.isWebGL2, i = /* @__PURE__ */ new WeakMap();
  function r(l, d) {
    const h = l.array, f = l.usage, g = n.createBuffer();
    n.bindBuffer(d, g), n.bufferData(d, h, f), l.onUploadCallback();
    let p = 5126;
    return h instanceof Float32Array ? p = 5126 : h instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : h instanceof Uint16Array ? l.isFloat16BufferAttribute ? t ? p = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : p = 5123 : h instanceof Int16Array ? p = 5122 : h instanceof Uint32Array ? p = 5125 : h instanceof Int32Array ? p = 5124 : h instanceof Int8Array ? p = 5120 : (h instanceof Uint8Array || h instanceof Uint8ClampedArray) && (p = 5121), {
      buffer: g,
      type: p,
      bytesPerElement: h.BYTES_PER_ELEMENT,
      version: l.version
    };
  }
  function s(l, d, h) {
    const f = d.array, g = d.updateRange;
    n.bindBuffer(h, l), g.count === -1 ? n.bufferSubData(h, 0, f) : (t ? n.bufferSubData(
      h,
      g.offset * f.BYTES_PER_ELEMENT,
      f,
      g.offset,
      g.count
    ) : n.bufferSubData(
      h,
      g.offset * f.BYTES_PER_ELEMENT,
      f.subarray(g.offset, g.offset + g.count)
    ), g.count = -1);
  }
  function o(l) {
    return l.isInterleavedBufferAttribute && (l = l.data), i.get(l);
  }
  function a(l) {
    l.isInterleavedBufferAttribute && (l = l.data);
    const d = i.get(l);
    d && (n.deleteBuffer(d.buffer), i.delete(l));
  }
  function c(l, d) {
    if (l.isGLBufferAttribute) {
      const f = i.get(l);
      (!f || f.version < l.version) && i.set(l, {
        buffer: l.buffer,
        type: l.type,
        bytesPerElement: l.elementSize,
        version: l.version
      });
      return;
    }
    l.isInterleavedBufferAttribute && (l = l.data);
    const h = i.get(l);
    h === void 0 ? i.set(l, r(l, d)) : h.version < l.version && (s(h.buffer, l, d), h.version = l.version);
  }
  return {
    get: o,
    remove: a,
    update: c
  };
}
class Ls extends Ke {
  constructor(e = 1, t = 1, i = 1, r = 1) {
    super(), this.type = "PlaneGeometry", this.parameters = {
      width: e,
      height: t,
      widthSegments: i,
      heightSegments: r
    };
    const s = e / 2, o = t / 2, a = Math.floor(i), c = Math.floor(r), l = a + 1, d = c + 1, h = e / a, f = t / c, g = [], p = [], u = [], y = [];
    for (let v = 0; v < d; v++) {
      const m = v * f - o;
      for (let x = 0; x < l; x++) {
        const w = x * h - s;
        p.push(w, -m, 0), u.push(0, 0, 1), y.push(x / a), y.push(1 - v / c);
      }
    }
    for (let v = 0; v < c; v++)
      for (let m = 0; m < a; m++) {
        const x = m + l * v, w = m + l * (v + 1), A = m + 1 + l * (v + 1), M = m + 1 + l * v;
        g.push(x, w, M), g.push(w, A, M);
      }
    this.setIndex(g), this.setAttribute("position", new We(p, 3)), this.setAttribute("normal", new We(u, 3)), this.setAttribute("uv", new We(y, 2));
  }
  static fromJSON(e) {
    return new Ls(e.width, e.height, e.widthSegments, e.heightSegments);
  }
}
var IF = `#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`, OF = `#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`, DF = `#ifdef ALPHATEST
	if ( diffuseColor.a < ALPHATEST ) discard;
#endif`, NF = `#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
	#endif
#endif`, BF = `#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`, UF = "vec3 transformed = vec3( position );", zF = `vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`, kF = `vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	return vec2( -1.04, 1.04 ) * a004 + r.zw;
}
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
#else
	if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
		return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
	}
	return 1.0;
#endif
}
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 specularColor, const in float dotVH ) {
	float fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );
	return ( 1.0 - specularColor ) * fresnel + specularColor;
}
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
	float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
	vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
	return Fr * fresnel + F0;
}
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	return 1.0 / ( gl * gv );
}
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( incidentLight.direction + viewDir );
	float dotNL = saturate( dot( normal, incidentLight.direction ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
	vec3 F = F_Schlick( specularColor, dotLH );
	float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
	float D = D_GGX( alpha, dotNH );
	return F * ( G * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
	return specularColor * brdf.x + brdf.y;
}
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
	vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
	vec3 FssEss = F * brdf.x + brdf.y;
	float Ess = brdf.x + brdf.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
	float dotNH = saturate( dot( geometry.normal, halfDir ) );
	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
	vec3 F = F_Schlick( specularColor, dotLH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
}
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
	return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
}
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
	return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
}
#if defined( USE_SHEEN )
float D_Charlie(float roughness, float NoH) {
	float invAlpha = 1.0 / roughness;
	float cos2h = NoH * NoH;
	float sin2h = max(1.0 - cos2h, 0.0078125);	return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
}
float V_Neubelt(float NoV, float NoL) {
	return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
}
vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
	vec3 N = geometry.normal;
	vec3 V = geometry.viewDir;
	vec3 H = normalize( V + L );
	float dotNH = saturate( dot( N, H ) );
	return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
}
#endif`, VF = `#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vUv );
		vec2 dSTdy = dFdy( vUv );
		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
		vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`, GF = `#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#pragma unroll_loop_start
	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
		plane = clippingPlanes[ i ];
		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
	}
	#pragma unroll_loop_end
	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
		bool clipped = true;
		#pragma unroll_loop_start
		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
		}
		#pragma unroll_loop_end
		if ( clipped ) discard;
	#endif
#endif`, HF = `#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`, WF = `#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`, jF = `#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`, $F = `#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`, ZF = `#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`, XF = `#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	varying vec3 vColor;
#endif`, YF = `#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif`, JF = `#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement(a) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract(sin(sn) * c);
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
struct GeometricContext {
	vec3 position;
	vec3 normal;
	vec3 viewDir;
#ifdef CLEARCOAT
	vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
	float distance = dot( planeNormal, point - pointOnPlane );
	return - distance * planeNormal + point;
}
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
	return sign( dot( point - pointOnPlane, planeNormal ) );
}
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float linearToRelativeLuminance( const in vec3 color ) {
	vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
	return dot( weights, color.rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}`, KF = `#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_maxMipLevel 8.0
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_maxTileSize 256.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
		vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );
		vec2 f = fract( uv );
		uv += 0.5 - f;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		if ( mipInt < cubeUV_maxMipLevel ) {
			uv.y += 2.0 * cubeUV_maxTileSize;
		}
		uv.y += filterInt * 2.0 * cubeUV_minTileSize;
		uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
		uv *= texelSize;
		vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
		uv.x += texelSize;
		vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
		uv.y += texelSize;
		vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
		uv.x -= texelSize;
		vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
		vec3 tm = mix( tl, tr, f.x );
		vec3 bm = mix( bl, br, f.x );
		return mix( tm, bm, f.y );
	}
	#define r0 1.0
	#define v0 0.339
	#define m0 - 2.0
	#define r1 0.8
	#define v1 0.276
	#define m1 - 1.0
	#define r4 0.4
	#define v4 0.046
	#define m4 2.0
	#define r5 0.305
	#define v5 0.016
	#define m5 3.0
	#define r6 0.21
	#define v6 0.0038
	#define m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= r1 ) {
			mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
		} else if ( roughness >= r4 ) {
			mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
		} else if ( roughness >= r5 ) {
			mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
		} else if ( roughness >= r6 ) {
			mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`, qF = `vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
	mat3 m = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
	transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`, QF = `#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`, eP = `#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`, tP = `#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vUv );
	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`, nP = `#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`, iP = "gl_FragColor = linearToOutputTexel( gl_FragColor );", rP = `
vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
	return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
}
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
	return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
}
vec4 sRGBToLinear( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 LinearTosRGB( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 RGBEToLinear( in vec4 value ) {
	return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
}
vec4 LinearToRGBE( in vec4 value ) {
	float maxComponent = max( max( value.r, value.g ), value.b );
	float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
	return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
}
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
	return vec4( value.rgb * value.a * maxRange, 1.0 );
}
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
	float maxRGB = max( value.r, max( value.g, value.b ) );
	float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
	M = ceil( M * 255.0 ) / 255.0;
	return vec4( value.rgb / ( M * maxRange ), M );
}
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
	return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
}
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
	float maxRGB = max( value.r, max( value.g, value.b ) );
	float D = max( maxRange / maxRGB, 1.0 );
	D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
	return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
}
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
vec4 LinearToLogLuv( in vec4 value ) {
	vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
	Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
	vec4 vResult;
	vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
	float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
	vResult.w = fract( Le );
	vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
	return vResult;
}
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
vec4 LogLuvToLinear( in vec4 value ) {
	float Le = value.z * 255.0 + value.w;
	vec3 Xp_Y_XYZp;
	Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
	Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
	Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
	vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
	return vec4( max( vRGB, 0.0 ), 1.0 );
}`, sP = `#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifndef ENVMAP_TYPE_CUBE_UV
		envColor = envMapTexelToLinear( envColor );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`, oP = `#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform int maxMipLevel;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`, aP = `#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`, lP = `#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`, cP = `#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`, uP = `#ifdef USE_FOG
	fogDepth = - mvPosition.z;
#endif`, hP = `#ifdef USE_FOG
	varying float fogDepth;
#endif`, dP = `#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`, fP = `#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float fogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`, pP = `#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return texture2D( gradientMap, coord ).rgb;
	#else
		return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
	#endif
}`, mP = `#ifdef USE_LIGHTMAP
	vec4 lightMapTexel= texture2D( lightMap, vUv2 );
	reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#endif`, gP = `#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`, vP = `vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
	vLightBack = vec3( 0.0 );
	vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
#ifdef DOUBLE_SIDED
	vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
	vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
#endif
#if NUM_POINT_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_SPOT_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_DIR_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
	#pragma unroll_loop_end
#endif
#if NUM_HEMI_LIGHTS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
		vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
		#ifdef DOUBLE_SIDED
			vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
		#endif
	}
	#pragma unroll_loop_end
#endif`, yP = `uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
	vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	return irradiance;
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
		directLight.color = directionalLight.color;
		directLight.direction = directionalLight.direction;
		directLight.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
		vec3 lVector = pointLight.position - geometry.position;
		directLight.direction = normalize( lVector );
		float lightDistance = length( lVector );
		directLight.color = pointLight.color;
		directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
		directLight.visible = ( directLight.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
		vec3 lVector = spotLight.position - geometry.position;
		directLight.direction = normalize( lVector );
		float lightDistance = length( lVector );
		float angleCos = dot( directLight.direction, spotLight.direction );
		if ( angleCos > spotLight.coneCos ) {
			float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
			directLight.color = spotLight.color;
			directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
			directLight.visible = true;
		} else {
			directLight.color = vec3( 0.0 );
			directLight.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
		float dotNL = dot( geometry.normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		#ifndef PHYSICALLY_CORRECT_LIGHTS
			irradiance *= PI;
		#endif
		return irradiance;
	}
#endif`, bP = `#if defined( USE_ENVMAP )
	#ifdef ENVMAP_MODE_REFRACTION
		uniform float refractionRatio;
	#endif
	vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
		#ifdef ENVMAP_TYPE_CUBE
			vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
			#else
				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#elif defined( ENVMAP_TYPE_CUBE_UV )
			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
		#else
			vec4 envMapColor = vec4( 0.0 );
		#endif
		return PI * envMapColor.rgb * envMapIntensity;
	}
	float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
		float maxMIPLevelScalar = float( maxMIPLevel );
		float sigma = PI * roughness * roughness / ( 1.0 + roughness );
		float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
	}
	vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( -viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
		#else
			vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
		#endif
		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
		float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
		#ifdef ENVMAP_TYPE_CUBE
			vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
			#else
				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#elif defined( ENVMAP_TYPE_CUBE_UV )
			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
		#endif
		return envMapColor.rgb * envMapIntensity;
	}
#endif`, xP = `ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`, MP = `varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material )	(0)`, wP = `BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`, AP = `varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material )	(0)`, SP = `PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
material.specularRoughness = min( material.specularRoughness, 1.0 );
#ifdef REFLECTIVITY
	material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
#endif
#ifdef CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheen;
#endif`, _P = `struct PhysicalMaterial {
	vec3 diffuseColor;
	float specularRoughness;
	vec3 specularColor;
#ifdef CLEARCOAT
	float clearcoat;
	float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
	vec3 sheenColor;
#endif
};
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
	return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometry.normal;
		vec3 viewDir = geometry.viewDir;
		vec3 position = geometry.position;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.specularRoughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	#ifdef CLEARCOAT
		float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = ccDotNL * directLight.color;
		#ifndef PHYSICALLY_CORRECT_LIGHTS
			ccIrradiance *= PI;
		#endif
		float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
		reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
	#else
		float clearcoatDHR = 0.0;
	#endif
	#ifdef USE_SHEEN
		reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
			material.specularRoughness,
			directLight.direction,
			geometry,
			material.sheenColor
		);
	#else
		reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
	#endif
	reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef CLEARCOAT
		float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
		reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
		float ccDotNL = ccDotNV;
		float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
	#else
		float clearcoatDHR = 0.0;
	#endif
	float clearcoatInv = 1.0 - clearcoatDHR;
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
	vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
	reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`, TP = `
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef CLEARCOAT
	geometry.clearcoatNormal = clearcoatNormal;
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointDirectLightIrradiance( pointLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotDirectLightIrradiance( spotLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	irradiance += getLightProbeIrradiance( lightProbe, geometry );
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`, EP = `#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
		vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
		#ifndef PHYSICALLY_CORRECT_LIGHTS
			lightMapIrradiance *= PI;
		#endif
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
	#ifdef CLEARCOAT
		clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
	#endif
#endif`, CP = `#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`, LP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`, RP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`, FP = `#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		varying float vFragDepth;
		varying float vIsPerspective;
	#else
		uniform float logDepthBufFC;
	#endif
#endif`, PP = `#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		vFragDepth = 1.0 + gl_Position.w;
		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
	#else
		if ( isPerspectiveMatrix( projectionMatrix ) ) {
			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
			gl_Position.z *= gl_Position.w;
		}
	#endif
#endif`, IP = `#ifdef USE_MAP
	vec4 texelColor = texture2D( map, vUv );
	texelColor = mapTexelToLinear( texelColor );
	diffuseColor *= texelColor;
#endif`, OP = `#ifdef USE_MAP
	uniform sampler2D map;
#endif`, DP = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#ifdef USE_MAP
	vec4 mapTexel = texture2D( map, uv );
	diffuseColor *= mapTexelToLinear( mapTexel );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`, NP = `#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	uniform mat3 uvTransform;
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`, BP = `float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vUv );
	metalnessFactor *= texelMetalness.b;
#endif`, UP = `#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`, zP = `#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
	objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
	objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
	objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif`, kP = `#ifdef USE_MORPHTARGETS
	uniform float morphTargetBaseInfluence;
	#ifndef USE_MORPHNORMALS
		uniform float morphTargetInfluences[ 8 ];
	#else
		uniform float morphTargetInfluences[ 4 ];
	#endif
#endif`, VP = `#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	transformed += morphTarget0 * morphTargetInfluences[ 0 ];
	transformed += morphTarget1 * morphTargetInfluences[ 1 ];
	transformed += morphTarget2 * morphTargetInfluences[ 2 ];
	transformed += morphTarget3 * morphTargetInfluences[ 3 ];
	#ifndef USE_MORPHNORMALS
		transformed += morphTarget4 * morphTargetInfluences[ 4 ];
		transformed += morphTarget5 * morphTargetInfluences[ 5 ];
		transformed += morphTarget6 * morphTargetInfluences[ 6 ];
		transformed += morphTarget7 * morphTargetInfluences[ 7 ];
	#endif
#endif`, GP = `float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	#ifdef USE_TANGENT
		vec3 tangent = normalize( vTangent );
		vec3 bitangent = normalize( vBitangent );
		#ifdef DOUBLE_SIDED
			tangent = tangent * faceDirection;
			bitangent = bitangent * faceDirection;
		#endif
		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
			mat3 vTBN = mat3( tangent, bitangent, normal );
		#endif
	#endif
#endif
vec3 geometryNormal = normal;`, HP = `#ifdef OBJECTSPACE_NORMALMAP
	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( TANGENTSPACE_NORMALMAP )
	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	#ifdef USE_TANGENT
		normal = normalize( vTBN * mapN );
	#else
		normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );
	#endif
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`, WP = `#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef OBJECTSPACE_NORMALMAP
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
		vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
		vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
		vec2 st0 = dFdx( vUv.st );
		vec2 st1 = dFdy( vUv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
	}
#endif`, jP = `#ifdef CLEARCOAT
	vec3 clearcoatNormal = geometryNormal;
#endif`, $P = `#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	#ifdef USE_TANGENT
		clearcoatNormal = normalize( vTBN * clearcoatMapN );
	#else
		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
	#endif
#endif`, ZP = `#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif`, XP = `vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
	vec4 r = vec4( fract( v * PackFactors ), v );
	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors );
}
vec4 pack2HalfToRGBA( vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
}
vec2 unpackRGBATo2Half( vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
	return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`, YP = `#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`, JP = `vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`, KP = `#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`, qP = `#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`, QP = `float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vUv );
	roughnessFactor *= texelRoughness.g;
#endif`, eI = `#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`, tI = `#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
		bool inFrustum = all( inFrustumVec );
		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
		bool frustumTest = all( frustumTestVec );
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return shadow;
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
		vec3 lightToPosition = shadowCoord.xyz;
		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
		vec3 bd3D = normalize( lightToPosition );
		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
			return (
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
			) * ( 1.0 / 9.0 );
		#else
			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
		#endif
	}
#endif`, nI = `#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`, iI = `#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		vec4 shadowWorldPosition;
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
#endif`, rI = `float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`, sI = `#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`, oI = `#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	#ifdef BONE_TEXTURE
		uniform highp sampler2D boneTexture;
		uniform int boneTextureSize;
		mat4 getBoneMatrix( const in float i ) {
			float j = i * 4.0;
			float x = mod( j, float( boneTextureSize ) );
			float y = floor( j / float( boneTextureSize ) );
			float dx = 1.0 / float( boneTextureSize );
			float dy = 1.0 / float( boneTextureSize );
			y = dy * ( y + 0.5 );
			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
			mat4 bone = mat4( v1, v2, v3, v4 );
			return bone;
		}
	#else
		uniform mat4 boneMatrices[ MAX_BONES ];
		mat4 getBoneMatrix( const in float i ) {
			mat4 bone = boneMatrices[ int(i) ];
			return bone;
		}
	#endif
#endif`, aI = `#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`, lI = `#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`, cI = `float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`, uI = `#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`, hI = `#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`, dI = `#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`, fI = `#ifdef USE_TRANSMISSION
	float transmissionFactor = transmission;
	float thicknessFactor = thickness;
	#ifdef USE_TRANSMISSIONMAP
		transmissionFactor *= texture2D( transmissionMap, vUv ).r;
	#endif
	#ifdef USE_THICKNESSNMAP
		thicknessFactor *= texture2D( thicknessMap, vUv ).g;
	#endif
	vec3 pos = vWorldPosition.xyz / vWorldPosition.w;
	vec3 v = normalize( cameraPosition - pos );
	float ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );
	vec3 transmission = transmissionFactor * getIBLVolumeRefraction(
		normal, v, roughnessFactor, material.diffuseColor, totalSpecular,
		pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
		attenuationColor, attenuationDistance );
	totalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );
#endif`, pI = `#ifdef USE_TRANSMISSION
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec4 vWorldPosition;
	vec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {
		vec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);
		vec3 modelScale;
		modelScale.x = length(vec3(modelMatrix[0].xyz));
		modelScale.y = length(vec3(modelMatrix[1].xyz));
		modelScale.z = length(vec3(modelMatrix[2].xyz));
		return normalize(refractionVector) * thickness * modelScale;
	}
	float applyIorToRoughness(float roughness, float ior) {
		return roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);
	}
	vec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {
		float framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);
		return texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;
	}
	vec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {
		if (attenuationDistance == 0.0) {
			return radiance;
		} else {
			vec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;
			vec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);			return transmittance * radiance;
		}
	}
	vec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,
		vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,
		vec3 attenuationColor, float attenuationDistance) {
		vec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);
		vec3 refractedRayExit = position + transmissionRay;
		vec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);
		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
		refractionCoords += 1.0;
		refractionCoords /= 2.0;
		vec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);
		vec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);
		return (1.0 - specularColor) * attenuatedColor * baseColor;
	}
#endif`, mI = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
	varying vec2 vUv;
#endif`, gI = `#ifdef USE_UV
	#ifdef UVS_VERTEX_ONLY
		vec2 vUv;
	#else
		varying vec2 vUv;
	#endif
	uniform mat3 uvTransform;
#endif`, vI = `#ifdef USE_UV
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`, yI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	varying vec2 vUv2;
#endif`, bI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	attribute vec2 uv2;
	varying vec2 vUv2;
	uniform mat3 uv2Transform;
#endif`, xI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`, MI = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`, wI = `uniform sampler2D t2D;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	gl_FragColor = mapTexelToLinear( texColor );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`, AI = `varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`, SI = `#include <envmap_common_pars_fragment>
uniform float opacity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	vec3 vReflect = vWorldDirection;
	#include <envmap_fragment>
	gl_FragColor = envColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`, _I = `varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`, TI = `#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#endif
}`, EI = `#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`, CI = `#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`, LI = `#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`, RI = `uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	vec4 texColor = texture2D( tEquirect, sampleUV );
	gl_FragColor = mapTexelToLinear( texColor );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`, FI = `varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`, PI = `uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`, II = `uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <color_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`, OI = `uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
	
		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
		reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, DI = `#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <skinbase_vertex>
	#ifdef USE_ENVMAP
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`, NI = `uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <fog_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <emissivemap_fragment>
	#ifdef DOUBLE_SIDED
		reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
	#else
		reflectedLight.indirectDiffuse += vIndirectFront;
	#endif
	#include <lightmap_fragment>
	reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
	#ifdef DOUBLE_SIDED
		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
	#else
		reflectedLight.directDiffuse = vLightFront;
	#endif
	reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, BI = `#define LAMBERT
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <bsdfs>
#include <lights_pars_begin>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <lights_lambert_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`, UI = `#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
		matcapColor = matcapTexelToLinear( matcapColor );
	#else
		vec4 matcapColor = vec4( 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, zI = `#define MATCAP
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#ifndef FLAT_SHADED
		vNormal = normalize( transformedNormal );
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`, kI = `#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, VI = `#define TOON
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`, GI = `#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, HI = `#define PHONG
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`, WI = `#define STANDARD
#ifdef PHYSICAL
	#define REFLECTIVITY
	#define CLEARCOAT
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform vec3 attenuationColor;
	uniform float attenuationDistance;
#endif
#ifdef REFLECTIVITY
	uniform float reflectivity;
#endif
#ifdef CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheen;
#endif
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <transmission_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <lights_physical_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`, jI = `#define STANDARD
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#ifdef USE_TRANSMISSION
	varying vec4 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition;
#endif
}`, $I = `#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <packing>
#include <uv_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
}`, ZI = `#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	vViewPosition = - mvPosition.xyz;
#endif
}`, XI = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`, YI = `uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <color_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`, JI = `uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`, KI = `#include <common>
#include <fog_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <begin_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`, qI = `uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`, QI = `uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	vec2 scale;
	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`;
const dt = {
  alphamap_fragment: IF,
  alphamap_pars_fragment: OF,
  alphatest_fragment: DF,
  aomap_fragment: NF,
  aomap_pars_fragment: BF,
  begin_vertex: UF,
  beginnormal_vertex: zF,
  bsdfs: kF,
  bumpmap_pars_fragment: VF,
  clipping_planes_fragment: GF,
  clipping_planes_pars_fragment: HF,
  clipping_planes_pars_vertex: WF,
  clipping_planes_vertex: jF,
  color_fragment: $F,
  color_pars_fragment: ZF,
  color_pars_vertex: XF,
  color_vertex: YF,
  common: JF,
  cube_uv_reflection_fragment: KF,
  defaultnormal_vertex: qF,
  displacementmap_pars_vertex: QF,
  displacementmap_vertex: eP,
  emissivemap_fragment: tP,
  emissivemap_pars_fragment: nP,
  encodings_fragment: iP,
  encodings_pars_fragment: rP,
  envmap_fragment: sP,
  envmap_common_pars_fragment: oP,
  envmap_pars_fragment: aP,
  envmap_pars_vertex: lP,
  envmap_physical_pars_fragment: bP,
  envmap_vertex: cP,
  fog_vertex: uP,
  fog_pars_vertex: hP,
  fog_fragment: dP,
  fog_pars_fragment: fP,
  gradientmap_pars_fragment: pP,
  lightmap_fragment: mP,
  lightmap_pars_fragment: gP,
  lights_lambert_vertex: vP,
  lights_pars_begin: yP,
  lights_toon_fragment: xP,
  lights_toon_pars_fragment: MP,
  lights_phong_fragment: wP,
  lights_phong_pars_fragment: AP,
  lights_physical_fragment: SP,
  lights_physical_pars_fragment: _P,
  lights_fragment_begin: TP,
  lights_fragment_maps: EP,
  lights_fragment_end: CP,
  logdepthbuf_fragment: LP,
  logdepthbuf_pars_fragment: RP,
  logdepthbuf_pars_vertex: FP,
  logdepthbuf_vertex: PP,
  map_fragment: IP,
  map_pars_fragment: OP,
  map_particle_fragment: DP,
  map_particle_pars_fragment: NP,
  metalnessmap_fragment: BP,
  metalnessmap_pars_fragment: UP,
  morphnormal_vertex: zP,
  morphtarget_pars_vertex: kP,
  morphtarget_vertex: VP,
  normal_fragment_begin: GP,
  normal_fragment_maps: HP,
  normalmap_pars_fragment: WP,
  clearcoat_normal_fragment_begin: jP,
  clearcoat_normal_fragment_maps: $P,
  clearcoat_pars_fragment: ZP,
  packing: XP,
  premultiplied_alpha_fragment: YP,
  project_vertex: JP,
  dithering_fragment: KP,
  dithering_pars_fragment: qP,
  roughnessmap_fragment: QP,
  roughnessmap_pars_fragment: eI,
  shadowmap_pars_fragment: tI,
  shadowmap_pars_vertex: nI,
  shadowmap_vertex: iI,
  shadowmask_pars_fragment: rI,
  skinbase_vertex: sI,
  skinning_pars_vertex: oI,
  skinning_vertex: aI,
  skinnormal_vertex: lI,
  specularmap_fragment: cI,
  specularmap_pars_fragment: uI,
  tonemapping_fragment: hI,
  tonemapping_pars_fragment: dI,
  transmission_fragment: fI,
  transmission_pars_fragment: pI,
  uv_pars_fragment: mI,
  uv_pars_vertex: gI,
  uv_vertex: vI,
  uv2_pars_fragment: yI,
  uv2_pars_vertex: bI,
  uv2_vertex: xI,
  worldpos_vertex: MI,
  background_frag: wI,
  background_vert: AI,
  cube_frag: SI,
  cube_vert: _I,
  depth_frag: TI,
  depth_vert: EI,
  distanceRGBA_frag: CI,
  distanceRGBA_vert: LI,
  equirect_frag: RI,
  equirect_vert: FI,
  linedashed_frag: PI,
  linedashed_vert: II,
  meshbasic_frag: OI,
  meshbasic_vert: DI,
  meshlambert_frag: NI,
  meshlambert_vert: BI,
  meshmatcap_frag: UI,
  meshmatcap_vert: zI,
  meshtoon_frag: kI,
  meshtoon_vert: VI,
  meshphong_frag: GI,
  meshphong_vert: HI,
  meshphysical_frag: WI,
  meshphysical_vert: jI,
  normal_frag: $I,
  normal_vert: ZI,
  points_frag: XI,
  points_vert: YI,
  shadow_frag: JI,
  shadow_vert: KI,
  sprite_frag: qI,
  sprite_vert: QI
}, ze = {
  common: {
    diffuse: { value: new Ue(16777215) },
    opacity: { value: 1 },
    map: { value: null },
    uvTransform: { value: new rn() },
    uv2Transform: { value: new rn() },
    alphaMap: { value: null }
  },
  specularmap: {
    specularMap: { value: null }
  },
  envmap: {
    envMap: { value: null },
    flipEnvMap: { value: -1 },
    reflectivity: { value: 1 },
    refractionRatio: { value: 0.98 },
    maxMipLevel: { value: 0 }
  },
  aomap: {
    aoMap: { value: null },
    aoMapIntensity: { value: 1 }
  },
  lightmap: {
    lightMap: { value: null },
    lightMapIntensity: { value: 1 }
  },
  emissivemap: {
    emissiveMap: { value: null }
  },
  bumpmap: {
    bumpMap: { value: null },
    bumpScale: { value: 1 }
  },
  normalmap: {
    normalMap: { value: null },
    normalScale: { value: new Re(1, 1) }
  },
  displacementmap: {
    displacementMap: { value: null },
    displacementScale: { value: 1 },
    displacementBias: { value: 0 }
  },
  roughnessmap: {
    roughnessMap: { value: null }
  },
  metalnessmap: {
    metalnessMap: { value: null }
  },
  gradientmap: {
    gradientMap: { value: null }
  },
  fog: {
    fogDensity: { value: 25e-5 },
    fogNear: { value: 1 },
    fogFar: { value: 2e3 },
    fogColor: { value: new Ue(16777215) }
  },
  lights: {
    ambientLightColor: { value: [] },
    lightProbe: { value: [] },
    directionalLights: { value: [], properties: {
      direction: {},
      color: {}
    } },
    directionalLightShadows: { value: [], properties: {
      shadowBias: {},
      shadowNormalBias: {},
      shadowRadius: {},
      shadowMapSize: {}
    } },
    directionalShadowMap: { value: [] },
    directionalShadowMatrix: { value: [] },
    spotLights: { value: [], properties: {
      color: {},
      position: {},
      direction: {},
      distance: {},
      coneCos: {},
      penumbraCos: {},
      decay: {}
    } },
    spotLightShadows: { value: [], properties: {
      shadowBias: {},
      shadowNormalBias: {},
      shadowRadius: {},
      shadowMapSize: {}
    } },
    spotShadowMap: { value: [] },
    spotShadowMatrix: { value: [] },
    pointLights: { value: [], properties: {
      color: {},
      position: {},
      decay: {},
      distance: {}
    } },
    pointLightShadows: { value: [], properties: {
      shadowBias: {},
      shadowNormalBias: {},
      shadowRadius: {},
      shadowMapSize: {},
      shadowCameraNear: {},
      shadowCameraFar: {}
    } },
    pointShadowMap: { value: [] },
    pointShadowMatrix: { value: [] },
    hemisphereLights: { value: [], properties: {
      direction: {},
      skyColor: {},
      groundColor: {}
    } },
    // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src
    rectAreaLights: { value: [], properties: {
      color: {},
      position: {},
      width: {},
      height: {}
    } },
    ltc_1: { value: null },
    ltc_2: { value: null }
  },
  points: {
    diffuse: { value: new Ue(16777215) },
    opacity: { value: 1 },
    size: { value: 1 },
    scale: { value: 1 },
    map: { value: null },
    alphaMap: { value: null },
    uvTransform: { value: new rn() }
  },
  sprite: {
    diffuse: { value: new Ue(16777215) },
    opacity: { value: 1 },
    center: { value: new Re(0.5, 0.5) },
    rotation: { value: 0 },
    map: { value: null },
    alphaMap: { value: null },
    uvTransform: { value: new rn() }
  }
}, ci = {
  basic: {
    uniforms: wn([
      ze.common,
      ze.specularmap,
      ze.envmap,
      ze.aomap,
      ze.lightmap,
      ze.fog
    ]),
    vertexShader: dt.meshbasic_vert,
    fragmentShader: dt.meshbasic_frag
  },
  lambert: {
    uniforms: wn([
      ze.common,
      ze.specularmap,
      ze.envmap,
      ze.aomap,
      ze.lightmap,
      ze.emissivemap,
      ze.fog,
      ze.lights,
      {
        emissive: { value: new Ue(0) }
      }
    ]),
    vertexShader: dt.meshlambert_vert,
    fragmentShader: dt.meshlambert_frag
  },
  phong: {
    uniforms: wn([
      ze.common,
      ze.specularmap,
      ze.envmap,
      ze.aomap,
      ze.lightmap,
      ze.emissivemap,
      ze.bumpmap,
      ze.normalmap,
      ze.displacementmap,
      ze.fog,
      ze.lights,
      {
        emissive: { value: new Ue(0) },
        specular: { value: new Ue(1118481) },
        shininess: { value: 30 }
      }
    ]),
    vertexShader: dt.meshphong_vert,
    fragmentShader: dt.meshphong_frag
  },
  standard: {
    uniforms: wn([
      ze.common,
      ze.envmap,
      ze.aomap,
      ze.lightmap,
      ze.emissivemap,
      ze.bumpmap,
      ze.normalmap,
      ze.displacementmap,
      ze.roughnessmap,
      ze.metalnessmap,
      ze.fog,
      ze.lights,
      {
        emissive: { value: new Ue(0) },
        roughness: { value: 1 },
        metalness: { value: 0 },
        envMapIntensity: { value: 1 }
        // temporary
      }
    ]),
    vertexShader: dt.meshphysical_vert,
    fragmentShader: dt.meshphysical_frag
  },
  toon: {
    uniforms: wn([
      ze.common,
      ze.aomap,
      ze.lightmap,
      ze.emissivemap,
      ze.bumpmap,
      ze.normalmap,
      ze.displacementmap,
      ze.gradientmap,
      ze.fog,
      ze.lights,
      {
        emissive: { value: new Ue(0) }
      }
    ]),
    vertexShader: dt.meshtoon_vert,
    fragmentShader: dt.meshtoon_frag
  },
  matcap: {
    uniforms: wn([
      ze.common,
      ze.bumpmap,
      ze.normalmap,
      ze.displacementmap,
      ze.fog,
      {
        matcap: { value: null }
      }
    ]),
    vertexShader: dt.meshmatcap_vert,
    fragmentShader: dt.meshmatcap_frag
  },
  points: {
    uniforms: wn([
      ze.points,
      ze.fog
    ]),
    vertexShader: dt.points_vert,
    fragmentShader: dt.points_frag
  },
  dashed: {
    uniforms: wn([
      ze.common,
      ze.fog,
      {
        scale: { value: 1 },
        dashSize: { value: 1 },
        totalSize: { value: 2 }
      }
    ]),
    vertexShader: dt.linedashed_vert,
    fragmentShader: dt.linedashed_frag
  },
  depth: {
    uniforms: wn([
      ze.common,
      ze.displacementmap
    ]),
    vertexShader: dt.depth_vert,
    fragmentShader: dt.depth_frag
  },
  normal: {
    uniforms: wn([
      ze.common,
      ze.bumpmap,
      ze.normalmap,
      ze.displacementmap,
      {
        opacity: { value: 1 }
      }
    ]),
    vertexShader: dt.normal_vert,
    fragmentShader: dt.normal_frag
  },
  sprite: {
    uniforms: wn([
      ze.sprite,
      ze.fog
    ]),
    vertexShader: dt.sprite_vert,
    fragmentShader: dt.sprite_frag
  },
  background: {
    uniforms: {
      uvTransform: { value: new rn() },
      t2D: { value: null }
    },
    vertexShader: dt.background_vert,
    fragmentShader: dt.background_frag
  },
  /* -------------------------------------------------------------------------
  //	Cube map shader
   ------------------------------------------------------------------------- */
  cube: {
    uniforms: wn([
      ze.envmap,
      {
        opacity: { value: 1 }
      }
    ]),
    vertexShader: dt.cube_vert,
    fragmentShader: dt.cube_frag
  },
  equirect: {
    uniforms: {
      tEquirect: { value: null }
    },
    vertexShader: dt.equirect_vert,
    fragmentShader: dt.equirect_frag
  },
  distanceRGBA: {
    uniforms: wn([
      ze.common,
      ze.displacementmap,
      {
        referencePosition: { value: new Q() },
        nearDistance: { value: 1 },
        farDistance: { value: 1e3 }
      }
    ]),
    vertexShader: dt.distanceRGBA_vert,
    fragmentShader: dt.distanceRGBA_frag
  },
  shadow: {
    uniforms: wn([
      ze.lights,
      ze.fog,
      {
        color: { value: new Ue(0) },
        opacity: { value: 1 }
      }
    ]),
    vertexShader: dt.shadow_vert,
    fragmentShader: dt.shadow_frag
  }
};
ci.physical = {
  uniforms: wn([
    ci.standard.uniforms,
    {
      clearcoat: { value: 0 },
      clearcoatMap: { value: null },
      clearcoatRoughness: { value: 0 },
      clearcoatRoughnessMap: { value: null },
      clearcoatNormalScale: { value: new Re(1, 1) },
      clearcoatNormalMap: { value: null },
      sheen: { value: new Ue(0) },
      transmission: { value: 0 },
      transmissionMap: { value: null },
      transmissionSamplerSize: { value: new Re() },
      transmissionSamplerMap: { value: null },
      thickness: { value: 0 },
      thicknessMap: { value: null },
      attenuationDistance: { value: 0 },
      attenuationColor: { value: new Ue(0) }
    }
  ]),
  vertexShader: dt.meshphysical_vert,
  fragmentShader: dt.meshphysical_frag
};
function eO(n, e, t, i, r) {
  const s = new Ue(0);
  let o = 0, a, c, l = null, d = 0, h = null;
  function f(p, u) {
    let y = !1, v = u.isScene === !0 ? u.background : null;
    v && v.isTexture && (v = e.get(v));
    const m = n.xr, x = m.getSession && m.getSession();
    x && x.environmentBlendMode === "additive" && (v = null), v === null ? g(s, o) : v && v.isColor && (g(v, 1), y = !0), (n.autoClear || y) && n.clear(n.autoClearColor, n.autoClearDepth, n.autoClearStencil), v && (v.isCubeTexture || v.mapping === ea) ? (c === void 0 && (c = new Xt(
      new or(1, 1, 1),
      new ar({
        name: "BackgroundCubeMaterial",
        uniforms: Po(ci.cube.uniforms),
        vertexShader: ci.cube.vertexShader,
        fragmentShader: ci.cube.fragmentShader,
        side: jt,
        depthTest: !1,
        depthWrite: !1,
        fog: !1
      })
    ), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(w, A, M) {
      this.matrixWorld.copyPosition(M.matrixWorld);
    }, Object.defineProperty(c.material, "envMap", {
      get: function() {
        return this.uniforms.envMap.value;
      }
    }), i.update(c)), c.material.uniforms.envMap.value = v, c.material.uniforms.flipEnvMap.value = v.isCubeTexture && v._needsFlipEnvMap ? -1 : 1, (l !== v || d !== v.version || h !== n.toneMapping) && (c.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), p.unshift(c, c.geometry, c.material, 0, 0, null)) : v && v.isTexture && (a === void 0 && (a = new Xt(
      new Ls(2, 2),
      new ar({
        name: "BackgroundMaterial",
        uniforms: Po(ci.background.uniforms),
        vertexShader: ci.background.vertexShader,
        fragmentShader: ci.background.fragmentShader,
        side: Hr,
        depthTest: !1,
        depthWrite: !1,
        fog: !1
      })
    ), a.geometry.deleteAttribute("normal"), Object.defineProperty(a.material, "map", {
      get: function() {
        return this.uniforms.t2D.value;
      }
    }), i.update(a)), a.material.uniforms.t2D.value = v, v.matrixAutoUpdate === !0 && v.updateMatrix(), a.material.uniforms.uvTransform.value.copy(v.matrix), (l !== v || d !== v.version || h !== n.toneMapping) && (a.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), p.unshift(a, a.geometry, a.material, 0, 0, null));
  }
  function g(p, u) {
    t.buffers.color.setClear(p.r, p.g, p.b, u, r);
  }
  return {
    getClearColor: function() {
      return s;
    },
    setClearColor: function(p, u = 1) {
      s.set(p), o = u, g(s, o);
    },
    getClearAlpha: function() {
      return o;
    },
    setClearAlpha: function(p) {
      o = p, g(s, o);
    },
    render: f
  };
}
function tO(n, e, t, i) {
  const r = n.getParameter(34921), s = i.isWebGL2 ? null : e.get("OES_vertex_array_object"), o = i.isWebGL2 || s !== null, a = {}, c = u(null);
  let l = c;
  function d(E, C, P, b, I) {
    let D = !1;
    if (o) {
      const N = p(b, P, C);
      l !== N && (l = N, f(l.object)), D = y(b, I), D && v(b, I);
    } else {
      const N = C.wireframe === !0;
      (l.geometry !== b.id || l.program !== P.id || l.wireframe !== N) && (l.geometry = b.id, l.program = P.id, l.wireframe = N, D = !0);
    }
    E.isInstancedMesh === !0 && (D = !0), I !== null && t.update(I, 34963), D && (R(E, C, P, b), I !== null && n.bindBuffer(34963, t.get(I).buffer));
  }
  function h() {
    return i.isWebGL2 ? n.createVertexArray() : s.createVertexArrayOES();
  }
  function f(E) {
    return i.isWebGL2 ? n.bindVertexArray(E) : s.bindVertexArrayOES(E);
  }
  function g(E) {
    return i.isWebGL2 ? n.deleteVertexArray(E) : s.deleteVertexArrayOES(E);
  }
  function p(E, C, P) {
    const b = P.wireframe === !0;
    let I = a[E.id];
    I === void 0 && (I = {}, a[E.id] = I);
    let D = I[C.id];
    D === void 0 && (D = {}, I[C.id] = D);
    let N = D[b];
    return N === void 0 && (N = u(h()), D[b] = N), N;
  }
  function u(E) {
    const C = [], P = [], b = [];
    for (let I = 0; I < r; I++)
      C[I] = 0, P[I] = 0, b[I] = 0;
    return {
      // for backward compatibility on non-VAO support browser
      geometry: null,
      program: null,
      wireframe: !1,
      newAttributes: C,
      enabledAttributes: P,
      attributeDivisors: b,
      object: E,
      attributes: {},
      index: null
    };
  }
  function y(E, C) {
    const P = l.attributes, b = E.attributes;
    let I = 0;
    for (const D in b) {
      const N = P[D], U = b[D];
      if (N === void 0 || N.attribute !== U || N.data !== U.data) return !0;
      I++;
    }
    return l.attributesNum !== I || l.index !== C;
  }
  function v(E, C) {
    const P = {}, b = E.attributes;
    let I = 0;
    for (const D in b) {
      const N = b[D], U = {};
      U.attribute = N, N.data && (U.data = N.data), P[D] = U, I++;
    }
    l.attributes = P, l.attributesNum = I, l.index = C;
  }
  function m() {
    const E = l.newAttributes;
    for (let C = 0, P = E.length; C < P; C++)
      E[C] = 0;
  }
  function x(E) {
    w(E, 0);
  }
  function w(E, C) {
    const P = l.newAttributes, b = l.enabledAttributes, I = l.attributeDivisors;
    P[E] = 1, b[E] === 0 && (n.enableVertexAttribArray(E), b[E] = 1), I[E] !== C && ((i.isWebGL2 ? n : e.get("ANGLE_instanced_arrays"))[i.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](E, C), I[E] = C);
  }
  function A() {
    const E = l.newAttributes, C = l.enabledAttributes;
    for (let P = 0, b = C.length; P < b; P++)
      C[P] !== E[P] && (n.disableVertexAttribArray(P), C[P] = 0);
  }
  function M(E, C, P, b, I, D) {
    i.isWebGL2 === !0 && (P === 5124 || P === 5125) ? n.vertexAttribIPointer(E, C, P, I, D) : n.vertexAttribPointer(E, C, P, b, I, D);
  }
  function R(E, C, P, b) {
    if (i.isWebGL2 === !1 && (E.isInstancedMesh || b.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null)
      return;
    m();
    const I = b.attributes, D = P.getAttributes(), N = C.defaultAttributeValues;
    for (const U in D) {
      const B = D[U];
      if (B >= 0) {
        const G = I[U];
        if (G !== void 0) {
          const J = G.normalized, j = G.itemSize, te = t.get(G);
          if (te === void 0) continue;
          const ee = te.buffer, ae = te.type, H = te.bytesPerElement;
          if (G.isInterleavedBufferAttribute) {
            const Z = G.data, $ = Z.stride, se = G.offset;
            Z && Z.isInstancedInterleavedBuffer ? (w(B, Z.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = Z.meshPerAttribute * Z.count)) : x(B), n.bindBuffer(34962, ee), M(B, j, ae, J, $ * H, se * H);
          } else
            G.isInstancedBufferAttribute ? (w(B, G.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = G.meshPerAttribute * G.count)) : x(B), n.bindBuffer(34962, ee), M(B, j, ae, J, 0, 0);
        } else if (U === "instanceMatrix") {
          const J = t.get(E.instanceMatrix);
          if (J === void 0) continue;
          const j = J.buffer, te = J.type;
          w(B + 0, 1), w(B + 1, 1), w(B + 2, 1), w(B + 3, 1), n.bindBuffer(34962, j), n.vertexAttribPointer(B + 0, 4, te, !1, 64, 0), n.vertexAttribPointer(B + 1, 4, te, !1, 64, 16), n.vertexAttribPointer(B + 2, 4, te, !1, 64, 32), n.vertexAttribPointer(B + 3, 4, te, !1, 64, 48);
        } else if (U === "instanceColor") {
          const J = t.get(E.instanceColor);
          if (J === void 0) continue;
          const j = J.buffer, te = J.type;
          w(B, 1), n.bindBuffer(34962, j), n.vertexAttribPointer(B, 3, te, !1, 12, 0);
        } else if (N !== void 0) {
          const J = N[U];
          if (J !== void 0)
            switch (J.length) {
              case 2:
                n.vertexAttrib2fv(B, J);
                break;
              case 3:
                n.vertexAttrib3fv(B, J);
                break;
              case 4:
                n.vertexAttrib4fv(B, J);
                break;
              default:
                n.vertexAttrib1fv(B, J);
            }
        }
      }
    }
    A();
  }
  function L() {
    S();
    for (const E in a) {
      const C = a[E];
      for (const P in C) {
        const b = C[P];
        for (const I in b)
          g(b[I].object), delete b[I];
        delete C[P];
      }
      delete a[E];
    }
  }
  function _(E) {
    if (a[E.id] === void 0) return;
    const C = a[E.id];
    for (const P in C) {
      const b = C[P];
      for (const I in b)
        g(b[I].object), delete b[I];
      delete C[P];
    }
    delete a[E.id];
  }
  function F(E) {
    for (const C in a) {
      const P = a[C];
      if (P[E.id] === void 0) continue;
      const b = P[E.id];
      for (const I in b)
        g(b[I].object), delete b[I];
      delete P[E.id];
    }
  }
  function S() {
    T(), l !== c && (l = c, f(l.object));
  }
  function T() {
    c.geometry = null, c.program = null, c.wireframe = !1;
  }
  return {
    setup: d,
    reset: S,
    resetDefaultState: T,
    dispose: L,
    releaseStatesOfGeometry: _,
    releaseStatesOfProgram: F,
    initAttributes: m,
    enableAttribute: x,
    disableUnusedAttributes: A
  };
}
function nO(n, e, t, i) {
  const r = i.isWebGL2;
  let s;
  function o(l) {
    s = l;
  }
  function a(l, d) {
    n.drawArrays(s, l, d), t.update(d, s, 1);
  }
  function c(l, d, h) {
    if (h === 0) return;
    let f, g;
    if (r)
      f = n, g = "drawArraysInstanced";
    else if (f = e.get("ANGLE_instanced_arrays"), g = "drawArraysInstancedANGLE", f === null) {
      console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
      return;
    }
    f[g](s, l, d, h), t.update(d, s, h);
  }
  this.setMode = o, this.render = a, this.renderInstances = c;
}
function iO(n, e, t) {
  let i;
  function r() {
    if (i !== void 0) return i;
    if (e.has("EXT_texture_filter_anisotropic") === !0) {
      const R = e.get("EXT_texture_filter_anisotropic");
      i = n.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
    } else
      i = 0;
    return i;
  }
  function s(R) {
    if (R === "highp") {
      if (n.getShaderPrecisionFormat(35633, 36338).precision > 0 && n.getShaderPrecisionFormat(35632, 36338).precision > 0)
        return "highp";
      R = "mediump";
    }
    return R === "mediump" && n.getShaderPrecisionFormat(35633, 36337).precision > 0 && n.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp";
  }
  const o = typeof WebGL2RenderingContext < "u" && n instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext < "u" && n instanceof WebGL2ComputeRenderingContext;
  let a = t.precision !== void 0 ? t.precision : "highp";
  const c = s(a);
  c !== a && (console.warn("THREE.WebGLRenderer:", a, "not supported, using", c, "instead."), a = c);
  const l = o || e.has("WEBGL_draw_buffers"), d = t.logarithmicDepthBuffer === !0, h = n.getParameter(34930), f = n.getParameter(35660), g = n.getParameter(3379), p = n.getParameter(34076), u = n.getParameter(34921), y = n.getParameter(36347), v = n.getParameter(36348), m = n.getParameter(36349), x = f > 0, w = o || e.has("OES_texture_float"), A = x && w, M = o ? n.getParameter(36183) : 0;
  return {
    isWebGL2: o,
    drawBuffers: l,
    getMaxAnisotropy: r,
    getMaxPrecision: s,
    precision: a,
    logarithmicDepthBuffer: d,
    maxTextures: h,
    maxVertexTextures: f,
    maxTextureSize: g,
    maxCubemapSize: p,
    maxAttributes: u,
    maxVertexUniforms: y,
    maxVaryings: v,
    maxFragmentUniforms: m,
    vertexTextures: x,
    floatFragmentTextures: w,
    floatVertexTextures: A,
    maxSamples: M
  };
}
function rO(n) {
  const e = this;
  let t = null, i = 0, r = !1, s = !1;
  const o = new wi(), a = new rn(), c = { value: null, needsUpdate: !1 };
  this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(h, f, g) {
    const p = h.length !== 0 || f || // enable state of previous frame - the clipping code has to
    // run another frame in order to reset the state:
    i !== 0 || r;
    return r = f, t = d(h, g, 0), i = h.length, p;
  }, this.beginShadows = function() {
    s = !0, d(null);
  }, this.endShadows = function() {
    s = !1, l();
  }, this.setState = function(h, f, g) {
    const p = h.clippingPlanes, u = h.clipIntersection, y = h.clipShadows, v = n.get(h);
    if (!r || p === null || p.length === 0 || s && !y)
      s ? d(null) : l();
    else {
      const m = s ? 0 : i, x = m * 4;
      let w = v.clippingState || null;
      c.value = w, w = d(p, f, x, g);
      for (let A = 0; A !== x; ++A)
        w[A] = t[A];
      v.clippingState = w, this.numIntersection = u ? this.numPlanes : 0, this.numPlanes += m;
    }
  };
  function l() {
    c.value !== t && (c.value = t, c.needsUpdate = i > 0), e.numPlanes = i, e.numIntersection = 0;
  }
  function d(h, f, g, p) {
    const u = h !== null ? h.length : 0;
    let y = null;
    if (u !== 0) {
      if (y = c.value, p !== !0 || y === null) {
        const v = g + u * 4, m = f.matrixWorldInverse;
        a.getNormalMatrix(m), (y === null || y.length < v) && (y = new Float32Array(v));
        for (let x = 0, w = g; x !== u; ++x, w += 4)
          o.copy(h[x]).applyMatrix4(m, a), o.normal.toArray(y, w), y[w + 3] = o.constant;
      }
      c.value = y, c.needsUpdate = !0;
    }
    return e.numPlanes = u, e.numIntersection = 0, y;
  }
}
function sO(n) {
  let e = /* @__PURE__ */ new WeakMap();
  function t(o, a) {
    return a === Vc ? o.mapping = ll : a === Gc && (o.mapping = cl), o;
  }
  function i(o) {
    if (o && o.isTexture) {
      const a = o.mapping;
      if (a === Vc || a === Gc)
        if (e.has(o)) {
          const c = e.get(o).texture;
          return t(c, o.mapping);
        } else {
          const c = o.image;
          if (c && c.height > 0) {
            const l = n.getRenderTarget(), d = new bu(c.height / 2);
            return d.fromEquirectangularTexture(n, o), e.set(o, d), n.setRenderTarget(l), o.addEventListener("dispose", r), t(d.texture, o.mapping);
          } else
            return null;
        }
    }
    return o;
  }
  function r(o) {
    const a = o.target;
    a.removeEventListener("dispose", r);
    const c = e.get(a);
    c !== void 0 && (e.delete(a), c.dispose());
  }
  function s() {
    e = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: i,
    dispose: s
  };
}
function oO(n) {
  const e = {};
  function t(i) {
    if (e[i] !== void 0)
      return e[i];
    let r;
    switch (i) {
      case "WEBGL_depth_texture":
        r = n.getExtension("WEBGL_depth_texture") || n.getExtension("MOZ_WEBGL_depth_texture") || n.getExtension("WEBKIT_WEBGL_depth_texture");
        break;
      case "EXT_texture_filter_anisotropic":
        r = n.getExtension("EXT_texture_filter_anisotropic") || n.getExtension("MOZ_EXT_texture_filter_anisotropic") || n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
        break;
      case "WEBGL_compressed_texture_s3tc":
        r = n.getExtension("WEBGL_compressed_texture_s3tc") || n.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
        break;
      case "WEBGL_compressed_texture_pvrtc":
        r = n.getExtension("WEBGL_compressed_texture_pvrtc") || n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
        break;
      default:
        r = n.getExtension(i);
    }
    return e[i] = r, r;
  }
  return {
    has: function(i) {
      return t(i) !== null;
    },
    init: function(i) {
      i.isWebGL2 ? t("EXT_color_buffer_float") : (t("WEBGL_depth_texture"), t("OES_texture_float"), t("OES_texture_half_float"), t("OES_texture_half_float_linear"), t("OES_standard_derivatives"), t("OES_element_index_uint"), t("OES_vertex_array_object"), t("ANGLE_instanced_arrays")), t("OES_texture_float_linear"), t("EXT_color_buffer_half_float");
    },
    get: function(i) {
      const r = t(i);
      return r === null && console.warn("THREE.WebGLRenderer: " + i + " extension not supported."), r;
    }
  };
}
function aO(n, e, t, i) {
  const r = {}, s = /* @__PURE__ */ new WeakMap();
  function o(h) {
    const f = h.target;
    f.index !== null && e.remove(f.index);
    for (const p in f.attributes)
      e.remove(f.attributes[p]);
    f.removeEventListener("dispose", o), delete r[f.id];
    const g = s.get(f);
    g && (e.remove(g), s.delete(f)), i.releaseStatesOfGeometry(f), f.isInstancedBufferGeometry === !0 && delete f._maxInstanceCount, t.memory.geometries--;
  }
  function a(h, f) {
    return r[f.id] === !0 || (f.addEventListener("dispose", o), r[f.id] = !0, t.memory.geometries++), f;
  }
  function c(h) {
    const f = h.attributes;
    for (const p in f)
      e.update(f[p], 34962);
    const g = h.morphAttributes;
    for (const p in g) {
      const u = g[p];
      for (let y = 0, v = u.length; y < v; y++)
        e.update(u[y], 34962);
    }
  }
  function l(h) {
    const f = [], g = h.index, p = h.attributes.position;
    let u = 0;
    if (g !== null) {
      const m = g.array;
      u = g.version;
      for (let x = 0, w = m.length; x < w; x += 3) {
        const A = m[x + 0], M = m[x + 1], R = m[x + 2];
        f.push(A, M, M, R, R, A);
      }
    } else {
      const m = p.array;
      u = p.version;
      for (let x = 0, w = m.length / 3 - 1; x < w; x += 3) {
        const A = x + 0, M = x + 1, R = x + 2;
        f.push(A, M, M, R, R, A);
      }
    }
    const y = new (hx(f) > 65535 ? vu : gu)(f, 1);
    y.version = u;
    const v = s.get(h);
    v && e.remove(v), s.set(h, y);
  }
  function d(h) {
    const f = s.get(h);
    if (f) {
      const g = h.index;
      g !== null && f.version < g.version && l(h);
    } else
      l(h);
    return s.get(h);
  }
  return {
    get: a,
    update: c,
    getWireframeAttribute: d
  };
}
function lO(n, e, t, i) {
  const r = i.isWebGL2;
  let s;
  function o(f) {
    s = f;
  }
  let a, c;
  function l(f) {
    a = f.type, c = f.bytesPerElement;
  }
  function d(f, g) {
    n.drawElements(s, g, a, f * c), t.update(g, s, 1);
  }
  function h(f, g, p) {
    if (p === 0) return;
    let u, y;
    if (r)
      u = n, y = "drawElementsInstanced";
    else if (u = e.get("ANGLE_instanced_arrays"), y = "drawElementsInstancedANGLE", u === null) {
      console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
      return;
    }
    u[y](s, g, a, f * c, p), t.update(g, s, p);
  }
  this.setMode = o, this.setIndex = l, this.render = d, this.renderInstances = h;
}
function cO(n) {
  const e = {
    geometries: 0,
    textures: 0
  }, t = {
    frame: 0,
    calls: 0,
    triangles: 0,
    points: 0,
    lines: 0
  };
  function i(s, o, a) {
    switch (t.calls++, o) {
      case 4:
        t.triangles += a * (s / 3);
        break;
      case 1:
        t.lines += a * (s / 2);
        break;
      case 3:
        t.lines += a * (s - 1);
        break;
      case 2:
        t.lines += a * s;
        break;
      case 0:
        t.points += a * s;
        break;
      default:
        console.error("THREE.WebGLInfo: Unknown draw mode:", o);
        break;
    }
  }
  function r() {
    t.frame++, t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0;
  }
  return {
    memory: e,
    render: t,
    programs: null,
    autoReset: !0,
    reset: r,
    update: i
  };
}
function uO(n, e) {
  return n[0] - e[0];
}
function hO(n, e) {
  return Math.abs(e[1]) - Math.abs(n[1]);
}
function dO(n) {
  const e = {}, t = new Float32Array(8), i = [];
  for (let s = 0; s < 8; s++)
    i[s] = [s, 0];
  function r(s, o, a, c) {
    const l = s.morphTargetInfluences, d = l === void 0 ? 0 : l.length;
    let h = e[o.id];
    if (h === void 0 || h.length !== d) {
      h = [];
      for (let y = 0; y < d; y++)
        h[y] = [y, 0];
      e[o.id] = h;
    }
    for (let y = 0; y < d; y++) {
      const v = h[y];
      v[0] = y, v[1] = l[y];
    }
    h.sort(hO);
    for (let y = 0; y < 8; y++)
      y < d && h[y][1] ? (i[y][0] = h[y][0], i[y][1] = h[y][1]) : (i[y][0] = Number.MAX_SAFE_INTEGER, i[y][1] = 0);
    i.sort(uO);
    const f = a.morphTargets && o.morphAttributes.position, g = a.morphNormals && o.morphAttributes.normal;
    let p = 0;
    for (let y = 0; y < 8; y++) {
      const v = i[y], m = v[0], x = v[1];
      m !== Number.MAX_SAFE_INTEGER && x ? (f && o.getAttribute("morphTarget" + y) !== f[m] && o.setAttribute("morphTarget" + y, f[m]), g && o.getAttribute("morphNormal" + y) !== g[m] && o.setAttribute("morphNormal" + y, g[m]), t[y] = x, p += x) : (f && o.hasAttribute("morphTarget" + y) === !0 && o.deleteAttribute("morphTarget" + y), g && o.hasAttribute("morphNormal" + y) === !0 && o.deleteAttribute("morphNormal" + y), t[y] = 0);
    }
    const u = o.morphTargetsRelative ? 1 : 1 - p;
    c.getUniforms().setValue(n, "morphTargetBaseInfluence", u), c.getUniforms().setValue(n, "morphTargetInfluences", t);
  }
  return {
    update: r
  };
}
function fO(n, e, t, i) {
  let r = /* @__PURE__ */ new WeakMap();
  function s(c) {
    const l = i.render.frame, d = c.geometry, h = e.get(c, d);
    return r.get(h) !== l && (e.update(h), r.set(h, l)), c.isInstancedMesh && (c.hasEventListener("dispose", a) === !1 && c.addEventListener("dispose", a), t.update(c.instanceMatrix, 34962), c.instanceColor !== null && t.update(c.instanceColor, 34962)), h;
  }
  function o() {
    r = /* @__PURE__ */ new WeakMap();
  }
  function a(c) {
    const l = c.target;
    l.removeEventListener("dispose", a), t.remove(l.instanceMatrix), l.instanceColor !== null && t.remove(l.instanceColor);
  }
  return {
    update: s,
    dispose: o
  };
}
class Lf extends Yt {
  constructor(e = null, t = 1, i = 1, r = 1) {
    super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = $t, this.minFilter = $t, this.wrapR = hn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0;
  }
}
Lf.prototype.isDataTexture2DArray = !0;
class Rf extends Yt {
  constructor(e = null, t = 1, i = 1, r = 1) {
    super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = $t, this.minFilter = $t, this.wrapR = hn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0;
  }
}
Rf.prototype.isDataTexture3D = !0;
const px = new Yt(), pO = new Lf(), mO = new Rf(), mx = new ta(), ig = [], rg = [], sg = new Float32Array(16), og = new Float32Array(9), ag = new Float32Array(4);
function na(n, e, t) {
  const i = n[0];
  if (i <= 0 || i > 0) return n;
  const r = e * t;
  let s = ig[r];
  if (s === void 0 && (s = new Float32Array(r), ig[r] = s), e !== 0) {
    i.toArray(s, 0);
    for (let o = 1, a = 0; o !== e; ++o)
      a += t, n[o].toArray(s, a);
  }
  return s;
}
function Ln(n, e) {
  if (n.length !== e.length) return !1;
  for (let t = 0, i = n.length; t < i; t++)
    if (n[t] !== e[t]) return !1;
  return !0;
}
function _n(n, e) {
  for (let t = 0, i = e.length; t < i; t++)
    n[t] = e[t];
}
function gx(n, e) {
  let t = rg[e];
  t === void 0 && (t = new Int32Array(e), rg[e] = t);
  for (let i = 0; i !== e; ++i)
    t[i] = n.allocateTextureUnit();
  return t;
}
function gO(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1f(this.addr, e), t[0] = e);
}
function vO(n, e) {
  const t = this.cache;
  if (e.x !== void 0)
    (t[0] !== e.x || t[1] !== e.y) && (n.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y);
  else {
    if (Ln(t, e)) return;
    n.uniform2fv(this.addr, e), _n(t, e);
  }
}
function yO(n, e) {
  const t = this.cache;
  if (e.x !== void 0)
    (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (n.uniform3f(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z);
  else if (e.r !== void 0)
    (t[0] !== e.r || t[1] !== e.g || t[2] !== e.b) && (n.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b);
  else {
    if (Ln(t, e)) return;
    n.uniform3fv(this.addr, e), _n(t, e);
  }
}
function bO(n, e) {
  const t = this.cache;
  if (e.x !== void 0)
    (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (n.uniform4f(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w);
  else {
    if (Ln(t, e)) return;
    n.uniform4fv(this.addr, e), _n(t, e);
  }
}
function xO(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Ln(t, e)) return;
    n.uniformMatrix2fv(this.addr, !1, e), _n(t, e);
  } else {
    if (Ln(t, i)) return;
    ag.set(i), n.uniformMatrix2fv(this.addr, !1, ag), _n(t, i);
  }
}
function MO(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Ln(t, e)) return;
    n.uniformMatrix3fv(this.addr, !1, e), _n(t, e);
  } else {
    if (Ln(t, i)) return;
    og.set(i), n.uniformMatrix3fv(this.addr, !1, og), _n(t, i);
  }
}
function wO(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Ln(t, e)) return;
    n.uniformMatrix4fv(this.addr, !1, e), _n(t, e);
  } else {
    if (Ln(t, i)) return;
    sg.set(i), n.uniformMatrix4fv(this.addr, !1, sg), _n(t, i);
  }
}
function AO(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1i(this.addr, e), t[0] = e);
}
function SO(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform2iv(this.addr, e), _n(t, e));
}
function _O(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform3iv(this.addr, e), _n(t, e));
}
function TO(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform4iv(this.addr, e), _n(t, e));
}
function EO(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1ui(this.addr, e), t[0] = e);
}
function CO(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform2uiv(this.addr, e), _n(t, e));
}
function LO(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform3uiv(this.addr, e), _n(t, e));
}
function RO(n, e) {
  const t = this.cache;
  Ln(t, e) || (n.uniform4uiv(this.addr, e), _n(t, e));
}
function FO(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTexture2D(e || px, r);
}
function PO(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture3D(e || mO, r);
}
function IO(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTextureCube(e || mx, r);
}
function OO(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture2DArray(e || pO, r);
}
function DO(n) {
  switch (n) {
    case 5126:
      return gO;
    case 35664:
      return vO;
    case 35665:
      return yO;
    case 35666:
      return bO;
    case 35674:
      return xO;
    case 35675:
      return MO;
    case 35676:
      return wO;
    case 5124:
    case 35670:
      return AO;
    case 35667:
    case 35671:
      return SO;
    case 35668:
    case 35672:
      return _O;
    case 35669:
    case 35673:
      return TO;
    case 5125:
      return EO;
    case 36294:
      return CO;
    case 36295:
      return LO;
    case 36296:
      return RO;
    case 35678:
    case 36198:
    case 36298:
    case 36306:
    case 35682:
      return FO;
    case 35679:
    case 36299:
    case 36307:
      return PO;
    case 35680:
    case 36300:
    case 36308:
    case 36293:
      return IO;
    case 36289:
    case 36303:
    case 36311:
    case 36292:
      return OO;
  }
}
function NO(n, e) {
  n.uniform1fv(this.addr, e);
}
function BO(n, e) {
  const t = na(e, this.size, 2);
  n.uniform2fv(this.addr, t);
}
function UO(n, e) {
  const t = na(e, this.size, 3);
  n.uniform3fv(this.addr, t);
}
function zO(n, e) {
  const t = na(e, this.size, 4);
  n.uniform4fv(this.addr, t);
}
function kO(n, e) {
  const t = na(e, this.size, 4);
  n.uniformMatrix2fv(this.addr, !1, t);
}
function VO(n, e) {
  const t = na(e, this.size, 9);
  n.uniformMatrix3fv(this.addr, !1, t);
}
function GO(n, e) {
  const t = na(e, this.size, 16);
  n.uniformMatrix4fv(this.addr, !1, t);
}
function HO(n, e) {
  n.uniform1iv(this.addr, e);
}
function WO(n, e) {
  n.uniform2iv(this.addr, e);
}
function jO(n, e) {
  n.uniform3iv(this.addr, e);
}
function $O(n, e) {
  n.uniform4iv(this.addr, e);
}
function ZO(n, e) {
  n.uniform1uiv(this.addr, e);
}
function XO(n, e) {
  n.uniform2uiv(this.addr, e);
}
function YO(n, e) {
  n.uniform3uiv(this.addr, e);
}
function JO(n, e) {
  n.uniform4uiv(this.addr, e);
}
function KO(n, e, t) {
  const i = e.length, r = gx(t, i);
  n.uniform1iv(this.addr, r);
  for (let s = 0; s !== i; ++s)
    t.safeSetTexture2D(e[s] || px, r[s]);
}
function qO(n, e, t) {
  const i = e.length, r = gx(t, i);
  n.uniform1iv(this.addr, r);
  for (let s = 0; s !== i; ++s)
    t.safeSetTextureCube(e[s] || mx, r[s]);
}
function QO(n) {
  switch (n) {
    case 5126:
      return NO;
    case 35664:
      return BO;
    case 35665:
      return UO;
    case 35666:
      return zO;
    case 35674:
      return kO;
    case 35675:
      return VO;
    case 35676:
      return GO;
    case 5124:
    case 35670:
      return HO;
    case 35667:
    case 35671:
      return WO;
    case 35668:
    case 35672:
      return jO;
    case 35669:
    case 35673:
      return $O;
    case 5125:
      return ZO;
    case 36294:
      return XO;
    case 36295:
      return YO;
    case 36296:
      return JO;
    case 35678:
    case 36198:
    case 36298:
    case 36306:
    case 35682:
      return KO;
    case 35680:
    case 36300:
    case 36308:
    case 36293:
      return qO;
  }
}
function eD(n, e, t) {
  this.id = n, this.addr = t, this.cache = [], this.setValue = DO(e.type);
}
function vx(n, e, t) {
  this.id = n, this.addr = t, this.cache = [], this.size = e.size, this.setValue = QO(e.type);
}
vx.prototype.updateCache = function(n) {
  const e = this.cache;
  n instanceof Float32Array && e.length !== n.length && (this.cache = new Float32Array(n.length)), _n(e, n);
};
function yx(n) {
  this.id = n, this.seq = [], this.map = {};
}
yx.prototype.setValue = function(n, e, t) {
  const i = this.seq;
  for (let r = 0, s = i.length; r !== s; ++r) {
    const o = i[r];
    o.setValue(n, e[o.id], t);
  }
};
const mh = /(\w+)(\])?(\[|\.)?/g;
function lg(n, e) {
  n.seq.push(e), n.map[e.id] = e;
}
function tD(n, e, t) {
  const i = n.name, r = i.length;
  for (mh.lastIndex = 0; ; ) {
    const s = mh.exec(i), o = mh.lastIndex;
    let a = s[1];
    const c = s[2] === "]", l = s[3];
    if (c && (a = a | 0), l === void 0 || l === "[" && o + 2 === r) {
      lg(t, l === void 0 ? new eD(a, n, e) : new vx(a, n, e));
      break;
    } else {
      let h = t.map[a];
      h === void 0 && (h = new yx(a), lg(t, h)), t = h;
    }
  }
}
function Or(n, e) {
  this.seq = [], this.map = {};
  const t = n.getProgramParameter(e, 35718);
  for (let i = 0; i < t; ++i) {
    const r = n.getActiveUniform(e, i), s = n.getUniformLocation(e, r.name);
    tD(r, s, this);
  }
}
Or.prototype.setValue = function(n, e, t, i) {
  const r = this.map[e];
  r !== void 0 && r.setValue(n, t, i);
};
Or.prototype.setOptional = function(n, e, t) {
  const i = e[t];
  i !== void 0 && this.setValue(n, t, i);
};
Or.upload = function(n, e, t, i) {
  for (let r = 0, s = e.length; r !== s; ++r) {
    const o = e[r], a = t[o.id];
    a.needsUpdate !== !1 && o.setValue(n, a.value, i);
  }
};
Or.seqWithValue = function(n, e) {
  const t = [];
  for (let i = 0, r = n.length; i !== r; ++i) {
    const s = n[i];
    s.id in e && t.push(s);
  }
  return t;
};
function cg(n, e, t) {
  const i = n.createShader(e);
  return n.shaderSource(i, t), n.compileShader(i), i;
}
let nD = 0;
function iD(n) {
  const e = n.split(`
`);
  for (let t = 0; t < e.length; t++)
    e[t] = t + 1 + ": " + e[t];
  return e.join(`
`);
}
function bx(n) {
  switch (n) {
    case Cn:
      return ["Linear", "( value )"];
    case Cs:
      return ["sRGB", "( value )"];
    case mu:
      return ["RGBE", "( value )"];
    case Af:
      return ["RGBM", "( value, 7.0 )"];
    case Sf:
      return ["RGBM", "( value, 16.0 )"];
    case _f:
      return ["RGBD", "( value, 256.0 )"];
    case pu:
      return ["Gamma", "( value, float( GAMMA_FACTOR ) )"];
    case Yb:
      return ["LogLuv", "( value )"];
    default:
      return console.warn("THREE.WebGLProgram: Unsupported encoding:", n), ["Linear", "( value )"];
  }
}
function ug(n, e, t) {
  const i = n.getShaderParameter(e, 35713), r = n.getShaderInfoLog(e).trim();
  if (i && r === "") return "";
  const s = n.getShaderSource(e);
  return "THREE.WebGLShader: gl.getShaderInfoLog() " + t + `
` + r + iD(s);
}
function ma(n, e) {
  const t = bx(e);
  return "vec4 " + n + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }";
}
function rD(n, e) {
  const t = bx(e);
  return "vec4 " + n + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }";
}
function sD(n, e) {
  let t;
  switch (e) {
    case Zy:
      t = "Linear";
      break;
    case Xy:
      t = "Reinhard";
      break;
    case Yy:
      t = "OptimizedCineon";
      break;
    case Jy:
      t = "ACESFilmic";
      break;
    case Ky:
      t = "Custom";
      break;
    default:
      console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), t = "Linear";
  }
  return "vec3 " + n + "( vec3 color ) { return " + t + "ToneMapping( color ); }";
}
function oD(n) {
  return [
    n.extensionDerivatives || n.envMapCubeUV || n.bumpMap || n.tangentSpaceNormalMap || n.clearcoatNormalMap || n.flatShading || n.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "",
    (n.extensionFragDepth || n.logarithmicDepthBuffer) && n.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "",
    n.extensionDrawBuffers && n.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "",
    (n.extensionShaderTextureLOD || n.envMap || n.transmission > 0) && n.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : ""
  ].filter(Ta).join(`
`);
}
function aD(n) {
  const e = [];
  for (const t in n) {
    const i = n[t];
    i !== !1 && e.push("#define " + t + " " + i);
  }
  return e.join(`
`);
}
function lD(n, e) {
  const t = {}, i = n.getProgramParameter(e, 35721);
  for (let r = 0; r < i; r++) {
    const o = n.getActiveAttrib(e, r).name;
    t[o] = n.getAttribLocation(e, o);
  }
  return t;
}
function Ta(n) {
  return n !== "";
}
function hg(n, e) {
  return n.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows);
}
function dg(n, e) {
  return n.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);
}
const cD = /^[ \t]*#include +<([\w\d./]+)>/gm;
function Md(n) {
  return n.replace(cD, uD);
}
function uD(n, e) {
  const t = dt[e];
  if (t === void 0)
    throw new Error("Can not resolve #include <" + e + ">");
  return Md(t);
}
const hD = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, dD = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
function fg(n) {
  return n.replace(dD, xx).replace(hD, fD);
}
function fD(n, e, t, i) {
  return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), xx(n, e, t, i);
}
function xx(n, e, t, i) {
  let r = "";
  for (let s = parseInt(e); s < parseInt(t); s++)
    r += i.replace(/\[\s*i\s*\]/g, "[ " + s + " ]").replace(/UNROLLED_LOOP_INDEX/g, s);
  return r;
}
function pg(n) {
  let e = "precision " + n.precision + ` float;
precision ` + n.precision + " int;";
  return n.precision === "highp" ? e += `
#define HIGH_PRECISION` : n.precision === "mediump" ? e += `
#define MEDIUM_PRECISION` : n.precision === "lowp" && (e += `
#define LOW_PRECISION`), e;
}
function pD(n) {
  let e = "SHADOWMAP_TYPE_BASIC";
  return n.shadowMapType === vf ? e = "SHADOWMAP_TYPE_PCF" : n.shadowMapType === _y ? e = "SHADOWMAP_TYPE_PCF_SOFT" : n.shadowMapType === po && (e = "SHADOWMAP_TYPE_VSM"), e;
}
function mD(n) {
  let e = "ENVMAP_TYPE_CUBE";
  if (n.envMap)
    switch (n.envMapMode) {
      case ll:
      case cl:
        e = "ENVMAP_TYPE_CUBE";
        break;
      case ea:
      case ul:
        e = "ENVMAP_TYPE_CUBE_UV";
        break;
    }
  return e;
}
function gD(n) {
  let e = "ENVMAP_MODE_REFLECTION";
  if (n.envMap)
    switch (n.envMapMode) {
      case cl:
      case ul:
        e = "ENVMAP_MODE_REFRACTION";
        break;
    }
  return e;
}
function vD(n) {
  let e = "ENVMAP_BLENDING_NONE";
  if (n.envMap)
    switch (n.combine) {
      case al:
        e = "ENVMAP_BLENDING_MULTIPLY";
        break;
      case jy:
        e = "ENVMAP_BLENDING_MIX";
        break;
      case $y:
        e = "ENVMAP_BLENDING_ADD";
        break;
    }
  return e;
}
function yD(n, e, t, i) {
  const r = n.getContext(), s = t.defines;
  let o = t.vertexShader, a = t.fragmentShader;
  const c = pD(t), l = mD(t), d = gD(t), h = vD(t), f = n.gammaFactor > 0 ? n.gammaFactor : 1, g = t.isWebGL2 ? "" : oD(t), p = aD(s), u = r.createProgram();
  let y, v, m = t.glslVersion ? "#version " + t.glslVersion + `
` : "";
  t.isRawShaderMaterial ? (y = [
    p
  ].filter(Ta).join(`
`), y.length > 0 && (y += `
`), v = [
    g,
    p
  ].filter(Ta).join(`
`), v.length > 0 && (v += `
`)) : (y = [
    pg(t),
    "#define SHADER_NAME " + t.shaderName,
    p,
    t.instancing ? "#define USE_INSTANCING" : "",
    t.instancingColor ? "#define USE_INSTANCING_COLOR" : "",
    t.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "",
    "#define GAMMA_FACTOR " + f,
    "#define MAX_BONES " + t.maxBones,
    t.useFog && t.fog ? "#define USE_FOG" : "",
    t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "",
    t.map ? "#define USE_MAP" : "",
    t.envMap ? "#define USE_ENVMAP" : "",
    t.envMap ? "#define " + d : "",
    t.lightMap ? "#define USE_LIGHTMAP" : "",
    t.aoMap ? "#define USE_AOMAP" : "",
    t.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
    t.bumpMap ? "#define USE_BUMPMAP" : "",
    t.normalMap ? "#define USE_NORMALMAP" : "",
    t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "",
    t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "",
    t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "",
    t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "",
    t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "",
    t.displacementMap && t.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "",
    t.specularMap ? "#define USE_SPECULARMAP" : "",
    t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "",
    t.metalnessMap ? "#define USE_METALNESSMAP" : "",
    t.alphaMap ? "#define USE_ALPHAMAP" : "",
    t.transmission ? "#define USE_TRANSMISSION" : "",
    t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "",
    t.thicknessMap ? "#define USE_THICKNESSMAP" : "",
    t.vertexTangents ? "#define USE_TANGENT" : "",
    t.vertexColors ? "#define USE_COLOR" : "",
    t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
    t.vertexUvs ? "#define USE_UV" : "",
    t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "",
    t.flatShading ? "#define FLAT_SHADED" : "",
    t.skinning ? "#define USE_SKINNING" : "",
    t.useVertexTexture ? "#define BONE_TEXTURE" : "",
    t.morphTargets ? "#define USE_MORPHTARGETS" : "",
    t.morphNormals && t.flatShading === !1 ? "#define USE_MORPHNORMALS" : "",
    t.doubleSided ? "#define DOUBLE_SIDED" : "",
    t.flipSided ? "#define FLIP_SIDED" : "",
    t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "",
    t.shadowMapEnabled ? "#define " + c : "",
    t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "",
    t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "",
    t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "",
    "uniform mat4 modelMatrix;",
    "uniform mat4 modelViewMatrix;",
    "uniform mat4 projectionMatrix;",
    "uniform mat4 viewMatrix;",
    "uniform mat3 normalMatrix;",
    "uniform vec3 cameraPosition;",
    "uniform bool isOrthographic;",
    "#ifdef USE_INSTANCING",
    "	attribute mat4 instanceMatrix;",
    "#endif",
    "#ifdef USE_INSTANCING_COLOR",
    "	attribute vec3 instanceColor;",
    "#endif",
    "attribute vec3 position;",
    "attribute vec3 normal;",
    "attribute vec2 uv;",
    "#ifdef USE_TANGENT",
    "	attribute vec4 tangent;",
    "#endif",
    "#if defined( USE_COLOR_ALPHA )",
    "	attribute vec4 color;",
    "#elif defined( USE_COLOR )",
    "	attribute vec3 color;",
    "#endif",
    "#ifdef USE_MORPHTARGETS",
    "	attribute vec3 morphTarget0;",
    "	attribute vec3 morphTarget1;",
    "	attribute vec3 morphTarget2;",
    "	attribute vec3 morphTarget3;",
    "	#ifdef USE_MORPHNORMALS",
    "		attribute vec3 morphNormal0;",
    "		attribute vec3 morphNormal1;",
    "		attribute vec3 morphNormal2;",
    "		attribute vec3 morphNormal3;",
    "	#else",
    "		attribute vec3 morphTarget4;",
    "		attribute vec3 morphTarget5;",
    "		attribute vec3 morphTarget6;",
    "		attribute vec3 morphTarget7;",
    "	#endif",
    "#endif",
    "#ifdef USE_SKINNING",
    "	attribute vec4 skinIndex;",
    "	attribute vec4 skinWeight;",
    "#endif",
    `
`
  ].filter(Ta).join(`
`), v = [
    g,
    pg(t),
    "#define SHADER_NAME " + t.shaderName,
    p,
    t.alphaTest ? "#define ALPHATEST " + t.alphaTest + (t.alphaTest % 1 ? "" : ".0") : "",
    // add '.0' if integer
    "#define GAMMA_FACTOR " + f,
    t.useFog && t.fog ? "#define USE_FOG" : "",
    t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "",
    t.map ? "#define USE_MAP" : "",
    t.matcap ? "#define USE_MATCAP" : "",
    t.envMap ? "#define USE_ENVMAP" : "",
    t.envMap ? "#define " + l : "",
    t.envMap ? "#define " + d : "",
    t.envMap ? "#define " + h : "",
    t.lightMap ? "#define USE_LIGHTMAP" : "",
    t.aoMap ? "#define USE_AOMAP" : "",
    t.emissiveMap ? "#define USE_EMISSIVEMAP" : "",
    t.bumpMap ? "#define USE_BUMPMAP" : "",
    t.normalMap ? "#define USE_NORMALMAP" : "",
    t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "",
    t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "",
    t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "",
    t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "",
    t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "",
    t.specularMap ? "#define USE_SPECULARMAP" : "",
    t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "",
    t.metalnessMap ? "#define USE_METALNESSMAP" : "",
    t.alphaMap ? "#define USE_ALPHAMAP" : "",
    t.sheen ? "#define USE_SHEEN" : "",
    t.transmission ? "#define USE_TRANSMISSION" : "",
    t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "",
    t.thicknessMap ? "#define USE_THICKNESSMAP" : "",
    t.vertexTangents ? "#define USE_TANGENT" : "",
    t.vertexColors || t.instancingColor ? "#define USE_COLOR" : "",
    t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "",
    t.vertexUvs ? "#define USE_UV" : "",
    t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "",
    t.gradientMap ? "#define USE_GRADIENTMAP" : "",
    t.flatShading ? "#define FLAT_SHADED" : "",
    t.doubleSided ? "#define DOUBLE_SIDED" : "",
    t.flipSided ? "#define FLIP_SIDED" : "",
    t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "",
    t.shadowMapEnabled ? "#define " + c : "",
    t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "",
    t.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "",
    t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "",
    t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "",
    (t.extensionShaderTextureLOD || t.envMap) && t.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "",
    "uniform mat4 viewMatrix;",
    "uniform vec3 cameraPosition;",
    "uniform bool isOrthographic;",
    t.toneMapping !== Ir ? "#define TONE_MAPPING" : "",
    t.toneMapping !== Ir ? dt.tonemapping_pars_fragment : "",
    // this code is required here because it is used by the toneMapping() function defined below
    t.toneMapping !== Ir ? sD("toneMapping", t.toneMapping) : "",
    t.dithering ? "#define DITHERING" : "",
    dt.encodings_pars_fragment,
    // this code is required here because it is used by the various encoding/decoding function defined below
    t.map ? ma("mapTexelToLinear", t.mapEncoding) : "",
    t.matcap ? ma("matcapTexelToLinear", t.matcapEncoding) : "",
    t.envMap ? ma("envMapTexelToLinear", t.envMapEncoding) : "",
    t.emissiveMap ? ma("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "",
    t.lightMap ? ma("lightMapTexelToLinear", t.lightMapEncoding) : "",
    rD("linearToOutputTexel", t.outputEncoding),
    t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "",
    `
`
  ].filter(Ta).join(`
`)), o = Md(o), o = hg(o, t), o = dg(o, t), a = Md(a), a = hg(a, t), a = dg(a, t), o = fg(o), a = fg(a), t.isWebGL2 && t.isRawShaderMaterial !== !0 && (m = `#version 300 es
`, y = [
    "#define attribute in",
    "#define varying out",
    "#define texture2D texture"
  ].join(`
`) + `
` + y, v = [
    "#define varying in",
    t.glslVersion === yd ? "" : "out highp vec4 pc_fragColor;",
    t.glslVersion === yd ? "" : "#define gl_FragColor pc_fragColor",
    "#define gl_FragDepthEXT gl_FragDepth",
    "#define texture2D texture",
    "#define textureCube texture",
    "#define texture2DProj textureProj",
    "#define texture2DLodEXT textureLod",
    "#define texture2DProjLodEXT textureProjLod",
    "#define textureCubeLodEXT textureLod",
    "#define texture2DGradEXT textureGrad",
    "#define texture2DProjGradEXT textureProjGrad",
    "#define textureCubeGradEXT textureGrad"
  ].join(`
`) + `
` + v);
  const x = m + y + o, w = m + v + a, A = cg(r, 35633, x), M = cg(r, 35632, w);
  if (r.attachShader(u, A), r.attachShader(u, M), t.index0AttributeName !== void 0 ? r.bindAttribLocation(u, 0, t.index0AttributeName) : t.morphTargets === !0 && r.bindAttribLocation(u, 0, "position"), r.linkProgram(u), n.debug.checkShaderErrors) {
    const _ = r.getProgramInfoLog(u).trim(), F = r.getShaderInfoLog(A).trim(), S = r.getShaderInfoLog(M).trim();
    let T = !0, E = !0;
    if (r.getProgramParameter(u, 35714) === !1) {
      T = !1;
      const C = ug(r, A, "vertex"), P = ug(r, M, "fragment");
      console.error("THREE.WebGLProgram: shader error: ", r.getError(), "35715", r.getProgramParameter(u, 35715), "gl.getProgramInfoLog", _, C, P);
    } else _ !== "" ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", _) : (F === "" || S === "") && (E = !1);
    E && (this.diagnostics = {
      runnable: T,
      programLog: _,
      vertexShader: {
        log: F,
        prefix: y
      },
      fragmentShader: {
        log: S,
        prefix: v
      }
    });
  }
  r.deleteShader(A), r.deleteShader(M);
  let R;
  this.getUniforms = function() {
    return R === void 0 && (R = new Or(r, u)), R;
  };
  let L;
  return this.getAttributes = function() {
    return L === void 0 && (L = lD(r, u)), L;
  }, this.destroy = function() {
    i.releaseStatesOfProgram(this), r.deleteProgram(u), this.program = void 0;
  }, this.name = t.shaderName, this.id = nD++, this.cacheKey = e, this.usedTimes = 1, this.program = u, this.vertexShader = A, this.fragmentShader = M, this;
}
function bD(n, e, t, i, r, s) {
  const o = [], a = i.isWebGL2, c = i.logarithmicDepthBuffer, l = i.floatVertexTextures, d = i.maxVertexUniforms, h = i.vertexTextures;
  let f = i.precision;
  const g = {
    MeshDepthMaterial: "depth",
    MeshDistanceMaterial: "distanceRGBA",
    MeshNormalMaterial: "normal",
    MeshBasicMaterial: "basic",
    MeshLambertMaterial: "lambert",
    MeshPhongMaterial: "phong",
    MeshToonMaterial: "toon",
    MeshStandardMaterial: "physical",
    MeshPhysicalMaterial: "physical",
    MeshMatcapMaterial: "matcap",
    LineBasicMaterial: "basic",
    LineDashedMaterial: "dashed",
    PointsMaterial: "points",
    ShadowMaterial: "shadow",
    SpriteMaterial: "sprite"
  }, p = [
    "precision",
    "isWebGL2",
    "supportsVertexTextures",
    "outputEncoding",
    "instancing",
    "instancingColor",
    "map",
    "mapEncoding",
    "matcap",
    "matcapEncoding",
    "envMap",
    "envMapMode",
    "envMapEncoding",
    "envMapCubeUV",
    "lightMap",
    "lightMapEncoding",
    "aoMap",
    "emissiveMap",
    "emissiveMapEncoding",
    "bumpMap",
    "normalMap",
    "objectSpaceNormalMap",
    "tangentSpaceNormalMap",
    "clearcoatMap",
    "clearcoatRoughnessMap",
    "clearcoatNormalMap",
    "displacementMap",
    "specularMap",
    "roughnessMap",
    "metalnessMap",
    "gradientMap",
    "alphaMap",
    "combine",
    "vertexColors",
    "vertexAlphas",
    "vertexTangents",
    "vertexUvs",
    "uvsVertexOnly",
    "fog",
    "useFog",
    "fogExp2",
    "flatShading",
    "sizeAttenuation",
    "logarithmicDepthBuffer",
    "skinning",
    "maxBones",
    "useVertexTexture",
    "morphTargets",
    "morphNormals",
    "premultipliedAlpha",
    "numDirLights",
    "numPointLights",
    "numSpotLights",
    "numHemiLights",
    "numRectAreaLights",
    "numDirLightShadows",
    "numPointLightShadows",
    "numSpotLightShadows",
    "shadowMapEnabled",
    "shadowMapType",
    "toneMapping",
    "physicallyCorrectLights",
    "alphaTest",
    "doubleSided",
    "flipSided",
    "numClippingPlanes",
    "numClipIntersection",
    "depthPacking",
    "dithering",
    "sheen",
    "transmission",
    "transmissionMap",
    "thicknessMap"
  ];
  function u(M) {
    const L = M.skeleton.bones;
    if (l)
      return 1024;
    {
      const F = Math.floor((d - 20) / 4), S = Math.min(F, L.length);
      return S < L.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + L.length + " bones. This GPU supports " + S + "."), 0) : S;
    }
  }
  function y(M) {
    let R;
    return M && M.isTexture ? R = M.encoding : M && M.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), R = M.texture.encoding) : R = Cn, R;
  }
  function v(M, R, L, _, F) {
    const S = _.fog, T = M.isMeshStandardMaterial ? _.environment : null, E = e.get(M.envMap || T), C = g[M.type], P = F.isSkinnedMesh ? u(F) : 0;
    M.precision !== null && (f = i.getMaxPrecision(M.precision), f !== M.precision && console.warn("THREE.WebGLProgram.getParameters:", M.precision, "not supported, using", f, "instead."));
    let b, I;
    if (C) {
      const U = ci[C];
      b = U.vertexShader, I = U.fragmentShader;
    } else
      b = M.vertexShader, I = M.fragmentShader;
    const D = n.getRenderTarget();
    return {
      isWebGL2: a,
      shaderID: C,
      shaderName: M.type,
      vertexShader: b,
      fragmentShader: I,
      defines: M.defines,
      isRawShaderMaterial: M.isRawShaderMaterial === !0,
      glslVersion: M.glslVersion,
      precision: f,
      instancing: F.isInstancedMesh === !0,
      instancingColor: F.isInstancedMesh === !0 && F.instanceColor !== null,
      supportsVertexTextures: h,
      outputEncoding: D !== null ? y(D.texture) : n.outputEncoding,
      map: !!M.map,
      mapEncoding: y(M.map),
      matcap: !!M.matcap,
      matcapEncoding: y(M.matcap),
      envMap: !!E,
      envMapMode: E && E.mapping,
      envMapEncoding: y(E),
      envMapCubeUV: !!E && (E.mapping === ea || E.mapping === ul),
      lightMap: !!M.lightMap,
      lightMapEncoding: y(M.lightMap),
      aoMap: !!M.aoMap,
      emissiveMap: !!M.emissiveMap,
      emissiveMapEncoding: y(M.emissiveMap),
      bumpMap: !!M.bumpMap,
      normalMap: !!M.normalMap,
      objectSpaceNormalMap: M.normalMapType === qb,
      tangentSpaceNormalMap: M.normalMapType === Jr,
      clearcoatMap: !!M.clearcoatMap,
      clearcoatRoughnessMap: !!M.clearcoatRoughnessMap,
      clearcoatNormalMap: !!M.clearcoatNormalMap,
      displacementMap: !!M.displacementMap,
      roughnessMap: !!M.roughnessMap,
      metalnessMap: !!M.metalnessMap,
      specularMap: !!M.specularMap,
      alphaMap: !!M.alphaMap,
      gradientMap: !!M.gradientMap,
      sheen: !!M.sheen,
      transmission: !!M.transmission,
      transmissionMap: !!M.transmissionMap,
      thicknessMap: !!M.thicknessMap,
      combine: M.combine,
      vertexTangents: M.normalMap && M.vertexTangents,
      vertexColors: M.vertexColors,
      vertexAlphas: M.vertexColors === !0 && F.geometry && F.geometry.attributes.color && F.geometry.attributes.color.itemSize === 4,
      vertexUvs: !!M.map || !!M.bumpMap || !!M.normalMap || !!M.specularMap || !!M.alphaMap || !!M.emissiveMap || !!M.roughnessMap || !!M.metalnessMap || !!M.clearcoatMap || !!M.clearcoatRoughnessMap || !!M.clearcoatNormalMap || !!M.displacementMap || !!M.transmissionMap || !!M.thicknessMap,
      uvsVertexOnly: !(M.map || M.bumpMap || M.normalMap || M.specularMap || M.alphaMap || M.emissiveMap || M.roughnessMap || M.metalnessMap || M.clearcoatNormalMap || M.transmission || M.transmissionMap || M.thicknessMap) && !!M.displacementMap,
      fog: !!S,
      useFog: M.fog,
      fogExp2: S && S.isFogExp2,
      flatShading: !!M.flatShading,
      sizeAttenuation: M.sizeAttenuation,
      logarithmicDepthBuffer: c,
      skinning: F.isSkinnedMesh === !0 && P > 0,
      maxBones: P,
      useVertexTexture: l,
      morphTargets: M.morphTargets,
      morphNormals: M.morphNormals,
      numDirLights: R.directional.length,
      numPointLights: R.point.length,
      numSpotLights: R.spot.length,
      numRectAreaLights: R.rectArea.length,
      numHemiLights: R.hemi.length,
      numDirLightShadows: R.directionalShadowMap.length,
      numPointLightShadows: R.pointShadowMap.length,
      numSpotLightShadows: R.spotShadowMap.length,
      numClippingPlanes: s.numPlanes,
      numClipIntersection: s.numIntersection,
      dithering: M.dithering,
      shadowMapEnabled: n.shadowMap.enabled && L.length > 0,
      shadowMapType: n.shadowMap.type,
      toneMapping: M.toneMapped ? n.toneMapping : Ir,
      physicallyCorrectLights: n.physicallyCorrectLights,
      premultipliedAlpha: M.premultipliedAlpha,
      alphaTest: M.alphaTest,
      doubleSided: M.side === Wr,
      flipSided: M.side === jt,
      depthPacking: M.depthPacking !== void 0 ? M.depthPacking : !1,
      index0AttributeName: M.index0AttributeName,
      extensionDerivatives: M.extensions && M.extensions.derivatives,
      extensionFragDepth: M.extensions && M.extensions.fragDepth,
      extensionDrawBuffers: M.extensions && M.extensions.drawBuffers,
      extensionShaderTextureLOD: M.extensions && M.extensions.shaderTextureLOD,
      rendererExtensionFragDepth: a || t.has("EXT_frag_depth"),
      rendererExtensionDrawBuffers: a || t.has("WEBGL_draw_buffers"),
      rendererExtensionShaderTextureLod: a || t.has("EXT_shader_texture_lod"),
      customProgramCacheKey: M.customProgramCacheKey()
    };
  }
  function m(M) {
    const R = [];
    if (M.shaderID ? R.push(M.shaderID) : (R.push(M.fragmentShader), R.push(M.vertexShader)), M.defines !== void 0)
      for (const L in M.defines)
        R.push(L), R.push(M.defines[L]);
    if (M.isRawShaderMaterial === !1) {
      for (let L = 0; L < p.length; L++)
        R.push(M[p[L]]);
      R.push(n.outputEncoding), R.push(n.gammaFactor);
    }
    return R.push(M.customProgramCacheKey), R.join();
  }
  function x(M) {
    const R = g[M.type];
    let L;
    if (R) {
      const _ = ci[R];
      L = dx.clone(_.uniforms);
    } else
      L = M.uniforms;
    return L;
  }
  function w(M, R) {
    let L;
    for (let _ = 0, F = o.length; _ < F; _++) {
      const S = o[_];
      if (S.cacheKey === R) {
        L = S, ++L.usedTimes;
        break;
      }
    }
    return L === void 0 && (L = new yD(n, R, M, r), o.push(L)), L;
  }
  function A(M) {
    if (--M.usedTimes === 0) {
      const R = o.indexOf(M);
      o[R] = o[o.length - 1], o.pop(), M.destroy();
    }
  }
  return {
    getParameters: v,
    getProgramCacheKey: m,
    getUniforms: x,
    acquireProgram: w,
    releaseProgram: A,
    // Exposed for resource monitoring & error feedback via renderer.info:
    programs: o
  };
}
function xD() {
  let n = /* @__PURE__ */ new WeakMap();
  function e(s) {
    let o = n.get(s);
    return o === void 0 && (o = {}, n.set(s, o)), o;
  }
  function t(s) {
    n.delete(s);
  }
  function i(s, o, a) {
    n.get(s)[o] = a;
  }
  function r() {
    n = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: e,
    remove: t,
    update: i,
    dispose: r
  };
}
function MD(n, e) {
  return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.program !== e.program ? n.program.id - e.program.id : n.material.id !== e.material.id ? n.material.id - e.material.id : n.z !== e.z ? n.z - e.z : n.id - e.id;
}
function mg(n, e) {
  return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.z !== e.z ? e.z - n.z : n.id - e.id;
}
function gg(n) {
  const e = [];
  let t = 0;
  const i = [], r = [], s = [], o = { id: -1 };
  function a() {
    t = 0, i.length = 0, r.length = 0, s.length = 0;
  }
  function c(g, p, u, y, v, m) {
    let x = e[t];
    const w = n.get(u);
    return x === void 0 ? (x = {
      id: g.id,
      object: g,
      geometry: p,
      material: u,
      program: w.program || o,
      groupOrder: y,
      renderOrder: g.renderOrder,
      z: v,
      group: m
    }, e[t] = x) : (x.id = g.id, x.object = g, x.geometry = p, x.material = u, x.program = w.program || o, x.groupOrder = y, x.renderOrder = g.renderOrder, x.z = v, x.group = m), t++, x;
  }
  function l(g, p, u, y, v, m) {
    const x = c(g, p, u, y, v, m);
    u.transmission > 0 ? r.push(x) : u.transparent === !0 ? s.push(x) : i.push(x);
  }
  function d(g, p, u, y, v, m) {
    const x = c(g, p, u, y, v, m);
    u.transmission > 0 ? r.unshift(x) : u.transparent === !0 ? s.unshift(x) : i.unshift(x);
  }
  function h(g, p) {
    i.length > 1 && i.sort(g || MD), r.length > 1 && r.sort(p || mg), s.length > 1 && s.sort(p || mg);
  }
  function f() {
    for (let g = t, p = e.length; g < p; g++) {
      const u = e[g];
      if (u.id === null) break;
      u.id = null, u.object = null, u.geometry = null, u.material = null, u.program = null, u.group = null;
    }
  }
  return {
    opaque: i,
    transmissive: r,
    transparent: s,
    init: a,
    push: l,
    unshift: d,
    finish: f,
    sort: h
  };
}
function wD(n) {
  let e = /* @__PURE__ */ new WeakMap();
  function t(r, s) {
    let o;
    return e.has(r) === !1 ? (o = new gg(n), e.set(r, [o])) : s >= e.get(r).length ? (o = new gg(n), e.get(r).push(o)) : o = e.get(r)[s], o;
  }
  function i() {
    e = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: t,
    dispose: i
  };
}
function AD() {
  const n = {};
  return {
    get: function(e) {
      if (n[e.id] !== void 0)
        return n[e.id];
      let t;
      switch (e.type) {
        case "DirectionalLight":
          t = {
            direction: new Q(),
            color: new Ue()
          };
          break;
        case "SpotLight":
          t = {
            position: new Q(),
            direction: new Q(),
            color: new Ue(),
            distance: 0,
            coneCos: 0,
            penumbraCos: 0,
            decay: 0
          };
          break;
        case "PointLight":
          t = {
            position: new Q(),
            color: new Ue(),
            distance: 0,
            decay: 0
          };
          break;
        case "HemisphereLight":
          t = {
            direction: new Q(),
            skyColor: new Ue(),
            groundColor: new Ue()
          };
          break;
        case "RectAreaLight":
          t = {
            color: new Ue(),
            position: new Q(),
            halfWidth: new Q(),
            halfHeight: new Q()
          };
          break;
      }
      return n[e.id] = t, t;
    }
  };
}
function SD() {
  const n = {};
  return {
    get: function(e) {
      if (n[e.id] !== void 0)
        return n[e.id];
      let t;
      switch (e.type) {
        case "DirectionalLight":
          t = {
            shadowBias: 0,
            shadowNormalBias: 0,
            shadowRadius: 1,
            shadowMapSize: new Re()
          };
          break;
        case "SpotLight":
          t = {
            shadowBias: 0,
            shadowNormalBias: 0,
            shadowRadius: 1,
            shadowMapSize: new Re()
          };
          break;
        case "PointLight":
          t = {
            shadowBias: 0,
            shadowNormalBias: 0,
            shadowRadius: 1,
            shadowMapSize: new Re(),
            shadowCameraNear: 1,
            shadowCameraFar: 1e3
          };
          break;
      }
      return n[e.id] = t, t;
    }
  };
}
let _D = 0;
function TD(n, e) {
  return (e.castShadow ? 1 : 0) - (n.castShadow ? 1 : 0);
}
function ED(n, e) {
  const t = new AD(), i = SD(), r = {
    version: 0,
    hash: {
      directionalLength: -1,
      pointLength: -1,
      spotLength: -1,
      rectAreaLength: -1,
      hemiLength: -1,
      numDirectionalShadows: -1,
      numPointShadows: -1,
      numSpotShadows: -1
    },
    ambient: [0, 0, 0],
    probe: [],
    directional: [],
    directionalShadow: [],
    directionalShadowMap: [],
    directionalShadowMatrix: [],
    spot: [],
    spotShadow: [],
    spotShadowMap: [],
    spotShadowMatrix: [],
    rectArea: [],
    rectAreaLTC1: null,
    rectAreaLTC2: null,
    point: [],
    pointShadow: [],
    pointShadowMap: [],
    pointShadowMatrix: [],
    hemi: []
  };
  for (let d = 0; d < 9; d++) r.probe.push(new Q());
  const s = new Q(), o = new Xe(), a = new Xe();
  function c(d) {
    let h = 0, f = 0, g = 0;
    for (let R = 0; R < 9; R++) r.probe[R].set(0, 0, 0);
    let p = 0, u = 0, y = 0, v = 0, m = 0, x = 0, w = 0, A = 0;
    d.sort(TD);
    for (let R = 0, L = d.length; R < L; R++) {
      const _ = d[R], F = _.color, S = _.intensity, T = _.distance, E = _.shadow && _.shadow.map ? _.shadow.map.texture : null;
      if (_.isAmbientLight)
        h += F.r * S, f += F.g * S, g += F.b * S;
      else if (_.isLightProbe)
        for (let C = 0; C < 9; C++)
          r.probe[C].addScaledVector(_.sh.coefficients[C], S);
      else if (_.isDirectionalLight) {
        const C = t.get(_);
        if (C.color.copy(_.color).multiplyScalar(_.intensity), _.castShadow) {
          const P = _.shadow, b = i.get(_);
          b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, r.directionalShadow[p] = b, r.directionalShadowMap[p] = E, r.directionalShadowMatrix[p] = _.shadow.matrix, x++;
        }
        r.directional[p] = C, p++;
      } else if (_.isSpotLight) {
        const C = t.get(_);
        if (C.position.setFromMatrixPosition(_.matrixWorld), C.color.copy(F).multiplyScalar(S), C.distance = T, C.coneCos = Math.cos(_.angle), C.penumbraCos = Math.cos(_.angle * (1 - _.penumbra)), C.decay = _.decay, _.castShadow) {
          const P = _.shadow, b = i.get(_);
          b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, r.spotShadow[y] = b, r.spotShadowMap[y] = E, r.spotShadowMatrix[y] = _.shadow.matrix, A++;
        }
        r.spot[y] = C, y++;
      } else if (_.isRectAreaLight) {
        const C = t.get(_);
        C.color.copy(F).multiplyScalar(S), C.halfWidth.set(_.width * 0.5, 0, 0), C.halfHeight.set(0, _.height * 0.5, 0), r.rectArea[v] = C, v++;
      } else if (_.isPointLight) {
        const C = t.get(_);
        if (C.color.copy(_.color).multiplyScalar(_.intensity), C.distance = _.distance, C.decay = _.decay, _.castShadow) {
          const P = _.shadow, b = i.get(_);
          b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, b.shadowCameraNear = P.camera.near, b.shadowCameraFar = P.camera.far, r.pointShadow[u] = b, r.pointShadowMap[u] = E, r.pointShadowMatrix[u] = _.shadow.matrix, w++;
        }
        r.point[u] = C, u++;
      } else if (_.isHemisphereLight) {
        const C = t.get(_);
        C.skyColor.copy(_.color).multiplyScalar(S), C.groundColor.copy(_.groundColor).multiplyScalar(S), r.hemi[m] = C, m++;
      }
    }
    v > 0 && (e.isWebGL2 || n.has("OES_texture_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_FLOAT_1, r.rectAreaLTC2 = ze.LTC_FLOAT_2) : n.has("OES_texture_half_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_HALF_1, r.rectAreaLTC2 = ze.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), r.ambient[0] = h, r.ambient[1] = f, r.ambient[2] = g;
    const M = r.hash;
    (M.directionalLength !== p || M.pointLength !== u || M.spotLength !== y || M.rectAreaLength !== v || M.hemiLength !== m || M.numDirectionalShadows !== x || M.numPointShadows !== w || M.numSpotShadows !== A) && (r.directional.length = p, r.spot.length = y, r.rectArea.length = v, r.point.length = u, r.hemi.length = m, r.directionalShadow.length = x, r.directionalShadowMap.length = x, r.pointShadow.length = w, r.pointShadowMap.length = w, r.spotShadow.length = A, r.spotShadowMap.length = A, r.directionalShadowMatrix.length = x, r.pointShadowMatrix.length = w, r.spotShadowMatrix.length = A, M.directionalLength = p, M.pointLength = u, M.spotLength = y, M.rectAreaLength = v, M.hemiLength = m, M.numDirectionalShadows = x, M.numPointShadows = w, M.numSpotShadows = A, r.version = _D++);
  }
  function l(d, h) {
    let f = 0, g = 0, p = 0, u = 0, y = 0;
    const v = h.matrixWorldInverse;
    for (let m = 0, x = d.length; m < x; m++) {
      const w = d[m];
      if (w.isDirectionalLight) {
        const A = r.directional[f];
        A.direction.setFromMatrixPosition(w.matrixWorld), s.setFromMatrixPosition(w.target.matrixWorld), A.direction.sub(s), A.direction.transformDirection(v), f++;
      } else if (w.isSpotLight) {
        const A = r.spot[p];
        A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), A.direction.setFromMatrixPosition(w.matrixWorld), s.setFromMatrixPosition(w.target.matrixWorld), A.direction.sub(s), A.direction.transformDirection(v), p++;
      } else if (w.isRectAreaLight) {
        const A = r.rectArea[u];
        A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), a.identity(), o.copy(w.matrixWorld), o.premultiply(v), a.extractRotation(o), A.halfWidth.set(w.width * 0.5, 0, 0), A.halfHeight.set(0, w.height * 0.5, 0), A.halfWidth.applyMatrix4(a), A.halfHeight.applyMatrix4(a), u++;
      } else if (w.isPointLight) {
        const A = r.point[g];
        A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), g++;
      } else if (w.isHemisphereLight) {
        const A = r.hemi[y];
        A.direction.setFromMatrixPosition(w.matrixWorld), A.direction.transformDirection(v), A.direction.normalize(), y++;
      }
    }
  }
  return {
    setup: c,
    setupView: l,
    state: r
  };
}
function vg(n, e) {
  const t = new ED(n, e), i = [], r = [];
  function s() {
    i.length = 0, r.length = 0;
  }
  function o(h) {
    i.push(h);
  }
  function a(h) {
    r.push(h);
  }
  function c() {
    t.setup(i);
  }
  function l(h) {
    t.setupView(i, h);
  }
  return {
    init: s,
    state: {
      lightsArray: i,
      shadowsArray: r,
      lights: t
    },
    setupLights: c,
    setupLightsView: l,
    pushLight: o,
    pushShadow: a
  };
}
function CD(n, e) {
  let t = /* @__PURE__ */ new WeakMap();
  function i(s, o = 0) {
    let a;
    return t.has(s) === !1 ? (a = new vg(n, e), t.set(s, [a])) : o >= t.get(s).length ? (a = new vg(n, e), t.get(s).push(a)) : a = t.get(s)[o], a;
  }
  function r() {
    t = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: i,
    dispose: r
  };
}
class xu extends tn {
  constructor(e) {
    super(), this.type = "MeshDepthMaterial", this.depthPacking = Jb, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.depthPacking = e.depthPacking, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this;
  }
}
xu.prototype.isMeshDepthMaterial = !0;
class Mu extends tn {
  constructor(e) {
    super(), this.type = "MeshDistanceMaterial", this.referencePosition = new Q(), this.nearDistance = 1, this.farDistance = 1e3, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.referencePosition.copy(e.referencePosition), this.nearDistance = e.nearDistance, this.farDistance = e.farDistance, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this;
  }
}
Mu.prototype.isMeshDistanceMaterial = !0;
var LD = `uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	float mean = 0.0;
	float squared_mean = 0.0;
	float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
	for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean * HALF_SAMPLE_RATE;
	squared_mean = squared_mean * HALF_SAMPLE_RATE;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`, RD = `void main() {
	gl_Position = vec4( position, 1.0 );
}`;
function Mx(n, e, t) {
  let i = new dl();
  const r = new Re(), s = new Re(), o = new xt(), a = [], c = [], l = {}, d = t.maxTextureSize, h = { 0: jt, 1: Hr, 2: Wr }, f = new ar({
    defines: {
      SAMPLE_RATE: 2 / 8,
      HALF_SAMPLE_RATE: 1 / 8
    },
    uniforms: {
      shadow_pass: { value: null },
      resolution: { value: new Re() },
      radius: { value: 4 }
    },
    vertexShader: RD,
    fragmentShader: LD
  }), g = f.clone();
  g.defines.HORIZONTAL_PASS = 1;
  const p = new Ke();
  p.setAttribute(
    "position",
    new ot(
      new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]),
      3
    )
  );
  const u = new Xt(p, f), y = this;
  this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = vf, this.render = function(M, R, L) {
    if (y.enabled === !1 || y.autoUpdate === !1 && y.needsUpdate === !1 || M.length === 0) return;
    const _ = n.getRenderTarget(), F = n.getActiveCubeFace(), S = n.getActiveMipmapLevel(), T = n.state;
    T.setBlending(nr), T.buffers.color.setClear(1, 1, 1, 1), T.buffers.depth.setTest(!0), T.setScissorTest(!1);
    for (let E = 0, C = M.length; E < C; E++) {
      const P = M[E], b = P.shadow;
      if (b === void 0) {
        console.warn("THREE.WebGLShadowMap:", P, "has no shadow.");
        continue;
      }
      if (b.autoUpdate === !1 && b.needsUpdate === !1) continue;
      r.copy(b.mapSize);
      const I = b.getFrameExtents();
      if (r.multiply(I), s.copy(b.mapSize), (r.x > d || r.y > d) && (r.x > d && (s.x = Math.floor(d / I.x), r.x = s.x * I.x, b.mapSize.x = s.x), r.y > d && (s.y = Math.floor(d / I.y), r.y = s.y * I.y, b.mapSize.y = s.y)), b.map === null && !b.isPointLightShadow && this.type === po) {
        const N = { minFilter: zt, magFilter: zt, format: Hn };
        b.map = new fi(r.x, r.y, N), b.map.texture.name = P.name + ".shadowMap", b.mapPass = new fi(r.x, r.y, N), b.camera.updateProjectionMatrix();
      }
      if (b.map === null) {
        const N = { minFilter: $t, magFilter: $t, format: Hn };
        b.map = new fi(r.x, r.y, N), b.map.texture.name = P.name + ".shadowMap", b.camera.updateProjectionMatrix();
      }
      n.setRenderTarget(b.map), n.clear();
      const D = b.getViewportCount();
      for (let N = 0; N < D; N++) {
        const U = b.getViewport(N);
        o.set(
          s.x * U.x,
          s.y * U.y,
          s.x * U.z,
          s.y * U.w
        ), T.viewport(o), b.updateMatrices(P, N), i = b.getFrustum(), A(R, L, b.camera, P, this.type);
      }
      !b.isPointLightShadow && this.type === po && v(b, L), b.needsUpdate = !1;
    }
    y.needsUpdate = !1, n.setRenderTarget(_, F, S);
  };
  function v(M, R) {
    const L = e.update(u);
    f.uniforms.shadow_pass.value = M.map.texture, f.uniforms.resolution.value = M.mapSize, f.uniforms.radius.value = M.radius, n.setRenderTarget(M.mapPass), n.clear(), n.renderBufferDirect(R, null, L, f, u, null), g.uniforms.shadow_pass.value = M.mapPass.texture, g.uniforms.resolution.value = M.mapSize, g.uniforms.radius.value = M.radius, n.setRenderTarget(M.map), n.clear(), n.renderBufferDirect(R, null, L, g, u, null);
  }
  function m(M) {
    const R = M << 0;
    let L = a[R];
    return L === void 0 && (L = new xu({
      depthPacking: Kb,
      morphTargets: M
    }), a[R] = L), L;
  }
  function x(M) {
    const R = M << 0;
    let L = c[R];
    return L === void 0 && (L = new Mu({
      morphTargets: M
    }), c[R] = L), L;
  }
  function w(M, R, L, _, F, S, T) {
    let E = null, C = m, P = M.customDepthMaterial;
    if (_.isPointLight === !0 && (C = x, P = M.customDistanceMaterial), P === void 0) {
      let b = !1;
      L.morphTargets === !0 && (b = R.morphAttributes && R.morphAttributes.position && R.morphAttributes.position.length > 0), E = C(b);
    } else
      E = P;
    if (n.localClippingEnabled && L.clipShadows === !0 && L.clippingPlanes.length !== 0) {
      const b = E.uuid, I = L.uuid;
      let D = l[b];
      D === void 0 && (D = {}, l[b] = D);
      let N = D[I];
      N === void 0 && (N = E.clone(), D[I] = N), E = N;
    }
    return E.visible = L.visible, E.wireframe = L.wireframe, T === po ? E.side = L.shadowSide !== null ? L.shadowSide : L.side : E.side = L.shadowSide !== null ? L.shadowSide : h[L.side], E.clipShadows = L.clipShadows, E.clippingPlanes = L.clippingPlanes, E.clipIntersection = L.clipIntersection, E.wireframeLinewidth = L.wireframeLinewidth, E.linewidth = L.linewidth, _.isPointLight === !0 && E.isMeshDistanceMaterial === !0 && (E.referencePosition.setFromMatrixPosition(_.matrixWorld), E.nearDistance = F, E.farDistance = S), E;
  }
  function A(M, R, L, _, F) {
    if (M.visible === !1) return;
    if (M.layers.test(R.layers) && (M.isMesh || M.isLine || M.isPoints) && (M.castShadow || M.receiveShadow && F === po) && (!M.frustumCulled || i.intersectsObject(M))) {
      M.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse, M.matrixWorld);
      const E = e.update(M), C = M.material;
      if (Array.isArray(C)) {
        const P = E.groups;
        for (let b = 0, I = P.length; b < I; b++) {
          const D = P[b], N = C[D.materialIndex];
          if (N && N.visible) {
            const U = w(M, E, N, _, L.near, L.far, F);
            n.renderBufferDirect(L, null, E, U, M, D);
          }
        }
      } else if (C.visible) {
        const P = w(M, E, C, _, L.near, L.far, F);
        n.renderBufferDirect(L, null, E, P, M, null);
      }
    }
    const T = M.children;
    for (let E = 0, C = T.length; E < C; E++)
      A(T[E], R, L, _, F);
  }
}
function FD(n, e, t) {
  const i = t.isWebGL2;
  function r() {
    let re = !1;
    const me = new xt();
    let Me = null;
    const De = new xt(0, 0, 0, 0);
    return {
      setMask: function(Ie) {
        Me !== Ie && !re && (n.colorMask(Ie, Ie, Ie, Ie), Me = Ie);
      },
      setLocked: function(Ie) {
        re = Ie;
      },
      setClear: function(Ie, $e, lt, qe, Mt) {
        Mt === !0 && (Ie *= qe, $e *= qe, lt *= qe), me.set(Ie, $e, lt, qe), De.equals(me) === !1 && (n.clearColor(Ie, $e, lt, qe), De.copy(me));
      },
      reset: function() {
        re = !1, Me = null, De.set(-1, 0, 0, 0);
      }
    };
  }
  function s() {
    let re = !1, me = null, Me = null, De = null;
    return {
      setTest: function(Ie) {
        Ie ? j(2929) : te(2929);
      },
      setMask: function(Ie) {
        me !== Ie && !re && (n.depthMask(Ie), me = Ie);
      },
      setFunc: function(Ie) {
        if (Me !== Ie) {
          if (Ie)
            switch (Ie) {
              case Uy:
                n.depthFunc(512);
                break;
              case zy:
                n.depthFunc(519);
                break;
              case ky:
                n.depthFunc(513);
                break;
              case kc:
                n.depthFunc(515);
                break;
              case Vy:
                n.depthFunc(514);
                break;
              case Gy:
                n.depthFunc(518);
                break;
              case Hy:
                n.depthFunc(516);
                break;
              case Wy:
                n.depthFunc(517);
                break;
              default:
                n.depthFunc(515);
            }
          else
            n.depthFunc(515);
          Me = Ie;
        }
      },
      setLocked: function(Ie) {
        re = Ie;
      },
      setClear: function(Ie) {
        De !== Ie && (n.clearDepth(Ie), De = Ie);
      },
      reset: function() {
        re = !1, me = null, Me = null, De = null;
      }
    };
  }
  function o() {
    let re = !1, me = null, Me = null, De = null, Ie = null, $e = null, lt = null, qe = null, Mt = null;
    return {
      setTest: function(Be) {
        re || (Be ? j(2960) : te(2960));
      },
      setMask: function(Be) {
        me !== Be && !re && (n.stencilMask(Be), me = Be);
      },
      setFunc: function(Be, it, tt) {
        (Me !== Be || De !== it || Ie !== tt) && (n.stencilFunc(Be, it, tt), Me = Be, De = it, Ie = tt);
      },
      setOp: function(Be, it, tt) {
        ($e !== Be || lt !== it || qe !== tt) && (n.stencilOp(Be, it, tt), $e = Be, lt = it, qe = tt);
      },
      setLocked: function(Be) {
        re = Be;
      },
      setClear: function(Be) {
        Mt !== Be && (n.clearStencil(Be), Mt = Be);
      },
      reset: function() {
        re = !1, me = null, Me = null, De = null, Ie = null, $e = null, lt = null, qe = null, Mt = null;
      }
    };
  }
  const a = new r(), c = new s(), l = new o();
  let d = {}, h = null, f = {}, g = null, p = !1, u = null, y = null, v = null, m = null, x = null, w = null, A = null, M = !1, R = null, L = null, _ = null, F = null, S = null;
  const T = n.getParameter(35661);
  let E = !1, C = 0;
  const P = n.getParameter(7938);
  P.indexOf("WebGL") !== -1 ? (C = parseFloat(/^WebGL (\d)/.exec(P)[1]), E = C >= 1) : P.indexOf("OpenGL ES") !== -1 && (C = parseFloat(/^OpenGL ES (\d)/.exec(P)[1]), E = C >= 2);
  let b = null, I = {};
  const D = n.getParameter(3088), N = n.getParameter(2978), U = new xt().fromArray(D), B = new xt().fromArray(N);
  function G(re, me, Me) {
    const De = new Uint8Array(4), Ie = n.createTexture();
    n.bindTexture(re, Ie), n.texParameteri(re, 10241, 9728), n.texParameteri(re, 10240, 9728);
    for (let $e = 0; $e < Me; $e++)
      n.texImage2D(me + $e, 0, 6408, 1, 1, 0, 6408, 5121, De);
    return Ie;
  }
  const J = {};
  J[3553] = G(3553, 3553, 1), J[34067] = G(34067, 34069, 6), a.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), j(2929), c.setFunc(kc), W(!1), q(nd), j(2884), se(nr);
  function j(re) {
    d[re] !== !0 && (n.enable(re), d[re] = !0);
  }
  function te(re) {
    d[re] !== !1 && (n.disable(re), d[re] = !1);
  }
  function ee(re) {
    re !== h && (n.bindFramebuffer(36160, re), h = re);
  }
  function ae(re, me) {
    return me === null && h !== null && (me = h), f[re] !== me ? (n.bindFramebuffer(re, me), f[re] = me, i && (re === 36009 && (f[36160] = me), re === 36160 && (f[36009] = me)), !0) : !1;
  }
  function H(re) {
    return g !== re ? (n.useProgram(re), g = re, !0) : !1;
  }
  const Z = {
    [ps]: 32774,
    [Ey]: 32778,
    [Cy]: 32779
  };
  if (i)
    Z[od] = 32775, Z[ad] = 32776;
  else {
    const re = e.get("EXT_blend_minmax");
    re !== null && (Z[od] = re.MIN_EXT, Z[ad] = re.MAX_EXT);
  }
  const $ = {
    [Ly]: 0,
    [Ry]: 1,
    [Fy]: 768,
    [bf]: 770,
    [By]: 776,
    [Dy]: 774,
    [Iy]: 772,
    [Py]: 769,
    [xf]: 771,
    [Ny]: 775,
    [Oy]: 773
  };
  function se(re, me, Me, De, Ie, $e, lt, qe) {
    if (re === nr) {
      p === !0 && (te(3042), p = !1);
      return;
    }
    if (p === !1 && (j(3042), p = !0), re !== Ty) {
      if (re !== u || qe !== M) {
        if ((y !== ps || x !== ps) && (n.blendEquation(32774), y = ps, x = ps), qe)
          switch (re) {
            case vo:
              n.blendFuncSeparate(1, 771, 1, 771);
              break;
            case id:
              n.blendFunc(1, 1);
              break;
            case rd:
              n.blendFuncSeparate(0, 0, 769, 771);
              break;
            case sd:
              n.blendFuncSeparate(0, 768, 0, 770);
              break;
            default:
              console.error("THREE.WebGLState: Invalid blending: ", re);
              break;
          }
        else
          switch (re) {
            case vo:
              n.blendFuncSeparate(770, 771, 1, 771);
              break;
            case id:
              n.blendFunc(770, 1);
              break;
            case rd:
              n.blendFunc(0, 769);
              break;
            case sd:
              n.blendFunc(0, 768);
              break;
            default:
              console.error("THREE.WebGLState: Invalid blending: ", re);
              break;
          }
        v = null, m = null, w = null, A = null, u = re, M = qe;
      }
      return;
    }
    Ie = Ie || me, $e = $e || Me, lt = lt || De, (me !== y || Ie !== x) && (n.blendEquationSeparate(Z[me], Z[Ie]), y = me, x = Ie), (Me !== v || De !== m || $e !== w || lt !== A) && (n.blendFuncSeparate($[Me], $[De], $[$e], $[lt]), v = Me, m = De, w = $e, A = lt), u = re, M = null;
  }
  function k(re, me) {
    re.side === Wr ? te(2884) : j(2884);
    let Me = re.side === jt;
    me && (Me = !Me), W(Me), re.blending === vo && re.transparent === !1 ? se(nr) : se(re.blending, re.blendEquation, re.blendSrc, re.blendDst, re.blendEquationAlpha, re.blendSrcAlpha, re.blendDstAlpha, re.premultipliedAlpha), c.setFunc(re.depthFunc), c.setTest(re.depthTest), c.setMask(re.depthWrite), a.setMask(re.colorWrite);
    const De = re.stencilWrite;
    l.setTest(De), De && (l.setMask(re.stencilWriteMask), l.setFunc(re.stencilFunc, re.stencilRef, re.stencilFuncMask), l.setOp(re.stencilFail, re.stencilZFail, re.stencilZPass)), oe(re.polygonOffset, re.polygonOffsetFactor, re.polygonOffsetUnits), re.alphaToCoverage === !0 ? j(32926) : te(32926);
  }
  function W(re) {
    R !== re && (re ? n.frontFace(2304) : n.frontFace(2305), R = re);
  }
  function q(re) {
    re !== Ay ? (j(2884), re !== L && (re === nd ? n.cullFace(1029) : re === Sy ? n.cullFace(1028) : n.cullFace(1032))) : te(2884), L = re;
  }
  function ce(re) {
    re !== _ && (E && n.lineWidth(re), _ = re);
  }
  function oe(re, me, Me) {
    re ? (j(32823), (F !== me || S !== Me) && (n.polygonOffset(me, Me), F = me, S = Me)) : te(32823);
  }
  function V(re) {
    re ? j(3089) : te(3089);
  }
  function O(re) {
    re === void 0 && (re = 33984 + T - 1), b !== re && (n.activeTexture(re), b = re);
  }
  function X(re, me) {
    b === null && O();
    let Me = I[b];
    Me === void 0 && (Me = { type: void 0, texture: void 0 }, I[b] = Me), (Me.type !== re || Me.texture !== me) && (n.bindTexture(re, me || J[re]), Me.type = re, Me.texture = me);
  }
  function Y() {
    const re = I[b];
    re !== void 0 && re.type !== void 0 && (n.bindTexture(re.type, null), re.type = void 0, re.texture = void 0);
  }
  function ie() {
    try {
      n.compressedTexImage2D.apply(n, arguments);
    } catch (re) {
      console.error("THREE.WebGLState:", re);
    }
  }
  function fe() {
    try {
      n.texImage2D.apply(n, arguments);
    } catch (re) {
      console.error("THREE.WebGLState:", re);
    }
  }
  function be() {
    try {
      n.texImage3D.apply(n, arguments);
    } catch (re) {
      console.error("THREE.WebGLState:", re);
    }
  }
  function Ae(re) {
    U.equals(re) === !1 && (n.scissor(re.x, re.y, re.z, re.w), U.copy(re));
  }
  function he(re) {
    B.equals(re) === !1 && (n.viewport(re.x, re.y, re.z, re.w), B.copy(re));
  }
  function xe() {
    n.disable(3042), n.disable(2884), n.disable(2929), n.disable(32823), n.disable(3089), n.disable(2960), n.disable(32926), n.blendEquation(32774), n.blendFunc(1, 0), n.blendFuncSeparate(1, 0, 1, 0), n.colorMask(!0, !0, !0, !0), n.clearColor(0, 0, 0, 0), n.depthMask(!0), n.depthFunc(513), n.clearDepth(1), n.stencilMask(4294967295), n.stencilFunc(519, 0, 4294967295), n.stencilOp(7680, 7680, 7680), n.clearStencil(0), n.cullFace(1029), n.frontFace(2305), n.polygonOffset(0, 0), n.activeTexture(33984), n.bindFramebuffer(36160, null), i === !0 && (n.bindFramebuffer(36009, null), n.bindFramebuffer(36008, null)), n.useProgram(null), n.lineWidth(1), n.scissor(0, 0, n.canvas.width, n.canvas.height), n.viewport(0, 0, n.canvas.width, n.canvas.height), d = {}, b = null, I = {}, h = null, f = {}, g = null, p = !1, u = null, y = null, v = null, m = null, x = null, w = null, A = null, M = !1, R = null, L = null, _ = null, F = null, S = null, U.set(0, 0, n.canvas.width, n.canvas.height), B.set(0, 0, n.canvas.width, n.canvas.height), a.reset(), c.reset(), l.reset();
  }
  return {
    buffers: {
      color: a,
      depth: c,
      stencil: l
    },
    enable: j,
    disable: te,
    bindFramebuffer: ae,
    bindXRFramebuffer: ee,
    useProgram: H,
    setBlending: se,
    setMaterial: k,
    setFlipSided: W,
    setCullFace: q,
    setLineWidth: ce,
    setPolygonOffset: oe,
    setScissorTest: V,
    activeTexture: O,
    bindTexture: X,
    unbindTexture: Y,
    compressedTexImage2D: ie,
    texImage2D: fe,
    texImage3D: be,
    scissor: Ae,
    viewport: he,
    reset: xe
  };
}
function PD(n, e, t, i, r, s, o) {
  const a = r.isWebGL2, c = r.maxTextures, l = r.maxCubemapSize, d = r.maxTextureSize, h = r.maxSamples, f = /* @__PURE__ */ new WeakMap();
  let g, p = !1;
  try {
    p = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null;
  } catch {
  }
  function u(V, O) {
    return p ? new OffscreenCanvas(V, O) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  }
  function y(V, O, X, Y) {
    let ie = 1;
    if ((V.width > Y || V.height > Y) && (ie = Y / Math.max(V.width, V.height)), ie < 1 || O === !0)
      if (typeof HTMLImageElement < "u" && V instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && V instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && V instanceof ImageBitmap) {
        const fe = O ? tx : Math.floor, be = fe(ie * V.width), Ae = fe(ie * V.height);
        g === void 0 && (g = u(be, Ae));
        const he = X ? u(be, Ae) : g;
        return he.width = be, he.height = Ae, he.getContext("2d").drawImage(V, 0, 0, be, Ae), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + V.width + "x" + V.height + ") to (" + be + "x" + Ae + ")."), he;
      } else
        return "data" in V && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + V.width + "x" + V.height + ")."), V;
    return V;
  }
  function v(V) {
    return bd(V.width) && bd(V.height);
  }
  function m(V) {
    return a ? !1 : V.wrapS !== hn || V.wrapT !== hn || V.minFilter !== $t && V.minFilter !== zt;
  }
  function x(V, O) {
    return V.generateMipmaps && O && V.minFilter !== $t && V.minFilter !== zt;
  }
  function w(V, O, X, Y, ie = 1) {
    n.generateMipmap(V);
    const fe = i.get(O);
    fe.__maxMipLevel = Math.log2(Math.max(X, Y, ie));
  }
  function A(V, O, X) {
    if (a === !1) return O;
    if (V !== null) {
      if (n[V] !== void 0) return n[V];
      console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + V + "'");
    }
    let Y = O;
    return O === 6403 && (X === 5126 && (Y = 33326), X === 5131 && (Y = 33325), X === 5121 && (Y = 33321)), O === 6407 && (X === 5126 && (Y = 34837), X === 5131 && (Y = 34843), X === 5121 && (Y = 32849)), O === 6408 && (X === 5126 && (Y = 34836), X === 5131 && (Y = 34842), X === 5121 && (Y = 32856)), (Y === 33325 || Y === 33326 || Y === 34842 || Y === 34836) && e.get("EXT_color_buffer_float"), Y;
  }
  function M(V) {
    return V === $t || V === Va || V === Ga ? 9728 : 9729;
  }
  function R(V) {
    const O = V.target;
    O.removeEventListener("dispose", R), _(O), O.isVideoTexture && f.delete(O), o.memory.textures--;
  }
  function L(V) {
    const O = V.target;
    O.removeEventListener("dispose", L), F(O);
  }
  function _(V) {
    const O = i.get(V);
    O.__webglInit !== void 0 && (n.deleteTexture(O.__webglTexture), i.remove(V));
  }
  function F(V) {
    const O = V.texture, X = i.get(V), Y = i.get(O);
    if (V) {
      if (Y.__webglTexture !== void 0 && (n.deleteTexture(Y.__webglTexture), o.memory.textures--), V.depthTexture && V.depthTexture.dispose(), V.isWebGLCubeRenderTarget)
        for (let ie = 0; ie < 6; ie++)
          n.deleteFramebuffer(X.__webglFramebuffer[ie]), X.__webglDepthbuffer && n.deleteRenderbuffer(X.__webglDepthbuffer[ie]);
      else
        n.deleteFramebuffer(X.__webglFramebuffer), X.__webglDepthbuffer && n.deleteRenderbuffer(X.__webglDepthbuffer), X.__webglMultisampledFramebuffer && n.deleteFramebuffer(X.__webglMultisampledFramebuffer), X.__webglColorRenderbuffer && n.deleteRenderbuffer(X.__webglColorRenderbuffer), X.__webglDepthRenderbuffer && n.deleteRenderbuffer(X.__webglDepthRenderbuffer);
      if (V.isWebGLMultipleRenderTargets)
        for (let ie = 0, fe = O.length; ie < fe; ie++) {
          const be = i.get(O[ie]);
          be.__webglTexture && (n.deleteTexture(be.__webglTexture), o.memory.textures--), i.remove(O[ie]);
        }
      i.remove(O), i.remove(V);
    }
  }
  let S = 0;
  function T() {
    S = 0;
  }
  function E() {
    const V = S;
    return V >= c && console.warn("THREE.WebGLTextures: Trying to use " + V + " texture units while this GPU supports only " + c), S += 1, V;
  }
  function C(V, O) {
    const X = i.get(V);
    if (V.isVideoTexture && k(V), V.version > 0 && X.__version !== V.version) {
      const Y = V.image;
      if (Y === void 0)
        console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
      else if (Y.complete === !1)
        console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");
      else {
        G(X, V, O);
        return;
      }
    }
    t.activeTexture(33984 + O), t.bindTexture(3553, X.__webglTexture);
  }
  function P(V, O) {
    const X = i.get(V);
    if (V.version > 0 && X.__version !== V.version) {
      G(X, V, O);
      return;
    }
    t.activeTexture(33984 + O), t.bindTexture(35866, X.__webglTexture);
  }
  function b(V, O) {
    const X = i.get(V);
    if (V.version > 0 && X.__version !== V.version) {
      G(X, V, O);
      return;
    }
    t.activeTexture(33984 + O), t.bindTexture(32879, X.__webglTexture);
  }
  function I(V, O) {
    const X = i.get(V);
    if (V.version > 0 && X.__version !== V.version) {
      J(X, V, O);
      return;
    }
    t.activeTexture(33984 + O), t.bindTexture(34067, X.__webglTexture);
  }
  const D = {
    [jr]: 10497,
    [hn]: 33071,
    [Eo]: 33648
  }, N = {
    [$t]: 9728,
    [Va]: 9984,
    [Ga]: 9986,
    [zt]: 9729,
    [du]: 9985,
    [pr]: 9987
  };
  function U(V, O, X) {
    if (X ? (n.texParameteri(V, 10242, D[O.wrapS]), n.texParameteri(V, 10243, D[O.wrapT]), (V === 32879 || V === 35866) && n.texParameteri(V, 32882, D[O.wrapR]), n.texParameteri(V, 10240, N[O.magFilter]), n.texParameteri(V, 10241, N[O.minFilter])) : (n.texParameteri(V, 10242, 33071), n.texParameteri(V, 10243, 33071), (V === 32879 || V === 35866) && n.texParameteri(V, 32882, 33071), (O.wrapS !== hn || O.wrapT !== hn) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), n.texParameteri(V, 10240, M(O.magFilter)), n.texParameteri(V, 10241, M(O.minFilter)), O.minFilter !== $t && O.minFilter !== zt && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")), e.has("EXT_texture_filter_anisotropic") === !0) {
      const Y = e.get("EXT_texture_filter_anisotropic");
      if (O.type === Qi && e.has("OES_texture_float_linear") === !1 || a === !1 && O.type === Ms && e.has("OES_texture_half_float_linear") === !1) return;
      (O.anisotropy > 1 || i.get(O).__currentAnisotropy) && (n.texParameterf(V, Y.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(O.anisotropy, r.getMaxAnisotropy())), i.get(O).__currentAnisotropy = O.anisotropy);
    }
  }
  function B(V, O) {
    V.__webglInit === void 0 && (V.__webglInit = !0, O.addEventListener("dispose", R), V.__webglTexture = n.createTexture(), o.memory.textures++);
  }
  function G(V, O, X) {
    let Y = 3553;
    O.isDataTexture2DArray && (Y = 35866), O.isDataTexture3D && (Y = 32879), B(V, O), t.activeTexture(33984 + X), t.bindTexture(Y, V.__webglTexture), n.pixelStorei(37440, O.flipY), n.pixelStorei(37441, O.premultiplyAlpha), n.pixelStorei(3317, O.unpackAlignment), n.pixelStorei(37443, 0);
    const ie = m(O) && v(O.image) === !1, fe = y(O.image, ie, !1, d), be = v(fe) || a, Ae = s.convert(O.format);
    let he = s.convert(O.type), xe = A(O.internalFormat, Ae, he);
    U(Y, O, be);
    let re;
    const me = O.mipmaps;
    if (O.isDepthTexture)
      xe = 6402, a ? O.type === Qi ? xe = 36012 : O.type === Ra ? xe = 33190 : O.type === yo ? xe = 35056 : xe = 33189 : O.type === Qi && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), O.format === ws && xe === 6402 && O.type !== Ha && O.type !== Ra && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), O.type = Ha, he = s.convert(O.type)), O.format === Co && xe === 6402 && (xe = 34041, O.type !== yo && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), O.type = yo, he = s.convert(O.type))), t.texImage2D(3553, 0, xe, fe.width, fe.height, 0, Ae, he, null);
    else if (O.isDataTexture)
      if (me.length > 0 && be) {
        for (let Me = 0, De = me.length; Me < De; Me++)
          re = me[Me], t.texImage2D(3553, Me, xe, re.width, re.height, 0, Ae, he, re.data);
        O.generateMipmaps = !1, V.__maxMipLevel = me.length - 1;
      } else
        t.texImage2D(3553, 0, xe, fe.width, fe.height, 0, Ae, he, fe.data), V.__maxMipLevel = 0;
    else if (O.isCompressedTexture) {
      for (let Me = 0, De = me.length; Me < De; Me++)
        re = me[Me], O.format !== Hn && O.format !== ir ? Ae !== null ? t.compressedTexImage2D(3553, Me, xe, re.width, re.height, 0, re.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, Me, xe, re.width, re.height, 0, Ae, he, re.data);
      V.__maxMipLevel = me.length - 1;
    } else if (O.isDataTexture2DArray)
      t.texImage3D(35866, 0, xe, fe.width, fe.height, fe.depth, 0, Ae, he, fe.data), V.__maxMipLevel = 0;
    else if (O.isDataTexture3D)
      t.texImage3D(32879, 0, xe, fe.width, fe.height, fe.depth, 0, Ae, he, fe.data), V.__maxMipLevel = 0;
    else if (me.length > 0 && be) {
      for (let Me = 0, De = me.length; Me < De; Me++)
        re = me[Me], t.texImage2D(3553, Me, xe, Ae, he, re);
      O.generateMipmaps = !1, V.__maxMipLevel = me.length - 1;
    } else
      t.texImage2D(3553, 0, xe, Ae, he, fe), V.__maxMipLevel = 0;
    x(O, be) && w(Y, O, fe.width, fe.height), V.__version = O.version, O.onUpdate && O.onUpdate(O);
  }
  function J(V, O, X) {
    if (O.image.length !== 6) return;
    B(V, O), t.activeTexture(33984 + X), t.bindTexture(34067, V.__webglTexture), n.pixelStorei(37440, O.flipY), n.pixelStorei(37441, O.premultiplyAlpha), n.pixelStorei(3317, O.unpackAlignment), n.pixelStorei(37443, 0);
    const Y = O && (O.isCompressedTexture || O.image[0].isCompressedTexture), ie = O.image[0] && O.image[0].isDataTexture, fe = [];
    for (let Me = 0; Me < 6; Me++)
      !Y && !ie ? fe[Me] = y(O.image[Me], !1, !0, l) : fe[Me] = ie ? O.image[Me].image : O.image[Me];
    const be = fe[0], Ae = v(be) || a, he = s.convert(O.format), xe = s.convert(O.type), re = A(O.internalFormat, he, xe);
    U(34067, O, Ae);
    let me;
    if (Y) {
      for (let Me = 0; Me < 6; Me++) {
        me = fe[Me].mipmaps;
        for (let De = 0; De < me.length; De++) {
          const Ie = me[De];
          O.format !== Hn && O.format !== ir ? he !== null ? t.compressedTexImage2D(34069 + Me, De, re, Ie.width, Ie.height, 0, Ie.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + Me, De, re, Ie.width, Ie.height, 0, he, xe, Ie.data);
        }
      }
      V.__maxMipLevel = me.length - 1;
    } else {
      me = O.mipmaps;
      for (let Me = 0; Me < 6; Me++)
        if (ie) {
          t.texImage2D(34069 + Me, 0, re, fe[Me].width, fe[Me].height, 0, he, xe, fe[Me].data);
          for (let De = 0; De < me.length; De++) {
            const $e = me[De].image[Me].image;
            t.texImage2D(34069 + Me, De + 1, re, $e.width, $e.height, 0, he, xe, $e.data);
          }
        } else {
          t.texImage2D(34069 + Me, 0, re, he, xe, fe[Me]);
          for (let De = 0; De < me.length; De++) {
            const Ie = me[De];
            t.texImage2D(34069 + Me, De + 1, re, he, xe, Ie.image[Me]);
          }
        }
      V.__maxMipLevel = me.length;
    }
    x(O, Ae) && w(34067, O, be.width, be.height), V.__version = O.version, O.onUpdate && O.onUpdate(O);
  }
  function j(V, O, X, Y, ie) {
    const fe = s.convert(X.format), be = s.convert(X.type), Ae = A(X.internalFormat, fe, be);
    ie === 32879 || ie === 35866 ? t.texImage3D(ie, 0, Ae, O.width, O.height, O.depth, 0, fe, be, null) : t.texImage2D(ie, 0, Ae, O.width, O.height, 0, fe, be, null), t.bindFramebuffer(36160, V), n.framebufferTexture2D(36160, Y, ie, i.get(X).__webglTexture, 0), t.bindFramebuffer(36160, null);
  }
  function te(V, O, X) {
    if (n.bindRenderbuffer(36161, V), O.depthBuffer && !O.stencilBuffer) {
      let Y = 33189;
      if (X) {
        const ie = O.depthTexture;
        ie && ie.isDepthTexture && (ie.type === Qi ? Y = 36012 : ie.type === Ra && (Y = 33190));
        const fe = se(O);
        n.renderbufferStorageMultisample(36161, fe, Y, O.width, O.height);
      } else
        n.renderbufferStorage(36161, Y, O.width, O.height);
      n.framebufferRenderbuffer(36160, 36096, 36161, V);
    } else if (O.depthBuffer && O.stencilBuffer) {
      if (X) {
        const Y = se(O);
        n.renderbufferStorageMultisample(36161, Y, 35056, O.width, O.height);
      } else
        n.renderbufferStorage(36161, 34041, O.width, O.height);
      n.framebufferRenderbuffer(36160, 33306, 36161, V);
    } else {
      const Y = O.isWebGLMultipleRenderTargets === !0 ? O.texture[0] : O.texture, ie = s.convert(Y.format), fe = s.convert(Y.type), be = A(Y.internalFormat, ie, fe);
      if (X) {
        const Ae = se(O);
        n.renderbufferStorageMultisample(36161, Ae, be, O.width, O.height);
      } else
        n.renderbufferStorage(36161, be, O.width, O.height);
    }
    n.bindRenderbuffer(36161, null);
  }
  function ee(V, O) {
    if (O && O.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported");
    if (t.bindFramebuffer(36160, V), !(O.depthTexture && O.depthTexture.isDepthTexture))
      throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
    (!i.get(O.depthTexture).__webglTexture || O.depthTexture.image.width !== O.width || O.depthTexture.image.height !== O.height) && (O.depthTexture.image.width = O.width, O.depthTexture.image.height = O.height, O.depthTexture.needsUpdate = !0), C(O.depthTexture, 0);
    const Y = i.get(O.depthTexture).__webglTexture;
    if (O.depthTexture.format === ws)
      n.framebufferTexture2D(36160, 36096, 3553, Y, 0);
    else if (O.depthTexture.format === Co)
      n.framebufferTexture2D(36160, 33306, 3553, Y, 0);
    else
      throw new Error("Unknown depthTexture format");
  }
  function ae(V) {
    const O = i.get(V), X = V.isWebGLCubeRenderTarget === !0;
    if (V.depthTexture) {
      if (X) throw new Error("target.depthTexture not supported in Cube render targets");
      ee(O.__webglFramebuffer, V);
    } else if (X) {
      O.__webglDepthbuffer = [];
      for (let Y = 0; Y < 6; Y++)
        t.bindFramebuffer(36160, O.__webglFramebuffer[Y]), O.__webglDepthbuffer[Y] = n.createRenderbuffer(), te(O.__webglDepthbuffer[Y], V, !1);
    } else
      t.bindFramebuffer(36160, O.__webglFramebuffer), O.__webglDepthbuffer = n.createRenderbuffer(), te(O.__webglDepthbuffer, V, !1);
    t.bindFramebuffer(36160, null);
  }
  function H(V) {
    const O = V.texture, X = i.get(V), Y = i.get(O);
    V.addEventListener("dispose", L), V.isWebGLMultipleRenderTargets !== !0 && (Y.__webglTexture = n.createTexture(), Y.__version = O.version, o.memory.textures++);
    const ie = V.isWebGLCubeRenderTarget === !0, fe = V.isWebGLMultipleRenderTargets === !0, be = V.isWebGLMultisampleRenderTarget === !0, Ae = O.isDataTexture3D || O.isDataTexture2DArray, he = v(V) || a;
    if (a && O.format === ir && (O.type === Qi || O.type === Ms) && (O.format = Hn, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), ie) {
      X.__webglFramebuffer = [];
      for (let xe = 0; xe < 6; xe++)
        X.__webglFramebuffer[xe] = n.createFramebuffer();
    } else if (X.__webglFramebuffer = n.createFramebuffer(), fe)
      if (r.drawBuffers) {
        const xe = V.texture;
        for (let re = 0, me = xe.length; re < me; re++) {
          const Me = i.get(xe[re]);
          Me.__webglTexture === void 0 && (Me.__webglTexture = n.createTexture(), o.memory.textures++);
        }
      } else
        console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");
    else if (be)
      if (a) {
        X.__webglMultisampledFramebuffer = n.createFramebuffer(), X.__webglColorRenderbuffer = n.createRenderbuffer(), n.bindRenderbuffer(36161, X.__webglColorRenderbuffer);
        const xe = s.convert(O.format), re = s.convert(O.type), me = A(O.internalFormat, xe, re), Me = se(V);
        n.renderbufferStorageMultisample(36161, Me, me, V.width, V.height), t.bindFramebuffer(36160, X.__webglMultisampledFramebuffer), n.framebufferRenderbuffer(36160, 36064, 36161, X.__webglColorRenderbuffer), n.bindRenderbuffer(36161, null), V.depthBuffer && (X.__webglDepthRenderbuffer = n.createRenderbuffer(), te(X.__webglDepthRenderbuffer, V, !0)), t.bindFramebuffer(36160, null);
      } else
        console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");
    if (ie) {
      t.bindTexture(34067, Y.__webglTexture), U(34067, O, he);
      for (let xe = 0; xe < 6; xe++)
        j(X.__webglFramebuffer[xe], V, O, 36064, 34069 + xe);
      x(O, he) && w(34067, O, V.width, V.height), t.bindTexture(34067, null);
    } else if (fe) {
      const xe = V.texture;
      for (let re = 0, me = xe.length; re < me; re++) {
        const Me = xe[re], De = i.get(Me);
        t.bindTexture(3553, De.__webglTexture), U(3553, Me, he), j(X.__webglFramebuffer, V, Me, 36064 + re, 3553), x(Me, he) && w(3553, Me, V.width, V.height);
      }
      t.bindTexture(3553, null);
    } else {
      let xe = 3553;
      Ae && (a ? xe = O.isDataTexture3D ? 32879 : 35866 : console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")), t.bindTexture(xe, Y.__webglTexture), U(xe, O, he), j(X.__webglFramebuffer, V, O, 36064, xe), x(O, he) && w(xe, O, V.width, V.height, V.depth), t.bindTexture(xe, null);
    }
    V.depthBuffer && ae(V);
  }
  function Z(V) {
    const O = v(V) || a, X = V.isWebGLMultipleRenderTargets === !0 ? V.texture : [V.texture];
    for (let Y = 0, ie = X.length; Y < ie; Y++) {
      const fe = X[Y];
      if (x(fe, O)) {
        const be = V.isWebGLCubeRenderTarget ? 34067 : 3553, Ae = i.get(fe).__webglTexture;
        t.bindTexture(be, Ae), w(be, fe, V.width, V.height), t.bindTexture(be, null);
      }
    }
  }
  function $(V) {
    if (V.isWebGLMultisampleRenderTarget)
      if (a) {
        const O = V.width, X = V.height;
        let Y = 16384;
        V.depthBuffer && (Y |= 256), V.stencilBuffer && (Y |= 1024);
        const ie = i.get(V);
        t.bindFramebuffer(36008, ie.__webglMultisampledFramebuffer), t.bindFramebuffer(36009, ie.__webglFramebuffer), n.blitFramebuffer(0, 0, O, X, 0, 0, O, X, Y, 9728), t.bindFramebuffer(36008, null), t.bindFramebuffer(36009, ie.__webglMultisampledFramebuffer);
      } else
        console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");
  }
  function se(V) {
    return a && V.isWebGLMultisampleRenderTarget ? Math.min(h, V.samples) : 0;
  }
  function k(V) {
    const O = o.render.frame;
    f.get(V) !== O && (f.set(V, O), V.update());
  }
  let W = !1, q = !1;
  function ce(V, O) {
    V && V.isWebGLRenderTarget && (W === !1 && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), W = !0), V = V.texture), C(V, O);
  }
  function oe(V, O) {
    V && V.isWebGLCubeRenderTarget && (q === !1 && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), q = !0), V = V.texture), I(V, O);
  }
  this.allocateTextureUnit = E, this.resetTextureUnits = T, this.setTexture2D = C, this.setTexture2DArray = P, this.setTexture3D = b, this.setTextureCube = I, this.setupRenderTarget = H, this.updateRenderTargetMipmap = Z, this.updateMultisampleRenderTarget = $, this.safeSetTexture2D = ce, this.safeSetTextureCube = oe;
}
function wx(n, e, t) {
  const i = t.isWebGL2;
  function r(s) {
    let o;
    if (s === Ts) return 5121;
    if (s === tb) return 32819;
    if (s === nb) return 32820;
    if (s === ib) return 33635;
    if (s === qy) return 5120;
    if (s === Qy) return 5122;
    if (s === Ha) return 5123;
    if (s === eb) return 5124;
    if (s === Ra) return 5125;
    if (s === Qi) return 5126;
    if (s === Ms)
      return i ? 5131 : (o = e.get("OES_texture_half_float"), o !== null ? o.HALF_FLOAT_OES : null);
    if (s === rb) return 6406;
    if (s === ir) return 6407;
    if (s === Hn) return 6408;
    if (s === sb) return 6409;
    if (s === ob) return 6410;
    if (s === ws) return 6402;
    if (s === Co) return 34041;
    if (s === lb) return 6403;
    if (s === cb) return 36244;
    if (s === ub) return 33319;
    if (s === hb) return 33320;
    if (s === db) return 36248;
    if (s === fb) return 36249;
    if (s === ld || s === cd || s === ud || s === hd)
      if (o = e.get("WEBGL_compressed_texture_s3tc"), o !== null) {
        if (s === ld) return o.COMPRESSED_RGB_S3TC_DXT1_EXT;
        if (s === cd) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;
        if (s === ud) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;
        if (s === hd) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT;
      } else
        return null;
    if (s === dd || s === fd || s === pd || s === md)
      if (o = e.get("WEBGL_compressed_texture_pvrtc"), o !== null) {
        if (s === dd) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
        if (s === fd) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
        if (s === pd) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
        if (s === md) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
      } else
        return null;
    if (s === pb)
      return o = e.get("WEBGL_compressed_texture_etc1"), o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null;
    if ((s === gd || s === vd) && (o = e.get("WEBGL_compressed_texture_etc"), o !== null)) {
      if (s === gd) return o.COMPRESSED_RGB8_ETC2;
      if (s === vd) return o.COMPRESSED_RGBA8_ETC2_EAC;
    }
    if (s === mb || s === gb || s === vb || s === yb || s === bb || s === xb || s === Mb || s === wb || s === Ab || s === Sb || s === _b || s === Tb || s === Eb || s === Cb || s === Rb || s === Fb || s === Pb || s === Ib || s === Ob || s === Db || s === Nb || s === Bb || s === Ub || s === zb || s === kb || s === Vb || s === Gb || s === Hb)
      return o = e.get("WEBGL_compressed_texture_astc"), o !== null ? s : null;
    if (s === Lb)
      return o = e.get("EXT_texture_compression_bptc"), o !== null ? s : null;
    if (s === yo)
      return i ? 34042 : (o = e.get("WEBGL_depth_texture"), o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null);
  }
  return { convert: r };
}
class Ff extends nn {
  constructor(e = []) {
    super(), this.cameras = e;
  }
}
Ff.prototype.isArrayCamera = !0;
class _i extends ut {
  constructor() {
    super(), this.type = "Group";
  }
}
_i.prototype.isGroup = !0;
const ID = { type: "move" };
class gh {
  constructor() {
    this._targetRay = null, this._grip = null, this._hand = null;
  }
  getHandSpace() {
    return this._hand === null && (this._hand = new _i(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand;
  }
  getTargetRaySpace() {
    return this._targetRay === null && (this._targetRay = new _i(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new Q(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new Q()), this._targetRay;
  }
  getGripSpace() {
    return this._grip === null && (this._grip = new _i(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new Q(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new Q()), this._grip;
  }
  dispatchEvent(e) {
    return this._targetRay !== null && this._targetRay.dispatchEvent(e), this._grip !== null && this._grip.dispatchEvent(e), this._hand !== null && this._hand.dispatchEvent(e), this;
  }
  disconnect(e) {
    return this.dispatchEvent({ type: "disconnected", data: e }), this._targetRay !== null && (this._targetRay.visible = !1), this._grip !== null && (this._grip.visible = !1), this._hand !== null && (this._hand.visible = !1), this;
  }
  update(e, t, i) {
    let r = null, s = null, o = null;
    const a = this._targetRay, c = this._grip, l = this._hand;
    if (e && t.session.visibilityState !== "visible-blurred")
      if (a !== null && (r = t.getPose(e.targetRaySpace, i), r !== null && (a.matrix.fromArray(r.transform.matrix), a.matrix.decompose(a.position, a.rotation, a.scale), r.linearVelocity ? (a.hasLinearVelocity = !0, a.linearVelocity.copy(r.linearVelocity)) : a.hasLinearVelocity = !1, r.angularVelocity ? (a.hasAngularVelocity = !0, a.angularVelocity.copy(r.angularVelocity)) : a.hasAngularVelocity = !1, this.dispatchEvent(ID))), l && e.hand) {
        o = !0;
        for (const u of e.hand.values()) {
          const y = t.getJointPose(u, i);
          if (l.joints[u.jointName] === void 0) {
            const m = new _i();
            m.matrixAutoUpdate = !1, m.visible = !1, l.joints[u.jointName] = m, l.add(m);
          }
          const v = l.joints[u.jointName];
          y !== null && (v.matrix.fromArray(y.transform.matrix), v.matrix.decompose(v.position, v.rotation, v.scale), v.jointRadius = y.radius), v.visible = y !== null;
        }
        const d = l.joints["index-finger-tip"], h = l.joints["thumb-tip"], f = d.position.distanceTo(h.position), g = 0.02, p = 5e-3;
        l.inputState.pinching && f > g + p ? (l.inputState.pinching = !1, this.dispatchEvent({
          type: "pinchend",
          handedness: e.handedness,
          target: this
        })) : !l.inputState.pinching && f <= g - p && (l.inputState.pinching = !0, this.dispatchEvent({
          type: "pinchstart",
          handedness: e.handedness,
          target: this
        }));
      } else
        c !== null && e.gripSpace && (s = t.getPose(e.gripSpace, i), s !== null && (c.matrix.fromArray(s.transform.matrix), c.matrix.decompose(c.position, c.rotation, c.scale), s.linearVelocity ? (c.hasLinearVelocity = !0, c.linearVelocity.copy(s.linearVelocity)) : c.hasLinearVelocity = !1, s.angularVelocity ? (c.hasAngularVelocity = !0, c.angularVelocity.copy(s.angularVelocity)) : c.hasAngularVelocity = !1));
    return a !== null && (a.visible = r !== null), c !== null && (c.visible = s !== null), l !== null && (l.visible = o !== null), this;
  }
}
class OD extends Kr {
  constructor(e, t) {
    super();
    const i = this, r = e.state;
    let s = null, o = 1, a = null, c = "local-floor", l = null, d = null, h = null, f = null;
    const g = [], p = /* @__PURE__ */ new Map(), u = new nn();
    u.layers.enable(1), u.viewport = new xt();
    const y = new nn();
    y.layers.enable(2), y.viewport = new xt();
    const v = [u, y], m = new Ff();
    m.layers.enable(1), m.layers.enable(2);
    let x = null, w = null;
    this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(P) {
      let b = g[P];
      return b === void 0 && (b = new gh(), g[P] = b), b.getTargetRaySpace();
    }, this.getControllerGrip = function(P) {
      let b = g[P];
      return b === void 0 && (b = new gh(), g[P] = b), b.getGripSpace();
    }, this.getHand = function(P) {
      let b = g[P];
      return b === void 0 && (b = new gh(), g[P] = b), b.getHandSpace();
    };
    function A(P) {
      const b = p.get(P.inputSource);
      b && b.dispatchEvent({ type: P.type, data: P.inputSource });
    }
    function M() {
      p.forEach(function(P, b) {
        P.disconnect(b);
      }), p.clear(), x = null, w = null, r.bindXRFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), C.stop(), i.isPresenting = !1, i.dispatchEvent({ type: "sessionend" });
    }
    this.setFramebufferScaleFactor = function(P) {
      o = P, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.");
    }, this.setReferenceSpaceType = function(P) {
      c = P, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.");
    }, this.getReferenceSpace = function() {
      return a;
    }, this.getSession = function() {
      return s;
    }, this.setSession = async function(P) {
      if (s = P, s !== null) {
        s.addEventListener("select", A), s.addEventListener("selectstart", A), s.addEventListener("selectend", A), s.addEventListener("squeeze", A), s.addEventListener("squeezestart", A), s.addEventListener("squeezeend", A), s.addEventListener("end", M), s.addEventListener("inputsourceschange", R);
        const b = t.getContextAttributes();
        if (b.xrCompatible !== !0 && await t.makeXRCompatible(), s.renderState.layers === void 0) {
          const I = {
            antialias: b.antialias,
            alpha: b.alpha,
            depth: b.depth,
            stencil: b.stencil,
            framebufferScaleFactor: o
          }, D = new XRWebGLLayer(s, t, I);
          s.updateRenderState({ baseLayer: D });
        } else {
          let I = 0;
          b.depth && (I = b.stencil ? 34041 : 6402);
          const D = {
            colorFormat: b.alpha ? 6408 : 6407,
            depthFormat: I,
            scaleFactor: o
          };
          d = new XRWebGLBinding(s, t), f = d.createProjectionLayer(D), h = t.createFramebuffer(), s.updateRenderState({ layers: [f] });
        }
        a = await s.requestReferenceSpace(c), C.setContext(s), C.start(), i.isPresenting = !0, i.dispatchEvent({ type: "sessionstart" });
      }
    };
    function R(P) {
      const b = s.inputSources;
      for (let I = 0; I < g.length; I++)
        p.set(b[I], g[I]);
      for (let I = 0; I < P.removed.length; I++) {
        const D = P.removed[I], N = p.get(D);
        N && (N.dispatchEvent({ type: "disconnected", data: D }), p.delete(D));
      }
      for (let I = 0; I < P.added.length; I++) {
        const D = P.added[I], N = p.get(D);
        N && N.dispatchEvent({ type: "connected", data: D });
      }
    }
    const L = new Q(), _ = new Q();
    function F(P, b, I) {
      L.setFromMatrixPosition(b.matrixWorld), _.setFromMatrixPosition(I.matrixWorld);
      const D = L.distanceTo(_), N = b.projectionMatrix.elements, U = I.projectionMatrix.elements, B = N[14] / (N[10] - 1), G = N[14] / (N[10] + 1), J = (N[9] + 1) / N[5], j = (N[9] - 1) / N[5], te = (N[8] - 1) / N[0], ee = (U[8] + 1) / U[0], ae = B * te, H = B * ee, Z = D / (-te + ee), $ = Z * -te;
      b.matrixWorld.decompose(P.position, P.quaternion, P.scale), P.translateX($), P.translateZ(Z), P.matrixWorld.compose(P.position, P.quaternion, P.scale), P.matrixWorldInverse.copy(P.matrixWorld).invert();
      const se = B + Z, k = G + Z, W = ae - $, q = H + (D - $), ce = J * G / k * se, oe = j * G / k * se;
      P.projectionMatrix.makePerspective(W, q, ce, oe, se, k);
    }
    function S(P, b) {
      b === null ? P.matrixWorld.copy(P.matrix) : P.matrixWorld.multiplyMatrices(b.matrixWorld, P.matrix), P.matrixWorldInverse.copy(P.matrixWorld).invert();
    }
    this.updateCamera = function(P) {
      if (s === null) return;
      m.near = y.near = u.near = P.near, m.far = y.far = u.far = P.far, (x !== m.near || w !== m.far) && (s.updateRenderState({
        depthNear: m.near,
        depthFar: m.far
      }), x = m.near, w = m.far);
      const b = P.parent, I = m.cameras;
      S(m, b);
      for (let N = 0; N < I.length; N++)
        S(I[N], b);
      m.matrixWorld.decompose(m.position, m.quaternion, m.scale), P.position.copy(m.position), P.quaternion.copy(m.quaternion), P.scale.copy(m.scale), P.matrix.copy(m.matrix), P.matrixWorld.copy(m.matrixWorld);
      const D = P.children;
      for (let N = 0, U = D.length; N < U; N++)
        D[N].updateMatrixWorld(!0);
      I.length === 2 ? F(m, u, y) : m.projectionMatrix.copy(u.projectionMatrix);
    }, this.getCamera = function() {
      return m;
    };
    let T = null;
    function E(P, b) {
      if (l = b.getViewerPose(a), l !== null) {
        const D = l.views, N = s.renderState.baseLayer;
        s.renderState.layers === void 0 && r.bindXRFramebuffer(N.framebuffer);
        let U = !1;
        D.length !== m.cameras.length && (m.cameras.length = 0, U = !0);
        for (let B = 0; B < D.length; B++) {
          const G = D[B];
          let J = null;
          if (s.renderState.layers === void 0)
            J = N.getViewport(G);
          else {
            const te = d.getViewSubImage(f, G);
            r.bindXRFramebuffer(h), t.framebufferTexture2D(36160, 36064, 3553, te.colorTexture, 0), te.depthStencilTexture !== void 0 && t.framebufferTexture2D(36160, 36096, 3553, te.depthStencilTexture, 0), J = te.viewport;
          }
          const j = v[B];
          j.matrix.fromArray(G.transform.matrix), j.projectionMatrix.fromArray(G.projectionMatrix), j.viewport.set(J.x, J.y, J.width, J.height), B === 0 && m.matrix.copy(j.matrix), U === !0 && m.cameras.push(j);
        }
      }
      const I = s.inputSources;
      for (let D = 0; D < g.length; D++) {
        const N = g[D], U = I[D];
        N.update(U, b, a);
      }
      T && T(P, b);
    }
    const C = new fx();
    C.setAnimationLoop(E), this.setAnimationLoop = function(P) {
      T = P;
    }, this.dispose = function() {
    };
  }
}
function DD(n) {
  function e(v, m) {
    v.fogColor.value.copy(m.color), m.isFog ? (v.fogNear.value = m.near, v.fogFar.value = m.far) : m.isFogExp2 && (v.fogDensity.value = m.density);
  }
  function t(v, m, x, w, A) {
    m.isMeshBasicMaterial ? i(v, m) : m.isMeshLambertMaterial ? (i(v, m), c(v, m)) : m.isMeshToonMaterial ? (i(v, m), d(v, m)) : m.isMeshPhongMaterial ? (i(v, m), l(v, m)) : m.isMeshStandardMaterial ? (i(v, m), m.isMeshPhysicalMaterial ? f(v, m, A) : h(v, m)) : m.isMeshMatcapMaterial ? (i(v, m), g(v, m)) : m.isMeshDepthMaterial ? (i(v, m), p(v, m)) : m.isMeshDistanceMaterial ? (i(v, m), u(v, m)) : m.isMeshNormalMaterial ? (i(v, m), y(v, m)) : m.isLineBasicMaterial ? (r(v, m), m.isLineDashedMaterial && s(v, m)) : m.isPointsMaterial ? o(v, m, x, w) : m.isSpriteMaterial ? a(v, m) : m.isShadowMaterial ? (v.color.value.copy(m.color), v.opacity.value = m.opacity) : m.isShaderMaterial && (m.uniformsNeedUpdate = !1);
  }
  function i(v, m) {
    v.opacity.value = m.opacity, m.color && v.diffuse.value.copy(m.color), m.emissive && v.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity), m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap), m.specularMap && (v.specularMap.value = m.specularMap);
    const x = n.get(m).envMap;
    if (x) {
      v.envMap.value = x, v.flipEnvMap.value = x.isCubeTexture && x._needsFlipEnvMap ? -1 : 1, v.reflectivity.value = m.reflectivity, v.refractionRatio.value = m.refractionRatio;
      const M = n.get(x).__maxMipLevel;
      M !== void 0 && (v.maxMipLevel.value = M);
    }
    m.lightMap && (v.lightMap.value = m.lightMap, v.lightMapIntensity.value = m.lightMapIntensity), m.aoMap && (v.aoMap.value = m.aoMap, v.aoMapIntensity.value = m.aoMapIntensity);
    let w;
    m.map ? w = m.map : m.specularMap ? w = m.specularMap : m.displacementMap ? w = m.displacementMap : m.normalMap ? w = m.normalMap : m.bumpMap ? w = m.bumpMap : m.roughnessMap ? w = m.roughnessMap : m.metalnessMap ? w = m.metalnessMap : m.alphaMap ? w = m.alphaMap : m.emissiveMap ? w = m.emissiveMap : m.clearcoatMap ? w = m.clearcoatMap : m.clearcoatNormalMap ? w = m.clearcoatNormalMap : m.clearcoatRoughnessMap && (w = m.clearcoatRoughnessMap), w !== void 0 && (w.isWebGLRenderTarget && (w = w.texture), w.matrixAutoUpdate === !0 && w.updateMatrix(), v.uvTransform.value.copy(w.matrix));
    let A;
    m.aoMap ? A = m.aoMap : m.lightMap && (A = m.lightMap), A !== void 0 && (A.isWebGLRenderTarget && (A = A.texture), A.matrixAutoUpdate === !0 && A.updateMatrix(), v.uv2Transform.value.copy(A.matrix));
  }
  function r(v, m) {
    v.diffuse.value.copy(m.color), v.opacity.value = m.opacity;
  }
  function s(v, m) {
    v.dashSize.value = m.dashSize, v.totalSize.value = m.dashSize + m.gapSize, v.scale.value = m.scale;
  }
  function o(v, m, x, w) {
    v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.size.value = m.size * x, v.scale.value = w * 0.5, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap);
    let A;
    m.map ? A = m.map : m.alphaMap && (A = m.alphaMap), A !== void 0 && (A.matrixAutoUpdate === !0 && A.updateMatrix(), v.uvTransform.value.copy(A.matrix));
  }
  function a(v, m) {
    v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.rotation.value = m.rotation, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap);
    let x;
    m.map ? x = m.map : m.alphaMap && (x = m.alphaMap), x !== void 0 && (x.matrixAutoUpdate === !0 && x.updateMatrix(), v.uvTransform.value.copy(x.matrix));
  }
  function c(v, m) {
    m.emissiveMap && (v.emissiveMap.value = m.emissiveMap);
  }
  function l(v, m) {
    v.specular.value.copy(m.specular), v.shininess.value = Math.max(m.shininess, 1e-4), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias);
  }
  function d(v, m) {
    m.gradientMap && (v.gradientMap.value = m.gradientMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias);
  }
  function h(v, m) {
    v.roughness.value = m.roughness, v.metalness.value = m.metalness, m.roughnessMap && (v.roughnessMap.value = m.roughnessMap), m.metalnessMap && (v.metalnessMap.value = m.metalnessMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), n.get(m).envMap && (v.envMapIntensity.value = m.envMapIntensity);
  }
  function f(v, m, x) {
    h(v, m), v.reflectivity.value = m.reflectivity, v.clearcoat.value = m.clearcoat, v.clearcoatRoughness.value = m.clearcoatRoughness, m.sheen && v.sheen.value.copy(m.sheen), m.clearcoatMap && (v.clearcoatMap.value = m.clearcoatMap), m.clearcoatRoughnessMap && (v.clearcoatRoughnessMap.value = m.clearcoatRoughnessMap), m.clearcoatNormalMap && (v.clearcoatNormalScale.value.copy(m.clearcoatNormalScale), v.clearcoatNormalMap.value = m.clearcoatNormalMap, m.side === jt && v.clearcoatNormalScale.value.negate()), v.transmission.value = m.transmission, m.transmissionMap && (v.transmissionMap.value = m.transmissionMap), m.transmission > 0 && (v.transmissionSamplerMap.value = x.texture, v.transmissionSamplerSize.value.set(x.width, x.height)), v.thickness.value = m.thickness, m.thicknessMap && (v.thicknessMap.value = m.thicknessMap), v.attenuationDistance.value = m.attenuationDistance, v.attenuationColor.value.copy(m.attenuationColor);
  }
  function g(v, m) {
    m.matcap && (v.matcap.value = m.matcap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias);
  }
  function p(v, m) {
    m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias);
  }
  function u(v, m) {
    m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), v.referencePosition.value.copy(m.referencePosition), v.nearDistance.value = m.nearDistance, v.farDistance.value = m.farDistance;
  }
  function y(v, m) {
    m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias);
  }
  return {
    refreshFogUniforms: e,
    refreshMaterialUniforms: t
  };
}
function ND() {
  const n = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  return n.style.display = "block", n;
}
function wt(n = {}) {
  const e = n.canvas !== void 0 ? n.canvas : ND(), t = n.context !== void 0 ? n.context : null, i = n.alpha !== void 0 ? n.alpha : !1, r = n.depth !== void 0 ? n.depth : !0, s = n.stencil !== void 0 ? n.stencil : !0, o = n.antialias !== void 0 ? n.antialias : !1, a = n.premultipliedAlpha !== void 0 ? n.premultipliedAlpha : !0, c = n.preserveDrawingBuffer !== void 0 ? n.preserveDrawingBuffer : !1, l = n.powerPreference !== void 0 ? n.powerPreference : "default", d = n.failIfMajorPerformanceCaveat !== void 0 ? n.failIfMajorPerformanceCaveat : !1;
  let h = null, f = null;
  const g = [], p = [];
  this.domElement = e, this.debug = {
    /**
     * Enables error checking and reporting when shader programs are being compiled
     * @type {boolean}
     */
    checkShaderErrors: !0
  }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.outputEncoding = Cn, this.physicallyCorrectLights = !1, this.toneMapping = Ir, this.toneMappingExposure = 1;
  const u = this;
  let y = !1, v = 0, m = 0, x = null, w = -1, A = null;
  const M = new xt(), R = new xt();
  let L = null, _ = e.width, F = e.height, S = 1, T = null, E = null;
  const C = new xt(0, 0, _, F), P = new xt(0, 0, _, F);
  let b = !1;
  const I = [], D = new dl();
  let N = !1, U = !1, B = null;
  const G = new Xe(), J = new Q(), j = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 };
  function te() {
    return x === null ? S : 1;
  }
  let ee = t;
  function ae(K, ye) {
    for (let pe = 0; pe < K.length; pe++) {
      const we = K[pe], Le = e.getContext(we, ye);
      if (Le !== null) return Le;
    }
    return null;
  }
  try {
    const K = {
      alpha: i,
      depth: r,
      stencil: s,
      antialias: o,
      premultipliedAlpha: a,
      preserveDrawingBuffer: c,
      powerPreference: l,
      failIfMajorPerformanceCaveat: d
    };
    if (e.addEventListener("webglcontextlost", $e, !1), e.addEventListener("webglcontextrestored", lt, !1), ee === null) {
      const ye = ["webgl2", "webgl", "experimental-webgl"];
      if (u.isWebGL1Renderer === !0 && ye.shift(), ee = ae(ye, K), ee === null)
        throw ae(ye) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
    }
    ee.getShaderPrecisionFormat === void 0 && (ee.getShaderPrecisionFormat = function() {
      return { rangeMin: 1, rangeMax: 1, precision: 1 };
    });
  } catch (K) {
    throw console.error("THREE.WebGLRenderer: " + K.message), K;
  }
  let H, Z, $, se, k, W, q, ce, oe, V, O, X, Y, ie, fe, be, Ae, he, xe, re, me, Me;
  function De() {
    H = new oO(ee), Z = new iO(ee, H, n), H.init(Z), me = new wx(ee, H, Z), $ = new FD(ee, H, Z), I[0] = 1029, se = new cO(), k = new xD(), W = new PD(ee, H, $, k, Z, me, se), q = new sO(u), ce = new PF(ee, Z), Me = new tO(ee, H, ce, Z), oe = new aO(ee, ce, se, Me), V = new fO(ee, oe, ce, se), he = new dO(ee), fe = new rO(k), O = new bD(u, q, H, Z, Me, fe), X = new DD(k), Y = new wD(k), ie = new CD(H, Z), Ae = new eO(u, q, $, V, a), be = new Mx(u, V, Z), xe = new nO(ee, H, se, Z), re = new lO(ee, H, se, Z), se.programs = O.programs, u.capabilities = Z, u.extensions = H, u.properties = k, u.renderLists = Y, u.shadowMap = be, u.state = $, u.info = se;
  }
  De();
  const Ie = new OD(u, ee);
  this.xr = Ie, this.getContext = function() {
    return ee;
  }, this.getContextAttributes = function() {
    return ee.getContextAttributes();
  }, this.forceContextLoss = function() {
    const K = H.get("WEBGL_lose_context");
    K && K.loseContext();
  }, this.forceContextRestore = function() {
    const K = H.get("WEBGL_lose_context");
    K && K.restoreContext();
  }, this.getPixelRatio = function() {
    return S;
  }, this.setPixelRatio = function(K) {
    K !== void 0 && (S = K, this.setSize(_, F, !1));
  }, this.getSize = function(K) {
    return K.set(_, F);
  }, this.setSize = function(K, ye, pe) {
    if (Ie.isPresenting) {
      console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");
      return;
    }
    _ = K, F = ye, e.width = Math.floor(K * S), e.height = Math.floor(ye * S), pe !== !1 && (e.style.width = K + "px", e.style.height = ye + "px"), this.setViewport(0, 0, K, ye);
  }, this.getDrawingBufferSize = function(K) {
    return K.set(_ * S, F * S).floor();
  }, this.setDrawingBufferSize = function(K, ye, pe) {
    _ = K, F = ye, S = pe, e.width = Math.floor(K * pe), e.height = Math.floor(ye * pe), this.setViewport(0, 0, K, ye);
  }, this.getCurrentViewport = function(K) {
    return K.copy(M);
  }, this.getViewport = function(K) {
    return K.copy(C);
  }, this.setViewport = function(K, ye, pe, we) {
    K.isVector4 ? C.set(K.x, K.y, K.z, K.w) : C.set(K, ye, pe, we), $.viewport(M.copy(C).multiplyScalar(S).floor());
  }, this.getScissor = function(K) {
    return K.copy(P);
  }, this.setScissor = function(K, ye, pe, we) {
    K.isVector4 ? P.set(K.x, K.y, K.z, K.w) : P.set(K, ye, pe, we), $.scissor(R.copy(P).multiplyScalar(S).floor());
  }, this.getScissorTest = function() {
    return b;
  }, this.setScissorTest = function(K) {
    $.setScissorTest(b = K);
  }, this.setOpaqueSort = function(K) {
    T = K;
  }, this.setTransparentSort = function(K) {
    E = K;
  }, this.getClearColor = function(K) {
    return K.copy(Ae.getClearColor());
  }, this.setClearColor = function() {
    Ae.setClearColor.apply(Ae, arguments);
  }, this.getClearAlpha = function() {
    return Ae.getClearAlpha();
  }, this.setClearAlpha = function() {
    Ae.setClearAlpha.apply(Ae, arguments);
  }, this.clear = function(K, ye, pe) {
    let we = 0;
    (K === void 0 || K) && (we |= 16384), (ye === void 0 || ye) && (we |= 256), (pe === void 0 || pe) && (we |= 1024), ee.clear(we);
  }, this.clearColor = function() {
    this.clear(!0, !1, !1);
  }, this.clearDepth = function() {
    this.clear(!1, !0, !1);
  }, this.clearStencil = function() {
    this.clear(!1, !1, !0);
  }, this.dispose = function() {
    e.removeEventListener("webglcontextlost", $e, !1), e.removeEventListener("webglcontextrestored", lt, !1), Y.dispose(), ie.dispose(), k.dispose(), q.dispose(), V.dispose(), Me.dispose(), Ie.dispose(), Ie.removeEventListener("sessionstart", Qt), Ie.removeEventListener("sessionend", Pt), B && (B.dispose(), B = null), Nt.stop();
  };
  function $e(K) {
    K.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = !0;
  }
  function lt() {
    console.log("THREE.WebGLRenderer: Context Restored."), y = !1;
    const K = se.autoReset, ye = be.enabled, pe = be.autoUpdate, we = be.needsUpdate, Le = be.type;
    De(), se.autoReset = K, be.enabled = ye, be.autoUpdate = pe, be.needsUpdate = we, be.type = Le;
  }
  function qe(K) {
    const ye = K.target;
    ye.removeEventListener("dispose", qe), Mt(ye);
  }
  function Mt(K) {
    Be(K), k.remove(K);
  }
  function Be(K) {
    const ye = k.get(K).programs;
    ye !== void 0 && ye.forEach(function(pe) {
      O.releaseProgram(pe);
    });
  }
  function it(K, ye) {
    K.render(function(pe) {
      u.renderBufferImmediate(pe, ye);
    });
  }
  this.renderBufferImmediate = function(K, ye) {
    Me.initAttributes();
    const pe = k.get(K);
    K.hasPositions && !pe.position && (pe.position = ee.createBuffer()), K.hasNormals && !pe.normal && (pe.normal = ee.createBuffer()), K.hasUvs && !pe.uv && (pe.uv = ee.createBuffer()), K.hasColors && !pe.color && (pe.color = ee.createBuffer());
    const we = ye.getAttributes();
    K.hasPositions && (ee.bindBuffer(34962, pe.position), ee.bufferData(34962, K.positionArray, 35048), Me.enableAttribute(we.position), ee.vertexAttribPointer(we.position, 3, 5126, !1, 0, 0)), K.hasNormals && (ee.bindBuffer(34962, pe.normal), ee.bufferData(34962, K.normalArray, 35048), Me.enableAttribute(we.normal), ee.vertexAttribPointer(we.normal, 3, 5126, !1, 0, 0)), K.hasUvs && (ee.bindBuffer(34962, pe.uv), ee.bufferData(34962, K.uvArray, 35048), Me.enableAttribute(we.uv), ee.vertexAttribPointer(we.uv, 2, 5126, !1, 0, 0)), K.hasColors && (ee.bindBuffer(34962, pe.color), ee.bufferData(34962, K.colorArray, 35048), Me.enableAttribute(we.color), ee.vertexAttribPointer(we.color, 3, 5126, !1, 0, 0)), Me.disableUnusedAttributes(), ee.drawArrays(4, 0, K.count), K.count = 0;
  }, this.renderBufferDirect = function(K, ye, pe, we, Le, ge) {
    ye === null && (ye = j);
    const Se = Le.isMesh && Le.matrixWorld.determinant() < 0, Fe = Oe(K, ye, we, Le);
    $.setMaterial(we, Se);
    let Ge = pe.index;
    const je = pe.attributes.position;
    if (Ge === null) {
      if (je === void 0 || je.count === 0) return;
    } else if (Ge.count === 0)
      return;
    let et = 1;
    we.wireframe === !0 && (Ge = oe.getWireframeAttribute(pe), et = 2), (we.morphTargets || we.morphNormals) && he.update(Le, pe, we, Fe), Me.setup(Le, we, Fe, pe, Ge);
    let Ye, ft = xe;
    Ge !== null && (Ye = ce.get(Ge), ft = re, ft.setIndex(Ye));
    const Vt = Ge !== null ? Ge.count : je.count, ln = pe.drawRange.start * et, ns = pe.drawRange.count * et, Tt = ge !== null ? ge.start * et : 0, is = ge !== null ? ge.count * et : 1 / 0, Mn = Math.max(ln, Tt), NM = Math.min(Vt, ln + ns, Tt + is) - 1, Sl = Math.max(0, NM - Mn + 1);
    if (Sl !== 0) {
      if (Le.isMesh)
        we.wireframe === !0 ? ($.setLineWidth(we.wireframeLinewidth * te()), ft.setMode(1)) : ft.setMode(4);
      else if (Le.isLine) {
        let aa = we.linewidth;
        aa === void 0 && (aa = 1), $.setLineWidth(aa * te()), Le.isLineSegments ? ft.setMode(1) : Le.isLineLoop ? ft.setMode(2) : ft.setMode(3);
      } else Le.isPoints ? ft.setMode(0) : Le.isSprite && ft.setMode(4);
      if (Le.isInstancedMesh)
        ft.renderInstances(Mn, Sl, Le.count);
      else if (pe.isInstancedBufferGeometry) {
        const aa = Math.min(pe.instanceCount, pe._maxInstanceCount);
        ft.renderInstances(Mn, Sl, aa);
      } else
        ft.render(Mn, Sl);
    }
  }, this.compile = function(K, ye) {
    f = ie.get(K), f.init(), K.traverseVisible(function(pe) {
      pe.isLight && pe.layers.test(ye.layers) && (f.pushLight(pe), pe.castShadow && f.pushShadow(pe));
    }), f.setupLights(), K.traverse(function(pe) {
      const we = pe.material;
      if (we)
        if (Array.isArray(we))
          for (let Le = 0; Le < we.length; Le++) {
            const ge = we[Le];
            ne(ge, K, pe);
          }
        else
          ne(we, K, pe);
    });
  };
  let tt = null;
  function qt(K) {
    tt && tt(K);
  }
  function Qt() {
    Nt.stop();
  }
  function Pt() {
    Nt.start();
  }
  const Nt = new fx();
  Nt.setAnimationLoop(qt), typeof window < "u" && Nt.setContext(window), this.setAnimationLoop = function(K) {
    tt = K, Ie.setAnimationLoop(K), K === null ? Nt.stop() : Nt.start();
  }, Ie.addEventListener("sessionstart", Qt), Ie.addEventListener("sessionend", Pt), this.render = function(K, ye) {
    if (ye !== void 0 && ye.isCamera !== !0) {
      console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
      return;
    }
    if (y === !0) return;
    K.autoUpdate === !0 && K.updateMatrixWorld(), ye.parent === null && ye.updateMatrixWorld(), Ie.enabled === !0 && Ie.isPresenting === !0 && (Ie.cameraAutoUpdate === !0 && Ie.updateCamera(ye), ye = Ie.getCamera()), K.isScene === !0 && K.onBeforeRender(u, K, ye, x), f = ie.get(K, p.length), f.init(), p.push(f), G.multiplyMatrices(ye.projectionMatrix, ye.matrixWorldInverse), D.setFromProjectionMatrix(G), U = this.localClippingEnabled, N = fe.init(this.clippingPlanes, U, ye), h = Y.get(K, g.length), h.init(), g.push(h), Vi(K, ye, 0, u.sortObjects), h.finish(), u.sortObjects === !0 && h.sort(T, E), N === !0 && fe.beginShadows();
    const pe = f.state.shadowsArray;
    be.render(pe, K, ye), f.setupLights(), f.setupLightsView(ye), N === !0 && fe.endShadows(), this.info.autoReset === !0 && this.info.reset(), Ae.render(h, K);
    const we = h.opaque, Le = h.transmissive, ge = h.transparent;
    we.length > 0 && ni(we, K, ye), Le.length > 0 && Gi(we, Le, K, ye), ge.length > 0 && ni(ge, K, ye), x !== null && (W.updateMultisampleRenderTarget(x), W.updateRenderTargetMipmap(x)), K.isScene === !0 && K.onAfterRender(u, K, ye), $.buffers.depth.setTest(!0), $.buffers.depth.setMask(!0), $.buffers.color.setMask(!0), $.setPolygonOffset(!1), Me.resetDefaultState(), w = -1, A = null, p.pop(), p.length > 0 ? f = p[p.length - 1] : f = null, g.pop(), g.length > 0 ? h = g[g.length - 1] : h = null;
  };
  function Vi(K, ye, pe, we) {
    if (K.visible === !1) return;
    if (K.layers.test(ye.layers)) {
      if (K.isGroup)
        pe = K.renderOrder;
      else if (K.isLOD)
        K.autoUpdate === !0 && K.update(ye);
      else if (K.isLight)
        f.pushLight(K), K.castShadow && f.pushShadow(K);
      else if (K.isSprite) {
        if (!K.frustumCulled || D.intersectsSprite(K)) {
          we && J.setFromMatrixPosition(K.matrixWorld).applyMatrix4(G);
          const Se = V.update(K), Fe = K.material;
          Fe.visible && h.push(K, Se, Fe, pe, J.z, null);
        }
      } else if (K.isImmediateRenderObject)
        we && J.setFromMatrixPosition(K.matrixWorld).applyMatrix4(G), h.push(K, null, K.material, pe, J.z, null);
      else if ((K.isMesh || K.isLine || K.isPoints) && (K.isSkinnedMesh && K.skeleton.frame !== se.render.frame && (K.skeleton.update(), K.skeleton.frame = se.render.frame), !K.frustumCulled || D.intersectsObject(K))) {
        we && J.setFromMatrixPosition(K.matrixWorld).applyMatrix4(G);
        const Se = V.update(K), Fe = K.material;
        if (Array.isArray(Fe)) {
          const Ge = Se.groups;
          for (let je = 0, et = Ge.length; je < et; je++) {
            const Ye = Ge[je], ft = Fe[Ye.materialIndex];
            ft && ft.visible && h.push(K, Se, ft, pe, J.z, Ye);
          }
        } else Fe.visible && h.push(K, Se, Fe, pe, J.z, null);
      }
    }
    const ge = K.children;
    for (let Se = 0, Fe = ge.length; Se < Fe; Se++)
      Vi(ge[Se], ye, pe, we);
  }
  function Gi(K, ye, pe, we) {
    if (B === null) {
      const Fe = o === !0 && Z.isWebGL2 === !0 ? Ef : fi;
      B = new Fe(1024, 1024, {
        generateMipmaps: !0,
        type: me.convert(Ms) !== null ? Ms : Ts,
        minFilter: pr,
        magFilter: $t,
        wrapS: hn,
        wrapT: hn
      });
    }
    const Le = u.getRenderTarget();
    u.setRenderTarget(B), u.clear();
    const ge = u.toneMapping;
    u.toneMapping = Ir, ni(K, pe, we), u.toneMapping = ge, W.updateMultisampleRenderTarget(B), W.updateRenderTargetMipmap(B), u.setRenderTarget(Le), ni(ye, pe, we);
  }
  function ni(K, ye, pe) {
    const we = ye.isScene === !0 ? ye.overrideMaterial : null;
    for (let Le = 0, ge = K.length; Le < ge; Le++) {
      const Se = K[Le], Fe = Se.object, Ge = Se.geometry, je = we === null ? Se.material : we, et = Se.group;
      if (pe.isArrayCamera) {
        const Ye = pe.cameras;
        for (let ft = 0, Vt = Ye.length; ft < Vt; ft++) {
          const ln = Ye[ft];
          Fe.layers.test(ln.layers) && ($.viewport(M.copy(ln.viewport)), f.setupLightsView(ln), ts(Fe, ye, ln, Ge, je, et));
        }
      } else
        ts(Fe, ye, pe, Ge, je, et);
    }
  }
  function ts(K, ye, pe, we, Le, ge) {
    if (K.onBeforeRender(u, ye, pe, we, Le, ge), K.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse, K.matrixWorld), K.normalMatrix.getNormalMatrix(K.modelViewMatrix), K.isImmediateRenderObject) {
      const Se = Oe(pe, ye, Le, K);
      $.setMaterial(Le), Me.reset(), it(K, Se);
    } else
      Le.transparent === !0 && Le.side === Wr ? (Le.side = jt, Le.needsUpdate = !0, u.renderBufferDirect(pe, ye, we, Le, K, ge), Le.side = Hr, Le.needsUpdate = !0, u.renderBufferDirect(pe, ye, we, Le, K, ge), Le.side = Wr) : u.renderBufferDirect(pe, ye, we, Le, K, ge);
    K.onAfterRender(u, ye, pe, we, Le, ge);
  }
  function ne(K, ye, pe) {
    ye.isScene !== !0 && (ye = j);
    const we = k.get(K), Le = f.state.lights, ge = f.state.shadowsArray, Se = Le.state.version, Fe = O.getParameters(K, Le.state, ge, ye, pe), Ge = O.getProgramCacheKey(Fe);
    let je = we.programs;
    we.environment = K.isMeshStandardMaterial ? ye.environment : null, we.fog = ye.fog, we.envMap = q.get(K.envMap || we.environment), je === void 0 && (K.addEventListener("dispose", qe), je = /* @__PURE__ */ new Map(), we.programs = je);
    let et = je.get(Ge);
    if (et !== void 0) {
      if (we.currentProgram === et && we.lightsStateVersion === Se)
        return _e(K, Fe), et;
    } else
      Fe.uniforms = O.getUniforms(K), K.onBuild(Fe, u), K.onBeforeCompile(Fe, u), et = O.acquireProgram(Fe, Ge), je.set(Ge, et), we.uniforms = Fe.uniforms;
    const Ye = we.uniforms;
    (!K.isShaderMaterial && !K.isRawShaderMaterial || K.clipping === !0) && (Ye.clippingPlanes = fe.uniform), _e(K, Fe), we.needsLights = ht(K), we.lightsStateVersion = Se, we.needsLights && (Ye.ambientLightColor.value = Le.state.ambient, Ye.lightProbe.value = Le.state.probe, Ye.directionalLights.value = Le.state.directional, Ye.directionalLightShadows.value = Le.state.directionalShadow, Ye.spotLights.value = Le.state.spot, Ye.spotLightShadows.value = Le.state.spotShadow, Ye.rectAreaLights.value = Le.state.rectArea, Ye.ltc_1.value = Le.state.rectAreaLTC1, Ye.ltc_2.value = Le.state.rectAreaLTC2, Ye.pointLights.value = Le.state.point, Ye.pointLightShadows.value = Le.state.pointShadow, Ye.hemisphereLights.value = Le.state.hemi, Ye.directionalShadowMap.value = Le.state.directionalShadowMap, Ye.directionalShadowMatrix.value = Le.state.directionalShadowMatrix, Ye.spotShadowMap.value = Le.state.spotShadowMap, Ye.spotShadowMatrix.value = Le.state.spotShadowMatrix, Ye.pointShadowMap.value = Le.state.pointShadowMap, Ye.pointShadowMatrix.value = Le.state.pointShadowMatrix);
    const ft = et.getUniforms(), Vt = Or.seqWithValue(ft.seq, Ye);
    return we.currentProgram = et, we.uniformsList = Vt, et;
  }
  function _e(K, ye) {
    const pe = k.get(K);
    pe.outputEncoding = ye.outputEncoding, pe.instancing = ye.instancing, pe.skinning = ye.skinning, pe.numClippingPlanes = ye.numClippingPlanes, pe.numIntersection = ye.numClipIntersection, pe.vertexAlphas = ye.vertexAlphas;
  }
  function Oe(K, ye, pe, we) {
    ye.isScene !== !0 && (ye = j), W.resetTextureUnits();
    const Le = ye.fog, ge = pe.isMeshStandardMaterial ? ye.environment : null, Se = x === null ? u.outputEncoding : x.texture.encoding, Fe = q.get(pe.envMap || ge), Ge = pe.vertexColors === !0 && we.geometry && we.geometry.attributes.color && we.geometry.attributes.color.itemSize === 4, je = k.get(pe), et = f.state.lights;
    if (N === !0 && (U === !0 || K !== A)) {
      const Mn = K === A && pe.id === w;
      fe.setState(pe, K, Mn);
    }
    let Ye = !1;
    pe.version === je.__version ? (je.needsLights && je.lightsStateVersion !== et.state.version || je.outputEncoding !== Se || we.isInstancedMesh && je.instancing === !1 || !we.isInstancedMesh && je.instancing === !0 || we.isSkinnedMesh && je.skinning === !1 || !we.isSkinnedMesh && je.skinning === !0 || je.envMap !== Fe || pe.fog && je.fog !== Le || je.numClippingPlanes !== void 0 && (je.numClippingPlanes !== fe.numPlanes || je.numIntersection !== fe.numIntersection) || je.vertexAlphas !== Ge) && (Ye = !0) : (Ye = !0, je.__version = pe.version);
    let ft = je.currentProgram;
    Ye === !0 && (ft = ne(pe, ye, we));
    let Vt = !1, ln = !1, ns = !1;
    const Tt = ft.getUniforms(), is = je.uniforms;
    if ($.useProgram(ft.program) && (Vt = !0, ln = !0, ns = !0), pe.id !== w && (w = pe.id, ln = !0), Vt || A !== K) {
      if (Tt.setValue(ee, "projectionMatrix", K.projectionMatrix), Z.logarithmicDepthBuffer && Tt.setValue(
        ee,
        "logDepthBufFC",
        2 / (Math.log(K.far + 1) / Math.LN2)
      ), A !== K && (A = K, ln = !0, ns = !0), pe.isShaderMaterial || pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshStandardMaterial || pe.envMap) {
        const Mn = Tt.map.cameraPosition;
        Mn !== void 0 && Mn.setValue(
          ee,
          J.setFromMatrixPosition(K.matrixWorld)
        );
      }
      (pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshLambertMaterial || pe.isMeshBasicMaterial || pe.isMeshStandardMaterial || pe.isShaderMaterial) && Tt.setValue(ee, "isOrthographic", K.isOrthographicCamera === !0), (pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshLambertMaterial || pe.isMeshBasicMaterial || pe.isMeshStandardMaterial || pe.isShaderMaterial || pe.isShadowMaterial || we.isSkinnedMesh) && Tt.setValue(ee, "viewMatrix", K.matrixWorldInverse);
    }
    if (we.isSkinnedMesh) {
      Tt.setOptional(ee, we, "bindMatrix"), Tt.setOptional(ee, we, "bindMatrixInverse");
      const Mn = we.skeleton;
      Mn && (Z.floatVertexTextures ? (Mn.boneTexture === null && Mn.computeBoneTexture(), Tt.setValue(ee, "boneTexture", Mn.boneTexture, W), Tt.setValue(ee, "boneTextureSize", Mn.boneTextureSize)) : Tt.setOptional(ee, Mn, "boneMatrices"));
    }
    return (ln || je.receiveShadow !== we.receiveShadow) && (je.receiveShadow = we.receiveShadow, Tt.setValue(ee, "receiveShadow", we.receiveShadow)), ln && (Tt.setValue(ee, "toneMappingExposure", u.toneMappingExposure), je.needsLights && Ze(is, ns), Le && pe.fog && X.refreshFogUniforms(is, Le), X.refreshMaterialUniforms(is, pe, S, F, B), Or.upload(ee, je.uniformsList, is, W)), pe.isShaderMaterial && pe.uniformsNeedUpdate === !0 && (Or.upload(ee, je.uniformsList, is, W), pe.uniformsNeedUpdate = !1), pe.isSpriteMaterial && Tt.setValue(ee, "center", we.center), Tt.setValue(ee, "modelViewMatrix", we.modelViewMatrix), Tt.setValue(ee, "normalMatrix", we.normalMatrix), Tt.setValue(ee, "modelMatrix", we.matrixWorld), ft;
  }
  function Ze(K, ye) {
    K.ambientLightColor.needsUpdate = ye, K.lightProbe.needsUpdate = ye, K.directionalLights.needsUpdate = ye, K.directionalLightShadows.needsUpdate = ye, K.pointLights.needsUpdate = ye, K.pointLightShadows.needsUpdate = ye, K.spotLights.needsUpdate = ye, K.spotLightShadows.needsUpdate = ye, K.rectAreaLights.needsUpdate = ye, K.hemisphereLights.needsUpdate = ye;
  }
  function ht(K) {
    return K.isMeshLambertMaterial || K.isMeshToonMaterial || K.isMeshPhongMaterial || K.isMeshStandardMaterial || K.isShadowMaterial || K.isShaderMaterial && K.lights === !0;
  }
  this.getActiveCubeFace = function() {
    return v;
  }, this.getActiveMipmapLevel = function() {
    return m;
  }, this.getRenderTarget = function() {
    return x;
  }, this.setRenderTarget = function(K, ye = 0, pe = 0) {
    x = K, v = ye, m = pe, K && k.get(K).__webglFramebuffer === void 0 && W.setupRenderTarget(K);
    let we = null, Le = !1, ge = !1;
    if (K) {
      const Fe = K.texture;
      (Fe.isDataTexture3D || Fe.isDataTexture2DArray) && (ge = !0);
      const Ge = k.get(K).__webglFramebuffer;
      K.isWebGLCubeRenderTarget ? (we = Ge[ye], Le = !0) : K.isWebGLMultisampleRenderTarget ? we = k.get(K).__webglMultisampledFramebuffer : we = Ge, M.copy(K.viewport), R.copy(K.scissor), L = K.scissorTest;
    } else
      M.copy(C).multiplyScalar(S).floor(), R.copy(P).multiplyScalar(S).floor(), L = b;
    if ($.bindFramebuffer(36160, we) && Z.drawBuffers) {
      let Fe = !1;
      if (K)
        if (K.isWebGLMultipleRenderTargets) {
          const Ge = K.texture;
          if (I.length !== Ge.length || I[0] !== 36064) {
            for (let je = 0, et = Ge.length; je < et; je++)
              I[je] = 36064 + je;
            I.length = Ge.length, Fe = !0;
          }
        } else
          (I.length !== 1 || I[0] !== 36064) && (I[0] = 36064, I.length = 1, Fe = !0);
      else
        (I.length !== 1 || I[0] !== 1029) && (I[0] = 1029, I.length = 1, Fe = !0);
      Fe && (Z.isWebGL2 ? ee.drawBuffers(I) : H.get("WEBGL_draw_buffers").drawBuffersWEBGL(I));
    }
    if ($.viewport(M), $.scissor(R), $.setScissorTest(L), Le) {
      const Fe = k.get(K.texture);
      ee.framebufferTexture2D(36160, 36064, 34069 + ye, Fe.__webglTexture, pe);
    } else if (ge) {
      const Fe = k.get(K.texture), Ge = ye || 0;
      ee.framebufferTextureLayer(36160, 36064, Fe.__webglTexture, pe || 0, Ge);
    }
  }, this.readRenderTargetPixels = function(K, ye, pe, we, Le, ge, Se) {
    if (!(K && K.isWebGLRenderTarget)) {
      console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
      return;
    }
    let Fe = k.get(K).__webglFramebuffer;
    if (K.isWebGLCubeRenderTarget && Se !== void 0 && (Fe = Fe[Se]), Fe) {
      $.bindFramebuffer(36160, Fe);
      try {
        const Ge = K.texture, je = Ge.format, et = Ge.type;
        if (je !== Hn && me.convert(je) !== ee.getParameter(35739)) {
          console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
          return;
        }
        const Ye = et === Ms && (H.has("EXT_color_buffer_half_float") || Z.isWebGL2 && H.has("EXT_color_buffer_float"));
        if (et !== Ts && me.convert(et) !== ee.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513)
        !(et === Qi && (Z.isWebGL2 || H.has("OES_texture_float") || H.has("WEBGL_color_buffer_float"))) && // Chrome Mac >= 52 and Firefox
        !Ye) {
          console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
          return;
        }
        ee.checkFramebufferStatus(36160) === 36053 ? ye >= 0 && ye <= K.width - we && pe >= 0 && pe <= K.height - Le && ee.readPixels(ye, pe, we, Le, me.convert(je), me.convert(et), ge) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");
      } finally {
        const Ge = x !== null ? k.get(x).__webglFramebuffer : null;
        $.bindFramebuffer(36160, Ge);
      }
    }
  }, this.copyFramebufferToTexture = function(K, ye, pe = 0) {
    const we = Math.pow(2, -pe), Le = Math.floor(ye.image.width * we), ge = Math.floor(ye.image.height * we);
    let Se = me.convert(ye.format);
    Z.isWebGL2 && (Se === 6407 && (Se = 32849), Se === 6408 && (Se = 32856)), W.setTexture2D(ye, 0), ee.copyTexImage2D(3553, pe, Se, K.x, K.y, Le, ge, 0), $.unbindTexture();
  }, this.copyTextureToTexture = function(K, ye, pe, we = 0) {
    const Le = ye.image.width, ge = ye.image.height, Se = me.convert(pe.format), Fe = me.convert(pe.type);
    W.setTexture2D(pe, 0), ee.pixelStorei(37440, pe.flipY), ee.pixelStorei(37441, pe.premultiplyAlpha), ee.pixelStorei(3317, pe.unpackAlignment), ye.isDataTexture ? ee.texSubImage2D(3553, we, K.x, K.y, Le, ge, Se, Fe, ye.image.data) : ye.isCompressedTexture ? ee.compressedTexSubImage2D(3553, we, K.x, K.y, ye.mipmaps[0].width, ye.mipmaps[0].height, Se, ye.mipmaps[0].data) : ee.texSubImage2D(3553, we, K.x, K.y, Se, Fe, ye.image), we === 0 && pe.generateMipmaps && ee.generateMipmap(3553), $.unbindTexture();
  }, this.copyTextureToTexture3D = function(K, ye, pe, we, Le = 0) {
    if (u.isWebGL1Renderer) {
      console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");
      return;
    }
    const ge = K.max.x - K.min.x + 1, Se = K.max.y - K.min.y + 1, Fe = K.max.z - K.min.z + 1, Ge = me.convert(we.format), je = me.convert(we.type);
    let et;
    if (we.isDataTexture3D)
      W.setTexture3D(we, 0), et = 32879;
    else if (we.isDataTexture2DArray)
      W.setTexture2DArray(we, 0), et = 35866;
    else {
      console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");
      return;
    }
    ee.pixelStorei(37440, we.flipY), ee.pixelStorei(37441, we.premultiplyAlpha), ee.pixelStorei(3317, we.unpackAlignment);
    const Ye = ee.getParameter(3314), ft = ee.getParameter(32878), Vt = ee.getParameter(3316), ln = ee.getParameter(3315), ns = ee.getParameter(32877), Tt = pe.isCompressedTexture ? pe.mipmaps[0] : pe.image;
    ee.pixelStorei(3314, Tt.width), ee.pixelStorei(32878, Tt.height), ee.pixelStorei(3316, K.min.x), ee.pixelStorei(3315, K.min.y), ee.pixelStorei(32877, K.min.z), pe.isDataTexture || pe.isDataTexture3D ? ee.texSubImage3D(et, Le, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, je, Tt.data) : pe.isCompressedTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), ee.compressedTexSubImage3D(et, Le, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, Tt.data)) : ee.texSubImage3D(et, Le, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, je, Tt), ee.pixelStorei(3314, Ye), ee.pixelStorei(32878, ft), ee.pixelStorei(3316, Vt), ee.pixelStorei(3315, ln), ee.pixelStorei(32877, ns), Le === 0 && we.generateMipmaps && ee.generateMipmap(et), $.unbindTexture();
  }, this.initTexture = function(K) {
    W.setTexture2D(K, 0), $.unbindTexture();
  }, this.resetState = function() {
    v = 0, m = 0, x = null, $.reset(), Me.reset();
  }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
class Ax extends wt {
}
Ax.prototype.isWebGL1Renderer = !0;
class fl {
  constructor(e, t = 25e-5) {
    this.name = "", this.color = new Ue(e), this.density = t;
  }
  clone() {
    return new fl(this.color, this.density);
  }
  toJSON() {
    return {
      type: "FogExp2",
      color: this.color.getHex(),
      density: this.density
    };
  }
}
fl.prototype.isFogExp2 = !0;
class pl {
  constructor(e, t = 1, i = 1e3) {
    this.name = "", this.color = new Ue(e), this.near = t, this.far = i;
  }
  clone() {
    return new pl(this.color, this.near, this.far);
  }
  toJSON() {
    return {
      type: "Fog",
      color: this.color.getHex(),
      near: this.near,
      far: this.far
    };
  }
}
pl.prototype.isFog = !0;
class wu extends ut {
  constructor() {
    super(), this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = !0, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
  }
  copy(e, t) {
    return super.copy(e, t), e.background !== null && (this.background = e.background.clone()), e.environment !== null && (this.environment = e.environment.clone()), e.fog !== null && (this.fog = e.fog.clone()), e.overrideMaterial !== null && (this.overrideMaterial = e.overrideMaterial.clone()), this.autoUpdate = e.autoUpdate, this.matrixAutoUpdate = e.matrixAutoUpdate, this;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return this.fog !== null && (t.object.fog = this.fog.toJSON()), t;
  }
}
wu.prototype.isScene = !0;
class Qr {
  constructor(e, t) {
    this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Ro, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = Wn();
  }
  onUploadCallback() {
  }
  set needsUpdate(e) {
    e === !0 && this.version++;
  }
  setUsage(e) {
    return this.usage = e, this;
  }
  copy(e) {
    return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this;
  }
  copyAt(e, t, i) {
    e *= this.stride, i *= t.stride;
    for (let r = 0, s = this.stride; r < s; r++)
      this.array[e + r] = t.array[i + r];
    return this;
  }
  set(e, t = 0) {
    return this.array.set(e, t), this;
  }
  clone(e) {
    e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Wn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
    const t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), i = new this.constructor(t, this.stride);
    return i.setUsage(this.usage), i;
  }
  onUpload(e) {
    return this.onUploadCallback = e, this;
  }
  toJSON(e) {
    return e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Wn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer))), {
      uuid: this.uuid,
      buffer: this.array.buffer._uuid,
      type: this.array.constructor.name,
      stride: this.stride
    };
  }
}
Qr.prototype.isInterleavedBuffer = !0;
const Gt = /* @__PURE__ */ new Q();
class lr {
  constructor(e, t, i, r = !1) {
    this.name = "", this.data = e, this.itemSize = t, this.offset = i, this.normalized = r === !0;
  }
  get count() {
    return this.data.count;
  }
  get array() {
    return this.data.array;
  }
  set needsUpdate(e) {
    this.data.needsUpdate = e;
  }
  applyMatrix4(e) {
    for (let t = 0, i = this.data.count; t < i; t++)
      Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.applyMatrix4(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z);
    return this;
  }
  applyNormalMatrix(e) {
    for (let t = 0, i = this.count; t < i; t++)
      Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.applyNormalMatrix(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z);
    return this;
  }
  transformDirection(e) {
    for (let t = 0, i = this.count; t < i; t++)
      Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.transformDirection(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z);
    return this;
  }
  setX(e, t) {
    return this.data.array[e * this.data.stride + this.offset] = t, this;
  }
  setY(e, t) {
    return this.data.array[e * this.data.stride + this.offset + 1] = t, this;
  }
  setZ(e, t) {
    return this.data.array[e * this.data.stride + this.offset + 2] = t, this;
  }
  setW(e, t) {
    return this.data.array[e * this.data.stride + this.offset + 3] = t, this;
  }
  getX(e) {
    return this.data.array[e * this.data.stride + this.offset];
  }
  getY(e) {
    return this.data.array[e * this.data.stride + this.offset + 1];
  }
  getZ(e) {
    return this.data.array[e * this.data.stride + this.offset + 2];
  }
  getW(e) {
    return this.data.array[e * this.data.stride + this.offset + 3];
  }
  setXY(e, t, i) {
    return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this;
  }
  setXYZ(e, t, i, r) {
    return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this;
  }
  setXYZW(e, t, i, r, s) {
    return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this.data.array[e + 3] = s, this;
  }
  clone(e) {
    if (e === void 0) {
      console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");
      const t = [];
      for (let i = 0; i < this.count; i++) {
        const r = i * this.data.stride + this.offset;
        for (let s = 0; s < this.itemSize; s++)
          t.push(this.data.array[r + s]);
      }
      return new ot(new this.array.constructor(t), this.itemSize, this.normalized);
    } else
      return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new lr(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
  }
  toJSON(e) {
    if (e === void 0) {
      console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");
      const t = [];
      for (let i = 0; i < this.count; i++) {
        const r = i * this.data.stride + this.offset;
        for (let s = 0; s < this.itemSize; s++)
          t.push(this.data.array[r + s]);
      }
      return {
        itemSize: this.itemSize,
        type: this.array.constructor.name,
        array: t,
        normalized: this.normalized
      };
    } else
      return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), {
        isInterleavedBufferAttribute: !0,
        itemSize: this.itemSize,
        data: this.data.uuid,
        offset: this.offset,
        normalized: this.normalized
      };
  }
}
lr.prototype.isInterleavedBufferAttribute = !0;
class ml extends tn {
  constructor(e) {
    super(), this.type = "SpriteMaterial", this.color = new Ue(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.rotation = e.rotation, this.sizeAttenuation = e.sizeAttenuation, this;
  }
}
ml.prototype.isSpriteMaterial = !0;
let ro;
const ga = /* @__PURE__ */ new Q(), so = /* @__PURE__ */ new Q(), oo = /* @__PURE__ */ new Q(), ao = /* @__PURE__ */ new Re(), va = /* @__PURE__ */ new Re(), Sx = /* @__PURE__ */ new Xe(), Kl = /* @__PURE__ */ new Q(), ya = /* @__PURE__ */ new Q(), ql = /* @__PURE__ */ new Q(), yg = /* @__PURE__ */ new Re(), vh = /* @__PURE__ */ new Re(), bg = /* @__PURE__ */ new Re();
class gl extends ut {
  constructor(e) {
    if (super(), this.type = "Sprite", ro === void 0) {
      ro = new Ke();
      const t = new Float32Array([
        -0.5,
        -0.5,
        0,
        0,
        0,
        0.5,
        -0.5,
        0,
        1,
        0,
        0.5,
        0.5,
        0,
        1,
        1,
        -0.5,
        0.5,
        0,
        0,
        1
      ]), i = new Qr(t, 5);
      ro.setIndex([0, 1, 2, 0, 2, 3]), ro.setAttribute("position", new lr(i, 3, 0, !1)), ro.setAttribute("uv", new lr(i, 2, 3, !1));
    }
    this.geometry = ro, this.material = e !== void 0 ? e : new ml(), this.center = new Re(0.5, 0.5);
  }
  raycast(e, t) {
    e.camera === null && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), so.setFromMatrixScale(this.matrixWorld), Sx.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), oo.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && so.multiplyScalar(-oo.z);
    const i = this.material.rotation;
    let r, s;
    i !== 0 && (s = Math.cos(i), r = Math.sin(i));
    const o = this.center;
    Ql(Kl.set(-0.5, -0.5, 0), oo, o, so, r, s), Ql(ya.set(0.5, -0.5, 0), oo, o, so, r, s), Ql(ql.set(0.5, 0.5, 0), oo, o, so, r, s), yg.set(0, 0), vh.set(1, 0), bg.set(1, 1);
    let a = e.ray.intersectTriangle(Kl, ya, ql, !1, ga);
    if (a === null && (Ql(ya.set(-0.5, 0.5, 0), oo, o, so, r, s), vh.set(0, 1), a = e.ray.intersectTriangle(Kl, ql, ya, !1, ga), a === null))
      return;
    const c = e.ray.origin.distanceTo(ga);
    c < e.near || c > e.far || t.push({
      distance: c,
      point: ga.clone(),
      uv: Zt.getUV(ga, Kl, ya, ql, yg, vh, bg, new Re()),
      face: null,
      object: this
    });
  }
  copy(e) {
    return super.copy(e), e.center !== void 0 && this.center.copy(e.center), this.material = e.material, this;
  }
}
gl.prototype.isSprite = !0;
function Ql(n, e, t, i, r, s) {
  ao.subVectors(n, t).addScalar(0.5).multiply(i), r !== void 0 ? (va.x = s * ao.x - r * ao.y, va.y = r * ao.x + s * ao.y) : va.copy(ao), n.copy(e), n.x += va.x, n.y += va.y, n.applyMatrix4(Sx);
}
const ec = /* @__PURE__ */ new Q(), xg = /* @__PURE__ */ new Q();
class _x extends ut {
  constructor() {
    super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, {
      levels: {
        enumerable: !0,
        value: []
      },
      isLOD: {
        value: !0
      }
    }), this.autoUpdate = !0;
  }
  copy(e) {
    super.copy(e, !1);
    const t = e.levels;
    for (let i = 0, r = t.length; i < r; i++) {
      const s = t[i];
      this.addLevel(s.object.clone(), s.distance);
    }
    return this.autoUpdate = e.autoUpdate, this;
  }
  addLevel(e, t = 0) {
    t = Math.abs(t);
    const i = this.levels;
    let r;
    for (r = 0; r < i.length && !(t < i[r].distance); r++)
      ;
    return i.splice(r, 0, { distance: t, object: e }), this.add(e), this;
  }
  getCurrentLevel() {
    return this._currentLevel;
  }
  getObjectForDistance(e) {
    const t = this.levels;
    if (t.length > 0) {
      let i, r;
      for (i = 1, r = t.length; i < r && !(e < t[i].distance); i++)
        ;
      return t[i - 1].object;
    }
    return null;
  }
  raycast(e, t) {
    if (this.levels.length > 0) {
      ec.setFromMatrixPosition(this.matrixWorld);
      const r = e.ray.origin.distanceTo(ec);
      this.getObjectForDistance(r).raycast(e, t);
    }
  }
  update(e) {
    const t = this.levels;
    if (t.length > 1) {
      ec.setFromMatrixPosition(e.matrixWorld), xg.setFromMatrixPosition(this.matrixWorld);
      const i = ec.distanceTo(xg) / e.zoom;
      t[0].object.visible = !0;
      let r, s;
      for (r = 1, s = t.length; r < s && i >= t[r].distance; r++)
        t[r - 1].object.visible = !1, t[r].object.visible = !0;
      for (this._currentLevel = r - 1; r < s; r++)
        t[r].object.visible = !1;
    }
  }
  toJSON(e) {
    const t = super.toJSON(e);
    this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = [];
    const i = this.levels;
    for (let r = 0, s = i.length; r < s; r++) {
      const o = i[r];
      t.object.levels.push({
        object: o.object.uuid,
        distance: o.distance
      });
    }
    return t;
  }
}
const Mg = /* @__PURE__ */ new Q(), wg = /* @__PURE__ */ new xt(), Ag = /* @__PURE__ */ new xt(), BD = /* @__PURE__ */ new Q(), Sg = /* @__PURE__ */ new Xe();
class vl extends Xt {
  constructor(e, t) {
    super(e, t), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new Xe(), this.bindMatrixInverse = new Xe();
  }
  copy(e) {
    return super.copy(e), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, this;
  }
  bind(e, t) {
    this.skeleton = e, t === void 0 && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert();
  }
  pose() {
    this.skeleton.pose();
  }
  normalizeSkinWeights() {
    const e = new xt(), t = this.geometry.attributes.skinWeight;
    for (let i = 0, r = t.count; i < r; i++) {
      e.x = t.getX(i), e.y = t.getY(i), e.z = t.getZ(i), e.w = t.getW(i);
      const s = 1 / e.manhattanLength();
      s !== 1 / 0 ? e.multiplyScalar(s) : e.set(1, 0, 0, 0), t.setXYZW(i, e.x, e.y, e.z, e.w);
    }
  }
  updateMatrixWorld(e) {
    super.updateMatrixWorld(e), this.bindMode === "attached" ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === "detached" ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
  }
  boneTransform(e, t) {
    const i = this.skeleton, r = this.geometry;
    wg.fromBufferAttribute(r.attributes.skinIndex, e), Ag.fromBufferAttribute(r.attributes.skinWeight, e), Mg.fromBufferAttribute(r.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
    for (let s = 0; s < 4; s++) {
      const o = Ag.getComponent(s);
      if (o !== 0) {
        const a = wg.getComponent(s);
        Sg.multiplyMatrices(i.bones[a].matrixWorld, i.boneInverses[a]), t.addScaledVector(BD.copy(Mg).applyMatrix4(Sg), o);
      }
    }
    return t.applyMatrix4(this.bindMatrixInverse);
  }
}
vl.prototype.isSkinnedMesh = !0;
class yl extends ut {
  constructor() {
    super(), this.type = "Bone";
  }
}
yl.prototype.isBone = !0;
class Ss extends Yt {
  constructor(e = null, t = 1, i = 1, r, s, o, a, c, l = $t, d = $t, h, f) {
    super(null, o, a, c, l, d, r, s, h, f), this.image = { data: e, width: t, height: i }, this.magFilter = l, this.minFilter = d, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0;
  }
}
Ss.prototype.isDataTexture = !0;
const _g = /* @__PURE__ */ new Xe(), UD = /* @__PURE__ */ new Xe();
class bl {
  constructor(e = [], t = []) {
    this.uuid = Wn(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.boneTextureSize = 0, this.frame = -1, this.init();
  }
  init() {
    const e = this.bones, t = this.boneInverses;
    if (this.boneMatrices = new Float32Array(e.length * 16), t.length === 0)
      this.calculateInverses();
    else if (e.length !== t.length) {
      console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = [];
      for (let i = 0, r = this.bones.length; i < r; i++)
        this.boneInverses.push(new Xe());
    }
  }
  calculateInverses() {
    this.boneInverses.length = 0;
    for (let e = 0, t = this.bones.length; e < t; e++) {
      const i = new Xe();
      this.bones[e] && i.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(i);
    }
  }
  pose() {
    for (let e = 0, t = this.bones.length; e < t; e++) {
      const i = this.bones[e];
      i && i.matrixWorld.copy(this.boneInverses[e]).invert();
    }
    for (let e = 0, t = this.bones.length; e < t; e++) {
      const i = this.bones[e];
      i && (i.parent && i.parent.isBone ? (i.matrix.copy(i.parent.matrixWorld).invert(), i.matrix.multiply(i.matrixWorld)) : i.matrix.copy(i.matrixWorld), i.matrix.decompose(i.position, i.quaternion, i.scale));
    }
  }
  update() {
    const e = this.bones, t = this.boneInverses, i = this.boneMatrices, r = this.boneTexture;
    for (let s = 0, o = e.length; s < o; s++) {
      const a = e[s] ? e[s].matrixWorld : UD;
      _g.multiplyMatrices(a, t[s]), _g.toArray(i, s * 16);
    }
    r !== null && (r.needsUpdate = !0);
  }
  clone() {
    return new bl(this.bones, this.boneInverses);
  }
  computeBoneTexture() {
    let e = Math.sqrt(this.bones.length * 4);
    e = ex(e), e = Math.max(e, 4);
    const t = new Float32Array(e * e * 4);
    t.set(this.boneMatrices);
    const i = new Ss(t, e, e, Hn, Qi);
    return this.boneMatrices = t, this.boneTexture = i, this.boneTextureSize = e, this;
  }
  getBoneByName(e) {
    for (let t = 0, i = this.bones.length; t < i; t++) {
      const r = this.bones[t];
      if (r.name === e)
        return r;
    }
  }
  dispose() {
    this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null);
  }
  fromJSON(e, t) {
    this.uuid = e.uuid;
    for (let i = 0, r = e.bones.length; i < r; i++) {
      const s = e.bones[i];
      let o = t[s];
      o === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", s), o = new yl()), this.bones.push(o), this.boneInverses.push(new Xe().fromArray(e.boneInverses[i]));
    }
    return this.init(), this;
  }
  toJSON() {
    const e = {
      metadata: {
        version: 4.5,
        type: "Skeleton",
        generator: "Skeleton.toJSON"
      },
      bones: [],
      boneInverses: []
    };
    e.uuid = this.uuid;
    const t = this.bones, i = this.boneInverses;
    for (let r = 0, s = t.length; r < s; r++) {
      const o = t[r];
      e.bones.push(o.uuid);
      const a = i[r];
      e.boneInverses.push(a.toArray());
    }
    return e;
  }
}
const Tg = /* @__PURE__ */ new Xe(), Eg = /* @__PURE__ */ new Xe(), tc = [], ba = /* @__PURE__ */ new Xt();
class Pf extends Xt {
  constructor(e, t, i) {
    super(e, t), this.instanceMatrix = new ot(new Float32Array(i * 16), 16), this.instanceColor = null, this.count = i, this.frustumCulled = !1;
  }
  copy(e) {
    return super.copy(e), this.instanceMatrix.copy(e.instanceMatrix), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, this;
  }
  getColorAt(e, t) {
    t.fromArray(this.instanceColor.array, e * 3);
  }
  getMatrixAt(e, t) {
    t.fromArray(this.instanceMatrix.array, e * 16);
  }
  raycast(e, t) {
    const i = this.matrixWorld, r = this.count;
    if (ba.geometry = this.geometry, ba.material = this.material, ba.material !== void 0)
      for (let s = 0; s < r; s++) {
        this.getMatrixAt(s, Tg), Eg.multiplyMatrices(i, Tg), ba.matrixWorld = Eg, ba.raycast(e, tc);
        for (let o = 0, a = tc.length; o < a; o++) {
          const c = tc[o];
          c.instanceId = s, c.object = this, t.push(c);
        }
        tc.length = 0;
      }
  }
  setColorAt(e, t) {
    this.instanceColor === null && (this.instanceColor = new ot(new Float32Array(this.count * 3), 3)), t.toArray(this.instanceColor.array, e * 3);
  }
  setMatrixAt(e, t) {
    t.toArray(this.instanceMatrix.array, e * 16);
  }
  updateMorphTargets() {
  }
  dispose() {
    this.dispatchEvent({ type: "dispose" });
  }
}
Pf.prototype.isInstancedMesh = !0;
class an extends tn {
  constructor(e) {
    super(), this.type = "LineBasicMaterial", this.color = new Ue(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.morphTargets = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.morphTargets = e.morphTargets, this;
  }
}
an.prototype.isLineBasicMaterial = !0;
const Cg = /* @__PURE__ */ new Q(), Lg = /* @__PURE__ */ new Q(), Rg = /* @__PURE__ */ new Xe(), yh = /* @__PURE__ */ new qr(), nc = /* @__PURE__ */ new mr();
class Oi extends ut {
  constructor(e = new Ke(), t = new an()) {
    super(), this.type = "Line", this.geometry = e, this.material = t, this.updateMorphTargets();
  }
  copy(e) {
    return super.copy(e), this.material = e.material, this.geometry = e.geometry, this;
  }
  computeLineDistances() {
    const e = this.geometry;
    if (e.isBufferGeometry)
      if (e.index === null) {
        const t = e.attributes.position, i = [0];
        for (let r = 1, s = t.count; r < s; r++)
          Cg.fromBufferAttribute(t, r - 1), Lg.fromBufferAttribute(t, r), i[r] = i[r - 1], i[r] += Cg.distanceTo(Lg);
        e.setAttribute("lineDistance", new We(i, 1));
      } else
        console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
    else e.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
    return this;
  }
  raycast(e, t) {
    const i = this.geometry, r = this.matrixWorld, s = e.params.Line.threshold, o = i.drawRange;
    if (i.boundingSphere === null && i.computeBoundingSphere(), nc.copy(i.boundingSphere), nc.applyMatrix4(r), nc.radius += s, e.ray.intersectsSphere(nc) === !1) return;
    Rg.copy(r).invert(), yh.copy(e.ray).applyMatrix4(Rg);
    const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a, l = new Q(), d = new Q(), h = new Q(), f = new Q(), g = this.isLineSegments ? 2 : 1;
    if (i.isBufferGeometry) {
      const p = i.index, y = i.attributes.position;
      if (p !== null) {
        const v = Math.max(0, o.start), m = Math.min(p.count, o.start + o.count);
        for (let x = v, w = m - 1; x < w; x += g) {
          const A = p.getX(x), M = p.getX(x + 1);
          if (l.fromBufferAttribute(y, A), d.fromBufferAttribute(y, M), yh.distanceSqToSegment(l, d, f, h) > c) continue;
          f.applyMatrix4(this.matrixWorld);
          const L = e.ray.origin.distanceTo(f);
          L < e.near || L > e.far || t.push({
            distance: L,
            // What do we want? intersection point on the ray or on the segment??
            // point: raycaster.ray.at( distance ),
            point: h.clone().applyMatrix4(this.matrixWorld),
            index: x,
            face: null,
            faceIndex: null,
            object: this
          });
        }
      } else {
        const v = Math.max(0, o.start), m = Math.min(y.count, o.start + o.count);
        for (let x = v, w = m - 1; x < w; x += g) {
          if (l.fromBufferAttribute(y, x), d.fromBufferAttribute(y, x + 1), yh.distanceSqToSegment(l, d, f, h) > c) continue;
          f.applyMatrix4(this.matrixWorld);
          const M = e.ray.origin.distanceTo(f);
          M < e.near || M > e.far || t.push({
            distance: M,
            // What do we want? intersection point on the ray or on the segment??
            // point: raycaster.ray.at( distance ),
            point: h.clone().applyMatrix4(this.matrixWorld),
            index: x,
            face: null,
            faceIndex: null,
            object: this
          });
        }
      }
    } else i.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
  }
  updateMorphTargets() {
    const e = this.geometry;
    if (e.isBufferGeometry) {
      const t = e.morphAttributes, i = Object.keys(t);
      if (i.length > 0) {
        const r = t[i[0]];
        if (r !== void 0) {
          this.morphTargetInfluences = [], this.morphTargetDictionary = {};
          for (let s = 0, o = r.length; s < o; s++) {
            const a = r[s].name || String(s);
            this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s;
          }
        }
      }
    } else {
      const t = e.morphTargets;
      t !== void 0 && t.length > 0 && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
    }
  }
}
Oi.prototype.isLine = !0;
const Fg = /* @__PURE__ */ new Q(), Pg = /* @__PURE__ */ new Q();
class Rn extends Oi {
  constructor(e, t) {
    super(e, t), this.type = "LineSegments";
  }
  computeLineDistances() {
    const e = this.geometry;
    if (e.isBufferGeometry)
      if (e.index === null) {
        const t = e.attributes.position, i = [];
        for (let r = 0, s = t.count; r < s; r += 2)
          Fg.fromBufferAttribute(t, r), Pg.fromBufferAttribute(t, r + 1), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + Fg.distanceTo(Pg);
        e.setAttribute("lineDistance", new We(i, 1));
      } else
        console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
    else e.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
    return this;
  }
}
Rn.prototype.isLineSegments = !0;
class Au extends Oi {
  constructor(e, t) {
    super(e, t), this.type = "LineLoop";
  }
}
Au.prototype.isLineLoop = !0;
class es extends tn {
  constructor(e) {
    super(), this.type = "PointsMaterial", this.color = new Ue(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.morphTargets = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.morphTargets = e.morphTargets, this;
  }
}
es.prototype.isPointsMaterial = !0;
const Ig = /* @__PURE__ */ new Xe(), wd = /* @__PURE__ */ new qr(), ic = /* @__PURE__ */ new mr(), rc = /* @__PURE__ */ new Q();
class ia extends ut {
  constructor(e = new Ke(), t = new es()) {
    super(), this.type = "Points", this.geometry = e, this.material = t, this.updateMorphTargets();
  }
  copy(e) {
    return super.copy(e), this.material = e.material, this.geometry = e.geometry, this;
  }
  raycast(e, t) {
    const i = this.geometry, r = this.matrixWorld, s = e.params.Points.threshold, o = i.drawRange;
    if (i.boundingSphere === null && i.computeBoundingSphere(), ic.copy(i.boundingSphere), ic.applyMatrix4(r), ic.radius += s, e.ray.intersectsSphere(ic) === !1) return;
    Ig.copy(r).invert(), wd.copy(e.ray).applyMatrix4(Ig);
    const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a;
    if (i.isBufferGeometry) {
      const l = i.index, h = i.attributes.position;
      if (l !== null) {
        const f = Math.max(0, o.start), g = Math.min(l.count, o.start + o.count);
        for (let p = f, u = g; p < u; p++) {
          const y = l.getX(p);
          rc.fromBufferAttribute(h, y), Og(rc, y, c, r, e, t, this);
        }
      } else {
        const f = Math.max(0, o.start), g = Math.min(h.count, o.start + o.count);
        for (let p = f, u = g; p < u; p++)
          rc.fromBufferAttribute(h, p), Og(rc, p, c, r, e, t, this);
      }
    } else
      console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
  }
  updateMorphTargets() {
    const e = this.geometry;
    if (e.isBufferGeometry) {
      const t = e.morphAttributes, i = Object.keys(t);
      if (i.length > 0) {
        const r = t[i[0]];
        if (r !== void 0) {
          this.morphTargetInfluences = [], this.morphTargetDictionary = {};
          for (let s = 0, o = r.length; s < o; s++) {
            const a = r[s].name || String(s);
            this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s;
          }
        }
      }
    } else {
      const t = e.morphTargets;
      t !== void 0 && t.length > 0 && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
    }
  }
}
ia.prototype.isPoints = !0;
function Og(n, e, t, i, r, s, o) {
  const a = wd.distanceSqToPoint(n);
  if (a < t) {
    const c = new Q();
    wd.closestPointToPoint(n, c), c.applyMatrix4(i);
    const l = r.ray.origin.distanceTo(c);
    if (l < r.near || l > r.far) return;
    s.push({
      distance: l,
      distanceToRay: Math.sqrt(a),
      point: c,
      index: e,
      face: null,
      object: o
    });
  }
}
class Tx extends Yt {
  constructor(e, t, i, r, s, o, a, c, l) {
    super(e, t, i, r, s, o, a, c, l), this.format = a !== void 0 ? a : ir, this.minFilter = o !== void 0 ? o : zt, this.magFilter = s !== void 0 ? s : zt, this.generateMipmaps = !1;
    const d = this;
    function h() {
      d.needsUpdate = !0, e.requestVideoFrameCallback(h);
    }
    "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(h);
  }
  clone() {
    return new this.constructor(this.image).copy(this);
  }
  update() {
    const e = this.image;
    "requestVideoFrameCallback" in e === !1 && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0);
  }
}
Tx.prototype.isVideoTexture = !0;
class If extends Yt {
  constructor(e, t, i, r, s, o, a, c, l, d, h, f) {
    super(null, o, a, c, l, d, r, s, h, f), this.image = { width: t, height: i }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1;
  }
}
If.prototype.isCompressedTexture = !0;
class Ex extends Yt {
  constructor(e, t, i, r, s, o, a, c, l) {
    super(e, t, i, r, s, o, a, c, l), this.needsUpdate = !0;
  }
}
Ex.prototype.isCanvasTexture = !0;
class Cx extends Yt {
  constructor(e, t, i, r, s, o, a, c, l, d) {
    if (d = d !== void 0 ? d : ws, d !== ws && d !== Co)
      throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
    i === void 0 && d === ws && (i = Ha), i === void 0 && d === Co && (i = yo), super(null, r, s, o, a, c, d, i, l), this.image = { width: e, height: t }, this.magFilter = a !== void 0 ? a : $t, this.minFilter = c !== void 0 ? c : $t, this.flipY = !1, this.generateMipmaps = !1;
  }
}
Cx.prototype.isDepthTexture = !0;
class Io extends Ke {
  constructor(e = 1, t = 8, i = 0, r = Math.PI * 2) {
    super(), this.type = "CircleGeometry", this.parameters = {
      radius: e,
      segments: t,
      thetaStart: i,
      thetaLength: r
    }, t = Math.max(3, t);
    const s = [], o = [], a = [], c = [], l = new Q(), d = new Re();
    o.push(0, 0, 0), a.push(0, 0, 1), c.push(0.5, 0.5);
    for (let h = 0, f = 3; h <= t; h++, f += 3) {
      const g = i + h / t * r;
      l.x = e * Math.cos(g), l.y = e * Math.sin(g), o.push(l.x, l.y, l.z), a.push(0, 0, 1), d.x = (o[f] / e + 1) / 2, d.y = (o[f + 1] / e + 1) / 2, c.push(d.x, d.y);
    }
    for (let h = 1; h <= t; h++)
      s.push(h, h + 1, 0);
    this.setIndex(s), this.setAttribute("position", new We(o, 3)), this.setAttribute("normal", new We(a, 3)), this.setAttribute("uv", new We(c, 2));
  }
  static fromJSON(e) {
    return new Io(e.radius, e.segments, e.thetaStart, e.thetaLength);
  }
}
class $r extends Ke {
  constructor(e = 1, t = 1, i = 1, r = 8, s = 1, o = !1, a = 0, c = Math.PI * 2) {
    super(), this.type = "CylinderGeometry", this.parameters = {
      radiusTop: e,
      radiusBottom: t,
      height: i,
      radialSegments: r,
      heightSegments: s,
      openEnded: o,
      thetaStart: a,
      thetaLength: c
    };
    const l = this;
    r = Math.floor(r), s = Math.floor(s);
    const d = [], h = [], f = [], g = [];
    let p = 0;
    const u = [], y = i / 2;
    let v = 0;
    m(), o === !1 && (e > 0 && x(!0), t > 0 && x(!1)), this.setIndex(d), this.setAttribute("position", new We(h, 3)), this.setAttribute("normal", new We(f, 3)), this.setAttribute("uv", new We(g, 2));
    function m() {
      const w = new Q(), A = new Q();
      let M = 0;
      const R = (t - e) / i;
      for (let L = 0; L <= s; L++) {
        const _ = [], F = L / s, S = F * (t - e) + e;
        for (let T = 0; T <= r; T++) {
          const E = T / r, C = E * c + a, P = Math.sin(C), b = Math.cos(C);
          A.x = S * P, A.y = -F * i + y, A.z = S * b, h.push(A.x, A.y, A.z), w.set(P, R, b).normalize(), f.push(w.x, w.y, w.z), g.push(E, 1 - F), _.push(p++);
        }
        u.push(_);
      }
      for (let L = 0; L < r; L++)
        for (let _ = 0; _ < s; _++) {
          const F = u[_][L], S = u[_ + 1][L], T = u[_ + 1][L + 1], E = u[_][L + 1];
          d.push(F, S, E), d.push(S, T, E), M += 6;
        }
      l.addGroup(v, M, 0), v += M;
    }
    function x(w) {
      const A = p, M = new Re(), R = new Q();
      let L = 0;
      const _ = w === !0 ? e : t, F = w === !0 ? 1 : -1;
      for (let T = 1; T <= r; T++)
        h.push(0, y * F, 0), f.push(0, F, 0), g.push(0.5, 0.5), p++;
      const S = p;
      for (let T = 0; T <= r; T++) {
        const C = T / r * c + a, P = Math.cos(C), b = Math.sin(C);
        R.x = _ * b, R.y = y * F, R.z = _ * P, h.push(R.x, R.y, R.z), f.push(0, F, 0), M.x = P * 0.5 + 0.5, M.y = b * 0.5 * F + 0.5, g.push(M.x, M.y), p++;
      }
      for (let T = 0; T < r; T++) {
        const E = A + T, C = S + T;
        w === !0 ? d.push(C, C + 1, E) : d.push(C + 1, C, E), L += 3;
      }
      l.addGroup(v, L, w === !0 ? 1 : 2), v += L;
    }
  }
  static fromJSON(e) {
    return new $r(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength);
  }
}
class Oo extends $r {
  constructor(e = 1, t = 1, i = 8, r = 1, s = !1, o = 0, a = Math.PI * 2) {
    super(0, e, t, i, r, s, o, a), this.type = "ConeGeometry", this.parameters = {
      radius: e,
      height: t,
      radialSegments: i,
      heightSegments: r,
      openEnded: s,
      thetaStart: o,
      thetaLength: a
    };
  }
  static fromJSON(e) {
    return new Oo(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength);
  }
}
class Di extends Ke {
  constructor(e, t, i = 1, r = 0) {
    super(), this.type = "PolyhedronGeometry", this.parameters = {
      vertices: e,
      indices: t,
      radius: i,
      detail: r
    };
    const s = [], o = [];
    a(r), l(i), d(), this.setAttribute("position", new We(s, 3)), this.setAttribute("normal", new We(s.slice(), 3)), this.setAttribute("uv", new We(o, 2)), r === 0 ? this.computeVertexNormals() : this.normalizeNormals();
    function a(m) {
      const x = new Q(), w = new Q(), A = new Q();
      for (let M = 0; M < t.length; M += 3)
        g(t[M + 0], x), g(t[M + 1], w), g(t[M + 2], A), c(x, w, A, m);
    }
    function c(m, x, w, A) {
      const M = A + 1, R = [];
      for (let L = 0; L <= M; L++) {
        R[L] = [];
        const _ = m.clone().lerp(w, L / M), F = x.clone().lerp(w, L / M), S = M - L;
        for (let T = 0; T <= S; T++)
          T === 0 && L === M ? R[L][T] = _ : R[L][T] = _.clone().lerp(F, T / S);
      }
      for (let L = 0; L < M; L++)
        for (let _ = 0; _ < 2 * (M - L) - 1; _++) {
          const F = Math.floor(_ / 2);
          _ % 2 === 0 ? (f(R[L][F + 1]), f(R[L + 1][F]), f(R[L][F])) : (f(R[L][F + 1]), f(R[L + 1][F + 1]), f(R[L + 1][F]));
        }
    }
    function l(m) {
      const x = new Q();
      for (let w = 0; w < s.length; w += 3)
        x.x = s[w + 0], x.y = s[w + 1], x.z = s[w + 2], x.normalize().multiplyScalar(m), s[w + 0] = x.x, s[w + 1] = x.y, s[w + 2] = x.z;
    }
    function d() {
      const m = new Q();
      for (let x = 0; x < s.length; x += 3) {
        m.x = s[x + 0], m.y = s[x + 1], m.z = s[x + 2];
        const w = y(m) / 2 / Math.PI + 0.5, A = v(m) / Math.PI + 0.5;
        o.push(w, 1 - A);
      }
      p(), h();
    }
    function h() {
      for (let m = 0; m < o.length; m += 6) {
        const x = o[m + 0], w = o[m + 2], A = o[m + 4], M = Math.max(x, w, A), R = Math.min(x, w, A);
        M > 0.9 && R < 0.1 && (x < 0.2 && (o[m + 0] += 1), w < 0.2 && (o[m + 2] += 1), A < 0.2 && (o[m + 4] += 1));
      }
    }
    function f(m) {
      s.push(m.x, m.y, m.z);
    }
    function g(m, x) {
      const w = m * 3;
      x.x = e[w + 0], x.y = e[w + 1], x.z = e[w + 2];
    }
    function p() {
      const m = new Q(), x = new Q(), w = new Q(), A = new Q(), M = new Re(), R = new Re(), L = new Re();
      for (let _ = 0, F = 0; _ < s.length; _ += 9, F += 6) {
        m.set(s[_ + 0], s[_ + 1], s[_ + 2]), x.set(s[_ + 3], s[_ + 4], s[_ + 5]), w.set(s[_ + 6], s[_ + 7], s[_ + 8]), M.set(o[F + 0], o[F + 1]), R.set(o[F + 2], o[F + 3]), L.set(o[F + 4], o[F + 5]), A.copy(m).add(x).add(w).divideScalar(3);
        const S = y(A);
        u(M, F + 0, m, S), u(R, F + 2, x, S), u(L, F + 4, w, S);
      }
    }
    function u(m, x, w, A) {
      A < 0 && m.x === 1 && (o[x] = m.x - 1), w.x === 0 && w.z === 0 && (o[x] = A / 2 / Math.PI + 0.5);
    }
    function y(m) {
      return Math.atan2(m.z, -m.x);
    }
    function v(m) {
      return Math.atan2(-m.y, Math.sqrt(m.x * m.x + m.z * m.z));
    }
  }
  static fromJSON(e) {
    return new Di(e.vertices, e.indices, e.radius, e.details);
  }
}
class Do extends Di {
  constructor(e = 1, t = 0) {
    const i = (1 + Math.sqrt(5)) / 2, r = 1 / i, s = [
      // (±1, ±1, ±1)
      -1,
      -1,
      -1,
      -1,
      -1,
      1,
      -1,
      1,
      -1,
      -1,
      1,
      1,
      1,
      -1,
      -1,
      1,
      -1,
      1,
      1,
      1,
      -1,
      1,
      1,
      1,
      // (0, ±1/φ, ±φ)
      0,
      -r,
      -i,
      0,
      -r,
      i,
      0,
      r,
      -i,
      0,
      r,
      i,
      // (±1/φ, ±φ, 0)
      -r,
      -i,
      0,
      -r,
      i,
      0,
      r,
      -i,
      0,
      r,
      i,
      0,
      // (±φ, 0, ±1/φ)
      -i,
      0,
      -r,
      i,
      0,
      -r,
      -i,
      0,
      r,
      i,
      0,
      r
    ], o = [
      3,
      11,
      7,
      3,
      7,
      15,
      3,
      15,
      13,
      7,
      19,
      17,
      7,
      17,
      6,
      7,
      6,
      15,
      17,
      4,
      8,
      17,
      8,
      10,
      17,
      10,
      6,
      8,
      0,
      16,
      8,
      16,
      2,
      8,
      2,
      10,
      0,
      12,
      1,
      0,
      1,
      18,
      0,
      18,
      16,
      6,
      10,
      2,
      6,
      2,
      13,
      6,
      13,
      15,
      2,
      16,
      18,
      2,
      18,
      3,
      2,
      3,
      13,
      18,
      1,
      9,
      18,
      9,
      11,
      18,
      11,
      3,
      4,
      14,
      12,
      4,
      12,
      0,
      4,
      0,
      8,
      11,
      9,
      5,
      11,
      5,
      19,
      11,
      19,
      7,
      19,
      5,
      14,
      19,
      14,
      4,
      19,
      4,
      17,
      1,
      12,
      14,
      1,
      14,
      5,
      1,
      5,
      9
    ];
    super(s, o, e, t), this.type = "DodecahedronGeometry", this.parameters = {
      radius: e,
      detail: t
    };
  }
  static fromJSON(e) {
    return new Do(e.radius, e.detail);
  }
}
const sc = new Q(), oc = new Q(), bh = new Q(), ac = new Zt();
class Of extends Ke {
  constructor(e, t) {
    if (super(), this.type = "EdgesGeometry", this.parameters = {
      thresholdAngle: t
    }, t = t !== void 0 ? t : 1, e.isGeometry === !0) {
      console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
      return;
    }
    const r = Math.pow(10, 4), s = Math.cos(As * t), o = e.getIndex(), a = e.getAttribute("position"), c = o ? o.count : a.count, l = [0, 0, 0], d = ["a", "b", "c"], h = new Array(3), f = {}, g = [];
    for (let p = 0; p < c; p += 3) {
      o ? (l[0] = o.getX(p), l[1] = o.getX(p + 1), l[2] = o.getX(p + 2)) : (l[0] = p, l[1] = p + 1, l[2] = p + 2);
      const { a: u, b: y, c: v } = ac;
      if (u.fromBufferAttribute(a, l[0]), y.fromBufferAttribute(a, l[1]), v.fromBufferAttribute(a, l[2]), ac.getNormal(bh), h[0] = `${Math.round(u.x * r)},${Math.round(u.y * r)},${Math.round(u.z * r)}`, h[1] = `${Math.round(y.x * r)},${Math.round(y.y * r)},${Math.round(y.z * r)}`, h[2] = `${Math.round(v.x * r)},${Math.round(v.y * r)},${Math.round(v.z * r)}`, !(h[0] === h[1] || h[1] === h[2] || h[2] === h[0]))
        for (let m = 0; m < 3; m++) {
          const x = (m + 1) % 3, w = h[m], A = h[x], M = ac[d[m]], R = ac[d[x]], L = `${w}_${A}`, _ = `${A}_${w}`;
          _ in f && f[_] ? (bh.dot(f[_].normal) <= s && (g.push(M.x, M.y, M.z), g.push(R.x, R.y, R.z)), f[_] = null) : L in f || (f[L] = {
            index0: l[m],
            index1: l[x],
            normal: bh.clone()
          });
        }
    }
    for (const p in f)
      if (f[p]) {
        const { index0: u, index1: y } = f[p];
        sc.fromBufferAttribute(a, u), oc.fromBufferAttribute(a, y), g.push(sc.x, sc.y, sc.z), g.push(oc.x, oc.y, oc.z);
      }
    this.setAttribute("position", new We(g, 3));
  }
}
class $n {
  constructor() {
    this.type = "Curve", this.arcLengthDivisions = 200;
  }
  // Virtual base class method to overwrite and implement in subclasses
  //	- t [0 .. 1]
  getPoint() {
    return console.warn("THREE.Curve: .getPoint() not implemented."), null;
  }
  // Get point at relative position in curve according to arc length
  // - u [0 .. 1]
  getPointAt(e, t) {
    const i = this.getUtoTmapping(e);
    return this.getPoint(i, t);
  }
  // Get sequence of points using getPoint( t )
  getPoints(e = 5) {
    const t = [];
    for (let i = 0; i <= e; i++)
      t.push(this.getPoint(i / e));
    return t;
  }
  // Get sequence of points using getPointAt( u )
  getSpacedPoints(e = 5) {
    const t = [];
    for (let i = 0; i <= e; i++)
      t.push(this.getPointAt(i / e));
    return t;
  }
  // Get total curve arc length
  getLength() {
    const e = this.getLengths();
    return e[e.length - 1];
  }
  // Get list of cumulative segment lengths
  getLengths(e = this.arcLengthDivisions) {
    if (this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate)
      return this.cacheArcLengths;
    this.needsUpdate = !1;
    const t = [];
    let i, r = this.getPoint(0), s = 0;
    t.push(0);
    for (let o = 1; o <= e; o++)
      i = this.getPoint(o / e), s += i.distanceTo(r), t.push(s), r = i;
    return this.cacheArcLengths = t, t;
  }
  updateArcLengths() {
    this.needsUpdate = !0, this.getLengths();
  }
  // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
  getUtoTmapping(e, t) {
    const i = this.getLengths();
    let r = 0;
    const s = i.length;
    let o;
    t ? o = t : o = e * i[s - 1];
    let a = 0, c = s - 1, l;
    for (; a <= c; )
      if (r = Math.floor(a + (c - a) / 2), l = i[r] - o, l < 0)
        a = r + 1;
      else if (l > 0)
        c = r - 1;
      else {
        c = r;
        break;
      }
    if (r = c, i[r] === o)
      return r / (s - 1);
    const d = i[r], f = i[r + 1] - d, g = (o - d) / f;
    return (r + g) / (s - 1);
  }
  // Returns a unit vector tangent at t
  // In case any sub curve does not implement its tangent derivation,
  // 2 points a small delta apart will be used to find its gradient
  // which seems to give a reasonable approximation
  getTangent(e, t) {
    let r = e - 1e-4, s = e + 1e-4;
    r < 0 && (r = 0), s > 1 && (s = 1);
    const o = this.getPoint(r), a = this.getPoint(s), c = t || (o.isVector2 ? new Re() : new Q());
    return c.copy(a).sub(o).normalize(), c;
  }
  getTangentAt(e, t) {
    const i = this.getUtoTmapping(e);
    return this.getTangent(i, t);
  }
  computeFrenetFrames(e, t) {
    const i = new Q(), r = [], s = [], o = [], a = new Q(), c = new Xe();
    for (let g = 0; g <= e; g++) {
      const p = g / e;
      r[g] = this.getTangentAt(p, new Q()), r[g].normalize();
    }
    s[0] = new Q(), o[0] = new Q();
    let l = Number.MAX_VALUE;
    const d = Math.abs(r[0].x), h = Math.abs(r[0].y), f = Math.abs(r[0].z);
    d <= l && (l = d, i.set(1, 0, 0)), h <= l && (l = h, i.set(0, 1, 0)), f <= l && i.set(0, 0, 1), a.crossVectors(r[0], i).normalize(), s[0].crossVectors(r[0], a), o[0].crossVectors(r[0], s[0]);
    for (let g = 1; g <= e; g++) {
      if (s[g] = s[g - 1].clone(), o[g] = o[g - 1].clone(), a.crossVectors(r[g - 1], r[g]), a.length() > Number.EPSILON) {
        a.normalize();
        const p = Math.acos(gn(r[g - 1].dot(r[g]), -1, 1));
        s[g].applyMatrix4(c.makeRotationAxis(a, p));
      }
      o[g].crossVectors(r[g], s[g]);
    }
    if (t === !0) {
      let g = Math.acos(gn(s[0].dot(s[e]), -1, 1));
      g /= e, r[0].dot(a.crossVectors(s[0], s[e])) > 0 && (g = -g);
      for (let p = 1; p <= e; p++)
        s[p].applyMatrix4(c.makeRotationAxis(r[p], g * p)), o[p].crossVectors(r[p], s[p]);
    }
    return {
      tangents: r,
      normals: s,
      binormals: o
    };
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.arcLengthDivisions = e.arcLengthDivisions, this;
  }
  toJSON() {
    const e = {
      metadata: {
        version: 4.5,
        type: "Curve",
        generator: "Curve.toJSON"
      }
    };
    return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e;
  }
  fromJSON(e) {
    return this.arcLengthDivisions = e.arcLengthDivisions, this;
  }
}
class xl extends $n {
  constructor(e = 0, t = 0, i = 1, r = 1, s = 0, o = Math.PI * 2, a = !1, c = 0) {
    super(), this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = i, this.yRadius = r, this.aStartAngle = s, this.aEndAngle = o, this.aClockwise = a, this.aRotation = c;
  }
  getPoint(e, t) {
    const i = t || new Re(), r = Math.PI * 2;
    let s = this.aEndAngle - this.aStartAngle;
    const o = Math.abs(s) < Number.EPSILON;
    for (; s < 0; ) s += r;
    for (; s > r; ) s -= r;
    s < Number.EPSILON && (o ? s = 0 : s = r), this.aClockwise === !0 && !o && (s === r ? s = -r : s = s - r);
    const a = this.aStartAngle + e * s;
    let c = this.aX + this.xRadius * Math.cos(a), l = this.aY + this.yRadius * Math.sin(a);
    if (this.aRotation !== 0) {
      const d = Math.cos(this.aRotation), h = Math.sin(this.aRotation), f = c - this.aX, g = l - this.aY;
      c = f * d - g * h + this.aX, l = f * h + g * d + this.aY;
    }
    return i.set(c, l);
  }
  copy(e) {
    return super.copy(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.aX = this.aX, e.aY = this.aY, e.xRadius = this.xRadius, e.yRadius = this.yRadius, e.aStartAngle = this.aStartAngle, e.aEndAngle = this.aEndAngle, e.aClockwise = this.aClockwise, e.aRotation = this.aRotation, e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this;
  }
}
xl.prototype.isEllipseCurve = !0;
class Df extends xl {
  constructor(e, t, i, r, s, o) {
    super(e, t, i, i, r, s, o), this.type = "ArcCurve";
  }
}
Df.prototype.isArcCurve = !0;
function Nf() {
  let n = 0, e = 0, t = 0, i = 0;
  function r(s, o, a, c) {
    n = s, e = a, t = -3 * s + 3 * o - 2 * a - c, i = 2 * s - 2 * o + a + c;
  }
  return {
    initCatmullRom: function(s, o, a, c, l) {
      r(o, a, l * (a - s), l * (c - o));
    },
    initNonuniformCatmullRom: function(s, o, a, c, l, d, h) {
      let f = (o - s) / l - (a - s) / (l + d) + (a - o) / d, g = (a - o) / d - (c - o) / (d + h) + (c - a) / h;
      f *= d, g *= d, r(o, a, f, g);
    },
    calc: function(s) {
      const o = s * s, a = o * s;
      return n + e * s + t * o + i * a;
    }
  };
}
const lc = new Q(), xh = new Nf(), Mh = new Nf(), wh = new Nf();
class Bf extends $n {
  constructor(e = [], t = !1, i = "centripetal", r = 0.5) {
    super(), this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = i, this.tension = r;
  }
  getPoint(e, t = new Q()) {
    const i = t, r = this.points, s = r.length, o = (s - (this.closed ? 0 : 1)) * e;
    let a = Math.floor(o), c = o - a;
    this.closed ? a += a > 0 ? 0 : (Math.floor(Math.abs(a) / s) + 1) * s : c === 0 && a === s - 1 && (a = s - 2, c = 1);
    let l, d;
    this.closed || a > 0 ? l = r[(a - 1) % s] : (lc.subVectors(r[0], r[1]).add(r[0]), l = lc);
    const h = r[a % s], f = r[(a + 1) % s];
    if (this.closed || a + 2 < s ? d = r[(a + 2) % s] : (lc.subVectors(r[s - 1], r[s - 2]).add(r[s - 1]), d = lc), this.curveType === "centripetal" || this.curveType === "chordal") {
      const g = this.curveType === "chordal" ? 0.5 : 0.25;
      let p = Math.pow(l.distanceToSquared(h), g), u = Math.pow(h.distanceToSquared(f), g), y = Math.pow(f.distanceToSquared(d), g);
      u < 1e-4 && (u = 1), p < 1e-4 && (p = u), y < 1e-4 && (y = u), xh.initNonuniformCatmullRom(l.x, h.x, f.x, d.x, p, u, y), Mh.initNonuniformCatmullRom(l.y, h.y, f.y, d.y, p, u, y), wh.initNonuniformCatmullRom(l.z, h.z, f.z, d.z, p, u, y);
    } else this.curveType === "catmullrom" && (xh.initCatmullRom(l.x, h.x, f.x, d.x, this.tension), Mh.initCatmullRom(l.y, h.y, f.y, d.y, this.tension), wh.initCatmullRom(l.z, h.z, f.z, d.z, this.tension));
    return i.set(
      xh.calc(c),
      Mh.calc(c),
      wh.calc(c)
    ), i;
  }
  copy(e) {
    super.copy(e), this.points = [];
    for (let t = 0, i = e.points.length; t < i; t++) {
      const r = e.points[t];
      this.points.push(r.clone());
    }
    return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this;
  }
  toJSON() {
    const e = super.toJSON();
    e.points = [];
    for (let t = 0, i = this.points.length; t < i; t++) {
      const r = this.points[t];
      e.points.push(r.toArray());
    }
    return e.closed = this.closed, e.curveType = this.curveType, e.tension = this.tension, e;
  }
  fromJSON(e) {
    super.fromJSON(e), this.points = [];
    for (let t = 0, i = e.points.length; t < i; t++) {
      const r = e.points[t];
      this.points.push(new Q().fromArray(r));
    }
    return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this;
  }
}
Bf.prototype.isCatmullRomCurve3 = !0;
function Dg(n, e, t, i, r) {
  const s = (i - e) * 0.5, o = (r - t) * 0.5, a = n * n, c = n * a;
  return (2 * t - 2 * i + s + o) * c + (-3 * t + 3 * i - 2 * s - o) * a + s * n + t;
}
function zD(n, e) {
  const t = 1 - n;
  return t * t * e;
}
function kD(n, e) {
  return 2 * (1 - n) * n * e;
}
function VD(n, e) {
  return n * n * e;
}
function Pa(n, e, t, i) {
  return zD(n, e) + kD(n, t) + VD(n, i);
}
function GD(n, e) {
  const t = 1 - n;
  return t * t * t * e;
}
function HD(n, e) {
  const t = 1 - n;
  return 3 * t * t * n * e;
}
function WD(n, e) {
  return 3 * (1 - n) * n * n * e;
}
function jD(n, e) {
  return n * n * n * e;
}
function Ia(n, e, t, i, r) {
  return GD(n, e) + HD(n, t) + WD(n, i) + jD(n, r);
}
class Su extends $n {
  constructor(e = new Re(), t = new Re(), i = new Re(), r = new Re()) {
    super(), this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r;
  }
  getPoint(e, t = new Re()) {
    const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3;
    return i.set(
      Ia(e, r.x, s.x, o.x, a.x),
      Ia(e, r.y, s.y, o.y, a.y)
    ), i;
  }
  copy(e) {
    return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this;
  }
}
Su.prototype.isCubicBezierCurve = !0;
class Uf extends $n {
  constructor(e = new Q(), t = new Q(), i = new Q(), r = new Q()) {
    super(), this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r;
  }
  getPoint(e, t = new Q()) {
    const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3;
    return i.set(
      Ia(e, r.x, s.x, o.x, a.x),
      Ia(e, r.y, s.y, o.y, a.y),
      Ia(e, r.z, s.z, o.z, a.z)
    ), i;
  }
  copy(e) {
    return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this;
  }
}
Uf.prototype.isCubicBezierCurve3 = !0;
class Ml extends $n {
  constructor(e = new Re(), t = new Re()) {
    super(), this.type = "LineCurve", this.v1 = e, this.v2 = t;
  }
  getPoint(e, t = new Re()) {
    const i = t;
    return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i;
  }
  // Line curve is linear, so we can overwrite default getPointAt
  getPointAt(e, t) {
    return this.getPoint(e, t);
  }
  getTangent(e, t) {
    const i = t || new Re();
    return i.copy(this.v2).sub(this.v1).normalize(), i;
  }
  copy(e) {
    return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this;
  }
}
Ml.prototype.isLineCurve = !0;
class Lx extends $n {
  constructor(e = new Q(), t = new Q()) {
    super(), this.type = "LineCurve3", this.isLineCurve3 = !0, this.v1 = e, this.v2 = t;
  }
  getPoint(e, t = new Q()) {
    const i = t;
    return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i;
  }
  // Line curve is linear, so we can overwrite default getPointAt
  getPointAt(e, t) {
    return this.getPoint(e, t);
  }
  copy(e) {
    return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this;
  }
}
class _u extends $n {
  constructor(e = new Re(), t = new Re(), i = new Re()) {
    super(), this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i;
  }
  getPoint(e, t = new Re()) {
    const i = t, r = this.v0, s = this.v1, o = this.v2;
    return i.set(
      Pa(e, r.x, s.x, o.x),
      Pa(e, r.y, s.y, o.y)
    ), i;
  }
  copy(e) {
    return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this;
  }
}
_u.prototype.isQuadraticBezierCurve = !0;
class zf extends $n {
  constructor(e = new Q(), t = new Q(), i = new Q()) {
    super(), this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i;
  }
  getPoint(e, t = new Q()) {
    const i = t, r = this.v0, s = this.v1, o = this.v2;
    return i.set(
      Pa(e, r.x, s.x, o.x),
      Pa(e, r.y, s.y, o.y),
      Pa(e, r.z, s.z, o.z)
    ), i;
  }
  copy(e) {
    return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this;
  }
}
zf.prototype.isQuadraticBezierCurve3 = !0;
class Tu extends $n {
  constructor(e = []) {
    super(), this.type = "SplineCurve", this.points = e;
  }
  getPoint(e, t = new Re()) {
    const i = t, r = this.points, s = (r.length - 1) * e, o = Math.floor(s), a = s - o, c = r[o === 0 ? o : o - 1], l = r[o], d = r[o > r.length - 2 ? r.length - 1 : o + 1], h = r[o > r.length - 3 ? r.length - 1 : o + 2];
    return i.set(
      Dg(a, c.x, l.x, d.x, h.x),
      Dg(a, c.y, l.y, d.y, h.y)
    ), i;
  }
  copy(e) {
    super.copy(e), this.points = [];
    for (let t = 0, i = e.points.length; t < i; t++) {
      const r = e.points[t];
      this.points.push(r.clone());
    }
    return this;
  }
  toJSON() {
    const e = super.toJSON();
    e.points = [];
    for (let t = 0, i = this.points.length; t < i; t++) {
      const r = this.points[t];
      e.points.push(r.toArray());
    }
    return e;
  }
  fromJSON(e) {
    super.fromJSON(e), this.points = [];
    for (let t = 0, i = e.points.length; t < i; t++) {
      const r = e.points[t];
      this.points.push(new Re().fromArray(r));
    }
    return this;
  }
}
Tu.prototype.isSplineCurve = !0;
var kf = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ArcCurve: Df,
  CatmullRomCurve3: Bf,
  CubicBezierCurve: Su,
  CubicBezierCurve3: Uf,
  EllipseCurve: xl,
  LineCurve: Ml,
  LineCurve3: Lx,
  QuadraticBezierCurve: _u,
  QuadraticBezierCurve3: zf,
  SplineCurve: Tu
});
const $D = {
  triangulate: function(n, e, t = 2) {
    const i = e && e.length, r = i ? e[0] * t : n.length;
    let s = Rx(n, 0, r, t, !0);
    const o = [];
    if (!s || s.next === s.prev) return o;
    let a, c, l, d, h, f, g;
    if (i && (s = KD(n, e, s, t)), n.length > 80 * t) {
      a = l = n[0], c = d = n[1];
      for (let p = t; p < r; p += t)
        h = n[p], f = n[p + 1], h < a && (a = h), f < c && (c = f), h > l && (l = h), f > d && (d = f);
      g = Math.max(l - a, d - c), g = g !== 0 ? 1 / g : 0;
    }
    return $a(s, o, t, a, c, g), o;
  }
};
function Rx(n, e, t, i, r) {
  let s, o;
  if (r === lN(n, e, t, i) > 0)
    for (s = e; s < t; s += i) o = Ng(s, n[s], n[s + 1], o);
  else
    for (s = t - i; s >= e; s -= i) o = Ng(s, n[s], n[s + 1], o);
  return o && Eu(o, o.next) && (Xa(o), o = o.next), o;
}
function Zr(n, e) {
  if (!n) return n;
  e || (e = n);
  let t = n, i;
  do
    if (i = !1, !t.steiner && (Eu(t, t.next) || Ot(t.prev, t, t.next) === 0)) {
      if (Xa(t), t = e = t.prev, t === t.next) break;
      i = !0;
    } else
      t = t.next;
  while (i || t !== e);
  return e;
}
function $a(n, e, t, i, r, s, o) {
  if (!n) return;
  !o && s && nN(n, i, r, s);
  let a = n, c, l;
  for (; n.prev !== n.next; ) {
    if (c = n.prev, l = n.next, s ? XD(n, i, r, s) : ZD(n)) {
      e.push(c.i / t), e.push(n.i / t), e.push(l.i / t), Xa(n), n = l.next, a = l.next;
      continue;
    }
    if (n = l, n === a) {
      o ? o === 1 ? (n = YD(Zr(n), e, t), $a(n, e, t, i, r, s, 2)) : o === 2 && JD(n, e, t, i, r, s) : $a(Zr(n), e, t, i, r, s, 1);
      break;
    }
  }
}
function ZD(n) {
  const e = n.prev, t = n, i = n.next;
  if (Ot(e, t, i) >= 0) return !1;
  let r = n.next.next;
  for (; r !== n.prev; ) {
    if (go(e.x, e.y, t.x, t.y, i.x, i.y, r.x, r.y) && Ot(r.prev, r, r.next) >= 0) return !1;
    r = r.next;
  }
  return !0;
}
function XD(n, e, t, i) {
  const r = n.prev, s = n, o = n.next;
  if (Ot(r, s, o) >= 0) return !1;
  const a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, c = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, l = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, d = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ad(a, c, e, t, i), f = Ad(l, d, e, t, i);
  let g = n.prevZ, p = n.nextZ;
  for (; g && g.z >= h && p && p.z <= f; ) {
    if (g !== n.prev && g !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && Ot(g.prev, g, g.next) >= 0 || (g = g.prevZ, p !== n.prev && p !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && Ot(p.prev, p, p.next) >= 0)) return !1;
    p = p.nextZ;
  }
  for (; g && g.z >= h; ) {
    if (g !== n.prev && g !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && Ot(g.prev, g, g.next) >= 0) return !1;
    g = g.prevZ;
  }
  for (; p && p.z <= f; ) {
    if (p !== n.prev && p !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && Ot(p.prev, p, p.next) >= 0) return !1;
    p = p.nextZ;
  }
  return !0;
}
function YD(n, e, t) {
  let i = n;
  do {
    const r = i.prev, s = i.next.next;
    !Eu(r, s) && Fx(r, i, i.next, s) && Za(r, s) && Za(s, r) && (e.push(r.i / t), e.push(i.i / t), e.push(s.i / t), Xa(i), Xa(i.next), i = n = s), i = i.next;
  } while (i !== n);
  return Zr(i);
}
function JD(n, e, t, i, r, s) {
  let o = n;
  do {
    let a = o.next.next;
    for (; a !== o.prev; ) {
      if (o.i !== a.i && sN(o, a)) {
        let c = Px(o, a);
        o = Zr(o, o.next), c = Zr(c, c.next), $a(o, e, t, i, r, s), $a(c, e, t, i, r, s);
        return;
      }
      a = a.next;
    }
    o = o.next;
  } while (o !== n);
}
function KD(n, e, t, i) {
  const r = [];
  let s, o, a, c, l;
  for (s = 0, o = e.length; s < o; s++)
    a = e[s] * i, c = s < o - 1 ? e[s + 1] * i : n.length, l = Rx(n, a, c, i, !1), l === l.next && (l.steiner = !0), r.push(rN(l));
  for (r.sort(qD), s = 0; s < r.length; s++)
    QD(r[s], t), t = Zr(t, t.next);
  return t;
}
function qD(n, e) {
  return n.x - e.x;
}
function QD(n, e) {
  if (e = eN(n, e), e) {
    const t = Px(e, n);
    Zr(e, e.next), Zr(t, t.next);
  }
}
function eN(n, e) {
  let t = e;
  const i = n.x, r = n.y;
  let s = -1 / 0, o;
  do {
    if (r <= t.y && r >= t.next.y && t.next.y !== t.y) {
      const f = t.x + (r - t.y) * (t.next.x - t.x) / (t.next.y - t.y);
      if (f <= i && f > s) {
        if (s = f, f === i) {
          if (r === t.y) return t;
          if (r === t.next.y) return t.next;
        }
        o = t.x < t.next.x ? t : t.next;
      }
    }
    t = t.next;
  } while (t !== e);
  if (!o) return null;
  if (i === s) return o;
  const a = o, c = o.x, l = o.y;
  let d = 1 / 0, h;
  t = o;
  do
    i >= t.x && t.x >= c && i !== t.x && go(r < l ? i : s, r, c, l, r < l ? s : i, r, t.x, t.y) && (h = Math.abs(r - t.y) / (i - t.x), Za(t, n) && (h < d || h === d && (t.x > o.x || t.x === o.x && tN(o, t))) && (o = t, d = h)), t = t.next;
  while (t !== a);
  return o;
}
function tN(n, e) {
  return Ot(n.prev, n, e.prev) < 0 && Ot(e.next, n, n.next) < 0;
}
function nN(n, e, t, i) {
  let r = n;
  do
    r.z === null && (r.z = Ad(r.x, r.y, e, t, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next;
  while (r !== n);
  r.prevZ.nextZ = null, r.prevZ = null, iN(r);
}
function iN(n) {
  let e, t, i, r, s, o, a, c, l = 1;
  do {
    for (t = n, n = null, s = null, o = 0; t; ) {
      for (o++, i = t, a = 0, e = 0; e < l && (a++, i = i.nextZ, !!i); e++)
        ;
      for (c = l; a > 0 || c > 0 && i; )
        a !== 0 && (c === 0 || !i || t.z <= i.z) ? (r = t, t = t.nextZ, a--) : (r = i, i = i.nextZ, c--), s ? s.nextZ = r : n = r, r.prevZ = s, s = r;
      t = i;
    }
    s.nextZ = null, l *= 2;
  } while (o > 1);
  return n;
}
function Ad(n, e, t, i, r) {
  return n = 32767 * (n - t) * r, e = 32767 * (e - i) * r, n = (n | n << 8) & 16711935, n = (n | n << 4) & 252645135, n = (n | n << 2) & 858993459, n = (n | n << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, n | e << 1;
}
function rN(n) {
  let e = n, t = n;
  do
    (e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next;
  while (e !== n);
  return t;
}
function go(n, e, t, i, r, s, o, a) {
  return (r - o) * (e - a) - (n - o) * (s - a) >= 0 && (n - o) * (i - a) - (t - o) * (e - a) >= 0 && (t - o) * (s - a) - (r - o) * (i - a) >= 0;
}
function sN(n, e) {
  return n.next.i !== e.i && n.prev.i !== e.i && !oN(n, e) && // dones't intersect other edges
  (Za(n, e) && Za(e, n) && aN(n, e) && // locally visible
  (Ot(n.prev, n, e.prev) || Ot(n, e.prev, e)) || // does not create opposite-facing sectors
  Eu(n, e) && Ot(n.prev, n, n.next) > 0 && Ot(e.prev, e, e.next) > 0);
}
function Ot(n, e, t) {
  return (e.y - n.y) * (t.x - e.x) - (e.x - n.x) * (t.y - e.y);
}
function Eu(n, e) {
  return n.x === e.x && n.y === e.y;
}
function Fx(n, e, t, i) {
  const r = uc(Ot(n, e, t)), s = uc(Ot(n, e, i)), o = uc(Ot(t, i, n)), a = uc(Ot(t, i, e));
  return !!(r !== s && o !== a || r === 0 && cc(n, t, e) || s === 0 && cc(n, i, e) || o === 0 && cc(t, n, i) || a === 0 && cc(t, e, i));
}
function cc(n, e, t) {
  return e.x <= Math.max(n.x, t.x) && e.x >= Math.min(n.x, t.x) && e.y <= Math.max(n.y, t.y) && e.y >= Math.min(n.y, t.y);
}
function uc(n) {
  return n > 0 ? 1 : n < 0 ? -1 : 0;
}
function oN(n, e) {
  let t = n;
  do {
    if (t.i !== n.i && t.next.i !== n.i && t.i !== e.i && t.next.i !== e.i && Fx(t, t.next, n, e)) return !0;
    t = t.next;
  } while (t !== n);
  return !1;
}
function Za(n, e) {
  return Ot(n.prev, n, n.next) < 0 ? Ot(n, e, n.next) >= 0 && Ot(n, n.prev, e) >= 0 : Ot(n, e, n.prev) < 0 || Ot(n, n.next, e) < 0;
}
function aN(n, e) {
  let t = n, i = !1;
  const r = (n.x + e.x) / 2, s = (n.y + e.y) / 2;
  do
    t.y > s != t.next.y > s && t.next.y !== t.y && r < (t.next.x - t.x) * (s - t.y) / (t.next.y - t.y) + t.x && (i = !i), t = t.next;
  while (t !== n);
  return i;
}
function Px(n, e) {
  const t = new Sd(n.i, n.x, n.y), i = new Sd(e.i, e.x, e.y), r = n.next, s = e.prev;
  return n.next = e, e.prev = n, t.next = r, r.prev = t, i.next = t, t.prev = i, s.next = i, i.prev = s, i;
}
function Ng(n, e, t, i) {
  const r = new Sd(n, e, t);
  return i ? (r.next = i.next, r.prev = i, i.next.prev = r, i.next = r) : (r.prev = r, r.next = r), r;
}
function Xa(n) {
  n.next.prev = n.prev, n.prev.next = n.next, n.prevZ && (n.prevZ.nextZ = n.nextZ), n.nextZ && (n.nextZ.prevZ = n.prevZ);
}
function Sd(n, e, t) {
  this.i = n, this.x = e, this.y = t, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1;
}
function lN(n, e, t, i) {
  let r = 0;
  for (let s = e, o = t - i; s < t; s += i)
    r += (n[o] - n[s]) * (n[s + 1] + n[o + 1]), o = s;
  return r;
}
class Fi {
  // calculate area of the contour polygon
  static area(e) {
    const t = e.length;
    let i = 0;
    for (let r = t - 1, s = 0; s < t; r = s++)
      i += e[r].x * e[s].y - e[s].x * e[r].y;
    return i * 0.5;
  }
  static isClockWise(e) {
    return Fi.area(e) < 0;
  }
  static triangulateShape(e, t) {
    const i = [], r = [], s = [];
    Bg(e), Ug(i, e);
    let o = e.length;
    t.forEach(Bg);
    for (let c = 0; c < t.length; c++)
      r.push(o), o += t[c].length, Ug(i, t[c]);
    const a = $D.triangulate(i, r);
    for (let c = 0; c < a.length; c += 3)
      s.push(a.slice(c, c + 3));
    return s;
  }
}
function Bg(n) {
  const e = n.length;
  e > 2 && n[e - 1].equals(n[0]) && n.pop();
}
function Ug(n, e) {
  for (let t = 0; t < e.length; t++)
    n.push(e[t].x), n.push(e[t].y);
}
class mi extends Ke {
  constructor(e, t) {
    super(), this.type = "ExtrudeGeometry", this.parameters = {
      shapes: e,
      options: t
    }, e = Array.isArray(e) ? e : [e];
    const i = this, r = [], s = [];
    for (let a = 0, c = e.length; a < c; a++) {
      const l = e[a];
      o(l);
    }
    this.setAttribute("position", new We(r, 3)), this.setAttribute("uv", new We(s, 2)), this.computeVertexNormals();
    function o(a) {
      const c = [], l = t.curveSegments !== void 0 ? t.curveSegments : 12, d = t.steps !== void 0 ? t.steps : 1;
      let h = t.depth !== void 0 ? t.depth : 100, f = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, g = t.bevelThickness !== void 0 ? t.bevelThickness : 6, p = t.bevelSize !== void 0 ? t.bevelSize : g - 2, u = t.bevelOffset !== void 0 ? t.bevelOffset : 0, y = t.bevelSegments !== void 0 ? t.bevelSegments : 3;
      const v = t.extrudePath, m = t.UVGenerator !== void 0 ? t.UVGenerator : cN;
      t.amount !== void 0 && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), h = t.amount);
      let x, w = !1, A, M, R, L;
      v && (x = v.getSpacedPoints(d), w = !0, f = !1, A = v.computeFrenetFrames(d, !1), M = new Q(), R = new Q(), L = new Q()), f || (y = 0, g = 0, p = 0, u = 0);
      const _ = a.extractPoints(l);
      let F = _.shape;
      const S = _.holes;
      if (!Fi.isClockWise(F)) {
        F = F.reverse();
        for (let k = 0, W = S.length; k < W; k++) {
          const q = S[k];
          Fi.isClockWise(q) && (S[k] = q.reverse());
        }
      }
      const E = Fi.triangulateShape(F, S), C = F;
      for (let k = 0, W = S.length; k < W; k++) {
        const q = S[k];
        F = F.concat(q);
      }
      function P(k, W, q) {
        return W || console.error("THREE.ExtrudeGeometry: vec does not exist"), W.clone().multiplyScalar(q).add(k);
      }
      const b = F.length, I = E.length;
      function D(k, W, q) {
        let ce, oe, V;
        const O = k.x - W.x, X = k.y - W.y, Y = q.x - k.x, ie = q.y - k.y, fe = O * O + X * X, be = O * ie - X * Y;
        if (Math.abs(be) > Number.EPSILON) {
          const Ae = Math.sqrt(fe), he = Math.sqrt(Y * Y + ie * ie), xe = W.x - X / Ae, re = W.y + O / Ae, me = q.x - ie / he, Me = q.y + Y / he, De = ((me - xe) * ie - (Me - re) * Y) / (O * ie - X * Y);
          ce = xe + O * De - k.x, oe = re + X * De - k.y;
          const Ie = ce * ce + oe * oe;
          if (Ie <= 2)
            return new Re(ce, oe);
          V = Math.sqrt(Ie / 2);
        } else {
          let Ae = !1;
          O > Number.EPSILON ? Y > Number.EPSILON && (Ae = !0) : O < -Number.EPSILON ? Y < -Number.EPSILON && (Ae = !0) : Math.sign(X) === Math.sign(ie) && (Ae = !0), Ae ? (ce = -X, oe = O, V = Math.sqrt(fe)) : (ce = O, oe = X, V = Math.sqrt(fe / 2));
        }
        return new Re(ce / V, oe / V);
      }
      const N = [];
      for (let k = 0, W = C.length, q = W - 1, ce = k + 1; k < W; k++, q++, ce++)
        q === W && (q = 0), ce === W && (ce = 0), N[k] = D(C[k], C[q], C[ce]);
      const U = [];
      let B, G = N.concat();
      for (let k = 0, W = S.length; k < W; k++) {
        const q = S[k];
        B = [];
        for (let ce = 0, oe = q.length, V = oe - 1, O = ce + 1; ce < oe; ce++, V++, O++)
          V === oe && (V = 0), O === oe && (O = 0), B[ce] = D(q[ce], q[V], q[O]);
        U.push(B), G = G.concat(B);
      }
      for (let k = 0; k < y; k++) {
        const W = k / y, q = g * Math.cos(W * Math.PI / 2), ce = p * Math.sin(W * Math.PI / 2) + u;
        for (let oe = 0, V = C.length; oe < V; oe++) {
          const O = P(C[oe], N[oe], ce);
          ae(O.x, O.y, -q);
        }
        for (let oe = 0, V = S.length; oe < V; oe++) {
          const O = S[oe];
          B = U[oe];
          for (let X = 0, Y = O.length; X < Y; X++) {
            const ie = P(O[X], B[X], ce);
            ae(ie.x, ie.y, -q);
          }
        }
      }
      const J = p + u;
      for (let k = 0; k < b; k++) {
        const W = f ? P(F[k], G[k], J) : F[k];
        w ? (R.copy(A.normals[0]).multiplyScalar(W.x), M.copy(A.binormals[0]).multiplyScalar(W.y), L.copy(x[0]).add(R).add(M), ae(L.x, L.y, L.z)) : ae(W.x, W.y, 0);
      }
      for (let k = 1; k <= d; k++)
        for (let W = 0; W < b; W++) {
          const q = f ? P(F[W], G[W], J) : F[W];
          w ? (R.copy(A.normals[k]).multiplyScalar(q.x), M.copy(A.binormals[k]).multiplyScalar(q.y), L.copy(x[k]).add(R).add(M), ae(L.x, L.y, L.z)) : ae(q.x, q.y, h / d * k);
        }
      for (let k = y - 1; k >= 0; k--) {
        const W = k / y, q = g * Math.cos(W * Math.PI / 2), ce = p * Math.sin(W * Math.PI / 2) + u;
        for (let oe = 0, V = C.length; oe < V; oe++) {
          const O = P(C[oe], N[oe], ce);
          ae(O.x, O.y, h + q);
        }
        for (let oe = 0, V = S.length; oe < V; oe++) {
          const O = S[oe];
          B = U[oe];
          for (let X = 0, Y = O.length; X < Y; X++) {
            const ie = P(O[X], B[X], ce);
            w ? ae(ie.x, ie.y + x[d - 1].y, x[d - 1].x + q) : ae(ie.x, ie.y, h + q);
          }
        }
      }
      j(), te();
      function j() {
        const k = r.length / 3;
        if (f) {
          let W = 0, q = b * W;
          for (let ce = 0; ce < I; ce++) {
            const oe = E[ce];
            H(oe[2] + q, oe[1] + q, oe[0] + q);
          }
          W = d + y * 2, q = b * W;
          for (let ce = 0; ce < I; ce++) {
            const oe = E[ce];
            H(oe[0] + q, oe[1] + q, oe[2] + q);
          }
        } else {
          for (let W = 0; W < I; W++) {
            const q = E[W];
            H(q[2], q[1], q[0]);
          }
          for (let W = 0; W < I; W++) {
            const q = E[W];
            H(q[0] + b * d, q[1] + b * d, q[2] + b * d);
          }
        }
        i.addGroup(k, r.length / 3 - k, 0);
      }
      function te() {
        const k = r.length / 3;
        let W = 0;
        ee(C, W), W += C.length;
        for (let q = 0, ce = S.length; q < ce; q++) {
          const oe = S[q];
          ee(oe, W), W += oe.length;
        }
        i.addGroup(k, r.length / 3 - k, 1);
      }
      function ee(k, W) {
        let q = k.length;
        for (; --q >= 0; ) {
          const ce = q;
          let oe = q - 1;
          oe < 0 && (oe = k.length - 1);
          for (let V = 0, O = d + y * 2; V < O; V++) {
            const X = b * V, Y = b * (V + 1), ie = W + ce + X, fe = W + oe + X, be = W + oe + Y, Ae = W + ce + Y;
            Z(ie, fe, be, Ae);
          }
        }
      }
      function ae(k, W, q) {
        c.push(k), c.push(W), c.push(q);
      }
      function H(k, W, q) {
        $(k), $(W), $(q);
        const ce = r.length / 3, oe = m.generateTopUV(i, r, ce - 3, ce - 2, ce - 1);
        se(oe[0]), se(oe[1]), se(oe[2]);
      }
      function Z(k, W, q, ce) {
        $(k), $(W), $(ce), $(W), $(q), $(ce);
        const oe = r.length / 3, V = m.generateSideWallUV(i, r, oe - 6, oe - 3, oe - 2, oe - 1);
        se(V[0]), se(V[1]), se(V[3]), se(V[1]), se(V[2]), se(V[3]);
      }
      function $(k) {
        r.push(c[k * 3 + 0]), r.push(c[k * 3 + 1]), r.push(c[k * 3 + 2]);
      }
      function se(k) {
        s.push(k.x), s.push(k.y);
      }
    }
  }
  toJSON() {
    const e = super.toJSON(), t = this.parameters.shapes, i = this.parameters.options;
    return uN(t, i, e);
  }
  static fromJSON(e, t) {
    const i = [];
    for (let s = 0, o = e.shapes.length; s < o; s++) {
      const a = t[e.shapes[s]];
      i.push(a);
    }
    const r = e.options.extrudePath;
    return r !== void 0 && (e.options.extrudePath = new kf[r.type]().fromJSON(r)), new mi(i, e.options);
  }
}
const cN = {
  generateTopUV: function(n, e, t, i, r) {
    const s = e[t * 3], o = e[t * 3 + 1], a = e[i * 3], c = e[i * 3 + 1], l = e[r * 3], d = e[r * 3 + 1];
    return [
      new Re(s, o),
      new Re(a, c),
      new Re(l, d)
    ];
  },
  generateSideWallUV: function(n, e, t, i, r, s) {
    const o = e[t * 3], a = e[t * 3 + 1], c = e[t * 3 + 2], l = e[i * 3], d = e[i * 3 + 1], h = e[i * 3 + 2], f = e[r * 3], g = e[r * 3 + 1], p = e[r * 3 + 2], u = e[s * 3], y = e[s * 3 + 1], v = e[s * 3 + 2];
    return Math.abs(a - d) < Math.abs(o - l) ? [
      new Re(o, 1 - c),
      new Re(l, 1 - h),
      new Re(f, 1 - p),
      new Re(u, 1 - v)
    ] : [
      new Re(a, 1 - c),
      new Re(d, 1 - h),
      new Re(g, 1 - p),
      new Re(y, 1 - v)
    ];
  }
};
function uN(n, e, t) {
  if (t.shapes = [], Array.isArray(n))
    for (let i = 0, r = n.length; i < r; i++) {
      const s = n[i];
      t.shapes.push(s.uuid);
    }
  else
    t.shapes.push(n.uuid);
  return e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t;
}
class No extends Di {
  constructor(e = 1, t = 0) {
    const i = (1 + Math.sqrt(5)) / 2, r = [
      -1,
      i,
      0,
      1,
      i,
      0,
      -1,
      -i,
      0,
      1,
      -i,
      0,
      0,
      -1,
      i,
      0,
      1,
      i,
      0,
      -1,
      -i,
      0,
      1,
      -i,
      i,
      0,
      -1,
      i,
      0,
      1,
      -i,
      0,
      -1,
      -i,
      0,
      1
    ], s = [
      0,
      11,
      5,
      0,
      5,
      1,
      0,
      1,
      7,
      0,
      7,
      10,
      0,
      10,
      11,
      1,
      5,
      9,
      5,
      11,
      4,
      11,
      10,
      2,
      10,
      7,
      6,
      7,
      1,
      8,
      3,
      9,
      4,
      3,
      4,
      2,
      3,
      2,
      6,
      3,
      6,
      8,
      3,
      8,
      9,
      4,
      9,
      5,
      2,
      4,
      11,
      6,
      2,
      10,
      8,
      6,
      7,
      9,
      8,
      1
    ];
    super(r, s, e, t), this.type = "IcosahedronGeometry", this.parameters = {
      radius: e,
      detail: t
    };
  }
  static fromJSON(e) {
    return new No(e.radius, e.detail);
  }
}
class Bo extends Ke {
  constructor(e, t = 12, i = 0, r = Math.PI * 2) {
    super(), this.type = "LatheGeometry", this.parameters = {
      points: e,
      segments: t,
      phiStart: i,
      phiLength: r
    }, t = Math.floor(t), r = gn(r, 0, Math.PI * 2);
    const s = [], o = [], a = [], c = 1 / t, l = new Q(), d = new Re();
    for (let h = 0; h <= t; h++) {
      const f = i + h * c * r, g = Math.sin(f), p = Math.cos(f);
      for (let u = 0; u <= e.length - 1; u++)
        l.x = e[u].x * g, l.y = e[u].y, l.z = e[u].x * p, o.push(l.x, l.y, l.z), d.x = h / t, d.y = u / (e.length - 1), a.push(d.x, d.y);
    }
    for (let h = 0; h < t; h++)
      for (let f = 0; f < e.length - 1; f++) {
        const g = f + h * e.length, p = g, u = g + e.length, y = g + e.length + 1, v = g + 1;
        s.push(p, u, v), s.push(u, y, v);
      }
    if (this.setIndex(s), this.setAttribute("position", new We(o, 3)), this.setAttribute("uv", new We(a, 2)), this.computeVertexNormals(), r === Math.PI * 2) {
      const h = this.attributes.normal.array, f = new Q(), g = new Q(), p = new Q(), u = t * e.length * 3;
      for (let y = 0, v = 0; y < e.length; y++, v += 3)
        f.x = h[v + 0], f.y = h[v + 1], f.z = h[v + 2], g.x = h[u + v + 0], g.y = h[u + v + 1], g.z = h[u + v + 2], p.addVectors(f, g).normalize(), h[v + 0] = h[u + v + 0] = p.x, h[v + 1] = h[u + v + 1] = p.y, h[v + 2] = h[u + v + 2] = p.z;
    }
  }
  static fromJSON(e) {
    return new Bo(e.points, e.segments, e.phiStart, e.phiLength);
  }
}
class Rs extends Di {
  constructor(e = 1, t = 0) {
    const i = [
      1,
      0,
      0,
      -1,
      0,
      0,
      0,
      1,
      0,
      0,
      -1,
      0,
      0,
      0,
      1,
      0,
      0,
      -1
    ], r = [
      0,
      2,
      4,
      0,
      4,
      3,
      0,
      3,
      5,
      0,
      5,
      2,
      1,
      2,
      5,
      1,
      5,
      3,
      1,
      3,
      4,
      1,
      4,
      2
    ];
    super(i, r, e, t), this.type = "OctahedronGeometry", this.parameters = {
      radius: e,
      detail: t
    };
  }
  static fromJSON(e) {
    return new Rs(e.radius, e.detail);
  }
}
class Hc extends Ke {
  constructor(e, t, i) {
    super(), this.type = "ParametricGeometry", this.parameters = {
      func: e,
      slices: t,
      stacks: i
    };
    const r = [], s = [], o = [], a = [], c = 1e-5, l = new Q(), d = new Q(), h = new Q(), f = new Q(), g = new Q();
    e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
    const p = t + 1;
    for (let u = 0; u <= i; u++) {
      const y = u / i;
      for (let v = 0; v <= t; v++) {
        const m = v / t;
        e(m, y, d), s.push(d.x, d.y, d.z), m - c >= 0 ? (e(m - c, y, h), f.subVectors(d, h)) : (e(m + c, y, h), f.subVectors(h, d)), y - c >= 0 ? (e(m, y - c, h), g.subVectors(d, h)) : (e(m, y + c, h), g.subVectors(h, d)), l.crossVectors(f, g).normalize(), o.push(l.x, l.y, l.z), a.push(m, y);
      }
    }
    for (let u = 0; u < i; u++)
      for (let y = 0; y < t; y++) {
        const v = u * p + y, m = u * p + y + 1, x = (u + 1) * p + y + 1, w = (u + 1) * p + y;
        r.push(v, m, w), r.push(m, x, w);
      }
    this.setIndex(r), this.setAttribute("position", new We(s, 3)), this.setAttribute("normal", new We(o, 3)), this.setAttribute("uv", new We(a, 2));
  }
}
class Uo extends Ke {
  constructor(e = 0.5, t = 1, i = 8, r = 1, s = 0, o = Math.PI * 2) {
    super(), this.type = "RingGeometry", this.parameters = {
      innerRadius: e,
      outerRadius: t,
      thetaSegments: i,
      phiSegments: r,
      thetaStart: s,
      thetaLength: o
    }, i = Math.max(3, i), r = Math.max(1, r);
    const a = [], c = [], l = [], d = [];
    let h = e;
    const f = (t - e) / r, g = new Q(), p = new Re();
    for (let u = 0; u <= r; u++) {
      for (let y = 0; y <= i; y++) {
        const v = s + y / i * o;
        g.x = h * Math.cos(v), g.y = h * Math.sin(v), c.push(g.x, g.y, g.z), l.push(0, 0, 1), p.x = (g.x / t + 1) / 2, p.y = (g.y / t + 1) / 2, d.push(p.x, p.y);
      }
      h += f;
    }
    for (let u = 0; u < r; u++) {
      const y = u * (i + 1);
      for (let v = 0; v < i; v++) {
        const m = v + y, x = m, w = m + i + 1, A = m + i + 2, M = m + 1;
        a.push(x, w, M), a.push(w, A, M);
      }
    }
    this.setIndex(a), this.setAttribute("position", new We(c, 3)), this.setAttribute("normal", new We(l, 3)), this.setAttribute("uv", new We(d, 2));
  }
  static fromJSON(e) {
    return new Uo(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength);
  }
}
class Fs extends Ke {
  constructor(e, t = 12) {
    super(), this.type = "ShapeGeometry", this.parameters = {
      shapes: e,
      curveSegments: t
    };
    const i = [], r = [], s = [], o = [];
    let a = 0, c = 0;
    if (Array.isArray(e) === !1)
      l(e);
    else
      for (let d = 0; d < e.length; d++)
        l(e[d]), this.addGroup(a, c, d), a += c, c = 0;
    this.setIndex(i), this.setAttribute("position", new We(r, 3)), this.setAttribute("normal", new We(s, 3)), this.setAttribute("uv", new We(o, 2));
    function l(d) {
      const h = r.length / 3, f = d.extractPoints(t);
      let g = f.shape;
      const p = f.holes;
      Fi.isClockWise(g) === !1 && (g = g.reverse());
      for (let y = 0, v = p.length; y < v; y++) {
        const m = p[y];
        Fi.isClockWise(m) === !0 && (p[y] = m.reverse());
      }
      const u = Fi.triangulateShape(g, p);
      for (let y = 0, v = p.length; y < v; y++) {
        const m = p[y];
        g = g.concat(m);
      }
      for (let y = 0, v = g.length; y < v; y++) {
        const m = g[y];
        r.push(m.x, m.y, 0), s.push(0, 0, 1), o.push(m.x, m.y);
      }
      for (let y = 0, v = u.length; y < v; y++) {
        const m = u[y], x = m[0] + h, w = m[1] + h, A = m[2] + h;
        i.push(x, w, A), c += 3;
      }
    }
  }
  toJSON() {
    const e = super.toJSON(), t = this.parameters.shapes;
    return hN(t, e);
  }
  static fromJSON(e, t) {
    const i = [];
    for (let r = 0, s = e.shapes.length; r < s; r++) {
      const o = t[e.shapes[r]];
      i.push(o);
    }
    return new Fs(i, e.curveSegments);
  }
}
function hN(n, e) {
  if (e.shapes = [], Array.isArray(n))
    for (let t = 0, i = n.length; t < i; t++) {
      const r = n[t];
      e.shapes.push(r.uuid);
    }
  else
    e.shapes.push(n.uuid);
  return e;
}
class Ps extends Ke {
  constructor(e = 1, t = 8, i = 6, r = 0, s = Math.PI * 2, o = 0, a = Math.PI) {
    super(), this.type = "SphereGeometry", this.parameters = {
      radius: e,
      widthSegments: t,
      heightSegments: i,
      phiStart: r,
      phiLength: s,
      thetaStart: o,
      thetaLength: a
    }, t = Math.max(3, Math.floor(t)), i = Math.max(2, Math.floor(i));
    const c = Math.min(o + a, Math.PI);
    let l = 0;
    const d = [], h = new Q(), f = new Q(), g = [], p = [], u = [], y = [];
    for (let v = 0; v <= i; v++) {
      const m = [], x = v / i;
      let w = 0;
      v == 0 && o == 0 ? w = 0.5 / t : v == i && c == Math.PI && (w = -0.5 / t);
      for (let A = 0; A <= t; A++) {
        const M = A / t;
        h.x = -e * Math.cos(r + M * s) * Math.sin(o + x * a), h.y = e * Math.cos(o + x * a), h.z = e * Math.sin(r + M * s) * Math.sin(o + x * a), p.push(h.x, h.y, h.z), f.copy(h).normalize(), u.push(f.x, f.y, f.z), y.push(M + w, 1 - x), m.push(l++);
      }
      d.push(m);
    }
    for (let v = 0; v < i; v++)
      for (let m = 0; m < t; m++) {
        const x = d[v][m + 1], w = d[v][m], A = d[v + 1][m], M = d[v + 1][m + 1];
        (v !== 0 || o > 0) && g.push(x, w, M), (v !== i - 1 || c < Math.PI) && g.push(w, A, M);
      }
    this.setIndex(g), this.setAttribute("position", new We(p, 3)), this.setAttribute("normal", new We(u, 3)), this.setAttribute("uv", new We(y, 2));
  }
  static fromJSON(e) {
    return new Ps(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength);
  }
}
class zo extends Di {
  constructor(e = 1, t = 0) {
    const i = [
      1,
      1,
      1,
      -1,
      -1,
      1,
      -1,
      1,
      -1,
      1,
      -1,
      -1
    ], r = [
      2,
      1,
      0,
      0,
      3,
      2,
      1,
      3,
      0,
      2,
      3,
      1
    ];
    super(i, r, e, t), this.type = "TetrahedronGeometry", this.parameters = {
      radius: e,
      detail: t
    };
  }
  static fromJSON(e) {
    return new zo(e.radius, e.detail);
  }
}
class Wc extends mi {
  constructor(e, t = {}) {
    const i = t.font;
    if (!(i && i.isFont))
      return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new Ke();
    const r = i.generateShapes(e, t.size);
    t.depth = t.height !== void 0 ? t.height : 50, t.bevelThickness === void 0 && (t.bevelThickness = 10), t.bevelSize === void 0 && (t.bevelSize = 8), t.bevelEnabled === void 0 && (t.bevelEnabled = !1), super(r, t), this.type = "TextGeometry";
  }
}
class ko extends Ke {
  constructor(e = 1, t = 0.4, i = 8, r = 6, s = Math.PI * 2) {
    super(), this.type = "TorusGeometry", this.parameters = {
      radius: e,
      tube: t,
      radialSegments: i,
      tubularSegments: r,
      arc: s
    }, i = Math.floor(i), r = Math.floor(r);
    const o = [], a = [], c = [], l = [], d = new Q(), h = new Q(), f = new Q();
    for (let g = 0; g <= i; g++)
      for (let p = 0; p <= r; p++) {
        const u = p / r * s, y = g / i * Math.PI * 2;
        h.x = (e + t * Math.cos(y)) * Math.cos(u), h.y = (e + t * Math.cos(y)) * Math.sin(u), h.z = t * Math.sin(y), a.push(h.x, h.y, h.z), d.x = e * Math.cos(u), d.y = e * Math.sin(u), f.subVectors(h, d).normalize(), c.push(f.x, f.y, f.z), l.push(p / r), l.push(g / i);
      }
    for (let g = 1; g <= i; g++)
      for (let p = 1; p <= r; p++) {
        const u = (r + 1) * g + p - 1, y = (r + 1) * (g - 1) + p - 1, v = (r + 1) * (g - 1) + p, m = (r + 1) * g + p;
        o.push(u, y, m), o.push(y, v, m);
      }
    this.setIndex(o), this.setAttribute("position", new We(a, 3)), this.setAttribute("normal", new We(c, 3)), this.setAttribute("uv", new We(l, 2));
  }
  static fromJSON(e) {
    return new ko(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc);
  }
}
class Vo extends Ke {
  constructor(e = 1, t = 0.4, i = 64, r = 8, s = 2, o = 3) {
    super(), this.type = "TorusKnotGeometry", this.parameters = {
      radius: e,
      tube: t,
      tubularSegments: i,
      radialSegments: r,
      p: s,
      q: o
    }, i = Math.floor(i), r = Math.floor(r);
    const a = [], c = [], l = [], d = [], h = new Q(), f = new Q(), g = new Q(), p = new Q(), u = new Q(), y = new Q(), v = new Q();
    for (let x = 0; x <= i; ++x) {
      const w = x / i * s * Math.PI * 2;
      m(w, s, o, e, g), m(w + 0.01, s, o, e, p), y.subVectors(p, g), v.addVectors(p, g), u.crossVectors(y, v), v.crossVectors(u, y), u.normalize(), v.normalize();
      for (let A = 0; A <= r; ++A) {
        const M = A / r * Math.PI * 2, R = -t * Math.cos(M), L = t * Math.sin(M);
        h.x = g.x + (R * v.x + L * u.x), h.y = g.y + (R * v.y + L * u.y), h.z = g.z + (R * v.z + L * u.z), c.push(h.x, h.y, h.z), f.subVectors(h, g).normalize(), l.push(f.x, f.y, f.z), d.push(x / i), d.push(A / r);
      }
    }
    for (let x = 1; x <= i; x++)
      for (let w = 1; w <= r; w++) {
        const A = (r + 1) * (x - 1) + (w - 1), M = (r + 1) * x + (w - 1), R = (r + 1) * x + w, L = (r + 1) * (x - 1) + w;
        a.push(A, M, L), a.push(M, R, L);
      }
    this.setIndex(a), this.setAttribute("position", new We(c, 3)), this.setAttribute("normal", new We(l, 3)), this.setAttribute("uv", new We(d, 2));
    function m(x, w, A, M, R) {
      const L = Math.cos(x), _ = Math.sin(x), F = A / w * x, S = Math.cos(F);
      R.x = M * (2 + S) * 0.5 * L, R.y = M * (2 + S) * _ * 0.5, R.z = M * Math.sin(F) * 0.5;
    }
  }
  static fromJSON(e) {
    return new Vo(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q);
  }
}
class Go extends Ke {
  constructor(e, t = 64, i = 1, r = 8, s = !1) {
    super(), this.type = "TubeGeometry", this.parameters = {
      path: e,
      tubularSegments: t,
      radius: i,
      radialSegments: r,
      closed: s
    };
    const o = e.computeFrenetFrames(t, s);
    this.tangents = o.tangents, this.normals = o.normals, this.binormals = o.binormals;
    const a = new Q(), c = new Q(), l = new Re();
    let d = new Q();
    const h = [], f = [], g = [], p = [];
    u(), this.setIndex(p), this.setAttribute("position", new We(h, 3)), this.setAttribute("normal", new We(f, 3)), this.setAttribute("uv", new We(g, 2));
    function u() {
      for (let x = 0; x < t; x++)
        y(x);
      y(s === !1 ? t : 0), m(), v();
    }
    function y(x) {
      d = e.getPointAt(x / t, d);
      const w = o.normals[x], A = o.binormals[x];
      for (let M = 0; M <= r; M++) {
        const R = M / r * Math.PI * 2, L = Math.sin(R), _ = -Math.cos(R);
        c.x = _ * w.x + L * A.x, c.y = _ * w.y + L * A.y, c.z = _ * w.z + L * A.z, c.normalize(), f.push(c.x, c.y, c.z), a.x = d.x + i * c.x, a.y = d.y + i * c.y, a.z = d.z + i * c.z, h.push(a.x, a.y, a.z);
      }
    }
    function v() {
      for (let x = 1; x <= t; x++)
        for (let w = 1; w <= r; w++) {
          const A = (r + 1) * (x - 1) + (w - 1), M = (r + 1) * x + (w - 1), R = (r + 1) * x + w, L = (r + 1) * (x - 1) + w;
          p.push(A, M, L), p.push(M, R, L);
        }
    }
    function m() {
      for (let x = 0; x <= t; x++)
        for (let w = 0; w <= r; w++)
          l.x = x / t, l.y = w / r, g.push(l.x, l.y);
    }
  }
  toJSON() {
    const e = super.toJSON();
    return e.path = this.parameters.path.toJSON(), e;
  }
  static fromJSON(e) {
    return new Go(
      new kf[e.path.type]().fromJSON(e.path),
      e.tubularSegments,
      e.radius,
      e.radialSegments,
      e.closed
    );
  }
}
class Vf extends Ke {
  constructor(e) {
    if (super(), this.type = "WireframeGeometry", e.isGeometry === !0) {
      console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
      return;
    }
    const t = [], i = [0, 0], r = {}, s = new Q();
    if (e.index !== null) {
      const o = e.attributes.position, a = e.index;
      let c = e.groups;
      c.length === 0 && (c = [{ start: 0, count: a.count, materialIndex: 0 }]);
      for (let l = 0, d = c.length; l < d; ++l) {
        const h = c[l], f = h.start, g = h.count;
        for (let p = f, u = f + g; p < u; p += 3)
          for (let y = 0; y < 3; y++) {
            const v = a.getX(p + y), m = a.getX(p + (y + 1) % 3);
            i[0] = Math.min(v, m), i[1] = Math.max(v, m);
            const x = i[0] + "," + i[1];
            r[x] === void 0 && (r[x] = { index1: i[0], index2: i[1] });
          }
      }
      for (const l in r) {
        const d = r[l];
        s.fromBufferAttribute(o, d.index1), t.push(s.x, s.y, s.z), s.fromBufferAttribute(o, d.index2), t.push(s.x, s.y, s.z);
      }
    } else {
      const o = e.attributes.position;
      for (let a = 0, c = o.count / 3; a < c; a++)
        for (let l = 0; l < 3; l++) {
          const d = 3 * a + l;
          s.fromBufferAttribute(o, d), t.push(s.x, s.y, s.z);
          const h = 3 * a + (l + 1) % 3;
          s.fromBufferAttribute(o, h), t.push(s.x, s.y, s.z);
        }
    }
    this.setAttribute("position", new We(t, 3));
  }
}
var zg = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  BoxGeometry: or,
  BoxBufferGeometry: or,
  CircleGeometry: Io,
  CircleBufferGeometry: Io,
  ConeGeometry: Oo,
  ConeBufferGeometry: Oo,
  CylinderGeometry: $r,
  CylinderBufferGeometry: $r,
  DodecahedronGeometry: Do,
  DodecahedronBufferGeometry: Do,
  EdgesGeometry: Of,
  ExtrudeGeometry: mi,
  ExtrudeBufferGeometry: mi,
  IcosahedronGeometry: No,
  IcosahedronBufferGeometry: No,
  LatheGeometry: Bo,
  LatheBufferGeometry: Bo,
  OctahedronGeometry: Rs,
  OctahedronBufferGeometry: Rs,
  ParametricGeometry: Hc,
  ParametricBufferGeometry: Hc,
  PlaneGeometry: Ls,
  PlaneBufferGeometry: Ls,
  PolyhedronGeometry: Di,
  PolyhedronBufferGeometry: Di,
  RingGeometry: Uo,
  RingBufferGeometry: Uo,
  ShapeGeometry: Fs,
  ShapeBufferGeometry: Fs,
  SphereGeometry: Ps,
  SphereBufferGeometry: Ps,
  TetrahedronGeometry: zo,
  TetrahedronBufferGeometry: zo,
  TextGeometry: Wc,
  TextBufferGeometry: Wc,
  TorusGeometry: ko,
  TorusBufferGeometry: ko,
  TorusKnotGeometry: Vo,
  TorusKnotBufferGeometry: Vo,
  TubeGeometry: Go,
  TubeBufferGeometry: Go,
  WireframeGeometry: Vf
});
class Gf extends tn {
  constructor(e) {
    super(), this.type = "ShadowMaterial", this.color = new Ue(0), this.transparent = !0, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this;
  }
}
Gf.prototype.isShadowMaterial = !0;
class ra extends ar {
  constructor(e) {
    super(e), this.type = "RawShaderMaterial";
  }
}
ra.prototype.isRawShaderMaterial = !0;
class zs extends tn {
  constructor(e) {
    super(), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Ue(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapIntensity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.vertexTangents = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapIntensity = e.envMapIntensity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this.vertexTangents = e.vertexTangents, this;
  }
}
zs.prototype.isMeshStandardMaterial = !0;
class wl extends zs {
  constructor(e) {
    super(), this.defines = {
      STANDARD: "",
      PHYSICAL: ""
    }, this.type = "MeshPhysicalMaterial", this.clearcoat = 0, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Re(1, 1), this.clearcoatNormalMap = null, this.reflectivity = 0.5, Object.defineProperty(this, "ior", {
      get: function() {
        return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity);
      },
      set: function(t) {
        this.reflectivity = gn(2.5 * (t - 1) / (t + 1), 0, 1);
      }
    }), this.sheen = null, this.transmission = 0, this.transmissionMap = null, this.thickness = 0.01, this.thicknessMap = null, this.attenuationDistance = 0, this.attenuationColor = new Ue(1, 1, 1), this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.defines = {
      STANDARD: "",
      PHYSICAL: ""
    }, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.reflectivity = e.reflectivity, e.sheen ? this.sheen = (this.sheen || new Ue()).copy(e.sheen) : this.sheen = null, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this;
  }
}
wl.prototype.isMeshPhysicalMaterial = !0;
class Hf extends tn {
  constructor(e) {
    super(), this.type = "MeshPhongMaterial", this.color = new Ue(16777215), this.specular = new Ue(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this;
  }
}
Hf.prototype.isMeshPhongMaterial = !0;
class Wf extends tn {
  constructor(e) {
    super(), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Ue(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.map = e.map, this.gradientMap = e.gradientMap, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this;
  }
}
Wf.prototype.isMeshToonMaterial = !0;
class jf extends tn {
  constructor(e) {
    super(), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this;
  }
}
jf.prototype.isMeshNormalMaterial = !0;
class $f extends tn {
  constructor(e) {
    super(), this.type = "MeshLambertMaterial", this.color = new Ue(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this;
  }
}
$f.prototype.isMeshLambertMaterial = !0;
class Zf extends tn {
  constructor(e) {
    super(), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Ue(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.defines = { MATCAP: "" }, this.color.copy(e.color), this.matcap = e.matcap, this.map = e.map, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this;
  }
}
Zf.prototype.isMeshMatcapMaterial = !0;
class Xf extends an {
  constructor(e) {
    super(), this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.scale = e.scale, this.dashSize = e.dashSize, this.gapSize = e.gapSize, this;
  }
}
Xf.prototype.isLineDashedMaterial = !0;
var dN = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ShadowMaterial: Gf,
  SpriteMaterial: ml,
  RawShaderMaterial: ra,
  ShaderMaterial: ar,
  PointsMaterial: es,
  MeshPhysicalMaterial: wl,
  MeshStandardMaterial: zs,
  MeshPhongMaterial: Hf,
  MeshToonMaterial: Wf,
  MeshNormalMaterial: jf,
  MeshLambertMaterial: $f,
  MeshDepthMaterial: xu,
  MeshDistanceMaterial: Mu,
  MeshBasicMaterial: In,
  MeshMatcapMaterial: Zf,
  LineDashedMaterial: Xf,
  LineBasicMaterial: an,
  Material: tn
});
const Ct = {
  // same as Array.prototype.slice, but also works on typed arrays
  arraySlice: function(n, e, t) {
    return Ct.isTypedArray(n) ? new n.constructor(n.subarray(e, t !== void 0 ? t : n.length)) : n.slice(e, t);
  },
  // converts an array to a specific type
  convertArray: function(n, e, t) {
    return !n || // let 'undefined' and 'null' pass
    !t && n.constructor === e ? n : typeof e.BYTES_PER_ELEMENT == "number" ? new e(n) : Array.prototype.slice.call(n);
  },
  isTypedArray: function(n) {
    return ArrayBuffer.isView(n) && !(n instanceof DataView);
  },
  // returns an array by which times and values can be sorted
  getKeyframeOrder: function(n) {
    function e(r, s) {
      return n[r] - n[s];
    }
    const t = n.length, i = new Array(t);
    for (let r = 0; r !== t; ++r) i[r] = r;
    return i.sort(e), i;
  },
  // uses the array previously returned by 'getKeyframeOrder' to sort data
  sortedArray: function(n, e, t) {
    const i = n.length, r = new n.constructor(i);
    for (let s = 0, o = 0; o !== i; ++s) {
      const a = t[s] * e;
      for (let c = 0; c !== e; ++c)
        r[o++] = n[a + c];
    }
    return r;
  },
  // function for parsing AOS keyframe formats
  flattenJSON: function(n, e, t, i) {
    let r = 1, s = n[0];
    for (; s !== void 0 && s[i] === void 0; )
      s = n[r++];
    if (s === void 0) return;
    let o = s[i];
    if (o !== void 0)
      if (Array.isArray(o))
        do
          o = s[i], o !== void 0 && (e.push(s.time), t.push.apply(t, o)), s = n[r++];
        while (s !== void 0);
      else if (o.toArray !== void 0)
        do
          o = s[i], o !== void 0 && (e.push(s.time), o.toArray(t, t.length)), s = n[r++];
        while (s !== void 0);
      else
        do
          o = s[i], o !== void 0 && (e.push(s.time), t.push(o)), s = n[r++];
        while (s !== void 0);
  },
  subclip: function(n, e, t, i, r = 30) {
    const s = n.clone();
    s.name = e;
    const o = [];
    for (let c = 0; c < s.tracks.length; ++c) {
      const l = s.tracks[c], d = l.getValueSize(), h = [], f = [];
      for (let g = 0; g < l.times.length; ++g) {
        const p = l.times[g] * r;
        if (!(p < t || p >= i)) {
          h.push(l.times[g]);
          for (let u = 0; u < d; ++u)
            f.push(l.values[g * d + u]);
        }
      }
      h.length !== 0 && (l.times = Ct.convertArray(h, l.times.constructor), l.values = Ct.convertArray(f, l.values.constructor), o.push(l));
    }
    s.tracks = o;
    let a = 1 / 0;
    for (let c = 0; c < s.tracks.length; ++c)
      a > s.tracks[c].times[0] && (a = s.tracks[c].times[0]);
    for (let c = 0; c < s.tracks.length; ++c)
      s.tracks[c].shift(-1 * a);
    return s.resetDuration(), s;
  },
  makeClipAdditive: function(n, e = 0, t = n, i = 30) {
    i <= 0 && (i = 30);
    const r = t.tracks.length, s = e / i;
    for (let o = 0; o < r; ++o) {
      const a = t.tracks[o], c = a.ValueTypeName;
      if (c === "bool" || c === "string") continue;
      const l = n.tracks.find(function(v) {
        return v.name === a.name && v.ValueTypeName === c;
      });
      if (l === void 0) continue;
      let d = 0;
      const h = a.getValueSize();
      a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = h / 3);
      let f = 0;
      const g = l.getValueSize();
      l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (f = g / 3);
      const p = a.times.length - 1;
      let u;
      if (s <= a.times[0]) {
        const v = d, m = h - d;
        u = Ct.arraySlice(a.values, v, m);
      } else if (s >= a.times[p]) {
        const v = p * h + d, m = v + h - d;
        u = Ct.arraySlice(a.values, v, m);
      } else {
        const v = a.createInterpolant(), m = d, x = h - d;
        v.evaluate(s), u = Ct.arraySlice(v.resultBuffer, m, x);
      }
      c === "quaternion" && new bn().fromArray(u).normalize().conjugate().toArray(u);
      const y = l.times.length;
      for (let v = 0; v < y; ++v) {
        const m = v * g + f;
        if (c === "quaternion")
          bn.multiplyQuaternionsFlat(
            l.values,
            m,
            u,
            0,
            l.values,
            m
          );
        else {
          const x = g - f * 2;
          for (let w = 0; w < x; ++w)
            l.values[m + w] -= u[w];
        }
      }
    }
    return n.blendMode = Mf, n;
  }
};
class Ni {
  constructor(e, t, i, r) {
    this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r !== void 0 ? r : new t.constructor(i), this.sampleValues = t, this.valueSize = i, this.settings = null, this.DefaultSettings_ = {};
  }
  evaluate(e) {
    const t = this.parameterPositions;
    let i = this._cachedIndex, r = t[i], s = t[i - 1];
    e: {
      t: {
        let o;
        n: {
          i: if (!(e < r)) {
            for (let a = i + 2; ; ) {
              if (r === void 0) {
                if (e < s) break i;
                return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, e, s);
              }
              if (i === a) break;
              if (s = r, r = t[++i], e < r)
                break t;
            }
            o = t.length;
            break n;
          }
          if (!(e >= s)) {
            const a = t[1];
            e < a && (i = 2, s = a);
            for (let c = i - 2; ; ) {
              if (s === void 0)
                return this._cachedIndex = 0, this.beforeStart_(0, e, r);
              if (i === c) break;
              if (r = s, s = t[--i - 1], e >= s)
                break t;
            }
            o = i, i = 0;
            break n;
          }
          break e;
        }
        for (; i < o; ) {
          const a = i + o >>> 1;
          e < t[a] ? o = a : i = a + 1;
        }
        if (r = t[i], s = t[i - 1], s === void 0)
          return this._cachedIndex = 0, this.beforeStart_(0, e, r);
        if (r === void 0)
          return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, s, e);
      }
      this._cachedIndex = i, this.intervalChanged_(i, s, r);
    }
    return this.interpolate_(i, s, e, r);
  }
  getSettings_() {
    return this.settings || this.DefaultSettings_;
  }
  copySampleValue_(e) {
    const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r;
    for (let o = 0; o !== r; ++o)
      t[o] = i[s + o];
    return t;
  }
  // Template methods for derived classes:
  interpolate_() {
    throw new Error("call to abstract method");
  }
  intervalChanged_() {
  }
}
Ni.prototype.beforeStart_ = Ni.prototype.copySampleValue_;
Ni.prototype.afterEnd_ = Ni.prototype.copySampleValue_;
class Ix extends Ni {
  constructor(e, t, i, r) {
    super(e, t, i, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
      endingStart: gs,
      endingEnd: gs
    };
  }
  intervalChanged_(e, t, i) {
    const r = this.parameterPositions;
    let s = e - 2, o = e + 1, a = r[s], c = r[o];
    if (a === void 0)
      switch (this.getSettings_().endingStart) {
        case vs:
          s = e, a = 2 * t - i;
          break;
        case Wa:
          s = r.length - 2, a = t + r[s] - r[s + 1];
          break;
        default:
          s = e, a = i;
      }
    if (c === void 0)
      switch (this.getSettings_().endingEnd) {
        case vs:
          o = e, c = 2 * i - t;
          break;
        case Wa:
          o = 1, c = i + r[1] - r[0];
          break;
        default:
          o = e - 1, c = t;
      }
    const l = (i - t) * 0.5, d = this.valueSize;
    this._weightPrev = l / (t - a), this._weightNext = l / (c - i), this._offsetPrev = s * d, this._offsetNext = o * d;
  }
  interpolate_(e, t, i, r) {
    const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = this._offsetPrev, h = this._offsetNext, f = this._weightPrev, g = this._weightNext, p = (i - t) / (r - t), u = p * p, y = u * p, v = -f * y + 2 * f * u - f * p, m = (1 + f) * y + (-1.5 - 2 * f) * u + (-0.5 + f) * p + 1, x = (-1 - g) * y + (1.5 + g) * u + 0.5 * p, w = g * y - g * u;
    for (let A = 0; A !== a; ++A)
      s[A] = v * o[d + A] + m * o[l + A] + x * o[c + A] + w * o[h + A];
    return s;
  }
}
class Yf extends Ni {
  constructor(e, t, i, r) {
    super(e, t, i, r);
  }
  interpolate_(e, t, i, r) {
    const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = (i - t) / (r - t), h = 1 - d;
    for (let f = 0; f !== a; ++f)
      s[f] = o[l + f] * h + o[c + f] * d;
    return s;
  }
}
class Ox extends Ni {
  constructor(e, t, i, r) {
    super(e, t, i, r);
  }
  interpolate_(e) {
    return this.copySampleValue_(e - 1);
  }
}
class xi {
  constructor(e, t, i, r) {
    if (e === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined");
    if (t === void 0 || t.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e);
    this.name = e, this.times = Ct.convertArray(t, this.TimeBufferType), this.values = Ct.convertArray(i, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation);
  }
  // Serialization (in static context, because of constructor invocation
  // and automatic invocation of .toJSON):
  static toJSON(e) {
    const t = e.constructor;
    let i;
    if (t.toJSON !== this.toJSON)
      i = t.toJSON(e);
    else {
      i = {
        name: e.name,
        times: Ct.convertArray(e.times, Array),
        values: Ct.convertArray(e.values, Array)
      };
      const r = e.getInterpolation();
      r !== e.DefaultInterpolation && (i.interpolation = r);
    }
    return i.type = e.ValueTypeName, i;
  }
  InterpolantFactoryMethodDiscrete(e) {
    return new Ox(this.times, this.values, this.getValueSize(), e);
  }
  InterpolantFactoryMethodLinear(e) {
    return new Yf(this.times, this.values, this.getValueSize(), e);
  }
  InterpolantFactoryMethodSmooth(e) {
    return new Ix(this.times, this.values, this.getValueSize(), e);
  }
  setInterpolation(e) {
    let t;
    switch (e) {
      case Lo:
        t = this.InterpolantFactoryMethodDiscrete;
        break;
      case Es:
        t = this.InterpolantFactoryMethodLinear;
        break;
      case Cc:
        t = this.InterpolantFactoryMethodSmooth;
        break;
    }
    if (t === void 0) {
      const i = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name;
      if (this.createInterpolant === void 0)
        if (e !== this.DefaultInterpolation)
          this.setInterpolation(this.DefaultInterpolation);
        else
          throw new Error(i);
      return console.warn("THREE.KeyframeTrack:", i), this;
    }
    return this.createInterpolant = t, this;
  }
  getInterpolation() {
    switch (this.createInterpolant) {
      case this.InterpolantFactoryMethodDiscrete:
        return Lo;
      case this.InterpolantFactoryMethodLinear:
        return Es;
      case this.InterpolantFactoryMethodSmooth:
        return Cc;
    }
  }
  getValueSize() {
    return this.values.length / this.times.length;
  }
  // move all keyframes either forwards or backwards in time
  shift(e) {
    if (e !== 0) {
      const t = this.times;
      for (let i = 0, r = t.length; i !== r; ++i)
        t[i] += e;
    }
    return this;
  }
  // scale all keyframe times by a factor (useful for frame <-> seconds conversions)
  scale(e) {
    if (e !== 1) {
      const t = this.times;
      for (let i = 0, r = t.length; i !== r; ++i)
        t[i] *= e;
    }
    return this;
  }
  // removes keyframes before and after animation without changing any values within the range [startTime, endTime].
  // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
  trim(e, t) {
    const i = this.times, r = i.length;
    let s = 0, o = r - 1;
    for (; s !== r && i[s] < e; )
      ++s;
    for (; o !== -1 && i[o] > t; )
      --o;
    if (++o, s !== 0 || o !== r) {
      s >= o && (o = Math.max(o, 1), s = o - 1);
      const a = this.getValueSize();
      this.times = Ct.arraySlice(i, s, o), this.values = Ct.arraySlice(this.values, s * a, o * a);
    }
    return this;
  }
  // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
  validate() {
    let e = !0;
    const t = this.getValueSize();
    t - Math.floor(t) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1);
    const i = this.times, r = this.values, s = i.length;
    s === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1);
    let o = null;
    for (let a = 0; a !== s; a++) {
      const c = i[a];
      if (typeof c == "number" && isNaN(c)) {
        console.error("THREE.KeyframeTrack: Time is not a valid number.", this, a, c), e = !1;
        break;
      }
      if (o !== null && o > c) {
        console.error("THREE.KeyframeTrack: Out of order keys.", this, a, c, o), e = !1;
        break;
      }
      o = c;
    }
    if (r !== void 0 && Ct.isTypedArray(r))
      for (let a = 0, c = r.length; a !== c; ++a) {
        const l = r[a];
        if (isNaN(l)) {
          console.error("THREE.KeyframeTrack: Value is not a valid number.", this, a, l), e = !1;
          break;
        }
      }
    return e;
  }
  // removes equivalent sequential keys as common in morph target sequences
  // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
  optimize() {
    const e = Ct.arraySlice(this.times), t = Ct.arraySlice(this.values), i = this.getValueSize(), r = this.getInterpolation() === Cc, s = e.length - 1;
    let o = 1;
    for (let a = 1; a < s; ++a) {
      let c = !1;
      const l = e[a], d = e[a + 1];
      if (l !== d && (a !== 1 || l !== e[0]))
        if (r)
          c = !0;
        else {
          const h = a * i, f = h - i, g = h + i;
          for (let p = 0; p !== i; ++p) {
            const u = t[h + p];
            if (u !== t[f + p] || u !== t[g + p]) {
              c = !0;
              break;
            }
          }
        }
      if (c) {
        if (a !== o) {
          e[o] = e[a];
          const h = a * i, f = o * i;
          for (let g = 0; g !== i; ++g)
            t[f + g] = t[h + g];
        }
        ++o;
      }
    }
    if (s > 0) {
      e[o] = e[s];
      for (let a = s * i, c = o * i, l = 0; l !== i; ++l)
        t[c + l] = t[a + l];
      ++o;
    }
    return o !== e.length ? (this.times = Ct.arraySlice(e, 0, o), this.values = Ct.arraySlice(t, 0, o * i)) : (this.times = e, this.values = t), this;
  }
  clone() {
    const e = Ct.arraySlice(this.times, 0), t = Ct.arraySlice(this.values, 0), i = this.constructor, r = new i(this.name, e, t);
    return r.createInterpolant = this.createInterpolant, r;
  }
}
xi.prototype.TimeBufferType = Float32Array;
xi.prototype.ValueBufferType = Float32Array;
xi.prototype.DefaultInterpolation = Es;
class ks extends xi {
}
ks.prototype.ValueTypeName = "bool";
ks.prototype.ValueBufferType = Array;
ks.prototype.DefaultInterpolation = Lo;
ks.prototype.InterpolantFactoryMethodLinear = void 0;
ks.prototype.InterpolantFactoryMethodSmooth = void 0;
class Jf extends xi {
}
Jf.prototype.ValueTypeName = "color";
class Ho extends xi {
}
Ho.prototype.ValueTypeName = "number";
class Dx extends Ni {
  constructor(e, t, i, r) {
    super(e, t, i, r);
  }
  interpolate_(e, t, i, r) {
    const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = (i - t) / (r - t);
    let l = e * a;
    for (let d = l + a; l !== d; l += 4)
      bn.slerpFlat(s, 0, o, l - a, o, l, c);
    return s;
  }
}
class Vs extends xi {
  InterpolantFactoryMethodLinear(e) {
    return new Dx(this.times, this.values, this.getValueSize(), e);
  }
}
Vs.prototype.ValueTypeName = "quaternion";
Vs.prototype.DefaultInterpolation = Es;
Vs.prototype.InterpolantFactoryMethodSmooth = void 0;
class Gs extends xi {
}
Gs.prototype.ValueTypeName = "string";
Gs.prototype.ValueBufferType = Array;
Gs.prototype.DefaultInterpolation = Lo;
Gs.prototype.InterpolantFactoryMethodLinear = void 0;
Gs.prototype.InterpolantFactoryMethodSmooth = void 0;
class Wo extends xi {
}
Wo.prototype.ValueTypeName = "vector";
class jo {
  constructor(e, t = -1, i, r = fu) {
    this.name = e, this.tracks = i, this.duration = t, this.blendMode = r, this.uuid = Wn(), this.duration < 0 && this.resetDuration();
  }
  static parse(e) {
    const t = [], i = e.tracks, r = 1 / (e.fps || 1);
    for (let o = 0, a = i.length; o !== a; ++o)
      t.push(pN(i[o]).scale(r));
    const s = new this(e.name, e.duration, t, e.blendMode);
    return s.uuid = e.uuid, s;
  }
  static toJSON(e) {
    const t = [], i = e.tracks, r = {
      name: e.name,
      duration: e.duration,
      tracks: t,
      uuid: e.uuid,
      blendMode: e.blendMode
    };
    for (let s = 0, o = i.length; s !== o; ++s)
      t.push(xi.toJSON(i[s]));
    return r;
  }
  static CreateFromMorphTargetSequence(e, t, i, r) {
    const s = t.length, o = [];
    for (let a = 0; a < s; a++) {
      let c = [], l = [];
      c.push(
        (a + s - 1) % s,
        a,
        (a + 1) % s
      ), l.push(0, 1, 0);
      const d = Ct.getKeyframeOrder(c);
      c = Ct.sortedArray(c, 1, d), l = Ct.sortedArray(l, 1, d), !r && c[0] === 0 && (c.push(s), l.push(l[0])), o.push(
        new Ho(
          ".morphTargetInfluences[" + t[a].name + "]",
          c,
          l
        ).scale(1 / i)
      );
    }
    return new this(e, -1, o);
  }
  static findByName(e, t) {
    let i = e;
    if (!Array.isArray(e)) {
      const r = e;
      i = r.geometry && r.geometry.animations || r.animations;
    }
    for (let r = 0; r < i.length; r++)
      if (i[r].name === t)
        return i[r];
    return null;
  }
  static CreateClipsFromMorphTargetSequences(e, t, i) {
    const r = {}, s = /^([\w-]*?)([\d]+)$/;
    for (let a = 0, c = e.length; a < c; a++) {
      const l = e[a], d = l.name.match(s);
      if (d && d.length > 1) {
        const h = d[1];
        let f = r[h];
        f || (r[h] = f = []), f.push(l);
      }
    }
    const o = [];
    for (const a in r)
      o.push(this.CreateFromMorphTargetSequence(a, r[a], t, i));
    return o;
  }
  // parse the animation.hierarchy format
  static parseAnimation(e, t) {
    if (!e)
      return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null;
    const i = function(h, f, g, p, u) {
      if (g.length !== 0) {
        const y = [], v = [];
        Ct.flattenJSON(g, y, v, p), y.length !== 0 && u.push(new h(f, y, v));
      }
    }, r = [], s = e.name || "default", o = e.fps || 30, a = e.blendMode;
    let c = e.length || -1;
    const l = e.hierarchy || [];
    for (let h = 0; h < l.length; h++) {
      const f = l[h].keys;
      if (!(!f || f.length === 0))
        if (f[0].morphTargets) {
          const g = {};
          let p;
          for (p = 0; p < f.length; p++)
            if (f[p].morphTargets)
              for (let u = 0; u < f[p].morphTargets.length; u++)
                g[f[p].morphTargets[u]] = -1;
          for (const u in g) {
            const y = [], v = [];
            for (let m = 0; m !== f[p].morphTargets.length; ++m) {
              const x = f[p];
              y.push(x.time), v.push(x.morphTarget === u ? 1 : 0);
            }
            r.push(new Ho(".morphTargetInfluence[" + u + "]", y, v));
          }
          c = g.length * (o || 1);
        } else {
          const g = ".bones[" + t[h].name + "]";
          i(
            Wo,
            g + ".position",
            f,
            "pos",
            r
          ), i(
            Vs,
            g + ".quaternion",
            f,
            "rot",
            r
          ), i(
            Wo,
            g + ".scale",
            f,
            "scl",
            r
          );
        }
    }
    return r.length === 0 ? null : new this(s, c, r, a);
  }
  resetDuration() {
    const e = this.tracks;
    let t = 0;
    for (let i = 0, r = e.length; i !== r; ++i) {
      const s = this.tracks[i];
      t = Math.max(t, s.times[s.times.length - 1]);
    }
    return this.duration = t, this;
  }
  trim() {
    for (let e = 0; e < this.tracks.length; e++)
      this.tracks[e].trim(0, this.duration);
    return this;
  }
  validate() {
    let e = !0;
    for (let t = 0; t < this.tracks.length; t++)
      e = e && this.tracks[t].validate();
    return e;
  }
  optimize() {
    for (let e = 0; e < this.tracks.length; e++)
      this.tracks[e].optimize();
    return this;
  }
  clone() {
    const e = [];
    for (let t = 0; t < this.tracks.length; t++)
      e.push(this.tracks[t].clone());
    return new this.constructor(this.name, this.duration, e, this.blendMode);
  }
  toJSON() {
    return this.constructor.toJSON(this);
  }
}
function fN(n) {
  switch (n.toLowerCase()) {
    case "scalar":
    case "double":
    case "float":
    case "number":
    case "integer":
      return Ho;
    case "vector":
    case "vector2":
    case "vector3":
    case "vector4":
      return Wo;
    case "color":
      return Jf;
    case "quaternion":
      return Vs;
    case "bool":
    case "boolean":
      return ks;
    case "string":
      return Gs;
  }
  throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + n);
}
function pN(n) {
  if (n.type === void 0)
    throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
  const e = fN(n.type);
  if (n.times === void 0) {
    const t = [], i = [];
    Ct.flattenJSON(n.keys, t, i, "value"), n.times = t, n.values = i;
  }
  return e.parse !== void 0 ? e.parse(n) : new e(n.name, n.times, n.values, n.interpolation);
}
const Is = {
  enabled: !1,
  files: {},
  add: function(n, e) {
    this.enabled !== !1 && (this.files[n] = e);
  },
  get: function(n) {
    if (this.enabled !== !1)
      return this.files[n];
  },
  remove: function(n) {
    delete this.files[n];
  },
  clear: function() {
    this.files = {};
  }
};
class Kf {
  constructor(e, t, i) {
    const r = this;
    let s = !1, o = 0, a = 0, c;
    const l = [];
    this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = i, this.itemStart = function(d) {
      a++, s === !1 && r.onStart !== void 0 && r.onStart(d, o, a), s = !0;
    }, this.itemEnd = function(d) {
      o++, r.onProgress !== void 0 && r.onProgress(d, o, a), o === a && (s = !1, r.onLoad !== void 0 && r.onLoad());
    }, this.itemError = function(d) {
      r.onError !== void 0 && r.onError(d);
    }, this.resolveURL = function(d) {
      return c ? c(d) : d;
    }, this.setURLModifier = function(d) {
      return c = d, this;
    }, this.addHandler = function(d, h) {
      return l.push(d, h), this;
    }, this.removeHandler = function(d) {
      const h = l.indexOf(d);
      return h !== -1 && l.splice(h, 2), this;
    }, this.getHandler = function(d) {
      for (let h = 0, f = l.length; h < f; h += 2) {
        const g = l[h], p = l[h + 1];
        if (g.global && (g.lastIndex = 0), g.test(d))
          return p;
      }
      return null;
    };
  }
}
const Nx = new Kf();
class xn {
  constructor(e) {
    this.manager = e !== void 0 ? e : Nx, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
  }
  load() {
  }
  loadAsync(e, t) {
    const i = this;
    return new Promise(function(r, s) {
      i.load(e, r, t, s);
    });
  }
  parse() {
  }
  setCrossOrigin(e) {
    return this.crossOrigin = e, this;
  }
  setWithCredentials(e) {
    return this.withCredentials = e, this;
  }
  setPath(e) {
    return this.path = e, this;
  }
  setResourcePath(e) {
    return this.resourcePath = e, this;
  }
  setRequestHeader(e) {
    return this.requestHeader = e, this;
  }
}
const ai = {};
class Zn extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
    const s = this, o = Is.get(e);
    if (o !== void 0)
      return s.manager.itemStart(e), setTimeout(function() {
        t && t(o), s.manager.itemEnd(e);
      }, 0), o;
    if (ai[e] !== void 0) {
      ai[e].push({
        onLoad: t,
        onProgress: i,
        onError: r
      });
      return;
    }
    const a = /^data:(.*?)(;base64)?,(.*)$/, c = e.match(a);
    let l;
    if (c) {
      const d = c[1], h = !!c[2];
      let f = c[3];
      f = decodeURIComponent(f), h && (f = atob(f));
      try {
        let g;
        const p = (this.responseType || "").toLowerCase();
        switch (p) {
          case "arraybuffer":
          case "blob":
            const u = new Uint8Array(f.length);
            for (let v = 0; v < f.length; v++)
              u[v] = f.charCodeAt(v);
            p === "blob" ? g = new Blob([u.buffer], { type: d }) : g = u.buffer;
            break;
          case "document":
            g = new DOMParser().parseFromString(f, d);
            break;
          case "json":
            g = JSON.parse(f);
            break;
          default:
            g = f;
            break;
        }
        setTimeout(function() {
          t && t(g), s.manager.itemEnd(e);
        }, 0);
      } catch (g) {
        setTimeout(function() {
          r && r(g), s.manager.itemError(e), s.manager.itemEnd(e);
        }, 0);
      }
    } else {
      ai[e] = [], ai[e].push({
        onLoad: t,
        onProgress: i,
        onError: r
      }), l = new XMLHttpRequest(), l.open("GET", e, !0), l.addEventListener("load", function(d) {
        const h = this.response, f = ai[e];
        if (delete ai[e], this.status === 200 || this.status === 0) {
          this.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), Is.add(e, h);
          for (let g = 0, p = f.length; g < p; g++) {
            const u = f[g];
            u.onLoad && u.onLoad(h);
          }
          s.manager.itemEnd(e);
        } else {
          for (let g = 0, p = f.length; g < p; g++) {
            const u = f[g];
            u.onError && u.onError(d);
          }
          s.manager.itemError(e), s.manager.itemEnd(e);
        }
      }, !1), l.addEventListener("progress", function(d) {
        const h = ai[e];
        for (let f = 0, g = h.length; f < g; f++) {
          const p = h[f];
          p.onProgress && p.onProgress(d);
        }
      }, !1), l.addEventListener("error", function(d) {
        const h = ai[e];
        delete ai[e];
        for (let f = 0, g = h.length; f < g; f++) {
          const p = h[f];
          p.onError && p.onError(d);
        }
        s.manager.itemError(e), s.manager.itemEnd(e);
      }, !1), l.addEventListener("abort", function(d) {
        const h = ai[e];
        delete ai[e];
        for (let f = 0, g = h.length; f < g; f++) {
          const p = h[f];
          p.onError && p.onError(d);
        }
        s.manager.itemError(e), s.manager.itemEnd(e);
      }, !1), this.responseType !== void 0 && (l.responseType = this.responseType), this.withCredentials !== void 0 && (l.withCredentials = this.withCredentials), l.overrideMimeType && l.overrideMimeType(this.mimeType !== void 0 ? this.mimeType : "text/plain");
      for (const d in this.requestHeader)
        l.setRequestHeader(d, this.requestHeader[d]);
      l.send(null);
    }
    return s.manager.itemStart(e), l;
  }
  setResponseType(e) {
    return this.responseType = e, this;
  }
  setMimeType(e) {
    return this.mimeType = e, this;
  }
}
class mN extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Zn(this.manager);
    o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
      try {
        t(s.parse(JSON.parse(a)));
      } catch (c) {
        r ? r(c) : console.error(c), s.manager.itemError(e);
      }
    }, i, r);
  }
  parse(e) {
    const t = [];
    for (let i = 0; i < e.length; i++) {
      const r = jo.parse(e[i]);
      t.push(r);
    }
    return t;
  }
}
class gN extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = [], a = new If(), c = new Zn(this.manager);
    c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(s.withCredentials);
    let l = 0;
    function d(h) {
      c.load(e[h], function(f) {
        const g = s.parse(f, !0);
        o[h] = {
          width: g.width,
          height: g.height,
          format: g.format,
          mipmaps: g.mipmaps
        }, l += 1, l === 6 && (g.mipmapCount === 1 && (a.minFilter = zt), a.image = o, a.format = g.format, a.needsUpdate = !0, t && t(a));
      }, i, r);
    }
    if (Array.isArray(e))
      for (let h = 0, f = e.length; h < f; ++h)
        d(h);
    else
      c.load(e, function(h) {
        const f = s.parse(h, !0);
        if (f.isCubemap) {
          const g = f.mipmaps.length / f.mipmapCount;
          for (let p = 0; p < g; p++) {
            o[p] = { mipmaps: [] };
            for (let u = 0; u < f.mipmapCount; u++)
              o[p].mipmaps.push(f.mipmaps[p * f.mipmapCount + u]), o[p].format = f.format, o[p].width = f.width, o[p].height = f.height;
          }
          a.image = o;
        } else
          a.image.width = f.width, a.image.height = f.height, a.mipmaps = f.mipmaps;
        f.mipmapCount === 1 && (a.minFilter = zt), a.format = f.format, a.needsUpdate = !0, t && t(a);
      }, i, r);
    return a;
  }
}
class Ya extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
    const s = this, o = Is.get(e);
    if (o !== void 0)
      return s.manager.itemStart(e), setTimeout(function() {
        t && t(o), s.manager.itemEnd(e);
      }, 0), o;
    const a = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
    function c() {
      a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), Is.add(e, this), t && t(this), s.manager.itemEnd(e);
    }
    function l(d) {
      a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), r && r(d), s.manager.itemError(e), s.manager.itemEnd(e);
    }
    return a.addEventListener("load", c, !1), a.addEventListener("error", l, !1), e.substr(0, 5) !== "data:" && this.crossOrigin !== void 0 && (a.crossOrigin = this.crossOrigin), s.manager.itemStart(e), a.src = e, a;
  }
}
class Bx extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = new ta(), o = new Ya(this.manager);
    o.setCrossOrigin(this.crossOrigin), o.setPath(this.path);
    let a = 0;
    function c(l) {
      o.load(e[l], function(d) {
        s.images[l] = d, a++, a === 6 && (s.needsUpdate = !0, t && t(s));
      }, void 0, r);
    }
    for (let l = 0; l < e.length; ++l)
      c(l);
    return s;
  }
}
class Ux extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Ss(), a = new Zn(this.manager);
    return a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(s.withCredentials), a.load(e, function(c) {
      const l = s.parse(c);
      l && (l.image !== void 0 ? o.image = l.image : l.data !== void 0 && (o.image.width = l.width, o.image.height = l.height, o.image.data = l.data), o.wrapS = l.wrapS !== void 0 ? l.wrapS : hn, o.wrapT = l.wrapT !== void 0 ? l.wrapT : hn, o.magFilter = l.magFilter !== void 0 ? l.magFilter : zt, o.minFilter = l.minFilter !== void 0 ? l.minFilter : zt, o.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.encoding !== void 0 && (o.encoding = l.encoding), l.flipY !== void 0 && (o.flipY = l.flipY), l.format !== void 0 && (o.format = l.format), l.type !== void 0 && (o.type = l.type), l.mipmaps !== void 0 && (o.mipmaps = l.mipmaps, o.minFilter = pr), l.mipmapCount === 1 && (o.minFilter = zt), l.generateMipmaps !== void 0 && (o.generateMipmaps = l.generateMipmaps), o.needsUpdate = !0, t && t(o, l));
    }, i, r), o;
  }
}
class qf extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = new Yt(), o = new Ya(this.manager);
    return o.setCrossOrigin(this.crossOrigin), o.setPath(this.path), o.load(e, function(a) {
      s.image = a;
      const c = e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0;
      s.format = c ? ir : Hn, s.needsUpdate = !0, t !== void 0 && t(s);
    }, i, r), s;
  }
}
class zx extends $n {
  constructor() {
    super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1;
  }
  add(e) {
    this.curves.push(e);
  }
  closePath() {
    const e = this.curves[0].getPoint(0), t = this.curves[this.curves.length - 1].getPoint(1);
    e.equals(t) || this.curves.push(new Ml(t, e));
  }
  // To get accurate point with reference to
  // entire path distance at time t,
  // following has to be done:
  // 1. Length of each sub path have to be known
  // 2. Locate and identify type of curve
  // 3. Get t for the curve
  // 4. Return curve.getPointAt(t')
  getPoint(e) {
    const t = e * this.getLength(), i = this.getCurveLengths();
    let r = 0;
    for (; r < i.length; ) {
      if (i[r] >= t) {
        const s = i[r] - t, o = this.curves[r], a = o.getLength(), c = a === 0 ? 0 : 1 - s / a;
        return o.getPointAt(c);
      }
      r++;
    }
    return null;
  }
  // We cannot use the default THREE.Curve getPoint() with getLength() because in
  // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
  // getPoint() depends on getLength
  getLength() {
    const e = this.getCurveLengths();
    return e[e.length - 1];
  }
  // cacheLengths must be recalculated.
  updateArcLengths() {
    this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths();
  }
  // Compute lengths and cache them
  // We cannot overwrite getLengths() because UtoT mapping uses it.
  getCurveLengths() {
    if (this.cacheLengths && this.cacheLengths.length === this.curves.length)
      return this.cacheLengths;
    const e = [];
    let t = 0;
    for (let i = 0, r = this.curves.length; i < r; i++)
      t += this.curves[i].getLength(), e.push(t);
    return this.cacheLengths = e, e;
  }
  getSpacedPoints(e = 40) {
    const t = [];
    for (let i = 0; i <= e; i++)
      t.push(this.getPoint(i / e));
    return this.autoClose && t.push(t[0]), t;
  }
  getPoints(e = 12) {
    const t = [];
    let i;
    for (let r = 0, s = this.curves; r < s.length; r++) {
      const o = s[r], a = o && o.isEllipseCurve ? e * 2 : o && (o.isLineCurve || o.isLineCurve3) ? 1 : o && o.isSplineCurve ? e * o.points.length : e, c = o.getPoints(a);
      for (let l = 0; l < c.length; l++) {
        const d = c[l];
        i && i.equals(d) || (t.push(d), i = d);
      }
    }
    return this.autoClose && t.length > 1 && !t[t.length - 1].equals(t[0]) && t.push(t[0]), t;
  }
  copy(e) {
    super.copy(e), this.curves = [];
    for (let t = 0, i = e.curves.length; t < i; t++) {
      const r = e.curves[t];
      this.curves.push(r.clone());
    }
    return this.autoClose = e.autoClose, this;
  }
  toJSON() {
    const e = super.toJSON();
    e.autoClose = this.autoClose, e.curves = [];
    for (let t = 0, i = this.curves.length; t < i; t++) {
      const r = this.curves[t];
      e.curves.push(r.toJSON());
    }
    return e;
  }
  fromJSON(e) {
    super.fromJSON(e), this.autoClose = e.autoClose, this.curves = [];
    for (let t = 0, i = e.curves.length; t < i; t++) {
      const r = e.curves[t];
      this.curves.push(new kf[r.type]().fromJSON(r));
    }
    return this;
  }
}
class Ja extends zx {
  constructor(e) {
    super(), this.type = "Path", this.currentPoint = new Re(), e && this.setFromPoints(e);
  }
  setFromPoints(e) {
    this.moveTo(e[0].x, e[0].y);
    for (let t = 1, i = e.length; t < i; t++)
      this.lineTo(e[t].x, e[t].y);
    return this;
  }
  moveTo(e, t) {
    return this.currentPoint.set(e, t), this;
  }
  lineTo(e, t) {
    const i = new Ml(this.currentPoint.clone(), new Re(e, t));
    return this.curves.push(i), this.currentPoint.set(e, t), this;
  }
  quadraticCurveTo(e, t, i, r) {
    const s = new _u(
      this.currentPoint.clone(),
      new Re(e, t),
      new Re(i, r)
    );
    return this.curves.push(s), this.currentPoint.set(i, r), this;
  }
  bezierCurveTo(e, t, i, r, s, o) {
    const a = new Su(
      this.currentPoint.clone(),
      new Re(e, t),
      new Re(i, r),
      new Re(s, o)
    );
    return this.curves.push(a), this.currentPoint.set(s, o), this;
  }
  splineThru(e) {
    const t = [this.currentPoint.clone()].concat(e), i = new Tu(t);
    return this.curves.push(i), this.currentPoint.copy(e[e.length - 1]), this;
  }
  arc(e, t, i, r, s, o) {
    const a = this.currentPoint.x, c = this.currentPoint.y;
    return this.absarc(
      e + a,
      t + c,
      i,
      r,
      s,
      o
    ), this;
  }
  absarc(e, t, i, r, s, o) {
    return this.absellipse(e, t, i, i, r, s, o), this;
  }
  ellipse(e, t, i, r, s, o, a, c) {
    const l = this.currentPoint.x, d = this.currentPoint.y;
    return this.absellipse(e + l, t + d, i, r, s, o, a, c), this;
  }
  absellipse(e, t, i, r, s, o, a, c) {
    const l = new xl(e, t, i, r, s, o, a, c);
    if (this.curves.length > 0) {
      const h = l.getPoint(0);
      h.equals(this.currentPoint) || this.lineTo(h.x, h.y);
    }
    this.curves.push(l);
    const d = l.getPoint(1);
    return this.currentPoint.copy(d), this;
  }
  copy(e) {
    return super.copy(e), this.currentPoint.copy(e.currentPoint), this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.currentPoint = this.currentPoint.toArray(), e;
  }
  fromJSON(e) {
    return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this;
  }
}
class Dr extends Ja {
  constructor(e) {
    super(e), this.uuid = Wn(), this.type = "Shape", this.holes = [];
  }
  getPointsHoles(e) {
    const t = [];
    for (let i = 0, r = this.holes.length; i < r; i++)
      t[i] = this.holes[i].getPoints(e);
    return t;
  }
  // get points of shape and holes (keypoints based on segments parameter)
  extractPoints(e) {
    return {
      shape: this.getPoints(e),
      holes: this.getPointsHoles(e)
    };
  }
  copy(e) {
    super.copy(e), this.holes = [];
    for (let t = 0, i = e.holes.length; t < i; t++) {
      const r = e.holes[t];
      this.holes.push(r.clone());
    }
    return this;
  }
  toJSON() {
    const e = super.toJSON();
    e.uuid = this.uuid, e.holes = [];
    for (let t = 0, i = this.holes.length; t < i; t++) {
      const r = this.holes[t];
      e.holes.push(r.toJSON());
    }
    return e;
  }
  fromJSON(e) {
    super.fromJSON(e), this.uuid = e.uuid, this.holes = [];
    for (let t = 0, i = e.holes.length; t < i; t++) {
      const r = e.holes[t];
      this.holes.push(new Ja().fromJSON(r));
    }
    return this;
  }
}
class gi extends ut {
  constructor(e, t = 1) {
    super(), this.type = "Light", this.color = new Ue(e), this.intensity = t;
  }
  dispose() {
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this.intensity = e.intensity, this;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, this.groundColor !== void 0 && (t.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (t.object.distance = this.distance), this.angle !== void 0 && (t.object.angle = this.angle), this.decay !== void 0 && (t.object.decay = this.decay), this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), t;
  }
}
gi.prototype.isLight = !0;
class Qf extends gi {
  constructor(e, t, i) {
    super(e, i), this.type = "HemisphereLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.groundColor = new Ue(t);
  }
  copy(e) {
    return gi.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this;
  }
}
Qf.prototype.isHemisphereLight = !0;
const kg = /* @__PURE__ */ new Xe(), Vg = /* @__PURE__ */ new Q(), Gg = /* @__PURE__ */ new Q();
class ep {
  constructor(e) {
    this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.mapSize = new Re(512, 512), this.map = null, this.mapPass = null, this.matrix = new Xe(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new dl(), this._frameExtents = new Re(1, 1), this._viewportCount = 1, this._viewports = [
      new xt(0, 0, 1, 1)
    ];
  }
  getViewportCount() {
    return this._viewportCount;
  }
  getFrustum() {
    return this._frustum;
  }
  updateMatrices(e) {
    const t = this.camera, i = this.matrix;
    Vg.setFromMatrixPosition(e.matrixWorld), t.position.copy(Vg), Gg.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(Gg), t.updateMatrixWorld(), kg.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(kg), i.set(
      0.5,
      0,
      0,
      0.5,
      0,
      0.5,
      0,
      0.5,
      0,
      0,
      0.5,
      0.5,
      0,
      0,
      0,
      1
    ), i.multiply(t.projectionMatrix), i.multiply(t.matrixWorldInverse);
  }
  getViewport(e) {
    return this._viewports[e];
  }
  getFrameExtents() {
    return this._frameExtents;
  }
  dispose() {
    this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose();
  }
  copy(e) {
    return this.camera = e.camera.clone(), this.bias = e.bias, this.radius = e.radius, this.mapSize.copy(e.mapSize), this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  toJSON() {
    const e = {};
    return this.bias !== 0 && (e.bias = this.bias), this.normalBias !== 0 && (e.normalBias = this.normalBias), this.radius !== 1 && (e.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e;
  }
}
class kx extends ep {
  constructor() {
    super(new nn(50, 1, 0.5, 500)), this.focus = 1;
  }
  updateMatrices(e) {
    const t = this.camera, i = ja * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height, s = e.distance || t.far;
    (i !== t.fov || r !== t.aspect || s !== t.far) && (t.fov = i, t.aspect = r, t.far = s, t.updateProjectionMatrix()), super.updateMatrices(e);
  }
  copy(e) {
    return super.copy(e), this.focus = e.focus, this;
  }
}
kx.prototype.isSpotLightShadow = !0;
class Cu extends gi {
  constructor(e, t, i = 0, r = Math.PI / 3, s = 0, o = 1) {
    super(e, t), this.type = "SpotLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.target = new ut(), this.distance = i, this.angle = r, this.penumbra = s, this.decay = o, this.shadow = new kx();
  }
  get power() {
    return this.intensity * Math.PI;
  }
  set power(e) {
    this.intensity = e / Math.PI;
  }
  dispose() {
    this.shadow.dispose();
  }
  copy(e) {
    return super.copy(e), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
  }
}
Cu.prototype.isSpotLight = !0;
const Hg = /* @__PURE__ */ new Xe(), xa = /* @__PURE__ */ new Q(), Ah = /* @__PURE__ */ new Q();
class Vx extends ep {
  constructor() {
    super(new nn(90, 1, 0.5, 500)), this._frameExtents = new Re(4, 2), this._viewportCount = 6, this._viewports = [
      // These viewports map a cube-map onto a 2D texture with the
      // following orientation:
      //
      //  xzXZ
      //   y Y
      //
      // X - Positive x direction
      // x - Negative x direction
      // Y - Positive y direction
      // y - Negative y direction
      // Z - Positive z direction
      // z - Negative z direction
      // positive X
      new xt(2, 1, 1, 1),
      // negative X
      new xt(0, 1, 1, 1),
      // positive Z
      new xt(3, 1, 1, 1),
      // negative Z
      new xt(1, 1, 1, 1),
      // positive Y
      new xt(3, 0, 1, 1),
      // negative Y
      new xt(1, 0, 1, 1)
    ], this._cubeDirections = [
      new Q(1, 0, 0),
      new Q(-1, 0, 0),
      new Q(0, 0, 1),
      new Q(0, 0, -1),
      new Q(0, 1, 0),
      new Q(0, -1, 0)
    ], this._cubeUps = [
      new Q(0, 1, 0),
      new Q(0, 1, 0),
      new Q(0, 1, 0),
      new Q(0, 1, 0),
      new Q(0, 0, 1),
      new Q(0, 0, -1)
    ];
  }
  updateMatrices(e, t = 0) {
    const i = this.camera, r = this.matrix, s = e.distance || i.far;
    s !== i.far && (i.far = s, i.updateProjectionMatrix()), xa.setFromMatrixPosition(e.matrixWorld), i.position.copy(xa), Ah.copy(i.position), Ah.add(this._cubeDirections[t]), i.up.copy(this._cubeUps[t]), i.lookAt(Ah), i.updateMatrixWorld(), r.makeTranslation(-xa.x, -xa.y, -xa.z), Hg.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse), this._frustum.setFromProjectionMatrix(Hg);
  }
}
Vx.prototype.isPointLightShadow = !0;
class Lu extends gi {
  constructor(e, t, i = 0, r = 1) {
    super(e, t), this.type = "PointLight", this.distance = i, this.decay = r, this.shadow = new Vx();
  }
  get power() {
    return this.intensity * 4 * Math.PI;
  }
  set power(e) {
    this.intensity = e / (4 * Math.PI);
  }
  dispose() {
    this.shadow.dispose();
  }
  copy(e) {
    return super.copy(e), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;
  }
}
Lu.prototype.isPointLight = !0;
class sa extends hl {
  constructor(e = -1, t = 1, i = 1, r = -1, s = 0.1, o = 2e3) {
    super(), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = i, this.bottom = r, this.near = s, this.far = o, this.updateProjectionMatrix();
  }
  copy(e, t) {
    return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = e.view === null ? null : Object.assign({}, e.view), this;
  }
  setViewOffset(e, t, i, r, s, o) {
    this.view === null && (this.view = {
      enabled: !0,
      fullWidth: 1,
      fullHeight: 1,
      offsetX: 0,
      offsetY: 0,
      width: 1,
      height: 1
    }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix();
  }
  clearViewOffset() {
    this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();
  }
  updateProjectionMatrix() {
    const e = (this.right - this.left) / (2 * this.zoom), t = (this.top - this.bottom) / (2 * this.zoom), i = (this.right + this.left) / 2, r = (this.top + this.bottom) / 2;
    let s = i - e, o = i + e, a = r + t, c = r - t;
    if (this.view !== null && this.view.enabled) {
      const l = (this.right - this.left) / this.view.fullWidth / this.zoom, d = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
      s += l * this.view.offsetX, o = s + l * this.view.width, a -= d * this.view.offsetY, c = a - d * this.view.height;
    }
    this.projectionMatrix.makeOrthographic(s, o, a, c, this.near, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.object.zoom = this.zoom, t.object.left = this.left, t.object.right = this.right, t.object.top = this.top, t.object.bottom = this.bottom, t.object.near = this.near, t.object.far = this.far, this.view !== null && (t.object.view = Object.assign({}, this.view)), t;
  }
}
sa.prototype.isOrthographicCamera = !0;
class Gx extends ep {
  constructor() {
    super(new sa(-5, 5, 5, -5, 0.5, 500));
  }
}
Gx.prototype.isDirectionalLightShadow = !0;
class Ru extends gi {
  constructor(e, t) {
    super(e, t), this.type = "DirectionalLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.target = new ut(), this.shadow = new Gx();
  }
  dispose() {
    this.shadow.dispose();
  }
  copy(e) {
    return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
  }
}
Ru.prototype.isDirectionalLight = !0;
class tp extends gi {
  constructor(e, t) {
    super(e, t), this.type = "AmbientLight";
  }
}
tp.prototype.isAmbientLight = !0;
class np extends gi {
  constructor(e, t, i = 10, r = 10) {
    super(e, t), this.type = "RectAreaLight", this.width = i, this.height = r;
  }
  copy(e) {
    return super.copy(e), this.width = e.width, this.height = e.height, this;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.object.width = this.width, t.object.height = this.height, t;
  }
}
np.prototype.isRectAreaLight = !0;
class ip {
  constructor() {
    this.coefficients = [];
    for (let e = 0; e < 9; e++)
      this.coefficients.push(new Q());
  }
  set(e) {
    for (let t = 0; t < 9; t++)
      this.coefficients[t].copy(e[t]);
    return this;
  }
  zero() {
    for (let e = 0; e < 9; e++)
      this.coefficients[e].set(0, 0, 0);
    return this;
  }
  // get the radiance in the direction of the normal
  // target is a Vector3
  getAt(e, t) {
    const i = e.x, r = e.y, s = e.z, o = this.coefficients;
    return t.copy(o[0]).multiplyScalar(0.282095), t.addScaledVector(o[1], 0.488603 * r), t.addScaledVector(o[2], 0.488603 * s), t.addScaledVector(o[3], 0.488603 * i), t.addScaledVector(o[4], 1.092548 * (i * r)), t.addScaledVector(o[5], 1.092548 * (r * s)), t.addScaledVector(o[6], 0.315392 * (3 * s * s - 1)), t.addScaledVector(o[7], 1.092548 * (i * s)), t.addScaledVector(o[8], 0.546274 * (i * i - r * r)), t;
  }
  // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
  // target is a Vector3
  // https://graphics.stanford.edu/papers/envmap/envmap.pdf
  getIrradianceAt(e, t) {
    const i = e.x, r = e.y, s = e.z, o = this.coefficients;
    return t.copy(o[0]).multiplyScalar(0.886227), t.addScaledVector(o[1], 2 * 0.511664 * r), t.addScaledVector(o[2], 2 * 0.511664 * s), t.addScaledVector(o[3], 2 * 0.511664 * i), t.addScaledVector(o[4], 2 * 0.429043 * i * r), t.addScaledVector(o[5], 2 * 0.429043 * r * s), t.addScaledVector(o[6], 0.743125 * s * s - 0.247708), t.addScaledVector(o[7], 2 * 0.429043 * i * s), t.addScaledVector(o[8], 0.429043 * (i * i - r * r)), t;
  }
  add(e) {
    for (let t = 0; t < 9; t++)
      this.coefficients[t].add(e.coefficients[t]);
    return this;
  }
  addScaledSH(e, t) {
    for (let i = 0; i < 9; i++)
      this.coefficients[i].addScaledVector(e.coefficients[i], t);
    return this;
  }
  scale(e) {
    for (let t = 0; t < 9; t++)
      this.coefficients[t].multiplyScalar(e);
    return this;
  }
  lerp(e, t) {
    for (let i = 0; i < 9; i++)
      this.coefficients[i].lerp(e.coefficients[i], t);
    return this;
  }
  equals(e) {
    for (let t = 0; t < 9; t++)
      if (!this.coefficients[t].equals(e.coefficients[t]))
        return !1;
    return !0;
  }
  copy(e) {
    return this.set(e.coefficients);
  }
  clone() {
    return new this.constructor().copy(this);
  }
  fromArray(e, t = 0) {
    const i = this.coefficients;
    for (let r = 0; r < 9; r++)
      i[r].fromArray(e, t + r * 3);
    return this;
  }
  toArray(e = [], t = 0) {
    const i = this.coefficients;
    for (let r = 0; r < 9; r++)
      i[r].toArray(e, t + r * 3);
    return e;
  }
  // evaluate the basis functions
  // shBasis is an Array[ 9 ]
  static getBasisAt(e, t) {
    const i = e.x, r = e.y, s = e.z;
    t[0] = 0.282095, t[1] = 0.488603 * r, t[2] = 0.488603 * s, t[3] = 0.488603 * i, t[4] = 1.092548 * i * r, t[5] = 1.092548 * r * s, t[6] = 0.315392 * (3 * s * s - 1), t[7] = 1.092548 * i * s, t[8] = 0.546274 * (i * i - r * r);
  }
}
ip.prototype.isSphericalHarmonics3 = !0;
class Al extends gi {
  constructor(e = new ip(), t = 1) {
    super(void 0, t), this.sh = e;
  }
  copy(e) {
    return super.copy(e), this.sh.copy(e.sh), this;
  }
  fromJSON(e) {
    return this.intensity = e.intensity, this.sh.fromArray(e.sh), this;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.object.sh = this.sh.toArray(), t;
  }
}
Al.prototype.isLightProbe = !0;
class Hx extends xn {
  constructor(e) {
    super(e), this.textures = {};
  }
  load(e, t, i, r) {
    const s = this, o = new Zn(s.manager);
    o.setPath(s.path), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) {
      try {
        t(s.parse(JSON.parse(a)));
      } catch (c) {
        r ? r(c) : console.error(c), s.manager.itemError(e);
      }
    }, i, r);
  }
  parse(e) {
    const t = this.textures;
    function i(s) {
      return t[s] === void 0 && console.warn("THREE.MaterialLoader: Undefined texture", s), t[s];
    }
    const r = new dN[e.type]();
    if (e.uuid !== void 0 && (r.uuid = e.uuid), e.name !== void 0 && (r.name = e.name), e.color !== void 0 && r.color !== void 0 && r.color.setHex(e.color), e.roughness !== void 0 && (r.roughness = e.roughness), e.metalness !== void 0 && (r.metalness = e.metalness), e.sheen !== void 0 && (r.sheen = new Ue().setHex(e.sheen)), e.emissive !== void 0 && r.emissive !== void 0 && r.emissive.setHex(e.emissive), e.specular !== void 0 && r.specular !== void 0 && r.specular.setHex(e.specular), e.shininess !== void 0 && (r.shininess = e.shininess), e.clearcoat !== void 0 && (r.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (r.clearcoatRoughness = e.clearcoatRoughness), e.transmission !== void 0 && (r.transmission = e.transmission), e.thickness !== void 0 && (r.thickness = e.thickness), e.attenuationDistance !== void 0 && (r.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && r.attenuationColor !== void 0 && r.attenuationColor.setHex(e.attenuationColor), e.fog !== void 0 && (r.fog = e.fog), e.flatShading !== void 0 && (r.flatShading = e.flatShading), e.blending !== void 0 && (r.blending = e.blending), e.combine !== void 0 && (r.combine = e.combine), e.side !== void 0 && (r.side = e.side), e.shadowSide !== void 0 && (r.shadowSide = e.shadowSide), e.opacity !== void 0 && (r.opacity = e.opacity), e.transparent !== void 0 && (r.transparent = e.transparent), e.alphaTest !== void 0 && (r.alphaTest = e.alphaTest), e.depthTest !== void 0 && (r.depthTest = e.depthTest), e.depthWrite !== void 0 && (r.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (r.colorWrite = e.colorWrite), e.stencilWrite !== void 0 && (r.stencilWrite = e.stencilWrite), e.stencilWriteMask !== void 0 && (r.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (r.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (r.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (r.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (r.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (r.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (r.stencilZPass = e.stencilZPass), e.wireframe !== void 0 && (r.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (r.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (r.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (r.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (r.rotation = e.rotation), e.linewidth !== 1 && (r.linewidth = e.linewidth), e.dashSize !== void 0 && (r.dashSize = e.dashSize), e.gapSize !== void 0 && (r.gapSize = e.gapSize), e.scale !== void 0 && (r.scale = e.scale), e.polygonOffset !== void 0 && (r.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (r.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (r.polygonOffsetUnits = e.polygonOffsetUnits), e.morphTargets !== void 0 && (r.morphTargets = e.morphTargets), e.morphNormals !== void 0 && (r.morphNormals = e.morphNormals), e.dithering !== void 0 && (r.dithering = e.dithering), e.alphaToCoverage !== void 0 && (r.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (r.premultipliedAlpha = e.premultipliedAlpha), e.vertexTangents !== void 0 && (r.vertexTangents = e.vertexTangents), e.visible !== void 0 && (r.visible = e.visible), e.toneMapped !== void 0 && (r.toneMapped = e.toneMapped), e.userData !== void 0 && (r.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? r.vertexColors = e.vertexColors > 0 : r.vertexColors = e.vertexColors), e.uniforms !== void 0)
      for (const s in e.uniforms) {
        const o = e.uniforms[s];
        switch (r.uniforms[s] = {}, o.type) {
          case "t":
            r.uniforms[s].value = i(o.value);
            break;
          case "c":
            r.uniforms[s].value = new Ue().setHex(o.value);
            break;
          case "v2":
            r.uniforms[s].value = new Re().fromArray(o.value);
            break;
          case "v3":
            r.uniforms[s].value = new Q().fromArray(o.value);
            break;
          case "v4":
            r.uniforms[s].value = new xt().fromArray(o.value);
            break;
          case "m3":
            r.uniforms[s].value = new rn().fromArray(o.value);
            break;
          case "m4":
            r.uniforms[s].value = new Xe().fromArray(o.value);
            break;
          default:
            r.uniforms[s].value = o.value;
        }
      }
    if (e.defines !== void 0 && (r.defines = e.defines), e.vertexShader !== void 0 && (r.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (r.fragmentShader = e.fragmentShader), e.extensions !== void 0)
      for (const s in e.extensions)
        r.extensions[s] = e.extensions[s];
    if (e.shading !== void 0 && (r.flatShading = e.shading === 1), e.size !== void 0 && (r.size = e.size), e.sizeAttenuation !== void 0 && (r.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (r.map = i(e.map)), e.matcap !== void 0 && (r.matcap = i(e.matcap)), e.alphaMap !== void 0 && (r.alphaMap = i(e.alphaMap)), e.bumpMap !== void 0 && (r.bumpMap = i(e.bumpMap)), e.bumpScale !== void 0 && (r.bumpScale = e.bumpScale), e.normalMap !== void 0 && (r.normalMap = i(e.normalMap)), e.normalMapType !== void 0 && (r.normalMapType = e.normalMapType), e.normalScale !== void 0) {
      let s = e.normalScale;
      Array.isArray(s) === !1 && (s = [s, s]), r.normalScale = new Re().fromArray(s);
    }
    return e.displacementMap !== void 0 && (r.displacementMap = i(e.displacementMap)), e.displacementScale !== void 0 && (r.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (r.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (r.roughnessMap = i(e.roughnessMap)), e.metalnessMap !== void 0 && (r.metalnessMap = i(e.metalnessMap)), e.emissiveMap !== void 0 && (r.emissiveMap = i(e.emissiveMap)), e.emissiveIntensity !== void 0 && (r.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (r.specularMap = i(e.specularMap)), e.envMap !== void 0 && (r.envMap = i(e.envMap)), e.envMapIntensity !== void 0 && (r.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (r.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (r.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (r.lightMap = i(e.lightMap)), e.lightMapIntensity !== void 0 && (r.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (r.aoMap = i(e.aoMap)), e.aoMapIntensity !== void 0 && (r.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (r.gradientMap = i(e.gradientMap)), e.clearcoatMap !== void 0 && (r.clearcoatMap = i(e.clearcoatMap)), e.clearcoatRoughnessMap !== void 0 && (r.clearcoatRoughnessMap = i(e.clearcoatRoughnessMap)), e.clearcoatNormalMap !== void 0 && (r.clearcoatNormalMap = i(e.clearcoatNormalMap)), e.clearcoatNormalScale !== void 0 && (r.clearcoatNormalScale = new Re().fromArray(e.clearcoatNormalScale)), e.transmissionMap !== void 0 && (r.transmissionMap = i(e.transmissionMap)), e.thicknessMap !== void 0 && (r.thicknessMap = i(e.thicknessMap)), r;
  }
  setTextures(e) {
    return this.textures = e, this;
  }
}
class rr {
  static decodeText(e) {
    if (typeof TextDecoder < "u")
      return new TextDecoder().decode(e);
    let t = "";
    for (let i = 0, r = e.length; i < r; i++)
      t += String.fromCharCode(e[i]);
    try {
      return decodeURIComponent(escape(t));
    } catch {
      return t;
    }
  }
  static extractUrlBase(e) {
    const t = e.lastIndexOf("/");
    return t === -1 ? "./" : e.substr(0, t + 1);
  }
}
class rp extends Ke {
  constructor() {
    super(), this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0;
  }
  copy(e) {
    return super.copy(e), this.instanceCount = e.instanceCount, this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  toJSON() {
    const e = super.toJSON(this);
    return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e;
  }
}
rp.prototype.isInstancedBufferGeometry = !0;
class sp extends ot {
  constructor(e, t, i, r = 1) {
    typeof i == "number" && (r = i, i = !1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), super(e, t, i), this.meshPerAttribute = r;
  }
  copy(e) {
    return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this;
  }
  toJSON() {
    const e = super.toJSON();
    return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;
  }
}
sp.prototype.isInstancedBufferAttribute = !0;
class Wx extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Zn(s.manager);
    o.setPath(s.path), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) {
      try {
        t(s.parse(JSON.parse(a)));
      } catch (c) {
        r ? r(c) : console.error(c), s.manager.itemError(e);
      }
    }, i, r);
  }
  parse(e) {
    const t = {}, i = {};
    function r(g, p) {
      if (t[p] !== void 0) return t[p];
      const y = g.interleavedBuffers[p], v = s(g, y.buffer), m = mo(y.type, v), x = new Qr(m, y.stride);
      return x.uuid = y.uuid, t[p] = x, x;
    }
    function s(g, p) {
      if (i[p] !== void 0) return i[p];
      const y = g.arrayBuffers[p], v = new Uint32Array(y).buffer;
      return i[p] = v, v;
    }
    const o = e.isInstancedBufferGeometry ? new rp() : new Ke(), a = e.data.index;
    if (a !== void 0) {
      const g = mo(a.type, a.array);
      o.setIndex(new ot(g, 1));
    }
    const c = e.data.attributes;
    for (const g in c) {
      const p = c[g];
      let u;
      if (p.isInterleavedBufferAttribute) {
        const y = r(e.data, p.data);
        u = new lr(y, p.itemSize, p.offset, p.normalized);
      } else {
        const y = mo(p.type, p.array), v = p.isInstancedBufferAttribute ? sp : ot;
        u = new v(y, p.itemSize, p.normalized);
      }
      p.name !== void 0 && (u.name = p.name), p.usage !== void 0 && u.setUsage(p.usage), p.updateRange !== void 0 && (u.updateRange.offset = p.updateRange.offset, u.updateRange.count = p.updateRange.count), o.setAttribute(g, u);
    }
    const l = e.data.morphAttributes;
    if (l)
      for (const g in l) {
        const p = l[g], u = [];
        for (let y = 0, v = p.length; y < v; y++) {
          const m = p[y];
          let x;
          if (m.isInterleavedBufferAttribute) {
            const w = r(e.data, m.data);
            x = new lr(w, m.itemSize, m.offset, m.normalized);
          } else {
            const w = mo(m.type, m.array);
            x = new ot(w, m.itemSize, m.normalized);
          }
          m.name !== void 0 && (x.name = m.name), u.push(x);
        }
        o.morphAttributes[g] = u;
      }
    e.data.morphTargetsRelative && (o.morphTargetsRelative = !0);
    const h = e.data.groups || e.data.drawcalls || e.data.offsets;
    if (h !== void 0)
      for (let g = 0, p = h.length; g !== p; ++g) {
        const u = h[g];
        o.addGroup(u.start, u.count, u.materialIndex);
      }
    const f = e.data.boundingSphere;
    if (f !== void 0) {
      const g = new Q();
      f.center !== void 0 && g.fromArray(f.center), o.boundingSphere = new mr(g, f.radius);
    }
    return e.name && (o.name = e.name), e.userData && (o.userData = e.userData), o;
  }
}
class vN extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = this.path === "" ? rr.extractUrlBase(e) : this.path;
    this.resourcePath = this.resourcePath || o;
    const a = new Zn(this.manager);
    a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) {
      let l = null;
      try {
        l = JSON.parse(c);
      } catch (h) {
        r !== void 0 && r(h), console.error("THREE:ObjectLoader: Can't parse " + e + ".", h.message);
        return;
      }
      const d = l.metadata;
      if (d === void 0 || d.type === void 0 || d.type.toLowerCase() === "geometry") {
        console.error("THREE.ObjectLoader: Can't load " + e);
        return;
      }
      s.parse(l, t);
    }, i, r);
  }
  async loadAsync(e, t) {
    const i = this, r = this.path === "" ? rr.extractUrlBase(e) : this.path;
    this.resourcePath = this.resourcePath || r;
    const s = new Zn(this.manager);
    s.setPath(this.path), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials);
    const o = await s.loadAsync(e, t), a = JSON.parse(o), c = a.metadata;
    if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry")
      throw new Error("THREE.ObjectLoader: Can't load " + e);
    return await i.parseAsync(a);
  }
  parse(e, t) {
    const i = this.parseAnimations(e.animations), r = this.parseShapes(e.shapes), s = this.parseGeometries(e.geometries, r), o = this.parseImages(e.images, function() {
      t !== void 0 && t(l);
    }), a = this.parseTextures(e.textures, o), c = this.parseMaterials(e.materials, a), l = this.parseObject(e.object, s, c, a, i), d = this.parseSkeletons(e.skeletons, l);
    if (this.bindSkeletons(l, d), t !== void 0) {
      let h = !1;
      for (const f in o)
        if (o[f] instanceof HTMLImageElement) {
          h = !0;
          break;
        }
      h === !1 && t(l);
    }
    return l;
  }
  async parseAsync(e) {
    const t = this.parseAnimations(e.animations), i = this.parseShapes(e.shapes), r = this.parseGeometries(e.geometries, i), s = await this.parseImagesAsync(e.images), o = this.parseTextures(e.textures, s), a = this.parseMaterials(e.materials, o), c = this.parseObject(e.object, r, a, o, t), l = this.parseSkeletons(e.skeletons, c);
    return this.bindSkeletons(c, l), c;
  }
  parseShapes(e) {
    const t = {};
    if (e !== void 0)
      for (let i = 0, r = e.length; i < r; i++) {
        const s = new Dr().fromJSON(e[i]);
        t[s.uuid] = s;
      }
    return t;
  }
  parseSkeletons(e, t) {
    const i = {}, r = {};
    if (t.traverse(function(s) {
      s.isBone && (r[s.uuid] = s);
    }), e !== void 0)
      for (let s = 0, o = e.length; s < o; s++) {
        const a = new bl().fromJSON(e[s], r);
        i[a.uuid] = a;
      }
    return i;
  }
  parseGeometries(e, t) {
    const i = {};
    if (e !== void 0) {
      const r = new Wx();
      for (let s = 0, o = e.length; s < o; s++) {
        let a;
        const c = e[s];
        switch (c.type) {
          case "BufferGeometry":
          case "InstancedBufferGeometry":
            a = r.parse(c);
            break;
          case "Geometry":
            console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");
            break;
          default:
            c.type in zg ? a = zg[c.type].fromJSON(c, t) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`);
        }
        a.uuid = c.uuid, c.name !== void 0 && (a.name = c.name), a.isBufferGeometry === !0 && c.userData !== void 0 && (a.userData = c.userData), i[c.uuid] = a;
      }
    }
    return i;
  }
  parseMaterials(e, t) {
    const i = {}, r = {};
    if (e !== void 0) {
      const s = new Hx();
      s.setTextures(t);
      for (let o = 0, a = e.length; o < a; o++) {
        const c = e[o];
        if (c.type === "MultiMaterial") {
          const l = [];
          for (let d = 0; d < c.materials.length; d++) {
            const h = c.materials[d];
            i[h.uuid] === void 0 && (i[h.uuid] = s.parse(h)), l.push(i[h.uuid]);
          }
          r[c.uuid] = l;
        } else
          i[c.uuid] === void 0 && (i[c.uuid] = s.parse(c)), r[c.uuid] = i[c.uuid];
      }
    }
    return r;
  }
  parseAnimations(e) {
    const t = {};
    if (e !== void 0)
      for (let i = 0; i < e.length; i++) {
        const r = e[i], s = jo.parse(r);
        t[s.uuid] = s;
      }
    return t;
  }
  parseImages(e, t) {
    const i = this, r = {};
    let s;
    function o(c) {
      return i.manager.itemStart(c), s.load(c, function() {
        i.manager.itemEnd(c);
      }, void 0, function() {
        i.manager.itemError(c), i.manager.itemEnd(c);
      });
    }
    function a(c) {
      if (typeof c == "string") {
        const l = c, d = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : i.resourcePath + l;
        return o(d);
      } else
        return c.data ? {
          data: mo(c.type, c.data),
          width: c.width,
          height: c.height
        } : null;
    }
    if (e !== void 0 && e.length > 0) {
      const c = new Kf(t);
      s = new Ya(c), s.setCrossOrigin(this.crossOrigin);
      for (let l = 0, d = e.length; l < d; l++) {
        const h = e[l], f = h.url;
        if (Array.isArray(f)) {
          r[h.uuid] = [];
          for (let g = 0, p = f.length; g < p; g++) {
            const u = f[g], y = a(u);
            y !== null && (y instanceof HTMLImageElement ? r[h.uuid].push(y) : r[h.uuid].push(new Ss(y.data, y.width, y.height)));
          }
        } else {
          const g = a(h.url);
          g !== null && (r[h.uuid] = g);
        }
      }
    }
    return r;
  }
  async parseImagesAsync(e) {
    const t = this, i = {};
    let r;
    async function s(o) {
      if (typeof o == "string") {
        const a = o, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(a) ? a : t.resourcePath + a;
        return await r.loadAsync(c);
      } else
        return o.data ? {
          data: mo(o.type, o.data),
          width: o.width,
          height: o.height
        } : null;
    }
    if (e !== void 0 && e.length > 0) {
      r = new Ya(this.manager), r.setCrossOrigin(this.crossOrigin);
      for (let o = 0, a = e.length; o < a; o++) {
        const c = e[o], l = c.url;
        if (Array.isArray(l)) {
          i[c.uuid] = [];
          for (let d = 0, h = l.length; d < h; d++) {
            const f = l[d], g = await s(f);
            g !== null && (g instanceof HTMLImageElement ? i[c.uuid].push(g) : i[c.uuid].push(new Ss(g.data, g.width, g.height)));
          }
        } else {
          const d = await s(c.url);
          d !== null && (i[c.uuid] = d);
        }
      }
    }
    return i;
  }
  parseTextures(e, t) {
    function i(s, o) {
      return typeof s == "number" ? s : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", s), o[s]);
    }
    const r = {};
    if (e !== void 0)
      for (let s = 0, o = e.length; s < o; s++) {
        const a = e[s];
        a.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', a.uuid), t[a.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", a.image);
        let c;
        const l = t[a.image];
        Array.isArray(l) ? (c = new ta(l), l.length === 6 && (c.needsUpdate = !0)) : (l && l.data ? c = new Ss(l.data, l.width, l.height) : c = new Yt(l), l && (c.needsUpdate = !0)), c.uuid = a.uuid, a.name !== void 0 && (c.name = a.name), a.mapping !== void 0 && (c.mapping = i(a.mapping, yN)), a.offset !== void 0 && c.offset.fromArray(a.offset), a.repeat !== void 0 && c.repeat.fromArray(a.repeat), a.center !== void 0 && c.center.fromArray(a.center), a.rotation !== void 0 && (c.rotation = a.rotation), a.wrap !== void 0 && (c.wrapS = i(a.wrap[0], Wg), c.wrapT = i(a.wrap[1], Wg)), a.format !== void 0 && (c.format = a.format), a.type !== void 0 && (c.type = a.type), a.encoding !== void 0 && (c.encoding = a.encoding), a.minFilter !== void 0 && (c.minFilter = i(a.minFilter, jg)), a.magFilter !== void 0 && (c.magFilter = i(a.magFilter, jg)), a.anisotropy !== void 0 && (c.anisotropy = a.anisotropy), a.flipY !== void 0 && (c.flipY = a.flipY), a.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = a.premultiplyAlpha), a.unpackAlignment !== void 0 && (c.unpackAlignment = a.unpackAlignment), r[a.uuid] = c;
      }
    return r;
  }
  parseObject(e, t, i, r, s) {
    let o;
    function a(f) {
      return t[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined geometry", f), t[f];
    }
    function c(f) {
      if (f !== void 0) {
        if (Array.isArray(f)) {
          const g = [];
          for (let p = 0, u = f.length; p < u; p++) {
            const y = f[p];
            i[y] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", y), g.push(i[y]);
          }
          return g;
        }
        return i[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", f), i[f];
      }
    }
    function l(f) {
      return r[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", f), r[f];
    }
    let d, h;
    switch (e.type) {
      case "Scene":
        o = new wu(), e.background !== void 0 && (Number.isInteger(e.background) ? o.background = new Ue(e.background) : o.background = l(e.background)), e.environment !== void 0 && (o.environment = l(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? o.fog = new pl(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (o.fog = new fl(e.fog.color, e.fog.density)));
        break;
      case "PerspectiveCamera":
        o = new nn(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (o.focus = e.focus), e.zoom !== void 0 && (o.zoom = e.zoom), e.filmGauge !== void 0 && (o.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (o.filmOffset = e.filmOffset), e.view !== void 0 && (o.view = Object.assign({}, e.view));
        break;
      case "OrthographicCamera":
        o = new sa(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (o.zoom = e.zoom), e.view !== void 0 && (o.view = Object.assign({}, e.view));
        break;
      case "AmbientLight":
        o = new tp(e.color, e.intensity);
        break;
      case "DirectionalLight":
        o = new Ru(e.color, e.intensity);
        break;
      case "PointLight":
        o = new Lu(e.color, e.intensity, e.distance, e.decay);
        break;
      case "RectAreaLight":
        o = new np(e.color, e.intensity, e.width, e.height);
        break;
      case "SpotLight":
        o = new Cu(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay);
        break;
      case "HemisphereLight":
        o = new Qf(e.color, e.groundColor, e.intensity);
        break;
      case "LightProbe":
        o = new Al().fromJSON(e);
        break;
      case "SkinnedMesh":
        d = a(e.geometry), h = c(e.material), o = new vl(d, h), e.bindMode !== void 0 && (o.bindMode = e.bindMode), e.bindMatrix !== void 0 && o.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (o.skeleton = e.skeleton);
        break;
      case "Mesh":
        d = a(e.geometry), h = c(e.material), o = new Xt(d, h);
        break;
      case "InstancedMesh":
        d = a(e.geometry), h = c(e.material);
        const f = e.count, g = e.instanceMatrix, p = e.instanceColor;
        o = new Pf(d, h, f), o.instanceMatrix = new ot(new Float32Array(g.array), 16), p !== void 0 && (o.instanceColor = new ot(new Float32Array(p.array), p.itemSize));
        break;
      case "LOD":
        o = new _x();
        break;
      case "Line":
        o = new Oi(a(e.geometry), c(e.material));
        break;
      case "LineLoop":
        o = new Au(a(e.geometry), c(e.material));
        break;
      case "LineSegments":
        o = new Rn(a(e.geometry), c(e.material));
        break;
      case "PointCloud":
      case "Points":
        o = new ia(a(e.geometry), c(e.material));
        break;
      case "Sprite":
        o = new gl(c(e.material));
        break;
      case "Group":
        o = new _i();
        break;
      case "Bone":
        o = new yl();
        break;
      default:
        o = new ut();
    }
    if (o.uuid = e.uuid, e.name !== void 0 && (o.name = e.name), e.matrix !== void 0 ? (o.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (o.matrixAutoUpdate = e.matrixAutoUpdate), o.matrixAutoUpdate && o.matrix.decompose(o.position, o.quaternion, o.scale)) : (e.position !== void 0 && o.position.fromArray(e.position), e.rotation !== void 0 && o.rotation.fromArray(e.rotation), e.quaternion !== void 0 && o.quaternion.fromArray(e.quaternion), e.scale !== void 0 && o.scale.fromArray(e.scale)), e.castShadow !== void 0 && (o.castShadow = e.castShadow), e.receiveShadow !== void 0 && (o.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.bias !== void 0 && (o.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (o.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (o.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && o.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (o.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (o.visible = e.visible), e.frustumCulled !== void 0 && (o.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (o.renderOrder = e.renderOrder), e.userData !== void 0 && (o.userData = e.userData), e.layers !== void 0 && (o.layers.mask = e.layers), e.children !== void 0) {
      const f = e.children;
      for (let g = 0; g < f.length; g++)
        o.add(this.parseObject(f[g], t, i, r, s));
    }
    if (e.animations !== void 0) {
      const f = e.animations;
      for (let g = 0; g < f.length; g++) {
        const p = f[g];
        o.animations.push(s[p]);
      }
    }
    if (e.type === "LOD") {
      e.autoUpdate !== void 0 && (o.autoUpdate = e.autoUpdate);
      const f = e.levels;
      for (let g = 0; g < f.length; g++) {
        const p = f[g], u = o.getObjectByProperty("uuid", p.object);
        u !== void 0 && o.addLevel(u, p.distance);
      }
    }
    return o;
  }
  bindSkeletons(e, t) {
    Object.keys(t).length !== 0 && e.traverse(function(i) {
      if (i.isSkinnedMesh === !0 && i.skeleton !== void 0) {
        const r = t[i.skeleton];
        r === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", i.skeleton) : i.bind(r, i.bindMatrix);
      }
    });
  }
  /* DEPRECATED */
  setTexturePath(e) {
    return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."), this.setResourcePath(e);
  }
}
const yN = {
  UVMapping: hu,
  CubeReflectionMapping: ll,
  CubeRefractionMapping: cl,
  EquirectangularReflectionMapping: Vc,
  EquirectangularRefractionMapping: Gc,
  CubeUVReflectionMapping: ea,
  CubeUVRefractionMapping: ul
}, Wg = {
  RepeatWrapping: jr,
  ClampToEdgeWrapping: hn,
  MirroredRepeatWrapping: Eo
}, jg = {
  NearestFilter: $t,
  NearestMipmapNearestFilter: Va,
  NearestMipmapLinearFilter: Ga,
  LinearFilter: zt,
  LinearMipmapNearestFilter: du,
  LinearMipmapLinearFilter: pr
};
class op extends xn {
  constructor(e) {
    super(e), typeof createImageBitmap > "u" && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" };
  }
  setOptions(e) {
    return this.options = e, this;
  }
  load(e, t, i, r) {
    e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
    const s = this, o = Is.get(e);
    if (o !== void 0)
      return s.manager.itemStart(e), setTimeout(function() {
        t && t(o), s.manager.itemEnd(e);
      }, 0), o;
    const a = {};
    a.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", a.headers = this.requestHeader, fetch(e, a).then(function(c) {
      return c.blob();
    }).then(function(c) {
      return createImageBitmap(c, Object.assign(s.options, { colorSpaceConversion: "none" }));
    }).then(function(c) {
      Is.add(e, c), t && t(c), s.manager.itemEnd(e);
    }).catch(function(c) {
      r && r(c), s.manager.itemError(e), s.manager.itemEnd(e);
    }), s.manager.itemStart(e);
  }
}
op.prototype.isImageBitmapLoader = !0;
class jx {
  constructor() {
    this.type = "ShapePath", this.color = new Ue(), this.subPaths = [], this.currentPath = null;
  }
  moveTo(e, t) {
    return this.currentPath = new Ja(), this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this;
  }
  lineTo(e, t) {
    return this.currentPath.lineTo(e, t), this;
  }
  quadraticCurveTo(e, t, i, r) {
    return this.currentPath.quadraticCurveTo(e, t, i, r), this;
  }
  bezierCurveTo(e, t, i, r, s, o) {
    return this.currentPath.bezierCurveTo(e, t, i, r, s, o), this;
  }
  splineThru(e) {
    return this.currentPath.splineThru(e), this;
  }
  toShapes(e, t) {
    function i(m) {
      const x = [];
      for (let w = 0, A = m.length; w < A; w++) {
        const M = m[w], R = new Dr();
        R.curves = M.curves, x.push(R);
      }
      return x;
    }
    function r(m, x) {
      const w = x.length;
      let A = !1;
      for (let M = w - 1, R = 0; R < w; M = R++) {
        let L = x[M], _ = x[R], F = _.x - L.x, S = _.y - L.y;
        if (Math.abs(S) > Number.EPSILON) {
          if (S < 0 && (L = x[R], F = -F, _ = x[M], S = -S), m.y < L.y || m.y > _.y) continue;
          if (m.y === L.y) {
            if (m.x === L.x) return !0;
          } else {
            const T = S * (m.x - L.x) - F * (m.y - L.y);
            if (T === 0) return !0;
            if (T < 0) continue;
            A = !A;
          }
        } else {
          if (m.y !== L.y) continue;
          if (_.x <= m.x && m.x <= L.x || L.x <= m.x && m.x <= _.x) return !0;
        }
      }
      return A;
    }
    const s = Fi.isClockWise, o = this.subPaths;
    if (o.length === 0) return [];
    if (t === !0) return i(o);
    let a, c, l;
    const d = [];
    if (o.length === 1)
      return c = o[0], l = new Dr(), l.curves = c.curves, d.push(l), d;
    let h = !s(o[0].getPoints());
    h = e ? !h : h;
    const f = [], g = [];
    let p = [], u = 0, y;
    g[u] = void 0, p[u] = [];
    for (let m = 0, x = o.length; m < x; m++)
      c = o[m], y = c.getPoints(), a = s(y), a = e ? !a : a, a ? (!h && g[u] && u++, g[u] = { s: new Dr(), p: y }, g[u].s.curves = c.curves, h && u++, p[u] = []) : p[u].push({ h: c, p: y[0] });
    if (!g[0]) return i(o);
    if (g.length > 1) {
      let m = !1;
      const x = [];
      for (let w = 0, A = g.length; w < A; w++)
        f[w] = [];
      for (let w = 0, A = g.length; w < A; w++) {
        const M = p[w];
        for (let R = 0; R < M.length; R++) {
          const L = M[R];
          let _ = !0;
          for (let F = 0; F < g.length; F++)
            r(L.p, g[F].p) && (w !== F && x.push({ froms: w, tos: F, hole: R }), _ ? (_ = !1, f[F].push(L)) : m = !0);
          _ && f[w].push(L);
        }
      }
      x.length > 0 && (m || (p = f));
    }
    let v;
    for (let m = 0, x = g.length; m < x; m++) {
      l = g[m].s, d.push(l), v = p[m];
      for (let w = 0, A = v.length; w < A; w++)
        l.holes.push(v[w].h);
    }
    return d;
  }
}
class ap {
  constructor(e) {
    this.type = "Font", this.data = e;
  }
  generateShapes(e, t = 100) {
    const i = [], r = bN(e, t, this.data);
    for (let s = 0, o = r.length; s < o; s++)
      Array.prototype.push.apply(i, r[s].toShapes());
    return i;
  }
}
function bN(n, e, t) {
  const i = Array.from(n), r = e / t.resolution, s = (t.boundingBox.yMax - t.boundingBox.yMin + t.underlineThickness) * r, o = [];
  let a = 0, c = 0;
  for (let l = 0; l < i.length; l++) {
    const d = i[l];
    if (d === `
`)
      a = 0, c -= s;
    else {
      const h = xN(d, r, a, c, t);
      a += h.offsetX, o.push(h.path);
    }
  }
  return o;
}
function xN(n, e, t, i, r) {
  const s = r.glyphs[n] || r.glyphs["?"];
  if (!s) {
    console.error('THREE.Font: character "' + n + '" does not exists in font family ' + r.familyName + ".");
    return;
  }
  const o = new jx();
  let a, c, l, d, h, f, g, p;
  if (s.o) {
    const u = s._cachedOutline || (s._cachedOutline = s.o.split(" "));
    for (let y = 0, v = u.length; y < v; )
      switch (u[y++]) {
        case "m":
          a = u[y++] * e + t, c = u[y++] * e + i, o.moveTo(a, c);
          break;
        case "l":
          a = u[y++] * e + t, c = u[y++] * e + i, o.lineTo(a, c);
          break;
        case "q":
          l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, f = u[y++] * e + i, o.quadraticCurveTo(h, f, l, d);
          break;
        case "b":
          l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, f = u[y++] * e + i, g = u[y++] * e + t, p = u[y++] * e + i, o.bezierCurveTo(h, f, g, p, l, d);
          break;
      }
  }
  return { offsetX: s.ha * e, path: o };
}
ap.prototype.isFont = !0;
class MN extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Zn(this.manager);
    o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) {
      let c;
      try {
        c = JSON.parse(a);
      } catch {
        console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), c = JSON.parse(a.substring(65, a.length - 2));
      }
      const l = s.parse(c);
      t && t(l);
    }, i, r);
  }
  parse(e) {
    return new ap(e);
  }
}
let hc;
const lp = {
  getContext: function() {
    return hc === void 0 && (hc = new (window.AudioContext || window.webkitAudioContext)()), hc;
  },
  setContext: function(n) {
    hc = n;
  }
};
class $x extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Zn(this.manager);
    o.setResponseType("arraybuffer"), o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) {
      try {
        const c = a.slice(0);
        lp.getContext().decodeAudioData(c, function(d) {
          t(d);
        });
      } catch (c) {
        r ? r(c) : console.error(c), s.manager.itemError(e);
      }
    }, i, r);
  }
}
class Zx extends Al {
  constructor(e, t, i = 1) {
    super(void 0, i);
    const r = new Ue().set(e), s = new Ue().set(t), o = new Q(r.r, r.g, r.b), a = new Q(s.r, s.g, s.b), c = Math.sqrt(Math.PI), l = c * Math.sqrt(0.75);
    this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c), this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l);
  }
}
Zx.prototype.isHemisphereLightProbe = !0;
class Xx extends Al {
  constructor(e, t = 1) {
    super(void 0, t);
    const i = new Ue().set(e);
    this.sh.coefficients[0].set(i.r, i.g, i.b).multiplyScalar(2 * Math.sqrt(Math.PI));
  }
}
Xx.prototype.isAmbientLightProbe = !0;
const $g = /* @__PURE__ */ new Xe(), Zg = /* @__PURE__ */ new Xe();
class wN {
  constructor() {
    this.type = "StereoCamera", this.aspect = 1, this.eyeSep = 0.064, this.cameraL = new nn(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new nn(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = {
      focus: null,
      fov: null,
      aspect: null,
      near: null,
      far: null,
      zoom: null,
      eyeSep: null
    };
  }
  update(e) {
    const t = this._cache;
    if (t.focus !== e.focus || t.fov !== e.fov || t.aspect !== e.aspect * this.aspect || t.near !== e.near || t.far !== e.far || t.zoom !== e.zoom || t.eyeSep !== this.eyeSep) {
      t.focus = e.focus, t.fov = e.fov, t.aspect = e.aspect * this.aspect, t.near = e.near, t.far = e.far, t.zoom = e.zoom, t.eyeSep = this.eyeSep;
      const r = e.projectionMatrix.clone(), s = t.eyeSep / 2, o = s * t.near / t.focus, a = t.near * Math.tan(As * t.fov * 0.5) / t.zoom;
      let c, l;
      Zg.elements[12] = -s, $g.elements[12] = s, c = -a * t.aspect + o, l = a * t.aspect + o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraL.projectionMatrix.copy(r), c = -a * t.aspect - o, l = a * t.aspect - o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraR.projectionMatrix.copy(r);
    }
    this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Zg), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($g);
  }
}
class Yx {
  constructor(e = !0) {
    this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1;
  }
  start() {
    this.startTime = Xg(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0;
  }
  stop() {
    this.getElapsedTime(), this.running = !1, this.autoStart = !1;
  }
  getElapsedTime() {
    return this.getDelta(), this.elapsedTime;
  }
  getDelta() {
    let e = 0;
    if (this.autoStart && !this.running)
      return this.start(), 0;
    if (this.running) {
      const t = Xg();
      e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e;
    }
    return e;
  }
}
function Xg() {
  return (typeof performance > "u" ? Date : performance).now();
}
const as = /* @__PURE__ */ new Q(), Yg = /* @__PURE__ */ new bn(), AN = /* @__PURE__ */ new Q(), ls = /* @__PURE__ */ new Q();
class SN extends ut {
  constructor() {
    super(), this.type = "AudioListener", this.context = lp.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new Yx();
  }
  getInput() {
    return this.gain;
  }
  removeFilter() {
    return this.filter !== null && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this;
  }
  getFilter() {
    return this.filter;
  }
  setFilter(e) {
    return this.filter !== null ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = e, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this;
  }
  getMasterVolume() {
    return this.gain.gain.value;
  }
  setMasterVolume(e) {
    return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this;
  }
  updateMatrixWorld(e) {
    super.updateMatrixWorld(e);
    const t = this.context.listener, i = this.up;
    if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(as, Yg, AN), ls.set(0, 0, -1).applyQuaternion(Yg), t.positionX) {
      const r = this.context.currentTime + this.timeDelta;
      t.positionX.linearRampToValueAtTime(as.x, r), t.positionY.linearRampToValueAtTime(as.y, r), t.positionZ.linearRampToValueAtTime(as.z, r), t.forwardX.linearRampToValueAtTime(ls.x, r), t.forwardY.linearRampToValueAtTime(ls.y, r), t.forwardZ.linearRampToValueAtTime(ls.z, r), t.upX.linearRampToValueAtTime(i.x, r), t.upY.linearRampToValueAtTime(i.y, r), t.upZ.linearRampToValueAtTime(i.z, r);
    } else
      t.setPosition(as.x, as.y, as.z), t.setOrientation(ls.x, ls.y, ls.z, i.x, i.y, i.z);
  }
}
class cp extends ut {
  constructor(e) {
    super(), this.type = "Audio", this.listener = e, this.context = e.context, this.gain = this.context.createGain(), this.gain.connect(e.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = !1, this.filters = [];
  }
  getOutput() {
    return this.gain;
  }
  setNodeSource(e) {
    return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = e, this.connect(), this;
  }
  setMediaElementSource(e) {
    return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this;
  }
  setMediaStreamSource(e) {
    return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(e), this.connect(), this;
  }
  setBuffer(e) {
    return this.buffer = e, this.sourceType = "buffer", this.autoplay && this.play(), this;
  }
  play(e = 0) {
    if (this.isPlaying === !0) {
      console.warn("THREE.Audio: Audio is already playing.");
      return;
    }
    if (this.hasPlaybackControl === !1) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    this._startedAt = this.context.currentTime + e;
    const t = this.context.createBufferSource();
    return t.buffer = this.buffer, t.loop = this.loop, t.loopStart = this.loopStart, t.loopEnd = this.loopEnd, t.onended = this.onEnded.bind(this), t.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = t, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect();
  }
  pause() {
    if (this.hasPlaybackControl === !1) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.isPlaying === !0 && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === !0 && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this;
  }
  stop() {
    if (this.hasPlaybackControl === !1) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this._progress = 0, this.source.stop(), this.source.onended = null, this.isPlaying = !1, this;
  }
  connect() {
    if (this.filters.length > 0) {
      this.source.connect(this.filters[0]);
      for (let e = 1, t = this.filters.length; e < t; e++)
        this.filters[e - 1].connect(this.filters[e]);
      this.filters[this.filters.length - 1].connect(this.getOutput());
    } else
      this.source.connect(this.getOutput());
    return this._connected = !0, this;
  }
  disconnect() {
    if (this.filters.length > 0) {
      this.source.disconnect(this.filters[0]);
      for (let e = 1, t = this.filters.length; e < t; e++)
        this.filters[e - 1].disconnect(this.filters[e]);
      this.filters[this.filters.length - 1].disconnect(this.getOutput());
    } else
      this.source.disconnect(this.getOutput());
    return this._connected = !1, this;
  }
  getFilters() {
    return this.filters;
  }
  setFilters(e) {
    return e || (e = []), this._connected === !0 ? (this.disconnect(), this.filters = e.slice(), this.connect()) : this.filters = e.slice(), this;
  }
  setDetune(e) {
    if (this.detune = e, this.source.detune !== void 0)
      return this.isPlaying === !0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01), this;
  }
  getDetune() {
    return this.detune;
  }
  getFilter() {
    return this.getFilters()[0];
  }
  setFilter(e) {
    return this.setFilters(e ? [e] : []);
  }
  setPlaybackRate(e) {
    if (this.hasPlaybackControl === !1) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.playbackRate = e, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01), this;
  }
  getPlaybackRate() {
    return this.playbackRate;
  }
  onEnded() {
    this.isPlaying = !1;
  }
  getLoop() {
    return this.hasPlaybackControl === !1 ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop;
  }
  setLoop(e) {
    if (this.hasPlaybackControl === !1) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.loop = e, this.isPlaying === !0 && (this.source.loop = this.loop), this;
  }
  setLoopStart(e) {
    return this.loopStart = e, this;
  }
  setLoopEnd(e) {
    return this.loopEnd = e, this;
  }
  getVolume() {
    return this.gain.gain.value;
  }
  setVolume(e) {
    return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this;
  }
}
const cs = /* @__PURE__ */ new Q(), Jg = /* @__PURE__ */ new bn(), _N = /* @__PURE__ */ new Q(), us = /* @__PURE__ */ new Q();
class TN extends cp {
  constructor(e) {
    super(e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain);
  }
  getOutput() {
    return this.panner;
  }
  getRefDistance() {
    return this.panner.refDistance;
  }
  setRefDistance(e) {
    return this.panner.refDistance = e, this;
  }
  getRolloffFactor() {
    return this.panner.rolloffFactor;
  }
  setRolloffFactor(e) {
    return this.panner.rolloffFactor = e, this;
  }
  getDistanceModel() {
    return this.panner.distanceModel;
  }
  setDistanceModel(e) {
    return this.panner.distanceModel = e, this;
  }
  getMaxDistance() {
    return this.panner.maxDistance;
  }
  setMaxDistance(e) {
    return this.panner.maxDistance = e, this;
  }
  setDirectionalCone(e, t, i) {
    return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = i, this;
  }
  updateMatrixWorld(e) {
    if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return;
    this.matrixWorld.decompose(cs, Jg, _N), us.set(0, 0, 1).applyQuaternion(Jg);
    const t = this.panner;
    if (t.positionX) {
      const i = this.context.currentTime + this.listener.timeDelta;
      t.positionX.linearRampToValueAtTime(cs.x, i), t.positionY.linearRampToValueAtTime(cs.y, i), t.positionZ.linearRampToValueAtTime(cs.z, i), t.orientationX.linearRampToValueAtTime(us.x, i), t.orientationY.linearRampToValueAtTime(us.y, i), t.orientationZ.linearRampToValueAtTime(us.z, i);
    } else
      t.setPosition(cs.x, cs.y, cs.z), t.setOrientation(us.x, us.y, us.z);
  }
}
class Jx {
  constructor(e, t = 2048) {
    this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser);
  }
  getFrequencyData() {
    return this.analyser.getByteFrequencyData(this.data), this.data;
  }
  getAverageFrequency() {
    let e = 0;
    const t = this.getFrequencyData();
    for (let i = 0; i < t.length; i++)
      e += t[i];
    return e / t.length;
  }
}
class Kx {
  constructor(e, t, i) {
    this.binding = e, this.valueSize = i;
    let r, s, o;
    switch (t) {
      case "quaternion":
        r = this._slerp, s = this._slerpAdditive, o = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(i * 6), this._workIndex = 5;
        break;
      case "string":
      case "bool":
        r = this._select, s = this._select, o = this._setAdditiveIdentityOther, this.buffer = new Array(i * 5);
        break;
      default:
        r = this._lerp, s = this._lerpAdditive, o = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(i * 5);
    }
    this._mixBufferRegion = r, this._mixBufferRegionAdditive = s, this._setIdentity = o, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0;
  }
  // accumulate data in the 'incoming' region into 'accu<i>'
  accumulate(e, t) {
    const i = this.buffer, r = this.valueSize, s = e * r + r;
    let o = this.cumulativeWeight;
    if (o === 0) {
      for (let a = 0; a !== r; ++a)
        i[s + a] = i[a];
      o = t;
    } else {
      o += t;
      const a = t / o;
      this._mixBufferRegion(i, s, 0, a, r);
    }
    this.cumulativeWeight = o;
  }
  // accumulate data in the 'incoming' region into 'add'
  accumulateAdditive(e) {
    const t = this.buffer, i = this.valueSize, r = i * this._addIndex;
    this.cumulativeWeightAdditive === 0 && this._setIdentity(), this._mixBufferRegionAdditive(t, r, 0, e, i), this.cumulativeWeightAdditive += e;
  }
  // apply the state of 'accu<i>' to the binding when accus differ
  apply(e) {
    const t = this.valueSize, i = this.buffer, r = e * t + t, s = this.cumulativeWeight, o = this.cumulativeWeightAdditive, a = this.binding;
    if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, s < 1) {
      const c = t * this._origIndex;
      this._mixBufferRegion(
        i,
        r,
        c,
        1 - s,
        t
      );
    }
    o > 0 && this._mixBufferRegionAdditive(i, r, this._addIndex * t, 1, t);
    for (let c = t, l = t + t; c !== l; ++c)
      if (i[c] !== i[c + t]) {
        a.setValue(i, r);
        break;
      }
  }
  // remember the state of the bound property and copy it to both accus
  saveOriginalState() {
    const e = this.binding, t = this.buffer, i = this.valueSize, r = i * this._origIndex;
    e.getValue(t, r);
    for (let s = i, o = r; s !== o; ++s)
      t[s] = t[r + s % i];
    this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0;
  }
  // apply the state previously taken via 'saveOriginalState' to the binding
  restoreOriginalState() {
    const e = this.valueSize * 3;
    this.binding.setValue(this.buffer, e);
  }
  _setAdditiveIdentityNumeric() {
    const e = this._addIndex * this.valueSize, t = e + this.valueSize;
    for (let i = e; i < t; i++)
      this.buffer[i] = 0;
  }
  _setAdditiveIdentityQuaternion() {
    this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1;
  }
  _setAdditiveIdentityOther() {
    const e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize;
    for (let i = 0; i < this.valueSize; i++)
      this.buffer[t + i] = this.buffer[e + i];
  }
  // mix functions
  _select(e, t, i, r, s) {
    if (r >= 0.5)
      for (let o = 0; o !== s; ++o)
        e[t + o] = e[i + o];
  }
  _slerp(e, t, i, r) {
    bn.slerpFlat(e, t, e, t, e, i, r);
  }
  _slerpAdditive(e, t, i, r, s) {
    const o = this._workIndex * s;
    bn.multiplyQuaternionsFlat(e, o, e, t, e, i), bn.slerpFlat(e, t, e, t, e, o, r);
  }
  _lerp(e, t, i, r, s) {
    const o = 1 - r;
    for (let a = 0; a !== s; ++a) {
      const c = t + a;
      e[c] = e[c] * o + e[i + a] * r;
    }
  }
  _lerpAdditive(e, t, i, r, s) {
    for (let o = 0; o !== s; ++o) {
      const a = t + o;
      e[a] = e[a] + e[i + o] * r;
    }
  }
}
const up = "\\[\\]\\.:\\/", EN = new RegExp("[" + up + "]", "g"), hp = "[^" + up + "]", CN = "[^" + up.replace("\\.", "") + "]", LN = /((?:WC+[\/:])*)/.source.replace("WC", hp), RN = /(WCOD+)?/.source.replace("WCOD", CN), FN = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", hp), PN = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", hp), IN = new RegExp(
  "^" + LN + RN + FN + PN + "$"
), ON = ["material", "materials", "bones"];
class DN {
  constructor(e, t, i) {
    const r = i || mt.parseTrackName(t);
    this._targetGroup = e, this._bindings = e.subscribe_(t, r);
  }
  getValue(e, t) {
    this.bind();
    const i = this._targetGroup.nCachedObjects_, r = this._bindings[i];
    r !== void 0 && r.getValue(e, t);
  }
  setValue(e, t) {
    const i = this._bindings;
    for (let r = this._targetGroup.nCachedObjects_, s = i.length; r !== s; ++r)
      i[r].setValue(e, t);
  }
  bind() {
    const e = this._bindings;
    for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t)
      e[t].bind();
  }
  unbind() {
    const e = this._bindings;
    for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t)
      e[t].unbind();
  }
}
class mt {
  constructor(e, t, i) {
    this.path = t, this.parsedPath = i || mt.parseTrackName(t), this.node = mt.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
  }
  static create(e, t, i) {
    return e && e.isAnimationObjectGroup ? new mt.Composite(e, t, i) : new mt(e, t, i);
  }
  /**
   * Replaces spaces with underscores and removes unsupported characters from
   * node names, to ensure compatibility with parseTrackName().
   *
   * @param {string} name Node name to be sanitized.
   * @return {string}
   */
  static sanitizeNodeName(e) {
    return e.replace(/\s/g, "_").replace(EN, "");
  }
  static parseTrackName(e) {
    const t = IN.exec(e);
    if (!t)
      throw new Error("PropertyBinding: Cannot parse trackName: " + e);
    const i = {
      // directoryName: matches[ 1 ], // (tschw) currently unused
      nodeName: t[2],
      objectName: t[3],
      objectIndex: t[4],
      propertyName: t[5],
      // required
      propertyIndex: t[6]
    }, r = i.nodeName && i.nodeName.lastIndexOf(".");
    if (r !== void 0 && r !== -1) {
      const s = i.nodeName.substring(r + 1);
      ON.indexOf(s) !== -1 && (i.nodeName = i.nodeName.substring(0, r), i.objectName = s);
    }
    if (i.propertyName === null || i.propertyName.length === 0)
      throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e);
    return i;
  }
  static findNode(e, t) {
    if (!t || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid)
      return e;
    if (e.skeleton) {
      const i = e.skeleton.getBoneByName(t);
      if (i !== void 0)
        return i;
    }
    if (e.children) {
      const i = function(s) {
        for (let o = 0; o < s.length; o++) {
          const a = s[o];
          if (a.name === t || a.uuid === t)
            return a;
          const c = i(a.children);
          if (c) return c;
        }
        return null;
      }, r = i(e.children);
      if (r)
        return r;
    }
    return null;
  }
  // these are used to "bind" a nonexistent property
  _getValue_unavailable() {
  }
  _setValue_unavailable() {
  }
  // Getters
  _getValue_direct(e, t) {
    e[t] = this.node[this.propertyName];
  }
  _getValue_array(e, t) {
    const i = this.resolvedProperty;
    for (let r = 0, s = i.length; r !== s; ++r)
      e[t++] = i[r];
  }
  _getValue_arrayElement(e, t) {
    e[t] = this.resolvedProperty[this.propertyIndex];
  }
  _getValue_toArray(e, t) {
    this.resolvedProperty.toArray(e, t);
  }
  // Direct
  _setValue_direct(e, t) {
    this.targetObject[this.propertyName] = e[t];
  }
  _setValue_direct_setNeedsUpdate(e, t) {
    this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0;
  }
  _setValue_direct_setMatrixWorldNeedsUpdate(e, t) {
    this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;
  }
  // EntireArray
  _setValue_array(e, t) {
    const i = this.resolvedProperty;
    for (let r = 0, s = i.length; r !== s; ++r)
      i[r] = e[t++];
  }
  _setValue_array_setNeedsUpdate(e, t) {
    const i = this.resolvedProperty;
    for (let r = 0, s = i.length; r !== s; ++r)
      i[r] = e[t++];
    this.targetObject.needsUpdate = !0;
  }
  _setValue_array_setMatrixWorldNeedsUpdate(e, t) {
    const i = this.resolvedProperty;
    for (let r = 0, s = i.length; r !== s; ++r)
      i[r] = e[t++];
    this.targetObject.matrixWorldNeedsUpdate = !0;
  }
  // ArrayElement
  _setValue_arrayElement(e, t) {
    this.resolvedProperty[this.propertyIndex] = e[t];
  }
  _setValue_arrayElement_setNeedsUpdate(e, t) {
    this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0;
  }
  _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) {
    this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0;
  }
  // HasToFromArray
  _setValue_fromArray(e, t) {
    this.resolvedProperty.fromArray(e, t);
  }
  _setValue_fromArray_setNeedsUpdate(e, t) {
    this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0;
  }
  _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) {
    this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0;
  }
  _getValue_unbound(e, t) {
    this.bind(), this.getValue(e, t);
  }
  _setValue_unbound(e, t) {
    this.bind(), this.setValue(e, t);
  }
  // create getter / setter pair for a property in the scene graph
  bind() {
    let e = this.node;
    const t = this.parsedPath, i = t.objectName, r = t.propertyName;
    let s = t.propertyIndex;
    if (e || (e = mt.findNode(this.rootNode, t.nodeName) || this.rootNode, this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) {
      console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found.");
      return;
    }
    if (i) {
      let l = t.objectIndex;
      switch (i) {
        case "materials":
          if (!e.material) {
            console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
            return;
          }
          if (!e.material.materials) {
            console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
            return;
          }
          e = e.material.materials;
          break;
        case "bones":
          if (!e.skeleton) {
            console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
            return;
          }
          e = e.skeleton.bones;
          for (let d = 0; d < e.length; d++)
            if (e[d].name === l) {
              l = d;
              break;
            }
          break;
        default:
          if (e[i] === void 0) {
            console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this);
            return;
          }
          e = e[i];
      }
      if (l !== void 0) {
        if (e[l] === void 0) {
          console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e);
          return;
        }
        e = e[l];
      }
    }
    const o = e[r];
    if (o === void 0) {
      const l = t.nodeName;
      console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + r + " but it wasn't found.", e);
      return;
    }
    let a = this.Versioning.None;
    this.targetObject = e, e.needsUpdate !== void 0 ? a = this.Versioning.NeedsUpdate : e.matrixWorldNeedsUpdate !== void 0 && (a = this.Versioning.MatrixWorldNeedsUpdate);
    let c = this.BindingType.Direct;
    if (s !== void 0) {
      if (r === "morphTargetInfluences") {
        if (!e.geometry) {
          console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
          return;
        }
        if (e.geometry.isBufferGeometry) {
          if (!e.geometry.morphAttributes) {
            console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
            return;
          }
          e.morphTargetDictionary[s] !== void 0 && (s = e.morphTargetDictionary[s]);
        } else {
          console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.", this);
          return;
        }
      }
      c = this.BindingType.ArrayElement, this.resolvedProperty = o, this.propertyIndex = s;
    } else o.fromArray !== void 0 && o.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = o) : Array.isArray(o) ? (c = this.BindingType.EntireArray, this.resolvedProperty = o) : this.propertyName = r;
    this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][a];
  }
  unbind() {
    this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
  }
}
mt.Composite = DN;
mt.prototype.BindingType = {
  Direct: 0,
  EntireArray: 1,
  ArrayElement: 2,
  HasFromToArray: 3
};
mt.prototype.Versioning = {
  None: 0,
  NeedsUpdate: 1,
  MatrixWorldNeedsUpdate: 2
};
mt.prototype.GetterByBindingType = [
  mt.prototype._getValue_direct,
  mt.prototype._getValue_array,
  mt.prototype._getValue_arrayElement,
  mt.prototype._getValue_toArray
];
mt.prototype.SetterByBindingTypeAndVersioning = [
  [
    // Direct
    mt.prototype._setValue_direct,
    mt.prototype._setValue_direct_setNeedsUpdate,
    mt.prototype._setValue_direct_setMatrixWorldNeedsUpdate
  ],
  [
    // EntireArray
    mt.prototype._setValue_array,
    mt.prototype._setValue_array_setNeedsUpdate,
    mt.prototype._setValue_array_setMatrixWorldNeedsUpdate
  ],
  [
    // ArrayElement
    mt.prototype._setValue_arrayElement,
    mt.prototype._setValue_arrayElement_setNeedsUpdate,
    mt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
  ],
  [
    // HasToFromArray
    mt.prototype._setValue_fromArray,
    mt.prototype._setValue_fromArray_setNeedsUpdate,
    mt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
  ]
];
class qx {
  constructor() {
    this.uuid = Wn(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0;
    const e = {};
    this._indicesByUUID = e;
    for (let i = 0, r = arguments.length; i !== r; ++i)
      e[arguments[i].uuid] = i;
    this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {};
    const t = this;
    this.stats = {
      objects: {
        get total() {
          return t._objects.length;
        },
        get inUse() {
          return this.total - t.nCachedObjects_;
        }
      },
      get bindingsPerObject() {
        return t._bindings.length;
      }
    };
  }
  add() {
    const e = this._objects, t = this._indicesByUUID, i = this._paths, r = this._parsedPaths, s = this._bindings, o = s.length;
    let a, c = e.length, l = this.nCachedObjects_;
    for (let d = 0, h = arguments.length; d !== h; ++d) {
      const f = arguments[d], g = f.uuid;
      let p = t[g];
      if (p === void 0) {
        p = c++, t[g] = p, e.push(f);
        for (let u = 0, y = o; u !== y; ++u)
          s[u].push(new mt(f, i[u], r[u]));
      } else if (p < l) {
        a = e[p];
        const u = --l, y = e[u];
        t[y.uuid] = p, e[p] = y, t[g] = u, e[u] = f;
        for (let v = 0, m = o; v !== m; ++v) {
          const x = s[v], w = x[u];
          let A = x[p];
          x[p] = w, A === void 0 && (A = new mt(f, i[v], r[v])), x[u] = A;
        }
      } else e[p] !== a && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.");
    }
    this.nCachedObjects_ = l;
  }
  remove() {
    const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length;
    let s = this.nCachedObjects_;
    for (let o = 0, a = arguments.length; o !== a; ++o) {
      const c = arguments[o], l = c.uuid, d = t[l];
      if (d !== void 0 && d >= s) {
        const h = s++, f = e[h];
        t[f.uuid] = d, e[d] = f, t[l] = h, e[h] = c;
        for (let g = 0, p = r; g !== p; ++g) {
          const u = i[g], y = u[h], v = u[d];
          u[d] = y, u[h] = v;
        }
      }
    }
    this.nCachedObjects_ = s;
  }
  // remove & forget
  uncache() {
    const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length;
    let s = this.nCachedObjects_, o = e.length;
    for (let a = 0, c = arguments.length; a !== c; ++a) {
      const l = arguments[a], d = l.uuid, h = t[d];
      if (h !== void 0)
        if (delete t[d], h < s) {
          const f = --s, g = e[f], p = --o, u = e[p];
          t[g.uuid] = h, e[h] = g, t[u.uuid] = f, e[f] = u, e.pop();
          for (let y = 0, v = r; y !== v; ++y) {
            const m = i[y], x = m[f], w = m[p];
            m[h] = x, m[f] = w, m.pop();
          }
        } else {
          const f = --o, g = e[f];
          f > 0 && (t[g.uuid] = h), e[h] = g, e.pop();
          for (let p = 0, u = r; p !== u; ++p) {
            const y = i[p];
            y[h] = y[f], y.pop();
          }
        }
    }
    this.nCachedObjects_ = s;
  }
  // Internal interface used by befriended PropertyBinding.Composite:
  subscribe_(e, t) {
    const i = this._bindingsIndicesByPath;
    let r = i[e];
    const s = this._bindings;
    if (r !== void 0) return s[r];
    const o = this._paths, a = this._parsedPaths, c = this._objects, l = c.length, d = this.nCachedObjects_, h = new Array(l);
    r = s.length, i[e] = r, o.push(e), a.push(t), s.push(h);
    for (let f = d, g = c.length; f !== g; ++f) {
      const p = c[f];
      h[f] = new mt(p, e, t);
    }
    return h;
  }
  unsubscribe_(e) {
    const t = this._bindingsIndicesByPath, i = t[e];
    if (i !== void 0) {
      const r = this._paths, s = this._parsedPaths, o = this._bindings, a = o.length - 1, c = o[a], l = e[a];
      t[l] = i, o[i] = c, o.pop(), s[i] = s[a], s.pop(), r[i] = r[a], r.pop();
    }
  }
}
qx.prototype.isAnimationObjectGroup = !0;
class NN {
  constructor(e, t, i = null, r = t.blendMode) {
    this._mixer = e, this._clip = t, this._localRoot = i, this.blendMode = r;
    const s = t.tracks, o = s.length, a = new Array(o), c = {
      endingStart: gs,
      endingEnd: gs
    };
    for (let l = 0; l !== o; ++l) {
      const d = s[l].createInterpolant(null);
      a[l] = d, d.settings = c;
    }
    this._interpolantSettings = c, this._interpolants = a, this._propertyBindings = new Array(o), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = jb, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0;
  }
  // State & Scheduling
  play() {
    return this._mixer._activateAction(this), this;
  }
  stop() {
    return this._mixer._deactivateAction(this), this.reset();
  }
  reset() {
    return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping();
  }
  isRunning() {
    return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);
  }
  // return true when play has been called
  isScheduled() {
    return this._mixer._isActiveAction(this);
  }
  startAt(e) {
    return this._startTime = e, this;
  }
  setLoop(e, t) {
    return this.loop = e, this.repetitions = t, this;
  }
  // Weight
  // set the weight stopping any scheduled fading
  // although .enabled = false yields an effective weight of zero, this
  // method does *not* change .enabled, because it would be confusing
  setEffectiveWeight(e) {
    return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading();
  }
  // return the weight considering fading and .enabled
  getEffectiveWeight() {
    return this._effectiveWeight;
  }
  fadeIn(e) {
    return this._scheduleFading(e, 0, 1);
  }
  fadeOut(e) {
    return this._scheduleFading(e, 1, 0);
  }
  crossFadeFrom(e, t, i) {
    if (e.fadeOut(t), this.fadeIn(t), i) {
      const r = this._clip.duration, s = e._clip.duration, o = s / r, a = r / s;
      e.warp(1, o, t), this.warp(a, 1, t);
    }
    return this;
  }
  crossFadeTo(e, t, i) {
    return e.crossFadeFrom(this, t, i);
  }
  stopFading() {
    const e = this._weightInterpolant;
    return e !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this;
  }
  // Time Scale Control
  // set the time scale stopping any scheduled warping
  // although .paused = true yields an effective time scale of zero, this
  // method does *not* change .paused, because it would be confusing
  setEffectiveTimeScale(e) {
    return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping();
  }
  // return the time scale considering warping and .paused
  getEffectiveTimeScale() {
    return this._effectiveTimeScale;
  }
  setDuration(e) {
    return this.timeScale = this._clip.duration / e, this.stopWarping();
  }
  syncWith(e) {
    return this.time = e.time, this.timeScale = e.timeScale, this.stopWarping();
  }
  halt(e) {
    return this.warp(this._effectiveTimeScale, 0, e);
  }
  warp(e, t, i) {
    const r = this._mixer, s = r.time, o = this.timeScale;
    let a = this._timeScaleInterpolant;
    a === null && (a = r._lendControlInterpolant(), this._timeScaleInterpolant = a);
    const c = a.parameterPositions, l = a.sampleValues;
    return c[0] = s, c[1] = s + i, l[0] = e / o, l[1] = t / o, this;
  }
  stopWarping() {
    const e = this._timeScaleInterpolant;
    return e !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this;
  }
  // Object Accessors
  getMixer() {
    return this._mixer;
  }
  getClip() {
    return this._clip;
  }
  getRoot() {
    return this._localRoot || this._mixer._root;
  }
  // Interna
  _update(e, t, i, r) {
    if (!this.enabled) {
      this._updateWeight(e);
      return;
    }
    const s = this._startTime;
    if (s !== null) {
      const c = (e - s) * i;
      if (c < 0 || i === 0)
        return;
      this._startTime = null, t = i * c;
    }
    t *= this._updateTimeScale(e);
    const o = this._updateTime(t), a = this._updateWeight(e);
    if (a > 0) {
      const c = this._interpolants, l = this._propertyBindings;
      switch (this.blendMode) {
        case Mf:
          for (let d = 0, h = c.length; d !== h; ++d)
            c[d].evaluate(o), l[d].accumulateAdditive(a);
          break;
        case fu:
        default:
          for (let d = 0, h = c.length; d !== h; ++d)
            c[d].evaluate(o), l[d].accumulate(r, a);
      }
    }
  }
  _updateWeight(e) {
    let t = 0;
    if (this.enabled) {
      t = this.weight;
      const i = this._weightInterpolant;
      if (i !== null) {
        const r = i.evaluate(e)[0];
        t *= r, e > i.parameterPositions[1] && (this.stopFading(), r === 0 && (this.enabled = !1));
      }
    }
    return this._effectiveWeight = t, t;
  }
  _updateTimeScale(e) {
    let t = 0;
    if (!this.paused) {
      t = this.timeScale;
      const i = this._timeScaleInterpolant;
      if (i !== null) {
        const r = i.evaluate(e)[0];
        t *= r, e > i.parameterPositions[1] && (this.stopWarping(), t === 0 ? this.paused = !0 : this.timeScale = t);
      }
    }
    return this._effectiveTimeScale = t, t;
  }
  _updateTime(e) {
    const t = this._clip.duration, i = this.loop;
    let r = this.time + e, s = this._loopCount;
    const o = i === $b;
    if (e === 0)
      return s === -1 ? r : o && (s & 1) === 1 ? t - r : r;
    if (i === Wb) {
      s === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1));
      e: {
        if (r >= t)
          r = t;
        else if (r < 0)
          r = 0;
        else {
          this.time = r;
          break e;
        }
        this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = r, this._mixer.dispatchEvent({
          type: "finished",
          action: this,
          direction: e < 0 ? -1 : 1
        });
      }
    } else {
      if (s === -1 && (e >= 0 ? (s = 0, this._setEndings(!0, this.repetitions === 0, o)) : this._setEndings(this.repetitions === 0, !0, o)), r >= t || r < 0) {
        const a = Math.floor(r / t);
        r -= t * a, s += Math.abs(a);
        const c = this.repetitions - s;
        if (c <= 0)
          this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, r = e > 0 ? t : 0, this.time = r, this._mixer.dispatchEvent({
            type: "finished",
            action: this,
            direction: e > 0 ? 1 : -1
          });
        else {
          if (c === 1) {
            const l = e < 0;
            this._setEndings(l, !l, o);
          } else
            this._setEndings(!1, !1, o);
          this._loopCount = s, this.time = r, this._mixer.dispatchEvent({
            type: "loop",
            action: this,
            loopDelta: a
          });
        }
      } else
        this.time = r;
      if (o && (s & 1) === 1)
        return t - r;
    }
    return r;
  }
  _setEndings(e, t, i) {
    const r = this._interpolantSettings;
    i ? (r.endingStart = vs, r.endingEnd = vs) : (e ? r.endingStart = this.zeroSlopeAtStart ? vs : gs : r.endingStart = Wa, t ? r.endingEnd = this.zeroSlopeAtEnd ? vs : gs : r.endingEnd = Wa);
  }
  _scheduleFading(e, t, i) {
    const r = this._mixer, s = r.time;
    let o = this._weightInterpolant;
    o === null && (o = r._lendControlInterpolant(), this._weightInterpolant = o);
    const a = o.parameterPositions, c = o.sampleValues;
    return a[0] = s, c[0] = t, a[1] = s + e, c[1] = i, this;
  }
}
class Qx extends Kr {
  constructor(e) {
    super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1;
  }
  _bindAction(e, t) {
    const i = e._localRoot || this._root, r = e._clip.tracks, s = r.length, o = e._propertyBindings, a = e._interpolants, c = i.uuid, l = this._bindingsByRootAndName;
    let d = l[c];
    d === void 0 && (d = {}, l[c] = d);
    for (let h = 0; h !== s; ++h) {
      const f = r[h], g = f.name;
      let p = d[g];
      if (p !== void 0)
        o[h] = p;
      else {
        if (p = o[h], p !== void 0) {
          p._cacheIndex === null && (++p.referenceCount, this._addInactiveBinding(p, c, g));
          continue;
        }
        const u = t && t._propertyBindings[h].binding.parsedPath;
        p = new Kx(
          mt.create(i, g, u),
          f.ValueTypeName,
          f.getValueSize()
        ), ++p.referenceCount, this._addInactiveBinding(p, c, g), o[h] = p;
      }
      a[h].resultBuffer = p.buffer;
    }
  }
  _activateAction(e) {
    if (!this._isActiveAction(e)) {
      if (e._cacheIndex === null) {
        const i = (e._localRoot || this._root).uuid, r = e._clip.uuid, s = this._actionsByClip[r];
        this._bindAction(
          e,
          s && s.knownActions[0]
        ), this._addInactiveAction(e, r, i);
      }
      const t = e._propertyBindings;
      for (let i = 0, r = t.length; i !== r; ++i) {
        const s = t[i];
        s.useCount++ === 0 && (this._lendBinding(s), s.saveOriginalState());
      }
      this._lendAction(e);
    }
  }
  _deactivateAction(e) {
    if (this._isActiveAction(e)) {
      const t = e._propertyBindings;
      for (let i = 0, r = t.length; i !== r; ++i) {
        const s = t[i];
        --s.useCount === 0 && (s.restoreOriginalState(), this._takeBackBinding(s));
      }
      this._takeBackAction(e);
    }
  }
  // Memory manager
  _initMemoryManager() {
    this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0;
    const e = this;
    this.stats = {
      actions: {
        get total() {
          return e._actions.length;
        },
        get inUse() {
          return e._nActiveActions;
        }
      },
      bindings: {
        get total() {
          return e._bindings.length;
        },
        get inUse() {
          return e._nActiveBindings;
        }
      },
      controlInterpolants: {
        get total() {
          return e._controlInterpolants.length;
        },
        get inUse() {
          return e._nActiveControlInterpolants;
        }
      }
    };
  }
  // Memory management for AnimationAction objects
  _isActiveAction(e) {
    const t = e._cacheIndex;
    return t !== null && t < this._nActiveActions;
  }
  _addInactiveAction(e, t, i) {
    const r = this._actions, s = this._actionsByClip;
    let o = s[t];
    if (o === void 0)
      o = {
        knownActions: [e],
        actionByRoot: {}
      }, e._byClipCacheIndex = 0, s[t] = o;
    else {
      const a = o.knownActions;
      e._byClipCacheIndex = a.length, a.push(e);
    }
    e._cacheIndex = r.length, r.push(e), o.actionByRoot[i] = e;
  }
  _removeInactiveAction(e) {
    const t = this._actions, i = t[t.length - 1], r = e._cacheIndex;
    i._cacheIndex = r, t[r] = i, t.pop(), e._cacheIndex = null;
    const s = e._clip.uuid, o = this._actionsByClip, a = o[s], c = a.knownActions, l = c[c.length - 1], d = e._byClipCacheIndex;
    l._byClipCacheIndex = d, c[d] = l, c.pop(), e._byClipCacheIndex = null;
    const h = a.actionByRoot, f = (e._localRoot || this._root).uuid;
    delete h[f], c.length === 0 && delete o[s], this._removeInactiveBindingsForAction(e);
  }
  _removeInactiveBindingsForAction(e) {
    const t = e._propertyBindings;
    for (let i = 0, r = t.length; i !== r; ++i) {
      const s = t[i];
      --s.referenceCount === 0 && this._removeInactiveBinding(s);
    }
  }
  _lendAction(e) {
    const t = this._actions, i = e._cacheIndex, r = this._nActiveActions++, s = t[r];
    e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s;
  }
  _takeBackAction(e) {
    const t = this._actions, i = e._cacheIndex, r = --this._nActiveActions, s = t[r];
    e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s;
  }
  // Memory management for PropertyMixer objects
  _addInactiveBinding(e, t, i) {
    const r = this._bindingsByRootAndName, s = this._bindings;
    let o = r[t];
    o === void 0 && (o = {}, r[t] = o), o[i] = e, e._cacheIndex = s.length, s.push(e);
  }
  _removeInactiveBinding(e) {
    const t = this._bindings, i = e.binding, r = i.rootNode.uuid, s = i.path, o = this._bindingsByRootAndName, a = o[r], c = t[t.length - 1], l = e._cacheIndex;
    c._cacheIndex = l, t[l] = c, t.pop(), delete a[s], Object.keys(a).length === 0 && delete o[r];
  }
  _lendBinding(e) {
    const t = this._bindings, i = e._cacheIndex, r = this._nActiveBindings++, s = t[r];
    e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s;
  }
  _takeBackBinding(e) {
    const t = this._bindings, i = e._cacheIndex, r = --this._nActiveBindings, s = t[r];
    e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s;
  }
  // Memory management of Interpolants for weight and time scale
  _lendControlInterpolant() {
    const e = this._controlInterpolants, t = this._nActiveControlInterpolants++;
    let i = e[t];
    return i === void 0 && (i = new Yf(
      new Float32Array(2),
      new Float32Array(2),
      1,
      this._controlInterpolantsResultBuffer
    ), i.__cacheIndex = t, e[t] = i), i;
  }
  _takeBackControlInterpolant(e) {
    const t = this._controlInterpolants, i = e.__cacheIndex, r = --this._nActiveControlInterpolants, s = t[r];
    e.__cacheIndex = r, t[r] = e, s.__cacheIndex = i, t[i] = s;
  }
  // return an action for a clip optionally using a custom root target
  // object (this method allocates a lot of dynamic memory in case a
  // previously unknown clip/root combination is specified)
  clipAction(e, t, i) {
    const r = t || this._root, s = r.uuid;
    let o = typeof e == "string" ? jo.findByName(r, e) : e;
    const a = o !== null ? o.uuid : e, c = this._actionsByClip[a];
    let l = null;
    if (i === void 0 && (o !== null ? i = o.blendMode : i = fu), c !== void 0) {
      const h = c.actionByRoot[s];
      if (h !== void 0 && h.blendMode === i)
        return h;
      l = c.knownActions[0], o === null && (o = l._clip);
    }
    if (o === null) return null;
    const d = new NN(this, o, t, i);
    return this._bindAction(d, l), this._addInactiveAction(d, a, s), d;
  }
  // get an existing action
  existingAction(e, t) {
    const i = t || this._root, r = i.uuid, s = typeof e == "string" ? jo.findByName(i, e) : e, o = s ? s.uuid : e, a = this._actionsByClip[o];
    return a !== void 0 && a.actionByRoot[r] || null;
  }
  // deactivates all previously scheduled actions
  stopAllAction() {
    const e = this._actions, t = this._nActiveActions;
    for (let i = t - 1; i >= 0; --i)
      e[i].stop();
    return this;
  }
  // advance the time and update apply the animation
  update(e) {
    e *= this.timeScale;
    const t = this._actions, i = this._nActiveActions, r = this.time += e, s = Math.sign(e), o = this._accuIndex ^= 1;
    for (let l = 0; l !== i; ++l)
      t[l]._update(r, e, s, o);
    const a = this._bindings, c = this._nActiveBindings;
    for (let l = 0; l !== c; ++l)
      a[l].apply(o);
    return this;
  }
  // Allows you to seek to a specific time in an animation.
  setTime(e) {
    this.time = 0;
    for (let t = 0; t < this._actions.length; t++)
      this._actions[t].time = 0;
    return this.update(e);
  }
  // return this mixer's root target object
  getRoot() {
    return this._root;
  }
  // free all resources specific to a particular clip
  uncacheClip(e) {
    const t = this._actions, i = e.uuid, r = this._actionsByClip, s = r[i];
    if (s !== void 0) {
      const o = s.knownActions;
      for (let a = 0, c = o.length; a !== c; ++a) {
        const l = o[a];
        this._deactivateAction(l);
        const d = l._cacheIndex, h = t[t.length - 1];
        l._cacheIndex = null, l._byClipCacheIndex = null, h._cacheIndex = d, t[d] = h, t.pop(), this._removeInactiveBindingsForAction(l);
      }
      delete r[i];
    }
  }
  // free all resources specific to a particular root target object
  uncacheRoot(e) {
    const t = e.uuid, i = this._actionsByClip;
    for (const o in i) {
      const a = i[o].actionByRoot, c = a[t];
      c !== void 0 && (this._deactivateAction(c), this._removeInactiveAction(c));
    }
    const r = this._bindingsByRootAndName, s = r[t];
    if (s !== void 0)
      for (const o in s) {
        const a = s[o];
        a.restoreOriginalState(), this._removeInactiveBinding(a);
      }
  }
  // remove a targeted clip from the cache
  uncacheAction(e, t) {
    const i = this.existingAction(e, t);
    i !== null && (this._deactivateAction(i), this._removeInactiveAction(i));
  }
}
Qx.prototype._controlInterpolantsResultBuffer = new Float32Array(1);
class Fu {
  constructor(e) {
    typeof e == "string" && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e;
  }
  clone() {
    return new Fu(this.value.clone === void 0 ? this.value : this.value.clone());
  }
}
class eM extends Qr {
  constructor(e, t, i = 1) {
    super(e, t), this.meshPerAttribute = i;
  }
  copy(e) {
    return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this;
  }
  clone(e) {
    const t = super.clone(e);
    return t.meshPerAttribute = this.meshPerAttribute, t;
  }
  toJSON(e) {
    const t = super.toJSON(e);
    return t.isInstancedInterleavedBuffer = !0, t.meshPerAttribute = this.meshPerAttribute, t;
  }
}
eM.prototype.isInstancedInterleavedBuffer = !0;
class tM {
  constructor(e, t, i, r, s) {
    this.buffer = e, this.type = t, this.itemSize = i, this.elementSize = r, this.count = s, this.version = 0;
  }
  set needsUpdate(e) {
    e === !0 && this.version++;
  }
  setBuffer(e) {
    return this.buffer = e, this;
  }
  setType(e, t) {
    return this.type = e, this.elementSize = t, this;
  }
  setItemSize(e) {
    return this.itemSize = e, this;
  }
  setCount(e) {
    return this.count = e, this;
  }
}
tM.prototype.isGLBufferAttribute = !0;
class BN {
  constructor(e, t, i = 0, r = 1 / 0) {
    this.ray = new qr(e, t), this.near = i, this.far = r, this.camera = null, this.layers = new Cf(), this.params = {
      Mesh: {},
      Line: { threshold: 1 },
      LOD: {},
      Points: { threshold: 1 },
      Sprite: {}
    };
  }
  set(e, t) {
    this.ray.set(e, t);
  }
  setFromCamera(e, t) {
    t && t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, 0.5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t && t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type);
  }
  intersectObject(e, t = !1, i = []) {
    return _d(e, this, i, t), i.sort(Kg), i;
  }
  intersectObjects(e, t = !1, i = []) {
    for (let r = 0, s = e.length; r < s; r++)
      _d(e[r], this, i, t);
    return i.sort(Kg), i;
  }
}
function Kg(n, e) {
  return n.distance - e.distance;
}
function _d(n, e, t, i) {
  if (n.layers.test(e.layers) && n.raycast(e, t), i === !0) {
    const r = n.children;
    for (let s = 0, o = r.length; s < o; s++)
      _d(r[s], e, t, !0);
  }
}
class UN {
  constructor(e = 1, t = 0, i = 0) {
    return this.radius = e, this.phi = t, this.theta = i, this;
  }
  set(e, t, i) {
    return this.radius = e, this.phi = t, this.theta = i, this;
  }
  copy(e) {
    return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this;
  }
  // restrict phi to be betwee EPS and PI-EPS
  makeSafe() {
    return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)), this;
  }
  setFromVector3(e) {
    return this.setFromCartesianCoords(e.x, e.y, e.z);
  }
  setFromCartesianCoords(e, t, i) {
    return this.radius = Math.sqrt(e * e + t * t + i * i), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, i), this.phi = Math.acos(gn(t / this.radius, -1, 1))), this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
class zN {
  constructor(e = 1, t = 0, i = 0) {
    return this.radius = e, this.theta = t, this.y = i, this;
  }
  set(e, t, i) {
    return this.radius = e, this.theta = t, this.y = i, this;
  }
  copy(e) {
    return this.radius = e.radius, this.theta = e.theta, this.y = e.y, this;
  }
  setFromVector3(e) {
    return this.setFromCartesianCoords(e.x, e.y, e.z);
  }
  setFromCartesianCoords(e, t, i) {
    return this.radius = Math.sqrt(e * e + i * i), this.theta = Math.atan2(e, i), this.y = t, this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
const qg = /* @__PURE__ */ new Re();
class oa {
  constructor(e = new Re(1 / 0, 1 / 0), t = new Re(-1 / 0, -1 / 0)) {
    this.min = e, this.max = t;
  }
  set(e, t) {
    return this.min.copy(e), this.max.copy(t), this;
  }
  setFromPoints(e) {
    this.makeEmpty();
    for (let t = 0, i = e.length; t < i; t++)
      this.expandByPoint(e[t]);
    return this;
  }
  setFromCenterAndSize(e, t) {
    const i = qg.copy(t).multiplyScalar(0.5);
    return this.min.copy(e).sub(i), this.max.copy(e).add(i), this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
  copy(e) {
    return this.min.copy(e.min), this.max.copy(e.max), this;
  }
  makeEmpty() {
    return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this;
  }
  isEmpty() {
    return this.max.x < this.min.x || this.max.y < this.min.y;
  }
  getCenter(e) {
    return this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5);
  }
  getSize(e) {
    return this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min);
  }
  expandByPoint(e) {
    return this.min.min(e), this.max.max(e), this;
  }
  expandByVector(e) {
    return this.min.sub(e), this.max.add(e), this;
  }
  expandByScalar(e) {
    return this.min.addScalar(-e), this.max.addScalar(e), this;
  }
  containsPoint(e) {
    return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y);
  }
  containsBox(e) {
    return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y;
  }
  getParameter(e, t) {
    return t.set(
      (e.x - this.min.x) / (this.max.x - this.min.x),
      (e.y - this.min.y) / (this.max.y - this.min.y)
    );
  }
  intersectsBox(e) {
    return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y);
  }
  clampPoint(e, t) {
    return t.copy(e).clamp(this.min, this.max);
  }
  distanceToPoint(e) {
    return qg.copy(e).clamp(this.min, this.max).sub(e).length();
  }
  intersect(e) {
    return this.min.max(e.min), this.max.min(e.max), this;
  }
  union(e) {
    return this.min.min(e.min), this.max.max(e.max), this;
  }
  translate(e) {
    return this.min.add(e), this.max.add(e), this;
  }
  equals(e) {
    return e.min.equals(this.min) && e.max.equals(this.max);
  }
}
oa.prototype.isBox2 = !0;
const Qg = /* @__PURE__ */ new Q(), dc = /* @__PURE__ */ new Q();
class nM {
  constructor(e = new Q(), t = new Q()) {
    this.start = e, this.end = t;
  }
  set(e, t) {
    return this.start.copy(e), this.end.copy(t), this;
  }
  copy(e) {
    return this.start.copy(e.start), this.end.copy(e.end), this;
  }
  getCenter(e) {
    return e.addVectors(this.start, this.end).multiplyScalar(0.5);
  }
  delta(e) {
    return e.subVectors(this.end, this.start);
  }
  distanceSq() {
    return this.start.distanceToSquared(this.end);
  }
  distance() {
    return this.start.distanceTo(this.end);
  }
  at(e, t) {
    return this.delta(t).multiplyScalar(e).add(this.start);
  }
  closestPointToPointParameter(e, t) {
    Qg.subVectors(e, this.start), dc.subVectors(this.end, this.start);
    const i = dc.dot(dc);
    let s = dc.dot(Qg) / i;
    return t && (s = gn(s, 0, 1)), s;
  }
  closestPointToPoint(e, t, i) {
    const r = this.closestPointToPointParameter(e, t);
    return this.delta(i).multiplyScalar(r).add(this.start);
  }
  applyMatrix4(e) {
    return this.start.applyMatrix4(e), this.end.applyMatrix4(e), this;
  }
  equals(e) {
    return e.start.equals(this.start) && e.end.equals(this.end);
  }
  clone() {
    return new this.constructor().copy(this);
  }
}
class iM extends ut {
  constructor(e) {
    super(), this.material = e, this.render = function() {
    }, this.hasPositions = !1, this.hasNormals = !1, this.hasColors = !1, this.hasUvs = !1, this.positionArray = null, this.normalArray = null, this.colorArray = null, this.uvArray = null, this.count = 0;
  }
}
iM.prototype.isImmediateRenderObject = !0;
const ev = /* @__PURE__ */ new Q();
class kN extends ut {
  constructor(e, t) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t;
    const i = new Ke(), r = [
      0,
      0,
      0,
      0,
      0,
      1,
      0,
      0,
      0,
      1,
      0,
      1,
      0,
      0,
      0,
      -1,
      0,
      1,
      0,
      0,
      0,
      0,
      1,
      1,
      0,
      0,
      0,
      0,
      -1,
      1
    ];
    for (let o = 0, a = 1, c = 32; o < c; o++, a++) {
      const l = o / c * Math.PI * 2, d = a / c * Math.PI * 2;
      r.push(
        Math.cos(l),
        Math.sin(l),
        1,
        Math.cos(d),
        Math.sin(d),
        1
      );
    }
    i.setAttribute("position", new We(r, 3));
    const s = new an({ fog: !1, toneMapped: !1 });
    this.cone = new Rn(i, s), this.add(this.cone), this.update();
  }
  dispose() {
    this.cone.geometry.dispose(), this.cone.material.dispose();
  }
  update() {
    this.light.updateMatrixWorld();
    const e = this.light.distance ? this.light.distance : 1e3, t = e * Math.tan(this.light.angle);
    this.cone.scale.set(t, t, e), ev.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(ev), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color);
  }
}
const Sr = /* @__PURE__ */ new Q(), fc = /* @__PURE__ */ new Xe(), Sh = /* @__PURE__ */ new Xe();
class rM extends Rn {
  constructor(e) {
    const t = sM(e), i = new Ke(), r = [], s = [], o = new Ue(0, 0, 1), a = new Ue(0, 1, 0);
    for (let l = 0; l < t.length; l++) {
      const d = t[l];
      d.parent && d.parent.isBone && (r.push(0, 0, 0), r.push(0, 0, 0), s.push(o.r, o.g, o.b), s.push(a.r, a.g, a.b));
    }
    i.setAttribute("position", new We(r, 3)), i.setAttribute("color", new We(s, 3));
    const c = new an({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 });
    super(i, c), this.type = "SkeletonHelper", this.isSkeletonHelper = !0, this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1;
  }
  updateMatrixWorld(e) {
    const t = this.bones, i = this.geometry, r = i.getAttribute("position");
    Sh.copy(this.root.matrixWorld).invert();
    for (let s = 0, o = 0; s < t.length; s++) {
      const a = t[s];
      a.parent && a.parent.isBone && (fc.multiplyMatrices(Sh, a.matrixWorld), Sr.setFromMatrixPosition(fc), r.setXYZ(o, Sr.x, Sr.y, Sr.z), fc.multiplyMatrices(Sh, a.parent.matrixWorld), Sr.setFromMatrixPosition(fc), r.setXYZ(o + 1, Sr.x, Sr.y, Sr.z), o += 2);
    }
    i.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e);
  }
}
function sM(n) {
  const e = [];
  n && n.isBone && e.push(n);
  for (let t = 0; t < n.children.length; t++)
    e.push.apply(e, sM(n.children[t]));
  return e;
}
class VN extends Xt {
  constructor(e, t, i) {
    const r = new Ps(t, 4, 2), s = new In({ wireframe: !0, fog: !1, toneMapped: !1 });
    super(r, s), this.light = e, this.light.updateMatrixWorld(), this.color = i, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update();
  }
  dispose() {
    this.geometry.dispose(), this.material.dispose();
  }
  update() {
    this.color !== void 0 ? this.material.color.set(this.color) : this.material.color.copy(this.light.color);
  }
}
const GN = /* @__PURE__ */ new Q(), tv = /* @__PURE__ */ new Ue(), nv = /* @__PURE__ */ new Ue();
class HN extends ut {
  constructor(e, t, i) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i;
    const r = new Rs(t);
    r.rotateY(Math.PI * 0.5), this.material = new In({ wireframe: !0, fog: !1, toneMapped: !1 }), this.color === void 0 && (this.material.vertexColors = !0);
    const s = r.getAttribute("position"), o = new Float32Array(s.count * 3);
    r.setAttribute("color", new ot(o, 3)), this.add(new Xt(r, this.material)), this.update();
  }
  dispose() {
    this.children[0].geometry.dispose(), this.children[0].material.dispose();
  }
  update() {
    const e = this.children[0];
    if (this.color !== void 0)
      this.material.color.set(this.color);
    else {
      const t = e.geometry.getAttribute("color");
      tv.copy(this.light.color), nv.copy(this.light.groundColor);
      for (let i = 0, r = t.count; i < r; i++) {
        const s = i < r / 2 ? tv : nv;
        t.setXYZ(i, s.r, s.g, s.b);
      }
      t.needsUpdate = !0;
    }
    e.lookAt(GN.setFromMatrixPosition(this.light.matrixWorld).negate());
  }
}
class oM extends Rn {
  constructor(e = 10, t = 10, i = 4473924, r = 8947848) {
    i = new Ue(i), r = new Ue(r);
    const s = t / 2, o = e / t, a = e / 2, c = [], l = [];
    for (let f = 0, g = 0, p = -a; f <= t; f++, p += o) {
      c.push(-a, 0, p, a, 0, p), c.push(p, 0, -a, p, 0, a);
      const u = f === s ? i : r;
      u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3;
    }
    const d = new Ke();
    d.setAttribute("position", new We(c, 3)), d.setAttribute("color", new We(l, 3));
    const h = new an({ vertexColors: !0, toneMapped: !1 });
    super(d, h), this.type = "GridHelper";
  }
}
class WN extends Rn {
  constructor(e = 10, t = 16, i = 8, r = 64, s = 4473924, o = 8947848) {
    s = new Ue(s), o = new Ue(o);
    const a = [], c = [];
    for (let h = 0; h <= t; h++) {
      const f = h / t * (Math.PI * 2), g = Math.sin(f) * e, p = Math.cos(f) * e;
      a.push(0, 0, 0), a.push(g, 0, p);
      const u = h & 1 ? s : o;
      c.push(u.r, u.g, u.b), c.push(u.r, u.g, u.b);
    }
    for (let h = 0; h <= i; h++) {
      const f = h & 1 ? s : o, g = e - e / i * h;
      for (let p = 0; p < r; p++) {
        let u = p / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g;
        a.push(y, 0, v), c.push(f.r, f.g, f.b), u = (p + 1) / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g, a.push(y, 0, v), c.push(f.r, f.g, f.b);
      }
    }
    const l = new Ke();
    l.setAttribute("position", new We(a, 3)), l.setAttribute("color", new We(c, 3));
    const d = new an({ vertexColors: !0, toneMapped: !1 });
    super(l, d), this.type = "PolarGridHelper";
  }
}
const iv = /* @__PURE__ */ new Q(), pc = /* @__PURE__ */ new Q(), rv = /* @__PURE__ */ new Q();
class jN extends ut {
  constructor(e, t, i) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i, t === void 0 && (t = 1);
    let r = new Ke();
    r.setAttribute("position", new We([
      -t,
      t,
      0,
      t,
      t,
      0,
      t,
      -t,
      0,
      -t,
      -t,
      0,
      -t,
      t,
      0
    ], 3));
    const s = new an({ fog: !1, toneMapped: !1 });
    this.lightPlane = new Oi(r, s), this.add(this.lightPlane), r = new Ke(), r.setAttribute("position", new We([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Oi(r, s), this.add(this.targetLine), this.update();
  }
  dispose() {
    this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose();
  }
  update() {
    iv.setFromMatrixPosition(this.light.matrixWorld), pc.setFromMatrixPosition(this.light.target.matrixWorld), rv.subVectors(pc, iv), this.lightPlane.lookAt(pc), this.color !== void 0 ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(pc), this.targetLine.scale.z = rv.length();
  }
}
const mc = /* @__PURE__ */ new Q(), Bt = /* @__PURE__ */ new hl();
class $N extends Rn {
  constructor(e) {
    const t = new Ke(), i = new an({ color: 16777215, vertexColors: !0, toneMapped: !1 }), r = [], s = [], o = {}, a = new Ue(16755200), c = new Ue(16711680), l = new Ue(43775), d = new Ue(16777215), h = new Ue(3355443);
    f("n1", "n2", a), f("n2", "n4", a), f("n4", "n3", a), f("n3", "n1", a), f("f1", "f2", a), f("f2", "f4", a), f("f4", "f3", a), f("f3", "f1", a), f("n1", "f1", a), f("n2", "f2", a), f("n3", "f3", a), f("n4", "f4", a), f("p", "n1", c), f("p", "n2", c), f("p", "n3", c), f("p", "n4", c), f("u1", "u2", l), f("u2", "u3", l), f("u3", "u1", l), f("c", "t", d), f("p", "c", h), f("cn1", "cn2", h), f("cn3", "cn4", h), f("cf1", "cf2", h), f("cf3", "cf4", h);
    function f(p, u, y) {
      g(p, y), g(u, y);
    }
    function g(p, u) {
      r.push(0, 0, 0), s.push(u.r, u.g, u.b), o[p] === void 0 && (o[p] = []), o[p].push(r.length / 3 - 1);
    }
    t.setAttribute("position", new We(r, 3)), t.setAttribute("color", new We(s, 3)), super(t, i), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = o, this.update();
  }
  update() {
    const e = this.geometry, t = this.pointMap, i = 1, r = 1;
    Bt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), Ht("c", t, e, Bt, 0, 0, -1), Ht("t", t, e, Bt, 0, 0, 1), Ht("n1", t, e, Bt, -i, -r, -1), Ht("n2", t, e, Bt, i, -r, -1), Ht("n3", t, e, Bt, -i, r, -1), Ht("n4", t, e, Bt, i, r, -1), Ht("f1", t, e, Bt, -i, -r, 1), Ht("f2", t, e, Bt, i, -r, 1), Ht("f3", t, e, Bt, -i, r, 1), Ht("f4", t, e, Bt, i, r, 1), Ht("u1", t, e, Bt, i * 0.7, r * 1.1, -1), Ht("u2", t, e, Bt, -i * 0.7, r * 1.1, -1), Ht("u3", t, e, Bt, 0, r * 2, -1), Ht("cf1", t, e, Bt, -i, 0, 1), Ht("cf2", t, e, Bt, i, 0, 1), Ht("cf3", t, e, Bt, 0, -r, 1), Ht("cf4", t, e, Bt, 0, r, 1), Ht("cn1", t, e, Bt, -i, 0, -1), Ht("cn2", t, e, Bt, i, 0, -1), Ht("cn3", t, e, Bt, 0, -r, -1), Ht("cn4", t, e, Bt, 0, r, -1), e.getAttribute("position").needsUpdate = !0;
  }
  dispose() {
    this.geometry.dispose(), this.material.dispose();
  }
}
function Ht(n, e, t, i, r, s, o) {
  mc.set(r, s, o).unproject(i);
  const a = e[n];
  if (a !== void 0) {
    const c = t.getAttribute("position");
    for (let l = 0, d = a.length; l < d; l++)
      c.setXYZ(a[l], mc.x, mc.y, mc.z);
  }
}
const gc = /* @__PURE__ */ new Nn();
class aM extends Rn {
  constructor(e, t = 16776960) {
    const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = new Float32Array(8 * 3), s = new Ke();
    s.setIndex(new ot(i, 1)), s.setAttribute("position", new ot(r, 3)), super(s, new an({ color: t, toneMapped: !1 })), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update();
  }
  update(e) {
    if (e !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && gc.setFromObject(this.object), gc.isEmpty()) return;
    const t = gc.min, i = gc.max, r = this.geometry.attributes.position, s = r.array;
    s[0] = i.x, s[1] = i.y, s[2] = i.z, s[3] = t.x, s[4] = i.y, s[5] = i.z, s[6] = t.x, s[7] = t.y, s[8] = i.z, s[9] = i.x, s[10] = t.y, s[11] = i.z, s[12] = i.x, s[13] = i.y, s[14] = t.z, s[15] = t.x, s[16] = i.y, s[17] = t.z, s[18] = t.x, s[19] = t.y, s[20] = t.z, s[21] = i.x, s[22] = t.y, s[23] = t.z, r.needsUpdate = !0, this.geometry.computeBoundingSphere();
  }
  setFromObject(e) {
    return this.object = e, this.update(), this;
  }
  copy(e) {
    return Rn.prototype.copy.call(this, e), this.object = e.object, this;
  }
}
class ZN extends Rn {
  constructor(e, t = 16776960) {
    const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1], s = new Ke();
    s.setIndex(new ot(i, 1)), s.setAttribute("position", new We(r, 3)), super(s, new an({ color: t, toneMapped: !1 })), this.box = e, this.type = "Box3Helper", this.geometry.computeBoundingSphere();
  }
  updateMatrixWorld(e) {
    const t = this.box;
    t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(0.5), super.updateMatrixWorld(e));
  }
}
class XN extends Oi {
  constructor(e, t = 1, i = 16776960) {
    const r = i, s = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0], o = new Ke();
    o.setAttribute("position", new We(s, 3)), o.computeBoundingSphere(), super(o, new an({ color: r, toneMapped: !1 })), this.type = "PlaneHelper", this.plane = e, this.size = t;
    const a = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1], c = new Ke();
    c.setAttribute("position", new We(a, 3)), c.computeBoundingSphere(), this.add(new Xt(c, new In({ color: r, opacity: 0.2, transparent: !0, depthWrite: !1, toneMapped: !1 })));
  }
  updateMatrixWorld(e) {
    let t = -this.plane.constant;
    Math.abs(t) < 1e-8 && (t = 1e-8), this.scale.set(0.5 * this.size, 0.5 * this.size, t), this.children[0].material.side = t < 0 ? jt : Hr, this.lookAt(this.plane.normal), super.updateMatrixWorld(e);
  }
}
const sv = /* @__PURE__ */ new Q();
let vc, _h;
class YN extends ut {
  // dir is assumed to be normalized
  constructor(e = new Q(0, 0, 1), t = new Q(0, 0, 0), i = 1, r = 16776960, s = i * 0.2, o = s * 0.2) {
    super(), this.type = "ArrowHelper", vc === void 0 && (vc = new Ke(), vc.setAttribute("position", new We([0, 0, 0, 0, 1, 0], 3)), _h = new $r(0, 0.5, 1, 5, 1), _h.translate(0, -0.5, 0)), this.position.copy(t), this.line = new Oi(vc, new an({ color: r, toneMapped: !1 })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new Xt(_h, new In({ color: r, toneMapped: !1 })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(i, s, o);
  }
  setDirection(e) {
    if (e.y > 0.99999)
      this.quaternion.set(0, 0, 0, 1);
    else if (e.y < -0.99999)
      this.quaternion.set(1, 0, 0, 0);
    else {
      sv.set(e.z, 0, -e.x).normalize();
      const t = Math.acos(e.y);
      this.quaternion.setFromAxisAngle(sv, t);
    }
  }
  setLength(e, t = e * 0.2, i = t * 0.2) {
    this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(i, t, i), this.cone.position.y = e, this.cone.updateMatrix();
  }
  setColor(e) {
    this.line.material.color.set(e), this.cone.material.color.set(e);
  }
  copy(e) {
    return super.copy(e, !1), this.line.copy(e.line), this.cone.copy(e.cone), this;
  }
}
class lM extends Rn {
  constructor(e = 1) {
    const t = [
      0,
      0,
      0,
      e,
      0,
      0,
      0,
      0,
      0,
      0,
      e,
      0,
      0,
      0,
      0,
      0,
      0,
      e
    ], i = [
      1,
      0,
      0,
      1,
      0.6,
      0,
      0,
      1,
      0,
      0.6,
      1,
      0,
      0,
      0,
      1,
      0,
      0.6,
      1
    ], r = new Ke();
    r.setAttribute("position", new We(t, 3)), r.setAttribute("color", new We(i, 3));
    const s = new an({ vertexColors: !0, toneMapped: !1 });
    super(r, s), this.type = "AxesHelper";
  }
  setColors(e, t, i) {
    const r = new Ue(), s = this.geometry.attributes.color.array;
    return r.set(e), r.toArray(s, 0), r.toArray(s, 3), r.set(t), r.toArray(s, 6), r.toArray(s, 9), r.set(i), r.toArray(s, 12), r.toArray(s, 15), this.geometry.attributes.color.needsUpdate = !0, this;
  }
  dispose() {
    this.geometry.dispose(), this.material.dispose();
  }
}
const cM = new Float32Array(1), JN = new Int32Array(cM.buffer);
class KN {
  // Converts float32 to float16 (stored as uint16 value).
  static toHalfFloat(e) {
    cM[0] = e;
    const t = JN[0];
    let i = t >> 16 & 32768, r = t >> 12 & 2047;
    const s = t >> 23 & 255;
    return s < 103 ? i : s > 142 ? (i |= 31744, i |= (s == 255 ? 0 : 1) && t & 8388607, i) : s < 113 ? (r |= 2048, i |= (r >> 114 - s) + (r >> 113 - s & 1), i) : (i |= s - 112 << 10 | r >> 1, i += r & 1, i);
  }
}
const bo = 4, Nr = 8, Mi = Math.pow(2, Nr), uM = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], hM = Nr - bo + 1 + uM.length, lo = 20, Ti = {
  [Cn]: 0,
  [Cs]: 1,
  [mu]: 2,
  [Af]: 3,
  [Sf]: 4,
  [_f]: 5,
  [pu]: 6
}, hs = new In({
  side: jt,
  depthWrite: !1,
  depthTest: !1
}), qN = new Xt(new or(), hs), Th = /* @__PURE__ */ new sa(), { _lodPlanes: Ma, _sizeLods: ov, _sigmas: yc } = /* @__PURE__ */ tB(), av = /* @__PURE__ */ new Ue();
let Eh = null;
const ds = (1 + Math.sqrt(5)) / 2, co = 1 / ds, lv = [
  /* @__PURE__ */ new Q(1, 1, 1),
  /* @__PURE__ */ new Q(-1, 1, 1),
  /* @__PURE__ */ new Q(1, 1, -1),
  /* @__PURE__ */ new Q(-1, 1, -1),
  /* @__PURE__ */ new Q(0, ds, co),
  /* @__PURE__ */ new Q(0, ds, -co),
  /* @__PURE__ */ new Q(co, 0, ds),
  /* @__PURE__ */ new Q(-co, 0, ds),
  /* @__PURE__ */ new Q(ds, co, 0),
  /* @__PURE__ */ new Q(-ds, co, 0)
];
function cv(n) {
  const e = Math.max(n.r, n.g, n.b), t = Math.min(Math.max(Math.ceil(Math.log2(e)), -128), 127);
  return n.multiplyScalar(Math.pow(2, -t)), (t + 128) / 255;
}
class QN {
  constructor(e) {
    this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = nB(lo), this._equirectShader = null, this._cubemapShader = null, this._compileMaterial(this._blurMaterial);
  }
  /**
   * Generates a PMREM from a supplied Scene, which can be faster than using an
   * image if networking bandwidth is low. Optional sigma specifies a blur radius
   * in radians to be applied to the scene before PMREM generation. Optional near
   * and far planes ensure the scene is rendered in its entirety (the cubeCamera
   * is placed at the origin).
   */
  fromScene(e, t = 0, i = 0.1, r = 100) {
    Eh = this._renderer.getRenderTarget();
    const s = this._allocateTargets();
    return this._sceneToCubeUV(e, i, r, s), t > 0 && this._blur(s, 0, 0, t), this._applyPMREM(s), this._cleanup(s), s;
  }
  /**
   * Generates a PMREM from an equirectangular texture, which can be either LDR
   * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),
   * as this matches best with the 256 x 256 cubemap output.
   */
  fromEquirectangular(e) {
    return this._fromTexture(e);
  }
  /**
   * Generates a PMREM from an cubemap texture, which can be either LDR
   * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,
   * as this matches best with the 256 x 256 cubemap output.
   */
  fromCubemap(e) {
    return this._fromTexture(e);
  }
  /**
   * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during
   * your texture's network fetch for increased concurrency.
   */
  compileCubemapShader() {
    this._cubemapShader === null && (this._cubemapShader = dv(), this._compileMaterial(this._cubemapShader));
  }
  /**
   * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
   * your texture's network fetch for increased concurrency.
   */
  compileEquirectangularShader() {
    this._equirectShader === null && (this._equirectShader = hv(), this._compileMaterial(this._equirectShader));
  }
  /**
   * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
   * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on
   * one of them will cause any others to also become unusable.
   */
  dispose() {
    this._blurMaterial.dispose(), this._cubemapShader !== null && this._cubemapShader.dispose(), this._equirectShader !== null && this._equirectShader.dispose();
    for (let e = 0; e < Ma.length; e++)
      Ma[e].dispose();
  }
  // private interface
  _cleanup(e) {
    this._pingPongRenderTarget.dispose(), this._renderer.setRenderTarget(Eh), e.scissorTest = !1, bc(e, 0, 0, e.width, e.height);
  }
  _fromTexture(e) {
    Eh = this._renderer.getRenderTarget();
    const t = this._allocateTargets(e);
    return this._textureToCubeUV(e, t), this._applyPMREM(t), this._cleanup(t), t;
  }
  _allocateTargets(e) {
    const t = {
      magFilter: $t,
      minFilter: $t,
      generateMipmaps: !1,
      type: Ts,
      format: ab,
      encoding: eB(e) ? e.encoding : mu,
      depthBuffer: !1
    }, i = uv(t);
    return i.depthBuffer = !e, this._pingPongRenderTarget = uv(t), i;
  }
  _compileMaterial(e) {
    const t = new Xt(Ma[0], e);
    this._renderer.compile(t, Th);
  }
  _sceneToCubeUV(e, t, i, r) {
    const a = new nn(90, 1, t, i), c = [1, -1, 1, 1, 1, 1], l = [1, 1, 1, -1, -1, -1], d = this._renderer, h = d.autoClear, f = d.outputEncoding, g = d.toneMapping;
    d.getClearColor(av), d.toneMapping = Ir, d.outputEncoding = Cn, d.autoClear = !1;
    let p = !1;
    const u = e.background;
    if (u) {
      if (u.isColor) {
        hs.color.copy(u).convertSRGBToLinear(), e.background = null;
        const y = cv(hs.color);
        hs.opacity = y, p = !0;
      }
    } else {
      hs.color.copy(av).convertSRGBToLinear();
      const y = cv(hs.color);
      hs.opacity = y, p = !0;
    }
    for (let y = 0; y < 6; y++) {
      const v = y % 3;
      v == 0 ? (a.up.set(0, c[y], 0), a.lookAt(l[y], 0, 0)) : v == 1 ? (a.up.set(0, 0, c[y]), a.lookAt(0, l[y], 0)) : (a.up.set(0, c[y], 0), a.lookAt(0, 0, l[y])), bc(
        r,
        v * Mi,
        y > 2 ? Mi : 0,
        Mi,
        Mi
      ), d.setRenderTarget(r), p && d.render(qN, a), d.render(e, a);
    }
    d.toneMapping = g, d.outputEncoding = f, d.autoClear = h;
  }
  _textureToCubeUV(e, t) {
    const i = this._renderer;
    e.isCubeTexture ? this._cubemapShader == null && (this._cubemapShader = dv()) : this._equirectShader == null && (this._equirectShader = hv());
    const r = e.isCubeTexture ? this._cubemapShader : this._equirectShader, s = new Xt(Ma[0], r), o = r.uniforms;
    o.envMap.value = e, e.isCubeTexture || o.texelSize.value.set(1 / e.image.width, 1 / e.image.height), o.inputEncoding.value = Ti[e.encoding], o.outputEncoding.value = Ti[t.texture.encoding], bc(t, 0, 0, 3 * Mi, 2 * Mi), i.setRenderTarget(t), i.render(s, Th);
  }
  _applyPMREM(e) {
    const t = this._renderer, i = t.autoClear;
    t.autoClear = !1;
    for (let r = 1; r < hM; r++) {
      const s = Math.sqrt(yc[r] * yc[r] - yc[r - 1] * yc[r - 1]), o = lv[(r - 1) % lv.length];
      this._blur(e, r - 1, r, s, o);
    }
    t.autoClear = i;
  }
  /**
   * This is a two-pass Gaussian blur for a cubemap. Normally this is done
   * vertically and horizontally, but this breaks down on a cube. Here we apply
   * the blur latitudinally (around the poles), and then longitudinally (towards
   * the poles) to approximate the orthogonally-separable blur. It is least
   * accurate at the poles, but still does a decent job.
   */
  _blur(e, t, i, r, s) {
    const o = this._pingPongRenderTarget;
    this._halfBlur(
      e,
      o,
      t,
      i,
      r,
      "latitudinal",
      s
    ), this._halfBlur(
      o,
      e,
      i,
      i,
      r,
      "longitudinal",
      s
    );
  }
  _halfBlur(e, t, i, r, s, o, a) {
    const c = this._renderer, l = this._blurMaterial;
    o !== "latitudinal" && o !== "longitudinal" && console.error(
      "blur direction must be either latitudinal or longitudinal!"
    );
    const d = 3, h = new Xt(Ma[r], l), f = l.uniforms, g = ov[i] - 1, p = isFinite(s) ? Math.PI / (2 * g) : 2 * Math.PI / (2 * lo - 1), u = s / p, y = isFinite(s) ? 1 + Math.floor(d * u) : lo;
    y > lo && console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${lo}`);
    const v = [];
    let m = 0;
    for (let M = 0; M < lo; ++M) {
      const R = M / u, L = Math.exp(-R * R / 2);
      v.push(L), M == 0 ? m += L : M < y && (m += 2 * L);
    }
    for (let M = 0; M < v.length; M++)
      v[M] = v[M] / m;
    f.envMap.value = e.texture, f.samples.value = y, f.weights.value = v, f.latitudinal.value = o === "latitudinal", a && (f.poleAxis.value = a), f.dTheta.value = p, f.mipInt.value = Nr - i, f.inputEncoding.value = Ti[e.texture.encoding], f.outputEncoding.value = Ti[e.texture.encoding];
    const x = ov[r], w = 3 * Math.max(0, Mi - 2 * x), A = (r === 0 ? 0 : 2 * Mi) + 2 * x * (r > Nr - bo ? r - Nr + bo : 0);
    bc(t, w, A, 3 * x, 2 * x), c.setRenderTarget(t), c.render(h, Th);
  }
}
function eB(n) {
  return n === void 0 || n.type !== Ts ? !1 : n.encoding === Cn || n.encoding === Cs || n.encoding === pu;
}
function tB() {
  const n = [], e = [], t = [];
  let i = Nr;
  for (let r = 0; r < hM; r++) {
    const s = Math.pow(2, i);
    e.push(s);
    let o = 1 / s;
    r > Nr - bo ? o = uM[r - Nr + bo - 1] : r == 0 && (o = 0), t.push(o);
    const a = 1 / (s - 1), c = -a / 2, l = 1 + a / 2, d = [c, c, l, c, l, l, c, c, l, l, c, l], h = 6, f = 6, g = 3, p = 2, u = 1, y = new Float32Array(g * f * h), v = new Float32Array(p * f * h), m = new Float32Array(u * f * h);
    for (let w = 0; w < h; w++) {
      const A = w % 3 * 2 / 3 - 1, M = w > 2 ? 0 : -1, R = [
        A,
        M,
        0,
        A + 2 / 3,
        M,
        0,
        A + 2 / 3,
        M + 1,
        0,
        A,
        M,
        0,
        A + 2 / 3,
        M + 1,
        0,
        A,
        M + 1,
        0
      ];
      y.set(R, g * f * w), v.set(d, p * f * w);
      const L = [w, w, w, w, w, w];
      m.set(L, u * f * w);
    }
    const x = new Ke();
    x.setAttribute("position", new ot(y, g)), x.setAttribute("uv", new ot(v, p)), x.setAttribute("faceIndex", new ot(m, u)), n.push(x), i > bo && i--;
  }
  return { _lodPlanes: n, _sizeLods: e, _sigmas: t };
}
function uv(n) {
  const e = new fi(3 * Mi, 3 * Mi, n);
  return e.texture.mapping = ea, e.texture.name = "PMREM.cubeUv", e.scissorTest = !0, e;
}
function bc(n, e, t, i, r) {
  n.viewport.set(e, t, i, r), n.scissor.set(e, t, i, r);
}
function nB(n) {
  const e = new Float32Array(n), t = new Q(0, 1, 0);
  return new ra({
    name: "SphericalGaussianBlur",
    defines: { n },
    uniforms: {
      envMap: { value: null },
      samples: { value: 1 },
      weights: { value: e },
      latitudinal: { value: !1 },
      dTheta: { value: 0 },
      mipInt: { value: 0 },
      poleAxis: { value: t },
      inputEncoding: { value: Ti[Cn] },
      outputEncoding: { value: Ti[Cn] }
    },
    vertexShader: dp(),
    fragmentShader: (
      /* glsl */
      `

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			${fp()}

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

				gl_FragColor = linearToOutputTexel( gl_FragColor );

			}
		`
    ),
    blending: nr,
    depthTest: !1,
    depthWrite: !1
  });
}
function hv() {
  const n = new Re(1, 1);
  return new ra({
    name: "EquirectangularToCubeUV",
    uniforms: {
      envMap: { value: null },
      texelSize: { value: n },
      inputEncoding: { value: Ti[Cn] },
      outputEncoding: { value: Ti[Cn] }
    },
    vertexShader: dp(),
    fragmentShader: (
      /* glsl */
      `

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform vec2 texelSize;

			${fp()}

			#include <common>

			void main() {

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				vec2 f = fract( uv / texelSize - 0.5 );
				uv -= f * texelSize;
				vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
				uv.x += texelSize.x;
				vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
				uv.y += texelSize.y;
				vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
				uv.x -= texelSize.x;
				vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;

				vec3 tm = mix( tl, tr, f.x );
				vec3 bm = mix( bl, br, f.x );
				gl_FragColor.rgb = mix( tm, bm, f.y );

				gl_FragColor = linearToOutputTexel( gl_FragColor );

			}
		`
    ),
    blending: nr,
    depthTest: !1,
    depthWrite: !1
  });
}
function dv() {
  return new ra({
    name: "CubemapToCubeUV",
    uniforms: {
      envMap: { value: null },
      inputEncoding: { value: Ti[Cn] },
      outputEncoding: { value: Ti[Cn] }
    },
    vertexShader: dp(),
    fragmentShader: (
      /* glsl */
      `

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			${fp()}

			void main() {

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
				gl_FragColor = linearToOutputTexel( gl_FragColor );

			}
		`
    ),
    blending: nr,
    depthTest: !1,
    depthWrite: !1
  });
}
function dp() {
  return (
    /* glsl */
    `

		precision mediump float;
		precision mediump int;

		attribute vec3 position;
		attribute vec2 uv;
		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`
  );
}
function fp() {
  return (
    /* glsl */
    `

		uniform int inputEncoding;
		uniform int outputEncoding;

		#include <encodings_pars_fragment>

		vec4 inputTexelToLinear( vec4 value ) {

			if ( inputEncoding == 0 ) {

				return value;

			} else if ( inputEncoding == 1 ) {

				return sRGBToLinear( value );

			} else if ( inputEncoding == 2 ) {

				return RGBEToLinear( value );

			} else if ( inputEncoding == 3 ) {

				return RGBMToLinear( value, 7.0 );

			} else if ( inputEncoding == 4 ) {

				return RGBMToLinear( value, 16.0 );

			} else if ( inputEncoding == 5 ) {

				return RGBDToLinear( value, 256.0 );

			} else {

				return GammaToLinear( value, 2.2 );

			}

		}

		vec4 linearToOutputTexel( vec4 value ) {

			if ( outputEncoding == 0 ) {

				return value;

			} else if ( outputEncoding == 1 ) {

				return LinearTosRGB( value );

			} else if ( outputEncoding == 2 ) {

				return LinearToRGBE( value );

			} else if ( outputEncoding == 3 ) {

				return LinearToRGBM( value, 7.0 );

			} else if ( outputEncoding == 4 ) {

				return LinearToRGBM( value, 16.0 );

			} else if ( outputEncoding == 5 ) {

				return LinearToRGBD( value, 256.0 );

			} else {

				return LinearToGamma( value, 2.2 );

			}

		}

		vec4 envMapTexelToLinear( vec4 color ) {

			return inputTexelToLinear( color );

		}
	`
  );
}
const iB = 0, rB = 1, sB = 0, oB = 1, aB = 2;
function lB(n) {
  return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), n;
}
function cB(n = []) {
  return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), n.isMultiMaterial = !0, n.materials = n, n.clone = function() {
    return n.slice();
  }, n;
}
function uB(n, e) {
  return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new ia(n, e);
}
function hB(n) {
  return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new gl(n);
}
function dB(n, e) {
  return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new ia(n, e);
}
function fB(n) {
  return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new es(n);
}
function pB(n) {
  return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new es(n);
}
function mB(n) {
  return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new es(n);
}
function gB(n, e, t) {
  return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new Q(n, e, t);
}
function vB(n, e) {
  return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new ot(n, e).setUsage(Fo);
}
function yB(n, e) {
  return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new rx(n, e);
}
function bB(n, e) {
  return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new sx(n, e);
}
function xB(n, e) {
  return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new ox(n, e);
}
function MB(n, e) {
  return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new ax(n, e);
}
function wB(n, e) {
  return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new gu(n, e);
}
function AB(n, e) {
  return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new lx(n, e);
}
function SB(n, e) {
  return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new vu(n, e);
}
function _B(n, e) {
  return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new We(n, e);
}
function TB(n, e) {
  return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new ux(n, e);
}
$n.create = function(n, e) {
  return console.log("THREE.Curve.create() has been deprecated"), n.prototype = Object.create($n.prototype), n.prototype.constructor = n, n.prototype.getPoint = e, n;
};
Ja.prototype.fromPoints = function(n) {
  return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(n);
};
function EB(n) {
  return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new lM(n);
}
function CB(n, e) {
  return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new aM(n, e);
}
function LB(n, e) {
  return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new Rn(new Of(n.geometry), new an({ color: e !== void 0 ? e : 16777215 }));
}
oM.prototype.setColors = function() {
  console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.");
};
rM.prototype.update = function() {
  console.error("THREE.SkeletonHelper: update() no longer needs to be called.");
};
function RB(n, e) {
  return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new Rn(new Vf(n.geometry), new an({ color: e !== void 0 ? e : 16777215 }));
}
xn.prototype.extractUrlBase = function(n) {
  return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), rr.extractUrlBase(n);
};
xn.Handlers = {
  add: function() {
    console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.");
  },
  get: function() {
    console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.");
  }
};
function FB(n) {
  return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new Zn(n);
}
function PB(n) {
  return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Ux(n);
}
oa.prototype.center = function(n) {
  return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(n);
};
oa.prototype.empty = function() {
  return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
oa.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
oa.prototype.size = function(n) {
  return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(n);
};
Nn.prototype.center = function(n) {
  return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(n);
};
Nn.prototype.empty = function() {
  return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
Nn.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
Nn.prototype.isIntersectionSphere = function(n) {
  return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n);
};
Nn.prototype.size = function(n) {
  return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(n);
};
mr.prototype.empty = function() {
  return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
dl.prototype.setFromMatrix = function(n) {
  return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(n);
};
nM.prototype.center = function(n) {
  return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(n);
};
rn.prototype.flattenToArrayOffset = function(n, e) {
  return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e);
};
rn.prototype.multiplyVector3 = function(n) {
  return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), n.applyMatrix3(this);
};
rn.prototype.multiplyVector3Array = function() {
  console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.");
};
rn.prototype.applyToBufferAttribute = function(n) {
  return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."), n.applyMatrix3(this);
};
rn.prototype.applyToVector3Array = function() {
  console.error("THREE.Matrix3: .applyToVector3Array() has been removed.");
};
rn.prototype.getInverse = function(n) {
  return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert();
};
Xe.prototype.extractPosition = function(n) {
  return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(n);
};
Xe.prototype.flattenToArrayOffset = function(n, e) {
  return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e);
};
Xe.prototype.getPosition = function() {
  return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), new Q().setFromMatrixColumn(this, 3);
};
Xe.prototype.setRotationFromQuaternion = function(n) {
  return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(n);
};
Xe.prototype.multiplyToArray = function() {
  console.warn("THREE.Matrix4: .multiplyToArray() has been removed.");
};
Xe.prototype.multiplyVector3 = function(n) {
  return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Xe.prototype.multiplyVector4 = function(n) {
  return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Xe.prototype.multiplyVector3Array = function() {
  console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.");
};
Xe.prototype.rotateAxis = function(n) {
  console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), n.transformDirection(this);
};
Xe.prototype.crossVector = function(n) {
  return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Xe.prototype.translate = function() {
  console.error("THREE.Matrix4: .translate() has been removed.");
};
Xe.prototype.rotateX = function() {
  console.error("THREE.Matrix4: .rotateX() has been removed.");
};
Xe.prototype.rotateY = function() {
  console.error("THREE.Matrix4: .rotateY() has been removed.");
};
Xe.prototype.rotateZ = function() {
  console.error("THREE.Matrix4: .rotateZ() has been removed.");
};
Xe.prototype.rotateByAxis = function() {
  console.error("THREE.Matrix4: .rotateByAxis() has been removed.");
};
Xe.prototype.applyToBufferAttribute = function(n) {
  return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Xe.prototype.applyToVector3Array = function() {
  console.error("THREE.Matrix4: .applyToVector3Array() has been removed.");
};
Xe.prototype.makeFrustum = function(n, e, t, i, r, s) {
  return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(n, e, i, t, r, s);
};
Xe.prototype.getInverse = function(n) {
  return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert();
};
wi.prototype.isIntersectionLine = function(n) {
  return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(n);
};
bn.prototype.multiplyVector3 = function(n) {
  return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), n.applyQuaternion(this);
};
bn.prototype.inverse = function() {
  return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."), this.invert();
};
qr.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
qr.prototype.isIntersectionPlane = function(n) {
  return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(n);
};
qr.prototype.isIntersectionSphere = function(n) {
  return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n);
};
Zt.prototype.area = function() {
  return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea();
};
Zt.prototype.barycoordFromPoint = function(n, e) {
  return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(n, e);
};
Zt.prototype.midpoint = function(n) {
  return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(n);
};
Zt.prototypenormal = function(n) {
  return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(n);
};
Zt.prototype.plane = function(n) {
  return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(n);
};
Zt.barycoordFromPoint = function(n, e, t, i, r) {
  return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), Zt.getBarycoord(n, e, t, i, r);
};
Zt.normal = function(n, e, t, i) {
  return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), Zt.getNormal(n, e, t, i);
};
Dr.prototype.extractAllPoints = function(n) {
  return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(n);
};
Dr.prototype.extrude = function(n) {
  return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new mi(this, n);
};
Dr.prototype.makeGeometry = function(n) {
  return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new Fs(this, n);
};
Re.prototype.fromAttribute = function(n, e, t) {
  return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t);
};
Re.prototype.distanceToManhattan = function(n) {
  return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n);
};
Re.prototype.lengthManhattan = function() {
  return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength();
};
Q.prototype.setEulerFromRotationMatrix = function() {
  console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.");
};
Q.prototype.setEulerFromQuaternion = function() {
  console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.");
};
Q.prototype.getPositionFromMatrix = function(n) {
  return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(n);
};
Q.prototype.getScaleFromMatrix = function(n) {
  return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(n);
};
Q.prototype.getColumnFromMatrix = function(n, e) {
  return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(e, n);
};
Q.prototype.applyProjection = function(n) {
  return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(n);
};
Q.prototype.fromAttribute = function(n, e, t) {
  return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t);
};
Q.prototype.distanceToManhattan = function(n) {
  return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n);
};
Q.prototype.lengthManhattan = function() {
  return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength();
};
xt.prototype.fromAttribute = function(n, e, t) {
  return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t);
};
xt.prototype.lengthManhattan = function() {
  return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength();
};
ut.prototype.getChildByName = function(n) {
  return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(n);
};
ut.prototype.renderDepth = function() {
  console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.");
};
ut.prototype.translate = function(n, e) {
  return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, n);
};
ut.prototype.getWorldRotation = function() {
  console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.");
};
ut.prototype.applyMatrix = function(n) {
  return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n);
};
Object.defineProperties(ut.prototype, {
  eulerOrder: {
    get: function() {
      return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order;
    },
    set: function(n) {
      console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = n;
    }
  },
  useQuaternion: {
    get: function() {
      console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.");
    },
    set: function() {
      console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.");
    }
  }
});
Xt.prototype.setDrawMode = function() {
  console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.");
};
Object.defineProperties(Xt.prototype, {
  drawMode: {
    get: function() {
      return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), Zb;
    },
    set: function() {
      console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.");
    }
  }
});
vl.prototype.initBones = function() {
  console.error("THREE.SkinnedMesh: initBones() has been removed.");
};
nn.prototype.setLens = function(n, e) {
  console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), e !== void 0 && (this.filmGauge = e), this.setFocalLength(n);
};
Object.defineProperties(gi.prototype, {
  onlyShadow: {
    set: function() {
      console.warn("THREE.Light: .onlyShadow has been removed.");
    }
  },
  shadowCameraFov: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = n;
    }
  },
  shadowCameraLeft: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = n;
    }
  },
  shadowCameraRight: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = n;
    }
  },
  shadowCameraTop: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = n;
    }
  },
  shadowCameraBottom: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = n;
    }
  },
  shadowCameraNear: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = n;
    }
  },
  shadowCameraFar: {
    set: function(n) {
      console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = n;
    }
  },
  shadowCameraVisible: {
    set: function() {
      console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.");
    }
  },
  shadowBias: {
    set: function(n) {
      console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = n;
    }
  },
  shadowDarkness: {
    set: function() {
      console.warn("THREE.Light: .shadowDarkness has been removed.");
    }
  },
  shadowMapWidth: {
    set: function(n) {
      console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = n;
    }
  },
  shadowMapHeight: {
    set: function(n) {
      console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = n;
    }
  }
});
Object.defineProperties(ot.prototype, {
  length: {
    get: function() {
      return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."), this.array.length;
    }
  },
  dynamic: {
    get: function() {
      return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.usage === Fo;
    },
    set: function() {
      console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(Fo);
    }
  }
});
ot.prototype.setDynamic = function(n) {
  return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Fo : Ro), this;
};
ot.prototype.copyIndicesArray = function() {
  console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.");
}, ot.prototype.setArray = function() {
  console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers");
};
Ke.prototype.addIndex = function(n) {
  console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(n);
};
Ke.prototype.addAttribute = function(n, e) {
  return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."), !(e && e.isBufferAttribute) && !(e && e.isInterleavedBufferAttribute) ? (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."), this.setAttribute(n, new ot(arguments[1], arguments[2]))) : n === "index" ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), this.setIndex(e), this) : this.setAttribute(n, e);
};
Ke.prototype.addDrawCall = function(n, e, t) {
  t !== void 0 && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(n, e);
};
Ke.prototype.clearDrawCalls = function() {
  console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups();
};
Ke.prototype.computeOffsets = function() {
  console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.");
};
Ke.prototype.removeAttribute = function(n) {
  return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."), this.deleteAttribute(n);
};
Ke.prototype.applyMatrix = function(n) {
  return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n);
};
Object.defineProperties(Ke.prototype, {
  drawcalls: {
    get: function() {
      return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."), this.groups;
    }
  },
  offsets: {
    get: function() {
      return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."), this.groups;
    }
  }
});
Qr.prototype.setDynamic = function(n) {
  return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Fo : Ro), this;
};
Qr.prototype.setArray = function() {
  console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers");
};
mi.prototype.getArrays = function() {
  console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.");
};
mi.prototype.addShapeList = function() {
  console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.");
};
mi.prototype.addShape = function() {
  console.error("THREE.ExtrudeGeometry: .addShape() has been removed.");
};
wu.prototype.dispose = function() {
  console.error("THREE.Scene: .dispose() has been removed.");
};
Fu.prototype.onUpdate = function() {
  return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this;
};
Object.defineProperties(tn.prototype, {
  wrapAround: {
    get: function() {
      console.warn("THREE.Material: .wrapAround has been removed.");
    },
    set: function() {
      console.warn("THREE.Material: .wrapAround has been removed.");
    }
  },
  overdraw: {
    get: function() {
      console.warn("THREE.Material: .overdraw has been removed.");
    },
    set: function() {
      console.warn("THREE.Material: .overdraw has been removed.");
    }
  },
  wrapRGB: {
    get: function() {
      return console.warn("THREE.Material: .wrapRGB has been removed."), new Ue();
    }
  },
  shading: {
    get: function() {
      console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead.");
    },
    set: function(n) {
      console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = n === yf;
    }
  },
  stencilMask: {
    get: function() {
      return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask;
    },
    set: function(n) {
      console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask = n;
    }
  }
});
Object.defineProperties(ar.prototype, {
  derivatives: {
    get: function() {
      return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives;
    },
    set: function(n) {
      console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = n;
    }
  }
});
wt.prototype.clearTarget = function(n, e, t, i) {
  console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."), this.setRenderTarget(n), this.clear(e, t, i);
};
wt.prototype.animate = function(n) {
  console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(n);
};
wt.prototype.getCurrentRenderTarget = function() {
  return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget();
};
wt.prototype.getMaxAnisotropy = function() {
  return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy();
};
wt.prototype.getPrecision = function() {
  return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision;
};
wt.prototype.resetGLState = function() {
  return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset();
};
wt.prototype.supportsFloatTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float");
};
wt.prototype.supportsHalfFloatTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float");
};
wt.prototype.supportsStandardDerivatives = function() {
  return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives");
};
wt.prototype.supportsCompressedTextureS3TC = function() {
  return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc");
};
wt.prototype.supportsCompressedTexturePVRTC = function() {
  return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc");
};
wt.prototype.supportsBlendMinMax = function() {
  return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax");
};
wt.prototype.supportsVertexTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures;
};
wt.prototype.supportsInstancedArrays = function() {
  return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays");
};
wt.prototype.enableScissorTest = function(n) {
  console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(n);
};
wt.prototype.initMaterial = function() {
  console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.");
};
wt.prototype.addPrePlugin = function() {
  console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.");
};
wt.prototype.addPostPlugin = function() {
  console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.");
};
wt.prototype.updateShadowMap = function() {
  console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.");
};
wt.prototype.setFaceCulling = function() {
  console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.");
};
wt.prototype.allocTextureUnit = function() {
  console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.");
};
wt.prototype.setTexture = function() {
  console.warn("THREE.WebGLRenderer: .setTexture() has been removed.");
};
wt.prototype.setTexture2D = function() {
  console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.");
};
wt.prototype.setTextureCube = function() {
  console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.");
};
wt.prototype.getActiveMipMapLevel = function() {
  return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."), this.getActiveMipmapLevel();
};
Object.defineProperties(wt.prototype, {
  shadowMapEnabled: {
    get: function() {
      return this.shadowMap.enabled;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = n;
    }
  },
  shadowMapType: {
    get: function() {
      return this.shadowMap.type;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = n;
    }
  },
  shadowMapCullFace: {
    get: function() {
      console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.");
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.");
    }
  },
  context: {
    get: function() {
      return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."), this.getContext();
    }
  },
  vr: {
    get: function() {
      return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"), this.xr;
    }
  },
  gammaInput: {
    get: function() {
      return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."), !1;
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.");
    }
  },
  gammaOutput: {
    get: function() {
      return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), !1;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = n === !0 ? Cs : Cn;
    }
  },
  toneMappingWhitePoint: {
    get: function() {
      return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."), 1;
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.");
    }
  }
});
Object.defineProperties(Mx.prototype, {
  cullFace: {
    get: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.");
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.");
    }
  },
  renderReverseSided: {
    get: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.");
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.");
    }
  },
  renderSingleSided: {
    get: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.");
    },
    set: function() {
      console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.");
    }
  }
});
function IB(n, e, t) {
  return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new bu(n, t);
}
Object.defineProperties(fi.prototype, {
  wrapS: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = n;
    }
  },
  wrapT: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = n;
    }
  },
  magFilter: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = n;
    }
  },
  minFilter: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = n;
    }
  },
  anisotropy: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = n;
    }
  },
  offset: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = n;
    }
  },
  repeat: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = n;
    }
  },
  format: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = n;
    }
  },
  type: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = n;
    }
  },
  generateMipmaps: {
    get: function() {
      return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = n;
    }
  }
});
cp.prototype.load = function(n) {
  console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");
  const e = this;
  return new $x().load(n, function(i) {
    e.setBuffer(i);
  }), this;
};
Jx.prototype.getData = function() {
  return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData();
};
yu.prototype.updateCubeMap = function(n, e) {
  return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(n, e);
};
yu.prototype.clear = function(n, e, t, i) {
  return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(n, e, t, i);
};
Bs.crossOrigin = void 0;
Bs.loadTexture = function(n, e, t, i) {
  console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");
  const r = new qf();
  r.setCrossOrigin(this.crossOrigin);
  const s = r.load(n, t, void 0, i);
  return e && (s.mapping = e), s;
};
Bs.loadTextureCube = function(n, e, t, i) {
  console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
  const r = new Bx();
  r.setCrossOrigin(this.crossOrigin);
  const s = r.load(n, t, void 0, i);
  return e && (s.mapping = e), s;
};
Bs.loadCompressedTexture = function() {
  console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.");
};
Bs.loadCompressedTextureCube = function() {
  console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.");
};
function OB() {
  console.error("THREE.CanvasRenderer has been removed");
}
function DB() {
  console.error("THREE.JSONLoader has been removed.");
}
const NB = {
  createMultiMaterialObject: function() {
    console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js");
  },
  detach: function() {
    console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js");
  },
  attach: function() {
    console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js");
  }
};
function BB() {
  console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js");
}
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: {
  revision: gf
} }));
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = gf);
const UB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ACESFilmicToneMapping: Jy,
  AddEquation: ps,
  AddOperation: $y,
  AdditiveAnimationBlendMode: Mf,
  AdditiveBlending: id,
  AlphaFormat: rb,
  AlwaysDepth: zy,
  AlwaysStencilFunc: Qb,
  AmbientLight: tp,
  AmbientLightProbe: Xx,
  AnimationClip: jo,
  AnimationLoader: mN,
  AnimationMixer: Qx,
  AnimationObjectGroup: qx,
  AnimationUtils: Ct,
  ArcCurve: Df,
  ArrayCamera: Ff,
  ArrowHelper: YN,
  Audio: cp,
  AudioAnalyser: Jx,
  AudioContext: lp,
  AudioListener: SN,
  AudioLoader: $x,
  AxesHelper: lM,
  AxisHelper: EB,
  BackSide: jt,
  BasicDepthPacking: Jb,
  BasicShadowMap: L3,
  BinaryTextureLoader: PB,
  Bone: yl,
  BooleanKeyframeTrack: ks,
  BoundingBoxHelper: CB,
  Box2: oa,
  Box3: Nn,
  Box3Helper: ZN,
  BoxBufferGeometry: or,
  BoxGeometry: or,
  BoxHelper: aM,
  BufferAttribute: ot,
  BufferGeometry: Ke,
  BufferGeometryLoader: Wx,
  ByteType: qy,
  Cache: Is,
  Camera: hl,
  CameraHelper: $N,
  CanvasRenderer: OB,
  CanvasTexture: Ex,
  CatmullRomCurve3: Bf,
  CineonToneMapping: Yy,
  CircleBufferGeometry: Io,
  CircleGeometry: Io,
  ClampToEdgeWrapping: hn,
  Clock: Yx,
  Color: Ue,
  ColorKeyframeTrack: Jf,
  CompressedTexture: If,
  CompressedTextureLoader: gN,
  ConeBufferGeometry: Oo,
  ConeGeometry: Oo,
  CubeCamera: yu,
  CubeReflectionMapping: ll,
  CubeRefractionMapping: cl,
  CubeTexture: ta,
  CubeTextureLoader: Bx,
  CubeUVReflectionMapping: ea,
  CubeUVRefractionMapping: ul,
  CubicBezierCurve: Su,
  CubicBezierCurve3: Uf,
  CubicInterpolant: Ix,
  CullFaceBack: nd,
  CullFaceFront: Sy,
  CullFaceFrontBack: C3,
  CullFaceNone: Ay,
  Curve: $n,
  CurvePath: zx,
  CustomBlending: Ty,
  CustomToneMapping: Ky,
  CylinderBufferGeometry: $r,
  CylinderGeometry: $r,
  Cylindrical: zN,
  DataTexture: Ss,
  DataTexture2DArray: Lf,
  DataTexture3D: Rf,
  DataTextureLoader: Ux,
  DataUtils: KN,
  DecrementStencilOp: U3,
  DecrementWrapStencilOp: k3,
  DefaultLoadingManager: Nx,
  DepthFormat: ws,
  DepthStencilFormat: Co,
  DepthTexture: Cx,
  DirectionalLight: Ru,
  DirectionalLightHelper: jN,
  DiscreteInterpolant: Ox,
  DodecahedronBufferGeometry: Do,
  DodecahedronGeometry: Do,
  DoubleSide: Wr,
  DstAlphaFactor: Iy,
  DstColorFactor: Dy,
  DynamicBufferAttribute: vB,
  DynamicCopyUsage: eF,
  DynamicDrawUsage: Fo,
  DynamicReadUsage: K3,
  EdgesGeometry: Of,
  EdgesHelper: LB,
  EllipseCurve: xl,
  EqualDepth: Vy,
  EqualStencilFunc: W3,
  EquirectangularReflectionMapping: Vc,
  EquirectangularRefractionMapping: Gc,
  Euler: Us,
  EventDispatcher: Kr,
  ExtrudeBufferGeometry: mi,
  ExtrudeGeometry: mi,
  FaceColors: oB,
  FileLoader: Zn,
  FlatShading: yf,
  Float16BufferAttribute: cx,
  Float32Attribute: _B,
  Float32BufferAttribute: We,
  Float64Attribute: TB,
  Float64BufferAttribute: ux,
  FloatType: Qi,
  Fog: pl,
  FogExp2: fl,
  Font: ap,
  FontLoader: MN,
  FrontSide: Hr,
  Frustum: dl,
  GLBufferAttribute: tM,
  GLSL1: nF,
  GLSL3: yd,
  GammaEncoding: pu,
  GreaterDepth: Hy,
  GreaterEqualDepth: Gy,
  GreaterEqualStencilFunc: X3,
  GreaterStencilFunc: $3,
  GridHelper: oM,
  Group: _i,
  HalfFloatType: Ms,
  HemisphereLight: Qf,
  HemisphereLightHelper: HN,
  HemisphereLightProbe: Zx,
  IcosahedronBufferGeometry: No,
  IcosahedronGeometry: No,
  ImageBitmapLoader: op,
  ImageLoader: Ya,
  ImageUtils: Bs,
  ImmediateRenderObject: iM,
  IncrementStencilOp: B3,
  IncrementWrapStencilOp: z3,
  InstancedBufferAttribute: sp,
  InstancedBufferGeometry: rp,
  InstancedInterleavedBuffer: eM,
  InstancedMesh: Pf,
  Int16Attribute: MB,
  Int16BufferAttribute: ax,
  Int32Attribute: AB,
  Int32BufferAttribute: lx,
  Int8Attribute: yB,
  Int8BufferAttribute: rx,
  IntType: eb,
  InterleavedBuffer: Qr,
  InterleavedBufferAttribute: lr,
  Interpolant: Ni,
  InterpolateDiscrete: Lo,
  InterpolateLinear: Es,
  InterpolateSmooth: Cc,
  InvertStencilOp: V3,
  JSONLoader: DB,
  KeepStencilOp: Lc,
  KeyframeTrack: xi,
  LOD: _x,
  LatheBufferGeometry: Bo,
  LatheGeometry: Bo,
  Layers: Cf,
  LensFlare: BB,
  LessDepth: ky,
  LessEqualDepth: kc,
  LessEqualStencilFunc: j3,
  LessStencilFunc: H3,
  Light: gi,
  LightProbe: Al,
  Line: Oi,
  Line3: nM,
  LineBasicMaterial: an,
  LineCurve: Ml,
  LineCurve3: Lx,
  LineDashedMaterial: Xf,
  LineLoop: Au,
  LinePieces: rB,
  LineSegments: Rn,
  LineStrip: iB,
  LinearEncoding: Cn,
  LinearFilter: zt,
  LinearInterpolant: Yf,
  LinearMipMapLinearFilter: O3,
  LinearMipMapNearestFilter: I3,
  LinearMipmapLinearFilter: pr,
  LinearMipmapNearestFilter: du,
  LinearToneMapping: Zy,
  Loader: xn,
  LoaderUtils: rr,
  LoadingManager: Kf,
  LogLuvEncoding: Yb,
  LoopOnce: Wb,
  LoopPingPong: $b,
  LoopRepeat: jb,
  LuminanceAlphaFormat: ob,
  LuminanceFormat: sb,
  MOUSE: T3,
  Material: tn,
  MaterialLoader: Hx,
  Math: xd,
  MathUtils: xd,
  Matrix3: rn,
  Matrix4: Xe,
  MaxEquation: ad,
  Mesh: Xt,
  MeshBasicMaterial: In,
  MeshDepthMaterial: xu,
  MeshDistanceMaterial: Mu,
  MeshFaceMaterial: lB,
  MeshLambertMaterial: $f,
  MeshMatcapMaterial: Zf,
  MeshNormalMaterial: jf,
  MeshPhongMaterial: Hf,
  MeshPhysicalMaterial: wl,
  MeshStandardMaterial: zs,
  MeshToonMaterial: Wf,
  MinEquation: od,
  MirroredRepeatWrapping: Eo,
  MixOperation: jy,
  MultiMaterial: cB,
  MultiplyBlending: sd,
  MultiplyOperation: al,
  NearestFilter: $t,
  NearestMipMapLinearFilter: P3,
  NearestMipMapNearestFilter: F3,
  NearestMipmapLinearFilter: Ga,
  NearestMipmapNearestFilter: Va,
  NeverDepth: Uy,
  NeverStencilFunc: G3,
  NoBlending: nr,
  NoColors: sB,
  NoToneMapping: Ir,
  NormalAnimationBlendMode: fu,
  NormalBlending: vo,
  NotEqualDepth: Wy,
  NotEqualStencilFunc: Z3,
  NumberKeyframeTrack: Ho,
  Object3D: ut,
  ObjectLoader: vN,
  ObjectSpaceNormalMap: qb,
  OctahedronBufferGeometry: Rs,
  OctahedronGeometry: Rs,
  OneFactor: Ry,
  OneMinusDstAlphaFactor: Oy,
  OneMinusDstColorFactor: Ny,
  OneMinusSrcAlphaFactor: xf,
  OneMinusSrcColorFactor: Py,
  OrthographicCamera: sa,
  PCFShadowMap: vf,
  PCFSoftShadowMap: _y,
  PMREMGenerator: QN,
  ParametricBufferGeometry: Hc,
  ParametricGeometry: Hc,
  Particle: hB,
  ParticleBasicMaterial: pB,
  ParticleSystem: dB,
  ParticleSystemMaterial: mB,
  Path: Ja,
  PerspectiveCamera: nn,
  Plane: wi,
  PlaneBufferGeometry: Ls,
  PlaneGeometry: Ls,
  PlaneHelper: XN,
  PointCloud: uB,
  PointCloudMaterial: fB,
  PointLight: Lu,
  PointLightHelper: VN,
  Points: ia,
  PointsMaterial: es,
  PolarGridHelper: WN,
  PolyhedronBufferGeometry: Di,
  PolyhedronGeometry: Di,
  PositionalAudio: TN,
  PropertyBinding: mt,
  PropertyMixer: Kx,
  QuadraticBezierCurve: _u,
  QuadraticBezierCurve3: zf,
  Quaternion: bn,
  QuaternionKeyframeTrack: Vs,
  QuaternionLinearInterpolant: Dx,
  REVISION: gf,
  RGBADepthPacking: Kb,
  RGBAFormat: Hn,
  RGBAIntegerFormat: fb,
  RGBA_ASTC_10x10_Format: Tb,
  RGBA_ASTC_10x5_Format: Ab,
  RGBA_ASTC_10x6_Format: Sb,
  RGBA_ASTC_10x8_Format: _b,
  RGBA_ASTC_12x10_Format: Eb,
  RGBA_ASTC_12x12_Format: Cb,
  RGBA_ASTC_4x4_Format: mb,
  RGBA_ASTC_5x4_Format: gb,
  RGBA_ASTC_5x5_Format: vb,
  RGBA_ASTC_6x5_Format: yb,
  RGBA_ASTC_6x6_Format: bb,
  RGBA_ASTC_8x5_Format: xb,
  RGBA_ASTC_8x6_Format: Mb,
  RGBA_ASTC_8x8_Format: wb,
  RGBA_BPTC_Format: Lb,
  RGBA_ETC2_EAC_Format: vd,
  RGBA_PVRTC_2BPPV1_Format: md,
  RGBA_PVRTC_4BPPV1_Format: pd,
  RGBA_S3TC_DXT1_Format: cd,
  RGBA_S3TC_DXT3_Format: ud,
  RGBA_S3TC_DXT5_Format: hd,
  RGBDEncoding: _f,
  RGBEEncoding: mu,
  RGBEFormat: ab,
  RGBFormat: ir,
  RGBIntegerFormat: db,
  RGBM16Encoding: Sf,
  RGBM7Encoding: Af,
  RGB_ETC1_Format: pb,
  RGB_ETC2_Format: gd,
  RGB_PVRTC_2BPPV1_Format: fd,
  RGB_PVRTC_4BPPV1_Format: dd,
  RGB_S3TC_DXT1_Format: ld,
  RGFormat: ub,
  RGIntegerFormat: hb,
  RawShaderMaterial: ra,
  Ray: qr,
  Raycaster: BN,
  RectAreaLight: np,
  RedFormat: lb,
  RedIntegerFormat: cb,
  ReinhardToneMapping: Xy,
  RepeatWrapping: jr,
  ReplaceStencilOp: N3,
  ReverseSubtractEquation: Cy,
  RingBufferGeometry: Uo,
  RingGeometry: Uo,
  SRGB8_ALPHA8_ASTC_10x10_Format: Vb,
  SRGB8_ALPHA8_ASTC_10x5_Format: Ub,
  SRGB8_ALPHA8_ASTC_10x6_Format: zb,
  SRGB8_ALPHA8_ASTC_10x8_Format: kb,
  SRGB8_ALPHA8_ASTC_12x10_Format: Gb,
  SRGB8_ALPHA8_ASTC_12x12_Format: Hb,
  SRGB8_ALPHA8_ASTC_4x4_Format: Rb,
  SRGB8_ALPHA8_ASTC_5x4_Format: Fb,
  SRGB8_ALPHA8_ASTC_5x5_Format: Pb,
  SRGB8_ALPHA8_ASTC_6x5_Format: Ib,
  SRGB8_ALPHA8_ASTC_6x6_Format: Ob,
  SRGB8_ALPHA8_ASTC_8x5_Format: Db,
  SRGB8_ALPHA8_ASTC_8x6_Format: Nb,
  SRGB8_ALPHA8_ASTC_8x8_Format: Bb,
  Scene: wu,
  SceneUtils: NB,
  ShaderChunk: dt,
  ShaderLib: ci,
  ShaderMaterial: ar,
  ShadowMaterial: Gf,
  Shape: Dr,
  ShapeBufferGeometry: Fs,
  ShapeGeometry: Fs,
  ShapePath: jx,
  ShapeUtils: Fi,
  ShortType: Qy,
  Skeleton: bl,
  SkeletonHelper: rM,
  SkinnedMesh: vl,
  SmoothShading: R3,
  Sphere: mr,
  SphereBufferGeometry: Ps,
  SphereGeometry: Ps,
  Spherical: UN,
  SphericalHarmonics3: ip,
  SplineCurve: Tu,
  SpotLight: Cu,
  SpotLightHelper: kN,
  Sprite: gl,
  SpriteMaterial: ml,
  SrcAlphaFactor: bf,
  SrcAlphaSaturateFactor: By,
  SrcColorFactor: Fy,
  StaticCopyUsage: Q3,
  StaticDrawUsage: Ro,
  StaticReadUsage: J3,
  StereoCamera: wN,
  StreamCopyUsage: tF,
  StreamDrawUsage: Y3,
  StreamReadUsage: q3,
  StringKeyframeTrack: Gs,
  SubtractEquation: Ey,
  SubtractiveBlending: rd,
  TOUCH: E3,
  TangentSpaceNormalMap: Jr,
  TetrahedronBufferGeometry: zo,
  TetrahedronGeometry: zo,
  TextBufferGeometry: Wc,
  TextGeometry: Wc,
  Texture: Yt,
  TextureLoader: qf,
  TorusBufferGeometry: ko,
  TorusGeometry: ko,
  TorusKnotBufferGeometry: Vo,
  TorusKnotGeometry: Vo,
  Triangle: Zt,
  TriangleFanDrawMode: wf,
  TriangleStripDrawMode: Xb,
  TrianglesDrawMode: Zb,
  TubeBufferGeometry: Go,
  TubeGeometry: Go,
  UVMapping: hu,
  Uint16Attribute: wB,
  Uint16BufferAttribute: gu,
  Uint32Attribute: SB,
  Uint32BufferAttribute: vu,
  Uint8Attribute: bB,
  Uint8BufferAttribute: sx,
  Uint8ClampedAttribute: xB,
  Uint8ClampedBufferAttribute: ox,
  Uniform: Fu,
  UniformsLib: ze,
  UniformsUtils: dx,
  UnsignedByteType: Ts,
  UnsignedInt248Type: yo,
  UnsignedIntType: Ra,
  UnsignedShort4444Type: tb,
  UnsignedShort5551Type: nb,
  UnsignedShort565Type: ib,
  UnsignedShortType: Ha,
  VSMShadowMap: po,
  Vector2: Re,
  Vector3: Q,
  Vector4: xt,
  VectorKeyframeTrack: Wo,
  Vertex: gB,
  VertexColors: aB,
  VideoTexture: Tx,
  WebGL1Renderer: Ax,
  WebGLCubeRenderTarget: bu,
  WebGLMultipleRenderTargets: nx,
  WebGLMultisampleRenderTarget: Ef,
  WebGLRenderTarget: fi,
  WebGLRenderTargetCube: IB,
  WebGLRenderer: wt,
  WebGLUtils: wx,
  WireframeGeometry: Vf,
  WireframeHelper: RB,
  WrapAroundEnding: Wa,
  XHRLoader: FB,
  ZeroCurvatureEnding: gs,
  ZeroFactor: Ly,
  ZeroSlopeEnding: vs,
  ZeroStencilOp: D3,
  sRGBEncoding: Cs
}, Symbol.toStringTag, { value: "Module" })), zB = /* @__PURE__ */ au(UB);
function kB(n, e) {
  if (!(n instanceof e))
    throw new TypeError("Cannot call a class as a function");
}
function VB(n, e) {
  for (var t = 0; t < e.length; t++) {
    var i = e[t];
    i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, i.key, i);
  }
}
function GB(n, e, t) {
  return e && VB(n.prototype, e), n;
}
function HB(n, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Super expression must either be null or a function");
  n.prototype = Object.create(e && e.prototype, {
    constructor: {
      value: n,
      writable: !0,
      configurable: !0
    }
  }), e && Td(n, e);
}
function jc(n) {
  return jc = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) {
    return t.__proto__ || Object.getPrototypeOf(t);
  }, jc(n);
}
function Td(n, e) {
  return Td = Object.setPrototypeOf || function(i, r) {
    return i.__proto__ = r, i;
  }, Td(n, e);
}
function WB() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
  if (typeof Proxy == "function") return !0;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), !0;
  } catch {
    return !1;
  }
}
function jB(n) {
  if (n === void 0)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return n;
}
function $B(n, e) {
  return e && (typeof e == "object" || typeof e == "function") ? e : jB(n);
}
function ZB(n) {
  var e = WB();
  return function() {
    var i = jc(n), r;
    if (e) {
      var s = jc(this).constructor;
      r = Reflect.construct(i, arguments, s);
    } else
      r = i.apply(this, arguments);
    return $B(this, r);
  };
}
function fv(n, e) {
  return YB(n) || KB(n, e) || dM(n, e) || QB();
}
function xc(n) {
  return XB(n) || JB(n) || dM(n) || qB();
}
function XB(n) {
  if (Array.isArray(n)) return Ed(n);
}
function YB(n) {
  if (Array.isArray(n)) return n;
}
function JB(n) {
  if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
}
function KB(n, e) {
  var t = n && (typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"]);
  if (t != null) {
    var i = [], r = !0, s = !1, o, a;
    try {
      for (t = t.call(n); !(r = (o = t.next()).done) && (i.push(o.value), !(e && i.length === e)); r = !0)
        ;
    } catch (c) {
      s = !0, a = c;
    } finally {
      try {
        !r && t.return != null && t.return();
      } finally {
        if (s) throw a;
      }
    }
    return i;
  }
}
function dM(n, e) {
  if (n) {
    if (typeof n == "string") return Ed(n, e);
    var t = Object.prototype.toString.call(n).slice(8, -1);
    if (t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set") return Array.from(n);
    if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Ed(n, e);
  }
}
function Ed(n, e) {
  (e == null || e > n.length) && (e = n.length);
  for (var t = 0, i = new Array(e); t < e; t++) i[t] = n[t];
  return i;
}
function qB() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function QB() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var wa = typeof window < "u" && window.THREE ? window.THREE : {
  LinearFilter: zt,
  Sprite: gl,
  SpriteMaterial: ml,
  Texture: Yt
}, e4 = /* @__PURE__ */ function(n) {
  HB(t, n);
  var e = ZB(t);
  function t() {
    var i, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 10, o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "rgba(255, 255, 255, 1)";
    return kB(this, t), i = e.call(this, new wa.SpriteMaterial({
      map: new wa.Texture()
    })), i._text = "".concat(r), i._textHeight = s, i._color = o, i._backgroundColor = !1, i._padding = 0, i._borderWidth = 0, i._borderRadius = 0, i._borderColor = "white", i._strokeWidth = 0, i._strokeColor = "white", i._fontFace = "Arial", i._fontSize = 90, i._fontWeight = "normal", i._canvas = document.createElement("canvas"), i._texture = i.material.map, i._texture.minFilter = wa.LinearFilter, i._genCanvas(), i;
  }
  return GB(t, [{
    key: "text",
    get: function() {
      return this._text;
    },
    set: function(r) {
      this._text = r, this._genCanvas();
    }
  }, {
    key: "textHeight",
    get: function() {
      return this._textHeight;
    },
    set: function(r) {
      this._textHeight = r, this._genCanvas();
    }
  }, {
    key: "color",
    get: function() {
      return this._color;
    },
    set: function(r) {
      this._color = r, this._genCanvas();
    }
  }, {
    key: "backgroundColor",
    get: function() {
      return this._backgroundColor;
    },
    set: function(r) {
      this._backgroundColor = r, this._genCanvas();
    }
  }, {
    key: "padding",
    get: function() {
      return this._padding;
    },
    set: function(r) {
      this._padding = r, this._genCanvas();
    }
  }, {
    key: "borderWidth",
    get: function() {
      return this._borderWidth;
    },
    set: function(r) {
      this._borderWidth = r, this._genCanvas();
    }
  }, {
    key: "borderRadius",
    get: function() {
      return this._borderRadius;
    },
    set: function(r) {
      this._borderRadius = r, this._genCanvas();
    }
  }, {
    key: "borderColor",
    get: function() {
      return this._borderColor;
    },
    set: function(r) {
      this._borderColor = r, this._genCanvas();
    }
  }, {
    key: "fontFace",
    get: function() {
      return this._fontFace;
    },
    set: function(r) {
      this._fontFace = r, this._genCanvas();
    }
  }, {
    key: "fontSize",
    get: function() {
      return this._fontSize;
    },
    set: function(r) {
      this._fontSize = r, this._genCanvas();
    }
  }, {
    key: "fontWeight",
    get: function() {
      return this._fontWeight;
    },
    set: function(r) {
      this._fontWeight = r, this._genCanvas();
    }
  }, {
    key: "strokeWidth",
    get: function() {
      return this._strokeWidth;
    },
    set: function(r) {
      this._strokeWidth = r, this._genCanvas();
    }
  }, {
    key: "strokeColor",
    get: function() {
      return this._strokeColor;
    },
    set: function(r) {
      this._strokeColor = r, this._genCanvas();
    }
  }, {
    key: "_genCanvas",
    value: function() {
      var r = this, s = this._canvas, o = s.getContext("2d"), a = Array.isArray(this.borderWidth) ? this.borderWidth : [this.borderWidth, this.borderWidth], c = a.map(function(R) {
        return R * r.fontSize * 0.1;
      }), l = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius], d = l.map(function(R) {
        return R * r.fontSize * 0.1;
      }), h = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding], f = h.map(function(R) {
        return R * r.fontSize * 0.1;
      }), g = this.text.split(`
`), p = "".concat(this.fontWeight, " ").concat(this.fontSize, "px ").concat(this.fontFace);
      o.font = p;
      var u = Math.max.apply(Math, xc(g.map(function(R) {
        return o.measureText(R).width;
      }))), y = this.fontSize * g.length;
      if (s.width = u + c[0] * 2 + f[0] * 2, s.height = y + c[1] * 2 + f[1] * 2, this.borderWidth) {
        if (o.strokeStyle = this.borderColor, c[0]) {
          var v = c[0] / 2;
          o.lineWidth = c[0], o.beginPath(), o.moveTo(v, d[0]), o.lineTo(v, s.height - d[3]), o.moveTo(s.width - v, d[1]), o.lineTo(s.width - v, s.height - d[2]), o.stroke();
        }
        if (c[1]) {
          var m = c[1] / 2;
          o.lineWidth = c[1], o.beginPath(), o.moveTo(Math.max(c[0], d[0]), m), o.lineTo(s.width - Math.max(c[0], d[1]), m), o.moveTo(Math.max(c[0], d[3]), s.height - m), o.lineTo(s.width - Math.max(c[0], d[2]), s.height - m), o.stroke();
        }
        if (this.borderRadius) {
          var x = Math.max.apply(Math, xc(c)), w = x / 2;
          o.lineWidth = x, o.beginPath(), [!!d[0] && [d[0], w, w, d[0]], !!d[1] && [s.width - d[1], s.width - w, w, d[1]], !!d[2] && [s.width - d[2], s.width - w, s.height - w, s.height - d[2]], !!d[3] && [d[3], w, s.height - w, s.height - d[3]]].filter(function(R) {
            return R;
          }).forEach(function(R) {
            var L = fv(R, 4), _ = L[0], F = L[1], S = L[2], T = L[3];
            o.moveTo(_, S), o.quadraticCurveTo(F, S, F, T);
          }), o.stroke();
        }
      }
      this.backgroundColor && (o.fillStyle = this.backgroundColor, this.borderRadius ? (o.beginPath(), o.moveTo(c[0], d[0]), [
        [c[0], d[0], s.width - d[1], c[1], c[1], c[1]],
        // t
        [s.width - c[0], s.width - c[0], s.width - c[0], c[1], d[1], s.height - d[2]],
        // r
        [s.width - c[0], s.width - d[2], d[3], s.height - c[1], s.height - c[1], s.height - c[1]],
        // b
        [c[0], c[0], c[0], s.height - c[1], s.height - d[3], d[0]]
        // t
      ].forEach(function(R) {
        var L = fv(R, 6), _ = L[0], F = L[1], S = L[2], T = L[3], E = L[4], C = L[5];
        o.quadraticCurveTo(_, T, F, E), o.lineTo(S, C);
      }), o.closePath(), o.fill()) : o.fillRect(c[0], c[1], s.width - c[0] * 2, s.height - c[1] * 2)), o.translate.apply(o, xc(c)), o.translate.apply(o, xc(f)), o.font = p, o.fillStyle = this.color, o.textBaseline = "bottom";
      var A = this.strokeWidth > 0;
      A && (o.lineWidth = this.strokeWidth * this.fontSize / 10, o.strokeStyle = this.strokeColor), g.forEach(function(R, L) {
        var _ = (u - o.measureText(R).width) / 2, F = (L + 1) * r.fontSize;
        A && o.strokeText(R, _, F), o.fillText(R, _, F);
      }), this._texture.image = s, this._texture.needsUpdate = !0;
      var M = this.textHeight * g.length + a[1] * 2 + h[1] * 2;
      this.scale.set(M * s.width / s.height, M, 0);
    }
  }, {
    key: "clone",
    value: function() {
      return new this.constructor(this.text, this.textHeight, this.color).copy(this);
    }
  }, {
    key: "copy",
    value: function(r) {
      return wa.Sprite.prototype.copy.call(this, r), this.color = r.color, this.backgroundColor = r.backgroundColor, this.padding = r.padding, this.borderWidth = r.borderWidth, this.borderColor = r.borderColor, this.fontFace = r.fontFace, this.fontSize = r.fontSize, this.fontWeight = r.fontWeight, this.strokeWidth = r.strokeWidth, this.strokeColor = r.strokeColor, this;
    }
  }]), t;
}(wa.Sprite);
const t4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: e4
}, Symbol.toStringTag, { value: "Module" })), n4 = /* @__PURE__ */ au(t4);
var Ch = { exports: {} }, pv;
function i4() {
  return pv || (pv = 1, function(n, e) {
    (function(t, i) {
      n.exports = i();
    })(typeof window < "u" ? window : Lr, function() {
      if (typeof window > "u")
        return null;
      var t = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")(), i = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || function(d) {
        return t.setTimeout(d, 20);
      }, r = t.cancelAnimationFrame || t.mozCancelAnimationFrame || t.webkitCancelAnimationFrame || function(d) {
        t.clearTimeout(d);
      };
      function s(d, h) {
        var f = Object.prototype.toString.call(d), g = f === "[object Array]" || f === "[object NodeList]" || f === "[object HTMLCollection]" || f === "[object Object]" || typeof jQuery < "u" && d instanceof jQuery || typeof Elements < "u" && d instanceof Elements, p = 0, u = d.length;
        if (g)
          for (; p < u; p++)
            h(d[p]);
        else
          h(d);
      }
      function o(d) {
        if (!d.getBoundingClientRect)
          return {
            width: d.offsetWidth,
            height: d.offsetHeight
          };
        var h = d.getBoundingClientRect();
        return {
          width: Math.round(h.width),
          height: Math.round(h.height)
        };
      }
      function a(d, h) {
        Object.keys(h).forEach(function(f) {
          d.style[f] = h[f];
        });
      }
      var c = function(d, h) {
        var f = 0;
        function g() {
          var u = [];
          this.add = function(m) {
            u.push(m);
          };
          var y, v;
          this.call = function(m) {
            for (y = 0, v = u.length; y < v; y++)
              u[y].call(this, m);
          }, this.remove = function(m) {
            var x = [];
            for (y = 0, v = u.length; y < v; y++)
              u[y] !== m && x.push(u[y]);
            u = x;
          }, this.length = function() {
            return u.length;
          };
        }
        function p(u, y) {
          if (u) {
            if (u.resizedAttached) {
              u.resizedAttached.add(y);
              return;
            }
            u.resizedAttached = new g(), u.resizedAttached.add(y), u.resizeSensor = document.createElement("div"), u.resizeSensor.dir = "ltr", u.resizeSensor.className = "resize-sensor";
            var v = {
              pointerEvents: "none",
              position: "absolute",
              left: "0px",
              top: "0px",
              right: "0px",
              bottom: "0px",
              overflow: "hidden",
              zIndex: "-1",
              visibility: "hidden",
              maxWidth: "100%"
            }, m = {
              position: "absolute",
              left: "0px",
              top: "0px",
              transition: "0s"
            };
            a(u.resizeSensor, v);
            var x = document.createElement("div");
            x.className = "resize-sensor-expand", a(x, v);
            var w = document.createElement("div");
            a(w, m), x.appendChild(w);
            var A = document.createElement("div");
            A.className = "resize-sensor-shrink", a(A, v);
            var M = document.createElement("div");
            a(M, m), a(M, { width: "200%", height: "200%" }), A.appendChild(M), u.resizeSensor.appendChild(x), u.resizeSensor.appendChild(A), u.appendChild(u.resizeSensor);
            var R = window.getComputedStyle(u), L = R ? R.getPropertyValue("position") : null;
            L !== "absolute" && L !== "relative" && L !== "fixed" && L !== "sticky" && (u.style.position = "relative");
            var _ = !1, F = 0, S = o(u), T = 0, E = 0, C = !0;
            f = 0;
            var P = function() {
              var U = u.offsetWidth, B = u.offsetHeight;
              w.style.width = U + 10 + "px", w.style.height = B + 10 + "px", x.scrollLeft = U + 10, x.scrollTop = B + 10, A.scrollLeft = U + 10, A.scrollTop = B + 10;
            }, b = function() {
              if (C) {
                var U = u.offsetWidth === 0 && u.offsetHeight === 0;
                if (U) {
                  f || (f = i(function() {
                    f = 0, b();
                  }));
                  return;
                } else
                  C = !1;
              }
              P();
            };
            u.resizeSensor.resetSensor = b;
            var I = function() {
              F = 0, _ && (T = S.width, E = S.height, u.resizedAttached && u.resizedAttached.call(S));
            }, D = function() {
              S = o(u), _ = S.width !== T || S.height !== E, _ && !F && (F = i(I)), b();
            }, N = function(U, B, G) {
              U.attachEvent ? U.attachEvent("on" + B, G) : U.addEventListener(B, G);
            };
            N(x, "scroll", D), N(A, "scroll", D), f = i(function() {
              f = 0, b();
            });
          }
        }
        s(d, function(u) {
          p(u, h);
        }), this.detach = function(u) {
          f || (r(f), f = 0), c.detach(d, u);
        }, this.reset = function() {
          d.resizeSensor.resetSensor();
        };
      };
      if (c.reset = function(d) {
        s(d, function(h) {
          h.resizeSensor.resetSensor();
        });
      }, c.detach = function(d, h) {
        s(d, function(f) {
          f && (f.resizedAttached && typeof h == "function" && (f.resizedAttached.remove(h), f.resizedAttached.length()) || f.resizeSensor && (f.contains(f.resizeSensor) && f.removeChild(f.resizeSensor), delete f.resizeSensor, delete f.resizedAttached));
        });
      }, typeof MutationObserver < "u") {
        var l = new MutationObserver(function(d) {
          for (var h in d)
            if (d.hasOwnProperty(h))
              for (var f = d[h].addedNodes, g = 0; g < f.length; g++)
                f[g].resizeSensor && c.reset(f[g]);
        });
        document.addEventListener("DOMContentLoaded", function(d) {
          l.observe(document.body, {
            childList: !0,
            subtree: !0
          });
        });
      }
      return c;
    });
  }(Ch)), Ch.exports;
}
class r4 extends xn {
  constructor(e) {
    super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
      return new l4(t);
    }), this.register(function(t) {
      return new u4(t);
    }), this.register(function(t) {
      return new h4(t);
    }), this.register(function(t) {
      return new c4(t);
    }), this.register(function(t) {
      return new o4(t);
    }), this.register(function(t) {
      return new d4(t);
    });
  }
  load(e, t, i, r) {
    const s = this;
    let o;
    this.resourcePath !== "" ? o = this.resourcePath : this.path !== "" ? o = this.path : o = rr.extractUrlBase(e), this.manager.itemStart(e);
    const a = function(l) {
      r ? r(l) : console.error(l), s.manager.itemError(e), s.manager.itemEnd(e);
    }, c = new Zn(this.manager);
    c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(this.withCredentials), c.load(e, function(l) {
      try {
        s.parse(l, o, function(d) {
          t(d), s.manager.itemEnd(e);
        }, a);
      } catch (d) {
        a(d);
      }
    }, i, a);
  }
  setDRACOLoader(e) {
    return this.dracoLoader = e, this;
  }
  setDDSLoader() {
    throw new Error(
      'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
    );
  }
  setKTX2Loader(e) {
    return this.ktx2Loader = e, this;
  }
  setMeshoptDecoder(e) {
    return this.meshoptDecoder = e, this;
  }
  register(e) {
    return this.pluginCallbacks.indexOf(e) === -1 && this.pluginCallbacks.push(e), this;
  }
  unregister(e) {
    return this.pluginCallbacks.indexOf(e) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this;
  }
  parse(e, t, i, r) {
    let s;
    const o = {}, a = {};
    if (typeof e == "string")
      s = e;
    else if (rr.decodeText(new Uint8Array(e, 0, 4)) === fM) {
      try {
        o[vt.KHR_BINARY_GLTF] = new f4(e);
      } catch (h) {
        r && r(h);
        return;
      }
      s = o[vt.KHR_BINARY_GLTF].content;
    } else
      s = rr.decodeText(new Uint8Array(e));
    const c = JSON.parse(s);
    if (c.asset === void 0 || c.asset.version[0] < 2) {
      r && r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
      return;
    }
    const l = new A4(c, {
      path: t || this.resourcePath || "",
      crossOrigin: this.crossOrigin,
      requestHeader: this.requestHeader,
      manager: this.manager,
      ktx2Loader: this.ktx2Loader,
      meshoptDecoder: this.meshoptDecoder
    });
    l.fileLoader.setRequestHeader(this.requestHeader);
    for (let d = 0; d < this.pluginCallbacks.length; d++) {
      const h = this.pluginCallbacks[d](l);
      a[h.name] = h, o[h.name] = !0;
    }
    if (c.extensionsUsed)
      for (let d = 0; d < c.extensionsUsed.length; ++d) {
        const h = c.extensionsUsed[d], f = c.extensionsRequired || [];
        switch (h) {
          case vt.KHR_MATERIALS_UNLIT:
            o[h] = new a4();
            break;
          case vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
            o[h] = new g4();
            break;
          case vt.KHR_DRACO_MESH_COMPRESSION:
            o[h] = new p4(c, this.dracoLoader);
            break;
          case vt.KHR_TEXTURE_TRANSFORM:
            o[h] = new m4();
            break;
          case vt.KHR_MESH_QUANTIZATION:
            o[h] = new v4();
            break;
          default:
            f.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".');
        }
      }
    l.setExtensions(o), l.setPlugins(a), l.parse(i, r);
  }
}
function s4() {
  let n = {};
  return {
    get: function(e) {
      return n[e];
    },
    add: function(e, t) {
      n[e] = t;
    },
    remove: function(e) {
      delete n[e];
    },
    removeAll: function() {
      n = {};
    }
  };
}
const vt = {
  KHR_BINARY_GLTF: "KHR_binary_glTF",
  KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
  KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
  KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
  KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
  KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
  KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
  KHR_TEXTURE_BASISU: "KHR_texture_basisu",
  KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
  KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
  EXT_TEXTURE_WEBP: "EXT_texture_webp",
  EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression"
};
class o4 {
  constructor(e) {
    this.parser = e, this.name = vt.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
  }
  _markDefs() {
    const e = this.parser, t = this.parser.json.nodes || [];
    for (let i = 0, r = t.length; i < r; i++) {
      const s = t[i];
      s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, s.extensions[this.name].light);
    }
  }
  _loadLight(e) {
    const t = this.parser, i = "light:" + e;
    let r = t.cache.get(i);
    if (r) return r;
    const s = t.json, c = ((s.extensions && s.extensions[this.name] || {}).lights || [])[e];
    let l;
    const d = new Ue(16777215);
    c.color !== void 0 && d.fromArray(c.color);
    const h = c.range !== void 0 ? c.range : 0;
    switch (c.type) {
      case "directional":
        l = new Ru(d), l.target.position.set(0, 0, -1), l.add(l.target);
        break;
      case "point":
        l = new Lu(d), l.distance = h;
        break;
      case "spot":
        l = new Cu(d), l.distance = h, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target);
        break;
      default:
        throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type);
    }
    return l.position.set(0, 0, 0), l.decay = 2, c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), r = Promise.resolve(l), t.cache.add(i, r), r;
  }
  createNodeAttachment(e) {
    const t = this, i = this.parser, s = i.json.nodes[e], a = (s.extensions && s.extensions[this.name] || {}).light;
    return a === void 0 ? null : this._loadLight(a).then(function(c) {
      return i._getNodeRef(t.cache, a, c);
    });
  }
}
class a4 {
  constructor() {
    this.name = vt.KHR_MATERIALS_UNLIT;
  }
  getMaterialType() {
    return In;
  }
  extendParams(e, t, i) {
    const r = [];
    e.color = new Ue(1, 1, 1), e.opacity = 1;
    const s = t.pbrMetallicRoughness;
    if (s) {
      if (Array.isArray(s.baseColorFactor)) {
        const o = s.baseColorFactor;
        e.color.fromArray(o), e.opacity = o[3];
      }
      s.baseColorTexture !== void 0 && r.push(i.assignTexture(e, "map", s.baseColorTexture));
    }
    return Promise.all(r);
  }
}
class l4 {
  constructor(e) {
    this.parser = e, this.name = vt.KHR_MATERIALS_CLEARCOAT;
  }
  getMaterialType(e) {
    const i = this.parser.json.materials[e];
    return !i.extensions || !i.extensions[this.name] ? null : wl;
  }
  extendMaterialParams(e, t) {
    const i = this.parser, r = i.json.materials[e];
    if (!r.extensions || !r.extensions[this.name])
      return Promise.resolve();
    const s = [], o = r.extensions[this.name];
    if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (s.push(i.assignTexture(t, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) {
      const a = o.clearcoatNormalTexture.scale;
      t.clearcoatNormalScale = new Re(a, -a);
    }
    return Promise.all(s);
  }
}
class c4 {
  constructor(e) {
    this.parser = e, this.name = vt.KHR_MATERIALS_TRANSMISSION;
  }
  getMaterialType(e) {
    const i = this.parser.json.materials[e];
    return !i.extensions || !i.extensions[this.name] ? null : wl;
  }
  extendMaterialParams(e, t) {
    const i = this.parser, r = i.json.materials[e];
    if (!r.extensions || !r.extensions[this.name])
      return Promise.resolve();
    const s = [], o = r.extensions[this.name];
    return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && s.push(i.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(s);
  }
}
class u4 {
  constructor(e) {
    this.parser = e, this.name = vt.KHR_TEXTURE_BASISU;
  }
  loadTexture(e) {
    const t = this.parser, i = t.json, r = i.textures[e];
    if (!r.extensions || !r.extensions[this.name])
      return null;
    const s = r.extensions[this.name], o = i.images[s.source], a = t.options.ktx2Loader;
    if (!a) {
      if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
        throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
      return null;
    }
    return t.loadTextureImage(e, o, a);
  }
}
class h4 {
  constructor(e) {
    this.parser = e, this.name = vt.EXT_TEXTURE_WEBP, this.isSupported = null;
  }
  loadTexture(e) {
    const t = this.name, i = this.parser, r = i.json, s = r.textures[e];
    if (!s.extensions || !s.extensions[t])
      return null;
    const o = s.extensions[t], a = r.images[o.source];
    let c = i.textureLoader;
    if (a.uri) {
      const l = i.options.manager.getHandler(a.uri);
      l !== null && (c = l);
    }
    return this.detectSupport().then(function(l) {
      if (l) return i.loadTextureImage(e, a, c);
      if (r.extensionsRequired && r.extensionsRequired.indexOf(t) >= 0)
        throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
      return i.loadTexture(e);
    });
  }
  detectSupport() {
    return this.isSupported || (this.isSupported = new Promise(function(e) {
      const t = new Image();
      t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() {
        e(t.height === 1);
      };
    })), this.isSupported;
  }
}
class d4 {
  constructor(e) {
    this.name = vt.EXT_MESHOPT_COMPRESSION, this.parser = e;
  }
  loadBufferView(e) {
    const t = this.parser.json, i = t.bufferViews[e];
    if (i.extensions && i.extensions[this.name]) {
      const r = i.extensions[this.name], s = this.parser.getDependency("buffer", r.buffer), o = this.parser.options.meshoptDecoder;
      if (!o || !o.supported) {
        if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0)
          throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
        return null;
      }
      return Promise.all([s, o.ready]).then(function(a) {
        const c = r.byteOffset || 0, l = r.byteLength || 0, d = r.count, h = r.byteStride, f = new ArrayBuffer(d * h), g = new Uint8Array(a[0], c, l);
        return o.decodeGltfBuffer(new Uint8Array(f), d, h, g, r.mode, r.filter), f;
      });
    } else
      return null;
  }
}
const fM = "glTF", Aa = 12, mv = { JSON: 1313821514, BIN: 5130562 };
class f4 {
  constructor(e) {
    this.name = vt.KHR_BINARY_GLTF, this.content = null, this.body = null;
    const t = new DataView(e, 0, Aa);
    if (this.header = {
      magic: rr.decodeText(new Uint8Array(e.slice(0, 4))),
      version: t.getUint32(4, !0),
      length: t.getUint32(8, !0)
    }, this.header.magic !== fM)
      throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
    if (this.header.version < 2)
      throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
    const i = this.header.length - Aa, r = new DataView(e, Aa);
    let s = 0;
    for (; s < i; ) {
      const o = r.getUint32(s, !0);
      s += 4;
      const a = r.getUint32(s, !0);
      if (s += 4, a === mv.JSON) {
        const c = new Uint8Array(e, Aa + s, o);
        this.content = rr.decodeText(c);
      } else if (a === mv.BIN) {
        const c = Aa + s;
        this.body = e.slice(c, c + o);
      }
      s += o;
    }
    if (this.content === null)
      throw new Error("THREE.GLTFLoader: JSON content not found.");
  }
}
class p4 {
  constructor(e, t) {
    if (!t)
      throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
    this.name = vt.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload();
  }
  decodePrimitive(e, t) {
    const i = this.json, r = this.dracoLoader, s = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, c = {}, l = {};
    for (const d in o) {
      const h = Ld[d] || d.toLowerCase();
      a[h] = o[d];
    }
    for (const d in e.attributes) {
      const h = Ld[d] || d.toLowerCase();
      if (o[d] !== void 0) {
        const f = i.accessors[e.attributes[d]], g = Ka[f.componentType];
        l[h] = g, c[h] = f.normalized === !0;
      }
    }
    return t.getDependency("bufferView", s).then(function(d) {
      return new Promise(function(h) {
        r.decodeDracoFile(d, function(f) {
          for (const g in f.attributes) {
            const p = f.attributes[g], u = c[g];
            u !== void 0 && (p.normalized = u);
          }
          h(f);
        }, a, l);
      });
    });
  }
}
class m4 {
  constructor() {
    this.name = vt.KHR_TEXTURE_TRANSFORM;
  }
  extendTexture(e, t) {
    return t.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e;
  }
}
class Cd extends zs {
  constructor(e) {
    super(), this.isGLTFSpecularGlossinessMaterial = !0;
    const t = [
      "#ifdef USE_SPECULARMAP",
      "	uniform sampler2D specularMap;",
      "#endif"
    ].join(`
`), i = [
      "#ifdef USE_GLOSSINESSMAP",
      "	uniform sampler2D glossinessMap;",
      "#endif"
    ].join(`
`), r = [
      "vec3 specularFactor = specular;",
      "#ifdef USE_SPECULARMAP",
      "	vec4 texelSpecular = texture2D( specularMap, vUv );",
      "	texelSpecular = sRGBToLinear( texelSpecular );",
      "	// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture",
      "	specularFactor *= texelSpecular.rgb;",
      "#endif"
    ].join(`
`), s = [
      "float glossinessFactor = glossiness;",
      "#ifdef USE_GLOSSINESSMAP",
      "	vec4 texelGlossiness = texture2D( glossinessMap, vUv );",
      "	// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture",
      "	glossinessFactor *= texelGlossiness.a;",
      "#endif"
    ].join(`
`), o = [
      "PhysicalMaterial material;",
      "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );",
      "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );",
      "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );",
      "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.",
      "material.specularRoughness += geometryRoughness;",
      "material.specularRoughness = min( material.specularRoughness, 1.0 );",
      "material.specularColor = specularFactor;"
    ].join(`
`), a = {
      specular: { value: new Ue().setHex(16777215) },
      glossiness: { value: 1 },
      specularMap: { value: null },
      glossinessMap: { value: null }
    };
    this._extraUniforms = a, this.onBeforeCompile = function(c) {
      for (const l in a)
        c.uniforms[l] = a[l];
      c.fragmentShader = c.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>", t).replace("#include <metalnessmap_pars_fragment>", i).replace("#include <roughnessmap_fragment>", r).replace("#include <metalnessmap_fragment>", s).replace("#include <lights_physical_fragment>", o);
    }, Object.defineProperties(this, {
      specular: {
        get: function() {
          return a.specular.value;
        },
        set: function(c) {
          a.specular.value = c;
        }
      },
      specularMap: {
        get: function() {
          return a.specularMap.value;
        },
        set: function(c) {
          a.specularMap.value = c, c ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP;
        }
      },
      glossiness: {
        get: function() {
          return a.glossiness.value;
        },
        set: function(c) {
          a.glossiness.value = c;
        }
      },
      glossinessMap: {
        get: function() {
          return a.glossinessMap.value;
        },
        set: function(c) {
          a.glossinessMap.value = c, c ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV);
        }
      }
    }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.specularMap = e.specularMap, this.specular.copy(e.specular), this.glossinessMap = e.glossinessMap, this.glossiness = e.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this;
  }
}
class g4 {
  constructor() {
    this.name = vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, this.specularGlossinessParams = [
      "color",
      "map",
      "lightMap",
      "lightMapIntensity",
      "aoMap",
      "aoMapIntensity",
      "emissive",
      "emissiveIntensity",
      "emissiveMap",
      "bumpMap",
      "bumpScale",
      "normalMap",
      "normalMapType",
      "displacementMap",
      "displacementScale",
      "displacementBias",
      "specularMap",
      "specular",
      "glossinessMap",
      "glossiness",
      "alphaMap",
      "envMap",
      "envMapIntensity",
      "refractionRatio"
    ];
  }
  getMaterialType() {
    return Cd;
  }
  extendParams(e, t, i) {
    const r = t.extensions[this.name];
    e.color = new Ue(1, 1, 1), e.opacity = 1;
    const s = [];
    if (Array.isArray(r.diffuseFactor)) {
      const o = r.diffuseFactor;
      e.color.fromArray(o), e.opacity = o[3];
    }
    if (r.diffuseTexture !== void 0 && s.push(i.assignTexture(e, "map", r.diffuseTexture)), e.emissive = new Ue(0, 0, 0), e.glossiness = r.glossinessFactor !== void 0 ? r.glossinessFactor : 1, e.specular = new Ue(1, 1, 1), Array.isArray(r.specularFactor) && e.specular.fromArray(r.specularFactor), r.specularGlossinessTexture !== void 0) {
      const o = r.specularGlossinessTexture;
      s.push(i.assignTexture(e, "glossinessMap", o)), s.push(i.assignTexture(e, "specularMap", o));
    }
    return Promise.all(s);
  }
  createMaterial(e) {
    const t = new Cd(e);
    return t.fog = !0, t.color = e.color, t.map = e.map === void 0 ? null : e.map, t.lightMap = null, t.lightMapIntensity = 1, t.aoMap = e.aoMap === void 0 ? null : e.aoMap, t.aoMapIntensity = 1, t.emissive = e.emissive, t.emissiveIntensity = 1, t.emissiveMap = e.emissiveMap === void 0 ? null : e.emissiveMap, t.bumpMap = e.bumpMap === void 0 ? null : e.bumpMap, t.bumpScale = 1, t.normalMap = e.normalMap === void 0 ? null : e.normalMap, t.normalMapType = Jr, e.normalScale && (t.normalScale = e.normalScale), t.displacementMap = null, t.displacementScale = 1, t.displacementBias = 0, t.specularMap = e.specularMap === void 0 ? null : e.specularMap, t.specular = e.specular, t.glossinessMap = e.glossinessMap === void 0 ? null : e.glossinessMap, t.glossiness = e.glossiness, t.alphaMap = null, t.envMap = e.envMap === void 0 ? null : e.envMap, t.envMapIntensity = 1, t.refractionRatio = 0.98, t;
  }
}
class v4 {
  constructor() {
    this.name = vt.KHR_MESH_QUANTIZATION;
  }
}
class $o extends Ni {
  constructor(e, t, i, r) {
    super(e, t, i, r);
  }
  copySampleValue_(e) {
    const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r * 3 + r;
    for (let o = 0; o !== r; o++)
      t[o] = i[s + o];
    return t;
  }
}
$o.prototype.beforeStart_ = $o.prototype.copySampleValue_;
$o.prototype.afterEnd_ = $o.prototype.copySampleValue_;
$o.prototype.interpolate_ = function(n, e, t, i) {
  const r = this.resultBuffer, s = this.sampleValues, o = this.valueSize, a = o * 2, c = o * 3, l = i - e, d = (t - e) / l, h = d * d, f = h * d, g = n * c, p = g - c, u = -2 * f + 3 * h, y = f - h, v = 1 - u, m = y - h + d;
  for (let x = 0; x !== o; x++) {
    const w = s[p + x + o], A = s[p + x + a] * l, M = s[g + x + o], R = s[g + x] * l;
    r[x] = v * w + m * A + u * M + y * R;
  }
  return r;
};
const Yi = {
  FLOAT: 5126,
  //FLOAT_MAT2: 35674,
  FLOAT_MAT3: 35675,
  FLOAT_MAT4: 35676,
  FLOAT_VEC2: 35664,
  FLOAT_VEC3: 35665,
  FLOAT_VEC4: 35666,
  LINEAR: 9729,
  REPEAT: 10497,
  SAMPLER_2D: 35678,
  POINTS: 0,
  LINES: 1,
  LINE_LOOP: 2,
  LINE_STRIP: 3,
  TRIANGLES: 4,
  TRIANGLE_STRIP: 5,
  TRIANGLE_FAN: 6,
  UNSIGNED_BYTE: 5121,
  UNSIGNED_SHORT: 5123
}, Ka = {
  5120: Int8Array,
  5121: Uint8Array,
  5122: Int16Array,
  5123: Uint16Array,
  5125: Uint32Array,
  5126: Float32Array
}, gv = {
  9728: $t,
  9729: zt,
  9984: Va,
  9985: du,
  9986: Ga,
  9987: pr
}, vv = {
  33071: hn,
  33648: Eo,
  10497: jr
}, yv = {
  SCALAR: 1,
  VEC2: 2,
  VEC3: 3,
  VEC4: 4,
  MAT2: 4,
  MAT3: 9,
  MAT4: 16
}, Ld = {
  POSITION: "position",
  NORMAL: "normal",
  TANGENT: "tangent",
  TEXCOORD_0: "uv",
  TEXCOORD_1: "uv2",
  COLOR_0: "color",
  WEIGHTS_0: "skinWeight",
  JOINTS_0: "skinIndex"
}, _r = {
  scale: "scale",
  translation: "position",
  rotation: "quaternion",
  weights: "morphTargetInfluences"
}, y4 = {
  CUBICSPLINE: void 0,
  // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
  // keyframe track will be initialized with a default interpolation type, then modified.
  LINEAR: Es,
  STEP: Lo
}, Lh = {
  OPAQUE: "OPAQUE",
  MASK: "MASK",
  BLEND: "BLEND"
};
function bv(n, e) {
  return typeof n != "string" || n === "" ? "" : (/^https?:\/\//i.test(e) && /^\//.test(n) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(n) || /^data:.*,.*$/i.test(n) || /^blob:.*$/i.test(n) ? n : e + n);
}
function b4(n) {
  return n.DefaultMaterial === void 0 && (n.DefaultMaterial = new zs({
    color: 16777215,
    emissive: 0,
    metalness: 1,
    roughness: 1,
    transparent: !1,
    depthTest: !0,
    side: Hr
  })), n.DefaultMaterial;
}
function Sa(n, e, t) {
  for (const i in t.extensions)
    n[i] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[i] = t.extensions[i]);
}
function fs(n, e) {
  e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(n.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras));
}
function x4(n, e, t) {
  let i = !1, r = !1;
  for (let a = 0, c = e.length; a < c; a++) {
    const l = e[a];
    if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (r = !0), i && r) break;
  }
  if (!i && !r) return Promise.resolve(n);
  const s = [], o = [];
  for (let a = 0, c = e.length; a < c; a++) {
    const l = e[a];
    if (i) {
      const d = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : n.attributes.position;
      s.push(d);
    }
    if (r) {
      const d = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : n.attributes.normal;
      o.push(d);
    }
  }
  return Promise.all([
    Promise.all(s),
    Promise.all(o)
  ]).then(function(a) {
    const c = a[0], l = a[1];
    return i && (n.morphAttributes.position = c), r && (n.morphAttributes.normal = l), n.morphTargetsRelative = !0, n;
  });
}
function M4(n, e) {
  if (n.updateMorphTargets(), e.weights !== void 0)
    for (let t = 0, i = e.weights.length; t < i; t++)
      n.morphTargetInfluences[t] = e.weights[t];
  if (e.extras && Array.isArray(e.extras.targetNames)) {
    const t = e.extras.targetNames;
    if (n.morphTargetInfluences.length === t.length) {
      n.morphTargetDictionary = {};
      for (let i = 0, r = t.length; i < r; i++)
        n.morphTargetDictionary[t[i]] = i;
    } else
      console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
  }
}
function w4(n) {
  const e = n.extensions && n.extensions[vt.KHR_DRACO_MESH_COMPRESSION];
  let t;
  return e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + xv(e.attributes) : t = n.indices + ":" + xv(n.attributes) + ":" + n.mode, t;
}
function xv(n) {
  let e = "";
  const t = Object.keys(n).sort();
  for (let i = 0, r = t.length; i < r; i++)
    e += t[i] + ":" + n[t[i]] + ";";
  return e;
}
function Rd(n) {
  switch (n) {
    case Int8Array:
      return 1 / 127;
    case Uint8Array:
      return 1 / 255;
    case Int16Array:
      return 1 / 32767;
    case Uint16Array:
      return 1 / 65535;
    default:
      throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
  }
}
class A4 {
  constructor(e = {}, t = {}) {
    this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new s4(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.textureCache = {}, this.nodeNamesUsed = {}, typeof createImageBitmap < "u" && /Firefox/.test(navigator.userAgent) === !1 ? this.textureLoader = new op(this.options.manager) : this.textureLoader = new qf(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Zn(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
  }
  setExtensions(e) {
    this.extensions = e;
  }
  setPlugins(e) {
    this.plugins = e;
  }
  parse(e, t) {
    const i = this, r = this.json, s = this.extensions;
    this.cache.removeAll(), this._invokeAll(function(o) {
      return o._markDefs && o._markDefs();
    }), Promise.all(this._invokeAll(function(o) {
      return o.beforeRoot && o.beforeRoot();
    })).then(function() {
      return Promise.all([
        i.getDependencies("scene"),
        i.getDependencies("animation"),
        i.getDependencies("camera")
      ]);
    }).then(function(o) {
      const a = {
        scene: o[0][r.scene || 0],
        scenes: o[0],
        animations: o[1],
        cameras: o[2],
        asset: r.asset,
        parser: i,
        userData: {}
      };
      Sa(s, a, r), fs(a, r), Promise.all(i._invokeAll(function(c) {
        return c.afterRoot && c.afterRoot(a);
      })).then(function() {
        e(a);
      });
    }).catch(t);
  }
  /**
   * Marks the special nodes/meshes in json for efficient parse.
   */
  _markDefs() {
    const e = this.json.nodes || [], t = this.json.skins || [], i = this.json.meshes || [];
    for (let r = 0, s = t.length; r < s; r++) {
      const o = t[r].joints;
      for (let a = 0, c = o.length; a < c; a++)
        e[o[a]].isBone = !0;
    }
    for (let r = 0, s = e.length; r < s; r++) {
      const o = e[r];
      o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (i[o.mesh].isSkinnedMesh = !0)), o.camera !== void 0 && this._addNodeRef(this.cameraCache, o.camera);
    }
  }
  /**
   * Counts references to shared node / Object3D resources. These resources
   * can be reused, or "instantiated", at multiple nodes in the scene
   * hierarchy. Mesh, Camera, and Light instances are instantiated and must
   * be marked. Non-scenegraph resources (like Materials, Geometries, and
   * Textures) can be reused directly and are not marked here.
   *
   * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
   */
  _addNodeRef(e, t) {
    t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++);
  }
  /** Returns a reference to a shared resource, cloning it if necessary. */
  _getNodeRef(e, t, i) {
    if (e.refs[t] <= 1) return i;
    const r = i.clone();
    return r.name += "_instance_" + e.uses[t]++, r;
  }
  _invokeOne(e) {
    const t = Object.values(this.plugins);
    t.push(this);
    for (let i = 0; i < t.length; i++) {
      const r = e(t[i]);
      if (r) return r;
    }
    return null;
  }
  _invokeAll(e) {
    const t = Object.values(this.plugins);
    t.unshift(this);
    const i = [];
    for (let r = 0; r < t.length; r++) {
      const s = e(t[r]);
      s && i.push(s);
    }
    return i;
  }
  /**
   * Requests the specified dependency asynchronously, with caching.
   * @param {string} type
   * @param {number} index
   * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
   */
  getDependency(e, t) {
    const i = e + ":" + t;
    let r = this.cache.get(i);
    if (!r) {
      switch (e) {
        case "scene":
          r = this.loadScene(t);
          break;
        case "node":
          r = this.loadNode(t);
          break;
        case "mesh":
          r = this._invokeOne(function(s) {
            return s.loadMesh && s.loadMesh(t);
          });
          break;
        case "accessor":
          r = this.loadAccessor(t);
          break;
        case "bufferView":
          r = this._invokeOne(function(s) {
            return s.loadBufferView && s.loadBufferView(t);
          });
          break;
        case "buffer":
          r = this.loadBuffer(t);
          break;
        case "material":
          r = this._invokeOne(function(s) {
            return s.loadMaterial && s.loadMaterial(t);
          });
          break;
        case "texture":
          r = this._invokeOne(function(s) {
            return s.loadTexture && s.loadTexture(t);
          });
          break;
        case "skin":
          r = this.loadSkin(t);
          break;
        case "animation":
          r = this.loadAnimation(t);
          break;
        case "camera":
          r = this.loadCamera(t);
          break;
        default:
          throw new Error("Unknown type: " + e);
      }
      this.cache.add(i, r);
    }
    return r;
  }
  /**
   * Requests all dependencies of the specified type asynchronously, with caching.
   * @param {string} type
   * @return {Promise<Array<Object>>}
   */
  getDependencies(e) {
    let t = this.cache.get(e);
    if (!t) {
      const i = this, r = this.json[e + (e === "mesh" ? "es" : "s")] || [];
      t = Promise.all(r.map(function(s, o) {
        return i.getDependency(e, o);
      })), this.cache.add(e, t);
    }
    return t;
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
   * @param {number} bufferIndex
   * @return {Promise<ArrayBuffer>}
   */
  loadBuffer(e) {
    const t = this.json.buffers[e], i = this.fileLoader;
    if (t.type && t.type !== "arraybuffer")
      throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
    if (t.uri === void 0 && e === 0)
      return Promise.resolve(this.extensions[vt.KHR_BINARY_GLTF].body);
    const r = this.options;
    return new Promise(function(s, o) {
      i.load(bv(t.uri, r.path), s, void 0, function() {
        o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'));
      });
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
   * @param {number} bufferViewIndex
   * @return {Promise<ArrayBuffer>}
   */
  loadBufferView(e) {
    const t = this.json.bufferViews[e];
    return this.getDependency("buffer", t.buffer).then(function(i) {
      const r = t.byteLength || 0, s = t.byteOffset || 0;
      return i.slice(s, s + r);
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
   * @param {number} accessorIndex
   * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
   */
  loadAccessor(e) {
    const t = this, i = this.json, r = this.json.accessors[e];
    if (r.bufferView === void 0 && r.sparse === void 0)
      return Promise.resolve(null);
    const s = [];
    return r.bufferView !== void 0 ? s.push(this.getDependency("bufferView", r.bufferView)) : s.push(null), r.sparse !== void 0 && (s.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(s).then(function(o) {
      const a = o[0], c = yv[r.type], l = Ka[r.componentType], d = l.BYTES_PER_ELEMENT, h = d * c, f = r.byteOffset || 0, g = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, p = r.normalized === !0;
      let u, y;
      if (g && g !== h) {
        const v = Math.floor(f / g), m = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + v + ":" + r.count;
        let x = t.cache.get(m);
        x || (u = new l(a, v * g, r.count * g / d), x = new Qr(u, g / d), t.cache.add(m, x)), y = new lr(x, c, f % g / d, p);
      } else
        a === null ? u = new l(r.count * c) : u = new l(a, f, r.count * c), y = new ot(u, c, p);
      if (r.sparse !== void 0) {
        const v = yv.SCALAR, m = Ka[r.sparse.indices.componentType], x = r.sparse.indices.byteOffset || 0, w = r.sparse.values.byteOffset || 0, A = new m(o[1], x, r.sparse.count * v), M = new l(o[2], w, r.sparse.count * c);
        a !== null && (y = new ot(y.array.slice(), y.itemSize, y.normalized));
        for (let R = 0, L = A.length; R < L; R++) {
          const _ = A[R];
          if (y.setX(_, M[R * c]), c >= 2 && y.setY(_, M[R * c + 1]), c >= 3 && y.setZ(_, M[R * c + 2]), c >= 4 && y.setW(_, M[R * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
        }
      }
      return y;
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
   * @param {number} textureIndex
   * @return {Promise<THREE.Texture>}
   */
  loadTexture(e) {
    const t = this.json, i = this.options, r = t.textures[e], s = t.images[r.source];
    let o = this.textureLoader;
    if (s.uri) {
      const a = i.manager.getHandler(s.uri);
      a !== null && (o = a);
    }
    return this.loadTextureImage(e, s, o);
  }
  loadTextureImage(e, t, i) {
    const r = this, s = this.json, o = this.options, a = s.textures[e], c = (t.uri || t.bufferView) + ":" + a.sampler;
    if (this.textureCache[c])
      return this.textureCache[c];
    const l = self.URL || self.webkitURL;
    let d = t.uri || "", h = !1, f = !0;
    const g = d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0;
    if ((t.mimeType === "image/jpeg" || g) && (f = !1), t.bufferView !== void 0)
      d = r.getDependency("bufferView", t.bufferView).then(function(u) {
        if (t.mimeType === "image/png") {
          const v = new DataView(u, 25, 1).getUint8(0, !1);
          f = v === 6 || v === 4 || v === 3;
        }
        h = !0;
        const y = new Blob([u], { type: t.mimeType });
        return d = l.createObjectURL(y), d;
      });
    else if (t.uri === void 0)
      throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
    const p = Promise.resolve(d).then(function(u) {
      return new Promise(function(y, v) {
        let m = y;
        i.isImageBitmapLoader === !0 && (m = function(x) {
          const w = new Yt(x);
          w.needsUpdate = !0, y(w);
        }), i.load(bv(u, o.path), m, void 0, v);
      });
    }).then(function(u) {
      h === !0 && l.revokeObjectURL(d), u.flipY = !1, a.name && (u.name = a.name), f || (u.format = ir);
      const v = (s.samplers || {})[a.sampler] || {};
      return u.magFilter = gv[v.magFilter] || zt, u.minFilter = gv[v.minFilter] || pr, u.wrapS = vv[v.wrapS] || jr, u.wrapT = vv[v.wrapT] || jr, r.associations.set(u, {
        type: "textures",
        index: e
      }), u;
    }).catch(function() {
      return console.error("THREE.GLTFLoader: Couldn't load texture", d), null;
    });
    return this.textureCache[c] = p, p;
  }
  /**
   * Asynchronously assigns a texture to the given material parameters.
   * @param {Object} materialParams
   * @param {string} mapName
   * @param {Object} mapDef
   * @return {Promise}
   */
  assignTexture(e, t, i) {
    const r = this;
    return this.getDependency("texture", i.index).then(function(s) {
      if (i.texCoord !== void 0 && i.texCoord != 0 && !(t === "aoMap" && i.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + i.texCoord + " for texture " + t + " not yet supported."), r.extensions[vt.KHR_TEXTURE_TRANSFORM]) {
        const o = i.extensions !== void 0 ? i.extensions[vt.KHR_TEXTURE_TRANSFORM] : void 0;
        if (o) {
          const a = r.associations.get(s);
          s = r.extensions[vt.KHR_TEXTURE_TRANSFORM].extendTexture(s, o), r.associations.set(s, a);
        }
      }
      e[t] = s;
    });
  }
  /**
   * Assigns final material to a Mesh, Line, or Points instance. The instance
   * already has a material (generated from the glTF material options alone)
   * but reuse of the same glTF material may require multiple threejs materials
   * to accommodate different primitive types, defines, etc. New materials will
   * be created if necessary, and reused from a cache.
   * @param  {Object3D} mesh Mesh, Line, or Points instance.
   */
  assignFinalMaterial(e) {
    const t = e.geometry;
    let i = e.material;
    const r = t.attributes.tangent !== void 0, s = t.attributes.color !== void 0, o = t.attributes.normal === void 0, a = Object.keys(t.morphAttributes).length > 0, c = a && t.morphAttributes.normal !== void 0;
    if (e.isPoints) {
      const l = "PointsMaterial:" + i.uuid;
      let d = this.cache.get(l);
      d || (d = new es(), tn.prototype.copy.call(d, i), d.color.copy(i.color), d.map = i.map, d.sizeAttenuation = !1, this.cache.add(l, d)), i = d;
    } else if (e.isLine) {
      const l = "LineBasicMaterial:" + i.uuid;
      let d = this.cache.get(l);
      d || (d = new an(), tn.prototype.copy.call(d, i), d.color.copy(i.color), this.cache.add(l, d)), i = d;
    }
    if (r || s || o || a) {
      let l = "ClonedMaterial:" + i.uuid + ":";
      i.isGLTFSpecularGlossinessMaterial && (l += "specular-glossiness:"), r && (l += "vertex-tangents:"), s && (l += "vertex-colors:"), o && (l += "flat-shading:"), a && (l += "morph-targets:"), c && (l += "morph-normals:");
      let d = this.cache.get(l);
      d || (d = i.clone(), s && (d.vertexColors = !0), o && (d.flatShading = !0), a && (d.morphTargets = !0), c && (d.morphNormals = !0), r && (d.vertexTangents = !0, d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(l, d), this.associations.set(d, this.associations.get(i))), i = d;
    }
    i.aoMap && t.attributes.uv2 === void 0 && t.attributes.uv !== void 0 && t.setAttribute("uv2", t.attributes.uv), e.material = i;
  }
  getMaterialType() {
    return zs;
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
   * @param {number} materialIndex
   * @return {Promise<Material>}
   */
  loadMaterial(e) {
    const t = this, i = this.json, r = this.extensions, s = i.materials[e];
    let o;
    const a = {}, c = s.extensions || {}, l = [];
    if (c[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
      const h = r[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
      o = h.getMaterialType(), l.push(h.extendParams(a, s, t));
    } else if (c[vt.KHR_MATERIALS_UNLIT]) {
      const h = r[vt.KHR_MATERIALS_UNLIT];
      o = h.getMaterialType(), l.push(h.extendParams(a, s, t));
    } else {
      const h = s.pbrMetallicRoughness || {};
      if (a.color = new Ue(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) {
        const f = h.baseColorFactor;
        a.color.fromArray(f), a.opacity = f[3];
      }
      h.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", h.baseColorTexture)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(f) {
        return f.getMaterialType && f.getMaterialType(e);
      }), l.push(Promise.all(this._invokeAll(function(f) {
        return f.extendMaterialParams && f.extendMaterialParams(e, a);
      })));
    }
    s.doubleSided === !0 && (a.side = Wr);
    const d = s.alphaMode || Lh.OPAQUE;
    return d === Lh.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === Lh.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== In && (l.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new Re(1, -1), s.normalTexture.scale !== void 0 && a.normalScale.set(s.normalTexture.scale, -s.normalTexture.scale)), s.occlusionTexture !== void 0 && o !== In && (l.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== In && (a.emissive = new Ue().fromArray(s.emissiveFactor)), s.emissiveTexture !== void 0 && o !== In && l.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture)), Promise.all(l).then(function() {
      let h;
      return o === Cd ? h = r[vt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a) : h = new o(a), s.name && (h.name = s.name), h.map && (h.map.encoding = Cs), h.emissiveMap && (h.emissiveMap.encoding = Cs), fs(h, s), t.associations.set(h, { type: "materials", index: e }), s.extensions && Sa(r, h, s), h;
    });
  }
  /** When Object3D instances are targeted by animation, they need unique names. */
  createUniqueName(e) {
    const t = mt.sanitizeNodeName(e || "");
    let i = t;
    for (let r = 1; this.nodeNamesUsed[i]; ++r)
      i = t + "_" + r;
    return this.nodeNamesUsed[i] = !0, i;
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
   *
   * Creates BufferGeometries from primitives.
   *
   * @param {Array<GLTF.Primitive>} primitives
   * @return {Promise<Array<BufferGeometry>>}
   */
  loadGeometries(e) {
    const t = this, i = this.extensions, r = this.primitiveCache;
    function s(a) {
      return i[vt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
        return Mv(c, a, t);
      });
    }
    const o = [];
    for (let a = 0, c = e.length; a < c; a++) {
      const l = e[a], d = w4(l), h = r[d];
      if (h)
        o.push(h.promise);
      else {
        let f;
        l.extensions && l.extensions[vt.KHR_DRACO_MESH_COMPRESSION] ? f = s(l) : f = Mv(new Ke(), l, t), r[d] = { primitive: l, promise: f }, o.push(f);
      }
    }
    return Promise.all(o);
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
   * @param {number} meshIndex
   * @return {Promise<Group|Mesh|SkinnedMesh>}
   */
  loadMesh(e) {
    const t = this, i = this.json, r = this.extensions, s = i.meshes[e], o = s.primitives, a = [];
    for (let c = 0, l = o.length; c < l; c++) {
      const d = o[c].material === void 0 ? b4(this.cache) : this.getDependency("material", o[c].material);
      a.push(d);
    }
    return a.push(t.loadGeometries(o)), Promise.all(a).then(function(c) {
      const l = c.slice(0, c.length - 1), d = c[c.length - 1], h = [];
      for (let g = 0, p = d.length; g < p; g++) {
        const u = d[g], y = o[g];
        let v;
        const m = l[g];
        if (y.mode === Yi.TRIANGLES || y.mode === Yi.TRIANGLE_STRIP || y.mode === Yi.TRIANGLE_FAN || y.mode === void 0)
          v = s.isSkinnedMesh === !0 ? new vl(u, m) : new Xt(u, m), v.isSkinnedMesh === !0 && !v.geometry.attributes.skinWeight.normalized && v.normalizeSkinWeights(), y.mode === Yi.TRIANGLE_STRIP ? v.geometry = wv(v.geometry, Xb) : y.mode === Yi.TRIANGLE_FAN && (v.geometry = wv(v.geometry, wf));
        else if (y.mode === Yi.LINES)
          v = new Rn(u, m);
        else if (y.mode === Yi.LINE_STRIP)
          v = new Oi(u, m);
        else if (y.mode === Yi.LINE_LOOP)
          v = new Au(u, m);
        else if (y.mode === Yi.POINTS)
          v = new ia(u, m);
        else
          throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
        Object.keys(v.geometry.morphAttributes).length > 0 && M4(v, s), v.name = t.createUniqueName(s.name || "mesh_" + e), fs(v, s), y.extensions && Sa(r, v, y), t.assignFinalMaterial(v), h.push(v);
      }
      if (h.length === 1)
        return h[0];
      const f = new _i();
      for (let g = 0, p = h.length; g < p; g++)
        f.add(h[g]);
      return f;
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
   * @param {number} cameraIndex
   * @return {Promise<THREE.Camera>}
   */
  loadCamera(e) {
    let t;
    const i = this.json.cameras[e], r = i[i.type];
    if (!r) {
      console.warn("THREE.GLTFLoader: Missing camera parameters.");
      return;
    }
    return i.type === "perspective" ? t = new nn(xd.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new sa(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), fs(t, i), Promise.resolve(t);
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
   * @param {number} skinIndex
   * @return {Promise<Object>}
   */
  loadSkin(e) {
    const t = this.json.skins[e], i = { joints: t.joints };
    return t.inverseBindMatrices === void 0 ? Promise.resolve(i) : this.getDependency("accessor", t.inverseBindMatrices).then(function(r) {
      return i.inverseBindMatrices = r, i;
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
   * @param {number} animationIndex
   * @return {Promise<AnimationClip>}
   */
  loadAnimation(e) {
    const i = this.json.animations[e], r = [], s = [], o = [], a = [], c = [];
    for (let l = 0, d = i.channels.length; l < d; l++) {
      const h = i.channels[l], f = i.samplers[h.sampler], g = h.target, p = g.node !== void 0 ? g.node : g.id, u = i.parameters !== void 0 ? i.parameters[f.input] : f.input, y = i.parameters !== void 0 ? i.parameters[f.output] : f.output;
      r.push(this.getDependency("node", p)), s.push(this.getDependency("accessor", u)), o.push(this.getDependency("accessor", y)), a.push(f), c.push(g);
    }
    return Promise.all([
      Promise.all(r),
      Promise.all(s),
      Promise.all(o),
      Promise.all(a),
      Promise.all(c)
    ]).then(function(l) {
      const d = l[0], h = l[1], f = l[2], g = l[3], p = l[4], u = [];
      for (let v = 0, m = d.length; v < m; v++) {
        const x = d[v], w = h[v], A = f[v], M = g[v], R = p[v];
        if (x === void 0) continue;
        x.updateMatrix(), x.matrixAutoUpdate = !0;
        let L;
        switch (_r[R.path]) {
          case _r.weights:
            L = Ho;
            break;
          case _r.rotation:
            L = Vs;
            break;
          case _r.position:
          case _r.scale:
          default:
            L = Wo;
            break;
        }
        const _ = x.name ? x.name : x.uuid, F = M.interpolation !== void 0 ? y4[M.interpolation] : Es, S = [];
        _r[R.path] === _r.weights ? x.traverse(function(E) {
          E.isMesh === !0 && E.morphTargetInfluences && S.push(E.name ? E.name : E.uuid);
        }) : S.push(_);
        let T = A.array;
        if (A.normalized) {
          const E = Rd(T.constructor), C = new Float32Array(T.length);
          for (let P = 0, b = T.length; P < b; P++)
            C[P] = T[P] * E;
          T = C;
        }
        for (let E = 0, C = S.length; E < C; E++) {
          const P = new L(
            S[E] + "." + _r[R.path],
            w.array,
            T,
            F
          );
          M.interpolation === "CUBICSPLINE" && (P.createInterpolant = function(I) {
            return new $o(this.times, this.values, this.getValueSize() / 3, I);
          }, P.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), u.push(P);
        }
      }
      const y = i.name ? i.name : "animation_" + e;
      return new jo(y, void 0, u);
    });
  }
  createNodeMesh(e) {
    const t = this.json, i = this, r = t.nodes[e];
    return r.mesh === void 0 ? null : i.getDependency("mesh", r.mesh).then(function(s) {
      const o = i._getNodeRef(i.meshCache, r.mesh, s);
      return r.weights !== void 0 && o.traverse(function(a) {
        if (a.isMesh)
          for (let c = 0, l = r.weights.length; c < l; c++)
            a.morphTargetInfluences[c] = r.weights[c];
      }), o;
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
   * @param {number} nodeIndex
   * @return {Promise<Object3D>}
   */
  loadNode(e) {
    const t = this.json, i = this.extensions, r = this, s = t.nodes[e], o = s.name ? r.createUniqueName(s.name) : "";
    return function() {
      const a = [], c = r._invokeOne(function(l) {
        return l.createNodeMesh && l.createNodeMesh(e);
      });
      return c && a.push(c), s.camera !== void 0 && a.push(r.getDependency("camera", s.camera).then(function(l) {
        return r._getNodeRef(r.cameraCache, s.camera, l);
      })), r._invokeAll(function(l) {
        return l.createNodeAttachment && l.createNodeAttachment(e);
      }).forEach(function(l) {
        a.push(l);
      }), Promise.all(a);
    }().then(function(a) {
      let c;
      if (s.isBone === !0 ? c = new yl() : a.length > 1 ? c = new _i() : a.length === 1 ? c = a[0] : c = new ut(), c !== a[0])
        for (let l = 0, d = a.length; l < d; l++)
          c.add(a[l]);
      if (s.name && (c.userData.name = s.name, c.name = o), fs(c, s), s.extensions && Sa(i, c, s), s.matrix !== void 0) {
        const l = new Xe();
        l.fromArray(s.matrix), c.applyMatrix4(l);
      } else
        s.translation !== void 0 && c.position.fromArray(s.translation), s.rotation !== void 0 && c.quaternion.fromArray(s.rotation), s.scale !== void 0 && c.scale.fromArray(s.scale);
      return r.associations.set(c, { type: "nodes", index: e }), c;
    });
  }
  /**
   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
   * @param {number} sceneIndex
   * @return {Promise<Group>}
   */
  loadScene(e) {
    const t = this.json, i = this.extensions, r = this.json.scenes[e], s = this, o = new _i();
    r.name && (o.name = s.createUniqueName(r.name)), fs(o, r), r.extensions && Sa(i, o, r);
    const a = r.nodes || [], c = [];
    for (let l = 0, d = a.length; l < d; l++)
      c.push(pM(a[l], o, t, s));
    return Promise.all(c).then(function() {
      return o;
    });
  }
}
function pM(n, e, t, i) {
  const r = t.nodes[n];
  return i.getDependency("node", n).then(function(s) {
    if (r.skin === void 0) return s;
    let o;
    return i.getDependency("skin", r.skin).then(function(a) {
      o = a;
      const c = [];
      for (let l = 0, d = o.joints.length; l < d; l++)
        c.push(i.getDependency("node", o.joints[l]));
      return Promise.all(c);
    }).then(function(a) {
      return s.traverse(function(c) {
        if (!c.isMesh) return;
        const l = [], d = [];
        for (let h = 0, f = a.length; h < f; h++) {
          const g = a[h];
          if (g) {
            l.push(g);
            const p = new Xe();
            o.inverseBindMatrices !== void 0 && p.fromArray(o.inverseBindMatrices.array, h * 16), d.push(p);
          } else
            console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', o.joints[h]);
        }
        c.bind(new bl(l, d), c.matrixWorld);
      }), s;
    });
  }).then(function(s) {
    e.add(s);
    const o = [];
    if (r.children) {
      const a = r.children;
      for (let c = 0, l = a.length; c < l; c++) {
        const d = a[c];
        o.push(pM(d, s, t, i));
      }
    }
    return Promise.all(o);
  });
}
function S4(n, e, t) {
  const i = e.attributes, r = new Nn();
  if (i.POSITION !== void 0) {
    const a = t.json.accessors[i.POSITION], c = a.min, l = a.max;
    if (c !== void 0 && l !== void 0) {
      if (r.set(
        new Q(c[0], c[1], c[2]),
        new Q(l[0], l[1], l[2])
      ), a.normalized) {
        const d = Rd(Ka[a.componentType]);
        r.min.multiplyScalar(d), r.max.multiplyScalar(d);
      }
    } else {
      console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
      return;
    }
  } else
    return;
  const s = e.targets;
  if (s !== void 0) {
    const a = new Q(), c = new Q();
    for (let l = 0, d = s.length; l < d; l++) {
      const h = s[l];
      if (h.POSITION !== void 0) {
        const f = t.json.accessors[h.POSITION], g = f.min, p = f.max;
        if (g !== void 0 && p !== void 0) {
          if (c.setX(Math.max(Math.abs(g[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(g[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(g[2]), Math.abs(p[2]))), f.normalized) {
            const u = Rd(Ka[f.componentType]);
            c.multiplyScalar(u);
          }
          a.max(c);
        } else
          console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
      }
    }
    r.expandByVector(a);
  }
  n.boundingBox = r;
  const o = new mr();
  r.getCenter(o.center), o.radius = r.min.distanceTo(r.max) / 2, n.boundingSphere = o;
}
function Mv(n, e, t) {
  const i = e.attributes, r = [];
  function s(o, a) {
    return t.getDependency("accessor", o).then(function(c) {
      n.setAttribute(a, c);
    });
  }
  for (const o in i) {
    const a = Ld[o] || o.toLowerCase();
    a in n.attributes || r.push(s(i[o], a));
  }
  if (e.indices !== void 0 && !n.index) {
    const o = t.getDependency("accessor", e.indices).then(function(a) {
      n.setIndex(a);
    });
    r.push(o);
  }
  return fs(n, e), S4(n, e, t), Promise.all(r).then(function() {
    return e.targets !== void 0 ? x4(n, e.targets, t) : n;
  });
}
function wv(n, e) {
  let t = n.getIndex();
  if (t === null) {
    const o = [], a = n.getAttribute("position");
    if (a !== void 0) {
      for (let c = 0; c < a.count; c++)
        o.push(c);
      n.setIndex(o), t = n.getIndex();
    } else
      return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), n;
  }
  const i = t.count - 2, r = [];
  if (e === wf)
    for (let o = 1; o <= i; o++)
      r.push(t.getX(0)), r.push(t.getX(o)), r.push(t.getX(o + 1));
  else
    for (let o = 0; o < i; o++)
      o % 2 === 0 ? (r.push(t.getX(o)), r.push(t.getX(o + 1)), r.push(t.getX(o + 2))) : (r.push(t.getX(o + 2)), r.push(t.getX(o + 1)), r.push(t.getX(o)));
  r.length / 3 !== i && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
  const s = n.clone();
  return s.setIndex(r), s;
}
const _4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  GLTFLoader: r4
}, Symbol.toStringTag, { value: "Module" })), T4 = /* @__PURE__ */ au(_4);
var Rh = { exports: {} }, Av;
function E4() {
  return Av || (Av = 1, function(n) {
    function e(l) {
      var d = {};
      function h(g) {
        if (d[g])
          return d[g].exports;
        var p = d[g] = {
          /******/
          i: g,
          /******/
          l: !1,
          /******/
          exports: {}
          /******/
        };
        return l[g].call(p.exports, p, p.exports, h), p.l = !0, p.exports;
      }
      h.m = l, h.c = d, h.i = function(g) {
        return g;
      }, h.d = function(g, p, u) {
        h.o(g, p) || Object.defineProperty(g, p, {
          /******/
          configurable: !1,
          /******/
          enumerable: !0,
          /******/
          get: u
          /******/
        });
      }, h.r = function(g) {
        Object.defineProperty(g, "__esModule", { value: !0 });
      }, h.n = function(g) {
        var p = g && g.__esModule ? (
          /******/
          function() {
            return g.default;
          }
        ) : (
          /******/
          function() {
            return g;
          }
        );
        return h.d(p, "a", p), p;
      }, h.o = function(g, p) {
        return Object.prototype.hasOwnProperty.call(g, p);
      }, h.p = "/", h.oe = function(g) {
        throw console.error(g), g;
      };
      var f = h(h.s = ENTRY_MODULE);
      return f.default || f;
    }
    var t = "[\\.|\\-|\\+|\\w|/|@]+", i = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + t + ").*?\\)";
    function r(l) {
      return (l + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
    }
    function s(l) {
      return !isNaN(1 * l);
    }
    function o(l, d, h) {
      var f = {};
      f[h] = [];
      var g = d.toString(), p = g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
      if (!p) return f;
      for (var u = p[1], y = new RegExp("(\\\\n|\\W)" + r(u) + i, "g"), v; v = y.exec(g); )
        v[3] !== "dll-reference" && f[h].push(v[3]);
      for (y = new RegExp("\\(" + r(u) + '\\("(dll-reference\\s(' + t + '))"\\)\\)' + i, "g"); v = y.exec(g); )
        l[v[2]] || (f[h].push(v[1]), l[v[2]] = __webpack_require__(v[1]).m), f[v[2]] = f[v[2]] || [], f[v[2]].push(v[4]);
      for (var m = Object.keys(f), x = 0; x < m.length; x++)
        for (var w = 0; w < f[m[x]].length; w++)
          s(f[m[x]][w]) && (f[m[x]][w] = 1 * f[m[x]][w]);
      return f;
    }
    function a(l) {
      var d = Object.keys(l);
      return d.reduce(function(h, f) {
        return h || l[f].length > 0;
      }, !1);
    }
    function c(l, d) {
      for (var h = {
        main: [d]
      }, f = {
        main: []
      }, g = {
        main: {}
      }; a(h); )
        for (var p = Object.keys(h), u = 0; u < p.length; u++) {
          var y = p[u], v = h[y], m = v.pop();
          if (g[y] = g[y] || {}, !(g[y][m] || !l[y][m])) {
            g[y][m] = !0, f[y] = f[y] || [], f[y].push(m);
            for (var x = o(l, l[y][m], y), w = Object.keys(x), A = 0; A < w.length; A++)
              h[w[A]] = h[w[A]] || [], h[w[A]] = h[w[A]].concat(x[w[A]]);
          }
        }
      return f;
    }
    n.exports = function(l, d) {
      d = d || {};
      var h = {
        main: __webpack_modules__
      }, f = d.all ? { main: Object.keys(h.main) } : c(h, l), g = "";
      Object.keys(f).filter(function(m) {
        return m !== "main";
      }).forEach(function(m) {
        for (var x = 0; f[m][x]; )
          x++;
        f[m].push(x), h[m][x] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", g = g + "var " + m + " = (" + e.toString().replace("ENTRY_MODULE", JSON.stringify(x)) + ")({" + f[m].map(function(w) {
          return "" + JSON.stringify(w) + ": " + h[m][w].toString();
        }).join(",") + `});
`;
      }), g = g + "new ((" + e.toString().replace("ENTRY_MODULE", JSON.stringify(l)) + ")({" + f.main.map(function(m) {
        return "" + JSON.stringify(m) + ": " + h.main[m].toString();
      }).join(",") + "}))(self);";
      var p = new window.Blob([g], { type: "text/javascript" });
      if (d.bare)
        return p;
      var u = window.URL || window.webkitURL || window.mozURL || window.msURL, y = u.createObjectURL(p), v = new window.Worker(y);
      return v.objectURL = y, v;
    };
  }(Rh)), Rh.exports;
}
function C4(n) {
  var e = this.constructor;
  return this.then(
    function(t) {
      return e.resolve(n()).then(function() {
        return t;
      });
    },
    function(t) {
      return e.resolve(n()).then(function() {
        return e.reject(t);
      });
    }
  );
}
function L4(n) {
  var e = this;
  return new e(function(t, i) {
    if (!(n && typeof n.length < "u"))
      return i(
        new TypeError(
          typeof n + " " + n + " is not iterable(cannot read property Symbol(Symbol.iterator))"
        )
      );
    var r = Array.prototype.slice.call(n);
    if (r.length === 0) return t([]);
    var s = r.length;
    function o(c, l) {
      if (l && (typeof l == "object" || typeof l == "function")) {
        var d = l.then;
        if (typeof d == "function") {
          d.call(
            l,
            function(h) {
              o(c, h);
            },
            function(h) {
              r[c] = { status: "rejected", reason: h }, --s === 0 && t(r);
            }
          );
          return;
        }
      }
      r[c] = { status: "fulfilled", value: l }, --s === 0 && t(r);
    }
    for (var a = 0; a < r.length; a++)
      o(a, r[a]);
  });
}
function mM(n, e) {
  this.name = "AggregateError", this.errors = n, this.message = e || "";
}
mM.prototype = Error.prototype;
function R4(n) {
  var e = this;
  return new e(function(t, i) {
    if (!(n && typeof n.length < "u"))
      return i(new TypeError("Promise.any accepts an array"));
    var r = Array.prototype.slice.call(n);
    if (r.length === 0) return i();
    for (var s = [], o = 0; o < r.length; o++)
      try {
        e.resolve(r[o]).then(t).catch(function(a) {
          s.push(a), s.length === r.length && i(
            new mM(
              s,
              "All promises were rejected"
            )
          );
        });
      } catch (a) {
        i(a);
      }
  });
}
var F4 = setTimeout;
function gM(n) {
  return !!(n && typeof n.length < "u");
}
function P4() {
}
function I4(n, e) {
  return function() {
    n.apply(e, arguments);
  };
}
function Dt(n) {
  if (!(this instanceof Dt))
    throw new TypeError("Promises must be constructed via new");
  if (typeof n != "function") throw new TypeError("not a function");
  this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], yM(n, this);
}
function vM(n, e) {
  for (; n._state === 3; )
    n = n._value;
  if (n._state === 0) {
    n._deferreds.push(e);
    return;
  }
  n._handled = !0, Dt._immediateFn(function() {
    var t = n._state === 1 ? e.onFulfilled : e.onRejected;
    if (t === null) {
      (n._state === 1 ? Fd : qa)(e.promise, n._value);
      return;
    }
    var i;
    try {
      i = t(n._value);
    } catch (r) {
      qa(e.promise, r);
      return;
    }
    Fd(e.promise, i);
  });
}
function Fd(n, e) {
  try {
    if (e === n)
      throw new TypeError("A promise cannot be resolved with itself.");
    if (e && (typeof e == "object" || typeof e == "function")) {
      var t = e.then;
      if (e instanceof Dt) {
        n._state = 3, n._value = e, Pd(n);
        return;
      } else if (typeof t == "function") {
        yM(I4(t, e), n);
        return;
      }
    }
    n._state = 1, n._value = e, Pd(n);
  } catch (i) {
    qa(n, i);
  }
}
function qa(n, e) {
  n._state = 2, n._value = e, Pd(n);
}
function Pd(n) {
  n._state === 2 && n._deferreds.length === 0 && Dt._immediateFn(function() {
    n._handled || Dt._unhandledRejectionFn(n._value);
  });
  for (var e = 0, t = n._deferreds.length; e < t; e++)
    vM(n, n._deferreds[e]);
  n._deferreds = null;
}
function O4(n, e, t) {
  this.onFulfilled = typeof n == "function" ? n : null, this.onRejected = typeof e == "function" ? e : null, this.promise = t;
}
function yM(n, e) {
  var t = !1;
  try {
    n(
      function(i) {
        t || (t = !0, Fd(e, i));
      },
      function(i) {
        t || (t = !0, qa(e, i));
      }
    );
  } catch (i) {
    if (t) return;
    t = !0, qa(e, i);
  }
}
Dt.prototype.catch = function(n) {
  return this.then(null, n);
};
Dt.prototype.then = function(n, e) {
  var t = new this.constructor(P4);
  return vM(this, new O4(n, e, t)), t;
};
Dt.prototype.finally = C4;
Dt.all = function(n) {
  return new Dt(function(e, t) {
    if (!gM(n))
      return t(new TypeError("Promise.all accepts an array"));
    var i = Array.prototype.slice.call(n);
    if (i.length === 0) return e([]);
    var r = i.length;
    function s(a, c) {
      try {
        if (c && (typeof c == "object" || typeof c == "function")) {
          var l = c.then;
          if (typeof l == "function") {
            l.call(
              c,
              function(d) {
                s(a, d);
              },
              t
            );
            return;
          }
        }
        i[a] = c, --r === 0 && e(i);
      } catch (d) {
        t(d);
      }
    }
    for (var o = 0; o < i.length; o++)
      s(o, i[o]);
  });
};
Dt.any = R4;
Dt.allSettled = L4;
Dt.resolve = function(n) {
  return n && typeof n == "object" && n.constructor === Dt ? n : new Dt(function(e) {
    e(n);
  });
};
Dt.reject = function(n) {
  return new Dt(function(e, t) {
    t(n);
  });
};
Dt.race = function(n) {
  return new Dt(function(e, t) {
    if (!gM(n))
      return t(new TypeError("Promise.race accepts an array"));
    for (var i = 0, r = n.length; i < r; i++)
      Dt.resolve(n[i]).then(e, t);
  });
};
Dt._immediateFn = // @ts-ignore
typeof setImmediate == "function" && function(n) {
  setImmediate(n);
} || function(n) {
  F4(n, 0);
};
Dt._unhandledRejectionFn = function(e) {
  typeof console < "u" && console && console.warn("Possible Unhandled Promise Rejection:", e);
};
const D4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Dt
}, Symbol.toStringTag, { value: "Module" })), N4 = /* @__PURE__ */ au(D4);
(function(n, e) {
  (function(i, r) {
    n.exports = r();
  })(Lr, () => (
    /******/
    (() => {
      var t = [
        /* 0 */
        /***/
        (o, a, c) => {
          c(1);
          var l = c(2), d = l.version, h = function() {
            this.Revision = d, this.defaultMaterialColor = 16777215, this.defaultOpacity = 1, this.modelPrefix = void 0, this.Geometry = c(3).Geometry, this.Glyph = c(16).Glyph, this.Glyphset = c(18).Glyphset, this.Pointset = c(22).Pointset, this.Label = c(17).Label, this.Lines = c(24).Lines, this.TextureArray = c(25).TextureArray, this.TextureSlides = c(27).TextureSlides, this.Renderer = c(30).Renderer, this.Scene = c(32).Scene, this.GeometryCSG = c(51).GeometryCSG, this.GlyphsetCSG = c(57).GlyphsetCSG, this.Viewport = c(44).Viewport, this.CameraControls = c(44).CameraControls, this.SmoothCameraTransition = c(44).SmoothCameraTransition, this.RayCaster = c(44).RayCaster, this.CameraAutoTumble = c(44).CameraAutoTumble, this.StereoEffect = c(44).StereoEffect, this.loadExternalFile = c(5).loadExternalFile, this.loadExternalFiles = c(5).loadExternalFiles, this.THREE = c(4);
          };
          o.exports = new h();
        },
        /* 1 */
        /***/
        (o) => {
          o.exports = _3();
        },
        /* 2 */
        /***/
        (o) => {
          o.exports = /* @__PURE__ */ JSON.parse('{"name":"zincjs","version":"1.16.2","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch;  npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}');
        },
        /* 3 */
        /***/
        function(o, a, c) {
          var l = c(4), d = c(5).toBufferGeometry, h = (g, p, u) => {
            var y = d(g, u), v = !1;
            1 > u.opacity && (v = !0);
            var m;
            if (y._video === void 0) {
              var x = u.localTimeEnabled || u.localMorphColour;
              p ? (m = p, m.morphTargets = x, m.morphNormals = u.localTimeEnabled) : y instanceof l.BufferGeometry && y.attributes.color === void 0 ? m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: x, morphNormals: u.localTimeEnabled, transparent: v, opacity: u.opacity, side: l.DoubleSide }) : m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: x, morphNormals: u.localTimeEnabled, vertexColors: l.VertexColors, transparent: v, opacity: u.opacity, side: l.DoubleSide }), u.localMorphColour && y.morphAttributes.color && (m.onBeforeCompile = c(9).augmentMorphColor());
            } else {
              var w = y._video.createCanvasVideoTexture();
              m = new l.MeshBasicMaterial({ morphTargets: u.localTimeEnabled, color: new l.Color(1, 1, 1), transparent: v, opacity: u.opacity, map: w, side: l.DoubleSide }), this.videoHandler = y._video;
            }
            return new l.Mesh(y, m);
          }, f = function() {
            c(10).ZincObject.call(this), this.videoHandler = void 0, this.isGeometry = !0, this.createMesh = (g, p, u) => {
              if (!(this.morph && this.morph.geometry && g != null)) {
                var y = h(g, p, u);
                this.setMesh(y, u.localTimeEnabled, u.localMorphColour);
              }
            }, this.calculateUVs = () => {
              this.geometry.computeBoundingBox();
              var g = this.geometry.boundingBox.max, p = this.geometry.boundingBox.min, u = new l.Vector2(0 - p.x, 0 - p.y), y = new l.Vector2(g.x - p.x, g.y - p.y);
              this.geometry.faceVertexUvs[0] = [];
              for (var v = 0; v < this.geometry.faces.length; v++) {
                var m = this.geometry.vertices[this.geometry.faces[v].a], x = this.geometry.vertices[this.geometry.faces[v].b], w = this.geometry.vertices[this.geometry.faces[v].c];
                geometry.faceVertexUvs[0].push([new l.Vector2((m.x + u.x) / y.x, (m.y + u.y) / y.y), new l.Vector2((x.x + u.x) / y.x, (x.y + u.y) / y.y), new l.Vector2((w.x + u.x) / y.x, (w.y + u.y) / y.y)]);
              }
              geometry.uvsNeedUpdate = !0;
            }, this.checkTransparentMesh = function() {
              this._lod.checkTransparentMesh();
            }, this.setWireframe = (g) => {
              this.morph.material.wireframe = g;
            }, this.editVertices = function(g, p) {
              if (g && g.length) {
                var u = this.getMorph(), y = u.geometry.getAttribute("position");
                if (!u || 0 > p) return;
                var v = 3 * p;
                g.forEach((m) => {
                  y.array[v++] = m[0], y.array[v++] = m[1], y.array[v++] = m[2];
                }), y.needsUpdate = !0, u.geometry.computeBoundingBox(), u.geometry.computeBoundingSphere(), this.boundingBoxUpdateRequired = !0;
              }
            };
          };
          f.prototype = Object.create(c(10).ZincObject.prototype), a.Geometry = f;
        },
        /* 4 */
        /***/
        (o) => {
          o.exports = zB;
        },
        /* 5 */
        /***/
        (o, a, c) => {
          function l(_) {
            throw new TypeError('"' + _ + '" is read-only');
          }
          var d = c(4), h = c(6).Geometry, f = c(7).default;
          function g(_) {
            var F = _, S = c(0).modelPrefix;
            return S && (S[S.length - 1] != "/" && l("prefix"), /^(?:[a-z]+:)?\/\//i.test(_) || (F = S + _)), F;
          }
          function p(_, F) {
            var S = (E, C) => {
              try {
                var P = new URL(E, C).href;
                if (E && 2 > E.split("?").length) {
                  var b = C.split("?");
                  b.length === 2 && (P = P + "?" + b[1]);
                }
                return P;
              } catch {
                console.error("There is an issue creating the url link with: ".concat(E, "."));
              }
            };
            if (!Array.isArray(_)) return S(_, F);
            var T = [];
            return _.forEach((E) => {
              T.push(S(E, F));
            }), T;
          }
          function u(_, F, S, T, E) {
            var C = _.morphTargetInfluences, P = void 0;
            _.geometry && (P = _.geometry.morphAttributes);
            var b = !1;
            if (C && P && P.position) {
              T.set(0, 0, 0), E.set(0, 0, 0);
              for (var I = 0; I < C.length; I++) 0 < C[I] && (b = !0, S.setFromArray(P.position[I].array), T.add(S.min.multiplyScalar(C[I])), E.add(S.max.multiplyScalar(C[I])));
              b && F.set(T, E);
            }
            b || F.setFromBufferAttribute(_.geometry.attributes.position), _.updateWorldMatrix(!0, !0), F.applyMatrix4(_.matrixWorld);
          }
          function y(_, F, S, T) {
            var E = new XMLHttpRequest();
            E.open("GET", g(_), !0), E.onreadystatechange = () => {
              E.readyState == 4 && (E.status == 200 ? S(E.responseText, F) : T(_));
            }, E.send(null);
          }
          function v(_, F, S) {
            function T(I, D) {
              P[D] = I, C++, C == E && F(P);
            }
            for (var E = _.length, C = 0, P = [], b = 0; b < E; b++) y(_[b], b, T, S);
          }
          a.getColorsRGB = (_, F) => {
            var S = Math.floor(F / 3), T = F % 3, E = 0;
            T == 0 ? E = _[S].r : T == 1 ? E = _[S].g : T == 2 && (E = _[S].b);
            var C = new d.Color(E);
            return [C.r, C.g, C.b];
          }, a.updateMorphColorAttribute = function(_, F) {
            if (F && _ && _.morphAttributes && _.morphAttributes.color) {
              var S = _.morphAttributes.color, T = F.morphTargetInfluences, E = T.length;
              _.deleteAttribute("morphColor0"), _.deleteAttribute("morphColor1");
              for (var C = 0, P = [], b = 0; 1 > C || b < E; b++) 0 < T[b] && (C++, P.push([b, T[b]]));
              P.length == 2 ? (_.setAttribute("morphColor0", S[P[0][0]]), _.setAttribute("morphColor1", S[P[1][0]])) : P.length == 1 && (_.setAttribute("morphColor0", S[P[0][0]]), _.setAttribute("morphColor1", S[P[0][0]]));
            }
          }, a.toBufferGeometry = (_, F) => {
            var S;
            return _ instanceof h ? (F.localTimeEnabled && !_.morphNormalsReady && (_.morphNormals == null || _.morphNormals.length == 0) && _.computeMorphNormals(), S = _.toIndexedBufferGeometry(), F.localMorphColour && m(_, S)) : _ instanceof d.BufferGeometry && (S = _.clone()), S.colorsNeedUpdate = !0, S.computeBoundingBox(), S.computeBoundingSphere(), _._video && (S._video = _._video), S;
          }, a.copyMorphColorsToBufferGeometry = (_, F) => {
            if (_ && _.morphColors && 0 < _.morphColors.length) {
              for (var S = [], T = _.morphColors, E = c(5).getColorsRGB, C = 0, P = T.length; C < P; C++) {
                for (var b = T[C], I = [], D = 0; D < _.faces.length; D++) {
                  var N = _.faces[D], U = E(b.colors, N.a);
                  I.push(U[0], U[1], U[2]), U = E(b.colors, N.b), I.push(U[0], U[1], U[2]), U = E(b.colors, N.c), I.push(U[0], U[1], U[2]);
                }
                var B = new d.Float32BufferAttribute(3 * (3 * _.faces.length), 3);
                B.name = b.name, S.push(B.copyArray(I));
              }
              F.morphAttributes.color = S;
            }
          };
          var m = (_, F) => {
            if (_ && _.morphColors && 0 < _.morphColors.length) {
              for (var S = [], T = _.morphColors, E = c(5).getColorsRGB, C = 0, P = T.length; C < P; C++) {
                for (var b, I = T[C], D = [], N = 0; N < 3 * I.colors.length; N++) b = E(I.colors, N), D.push(b[0], b[1], b[2]);
                var U = new d.Float32BufferAttribute(D, 3);
                U.name = I.name, S.push(U);
              }
              F.morphAttributes.color = S;
            }
          };
          function x(_) {
            for (var F, S, T, E, C = -1, P = 0, b = 0; b < _.length; ++b) {
              if (E = _[b], F === void 0 && (F = E.array.constructor), F !== E.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
              if (S === void 0 && (S = E.itemSize), S !== E.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null;
              if (T === void 0 && (T = E.normalized), T !== E.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null;
              if (C === -1 && (C = E.gpuType), C !== E.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
              P += E.count * S;
            }
            for (var I, D = new F(P), N = new d.BufferAttribute(D, S, T), U = 0, B = 0; B < _.length; ++B) {
              if (I = _[B], I.isInterleavedBufferAttribute) for (var G = U / S, J = 0, j = I.count; J < j; J++) for (var te, ee = 0; ee < S; ee++) te = I.getComponent(J, ee), N.setComponent(J + G, ee, te);
              else D.set(I.array, U);
              U += I.count * S;
            }
            return C !== void 0 && (N.gpuType = C), N;
          }
          a.mergeGeometries = function(_) {
            for (var F = 1 < arguments.length && arguments[1] !== void 0 && arguments[1], S = _[0].index !== null, T = new Set(Object.keys(_[0].attributes)), E = new Set(Object.keys(_[0].morphAttributes)), C = {}, P = {}, b = _[0].morphTargetsRelative, I = new d.BufferGeometry(), D = 0, N = 0; N < _.length; ++N) {
              var U = _[N], B = 0;
              if (S !== (U.index !== null)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
              for (var G in U.attributes) {
                if (!T.has(G)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + '. All geometries must have compatible attributes; make sure "' + G + '" attribute exists among all geometries, or in none of them.'), null;
                C[G] === void 0 && (C[G] = []), C[G].push(U.attributes[G]), B++;
              }
              if (B !== T.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". Make sure all geometries have the same number of attributes."), null;
              if (b !== U.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
              for (var J in U.morphAttributes) {
                if (!E.has(J)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ".  .morphAttributes must be consistent throughout all geometries."), null;
                P[J] === void 0 && (P[J] = []), P[J].push(U.morphAttributes[J]);
              }
              if (F) {
                var j = void 0;
                if (S) j = U.index.count;
                else if (U.attributes.position !== void 0) j = U.attributes.position.count;
                else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". The geometry must have either an index or a position attribute"), null;
                I.addGroup(D, j, N), D += j;
              }
            }
            if (S) {
              for (var te, ee = 0, ae = [], H = 0; H < _.length; ++H) {
                te = _[H].index;
                for (var Z = 0; Z < te.count; ++Z) ae.push(te.getX(Z) + ee);
                ee += _[H].attributes.position.count;
              }
              I.setIndex(ae);
            }
            for (var $ in C) {
              var se = x(C[$]);
              if (!se) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + $ + " attribute."), null;
              I.setAttribute($, se);
            }
            for (var k in P) {
              var W = P[k][0].length;
              if (W === 0) break;
              I.morphAttributes = I.morphAttributes || {}, I.morphAttributes[k] = [];
              for (var q, ce = 0; ce < W; ++ce) {
                q = [];
                for (var oe = 0; oe < P[k].length; ++oe) q.push(P[k][oe][ce]);
                var V = x(q);
                if (!V) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + k + " morphAttribute."), null;
                I.morphAttributes[k].push(V);
              }
            }
            return I;
          }, a.mergeVertices = function(_) {
            var F = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 1e-4;
            F = Math.max(F, Number.EPSILON);
            for (var S, T = {}, E = _.getIndex(), C = _.getAttribute("position"), P = E ? E.count : C.count, b = 0, I = Object.keys(_.attributes), D = {}, N = {}, be = [], U = ["getX", "getY", "getZ", "getW"], B = 0, G = I.length; B < G; B++) {
              S = I[B], D[S] = [];
              var J = _.morphAttributes[S];
              J && (N[S] = Array(J.length).fill().map(() => []));
            }
            for (var j = Math.log10(1 / F), te = Math.pow(10, j), B = 0; B < P; B++) {
              for (var ee = E ? E.getX(B) : B, ae = "", H = 0, G = I.length; H < G; H++) for (var S = I[H], Z = _.getAttribute(S), $ = Z.itemSize, se = 0; se < $; se++)
                ae += "".concat(~~(Z[U[se]](ee) * te), ",");
              if (ae in T) be.push(T[ae]);
              else {
                for (var H = 0, G = I.length; H < G; H++) for (var k, S = I[H], Z = _.getAttribute(S), J = _.morphAttributes[S], $ = Z.itemSize, W = D[S], q = N[S], se = 0; se < $; se++) if (k = U[se], W.push(Z[k](ee)), J) for (var ce = 0, oe = J.length; ce < oe; ce++) q[ce].push(J[ce][k](ee));
                T[ae] = b, be.push(b), b++;
              }
            }
            for (var V = _.clone(), B = 0, G = I.length; B < G; B++) {
              var Z, S = I[B], O = _.getAttribute(S), X = new O.array.constructor(D[S]);
              if (O.isInterleavedBufferAttribute ? Z = new d.BufferAttribute(X, O.itemSize, O.itemSize) : (Z = _.getAttribute(S).clone(), Z.setArray(X)), V.setAttribute(S, Z), S in N) for (var Y, H = 0; H < N[S].length; H++) Y = _.morphAttributes[S][H].clone(), Y.setArray(new Y.array.constructor(N[S][H])), V.morphAttributes[S][H] = Y;
            }
            var ie = Uint8Array;
            be.length >= Math.pow(2, 8) && (ie = Uint16Array), be.length >= Math.pow(2, 16) && (ie = Uint32Array);
            var fe = new ie(be), be = null;
            return E === null ? be = new d.BufferAttribute(fe, 1) : (be = _.getIndex().clone(), be.setArray(fe)), V.setIndex(be), V;
          };
          function w(_) {
            if (_.isMeshPhongMaterial) {
              var F = new d.MeshToonMaterial({ color: _.color.clone(), morphTargets: _.morphTargets, morphNormals: _.morphNormals, vertexColors: _.vertexColors, transparent: _.transparent, opacity: _.opacity, side: _.side });
              return _.map && (F.map = _.map), F;
            }
            return _;
          }
          function A(_, F) {
            if (F && _ >= F.length) {
              var S = new d.BufferGeometry(), T = new Float32Array(3 * _), E = 0;
              return F.forEach((C) => {
                T[E++] = C[0], T[E++] = C[1], T[E++] = C[2];
              }), S.setAttribute("position", new d.BufferAttribute(T, 3)), S.setDrawRange(0, F.length), S;
            }
          }
          function M() {
            var _ = new Image();
            _.src = c(8);
            var F = new d.Texture();
            return F.image = _, F.needsUpdate = !0, F;
          }
          function R(_, F, S, T, E, C) {
            var P = new f(_, F, S, T, E, C);
            return P.fontFace = T, P.fontSize = E, P.fontWeight = C, P.material.map.generateMipmaps = !1, P.material.map.anisotropy = 4, P.material.sizeAttenuation = !1, P.material.alphaTest = 0.5, P.material.transparent = !0, P.material.depthWrite = !1, P.material.depthTest = !1, P.center.set(0.5, -1.2), P.renderOrder = 1e4, P;
          }
          function L(_, F, S) {
            if (S) {
              var T = _ || "", E = F || "", C = S.lastIndexOf("/");
              if (-1 < C) {
                var P = void 0, b = void 0;
                if (P = S.substring(0, C), b = S.substring(C + 1), (P === "*" || P === "**" || P.toLowerCase() === T.toLowerCase()) && (b === "*" || b === "**" || b.toLowerCase() === E.toLowerCase())) return !0;
              } else if (T.toLowerCase() === S.toLowerCase() || E.toLowerCase() === S.toLowerCase()) return !0;
            }
            return !1;
          }
          a.getBoundingBox = u, a.createNewURL = p, a.createBufferGeometry = A, a.getCircularTexture = M, a.resolveURL = g, a.loadExternalFile = y, a.loadExternalFiles = v, a.PhongToToon = w, a.createNewSpriteText = R, a.isRegionGroup = L;
        },
        /* 6 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            Face3: () => (
              /* binding */
              y
            ),
            /* harmony export */
            Geometry: () => (
              /* binding */
              p
            )
            /* harmony export */
          });
          var l = c(4), d = new l.Matrix4(), h = new l.Object3D(), f = new l.Vector3(), g = new l.Vector3();
          function p() {
            this.uuid = l.MathUtils.generateUUID(), this.name = "", this.type = "Geometry", this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.normals = [], this.uvs = [], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.elementsNeedUpdate = !1, this.verticesNeedUpdate = !1, this.uvsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.lineDistancesNeedUpdate = !1, this.groupsNeedUpdate = !1, this.morphNormalsReady = !1;
          }
          p.prototype = Object.assign(Object.create(l.EventDispatcher.prototype), {
            constructor: p,
            isGeometry: !0,
            applyMatrix4: function(m) {
              for (var x, w = new l.Matrix3().getNormalMatrix(m), A = 0, M = this.vertices.length; A < M; A++) x = this.vertices[A], x.applyMatrix4(m);
              for (var R, L = 0, _ = this.faces.length; L < _; L++) {
                R = this.faces[L], R.normal.applyMatrix3(w).normalize();
                for (var F = 0, S = R.vertexNormals.length; F < S; F++) R.vertexNormals[F].applyMatrix3(w).normalize();
              }
              return this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this;
            },
            rotateX: function(m) {
              return d.makeRotationX(m), this.applyMatrix4(d), this;
            },
            rotateY: function(m) {
              return d.makeRotationY(m), this.applyMatrix4(d), this;
            },
            rotateZ: function(m) {
              return d.makeRotationZ(m), this.applyMatrix4(d), this;
            },
            translate: function(m, x, w) {
              return d.makeTranslation(m, x, w), this.applyMatrix4(d), this;
            },
            scale: function(m, x, w) {
              return d.makeScale(m, x, w), this.applyMatrix4(d), this;
            },
            lookAt: function(m) {
              return h.lookAt(m), h.updateMatrix(), this.applyMatrix4(h.matrix), this;
            },
            fromBufferGeometry: function(m) {
              function x(G, J, j, te) {
                var ee = _ === void 0 ? [] : [w.colors[G].clone(), w.colors[J].clone(), w.colors[j].clone()], ae = L === void 0 ? [] : [new l.Vector3().fromBufferAttribute(L, G), new l.Vector3().fromBufferAttribute(L, J), new l.Vector3().fromBufferAttribute(L, j)], H = new y(G, J, j, ae, ee, te);
                w.faces.push(H), F !== void 0 && w.faceVertexUvs[0].push([new l.Vector2().fromBufferAttribute(F, G), new l.Vector2().fromBufferAttribute(F, J), new l.Vector2().fromBufferAttribute(F, j)]), S !== void 0 && w.faceVertexUvs[1].push([new l.Vector2().fromBufferAttribute(S, G), new l.Vector2().fromBufferAttribute(S, J), new l.Vector2().fromBufferAttribute(S, j)]);
              }
              var w = this, A = m.index === null ? void 0 : m.index, M = m.attributes;
              if (M.position === void 0) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this;
              var R = M.position, L = M.normal, _ = M.color, F = M.uv, S = M.uv2;
              S !== void 0 && (this.faceVertexUvs[1] = []);
              for (var T = 0; T < R.count; T++) w.vertices.push(new l.Vector3().fromBufferAttribute(R, T)), _ !== void 0 && w.colors.push(new l.Color().fromBufferAttribute(_, T));
              var E = m.groups;
              if (0 < E.length) for (var C = 0; C < E.length; C++) for (var P = E[C], b = P.start, I = P.count, D = b, N = b + I; D < N; D += 3) A === void 0 ? x(D, D + 1, D + 2, P.materialIndex) : x(A.getX(D), A.getX(D + 1), A.getX(D + 2), P.materialIndex);
              else if (A !== void 0) for (var U = 0; U < A.count; U += 3) x(A.getX(U), A.getX(U + 1), A.getX(U + 2));
              else for (var B = 0; B < R.count; B += 3) x(B, B + 1, B + 2);
              return this.computeFaceNormals(), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), this;
            },
            center: function() {
              return this.computeBoundingBox(), this.boundingBox.getCenter(f).negate(), this.translate(f.x, f.y, f.z), this;
            },
            normalize: function() {
              this.computeBoundingSphere();
              var m = this.boundingSphere.center, x = this.boundingSphere.radius, w = x === 0 ? 1 : 1 / x, A = new l.Matrix4();
              return A.set(w, 0, 0, -w * m.x, 0, w, 0, -w * m.y, 0, 0, w, -w * m.z, 0, 0, 0, 1), this.applyMatrix4(A), this;
            },
            computeFaceNormals: function() {
              for (var m = new l.Vector3(), x = new l.Vector3(), w = 0, A = this.faces.length; w < A; w++) {
                var M = this.faces[w], R = this.vertices[M.a], L = this.vertices[M.b], _ = this.vertices[M.c];
                m.subVectors(_, L), x.subVectors(R, L), m.cross(x), m.normalize(), M.normal.copy(m);
              }
            },
            computeVertexNormals: function() {
              for (var m = !(0 < arguments.length && arguments[0] !== void 0) || arguments[0], x = Array(this.vertices.length), w = 0, A = this.vertices.length; w < A; w++) x[w] = new l.Vector3();
              if (m)
                for (var M = new l.Vector3(), R = new l.Vector3(), L = 0, _ = this.faces.length; L < _; L++) {
                  var F = this.faces[L], S = this.vertices[F.a], T = this.vertices[F.b], E = this.vertices[F.c];
                  M.subVectors(E, T), R.subVectors(S, T), M.cross(R), x[F.a].add(M), x[F.b].add(M), x[F.c].add(M);
                }
              else {
                this.computeFaceNormals();
                for (var C, P = 0, b = this.faces.length; P < b; P++) C = this.faces[P], x[C.a].add(C.normal), x[C.b].add(C.normal), x[C.c].add(C.normal);
              }
              for (var I = 0, D = this.vertices.length; I < D; I++) x[I].normalize();
              for (var N = 0, U = this.faces.length; N < U; N++) {
                var B = this.faces[N], G = B.vertexNormals;
                G.length === 3 ? (G[0].copy(x[B.a]), G[1].copy(x[B.b]), G[2].copy(x[B.c])) : (G[0] = x[B.a].clone(), G[1] = x[B.b].clone(), G[2] = x[B.c].clone());
              }
              return 0 < this.faces.length && (this.normalsNeedUpdate = !0), x;
            },
            computeFlatVertexNormals: function() {
              this.computeFaceNormals();
              for (var m = 0, x = this.faces.length; m < x; m++) {
                var w = this.faces[m], A = w.vertexNormals;
                A.length === 3 ? (A[0].copy(w.normal), A[1].copy(w.normal), A[2].copy(w.normal)) : (A[0] = w.normal.clone(), A[1] = w.normal.clone(), A[2] = w.normal.clone());
              }
              0 < this.faces.length && (this.normalsNeedUpdate = !0);
            },
            computeMorphNormals: function() {
              for (var m, x = 0, w = this.faces.length; x < w; x++) {
                m = this.faces[x], m.__originalFaceNormal ? m.__originalFaceNormal.copy(m.normal) : m.__originalFaceNormal = m.normal.clone(), m.__originalVertexNormals || (m.__originalVertexNormals = []);
                for (var A = 0, M = m.vertexNormals.length; A < M; A++) m.__originalVertexNormals[A] ? m.__originalVertexNormals[A].copy(m.vertexNormals[A]) : m.__originalVertexNormals[A] = m.vertexNormals[A].clone();
              }
              var R = new p();
              R.faces = this.faces;
              for (var L = 0, _ = this.morphTargets.length; L < _; L++) {
                if (!this.morphNormals[L]) {
                  this.morphNormals[L] = {}, this.morphNormals[L].faceNormals = [], this.morphNormals[L].vertexNormals = [];
                  for (var F = this.morphNormals[L].faceNormals, S = this.morphNormals[L].vertexNormals, T = 0, E = this.faces.length; T < E; T++) {
                    var C = new l.Vector3(), P = { a: new l.Vector3(), b: new l.Vector3(), c: new l.Vector3() };
                    F.push(C), S.push(P);
                  }
                }
                var b = this.morphNormals[L];
                R.vertices = this.morphTargets[L].vertices, R.computeFaceNormals();
                var I = R.computeVertexNormals();
                if (I && 0 < I.length) {
                  this.morphTargets[L].normals = Array(this.vertices.length);
                  for (var D = 0; D < I.length; D++) this.morphTargets[L].normals[D] = I[D].clone();
                }
                for (var N = 0, U = this.faces.length; N < U; N++) {
                  var B = this.faces[N], G = b.faceNormals[N], J = b.vertexNormals[N];
                  G.copy(B.normal), J.a.copy(B.vertexNormals[0]), J.b.copy(B.vertexNormals[1]), J.c.copy(B.vertexNormals[2]);
                }
              }
              for (var j, te = 0, ee = this.faces.length; te < ee; te++) j = this.faces[te], j.normal = j.__originalFaceNormal, j.vertexNormals = j.__originalVertexNormals;
              this.morphNormalsReady = !0;
            },
            computeBoundingBox: function() {
              this.boundingBox === null && (this.boundingBox = new l.Box3()), this.boundingBox.setFromPoints(this.vertices);
            },
            computeBoundingSphere: function() {
              this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingSphere.setFromPoints(this.vertices);
            },
            mergeMorph: function(m, x) {
              var w = this.morphTargets.length, A = this.morphTargets, M = m.morphTargets, R = this.morphColors.length, L = this.morphColors, _ = m.morphColors;
              if (0 < w && w == M.length) for (var F = 0, S = A.length; F < S; F++) {
                for (var T = A[F], E = M[F], C = 0, P = E.vertices.length; C < P; C++) {
                  var b = E.vertices[C], I = b.clone();
                  x !== void 0 && I.applyMatrix4(x), T.vertices.push(I);
                }
                if (T.normals && E.normals) for (var D = 0; D < E.normals.length; D += 3) g.set(E.normals2[D], E.normals2[D + 1], E.normals2[D + 2]), x !== void 0 && g.applyMatrix4(x), T.normals.push(g.x, g.y, g.z);
              }
              if (0 < R && R == _.length) for (var N = 0, U = L.length; N < U; N++) for (var B = L[N], G = _[N], J = 0, j = G.colors; J < j; J++) B.colors.push(G.colors[J].clone());
            },
            merge: function(m, x) {
              var w = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : 0;
              if (!(m && m.isGeometry)) return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", m);
              var A, M = this.vertices.length, R = this.vertices, L = m.vertices, _ = m.normals, F = this.faces, S = m.faces, T = this.colors, E = m.colors;
              x !== void 0 && (A = new l.Matrix3().getNormalMatrix(x));
              for (var C = 0, P = L.length; C < P; C++) {
                var b = L[C], I = b.clone();
                x !== void 0 && I.applyMatrix4(x), R.push(I);
              }
              for (var D = 0; D < _.length; D += 3) g.set(_[D], _[D + 1], _[D + 2]), x !== void 0 && g.applyMatrix4(x), this.normals.push(g.x, g.y, g.z);
              for (var N = 0, U = E.length; N < U; N++) typeof E[N] == "number" ? T.push(E[N]) : T.push(E[N].clone());
              for (var B = 0, G = S.length; B < G; B++) {
                var J = S[B], j = void 0, te = void 0, ee = J.vertexNormals, ae = J.vertexColors, H = new y(J.a + M, J.b + M, J.c + M);
                H.normal.copy(J.normal), A !== void 0 && H.normal.applyMatrix3(A).normalize();
                for (var Z = 0, $ = ee.length; Z < $; Z++) j = ee[Z].clone(), A !== void 0 && j.applyMatrix3(A).normalize(), H.vertexNormals.push(j);
                H.color.copy(J.color);
                for (var se = 0, k = ae.length; se < k; se++) te = ae[se], H.vertexColors.push(te.clone());
                H.materialIndex = J.materialIndex + w, F.push(H);
              }
              for (var W, q = 0, ce = m.faceVertexUvs.length; q < ce; q++) {
                W = m.faceVertexUvs[q], this.faceVertexUvs[q] === void 0 && (this.faceVertexUvs[q] = []);
                for (var oe = 0, V = W.length; oe < V; oe++) {
                  for (var O = W[oe], X = [], Y = 0, ie = O.length; Y < ie; Y++) X.push(O[Y].clone());
                  this.faceVertexUvs[q].push(X);
                }
              }
              this.mergeMorph(m, x);
            },
            mergeMesh: function(m) {
              return m && m.isMesh ? (m.matrixAutoUpdate && m.updateMatrix(), void this.merge(m.geometry, m.matrix)) : void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", m);
            },
            /*
            * Checks for duplicate vertices with hashmap.
            * Duplicated vertices are removed
            * and faces' vertices are updated.
            */
            mergeVertices: function() {
              for (var m = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : 4, x = {}, w = [], A = [], M = Math.pow(10, m), R = 0, L = this.vertices.length; R < L; R++) {
                var _ = this.vertices[R], F = Math.round(_.x * M) + "_" + Math.round(_.y * M) + "_" + Math.round(_.z * M);
                x[F] === void 0 ? (x[F] = R, w.push(this.vertices[R]), A[R] = w.length - 1) : A[R] = A[x[F]];
              }
              for (var S, T = [], E = 0, C = this.faces.length; E < C; E++) {
                S = this.faces[E], S.a = A[S.a], S.b = A[S.b], S.c = A[S.c];
                for (var P = [S.a, S.b, S.c], b = 0; 3 > b; b++) if (P[b] === P[(b + 1) % 3]) {
                  T.push(E);
                  break;
                }
              }
              for (var I, D = T.length - 1; 0 <= D; D--) {
                I = T[D], this.faces.splice(I, 1);
                for (var N = 0, U = this.faceVertexUvs.length; N < U; N++) this.faceVertexUvs[N].splice(I, 1);
              }
              var B = this.vertices.length - w.length;
              return this.vertices = w, B;
            },
            setFromPoints: function(m) {
              this.vertices = [];
              for (var x, w = 0, A = m.length; w < A; w++) x = m[w], this.vertices.push(new l.Vector3(x.x, x.y, x.z || 0));
              return this;
            },
            sortFacesByMaterialIndex: function() {
              for (var m = this.faces, x = m.length, w = 0; w < x; w++) m[w]._id = w;
              m.sort(function(S, T) {
                return S.materialIndex - T.materialIndex;
              });
              var A, M, R = this.faceVertexUvs[0], L = this.faceVertexUvs[1];
              R && R.length === x && (A = []), L && L.length === x && (M = []);
              for (var _, F = 0; F < x; F++) _ = m[F]._id, A && A.push(R[_]), M && M.push(L[_]);
              A && (this.faceVertexUvs[0] = A), M && (this.faceVertexUvs[1] = M);
            },
            toJSON: function() {
              function m(k, W, q) {
                return q ? k | 1 << W : k & ~(1 << W);
              }
              function x(k) {
                var W = k.x.toString() + k.y.toString() + k.z.toString();
                return C[W] === void 0 && (C[W] = E.length / 3, E.push(k.x, k.y, k.z)), C[W];
              }
              function w(k) {
                var W = k.r.toString() + k.g.toString() + k.b.toString();
                return b[W] === void 0 && (b[W] = P.length, P.push(k.getHex())), b[W];
              }
              function A(k) {
                var W = k.x.toString() + k.y.toString();
                return D[W] === void 0 && (D[W] = I.length / 2, I.push(k.x, k.y)), D[W];
              }
              var M = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } };
              if (M.uuid = this.uuid, M.type = this.type, this.name !== "" && (M.name = this.name), this.parameters !== void 0) {
                var R = this.parameters;
                for (var L in R) R[L] !== void 0 && (M[L] = R[L]);
                return M;
              }
              for (var _, F = [], S = 0; S < this.vertices.length; S++) _ = this.vertices[S], F.push(_.x, _.y, _.z);
              for (var T = [], E = [], C = {}, P = [], b = {}, I = [], D = {}, N = 0; N < this.faces.length; N++) {
                var U = this.faces[N], B = !0, G = !1, J = this.faceVertexUvs[0][N] !== void 0, j = 0 < U.normal.length(), te = 0 < U.vertexNormals.length, ee = U.color.r !== 1 || U.color.g !== 1 || U.color.b !== 1, ae = 0 < U.vertexColors.length, H = 0;
                if (H = m(H, 0, 0), H = m(H, 1, B), H = m(H, 2, G), H = m(H, 3, J), H = m(H, 4, j), H = m(H, 5, te), H = m(H, 6, ee), H = m(H, 7, ae), T.push(H), T.push(U.a, U.b, U.c), T.push(U.materialIndex), J) {
                  var Z = this.faceVertexUvs[0][N];
                  T.push(A(Z[0]), A(Z[1]), A(Z[2]));
                }
                if (j && T.push(x(U.normal)), te) {
                  var $ = U.vertexNormals;
                  T.push(x($[0]), x($[1]), x($[2]));
                }
                if (ee && T.push(w(U.color)), ae) {
                  var se = U.vertexColors;
                  T.push(w(se[0]), w(se[1]), w(se[2]));
                }
              }
              return M.data = {}, M.data.vertices = F, M.data.normals = E, 0 < P.length && (M.data.colors = P), 0 < I.length && (M.data.uvs = [I]), M.data.faces = T, M;
            },
            clone: function() {
              return new p().copy(this);
            },
            copy: function(m) {
              this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.name = m.name;
              for (var x = m.vertices, w = 0, A = x.length; w < A; w++) this.vertices.push(x[w].clone());
              for (var M = m.colors, R = 0, L = M.length; R < L; R++) this.colors.push(M[R].clone());
              for (var _ = m.faces, F = 0, S = _.length; F < S; F++) this.faces.push(_[F].clone());
              for (var T, E = 0, C = m.faceVertexUvs.length; E < C; E++) {
                T = m.faceVertexUvs[E], this.faceVertexUvs[E] === void 0 && (this.faceVertexUvs[E] = []);
                for (var P = 0, b = T.length; P < b; P++) {
                  for (var I, D = T[P], N = [], U = 0, B = D.length; U < B; U++) I = D[U], N.push(I.clone());
                  this.faceVertexUvs[E].push(N);
                }
              }
              for (var G, J = m.morphTargets, j = 0, te = J.length; j < te; j++) {
                if (G = {}, G.name = J[j].name, J[j].vertices !== void 0) {
                  G.vertices = [];
                  for (var ee = 0, ae = J[j].vertices.length; ee < ae; ee++) G.vertices.push(J[j].vertices[ee].clone());
                }
                if (J[j].normals !== void 0) {
                  G.normals = [];
                  for (var H = 0, Z = J[j].normals.length; H < Z; H++) G.normals.push(J[j].normals[H].clone());
                }
                this.morphTargets.push(G);
              }
              for (var $, se = m.morphNormals, k = 0, W = se.length; k < W; k++) {
                if ($ = {}, se[k].vertexNormals !== void 0) {
                  $.vertexNormals = [];
                  for (var q = 0, ce = se[k].vertexNormals.length; q < ce; q++) {
                    var oe = se[k].vertexNormals[q], V = {};
                    V.a = oe.a.clone(), V.b = oe.b.clone(), V.c = oe.c.clone(), $.vertexNormals.push(V);
                  }
                }
                if (se[k].faceNormals !== void 0) {
                  $.faceNormals = [];
                  for (var O = 0, X = se[k].faceNormals.length; O < X; O++) $.faceNormals.push(se[k].faceNormals[O].clone());
                }
                this.morphNormals.push($);
              }
              for (var Y = m.skinWeights, ie = 0, fe = Y.length; ie < fe; ie++) this.skinWeights.push(Y[ie].clone());
              for (var be = m.skinIndices, Ae = 0, he = be.length; Ae < he; Ae++) this.skinIndices.push(be[Ae].clone());
              for (var xe = m.lineDistances, re = 0, me = xe.length; re < me; re++) this.lineDistances.push(xe[re]);
              var Me = m.boundingBox;
              Me !== null && (this.boundingBox = Me.clone());
              var De = m.boundingSphere;
              return De !== null && (this.boundingSphere = De.clone()), this.elementsNeedUpdate = m.elementsNeedUpdate, this.verticesNeedUpdate = m.verticesNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.lineDistancesNeedUpdate = m.lineDistancesNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, this;
            },
            computeGroups() {
              var v, m, x = [], w = void 0, A = this.faces;
              for (m = 0; m < A.length; m++) {
                var M = A[m];
                M.materialIndex !== w && (w = M.materialIndex, v !== void 0 && (v.count = 3 * m - v.start, x.push(v)), v = { start: 3 * m, materialIndex: w });
              }
              return v !== void 0 && (v.count = 3 * m - v.start, x.push(v)), x;
            },
            toBufferGeometry: function() {
              var m = new u().fromGeometry(this), x = new l.BufferGeometry(), w = new Float32Array(3 * m.vertices.length);
              if (x.setAttribute("position", new l.BufferAttribute(w, 3).copyVector3sArray(m.vertices)), 0 < m.normals.length) {
                var A = new Float32Array(3 * m.normals.length);
                x.setAttribute("normal", new l.BufferAttribute(A, 3).copyVector3sArray(m.normals));
              }
              if (0 < m.colors.length) {
                var M = new Float32Array(3 * m.colors.length);
                x.setAttribute("color", new l.BufferAttribute(M, 3).copyColorsArray(m.colors));
              }
              if (0 < m.uvs.length) {
                var R = new Float32Array(2 * m.uvs.length);
                x.setAttribute("uv", new l.BufferAttribute(R, 2).copyVector2sArray(m.uvs));
              }
              if (0 < m.uvs2.length) {
                var L = new Float32Array(2 * m.uvs2.length);
                x.setAttribute("uv2", new l.BufferAttribute(L, 2).copyVector2sArray(m.uvs2));
              }
              for (var _ in x.groups = m.groups, m.morphTargets) {
                for (var F = [], S = m.morphTargets[_], T = 0, E = S.length; T < E; T++) {
                  var C = S[T], P = new l.Float32BufferAttribute(3 * C.data.length, 3);
                  P.name = C.name, F.push(P.copyVector3sArray(C.data));
                }
                x.morphAttributes[_] = F;
              }
              if (0 < m.skinIndices.length) {
                var b = new l.Float32BufferAttribute(4 * m.skinIndices.length, 4);
                x.setAttribute("skinIndex", b.copyVector4sArray(m.skinIndices));
              }
              if (0 < m.skinWeights.length) {
                var I = new l.Float32BufferAttribute(4 * m.skinWeights.length, 4);
                x.setAttribute("skinWeight", I.copyVector4sArray(m.skinWeights));
              }
              return m.boundingSphere !== null && (x.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (x.boundingBox = m.boundingBox.clone()), x;
            },
            toIndexedBufferGeometry: function() {
              var m = new l.BufferGeometry(), x = new Float32Array(3 * this.vertices.length);
              if (m.setAttribute("position", new l.BufferAttribute(x, 3).copyVector3sArray(this.vertices)), 0 < this.normals.length) {
                var w = new Float32Array(this.normals.length), A = new l.BufferAttribute(w, 3).copyArray(this.normals);
                m.setAttribute("normal", A);
              }
              if (0 < this.uvs.length && 0 < this.uvs[0].length) {
                var M = new Float32Array(2 * this.uvs[0].length);
                m.setAttribute("uv", new l.BufferAttribute(M, 2).copyArray(this.uvs[0]));
              }
              if (1 < this.uvs.length && 0 < this.uvs[1].length) {
                var R = new Float32Array(2 * this.uvs[1].length);
                m.setAttribute("uv2", new l.BufferAttribute(R, 2).copyArray(this.uvs[1]));
              }
              if (0 < this.colors.length) {
                for (var L = [], _ = 0; _ < this.colors.length; _++) L.push(new l.Color(this.colors[_]));
                var F = new Float32Array(3 * L.length);
                m.setAttribute("color", new l.BufferAttribute(F, 3).copyColorsArray(L));
              } else {
                for (var S = new Float32Array(3 * this.vertices.length), T = 0; T < 3 * this.vertices.length; T++) S[T] = 1;
                m.setAttribute("color", new l.BufferAttribute(S, 3));
              }
              if (0 < this.faces.length) {
                for (var E = [], C = [], P = 0; P < this.faces.length; P++) {
                  C.push(this.faces[P].a, this.faces[P].b, this.faces[P].c);
                  var b = this.faces[P].vertexColors;
                  if (b.length === 3) E.push(b[0], b[1], b[2]);
                  else {
                    var I = this.faces[P].color;
                    E.push(I, I, I);
                  }
                }
                m.setIndex(C), m.groups = this.computeGroups();
              }
              if (0 < this.morphTargets.length) {
                for (var D = [], N = [], U = 0, B = this.morphTargets.length; U < B; U++) {
                  var G = this.morphTargets[U], J = new l.Float32BufferAttribute(3 * G.vertices.length, 3);
                  if (J.name = G.name, D.push(J.copyVector3sArray(G.vertices)), G.normals) {
                    var j = new l.Float32BufferAttribute(3 * G.normals.length, 3);
                    j.name = G.name, N.push(j.copyVector3sArray(G.normals));
                  }
                }
                m.morphAttributes.position = D, m.morphAttributes.normal = N;
              }
              if (0 < this.skinIndices.length) {
                var te = new l.Float32BufferAttribute(4 * this.skinIndices.length, 4);
                m.setAttribute("skinIndex", te.copyVector4sArray(this.skinIndices));
              }
              if (0 < this.skinWeights.length) {
                var ee = new l.Float32BufferAttribute(4 * this.skinWeights.length, 4);
                m.setAttribute("skinWeight", ee.copyVector4sArray(this.skinWeights));
              }
              return this.boundingSphere !== null && (m.boundingSphere = this.boundingSphere.clone()), this.boundingBox !== null && (m.boundingBox = this.boundingBox.clone()), m;
            },
            computeTangents: function() {
              console.error("THREE.Geometry: .computeTangents() has been removed.");
            },
            computeLineDistances: function() {
              console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.");
            },
            applyMatrix: function(m) {
              return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(m);
            },
            dispose: function() {
              this.dispatchEvent({ type: "dispose" });
            }
          }), p.createBufferGeometryFromObject = function(v) {
            var m = new l.BufferGeometry(), x = v.geometry;
            if (v.isPoints || v.isLine) {
              var w = new l.Float32BufferAttribute(3 * x.vertices.length, 3), A = new l.Float32BufferAttribute(3 * x.colors.length, 3);
              if (m.setAttribute("position", w.copyVector3sArray(x.vertices)), m.setAttribute("color", A.copyColorsArray(x.colors)), x.lineDistances && x.lineDistances.length === x.vertices.length) {
                var M = new l.Float32BufferAttribute(x.lineDistances.length, 1);
                m.setAttribute("lineDistance", M.copyArray(x.lineDistances));
              }
              x.boundingSphere !== null && (m.boundingSphere = x.boundingSphere.clone()), x.boundingBox !== null && (m.boundingBox = x.boundingBox.clone());
            } else v.isMesh && (m = x.toBufferGeometry());
            return m;
          };
          class u {
            constructor() {
              this.vertices = [], this.normals = [], this.colors = [], this.uvs = [], this.uvs2 = [], this.groups = [], this.morphTargets = {}, this.skinWeights = [], this.skinIndices = [], this.boundingBox = null, this.boundingSphere = null, this.verticesNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.uvsNeedUpdate = !1, this.groupsNeedUpdate = !1;
            }
            computeGroups(m) {
              var x, w, A = [], M = void 0, R = m.faces;
              for (w = 0; w < R.length; w++) {
                var L = R[w];
                L.materialIndex !== M && (M = L.materialIndex, x !== void 0 && (x.count = 3 * w - x.start, A.push(x)), x = { start: 3 * w, materialIndex: M });
              }
              x !== void 0 && (x.count = 3 * w - x.start, A.push(x)), this.groups = A;
            }
            fromGeometry(m) {
              var x, w = m.faces, A = m.vertices, M = m.faceVertexUvs, R = M[0] && 0 < M[0].length, L = M[1] && 0 < M[1].length, _ = m.morphTargets, F = _.length;
              if (0 < F) {
                x = [];
                for (var S = 0; S < F; S++) x[S] = { name: _[S].name, data: [] };
                this.morphTargets.position = x;
              }
              var T, E = m.morphNormals, C = E.length;
              if (0 < C) {
                T = [];
                for (var P = 0; P < C; P++) T[P] = { name: E[P].name, data: [] };
                this.morphTargets.normal = T;
              }
              var b = m.skinIndices, I = m.skinWeights, D = b.length === A.length, N = I.length === A.length;
              0 < A.length && w.length === 0 && console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
              for (var U, B = 0; B < w.length; B++) {
                U = w[B], this.vertices.push(A[U.a], A[U.b], A[U.c]);
                var G = U.vertexNormals;
                if (G.length === 3) this.normals.push(G[0], G[1], G[2]);
                else {
                  var J = U.normal;
                  this.normals.push(J, J, J);
                }
                var j = U.vertexColors;
                if (j.length === 3) this.colors.push(j[0], j[1], j[2]);
                else {
                  var te = U.color;
                  this.colors.push(te, te, te);
                }
                if (R === !0) {
                  var ee = M[0][B];
                  ee === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", B), this.uvs.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs.push(ee[0], ee[1], ee[2]);
                }
                if (L === !0) {
                  var ae = M[1][B];
                  ae === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", B), this.uvs2.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs2.push(ae[0], ae[1], ae[2]);
                }
                for (var H, Z = 0; Z < F; Z++) H = _[Z].vertices, x[Z].data.push(H[U.a], H[U.b], H[U.c]);
                for (var $, se = 0; se < C; se++) $ = E[se].vertexNormals[B], T[se].data.push($.a, $.b, $.c);
                D && this.skinIndices.push(b[U.a], b[U.b], b[U.c]), N && this.skinWeights.push(I[U.a], I[U.b], I[U.c]);
              }
              return this.computeGroups(m), this.verticesNeedUpdate = m.verticesNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), this;
            }
          }
          class y {
            constructor(m, x, w, A, M) {
              var R = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : 0;
              this.a = m, this.b = x, this.c = w, this.normal = A && A.isVector3 ? A : new l.Vector3(), this.vertexNormals = Array.isArray(A) ? A : [], this.color = M && M.isColor ? M : new l.Color(), this.vertexColors = Array.isArray(M) ? M : [], this.materialIndex = R;
            }
            clone() {
              return new this.constructor().copy(this);
            }
            copy(m) {
              this.a = m.a, this.b = m.b, this.c = m.c, this.normal.copy(m.normal), this.color.copy(m.color), this.materialIndex = m.materialIndex;
              for (var x = 0, w = m.vertexNormals.length; x < w; x++) this.vertexNormals[x] = m.vertexNormals[x].clone();
              for (var A = 0, M = m.vertexColors.length; A < M; A++) this.vertexColors[A] = m.vertexColors[A].clone();
              return this;
            }
          }
        },
        /* 7 */
        /***/
        (o) => {
          o.exports = n4;
        },
        /* 8 */
        /***/
        (o) => {
          o.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg==";
        },
        /* 9 */
        /***/
        (o, a) => {
          a.augmentMorphColor = function() {
            return function(c) {
              c.vertexShader = c.vertexShader.replace("#include <color_pars_vertex>", ["varying vec3 vColor;", "attribute vec3 morphColor0;", "attribute vec3 morphColor1;"].join(`
`)), c.vertexShader = c.vertexShader.replace("#include <color_vertex>", ["vColor.xyz = color.xyz;", "#ifdef USE_MORPHTARGETS", "vColor = morphColor0 * morphTargetInfluences[ 0 ];", "vColor += morphColor1 * morphTargetInfluences[ 1 ];", "#endif"].join(`
`));
            };
          };
        },
        /* 10 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).createBufferGeometry, h = c(5).resolveURL, f = 0, g = function() {
            return "pr" + f++;
          }, p = function() {
            this.isZincObject = !0, this.geometry = void 0, this.morph = void 0, this.group = new l.Group(), this._lod = new (c(11)).LOD(this), this.groupName = void 0, this.timeEnabled = !1, this.morphColour = !1, this.inbuildTime = 0, this.mixer = void 0, this.animationGroup = void 0, this.duration = 6e3, this.clipAction = void 0, this.userData = {}, this.videoHandler = void 0, this.marker = void 0, this.markerNumber = void 0, this.markerUpdateRequired = !0, this.closestVertexIndex = -1, this.boundingBoxUpdateRequired = !0, this.cachedBoundingBox = new l.Box3(), this.anatomicalId = void 0, this.region = void 0, this.animationClip = void 0, this.markerMode = "inherited", this.uuid = g(), this._v1 = new l.Vector3(), this._v2 = new l.Vector3(), this._b1 = new l.Box3(), this.center = new l.Vector3(), this.radius = 0, this.visible = !0, this.drawRange = -1, this.origColour = void 0, this.origVertexColors = !1, this.isPickable = !0;
          };
          p.prototype.setDuration = function(u) {
            this.duration = u, this.clipAction && this.clipAction.setDuration(this.duration);
          }, p.prototype.getDuration = function() {
            return this.duration;
          }, p.prototype.setRegion = function(u) {
            this.region = u;
          }, p.prototype.getRegion = function() {
            return this.region;
          }, p.prototype.getMorph = function() {
            var u = this._lod.getCurrentMorph();
            return u || this.morph;
          }, p.prototype.getGroup = function() {
            return this.group;
          }, p.prototype.setMorph = function(u) {
            this.morph = u, this.group.add(this.morph);
            var y = this._lod.calculateDistance("far");
            this._lod.addLevel(u, y), this._lod.setMaterial(u.material);
          }, p.prototype.checkTransparentMesh = function() {
          }, p.prototype.setMesh = function(u, y, v) {
            this.animationGroup = new l.AnimationObjectGroup(u), this.mixer = new l.AnimationMixer(this.animationGroup);
            var m = u.geometry;
            if (this.geometry = u.geometry, this.clipAction = void 0, m && m.morphAttributes) {
              var x = m.morphAttributes.position;
              x || (x = m.morphAttributes.color ? m.morphAttributes.color : m.morphAttributes.normal), x && (this.animationClip = l.AnimationClip.CreateClipsFromMorphTargetSequences(x, 10, !0), this.animationClip && this.animationClip[0] != null && (this.clipAction = this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration), this.clipAction.loop = l.loopOnce, this.clipAction.clampWhenFinished = !0, this.clipAction.play()));
            }
            this.timeEnabled = y, this.morphColour = v, u.userData = this, u.matrixAutoUpdate = !1, this.setMorph(u), this.checkTransparentMesh(), this.timeEnabled ? this.setFrustumCulled(!1) : this.morphColour && (m.setAttribute("morphTarget0", m.getAttribute("position")), m.setAttribute("morphTarget1", m.getAttribute("position"))), this.boundingBoxUpdateRequired = !0;
          }, p.prototype.setIsPickable = function(u) {
            this.isPickable !== u && (this.isPickable = u, this.region && (this.region.pickableUpdateRequired = !0));
          }, p.prototype.setAnatomicalId = function(u) {
            this.anatomicalId = u;
          }, p.prototype.setName = function(u) {
            this.groupName = u, this._lod.setName(u);
          }, p.prototype.getCurrentTime = function() {
            if (this.clipAction) {
              var u = this.clipAction.time / this.clipAction._clip.duration;
              return this.duration * u;
            }
            return this.inbuildTime;
          }, p.prototype.setMorphTime = function(u) {
            var y = !1;
            if (this.clipAction) {
              var v = u / this.duration, m = this.clipAction._clip.duration, x = v * m;
              x != this.clipAction.time && (this.clipAction.time = x, y = !0), y && this.isTimeVarying() && this.mixer.update(0);
            } else {
              var w = u;
              w = u > this.duration ? this.duration : 0 > u ? 0 : u, w != this.inbuildTime && (this.inbuildTime = w, y = !0);
            }
            y && (this.boundingBoxUpdateRequired = !0, this._lod.updateMorphColorAttribute(!0), this.timeEnabled && (this.markerUpdateRequired = !0));
          }, p.prototype.isTimeVarying = function() {
            return !!(this.timeEnabled || this.morphColour);
          }, p.prototype.getVisibility = function() {
            return this.visible;
          }, p.prototype.setVisibility = function(u) {
            u !== this.visible && (this.visible = u, this.group.visible = u, this.region && (this.region.pickableUpdateRequired = !0));
          }, p.prototype.setAlpha = function(u) {
            var y = this._lod._material, v = !1;
            1 > u && (v = !0), y.opacity = u, y.transparent = v, this.checkTransparentMesh();
          }, p.prototype.setFrustumCulled = function(u) {
            this._lod.setFrustumCulled(u);
          }, p.prototype.setVertexColors = function(u) {
            this._lod.setVertexColors(u);
          }, p.prototype.getColour = function() {
            return this._lod._material ? this._lod._material.color : void 0;
          }, p.prototype.setColour = function(u) {
            this._lod.setColour(u);
          }, p.prototype.setGreyScale = function(u) {
            if (u) {
              if (!this.origColour && this._lod._material) return this.origColour = this._lod._material.color, this.origVertexColors = this._lod._material.vertexColors, this._lod.setVertexColors(!1), this._lod.setColour(new l.Color().setHex(12303291)), !0;
            } else if (this.origColour) return this._lod.setColour(this.origColour), this._lod.setVertexColors(this.origVertexColors), this.origColour = void 0, !0;
            return !1;
          }, p.prototype.getColourHex = function() {
            return !this.morphColour && this._lod._material && this._lod._material.color ? this._lod._material.color.getHexString() : void 0;
          }, p.prototype.setColourHex = function(u) {
            this._lod._material.color.setHex(u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.color.setHex(u);
          }, p.prototype.setEmissiveRGB = function(u) {
            this._lod._material && this._lod._material.emissive && this._lod._material.emissive.setRGB(...u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.emissive.setRGB(...u);
          }, p.prototype.setMaterial = function(u) {
            this._lod.setMaterial(u);
          }, p.prototype.getClosestVertexIndex = function() {
            var u = -1, y = this.getMorph();
            if (y && y.geoemtry) {
              var v = y.geometry.attributes.position;
              if (this._b1.setFromBufferAttribute(v), this._b1.getCenter(this._v1), v) for (var m = -1, x = 0, w = 0; w < v.count; w++) this._v2.fromArray(v.array, 3 * w), x = this._v2.distanceTo(this._v1), m == -1 ? m = x : m > x && (m = x, u = w);
            }
            return u;
          }, p.prototype.getClosestVertex = function(u) {
            var y = new l.Vector3();
            this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex());
            var v = this.getMorph();
            if (v && v.geometry && 0 <= this.closestVertexIndex) {
              var m = v.morphTargetInfluences, x = v.geometry.morphAttributes;
              if (m && x && x.position) {
                for (var w = !1, A = 0; A < m.length; A++) 0 < m[A] && (w = !0, this._v1.fromArray(x.position[A].array, 3 * this.closestVertexIndex), y.add(this._v1.multiplyScalar(m[A])));
                if (w) return u ? y.applyMatrix4(v.matrixWorld) : y;
              } else return y.fromArray(v.geometry.attributes.position.array, 3 * this.closestVertexIndex), u ? y.applyMatrix4(v.matrixWorld) : y;
            }
            return this.getBoundingBox(), y.copy(this.center), u ? y.applyMatrix4(this.morph.matrixWorld) : y;
          }, p.prototype.getBoundingBox = function() {
            if (this.visible) {
              var u = this._lod.getCurrentMorph();
              if (u && u.visible) return this.boundingBoxUpdateRequired && (c(5).getBoundingBox(u, this.cachedBoundingBox, this._b1, this._v1, this._v2), this.cachedBoundingBox.getCenter(this.center), this.radius = this.center.distanceTo(this.cachedBoundingBox.max), this.boundingBoxUpdateRequired = !1), this.cachedBoundingBox;
            }
          }, p.prototype.dispose = function() {
            this._lod.dispose(), this.animationGroup = void 0, this.mixer = void 0, this.morph = void 0, this.group = void 0, this.clipAction = void 0, this.groupName = void 0;
          }, p.prototype.markerIsRequired = function(u) {
            return !!(this.visible && (this.markerMode === "on" || u && u.displayMarkers && this.markerMode === "inherited"));
          }, p.prototype.updateMarker = function(u, y) {
            if (u == !1 && this.markerIsRequired(y)) {
              var v = y.ndcToBeUpdated;
              if (this.groupName) {
                if (this.marker || (this.marker = new (c(14)).Marker(this), this.markerUpdateRequired = !0), this.markerUpdateRequired) {
                  var m = this.getClosestVertex(!1);
                  m && (this.marker.setPosition(m.x, m.y, m.z), this.markerUpdateRequired = !1);
                }
                this.marker.isEnabled() || (y.markersList && !(this.marker.uuid in y.markersList) && (v = !0, y.markersList[this.marker.uuid] = this.marker), this.marker.enable(), this.group.add(this.marker.morph)), this.marker.setNumber(this.markerNumber), this.markerImgURL ? this.marker.loadUserSprite(this.markerImgURL) : this.marker.setDefaultSprite(), y && y.camera && (v || y.markerCluster.markerUpdateRequired) && (this.marker.updateNDC(y.camera.cameraObject), y.markerCluster.markerUpdateRequired = !0);
              }
            } else this.marker && this.marker.isEnabled() && (this.marker.disable(), this.group.remove(this.marker.morph), y.markersList && this.marker.uuid in y.markersList && (y.markerCluster.markerUpdateRequired = !0, delete y.markersList[this.marker.uuid])), this.markerUpdateRequired = !0;
          }, p.prototype.processMarkerVisual = function(u, y) {
            this.marker && this.marker.isEnabled() && this.marker.updateVisual(u, y);
          }, p.prototype.initiateMorphColor = function() {
            this.morphColour == 1 && this._lod.updateMorphColorAttribute(!1);
          }, p.prototype.setRenderOrder = function(u) {
            this._lod.setRenderOrder(u);
          }, p.prototype.getClosestVertexDOMElementCoords = function(u) {
            if (u && u.camera) {
              var y = !0, v = this.getClosestVertex(!0);
              return v.project(u.camera), v.z = Math.min(Math.max(v.z, 0), 1), (1 < v.x || -1 > v.x || 1 < v.y || -1 > v.y) && (y = !1), u.getZincCameraControls().getRelativeCoordsFromNDC(v.x, v.y, v), { position: v, inView: y };
            }
          }, p.prototype.setMarkerMode = function(u, y) {
            u !== this.markerMode && (this.markerMode = u === "on" || u === "off" ? u : "inherited", this.region && (this.region.pickableUpdateRequired = !0)), y && (this.markerNumber = y.number, this.markerImgURL = y.imgURL);
          }, p.prototype.render = function(u, y, v, m) {
            if (this.visible && !(this.timeEnabled && y) && this._lod.update(v, this.center), y == !0) {
              if (this.clipAction && this.isTimeVarying()) this.mixer.update(u);
              else {
                var x = this.inbuildTime + u;
                x > this.duration && (x -= this.duration), this.inbuildTime = x;
              }
              this.visible && u != 0 && (this.boundingBoxUpdateRequired = !0, this.morphColour == 1 && this._lod.updateMorphColorAttribute(!0));
            }
            this.updateMarker(y, m);
          }, p.prototype.addLOD = function(u, y, v, m, x) {
            this._lod.addLevelFromURL(u, y, v, m, x);
          }, p.prototype.addVertices = function(u) {
            var y = this.getMorph(), v = void 0;
            if (!y) v = d(500, u), this.drawRange = u.length;
            else if (-1 < this.drawRange) {
              var m = y.geometry.getAttribute("position");
              u.forEach((x) => {
                m.setXYZ(this.drawRange, x[0], x[1], x[2]), ++this.drawRange;
              }), m.needsUpdate = !0, y.geometry.setDrawRange(0, this.drawRange), y.geometry.computeBoundingBox(), y.geometry.computeBoundingSphere(), v = y.geoemtry, this.boundingBoxUpdateRequired = !0;
            }
            return v;
          }, p.prototype.setPosition = function(u, y, v) {
            var m = this.getGroup();
            m && (m.position.set(u, y, v), m.updateMatrix(), this.boundingBoxUpdateRequired = !0);
          }, p.prototype.loadAdditionalSources = function(u) {
            u.load(h(filename), meshloader(region, colour, opacity, localTimeEnabled, localMorphColour, void 0, void 0, void 0, void 0, finishCallback), this.onProgress(filename), this.onError(finishCallback));
          }, p.prototype.setScaleAll = function(u) {
            var y = this.getGroup();
            y && (y.scale.set(u, u, u), y.updateMatrix(), this.boundingBoxUpdateRequired = !0);
          }, a.ZincObject = p;
        },
        /* 11 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).updateMorphColorAttribute, h = c(5).toBufferGeometry, f = function(g) {
            this.levels = [], this._currentLevel = 0, this._renderOrder = 1, this._material = void 0, this._secondaryMaterial = void 0, this._loader = void 0, this._parent = g, this.addLevel = (u, y) => {
              if (u) {
                var v, m = Math.abs(y);
                for (v = 0; v < this.levels.length && !(m < this.levels[v].distance); v++) ;
                this.levels.splice(v, 0, { distance: m, morph: u, loaded: !0, loading: !1, url: "" }), u.renderOrder = this._renderOrder;
              }
            }, this.levelLoaded = (u, y) => {
              if (u) {
                for (var v = Math.abs(y), m = 0; m < this.levels.length; m++) if (v === this.levels[m].distance) {
                  this._parent.group.add(u), this.levels[m].morph = u, this.levels[m].loaded = !0, this.levels[m].loading = !1;
                  break;
                }
                this.checkTransparentMesh();
              }
            }, this.addLevelFromURL = (u, y, v, m, x) => {
              this._loader = u;
              var w, A = this.calculateDistance(y);
              for (w = 0; w < this.levels.length && !(A < this.levels[w].distance); w++) ;
              this.levels.splice(w, 0, { distance: A, morph: void 0, loaded: !1, loading: !1, url: v, index: m }), x && this.loadLevel(w);
            }, this.loadLevel = (u) => {
              var y = this.levels[u];
              return y.morph || y.loaded || y.loading || (y.loading = !0, this._loader.load(y.url, this.lodLoader(y.distance), void 0, void 0, { index: y.index })), y.morph === void 0;
            }, this.calculateDistance = function(u) {
              this._parent.getBoundingBox();
              var y = this._parent.radius, v = 0;
              return u === "far" ? v = 4.5 * y : u === "medium" ? v = 2.5 * y : u == "close" && (v = 0), v;
            }, this.containsLevels = () => !!(this.levels && 1 < this.levels.length), this.checkTransparentMesh = () => {
              var u = this.levels[this._currentLevel];
              this._material && (this._material.transparent ? (!this._secondaryMaterial && (this._secondaryMaterial = this._material.clone(), this._secondaryMaterial.side = l.FrontSide), this._secondaryMaterial.opacity = this._material.opacity, this._secondaryMaterial.emissive && this._secondaryMaterial.emissive.copy(this._material.emissive), this._secondaryMaterial.needsUpdate = !0, !u.secondaryMesh && (u.secondaryMesh = new l.Mesh(u.morph.geometry, this._secondaryMaterial), u.secondaryMesh.renderOrder = u.morph.renderOrder + 1, u.secondaryMesh.userData = u.morph.userData, u.secondaryMesh.name = u.morph.name), this._material.side = l.BackSide, this._material.needsUpdate = !0, !u.secondaryMesh.parent && (u.morph.add(u.secondaryMesh), this._parent.animationGroup && this._parent.animationGroup.add(u.secondaryMesh))) : (u.secondaryMesh && (u.morph.remove(u.secondaryMesh), this._parent.animationGroup && (this._parent.animationGroup.uncache(u.secondaryMesh), this._parent.animationGroup.remove(u.secondaryMesh))), this._material.side = l.DoubleSide, this._material.needsUpdate = !0));
            }, this.dispose = () => {
              this.levels.forEach((u) => {
                u.morph && u.morph.geometry && u.morph.geometry.dispose();
              }), this._material && this._material.dispose(), this._secondaryMaterial && this._secondaryMaterial.dispose();
            }, this.getCurrentLevel = () => this._currentLevel, this.getCurrentMorph = () => {
              var u = this.levels[this._currentLevel];
              return u && u.morph ? u.morph : this._parent.morph;
            }, this.lodLoader = function(u) {
              return (y) => {
                var v = this._material, m = { localTimeEnabled: this._parent.timeEnabled, localMorphColour: this._parent.morphColour }, x = h(y, m), w = void 0;
                this._parent.isGeometry ? w = new l.Mesh(x, v) : this._parent.isLines && (w = new (c(12)).LineSegments(x, v)), w.userData = this._parent, w.renderOrder = this._renderOrder, y.dispose(), this.levelLoaded(w, u);
              };
            }, this.updateMorphColorAttribute = (u) => {
              if (this._material && (this._material.vertexColors == l.VertexColors || this._material.vertexColors == !0)) if (u) {
                var y = this.getCurrentMorph();
                d(y.geometry, y);
              } else this.levels.forEach((v) => {
                v.morph && v.morph.geometry && d(v.morph.geometry, v.morph);
              });
            }, this.setColour = (u) => {
              this._material.color = u, this._secondaryMaterial && (this._secondaryMaterial.color = u), p();
            }, this.setFrustumCulled = (u) => {
              this.levels.forEach((y) => {
                y.morph && (y.morph.frustumCulled = u), y.secondaryMesh && (y.secondaryMesh.frustumCulled = u);
              });
            }, this.setMaterial = (u) => {
              u && (!this._material || this._material.id !== u.id) && (this._material = u, this._secondaryMaterial && this._secondaryMaterial.dispose(), this._secondaryMaterial = u.clone(), this._secondaryMaterial.side = l.FrontSide, this._secondaryMaterial.transparent = !0, this.levels.forEach((y) => {
                y.morph && (y.morph.material = this._material, y.morph.geometry && (y.morph.geometry.colorsNeedUpdate = !0)), y.secondaryMesh && (y.secondaryMesh.material = this._secondaryMaterial);
              }));
            }, this.setName = (u) => {
              this.levels.forEach((y) => {
                y.morph && (y.morph.name = u), y.secondaryMesh && (y.secondaryMesh.name = u);
              });
            }, this.setRenderOrder = (u) => {
              this._renderOrder = u, this.levels.forEach((y) => {
                y.morph && (y.morph.renderOrder = u), y.secondaryMesh && (y.secondaryMesh.renderOrder = u);
              });
            }, this.setVertexColors = (u) => {
              this._material.vertexColors = u, p(), this._secondaryMaterial && (this._secondaryMaterial.vertexColors = u);
            }, this.update = (u, y) => {
              var v = this.levels;
              if (1 < v.length) {
                var m, x, w = u.cameraObject.position.distanceTo(y), A = -1, M = -1;
                for (m = 0, x = v.length; m < x && w >= v[m].distance; m++) v[m].morph ? (-1 < A && v[A].morph && (v[A].morph.visible = !1), A = m, v[m].morph.visible = !0, M = -1) : M = m;
                for (-1 < M && this.loadLevel(M); m < x; m++) v[m].morph && (-1 < A ? v[m].morph.visible = !1 : (v[m].morph.visible = !0, A = m));
                this._currentLevel != A && (this._currentLevel = A, this.checkTransparentMesh());
              }
            }, this.toggleMarker = (u, y) => {
              this.levels.forEach((v) => {
                v.morph && (y ? v.morph.add(u) : v.morph.remove(u));
              });
            };
            var p = () => {
              this.levels.forEach((u) => {
                u.morph && u.morph.geometry && (u.morph.geometry.colorsNeedUpdate = !0);
              });
            };
          };
          a.LOD = f;
        },
        /* 12 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineSegments: () => (
              /* binding */
              g
            )
            /* harmony export */
          });
          var l = c(13), d = c(4), h = /* @__PURE__ */ new d.Vector3(), f = /* @__PURE__ */ new d.Vector3();
          class g extends l.Line {
            constructor(u, y) {
              super(u, y), this.type = "LineSegments";
            }
            computeLineDistances() {
              var u = this.geometry;
              if (!u.isBufferGeometry) u.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              else if (u.index === null) {
                for (var y = u.attributes.position, v = [], m = 0, x = y.count; m < x; m += 2) h.fromBufferAttribute(y, m), f.fromBufferAttribute(y, m + 1), v[m] = m == 0 ? 0 : v[m - 1], v[m + 1] = v[m] + h.distanceTo(f);
                u.setAttribute("lineDistance", new d.Float32BufferAttribute(v, 1));
              } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
              return this;
            }
          }
          g.prototype.isLineSegments = !0;
        },
        /* 13 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            Line: () => (
              /* binding */
              x
            )
            /* harmony export */
          });
          var l = c(4), d = /* @__PURE__ */ new l.Vector3(), h = /* @__PURE__ */ new l.Vector3(), f = /* @__PURE__ */ new l.Matrix4(), g = /* @__PURE__ */ new l.Ray(), p = /* @__PURE__ */ new l.Sphere(), u = /* @__PURE__ */ new l.Vector3(), y = /* @__PURE__ */ new l.Vector3(), v = /* @__PURE__ */ new l.Vector3(), m = /* @__PURE__ */ new l.Vector3();
          class x extends l.Object3D {
            constructor() {
              var M = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), R = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.LineBasicMaterial();
              super(), this.type = "Line", this.geometry = M, this.material = R, this.updateMorphTargets();
            }
            copy(M) {
              return super.copy(M), this.material = M.material, this.geometry = M.geometry, this;
            }
            computeLineDistances() {
              var M = this.geometry;
              if (!M.isBufferGeometry) M.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              else if (M.index === null) {
                for (var R = M.attributes.position, L = [0], _ = 1, F = R.count; _ < F; _++) d.fromBufferAttribute(R, _ - 1), h.fromBufferAttribute(R, _), L[_] = L[_ - 1], L[_] += d.distanceTo(h);
                M.setAttribute("lineDistance", new l.Float32BufferAttribute(L, 1));
              } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
              return this;
            }
            raycast(M, R) {
              var L = this.geometry, _ = this.matrixWorld, F = M.params.Line.threshold, S = L.drawRange, T = L.morphAttributes.position;
              if (L.boundingSphere === null && L.computeBoundingSphere(), p.copy(L.boundingSphere), p.applyMatrix4(_), p.radius += F, M.ray.intersectsSphere(p) !== !1) {
                f.copy(_).invert(), g.copy(M.ray).applyMatrix4(f);
                var E = F / ((this.scale.x + this.scale.y + this.scale.z) / 3), C = E * E, P = new l.Vector3(), b = new l.Vector3(), I = new l.Vector3(), D = new l.Vector3(), N = this.isLineSegments ? 2 : 1;
                if (L.isBufferGeometry) {
                  var U = L.index, B = L.attributes, G = B.position;
                  if (U !== null) for (var J = Math.max(0, S.start), j = Math.min(U.count, S.start + S.count), te = J; te < j - 1; te += N) {
                    var ee = U.getX(te), ae = U.getX(te + 1);
                    w(P, b, this, G, T, ee, ae);
                    var H = g.distanceSqToSegment(P, b, D, I);
                    if (!(H > C)) {
                      D.applyMatrix4(this.matrixWorld);
                      var Z = M.ray.origin.distanceTo(D);
                      Z < M.near || Z > M.far || R.push({
                        distance: Z,
                        // What do we want? intersection point on the ray or on the segment??
                        // point: raycaster.ray.at( distance ),
                        point: I.clone().applyMatrix4(this.matrixWorld),
                        index: te,
                        face: null,
                        faceIndex: null,
                        object: this
                      });
                    }
                  }
                  else for (var $ = Math.max(0, S.start), se = Math.min(G.count, S.start + S.count), k = $; k < se - 1; k += N) {
                    w(P, b, this, G, T, k, k + 1);
                    var W = g.distanceSqToSegment(P, b, D, I);
                    if (!(W > C)) {
                      D.applyMatrix4(this.matrixWorld);
                      var q = M.ray.origin.distanceTo(D);
                      q < M.near || q > M.far || R.push({
                        distance: q,
                        // What do we want? intersection point on the ray or on the segment??
                        // point: raycaster.ray.at( distance ),
                        point: I.clone().applyMatrix4(this.matrixWorld),
                        index: k,
                        face: null,
                        faceIndex: null,
                        object: this
                      });
                    }
                  }
                } else L.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
            updateMorphTargets() {
              var M = this.geometry;
              if (M.isBufferGeometry) {
                var R = M.morphAttributes, L = Object.keys(R);
                if (0 < L.length) {
                  var _ = R[L[0]];
                  if (_ !== void 0) {
                    this.morphTargetInfluences = [], this.morphTargetDictionary = {};
                    for (var F, S = 0, T = _.length; S < T; S++) F = _[S].name || S + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[F] = S;
                  }
                }
              } else {
                var E = M.morphTargets;
                E !== void 0 && 0 < E.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
          }
          function w(A, M, R, L, _, F, S) {
            A.fromBufferAttribute(L, F), M.fromBufferAttribute(L, S);
            var T = R.morphTargetInfluences;
            if (R.material.morphTargets && _ && T) {
              u.set(0, 0, 0), y.set(0, 0, 0);
              for (var E = 0, C = _.length; E < C; E++) {
                var P = T[E], b = _[E];
                P !== 0 && (v.fromBufferAttribute(b, F), m.fromBufferAttribute(b, S), u.addScaledVector(v.sub(A), P), y.addScaledVector(m.sub(M), P));
              }
              A.add(u), M.add(y);
            }
          }
          x.prototype.isLine = !0;
        },
        /* 14 */
        /***/
        (o, a, c) => {
          var l = c(4), d = new Image(128, 128);
          d.src = c(15);
          var h = new l.Texture();
          h.image = d, h.needsUpdate = !0;
          var f = [0.02, 0.03, 1], g = new l.SpriteMaterial({ map: h, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), p = c(5).createNewSpriteText, u = function(y) {
            c(10).ZincObject.call(this), this.texture = h;
            var v = void 0, m = void 0, x = void 0, w = void 0, A = void 0, M = !0;
            this.morph = new l.Group(), this.group = this.morph, this.parent = y, this.isMarker = !0;
            var R = !1;
            this.ndc = new l.Vector3();
            var L = void 0, _ = void 0, F = () => {
              v = new l.Sprite(g), v.center.set(0.5, 0), this.morph.add(v), this.morph.position.set(0, 0, 0), this.morph.renderOrder = 1e4, v.scale.set(f[0], f[1], f[2]), v.userData = this;
            };
            this.updateVisual = (S, T) => {
              var E = 1, C = 0;
              S !== T && (C = 1 - (this.ndc.z - S) / (T - S), E = 0.6 + 0.4 * C), this.setSpriteSize(E);
            }, this.updateNDC = (S) => (this.ndc.copy(this.morph.position), this.ndc.project(S), this.ndc.z = Math.min(Math.max(this.ndc.z, 0), 1), this.ndc), this.setPosition = (S, T, E) => {
              this.morph.position.set(S, T, E);
            }, this.setSpriteSize = (S) => {
              v.scale.set(0.015, 0.02, 1), v.scale.multiplyScalar(S);
            }, this.setUserSprite = () => {
              w && (this.morph.add(w), M && (this.morph.remove(v), _ && this.morph.remove(_), M = !1));
            }, this.setImageForUserSprite = (S, T) => {
              w && (this.morph.remove(w), w = void 0), m && m.dispose(), x && x.dispose(), m = new l.Texture(), m.image = S, m.needsUpdate = !0, x = new l.SpriteMaterial({ map: m, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), T || (T = [0.05, 0.05, 1]), w = new l.Sprite(x), w.center.set(0.5, 0), w.scale.set(T[0], T[1], T[2]), w.userData = this, this.setUserSprite();
            }, this.setDefaultSprite = () => {
              M || (M = !0, this.morph.add(v), w && this.morph.remove(w), _ && this.morph.add(_));
            }, this.loadUserSprite = (S, T) => {
              if (S) if (S !== A) {
                A = S;
                var E = new Image(128, 128);
                E.crossOrigin = "anonymous", E.onload = () => {
                  this.setImageForUserSprite(E, T);
                }, E.src = S;
              } else this.setUserSprite();
            }, this.dispose = () => {
              this.morph && this.morph.clear(), v && (v.clear(), v = void 0), _ && (_.material.map.dispose(), _.material.dispose(), _ = void 0);
            }, this.isEnabled = () => R, this.setNumber = (S) => {
              (!S || L != S) && _ && (this.morph.remove(_), _.material.map.dispose(), _.material.dispose(), _ = void 0), !_ && S && (_ = p(S, 0.012, "black", "Asap", 120, 700), this.morph.add(_)), L = S;
            }, this.getNumber = () => L || 1, this.setVisibility = function(S) {
              S !== this.visible && (this.visible = S, this.group.visible = S, this.parent.region && (this.parent.region.pickableUpdateRequired = !0));
            }, this.enable = () => {
              R = !0, this.morph.visible = !0, this.visible = !0;
            }, this.disable = () => {
              R = !1, this.morph.visible = !1, this.visible = !1;
            }, F();
          };
          u.prototype = Object.create(c(10).ZincObject.prototype), a.Marker = u;
        },
        /* 15 */
        /***/
        (o) => {
          o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4=";
        },
        /* 16 */
        /***/
        (o, a, c) => {
          var l = c(4), d = function(h, f, g, p) {
            c(10).ZincObject.call(this);
            var u;
            f && (u = f.clone(), u.vertexColors = l.FaceColors), this.id = g;
            var y = void 0, v = void 0;
            this.isGlyph = !0;
            var m = [0, 0, 0];
            this.fromMesh = (x) => !!(x && x.isMesh) && (this.morph = x.clone(), this.morph.userData = this, this.group.add(this.morph), !0), h && u && this.fromMesh(new l.Mesh(h, u)), this.getGlyphset = function() {
              return p;
            }, this.setLabel = (x) => {
              x && (typeof x == "string" || x instanceof String) && (v = x, this.morph && (this.morph.name = x));
            }, this.showLabel = (x) => {
              y && (m = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0), v && (typeof v == "string" || v instanceof String) && (y = new (c(17)).Label(v, x), y.setPosition(m[0], m[1], m[2]), this.group.add(y.getSprite()));
            }, this.hideLabel = () => {
              y && (m = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0);
            }, this.getLabel = () => v, this.getMesh = () => this.morph, this.setTransformation = (x, w, A, M) => {
              this.morph && (this.morph.matrix.elements[0] = w[0], this.morph.matrix.elements[1] = w[1], this.morph.matrix.elements[2] = w[2], this.morph.matrix.elements[3] = 0, this.morph.matrix.elements[4] = A[0], this.morph.matrix.elements[5] = A[1], this.morph.matrix.elements[6] = A[2], this.morph.matrix.elements[7] = 0, this.morph.matrix.elements[8] = M[0], this.morph.matrix.elements[9] = M[1], this.morph.matrix.elements[10] = M[2], this.morph.matrix.elements[11] = 0, this.morph.matrix.elements[12] = x[0], this.morph.matrix.elements[13] = x[1], this.morph.matrix.elements[14] = x[2], this.morph.matrix.elements[15] = 1, this.morph.matrixAutoUpdate = !1), m = [...x], y && y.setPosition(x[0], x[1], x[2]);
            }, this.setColour = (x) => {
              y && y.setColour(x), this.secondaryMesh && this.secondaryMesh.material && (this.secondaryMesh.material.color = colour), this.geometry && (this.geometry.colorsNeedUpdate = !0);
            }, this.dispose = () => {
              this.material && this.material.dispose(), this.morph = void 0;
            };
          };
          d.prototype = Object.create(c(10).ZincObject.prototype), a.Glyph = d;
        },
        /* 17 */
        /***/
        (o, a, c) => {
          var l = c(7).default;
          a.Label = function(d, h) {
            var f = d, g = void 0;
            g = h ? new l(f, 0.015, h.getStyle()) : new l(f, 0.015), g.fontFace = "Asap", g.fontWeight = 700, g.material.map.generateMipmaps = !1, g.material.sizeAttenuation = !1, g.center.x = -0.05, g.center.y = 0, this.getPosition = () => g ? [g.position.x, g.position.y, g.position.z] : [0, 0, 0], this.setPosition = (p, u, y) => {
              g && g.position.set(p, u, y);
            }, this.setColour = (p) => {
              console.log(g), p && (g.color = p.getStyle());
            }, this.setScale = (p) => {
              g && 0 < p && g.scale.set(p, p, 1);
            }, this.dispose = () => {
            }, this.getSprite = () => g, this.getString = () => f;
          };
        },
        /* 18 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(19).JSONLoader, h = function() {
            c(10).ZincObject.call(this);
            var f = [], g = void 0, p = void 0, u = void 0, y = void 0, v = void 0, m = void 0, x = void 0, w = 0, A = 0, M = [0, 0, 0], R = [0, 0, 0], L = [0, 0, 0], _ = "NONE";
            this.ready = !1;
            var F = !1, S = !1;
            this.isGlyphset = !0;
            var T = new l.Matrix4(), E = new l.Color(), C = new l.Color(), P = new l.Box3(), b = new l.Box3(), I = new l.Box3(), D = [], N = [], U = [], B = [], G = [], J = [], j = [];
            this.globalScale = 1;
            for (var te = 0; 8 > te; te++) new l.Vector3();
            this.load = (k, W, q, ce, oe) => {
              g = k.axis1, p = k.axis2, u = k.axis3, y = k.positions, v = k.scale, m = k.colors, x = k.label, F = k.metadata.MorphColours, S = k.metadata.MorphVertices, w = k.metadata.number_of_time_steps, _ = k.metadata.repeat_mode, A = k.metadata.number_of_vertices, _ == "AXES_2D" || _ == "MIRROR" ? A *= 2 : _ == "AXES_3D" && (A *= 3), M = k.metadata.base_size, R = k.metadata.offset, L = k.metadata.scale_factors;
              var V = new d();
              this.geometry = new l.BufferGeometry();
              var O = new l.InstancedMesh(this.geometry, void 0, A);
              if (this.setMorph(O), ce) {
                var X = V.parse(W);
                se(q, oe)(X.geometry, X.materials), X.geometry.dispose();
              } else V.crossOrigin = "Anonymous", V.load(W, se(q, oe));
            };
            var ee = (k, W, q, ce, oe, V) => {
              if (_ == "NONE" || _ == "MIRROR") {
                for (var O, X = [0, 0, 0], Y = [0, 0, 0], ie = [0, 0, 0], fe = [0, 0, 0], be = [0, 0, 0], Ae = [0, 0, 0], he = [0, 0, 0], xe = [0, 0, 0], re = [0, 0, 0], me = 0; 3 > me; me++) O = 0 > oe[me] ? -1 : 1, X[me] = (O * M[me] + oe[me] * L[me]) * this.globalScale;
                for (var me = 0; 3 > me; me++) Y[me] = W[me] * X[0], ie[me] = q[me] * X[1], fe[me] = ce[me] * X[2], be[me] = k[me] + R[0] * Y[me] + R[1] * ie[me] + R[2] * fe[me], _ == "MIRROR" && (Ae[me] = -Y[me], he[me] = -ie[me], xe[me] = -fe[me], re[me] = be[me], 0 > oe[0] && (be[me] -= Y[me], re[me] -= Ae[me]));
                0 > fe[0] * (Y[1] * ie[2] - Y[2] * ie[1]) + fe[1] * (Y[2] * ie[0] - Y[0] * ie[2]) + fe[2] * (Y[0] * ie[1] - Y[1] * ie[0]) && (fe[0] = -fe[0], fe[1] = -fe[1], fe[2] = -fe[2]), V[0] = [be, Y, ie, fe], _ == "MIRROR" && (0 > xe[0] * (Ae[1] * he[2] - Ae[2] * he[1]) + xe[1] * (Ae[2] * he[0] - Ae[0] * he[2]) + xe[2] * (Ae[0] * he[1] - Ae[1] * he[0]) && (xe[0] = -xe[0], xe[1] = -xe[1], xe[2] = -xe[2]), V[1] = [re, Ae, he, xe]);
              } else if (_ == "AXES_2D" || _ == "AXES_3D") {
                for (var O, Me = [0, 0, 0], De = [0, 0, 0], me = 0; 3 > me; me++) O = 0 > oe[me] ? -1 : 1, Me[me] = (O * M[0] + oe[me] * L[0]) * this.globalScale;
                for (var me = 0; 3 > me; me++) De[me] = k[me] + R[0] * Me[0] * W[me] + R[1] * Me[1] * q[me] + R[2] * Me[2] * ce[me];
                for (var Ie = glyph_repeat_mode == "AXES_2D" ? 2 : 3, $e = 0; $e < Ie; $e++) {
                  var lt = void 0, qe = void 0, Mt = oe[$e], Be = [0, 0, 0], it = [0, 0, 0], tt = [0, 0, 0];
                  $e == 0 ? (lt = W, qe = q) : $e == 1 ? (lt = q, qe = glyph_repeat_mode == "AXES_2D" ? W : ce) : (lt = ce, qe = W);
                  var qt = (M[0] + Mt * L[0]) * this.globalScale;
                  Be[0] = lt[0] * qt, Be[1] = lt[1] * qt, Be[2] = lt[2] * qt, tt[0] = Be[1] * qe[2] - qe[1] * Be[2], tt[1] = Be[2] * qe[0] - qe[2] * Be[0], tt[2] = Be[0] * qe[1] - Be[1] * qe[0];
                  var Qt = Math.sqrt(tt[0] * tt[0] + tt[1] * tt[1] + tt[2] * tt[2]);
                  if (0 < Qt) {
                    var Pt = (M[2] + Mt * L[2]) * this.globalScale / Qt;
                    _ == "AXES_2D" && 0 < $e && (Pt *= -1), tt[0] *= Pt, tt[1] *= Pt, tt[2] *= Pt;
                  }
                  if (it[0] = tt[1] * Be[2] - Be[1] * tt[2], it[1] = tt[2] * Be[0] - Be[2] * tt[0], it[2] = tt[0] * Be[1] - tt[1] * Be[0], Qt = Math.sqrt(it[0] * it[0] + it[1] * it[1] + it[2] * it[2]), 0 < Qt) {
                    var Nt = (M[1] + Mt * L[1]) * this.globalScale / Qt;
                    it[0] *= Nt, it[1] *= Nt, it[2] *= Nt;
                  }
                  V[$e] = [De, Be, it, tt];
                }
              }
              return V;
            }, ae = (k, W, q, ce, oe) => {
              var V = 1;
              _ == "AXES_2D" || _ == "MIRROR" ? V = 2 : _ == "AXES_3D" && (V = 3);
              var O = k.length / 3, X = 0;
              j.length = V;
              for (var Y = 0; Y < O; Y++) {
                var ie = 3 * Y, fe = [k[ie], k[ie + 1], k[ie + 2]], be = [W[ie], W[ie + 1], W[ie + 2]], Ae = [q[ie], q[ie + 1], q[ie + 2]], he = [ce[ie], ce[ie + 1], ce[ie + 2]], xe = [oe[ie], oe[ie + 1], oe[ie + 2]], re = ee(fe, be, Ae, he, xe, j);
                if (re.length == V) for (var me = 0; me < V; me++) {
                  T.elements[0] = re[me][1][0], T.elements[1] = re[me][1][1], T.elements[2] = re[me][1][2], T.elements[3] = 0, T.elements[4] = re[me][2][0], T.elements[5] = re[me][2][1], T.elements[6] = re[me][2][2], T.elements[7] = 0, T.elements[8] = re[me][3][0], T.elements[9] = re[me][3][1], T.elements[10] = re[me][3][2], T.elements[11] = 0, T.elements[12] = re[me][0][0], T.elements[13] = re[me][0][1], T.elements[14] = re[me][0][2], T.elements[15] = 1, this.morph.setMatrixAt(X, T);
                  var Me = f[X];
                  Me && Me.setTransformation(re[me][0], re[me][1], re[me][2], re[me][3]), X++;
                }
              }
              this.morph.instanceMatrix.needsUpdate = !0;
            }, H = (k) => {
              var W = 1;
              _ == "AXES_2D" || _ == "MIRROR" ? W = 2 : _ == "AXES_3D" && (W = 3);
              for (var q, ce = k.length, oe = 0, V = 0; V < ce; V++) {
                q = k[V];
                for (var O = 0; O < W; O++) {
                  E.setHex(q), this.morph.setColorAt(oe, E);
                  var X = f[oe];
                  X && X.setColour(E), oe++;
                }
              }
              this.morph.instanceColor.needsUpdate = !0;
            }, Z = () => {
              var k = D, W = N, q = U, ce = B, oe = G, V = J, O = this.inbuildTime / this.duration * (w - 1), X = Math.floor(O), Y = 1 - (O - X), ie = Math.ceil(O);
              if (S) {
                var fe = y[X.toString()], be = y[ie.toString()], Ae = g[X.toString()], he = g[ie.toString()], xe = p[X.toString()], re = p[ie.toString()], me = u[X.toString()], Me = u[ie.toString()], De = v[X.toString()], Ie = v[ie.toString()];
                D.length = fe.length, N.length = fe.length, U.length = fe.length, B.length = fe.length, G.length = fe.length;
                for (var $e = 0; $e < fe.length; $e++) k[$e] = Y * fe[$e] + (1 - Y) * be[$e], W[$e] = Y * Ae[$e] + (1 - Y) * he[$e], q[$e] = Y * xe[$e] + (1 - Y) * re[$e], ce[$e] = Y * me[$e] + (1 - Y) * Me[$e], oe[$e] = Y * De[$e] + (1 - Y) * Ie[$e];
              } else k = y[0], W = g[0], q = p[0], ce = u[0], oe = v[0];
              if (ae(k, W, q, ce, oe), this.boundingBoxUpdateRequired = !0, m != null) {
                if (F) {
                  var lt = m[X.toString()], qe = m[ie.toString()];
                  V.length = lt.length;
                  for (var Mt = 0; Mt < lt.length; Mt++) E.setHex(lt[Mt]), C.setHex(qe[Mt]), E.setRGB(E.r * Y + C.r * (1 - Y), E.g * Y + C.g * (1 - Y), E.b * Y + C.b * (1 - Y)), V[Mt] = E.getHex();
                } else V = m[0];
                H(V);
              }
            };
            this.showLabel = () => {
              for (var k = 0; k < f.length; k++) f[k].showLabel(this.morph.material ? this.morph.material.color : void 0);
            }, this.hideLabel = () => {
              for (var k = 0; k < f.length; k++) f[k].hideLabel();
            };
            var $ = (k) => {
              for (var W = 0; W < A; W++) {
                var q = new (c(16)).Glyph(void 0, void 0, W, this), ce = x ? x[W] : void 0;
                ce = ce || this.groupName, ce && q.setLabel(ce), 0 < w && q.setFrustumCulled(!1), f[W] = q, this.morph.add(q.getGroup());
              }
              k && this.showLabel(), ae(y[0], g[0], p[0], u[0], v[0]), m != null && H(m[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0;
            };
            this.addCustomGlyph = (k) => {
              k.isGlyph && f.push(k), this.ready = !0, this.boundingBoxUpdateRequired = !0;
            }, this.addMeshAsGlyph = (k, W) => {
              if (k.isMesh) {
                var q = new (c(16)).Glyph(void 0, void 0, W, this);
                return q.fromMesh(k), f.push(q), this.morph.add(q.getGroup()), this.ready = !0, this.boundingBoxUpdateRequired = !0, q;
              }
            }, this.forEachGlyph = (k) => {
              for (var W = 0; W < f.length; W++) k(f[W]);
            };
            var se = (k, W) => (q, ce) => {
              var oe = q.toBufferGeometry();
              this.geometry.copy(oe), this.geometry.computeBoundingSphere(), this.geometry.computeBoundingBox(), oe.dispose(), ce && ce[0] && (this.morph.material = ce[0]), $(W), this.morph.name = this.groupName, this.morph.userData = this, this.setMorph(this.morph), q.dispose(), k != null && typeof k == "function" && k(this);
            };
            this.getClosestVertexIndex = function() {
              var k = -1;
              if (this.morph && this.ready) {
                this.getBoundingBox().getCenter(this._v1);
                for (var W, q = y[0], ce = q.length / 3, oe = -1, V = 0, O = 0; O < ce; O++) W = 3 * O, this._v2.set(q[W], q[W + 1], q[W + 2]), V = this._v1.distanceTo(this._v2), (oe == -1 || oe > V) && (oe = V, k = O);
              }
              return k;
            }, this.getClosestVertex = function() {
              if (this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()), 0 <= this.closestVertexIndex && this.morph) {
                var k = new l.Vector3();
                return this.morph.getMatrixAt(this.closestVertexIndex, T), k.setFromMatrixPosition(T), k;
              }
            }, this.getBoundingBox = () => {
              if (this.morph && this.ready && this.morph.visible) {
                if (this.boundingBoxUpdateRequired) {
                  P.setFromBufferAttribute(this.morph.geometry.attributes.position);
                  for (var k = 0; k < A; k++) this.morph.getMatrixAt(k, T), b.copy(P).applyMatrix4(T), k == 0 ? I.copy(b) : I.union(b);
                  if (I) this.cachedBoundingBox.copy(I), this.morph.updateWorldMatrix(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1;
                  else return;
                }
                return this.cachedBoundingBox;
              }
            }, this.setMorphTime = (k) => {
              this.inbuildTime = k > this.duration ? this.duration : 0 > k ? 0 : k, (F || S) && (Z(), S && (this.markerUpdateRequired = !0));
            }, this.isTimeVarying = () => !!((this.ready === !1 || 0 < w) && (F || S)), this.getCurrentTime = () => this.inbuildTime, this.setScaleAll = function(k) {
              this.globalScale = k, Z();
            }, this.dispose = () => {
              for (var k = f.length - 1; 0 <= k; k--) f[k].dispose();
              this.geometry && this.geometry.dispose(), this.morph && this.morph.material.dispose(), g = void 0, p = void 0, u = void 0, y = void 0, v = void 0, m = void 0, this.ready = !1, this.groupName = void 0;
            }, this.render = (k, W, q) => {
              if (W == !0) {
                var ce = this.inbuildTime + k;
                ce > this.duration && (ce -= this.duration), this.inbuildTime = ce, (F || S) && Z();
              }
              this.updateMarker(W, q);
            };
          };
          h.prototype = Object.create(c(10).ZincObject.prototype), a.Glyphset = h;
        },
        /* 19 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            JSONLoader: () => (
              /* binding */
              M
            )
            /* harmony export */
          });
          var l = c(4), d = c(20).Loader, h = l.LoaderUtils, f = l.AnimationClip, g = l.Vector3, p = l.Vector4, u = l.Color, y = l.Vector2, v = c(6).Face3, m = c(6).Geometry, x = l.FileLoader, w = l.DefaultLoadingManager, A = c(21).VideoHandler;
          function M(R) {
            typeof R == "boolean" && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), R = void 0), this.manager = R === void 0 ? w : R, this.withCredentials = !1, this.paramsString = "";
          }
          Object.assign(M.prototype, { load: function(L, _, F, S) {
            var T = this, E = this.texturePath && typeof this.texturePath == "string" ? this.texturePath : h.extractUrlBase(L), C = new x(this.manager);
            L.split("?"), this.paramsString = L.length === 2 ? paramsStrings[1] : "", C.setWithCredentials(this.withCredentials), C.load(L, function(P) {
              var b;
              try {
                b = JSON.parse(P);
              } catch {
                if (console.error("The loader has encountered an error while parsing the content of a resource."), S) return void S({ responseURL: L });
              }
              var I = b.metadata;
              if (I !== void 0) {
                var D = I.type;
                if (D !== void 0 && D.toLowerCase() === "object") return void console.error("THREE.JSONLoader: " + L + " should be loaded with THREE.ObjectLoader instead.");
              }
              if (T && T.parse) try {
                var N = T.parse(b, E);
                _(N.geometry, N.materials);
              } catch (U) {
                if (console.error("The loader has encountered aon loading the geometry"), console.error(U), S) return void S({ responseURL: L });
              }
            }, F, S);
          }, setTexturePath: function(L) {
            this.texturePath = L;
          }, parse: /* @__PURE__ */ function() {
            function R(S, T) {
              function E(me, Me) {
                return me & 1 << Me;
              }
              var C, P, b, I, D, N, U, B, G, J, j, te, ee, ae, H, Z, $, se, k, W, q, ce, oe, V, O, X, Y, ie = S.faces, fe = S.vertices, be = S.normals, Ae = S.colors, he = S.scale, xe = 0;
              if (S.uvs !== void 0) {
                for (C = 0; C < S.uvs.length; C++) S.uvs[C].length && xe++;
                for (C = 0; C < xe; C++) T.faceVertexUvs[C] = [];
              }
              for (I = 0, D = fe.length; I < D; ) se = new g(), se.x = fe[I++] * he, se.y = fe[I++] * he, se.z = fe[I++] * he, T.vertices.push(se);
              if (I = 0, D = ie.length, S.uvs) for (C = 0; C < S.uvs.length; C++) {
                T.uvs[C] = [];
                for (var re = 0; re < S.uvs[C].length; re++) T.uvs[C][re] = S.uvs[C][re];
              }
              if (be) for (C = 0; C < be.length; C++) T.normals[C] = be[C];
              if (Ae) for (C = 0; C < Ae.length; C++) T.colors[C] = Ae[C];
              for (; I < D; )
                if (J = ie[I++], j = E(J, 0), te = E(J, 1), ee = E(J, 3), ae = E(J, 4), H = E(J, 5), Z = E(J, 6), $ = E(J, 7), j) {
                  if (W = new v(), W.a = ie[I], W.b = ie[I + 1], W.c = ie[I + 3], q = new v(), q.a = ie[I + 1], q.b = ie[I + 2], q.c = ie[I + 3], I += 4, te && (G = ie[I++], W.materialIndex = G, q.materialIndex = G), b = T.faces.length, ee) for (C = 0; C < xe; C++) for (V = S.uvs[C], T.faceVertexUvs[C][b] = [], T.faceVertexUvs[C][b + 1] = [], P = 0; 4 > P; P++) B = ie[I++], X = V[2 * B], Y = V[2 * B + 1], O = new y(X, Y), P !== 2 && T.faceVertexUvs[C][b].push(O), P !== 0 && T.faceVertexUvs[C][b + 1].push(O);
                  if (ae && (U = 3 * ie[I++], W.normal.set(be[U++], be[U++], be[U]), q.normal.copy(W.normal)), H) for (C = 0; 4 > C; C++) U = 3 * ie[I++], oe = new g(be[U++], be[U++], be[U]), C !== 2 && W.vertexNormals.push(oe), C !== 0 && q.vertexNormals.push(oe);
                  if (Z && (N = ie[I++], ce = Ae[N], W.color.setHex(ce), q.color.setHex(ce)), $) for (C = 0; 4 > C; C++) N = ie[I++], ce = Ae[N], C !== 2 && W.vertexColors.push(new u(ce)), C !== 0 && q.vertexColors.push(new u(ce));
                  T.faces.push(W), T.faces.push(q);
                } else {
                  if (k = new v(), k.a = ie[I++], k.b = ie[I++], k.c = ie[I++], te && (G = ie[I++], k.materialIndex = G), b = T.faces.length, ee) for (C = 0; C < xe; C++) for (V = S.uvs[C], T.faceVertexUvs[C][b] = [], P = 0; 3 > P; P++) B = ie[I++], X = V[2 * B], Y = V[2 * B + 1], O = new y(X, Y), T.faceVertexUvs[C][b].push(O);
                  if (ae && (U = 3 * ie[I++], k.normal.set(be[U++], be[U++], be[U])), H) for (C = 0; 3 > C; C++) U = 3 * ie[I++], oe = new g(be[U++], be[U++], be[U]), k.vertexNormals.push(oe);
                  if (Z && (N = ie[I++], k.color.setHex(Ae[N])), $) for (C = 0; 3 > C; C++) N = ie[I++], k.vertexColors.push(new u(Ae[N]));
                  T.faces.push(k);
                }
            }
            function L(S, T) {
              var E = S.influencesPerVertex === void 0 ? 2 : S.influencesPerVertex;
              if (S.skinWeights) for (var C = 0, P = S.skinWeights.length; C < P; C += E) {
                var b = S.skinWeights[C], I = 1 < E ? S.skinWeights[C + 1] : 0, D = 2 < E ? S.skinWeights[C + 2] : 0, N = 3 < E ? S.skinWeights[C + 3] : 0;
                T.skinWeights.push(new p(b, I, D, N));
              }
              if (S.skinIndices) for (var C = 0, P = S.skinIndices.length; C < P; C += E) {
                var U = S.skinIndices[C], B = 1 < E ? S.skinIndices[C + 1] : 0, G = 2 < E ? S.skinIndices[C + 2] : 0, J = 3 < E ? S.skinIndices[C + 3] : 0;
                T.skinIndices.push(new p(U, B, G, J));
              }
              T.bones = S.bones, T.bones && 0 < T.bones.length && (T.skinWeights.length !== T.skinIndices.length || T.skinIndices.length !== T.vertices.length) && console.warn("When skinning, number of vertices (" + T.vertices.length + "), skinIndices (" + T.skinIndices.length + "), and skinWeights (" + T.skinWeights.length + ") should match.");
            }
            function _(S, T) {
              var E = S.scale;
              if (S.morphTargets !== void 0) for (var C = 0, P = S.morphTargets.length; C < P; C++) {
                T.morphTargets[C] = {}, T.morphTargets[C].name = S.morphTargets[C].name, T.morphTargets[C].vertices = [];
                for (var b, I = T.morphTargets[C].vertices, D = S.morphTargets[C].vertices, N = 0, U = D.length; N < U; N += 3) b = new g(), b.x = D[N] * E, b.y = D[N + 1] * E, b.z = D[N + 2] * E, I.push(b);
              }
              if (S.morphNormals !== void 0) {
                for (var C = 0, P = S.morphNormals.length; C < P; C++) if (T.morphTargets[C]) {
                  T.morphTargets[C].normals = [];
                  for (var B, G = T.morphTargets[C].normals, J = S.morphNormals[C].normals, N = 0, U = J.length; N < U; N += 3) B = new g(), B.x = J[N], B.y = J[N + 1], B.z = J[N + 2], G.push(B);
                  T.morphNormalsReady = !0;
                }
              }
              if (S.morphColors !== void 0) {
                var C, P, j, te, ee, ae, H;
                for (C = 0, P = S.morphColors.length; C < P; C++) for (T.morphColors[C] = {}, T.morphColors[C].name = S.morphColors[C].name, T.morphColors[C].colors = [], ee = T.morphColors[C].colors, ae = S.morphColors[C].colors, j = 0, te = ae.length; j < te; j += 3) H = new l.Color(16755200), H.setRGB(ae[j], ae[j + 1], ae[j + 2]), ee.push(H);
              }
            }
            function F(S, T) {
              var E = [], C = [];
              S.animation !== void 0 && C.push(S.animation), S.animations !== void 0 && (S.animations.length ? C = C.concat(S.animations) : C.push(S.animations));
              for (var P, b = 0; b < C.length; b++) P = f.parseAnimation(C[b], T.bones), P && E.push(P);
              if (T.morphTargets) {
                var I = f.CreateClipsFromMorphTargetSequences(T.morphTargets, 10);
                E = E.concat(I);
              }
              0 < E.length && (T.animations = E);
            }
            return function(S, T) {
              S.data !== void 0 && (S = S.data), S.scale = S.scale === void 0 ? 1 : 1 / S.scale;
              var E = new m();
              if (E.morphColors = [], R(S, E), L(S, E), _(S, E), F(S, E), E.computeFaceNormals(), E.computeBoundingSphere(), S.materials === void 0 || S.materials.length === 0) return { geometry: E };
              var C = d.prototype.initMaterials(S.materials, T, "Anonymous");
              if (S.materials[0].video) {
                var P = T + S.materials[0].video;
                this.paramsString && (P += "?".concat(this.paramsString));
                var b = new A(P);
                E._video = b;
              }
              return C && 0 < C.length && (C[0].side = S.materials[0].singleSided ? l.FrontSide : S.materials[0].flipSided ? l.BackSide : l.DoubleSide, S.materials[0].specularCoef && (C[0].shininess = Math.floor(S.materials[0].specularCoef / 3))), { geometry: E, materials: C };
            };
          }() });
        },
        /* 20 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            Loader: () => (
              /* binding */
              d
            )
            /* harmony export */
          });
          var l = c(4);
          c(4);
          function d() {
          }
          d.Handlers = { handlers: [], add: function(f, g) {
            this.handlers.push(f, g);
          }, get: function(f) {
            for (var g = this.handlers, p = 0, u = g.length; p < u; p += 2) {
              var y = g[p], v = g[p + 1];
              if (y.test(f)) return v;
            }
            return null;
          } }, Object.assign(d.prototype, { crossOrigin: "anonymous", onLoadStart: function() {
          }, onLoadProgress: function() {
          }, onLoadComplete: function() {
          }, initMaterials: function(f, g, p) {
            for (var u = [], y = 0; y < f.length; ++y) u[y] = this.createMaterial(f[y], g, p);
            return u;
          }, createMaterial: function() {
            var h = { NoBlending: l.NoBlending, NormalBlending: l.NormalBlending, AdditiveBlending: l.AdditiveBlending, SubtractiveBlending: l.SubtractiveBlending, MultiplyBlending: l.MultiplyBlending, CustomBlending: l.CustomBlending }, f = new l.Color(), g = new l.TextureLoader(), p = new l.MaterialLoader();
            return function(u, y, v) {
              function m(R, L, _, F, S) {
                var T, E = y + R, C = d.Handlers.get(E);
                C === null ? (g.setCrossOrigin(v), T = g.load(E)) : T = C.load(E), L !== void 0 && (T.repeat.fromArray(L), L[0] !== 1 && (T.wrapS = l.RepeatWrapping), L[1] !== 1 && (T.wrapT = l.RepeatWrapping)), _ !== void 0 && T.offset.fromArray(_), F !== void 0 && (F[0] === "repeat" && (T.wrapS = l.RepeatWrapping), F[0] === "mirror" && (T.wrapS = l.MirroredRepeatWrapping), F[1] === "repeat" && (T.wrapT = l.RepeatWrapping), F[1] === "mirror" && (T.wrapT = l.MirroredRepeatWrapping)), S !== void 0 && (T.anisotropy = S);
                var P = l.MathUtils.generateUUID();
                return x[P] = T, P;
              }
              var x = {}, w = { uuid: l.MathUtils.generateUUID(), type: "MeshLambertMaterial" };
              for (var A in u) {
                var M = u[A];
                switch (A) {
                  case "DbgColor":
                  case "DbgIndex":
                  case "opticalDensity":
                  case "illumination":
                    break;
                  case "DbgName":
                    w.name = M;
                    break;
                  case "blending":
                    w.blending = h[M];
                    break;
                  case "colorAmbient":
                  case "mapAmbient":
                    console.warn("THREE.Loader.createMaterial:", A, "is no longer supported.");
                    break;
                  case "colorDiffuse":
                    w.color = f.fromArray(M).getHex();
                    break;
                  case "colorSpecular":
                    w.specular = f.fromArray(M).getHex();
                    break;
                  case "colorEmissive":
                    w.emissive = f.fromArray(M).getHex();
                    break;
                  case "specularCoef":
                    w.shininess = M;
                    break;
                  case "shading":
                    M.toLowerCase() === "basic" && (w.type = "MeshBasicMaterial"), M.toLowerCase() === "phong" && (w.type = "MeshPhongMaterial"), M.toLowerCase() === "standard" && (w.type = "MeshStandardMaterial");
                    break;
                  case "mapDiffuse":
                    w.map = m(M, u.mapDiffuseRepeat, u.mapDiffuseOffset, u.mapDiffuseWrap, u.mapDiffuseAnisotropy);
                    break;
                  case "mapDiffuseRepeat":
                  case "mapDiffuseOffset":
                  case "mapDiffuseWrap":
                  case "mapDiffuseAnisotropy":
                    break;
                  case "mapEmissive":
                    w.emissiveMap = m(M, u.mapEmissiveRepeat, u.mapEmissiveOffset, u.mapEmissiveWrap, u.mapEmissiveAnisotropy);
                    break;
                  case "mapEmissiveRepeat":
                  case "mapEmissiveOffset":
                  case "mapEmissiveWrap":
                  case "mapEmissiveAnisotropy":
                    break;
                  case "mapLight":
                    w.lightMap = m(M, u.mapLightRepeat, u.mapLightOffset, u.mapLightWrap, u.mapLightAnisotropy);
                    break;
                  case "mapLightRepeat":
                  case "mapLightOffset":
                  case "mapLightWrap":
                  case "mapLightAnisotropy":
                    break;
                  case "mapAO":
                    w.aoMap = m(M, u.mapAORepeat, u.mapAOOffset, u.mapAOWrap, u.mapAOAnisotropy);
                    break;
                  case "mapAORepeat":
                  case "mapAOOffset":
                  case "mapAOWrap":
                  case "mapAOAnisotropy":
                    break;
                  case "mapBump":
                    w.bumpMap = m(M, u.mapBumpRepeat, u.mapBumpOffset, u.mapBumpWrap, u.mapBumpAnisotropy);
                    break;
                  case "mapBumpScale":
                    w.bumpScale = M;
                    break;
                  case "mapBumpRepeat":
                  case "mapBumpOffset":
                  case "mapBumpWrap":
                  case "mapBumpAnisotropy":
                    break;
                  case "mapNormal":
                    w.normalMap = m(M, u.mapNormalRepeat, u.mapNormalOffset, u.mapNormalWrap, u.mapNormalAnisotropy);
                    break;
                  case "mapNormalFactor":
                    w.normalScale = M;
                    break;
                  case "mapNormalRepeat":
                  case "mapNormalOffset":
                  case "mapNormalWrap":
                  case "mapNormalAnisotropy":
                    break;
                  case "mapSpecular":
                    w.specularMap = m(M, u.mapSpecularRepeat, u.mapSpecularOffset, u.mapSpecularWrap, u.mapSpecularAnisotropy);
                    break;
                  case "mapSpecularRepeat":
                  case "mapSpecularOffset":
                  case "mapSpecularWrap":
                  case "mapSpecularAnisotropy":
                    break;
                  case "mapMetalness":
                    w.metalnessMap = m(M, u.mapMetalnessRepeat, u.mapMetalnessOffset, u.mapMetalnessWrap, u.mapMetalnessAnisotropy);
                    break;
                  case "mapMetalnessRepeat":
                  case "mapMetalnessOffset":
                  case "mapMetalnessWrap":
                  case "mapMetalnessAnisotropy":
                    break;
                  case "mapRoughness":
                    w.roughnessMap = m(M, u.mapRoughnessRepeat, u.mapRoughnessOffset, u.mapRoughnessWrap, u.mapRoughnessAnisotropy);
                    break;
                  case "mapRoughnessRepeat":
                  case "mapRoughnessOffset":
                  case "mapRoughnessWrap":
                  case "mapRoughnessAnisotropy":
                    break;
                  case "mapAlpha":
                    w.alphaMap = m(M, u.mapAlphaRepeat, u.mapAlphaOffset, u.mapAlphaWrap, u.mapAlphaAnisotropy);
                    break;
                  case "mapAlphaRepeat":
                  case "mapAlphaOffset":
                  case "mapAlphaWrap":
                  case "mapAlphaAnisotropy":
                    break;
                  case "flipSided":
                    w.side = l.BackSide;
                    break;
                  case "doubleSided":
                    w.side = l.DoubleSide;
                    break;
                  case "transparency":
                    console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), w.opacity = M;
                    break;
                  case "depthTest":
                  case "depthWrite":
                  case "colorWrite":
                  case "opacity":
                  case "reflectivity":
                  case "transparent":
                  case "visible":
                  case "wireframe":
                    w[A] = M;
                    break;
                  case "vertexColors":
                    M === !0 && (w.vertexColors = l.VertexColors), M === "face" && (w.vertexColors = l.FaceColors);
                    break;
                  default:
                    console.error("THREE.Loader.createMaterial: Unsupported", A, M);
                }
              }
              return w.type === "MeshBasicMaterial" && delete w.emissive, w.type !== "MeshPhongMaterial" && delete w.specular, 1 > w.opacity && (w.transparent = !0), p.setTextures(x), p.parse(w);
            };
          }() });
        },
        /* 21 */
        /***/
        (o, a, c) => {
          var l = c(4);
          a.VideoHandler = function(d) {
            var h = this;
            this.video = void 0, this.videoTexture = void 0, this.setMorphTime = function(f, g) {
              var p = f / g * h.video.duration;
              h.video.currentTime = p;
            }, this.getVideoDuration = function() {
              return h.video.duration;
            }, this.createCanvasVideoTexture = function() {
              return h.videoTexture = new l.VideoTexture(h.video), h.videoTexture.minFilter = l.LinearFilter, h.videoTexture.magFilter = l.LinearFilter, h.videoTexture.format = l.RGBFormat, h.video.currentTime = 0, h.videoTexture;
            }, this.getCurrentTime = function(f) {
              return h.video ? f * (h.video.currentTime / h.video.duration) : 0;
            }, this.isReadyToPlay = function() {
              return !!(h.video && 3 <= h.video.readyState);
            }, function() {
              document && (h.video = document.createElement("video"), h.video.crossOrigin = "anonymous", h.video.src = d, h.video.load(), h.video.loop = !0);
            }();
          };
        },
        /* 22 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(23).Points, h = c(5).toBufferGeometry, f = c(5).getCircularTexture, g = c(17).Label, p = function() {
            c(10).ZincObject.call(this), this.isPointset = !0;
            var u = [];
            this.createMesh = (v, m, x) => {
              if (v && m) {
                var w = h(v, x), A = f();
                m.map = A;
                var M = new d(w, m);
                this.setMesh(M, x.localTimeEnabled, x.localMorphColour);
              }
            };
            var y = (v, m, x, w) => {
              if (x) {
                var A = new l.Color(w), M = new g(x, A);
                M.setPosition(m[0], m[1], m[2]);
                var R = M.getSprite();
                R.material.sizeAttenuation = !1, R.material.alphaTest = 0.5, R.material.transparent = !0, R.material.depthWrite = !1, R.material.depthTest = !1, this.group.add(R), u[v] = M;
              }
            };
            this.addPoints = (v, m, x) => {
              if (v && 0 < v.length) {
                var w = this.drawRange - 1, A = this.addVertices(v), M = this.getMorph();
                if (!M) {
                  var R = new l.PointsMaterial({ alphaTest: 0.5, size: 10, color: x, sizeAttenuation: !1 });
                  A.colorsNeedUpdate = !0, this.createMesh(A, R, { localTimeEnabled: !1, localMorphColour: !1 });
                }
                var L = w + v.length, _ = 0;
                if (Array.isArray(m) && m.length === v.length || typeof m == "string") for (w; w + _ < L; ) {
                  var F = typeof m == "string" ? m : m[_];
                  y(_, v[_], F, x), _++;
                }
                this.region && (this.region.pickableUpdateRequired = !0);
              }
            }, this.setColourHex = function(v) {
              this._lod._material.color.setHex(v), this._lod._secondaryMaterial && this._lod._secondaryMaterial.color.setHex(v);
              for (var m = 0; m < u.length; m++) u[m] && u[m].setColour(this._lod._material.color);
            }, this.setColour = (v) => {
              this._lod.setColour(v);
              for (var m = 0; m < u.length; m++) u[m] && u[m].setColour(this._lod._material.color);
            }, this.setSize = (v) => {
              this.morph && this.morph.material && (this.morph.material.size = v, this.morph.material.needsUpdate = !0);
            }, this.setSizeAttenuation = (v) => {
              this.morph && this.morph.material && (this.morph.material.sizeAttenuation = v, this.morph.material.needsUpdate = !0);
            }, this.getVerticesByIndex = function(v) {
              if (0 <= v && this.drawRange > v) {
                var m = this.getMorph().geometry.getAttribute("position");
                return [m.getX(v), m.getY(v), m.getZ(v)];
              }
            }, this.editVertices = function(v, m) {
              if (v && v.length) {
                var x = this.getMorph(), w = m + v.length - 1;
                if (!x || 0 > m || w >= this.drawRange) return;
                var A = x.geometry.getAttribute("position"), M = m;
                v.forEach((R) => {
                  var L = u[M];
                  L && L.setPosition(R[0], R[1], R[2]), A.setXYZ(M++, R[0], R[1], R[2]);
                }), A.needsUpdate = !0, this.boundingBoxUpdateRequired = !0;
              }
            }, this.render = (v, m, x, w) => {
              this.morph && x && (this.morph.sizePerPixel = x.pixelHeight), p.prototype.render.call(this, v, m, x, w);
            };
          };
          p.prototype = Object.create(c(10).ZincObject.prototype), a.Pointset = p;
        },
        /* 23 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            Points: () => (
              /* binding */
              y
            )
            /* harmony export */
          });
          var l = c(4), d = /* @__PURE__ */ new l.Matrix4(), h = /* @__PURE__ */ new l.Ray(), f = /* @__PURE__ */ new l.Sphere(), g = /* @__PURE__ */ new l.Vector3(), p = /* @__PURE__ */ new l.Vector3(), u = /* @__PURE__ */ new l.Vector3();
          class y extends l.Object3D {
            constructor() {
              var w = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), A = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.PointsMaterial();
              super(), this.type = "Points", this.geometry = w, this.material = A, this.sizePerPixel = 1, this.updateMorphTargets();
            }
            copy(w) {
              return super.copy(w), this.material = w.material, this.geometry = w.geometry, this;
            }
            raycast(w, A) {
              var M = this.geometry, R = this.matrixWorld, L = w.params.Points.threshold, _ = M.drawRange;
              if (M.boundingSphere === null && M.computeBoundingSphere(), f.copy(M.boundingSphere), f.applyMatrix4(R), f.radius += L, w.ray.intersectsSphere(f) !== !1) {
                d.copy(R).invert(), h.copy(w.ray).applyMatrix4(d);
                var F = L / ((this.scale.x + this.scale.y + this.scale.z) / 3) * this.material.size * this.sizePerPixel, S = F * F;
                if (M.isBufferGeometry) {
                  var T = M.index, E = M.attributes, C = E.position, P = M.morphAttributes.position;
                  if (T !== null) for (var b, I = Math.max(0, _.start), D = Math.min(T.count, _.start + _.count), N = I; N < D; N++) b = T.getX(N), m(this, C, P, b), v(g, b, S, R, w, A, this);
                  else for (var U = Math.max(0, _.start), B = Math.min(C.count, _.start + _.count), G = U; G < B; G++) m(this, C, P, G), v(g, G, S, R, w, A, this);
                } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
            updateMorphTargets() {
              var w = this.geometry;
              if (w.isBufferGeometry) {
                var A = w.morphAttributes, M = Object.keys(A);
                if (0 < M.length) {
                  var R = A[M[0]];
                  if (R !== void 0) {
                    this.morphTargetInfluences = [], this.morphTargetDictionary = {};
                    for (var L, _ = 0, F = R.length; _ < F; _++) L = R[_].name || _ + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[L] = _;
                  }
                }
              } else {
                var S = w.morphTargets;
                S !== void 0 && 0 < S.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
          }
          y.prototype.isPoints = !0;
          function v(x, w, A, M, R, L, _) {
            var F = h.distanceSqToPoint(x);
            if (F < A) {
              var S = new l.Vector3();
              h.closestPointToPoint(x, S), S.applyMatrix4(M);
              var T = R.ray.origin.distanceTo(S);
              if (T < R.near || T > R.far) return;
              L.push({ distance: T, distanceToRay: Math.sqrt(F), point: S, index: w, face: null, object: _ });
            }
          }
          function m(x, w, A, M) {
            g.fromBufferAttribute(w, M);
            var R = x.morphTargetInfluences;
            if (x.material.morphTargets && A && R) {
              p.set(0, 0, 0);
              for (var L = 0, _ = A.length; L < _; L++) {
                var F = R[L], S = A[L];
                F !== 0 && (u.fromBufferAttribute(S, M), p.addScaledVector(u.sub(g), F));
              }
              g.add(p);
            }
          }
        },
        /* 24 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).toBufferGeometry, h = function() {
            c(10).ZincObject.call(this), this.isLines = !0, this.createLineSegment = (f, g, p) => {
              if (f && g) {
                var u = d(f, p);
                p.localMorphColour && u.morphAttributes.color && (g.onBeforeCompile = c(9).augmentMorphColor());
                var y = new (c(12)).LineSegments(u, g);
                this.setMesh(y, p.localTimeEnabled, p.localMorphColour);
              }
            }, this.setWidth = (f) => {
              this.morph && this.morph.material && (this.morph.material.linewidth = f, this.morph.material.needsUpdate = !0);
            }, this.addLines = (f, g) => {
              if (f && 0 < f.length) {
                var p = this.addVertices(f), u = this.getMorph();
                if (!u) {
                  var y = new l.LineBasicMaterial({ color: g });
                  p.colorsNeedUpdate = !0, this.createLineSegment(p, y, { localTimeEnabled: !1, localMorphColour: !1 });
                }
                this.region && (this.region.pickableUpdateRequired = !0);
              }
            };
          };
          h.prototype = Object.create(c(10).ZincObject.prototype), a.Lines = h;
        },
        /* 25 */
        /***/
        (o, a, c) => {
          function l(g, p, u, y, v, m, x) {
            try {
              var w = g[m](x), A = w.value;
            } catch (M) {
              return void u(M);
            }
            w.done ? p(A) : Promise.resolve(A).then(y, v);
          }
          function d(g) {
            return function() {
              var p = this, u = arguments;
              return new Promise(function(y, v) {
                function m(A) {
                  l(w, y, v, m, x, "next", A);
                }
                function x(A) {
                  l(w, y, v, m, x, "throw", A);
                }
                var w = g.apply(p, u);
                m(void 0);
              });
            };
          }
          var h = c(4), f = function() {
            var g = this;
            c(26).Texture.call(this), this.isTextureArray = !0, this.loadFromImages = /* @__PURE__ */ function() {
              var p = d(function* (u) {
                var y = 1, v = 1, m = 0;
                if (u && u.length) {
                  g.isLoading = !0;
                  var x = new Image();
                  x.crossOrigin = "Anonymous";
                  for (var w, A = document.createElement("canvas"), M = 0, R = Array(u.length), L = 0; L < u.length; L++) w = yield g.imageToUint8Array(g, x, u[L], A), w && w.array && (y = w.width, v = w.height, R[m] = w.array, M += R[m].length, m++);
                  var _ = new Uint8Array(M);
                  M = 0, R.forEach((F) => {
                    _.set(F, M), M += F.length;
                  }), g.impl = new h.DataTexture2DArray(_, y, v, m), g.size = { width: y, height: v, depth: m }, g.isLoading = !1, g.impl.needsUpdate = !0;
                }
              });
              return function() {
                return p.apply(this, arguments);
              };
            }(), this.getMaterial = (p) => {
              if (this.impl) {
                var u;
                if (!p) u = new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide });
                else if (p.vs && p.fs) {
                  var y = !0;
                  "transparent" in p && (y = p.transparent);
                  var v = h.FrontSide;
                  p.side && (v = p.side), u = new h.ShaderMaterial({ transparent: y, uniforms: p.uniforms, vertexShader: p.vs, fragmentShader: p.fs, side: v }), p.glslVersion && (u.glslVersion = p.glslVersion);
                }
                if (u) return u.needsUpdate = !0, u;
              }
            };
          };
          f.prototype = Object.create(c(26).Texture.prototype), a.TextureArray = f;
        },
        /* 26 */
        /***/
        (o, a, c) => {
          function l(g, p, u, y, v, m, x) {
            try {
              var w = g[m](x), A = w.value;
            } catch (M) {
              return void u(M);
            }
            w.done ? p(A) : Promise.resolve(A).then(y, v);
          }
          function d(g) {
            return function() {
              var p = this, u = arguments;
              return new Promise(function(y, v) {
                function m(A) {
                  l(w, y, v, m, x, "next", A);
                }
                function x(A) {
                  l(w, y, v, m, x, "throw", A);
                }
                var w = g.apply(p, u);
                m(void 0);
              });
            };
          }
          var h = c(4), f = function() {
            this.isTexture = !0, this.impl = void 0, this.isLoading = !1, this.size = { width: 1, height: 1, depth: 0 };
          };
          f.prototype.loadImage = function(g, p) {
            return new Promise((u, y) => {
              g.onload = () => u(g), g.onerror = y, g.src = p;
            });
          }, f.prototype.imageToUint8Array = /* @__PURE__ */ function() {
            var g = d(function* (p, u, y, v) {
              yield p.loadImage(u, y), v.width = u.width, v.height = u.height;
              var m = v.getContext("2d");
              return m.drawImage(u, 0, 0), { array: new Uint8Array(m.getImageData(0, 0, v.width, v.height).data.buffer), width: v.width, height: v.height };
            });
            return function() {
              return g.apply(this, arguments);
            };
          }(), f.prototype.loadFromImages = /* @__PURE__ */ function() {
            var g = d(function* () {
            });
            return function() {
              return g.apply(this, arguments);
            };
          }(), f.prototype.isReady = function() {
            return !(!this.impl || this.isLoading);
          }, f.prototype.getMaterial = function() {
            if (this.impl) return new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide });
          }, a.Texture = f;
        },
        /* 27 */
        /***/
        (o, a, c) => {
          function l(v, m) {
            var x = Object.keys(v);
            if (Object.getOwnPropertySymbols) {
              var w = Object.getOwnPropertySymbols(v);
              m && (w = w.filter(function(A) {
                return Object.getOwnPropertyDescriptor(v, A).enumerable;
              })), x.push.apply(x, w);
            }
            return x;
          }
          function d(v) {
            for (var m, x = 1; x < arguments.length; x++) m = arguments[x] == null ? {} : arguments[x], x % 2 ? l(Object(m), !0).forEach(function(w) {
              h(v, w, m[w]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(v, Object.getOwnPropertyDescriptors(m)) : l(Object(m)).forEach(function(w) {
              Object.defineProperty(v, w, Object.getOwnPropertyDescriptor(m, w));
            });
            return v;
          }
          function h(v, m, x) {
            return (m = f(m)) in v ? Object.defineProperty(v, m, { value: x, enumerable: !0, configurable: !0, writable: !0 }) : v[m] = x, v;
          }
          function f(v) {
            var m = g(v, "string");
            return typeof m == "symbol" ? m : m + "";
          }
          function g(v, m) {
            if (typeof v != "object" || !v) return v;
            var x = v[Symbol.toPrimitive];
            if (x !== void 0) {
              var w = x.call(v, m || "default");
              if (typeof w != "object") return w;
              throw new TypeError("@@toPrimitive must return a primitive value.");
            }
            return (m === "string" ? String : Number)(v);
          }
          var p = c(4), u = c(28), y = function(v) {
            c(29).TexturePrimitive.call(this, v), this.isTextureSlides = !0;
            var m = [], x = {};
            this.morph = new p.Group(), this.group = this.morph, this.morph.userData = this;
            var w = void 0, A = !0;
            this.createSlides = (L) => {
              L.forEach((_) => this.createSlide(_));
            };
            var M = (L, _) => {
              var F = L.material, S = F.uniforms;
              switch (L.rotation.x = 0, L.rotation.y = 0, L.rotation.z = 0, L.position.x = 0, L.position.y = 0, L.position.z = 0, _.direction) {
                case "x":
                  var T = -Math.PI / 2;
                  L.rotation.y = T, S.direction.value = 1, S.slide.value.set(_.value, 0, 0), L.position.x = _.value;
                  break;
                case "y":
                  L.rotation.x = Math.PI / 2, S.direction.value = 2, S.slide.value.set(0, _.value, 0), L.position.y = _.value;
                  break;
                case "z":
                  S.direction.value = 3, S.slide.value.set(0, 0, _.value), L.position.z = _.value;
                  break;
              }
              F.needsUpdate = !0, this.boundingBoxUpdateRequired = !0;
            };
            this.modifySlideSettings = (L) => {
              L && L.id && L.id in x && x[L.id] && M(x[L.id], L);
            }, this.createSlide = (L) => {
              if (this.texture && this.texture.isTextureArray && this.texture.isReady() && L && L.direction && L.value !== void 0) {
                var _ = new p.PlaneGeometry(1, 1);
                _.translate(0.5, 0.5, 0);
                var F = u.getUniforms();
                F.diffuse.value = this.texture.impl, F.depth.value = this.texture.size.depth, F.flipY.value = A;
                var S = { fs: u.fs, vs: u.vs, uniforms: F, glslVersion: u.glslVersion, side: p.DoubleSide, transparent: !1 }, T = this.texture.getMaterial(S);
                T.needsUpdate = !0;
                var E = new p.Mesh(_, T);
                E.name = this.groupName, E.userData = this;
                var C = { value: L.value, direction: L.direction, id: E.id };
                return m.push(C), M(E, C), x[E.id] = E, this.morph.add(E), this.boundingBoxUpdateRequired = !0, C;
              }
            }, this.getTextureSettings = () => [...m], this.getTextureSettingsWithId = (L) => {
              for (var _ = 0; _ < m.length; _++) if (L === m[_].id) return d({}, m[_]);
            }, this.getSlides = () => this.morph ? [...this.morph.children] : [], this.removeSlide = (L) => {
              L && this.removeSlideWithId(L.id);
            }, this.removeSlideWithId = (L) => {
              if (this.morph && L in x && x[L]) {
                if (this.morph.getObjectById(L)) {
                  var _ = x[L];
                  this.morph.remove(_), _.clear(), _.geometry && _.geometry.dispose(), _.material && _.material.dispose(), this.boundingBoxUpdateRequired = !0;
                }
                var F = m.findIndex((S) => S.id === L);
                -1 < F && m.splice(F, 1);
              }
            }, this.dispose = () => {
              this.morph.children.forEach((L) => {
                L.geometry && L.geometry.dispose(), L.material && L.material.dispose();
              }), c(29).TexturePrimitive.prototype.dispose.call(this), this.boundingBoxUpdateRequired = !0;
            };
            var R = (L, _, F) => {
              if (_) switch (_.direction.value) {
                case 1:
                  F.copy(_.slide.value), L.expandByPoint(F), F.setY(1), F.setZ(1), L.expandByPoint(F);
                  break;
                case 2:
                  F.copy(_.slide.value), L.expandByPoint(F), F.setX(1), F.setZ(1), L.expandByPoint(F);
                  break;
                case 3:
                  F.copy(_.slide.value), L.expandByPoint(F), F.setX(1), F.setY(1), L.expandByPoint(F);
                  break;
              }
            };
            this.getBoundingBox = () => {
              if (this.morph && this.morph.children && this.morph.visible && this.boundingBoxUpdateRequired) {
                this.cachedBoundingBox.makeEmpty();
                var L = new p.Vector3(0, 0, 0);
                this.morph.children.forEach((_) => {
                  R(this.cachedBoundingBox, _.material.uniforms, L);
                }), this.morph.updateMatrixWorld(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1;
              }
              return this.cachedBoundingBox;
            }, this.applyTransformation = (L, _, F) => {
              var S = new p.Matrix4();
              S.set(L[0], L[1], L[2], 0, L[3], L[4], L[5], 0, L[6], L[7], L[8], 0, 0, 0, 0, 0);
              var T = new p.Quaternion().setFromRotationMatrix(S);
              this.morph.position.set(..._), this.morph.quaternion.copy(T), this.morph.scale.set(...F), this.morph.updateMatrix(), this.boundingBoxUpdateRequired = !0;
            }, this.setRenderOrder = (L) => {
              this.morph.renderOrder = L;
            }, this.initialise = (L, _) => {
              if (L) {
                var F = L.locations;
                F && 0 < F.length && (this.applyTransformation(F[0].orientation, F[0].position, F[0].scale), "flipY" in F[0] && (A = F[0].flipY)), this.createSlides(L.settings.slides), _ != null && typeof _ == "function" && _(this);
              }
            }, this.showEdges = (L) => {
              if (w)
                w.material.color = L;
              else {
                var _ = new p.BoxGeometry(1, 1, 1);
                _.translate(0.5, 0.5, 0.5);
                var F = new p.EdgesGeometry(_);
                w = new p.LineSegments(F, new p.LineBasicMaterial({ color: L })), this.group.add(w);
              }
              w.visible = !0;
            }, this.hideEdges = () => {
              w && (w.visible = !1);
            };
          };
          y.prototype = Object.create(c(29).TexturePrimitive.prototype), y.prototype.constructor = y, a.TextureSlides = y;
        },
        /* 28 */
        /***/
        (o, a, c) => {
          var l = c(4), d = l.GLSL3, h = `
precision highp float;
precision highp int;
precision highp sampler2DArray;

uniform sampler2DArray diffuse;
uniform bool discardAlpha;
in vec3 vUw;

out vec4 outColor;

void main() {

  vec4 color = texture( diffuse, vUw );

  // lighten a bit
  if (discardAlpha && color.a == 0.0) discard;

  outColor = vec4( color.rgba );

}
`, f = `
out vec3 vUw;
uniform float depth;
uniform vec3 slide;
uniform int direction;
uniform bool flipY;

void main() {

  vec3 slidePos = position.xyz;
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );

  if (direction == 1)
    slidePos = vec3(slide.x, position.y, position.x);
  if (direction == 2)
    slidePos = vec3(position.x, slide.y, position.y);
  if (direction == 3)
    slidePos = vec3(position.x, position.y, slide.z);

  if (flipY) 
    slidePos.y = 1.0 - slidePos.y;

  vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);

}
`, g = function() {
            return { diffuse: { value: void 0 }, depth: { value: 1 }, slide: { value: new l.Vector3(0, 0, 1) }, direction: { value: 1 }, flipY: { value: !0 }, discardAlpha: { value: !0 } };
          };
          a.fs = h, a.vs = f, a.glslVersion = d, a.getUniforms = g;
        },
        /* 29 */
        /***/
        (o, a, c) => {
          c(4);
          var l = c(5).resolveURL, d = function(h) {
            c(10).ZincObject.call(this), this.isTexturePrimitive = !0, this.texture = h, this.load = (f, g) => {
              if (f && f.images && f.images.source) {
                var p = new (c(25)).TextureArray(), u = [];
                f.images.source.forEach((v) => {
                  u.push(l(v));
                });
                var y = this;
                p.loadFromImages(u).then(() => {
                  y.texture = p, y.initialise(f, g);
                });
              }
            }, this.initialise = (f, g) => {
              g != null && typeof g == "function" && g(this);
            };
          };
          d.prototype = Object.create(c(10).ZincObject.prototype), d.prototype.constructor = d, a.TexturePrimitive = d;
        },
        /* 30 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(31);
          a.Renderer = function(h) {
            var f = h, g = void 0, p = void 0, u = new l.Clock(!1);
            this.playAnimation = !0;
            var y = 1e3, v = {}, m = 0, x = {}, w = 0, A = {}, M = 0, R = {}, L = 0, _ = void 0, F = void 0, S = void 0, T = void 0, E = [], C = [], P = new l.Group(), b = void 0, I = void 0, D = !1, N = !1;
            this.getDrawingWidth = () => f ? f.clientWidth : b ? typeof b.clientWidth > "u" ? Math.round(b.width) : Math.round(b.clientWidth) : 0, this.getDrawingHeight = () => f ? f.clientHeight : b ? typeof b.clientHeight > "u" ? Math.round(b.height) : Math.round(b.clientHeight) : 0, this.onWindowResize = () => {
              p.onWindowResize();
              var j = this.getDrawingWidth(), te = this.getDrawingHeight();
              if (g != null) {
                var ee;
                f ? (ee = f.getBoundingClientRect(), g.setSize(j, te)) : b && (typeof b.getBoundingClientRect > "u" || (ee = b.getBoundingClientRect(), b.width = j, b.height = te), g.setSize(j, te, !1)), ee && (ee.left, ee.top);
                var ae = new l.Vector2();
                g.getSize(ae), ae.x, ae.y;
              }
            }, this.initialiseVisualisation = (j) => {
              if (!N) {
                if (j = j || {}, j.antialias === void 0) {
                  var te = !1;
                  try {
                    /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (te = !0);
                  } catch {
                    te = !1;
                  }
                  j.antialias = !te;
                }
                j.canvas && (f = void 0, b = j.canvas), g = new l.WebGLRenderer(j), f !== void 0 && f.appendChild(g.domElement), g.setClearColor(16777215, 1), b && b.style && (b.style.height = "100%", b.style.width = "100%");
                var ee = g.domElement;
                ee.addEventListener("webglcontextlost", U, !1), ee.addEventListener("webglcontextrestored", B, !1), g.autoClear = !1;
                var ae = this.createScene("default");
                this.setCurrentScene(ae), N = !0;
              }
            };
            var U = (j) => {
              j.preventDefault();
              for (var te of Object.keys(v)) A.hasOwnProperty(te) && A[te].call();
            }, B = (j) => {
              j.preventDefault();
              for (var te of Object.keys(v)) R.hasOwnProperty(te) && R[te].call();
            };
            this.getCurrentScene = () => p, this.setCurrentScene = (j) => {
              if (j) {
                this.removeActiveScene(j);
                var te = p;
                p = j, te && te.setInteractiveControlEnable(!1), p.setInteractiveControlEnable(!0), p.setAdditionalScenesGroup(P), this.onWindowResize();
              }
            }, this.getSceneByName = (j) => E[j], this.createScene = (j) => {
              if (E[j] == null) {
                var te;
                return te = b ? new (c(32)).Scene(b, g) : new (c(32)).Scene(f, g), E[j] = te, te.sceneName = j, te;
              }
            }, this.resetView = () => {
              p.resetView();
            }, this.viewAll = () => {
              if (p) {
                var j = p.getBoundingBox();
                if (j) {
                  for (var te, ee = 0; ee < C.length; ee++) te = C[ee].getBoundingBox(), te && j.union(te);
                  p.viewAllWithBoundingBox(j);
                }
              }
            }, this.loadModelsURL = (j, te, ee, ae, H, Z) => {
              p.loadModelsURL(j, te, ee, ae, H, Z);
            }, this.loadViewURL = (j) => {
              p.loadViewURL(j);
            }, this.loadFromViewURL = (j, te) => {
              p.loadFromViewURL(j, te);
            }, this.updateDirectionalLight = () => {
              p.updateDirectionalLight();
            };
            var G = () => {
              D ? (_ = requestAnimationFrame(G), this.render()) : (cancelAnimationFrame(_), _ = void 0);
            };
            this.stopAnimate = () => {
              D && (u.stop(), D = !1);
            }, this.animate = () => {
              D || (u.start(), D = !0, G());
            }, this.addContextLostCallbackFunction = (j) => (++M, A[M] = j, M), this.removeContextLostCallbackFunction = (j) => {
              j in A && delete A[j];
            }, this.addContextRestoredCallbackFunction = (j) => (++L, R[L] = j, L), this.removeContextRestoredCallbackFunction = (j) => {
              j in L && delete L[j];
            }, this.addPreRenderCallbackFunction = (j) => (++m, v[m] = j, m), this.removePreRenderCallbackFunction = (j) => {
              j in v && delete v[j];
            }, this.addPostRenderCallbackFunction = (j) => (++w, x[w] = j, w), this.removePostRenderCallbackFunction = (j) => {
              j in x && delete x[j];
            }, this.getPlayRate = () => y, this.setPlayRate = (j) => {
              y = j;
            }, this.getCurrentTime = () => p.getCurrentTime(), this.setMorphsTime = (j) => {
              p.setMorphsTime(j);
            }, this.getZincGeometryByID = (j) => p.getZincGeometryByID(j), this.addToScene = (j) => {
              p.addObject(j);
            }, this.addToOrthoScene = (j) => {
              if (S == null && (S = new l.Scene()), F == null) {
                var te = this.getDrawingWidth(), ee = this.getDrawingHeight();
                F = new l.OrthographicCamera(-te / 2, te / 2, ee / 2, -ee / 2, 1, 10), F.position.z = 10;
              }
              S.add(j);
            };
            var J = (j) => (te) => {
              te.needsUpdate = !0;
              var ee = new l.SpriteMaterial({ map: te }), ae = ee.map.image.width, H = ee.map.image.height;
              j.material = ee, j.scale.set(ae, H, 1);
              var Z = this.getDrawingWidth(), $ = this.getDrawingHeight();
              j.position.set((Z - ae) / 2, (-$ + H) / 2, 1), this.addToOrthoScene(j);
            };
            this.addLogo = () => {
              T = new l.Sprite(), l.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png", void 0, J(T));
            }, this.render = () => {
              I || (f ? 0 < f.clientWidth && 0 < f.clientHeight && (I = new d(f, this.onWindowResize)) : b && 0 < b.width && 0 < b.height && (I = new d(b, this.onWindowResize)));
              var j = u.getDelta();
              p.renderGeometries(y, j, this.playAnimation);
              for (var te, ee = 0; ee < C.length; ee++) te = C[ee], te.renderGeometries(y, j, this.playAnimation);
              F != null && S != null && (g.clearDepth(), g.render(S, F));
              for (var ae of Object.keys(v)) v.hasOwnProperty(ae) && v[ae].call();
              p.render(g);
              for (var H of Object.keys(x)) x.hasOwnProperty(H) && x[H].call();
            }, this.forceContextLoss = () => {
              g.forceContextLoss();
            }, this.forceContextRestore = () => {
              g.forceContextRestore();
            }, this.getThreeJSRenderer = () => g, this.isSceneActive = (j) => {
              if (p === j) return !0;
              for (var te, ee = 0; ee < C.length; ee++) if (te = C[ee], te === j) return !0;
              return !1;
            }, this.addActiveScene = (j) => {
              this.isSceneActive(j) || (C.push(j), P.add(j.getThreeJSScene()));
            }, this.removeActiveScene = (j) => {
              for (var te, ee = 0; ee < C.length; ee++) if (te = C[ee], te === j) return C.splice(ee, 1), void P.remove(j.getThreeJSScene());
            }, this.clearAllActiveScene = () => {
              for (var j = 0; j < C.length; j++) P.remove(C[j].getThreeJSScene());
              C.splice(0, C.length);
            }, this.dispose = () => {
              var j;
              for (var te in D && cancelAnimationFrame(_), E) E.hasOwnProperty(te) && E[te].clearAll();
              E = [], C = [], P = new l.Group(), this.stopAnimate(), v = {}, m = 0, x = {}, x = 0, A = {}, M = 0, R = {}, L = 0, F = void 0, S = void 0, T = void 0;
              var ee = this.createScene("default");
              this.setCurrentScene(ee), I = void 0, (j = g) === null || j === void 0 || j.dispose();
            }, this.transitionScene = (j, te) => {
              if (p) {
                var ee = p.getZincCameraControls(), ae = j.getBoundingBox();
                if (ae) {
                  var H = ae.min.distanceTo(ae.max) / 2, Z = (ae.min.x + ae.max.x) / 2, $ = (ae.min.y + ae.max.y) / 2, se = (ae.min.z + ae.max.z) / 2, k = ee.getViewportFromCentreAndRadius(Z, $, se, H, 40, H * 4), W = ee.getCurrentViewport();
                  ee.cameraTransition(W, k, te), ee.enableCameraTransition();
                }
              }
            }, this.isWebGL2 = () => !!g && g.capabilities.isWebGL2;
          };
        },
        /* 31 */
        /***/
        (o) => {
          o.exports = i4();
        },
        /* 32 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(33).MarkerCluster, h = c(35).SceneLoader, f = c(42).SceneExporter, g = c(44).Viewport, p = c(5).createBufferGeometry, u = c(5).getCircularTexture, y = c(5).createNewSpriteText, v = 0, m = function() {
            return "sc" + v++;
          }, x = function() {
            return { Duration: "6 secs", OriginalDuration: "-", TimeStamps: {} };
          }, w = 6e3;
          a.Scene = function(A, M) {
            var R = this, L = A, _ = void 0, F = new h(this), S = void 0, T = {}, E = 0, C = {}, P = 0, b = new l.Scene(), I = new l.Scene(), D = new (c(45)).Region(void 0, this);
            b.add(D.getGroup());
            var N = new l.Group();
            b.add(N), this.directionalLight = void 0, this.ambient = void 0, this.camera = void 0;
            var U = 6e3, B = void 0;
            this.sceneName = void 0;
            var G = !1, J = void 0;
            this.autoClearFlag = !0, this.displayMarkers = !1, this.displayMinimap = !1, this.displayMiniAxes = !1, this.minimapScissor = { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-right", updateRequired: !0 };
            var j = { x: 0, y: 0 }, te = x(), ee = new l.Vector2(), ae = [];
            this.forcePickableObjectsUpdate = !1, this.uuid = m();
            var H = new d(this);
            H.disable(), b.add(H.group);
            var Z = { main: [], mini: [] }, $ = new l.Vector3(0, 0, 0), se = () => L ? typeof L.clientWidth > "u" ? L.width : L.clientWidth : 0, k = () => L ? typeof L.clientHeight > "u" ? L.height : L.clientHeight : 0;
            this.getDownloadProgress = () => F.getDownloadProgress(), this.onWindowResize = () => {
              var O = k();
              this.camera.aspect = se() / O, this.camera.updateProjectionMatrix(), this.minimapScissor.updateRequired = !0, B.onResize(), B.calculateHeightPerPixelAtZeroDepth(O);
            }, this.resetView = () => {
              this.onWindowResize(), B.resetView();
            }, this.changeZoomByScrollRateUnit = (O) => {
              B.changeZoomByScrollRateUnit(O);
            };
            var W = () => {
              this.camera = new l.PerspectiveCamera(40, se() / k(), 0, 10), this.ambient = new l.AmbientLight(16777215, 0.2), b.add(this.ambient), this.directionalLight = new l.DirectionalLight(16777215, 0.8), b.add(this.directionalLight), B = new (c(44)).CameraControls(this.camera, M.domElement, M, this), B.setDirectionalLight(this.directionalLight), B.resetView(), S = new (c(50)).Minimap(this);
            };
            W(), this.loadView = (O) => {
              var X = new g();
              return X.setFromObject(O), B.setCurrentCameraSettings(X), !0;
            }, this.setupMultipleViews = (O, X) => {
              for (var [Y, ie] of Object.entries(X)) {
                var fe = new g();
                fe.setFromObject(ie), B.addViewport(Y, fe);
              }
              B.setDefaultViewport(O);
            }, this.getBoundingBox = () => D.getBoundingBox(!0), this.viewAllWithBoundingBox = (O) => {
              if (O) {
                var X = B.getViewportFromBoundingBox(O, 1);
                B.setCurrentCameraSettings(X), B.calculateHeightPerPixelAtZeroDepth(k()), H.markerUpdateRequired = !0;
              }
            }, this.viewAll = () => {
              var O = this.getBoundingBox();
              this.viewAllWithBoundingBox(O), H.markerUpdateRequired = !0;
            }, this.forEachGeometry = (O) => {
              D.forEachGeometry(O, !0);
            }, this.forEachGlyphset = (O) => {
              D.forEachGlyphset(O, !0);
            }, this.forEachPointset = (O) => {
              D.forEachPointset(O, !0);
            }, this.forEachLine = (O) => {
              D.forEachLine(O, !0);
            }, this.findGeometriesWithGroupName = (O) => D.findGeometriesWithGroupName(O, !0), this.findPointsetsWithGroupName = (O) => D.findPointsetsWithGroupName(O, !0), this.findGlyphsetsWithGroupName = (O) => D.findGlyphsetsWithGroupName(O, !0), this.findLinesWithGroupName = (O) => D.findLinesWithGroupName(O, !0), this.findObjectsWithGroupName = (O) => D.findObjectsWithGroupName(O, !0), this.findObjectsWithAnatomicalId = (O) => D.findObjectsWithAnatomicalId(O, !0), this.getBoundingBoxOfZincObjects = (O) => {
              for (var X, Y = void 0, ie = 0; ie < O.length; ie++) X = O[ie].getBoundingBox(), X && (Y ? Y.union(X) : Y = X);
              return Y;
            }, this.vectorToScreenXY = (O) => {
              O.project(this.camera);
              var X = se(), Y = k(), ie = X / 2, fe = Y / 2;
              return O.x = O.x * ie + ie, O.y = -(O.y * fe) + fe, O;
            }, this.getObjectsScreenXY = (O) => {
              if (O && 0 < O.length) {
                var X = this.getBoundingBoxOfZincObjects(O), Y = new l.Vector3();
                return X.getCenter(Y), this.vectorToScreenXY(Y);
              }
            }, this.getNamedObjectsScreenXY = (O) => {
              var X = this.findObjectsWithGroupName(O);
              return this.getObjectsScreenXY(X);
            }, this.addZincObject = (O) => {
              O && (D.addZincObject(O), B && B.calculateMaxAllowedDistance(this));
            }, this.loadGlyphsetURL = (O, X, Y, ie) => {
              F.loadGlyphsetURL(D, O, X, Y, ie);
            }, this.loadPointsetURL = (O, X, Y, ie, fe) => {
              F.loadPointsetURL(D, O, X, Y, ie, fe);
            }, this.loadLinesURL = (O, X, Y, ie, fe) => {
              F.loadLinesURL(D, O, X, Y, ie, fe);
            }, this.loadSTL = (O, X, Y) => {
              F.loadSTL(D, O, X, Y);
            }, this.loadOBJ = (O, X, Y) => {
              F.loadOBJ(D, O, X, Y);
            }, this.loadMetadataURL = (O, X, Y, ie) => {
              F.loadMetadataURL(D, O, X, Y, ie);
            }, this.loadModelsURL = (O, X, Y, ie, fe, be) => {
              F.loadModelsURL(D.urls, X, Y, ie, fe, be);
            }, this.loadViewURL = (O) => {
              F.loadViewURL(O);
            }, this.loadFromViewURL = (O, X) => {
              F.loadFromViewURL(O, X);
            }, this.loadGLTF = (O, X, Y, ie) => {
              F.loadGLTF(D, O, X, Y, ie);
            }, this.updateDirectionalLight = () => {
              B.updateDirectionalLight();
            }, this.addObject = (O) => {
              b.add(O);
            }, this.removeObject = (O) => {
              b.remove(O);
            }, this.getCurrentTime = () => {
              if (_ != null) return _.getCurrentTime(U);
              var O = D.getCurrentTime();
              return O === -1 ? 0 : O;
            }, this.setMorphsTime = (O) => {
              _ != null && _.setMorphTime(O, U), D.setMorphTime(O, !0);
            }, this.isTimeVarying = () => !!(_ && _.video && !_.video.error) || D.isTimeVarying(), this.renderGeometries = (O, X, Y) => {
              var ie = {};
              if (ie.camera = B, ie.displayMarkers = this.displayMarkers, ie.markerCluster = H, ie.markersList = H.markers, ie.ndcToBeUpdated = !1, Y && (ie.markerCluster.markerUpdateRequired = !0), !_) F.toBeDownloaded == 0 ? (ie.ndcToBeUpdated = B.update(X), ie.ndcToBeUpdated && B.calculateHeightPerPixelAtZeroDepth(k()), D.renderGeometries(O, X, Y, B, ie, !0)) : B.update(0);
              else if (_.isReadyToPlay()) {
                Y ? _.video.play() : _.video.pause();
                var fe = _.video.currentTime / _.getVideoDuration() * U;
                F.toBeDownloaded == 0 ? (B.setTime(fe), ie.ndcToBeUpdated = B.update(0), ie.ndcToBeUpdated && B.calculateHeightPerPixelAtZeroDepth(k()), D.setMorphTime(fe, !0), D.renderGeometries(0, 0, Y, B, ie, !0)) : B.update(0);
              } else myPlayRate = 0;
            }, this.getThreeJSScene = () => b, this.setVideoHandler = (O) => {
              _ || (_ = O);
            }, this.setAdditionalScenesGroup = (O) => {
              b.add(O);
            };
            var q = (O, X, Y, ie, fe, be, Ae) => {
              var he = 0, xe = 0;
              return xe = O.includes("top") ? Ae - fe - Y : O.includes("bottom") ? Y : Math.floor((Ae - fe) / 2), he = O.includes("left") ? X : O.includes("right") ? be - X - ie : Math.floor((be - ie) / 2), { x: he, y: xe };
            }, ce = (O) => {
              (this.displayMinimap || this.displayMiniAxes) && (O.setScissorTest(!0), O.getSize(ee), this.minimapScissor.updateRequired && (j = q(this.minimapScissor.align, this.minimapScissor.x_offset, this.minimapScissor.y_offset, this.minimapScissor.width, this.minimapScissor.height, ee.x, ee.y), this.minimapScissor.updateRequired = !1), O.setScissor(j.x, j.y, this.minimapScissor.width, this.minimapScissor.height), O.setViewport(j.x, j.y, this.minimapScissor.width, this.minimapScissor.height), S.updateCamera(), this.displayMiniAxes ? O.render(I, S.camera) : (b.add(S.mask), O.render(b, S.camera), b.remove(S.mask)), O.setScissorTest(!1), O.setViewport(0, 0, ee.x, ee.y));
            };
            this.render = (O) => {
              this.autoClearFlag && O.clear(), G && J ? J.render(b, this.camera) : (O.render(b, this.camera), ce(O));
            }, this.setInteractiveControlEnable = (O) => {
              O == !0 ? B.enable() : B.disable();
            }, this.getZincCameraControls = () => B, this.getThreeJSScene = () => b, this.setDuration = (O) => {
              D.setDuration(O), U = O, B.setPathDuration(O), F.duration = O;
            }, this.getDuration = () => U, this.setStereoEffectEnable = (O) => {
              O != !0 || J || (J = new c(44).StereoEffect(M)), M.setSize(se(), k()), this.camera.updateProjectionMatrix(), G = O;
            }, this.objectIsInScene = (O) => D.objectIsInRegion(O, !0), this.alignBoundingBoxToCameraView = (O, X) => {
              if (O) {
                O.getCenter($);
                var Y = this.getZincCameraControls().getCurrentViewport(), ie = new l.Vector3(Y.targetPosition[0], Y.targetPosition[1], Y.targetPosition[2]), fe = new l.Vector3(Y.eyePosition[0], Y.eyePosition[1], Y.eyePosition[2]), be = new l.Vector3(), Ae = new l.Vector3();
                be.subVectors(ie, fe).normalize(), Ae.subVectors(ie, $).normalize();
                var he = new l.Vector3();
                he.crossVectors(be, Ae);
                var xe = be.angleTo(Ae);
                0 < X ? (this.getZincCameraControls().rotateCameraTransition(he, xe, X), this.getZincCameraControls().enableCameraTransition()) : this.getZincCameraControls().rotateAboutLookAtpoint(he, xe), H.markerUpdateRequired = !0;
              }
            }, this.translateBoundingBoxToCameraView = (O, X, Y) => {
              if (O) {
                var ie = this.getZincCameraControls().getCurrentViewport(), fe = this.getZincCameraControls().getViewportFromBoundingBox(O, X);
                0 < Y && (this.getZincCameraControls().cameraTransition(ie, fe, Y), this.getZincCameraControls().enableCameraTransition()), H.markerUpdateRequired = !0;
              }
            }, this.alignObjectToCameraView = (O, X) => {
              if (this.objectIsInScene(O)) {
                var Y = O.getBoundingBox();
                this.alignBoundingBoxToCameraView(Y, X);
              }
            }, this.setCameraTargetToObject = (O) => {
              if (this.objectIsInScene(O)) {
                var X = O.getBoundingBox(), Y = this.getZincCameraControls().getCurrentViewport();
                X.getCenter($);
                var ie = new l.Vector3(Y.targetPosition[0], Y.targetPosition[1], Y.targetPosition[2]), fe = new l.Vector3(Y.eyePosition[0], Y.eyePosition[1], Y.eyePosition[2]), be = new l.Vector3(), Ae = new l.Vector3();
                be.subVectors(fe, ie), Ae.addVectors($, be), Y.eyePosition[0] = Ae.x, Y.eyePosition[1] = Ae.y, Y.eyePosition[2] = Ae.z, Y.targetPosition[0] = $.x, Y.targetPosition[1] = $.y, Y.targetPosition[2] = $.z, this.getZincCameraControls().setCurrentCameraSettings(Y), H.markerUpdateRequired = !0;
              }
            }, this.isStereoEffectEnable = () => G, this.removeZincObject = (O) => {
              D.removeZincObject(O), B && B.calculateMaxAllowedDistance(this), H.markerUpdateRequired = !0;
            }, this.updatePickableThreeJSObjects = () => {
              ae.length = 0, H.isEnabled && ae.push(H.group), D.getPickableThreeJSObjects(ae, !0), this.forcePickableObjectsUpdate = !1;
            }, this.getPickableThreeJSObjects = () => ((this.forcePickableObjectsUpdate || D.checkPickableUpdateRequred(!0)) && this.updatePickableThreeJSObjects(), ae), this.getNormalisedMinimapCoordinates = (O, X) => {
              if (this.displayMinimap) {
                var Y = new l.Vector2();
                O.getSize(Y);
                var ie = Y.y - X.clientY;
                if (j.x + this.minimapScissor.width > X.clientX && X.clientX > j.x && j.y + this.minimapScissor.height > ie && ie > j.y) {
                  var fe = 2 * ((X.clientX - j.x) / this.minimapScissor.width) - 1, be = 2 * ((ie - j.y) / this.minimapScissor.height) - 1;
                  return { x: fe, y: be };
                }
              }
            }, this.getMinimapDiffFromNormalised = (O, X) => S ? S.getDiffFromNormalised(O, X) : void 0, this.isWebGL2 = () => M.isWebGL2(), this.clearAll = () => {
              H.clear(), D.clear(!0), this.clearZincObjectAddedCallbacks(), this.clearZincObjectRemovedCallbacks(), F.toBeDwonloaded = 0, B && B.calculateMaxAllowedDistance(this), H.markerUpdateRequired = !0;
            }, this.addMetadataTimeStamp = (O, X) => {
              te.TimeStamps[O] = V(X);
            }, this.getMetadataTag = (O) => te[O], this.getMetadata = () => te, this.setMetadataTag = (O, X) => {
              te[O] = X;
            }, this.removeMetadataTag = (O) => {
              delete te[O];
            }, this.resetMetadata = () => {
              te = x();
            }, this.resetDuration = () => {
              this.setDuration(w);
            };
            var oe = (O) => [...O.years ? ["".concat(O.years, "years")] : [], ...O.months ? ["".concat(O.months, "months")] : [], ...O.weeks ? ["".concat(O.weeks, "weeks")] : [], ...O.days ? ["".concat(O.days, "days")] : [], ...O.hours ? ["".concat(O.hours, "hours")] : [], ...O.mins ? ["".concat(O.mins, "mins")] : [], ...O.secs ? ["".concat(O.secs, "secs")] : []].join(" "), V = (O) => O.years ? 31536e6 * O.years : 0 + O.months ? 2592e6 * O.months : 0 + O.weeks ? 6048e5 * O.weeks : 0 + O.days ? 864e5 * O.days : 0 + O.hours ? 36e5 * O.hours : 0 + O.mins ? 6e4 * O.mins : 0 + O.secs ? 1e3 * O.secs : 0;
            this.setDurationFromObject = (O) => {
              var X = oe(O), Y = V(O);
              this.setMetadataTag("Duration", X), this.setDuration(Y);
            }, this.setOriginalDurationFromObject = (O) => {
              var X = oe(O);
              this.setMetadataTag("OriginalDuration", X);
            }, this.exportGLTF = (O) => {
              var X = new f(this);
              return X.exportGLTF(O);
            }, this.getRootRegion = () => D, this.createLines = (O, X, Y, ie) => {
              var fe = D.findChildFromPath(O);
              return fe === void 0 && (fe = D.createChildFromPath(O)), fe.createLines(X, Y, ie);
            }, this.createPoints = (O, X, Y, ie, fe) => {
              var be = D.findChildFromPath(O);
              return be === void 0 && (be = D.createChildFromPath(O)), be.createPoints(X, Y, ie, fe);
            }, this.addZincObjectAddedCallbacks = (O) => (++E, T[E] = O, E), this.addZincObjectRemovedCallbacks = (O) => (++P, C[P] = O, P), this.removeZincObjectAddedCallbacks = (O) => {
              O in E && delete T[O];
            }, this.removeZincObjectRemovedCallbacks = (O) => {
              O in P && delete C[O];
            }, this.clearZincObjectAddedCallbacks = () => {
              T = {}, E = 0;
            }, this.clearZincObjectRemovedCallbacks = () => {
              C = {}, P = 0;
            }, this.triggerObjectAddedCallback = (O) => {
              for (var X in T) T.hasOwnProperty(X) && T[X](O);
            }, this.triggerObjectRemovedCallback = (O) => {
              for (var X in C) C.hasOwnProperty(X) && C[X](O);
            }, this.addTemporaryPoints = (O, X) => {
              var Y = p(O.length, O), ie = new l.PointsMaterial({ alphaTest: 0.5, size: 15, color: X, sizeAttenuation: !1 }), fe = u();
              ie.map = fe;
              var be = new (c(23)).Points(Y, ie);
              return N.add(be), be;
            }, this.addTemporaryLines = (O, X) => {
              var Y = p(O.length, O), ie = new l.LineBasicMaterial({ color: X }), fe = new (c(12)).LineSegments(Y, ie);
              return N.add(fe), fe;
            }, this.removeTemporaryPrimitive = (O) => {
              N.remove(O), O.geometry.dispose(), O.material.dispose();
            }, this.clearTemporaryPrimitives = () => {
              var O = 0, X = N.children;
              return X.forEach((Y) => {
                Y.geometry.dispose(), Y.material.dispose(), O++;
              }), N.clear(), O;
            }, this.addBoundingBoxPrimitive = function(O, X, Y, ie, fe) {
              var be = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0, Ae = D.findChildFromPath(O);
              Ae === void 0 && (Ae = D.createChildFromPath(O));
              var he = be || R.getBoundingBox();
              $.set(0, 0, 0);
              var xe = $.subVectors(he.max, he.min), re = new l.BoxGeometry(xe.x, xe.y, xe.z), me = Ae.createGeometryFromThreeJSGeometry(X, re, Y, ie, fe, 1e4);
              return xe.addVectors(he.min, he.max).multiplyScalar(0.5), me.setPosition(xe.x, xe.y, xe.z), me;
            }, this.addSlicesPrimitive = function(O, X, Y, ie, fe) {
              var be = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0;
              if (X && 3 <= X.length && Y && 3 <= Y.length) {
                var Ae = D.findChildFromPath(O);
                Ae === void 0 && (Ae = D.createChildFromPath(O));
                var he = be || R.getBoundingBox();
                $.set(0, 0, 0);
                var xe = $.subVectors(he.max, he.min), re = [], me = 0;
                return ["x", "y", "z"].forEach((Me) => {
                  var De;
                  switch (Me) {
                    case "x":
                      De = new l.PlaneGeometry(xe.z, xe.y), De.rotateY(Math.PI / 2);
                      break;
                    case "y":
                      De = new l.PlaneGeometry(xe.x, xe.z), De.rotateX(Math.PI / 2);
                      break;
                    case "z":
                      De = new l.PlaneGeometry(xe.x, xe.y);
                      break;
                  }
                  var Ie = Ae.createGeometryFromThreeJSGeometry(X[me], De, Y[me], ie, fe, 10001);
                  re.push(Ie), me++;
                }), xe.addVectors(he.min, he.max).multiplyScalar(0.5), re.forEach((Me) => {
                  Me.setPosition(xe.x, xe.y, xe.z);
                }), re;
              }
            }, this.enableMarkerCluster = (O) => {
              O ? (H.markerUpdateRequired = !0, H.enable()) : (H.markerUpdateRequired = !1, H.disable()), this.forcePickableObjectsUpdate = !0;
            }, this.destroyAxisDisplay = () => {
              this.displayMiniAxes = !1, Z.main && (this.enableAxisDisplay(!1, !1), Z.main.forEach((O) => {
                O.dispose && O.dispose();
              })), Z.mini && (this.enableAxisDisplay(!1, !0), Z.mini.forEach((O) => {
                O.dispose && O.dispose();
              })), Z = { main: [], mini: [] };
            }, this.createAxisDisplay = function() {
              var O = 0 < arguments.length && arguments[0] !== void 0 && arguments[0];
              R.destroyAxisDisplay();
              var X = [{ name: "x", dir: new l.Vector3(1, 0, 0), colour: "red", hex: 16733525 }, { name: "y", dir: new l.Vector3(0, 1, 0), colour: "green", hex: 5635925 }, { name: "z", dir: new l.Vector3(0, 0, 1), colour: "blue", hex: 5592575 }], Y = R.getBoundingBox(), ie = Y.min.distanceTo(Y.max), fe = new l.Vector3(0, 0, 0);
              O && fe.copy(Y.min), X.forEach((be) => {
                var Ae = new l.ArrowHelper(be.dir, fe, ie, be.hex);
                Z.main.push(Ae);
                var he = new l.ArrowHelper(be.dir, Y.getCenter($), ie / 2, be.hex);
                Z.mini.push(he);
                var xe = y(be.name, 0.036, be.colour, "Asap", 120, 700), re = be.dir.clone().multiplyScalar(ie).add(fe);
                xe.position.set(re.x, re.y, re.z), Z.main.push(xe);
              });
            }, this.enableAxisDisplay = function(O) {
              var X, Y = 1 < arguments.length && arguments[1] !== void 0 && arguments[1];
              Y && (X = Z) !== null && X !== void 0 && (X = X.mini) !== null && X !== void 0 && X.length ? (R.displayMiniAxes = O, Z.mini.forEach((ie) => {
                O ? I.add(ie) : I.remove(ie);
              })) : !Y && Z.main && Z.main.forEach((ie) => {
                O ? b.add(ie) : b.remove(ie);
              });
            };
          };
        },
        /* 33 */
        /***/
        (o, a, c) => {
          function l(A, M) {
            var R = Object.keys(A);
            if (Object.getOwnPropertySymbols) {
              var L = Object.getOwnPropertySymbols(A);
              M && (L = L.filter(function(_) {
                return Object.getOwnPropertyDescriptor(A, _).enumerable;
              })), R.push.apply(R, L);
            }
            return R;
          }
          function d(A) {
            for (var M, R = 1; R < arguments.length; R++) M = arguments[R] == null ? {} : arguments[R], R % 2 ? l(Object(M), !0).forEach(function(L) {
              h(A, L, M[L]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(A, Object.getOwnPropertyDescriptors(M)) : l(Object(M)).forEach(function(L) {
              Object.defineProperty(A, L, Object.getOwnPropertyDescriptor(M, L));
            });
            return A;
          }
          function h(A, M, R) {
            return (M = f(M)) in A ? Object.defineProperty(A, M, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : A[M] = R, A;
          }
          function f(A) {
            var M = g(A, "string");
            return typeof M == "symbol" ? M : M + "";
          }
          function g(A, M) {
            if (typeof A != "object" || !A) return A;
            var R = A[Symbol.toPrimitive];
            if (R !== void 0) {
              var L = R.call(A, M || "default");
              if (typeof L != "object") return L;
              throw new TypeError("@@toPrimitive must return a primitive value.");
            }
            return (M === "string" ? String : Number)(A);
          }
          var p = c(4), u = new Image(128, 128);
          u.src = c(34);
          var y = new p.Texture();
          y.image = u, y.needsUpdate = !0;
          var v = [0.02, 0.03, 1], m = new p.SpriteMaterial({ map: y, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), x = c(5).createNewSpriteText, w = function(A) {
            c(10).ZincObject.call(this), this.texture = y;
            var M = void 0;
            this.morph = new p.Group(), this.group = this.morph, this.isMarkerCluster = !0;
            var R = !0, L = [];
            this.markers = {};
            var _ = new p.Vector2(), F = new p.Vector2(), S = Date.now();
            this.setSpriteSize = (b) => {
              M.scale.set(0.015, 0.02, 1), M.scale.multiplyScalar(b);
            }, this.clear = () => {
              this.group.clear(), this.markers = {};
            }, this.dispose = () => {
              this.clear(), this.morph && this.morph.clear();
            };
            var T = (b) => {
              var I = new p.Group(), D = new p.Sprite(m);
              return D.clusterIndex = b, D.center.set(0.5, 0), D.position.set(0, 0, 0), D.renderOrder = 1e4, D.scale.set(v[0], v[1], v[2]), D.userData = this, I.add(D), this.group.add(I), { group: I, marker: D, label: void 0, number: 0, min: [0, 0, 0], max: [1, 1, 1] };
            }, E = (b, I, D) => {
              b.group.visible = !0, b.group.position.set(I.coords[0], I.coords[1], I.coords[2]), (b.label === void 0 || D !== b.number) && (b.label && (b.group.remove(b.label), b.label.material.map.dispose(), b.label.material.dispose()), b.label = x(D, 0.012, "black", "Asap", 120, 700), b.number = D, b.group.add(b.label)), b.min = I.min, b.max = I.max;
            }, C = (b) => {
              var I = 0;
              for (b.forEach((D) => {
                var N = D.members.length, U = 0;
                N === 1 ? D.members[0].setVisibility(!0) : (D.members.forEach((B) => {
                  U += B.getNumber(), B.setVisibility(!1);
                }), !L[I] && L.push(T(I)), E(L[I], D, U), I++);
              }), I; I < L.length; I++) L[I].group.visible = !1;
            }, P = (b, I) => {
              var D = !0, N = { members: [], coords: [0, 0, 0], min: [0, 0, 0], max: [1, 1, 1] }, U = 0;
              for (var B in b) D ? (_.set(b[B].ndc.x, b[B].ndc.y), this._b1.setFromPoints([b[B].morph.position]), D = !1, N.members.push(b[B]), N.coords = [b[B].morph.position.x, b[B].morph.position.y, b[B].morph.position.z], I.push(N), delete b[B]) : (F.set(b[B].ndc.x, b[B].ndc.y), U = _.distanceTo(F), 0.1 > U && (N.members.push(b[B]), this._b1.expandByPoint(b[B].morph.position), delete b[B]));
              N.min = [this._b1.min.x, this._b1.min.y, this._b1.min.z], N.max = [this._b1.max.x, this._b1.max.y, this._b1.max.z], D != !0 && P(b, I);
            };
            this.calculate = () => {
              if (R) {
                var b = Date.now();
                if (500 < b - S) {
                  var I = [];
                  P(d({}, this.markers), I), C(I), S = Date.now(), this.markerUpdateRequired = !1;
                }
              }
            }, this.isEnabled = () => R, this.enable = () => {
              R = !0, this.morph.visible = !0;
            }, this.disable = () => {
              for (var b in R = !1, this.morph.visible = !1, this.markers) {
                var I;
                (I = this.markers[b]) !== null && I !== void 0 && I.isMarker && this.markers[b].isEnabled() && this.markers[b].setVisibility(!0);
              }
            }, this.zoomToCluster = (b) => !!(b !== void 0 && -1 < b && (this._v1.set(...L[b].min), this._v2.set(...L[b].max), Math.abs(0 < this._v1.distanceTo(this._v2)))) && (this._b1.set(this._v1, this._v2), A.translateBoundingBoxToCameraView(this._b1, 3, 300), this.markerUpdateRequired = !0, !0), this.clusterIsVisible = (b) => {
              if (b !== void 0 && -1 < b && L[b]) {
                var I;
                return (I = L[b].group) === null || I === void 0 ? void 0 : I.visible;
              }
              return !1;
            };
          };
          w.prototype = Object.create(c(10).ZincObject.prototype), a.MarkerCluster = w;
        },
        /* 34 */
        /***/
        (o) => {
          o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+";
        },
        /* 35 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).resolveURL, h = c(5).createNewURL, f = c(5).isRegionGroup, g = c(36).STLLoader, p = c(37).OBJLoader, u = c(38).PrimitivesLoader;
          a.SceneLoader = function(y) {
            var v = y;
            this.toBeDownloaded = 0, this.progressMap = {};
            var m = !1, x = !1, w = new u();
            this.getDownloadProgress = () => {
              var H = 0, Z = 0, $ = !1;
              for (var se in this.progressMap) {
                var k = this.progressMap[se];
                H += k[1], Z += k[0], k[1] == 0 && ($ = !0);
              }
              return $ && (H = 0), [H, Z, x];
            }, this.onProgress = (H) => (Z) => {
              this.progressMap[H] = [Z.loaded, Z.total];
            }, this.onError = (H) => (Z) => {
              --this.toBeDownloaded, x = !0, console.error("There is an issue with external resource ".concat(Z != null && Z.responseURL ? ": " + (Z == null ? void 0 : Z.responseURL) : "", ".")), H && H({ type: "Error", xhr: Z });
            };
            var A = (H, Z) => {
              var $ = Z.Default;
              if (Z.Inline) v.setupMultipleViews($, Z.Entries);
              else {
                var se = [], k = function(oe) {
                  H && (newURL = h(q, H), se.push(new Promise((V, O) => {
                    fetch(newURL).then((X) => X.json()).then((X) => V({ key: oe, data: X })).catch((X) => O(X));
                  })));
                };
                for (var [W, q] of Object.entries(Z.Entries)) k(W);
                Promise.all(se).then((ce) => {
                  var oe = {};
                  ce.forEach((O) => {
                    oe[O.key] = O.data;
                  }), v.setupMultipleViews($, oe);
                  var V = v.getZincCameraControls();
                  V && V.setCurrentViewport($), m = !0;
                });
              }
            };
            this.loadViewURL = (H, Z) => {
              this.toBeDownloaded += 1;
              var $ = new XMLHttpRequest();
              $.onreadystatechange = () => {
                if ($.readyState == 4) if ($.status == 200) {
                  var k = JSON.parse($.responseText);
                  v.setupMultipleViews("default", { default: k }), v.resetView(), m = !0, --this.toBeDownloaded, Z != null && typeof Z == "function" && Z();
                } else this.onError(Z)({ responseURL: H });
              };
              var se = d(H);
              $.open("GET", se, !0), $.send();
            }, this.loadModelsURL = (H, Z, $, se, k, W, q) => {
              var ce = Z.length;
              this.toBeDownloaded += ce;
              for (var oe = 0; oe < ce; oe++) {
                var V = Z[oe], O = c(0).defaultMaterialColor, X = c(0).defaultOpacity;
                $ != null && $[oe] != null && (O = !!$[oe]), se != null && se[oe] != null && (X = se[oe]);
                var Y = 0;
                k != null && k[oe] != null && (Y = !!k[oe]);
                var ie = 0;
                W != null && W[oe] != null && (ie = !!W[oe]), w.load(d(V), P(H, O, X, Y, ie, void 0, void 0, void 0, void 0, q), this.onProgress(V), this.onError(q));
              }
            }, this.loadFromViewURL = (H, Z, $) => {
              var se = new XMLHttpRequest();
              se.onreadystatechange = () => {
                if (se.readyState == 4 && se.status == 200) {
                  var W = JSON.parse(se.responseText);
                  v.loadView(W);
                  for (var q, ce = [], oe = Z + "_", V = 0; V < W.numberOfResources; V++) q = oe + (V + 1) + ".json", ce.push(q);
                  this.loadModelsURL(H, ce, W.colour, W.opacity, W.timeEnabled, W.morphColour, $);
                }
              };
              var k = d(Z + "_view.json");
              se.open("GET", k, !0), se.send();
            };
            var M = (H, Z, $, se, k, W, q, ce, oe) => (V, O) => {
              var X = ce ? new (c(39)).TubeLines() : new (c(24)).Lines(), Y = void 0;
              O && O[0] && (Y = new l.LineBasicMaterial({ color: O[0].color.clone() }), 1 > O[0].opacity && (Y.transparent = !0), Y.opacity = O[0].opacity, Y.morphTargets = Z, Y.vertexColors = O[0].vertexColors);
              var ie = { localTimeEnabled: Z, localMorphColour: $ };
              if (X && (X.createLineSegment(V, Y, ie), X.setName(se), X.setAnatomicalId(k), X.setRenderOrder(W), H.addZincObject(X), X.setDuration(v.getDuration()), q && q.levels)) for (var [fe, be] of Object.entries(q.levels)) X.addLOD(w, fe, be.URL, be.Index, q.preload);
              --this.toBeDownloaded, V.dispose(), oe != null && typeof oe == "function" && oe(X);
            };
            this.loadLinesURL = (H, Z, $, se, k, W, q) => {
              var ce = 0;
              this.toBeDownloaded += 1;
              var oe = !!(q != null && q.isInline) && q.isInline, V = q != null && q.anatomicalId ? q.anatomicalId : void 0, O = q != null && q.renderOrder ? q.renderOrder : void 0;
              $ != null && (ce = !!$);
              var X = 0;
              se != null && (X = !!se);
              var Y = q.tubeLines && !ce && !X;
              if (oe) {
                var ie = w.parse(Z);
                M(H, ce, X, k, V, O, q.lod, Y, W)(ie.geometry, ie.materials);
              } else w.load(Z, M(H, ce, X, k, V, O, q.lod, Y, W), this.onProgress(Z), this.onError(W), q.loaderOptions);
            };
            var R = (H, Z, $, se, k, W) => {
              var q = W && W.isInline ? W.isInline : void 0, ce = W && W.anatomicalId ? W.anatomicalId : void 0, oe = W && W.displayLabels ? W.displayLabels : void 0, V = W && W.renderOrder ? W.renderOrder : void 0, O = new (c(18)).Glyphset();
              O.setDuration(v.getDuration()), O.groupName = se;
              var X = () => {
                --this.toBeDownloaded, k != null && typeof k == "function" && k(O);
              };
              ++this.toBeDownloaded, q ? O.load(Z, $, X, q, oe) : O.load(Z, d($), X, q, oe), O.setAnatomicalId(ce), O.setRenderOrder(V), H.addZincObject(O);
            }, L = (H, Z, $, se, k, W) => () => {
              if (Z.readyState == 4 && Z.status == 200) {
                var q = JSON.parse(Z.responseText);
                R(H, q, $, se, k, W);
              }
            }, _ = (H, Z, $, se, k, W, q) => (ce, oe) => {
              var V = new (c(22)).Pointset(), O = new l.PointsMaterial({ alphaTest: 0.5, size: 10, sizeAttenuation: !1 });
              oe && oe[0] && (1 > oe[0].opacity && (O.transparent = !0), O.opacity = oe[0].opacity, O.color = oe[0].color, O.morphTargets = Z, O.vertexColors = oe[0].vertexColors);
              var X = {};
              X.localTimeEnabled = Z, X.localMorphColour = $, V && (V.createMesh(ce, O, X), V.setName(se), V.setAnatomicalId(k), H.addZincObject(V), V.setDuration(v.getDuration()), V.setRenderOrder(W)), ce.dispose(), --this.toBeDownloaded, q != null && typeof q == "function" && q(V);
            };
            this.loadSTL = (H, Z, $, se) => {
              this.toBeDownloaded += 1;
              var k = c(0).defaultMaterialColor, W = c(0).defaultOpacity, q = new g();
              q.crossOrigin = "Anonymous", q.load(d(Z), P(H, k, W, !1, !1, $, void 0, void 0, void 0, se));
            }, this.loadOBJ = (H, Z, $, se) => {
              this.toBeDownloaded += 1;
              var k = c(0).defaultMaterialColor, W = c(0).defaultOpacity, q = new p();
              q.crossOrigin = "Anonymous", q.load(d(Z), P(H, k, W, !1, !1, $, void 0, void 0, void 0, se));
            };
            var F = (H, Z, $, se, k, W, q) => {
              this.toBeDownloaded += 1;
              var ce = c(0).defaultMaterialColor, oe = c(0).defaultOpacity, V = 0, O = !!(q && q.isInline) && q.isInline, X = q && q.fileFormat ? q.fileFormat : void 0, Y = q && q.anatomicalId ? q.anatomicalId : void 0, ie = q && q.renderOrder ? q.renderOrder : void 0;
              $ != null && (V = !!$);
              var fe = 0;
              se != null && (fe = !!se);
              var be = w;
              if (X !== void 0) {
                if (X == "STL") be = new g();
                else if (X == "OBJ") return be = new p(), be.crossOrigin = "Anonymous", void be.load(Z, objloader(H, ce, oe, V, fe, k, Y, W), this.onProgress(Z), this.onError, q.loaderOptions);
              }
              if (O) {
                var Ae = w.parse(Z);
                P(H, ce, oe, V, fe, k, Y, ie, q, W)(Ae.geometry, Ae.materials);
              } else be.crossOrigin = "Anonymous", w.load(Z, P(H, ce, oe, V, fe, k, Y, ie, q, W), this.onProgress(Z), this.onError(W), q.loaderOptions);
            }, S = function(Z, $, se) {
              var k = 0;
              return (W) => {
                if (++k, W && $ != null && typeof $ == "function" && $(W), k == Z && (m == !1 && v.viewAll(), se != null && typeof se == "function")) {
                  se();
                  var q = v.getZincCameraControls();
                  q && q.calculateMaxAllowedDistance(v);
                }
              };
            };
            this.loadPointsetURL = (H, Z, $, se, k, W, q) => {
              var ce = 0;
              this.toBeDownloaded += 1, $ != null && (ce = !!$);
              var oe = 0;
              se != null && (oe = !!se);
              var V = !!(q && q.isInline) && q.isInline, O = q && q.anatomicalId ? q.anatomicalId : void 0, X = q && q.renderOrder ? q.renderOrder : void 0;
              if (V) {
                var Y = w.parse(Z);
                _(H, ce, oe, k, O, X, W)(Y.geometry, Y.materials);
              } else w.load(Z, _(H, ce, oe, k, O, X, W), this.onProgress(Z), this.onError(W), q.loaderOptions);
            };
            var T = (H, Z, $, se, k, W) => {
              var q = W && W.isInline ? W.isInline : void 0, ce = W && W.anatomicalId ? W.anatomicalId : void 0, oe = W && W.renderOrder ? W.renderOrder : void 0, V = void 0;
              if ($) {
                if (Z && $.images && $.images.source) for (var O, X = $.images.source, Y = 0; Y < X.length; Y++) O = h(X[Y], Z), $.images.source[Y] = O;
                if ($.type === "slides" && (V = new (c(27)).TextureSlides()), V) {
                  V.groupName = se;
                  var ie = () => {
                    H.addZincObject(V), --this.toBeDownloaded, k != null && typeof k == "function" && k(V);
                  };
                  ++this.toBeDownloaded, V.load($, ie, q), V.setAnatomicalId(ce), V.setRenderOrder(oe);
                }
              }
            }, E = (H, Z, $, se, k) => () => {
              if (Z.readyState == 4 && Z.status == 200) {
                var W = JSON.parse(Z.responseText);
                T(H, Z.responseURL, W, $, se, k);
              }
            };
            this.loadTextureURL = (H, Z, $, se, k) => {
              var W = !!(k && k.isInline) && k.isInline;
              if (W) T(H, void 0, Z, $, se, k);
              else {
                var q = new XMLHttpRequest();
                q.onreadystatechange = E(H, q, $, se, k), q.open("GET", d(Z), !0), q.send();
              }
            }, this.loadGlyphsetURL = (H, Z, $, se, k, W) => {
              var q = !!(W && W.isInline) && W.isInline;
              if (q) R(H, Z, $, se, k, W);
              else {
                var ce = new XMLHttpRequest();
                ce.onreadystatechange = L(H, ce, $, se, k, W), ce.open("GET", d(Z), !0), ce.send();
              }
            };
            var C = (H, Z, $, se, k, W, q, ce, oe, V, O) => {
              var X = { colour: $, opacity: se, localTimeEnabled: k, localMorphColour: W }, Y = new (c(3)).Geometry();
              return Y.createMesh(Z, ce, X), Y.getMorph() ? (Y.setName(oe), Y.setRenderOrder(V), Y.setAnatomicalId(O), H && H.addZincObject(Y), Y.setDuration(v.getDuration()), Y.videoHandler && v.setVideoHandler(Y.videoHandler), Y) : void 0;
            }, P = (H, Z, $, se, k, W, q, ce, oe, V) => (O, X) => {
              var Y;
              X && X[0] && (Y = X[0]);
              var ie = C(H, O, Z, $, se, k, void 0, Y, W, ce, q);
              if (oe.lod && oe.lod.levels) for (var [fe, be] of Object.entries(oe.lod.levels)) ie.addLOD(w, fe, be.URL, be.Index, oe.lod.preload);
              --this.toBeDownloaded, O.dispose(), V != null && typeof V == "function" && V(ie);
            }, b = (H) => {
              var Z = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/, [, $, se, k, W, q, ce, oe] = H.match(Z);
              return { years: $, months: se, weeks: k, days: W, hours: q, mins: ce, secs: oe };
            };
            this.loadSettings = (H) => {
              if (H) {
                if (H.Duration) {
                  var Z = b(H.Duration);
                  v.setDurationFromObject(Z);
                }
                if (H.OriginalDuration) {
                  var $ = b(H.OriginalDuration);
                  v.setOriginalDurationFromObject($);
                }
                if (H.TimeStamps) for (var se in H.TimeStamps) {
                  var k = b(H.TimeStamps[se]);
                  v.addMetadataTimeStamp(se, k);
                }
              }
            };
            var I = (H, Z, $, se, k) => {
              if ($) {
                var W = void 0, q = !1;
                $.URL ? (W = $.URL, Z && (W = h(W, Z))) : $.Inline && (W = $.Inline.URL, q = !0);
                var ce = {};
                if ($.LOD && $.LOD.Levels) {
                  ce.preload = !!$.LOD.Preload, ce.levels = {};
                  for (var [oe, V] of Object.entries($.LOD.Levels)) ce.levels[oe] = {}, ce.levels[oe].URL = h(V.URL, Z), ce.levels[oe].Index = V.Index;
                }
                var O = $.GroupName;
                (O === void 0 || O === "") && (O = "_Unnamed");
                var X = { loaderOptions: { index: $.Index }, isInline: q, fileFormat: $.FileFormat, anatomicalId: $.AnatomicalId, compression: $.compression, tubeLines: $.tubeLines, lod: ce, renderOrder: se };
                switch ($.Type) {
                  case "Surfaces":
                    F(H, W, $.MorphVertices, $.MorphColours, O, k, X);
                    break;
                  case "Glyph":
                    var Y;
                    q ? Y = $.Inline.GlyphGeometriesURL : (Y = $.GlyphGeometriesURL, Y = h($.GlyphGeometriesURL, Z)), $.DisplayLabels && (X.displayLabels = !0), this.loadGlyphsetURL(H, W, Y, O, k, X);
                    break;
                  case "Points":
                    this.loadPointsetURL(H, W, $.MorphVertices, $.MorphColours, O, k, X);
                    break;
                  case "Lines":
                    this.loadLinesURL(H, W, $.MorphVertices, $.MorphColours, O, k, X);
                    break;
                  case "Texture":
                    this.loadTextureURL(H, W, O, k, X);
                    break;
                }
              }
            }, D = (H, Z, $) => {
              if (Z) {
                var se = void 0, k = !1;
                switch (Z.URL ? (se = Z.URL, H && (se = h(Z.URL, H))) : Z.Inline && (se = Z.Inline.URL, k = !0), Z.Type) {
                  case "View":
                    k ? (v.setupMultipleViews("default", { default: se }), m = !0, $ != null && typeof $ == "function" && $()) : this.loadViewURL(se, $);
                    break;
                  case "Settings":
                    this.loadSettings(Z);
                    break;
                }
              }
            };
            this.loadGLTF = (H, Z, $, se, k) => {
              var W = new (c(40)).GLTFToZincJSLoader();
              W.load(v, H, Z, $, se, k);
            };
            var N = (H, Z, $, se) => {
              if ($.Primitives && $.Primitives.forEach((ce) => {
                var oe = 1;
                ce.Order && (oe = ce.Order), I(H, Z, ce, oe, se);
              }), $.Transformation && H.setTransformation($.Transformation), $.Children) for (var [k, W] of Object.entries($.Children)) {
                var q = H.findOrCreateChildFromPath(k);
                q && N(q, Z, W, se);
              }
            }, U = (H, Z) => {
              var $, se, k = H, W = Z == null || ($ = Z.enabled) === null || $ === void 0 ? void 0 : $.include, q = Z == null || (se = Z.enabled) === null || se === void 0 ? void 0 : se.exclude, ce = Z == null ? void 0 : Z.tubeLines;
              return (W != null && W.length || q != null && q.length) && (W && (k = H.filter((oe) => {
                if (oe.Type === "View") return !0;
                for (var V = 0; V < W.length; V++) if (f(oe.RegionPath, oe.GroupName, W[V])) return !0;
                return !1;
              })), q && (k = k.filter((oe) => {
                if (oe.Type === "View") return !0;
                for (var V = 0; V < q.length; V++) if (f(oe.RegionPath, oe.GroupName, q[V])) return !1;
                return !0;
              }))), ce && k.forEach((oe) => {
                oe.Type === "Lines" && (oe.tubeLines = !0);
              }), k;
            }, B = (H, Z) => Array.isArray(H) ? U(H, Z) : H, G = (H, Z) => {
              if (Array.isArray(H)) {
                for (var $ = 0, se = 0; se < H.length; se++) H[se].Type && (Z && H[se].Type === "View" || H[se].Type === "Surfaces" || H[se].Type === "Glyph" || H[se].Type === "Points" || H[se].Type === "Lines" || H[se].Type === "Texture") && $++;
                return $;
              }
              return 0;
            }, J = (H) => {
              var Z = H.Primitives ? G(H.Primitives, !1) : 0;
              return H.Children && Object.values(H.Children).forEach(($) => {
                Z += J($);
              }), Z;
            }, j = (H) => Array.isArray(H) ? G(H, !0) : typeof H == "object" && H !== null && H.Version === "2.0" ? J(H.Regions) : void 0, te = (H, Z, $, se, k) => {
              var W = H;
              $.RegionPath && $.RegionPath !== "" && (W = H.findOrCreateChildFromPath($.RegionPath)), I(W, Z, $, 2 * se, k);
            }, ee = (H, Z, $, se, k, W) => {
              for (var q = B(Z, W), ce = j(q), oe = new S(ce, se, k), V = 0; V < Z.length; V++) D($, q[V], oe);
              for (var O = 0; O < Z.length; O++) te(H, $, q[O], O, oe);
            }, ae = (H, Z, $, se, k) => {
              var W = j(Z), q = new S(W, se, k);
              Z.Settings && this.loadSettings(Z.Settings), Z.Views && A($, Z.Views), Z.Regions && N(H, $, Z.Regions, q);
            };
            this.loadMetadataURL = (H, Z, $, se, k) => {
              var W = new XMLHttpRequest(), q = d(Z);
              W.onreadystatechange = () => {
                if (W.readyState == 4 && W.status == 200) {
                  v.resetMetadata(), v.resetDuration(), m = !1;
                  var ce = W.responseURL;
                  ce === void 0 && (ce = new URL(q).href);
                  var oe = JSON.parse(W.responseText);
                  Array.isArray(oe) ? ee(H, oe, ce, $, se, k) : typeof oe == "object" && oe !== null && oe.Version == "2.0" && ae(H, oe, ce, $, se);
                }
              }, W.open("GET", q, !0), W.send();
            };
          };
        },
        /* 36 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            STLLoader: () => (
              /* binding */
              d
            )
            /* harmony export */
          });
          var l = c(4);
          class d extends l.Loader {
            constructor(f) {
              super(f);
            }
            load(f, g, p, u) {
              var y = this, v = new l.FileLoader(this.manager);
              v.setPath(this.path), v.setResponseType("arraybuffer"), v.setRequestHeader(this.requestHeader), v.setWithCredentials(this.withCredentials), v.load(f, function(m) {
                try {
                  g(y.parse(m));
                } catch (x) {
                  u ? u(x) : console.error(x), y.manager.itemError(f);
                }
              }, p, u);
            }
            parse(f) {
              function g(u, y, v) {
                for (var m = 0, x = u.length; m < x; m++) if (u[m] !== y.getUint8(v + m, !1)) return !1;
                return !0;
              }
              var p = function(u) {
                if (typeof u == "string") {
                  for (var y = new Uint8Array(u.length), v = 0; v < u.length; v++) y[v] = 255 & u.charCodeAt(v);
                  return y.buffer || y;
                }
                return u;
              }(f);
              return function(u) {
                var y = new DataView(u), v = y.getUint32(80, !0);
                if (84 + v * 50 === y.byteLength) return !0;
                for (var m = [115, 111, 108, 105, 100], x = 0; 5 > x; x++)
                  if (g(m, y, x)) return !1;
                return !0;
              }(p) ? function(u) {
                for (var y, v, m, x, w, A, M, R, L = new DataView(u), _ = L.getUint32(80, !0), F = !1, S = 0; S < 70; S++) L.getUint32(S, !1) == 1129270351 && L.getUint8(S + 4) == 82 && L.getUint8(S + 5) == 61 && (F = !0, x = new Float32Array(3 * (3 * _)), w = L.getUint8(S + 6) / 255, A = L.getUint8(S + 7) / 255, M = L.getUint8(S + 8) / 255, R = L.getUint8(S + 9) / 255);
                for (var T = new l.BufferGeometry(), E = new Float32Array(3 * (3 * _)), C = new Float32Array(3 * (3 * _)), P = 0; P < _; P++) {
                  var b = 84 + P * 50, I = L.getFloat32(b, !0), D = L.getFloat32(b + 4, !0), N = L.getFloat32(b + 8, !0);
                  if (F) {
                    var U = L.getUint16(b + 48, !0);
                    32768 & U ? (y = w, v = A, m = M) : (y = (31 & U) / 31, v = (31 & U >> 5) / 31, m = (31 & U >> 10) / 31);
                  }
                  for (var B = 1; 3 >= B; B++) {
                    var G = b + 12 * B, J = 3 * (3 * P) + 3 * (B - 1);
                    E[J] = L.getFloat32(G, !0), E[J + 1] = L.getFloat32(G + 4, !0), E[J + 2] = L.getFloat32(G + 8, !0), C[J] = I, C[J + 1] = D, C[J + 2] = N, F && (x[J] = y, x[J + 1] = v, x[J + 2] = m);
                  }
                }
                return T.setAttribute("position", new l.BufferAttribute(E, 3)), T.setAttribute("normal", new l.BufferAttribute(C, 3)), F && (T.setAttribute("color", new l.BufferAttribute(x, 3)), T.hasColors = !0, T.alpha = R), T;
              }(p) : function(u) {
                for (var y, v = new l.BufferGeometry(), m = /solid([\s\S]*?)endsolid/g, x = /facet([\s\S]*?)endfacet/g, w = 0, A = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, M = new RegExp("vertex" + A + A + A, "g"), R = new RegExp("normal" + A + A + A, "g"), L = [], _ = [], F = new l.Vector3(), S = 0, T = 0, E = 0; (y = m.exec(u)) !== null; ) {
                  T = E;
                  for (var C = y[0]; (y = x.exec(C)) !== null; ) {
                    for (var P = 0, b = 0, I = y[0]; (y = R.exec(I)) !== null; ) F.x = parseFloat(y[1]), F.y = parseFloat(y[2]), F.z = parseFloat(y[3]), b++;
                    for (; (y = M.exec(I)) !== null; ) L.push(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])), _.push(F.x, F.y, F.z), P++, E++;
                    b !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + w), P !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + w), w++;
                  }
                  var D = T, N = E - T;
                  v.addGroup(D, N, S), S++;
                }
                return v.setAttribute("position", new l.Float32BufferAttribute(L, 3)), v.setAttribute("normal", new l.Float32BufferAttribute(_, 3)), v;
              }(function(u) {
                return typeof u == "string" ? u : l.LoaderUtils.decodeText(new Uint8Array(u));
              }(f));
            }
          }
        },
        /* 37 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            OBJLoader: () => (
              /* binding */
              w
            )
            /* harmony export */
          });
          var l = c(4), d = /^[og]\s*(.+)?/, h = /^mtllib /, f = /^usemtl /, g = /^usemap /, p = new l.Vector3(), u = new l.Vector3(), y = new l.Vector3(), v = new l.Vector3(), m = new l.Vector3();
          function x() {
            var A = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(R, L) {
              if (this.object && this.object.fromDeclaration === !1) return this.object.name = R, void (this.object.fromDeclaration = L !== !1);
              var _ = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
              if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = { name: R || "", fromDeclaration: L !== !1, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: !1 }, materials: [], smooth: !0, startMaterial: function(T, E) {
                var C = this._finalize(!1);
                C && (C.inherited || 0 >= C.groupCount) && this.materials.splice(C.index, 1);
                var P = { index: this.materials.length, name: T || "", mtllib: Array.isArray(E) && 0 < E.length ? E[E.length - 1] : "", smooth: C === void 0 ? this.smooth : C.smooth, groupStart: C === void 0 ? 0 : C.groupEnd, groupEnd: -1, groupCount: -1, inherited: !1, clone: function(I) {
                  var D = { index: typeof I == "number" ? I : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: !1 };
                  return D.clone = this.clone.bind(D), D;
                } };
                return this.materials.push(P), P;
              }, currentMaterial: function() {
                return 0 < this.materials.length ? this.materials[this.materials.length - 1] : void 0;
              }, _finalize: function(T) {
                var E = this.currentMaterial();
                if (E && E.groupEnd === -1 && (E.groupEnd = this.geometry.vertices.length / 3, E.groupCount = E.groupEnd - E.groupStart, E.inherited = !1), T && 1 < this.materials.length) for (var C = this.materials.length - 1; 0 <= C; C--) 0 >= this.materials[C].groupCount && this.materials.splice(C, 1);
                return T && this.materials.length === 0 && this.materials.push({ name: "", smooth: this.smooth }), E;
              } }, _ && _.name && typeof _.clone == "function") {
                var F = _.clone(0);
                F.inherited = !0, this.object.materials.push(F);
              }
              this.objects.push(this.object);
            }, finalize: function() {
              this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
            }, parseVertexIndex: function(R, L) {
              var _ = parseInt(R, 10);
              return 3 * (0 <= _ ? _ - 1 : _ + L / 3);
            }, parseNormalIndex: function(R, L) {
              var _ = parseInt(R, 10);
              return 3 * (0 <= _ ? _ - 1 : _ + L / 3);
            }, parseUVIndex: function(R, L) {
              var _ = parseInt(R, 10);
              return 2 * (0 <= _ ? _ - 1 : _ + L / 2);
            }, addVertex: function(R, L, _) {
              var F = this.vertices, S = this.object.geometry.vertices;
              S.push(F[R + 0], F[R + 1], F[R + 2]), S.push(F[L + 0], F[L + 1], F[L + 2]), S.push(F[_ + 0], F[_ + 1], F[_ + 2]);
            }, addVertexPoint: function(R) {
              var L = this.vertices, _ = this.object.geometry.vertices;
              _.push(L[R + 0], L[R + 1], L[R + 2]);
            }, addVertexLine: function(R) {
              var L = this.vertices, _ = this.object.geometry.vertices;
              _.push(L[R + 0], L[R + 1], L[R + 2]);
            }, addNormal: function(R, L, _) {
              var F = this.normals, S = this.object.geometry.normals;
              S.push(F[R + 0], F[R + 1], F[R + 2]), S.push(F[L + 0], F[L + 1], F[L + 2]), S.push(F[_ + 0], F[_ + 1], F[_ + 2]);
            }, addFaceNormal: function(R, L, _) {
              var F = this.vertices, S = this.object.geometry.normals;
              p.fromArray(F, R), u.fromArray(F, L), y.fromArray(F, _), m.subVectors(y, u), v.subVectors(p, u), m.cross(v), m.normalize(), S.push(m.x, m.y, m.z), S.push(m.x, m.y, m.z), S.push(m.x, m.y, m.z);
            }, addColor: function(R, L, _) {
              var F = this.colors, S = this.object.geometry.colors;
              F[R] !== void 0 && S.push(F[R + 0], F[R + 1], F[R + 2]), F[L] !== void 0 && S.push(F[L + 0], F[L + 1], F[L + 2]), F[_] !== void 0 && S.push(F[_ + 0], F[_ + 1], F[_ + 2]);
            }, addUV: function(R, L, _) {
              var F = this.uvs, S = this.object.geometry.uvs;
              S.push(F[R + 0], F[R + 1]), S.push(F[L + 0], F[L + 1]), S.push(F[_ + 0], F[_ + 1]);
            }, addDefaultUV: function() {
              var R = this.object.geometry.uvs;
              R.push(0, 0), R.push(0, 0), R.push(0, 0);
            }, addUVLine: function(R) {
              var L = this.uvs, _ = this.object.geometry.uvs;
              _.push(L[R + 0], L[R + 1]);
            }, addFace: function(R, L, _, F, S, T, E, C, P) {
              var b = this.vertices.length, I = this.parseVertexIndex(R, b), D = this.parseVertexIndex(L, b), N = this.parseVertexIndex(_, b);
              if (this.addVertex(I, D, N), this.addColor(I, D, N), E !== void 0 && E !== "") {
                var U = this.normals.length;
                I = this.parseNormalIndex(E, U), D = this.parseNormalIndex(C, U), N = this.parseNormalIndex(P, U), this.addNormal(I, D, N);
              } else this.addFaceNormal(I, D, N);
              if (F !== void 0 && F !== "") {
                var B = this.uvs.length;
                I = this.parseUVIndex(F, B), D = this.parseUVIndex(S, B), N = this.parseUVIndex(T, B), this.addUV(I, D, N), this.object.geometry.hasUVIndices = !0;
              } else
                this.addDefaultUV();
            }, addPointGeometry: function(R) {
              this.object.geometry.type = "Points";
              for (var L, _ = this.vertices.length, F = 0, S = R.length; F < S; F++) L = this.parseVertexIndex(R[F], _), this.addVertexPoint(L), this.addColor(L);
            }, addLineGeometry: function(R, L) {
              this.object.geometry.type = "Line";
              for (var _ = this.vertices.length, F = this.uvs.length, S = 0, T = R.length; S < T; S++) this.addVertexLine(this.parseVertexIndex(R[S], _));
              for (var E = 0, C = L.length; E < C; E++) this.addUVLine(this.parseUVIndex(L[E], F));
            } };
            return A.startObject("", !1), A;
          }
          class w extends l.Loader {
            constructor(M) {
              super(M), this.materials = null;
            }
            load(M, R, L, _) {
              var F = this, S = new l.FileLoader(this.manager);
              S.setPath(this.path), S.setRequestHeader(this.requestHeader), S.setWithCredentials(this.withCredentials), S.load(M, function(T) {
                try {
                  R(F.parse(T));
                } catch (E) {
                  _ ? _(E) : console.error(E), F.manager.itemError(M);
                }
              }, L, _);
            }
            setMaterials(M) {
              return this.materials = M, this;
            }
            parse(M) {
              var R = new x();
              M.indexOf(`\r
`) !== -1 && (M = M.replace(/\r\n/g, `
`)), M.indexOf(`\\
`) !== -1 && (M = M.replace(/\\\n/g, ""));
              for (var L = M.split(`
`), _ = "", F = "", S = 0, T = [], E = typeof "".trimLeft == "function", C = 0, P = L.length; C < P; C++) if (_ = L[C], _ = E ? _.trimLeft() : _.trim(), S = _.length, S !== 0 && (F = _.charAt(0), F !== "#"))
                if (F === "v") {
                  var b = _.split(/\s+/);
                  switch (b[0]) {
                    case "v":
                      R.vertices.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])), 7 <= b.length ? R.colors.push(parseFloat(b[4]), parseFloat(b[5]), parseFloat(b[6])) : R.colors.push(void 0, void 0, void 0);
                      break;
                    case "vn":
                      R.normals.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3]));
                      break;
                    case "vt":
                      R.uvs.push(parseFloat(b[1]), parseFloat(b[2]));
                  }
                } else if (F === "f") {
                  for (var I, D = _.substr(1).trim(), N = D.split(/\s+/), U = [], B = 0, G = N.length; B < G; B++) if (I = N[B], 0 < I.length) {
                    var J = I.split("/");
                    U.push(J);
                  }
                  for (var j = U[0], te = 1, ee = U.length - 1; te < ee; te++) {
                    var ae = U[te], H = U[te + 1];
                    R.addFace(j[0], ae[0], H[0], j[1], ae[1], H[1], j[2], ae[2], H[2]);
                  }
                } else if (F === "l") {
                  var Z = _.substring(1).trim().split(" "), $ = [], se = [];
                  if (_.indexOf("/") === -1) $ = Z;
                  else for (var k, W = 0, q = Z.length; W < q; W++) k = Z[W].split("/"), k[0] !== "" && $.push(k[0]), k[1] !== "" && se.push(k[1]);
                  R.addLineGeometry($, se);
                } else if (F === "p") {
                  var ce = _.substr(1).trim(), oe = ce.split(" ");
                  R.addPointGeometry(oe);
                } else if ((T = d.exec(_)) !== null) {
                  var V = (" " + T[0].substr(1).trim()).substr(1);
                  R.startObject(V);
                } else if (f.test(_))
                  R.object.startMaterial(_.substring(7).trim(), R.materialLibraries);
                else if (h.test(_))
                  R.materialLibraries.push(_.substring(7).trim());
                else if (g.test(_))
                  console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
                else if (F === "s") {
                  if (T = _.split(" "), 1 < T.length) {
                    var O = T[1].trim().toLowerCase();
                    R.object.smooth = O !== "0" && O !== "off";
                  } else
                    R.object.smooth = !0;
                  var X = R.object.currentMaterial();
                  X && (X.smooth = R.object.smooth);
                } else {
                  if (_ === "\0") continue;
                  console.warn('THREE.OBJLoader: Unexpected line: "' + _ + '"');
                }
              R.finalize();
              var Y = new l.Group();
              Y.materialLibraries = [].concat(R.materialLibraries);
              var ie = R.objects.length !== 1 || R.objects[0].geometry.vertices.length !== 0;
              if (ie == !0) for (var fe = 0, be = R.objects.length; fe < be; fe++) {
                var Ae = R.objects[fe], he = Ae.geometry, xe = Ae.materials, re = he.type === "Line", me = he.type === "Points", Me = !1;
                if (he.vertices.length !== 0) {
                  var De = new l.BufferGeometry();
                  De.setAttribute("position", new l.Float32BufferAttribute(he.vertices, 3)), 0 < he.normals.length && De.setAttribute("normal", new l.Float32BufferAttribute(he.normals, 3)), 0 < he.colors.length && (Me = !0, De.setAttribute("color", new l.Float32BufferAttribute(he.colors, 3))), he.hasUVIndices === !0 && De.setAttribute("uv", new l.Float32BufferAttribute(he.uvs, 2));
                  for (var Ie = [], $e = 0, lt = xe.length; $e < lt; $e++) {
                    var qe = xe[$e], Mt = qe.name + "_" + qe.smooth + "_" + Me, Be = R.materials[Mt];
                    if (this.materials !== null) {
                      if (Be = this.materials.create(qe.name), re && Be && !(Be instanceof l.LineBasicMaterial)) {
                        var it = new l.LineBasicMaterial();
                        l.Material.prototype.copy.call(it, Be), it.color.copy(Be.color), Be = it;
                      } else if (me && Be && !(Be instanceof l.PointsMaterial)) {
                        var tt = new l.PointsMaterial({ size: 10, sizeAttenuation: !1 });
                        l.Material.prototype.copy.call(tt, Be), tt.color.copy(Be.color), tt.map = Be.map, Be = tt;
                      }
                    }
                    Be === void 0 && (Be = re ? new l.LineBasicMaterial() : me ? new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }) : new l.MeshPhongMaterial(), Be.name = qe.name, Be.flatShading = !qe.smooth, Be.vertexColors = Me, R.materials[Mt] = Be), Ie.push(Be);
                  }
                  var qt = void 0;
                  if (1 < Ie.length) {
                    for (var Qt, Pt = 0, Nt = xe.length; Pt < Nt; Pt++) Qt = xe[Pt], De.addGroup(Qt.groupStart, Qt.groupCount, Pt);
                    qt = re ? new l.LineSegments(De, Ie) : me ? new l.Points(De, Ie) : new l.Mesh(De, Ie);
                  } else qt = re ? new l.LineSegments(De, Ie[0]) : me ? new l.Points(De, Ie[0]) : new l.Mesh(De, Ie[0]);
                  qt.name = Ae.name, Y.add(qt);
                }
              }
              else if (0 < R.vertices.length) {
                var Vi = new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }), Gi = new l.BufferGeometry();
                Gi.setAttribute("position", new l.Float32BufferAttribute(R.vertices, 3)), 0 < R.colors.length && R.colors[0] !== void 0 && (Gi.setAttribute("color", new l.Float32BufferAttribute(R.colors, 3)), Vi.vertexColors = !0);
                var ni = new l.Points(Gi, Vi);
                Y.add(ni);
              }
              return Y;
            }
          }
        },
        /* 38 */
        /***/
        (o, a, c) => {
          function l(w, A) {
            var M = Object.keys(w);
            if (Object.getOwnPropertySymbols) {
              var R = Object.getOwnPropertySymbols(w);
              A && (R = R.filter(function(L) {
                return Object.getOwnPropertyDescriptor(w, L).enumerable;
              })), M.push.apply(M, R);
            }
            return M;
          }
          function d(w) {
            for (var A, M = 1; M < arguments.length; M++) A = arguments[M] == null ? {} : arguments[M], M % 2 ? l(Object(A), !0).forEach(function(R) {
              h(w, R, A[R]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(w, Object.getOwnPropertyDescriptors(A)) : l(Object(A)).forEach(function(R) {
              Object.defineProperty(w, R, Object.getOwnPropertyDescriptor(A, R));
            });
            return w;
          }
          function h(w, A, M) {
            return (A = f(A)) in w ? Object.defineProperty(w, A, { value: M, enumerable: !0, configurable: !0, writable: !0 }) : w[A] = M, w;
          }
          function f(w) {
            var A = g(w, "string");
            return typeof A == "symbol" ? A : A + "";
          }
          function g(w, A) {
            if (typeof w != "object" || !w) return w;
            var M = w[Symbol.toPrimitive];
            if (M !== void 0) {
              var R = M.call(w, A || "default");
              if (typeof R != "object") return R;
              throw new TypeError("@@toPrimitive must return a primitive value.");
            }
            return (A === "string" ? String : Number)(w);
          }
          var p = c(19).JSONLoader, u = c(4), y = u.FileLoader, v = (w) => {
            var A = (R, L) => {
              R.merge(L);
            };
            if (w && 0 < w.length) {
              for (; 1 < w.length; ) {
                var M = w.splice(1, 1);
                A(w[0], M[0]);
              }
              return w[0];
            }
          }, m = function(A, M, R) {
            var L = new y(), _ = new p();
            L.crossOrigin = M;
            var F = A, S = R, T = void 0, E = !1, C = !1, P = void 0, b = [], I = (B) => {
              var G = T[B.index];
              if (G) {
                var J = _.parse(G);
                B.onLoad(J.geometry, J.materials);
              } else D(B);
            }, D = (B) => {
              B.onError && (!P && (P = { responseURL: F }), B.onError(P));
            };
            this.downloadCompleted = (B) => {
              try {
                T = JSON.parse(B[0]), E = !1, C = !0, Array.isArray(T) ? b.forEach((G) => I(G)) : b.forEach((G) => D(G));
              } catch {
                b.forEach((J) => D(J));
              }
            };
            var N = () => (B) => {
              P = B, C = !0, E = !1, b.forEach((G) => {
                D(G);
              });
            }, U = () => (B) => {
              b.forEach((G) => {
                G.onProgress && G.onProgress(B);
              });
            };
            this.load = (B, G, J, j) => {
              var te = { index: B, onLoad: G, onProgress: J, onError: j };
              C ? T ? I(te) : D(P) : E ? b.push(te) : (b.push(te), E = !0, L.load(F, S, U, N));
            };
          }, x = function(A, M) {
            var R = [], L = A, _ = M, F = 0;
            this.itemDownloaded = (S, T) => {
              if (R[S] = T, F++, F == L) {
                for (var E = R[0][1], C = R.map((I) => I[0]), P = v(C), b = 1; b < L; b++) R[S][0].dispose(), R[S][1].forEach((I) => I.dispose());
                _(P, E);
              }
            };
          };
          a.PrimitivesLoader = function() {
            var w = 0, A = 20;
            this.crossOrigin = "Anonymous";
            var M = new p(), R = [], L = {}, _ = (E, C, P, b, I) => {
              var D = E.length, N = new x(D, C), U = 0;
              E.forEach((B) => {
                var G = I ? d({}, I) : {};
                G.msHandler = N, G.order = U, U++, S(B, C, P, b, G);
              });
            }, F = (E, C, P, b, I) => {
              var D = I ? d({}, I) : {}, N = L[E];
              if (!N) if (A > w) {
                var U = new T(void 0, this, D);
                ++w, N = new m(E, this.crossOrigin, U), L[E] = N;
              } else R.push({ url: E, onLoad: C, onProgress: P, onError: b, options: I });
              N && (D.isHandler = N, N.load(I.index, C, P, b));
            }, S = (E, C, P, b, I) => {
              if (I && I.index !== void 0) F(E, C, P, b, I);
              else if (A > w) {
                ++w;
                var D = new T(C, this, I), N = new T(b, this, I);
                M.crossOrigin = this.crossOrigin, M.load(E, D, P, N);
              } else R.push({ url: E, onLoad: C, onProgress: P, onError: b, options: I });
            };
            this.load = (E, C, P, b, I) => {
              Array.isArray(E) ? _(E, C, P, b, I) : S(E, C, P, b, I);
            }, this.loadFromWaitingList = () => {
              for (; A > w; ) {
                var E = R.shift();
                if (E) this.load(E.url, E.onLoad, E.onProgress, E.onError, E.options);
                else return;
              }
            }, this.itemRemainingCheck = () => {
              if (R.length === 0 && w == 0) for (var E in L) L.hasOwnProperty(E) && delete L[E];
            };
            var T = function(C, P, b) {
              return function() {
                --w;
                for (var I = arguments.length, D = Array(I), N = 0; N < I; N++) D[N] = arguments[N];
                b != null && b.msHandler ? b.msHandler.itemDownloaded(b.order, D) : b != null && b.isHandler ? b.isHandler.downloadCompleted(D) : C && C(...D), P.loadFromWaitingList(), P.itemRemainingCheck();
              };
            };
            this.parse = (E) => M.parse(E);
          };
        },
        /* 39 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).mergeGeometries, h = function() {
            c(10).ZincObject.call(this), this.isTubeLines = !0;
            var f = {}, g = { radius: 1, radialSegments: 8, smooth: !1 };
            this.createLineSegment = (u, y, v) => {
              if (u && y) {
                f = { geometryIn: u, materialIn: y, options: v };
                var m = p(u.vertices), x = new l.MeshStandardMaterial({ color: y.color }), w = new l.Mesh(m, x);
                this.setMesh(w, v.localTimeEnabled, v.localMorphColour);
              }
            }, this.setWidth = (u) => {
              this.morph && this.morph.material && (this.morph.material.linewidth = u, this.morph.material.needsUpdate = !0);
            }, this.setAlpha = function(u) {
              var y = this.getMorph();
              y.material.opacity = u, y.material.transparent = 1 > u, y.material.depthWrite = 0.5 < u;
            }, this.setWireframe = (u) => {
              var y = this.getMorph();
              y.material.wireframe = u;
            }, this.setTubeLines = (u, y) => {
              if (u && y) {
                var { geometryIn: v } = f, m = this.getMorph();
                m.geometry.dispose(), g = Object.assign(g, { radius: u, radialSegments: y }), m.geometry = p(v.vertices);
              }
            };
            var p = (u) => {
              var y, { radius: v, radialSegments: m, smooth: x } = g;
              if (x) {
                var w = new l.CatmullRomCurve3(u);
                y = new l.TubeGeometry(w, u.length, v, m, !1);
              } else {
                for (var A = [], M = 0; M + 1 < u.length; M += 2) {
                  var R = new l.LineCurve3(u[M], u[M + 1]), L = new l.TubeGeometry(R, 1, v, m, !1);
                  A.push(L);
                }
                y = d(A, !0), A.forEach((_) => _.dispose());
              }
              return y;
            };
          };
          h.prototype = Object.create(c(10).ZincObject.prototype), a.TubeLines = h;
        },
        /* 40 */
        /***/
        (o, a, c) => {
          c(4);
          var l = c(41).GLTFLoader, d = function() {
            var h = this;
            this.parseGLTFObjects = (f, g, p, u) => {
              var y = g;
              if (p !== 0) {
                if (f.type !== "Object3D") {
                  var v;
                  if (f.type === "Mesh" ? v = new (c(3)).Geometry() : f.type === "LineSegments" ? v = new (c(24)).Lines() : f.type === "Points" && (v = new (c(22)).Pointset()), v) {
                    var m = !1, x = !1;
                    f.geometry && f.geometry.morphAttributes && (m = !!f.geometry.morphAttributes.position, x = !!f.geometry.morphAttributes.color), v.setMesh(f.clone(), m, x);
                    var w = v.getMorph();
                    v.groupName = w.name, w.matrixAutoUpdate = !0, g.addZincObject(v), u != null && typeof u == "function" && u(v);
                  }
                } else if (f.name !== "" && (g && (y = g.findOrCreateChildFromPath(f.name)), y)) {
                  var A = y.getGroup();
                  A.position.copy(f.position), A.rotation.copy(f.rotation), A.quaternion.copy(f.quaternion), A.matrixAutoUpdate = !0;
                }
              }
              p++, f.children.forEach((M) => {
                h.parseGLTFObjects(M, y, p, u);
              });
            }, this.setCamera = (f) => {
              f.viewAll();
              var g = f.getZincCameraControls(), p = g.getCurrentViewport();
              g.addViewport("default", p), g.setDefaultViewport("default");
            }, this.load = (f, g, p, u, y) => {
              var v = p.substring(0, p.lastIndexOf("/") + 1), m = p.substring(p.lastIndexOf("/") + 1, p.length), x = new l().setPath(v);
              x.load(m, function(w) {
                console.log(w), h.parseGLTFObjects(w.scene, g, 0, u), h.setCamera(f), y != null && typeof y == "function" && y();
              });
            };
          };
          a.GLTFToZincJSLoader = d;
        },
        /* 41 */
        /***/
        (o) => {
          o.exports = T4;
        },
        /* 42 */
        /***/
        (o, a, c) => {
          var l = c(43).GLTFExporter, d = function(h) {
            var f = h;
            this.exportGLTF = (g) => {
              var p = f.getRootRegion(), u = p.getAllObjects(!0), y = [];
              u.forEach((x) => {
                x.animationClip && y.push({ clip: x.animationClip[0], mesh: x.getMorph() });
              });
              var v = new l(), m = { binary: g, animations: y };
              return new Promise((x) => {
                v.parse(f.getThreeJSScene(), function(w) {
                  x(w);
                }, m);
              });
            };
          };
          a.SceneExporter = d;
        },
        /* 43 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            GLTFExporter: () => (
              /* binding */
              d
            )
            /* harmony export */
          });
          var l = c(4);
          class d {
            constructor() {
              this.pluginCallbacks = [], this.register(function(b) {
                return new T(b);
              }), this.register(function(b) {
                return new E(b);
              }), this.register(function(b) {
                return new C(b);
              });
            }
            register(b) {
              return this.pluginCallbacks.indexOf(b) === -1 && this.pluginCallbacks.push(b), this;
            }
            unregister(b) {
              return this.pluginCallbacks.indexOf(b) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(b), 1), this;
            }
            /**
            * Parse scenes and generate GLTF output
            * @param  {Scene or [THREE.Scenes]} input   Scene or Array of THREE.Scenes
            * @param  {Function} onDone  Callback on completed
            * @param  {Object} options options
            */
            parse(b, I, D) {
              for (var N = new S(), U = [], B = 0, G = this.pluginCallbacks.length; B < G; B++) U.push(this.pluginCallbacks[B](N));
              N.setPlugins(U), N.write(b, I, D);
            }
          }
          var h = { POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123, FLOAT: 5126, UNSIGNED_INT: 5125, ARRAY_BUFFER: 34962, ELEMENT_ARRAY_BUFFER: 34963, NEAREST: 9728, LINEAR: 9729, NEAREST_MIPMAP_NEAREST: 9984, LINEAR_MIPMAP_NEAREST: 9985, NEAREST_MIPMAP_LINEAR: 9986, LINEAR_MIPMAP_LINEAR: 9987, CLAMP_TO_EDGE: 33071, MIRRORED_REPEAT: 33648, REPEAT: 10497 }, f = {};
          f[l.NearestFilter] = h.NEAREST, f[l.NearestMipmapNearestFilter] = h.NEAREST_MIPMAP_NEAREST, f[l.NearestMipmapLinearFilter] = h.NEAREST_MIPMAP_LINEAR, f[l.LinearFilter] = h.LINEAR, f[l.LinearMipmapNearestFilter] = h.LINEAR_MIPMAP_NEAREST, f[l.LinearMipmapLinearFilter] = h.LINEAR_MIPMAP_LINEAR, f[l.ClampToEdgeWrapping] = h.CLAMP_TO_EDGE, f[l.RepeatWrapping] = h.REPEAT, f[l.MirroredRepeatWrapping] = h.MIRRORED_REPEAT;
          var g = { scale: "scale", position: "translation", quaternion: "rotation", morphTargetInfluences: "weights" }, p = 12, u = 1179937895, y = 2, v = 8, m = 1313821514, x = 5130562;
          function w(P, b) {
            return P.length === b.length && P.every(function(I, D) {
              return I === b[D];
            });
          }
          function A(P) {
            if (window.TextEncoder !== void 0) return new TextEncoder().encode(P).buffer;
            for (var b, I = new Uint8Array(new ArrayBuffer(P.length)), D = 0, N = P.length; D < N; D++)
              b = P.charCodeAt(D), I[D] = 255 < b ? 32 : b;
            return I.buffer;
          }
          function M(P) {
            return w(P.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
          }
          function R(P, b, I) {
            for (var D = { min: Array(P.itemSize).fill(Number.POSITIVE_INFINITY), max: Array(P.itemSize).fill(Number.NEGATIVE_INFINITY) }, N = b; N < b + I; N++) for (var U, B = 0; B < P.itemSize; B++) U = void 0, 4 < P.itemSize ? U = P.array[N * P.itemSize + B] : B === 0 ? U = P.getX(N) : B === 1 ? U = P.getY(N) : B === 2 ? U = P.getZ(N) : B == 3 && (U = P.getW(N)), D.min[B] = Math.min(D.min[B], U), D.max[B] = Math.max(D.max[B], U);
            return D;
          }
          function L(P) {
            return 4 * Math.ceil(P / 4);
          }
          function _(P) {
            var b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 0, I = L(P.byteLength);
            if (I !== P.byteLength) {
              var D = new Uint8Array(I);
              if (D.set(new Uint8Array(P)), b !== 0) for (var N = P.byteLength; N < I; N++) D[N] = b;
              return D.buffer;
            }
            return P;
          }
          var F = null;
          class S {
            constructor() {
              this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = { asset: { version: "2.0", generator: "THREE.GLTFExporter" } }, this.cache = { meshes: /* @__PURE__ */ new Map(), attributes: /* @__PURE__ */ new Map(), attributesNormalized: /* @__PURE__ */ new Map(), materials: /* @__PURE__ */ new Map(), textures: /* @__PURE__ */ new Map(), images: /* @__PURE__ */ new Map() };
            }
            setPlugins(b) {
              this.plugins = b;
            }
            /**
            * Parse scenes and generate GLTF output
            * @param  {Scene or [THREE.Scenes]} input   Scene or Array of THREE.Scenes
            * @param  {Function} onDone  Callback on completed
            * @param  {Object} options options
            */
            write(b, I, D) {
              this.options = Object.assign({}, {
                // default options
                binary: !1,
                trs: !1,
                onlyVisible: !0,
                truncateDrawRange: !0,
                embedImages: !0,
                maxTextureSize: 1 / 0,
                animations: [],
                includeCustomExtensions: !1
              }, D), 0 < this.options.animations.length && (this.options.trs = !0), this.processInput(b);
              var N = this;
              Promise.all(this.pending).then(function() {
                var U = N.buffers, B = N.json, G = N.options, J = N.extensionsUsed, j = new Blob(U, { type: "application/octet-stream" }), te = Object.keys(J);
                if (0 < te.length && (B.extensionsUsed = te), B.buffers && 0 < B.buffers.length && (B.buffers[0].byteLength = j.size), G.binary === !0) {
                  var ee = new window.FileReader();
                  ee.readAsArrayBuffer(j), ee.onloadend = function() {
                    var H = _(ee.result), Z = new DataView(new ArrayBuffer(v));
                    Z.setUint32(0, H.byteLength, !0), Z.setUint32(4, x, !0);
                    var $ = _(A(JSON.stringify(B)), 32), se = new DataView(new ArrayBuffer(v));
                    se.setUint32(0, $.byteLength, !0), se.setUint32(4, m, !0);
                    var k = new ArrayBuffer(p), W = new DataView(k);
                    W.setUint32(0, u, !0), W.setUint32(4, y, !0);
                    var q = p + se.byteLength + $.byteLength + Z.byteLength + H.byteLength;
                    W.setUint32(8, q, !0);
                    var ce = new Blob([k, se, $, Z, H], { type: "application/octet-stream" }), oe = new window.FileReader();
                    oe.readAsArrayBuffer(ce), oe.onloadend = function() {
                      I(oe.result);
                    };
                  };
                } else if (B.buffers && 0 < B.buffers.length) {
                  var ae = new window.FileReader();
                  ae.readAsDataURL(j), ae.onloadend = function() {
                    var H = ae.result;
                    B.buffers[0].uri = H, I(B);
                  };
                } else I(B);
              });
            }
            /**
            * Serializes a userData.
            *
            * @param {THREE.Object3D|THREE.Material} object
            * @param {Object} objectDef
            */
            serializeUserData(b, I) {
              if (!(b.userData && b.userData.isZincObject) && Object.keys(b.userData).length !== 0) {
                var D = this.options, N = this.extensionsUsed;
                try {
                  var U = JSON.parse(JSON.stringify(b.userData));
                  if (D.includeCustomExtensions && U.gltfExtensions) {
                    for (var B in I.extensions === void 0 && (I.extensions = {}), U.gltfExtensions) I.extensions[B] = U.gltfExtensions[B], N[B] = !0;
                    delete U.gltfExtensions;
                  }
                  0 < Object.keys(U).length && (I.extras = U);
                } catch (G) {
                  console.warn("THREE.GLTFExporter: userData of '" + b.name + "' won't be serialized because of JSON.stringify error - " + G.message);
                }
              }
            }
            /**
            * Assign and return a temporal unique id for an object
            * especially which doesn't have .uuid
            * @param  {Object} object
            * @return {Integer}
            */
            getUID(b) {
              return this.uids.has(b) || this.uids.set(b, this.uid++), this.uids.get(b);
            }
            /**
            * Checks if normal attribute values are normalized.
            *
            * @param {BufferAttribute} normal
            * @returns {Boolean}
            */
            isNormalizedNormalAttribute(b) {
              var I = this.cache;
              if (I.attributesNormalized.has(b)) return !1;
              for (var D = new l.Vector3(), N = 0, U = b.count; N < U; N++)
                if (5e-4 < Math.abs(D.fromBufferAttribute(b, N).length() - 1)) return !1;
              return !0;
            }
            /**
            * Creates normalized normal buffer attribute.
            *
            * @param {BufferAttribute} normal
            * @returns {BufferAttribute}
            *
            */
            createNormalizedNormalAttribute(b) {
              var I = this.cache;
              if (I.attributesNormalized.has(b)) return I.attributesNormalized.get(b);
              for (var D = b.clone(), N = new l.Vector3(), U = 0, B = D.count; U < B; U++) N.fromBufferAttribute(D, U), N.x === 0 && N.y === 0 && N.z === 0 ? N.setX(1) : N.normalize(), D.setXYZ(U, N.x, N.y, N.z);
              return I.attributesNormalized.set(b, D), D;
            }
            /**
            * Applies a texture transform, if present, to the map definition. Requires
            * the KHR_texture_transform extension.
            *
            * @param {Object} mapDef
            * @param {THREE.Texture} texture
            */
            applyTextureTransform(b, I) {
              var D = !1, N = {};
              (I.offset.x !== 0 || I.offset.y !== 0) && (N.offset = I.offset.toArray(), D = !0), I.rotation !== 0 && (N.rotation = I.rotation, D = !0), (I.repeat.x !== 1 || I.repeat.y !== 1) && (N.scale = I.repeat.toArray(), D = !0), D && (b.extensions = b.extensions || {}, b.extensions.KHR_texture_transform = N, this.extensionsUsed.KHR_texture_transform = !0);
            }
            /**
            * Process a buffer to append to the default one.
            * @param  {ArrayBuffer} buffer
            * @return {Integer}
            */
            processBuffer(b) {
              var I = this.json, D = this.buffers;
              return I.buffers || (I.buffers = [{ byteLength: 0 }]), D.push(b), 0;
            }
            /**
            * Process and generate a BufferView
            * @param  {BufferAttribute} attribute
            * @param  {number} componentType
            * @param  {number} start
            * @param  {number} count
            * @param  {number} target (Optional) Target usage of the BufferView
            * @return {Object}
            */
            processBufferView(b, I, D, N, U) {
              var B = this.json;
              B.bufferViews || (B.bufferViews = []);
              for (var G = I === h.UNSIGNED_BYTE ? 1 : I === h.UNSIGNED_SHORT ? 2 : 4, J = L(N * b.itemSize * G), j = new DataView(new ArrayBuffer(J)), te = 0, ee = D; ee < D + N; ee++) for (var ae, H = 0; H < b.itemSize; H++) ae = void 0, 4 < b.itemSize ? ae = b.array[ee * b.itemSize + H] : H === 0 ? ae = b.getX(ee) : H === 1 ? ae = b.getY(ee) : H === 2 ? ae = b.getZ(ee) : H == 3 && (ae = b.getW(ee)), I === h.FLOAT ? j.setFloat32(te, ae, !0) : I === h.UNSIGNED_INT ? j.setUint32(te, ae, !0) : I === h.UNSIGNED_SHORT ? j.setUint16(te, ae, !0) : I === h.UNSIGNED_BYTE && j.setUint8(te, ae), te += G;
              var Z = { buffer: this.processBuffer(j.buffer), byteOffset: this.byteOffset, byteLength: J };
              U !== void 0 && (Z.target = U), U === h.ARRAY_BUFFER && (Z.byteStride = b.itemSize * G), this.byteOffset += J, B.bufferViews.push(Z);
              var $ = { id: B.bufferViews.length - 1, byteLength: 0 };
              return $;
            }
            /**
            * Process and generate a BufferView from an image Blob.
            * @param {Blob} blob
            * @return {Promise<Integer>}
            */
            processBufferViewImage(b) {
              var I = this, D = I.json;
              return D.bufferViews || (D.bufferViews = []), new Promise(function(N) {
                var U = new window.FileReader();
                U.readAsArrayBuffer(b), U.onloadend = function() {
                  var B = _(U.result), G = { buffer: I.processBuffer(B), byteOffset: I.byteOffset, byteLength: B.byteLength };
                  I.byteOffset += B.byteLength, N(D.bufferViews.push(G) - 1);
                };
              });
            }
            /**
            * Process attribute to generate an accessor
            * @param  {BufferAttribute} attribute Attribute to process
            * @param  {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
            * @param  {Integer} start (Optional)
            * @param  {Integer} count (Optional)
            * @return {Integer|null} Index of the processed accessor on the "accessors" array
            */
            processAccessor(b, I, D, N) {
              var U, B = this.options, G = this.json;
              if (b.array.constructor === Float32Array) U = h.FLOAT;
              else if (b.array.constructor === Uint32Array) U = h.UNSIGNED_INT;
              else if (b.array.constructor === Uint16Array) U = h.UNSIGNED_SHORT;
              else if (b.array.constructor === Uint8Array) U = h.UNSIGNED_BYTE;
              else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");
              if (D === void 0 && (D = 0), N === void 0 && (N = b.count), B.truncateDrawRange && I !== void 0 && I.index === null) {
                var J = D + N, j = I.drawRange.count === 1 / 0 ? b.count : I.drawRange.start + I.drawRange.count;
                D = Math.max(D, I.drawRange.start), N = Math.min(J, j) - D, 0 > N && (N = 0);
              }
              if (N === 0) return null;
              var te, ee = R(b, D, N);
              I !== void 0 && (te = b === I.index ? h.ELEMENT_ARRAY_BUFFER : h.ARRAY_BUFFER);
              var ae = this.processBufferView(b, U, D, N, te), H = { bufferView: ae.id, byteOffset: ae.byteOffset, componentType: U, count: N, max: ee.max, min: ee.min, type: { 1: "SCALAR", 2: "VEC2", 3: "VEC3", 4: "VEC4", 16: "MAT4" }[b.itemSize] };
              return b.normalized === !0 && (H.normalized = !0), G.accessors || (G.accessors = []), G.accessors.push(H) - 1;
            }
            /**
            * Process image
            * @param  {Image} image to process
            * @param  {Integer} format of the image (e.g. RGBFormat, RGBAFormat etc)
            * @param  {Boolean} flipY before writing out the image
            * @return {Integer}     Index of the processed texture in the "images" array
            */
            processImage(b, I, D) {
              var N = this, U = N.cache, B = N.json, G = N.options, J = N.pending;
              U.images.has(b) || U.images.set(b, {});
              var j = U.images.get(b), te = I === l.RGBAFormat ? "image/png" : "image/jpeg", ee = te + ":flipY/" + D.toString();
              if (j[ee] !== void 0) return j[ee];
              B.images || (B.images = []);
              var ae = { mimeType: te };
              if (G.embedImages) {
                var H = F = F || document.createElement("canvas");
                H.width = Math.min(b.width, G.maxTextureSize), H.height = Math.min(b.height, G.maxTextureSize);
                var Z = H.getContext("2d");
                if (D === !0 && (Z.translate(0, H.height), Z.scale(1, -1)), typeof HTMLImageElement < "u" && b instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && b instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && b instanceof OffscreenCanvas || typeof ImageBitmap < "u" && b instanceof ImageBitmap) Z.drawImage(b, 0, 0, H.width, H.height);
                else {
                  I !== l.RGBAFormat && I !== l.RGBFormat && console.error("GLTFExporter: Only RGB and RGBA formats are supported."), (b.width > G.maxTextureSize || b.height > G.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", b);
                  var $ = new Uint8ClampedArray(4 * (b.height * b.width));
                  if (I === l.RGBAFormat) for (var se = 0; se < $.length; se += 4) $[se + 0] = b.data[se + 0], $[se + 1] = b.data[se + 1], $[se + 2] = b.data[se + 2], $[se + 3] = b.data[se + 3];
                  else for (var k = 0, W = 0; k < $.length; k += 4, W += 3) $[k + 0] = b.data[W + 0], $[k + 1] = b.data[W + 1], $[k + 2] = b.data[W + 2], $[k + 3] = 255;
                  Z.putImageData(new ImageData($, b.width, b.height), 0, 0);
                }
                G.binary === !0 ? J.push(new Promise(function(ce) {
                  H.toBlob(function(oe) {
                    N.processBufferViewImage(oe).then(function(V) {
                      ae.bufferView = V, ce();
                    });
                  }, te);
                })) : ae.uri = H.toDataURL(te);
              } else ae.uri = b.src;
              var q = B.images.push(ae) - 1;
              return j[ee] = q, q;
            }
            /**
            * Process sampler
            * @param  {Texture} map Texture to process
            * @return {Integer}     Index of the processed texture in the "samplers" array
            */
            processSampler(b) {
              var I = this.json;
              I.samplers || (I.samplers = []);
              var D = { magFilter: f[b.magFilter], minFilter: f[b.minFilter], wrapS: f[b.wrapS], wrapT: f[b.wrapT] };
              return I.samplers.push(D) - 1;
            }
            /**
            * Process texture
            * @param  {Texture} map Map to process
            * @return {Integer} Index of the processed texture in the "textures" array
            */
            processTexture(b) {
              var I = this.cache, D = this.json;
              if (I.textures.has(b)) return I.textures.get(b);
              D.textures || (D.textures = []);
              var N = { sampler: this.processSampler(b), source: this.processImage(b.image, b.format, b.flipY) };
              b.name && (N.name = b.name), this._invokeAll(function(B) {
                B.writeTexture && B.writeTexture(b, N);
              });
              var U = D.textures.push(N) - 1;
              return I.textures.set(b, U), U;
            }
            /**
            * Process material
            * @param  {THREE.Material} material Material to process
            * @return {Integer|null} Index of the processed material in the "materials" array
            */
            processMaterial(b) {
              var I = this.cache, D = this.json;
              if (I.materials.has(b)) return I.materials.get(b);
              if (b.isShaderMaterial) return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null;
              D.materials || (D.materials = []);
              var N = { pbrMetallicRoughness: {} };
              b.isMeshStandardMaterial !== !0 && b.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
              var U = b.color.toArray().concat([b.opacity]);
              if (w(U, [1, 1, 1, 1]) || (N.pbrMetallicRoughness.baseColorFactor = U), b.isMeshStandardMaterial ? (N.pbrMetallicRoughness.metallicFactor = b.metalness, N.pbrMetallicRoughness.roughnessFactor = b.roughness) : (N.pbrMetallicRoughness.metallicFactor = 0.5, N.pbrMetallicRoughness.roughnessFactor = 0.5), b.metalnessMap || b.roughnessMap) if (b.metalnessMap === b.roughnessMap) {
                var B = { index: this.processTexture(b.metalnessMap) };
                this.applyTextureTransform(B, b.metalnessMap), N.pbrMetallicRoughness.metallicRoughnessTexture = B;
              } else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");
              if (b.map) {
                var G = { index: this.processTexture(b.map) };
                this.applyTextureTransform(G, b.map), N.pbrMetallicRoughness.baseColorTexture = G;
              }
              if (b.emissive) {
                var J = b.emissive.clone().multiplyScalar(b.emissiveIntensity), j = Math.max(J.r, J.g, J.b);
                if (1 < j && (J.multiplyScalar(1 / j), console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")), 0 < j && (N.emissiveFactor = J.toArray()), b.emissiveMap) {
                  var te = { index: this.processTexture(b.emissiveMap) };
                  this.applyTextureTransform(te, b.emissiveMap), N.emissiveTexture = te;
                }
              }
              if (b.normalMap) {
                var ee = { index: this.processTexture(b.normalMap) };
                b.normalScale && b.normalScale.x !== -1 && (b.normalScale.x !== b.normalScale.y && console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."), ee.scale = b.normalScale.x), this.applyTextureTransform(ee, b.normalMap), N.normalTexture = ee;
              }
              if (b.aoMap) {
                var ae = { index: this.processTexture(b.aoMap), texCoord: 1 };
                b.aoMapIntensity !== 1 && (ae.strength = b.aoMapIntensity), this.applyTextureTransform(ae, b.aoMap), N.occlusionTexture = ae;
              }
              b.transparent ? N.alphaMode = "BLEND" : 0 < b.alphaTest && (N.alphaMode = "MASK", N.alphaCutoff = b.alphaTest), b.side === l.DoubleSide && (N.doubleSided = !0), b.name !== "" && (N.name = b.name), this.serializeUserData(b, N), this._invokeAll(function(Z) {
                Z.writeMaterial && Z.writeMaterial(b, N);
              });
              var H = D.materials.push(N) - 1;
              return I.materials.set(b, H), H;
            }
            /**
            * Process mesh
            * @param  {THREE.Mesh} mesh Mesh to process
            * @return {Integer|null} Index of the processed mesh in the "meshes" array
            */
            processMesh(b) {
              var I = this.cache, D = this.json, N = [b.geometry.uuid];
              if (Array.isArray(b.material)) for (var U = 0, B = b.material.length; U < B; U++) N.push(b.material[U].uuid);
              else N.push(b.material.uuid);
              var G = N.join(":");
              if (I.meshes.has(G)) return I.meshes.get(G);
              var J, j = b.geometry;
              if (J = b.isLineSegments ? h.LINES : b.isLineLoop ? h.LINE_LOOP : b.isLine ? h.LINE_STRIP : b.isPoints ? h.POINTS : b.material.wireframe ? h.LINES : h.TRIANGLES, j.isBufferGeometry !== !0) throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");
              var te = {}, ee = {}, ae = [], H = [], Z = { uv: "TEXCOORD_0", uv2: "TEXCOORD_1", color: "COLOR_0", skinWeight: "WEIGHTS_0", skinIndex: "JOINTS_0" }, $ = j.getAttribute("normal");
              $ === void 0 || this.isNormalizedNormalAttribute($) || (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), j.setAttribute("normal", this.createNormalizedNormalAttribute($)));
              var se = null;
              for (var k in j.attributes)
                if (k.substr(0, 5) !== "morph") {
                  var W = j.attributes[k];
                  k = Z[k] || k.toUpperCase();
                  var q = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;
                  if (q.test(k) || (k = "_" + k), I.attributes.has(this.getUID(W))) {
                    ee[k] = I.attributes.get(this.getUID(W));
                    continue;
                  }
                  se = null;
                  var ce = W.array;
                  k !== "JOINTS_0" || ce instanceof Uint16Array || ce instanceof Uint8Array || (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), se = new l.BufferAttribute(new Uint16Array(ce), W.itemSize, W.normalized));
                  var oe = this.processAccessor(se || W, j);
                  oe !== null && (ee[k] = oe, I.attributes.set(this.getUID(W), oe));
                }
              if ($ !== void 0 && j.setAttribute("normal", $), Object.keys(ee).length === 0) return null;
              if (b.morphTargetInfluences !== void 0 && 0 < b.morphTargetInfluences.length) {
                var V = [], O = [], X = {};
                if (b.morphTargetDictionary !== void 0) for (var Y in b.morphTargetDictionary) X[b.morphTargetDictionary[Y]] = Y;
                for (var ie = 0; ie < b.morphTargetInfluences.length; ++ie) {
                  var fe = {}, be = !1;
                  for (var Ae in j.morphAttributes) {
                    if (Ae != "position" && Ae !== "normal" && Ae !== "color") {
                      be || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), be = !0);
                      continue;
                    }
                    var he = j.morphAttributes[Ae][ie], xe = Ae.toUpperCase();
                    Z[Ae] && (xe = Z[Ae]);
                    var re = j.attributes[Ae];
                    if (I.attributes.has(this.getUID(he))) {
                      fe[xe] = I.attributes.get(this.getUID(he));
                      continue;
                    }
                    var me = re.clone();
                    if (!j.morphTargetsRelative) if (re) for (var Me = 0, De = he.count; Me < De; Me++) re.count > Me && me.setXYZ(Me, he.getX(Me) - re.getX(Me), he.getY(Me) - re.getY(Me), he.getZ(Me) - re.getZ(Me));
                    else for (var Ie = 0, $e = he.count; Ie < $e; Ie++) me.setXYZ(Ie, 0, 0, 0);
                    fe[xe] = this.processAccessor(me, j), I.attributes.set(this.getUID(re), fe[xe]);
                  }
                  H.push(fe), V.push(b.morphTargetInfluences[ie]), b.morphTargetDictionary !== void 0 && O.push(X[ie]);
                }
                te.weights = V, 0 < O.length && (te.extras = {}, te.extras.targetNames = O);
              }
              var lt = Array.isArray(b.material);
              if (lt && j.groups.length === 0) return null;
              for (var qe, Mt = lt ? b.material : [b.material], Be = lt ? j.groups : [{ materialIndex: 0, start: void 0, count: void 0 }], it = 0, tt = Be.length; it < tt; it++) {
                if (qe = { mode: J, attributes: ee }, this.serializeUserData(j, qe), 0 < H.length && (qe.targets = H), j.index !== null) {
                  var qt = this.getUID(j.index);
                  (Be[it].start !== void 0 || Be[it].count !== void 0) && (qt += ":" + Be[it].start + ":" + Be[it].count), I.attributes.has(qt) ? qe.indices = I.attributes.get(qt) : (qe.indices = this.processAccessor(j.index, j, Be[it].start, Be[it].count), I.attributes.set(qt, qe.indices)), qe.indices === null && delete qe.indices;
                }
                var Qt = this.processMaterial(Mt[Be[it].materialIndex]);
                Qt !== null && (qe.material = Qt), ae.push(qe);
              }
              te.primitives = ae, D.meshes || (D.meshes = []), this._invokeAll(function(Nt) {
                Nt.writeMesh && Nt.writeMesh(b, te);
              });
              var Pt = D.meshes.push(te) - 1;
              return I.meshes.set(G, Pt), Pt;
            }
            /**
            * Process camera
            * @param  {THREE.Camera} camera Camera to process
            * @return {Integer}      Index of the processed mesh in the "camera" array
            */
            processCamera(b) {
              var I = this.json;
              I.cameras || (I.cameras = []);
              var D = b.isOrthographicCamera, N = { type: D ? "orthographic" : "perspective" };
              return D ? N.orthographic = { xmag: 2 * b.right, ymag: 2 * b.top, zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near } : N.perspective = { aspectRatio: b.aspect, yfov: l.MathUtils.degToRad(b.fov), zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near }, b.name !== "" && (N.name = b.type), I.cameras.push(N) - 1;
            }
            /**
            * Creates glTF animation entry from AnimationClip object.
            *
            * Status:
            * - Only properties listed in PATH_PROPERTIES may be animated.
            *
            * @param {THREE.AnimationClip} clip
            * @param {THREE.Object3D} root
            * @return {number|null}
            */
            processAnimation(b, I) {
              var D = this.json, N = this.nodeMap;
              D.animations || (D.animations = []), b = d.Utils.mergeMorphTargetTracks(b.clone(), I);
              for (var U = b.tracks, B = [], G = [], J = 0; J < U.length; ++J) {
                var j = U[J], te = l.PropertyBinding.parseTrackName(j.name), ee = l.PropertyBinding.findNode(I, te.nodeName), ae = g[te.propertyName];
                if (te.objectName === "bones" && (ee.isSkinnedMesh === !0 ? ee = ee.skeleton.getBoneByName(te.objectIndex) : ee = void 0), !ee || !ae) return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', j.name), null;
                var H = 1, Z = j.values.length / j.times.length;
                ae === g.morphTargetInfluences && (Z /= ee.morphTargetInfluences.length);
                var $ = void 0;
                j.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? ($ = "CUBICSPLINE", Z /= 3) : j.getInterpolation() === l.InterpolateDiscrete ? $ = "STEP" : $ = "LINEAR", G.push({ input: this.processAccessor(new l.BufferAttribute(j.times, H)), output: this.processAccessor(new l.BufferAttribute(j.values, Z)), interpolation: $ }), B.push({ sampler: G.length - 1, target: { node: N.get(ee), path: ae } });
              }
              return D.animations.push({ name: b.name || "clip_" + D.animations.length, samplers: G, channels: B }), D.animations.length - 1;
            }
            /**
            * @param {THREE.Object3D} object
            * @return {number|null}
            */
            processSkin(b) {
              var I = this.json, D = this.nodeMap, N = I.nodes[D.get(b)], U = b.skeleton;
              if (U === void 0) return null;
              var B = b.skeleton.bones[0];
              if (B === void 0) return null;
              for (var G = [], J = new Float32Array(16 * U.bones.length), j = new l.Matrix4(), te = 0; te < U.bones.length; ++te) G.push(D.get(U.bones[te])), j.copy(U.boneInverses[te]), j.multiply(b.bindMatrix).toArray(J, 16 * te);
              I.skins === void 0 && (I.skins = []), I.skins.push({ inverseBindMatrices: this.processAccessor(new l.BufferAttribute(J, 16)), joints: G, skeleton: D.get(B) });
              var ee = N.skin = I.skins.length - 1;
              return ee;
            }
            /**
            * Process Object3D node
            * @param  {THREE.Object3D} node Object3D to processNode
            * @return {Integer} Index of the node in the nodes list
            */
            processNode(b) {
              var I = this.json, D = this.options, N = this.nodeMap;
              I.nodes || (I.nodes = []);
              var U = {};
              if (D.trs) {
                var B = b.quaternion.toArray(), G = b.position.toArray(), J = b.scale.toArray();
                w(B, [0, 0, 0, 1]) || (U.rotation = B), w(G, [0, 0, 0]) || (U.translation = G), w(J, [1, 1, 1]) || (U.scale = J);
              } else b.matrixAutoUpdate && b.updateMatrix(), M(b.matrix) === !1 && (U.matrix = b.matrix.elements);
              if (b.name !== "" && (U.name = b.name + ""), this.serializeUserData(b, U), b.isMesh || b.isLine || b.isPoints) {
                var j = this.processMesh(b);
                j !== null && (U.mesh = j);
              } else b.isCamera && (U.camera = this.processCamera(b));
              if (b.isSkinnedMesh && this.skins.push(b), 0 < b.children.length) {
                for (var te, ee = [], ae = 0, H = b.children.length; ae < H; ae++) if (te = b.children[ae], te.visible || D.onlyVisible === !1) {
                  var Z = this.processNode(te);
                  Z !== null && ee.push(Z);
                }
                0 < ee.length && (U.children = ee);
              }
              this._invokeAll(function(se) {
                se.writeNode && se.writeNode(b, U);
              });
              var $ = I.nodes.push(U) - 1;
              return N.set(b, $), $;
            }
            /**
            * Process Scene
            * @param  {Scene} node Scene to process
            */
            processScene(b) {
              var I = this.json, D = this.options;
              I.scenes || (I.scenes = [], I.scene = 0);
              var N = {};
              b.name !== "" && (N.name = b.name), I.scenes.push(N);
              for (var U, B = [], G = 0, J = b.children.length; G < J; G++) if (U = b.children[G], U.visible || D.onlyVisible === !1) {
                var j = this.processNode(U);
                j !== null && B.push(j);
              }
              0 < B.length && (N.nodes = B), this.serializeUserData(b, N);
            }
            /**
            * Creates a Scene to hold a list of objects and parse it
            * @param  {Array} objects List of objects to process
            */
            processObjects(b) {
              var I = new l.Scene();
              I.name = "AuxScene";
              for (var D = 0; D < b.length; D++)
                I.children.push(b[D]);
              this.processScene(I);
            }
            /**
            * @param {THREE.Object3D|Array<THREE.Object3D>} input
            */
            processInput(b) {
              var I = this.options;
              b = b instanceof Array ? b : [b], this._invokeAll(function(G) {
                G.beforeParse && G.beforeParse(b);
              });
              for (var D = [], N = 0; N < b.length; N++) b[N] instanceof l.Scene ? this.processScene(b[N]) : D.push(b[N]);
              0 < D.length && this.processObjects(D);
              for (var U = 0; U < this.skins.length; ++U) this.processSkin(this.skins[U]);
              for (var B = 0; B < I.animations.length; ++B) this.processAnimation(I.animations[B].clip, I.animations[B].mesh);
              this._invokeAll(function(G) {
                G.afterParse && G.afterParse(b);
              });
            }
            _invokeAll(b) {
              for (var I = 0, D = this.plugins.length; I < D; I++) b(this.plugins[I]);
            }
          }
          class T {
            constructor(b) {
              this.writer = b, this.name = "KHR_lights_punctual";
            }
            writeNode(b, I) {
              if (b.isLight) {
                if (!b.isDirectionalLight && !b.isPointLight && !b.isSpotLight) return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.", b);
                var D = this.writer, N = D.json, U = D.extensionsUsed, B = {};
                b.name && (B.name = b.name), B.color = b.color.toArray(), B.intensity = b.intensity, b.isDirectionalLight ? B.type = "directional" : b.isPointLight ? (B.type = "point", 0 < b.distance && (B.range = b.distance)) : b.isSpotLight && (B.type = "spot", 0 < b.distance && (B.range = b.distance), B.spot = {}, B.spot.innerConeAngle = -1 * ((b.penumbra - 1) * b.angle), B.spot.outerConeAngle = b.angle), b.decay !== void 0 && b.decay !== 2 && console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."), b.target && (b.target.parent !== b || b.target.position.x !== 0 || b.target.position.y !== 0 || b.target.position.z !== -1) && console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."), U[this.name] || (N.extensions = N.extensions || {}, N.extensions[this.name] = { lights: [] }, U[this.name] = !0);
                var G = N.extensions[this.name].lights;
                G.push(B), I.extensions = I.extensions || {}, I.extensions[this.name] = { light: G.length - 1 };
              }
            }
          }
          class E {
            constructor(b) {
              this.writer = b, this.name = "KHR_materials_unlit";
            }
            writeMaterial(b, I) {
              if (b.isMeshBasicMaterial) {
                var D = this.writer, N = D.extensionsUsed;
                I.extensions = I.extensions || {}, I.extensions[this.name] = {}, N[this.name] = !0, I.pbrMetallicRoughness.metallicFactor = 0, I.pbrMetallicRoughness.roughnessFactor = 0.9;
              }
            }
          }
          class C {
            constructor(b) {
              this.writer = b, this.name = "KHR_materials_pbrSpecularGlossiness";
            }
            writeMaterial(b, I) {
              if (b.isGLTFSpecularGlossinessMaterial) {
                var D = this.writer, N = D.extensionsUsed, U = {};
                I.pbrMetallicRoughness.baseColorFactor && (U.diffuseFactor = I.pbrMetallicRoughness.baseColorFactor);
                var B = [1, 1, 1];
                if (b.specular.toArray(B, 0), U.specularFactor = B, U.glossinessFactor = b.glossiness, I.pbrMetallicRoughness.baseColorTexture && (U.diffuseTexture = I.pbrMetallicRoughness.baseColorTexture), b.specularMap) {
                  var G = { index: D.processTexture(b.specularMap) };
                  D.applyTextureTransform(G, b.specularMap), U.specularGlossinessTexture = G;
                }
                I.extensions = I.extensions || {}, I.extensions[this.name] = U, N[this.name] = !0;
              }
            }
          }
          d.Utils = { insertKeyframe: function(b, I) {
            var D, N = 1e-3, U = b.getValueSize(), B = new b.TimeBufferType(b.times.length + 1), G = new b.ValueBufferType(b.values.length + U), J = b.createInterpolant(new b.ValueBufferType(U));
            if (b.times.length === 0) {
              B[0] = I;
              for (var j = 0; j < U; j++) G[j] = 0;
              D = 0;
            } else if (I < b.times[0]) {
              if (Math.abs(b.times[0] - I) < N) return 0;
              B[0] = I, B.set(b.times, 1), G.set(J.evaluate(I), 0), G.set(b.values, U), D = 0;
            } else if (I > b.times[b.times.length - 1]) {
              if (Math.abs(b.times[b.times.length - 1] - I) < N) return b.times.length - 1;
              B[B.length - 1] = I, B.set(b.times, 0), G.set(b.values, 0), G.set(J.evaluate(I), b.values.length), D = B.length - 1;
            } else for (var te = 0; te < b.times.length; te++) {
              if (Math.abs(b.times[te] - I) < N) return te;
              if (b.times[te] < I && b.times[te + 1] > I) {
                B.set(b.times.slice(0, te + 1), 0), B[te + 1] = I, B.set(b.times.slice(te + 1), te + 2), G.set(b.values.slice(0, (te + 1) * U), 0), G.set(J.evaluate(I), (te + 1) * U), G.set(b.values.slice((te + 1) * U), (te + 2) * U), D = te + 1;
                break;
              }
            }
            return b.times = B, b.values = G, D;
          }, mergeMorphTargetTracks: function(b, I) {
            for (var D = [], N = {}, U = b.tracks, B = 0; B < U.length; ++B) {
              var G = U[B], J = l.PropertyBinding.parseTrackName(G.name), j = l.PropertyBinding.findNode(I, J.nodeName);
              if (J.propertyName !== "morphTargetInfluences" || J.propertyIndex === void 0) {
                D.push(G);
                continue;
              }
              if (G.createInterpolant !== G.InterpolantFactoryMethodDiscrete && G.createInterpolant !== G.InterpolantFactoryMethodLinear) {
                if (G.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
                  throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
                console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), G = G.clone(), G.setInterpolation(l.InterpolateLinear);
              }
              var te = j.morphTargetInfluences.length, ee = j.morphTargetDictionary[J.propertyIndex];
              if (ee === void 0) throw new Error("THREE.GLTFExporter: Morph target name not found: " + J.propertyIndex);
              var ae = void 0;
              if (N[j.uuid] === void 0) {
                ae = G.clone();
                for (var H = new ae.ValueBufferType(te * ae.times.length), Z = 0; Z < ae.times.length; Z++) H[Z * te + ee] = ae.values[Z];
                ae.name = (J.nodeName || "") + ".morphTargetInfluences", ae.values = H, N[j.uuid] = ae, D.push(ae);
                continue;
              }
              var $ = G.createInterpolant(new G.ValueBufferType(1));
              ae = N[j.uuid];
              for (var se = 0; se < ae.times.length; se++) ae.values[se * te + ee] = $.evaluate(ae.times[se]);
              for (var k, W = 0; W < G.times.length; W++) k = this.insertKeyframe(ae, G.times[W]), ae.values[k * te + ee] = G.values[W];
            }
            return b.tracks = D, b;
          } };
        },
        /* 44 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).resolveURL, h = function() {
            this.nearPlane = 0.168248, this.farPlane = 6.82906, this.eyePosition = [0.5, -2.86496, 0.5], this.targetPosition = [0.5, 0.5, 0.5], this.upVector = [0, 0, 1];
            var A = this;
            this.setFromObject = (M) => {
              var { nearPlane: R, farPlane: L, eyePosition: _, targetPosition: F, upVector: S } = M;
              A.nearPlane = R, A.farPlane = L, A.eyePosition = _, A.targetPosition = F, A.upVector = S;
            };
          }, f = function(A, M, R, L) {
            var _ = { NONE: -1, DEFAULT: 0, PATH: 1, SMOOTH_CAMERA_TRANSITION: 2, AUTO_TUMBLE: 3, ROTATE_TRANSITION: 4, MINIMAP: 5, SYNC_CONTROL: 6 }, F = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM: 4, TOUCH_PAN: 5, SCROLL: 6, KEYBOARD_ZOOM: 7, KEYBOARD_ROTATE: 8, KEYBOARD_PAN: 9 }, S = { NONE: -1, FREE: 1, HORIZONTAL: 2, VERTICAL: 3 }, T = { ARROWLEFT: 37, ARROWUP: 38, ARROWRIGHT: 39, ARROWDOWN: 40, NUMPADADD: 107, NUMPADSUBTRACT: 109, EQUAL: 187, MINUS: 189 }, E = {};
            E.MAIN = F.ROTATE, E.AUXILIARY = F.ZOOM, E.SECONDARY = F.PAN, this.cameraObject = A, this.domElement = M === void 0 ? document : M, this.renderer = R, this.scene = L, this.tumble_rate = 1.5, this.pointer_x = 0, this.pointer_y = 0, this.pointer_x_start = 0, this.pointer_y_start = 0, this.previous_pointer_x = 0, this.previous_pointer_y = 0, this.near_plane_fly_debt = 0, this.touchZoomDistanceStart = 0, this.touchZoomDistanceEnd = 0, this.directionalLight = 0, this.zoomRate = 50, this.rotateRate = 50, this.panRate = 100, this.pixelHeight = 1;
            var C = 6e3, P = !0, b = 0, I = void 0, D = void 0, N = !1, U = 500, B = void 0, G = "default", J = _.DEFAULT, j = void 0, te = void 0, ee = void 0, ae = 0, H = S.FREE;
            this._state = F.NONE;
            var Z;
            this.targetTouchId = -1;
            var $ = void 0, se = new l.Vector3(), k = new l.Vector3(), W = new l.Vector3(), q = new l.Vector3(), ce = new l.Vector3(), oe = new l.Vector3(), V = new l.Vector3(), O = new l.Vector3(), X = new l.Sphere(), Y = new l.Vector3(), ie = !1, fe = void 0, be = 0, Ae = { default: new h() };
            Ae.default.nearPlane = 0.1, Ae.default.farPlane = 2e3, Ae.default.eyePosition = [0, 0, 0], Ae.default.targetPosition = [0, 0, -1], Ae.default.upVector = [0, 1, 0], this.cameraObject.target === void 0 && (this.cameraObject.target = new l.Vector3(...Ae.default.targetPosition)), this.calculateMaxAllowedDistance = (ne) => {
              var _e = ne.getBoundingBox();
              if (_e) {
                _e.getBoundingSphere(X), be = 6 * X.radius;
                var Oe = 0;
                this.cameraObject && (Oe = this.cameraObject.position.distanceTo(X.center)), be = Oe > be ? 1.5 * Oe : be;
              } else be = 0;
            }, this.addViewport = (ne, _e) => {
              ne && _e && (Ae[ne] = _e);
            }, this.setDefaultViewport = (ne) => !!(ne && ne in Ae) && (G = ne, !0), this.getDefaultViewport = () => G, this.getViewportOfName = (ne) => Ae[ne], this.setCurrentViewport = (ne) => ne in Ae && (this.setCurrentCameraSettings(Ae[ne]), !0), this.setRotationMode = (ne) => {
              switch (ne) {
                case "none":
                  H = S.NONE;
                  break;
                case "horizontal":
                  H = S.HORIZONTAL;
                  break;
                case "vertical":
                  H = S.VERTICAL;
                  break;
                case "free":
                default:
                  H = S.FREE;
              }
            }, this.onResize = () => {
              $ && ($ = void 0), fe && fe.setCurrentCameraSettings(this.cameraObject, Ae[G]);
            }, this.getVisibleHeightAtZDepth = (ne) => {
              var _e = this.cameraObject.position.distanceTo(this.cameraObject.target);
              ne < _e ? ne -= _e : ne += _e;
              var Oe = this.cameraObject.fov * Math.PI / 180;
              return 2 * Math.tan(Oe / 2) * Math.abs(ne);
            }, this.calculateHeightPerPixelAtZeroDepth = (ne) => {
              var _e = this.getVisibleHeightAtZDepth(0);
              return this.pixelHeight = _e / ne, this.pixelHeight;
            }, this.getNDCFromDocumentCoords = (ne, _e, Oe) => {
              Be(!1);
              var Ze = Oe || new l.Vector2(), ht = 2 * ((ne - $.left) / $.width) - 1, K = 2 * -((_e - $.top) / $.height) + 1;
              return Ze.set(ht, K);
            }, this.getRelativeCoordsFromNDC = (ne, _e, Oe) => {
              Be(!1);
              var Ze = Oe || new l.Vector2();
              return Ze.x = (ne + 1) * $.width / 2, Ze.y = (1 - _e) * $.height / 2, Ze;
            }, this.setMouseButtonAction = (ne, _e) => {
              E[ne] = F[_e];
            };
            var he = (ne, _e) => {
              ne instanceof HTMLCanvasElement && (ne.tabIndex = _e);
            }, xe = () => {
              if (0 < be) {
                var ne = Y.distanceTo(X.center);
                return be > ne || this.cameraObject.position.distanceTo(X.center) > ne;
              }
              return !0;
            }, re = (ne) => {
              Y.copy(this.cameraObject.position).add(ne), xe() && (this.cameraObject.target.add(ne), this.cameraObject.position.add(ne), this.updateDirectionalLight());
            }, me = (ne) => {
              Be(!1);
              var _e;
              if (J === _.DEFAULT && (_e = this.scene.getNormalisedMinimapCoordinates(this.renderer, ne)), !_e) ne.button == 0 ? ne.ctrlKey ? this._state = E.AUXILIARY : ne.shiftKey ? this._state = E.SECONDARY : this._state = E.MAIN : ne.button == 1 ? (ne.preventDefault(), this._state = E.AUXILIARY) : ne.button == 2 && (this._state = E.SECONDARY), this.pointer_x = ne.clientX - $.left, this.pointer_y = ne.clientY - $.top, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
              else {
                J = _.MINIMAP;
                var Oe = this.scene.getMinimapDiffFromNormalised(_e.x, _e.y);
                re(Oe);
              }
            }, Me = (ne) => {
              if (Be(!1), $) if (this.pointer_x = ne.clientX - $.left, this.pointer_y = ne.clientY - $.top, J === _.MINIMAP) {
                var _e = this.scene.getNormalisedMinimapCoordinates(this.renderer, ne);
                if (_e) {
                  var Oe = this.scene.getMinimapDiffFromNormalised(_e.x, _e.y);
                  re(Oe);
                }
              } else this._state === F.NONE && Z !== void 0 && Z.move(this, ne.clientX, ne.clientY, this.renderer);
            }, De = (ne) => {
              this._state = F.NONE, J == _.MINIMAP && (J = _.DEFAULT), Z !== void 0 && this.pointer_x_start == ne.clientX - $.left && this.pointer_y_start == ne.clientY - $.top && Z.pick(this, ne.clientX, ne.clientY, this.renderer);
            }, Ie = (ne) => {
              this._state = F.NONE;
            }, $e = (ne) => {
              Be(!1);
              var _e = ne.touches.length;
              if (_e == 1) {
                var Oe, Ze;
                this._state = F.TOUCH_ROTATE, this.pointer_x = ne.touches[0].clientX - ((Oe = $) === null || Oe === void 0 ? void 0 : Oe.left), this.pointer_y = ne.touches[0].clientY - ((Ze = $) === null || Ze === void 0 ? void 0 : Ze.top), this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
              } else if (_e == 2) {
                this._state = F.TOUCH_ZOOM;
                var ht = ne.touches[0].clientX - ne.touches[1].clientX, K = ne.touches[0].clientY - ne.touches[1].clientY;
                this.touchZoomDistanceEnd = this.touchZoomDistanceStart = Math.sqrt(ht * ht + K * K);
              } else if (_e == 3) {
                var ye, pe;
                this._state = F.TOUCH_PAN, this.targetTouchId = ne.touches[0].identifier, this.pointer_x = ne.touches[0].clientX - ((ye = $) === null || ye === void 0 ? void 0 : ye.left), this.pointer_y = ne.touches[0].clientY - ((pe = $) === null || pe === void 0 ? void 0 : pe.top), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
              }
            }, lt = (ne) => {
              ne.preventDefault(), ne.stopPropagation();
              var _e = ne.touches.length;
              if (_e == 1) this.pointer_x = ne.touches[0].clientX - $.left, this.pointer_y = ne.touches[0].clientY - $.top;
              else if (_e == 2) {
                if (this._state === F.TOUCH_ZOOM) {
                  var Oe = ne.touches[0].clientX - ne.touches[1].clientX, Ze = ne.touches[0].clientY - ne.touches[1].clientY;
                  this.touchZoomDistanceEnd = Math.sqrt(Oe * Oe + Ze * Ze);
                }
              } else if (_e == 3 && this._state === F.TOUCH_PAN) for (var ht = 0; 3 > ht; ht++) ne.touches[ht].identifier == this.targetTouchId && (this.pointer_x = ne.touches[0].clientX - $.left, this.pointer_y = ne.touches[0].clientY - $.top);
            }, qe = (ne) => {
              var _e = ne.touches.length;
              this.touchZoomDistanceStart = this.touchZoomDistanceEnd = 0, this.targetTouchId = -1, this._state = F.NONE, _e == 1 && Z !== void 0 && this.pointer_x_start == ne.touches[0].clientX - $.left && this.pointer_y_start == ne.touches[0].clientY - $.top && Z.pick(this.cameraObject, ne.touches[0].clientX, ne.touches[0].clientY, this.renderer);
            }, Mt = () => {
              Be(!0);
            }, Be = (ne) => {
              if (ne || $ === void 0) {
                var _e = new IntersectionObserver((Oe) => {
                  for (var Ze of Oe) $ = Ze.boundingClientRect;
                  _e.disconnect();
                });
                _e.observe(this.domElement);
              }
            }, it = (ne) => {
              Be(!1), this._state = F.SCROLL;
              var _e = 0;
              0 < ne.deltaY ? _e = this.zoomRate : 0 > ne.deltaY && (_e = -1 * this.zoomRate), ae += _e, ne.preventDefault(), ne.stopImmediatePropagation();
            }, tt = (ne) => {
              Be(!1);
              var _e = 0;
              if (ne.keyCode === T.EQUAL || ne.keyCode === T.MINUS || ne.keyCode === T.NUMPADADD || ne.keyCode === T.NUMPADSUBTRACT) {
                this._state = F.KEYBOARD_ZOOM;
                var Oe = 1;
                ne.shiftKey && (Oe *= 2), ne.keyCode === T.EQUAL || ne.keyCode === T.NUMPADADD ? _e = -1 * (this.zoomRate * Oe) : (ne.keyCode === T.MINUS || ne.keyCode === T.NUMPADSUBTRACT) && (_e = this.zoomRate * Oe), ae += _e;
              } else (ne.keyCode === T.ARROWLEFT || ne.keyCode === T.ARROWUP || ne.keyCode === T.ARROWRIGHT || ne.keyCode === T.ARROWDOWN) && (ne.shiftKey ? (this._state = F.KEYBOARD_ROTATE, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, _e = this.rotateRate) : (this._state = F.KEYBOARD_PAN, _e = this.panRate), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, ne.keyCode === T.ARROWLEFT ? this.pointer_x -= _e : ne.keyCode === T.ARROWUP ? this.pointer_y -= _e : ne.keyCode === T.ARROWRIGHT ? this.pointer_x += _e : ne.keyCode === T.ARROWDOWN && (this.pointer_y += _e));
              Object.values(T).includes(ne.keyCode) && ne.preventDefault();
            }, qt = (ne) => {
              this._state = F.NONE;
            }, Qt = () => {
              if (typeof this.cameraObject < "u") {
                var ne = $.height, _e = this.cameraObject.position.distanceTo(this.cameraObject.target), Oe = 0;
                this.cameraObject.far > this.cameraObject.near && _e >= this.cameraObject.near && _e <= this.cameraObject.far && (Oe = (_e - this.cameraObject.near) / (this.cameraObject.far - this.cameraObject.near)), k.set(this.previous_pointer_x, ne - this.previous_pointer_y, 0), W.set(this.previous_pointer_x, ne - this.previous_pointer_y, 1), q.set(this.pointer_x, ne - this.pointer_y, 0), ce.set(this.pointer_x, ne - this.pointer_y, 1), k.unproject(this.cameraObject), W.unproject(this.cameraObject), q.unproject(this.cameraObject), ce.unproject(this.cameraObject);
                var Ze = -2e-3;
                q.sub(k).multiplyScalar(1 - Oe), ce.sub(W).multiplyScalar(Oe), q.add(ce).multiplyScalar(Ze), re(q);
              }
              this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
            };
            this.getVectorsFromRotateAboutLookAtPoints = (ne, _e) => {
              ne.normalize(), V.copy(this.cameraObject.position).sub(this.cameraObject.target), O.copy(V), V.normalize(), 0.8 < Math.abs(V.dot(ne)) && V.copy(this.cameraObject.up), k.crossVectors(ne, V).normalize(), W.crossVectors(ne, k);
              var Oe = ne.dot(O), Ze = k.dot(O), ht = W.dot(O), K = ne.dot(this.cameraObject.up), ye = k.dot(this.cameraObject.up), pe = W.dot(this.cameraObject.up), we = Math.cos(_e), Le = Math.sin(_e);
              return q.set(we * k.x + Le * W.x, we * k.y + Le * W.y, we * k.z + Le * W.z), ce.set(we * W.x - Le * k.x, we * W.y - Le * k.y, we * W.z - Le * k.z), V.copy(this.cameraObject.target), V.x = V.x + ne.x * Oe + q.x * Ze + ce.x * ht, V.y = V.y + ne.y * Oe + q.y * Ze + ce.y * ht, V.z = V.z + ne.z * Oe + q.z * Ze + ce.z * ht, se.set(ne.x * K + q.x * ye + ce.x * pe, ne.y * K + q.y * ye + ce.y * pe, ne.z * K + q.z * ye + ce.z * pe), { position: V, up: se };
            }, this.rotateAboutLookAtpoint = (ne, _e) => {
              var Oe = this.getVectorsFromRotateAboutLookAtPoints(ne, _e);
              this.cameraObject.position.copy(Oe.position), this.updateDirectionalLight(), this.cameraObject.up.copy(Oe.up);
            };
            var Pt = () => {
              if (typeof this.cameraObject < "u") {
                var ne, _e, Oe = (ne = $) === null || ne === void 0 ? void 0 : ne.width, Ze = (_e = $) === null || _e === void 0 ? void 0 : _e.height;
                if (0 < Oe && 0 < Ze) {
                  var ht = 0.25 * (Oe + Ze), K = 0, ye = 0;
                  (H === S.FREE || H === S.HORIZONTAL) && (K = this.pointer_x - this.previous_pointer_x), (H === S.FREE || H === S.VERTICAL) && (ye = this.previous_pointer_y - this.pointer_y);
                  var pe = Math.sqrt(K * K + ye * ye);
                  if (0 < pe) {
                    var we = 1 * -ye / pe, Le = 1 * K / pe, ge = 0;
                    H === S.FREE && we * (this.pointer_x - 0.5 * (Oe - 1)) + Le * (0.5 * (Ze - 1) - this.pointer_y);
                    var Se = Math.acos(ge / ht) - 0.5 * Math.PI, Fe = this.tumble_rate * pe / ht;
                    se.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(), k.copy(this.cameraObject.up).normalize(), W.copy(k).cross(se).normalize().multiplyScalar(we), k.multiplyScalar(Le), oe.addVectors(W, k).multiplyScalar(Math.cos(Se)), se.multiplyScalar(Math.sin(Se)), oe.add(se), this.rotateAboutLookAtpoint(oe, -Fe);
                  }
                }
              }
              this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
            }, Nt = () => {
              var ne = 0;
              return this._state === F.ZOOM ? ne = this.previous_pointer_y - this.pointer_y : this._state === F.SCROLL || this._state === F.KEYBOARD_ZOOM ? ne = ae : (ne = -1 * (this.touchZoomDistanceEnd - this.touchZoomDistanceStart), this.touchZoomDistanceStart = this.touchZoomDistanceEnd), ne;
            };
            this.changeZoomByScrollRateUnit = (ne) => {
              var _e = ne * this.zoomRate;
              this.changeZoomByValue(_e);
            }, this.changeZoomByValue = (ne) => {
              if (typeof this.cameraObject < "u") {
                var _e = $.height, Oe = this.cameraObject.position.clone();
                Oe.sub(this.cameraObject.target);
                var Ze = Oe.length(), ht = 1.5 * ne / _e;
                if (0.01 < Ze + ht * Ze && (Oe.normalize(), Y.copy(this.cameraObject.position), Y.x += Oe.x * ht * Ze, Y.y += Oe.y * ht * Ze, Y.z += Oe.z * ht * Ze, xe())) {
                  this.cameraObject.position.copy(Y), this.updateDirectionalLight();
                  var K = 1e-5;
                  if (K * this.cameraObject.far < this.cameraObject.near + ht * Ze + this.near_plane_fly_debt) this.near_plane_fly_debt != 0 && (this.near_plane_fly_debt += ht * Ze, 0 < this.near_plane_fly_debt ? (this.cameraObject.near += this.near_plane_fly_debt, this.cameraObject.far += this.near_plane_fly_debt, this.near_plane_fly_debt = 0) : (this.cameraObject.near += ht * Ze, this.cameraObject.far += ht * Ze));
                  else {
                    if (this.near_plane_fly_debt == 0) {
                      var ye = this.cameraObject.near - K * this.cameraObject.far;
                      this.cameraObject.near = K * this.cameraObject.far, this.cameraObject.far -= ye, this.near_plane_fly_debt -= K * this.cameraObject.far;
                    }
                    this.near_plane_fly_debt += ht * Ze;
                  }
                  ie = !0;
                }
              }
            };
            var Vi = () => {
              var ne = Nt();
              this.changeZoomByValue(ne), this._state === F.ZOOM && (this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y), (this._state === F.SCROLL || this._state === F.KEYBOARD_ZOOM) && (ae = 0, this._state = F.NONE);
            };
            this.setDirectionalLight = (ne) => {
              this.directionalLight = ne;
            }, this.updateDirectionalLight = () => {
              this.directionalLight != 0 && this.directionalLight.position.set(this.cameraObject.position.x, this.cameraObject.position.y, this.cameraObject.position.z);
            }, this.enable = function() {
              P = !0, this.domElement && this.domElement.addEventListener && (he(this.domElement, 0), this.domElement.addEventListener("mousedown", me, !1), this.domElement.addEventListener("mousemove", Me, !1), this.domElement.addEventListener("mouseup", De, !1), this.domElement.addEventListener("mouseleave", Ie, !1), this.domElement.addEventListener("touchstart", $e, !1), this.domElement.addEventListener("touchmove", lt, !1), this.domElement.addEventListener("touchend", qe, !1), this.domElement.addEventListener("wheel", it, !1), this.domElement.addEventListener("mouseenter", Mt, !1), this.domElement.addEventListener("contextmenu", (ne) => {
                ne.preventDefault();
              }, !1), this.domElement.addEventListener("keydown", tt, !1), this.domElement.addEventListener("keyup", qt, !1));
            }, this.disable = function() {
              P = !1, this.domElement && this.domElement.removeEventListener && (this.domElement.removeEventListener("mousedown", me, !1), this.domElement.removeEventListener("mousemove", Me, !1), this.domElement.removeEventListener("mouseup", De, !1), this.domElement.removeEventListener("mouseleave", Ie, !1), this.domElement.removeEventListener("touchstart", $e, !1), this.domElement.removeEventListener("touchmove", lt, !1), this.domElement.removeEventListener("touchend", qe, !1), this.domElement.removeEventListener("wheel", it, !1), this.domElement.removeEventListener("mouseenter", Mt, !1), this.domElement.removeEventListener("contextmenu", (ne) => {
                ne.preventDefault();
              }, !1), this.domElement.removeEventListener("keydown", tt, !1), this.domElement.removeEventListener("keyup", qt, !1), he(this.domElement, -1));
            }, this.loadPath = (ne) => {
              I = ne.CameraPath, D = ne.NumberOfPoints;
            }, this.loadPathURL = (ne, _e) => {
              var Oe = new XMLHttpRequest();
              Oe.onreadystatechange = () => {
                if (Oe.readyState == 4 && Oe.status == 200) {
                  var ht = JSON.parse(Oe.responseText);
                  this.loadPath(ht), _e != null && typeof _e == "function" && _e();
                }
              };
              var Ze = d(ne);
              Oe.open("GET", Ze, !0), Oe.send();
            }, this.setPathDuration = (ne) => {
              C = ne, j && j.setDuration(C), te && te.setDuration(C);
            }, this.getPlayRate = () => U, this.setPlayRate = (ne) => {
              U = ne;
            };
            var Gi = (ne) => {
              var _e = b + ne;
              _e > C && (_e -= C), b = _e;
            };
            this.getTime = () => b, this.setTime = (ne) => {
              b = ne > C ? C : 0 > ne ? 0 : ne;
            }, this.getNumberOfTimeFrame = () => D, this.getCurrentTimeFrame = () => {
              if (2 < D) {
                var ne = b / C * (D - 1), _e = Math.floor(ne), Oe = 1 - (ne - _e), Ze = Math.ceil(ne);
                return _e == Ze ? _e == D - 1 ? [_e - 1, Ze, 0] : [_e, Ze + 1, 1] : [_e, Ze, Oe];
              }
              return D == 1 ? [0, 0, 0] : void 0;
            }, this.setCurrentTimeFrame = (ne) => {
              2 < D && (b = C * ne / (D - 1), 0 > b && (b = 0), b > C && (b = C));
            };
            var ni = (ne) => {
              if (J === _.PATH && (Gi(ne), I)) {
                for (var _e = this.getCurrentTimeFrame(), Oe = _e[0], Ze = _e[1], ht = _e[2], K = [I[3 * Oe], I[3 * Oe + 1], I[3 * Oe + 2]], ye = [I[3 * Ze], I[3 * Ze + 1], I[3 * Ze + 2]], pe = [], we = 0; we < K.length; we++) pe.push(ht * K[we] + (1 - ht) * ye[we]);
                this.cameraObject.position.set(pe[0], pe[1], pe[2]), this.cameraObject.target.set(ye[0], ye[1], ye[2]), B && this.cameraObject.lookAt(this.cameraObject.target), N && (this.directionalLight.position.set(pe[0], pe[1], pe[2]), this.directionalLight.target.position.set(ye[0], ye[1], ye[2]));
              }
            };
            this.calculatePathNow = () => {
              ni(0);
            };
            var ts = () => {
              this._state === F.ROTATE || this._state === F.TOUCH_ROTATE || this._state === F.KEYBOARD_ROTATE ? Pt() : this._state === F.PAN || this._state === F.TOUCH_PAN || this._state === F.KEYBOARD_PAN ? (Qt(), fe.triggerCallback()) : (this._state === F.ZOOM || this._state === F.TOUCH_ZOOM || this._state === F.SCROLL || this._state === F.KEYBOARD_ZOOM) && (fe.zoom(Nt()), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, (this._state === F.SCROLL || this._state === F.KEYBOARD_ZOOM) && (this._state = F.NONE), ae = 0, fe.triggerCallback());
            };
            this.update = (ne) => {
              var _e = ne * U, Oe = P, Ze = !0;
              return J === _.PATH ? ni(_e) : J === _.SMOOTH_CAMERA_TRANSITION && j ? (j.update(_e), j.isTransitionCompleted() && (J = _.DEFAULT), Oe = !1) : J === _.ROTATE_CAMERA_TRANSITION && te ? (te.update(_e), te.isTransitionCompleted() && (J = _.DEFAULT), Oe = !1) : J === _.AUTO_TUMBLE && ee ? ee.update(_e) : J === _.SYNC_CONTROL && fe ? (ts(), Oe = !1) : Ze = !1, Oe && (this._state !== F.NONE && (Ze = !0), this._state === F.ROTATE || this._state === F.TOUCH_ROTATE || this._state === F.KEYBOARD_ROTATE ? Pt() : this._state === F.PAN || this._state === F.TOUCH_PAN || this._state === F.KEYBOARD_PAN ? Qt() : (this._state === F.ZOOM || this._state === F.TOUCH_ZOOM || this._state === F.SCROLL || this._state === F.KEYBOARD_ZOOM) && Vi(), this._state !== F.NONE && J === _.AUTO_TUMBLE && ee && ee.stopOnCameraInput, this._state === F.SCROLL && (this._state = F.NONE)), B ? (Ze = !0, B.update()) : this.cameraObject.lookAt(this.cameraObject.target), Ze = Ze || ie, ie = !1, Ze;
            }, this.playPath = () => {
              J = _.PATH;
            }, this.stopPath = () => {
              J = _.DEFAULT;
            }, this.isPlayingPath = () => J === _.PATH, this.enableDirectionalLightUpdateWithPath = (ne) => {
              N = ne;
            }, this.enableDeviceOrientation = () => {
              B || (B = new x(this.cameraObject));
            }, this.disableDeviceOrientation = () => {
              B && (B.dispose(), B = void 0);
            }, this.isDeviceOrientationEnabled = () => !!B, this.resetView = () => {
              var ne = Ae[G];
              this.cameraObject.near = ne.nearPlane, this.cameraObject.far = ne.farPlane, this.cameraObject.position.set(ne.eyePosition[0], ne.eyePosition[1], ne.eyePosition[2]), this.cameraObject.target.set(ne.targetPosition[0], ne.targetPosition[1], ne.targetPosition[2]), this.cameraObject.up.set(ne.upVector[0], ne.upVector[1], ne.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight();
            }, this.setCurrentCameraSettings = (ne) => {
              ne.nearPlane && (this.cameraObject.near = ne.nearPlane), ne.farPlane && (this.cameraObject.far = ne.farPlane), ne.eyePosition && this.cameraObject.position.set(ne.eyePosition[0], ne.eyePosition[1], ne.eyePosition[2]), ne.targetPosition && this.cameraObject.target.set(ne.targetPosition[0], ne.targetPosition[1], ne.targetPosition[2]), ne.upVector && this.cameraObject.up.set(ne.upVector[0], ne.upVector[1], ne.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(), ie = !0;
            }, this.getViewportFromCentreAndRadius = (ne, _e, Oe, Ze, ht, K) => {
              var ye = this.cameraObject.position.x - this.cameraObject.target.x, pe = this.cameraObject.position.y - this.cameraObject.target.y, we = this.cameraObject.position.z - this.cameraObject.target.z, Le = 1 / Math.sqrt(ye * ye + pe * pe + we * we);
              ye *= Le, pe *= Le, we *= Le;
              var ge = [ne, _e, Oe], Se = Ze / Math.tan(ht * Math.PI / 360), Fe = [ne + ye * Se, _e + pe * Se, Oe + we * Se], Ge = Se + K, je = 0, et = 0.95;
              je = K > et * Se ? (1 - et) * Se : Se - K;
              var Ye = new h();
              return Ye.nearPlane = je, Ye.farPlane = Ge, Ye.eyePosition = Fe, Ye.targetPosition = ge, Ye.upVector = [this.cameraObject.up.x, this.cameraObject.up.y, this.cameraObject.up.z], Ye;
            }, this.getViewportFromBoundingBox = (ne, _e) => {
              var Oe = ne.min.distanceTo(ne.max) / 2 * _e, Ze = (ne.min.x + ne.max.x) / 2, ht = (ne.min.y + ne.max.y) / 2, K = (ne.min.z + ne.max.z) / 2, ye = 4, pe = this.getViewportFromCentreAndRadius(Ze, ht, K, Oe, 40, Oe * ye);
              return pe;
            }, this.getCurrentViewport = () => {
              var ne = new h();
              return ne.nearPlane = this.cameraObject.near, ne.farPlane = this.cameraObject.far, ne.eyePosition[0] = this.cameraObject.position.x, ne.eyePosition[1] = this.cameraObject.position.y, ne.eyePosition[2] = this.cameraObject.position.z, ne.targetPosition[0] = this.cameraObject.target.x, ne.targetPosition[1] = this.cameraObject.target.y, ne.targetPosition[2] = this.cameraObject.target.z, ne.upVector[0] = this.cameraObject.up.x, ne.upVector[1] = this.cameraObject.up.y, ne.upVector[2] = this.cameraObject.up.z, ne;
            }, this.getDefaultEyePosition = () => eyePosition, this.getDefaultTargetPosition = () => targetPosition, this.cameraTransition = (ne, _e, Oe) => {
              te == null && (j = new g(ne, _e, this, Oe));
            }, this.rotateCameraTransition = (ne, _e, Oe) => {
              j == null && (te = new p(ne, _e, this, Oe));
            }, this.enableCameraTransition = () => {
              j && (J = _.SMOOTH_CAMERA_TRANSITION), te && (J = _.ROTATE_CAMERA_TRANSITION);
            }, this.pauseCameraTransition = () => {
              J = _.DEFAULT;
            }, this.stopCameraTransition = () => {
              J = _.DEFAULT, j = void 0, te = void 0;
            }, this.isTransitioningCamera = () => J === _.SMOOTH_CAMERA_TRANSITION || J === _.ROTATE_CAMERA_TRANSITION, this.autoTumble = (ne, _e, Oe) => {
              ee = new y(ne, _e, Oe, this);
            }, this.enableAutoTumble = () => {
              J = _.AUTO_TUMBLE;
            }, this.stopAutoTumble = () => {
              J = _.DEFAULT, ee = void 0;
            }, this.updateAutoTumble = () => {
              ee && (ee.requireUpdate = !0);
            }, this.isAutoTumble = () => J === _.AUTO_TUMBLE, this.enableRaycaster = (ne, _e, Oe) => {
              Z == null && (Z = new u(ne, this.scene, _e, Oe, this.renderer));
            }, this.disableRaycaster = () => {
              Z.disable(), Z = void 0;
            }, this.isSyncControl = () => currentMpde === _.SYNC_CONTROL, this.enableSyncControl = () => (J = _.SYNC_CONTROL, fe || (fe = new w()), fe.setCurrentCameraSettings(this.cameraObject, Ae[G]), fe), this.disableSyncControl = () => {
              J = _.DEFAULT, this.cameraObject.zoom = 1, this.cameraObject.updateProjectionMatrix();
            }, this.enable();
          }, g = function(M, R, L, _) {
            var F = M.eyePosition, S = M.targetPosition, T = M.upVector, E = R.eyePosition, C = R.targetPosition, P = R.upVector, b = L, I = _, D = 0, N = !1;
            b.near = Math.min(M.nearPlane, R.nearPlane), b.far = Math.max(M.farPlane, R.farPlane), b.cameraObject.up.set(R.upVector[0], R.upVector[1], R.upVector[2]), this.setDuration = (G) => {
              I = G;
            };
            var U = (G) => {
              var J = D + G;
              J > I && (J = I), D = J;
            }, B = () => {
              var G = D / I, J = [F[0] * (1 - G) + E[0] * G, F[1] * (1 - G) + E[1] * G, F[2] * (1 - G) + E[2] * G], j = [S[0] * (1 - G) + C[0] * G, S[1] * (1 - G) + C[1] * G, S[2] * (1 - G) + C[2] * G];
              T[0] * (1 - G) + P[0] * G, T[1] * (1 - G) + P[1] * G, T[2] * (1 - G) + P[2] * G, b.cameraObject.position.set(J[0], J[1], J[2]), b.cameraObject.target.set(j[0], j[1], j[2]);
            };
            this.update = (G) => {
              this.enabled === !1 || (U(G), B(), D == I && (N = !0));
            }, this.isTransitionCompleted = () => N;
          }, p = function(M, R, L, _) {
            var F = M, S = R, T = L, E = _, C = 0, P = !1;
            this.setDuration = (I) => {
              E = I;
            };
            var b = (I) => {
              var D = C, N = C + I;
              N > E && (N = E), C = N;
              var U = C - D, B = U / E, G = B * S;
              T.rotateAboutLookAtpoint(F, G);
            };
            this.update = (I) => {
              this.enabled === !1 || (b(I), C == E && (P = !0));
            }, this.isTransitionCompleted = () => P;
          }, u = function(M, R, L, _, F) {
            var S = M, T = R, E = F, C = L, P = _, b = new l.Raycaster();
            b.params.Line.threshold = 0.1, b.params.Points.threshold = 1;
            var I = new l.Vector2(), D = !1, N = /* @__PURE__ */ new Date(), U = !1, B = 0, G = [], J = { zincCamera: void 0, x: -1, y: -1 }, j = void 0;
            this.enable = () => {
              enable = !0;
            }, this.disable = () => {
              enable = !1;
            }, this.getIntersectsObject = (ae) => {
              if (T !== S) {
                var H = S.getThreeJSScene();
                E.render(H, ae.cameraObject);
              }
              var Z = j || S.getPickableThreeJSObjects();
              return G.length = 0, b.intersectObjects(Z, !0, G);
            }, this.setPickableObjects = (ae) => {
              ae === void 0 ? j = void 0 : (j = [], ae.forEach((H) => {
                H.getGroup() && H.getGroup().visible && j.push(H.getGroup());
              }));
            }, this.getIntersectsObjectWithOrigin = (ae, H, Z) => (b.set(H, Z), this.getIntersectsObject(ae)), this.getIntersectsObjectWithCamera = (ae, H, Z) => (ae.getNDCFromDocumentCoords(H, Z, I), b.setFromCamera(I, ae.cameraObject), this.getIntersectsObject(ae)), this.pick = (ae, H, Z) => {
              if (E && S && ae && C) {
                this.getIntersectsObjectWithCamera(ae, H, Z);
                for (var $, se = G.length, k = 0; k < se; k++) if ($ = G[k].object ? G[k].object.userData : void 0, $ && $.isMarkerCluster && $.visible && $.clusterIsVisible(G[k].object.clusterIndex) && $.zoomToCluster(G[k].object.clusterIndex))
                  return;
                C(G, H, Z);
              }
            };
            var te = (ae, H, Z) => {
              if (E && S && ae && P) {
                if (this.getIntersectsObjectWithCamera(ae, H, Z), N.setTime(Date.now()), G.length === 0) {
                  if (U) return;
                  U = !0;
                } else U = !1;
                P(G, H, Z);
              }
            };
            this.move = (ae, H, Z) => {
              E && S && ae && P && (S.displayMarkers ? te(ae, H, Z) : (J.zincCamera = ae, J.x = H, J.y = Z, !D && (B = N ? Date.now() - N.getTime() : 250, 250 <= B ? te(ae, H, Z) : (D = !0, setTimeout(ee(J), B)))));
            };
            var ee = (ae) => function() {
              D = !1, te(ae.zincCamera, ae.x, ae.y);
            };
          }, y = function(M, R, L, _) {
            var F = new l.Vector3(), S = -R, T = _, E = M;
            this.stopOnCameraInput = L, this.requireUpdate = !0;
            var C = new l.Vector3(), P = new l.Vector3(), b = (I) => {
              var D = Math.sqrt(I[0] * I[0] + I[1] * I[1]), N = 4 * Math.abs(I[0]), U = 4 * Math.abs(I[1]), B = 0.25 * (N + U), G = -I[1] / D, J = I[0] / D, j = G * I[0] + J * -I[1];
              j > B ? j = B : j < -B && (j = -B);
              var te = Math.acos(j / B) - 0.5 * Math.PI;
              F.copy(T.cameraObject.position).sub(T.cameraObject.target).normalize(), C.copy(T.cameraObject.up).normalize(), P.crossVectors(C, F).normalize().multiplyScalar(G), C.multiplyScalar(J), C.add(P).multiplyScalar(Math.cos(te)), F.multiplyScalar(Math.sin(te)).add(C);
            };
            this.update = (I) => {
              this.enabled === !1 || (this.requireUpdate && (b(E), this.requireUpdate = !1), T.rotateAboutLookAtpoint(F, S * I / 1e3));
            };
          }, v = function() {
            this.type = "StereoCamera", this.aspect = 1, this.cameraL = new l.PerspectiveCamera(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new l.PerspectiveCamera(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1;
          };
          Object.assign(v.prototype, { update: (() => {
            var A, M, R, L, _, F, S = new l.Matrix4(), T = new l.Matrix4();
            return function(C) {
              var P = A !== C.focus || M !== C.fov || R !== C.aspect * this.aspect || L !== C.near || _ !== C.far || F !== C.zoom;
              if (P) {
                A = C.focus, M = C.fov, R = C.aspect * this.aspect, L = C.near, _ = C.far, F = C.zoom;
                var b, I, D = C.projectionMatrix.clone(), N = 0.064 / 2, U = N * L / A, B = L * Math.tan(0.5 * (l.Math.DEG2RAD * M)) / C.zoom;
                T.elements[12] = -N, S.elements[12] = N, b = -B * R + U, I = B * R + U, D.elements[0] = 2 * L / (I - b), D.elements[8] = (I + b) / (I - b), this.cameraL.projectionMatrix.copy(D), b = -B * R - U, I = B * R - U, D.elements[0] = 2 * L / (I - b), D.elements[8] = (I + b) / (I - b), this.cameraR.projectionMatrix.copy(D);
              }
              this.cameraL.matrixWorld.copy(C.matrixWorld).multiply(T), this.cameraR.matrixWorld.copy(C.matrixWorld).multiply(S);
            };
          })() });
          var m = function(M) {
            var R = new v();
            R.aspect = 0.5, this.setSize = (L, _) => {
              M.setSize(L, _);
            }, this.render = (L, _) => {
              L.updateMatrixWorld(), _.parent === null && _.updateMatrixWorld(), R.update(_);
              var F = M.getSize();
              M.setScissorTest(!0), M.clear(), M.setScissor(0, 0, F.width / 2, F.height), M.setViewport(0, 0, F.width / 2, F.height), M.render(L, R.cameraL), M.setScissor(F.width / 2, 0, F.width / 2, F.height), M.setViewport(F.width / 2, 0, F.width / 2, F.height), M.render(L, R.cameraR), M.setScissorTest(!1);
            };
          }, x = function(M) {
            var R = this;
            this.object = M, this.object.rotation.reorder("YXZ"), this.enabled = !0, this.deviceOrientation = {}, this.screenOrientation = 0;
            var L = (S) => {
              R.deviceOrientation = S;
            }, _ = () => {
              typeof window < "u" && (R.screenOrientation = window.orientation || 0);
            }, F = (() => {
              var S = new l.Vector3(0, 0, 1), T = new l.Euler(), E = new l.Quaternion(), C = new l.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));
              return (P, b, I, D, N) => {
                var U = new l.Vector3(0, 0, 1);
                U.subVectors(P.target, P.position), T.set(I, b, -D, "YXZ");
                var B = new l.Quaternion();
                B.setFromEuler(T), B.multiply(C), B.multiply(E.setFromAxisAngle(S, -N)), U.applyQuaternion(B), U.addVectors(P.position, U), P.lookAt(U);
              };
            })();
            this.connect = () => {
              _(), typeof window < "u" && (window.addEventListener("orientationchange", _, !1), window.addEventListener("deviceorientation", L, !1)), R.enabled = !0;
            }, this.disconnect = () => {
              typeof window < "u" && (window.removeEventListener("orientationchange", _, !1), window.removeEventListener("deviceorientation", L, !1)), R.enabled = !1;
            }, this.update = () => {
              if (R.enabled !== !1) {
                var S = R.deviceOrientation.alpha ? l.Math.degToRad(R.deviceOrientation.alpha) : 0, T = R.deviceOrientation.beta ? l.Math.degToRad(R.deviceOrientation.beta) : 0, E = R.deviceOrientation.gamma ? l.Math.degToRad(R.deviceOrientation.gamma) : 0, C = R.screenOrientation ? l.Math.degToRad(R.screenOrientation) : 0;
                F(R.object, S, T, E, C);
              }
            }, this.dispose = function() {
              this.disconnect();
            }, this.connect();
          }, w = function() {
            var M = void 0, R = void 0, L = void 0, _ = new l.Vector3(), F = new l.Vector3(), S = new l.Vector3(), T = new l.Vector3(), E = void 0;
            this.setCurrentCameraSettings = (C, P) => {
              M = C.clone(), R = C, L = P, M.near = L.nearPlane, L.farPlane && (M.far = L.farPlane), L.eyePosition && M.position.set(L.eyePosition[0], L.eyePosition[1], L.eyePosition[2]), L.upVector && M.up.set(L.upVector[0], L.upVector[1], L.upVector[2]), L.targetPosition && (M.target = new l.Vector3(L.targetPosition[0], L.targetPosition[1], L.targetPosition[2]), M.lookAt(M.target)), M.updateProjectionMatrix(), _.copy(M.position).project(M), F.copy(M.target).project(M);
            }, this.getCurrentPosition = () => (F.copy(R.target).project(M), [F.x, F.y]), this.zoom = (C) => {
              var P = 2e-3 * C, b = Math.max(R.zoom - P, 1);
              R.zoom = b, R.updateProjectionMatrix();
            }, this.zoomToBox = (C, P) => {
              C.getCenter(S), S.project(M), this.setCenterZoom([S.x, S.y], P);
            }, this.getPanZoom = () => ({ target: this.getCurrentPosition(), zoom: R.zoom }), this.setCenterZoom = (C, P) => {
              S.set(C[0], C[1], F.z).unproject(M), T.copy(S).sub(R.target), R.target.copy(S), R.lookAt(R.target), R.position.add(T), R.zoom = P, R.updateProjectionMatrix();
            }, this.setEventCallback = (C) => {
              (C === void 0 || typeof C == "function") && (E = C);
            }, this.triggerCallback = () => {
              E !== void 0 && typeof E == "function" && E();
            };
          };
          a.Viewport = h, a.CameraControls = f, a.SmoothCameraTransition = g, a.RotateCameraTransition = p, a.RayCaster = u, a.CameraAutoTumble = y, a.StereoEffect = m, a.NDCCameraControl = w;
        },
        /* 45 */
        /***/
        (o, a, c) => {
          var { Group: l, Matrix4: d } = c(4), h = c(22).Pointset;
          c(24).Lines;
          var f = c(46).Lines2, g = c(3).Geometry, p = c(4), u = 0, y = function() {
            return "re" + u++;
          }, v = function(m, x) {
            var w = m, A = new l();
            A.matrixAutoUpdate = !1, A.userData = this;
            var M = [], R = "", L = [], _ = x, F = new d(), S = 3e3;
            F.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this.pickableUpdateRequired = !0, this.isRegion = !0, this.uuid = y(), this.hideAllPrimitives = () => {
              M.forEach((T) => T.hideAllPrimitives()), L.forEach((T) => T.setVisibility(!1));
            }, this.showAllPrimitives = () => {
              M.forEach((T) => T.showAllPrimitives()), L.forEach((T) => T.setVisibility(!0));
            }, this.setVisibility = (T) => {
              T != A.visible && (A.visible = T, this.pickableUpdateRequired = !0);
            }, this.getVisibility = () => A.visible, this.getGroup = () => A, this.setTransformation = (T) => {
              F.set(...T), A.matrix.copy(F), A.updateMatrixWorld();
            }, this.setName = (T) => {
              T && T !== "" && (R = T);
            }, this.getName = () => R, this.getParent = () => w, this.getFullSeparatedPath = () => {
              var T = [];
              if (R !== "") {
                T.push(R);
                for (var E, C = w; C !== void 0; ) E = C.getName(), E !== "" && T.unshift(E), C = C.getParent();
              }
              return T;
            }, this.getFullPath = () => {
              var T = this.getFullSeparatedPath();
              if (0 < T.length) {
                var E = T.shift();
                return T.forEach((C) => {
                  E = E.concat("/", C);
                }), E;
              }
              return "";
            }, this.createChild = (T) => {
              var E = new v(this, _);
              return E.setName(T), M.push(E), A.add(E.getGroup()), E;
            }, this.getChildWithName = (T) => {
              if (T) {
                for (var E = T.toLowerCase(), C = 0; C < M.length; C++) if (M[C].getName().toLowerCase() === E) return M[C];
              }
            }, this.findChildFromSeparatedPath = (T) => {
              if (T && 0 < T.length && T[0] === "" && T.shift(), T && 0 < T.length) {
                var E = this.getChildWithName(T[0]);
                return E ? (T.shift(), E.findChildFromSeparatedPath(T)) : void 0;
              }
              return this;
            }, this.findChildFromPath = (T) => {
              var E = T.split("/");
              return this.findChildFromSeparatedPath(E);
            }, this.createChildFromSeparatedPath = (T) => {
              if (0 < T.length && T[0] === "" && T.shift(), 0 < T.length) {
                var E = this.getChildWithName(T[0]);
                return E || (E = this.createChild(T[0])), T.shift(), E.createChildFromSeparatedPath(T);
              }
              return this;
            }, this.createChildFromPath = (T) => {
              var E = T.split("/");
              return this.createChildFromSeparatedPath(E);
            }, this.findOrCreateChildFromPath = (T) => {
              var E = this.findChildFromPath(T);
              return E || (E = this.createChildFromPath(T)), E;
            }, this.addZincObject = (T) => {
              T && (T.setRegion(this), A.add(T.getGroup()), L.push(T), this.pickableUpdateRequired = !0, _ && _.triggerObjectAddedCallback(T));
            }, this.removeZincObject = (T) => {
              for (var E = 0; E < L.length; E++) if (T === L[E]) return A.remove(T.getGroup()), L.splice(E, 1), _ && _.triggerObjectRemovedCallback(T), T.dispose(), void (this.pickableUpdateRequired = !0);
            }, this.checkPickableUpdateRequred = (T) => {
              if (this.pickableUpdateRequired) return !0;
              if (T) {
                for (var E = !1, C = 0; C < M.length; C++) if (E = M[C].checkPickableUpdateRequred(T), E) return !0;
              }
              return !1;
            }, this.getPickableThreeJSObjects = (T, E) => (A.visible && (L.forEach((C) => {
              if (C.isPickable && C.getGroup() && C.getGroup().visible) {
                var P = C.marker;
                P && P.isEnabled() && T.push(P.getMorph()), T.push(C.getGroup());
              }
            }), E && M.forEach((C) => {
              C.getPickableThreeJSObjects(T, E);
            }), this.pickableUpdateRequired = !1), T), this.setDuration = (T) => {
              S = T, L.forEach((E) => E.setDuration(T)), M.forEach((E) => E.setDuration(T));
            }, this.getDuration = () => S, this.getBoundingBox = (T) => {
              var E, C;
              return L.forEach((P) => {
                C = P.getBoundingBox(), C && (E == null ? E = C.clone() : E.union(C));
              }), T && M.forEach((P) => {
                C = P.getBoundingBox(T), C && (E == null ? E = C.clone() : E.union(C));
              }), E;
            }, this.clear = (T) => {
              T && M.forEach((E) => E.clear(T)), L.forEach((E) => {
                A.remove(E.getGroup()), E.dispose();
              }), M = [], L = [];
            }, this.objectIsInRegion = (T, E) => {
              for (var C = 0; C < L.length; C++) if (T === L[C]) return !0;
              if (E) {
                for (var P = 0; P < M.length; P++) if (M[P].objectIsInRegion(T, E)) return !0;
              }
              return !1;
            }, this.forEachGeometry = (T, E) => {
              L.forEach((C) => {
                C.isGeometry && T(C);
              }), E && M.forEach((C) => C.forEachGeometry(T, E));
            }, this.forEachGlyphset = (T, E) => {
              L.forEach((C) => {
                C.isGlyphset && T(C);
              }), E && M.forEach((C) => C.forEachGlyphset(T, E));
            }, this.forEachPointset = (T, E) => {
              L.forEach((C) => {
                C.isPointset && T(C);
              }), E && M.forEach((C) => C.forEachPointset(T, E));
            }, this.forEachLine = (T, E) => {
              L.forEach((C) => {
                C.isLines && T(C);
              }), E && M.forEach((C) => C.forEachLine(T, E));
            }, this.findObjectsWithAnatomicalId = (T, E) => {
              var C = [];
              return L.forEach((P) => {
                P.anatomicalId === T && C.push(P);
              }), E && M.forEach((P) => {
                var b = P.findObjectsWithAnatomicalId(T, E);
                C.push(...b);
              }), C;
            }, this.findObjectsWithGroupName = (T, E) => {
              var C = [];
              return L.forEach((P) => {
                var b = P.groupName ? P.groupName.toLowerCase() : P.groupName, I = T && T.toLowerCase();
                b === I && C.push(P);
              }), E && M.forEach((P) => {
                var b = P.findObjectsWithGroupName(T, E);
                C.push(...b);
              }), C;
            }, this.findGeometriesWithGroupName = (T, E) => {
              var C = this.findObjectsWithGroupName(T, E), P = C.filter((b) => b.isGeometry);
              return P;
            }, this.findPointsetsWithGroupName = (T, E) => {
              var C = this.findObjectsWithGroupName(T, E), P = C.filter((b) => b.isPointset);
              return P;
            }, this.findGlyphsetsWithGroupName = (T, E) => {
              var C = this.findObjectsWithGroupName(T, E), P = C.filter((b) => b.isGlyphset);
              return P;
            }, this.findLinesWithGroupName = (T, E) => {
              var C = this.findObjectsWithGroupName(T, E), P = C.filter((b) => b.isLines);
              return P;
            }, this.getAllObjects = (T) => {
              var E = [...L];
              return T && M.forEach((C) => {
                var P = C.getAllObjects(T);
                E.push(...P);
              }), E;
            }, this.getChildRegions = (T) => {
              var E = [...M];
              return T && M.forEach((C) => {
                var P = C.getChildRegions(T);
                E.push(...P);
              }), E;
            }, this.getCurrentTime = () => {
              if (L[0] != null) return L[0].getCurrentTime();
              for (var T, E = 0; E < M.length; E++) if (T = M[E].getCurrentTime(), T !== -1) return T;
              return -1;
            }, this.setMorphTime = (T, E) => {
              L.forEach((C) => {
                C.setMorphTime(T);
              }), E && M.forEach((C) => {
                C.setMorphTime(T);
              });
            }, this.isTimeVarying = () => {
              for (var T = 0; T < L.length; T++) if (L[T].isTimeVarying()) return !0;
              for (var E = 0; E < M.length; E++) if (M[E].isTimeVarying()) return !0;
              return !1;
            }, this.renderGeometries = (T, E, C, P, b, I) => {
              var D, N = this.getAllObjects(I);
              N.forEach((U) => {
                U.render(T * E, C, P, b);
              }), b && C === !1 && (D = b.markerCluster) !== null && D !== void 0 && D.markerUpdateRequired && b.markerCluster.calculate();
            }, this.createPoints = (T, E, C, P) => {
              var b = !1, I = this.findObjectsWithGroupName(T, !1), D = I.findIndex((U) => U.isPointset), N = -1 < D ? I[D] : new h();
              return N.addPoints(E, C, P), D === -1 ? (N.setName(T), this.addZincObject(N), b = !0) : this.pickableUpdateRequired = !0, { zincObject: N, isNew: b };
            }, this.createLines = (T, E, C) => {
              var P = !1, b = this.findObjectsWithGroupName(T, !1), I = b.findIndex((N) => N.isLines), D = -1 < I ? b[I] : new f();
              return D.addLines(E, C), I === -1 ? (D.setName(T), this.addZincObject(D), P = !0) : this.pickableUpdateRequired = !0, { zincObject: D, isNew: P };
            }, this.createGeometryFromThreeJSGeometry = (T, E, C, P, b, I) => {
              var D = new g(), N = new p.MeshPhongMaterial({ color: C, morphTargets: !1, morphNormals: !1, transparent: !0, opacity: P, side: p.DoubleSide });
              return D.createMesh(E, N, { localTimeEnabled: !1, localMorphColour: !1 }), D.getMorph() ? (D.setVisibility(!1), D.setName(T), D.setRenderOrder(I), this.addZincObject(D), D) : void 0;
            };
          };
          a.Region = v;
        },
        /* 46 */
        /***/
        (o, a, c) => {
          c(4), c(5).toBufferGeometry;
          var l = c(47).LineSegments2, d = c(49).LineMaterial, h = c(48).LineSegmentsGeometry, f = function() {
            c(24).Lines.call(this), this.isLines2 = !0;
            var g = Array(300);
            this.createLineSegment = (p, u, y) => {
              if (p && u) {
                var v = new h();
                v.setPositions(p), v.colorsNeedUpdate = !0;
                var m = new l(v, u);
                m.scale.set(1, 1, 1), m.computeLineDistances(), this.setMesh(m, y.localTimeEnabled, y.localMorphColour);
              }
            }, this.setWidth = (p) => {
              this.morph && this.morph.material && (this.morph.material.linewidth = p, this.morph.material.needsUpdate = !0);
            }, this.addVertices = function(p) {
              if (p && p.length) {
                var u = this.getMorph();
                u || (this.drawRange = 0);
                var y = 3 * this.drawRange;
                if (p.forEach((v) => {
                  g[y++] = v[0], g[y++] = v[1], g[y++] = v[2], this.drawRange++;
                }), !u) for (; 300 > y; ) g[y++] = p[0][0], g[y++] = p[0][1], g[y++] = p[0][2];
                u && (u.geometry.setPositions(g), u.computeLineDistances(), this.boundingBoxUpdateRequired = !0);
              }
              return g;
            }, this.getVerticesByFaceIndex = function(p) {
              var u = 3 * (2 * p), y = this.getMorph();
              if (y && 3 * this.drawRange > u) {
                var v = y.geometry.getAttribute("instanceStart");
                return [[v.data.array[u], v.data.array[++u], v.data.array[++u]], [v.data.array[++u], v.data.array[++u], v.data.array[++u]]];
              }
              return [];
            }, this.editVertices = function(p, u) {
              if (p && p.length) {
                var y = this.getMorph(), v = u + p.length - 1;
                if (!y || 0 > u || v >= this.drawRange) return;
                var m = 3 * u;
                for (p.forEach((x) => {
                  g[m++] = x[0], g[m++] = x[1], g[m++] = x[2];
                }), m = 3 * this.drawRange; 300 > m; ) g[m++] = p[0][0], g[m++] = p[0][1], g[m++] = p[0][2];
                y.geometry.setPositions(g), y.computeLineDistances(), this.boundingBoxUpdateRequired = !0;
              }
              return g;
            }, this.addLines = (p, u) => {
              if (p && 0 < p.length) {
                this.addVertices(p);
                var y = this.getMorph();
                if (!y) {
                  var v = new d({ color: u, linewidth: 1, vertexColors: !1, worldUnits: !1 });
                  v.resolution.set(window.innerWidth, window.innerHeight), this.createLineSegment(g, v, { localTimeEnabled: !1, localMorphColour: !1 });
                }
                this.region && (this.region.pickableUpdateRequired = !0);
              }
            }, this.render = () => {
              var p = this.getMorph().material;
              p.resolution.set(window.innerWidth, window.innerHeight);
            };
          };
          f.prototype = Object.create(c(24).Lines.prototype), f.prototype.constructor = f, a.Lines2 = f;
        },
        /* 47 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineSegments2: () => (
              /* binding */
              L
            )
            /* harmony export */
          });
          var l = c(4), d = c(48), h = c(49), f = new l.Vector3(), g = new l.Vector3(), p = new l.Vector4(), u = new l.Vector4(), y = new l.Vector4(), v = new l.Vector3(), m = new l.Matrix4(), x = new l.Line3(), w = new l.Vector3(), A = new l.Box3(), M = new l.Sphere(), R = new l.Vector4();
          class L extends l.Mesh {
            constructor() {
              var F = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new d.LineSegmentsGeometry(), S = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new h.LineMaterial({ color: 16777215 * Math.random() });
              super(F, S), this.type = "LineSegments2";
            }
            // for backwards-compatability, but could be a method of LineSegmentsGeometry...
            computeLineDistances() {
              for (var F = this.geometry, S = F.attributes.instanceStart, T = F.attributes.instanceEnd, E = new Float32Array(2 * S.count), C = 0, P = 0, b = S.count; C < b; C++, P += 2) f.fromBufferAttribute(S, C), g.fromBufferAttribute(T, C), E[P] = P == 0 ? 0 : E[P - 1], E[P + 1] = E[P] + f.distanceTo(g);
              var I = new l.InstancedInterleavedBuffer(E, 2, 1);
              return F.setAttribute("instanceDistanceStart", new l.InterleavedBufferAttribute(I, 1, 0)), F.setAttribute("instanceDistanceEnd", new l.InterleavedBufferAttribute(I, 1, 1)), this;
            }
            raycast(F, S) {
              F.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');
              var T = F.params.Line2 === void 0 ? 0 : F.params.Line2.threshold || 0, E = F.ray, C = F.camera, P = C.projectionMatrix, b = this.matrixWorld, I = this.geometry, D = this.material, N = D.resolution, U = D.linewidth + T, B = I.attributes.instanceStart, G = I.attributes.instanceEnd, J = -C.near, j = 2 * Math.max(U / N.width, U / N.height);
              I.boundingSphere === null && I.computeBoundingSphere(), M.copy(I.boundingSphere).applyMatrix4(b);
              var te = Math.max(C.near, M.distanceToPoint(E.origin));
              R.set(0, 0, -te, 1).applyMatrix4(C.projectionMatrix), R.multiplyScalar(1 / R.w), R.applyMatrix4(C.projectionMatrixInverse);
              var ee = 0.5 * Math.abs(j / R.w);
              if (M.radius += ee, F.ray.intersectsSphere(M) !== !1) {
                I.boundingBox === null && I.computeBoundingBox(), A.copy(I.boundingBox).applyMatrix4(b);
                var ae = Math.max(C.near, A.distanceToPoint(E.origin));
                R.set(0, 0, -ae, 1).applyMatrix4(C.projectionMatrix), R.multiplyScalar(1 / R.w), R.applyMatrix4(C.projectionMatrixInverse);
                var H = 0.5 * Math.abs(j / R.w);
                if (A.max.x += H, A.max.y += H, A.max.z += H, A.min.x -= H, A.min.y -= H, A.min.z -= H, F.ray.intersectsBox(A) !== !1) {
                  E.at(1, y), y.w = 1, y.applyMatrix4(C.matrixWorldInverse), y.applyMatrix4(P), y.multiplyScalar(1 / y.w), y.x *= N.x / 2, y.y *= N.y / 2, y.z = 0, v.copy(y), m.multiplyMatrices(C.matrixWorldInverse, b);
                  for (var Z = 0, $ = B.count; Z < $; Z++) {
                    p.fromBufferAttribute(B, Z), u.fromBufferAttribute(G, Z), p.w = 1, u.w = 1, p.applyMatrix4(m), u.applyMatrix4(m);
                    var se = p.z > J && u.z > J;
                    if (!se) {
                      if (p.z > J) {
                        var k = p.z - u.z, W = (p.z - J) / k;
                        p.lerp(u, W);
                      } else if (u.z > J) {
                        var q = u.z - p.z, ce = (u.z - J) / q;
                        u.lerp(p, ce);
                      }
                      p.applyMatrix4(P), u.applyMatrix4(P), p.multiplyScalar(1 / p.w), u.multiplyScalar(1 / u.w), p.x *= N.x / 2, p.y *= N.y / 2, u.x *= N.x / 2, u.y *= N.y / 2, x.start.copy(p), x.start.z = 0, x.end.copy(u), x.end.z = 0;
                      var oe = x.closestPointToPointParameter(v, !0);
                      x.at(oe, w);
                      var V = l.MathUtils.lerp(p.z, u.z, oe), O = -1 <= V && 1 >= V, X = v.distanceTo(w) < 0.5 * U;
                      if (O && X) {
                        x.start.fromBufferAttribute(B, Z), x.end.fromBufferAttribute(G, Z), x.start.applyMatrix4(b), x.end.applyMatrix4(b);
                        var Y = new l.Vector3(), ie = new l.Vector3();
                        E.distanceSqToSegment(x.start, x.end, ie, Y), S.push({ point: ie, pointOnLine: Y, distance: E.origin.distanceTo(ie), object: this, face: null, faceIndex: Z, uv: null, uv2: null });
                      }
                    }
                  }
                }
              }
            }
          }
          L.prototype.LineSegments2 = !0;
        },
        /* 48 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineSegmentsGeometry: () => (
              /* binding */
              f
            )
            /* harmony export */
          });
          var l = c(4), d = new l.Box3(), h = new l.Vector3();
          class f extends l.InstancedBufferGeometry {
            constructor() {
              super(), this.type = "LineSegmentsGeometry", this.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]), this.setAttribute("position", new l.Float32BufferAttribute([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], 3)), this.setAttribute("uv", new l.Float32BufferAttribute([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], 2));
            }
            applyMatrix4(p) {
              var u = this.attributes.instanceStart, y = this.attributes.instanceEnd;
              return u !== void 0 && (u.applyMatrix4(p), y.applyMatrix4(p), u.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
            }
            setPositions(p) {
              var u;
              p instanceof Float32Array ? u = p : Array.isArray(p) && (u = new Float32Array(p));
              var y = new l.InstancedInterleavedBuffer(u, 6, 1);
              return this.setAttribute("instanceStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this;
            }
            setColors(p) {
              var u;
              p instanceof Float32Array ? u = p : Array.isArray(p) && (u = new Float32Array(p));
              var y = new l.InstancedInterleavedBuffer(u, 6, 1);
              return this.setAttribute("instanceColorStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceColorEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this;
            }
            fromWireframeGeometry(p) {
              return this.setPositions(p.attributes.position.array), this;
            }
            fromEdgesGeometry(p) {
              return this.setPositions(p.attributes.position.array), this;
            }
            fromMesh(p) {
              return this.fromWireframeGeometry(new l.WireframeGeometry(p.geometry)), this;
            }
            fromLineSegments(p) {
              var u = p.geometry;
              return u.isGeometry ? void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.") : (u.isBufferGeometry && this.setPositions(u.attributes.position.array), this);
            }
            computeBoundingBox() {
              this.boundingBox === null && (this.boundingBox = new l.Box3());
              var p = this.attributes.instanceStart, u = this.attributes.instanceEnd;
              p !== void 0 && u !== void 0 && (this.boundingBox.setFromBufferAttribute(p), d.setFromBufferAttribute(u), this.boundingBox.union(d));
            }
            computeBoundingSphere() {
              this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingBox === null && this.computeBoundingBox();
              var p = this.attributes.instanceStart, u = this.attributes.instanceEnd;
              if (p !== void 0 && u !== void 0) {
                var y = this.boundingSphere.center;
                this.boundingBox.getCenter(y);
                for (var v = 0, m = 0, x = p.count; m < x; m++) h.fromBufferAttribute(p, m), v = Math.max(v, y.distanceToSquared(h)), h.fromBufferAttribute(u, m), v = Math.max(v, y.distanceToSquared(h));
                this.boundingSphere.radius = Math.sqrt(v), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this);
              }
            }
            toJSON() {
            }
            applyMatrix(p) {
              return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(p);
            }
          }
          f.prototype.isLineSegmentsGeometry = !0;
        },
        /* 49 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineMaterial: () => (
              /* binding */
              d
            )
            /* harmony export */
          });
          var l = c(4);
          l.UniformsLib.line = {
            linewidth: { value: 1 },
            resolution: { value: new l.Vector2(1, 1) },
            dashScale: { value: 1 },
            dashSize: { value: 1 },
            dashOffset: { value: 0 },
            gapSize: { value: 1 },
            // todo FIX - maybe change to totalSize
            opacity: { value: 1 }
          }, l.ShaderLib.line = { uniforms: l.UniformsUtils.merge([l.UniformsLib.common, l.UniformsLib.fog, l.UniformsLib.line]), vertexShader: (
            /* glsl */
            `
		#include <common>
		#include <color_pars_vertex>
		#include <fog_pars_vertex>
		#include <logdepthbuf_pars_vertex>
		#include <clipping_planes_pars_vertex>

		uniform float linewidth;
		uniform vec2 resolution;

		attribute vec3 instanceStart;
		attribute vec3 instanceEnd;

		attribute vec3 instanceColorStart;
		attribute vec3 instanceColorEnd;

		varying vec2 vUv;

		#ifdef USE_DASH

			uniform float dashScale;
			attribute float instanceDistanceStart;
			attribute float instanceDistanceEnd;
			varying float vLineDistance;

		#endif

		void trimSegment( const in vec4 start, inout vec4 end ) {

			// trim end segment so it terminates between the camera plane and the near plane

			// conservative estimate of the near plane
			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
			float nearEstimate = - 0.5 * b / a;

			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

			end.xyz = mix( start.xyz, end.xyz, alpha );

		}

		void main() {

			#ifdef USE_COLOR

				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

			#endif

			#ifdef USE_DASH

				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;

			#endif

			float aspect = resolution.x / resolution.y;

			vUv = uv;

			// camera space
			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
			// perhaps there is a more elegant solution -- WestLangley

			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

			if ( perspective ) {

				if ( start.z < 0.0 && end.z >= 0.0 ) {

					trimSegment( start, end );

				} else if ( end.z < 0.0 && start.z >= 0.0 ) {

					trimSegment( end, start );

				}

			}

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

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

			// direction
			vec2 dir = ndcEnd - ndcStart;

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

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

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

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

			// endcaps
			if ( position.y < 0.0 ) {

				offset += - dir;

			} else if ( position.y > 1.0 ) {

				offset += dir;

			}

			// adjust for linewidth
			offset *= linewidth;

			// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
			offset /= resolution.y;

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

			// back to clip space
			offset *= clip.w;

			clip.xy += offset;

			gl_Position = clip;

			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

			#include <logdepthbuf_vertex>
			#include <clipping_planes_vertex>
			#include <fog_vertex>

		}`
          ), fragmentShader: (
            /* glsl */
            `
		uniform vec3 diffuse;
		uniform float opacity;

		#ifdef USE_DASH

			uniform float dashSize;
			uniform float dashOffset;
			uniform float gapSize;

		#endif

		varying float vLineDistance;

		#include <common>
		#include <color_pars_fragment>
		#include <fog_pars_fragment>
		#include <logdepthbuf_pars_fragment>
		#include <clipping_planes_pars_fragment>

		varying vec2 vUv;

		void main() {

			#include <clipping_planes_fragment>

			#ifdef USE_DASH

				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

			#endif

			float alpha = opacity;

			#ifdef ALPHA_TO_COVERAGE

			// artifacts appear on some hardware if a derivative is taken within a conditional
			float a = vUv.x;
			float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
			float len2 = a * a + b * b;
			float dlen = fwidth( len2 );

			if ( abs( vUv.y ) > 1.0 ) {

				alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

			}

			#else

			if ( abs( vUv.y ) > 1.0 ) {

				float a = vUv.x;
				float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
				float len2 = a * a + b * b;

				if ( len2 > 1.0 ) discard;

			}

			#endif

			vec4 diffuseColor = vec4( diffuse, alpha );

			#include <logdepthbuf_fragment>
			#include <color_fragment>

			gl_FragColor = vec4( diffuseColor.rgb, alpha );

			#include <tonemapping_fragment>
			#include <encodings_fragment>
			#include <fog_fragment>
			#include <premultiplied_alpha_fragment>

		}`
          ) };
          class d extends l.ShaderMaterial {
            constructor(f) {
              super({
                type: "LineMaterial",
                uniforms: l.UniformsUtils.clone(l.ShaderLib.line.uniforms),
                vertexShader: l.ShaderLib.line.vertexShader,
                fragmentShader: l.ShaderLib.line.fragmentShader,
                clipping: !0
                // required for clipping support
              }), Object.defineProperties(this, { color: { enumerable: !0, get: function() {
                return this.uniforms.diffuse.value;
              }, set: function(p) {
                this.uniforms.diffuse.value = p;
              } }, linewidth: { enumerable: !0, get: function() {
                return this.uniforms.linewidth.value;
              }, set: function(p) {
                this.uniforms.linewidth.value = p;
              } }, dashed: { enumerable: !0, get: function() {
                return "USE_DASH" in this.defines;
              }, set(g) {
                !!g != "USE_DASH" in this.defines && (this.needsUpdate = !0), g === !0 ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH;
              } }, dashScale: { enumerable: !0, get: function() {
                return this.uniforms.dashScale.value;
              }, set: function(p) {
                this.uniforms.dashScale.value = p;
              } }, dashSize: { enumerable: !0, get: function() {
                return this.uniforms.dashSize.value;
              }, set: function(p) {
                this.uniforms.dashSize.value = p;
              } }, dashOffset: { enumerable: !0, get: function() {
                return this.uniforms.dashOffset.value;
              }, set: function(p) {
                this.uniforms.dashOffset.value = p;
              } }, gapSize: { enumerable: !0, get: function() {
                return this.uniforms.gapSize.value;
              }, set: function(p) {
                this.uniforms.gapSize.value = p;
              } }, opacity: { enumerable: !0, get: function() {
                return this.uniforms.opacity.value;
              }, set: function(p) {
                this.uniforms.opacity.value = p;
              } }, resolution: { enumerable: !0, get: function() {
                return this.uniforms.resolution.value;
              }, set: function(p) {
                this.uniforms.resolution.value.copy(p);
              } }, alphaToCoverage: { enumerable: !0, get: function() {
                return "ALPHA_TO_COVERAGE" in this.defines;
              }, set: function(p) {
                !!p != "ALPHA_TO_COVERAGE" in this.defines && (this.needsUpdate = !0), p === !0 ? (this.defines.ALPHA_TO_COVERAGE = "", this.extensions.derivatives = !0) : (delete this.defines.ALPHA_TO_COVERAGE, this.extensions.derivatives = !1);
              } } }), this.setValues(f);
            }
          }
          d.prototype.isLineMaterial = !0;
        },
        /* 50 */
        /***/
        (o, a, c) => {
          var l = c(4);
          a.Minimap = function(d) {
            var h = d;
            this.camera = new l.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, 0.01, 10), this.helper = void 0;
            var f = new l.BufferGeometry(), g = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1]), p = new l.BufferAttribute(g, 3);
            f.setAttribute("position", p);
            var u = new l.MeshBasicMaterial({ color: 3355443, depthTest: !1, depthWrite: !1, opacity: 0.5, transparent: !0 });
            this.mask = new l.Mesh(f, u);
            var y = new l.Box3(), v = new l.Vector3();
            this.getDiffFromNormalised = (x, w) => {
              y.setFromBufferAttribute(p).getCenter(v);
              var A = v.clone().project(this.camera), M = new l.Vector3(x, w, A.z).unproject(this.camera);
              return M.sub(v);
            };
            var m = (x, w) => {
              h.camera.near && (this.camera.near = h.camera.near), w.farPlane && (this.camera.far = w.farPlane), w.eyePosition && this.camera.position.set(w.eyePosition[0], w.eyePosition[1], w.eyePosition[2]), w.upVector && this.camera.up.set(w.upVector[0], w.upVector[1], w.upVector[2]), w.targetPosition && this.camera.lookAt(new l.Vector3(w.targetPosition[0], w.targetPosition[1], w.targetPosition[2])), this.camera.zoom = 1 / x, this.camera.updateProjectionMatrix();
            };
            this.getBoundary = () => {
              var x = new l.Vector3().copy(h.camera.target).project(h.camera), w = new l.Vector3(-1, -1, x.z).unproject(h.camera), A = new l.Vector3(1, -1, x.z).unproject(h.camera), M = new l.Vector3(1, 1, x.z).unproject(h.camera), R = new l.Vector3(-1, 1, x.z).unproject(h.camera);
              p.copyVector3sArray([w, A, M, M, R, w]), p.needsUpdate = !0;
            }, this.updateCamera = () => {
              this.getBoundary();
              var x = h.getZincCameraControls(), w = h.getBoundingBox();
              if (w) {
                var A = w.min.distanceTo(w.max), M = A / 2, R = (w.min.x + w.max.x) / 2, L = (w.min.y + w.max.y) / 2, _ = (w.min.z + w.max.z) / 2, F = x.getViewportFromCentreAndRadius(R, L, _, M, 40, M * 4);
                m(A, F);
              }
            };
          };
        },
        /* 51 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(52)(l), h = c(3).Geometry, f = c(53), g = c(54).default, p = l.BufferGeometryLoader, u = function(y) {
            var v;
            y && y.isGeometry && (v = y);
            var m = void 0, x = void 0, w = !1, A = void 0, M = (S) => {
              var T = v.getMorph().material.clone();
              T.morphTargets = !1;
              var E = new h(), C = new p(), P = C.parse(S), b = new l.Mesh(P.geometry, T);
              return E.geometry = b.geometry, b.userData = E, E.setMorph(b), E;
            }, R = (S) => {
              switch (S.data.action) {
                case "message":
                  console.log(S.data.message);
                  break;
                case "result":
                  var T = new u(M(S.data.object));
                  A && A(T), A = void 0, w = !1;
                  break;
                default:
                  throw "Cannot handle specified action.";
              }
            }, L = (S) => {
              if (f !== void 0 && (x = f(
                /*require.resolve*/
                55
              )), !x) m = new (c(56)).GeometryCSGInternal(S);
              else if (S && S.isGeometry) {
                var T = S.getMorph(), E = T.geometry.clone().applyMatrix(T.matrix).toJSON();
                x.addEventListener("message", function(C) {
                  R(C);
                }), x.postMessage({ action: "initialise", object: E });
              }
            };
            this.getHostGeometry = () => {
              var S = new d(v.getMorph());
              return new _(S);
            }, this.getGeometry = () => v;
            var _ = (S) => {
              var T = v.getMorph().material.clone();
              T.morphTargets = !1;
              var E = S.toMesh(T), C = new h();
              return C.geometry = E.geometry, E.userData = C, C.setMorph(E), C;
            };
            this.setCSG = (S) => {
              m.setCSG(S);
            };
            var F = (S, T, E, C) => {
              if (w)
                C("On progress");
              else {
                var P = S.getMorph(), b = P.geometry.clone().applyMatrix(P.matrix).toJSON();
                A = E, w = !0, x.postMessage({ action: T, object: b });
              }
            };
            this.intersect = (S) => new g((T, E) => {
              if (x) F(S, "intersect", T, E);
              else {
                var C = m.intersect(S), P = new u(_(C));
                P.setCSG(C), T(P);
              }
            }), this.subtract = (S) => new g((T, E) => {
              if (x) F(S, "intersect", T, E);
              else {
                var C = m.subtract(S), P = new u(_(C));
                P.setCSG(C), T(P);
              }
            }), this.union = (S) => new g((T, E) => {
              if (x) F(S, "intersect", T, E);
              else {
                var C = m.union(S), P = new u(_(C));
                P.setCSG(C), T(P);
              }
            }), this.terminateWorker = () => {
              x && x.terminate();
            }, L(y);
          };
          a.GeometryCSG = u;
        },
        /* 52 */
        /***/
        (o) => {
          var a = 1e-5, c = 0, l = 1, d = 2, h = 3;
          o.exports = function(f) {
            var g = function(p) {
              var u, y, v, m, x, w, A, M = [];
              if (p.isBufferGeometry && (p = new f.Geometry().fromBufferGeometry(p)), p instanceof f.Geometry) this.matrix = new f.Matrix4();
              else if (p.isMesh) p.updateMatrix(), this.matrix = p.matrix.clone(), p = p.geometry, p.isBufferGeometry && (p = new f.Geometry().fromBufferGeometry(p)), p.mergeVertices(), p.computeVertexNormals(!1);
              else {
                if (p instanceof g.Node) return this.tree = p, this.matrix = new f.Matrix4(), this;
                throw "ThreeBSP: Given geometry is unsupported";
              }
              for (u = 0, y = p.faces.length; u < y; u++)
                v = p.faces[u], x = p.faceVertexUvs[0][u], A = new g.Polygon(), v instanceof f.Face3 ? (m = p.vertices[v.a], w = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.b], w = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.c], w = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m)) : (f.Face4, m = p.vertices[v.a], w = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.b], w = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[1], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.c], w = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.d], w = x ? new f.Vector2(x[3].x, x[3].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[3], w), m.applyMatrix4(this.matrix), A.vertices.push(m)), A.calculateProperties(), M.push(A);
              this.tree = new g.Node(M);
            };
            return g.prototype.subtract = function(p) {
              var u = this.tree.clone(), y = p.tree.clone();
              return u.invert(), u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u;
            }, g.prototype.union = function(p) {
              var u = this.tree.clone(), y = p.tree.clone();
              return u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u = new g(u), u.matrix = this.matrix, u;
            }, g.prototype.intersect = function(p) {
              var u = this.tree.clone(), y = p.tree.clone();
              return u.invert(), y.clipTo(u), y.invert(), u.clipTo(y), y.clipTo(u), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u;
            }, g.prototype.toGeometry = function() {
              var p, u, y, v, m, x, w, A, M, R, L = new f.Matrix4().getInverse(this.matrix), _ = new f.Geometry(), F = this.tree.allPolygons(), S = F.length, T = {};
              for (p = 0; p < S; p++) for (y = F[p], v = y.vertices.length, u = 2; u < v; u++) R = [], A = y.vertices[0], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof T[A.x + "," + A.y + "," + A.z] > "u" ? (_.vertices.push(A), m = T[A.x + "," + A.y + "," + A.z] = _.vertices.length - 1) : m = T[A.x + "," + A.y + "," + A.z], A = y.vertices[u - 1], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof T[A.x + "," + A.y + "," + A.z] > "u" ? (_.vertices.push(A), x = T[A.x + "," + A.y + "," + A.z] = _.vertices.length - 1) : x = T[A.x + "," + A.y + "," + A.z], A = y.vertices[u], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof T[A.x + "," + A.y + "," + A.z] > "u" ? (_.vertices.push(A), w = T[A.x + "," + A.y + "," + A.z] = _.vertices.length - 1) : w = T[A.x + "," + A.y + "," + A.z], M = new f.Face3(m, x, w, new f.Vector3(y.normal.x, y.normal.y, y.normal.z)), _.faces.push(M), _.faceVertexUvs[0].push(R);
              return _;
            }, g.prototype.toBufferGeometry = function() {
              var p = this.toGeometry(), u = new f.BufferGeometry().fromGeometry(p);
              return u;
            }, g.prototype.toMesh = function(p) {
              var u = this.toBufferGeometry(), y = new f.Mesh(u, p);
              return y.position.setFromMatrixPosition(this.matrix), y.rotation.setFromRotationMatrix(this.matrix), y;
            }, g.Polygon = function(p) {
              p instanceof Array || (p = []), this.vertices = p, 0 < p.length ? this.calculateProperties() : this.normal = this.w = void 0;
            }, g.Polygon.prototype.calculateProperties = function() {
              var p = this.vertices[0], u = this.vertices[1], y = this.vertices[2];
              return this.normal = u.clone().subtract(p).cross(y.clone().subtract(p)).normalize(), this.w = this.normal.clone().dot(p), this;
            }, g.Polygon.prototype.clone = function() {
              var p, u, y = new g.Polygon();
              for (p = 0, u = this.vertices.length; p < u; p++) y.vertices.push(this.vertices[p].clone());
              return y.calculateProperties(), y;
            }, g.Polygon.prototype.flip = function() {
              var p, u = [];
              for (this.normal.multiplyScalar(-1), this.w *= -1, p = this.vertices.length - 1; 0 <= p; p--) u.push(this.vertices[p]);
              return this.vertices = u, this;
            }, g.Polygon.prototype.classifyVertex = function(p) {
              var u = this.normal.dot(p) - this.w;
              return u < -a ? d : u > a ? l : c;
            }, g.Polygon.prototype.classifySide = function(p) {
              var u, y, v, m = 0, x = 0, w = p.vertices.length;
              for (u = 0; u < w; u++) y = p.vertices[u], v = this.classifyVertex(y), v === l ? m++ : v === d && x++;
              return 0 < m && x === 0 ? l : m === 0 && 0 < x ? d : m === 0 && x === 0 ? c : h;
            }, g.Polygon.prototype.splitPolygon = function(p, u, y, v, m) {
              var x = this.classifySide(p);
              if (x === c) (0 < this.normal.dot(p.normal) ? u : y).push(p);
              else if (x === l) v.push(p);
              else if (x === d) m.push(p);
              else {
                var w, A, M, R, L, _, F, S, T, E = [], C = [];
                for (A = 0, w = p.vertices.length; A < w; A++) M = (A + 1) % w, _ = p.vertices[A], F = p.vertices[M], R = this.classifyVertex(_), L = this.classifyVertex(F), R != d && E.push(_), R != l && C.push(_), (R | L) == h && (S = (this.w - this.normal.dot(_)) / this.normal.dot(F.clone().subtract(_)), T = _.interpolate(F, S), E.push(T), C.push(T));
                3 <= E.length && v.push(new g.Polygon(E).calculateProperties()), 3 <= C.length && m.push(new g.Polygon(C).calculateProperties());
              }
            }, g.Vertex = function(p, u, y, v, m) {
              this.x = p, this.y = u, this.z = y, this.normal = v || new f.Vector3(), this.uv = m || new f.Vector2();
            }, g.Vertex.prototype.clone = function() {
              return new g.Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone());
            }, g.Vertex.prototype.add = function(p) {
              return this.x += p.x, this.y += p.y, this.z += p.z, this;
            }, g.Vertex.prototype.subtract = function(p) {
              return this.x -= p.x, this.y -= p.y, this.z -= p.z, this;
            }, g.Vertex.prototype.multiplyScalar = function(p) {
              return this.x *= p, this.y *= p, this.z *= p, this;
            }, g.Vertex.prototype.cross = function(p) {
              var u = this.x, y = this.y, v = this.z;
              return this.x = y * p.z - v * p.y, this.y = v * p.x - u * p.z, this.z = u * p.y - y * p.x, this;
            }, g.Vertex.prototype.normalize = function() {
              var p = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
              return this.x /= p, this.y /= p, this.z /= p, this;
            }, g.Vertex.prototype.dot = function(p) {
              return this.x * p.x + this.y * p.y + this.z * p.z;
            }, g.Vertex.prototype.lerp = function(p, u) {
              return this.add(p.clone().subtract(this).multiplyScalar(u)), this.normal.add(p.normal.clone().sub(this.normal).multiplyScalar(u)), this.uv.add(p.uv.clone().sub(this.uv).multiplyScalar(u)), this;
            }, g.Vertex.prototype.interpolate = function(p, u) {
              return this.clone().lerp(p, u);
            }, g.Vertex.prototype.applyMatrix4 = function(p) {
              var u = this.x, y = this.y, v = this.z, m = p.elements;
              return this.x = m[0] * u + m[4] * y + m[8] * v + m[12], this.y = m[1] * u + m[5] * y + m[9] * v + m[13], this.z = m[2] * u + m[6] * y + m[10] * v + m[14], this;
            }, g.Node = function(p) {
              var u, y, v = [], m = [];
              if (this.polygons = [], this.front = this.back = void 0, p instanceof Array && p.length !== 0) {
                for (this.divider = p[0].clone(), u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], this.polygons, this.polygons, v, m);
                0 < v.length && (this.front = new g.Node(v)), 0 < m.length && (this.back = new g.Node(m));
              }
            }, g.Node.isConvex = function(p) {
              var u, y;
              for (u = 0; u < p.length; u++) for (y = 0; y < p.length; y++) if (u !== y && p[u].classifySide(p[y]) !== d) return !1;
              return !0;
            }, g.Node.prototype.build = function(p) {
              var u, y, v = [], m = [];
              for (this.divider || (this.divider = p[0].clone()), u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], this.polygons, this.polygons, v, m);
              0 < v.length && (!this.front && (this.front = new g.Node()), this.front.build(v)), 0 < m.length && (!this.back && (this.back = new g.Node()), this.back.build(m));
            }, g.Node.prototype.allPolygons = function() {
              var p = this.polygons.slice();
              return this.front && (p = p.concat(this.front.allPolygons())), this.back && (p = p.concat(this.back.allPolygons())), p;
            }, g.Node.prototype.clone = function() {
              var p = new g.Node();
              return p.divider = this.divider.clone(), p.polygons = this.polygons.map(function(u) {
                return u.clone();
              }), p.front = this.front && this.front.clone(), p.back = this.back && this.back.clone(), p;
            }, g.Node.prototype.invert = function() {
              var p, u, y;
              for (p = 0, u = this.polygons.length; p < u; p++) this.polygons[p].flip();
              return this.divider.flip(), this.front && this.front.invert(), this.back && this.back.invert(), y = this.front, this.front = this.back, this.back = y, this;
            }, g.Node.prototype.clipPolygons = function(p) {
              var u, y, v, m;
              if (!this.divider) return p.slice();
              for (v = [], m = [], u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], v, m, v, m);
              return this.front && (v = this.front.clipPolygons(v)), m = this.back ? this.back.clipPolygons(m) : [], v.concat(m);
            }, g.Node.prototype.clipTo = function(p) {
              this.polygons = p.clipPolygons(this.polygons), this.front && this.front.clipTo(p), this.back && this.back.clipTo(p);
            }, g;
          };
        },
        /* 53 */
        /***/
        (o) => {
          o.exports = E4();
        },
        /* 54 */
        /***/
        (o) => {
          o.exports = N4;
        },
        /* 55 */
        /***/
        (o, a, c) => {
          var l = c(3).Geometry, d = c(4), h = d.BufferGeometryLoader;
          o.exports = function(f) {
            var g = void 0, p = function(w) {
              var A = new h(), M = A.parse(w), R = new d.MeshPhongMaterial(), L = new d.Mesh(M.geometry, R), _ = new l();
              return _.setMorph(L), _;
            }, u = function(w) {
              var A = p(w);
              g = new (c(56)).GeometryCSGInternal(A), f.postMessage({ action: "message", message: "Initialised" });
            }, y = function(w) {
              if (g) {
                var A = p(w), M = g.intersect(A), R = M.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: R });
              }
            }, v = function(w) {
              if (g) {
                var A = p(w), M = g.subtract(A), R = M.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: R });
              }
            }, m = function(w) {
              if (g) {
                var A = p(w), M = g.union(A), R = M.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: R });
              }
            };
            f.addEventListener("message", function(x) {
              switch (x.data.action) {
                case "initialise":
                  u(x.data.object);
                  break;
                case "intersect":
                  y(x.data.object);
                  break;
                case "subtract":
                  v(x.data.object);
                  break;
                case "union":
                  m(x.data.object);
                  break;
                default:
                  throw "Cannot handle specified action.";
              }
            });
          };
        },
        /* 56 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(52)(l);
          c(3).Geometry, c(51).GeometryCSG;
          var h = function(f) {
            var g;
            f && f.isGeometry && (g = f);
            var p;
            this.setGeometry = (y) => {
              y && y.isGeometry && (g = y), p = void 0;
            }, this.setCSG = (y) => {
              p = y;
            };
            var u = (y) => {
              if (g && g.morph && y && y.morph) {
                p === void 0 && (p = new d(g.morph));
                var v = new d(y.morph);
                return v;
              }
            };
            this.intersect = (y) => {
              var v = u(y);
              return p && v ? p.intersect(v) : void 0;
            }, this.subtract = (y) => {
              var v = u(y);
              return p && v ? p.subtract(v) : void 0;
            }, this.union = (y) => {
              var v = u(y);
              return p && v ? p.union(v) : void 0;
            };
          };
          a.GeometryCSGInternal = h;
        },
        /* 57 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(52)(l);
          c(18).Glyphset;
          var h = function(f) {
            var g;
            f && f.isGlyphset && (g = f);
            var p = [];
            this.setGlyphset = (v) => {
              v && v.isGlyphset && (g = v), hostCSG = void 0;
            }, this.getGlyphset = () => g;
            var u = () => (v) => {
              var m = v.getMesh(), x = v.getLabel();
              if (m) {
                var w = new d(m.geometry.clone().applyMatrix(m.matrix)), A = [];
                A.csg = w, A.label = x, m.material && (A.material = m.material.clone()), p.push(A);
              }
            }, y = (v) => {
              if (g && v && v.getMorph()) {
                p.length == 0 && g.forEachGlyph(u());
                var m = new d(v.getMorph());
                return m;
              }
            };
            this.intersect = (v) => {
              var m = y(v);
              if (0 < p.length && m) {
                for (var x = new (c(18)).Glyphset(), w = 0; w < p.length; w++) {
                  var A = p[w], M = A.csg.intersect(m), R = M.toMesh();
                  if (R && R.geometry && 0 < R.geometry.vertices.length) {
                    A.material && (R.material = A.material, R.material.side = l.DoubleSide, R.material.clippingPlanes = null);
                    var L = x.addMeshAsGlyph(R, w + 1);
                    L.setLabel(A.label);
                  }
                }
                var _ = new h(x);
                return _;
              }
            };
          };
          a.GlyphsetCSG = h;
        }
        /******/
      ], i = {};
      function r(o) {
        var a = i[o];
        if (a !== void 0)
          return a.exports;
        var c = i[o] = {
          /******/
          // no module.id needed
          /******/
          // no module.loaded needed
          /******/
          exports: {}
          /******/
        };
        return t[o].call(c.exports, c, c.exports, r), c.exports;
      }
      r.n = (o) => {
        var a = o && o.__esModule ? (
          /******/
          () => o.default
        ) : (
          /******/
          () => o
        );
        return r.d(a, { a }), a;
      }, r.d = (o, a) => {
        for (var c in a)
          r.o(a, c) && !r.o(o, c) && Object.defineProperty(o, c, { enumerable: !0, get: a[c] });
      }, r.o = (o, a) => Object.prototype.hasOwnProperty.call(o, a), r.r = (o) => {
        typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 });
      };
      var s = r(0);
      return s;
    })()
  ));
})(wy);
var Pr = wy.exports;
const Rc = /* @__PURE__ */ HC(Pr), Ai = {
  SELECTED_COLOUR: "#00ff00",
  HIGHLIGHTED_COLOUR: "#ff0000",
  DEFAULT_RADIUS: 1,
  DEFAULT_RADIAL_SEGMENTS: 8,
  ZOOM_RADIUS: 5,
  ZOOM_RADIAL_SEGMENTS: 12
}, Sv = (n, e) => {
  if (n) {
    let t = "";
    n.forEach((i) => {
      t = i.uuid, i.region && (t = i.region.uuid + "/" + t), i && i.getVisibility() && e.push(t);
    });
  }
  return e;
}, Id = (n, e) => {
  const t = n[0] - e[0], i = n[1] - e[1], r = n[2] - e[2];
  return Math.sqrt(t * t + i * i + r * r);
}, B4 = (n) => {
  const e = n.zincObjects;
  if (e.length > 0 && e[0]) {
    const t = e[0];
    if (t.isEditable && t.isLines2) {
      const i = n.identifiers[0].extraData.intersected;
      if (i && i.faceIndex > -1) {
        const r = t.getVerticesByFaceIndex(i.faceIndex), s = n.identifiers[0].extraData.intersected.pointOnLine;
        if (r.length > 1) {
          const o = Id(r[0], [s.x, s.y, s.z]), a = Id(r[1], [s.x, s.y, s.z]);
          return o > a ? { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2 + 1, point: r[0] } : { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2, point: r[1] };
        }
      }
    }
  }
}, U4 = (n) => {
  const e = n.zincObjects;
  if (e.length > 0 && e[0])
    return e[0];
}, z4 = (n) => {
  const e = n.zincObjects;
  if (e.length > 0 && e[0]) {
    const t = e[0];
    if (t.isEditable)
      return t;
  }
}, k4 = (n, e, t) => {
  if (n != null && n.isEditable && (n != null && n.isPointset)) {
    let i = !1;
    for (let r = 0; r < 3 && !i; r++)
      t[r] !== 0 && (i = !0);
    if (i && e > -1) {
      const r = n.getVerticesByIndex(e);
      return r && (r[0] = r[0] + t[0], r[1] = r[1] + t[1], r[2] = r[2] + t[2]), n.editVertices([r], e), n.boundingBoxUpdateRequired = !0, !0;
    }
  }
  return !1;
}, Mc = (n, e) => {
  if (n != null && n.isEditable && (n != null && n.isLines2) && e > -1) {
    const t = n.getVerticesByFaceIndex(e);
    if (t && t.length > 1)
      return Id(t[1], t[0]);
  }
  return 0;
}, Fh = (n, e, t, i) => {
  if (n && t !== 0 && n.isEditable && n.isLines2 && e > -1) {
    const r = n.getVerticesByFaceIndex(e);
    let s = [r[1][0] - r[0][0], r[1][1] - r[0][1], r[1][2] - r[0][2]];
    const o = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]);
    for (let a = 0; a < 3; a++)
      s[a] = s[a] / o * t, i ? r[1][a] = r[0][a] + s[a] : (r[0][a] = r[0][a] + s[a], r[1][a] = r[1][a] + s[a]);
    return n.editVertices(r, e * 2), n.boundingBoxUpdateRequired = !0, !0;
  }
  return !1;
}, V4 = (n, e) => {
  const t = e.getBoundingBox(), i = new Pr.THREE.Vector3().subVectors(t.max, t.min), r = new Pr.THREE.BoxGeometry(i.x, i.y, i.z);
  i.addVectors(t.min, t.max).multiplyScalar(0.5);
  const s = r.getAttribute("position"), o = s.count, a = [];
  for (let c = 0; c < o; c++)
    a[c] = [
      s.array[c * 3],
      s.array[c * 3 + 1],
      s.array[c * 3 + 2]
    ];
  n.editVertices(a, 0), n.setPosition(i.x, i.y, i.z), r.dispose();
}, bM = (n, e) => {
  let t = "";
  n.isRegion && (t = `__r${n.regionPath}`), n.isPrimitives && (t = `${n.regionPath}/${n.label}`), e.push(t), n.children && n.children.forEach((i) => bM(i, e));
}, xo = (n, e, t, i) => {
  let r = n;
  const s = [];
  if (t && (r = n.findChildFromPath(t)), r) {
    const o = Array.isArray(e);
    let a = e;
    o || (a = [a]), a.forEach((c) => {
      const l = r.findObjectsWithGroupName(c, i);
      s.push(...l);
    });
  }
  return s;
}, Od = (n, e, t) => {
  const i = n.findIndex((s) => s.uuid === e);
  let r;
  return i > -1 && (r = n[i], t && n.splice(i, 1)), r;
}, G4 = (n, e) => {
  const t = [];
  if (n && e && e.length > 0) {
    const i = {}, r = {}, s = [n, ...n.getChildRegions(!0)];
    let o, a, c;
    e.forEach((l) => {
      const d = l.split("/");
      c = d[0], o = Od(s, c, !1), o && (r[c] || (r[c] = o.getFullPath()), d[1] ? (i[c] || (i[c] = o.getAllObjects(!1)), a = Od(i[c], d[1], !0), a && t.push(`${r[c]}/${a.groupName}`)) : t.push(`__r/${r[c]}`));
    });
  }
  return t;
}, H4 = (n) => {
  if (n) {
    const e = [];
    return n.forEach((i) => {
      i.isZincObject ? e.push(i) : i.isRegion && e.push(...i.getAllObjects(!0));
    }), Object.values(
      e.reduce((i, r) => ({ ...i, [r.uuid]: r }), {})
    );
  }
  return [];
}, _v = (n, e) => {
  const t = { label: "Multiple selections", regionPath: "", objects: [] };
  if (e && n) {
    const i = {}, r = n.getRootRegion();
    e.length > 0 && (t.regionPath = e[0].data.region, t.label = e[0].data.group), e.forEach((s) => {
      s.data.region.includes(t.regionPath) || (t.regionPath = ""), t.label !== s.data.group && (t.label = "Multiple selections");
      const o = r.findChildFromPath(s.data.region);
      i[o.uuid] || (i[o.uuid] = o.getAllObjects(!1));
      const a = Od(i[o.uuid], s.data.uuid);
      a && t.objects.push(a);
    });
  }
  return t;
}, W4 = (n) => {
  const e = n.getMorph();
  let t = "position";
  n.isLines2 && (t = "instanceStart");
  const i = [];
  let r = 0;
  const s = e.geometry.getAttribute(t);
  for (let o = 0; o < n.drawRange; o++)
    i.push([
      s.array[r++],
      s.array[r++],
      s.array[r++]
    ]);
  return i;
}, xM = (n, e, t, i, r) => {
  let s;
  n.isPointset ? s = "MultiPoint" : n.isLines2 ? s = "MultiLineString" : s = "Feature";
  const o = s !== "Feature", a = s === "Feature" ? "Feature annotation" : "Drawn annotation";
  if (s) {
    const c = W4(n);
    let l = e.slice(-1) === "/" ? e : e + "/";
    l = l + t;
    const d = l, h = {
      resource: i,
      item: {
        id: d
      },
      body: {
        evidence: [],
        comment: r
      },
      feature: {
        id: d,
        properties: {
          drawn: o,
          label: a
        },
        geometry: {
          coordinates: c,
          type: s
        }
      }
    };
    return r === "Deleted" && (h.feature = void 0), h;
  }
}, Tv = (n, e, t, i, r, s, o) => {
  const a = xM(t, i, r, s, o);
  if (a)
    return n && n.currentUser && (a.creator = { ...n.currentUser }, a.creator.orcid || (a.creator.orcid = "0000-0000-0000-0000"), n.addAnnotation(e, a).then((c) => {
      c.annotationId || console.log("There is a problem with the submission, please try again later");
    }).catch(() => {
      console.log("There is a problem with the submission, please try again later");
    })), a;
}, Ev = async (n, e, t) => {
  const i = t;
  return await n.drawnFeatures(e, i);
}, Cv = (n, e) => {
  n && e.forEach((t) => {
    const i = t.geometry, r = decodeURIComponent(t.id), s = r.lastIndexOf("/"), o = r.substring(0, s), a = r.substring(s + 1);
    let c;
    i.type === "MultiPoint" ? c = n.createPoints(
      o,
      a,
      i.coordinates,
      a,
      8942
    ) : i.type === "MultiLineString" && (c = n.createLines(
      o,
      a,
      i.coordinates,
      60962
    )), c && (c.zincObject.isEditable = !0);
  });
}, pp = function(n) {
  const e = [];
  for (let t = 0; t < n.length; t++) {
    let i = n[t].userData;
    if (i)
      if (i.isGlyph || i.isGlyphset) {
        let r = i;
        i.isGlyph && (r = i.getGlyphset()), e.push(r);
      } else
        e.push(i);
  }
  return e;
}, j4 = {
  name: "LinesControls",
  components: {
    Button: Ko,
    Col: bi,
    Container: zi,
    InputNumber: fr,
    Main: dr,
    Slider: ti,
    ElIconArrowLeft: zr,
    ElIconArrowRight: kr
  },
  props: {
    createData: {
      type: Object
    },
    usageConfig: {
      type: Object
    }
  },
  data: function() {
    return {
      adjust: 0,
      pAdjust: 0,
      lengthScale: 0,
      distance: 0,
      newDistance: 0,
      width: 1,
      radius: Ai.DEFAULT_RADIUS,
      radialSegments: Ai.DEFAULT_RADIAL_SEGMENTS,
      currentIndex: 0,
      ElIconArrowLeft: En(zr),
      ElIconArrowRight: En(kr),
      edited: !1,
      zincObject: void 0,
      isTubeLines: !1
    };
  },
  computed: {
    showTubeLinesControls() {
      return this.usageConfig.showTubeLinesControls;
    }
  },
  watch: {
    "createData.faceIndex": {
      handler: function(n) {
        var e;
        (e = this.zincObject) != null && e.isLines2 && (this.currentIndex = n, this.distance = Mc(this.zincObject, this.currentIndex));
      },
      immediate: !0
    }
  },
  methods: {
    changeIndex: function(n) {
      n ? Mc(this.zincObject, this.currentIndex + 1) > 0 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset());
    },
    onLengthInput: function() {
      this.newDistance !== 0 ? (this.distance = this.newDistance, this.edited = Fh(
        this.zincObject,
        this.currentIndex,
        this.newDistance,
        !0
      ) || this.edited) : this.newDistance = this.distance;
    },
    onLengthSliding: function() {
      this.newDistance = Math.pow(10, this.lengthScale) * this.distance, this.edited = Fh(
        this.zincObject,
        this.currentIndex,
        this.newDistance,
        !0
      ) || this.edited;
    },
    onMoveSliding: function() {
      const n = (this.adjust - this.pAdjust) * this.distance;
      this.edited = Fh(
        this.zincObject,
        this.currentIndex,
        n,
        !1
      ) || this.edited, this.pAdjust = this.adjust;
    },
    reset: function() {
      this.adjust = 0, this.pAdjust = 0, this.lengthScale = 0, this.distance = Mc(this.zincObject, this.currentIndex), this.newDistance = this.distance, this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1);
    },
    setObject: function(n) {
      var e;
      this.currentIndex = -1, this.distance = 0, n.isLines2 || n.isTubeLines ? (this.zincObject = An(n), this.width = this.zincObject.getMorph().material.linewidth, this.isTubeLines = n.isTubeLines, n.isEditable ? (this.currentIndex = 0, this.distance = Mc(n, this.currentIndex)) : (e = n.userData) != null && e.isNerves && (this.radius = Ai.ZOOM_RADIUS, this.radialSegments = Ai.ZOOM_RADIAL_SEGMENTS)) : (this.zincObject = void 0, this.width = 10);
    },
    modifyWidth: function() {
      this.zincObject.setWidth(this.width);
    },
    modifyTubeLines: function() {
      this.zincObject.setTubeLines(this.radius, this.radius * this.radialSegments);
    }
  }
};
function $4(n, e, t, i, r, s) {
  const o = bi, a = ti, c = fr, l = Ui, d = Ko, h = dr, f = zi;
  return ve(), Ve(f, { class: "lines-container" }, {
    default: de(() => [
      le(h, { class: "slides-block" }, {
        default: de(() => [
          n.isTubeLines && s.showTubeLinesControls ? (ve(), Ce(Ft, { key: 0 }, [
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[15] || (e[15] = [
                    rt(" Radius: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 12
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.radius,
                      "onUpdate:modelValue": e[0] || (e[0] = (g) => n.radius = g),
                      class: "my-slider",
                      step: 1,
                      min: 1,
                      max: 32,
                      "show-tooltip": !1,
                      onInput: s.modifyTubeLines
                    }, null, 8, ["modelValue", "onInput"])
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: de(() => [
                    le(c, {
                      modelValue: n.radius,
                      "onUpdate:modelValue": e[1] || (e[1] = (g) => n.radius = g),
                      step: 1,
                      min: 1,
                      max: 32,
                      controls: !1,
                      onChange: s.modifyTubeLines,
                      class: "input-box number-input"
                    }, null, 8, ["modelValue", "onChange"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[16] || (e[16] = [
                    rt(" Radial Segments: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 12
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.radialSegments,
                      "onUpdate:modelValue": e[2] || (e[2] = (g) => n.radialSegments = g),
                      class: "my-slider",
                      step: 1,
                      min: 8,
                      max: 32,
                      "show-tooltip": !1,
                      onInput: s.modifyTubeLines
                    }, null, 8, ["modelValue", "onInput"])
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: de(() => [
                    le(c, {
                      modelValue: n.radialSegments,
                      "onUpdate:modelValue": e[3] || (e[3] = (g) => n.radialSegments = g),
                      step: 1,
                      min: 8,
                      max: 32,
                      controls: !1,
                      onChange: s.modifyTubeLines,
                      class: "input-box number-input"
                    }, null, 8, ["modelValue", "onChange"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 64)) : n.isTubeLines ? ke("", !0) : (ve(), Ve(l, { key: 1 }, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[17] || (e[17] = [
                  rt(" Width: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 12
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.width,
                    "onUpdate:modelValue": e[4] || (e[4] = (g) => n.width = g),
                    class: "my-slider",
                    step: 1,
                    min: 1,
                    max: 100,
                    "show-tooltip": !1,
                    onInput: s.modifyWidth
                  }, null, 8, ["modelValue", "onInput"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 4
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.width,
                    "onUpdate:modelValue": e[5] || (e[5] = (g) => n.width = g),
                    step: 1,
                    min: 1,
                    max: 100,
                    controls: !1,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          })),
          n.currentIndex > -1 && n.distance > 0 ? (ve(), Ce(Ft, { key: 2 }, [
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: de(() => [
                    le(d, {
                      size: "small",
                      disabled: n.currentIndex === 0,
                      icon: n.ElIconArrowLeft,
                      onClick: e[6] || (e[6] = (g) => s.changeIndex(!1))
                    }, null, 8, ["disabled", "icon"])
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 4,
                  span: 9
                }, {
                  default: de(() => [
                    rt(" Editing Line " + gt(n.currentIndex + 1), 1)
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 2,
                  span: 2
                }, {
                  default: de(() => [
                    le(d, {
                      size: "small",
                      icon: n.ElIconArrowRight,
                      onClick: e[7] || (e[7] = (g) => s.changeIndex(!0))
                    }, null, 8, ["icon"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[18] || (e[18] = [
                    rt(" Move: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.adjust,
                      "onUpdate:modelValue": e[8] || (e[8] = (g) => n.adjust = g),
                      step: 0.01,
                      min: -3,
                      max: 3,
                      "show-tooltip": !1,
                      onInput: e[9] || (e[9] = (g) => s.onMoveSliding()),
                      onChange: e[10] || (e[10] = (g) => s.reset())
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[19] || (e[19] = [
                    rt(" Length: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 10
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.lengthScale,
                      "onUpdate:modelValue": e[11] || (e[11] = (g) => n.lengthScale = g),
                      step: 0.01,
                      min: -1,
                      max: 1,
                      "show-tooltip": !1,
                      onInput: e[12] || (e[12] = (g) => s.onLengthSliding()),
                      onChange: e[13] || (e[13] = (g) => s.reset())
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => [
                    le(c, {
                      modelValue: n.newDistance,
                      "onUpdate:modelValue": e[14] || (e[14] = (g) => n.newDistance = g),
                      controls: !1,
                      class: "input-box number-input",
                      onChange: s.onLengthInput
                    }, null, 8, ["modelValue", "onChange"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 64)) : ke("", !0)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
const MM = /* @__PURE__ */ ki(j4, [["render", $4], ["__scopeId", "data-v-0deb177d"]]), Z4 = {
  name: "PointsControls",
  components: {
    Col: bi,
    Container: zi,
    InputNumber: fr,
    Main: dr,
    Select: qo,
    Slider: ti,
    Row: Ui,
    Option: Qo,
    ElIconArrowLeft: zr,
    ElIconArrowRight: kr
  },
  inject: ["boundingDims"],
  data: function() {
    return {
      attenuation: !1,
      size: 10,
      choices: [
        {
          value: !0,
          label: "On"
        },
        {
          value: !1,
          label: "off"
        }
      ],
      min: [0, 0, 0],
      max: [1, 1, 1],
      translation: [0, 0, 0],
      pTranslation: [0, 0, 0],
      currentIndex: -1,
      ElIconArrowLeft: En(zr),
      ElIconArrowRight: En(kr),
      edited: !1,
      zincObject: void 0
    };
  },
  watch: {
    boundingDims: {
      handler: function(n) {
        const e = n.size;
        this.min = [
          -e[0] / 2,
          -e[1] / 2,
          -e[2] / 2
        ], this.max = [
          e[0] / 2,
          e[1] / 2,
          e[2] / 2
        ];
      },
      immediate: !0,
      deep: !0
    }
  },
  methods: {
    changeIndex: function(n) {
      n ? this.zincObject.drawRange > this.currentIndex + 1 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset());
    },
    onMoveSliding: function() {
      const n = [
        this.translation[0] - this.pTranslation[0],
        this.translation[1] - this.pTranslation[1],
        this.translation[2] - this.pTranslation[2]
      ];
      this.edited = k4(this.zincObject, this.currentIndex, n) || this.edited;
      for (let e = 0; e < 3; e++)
        this.pTranslation[e] = this.translation[e];
    },
    reset: function() {
      this.translation = [0, 0, 0], this.pTranslation = [0, 0, 0], this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1);
    },
    setObject: function(n) {
      this.currentIndex = -1, n.isPointset ? (this.zincObject = An(n), this.size = this.zincObject.morph.material.size, this.attenuation = this.zincObject.morph.material.sizeAttenuation, n.isEditable && this.zincObject.drawRange > 0 && (this.currentIndex = 0)) : (this.zincObject = void 0, this.size = 10, this.attenuation = !1);
    },
    modifyAttenuation: function(n) {
      this.attenuation = n, this.zincObject.setSizeAttenuation(n);
    },
    modifySize: function() {
      this.zincObject.setSize(this.size);
    }
  }
};
function X4(n, e, t, i, r, s) {
  const o = bi, a = ti, c = fr, l = Ui, d = Qo, h = qo, f = Ko, g = dr, p = zi;
  return ve(), Ve(p, { class: "pointset-container" }, {
    default: de(() => [
      le(g, { class: "slides-block" }, {
        default: de(() => [
          le(l, null, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[15] || (e[15] = [
                  rt(" Size: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.size,
                    "onUpdate:modelValue": e[0] || (e[0] = (u) => n.size = u),
                    class: "my-slider",
                    step: 1,
                    min: 0,
                    max: 100,
                    "show-tooltip": !1,
                    onInput: e[1] || (e[1] = (u) => s.modifySize())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.size,
                    "onUpdate:modelValue": e[2] || (e[2] = (u) => n.size = u),
                    step: 1,
                    min: 0,
                    max: 100,
                    controls: !1,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          le(l, null, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 16
              }, {
                default: de(() => e[16] || (e[16] = [
                  rt(" Size attenuation: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 5
              }, {
                default: de(() => [
                  le(h, {
                    teleported: !1,
                    "model-value": n.attenuation,
                    placeholder: "Select",
                    class: "input-box",
                    "popper-class": "viewer_dropdown",
                    onChange: e[3] || (e[3] = (u) => s.modifyAttenuation(u, n.slide))
                  }, {
                    default: de(() => [
                      (ve(!0), Ce(Ft, null, Gn(n.choices, (u) => (ve(), Ve(d, {
                        key: u.value,
                        label: u.label,
                        value: u.value
                      }, null, 8, ["label", "value"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["model-value"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          n.currentIndex > -1 ? (ve(), Ce(Ft, { key: 0 }, [
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: de(() => [
                    le(f, {
                      size: "small",
                      disabled: n.currentIndex === 0,
                      icon: n.ElIconArrowLeft,
                      onClick: e[4] || (e[4] = (u) => s.changeIndex(!1))
                    }, null, 8, ["disabled", "icon"])
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 4,
                  span: 9
                }, {
                  default: de(() => [
                    rt(" Editing Point " + gt(n.currentIndex + 1), 1)
                  ]),
                  _: 1
                }),
                le(o, {
                  offset: 2,
                  span: 2
                }, {
                  default: de(() => [
                    le(f, {
                      size: "small",
                      icon: n.ElIconArrowRight,
                      onClick: e[5] || (e[5] = (u) => s.changeIndex(!0))
                    }, null, 8, ["icon"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[17] || (e[17] = [
                    rt(" x: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.translation[0],
                      "onUpdate:modelValue": e[6] || (e[6] = (u) => n.translation[0] = u),
                      step: 0.01,
                      min: n.min[0],
                      max: n.max[0],
                      "show-tooltip": !1,
                      onInput: e[7] || (e[7] = (u) => s.onMoveSliding()),
                      onChange: e[8] || (e[8] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[18] || (e[18] = [
                    rt(" y: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.translation[1],
                      "onUpdate:modelValue": e[9] || (e[9] = (u) => n.translation[1] = u),
                      step: 0.01,
                      min: n.min[1],
                      max: n.max[1],
                      "show-tooltip": !1,
                      onInput: e[10] || (e[10] = (u) => s.onMoveSliding()),
                      onChange: e[11] || (e[11] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            le(l, null, {
              default: de(() => [
                le(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: de(() => e[19] || (e[19] = [
                    rt(" z: ")
                  ])),
                  _: 1
                }),
                le(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: de(() => [
                    le(a, {
                      modelValue: n.translation[2],
                      "onUpdate:modelValue": e[12] || (e[12] = (u) => n.translation[2] = u),
                      step: 0.01,
                      min: n.min[2],
                      max: n.max[2],
                      "show-tooltip": !1,
                      onInput: e[13] || (e[13] = (u) => s.onMoveSliding()),
                      onChange: e[14] || (e[14] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 64)) : ke("", !0)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
const wM = /* @__PURE__ */ ki(Z4, [["render", X4], ["__scopeId", "data-v-d1de9c65"]]), Y4 = {
  name: "TextureSlidesControls",
  components: {
    Col: bi,
    Container: zi,
    Footer: dy,
    Icon: It,
    InputNumber: fr,
    Main: dr,
    Row: Ui,
    Select: qo,
    Slider: ti,
    Option: Qo,
    ElIconDelete: Nc,
    ElIconPlus: tu
  },
  data: function() {
    return {
      settings: [],
      directions: [
        {
          value: "x",
          label: "x"
        },
        {
          value: "y",
          label: "y"
        },
        {
          value: "z",
          label: "z"
        }
      ],
      zincObject: void 0
    };
  },
  methods: {
    setObject: function(n) {
      n.isTextureSlides ? (this.zincObject = An(n), this.settings = this.zincObject.getTextureSettings()) : (this.zincObject = void 0, this.settings = []);
    },
    addNewSlide: function() {
      const n = { direction: "x", value: 0 }, e = this.zincObject.createSlide(n);
      this.settings.push(e);
    },
    modifyDirection: function(n, e) {
      e && (e.direction = n, this.zincObject.modifySlideSettings(e));
    },
    modifySlide: function(n) {
      n && this.zincObject.modifySlideSettings(n);
    },
    removeSlide: function(n, e) {
      this.zincObject.removeSlideWithId(e.id), this.settings.splice(n, 1);
    }
  }
};
function J4(n, e, t, i, r, s) {
  const o = Qo, a = qo, c = bi, l = ti, d = fr, h = Nc, f = It, g = Ui, p = dr, u = tu, y = dy, v = zi;
  return ve(), Ve(v, { class: "t-slides-container" }, {
    default: de(() => [
      le(p, { class: "slides-block" }, {
        default: de(() => [
          (ve(!0), Ce(Ft, null, Gn(n.settings, (m, x) => (ve(), Ve(g, {
            key: m.id,
            class: "slide-row"
          }, {
            default: de(() => [
              le(c, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(a, {
                    teleported: !1,
                    "model-value": m.direction,
                    placeholder: "Select",
                    class: "input-box",
                    "popper-class": "viewer_dropdown",
                    onChange: (w) => s.modifyDirection(w, m)
                  }, {
                    default: de(() => [
                      (ve(!0), Ce(Ft, null, Gn(n.directions, (w) => (ve(), Ve(o, {
                        key: w.value,
                        label: w.label,
                        value: w.value
                      }, null, 8, ["label", "value"]))), 128))
                    ]),
                    _: 2
                  }, 1032, ["model-value", "onChange"])
                ]),
                _: 2
              }, 1024),
              le(c, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(l, {
                    modelValue: m.value,
                    "onUpdate:modelValue": (w) => m.value = w,
                    class: "my-slider",
                    step: 0.01,
                    min: 0,
                    max: 1,
                    "show-tooltip": !1,
                    onInput: (w) => s.modifySlide(m)
                  }, null, 8, ["modelValue", "onUpdate:modelValue", "onInput"])
                ]),
                _: 2
              }, 1024),
              le(c, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(d, {
                    modelValue: m.value,
                    "onUpdate:modelValue": (w) => m.value = w,
                    step: 0.01,
                    min: 0,
                    max: 1,
                    controls: !1,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue", "onUpdate:modelValue"])
                ]),
                _: 2
              }, 1024),
              le(c, {
                offset: 0,
                span: 2
              }, {
                default: de(() => [
                  le(f, {
                    class: "delete-icon",
                    onClick: (w) => s.removeSlide(x, m)
                  }, {
                    default: de(() => [
                      le(h)
                    ]),
                    _: 2
                  }, 1032, ["onClick"])
                ]),
                _: 2
              }, 1024)
            ]),
            _: 2
          }, 1024))), 128))
        ]),
        _: 1
      }),
      le(y, {
        height: "30px",
        class: "add-slides-text",
        onClick: s.addNewSlide
      }, {
        default: de(() => [
          le(g, null, {
            default: de(() => [
              le(c, { span: 2 }, {
                default: de(() => [
                  le(f, null, {
                    default: de(() => [
                      le(u)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }),
              le(c, { span: 20 }, {
                default: de(() => e[0] || (e[0] = [
                  rt(" Add a new slide ")
                ])),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["onClick"])
    ]),
    _: 1
  });
}
const AM = /* @__PURE__ */ ki(Y4, [["render", J4], ["__scopeId", "data-v-12185b7f"]]), K4 = {
  name: "TransformationControls",
  components: {
    Col: bi,
    Container: zi,
    InputNumber: fr,
    Main: dr,
    Slider: ti
  },
  inject: ["boundingDims"],
  data: function() {
    return {
      x: 0,
      y: 0,
      z: 0,
      scale: 1,
      min: [0, 0, 0],
      max: [1, 1, 1],
      zincObject: void 0,
      enableScaling: !0
    };
  },
  watch: {
    boundingDims: {
      handler: function(n) {
        const e = n.centre, t = n.size;
        this.min = [
          e[0] - t[0],
          e[1] - t[1],
          e[2] - t[2]
        ], this.max = [
          e[0] + t[0],
          e[1] + t[1],
          e[2] + t[2]
        ];
      },
      immediate: !0,
      deep: !0
    }
  },
  methods: {
    setObject: function(n) {
      if (n.isZincObject) {
        this.zincObject = An(n);
        const e = this.zincObject.getGroup(), t = this.zincObject.userData.originalPos;
        e && e.position && (this.x = e.position.x, this.y = e.position.y, this.z = e.position.z, this.zincObject.isGlyphset ? this.scale = this.zincObject.globalScale : this.scale = e.scale.x, this.enableScaling = !this.zincObject.isTextureSlides, t && this.boundingDims && (this.min = [
          t[0] - this.boundingDims.size[0],
          t[1] - this.boundingDims.size[1],
          t[2] - this.boundingDims.size[2]
        ], this.max = [
          t[0] + this.boundingDims.size[0],
          t[1] + this.boundingDims.size[1],
          t[2] + this.boundingDims.size[2]
        ]));
      } else
        this.zincObject = void 0, this.x = 0, this.y = 0, this.z = 0, this.scale = 1;
    },
    modifyPosition: function() {
      this.zincObject && this.zincObject.setPosition(this.x, this.y, this.z);
    },
    modifyScale: function() {
      this.zincObject.setScaleAll(this.scale);
    }
  }
};
function q4(n, e, t, i, r, s) {
  const o = bi, a = ti, c = fr, l = Ui, d = dr, h = zi;
  return ve(), Ve(h, { class: "transformation-container" }, {
    default: de(() => [
      le(d, { class: "slides-block" }, {
        default: de(() => [
          le(l, { class: "tool-row" }, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[16] || (e[16] = [
                  rt(" x: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.x,
                    "onUpdate:modelValue": e[0] || (e[0] = (f) => n.x = f),
                    step: 0.01,
                    min: n.min[0],
                    max: n.max[0],
                    "show-tooltip": !1,
                    onInput: e[1] || (e[1] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.x,
                    "onUpdate:modelValue": e[2] || (e[2] = (f) => n.x = f),
                    step: 0.01,
                    min: n.min[0],
                    max: n.max[0],
                    controls: !1,
                    class: "input-box number-input",
                    onChange: e[3] || (e[3] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          le(l, { class: "tool-row" }, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[17] || (e[17] = [
                  rt(" y: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.y,
                    "onUpdate:modelValue": e[4] || (e[4] = (f) => n.y = f),
                    step: 0.01,
                    min: n.min[1],
                    max: n.max[1],
                    "show-tooltip": !1,
                    onInput: e[5] || (e[5] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.y,
                    "onUpdate:modelValue": e[6] || (e[6] = (f) => n.y = f),
                    step: 0.01,
                    min: n.min[1],
                    max: n.max[1],
                    controls: !1,
                    class: "input-box number-input",
                    onChange: e[7] || (e[7] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          le(l, { class: "tool-row" }, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[18] || (e[18] = [
                  rt(" z: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.z,
                    "onUpdate:modelValue": e[8] || (e[8] = (f) => n.z = f),
                    step: 0.01,
                    min: n.min[2],
                    max: n.max[2],
                    "show-tooltip": !1,
                    onInput: e[9] || (e[9] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.z,
                    "onUpdate:modelValue": e[10] || (e[10] = (f) => n.z = f),
                    step: 0.01,
                    min: n.min[2],
                    max: n.max[2],
                    controls: !1,
                    class: "input-box number-input",
                    onChange: e[11] || (e[11] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          n.enableScaling ? (ve(), Ve(l, {
            key: 0,
            class: "tool-row"
          }, {
            default: de(() => [
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => e[19] || (e[19] = [
                  rt(" Scale: ")
                ])),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 10
              }, {
                default: de(() => [
                  le(a, {
                    modelValue: n.scale,
                    "onUpdate:modelValue": e[12] || (e[12] = (f) => n.scale = f),
                    step: 0.01,
                    min: 0,
                    max: 5,
                    "show-tooltip": !1,
                    onInput: e[13] || (e[13] = (f) => s.modifyScale())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              }),
              le(o, {
                offset: 0,
                span: 6
              }, {
                default: de(() => [
                  le(c, {
                    modelValue: n.scale,
                    "onUpdate:modelValue": e[14] || (e[14] = (f) => n.scale = f),
                    step: 0.01,
                    min: 0,
                    max: 5,
                    controls: !1,
                    class: "input-box number-input",
                    onChange: e[15] || (e[15] = (f) => s.modifyScale())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          })) : ke("", !0)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
const SM = /* @__PURE__ */ ki(K4, [["render", q4], ["__scopeId", "data-v-cd88ead8"]]), Q4 = {
  name: "OpacityControls",
  components: {
    Container: zi,
    Header: $L,
    Main: dr,
    Slider: ti
  },
  props: {
    material: void 0,
    zincObject: void 0
  },
  data: function() {
    return {
      displayString: "100%"
    };
  },
  watch: {
    "material.opacity": function() {
      this.material && this.zincObject && this.zincObject.setAlpha(this.material.opacity);
    }
  },
  methods: {
    formatTooltip(n) {
      return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString;
    }
  }
}, e5 = { class: "block" }, t5 = { class: "display" };
function n5(n, e, t, i, r, s) {
  const o = ti, a = zi;
  return t.material ? (ve(), Ve(a, {
    key: 0,
    class: "opacity-container"
  }, {
    default: de(() => [
      Ne("div", e5, [
        Ne("span", t5, gt(n.displayString), 1),
        le(o, {
          modelValue: t.material.opacity,
          "onUpdate:modelValue": e[0] || (e[0] = (c) => t.material.opacity = c),
          class: "my-slider",
          step: 0.01,
          min: 0,
          max: 1,
          "format-tooltip": s.formatTooltip,
          "show-tooltip": !1
        }, null, 8, ["modelValue", "format-tooltip"])
      ])
    ]),
    _: 1
  })) : ke("", !0);
}
const _M = /* @__PURE__ */ ki(Q4, [["render", n5], ["__scopeId", "data-v-cbfc46a5"]]), i5 = {
  name: "PrimitiveControls",
  components: {
    Collapse: oy,
    CollapseItem: ay,
    LinesControls: MM,
    OpacityControls: _M,
    PointsControls: wM,
    TextureSlidesControls: AM,
    TransformationControls: SM,
    ElIconArrowRight: kr
  },
  props: {
    createData: {
      type: Object
    },
    viewingMode: {
      type: String,
      default: "Exploration"
    },
    usageConfig: {
      type: Object
    }
  },
  data: function() {
    return {
      activeName: "oControls",
      material: void 0,
      isTextureSlides: !1,
      isPointset: !1,
      isLines: !1,
      drawerOpen: !0,
      zincObject: void 0,
      isEditable: !1,
      displayString: "100%"
    };
  },
  computed: {
    hasValidPrimitive: function() {
      return this.viewingMode === "Exploration" || this.viewingMode === "Annotation" ? this.material !== void 0 || this.isTextureSlides === !0 : !1;
    }
  },
  methods: {
    formatTooltip: function(n) {
      return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString;
    },
    toggleDrawer: function() {
      this.drawerOpen = !this.drawerOpen;
    },
    setObject: function(n) {
      var e, t;
      n ? this.zincObject = An(n) : this.zincObject = void 0, this.isEditable = !!((e = this.zincObject) != null && e.isEditable), this.isPointset = !1, this.isTextureSlides = !1, this.isLines = !1, this.activeName = "trControls", n && (n.isTextureSlides ? (this.isTextureSlides = !0, this.$refs.tSlidesControls.setObject(n), this.activeName = "tsControls") : n.isPointset ? (this.isPointset = !0, this.$refs.pointsetControls.setObject(n), this.activeName = "pControls") : (n.isLines2 || n.isTubeLines && ((t = this.usageConfig) != null && t.showTubeLinesControls)) && (this.isLines = !0, this.$refs.linesControls.setObject(n), this.activeName = "lControls"), this.$refs.transformationControls.setObject(n)), n && n.getMorph() ? this.material = n.getMorph().material : this.material = void 0;
    }
  }
};
function r5(n, e, t, i, r, s) {
  const o = _M, a = ay, c = SM, l = AM, d = wM, h = MM, f = oy, g = kr, p = It;
  return Lt((ve(), Ce("div", {
    class: Te(["primitive-controls", { open: n.drawerOpen, close: !n.drawerOpen }])
  }, [
    Ne("div", {
      class: Te(["my-drawer", { open: n.drawerOpen, close: !n.drawerOpen }])
    }, [
      le(f, {
        class: "collapse",
        modelValue: n.activeName,
        "onUpdate:modelValue": e[2] || (e[2] = (u) => n.activeName = u),
        accordion: ""
      }, {
        default: de(() => [
          Lt(le(a, {
            title: "Opacity",
            name: "oControls"
          }, {
            default: de(() => [
              le(o, {
                material: n.material,
                zincObject: n.zincObject,
                ref: "opacityControls"
              }, null, 8, ["material", "zincObject"])
            ]),
            _: 1
          }, 512), [
            [mn, !n.isTextureSlides]
          ]),
          Lt(le(a, {
            title: "Transformation",
            name: "trControls"
          }, {
            default: de(() => [
              le(c, {
                class: "transformation-controls",
                ref: "transformationControls"
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [mn, !n.isEditable]
          ]),
          Lt(le(a, {
            title: "Texture Slides",
            name: "tsControls"
          }, {
            default: de(() => [
              le(l, {
                class: "texture-controls",
                ref: "tSlidesControls"
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [mn, n.isTextureSlides]
          ]),
          Lt(le(a, {
            title: "Points",
            name: "pControls"
          }, {
            default: de(() => [
              le(d, {
                class: "pointset-controls",
                ref: "pointsetControls",
                onPrimitivesUpdated: e[0] || (e[0] = (u) => n.$emit("primitivesUpdated", u))
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [mn, n.isPointset]
          ]),
          Lt(le(a, {
            title: "Lines",
            name: "lControls"
          }, {
            default: de(() => [
              le(h, {
                class: "lines-controls",
                ref: "linesControls",
                createData: t.createData,
                usageConfig: t.usageConfig,
                onPrimitivesUpdated: e[1] || (e[1] = (u) => n.$emit("primitivesUpdated", u))
              }, null, 8, ["createData", "usageConfig"])
            ]),
            _: 1
          }, 512), [
            [mn, n.isLines]
          ])
        ]),
        _: 1
      }, 8, ["modelValue"])
    ], 2),
    Ne("div", {
      class: Te(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]),
      onClick: e[3] || (e[3] = (...u) => s.toggleDrawer && s.toggleDrawer(...u))
    }, [
      le(p, null, {
        default: de(() => [
          le(g)
        ]),
        _: 1
      })
    ], 2)
  ], 2)), [
    [mn, s.hasValidPrimitive]
  ]);
}
const TM = /* @__PURE__ */ ki(i5, [["render", r5], ["__scopeId", "data-v-83d11562"]]), s5 = (n, e) => {
  const t = n.label.toUpperCase(), i = e.label.toUpperCase();
  return t < i ? -1 : t > i ? 1 : 0;
}, o5 = {
  name: "ScaffoldTreeControls",
  components: {
    ElIconArrowLeft: zr,
    TreeControls: QM
  },
  props: {
    /**
     * Enable/disable colour picker
     */
    showColourPicker: Boolean,
    isReady: Boolean
  },
  data: function() {
    return {
      treeData: [
        { label: "Root", regionPath: "", id: void 0, children: [] }
      ],
      active: [],
      hover: [],
      drawerOpen: !0,
      nodeNumbers: 0,
      module: void 0
      //checkedRegions: [],
    };
  },
  computed: {
    treeDataEntry: function() {
      return this.treeData[0].children;
    }
  },
  watch: {
    treeDataEntry: {
      deep: !0,
      handler: function(n) {
        this.isReady && this.setColourField(n);
      }
    }
    /*
    checkedRegions: {
      deep: true,
      handler: function (data) {
        if (this.isReady) {
          this.$emit('checked-regions', data);
        }
      },
    },
    */
  },
  methods: {
    addTreeItem: function(n, e, t) {
      n.some((i) => i.label === e.label) || (Object.assign(e, { activeColour: this.getColour(e) }), n.push(e), n.sort((i, r) => s5(i, r)), this.nodeNumbers++, this.$nextTick(() => {
        !this.$refs.treeControls.$refs.regionTree.getCheckedKeys().includes(e.id) && t.getVisibility() && this.$refs.treeControls.$refs.regionTree.setChecked(e.id, !0);
      }));
    },
    // find or create new region, region id is always prefixed with
    // '__r/'
    findOrCreateRegion: function(n, e, t) {
      if (this.module && this.module.scene && (this.treeData[0].id = this.module.scene.getRootRegion().uuid, this.treeData[0].isRegion = !0), e.length > 0) {
        const i = [...e];
        let r = n.children.find(
          (a) => a.label == i[0]
        );
        const s = t + "/" + e[0], o = this.module.scene.getRootRegion().findChildFromPath(s);
        return r || (r = {
          label: i[0],
          id: o.uuid,
          children: [],
          regionPath: s,
          isRegion: !0
        }, this.addTreeItem(n.children, r, o), s === "/_helper" && this.$nextTick(() => {
          this.$refs.treeControls.$refs.regionTree.setChecked(r.id, !1);
        })), i.shift(), this.findOrCreateRegion(r, i, s);
      } else
        return n;
    },
    removeRegion: function(n) {
      if (this.treeData[0].children) {
        for (let e = 0; e < this.treeData[0].children.length; e++)
          if (this.treeData[0].children[e].label === n) {
            this.treeData[0].children.splice(e, 1), this.nodeNumbers--;
            return;
          }
      }
    },
    /**
     * This is called when a new zinc object is read into the scene.
     */
    zincObjectAdded: function(n) {
      const e = n.region;
      if (e) {
        const t = e.getFullSeparatedPath(), i = this.findOrCreateRegion(this.treeData[0], t, "");
        if (n.groupName && i) {
          i.children || (i.children = []);
          const r = {
            disabled: !1,
            label: n.groupName,
            id: e.uuid + "/" + n.uuid,
            isPrimitives: !0,
            regionPath: n.region.getFullPath(),
            isTextureSlides: !!n.isTextureSlides
          };
          this.addTreeItem(i.children, r, n);
        }
      }
    },
    zincObjectRemoved: function(n) {
      const e = n.groupName;
      if (n.region.findObjectsWithGroupName(e, !1).length === 0) {
        const i = n.region.getFullSeparatedPath(), r = this.findOrCreateRegion(this.treeData[0], i, "");
        if (r.children) {
          for (let s = 0; s < r.children.length; s++)
            if (r.children[s].label === e) {
              r.children.splice(s, 1), this.nodeNumbers--;
              return;
            }
        }
      }
    },
    checkChanged: function(n, e) {
      const t = n.isRegion, i = n.isPrimitives, r = e.checkedKeys.includes(n.id), s = this.module.scene.getRootRegion().findChildFromPath(n.regionPath);
      t && (r ? s.showAllPrimitives() : s.hideAllPrimitives()), i && s.findObjectsWithGroupName(n.label).forEach((a) => {
        const c = r && !n.disabled;
        a.setVisibility(c);
      });
    },
    updateActiveUI: function(n) {
      this.active.length = 0, Sv(n, this.active);
    },
    changeActiveByPrimitives: function(n, e) {
      n && n.length > 0 ? (this.updateActiveUI(n), this.$emit("object-selected", n, e)) : this.removeActive(e), this.removeHover(e);
    },
    updateHoverUI: function(n) {
      this.hover.length = 0, Sv(n, this.hover);
    },
    changeHoverByPrimitives: function(n, e) {
      n && n.length > 0 ? (this.updateHoverUI(n), this.$emit("object-hovered", n, e)) : this.removeHover(e);
    },
    /**
     * Select a region by its name.
     */
    changeActiveByNames: function(n, e, t) {
      const i = this.module.scene.getRootRegion(), r = xo(
        i,
        n,
        e,
        !0
      );
      this.changeActiveByPrimitives(r, t);
    },
    /**
     * Hover a region by its name.
     */
    changeHoverByNames: function(n, e, t) {
      const i = this.module.scene.getRootRegion(), r = xo(
        i,
        n,
        e,
        !0
      );
      this.changeHoverByPrimitives(r, t);
    },
    changeActiveByNode: function(n, e) {
      if (n.isPrimitives || n.isRegion) {
        const t = !!n.isRegion, i = this.getZincObjectsFromNode(n, t);
        this.changeActiveByPrimitives(i, e);
      }
    },
    changeHoverByNode: function(n, e) {
      if (n.isPrimitives) {
        const t = this.getZincObjectsFromNode(n, !1);
        this.changeHoverByPrimitives(t, e);
      }
    },
    /**
     * Unselect the current selected region.
     */
    removeActive: function(n) {
      this.active = [], this.$emit("object-selected", [], n);
    },
    /**
     * Unselect the current hover region.
     */
    removeHover: function(n) {
      this.hover = [], this.$emit("object-hovered", [], n);
    },
    /**
     * Reset the controls.
     */
    clear: function() {
      this.active.length = 0, this.hover.length = 0, this.nodeNumbers = 0, this.$refs.treeControls.$refs.regionTree.updateKeyChildren(
        this.treeData[0].id,
        []
      ), this.treeData[0].children.length = 0, this.treeData[0].id = void 0, this.$emit("object-selected", []);
    },
    forEachChildInNode: function(n, e, t, i, r) {
      if (n.isRegion) {
        if (n.children) {
          const s = t === "" || e.includes(n.id);
          n.children.forEach(
            (o) => this.forEachChildInNode(
              o,
              e,
              n.regionPath,
              i && s,
              r
            )
          );
        }
      } else n.isPrimitives && r(n, t, i);
    },
    getColour: function(n) {
      if (n) {
        let t = this.getZincObjectsFromNode(n, !1)[0];
        if (t) {
          let i = t.getColourHex();
          if (i) return "#" + i;
        }
      }
      return "#FFFFFF";
    },
    getNodeDataByRegionAndGroup: function(n, e) {
      for (const t of this.treeDataEntry)
        if (t.isRegion && t.label === n) {
          const i = t.children;
          for (const r of i)
            if (r.isPrimitives && r.label === e)
              return r;
        }
    },
    getZincObjectsFromNode: function(n, e) {
      const t = this.module.scene.getRootRegion();
      if (n.isPrimitives)
        return xo(
          t,
          n.label,
          n.regionPath,
          e
        );
      if (n.isRegion && n.regionPath) {
        let i = t.findChildFromPath(n.regionPath);
        if (i)
          return i.getAllObjects(e);
      }
      return [];
    },
    //Set this right at the beginning.
    setModule: function(n) {
      this.module = An(n), this.nodeNumbers = 0, this.module.scene.getRootRegion().getAllObjects(!0).forEach((t) => {
        this.zincObjectAdded(t);
      }), this.module.addOrganPartAddedCallback(this.zincObjectAdded), this.module.addOrganPartRemovedCallback(this.zincObjectRemoved);
    },
    setColourField: function(n, e = void 0) {
      n.filter((t) => e && !t.children ? t.id === e.id : !0).map((t) => {
        if (t.children)
          this.setColourField(t.children, e);
        else {
          const i = this.getColour(t);
          t.defaultColour || (t.defaultColour = i), t.activeColour = i;
        }
      });
    },
    setColour: function(n, e) {
      n && n.isPrimitives && this.getZincObjectsFromNode(n, !1).forEach((i) => {
        let s = (e || n.defaultColour).replace("#", "0x");
        i.setColourHex(s), this.setColourField(this.treeData[0].children, n);
      });
    },
    updateAllNodeColours: function() {
      const n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
      this.forEachChildInNode(
        this.treeData[0],
        n,
        "",
        !0,
        (e, t, i) => {
          e.isPrimitives && (e.activeColour = this.getColour(e));
        }
      );
    },
    setOutlines: function(n) {
      const e = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
      this.forEachChildInNode(
        this.treeData[0],
        e,
        "",
        !0,
        (t, i, r) => {
          const o = this.module.scene.getRootRegion().findChildFromPath(i).findObjectsWithGroupName(t.label);
          n ? o.forEach((a) => {
            a.isLines && (e.includes(t.id) && r && a.setVisibility(!0), t.disabled = !1);
          }) : t.isPrimitives && o.forEach((a) => {
            a.isLines && (a.setVisibility(!1), t.disabled = !0);
          });
        }
      );
    },
    visibilityToggle: function(n, e) {
      this.module.changeOrganPartsVisibility(n, e), e == !1 && (this.activeRegion === n && this.removeActive(!0), this.hoverRegion === n && this.removeHover(!0));
    },
    toggleDrawer: function() {
      this.drawerOpen = !this.drawerOpen, this.$emit("drawer-toggled", this.drawerOpen);
    },
    //Set visibility using full paths and add found id to the ids list
    //and remove item from list if remove is set to true.
    setTreeVisibilityWithFullPaths: function(n, e, t, i) {
      let r = !1, s = "";
      n.isRegion && (s = `__r${n.regionPath}`), n.isPrimitives && (s = `${n.regionPath}/${n.label}`);
      const o = e.indexOf(s);
      o > -1 && (r = !0, e.splice(o, 1), t.push(n.id));
      const a = this.module.scene.getRootRegion().findChildFromPath(n.regionPath);
      s && s !== "__r" && n.isPrimitives && a.findObjectsWithGroupName(n.label).forEach((l) => l.setVisibility(r)), n.children && n.children.forEach((c) => {
        this.setTreeVisibilityWithFullPaths(c, e, t, !0);
      });
    },
    setCheckedKeys: function(n, e) {
      this.$nextTick(() => {
        e && this.$refs.treeControls.$refs.regionTree.setCheckedKeys([]), n.forEach((t) => {
          this.$refs.treeControls.$refs.regionTree.setChecked(t, !0, !0);
        });
      });
    },
    checkAllKeys: function(n = []) {
      const e = [], t = [];
      bM(this.treeData[0], e);
      const i = e.filter((r) => !n.some((s) => r.includes(s)));
      this.setTreeVisibilityWithFullPaths(
        this.treeData[0],
        i,
        t,
        !0
      ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t);
    },
    getState: function() {
      let n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
      return n.length === this.nodeNumbers ? { checkAll: !0, version: "2.0" } : { checkedItems: G4(
        this.module.scene.getRootRegion(),
        n
      ), version: "2.0" };
    },
    setState: function(n) {
      if (n) {
        if (n.checkAll)
          this.checkAllKeys();
        else if (n.checkedItems) {
          let e = [];
          n.version !== "2.0" ? (e = n.checkedItems.map((i) => "/" + i), e.shift("__r/")) : e.push(...n.checkedItems);
          const t = [];
          this.setTreeVisibilityWithFullPaths(
            this.treeData[0],
            e,
            t,
            !0
          ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t);
        }
      }
    }
  }
}, a5 = { class: "traditional-container" };
function l5(n, e, t, i, r, s) {
  const o = Vn("TreeControls"), a = zr, c = It;
  return ve(), Ce("div", {
    class: Te(["tree-controls", { open: n.drawerOpen, close: !n.drawerOpen }])
  }, [
    Ne("div", a5, [
      le(o, {
        mapType: "scaffold",
        title: "Regions",
        isReady: t.isReady,
        treeData: s.treeDataEntry,
        active: n.active,
        hover: n.hover,
        showColourPicker: t.showColourPicker,
        onSetColour: s.setColour,
        onCheckChanged: s.checkChanged,
        onChangeActive: s.changeActiveByNode,
        onChangeHover: s.changeHoverByNode,
        ref: "treeControls",
        onMouseleave: e[0] || (e[0] = (l) => s.removeHover(!0))
      }, null, 8, ["isReady", "treeData", "active", "hover", "showColourPicker", "onSetColour", "onCheckChanged", "onChangeActive", "onChangeHover"])
    ]),
    Ne("div", {
      class: Te(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]),
      onClick: e[1] || (e[1] = (...l) => s.toggleDrawer && s.toggleDrawer(...l))
    }, [
      le(c, null, {
        default: de(() => [
          le(a)
        ]),
        _: 1
      })
    ], 2)
  ], 2);
}
const EM = /* @__PURE__ */ ki(o5, [["render", l5], ["__scopeId", "data-v-5394b615"]]), Dd = iw("main", {
  state: () => ({
    userProfile: {
      token: ""
    }
  }),
  getters: {
    userToken(n) {
      return n.userProfile.token;
    }
  },
  actions: {
    setUserToken(n) {
      this.userProfile.token = n;
    }
  }
}), c5 = {
  name: "ScaffoldTooltip",
  components: {
    Col: bi,
    CreateTooltipContent: ew,
    ElIconDelete: Nc,
    Icon: It,
    Popover: cu,
    Row: Ui,
    Tooltip: tw
  },
  props: {
    createData: {
      type: Object,
      default: {
        toBeConfirmed: !1,
        points: [],
        shape: "",
        x: 0,
        y: 0
      }
    },
    label: {
      type: String,
      default: ""
    },
    annotationDisplay: {
      type: Boolean,
      default: !1
    },
    annotationFeature: {
      type: Object,
      default: {}
    },
    offlineAnnotationEnabled: {
      type: Boolean,
      default: !1
    },
    region: {
      type: String,
      default: ""
    },
    visible: {
      type: Boolean,
      default: !1
    },
    x: {
      type: Number,
      default: 200
    },
    y: {
      type: Number,
      default: 200
    }
  },
  inject: ["scaffoldUrl"],
  provide() {
    return {
      userApiKey: this.userToken
    };
  },
  data: function() {
    return {
      display: !1,
      annotationEntry: [],
      ElIconDelete: En(Nc)
    };
  },
  computed: {
    ...Gv(Dd, ["userToken"]),
    position: function() {
      let n = 40;
      return this.region && (n = 55), { left: this.x - 40 + "px", top: this.y - n + "px" };
    }
  },
  methods: {
    checkForDisplay: function() {
      if (this.visible && this.label && this.label !== "") {
        if (this.display = !0, this.annotationDisplay) {
          const n = this.region ? this.region + "/" : "";
          this.annotationEntry = [{
            featureId: n + this.label,
            resourceId: this.scaffoldUrl,
            resource: this.scaffoldUrl,
            feature: this.annotationFeature,
            offline: this.offlineAnnotationEnabled
          }];
        }
      } else
        this.display = !1, this.annotationEntry = [];
    },
    hideTriggered: function() {
      this.$emit("tooltip-hide");
    }
  },
  watch: {
    label: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: !0
    },
    visible: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: !0
    },
    annotationDisplay: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: !0
    }
  }
}, u5 = { class: "tooltip-text" }, h5 = {
  key: 0,
  class: "tooltip-text"
}, d5 = {
  key: 1,
  class: "delete-container"
};
function f5(n, e, t, i, r, s) {
  const o = Vn("CreateTooltipContent"), a = Vn("Tooltip"), c = bi, l = Ko, d = Ui, h = cu;
  return ve(), Ce("div", {
    style: Rt(s.position),
    class: "region-tooltip"
  }, [
    le(h, {
      ref: "tooltip",
      visible: t.visible,
      placement: "top",
      "show-arrow": !1,
      teleported: !1,
      trigger: "manual",
      "popper-class": "tooltip-popper non-selectable",
      "virtual-triggering": "",
      onHide: s.hideTriggered
    }, {
      default: de(() => [
        Ne("div", u5, gt(t.label), 1),
        t.region ? (ve(), Ce("div", h5, "Region: " + gt(t.region), 1)) : ke("", !0),
        Lt(le(o, {
          createData: t.createData,
          onConfirmCreate: e[0] || (e[0] = (f) => n.$emit("confirm-create", f)),
          onCancelCreate: e[1] || (e[1] = (f) => n.$emit("cancel-create"))
        }, null, 8, ["createData"]), [
          [mn, t.createData.toBeConfirmed]
        ]),
        Lt(le(a, {
          class: "p-tooltip",
          ref: "annotationTooltip",
          annotationDisplay: !0,
          annotationEntry: n.annotationEntry,
          onAnnotation: e[2] || (e[2] = (f) => n.$emit("confirm-comment", f))
        }, null, 8, ["annotationEntry"]), [
          [mn, t.annotationDisplay && !t.createData.toBeConfirmed]
        ]),
        t.createData.toBeDeleted ? (ve(), Ce("div", d5, [
          le(d, null, {
            default: de(() => [
              le(c, { span: 10 }, {
                default: de(() => e[5] || (e[5] = [
                  rt("Delete this feature?")
                ])),
                _: 1
              }),
              le(c, { span: 7 }, {
                default: de(() => [
                  le(l, {
                    class: "delete-button",
                    icon: n.ElIconDelete,
                    onClick: e[3] || (e[3] = (f) => n.$emit("confirm-delete"))
                  }, {
                    default: de(() => e[6] || (e[6] = [
                      rt(" Delete ")
                    ])),
                    _: 1
                  }, 8, ["icon"])
                ]),
                _: 1
              }),
              le(c, { span: 6 }, {
                default: de(() => [
                  le(l, {
                    class: "delete-button",
                    onClick: e[4] || (e[4] = (f) => n.$emit("cancel-create"))
                  }, {
                    default: de(() => e[7] || (e[7] = [
                      rt(" Dismiss ")
                    ])),
                    _: 1
                  })
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ])) : ke("", !0)
      ]),
      _: 1
    }, 8, ["visible", "onHide"])
  ], 4);
}
const CM = /* @__PURE__ */ ki(c5, [["render", f5], ["__scopeId", "data-v-d3f76b72"]]), Qa = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 }, p5 = function(n, e, t) {
  this.eventType = n, this.identifiers = e, this.zincObjects = t;
}, m5 = function(n, e, t) {
  this.targetedID = [];
  const i = n, r = e;
  this.targetEventType = t;
  const s = this;
  t === void 0 && (this.targetEventType = Qa.ALL), this.getEventType = function() {
    return t;
  }, this.notify = function(o, a, c, l) {
    if (o !== i && (s.targetEventType === Qa.ALL || s.targetEventType === a)) {
      const d = new p5(a, c, l);
      r(d);
    }
  };
}, g5 = function() {
  const n = [];
  this.publish = function(e, t, i, r) {
    for (let s = 0; s < n.length; s++)
      n[s].notify(e, t, i, r);
  }, this.subscribe = function(e, t, i) {
    if (typeof t == "function") {
      const r = new m5(e, t, i);
      return n.push(r), r;
    }
  }, this.unsubscribe = function(e) {
    for (let t = 0; t < n.length; t++)
      if (e === n[t]) {
        n.splice(t, 1);
        return;
      }
  };
}, Lv = {
  isWebGLAvailable: function() {
    try {
      var n = document.createElement("canvas");
      return !!(window.WebGLRenderingContext && (n.getContext("webgl") || n.getContext("experimental-webgl")));
    } catch {
      return !1;
    }
  },
  isWebGL2Available: function() {
    try {
      var n = document.createElement("canvas");
      return !!(window.WebGL2RenderingContext && n.getContext("webgl2"));
    } catch {
      return !1;
    }
  },
  getWebGLErrorMessage: function() {
    return this.getErrorMessage(1);
  },
  getWebGL2ErrorMessage: function() {
    return this.getErrorMessage(2);
  },
  getErrorMessage: function(n) {
    var e = {
      1: "WebGL",
      2: "WebGL 2"
    }, t = {
      1: window.WebGLRenderingContext,
      2: window.WebGL2RenderingContext
    }, i = 'This module requires <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#008">$1</a> support but your $0 does not seem to support it.', r = document.createElement("div");
    return r.id = "webglmessage", r.style.fontFamily = "monospace", r.style.fontSize = "20px", r.style.fontWeight = "normal", r.style.textAlign = "center", r.style.background = "#fff", r.style.color = "#000", r.style.padding = "1.5em", r.style.width = "400px", r.style.margin = "5em auto 0", t[n] ? i = i.replace("$0", "graphics card") : i = i.replace("$0", "browser"), i = i.replace("$1", e[n]), r.innerHTML = i, r;
  }
}, mp = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 }, Xn = function() {
  this.typeName = "Base Module", this.instanceName = "default", this.onChangedCallbacks = [], this.eventNotifiers = [];
};
Xn.prototype.setName = function(n) {
  if (n && this.instanceName !== n) {
    this.instanceName = n;
    const e = this.onChangedCallbacks.slice();
    for (let t = 0; t < e.length; t++)
      e[t](this, mp.NAME_CHANGED);
  }
};
Xn.prototype.settingsChanged = function() {
  const n = this.onChangedCallbacks.slice();
  for (let e = 0; e < n.length; e++)
    n[e](this, mp.SETTINGS_CHANGED);
};
Xn.prototype.exportSettings = function() {
  const n = {};
  return n.dialog = this.typeName, n.name = this.instanceName, n;
};
Xn.prototype.importSettings = function(n) {
  return n.dialog == this.typeName ? (this.setName(n.name), !0) : !1;
};
Xn.prototype.publishChanges = function(n, e, t) {
  for (let i = 0; i < this.eventNotifiers.length; i++)
    this.eventNotifiers[i].publish(this, e, n, t);
};
Xn.prototype.getName = function() {
  return this.instanceName;
};
Xn.prototype.destroy = function() {
  const n = this.onChangedCallbacks.slice();
  for (let e = 0; e < n.length; e++)
    n[e](this, mp.DESTROYED);
  delete this;
};
Xn.prototype.addChangedCallback = function(n) {
  this.onChangedCallbacks.includes(n) == !1 && this.onChangedCallbacks.push(n);
};
Xn.prototype.removeChangedCallback = function(n) {
  const e = this.onChangedCallbacks.indexOf(n);
  e > -1 && this.onChangedCallbacks.splice(e, 1);
};
Xn.prototype.addNotifier = function(n) {
  this.eventNotifiers.push(n);
};
const wc = (n, e, t) => {
  for (let i = 0; i < n.length; i++)
    if (n[i] && n[i].material && n[i].material.emissive) {
      let r = n[i].userData;
      r && r.isZincObject ? r.setEmissiveRGB(e) : n[i].material && n[i].material.emissive && n[i].material.emissive.setRGB(...e), t && n[i].material.depthFunc && (n[i].material.depthFunc = Pr.THREE.LessEqualDepth), n[i].children.forEach((s) => {
        const o = s.userData;
        o && o.isZincObject && s.material && s.material.emissive && s.material.emissive.setRGB(...e);
      });
    }
}, v5 = function() {
  let n = [], e = [];
  this.highlightColour = [1, 0, 0], this.selectColour = [0, 1, 0], this.originalColour = [0, 0, 0];
  const t = [], i = [], r = this, s = function(c, l) {
    if (c.length == 0 && l.length == 0)
      return !1;
    for (let d = 0; d < c.length; d++) {
      let h = !1;
      for (let f = 0; f < l.length; f++)
        c[d] === l[f] && (h = !0);
      if (!h)
        return !0;
    }
    for (let d = 0; d < l.length; d++) {
      let h = !1;
      for (let f = 0; f < c.length; f++)
        l[d] === c[f] && (h = !0);
      if (!h)
        return !0;
    }
    return !1;
  }, o = function(c, l) {
    if (t.length = 0, l.length == 0)
      return c;
    for (let d = 0; d < c.length; d++) {
      let h = !1;
      for (let f = 0; f < l.length; f++)
        c[d] === l[f] && (h = !0);
      h || t.push(c[d]);
    }
    return t;
  };
  this.setHighlighted = function(c) {
    const l = [...n];
    this.setNervesStyle(l), r.resetHighlighted();
    const d = o(c, e), h = a(d);
    return this.setNervesStyle(d, Ai.HIGHLIGHTED_COLOUR), wc(h, r.highlightColour, !1), n = d, s(n, l);
  }, this.setSelected = function(c) {
    const l = [...e];
    this.setNervesStyle(l), r.resetHighlighted(), r.resetSelected();
    const d = a(c);
    return this.setNervesStyle(c, Ai.SELECTED_COLOUR), wc(d, r.selectColour, !1), e = c, s(e, l);
  };
  const a = function(c) {
    i.length = 0;
    for (let l = 0; l < c.length; l++)
      c[l].material && i.push(c[l]);
    return i;
  };
  this.setNervesStyle = function(c, l) {
    const d = pp(c);
    if (d && d.length) {
      const h = l ? Ai.ZOOM_RADIUS : Ai.DEFAULT_RADIUS, f = l ? Ai.ZOOM_RADIAL_SEGMENTS : Ai.DEFAULT_RADIAL_SEGMENTS;
      d.forEach((g) => {
        var p, u, y;
        if (g.isTubeLines && ((p = g.userData) != null && p.isNerves) && !((u = g.userData) != null && u.isGreyScale)) {
          g.setTubeLines(h, f);
          let v = l || ((y = g.userData) == null ? void 0 : y.defaultColour);
          v = v.replace("#", "0x"), g.setColourHex(v);
        }
      });
    }
  }, this.resetHighlighted = function() {
    const c = a(n);
    this.setNervesStyle(n), wc(c, r.originalColour, !0), n = [];
  }, this.resetSelected = function() {
    const c = a(e);
    this.setNervesStyle(n), wc(c, r.originalColour, !0), e = [];
  }, this.getSelected = function() {
    return e;
  }, this.reset = function() {
    r.resetSelected(), r.resetHighlighted();
  };
}, gp = Rc.THREE, y5 = function() {
  const n = document.createElement("div");
  let e;
  if (n.style.height = "100%", Lv.isWebGLAvailable())
    e = new Rc.Renderer(n, window), Rc.defaultMaterialColor = 16777116, e.initialiseVisualisation(), e.playAnimation = !1;
  else {
    const t = Lv.getWebGLErrorMessage();
    n.appendChild(t);
  }
  return { Zinc: Rc, renderer: e, container: n };
}, Kt = function() {
  Xn.call(this), this.scene = void 0, this.rendererContainer = void 0, this.displayArea = void 0, this.graphicsHighlight = new v5(), this.selectObjectOnPick = !0, this.zincRenderer = null, this.selectedScreenCoordinates = new gp.Vector3(), this.selectedCenter = void 0, this.liveUpdatesObjects = void 0, this.ignorePreviousSelected = !1;
};
Kt.prototype = Object.create(Xn.prototype);
Kt.prototype.getIntersectedObject = function(n) {
  if (n) {
    const e = n.map((i) => {
      if (i && i.object && i.object.userData) {
        if (i.object.userData.isMarker)
          return 1;
        if (i.object.name && i.object.userData.isZincObject)
          return i.object.name === "_Unnamed" ? 3 : 2;
      }
      return 0;
    });
    let t = e.indexOf(1);
    return t > -1 || (t = e.indexOf(2), t = t > -1 ? t : e.indexOf(3)), n[t];
  }
};
Kt.prototype.getAnnotationsFromObjects = function(n) {
  const e = [];
  for (var t = 0; t < n.length; t++) {
    const i = n[t].userData;
    let r;
    if (i) {
      if (i.isGlyph || i.isGlyphset) {
        let s = i;
        i.isGlyph && (s = i.getGlyphset()), r = s.userData ? s.userData.annotation : void 0, r && r.data && (n[t].name && n[t].name != "" ? r.data.id = n[t].name : r.data.id = s.groupName);
      } else
        r = i.userData ? i.userData.annotation : void 0, r && r.data && (r.data.id = n[t].name);
      r && (r.data.anatomicalId = i.anatomicalId, r.data.isNerves = i.userData.isNerves, r.data.zincObject = i);
    }
    r && e.push(r);
  }
  return e;
};
Kt.prototype.setHighlightedByObjects = function(n, e, t, i) {
  const r = pp(n), s = this.graphicsHighlight.setHighlighted(n);
  if (i) {
    let o = Qa.MOVE;
    s && (o = Qa.HIGHLIGHTED);
    const a = this.getAnnotationsFromObjects(n);
    a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, r);
  }
  return s;
};
Kt.prototype.setHighlightedByZincObjects = function(n, e, t, i) {
  let r = [];
  return n && n.forEach((s) => {
    s && s.getMorph() && r.push(s.getMorph());
  }), this.setHighlightedByObjects(r, e, t, i);
};
Kt.prototype.setupLiveCoordinates = function(n) {
  if (this.liveUpdatesObjects = n, n && n.length > 0) {
    const e = this.scene.getBoundingBoxOfZincObjects(n);
    let t = new gp.Vector3();
    e ? (e.getCenter(t), this.selectedCenter == null ? this.selectedCenter = t : this.selectedCenter.copy(t)) : this.selectedCenter = void 0;
  } else
    this.selectedCenter = void 0;
};
Kt.prototype.setSelectedByObjects = function(n, e, t, i) {
  let r = !1;
  if (this.selectObjectOnPick ? r = this.graphicsHighlight.setSelected(n) : r = !0, r || this.ignorePreviousSelected) {
    const s = pp(n);
    if (this.selectObjectOnPick && this.setupLiveCoordinates(s), i) {
      const o = Qa.SELECTED, a = this.getAnnotationsFromObjects(n);
      a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s);
    }
  }
  return r;
};
Kt.prototype.setSelectedByZincObjects = function(n, e, t, i) {
  let r = [];
  return n && n.forEach((s) => {
    if (s) {
      const o = s.getMorph();
      o && r.push(o);
    }
  }), this.setSelectedByObjects(r, e, t, i);
};
Kt.prototype.findObjectsByGroupName = function(n) {
  return this.scene.findObjectsWithGroupName(n);
};
Kt.prototype.setHighlightedByGroupName = function(n, e) {
  const t = this.findObjectsByGroupName(n);
  return this.setHighlightedByObjects(t, void 0, {}, e);
};
Kt.prototype.setSelectedByGroupName = function(n, e) {
  const t = this.findObjectsByGroupName(n);
  return this.setSelectedByObjects(t, void 0, {}, e);
};
Kt.prototype.changeBackgroundColour = function(n) {
  const e = new gp.Color(n);
  this.zincRenderer && this.zincRenderer.getThreeJSRenderer().setClearColor(e, 1);
};
Kt.prototype.resetView = function() {
  this.zincRenderer && this.zincRenderer.resetView();
};
Kt.prototype.viewAll = function() {
  this.zincRenderer && this.zincRenderer.viewAll();
};
Kt.prototype.playAnimation = function(n) {
  this.zincRenderer && (this.zincRenderer.playAnimation = n);
};
Kt.prototype.setPlayRate = function(n) {
  this.zincRenderer && this.zincRenderer.setPlayRate(n);
};
Kt.prototype.getPlayRate = function(n) {
  return this.zincRenderer ? this.zincRenderer.getPlayRate() : 0;
};
Kt.prototype.initialiseRenderer = function(n) {
  if (this.zincRenderer === void 0 || this.rendererContainer === void 0) {
    let e = y5();
    this.Zinc = e.Zinc, this.zincRenderer = e.renderer, this.rendererContainer = e.container;
  }
  n && (this.displayArea = n, this.displayArea.appendChild(this.rendererContainer), this.zincRenderer && this.zincRenderer.animate());
};
Kt.prototype.destroy = function() {
  this.zincRenderer && (this.zincRenderer.dispose(), this.zincRenderer.getThreeJSRenderer().dispose(), this.zincRenderer = void 0), Xn.prototype.destroy.call(this);
};
const b5 = function() {
  this.type = "anatomical", this.data = void 0, this.isAnnotation = !0;
}, x5 = function() {
  this.currentName = "", this.currentSystem = "", this.currentPart = "", this.currentSpecies = "", this.metaURL = "", this.viewURL = "", this.timeVarying = !1, this.currentTime = 0;
}, LM = function(n) {
  Kt.call(this);
  const e = this;
  let t;
  this.sceneData = new x5();
  const i = new Array(), r = new Array(), s = new Array(), o = new Array();
  let a, c;
  const l = n;
  this.NDCCameraControl = void 0, e.typeName = "Organ Viewer";
  let d = !1;
  this.isIgnorePicking = function() {
    return d;
  }, this.setIgnorePicking = function(S) {
    d = S;
  }, this.getSceneData = function() {
    return e.sceneData;
  }, this.updateTime = function(S) {
    let T = 6e3;
    e.scene && (T = e.scene.getDuration());
    const E = S / 100 * T;
    e.sceneData.nerveMapIsActive || e.scene && e.scene.setMorphsTime(E), e.sceneData.currentTime = S;
  };
  const h = function() {
    let S = 3e3;
    e.scene && (S = e.scene.getDuration());
    const T = e.zincRenderer.getCurrentTime();
    for (let E = 0; E < i.length; E++)
      i[E](T);
    !e.sceneData.nerveMapIsActive && t && t.setMorphsTime(T), e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setTime(T / S), e.sceneData.currentTime = T / S * 100;
  };
  this.getCurrentTime = function() {
    return e.sceneData.currentTime;
  }, this.toggleSyncControl = (S, T) => {
    let E = this.scene.getZincCameraControls();
    S ? (E.resetView(), this.NDCCameraControl = E.enableSyncControl(), E.setRotationMode(T)) : (E.disableSyncControl(), this.NDCCameraControl = void 0, E.setRotationMode("free"));
  }, this.isSyncControl = () => this.NDCCameraControl !== void 0, this.setSyncControlZoomToBox = (S) => {
    this.NDCCameraControl && this.NDCCameraControl.zoomToBox(S, 2);
  }, this.setSyncControlCallback = (S) => {
    this.NDCCameraControl && this.NDCCameraControl.setEventCallback(S);
  }, this.setSyncControlCenterZoom = (S, T) => {
    this.NDCCameraControl && this.NDCCameraControl.setCenterZoom(S, T);
  };
  const f = function() {
    if (e.zincRenderer.playAnimation && e.liveUpdatesObjects && e.setupLiveCoordinates(e.liveUpdatesObjects), e.selectedCenter) {
      const S = new Pr.THREE.Vector3();
      S.copy(e.selectedCenter);
      const T = e.scene.vectorToScreenXY(S);
      e.selectedScreenCoordinates.x = T.x, e.selectedScreenCoordinates.y = T.y;
    }
  }, g = function() {
    return function() {
      h();
    };
  }, p = function() {
    return function() {
      f();
    };
  };
  this.addTimeChangedCallback = function(S) {
    i.push(S);
  }, this.setTexturePos = function(S) {
    e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setSliderPos(S);
  }, this.addSceneChangedCallback = function(S) {
    r.push(S);
  }, this.addOrganPartAddedCallback = function(S) {
    s.push(S);
  }, this.addOrganPartRemovedCallback = function(S) {
    o.push(S);
  }, this.setFinishDownloadCallback = function(S) {
    a = S;
  }, this.unsetFinishDownloadCallback = function() {
    a = void 0;
  }, this.setDownloadErrorCallback = function(S) {
    c = S;
  }, this.unsetDownloadErrorCallback = function() {
    c = void 0;
  }, this.getNamedObjectsToScreenCoordinates = function(S, T) {
    const E = new Pr.THREE.Vector3();
    E.setFromMatrixPosition(obj.matrixWorld);
    const C = width / 2, P = height / 2;
    return E.project(T), E.x = E.x * C + C, E.y = -(E.y * P) + P, E;
  };
  const u = function(S) {
    let T, E;
    if (S !== void 0) {
      let C = !1;
      S.object.userData && S.object.userData.isMarker ? (C = !0, E = S.object.userData.parent.getMorph()) : E = S.object;
      try {
        E.userData.userData.annotation.data.lastActionOnMarker = C;
      } finally {
      }
      if (E)
        if (E.name)
          T = E.name;
        else {
          const P = e.getAnnotationsFromObjects(
            [E]
          );
          P && P[0] && (T = P[0].data.group);
        }
    }
    return { id: T, object: E };
  }, y = function() {
    return function(S, T, E) {
      var D;
      const C = e.getIntersectedObject(S), P = u(C), b = {
        worldCoords: [
          C ? C.point.x : 0,
          C ? C.point.y : 0,
          C ? C.point.z : 0
        ],
        intersected: C,
        intersects: S
      }, I = { x: T, y: E };
      if (P.id) {
        b.threeID = (D = P.object) == null ? void 0 : D.id, P.object.userData.isGlyph ? P.object.name ? e.setSelectedByObjects(
          [P.object],
          I,
          b,
          !0
        ) : e.setSelectedByZincObjects(
          P.object.userData.getGlyphset(),
          I,
          b,
          !0
        ) : e.setSelectedByObjects([P.object], I, b, !0);
        return;
      } else {
        if (d) return;
        e.setSelectedByObjects([], I, b, !0);
      }
    };
  }, v = function() {
    return function(S, T, E) {
      var D;
      const C = e.getIntersectedObject(S), P = u(C), b = {
        worldCoords: [
          C ? C.point.x : 0,
          C ? C.point.y : 0,
          C ? C.point.z : 0
        ]
      }, I = { x: T, y: E };
      if (P.id) {
        b.threeID = (D = P.object) == null ? void 0 : D.id, e.displayArea.style.cursor = "pointer", e.setHighlightedByObjects([P.object], I, b, !0);
        return;
      } else
        e.displayArea.style.cursor = "auto", e.setHighlightedByObjects([], I, b, !0);
    };
  }, m = function(S, T, E, C) {
    if (C == "all" || C == "geometries") {
      const P = S.findGeometriesWithGroupName(T);
      for (let b = 0; b < P.length; b++)
        P[b].setVisibility(E);
    }
    if (C == "all" || C == "glyphsets") {
      const P = S.findGlyphsetsWithGroupName(T);
      for (let b = 0; b < P.length; b++)
        P[b].setVisibility(E);
    }
    if (C == "all" || C == "pointsets") {
      const P = S.findPointsetsWithGroupName(T);
      for (let b = 0; b < P.length; b++)
        P[b].setVisibility(E);
    }
    if (C == "all" || C == "lines") {
      const P = S.findLinesWithGroupName(T);
      for (let b = 0; b < P.length; b++)
        P[b].setVisibility(E);
    }
  };
  this.changeGeometriesVisibility = function(S, T) {
    m(e.scene, S, T, "geometries");
  }, this.changeGlyphsetsVisibility = function(S, T) {
    m(e.scene, S, T, "glyphsets");
  }, this.changeLinesVisibility = function(S, T) {
    m(e.scene, S, T, "lines");
  }, this.changePointsetsVisibility = function(S, T) {
    m(e.scene, S, T, "pointsets");
  }, this.changeOrganPartsVisibility = function(S, T, E) {
    let C = "all";
    E !== void 0 && (C = E), m(e.scene, S, T, C);
  }, this.changeOrganPartsVisibilityCallback = function(S) {
    return function(T) {
      e.changeOrganPartsVisibility(S, T);
    };
  }, this.changeBackgroundColour = function(S) {
    const T = new Pr.THREE.Color(S);
    e.zincRenderer && e.zincRenderer.getThreeJSRenderer().setClearColor(T, 1);
  };
  const x = function(S, T, E, C) {
    for (let I = 0; I < s.length; I++)
      s[I](C, e.scene.isTimeVarying());
    const P = new b5(), b = C.region.getFullPath();
    P.data = {
      species: e.sceneData.currentSpecies,
      system: S,
      part: T,
      group: C.groupName,
      region: b,
      uuid: C.uuid,
      lastActionOnMarker: !1
    }, C.userData.annotation = P;
  }, w = function(S, T, E, C) {
    for (let P = 0; P < o.length; P++)
      o[P](C);
  }, A = function(S, T, E) {
    return function(C) {
      x(S, T, E, C);
    };
  }, M = function(S, T, E) {
    return function(C) {
      w(S, T, E, C);
    };
  }, R = function() {
    return function() {
      e.settingsChanged(), e.sceneData.timeVarying = e.scene.isTimeVarying(), a && a();
    };
  }, L = function() {
    return function(S) {
      if ((S == null ? void 0 : S.type) === "Error" && c) {
        const T = {
          xhr: S.xhr,
          type: "download-error"
        };
        c(T);
      }
    };
  };
  this.updateFieldvisibility = function(S, T) {
    for (let E = 0; E < S.length; E++)
      if (T != E) {
        const C = S[E].PartName;
        e.changeOrganPartsVisibility(C, !1);
      }
    if (T > -1) {
      const E = S[T].PartName;
      if (e.scene.findGeometriesWithGroupName(E).length > 0 || e.scene.findGlyphsetsWithGroupName(E).length > 0)
        e.changeOrganPartsVisibility(E, !0);
      else {
        const C = getOrganDetails(S[T].SystemName, E);
        C != null && e.scene.loadMetadataURL(l.getOrgansDirectoryPrefix() + "/" + C.meta);
      }
    }
  }, this.getAvailableSpecies = function(S, T, E) {
    const C = new Array();
    C.push("none");
    const P = Object.keys(organsFileMap);
    for (index in P) {
      const b = P[index];
      b != S && organsFileMap[b].hasOwnProperty(T) && organsFileMap[b][T].hasOwnProperty(E) && C.push(b);
    }
    return C;
  }, this.getCentreAndSize = function() {
    const S = new Pr.THREE.Vector3(), T = this.scene.getBoundingBox();
    T.getCenter(S);
    const E = [S.x, S.y, S.z];
    T.getSize(S);
    const C = [S.x, S.y, S.z];
    return { centre: E, size: C };
  };
  const _ = function(S, T, E, C) {
    e.sceneData.nerveMapIsActive = !1, e.sceneData.nerveMap = void 0, e.sceneData.metaURL = "", e.sceneData.viewURL = "", e.sceneData.currentSpecies = S, e.sceneData.currentSystem = T, e.sceneData.currentPart = E, e.sceneData.currentTime = 0, e.sceneData.timeVarying = !1;
    let P = "";
    S && (P = S + "/"), T && (P = T + "/"), E && (P = E), e.sceneData.currentName = P;
  };
  this.loadOrgansFromURL = function(S, T, E, C, P, b, I) {
    if (e.zincRenderer && C && e.sceneData.metaURL !== S) {
      _(T, E, C);
      const D = e.sceneData.currentName;
      let N = e.zincRenderer.getSceneByName(D);
      N ? b && N.clearAll() : N = e.zincRenderer.createScene(D), e.selectObjectOnPick = !0;
      for (let B = 0; B < r.length; B++)
        r[B](e.sceneData);
      P && P != "" ? (e.sceneData.viewURL = P, N.loadViewURL(e.sceneData.viewURL)) : e.sceneData.viewURL = void 0, e.sceneData.metaURL = S, N.addZincObjectAddedCallbacks(A(E, C, !1)), N.addZincObjectRemovedCallbacks(M(void 0, C, !1)), N.loadMetadataURL(S, L(), R(), I), e.scene = N, e.zincRenderer.setCurrentScene(N), e.graphicsHighlight.reset();
      const U = N.getZincCameraControls();
      U.enableRaycaster(N, y(), v()), U.setMouseButtonAction("AUXILIARY", "ZOOM"), U.setMouseButtonAction("SECONDARY", "PAN");
    }
  }, this.loadGLTFFromURL = function(S, T, E) {
    if (e.zincRenderer && T && e.sceneData.metaURL !== S) {
      _(void 0, void 0, T);
      const C = e.sceneData.currentName;
      let P = e.zincRenderer.getSceneByName(C);
      P ? E && P.clearAll() : P = e.zincRenderer.createScene(C);
      for (let I = 0; I < r.length; I++)
        r[I](e.sceneData);
      e.sceneData.viewURL = void 0, e.sceneData.metaURL = S, P.addZincObjectAddedCallbacks(A(void 0, T, !1)), P.addZincObjectRemovedCallbacks(M(void 0, T, !1)), P.loadGLTF(S, void 0, R()), e.scene = P, e.zincRenderer.setCurrentScene(P), e.graphicsHighlight.reset();
      const b = P.getZincCameraControls();
      b.enableRaycaster(P, y(), v()), b.setMouseButtonAction("AUXILIARY", "ZOOM"), b.setMouseButtonAction("SECONDARY", "PAN");
    }
  }, this.alignCameraWithSelectedObject = function(S) {
    const T = e.graphicsHighlight.getSelected();
    T && T[0] && T[0].userData && e.scene.alignObjectToCameraView(T[0].userData, S);
  }, this.exportSettings = function() {
    const S = {};
    return S.name = e.instanceName, e.sceneData.currentSystem && (S.system = e.sceneData.currentSystem), e.sceneData.currentSpecies && (S.species = e.sceneData.currentSpecies), e.sceneData.currentPart && (S.part = e.sceneData.currentPart), S.metaURL = e.sceneData.metaURL, e.sceneData.viewURL && (S.viewURL = e.sceneData.viewURL), S.dialog = "Organ Viewer", S;
  }, this.importSettings = function(S) {
    return S && S.dialog == this.typeName ? (e.setName(S.name), S.metaURL !== void 0 && S.metaURL != "" ? e.loadOrgansFromURL(
      S.metaURL,
      S.species,
      S.system,
      S.part,
      S.viewURL,
      !0
    ) : e.loadOrgans(S.species, S.system, S.part), !0) : !1;
  }, function() {
    e.initialiseRenderer(void 0), e.zincRenderer && (e.zincRenderer.addPreRenderCallbackFunction(g()), e.zincRenderer.addPostRenderCallbackFunction(p()));
  }();
};
LM.prototype = Object.create(Kt.prototype);
var _t = function() {
  return _t = Object.assign || function(e) {
    for (var t, i = 1, r = arguments.length; i < r; i++) {
      t = arguments[i];
      for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
    }
    return e;
  }, _t.apply(this, arguments);
};
function M5(n, e, t, i) {
  function r(s) {
    return s instanceof t ? s : new t(function(o) {
      o(s);
    });
  }
  return new (t || (t = Promise))(function(s, o) {
    function a(d) {
      try {
        l(i.next(d));
      } catch (h) {
        o(h);
      }
    }
    function c(d) {
      try {
        l(i.throw(d));
      } catch (h) {
        o(h);
      }
    }
    function l(d) {
      d.done ? s(d.value) : r(d.value).then(a, c);
    }
    l((i = i.apply(n, [])).next());
  });
}
function w5(n, e) {
  var t = { label: 0, sent: function() {
    if (s[0] & 1) throw s[1];
    return s[1];
  }, trys: [], ops: [] }, i, r, s, o;
  return o = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
    return this;
  }), o;
  function a(l) {
    return function(d) {
      return c([l, d]);
    };
  }
  function c(l) {
    if (i) throw new TypeError("Generator is already executing.");
    for (; o && (o = 0, l[0] && (t = 0)), t; ) try {
      if (i = 1, r && (s = l[0] & 2 ? r.return : l[0] ? r.throw || ((s = r.return) && s.call(r), 0) : r.next) && !(s = s.call(r, l[1])).done) return s;
      switch (r = 0, s && (l = [l[0] & 2, s.value]), l[0]) {
        case 0:
        case 1:
          s = l;
          break;
        case 4:
          return t.label++, { value: l[1], done: !1 };
        case 5:
          t.label++, r = l[1], l = [0];
          continue;
        case 7:
          l = t.ops.pop(), t.trys.pop();
          continue;
        default:
          if (s = t.trys, !(s = s.length > 0 && s[s.length - 1]) && (l[0] === 6 || l[0] === 2)) {
            t = 0;
            continue;
          }
          if (l[0] === 3 && (!s || l[1] > s[0] && l[1] < s[3])) {
            t.label = l[1];
            break;
          }
          if (l[0] === 6 && t.label < s[1]) {
            t.label = s[1], s = l;
            break;
          }
          if (s && t.label < s[2]) {
            t.label = s[2], t.ops.push(l);
            break;
          }
          s[2] && t.ops.pop(), t.trys.pop();
          continue;
      }
      l = e.call(n, t);
    } catch (d) {
      l = [6, d], r = 0;
    } finally {
      i = s = 0;
    }
    if (l[0] & 5) throw l[1];
    return { value: l[0] ? l[1] : void 0, done: !0 };
  }
}
function ct(n) {
  var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], i = 0;
  if (t) return t.call(n);
  if (n && typeof n.length == "number") return {
    next: function() {
      return n && i >= n.length && (n = void 0), { value: n && n[i++], done: !n };
    }
  };
  throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function Wt(n, e) {
  var t = typeof Symbol == "function" && n[Symbol.iterator];
  if (!t) return n;
  var i = t.call(n), r, s = [], o;
  try {
    for (; (e === void 0 || e-- > 0) && !(r = i.next()).done; ) s.push(r.value);
  } catch (a) {
    o = { error: a };
  } finally {
    try {
      r && !r.done && (t = i.return) && t.call(i);
    } finally {
      if (o) throw o.error;
    }
  }
  return s;
}
var A5 = "ENTRIES", RM = "KEYS", FM = "VALUES", pn = "", Ph = (
  /** @class */
  function() {
    function n(e, t) {
      var i = e._tree, r = Array.from(i.keys());
      this.set = e, this._type = t, this._path = r.length > 0 ? [{ node: i, keys: r }] : [];
    }
    return n.prototype.next = function() {
      var e = this.dive();
      return this.backtrack(), e;
    }, n.prototype.dive = function() {
      if (this._path.length === 0)
        return { done: !0, value: void 0 };
      var e = uo(this._path), t = e.node, i = e.keys;
      if (uo(i) === pn)
        return { done: !1, value: this.result() };
      var r = t.get(uo(i));
      return this._path.push({ node: r, keys: Array.from(r.keys()) }), this.dive();
    }, n.prototype.backtrack = function() {
      if (this._path.length !== 0) {
        var e = uo(this._path).keys;
        e.pop(), !(e.length > 0) && (this._path.pop(), this.backtrack());
      }
    }, n.prototype.key = function() {
      return this.set._prefix + this._path.map(function(e) {
        var t = e.keys;
        return uo(t);
      }).filter(function(e) {
        return e !== pn;
      }).join("");
    }, n.prototype.value = function() {
      return uo(this._path).node.get(pn);
    }, n.prototype.result = function() {
      switch (this._type) {
        case FM:
          return this.value();
        case RM:
          return this.key();
        default:
          return [this.key(), this.value()];
      }
    }, n.prototype[Symbol.iterator] = function() {
      return this;
    }, n;
  }()
), uo = function(n) {
  return n[n.length - 1];
}, S5 = function(n, e, t) {
  var i = /* @__PURE__ */ new Map();
  if (e === void 0)
    return i;
  for (var r = e.length + 1, s = r + t, o = new Uint8Array(s * r).fill(t + 1), a = 0; a < r; ++a)
    o[a] = a;
  for (var c = 1; c < s; ++c)
    o[c * r] = c;
  return PM(n, e, t, i, o, 1, r, ""), i;
}, PM = function(n, e, t, i, r, s, o, a) {
  var c, l, d = s * o;
  try {
    e: for (var h = ct(n.keys()), f = h.next(); !f.done; f = h.next()) {
      var g = f.value;
      if (g === pn) {
        var p = r[d - 1];
        p <= t && i.set(a, [n.get(g), p]);
      } else {
        for (var u = s, y = 0; y < g.length; ++y, ++u) {
          for (var v = g[y], m = o * u, x = m - o, w = r[m], A = Math.max(0, u - t - 1), M = Math.min(o - 1, u + t), R = A; R < M; ++R) {
            var L = v !== e[R], _ = r[x + R] + +L, F = r[x + R + 1] + 1, S = r[m + R] + 1, T = r[m + R + 1] = Math.min(_, F, S);
            T < w && (w = T);
          }
          if (w > t)
            continue e;
        }
        PM(n.get(g), e, t, i, r, u, o, a + g);
      }
    }
  } catch (E) {
    c = { error: E };
  } finally {
    try {
      f && !f.done && (l = h.return) && l.call(h);
    } finally {
      if (c) throw c.error;
    }
  }
}, Ih = (
  /** @class */
  function() {
    function n(e, t) {
      e === void 0 && (e = /* @__PURE__ */ new Map()), t === void 0 && (t = ""), this._size = void 0, this._tree = e, this._prefix = t;
    }
    return n.prototype.atPrefix = function(e) {
      var t, i;
      if (!e.startsWith(this._prefix))
        throw new Error("Mismatched prefix");
      var r = Wt($c(this._tree, e.slice(this._prefix.length)), 2), s = r[0], o = r[1];
      if (s === void 0) {
        var a = Wt(vp(o), 2), c = a[0], l = a[1];
        try {
          for (var d = ct(c.keys()), h = d.next(); !h.done; h = d.next()) {
            var f = h.value;
            if (f !== pn && f.startsWith(l)) {
              var g = /* @__PURE__ */ new Map();
              return g.set(f.slice(l.length), c.get(f)), new n(g, e);
            }
          }
        } catch (p) {
          t = { error: p };
        } finally {
          try {
            h && !h.done && (i = d.return) && i.call(d);
          } finally {
            if (t) throw t.error;
          }
        }
      }
      return new n(s, e);
    }, n.prototype.clear = function() {
      this._size = void 0, this._tree.clear();
    }, n.prototype.delete = function(e) {
      return this._size = void 0, _5(this._tree, e);
    }, n.prototype.entries = function() {
      return new Ph(this, A5);
    }, n.prototype.forEach = function(e) {
      var t, i;
      try {
        for (var r = ct(this), s = r.next(); !s.done; s = r.next()) {
          var o = Wt(s.value, 2), a = o[0], c = o[1];
          e(a, c, this);
        }
      } catch (l) {
        t = { error: l };
      } finally {
        try {
          s && !s.done && (i = r.return) && i.call(r);
        } finally {
          if (t) throw t.error;
        }
      }
    }, n.prototype.fuzzyGet = function(e, t) {
      return S5(this._tree, e, t);
    }, n.prototype.get = function(e) {
      var t = Nd(this._tree, e);
      return t !== void 0 ? t.get(pn) : void 0;
    }, n.prototype.has = function(e) {
      var t = Nd(this._tree, e);
      return t !== void 0 && t.has(pn);
    }, n.prototype.keys = function() {
      return new Ph(this, RM);
    }, n.prototype.set = function(e, t) {
      if (typeof e != "string")
        throw new Error("key must be a string");
      this._size = void 0;
      var i = Oh(this._tree, e);
      return i.set(pn, t), this;
    }, Object.defineProperty(n.prototype, "size", {
      /**
       * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size
       */
      get: function() {
        if (this._size)
          return this._size;
        this._size = 0;
        for (var e = this.entries(); !e.next().done; )
          this._size += 1;
        return this._size;
      },
      enumerable: !1,
      configurable: !0
    }), n.prototype.update = function(e, t) {
      if (typeof e != "string")
        throw new Error("key must be a string");
      this._size = void 0;
      var i = Oh(this._tree, e);
      return i.set(pn, t(i.get(pn))), this;
    }, n.prototype.fetch = function(e, t) {
      if (typeof e != "string")
        throw new Error("key must be a string");
      this._size = void 0;
      var i = Oh(this._tree, e), r = i.get(pn);
      return r === void 0 && i.set(pn, r = t()), r;
    }, n.prototype.values = function() {
      return new Ph(this, FM);
    }, n.prototype[Symbol.iterator] = function() {
      return this.entries();
    }, n.from = function(e) {
      var t, i, r = new n();
      try {
        for (var s = ct(e), o = s.next(); !o.done; o = s.next()) {
          var a = Wt(o.value, 2), c = a[0], l = a[1];
          r.set(c, l);
        }
      } catch (d) {
        t = { error: d };
      } finally {
        try {
          o && !o.done && (i = s.return) && i.call(s);
        } finally {
          if (t) throw t.error;
        }
      }
      return r;
    }, n.fromObject = function(e) {
      return n.from(Object.entries(e));
    }, n;
  }()
), $c = function(n, e, t) {
  var i, r;
  if (t === void 0 && (t = []), e.length === 0 || n == null)
    return [n, t];
  try {
    for (var s = ct(n.keys()), o = s.next(); !o.done; o = s.next()) {
      var a = o.value;
      if (a !== pn && e.startsWith(a))
        return t.push([n, a]), $c(n.get(a), e.slice(a.length), t);
    }
  } catch (c) {
    i = { error: c };
  } finally {
    try {
      o && !o.done && (r = s.return) && r.call(s);
    } finally {
      if (i) throw i.error;
    }
  }
  return t.push([n, e]), $c(void 0, "", t);
}, Nd = function(n, e) {
  var t, i;
  if (e.length === 0 || n == null)
    return n;
  try {
    for (var r = ct(n.keys()), s = r.next(); !s.done; s = r.next()) {
      var o = s.value;
      if (o !== pn && e.startsWith(o))
        return Nd(n.get(o), e.slice(o.length));
    }
  } catch (a) {
    t = { error: a };
  } finally {
    try {
      s && !s.done && (i = r.return) && i.call(r);
    } finally {
      if (t) throw t.error;
    }
  }
}, Oh = function(n, e) {
  var t, i, r = e.length;
  e: for (var s = 0; n && s < r; ) {
    try {
      for (var o = (t = void 0, ct(n.keys())), a = o.next(); !a.done; a = o.next()) {
        var c = a.value;
        if (c !== pn && e[s] === c[0]) {
          for (var l = Math.min(r - s, c.length), d = 1; d < l && e[s + d] === c[d]; )
            ++d;
          var h = n.get(c);
          if (d === c.length)
            n = h;
          else {
            var f = /* @__PURE__ */ new Map();
            f.set(c.slice(d), h), n.set(e.slice(s, s + d), f), n.delete(c), n = f;
          }
          s += d;
          continue e;
        }
      }
    } catch (p) {
      t = { error: p };
    } finally {
      try {
        a && !a.done && (i = o.return) && i.call(o);
      } finally {
        if (t) throw t.error;
      }
    }
    var g = /* @__PURE__ */ new Map();
    return n.set(e.slice(s), g), g;
  }
  return n;
}, _5 = function(n, e) {
  var t = Wt($c(n, e), 2), i = t[0], r = t[1];
  if (i !== void 0) {
    if (i.delete(pn), i.size === 0)
      IM(r);
    else if (i.size === 1) {
      var s = Wt(i.entries().next().value, 2), o = s[0], a = s[1];
      OM(r, o, a);
    }
  }
}, IM = function(n) {
  if (n.length !== 0) {
    var e = Wt(vp(n), 2), t = e[0], i = e[1];
    if (t.delete(i), t.size === 0)
      IM(n.slice(0, -1));
    else if (t.size === 1) {
      var r = Wt(t.entries().next().value, 2), s = r[0], o = r[1];
      s !== pn && OM(n.slice(0, -1), s, o);
    }
  }
}, OM = function(n, e, t) {
  if (n.length !== 0) {
    var i = Wt(vp(n), 2), r = i[0], s = i[1];
    r.set(s + e, t), r.delete(s);
  }
}, vp = function(n) {
  return n[n.length - 1];
}, _a, yp = "or", DM = "and", T5 = "and_not", E5 = (
  /** @class */
  function() {
    function n(e) {
      if ((e == null ? void 0 : e.fields) == null)
        throw new Error('MiniSearch: option "fields" must be provided');
      var t = e.autoVacuum == null || e.autoVacuum === !0 ? Bh : e.autoVacuum;
      this._options = _t(_t(_t({}, Nh), e), { autoVacuum: t, searchOptions: _t(_t({}, Rv), e.searchOptions || {}), autoSuggestOptions: _t(_t({}, P5), e.autoSuggestOptions || {}) }), this._index = new Ih(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldIds = {}, this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._nextId = 0, this._storedFields = /* @__PURE__ */ new Map(), this._dirtCount = 0, this._currentVacuum = null, this._enqueuedVacuum = null, this._enqueuedVacuumConditions = Ud, this.addFields(this._options.fields);
    }
    return n.prototype.add = function(e) {
      var t, i, r, s, o, a, c = this._options, l = c.extractField, d = c.tokenize, h = c.processTerm, f = c.fields, g = c.idField, p = l(e, g);
      if (p == null)
        throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"'));
      if (this._idToShortId.has(p))
        throw new Error("MiniSearch: duplicate ID ".concat(p));
      var u = this.addDocumentId(p);
      this.saveStoredFields(u, e);
      try {
        for (var y = ct(f), v = y.next(); !v.done; v = y.next()) {
          var m = v.value, x = l(e, m);
          if (x != null) {
            var w = d(x.toString(), m), A = this._fieldIds[m], M = new Set(w).size;
            this.addFieldLength(u, A, this._documentCount - 1, M);
            try {
              for (var R = (r = void 0, ct(w)), L = R.next(); !L.done; L = R.next()) {
                var _ = L.value, F = h(_, m);
                if (Array.isArray(F))
                  try {
                    for (var S = (o = void 0, ct(F)), T = S.next(); !T.done; T = S.next()) {
                      var E = T.value;
                      this.addTerm(A, u, E);
                    }
                  } catch (C) {
                    o = { error: C };
                  } finally {
                    try {
                      T && !T.done && (a = S.return) && a.call(S);
                    } finally {
                      if (o) throw o.error;
                    }
                  }
                else F && this.addTerm(A, u, F);
              }
            } catch (C) {
              r = { error: C };
            } finally {
              try {
                L && !L.done && (s = R.return) && s.call(R);
              } finally {
                if (r) throw r.error;
              }
            }
          }
        }
      } catch (C) {
        t = { error: C };
      } finally {
        try {
          v && !v.done && (i = y.return) && i.call(y);
        } finally {
          if (t) throw t.error;
        }
      }
    }, n.prototype.addAll = function(e) {
      var t, i;
      try {
        for (var r = ct(e), s = r.next(); !s.done; s = r.next()) {
          var o = s.value;
          this.add(o);
        }
      } catch (a) {
        t = { error: a };
      } finally {
        try {
          s && !s.done && (i = r.return) && i.call(r);
        } finally {
          if (t) throw t.error;
        }
      }
    }, n.prototype.addAllAsync = function(e, t) {
      var i = this;
      t === void 0 && (t = {});
      var r = t.chunkSize, s = r === void 0 ? 10 : r, o = { chunk: [], promise: Promise.resolve() }, a = e.reduce(function(d, h, f) {
        var g = d.chunk, p = d.promise;
        return g.push(h), (f + 1) % s === 0 ? {
          chunk: [],
          promise: p.then(function() {
            return new Promise(function(u) {
              return setTimeout(u, 0);
            });
          }).then(function() {
            return i.addAll(g);
          })
        } : { chunk: g, promise: p };
      }, o), c = a.chunk, l = a.promise;
      return l.then(function() {
        return i.addAll(c);
      });
    }, n.prototype.remove = function(e) {
      var t, i, r, s, o, a, c = this._options, l = c.tokenize, d = c.processTerm, h = c.extractField, f = c.fields, g = c.idField, p = h(e, g);
      if (p == null)
        throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"'));
      var u = this._idToShortId.get(p);
      if (u == null)
        throw new Error("MiniSearch: cannot remove document with ID ".concat(p, ": it is not in the index"));
      try {
        for (var y = ct(f), v = y.next(); !v.done; v = y.next()) {
          var m = v.value, x = h(e, m);
          if (x != null) {
            var w = l(x.toString(), m), A = this._fieldIds[m], M = new Set(w).size;
            this.removeFieldLength(u, A, this._documentCount, M);
            try {
              for (var R = (r = void 0, ct(w)), L = R.next(); !L.done; L = R.next()) {
                var _ = L.value, F = d(_, m);
                if (Array.isArray(F))
                  try {
                    for (var S = (o = void 0, ct(F)), T = S.next(); !T.done; T = S.next()) {
                      var E = T.value;
                      this.removeTerm(A, u, E);
                    }
                  } catch (C) {
                    o = { error: C };
                  } finally {
                    try {
                      T && !T.done && (a = S.return) && a.call(S);
                    } finally {
                      if (o) throw o.error;
                    }
                  }
                else F && this.removeTerm(A, u, F);
              }
            } catch (C) {
              r = { error: C };
            } finally {
              try {
                L && !L.done && (s = R.return) && s.call(R);
              } finally {
                if (r) throw r.error;
              }
            }
          }
        }
      } catch (C) {
        t = { error: C };
      } finally {
        try {
          v && !v.done && (i = y.return) && i.call(y);
        } finally {
          if (t) throw t.error;
        }
      }
      this._storedFields.delete(u), this._documentIds.delete(u), this._idToShortId.delete(p), this._fieldLength.delete(u), this._documentCount -= 1;
    }, n.prototype.removeAll = function(e) {
      var t, i;
      if (e)
        try {
          for (var r = ct(e), s = r.next(); !s.done; s = r.next()) {
            var o = s.value;
            this.remove(o);
          }
        } catch (a) {
          t = { error: a };
        } finally {
          try {
            s && !s.done && (i = r.return) && i.call(r);
          } finally {
            if (t) throw t.error;
          }
        }
      else {
        if (arguments.length > 0)
          throw new Error("Expected documents to be present. Omit the argument to remove all documents.");
        this._index = new Ih(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._storedFields = /* @__PURE__ */ new Map(), this._nextId = 0;
      }
    }, n.prototype.discard = function(e) {
      var t = this, i = this._idToShortId.get(e);
      if (i == null)
        throw new Error("MiniSearch: cannot discard document with ID ".concat(e, ": it is not in the index"));
      this._idToShortId.delete(e), this._documentIds.delete(i), this._storedFields.delete(i), (this._fieldLength.get(i) || []).forEach(function(r, s) {
        t.removeFieldLength(i, s, t._documentCount, r);
      }), this._fieldLength.delete(i), this._documentCount -= 1, this._dirtCount += 1, this.maybeAutoVacuum();
    }, n.prototype.maybeAutoVacuum = function() {
      if (this._options.autoVacuum !== !1) {
        var e = this._options.autoVacuum, t = e.minDirtFactor, i = e.minDirtCount, r = e.batchSize, s = e.batchWait;
        this.conditionalVacuum({ batchSize: r, batchWait: s }, { minDirtCount: i, minDirtFactor: t });
      }
    }, n.prototype.discardAll = function(e) {
      var t, i, r = this._options.autoVacuum;
      try {
        this._options.autoVacuum = !1;
        try {
          for (var s = ct(e), o = s.next(); !o.done; o = s.next()) {
            var a = o.value;
            this.discard(a);
          }
        } catch (c) {
          t = { error: c };
        } finally {
          try {
            o && !o.done && (i = s.return) && i.call(s);
          } finally {
            if (t) throw t.error;
          }
        }
      } finally {
        this._options.autoVacuum = r;
      }
      this.maybeAutoVacuum();
    }, n.prototype.replace = function(e) {
      var t = this._options, i = t.idField, r = t.extractField, s = r(e, i);
      this.discard(s), this.add(e);
    }, n.prototype.vacuum = function(e) {
      return e === void 0 && (e = {}), this.conditionalVacuum(e);
    }, n.prototype.conditionalVacuum = function(e, t) {
      var i = this;
      return this._currentVacuum ? (this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && t, this._enqueuedVacuum != null ? this._enqueuedVacuum : (this._enqueuedVacuum = this._currentVacuum.then(function() {
        var r = i._enqueuedVacuumConditions;
        return i._enqueuedVacuumConditions = Ud, i.performVacuuming(e, r);
      }), this._enqueuedVacuum)) : this.vacuumConditionsMet(t) === !1 ? Promise.resolve() : (this._currentVacuum = this.performVacuuming(e), this._currentVacuum);
    }, n.prototype.performVacuuming = function(e, t) {
      return M5(this, void 0, void 0, function() {
        var i, r, s, o, a, c, l, d, h, f, g, p, u, y, v, m, x, w, A, M, R, L, _, F, S;
        return w5(this, function(T) {
          switch (T.label) {
            case 0:
              if (i = this._dirtCount, !this.vacuumConditionsMet(t)) return [3, 10];
              r = e.batchSize || Bd.batchSize, s = e.batchWait || Bd.batchWait, o = 1, T.label = 1;
            case 1:
              T.trys.push([1, 7, 8, 9]), a = ct(this._index), c = a.next(), T.label = 2;
            case 2:
              if (c.done) return [3, 6];
              l = Wt(c.value, 2), d = l[0], h = l[1];
              try {
                for (f = (L = void 0, ct(h)), g = f.next(); !g.done; g = f.next()) {
                  p = Wt(g.value, 2), u = p[0], y = p[1];
                  try {
                    for (v = (F = void 0, ct(y)), m = v.next(); !m.done; m = v.next())
                      x = Wt(m.value, 1), w = x[0], !this._documentIds.has(w) && (y.size <= 1 ? h.delete(u) : y.delete(w));
                  } catch (E) {
                    F = { error: E };
                  } finally {
                    try {
                      m && !m.done && (S = v.return) && S.call(v);
                    } finally {
                      if (F) throw F.error;
                    }
                  }
                }
              } catch (E) {
                L = { error: E };
              } finally {
                try {
                  g && !g.done && (_ = f.return) && _.call(f);
                } finally {
                  if (L) throw L.error;
                }
              }
              return this._index.get(d).size === 0 && this._index.delete(d), o % r !== 0 ? [3, 4] : [4, new Promise(function(E) {
                return setTimeout(E, s);
              })];
            case 3:
              T.sent(), T.label = 4;
            case 4:
              o += 1, T.label = 5;
            case 5:
              return c = a.next(), [3, 2];
            case 6:
              return [3, 9];
            case 7:
              return A = T.sent(), M = { error: A }, [3, 9];
            case 8:
              try {
                c && !c.done && (R = a.return) && R.call(a);
              } finally {
                if (M) throw M.error;
              }
              return [
                7
                /*endfinally*/
              ];
            case 9:
              this._dirtCount -= i, T.label = 10;
            case 10:
              return [4, null];
            case 11:
              return T.sent(), this._currentVacuum = this._enqueuedVacuum, this._enqueuedVacuum = null, [
                2
                /*return*/
              ];
          }
        });
      });
    }, n.prototype.vacuumConditionsMet = function(e) {
      if (e == null)
        return !0;
      var t = e.minDirtCount, i = e.minDirtFactor;
      return t = t || Bh.minDirtCount, i = i || Bh.minDirtFactor, this.dirtCount >= t && this.dirtFactor >= i;
    }, Object.defineProperty(n.prototype, "isVacuuming", {
      /**
       * Is `true` if a vacuuming operation is ongoing, `false` otherwise
       */
      get: function() {
        return this._currentVacuum != null;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n.prototype, "dirtCount", {
      /**
       * The number of documents discarded since the most recent vacuuming
       */
      get: function() {
        return this._dirtCount;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n.prototype, "dirtFactor", {
      /**
       * A number between 0 and 1 giving an indication about the proportion of
       * documents that are discarded, and can therefore be cleaned up by vacuuming.
       * A value close to 0 means that the index is relatively clean, while a higher
       * value means that the index is relatively dirty, and vacuuming could release
       * memory.
       */
      get: function() {
        return this._dirtCount / (1 + this._documentCount + this._dirtCount);
      },
      enumerable: !1,
      configurable: !0
    }), n.prototype.has = function(e) {
      return this._idToShortId.has(e);
    }, n.prototype.getStoredFields = function(e) {
      var t = this._idToShortId.get(e);
      if (t != null)
        return this._storedFields.get(t);
    }, n.prototype.search = function(e, t) {
      var i, r;
      t === void 0 && (t = {});
      var s = this.executeQuery(e, t), o = [];
      try {
        for (var a = ct(s), c = a.next(); !c.done; c = a.next()) {
          var l = Wt(c.value, 2), d = l[0], h = l[1], f = h.score, g = h.terms, p = h.match, u = g.length || 1, y = {
            id: this._documentIds.get(d),
            score: f * u,
            terms: Object.keys(p),
            queryTerms: g,
            match: p
          };
          Object.assign(y, this._storedFields.get(d)), (t.filter == null || t.filter(y)) && o.push(y);
        }
      } catch (v) {
        i = { error: v };
      } finally {
        try {
          c && !c.done && (r = a.return) && r.call(a);
        } finally {
          if (i) throw i.error;
        }
      }
      return e === n.wildcard && t.boostDocument == null && this._options.searchOptions.boostDocument == null || o.sort(Pv), o;
    }, n.prototype.autoSuggest = function(e, t) {
      var i, r, s, o;
      t === void 0 && (t = {}), t = _t(_t({}, this._options.autoSuggestOptions), t);
      var a = /* @__PURE__ */ new Map();
      try {
        for (var c = ct(this.search(e, t)), l = c.next(); !l.done; l = c.next()) {
          var d = l.value, h = d.score, f = d.terms, g = f.join(" "), p = a.get(g);
          p != null ? (p.score += h, p.count += 1) : a.set(g, { score: h, terms: f, count: 1 });
        }
      } catch (A) {
        i = { error: A };
      } finally {
        try {
          l && !l.done && (r = c.return) && r.call(c);
        } finally {
          if (i) throw i.error;
        }
      }
      var u = [];
      try {
        for (var y = ct(a), v = y.next(); !v.done; v = y.next()) {
          var m = Wt(v.value, 2), p = m[0], x = m[1], h = x.score, f = x.terms, w = x.count;
          u.push({ suggestion: p, terms: f, score: h / w });
        }
      } catch (A) {
        s = { error: A };
      } finally {
        try {
          v && !v.done && (o = y.return) && o.call(y);
        } finally {
          if (s) throw s.error;
        }
      }
      return u.sort(Pv), u;
    }, Object.defineProperty(n.prototype, "documentCount", {
      /**
       * Total number of documents available to search
       */
      get: function() {
        return this._documentCount;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n.prototype, "termCount", {
      /**
       * Number of terms in the index
       */
      get: function() {
        return this._index.size;
      },
      enumerable: !1,
      configurable: !0
    }), n.loadJSON = function(e, t) {
      if (t == null)
        throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");
      return this.loadJS(JSON.parse(e), t);
    }, n.getDefault = function(e) {
      if (Nh.hasOwnProperty(e))
        return Dh(Nh, e);
      throw new Error('MiniSearch: unknown option "'.concat(e, '"'));
    }, n.loadJS = function(e, t) {
      var i, r, s, o, a, c, l = e.index, d = e.documentCount, h = e.nextId, f = e.documentIds, g = e.fieldIds, p = e.fieldLength, u = e.averageFieldLength, y = e.storedFields, v = e.dirtCount, m = e.serializationVersion;
      if (m !== 1 && m !== 2)
        throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");
      var x = new n(t);
      x._documentCount = d, x._nextId = h, x._documentIds = Ac(f), x._idToShortId = /* @__PURE__ */ new Map(), x._fieldIds = g, x._fieldLength = Ac(p), x._avgFieldLength = u, x._storedFields = Ac(y), x._dirtCount = v || 0, x._index = new Ih();
      try {
        for (var w = ct(x._documentIds), A = w.next(); !A.done; A = w.next()) {
          var M = Wt(A.value, 2), R = M[0], L = M[1];
          x._idToShortId.set(L, R);
        }
      } catch (N) {
        i = { error: N };
      } finally {
        try {
          A && !A.done && (r = w.return) && r.call(w);
        } finally {
          if (i) throw i.error;
        }
      }
      try {
        for (var _ = ct(l), F = _.next(); !F.done; F = _.next()) {
          var S = Wt(F.value, 2), T = S[0], E = S[1], C = /* @__PURE__ */ new Map();
          try {
            for (var P = (a = void 0, ct(Object.keys(E))), b = P.next(); !b.done; b = P.next()) {
              var I = b.value, D = E[I];
              m === 1 && (D = D.ds), C.set(parseInt(I, 10), Ac(D));
            }
          } catch (N) {
            a = { error: N };
          } finally {
            try {
              b && !b.done && (c = P.return) && c.call(P);
            } finally {
              if (a) throw a.error;
            }
          }
          x._index.set(T, C);
        }
      } catch (N) {
        s = { error: N };
      } finally {
        try {
          F && !F.done && (o = _.return) && o.call(_);
        } finally {
          if (s) throw s.error;
        }
      }
      return x;
    }, n.prototype.executeQuery = function(e, t) {
      var i = this;
      if (t === void 0 && (t = {}), e === n.wildcard)
        return this.executeWildcardQuery(t);
      if (typeof e != "string") {
        var r = _t(_t(_t({}, t), e), { queries: void 0 }), s = e.queries.map(function(y) {
          return i.executeQuery(y, r);
        });
        return this.combineResults(s, r.combineWith);
      }
      var o = this._options, a = o.tokenize, c = o.processTerm, l = o.searchOptions, d = _t(_t({ tokenize: a, processTerm: c }, l), t), h = d.tokenize, f = d.processTerm, g = h(e).flatMap(function(y) {
        return f(y);
      }).filter(function(y) {
        return !!y;
      }), p = g.map(F5(d)), u = p.map(function(y) {
        return i.executeQuerySpec(y, d);
      });
      return this.combineResults(u, d.combineWith);
    }, n.prototype.executeQuerySpec = function(e, t) {
      var i, r, s, o, a = _t(_t({}, this._options.searchOptions), t), c = (a.fields || this._options.fields).reduce(function(I, D) {
        var N;
        return _t(_t({}, I), (N = {}, N[D] = Dh(a.boost, D) || 1, N));
      }, {}), l = a.boostDocument, d = a.weights, h = a.maxFuzzy, f = a.bm25, g = _t(_t({}, Rv.weights), d), p = g.fuzzy, u = g.prefix, y = this._index.get(e.term), v = this.termResults(e.term, e.term, 1, y, c, l, f), m, x;
      if (e.prefix && (m = this._index.atPrefix(e.term)), e.fuzzy) {
        var w = e.fuzzy === !0 ? 0.2 : e.fuzzy, A = w < 1 ? Math.min(h, Math.round(e.term.length * w)) : w;
        A && (x = this._index.fuzzyGet(e.term, A));
      }
      if (m)
        try {
          for (var M = ct(m), R = M.next(); !R.done; R = M.next()) {
            var L = Wt(R.value, 2), _ = L[0], F = L[1], S = _.length - e.term.length;
            if (S) {
              x == null || x.delete(_);
              var T = u * _.length / (_.length + 0.3 * S);
              this.termResults(e.term, _, T, F, c, l, f, v);
            }
          }
        } catch (I) {
          i = { error: I };
        } finally {
          try {
            R && !R.done && (r = M.return) && r.call(M);
          } finally {
            if (i) throw i.error;
          }
        }
      if (x)
        try {
          for (var E = ct(x.keys()), C = E.next(); !C.done; C = E.next()) {
            var _ = C.value, P = Wt(x.get(_), 2), b = P[0], S = P[1];
            if (S) {
              var T = p * _.length / (_.length + S);
              this.termResults(e.term, _, T, b, c, l, f, v);
            }
          }
        } catch (I) {
          s = { error: I };
        } finally {
          try {
            C && !C.done && (o = E.return) && o.call(E);
          } finally {
            if (s) throw s.error;
          }
        }
      return v;
    }, n.prototype.executeWildcardQuery = function(e) {
      var t, i, r = /* @__PURE__ */ new Map(), s = _t(_t({}, this._options.searchOptions), e);
      try {
        for (var o = ct(this._documentIds), a = o.next(); !a.done; a = o.next()) {
          var c = Wt(a.value, 2), l = c[0], d = c[1], h = s.boostDocument ? s.boostDocument(d, "", this._storedFields.get(l)) : 1;
          r.set(l, {
            score: h,
            terms: [],
            match: {}
          });
        }
      } catch (f) {
        t = { error: f };
      } finally {
        try {
          a && !a.done && (i = o.return) && i.call(o);
        } finally {
          if (t) throw t.error;
        }
      }
      return r;
    }, n.prototype.combineResults = function(e, t) {
      if (t === void 0 && (t = yp), e.length === 0)
        return /* @__PURE__ */ new Map();
      var i = t.toLowerCase();
      return e.reduce(C5[i]) || /* @__PURE__ */ new Map();
    }, n.prototype.toJSON = function() {
      var e, t, i, r, s = [];
      try {
        for (var o = ct(this._index), a = o.next(); !a.done; a = o.next()) {
          var c = Wt(a.value, 2), l = c[0], d = c[1], h = {};
          try {
            for (var f = (i = void 0, ct(d)), g = f.next(); !g.done; g = f.next()) {
              var p = Wt(g.value, 2), u = p[0], y = p[1];
              h[u] = Object.fromEntries(y);
            }
          } catch (v) {
            i = { error: v };
          } finally {
            try {
              g && !g.done && (r = f.return) && r.call(f);
            } finally {
              if (i) throw i.error;
            }
          }
          s.push([l, h]);
        }
      } catch (v) {
        e = { error: v };
      } finally {
        try {
          a && !a.done && (t = o.return) && t.call(o);
        } finally {
          if (e) throw e.error;
        }
      }
      return {
        documentCount: this._documentCount,
        nextId: this._nextId,
        documentIds: Object.fromEntries(this._documentIds),
        fieldIds: this._fieldIds,
        fieldLength: Object.fromEntries(this._fieldLength),
        averageFieldLength: this._avgFieldLength,
        storedFields: Object.fromEntries(this._storedFields),
        dirtCount: this._dirtCount,
        index: s,
        serializationVersion: 2
      };
    }, n.prototype.termResults = function(e, t, i, r, s, o, a, c) {
      var l, d, h, f, g;
      if (c === void 0 && (c = /* @__PURE__ */ new Map()), r == null)
        return c;
      try {
        for (var p = ct(Object.keys(s)), u = p.next(); !u.done; u = p.next()) {
          var y = u.value, v = s[y], m = this._fieldIds[y], x = r.get(m);
          if (x != null) {
            var w = x.size, A = this._avgFieldLength[m];
            try {
              for (var M = (h = void 0, ct(x.keys())), R = M.next(); !R.done; R = M.next()) {
                var L = R.value;
                if (!this._documentIds.has(L)) {
                  this.removeTerm(m, L, t), w -= 1;
                  continue;
                }
                var _ = o ? o(this._documentIds.get(L), t, this._storedFields.get(L)) : 1;
                if (_) {
                  var F = x.get(L), S = this._fieldLength.get(L)[m], T = R5(F, w, this._documentCount, S, A, a), E = i * v * _ * T, C = c.get(L);
                  if (C) {
                    C.score += E, I5(C.terms, e);
                    var P = Dh(C.match, t);
                    P ? P.push(y) : C.match[t] = [y];
                  } else
                    c.set(L, {
                      score: E,
                      terms: [e],
                      match: (g = {}, g[t] = [y], g)
                    });
                }
              }
            } catch (b) {
              h = { error: b };
            } finally {
              try {
                R && !R.done && (f = M.return) && f.call(M);
              } finally {
                if (h) throw h.error;
              }
            }
          }
        }
      } catch (b) {
        l = { error: b };
      } finally {
        try {
          u && !u.done && (d = p.return) && d.call(p);
        } finally {
          if (l) throw l.error;
        }
      }
      return c;
    }, n.prototype.addTerm = function(e, t, i) {
      var r = this._index.fetch(i, Iv), s = r.get(e);
      if (s == null)
        s = /* @__PURE__ */ new Map(), s.set(t, 1), r.set(e, s);
      else {
        var o = s.get(t);
        s.set(t, (o || 0) + 1);
      }
    }, n.prototype.removeTerm = function(e, t, i) {
      if (!this._index.has(i)) {
        this.warnDocumentChanged(t, e, i);
        return;
      }
      var r = this._index.fetch(i, Iv), s = r.get(e);
      s == null || s.get(t) == null ? this.warnDocumentChanged(t, e, i) : s.get(t) <= 1 ? s.size <= 1 ? r.delete(e) : s.delete(t) : s.set(t, s.get(t) - 1), this._index.get(i).size === 0 && this._index.delete(i);
    }, n.prototype.warnDocumentChanged = function(e, t, i) {
      var r, s;
      try {
        for (var o = ct(Object.keys(this._fieldIds)), a = o.next(); !a.done; a = o.next()) {
          var c = a.value;
          if (this._fieldIds[c] === t) {
            this._options.logger("warn", "MiniSearch: document with ID ".concat(this._documentIds.get(e), ' has changed before removal: term "').concat(i, '" was not present in field "').concat(c, '". Removing a document after it has changed can corrupt the index!'), "version_conflict");
            return;
          }
        }
      } catch (l) {
        r = { error: l };
      } finally {
        try {
          a && !a.done && (s = o.return) && s.call(o);
        } finally {
          if (r) throw r.error;
        }
      }
    }, n.prototype.addDocumentId = function(e) {
      var t = this._nextId;
      return this._idToShortId.set(e, t), this._documentIds.set(t, e), this._documentCount += 1, this._nextId += 1, t;
    }, n.prototype.addFields = function(e) {
      for (var t = 0; t < e.length; t++)
        this._fieldIds[e[t]] = t;
    }, n.prototype.addFieldLength = function(e, t, i, r) {
      var s = this._fieldLength.get(e);
      s == null && this._fieldLength.set(e, s = []), s[t] = r;
      var o = this._avgFieldLength[t] || 0, a = o * i + r;
      this._avgFieldLength[t] = a / (i + 1);
    }, n.prototype.removeFieldLength = function(e, t, i, r) {
      if (i === 1) {
        this._avgFieldLength[t] = 0;
        return;
      }
      var s = this._avgFieldLength[t] * i - r;
      this._avgFieldLength[t] = s / (i - 1);
    }, n.prototype.saveStoredFields = function(e, t) {
      var i, r, s = this._options, o = s.storeFields, a = s.extractField;
      if (!(o == null || o.length === 0)) {
        var c = this._storedFields.get(e);
        c == null && this._storedFields.set(e, c = {});
        try {
          for (var l = ct(o), d = l.next(); !d.done; d = l.next()) {
            var h = d.value, f = a(t, h);
            f !== void 0 && (c[h] = f);
          }
        } catch (g) {
          i = { error: g };
        } finally {
          try {
            d && !d.done && (r = l.return) && r.call(l);
          } finally {
            if (i) throw i.error;
          }
        }
      }
    }, n.wildcard = Symbol("*"), n;
  }()
), Dh = function(n, e) {
  return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0;
}, C5 = (_a = {}, _a[yp] = function(n, e) {
  var t, i;
  try {
    for (var r = ct(e.keys()), s = r.next(); !s.done; s = r.next()) {
      var o = s.value, a = n.get(o);
      if (a == null)
        n.set(o, e.get(o));
      else {
        var c = e.get(o), l = c.score, d = c.terms, h = c.match;
        a.score = a.score + l, a.match = Object.assign(a.match, h), Fv(a.terms, d);
      }
    }
  } catch (f) {
    t = { error: f };
  } finally {
    try {
      s && !s.done && (i = r.return) && i.call(r);
    } finally {
      if (t) throw t.error;
    }
  }
  return n;
}, _a[DM] = function(n, e) {
  var t, i, r = /* @__PURE__ */ new Map();
  try {
    for (var s = ct(e.keys()), o = s.next(); !o.done; o = s.next()) {
      var a = o.value, c = n.get(a);
      if (c != null) {
        var l = e.get(a), d = l.score, h = l.terms, f = l.match;
        Fv(c.terms, h), r.set(a, {
          score: c.score + d,
          terms: c.terms,
          match: Object.assign(c.match, f)
        });
      }
    }
  } catch (g) {
    t = { error: g };
  } finally {
    try {
      o && !o.done && (i = s.return) && i.call(s);
    } finally {
      if (t) throw t.error;
    }
  }
  return r;
}, _a[T5] = function(n, e) {
  var t, i;
  try {
    for (var r = ct(e.keys()), s = r.next(); !s.done; s = r.next()) {
      var o = s.value;
      n.delete(o);
    }
  } catch (a) {
    t = { error: a };
  } finally {
    try {
      s && !s.done && (i = r.return) && i.call(r);
    } finally {
      if (t) throw t.error;
    }
  }
  return n;
}, _a), L5 = { k: 1.2, b: 0.7, d: 0.5 }, R5 = function(n, e, t, i, r, s) {
  var o = s.k, a = s.b, c = s.d, l = Math.log(1 + (t - e + 0.5) / (e + 0.5));
  return l * (c + n * (o + 1) / (n + o * (1 - a + a * i / r)));
}, F5 = function(n) {
  return function(e, t, i) {
    var r = typeof n.fuzzy == "function" ? n.fuzzy(e, t, i) : n.fuzzy || !1, s = typeof n.prefix == "function" ? n.prefix(e, t, i) : n.prefix === !0;
    return { term: e, fuzzy: r, prefix: s };
  };
}, Nh = {
  idField: "id",
  extractField: function(n, e) {
    return n[e];
  },
  tokenize: function(n) {
    return n.split(O5);
  },
  processTerm: function(n) {
    return n.toLowerCase();
  },
  fields: void 0,
  searchOptions: void 0,
  storeFields: [],
  logger: function(n, e) {
    typeof (console == null ? void 0 : console[n]) == "function" && console[n](e);
  },
  autoVacuum: !0
}, Rv = {
  combineWith: yp,
  prefix: !1,
  fuzzy: !1,
  maxFuzzy: 6,
  boost: {},
  weights: { fuzzy: 0.45, prefix: 0.375 },
  bm25: L5
}, P5 = {
  combineWith: DM,
  prefix: function(n, e, t) {
    return e === t.length - 1;
  }
}, Bd = { batchSize: 1e3, batchWait: 10 }, Ud = { minDirtFactor: 0.1, minDirtCount: 20 }, Bh = _t(_t({}, Bd), Ud), I5 = function(n, e) {
  n.includes(e) || n.push(e);
}, Fv = function(n, e) {
  var t, i;
  try {
    for (var r = ct(e), s = r.next(); !s.done; s = r.next()) {
      var o = s.value;
      n.includes(o) || n.push(o);
    }
  } catch (a) {
    t = { error: a };
  } finally {
    try {
      s && !s.done && (i = r.return) && i.call(r);
    } finally {
      if (t) throw t.error;
    }
  }
}, Pv = function(n, e) {
  var t = n.score, i = e.score;
  return i - t;
}, Iv = function() {
  return /* @__PURE__ */ new Map();
}, Ac = function(n) {
  var e, t, i = /* @__PURE__ */ new Map();
  try {
    for (var r = ct(Object.keys(n)), s = r.next(); !s.done; s = r.next()) {
      var o = s.value;
      i.set(parseInt(o, 10), n[o]);
    }
  } catch (a) {
    e = { error: a };
  } finally {
    try {
      s && !s.done && (t = r.return) && t.call(r);
    } finally {
      if (e) throw e.error;
    }
  }
  return i;
}, O5 = /[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;
class D5 {
  constructor() {
    this._searchEngine = new E5({
      fields: ["path", "name"],
      storeFields: ["path"],
      tokenize: (e, t) => e.split(/[\s/]+/)
      // indexing tokenizer
    }), this.idMaps = {};
  }
  addZincObject(e, t) {
    const i = e.getRegion().getFullPath();
    let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName;
    r = r.replaceAll('"', ""), s = s.replaceAll('"', "");
    const o = { path: s, name: r, id: t };
    this._searchEngine.add(o), this.idMaps[t] = { path: s, zincObject: e };
  }
  removeZincObject(e, t) {
    const i = e.getRegion().getFullPath();
    let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName;
    r = r.replaceAll('"', ""), s = s.replaceAll('"', "");
    const o = { path: s, name: r, id: t };
    this._searchEngine.remove(o), delete this.idMaps[t];
  }
  addRegion(e, t) {
    let i = e.getFullPath(), r = e.getName();
    i = i.replaceAll('"', ""), r = r.replaceAll('"', "");
    const s = { path: i, name: r, id: t };
    this._searchEngine.add(s), this.idMaps[t] = { path: i, zincObject: e };
  }
  clearResults() {
    this._;
  }
  removeAll() {
    this._searchEngine.removeAll(), this.idMaps = {};
  }
  auto_suggest(e) {
    let t = [];
    e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 }));
    const i = [];
    t.forEach((o) => {
      o.id in this.idMaps && i.push(this.idMaps[o.id].path);
    });
    const r = [...new Set(i)], s = [];
    return r.forEach((o) => s.push({ suggestion: '"' + o + '"' })), s;
  }
  processResults(e, t) {
    const i = {
      regionPath: void 0,
      label: 'Search Results for "'
    };
    return Array.isArray(t) ? i.label += ",".join(t) : i.label += t, i.label += '"', e.length === 1 && (e[0].isRegion ? i.regionPath = e[0].getFullPath() : e[0].isZincObject && (i.regionPath = e[0].getRegion().getFullPath(), i.label = e[0].groupName)), i.zincObjects = H4(e), i;
  }
  search(e) {
    let t;
    e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 }));
    const i = [];
    return t.forEach((r) => {
      r.id in this.idMaps && i.push(this.idMaps[r.id].zincObject);
    }), i;
  }
  searchTerms(e) {
    let t = [];
    return e.forEach((i) => {
      const r = this.search(i);
      t.push(...r);
    }), t;
  }
  searchAndProcessResult(e) {
    let t = [];
    return Array.isArray(e) ? t = this.searchTerms(e) : t = this.search(e), this.processResults(t, e);
  }
}
const N5 = [
  {
    id: 0,
    nerve_id: "ILX:0793723",
    label: "Auriculotemporal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53002", "FMA:53001"],
    "subclass labels": ["Left auriculotemporal nerve", "Right auriculotemporal nerve"]
  },
  {
    id: 1,
    nerve_id: "ILX:0792409",
    label: "gray communicating ramus of tenth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6895", "FMA:6894"],
    "subclass labels": ["Left T10 grey ramus communicans", "Right T10 grey ramus communicans"]
  },
  {
    id: 2,
    nerve_id: "UBERON:0011326",
    label: "superior laryngeal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53530", "FMA:53536"],
    "subclass labels": ["Right superior laryngeal nerve", "Left superior laryngeal nerve"]
  },
  {
    id: 3,
    nerve_id: "ILX:0793220",
    label: "white communicating ramus of first lumbar spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 4,
    nerve_id: "ILX:0787082",
    label: "gray communicating ramus of the first thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6082", "FMA:6084"],
    "subclass labels": ["Right T1 grey ramus communicans", "Left T1 grey ramus communicans"]
  },
  {
    id: 5,
    nerve_id: "ILX:0793809",
    label: "Clitoral cavernous nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 6,
    nerve_id: "UBERON:0011096",
    label: "lacrimal nerve",
    "FMA subclasses (in human nerves)": ["FMA:52630", "FMA:52629"],
    "subclass labels": ["Left lacrimal nerve", "Right lacrimal nerve"]
  },
  {
    id: 7,
    nerve_id: "ILX:0793215",
    label: "white communicating ramus of ninth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 8,
    nerve_id: "ILX:0795005",
    label: "Posterior cutaneous nerve of arm",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 9,
    nerve_id: "UBERON:0001649",
    label: "glossopharyngeal nerve",
    "FMA subclasses (in human nerves)": ["FMA:50894", "FMA:50892"],
    "subclass labels": []
  },
  {
    id: 10,
    nerve_id: "UBERON:0022302",
    label: "short ciliary nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 11,
    nerve_id: "ILX:0785932",
    label: "gray communicating ramus of third lumbar nerve",
    "FMA subclasses (in human nerves)": ["FMA:65920", "FMA:65919"],
    "subclass labels": ["Left L3 grey ramus communicans", "Right L3 grey ramus communicans"]
  },
  {
    id: 12,
    nerve_id: "ILX:0738293",
    label: "Ganglioglomerular nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 13,
    nerve_id: "ILX:0739298",
    label: "gray communicating ramus of twelfth thoracic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 14,
    nerve_id: "UBERON:0001492",
    label: "radial nerve",
    "FMA subclasses (in human nerves)": ["FMA:37070", "FMA:37071"],
    "subclass labels": ["Right radial nerve", "Left radial nerve"]
  },
  {
    id: 15,
    nerve_id: "ILX:0793214",
    label: "white communicating ramus of eighth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 16,
    nerve_id: "UBERON:0018681",
    label: "lesser splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6957", "FMA:6958"],
    "subclass labels": ["Right lesser splanchnic nerve", "Left lesser splanchnic nerve"]
  },
  {
    id: 17,
    nerve_id: "ILX:0794476",
    label: "abdominal branch of vagus nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 18,
    nerve_id: "ILX:0791105",
    label: "gray communicating ramus of the second thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6122", "FMA:6757"],
    "subclass labels": ["Right T2 grey ramus communicans", "Left T2 grey ramus communicans"]
  },
  {
    id: 19,
    nerve_id: "ILX:0794853",
    label: "esophageal vagus trunk",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 20,
    nerve_id: "ILX:0793210",
    label: "white communicating ramus of fourth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 21,
    nerve_id: "UBERON:0001759",
    label: "vagus nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 22,
    nerve_id: "UBERON:0009675",
    label: "chorda tympani branch of facial nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 23,
    nerve_id: "ILX:0794949",
    label: "recurrent branch of the median nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 24,
    nerve_id: "ILX:0789339",
    label: "Pharyngeal branch of glossopharyngeal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53495", "FMA:53494"],
    "subclass labels": ["Pharyngeal branch of left glossopharyngeal nerve", "Pharyngeal branch of right glossopharyngeal nerve"]
  },
  {
    id: 25,
    nerve_id: "ILX:0793712",
    label: "Zygomatic nerve",
    "FMA subclasses (in human nerves)": ["FMA:52968", "FMA:52969"],
    "subclass labels": ["Right zygomatic nerve", "Left zygomatic nerve"]
  },
  {
    id: 26,
    nerve_id: "ILX:0788536",
    label: "gray communicating ramus of fourth lumbar nerve",
    "FMA subclasses (in human nerves)": ["FMA:65917", "FMA:65918"],
    "subclass labels": ["Right L4 grey ramus communicans", "Left L4 grey ramus communicans"]
  },
  {
    id: 27,
    nerve_id: "UBERON:0018680",
    label: "greater splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6956", "FMA:6955"],
    "subclass labels": ["Right greater splanchnic nerve", "Left greater splanchnic nerve"]
  },
  {
    id: 28,
    nerve_id: "UBERON:0001322",
    label: "sciatic nerve",
    "FMA subclasses (in human nerves)": ["FMA:22111", "FMA:22112"],
    "subclass labels": ["Right sciatic nerve", "Left sciatic nerve"]
  },
  {
    id: 29,
    nerve_id: "ILX:0793209",
    label: "white communicating ramus of third thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 30,
    nerve_id: "UBERON:0011391",
    label: "perineal nerve",
    "FMA subclasses (in human nerves)": ["FMA:21874", "FMA:21873"],
    "subclass labels": ["Left perineal nerve", "Right perineal nerve"]
  },
  {
    id: 31,
    nerve_id: "ILX:0788945",
    label: "gray communicating ramus of the fourth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6759", "FMA:6758"],
    "subclass labels": ["Right T4 grey ramus communicans", "Left T4 grey ramus communicans"]
  },
  {
    id: 32,
    nerve_id: "ILX:0790497",
    label: "Gray communicating ramus of cervicothoracic ganglion to first thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 33,
    nerve_id: "UBERON:0001323",
    label: "tibial nerve",
    "FMA subclasses (in human nerves)": ["FMA:22109", "FMA:22110"],
    "subclass labels": ["Right tibial nerve", "Left tibial nerve"]
  },
  {
    id: 34,
    nerve_id: "ILX:0794969",
    label: "deep branch of ulnar nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 35,
    nerve_id: "ILX:0793227",
    label: "gray communicating ramus of thirteenth thoracic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 36,
    nerve_id: "ILX:0793228",
    label: "gray communicating ramus of first sacral nerve",
    "FMA subclasses (in human nerves)": ["FMA:65992", "FMA:65991"],
    "subclass labels": ["Left S1 grey ramus communicans", "Right S1 grey ramus communicans"]
  },
  {
    id: 37,
    nerve_id: "UBERON:0035111",
    label: "medial plantar nerve",
    "FMA subclasses (in human nerves)": ["FMA:45435", "FMA:45434"],
    "subclass labels": ["Left medial plantar nerve", "Right medial plantar nerve"]
  },
  {
    id: 38,
    nerve_id: "UBERON:0001780",
    label: "spinal nerve",
    "FMA subclasses (in human nerves)": ["FMA:6117", "FMA:6435", "FMA:6295", "FMA:6422", "FMA:6417", "FMA:6421", "FMA:6038", "FMA:6292", "FMA:6439", "FMA:6313", "FMA:6410", "FMA:6412", "FMA:6088", "FMA:6298", "FMA:6433", "FMA:6411", "FMA:6438", "FMA:6314", "FMA:6291", "FMA:6420", "FMA:6116", "FMA:6413", "FMA:6310", "FMA:6432", "FMA:6305", "FMA:6182", "FMA:6297", "FMA:6436", "FMA:6418", "FMA:6039", "FMA:6089", "FMA:6301", "FMA:6294", "FMA:6303", "FMA:6183", "FMA:6434", "FMA:6429", "FMA:6308", "FMA:6300", "FMA:6430", "FMA:6428", "FMA:6419", "FMA:6437", "FMA:6307", "FMA:6311", "FMA:6431"],
    "subclass labels": ["Left T3 spinal nerve", "Left S4 spinal nerve", "Left T5 spinal nerve", "Left L5 spinal nerve", "Right L3 spinal nerve", "Right L5 spinal nerve", "Right T1 spinal nerve", "Left T4 spinal nerve", "Left coccygeal spinal nerve", "Right T11 spinal nerve", "Right L1 spinal nerve", "Right L2 spinal nerve", "Right T2 spinal nerve", "Left T6 spinal nerve", "Left S3 spinal nerve", "Left L1 spinal nerve", "Right coccygeal spinal nerve", "Left T11 spinal nerve", "Right T4 spinal nerve", "Left L4 spinal nerve", "Right T3 spinal nerve", "Left L2 spinal nerve", "Right T10 spinal nerve", "Right S3 spinal nerve", "Left T8 spinal nerve", "Right T12 spinal nerve", "Right T6 spinal nerve", "Right S5 spinal nerve", "Left L3 spinal nerve", "Left T1 spinal nerve", "Left T2 spinal nerve", "Left T7 spinal nerve", "Right T5 spinal nerve", "Right T8 spinal nerve", "Left T12 spinal nerve", "Right S4 spinal nerve", "Left S1 spinal nerve", "Left T9 spinal nerve", "Right T7 spinal nerve", "Right S2 spinal nerve", "Right S1 spinal nerve", "Right L4 spinal nerve", "Left S5 spinal nerve", "Right T9 spinal nerve", "Left T10 spinal nerve", "Left S2 spinal nerve"]
  },
  {
    id: 39,
    nerve_id: "UBERON:0018683",
    label: "lumbar splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6924", "FMA:6928", "FMA:6929", "FMA:6931", "FMA:6925", "FMA:6930", "FMA:6927", "FMA:6926"],
    "subclass labels": ["Right first lumbar splanchnic nerve", "Right third lumbar splanchnic nerve", "Left third lumbar splanchnic nerve", "Left fourth lumbar splanchnic nerve", "Left first lumbar splanchnic nerve", "Right fourth lumbar splanchnic nerve", "Left second lumbar splanchnic nerve", "Right second lumbar splanchnic nerve"]
  },
  {
    id: 40,
    nerve_id: "UBERON:0001643",
    label: "oculomotor nerve",
    "FMA subclasses (in human nerves)": ["FMA:50880", "FMA:50879"],
    "subclass labels": ["Left oculomotor nerve", "Right oculomotor nerve"]
  },
  {
    id: 41,
    nerve_id: "ILX:0793212",
    label: "white communicating ramus of sixth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 42,
    nerve_id: "UBERON:0003724",
    label: "musculocutaneous nerve",
    "FMA subclasses (in human nerves)": ["FMA:37066", "FMA:37065"],
    "subclass labels": ["Left musculocutaneous nerve", "Right musculocutaneous nerve"]
  },
  {
    id: 43,
    nerve_id: "ILX:0738372",
    label: "white communicating ramus of first thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 44,
    nerve_id: "ILX:0793563",
    label: "splenic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 45,
    nerve_id: "UBERON:0035526",
    label: "superficial fibular nerve",
    "FMA subclasses (in human nerves)": ["FMA:45363", "FMA:45364"],
    "subclass labels": ["Right superficial fibular nerve", "Left superficial fibular nerve"]
  },
  {
    id: 46,
    nerve_id: "ILX:0791560",
    label: "gray communicating ramus of eighth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6891", "FMA:6890"],
    "subclass labels": ["Left T8 grey ramus communicans", "Right T8 grey ramus communicans"]
  },
  {
    id: 47,
    nerve_id: "ILX:0793827",
    label: "posterior abdominal vagal trunk",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 48,
    nerve_id: "ILX:0794141",
    label: "right cervical vagus nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 49,
    nerve_id: "ILX:0793714",
    label: "Mesenteric nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 50,
    nerve_id: "UBERON:0001964",
    label: "least splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6960", "FMA:6959"],
    "subclass labels": ["Left least splanchnic nerve", "Right least splanchnic nerve"]
  },
  {
    id: 51,
    nerve_id: "UBERON:0001267",
    label: "femoral nerve",
    "FMA subclasses (in human nerves)": ["FMA:16499", "FMA:16500"],
    "subclass labels": ["Right femoral nerve", "Left femoral nerve"]
  },
  {
    id: 52,
    nerve_id: "UBERON:0034984",
    label: "nerve to quadratus femoris",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 53,
    nerve_id: "UBERON:0003721",
    label: "lingual nerve",
    "FMA subclasses (in human nerves)": ["FMA:53219", "FMA:53220"],
    "subclass labels": ["Right lingual nerve", "Left lingual nerve"]
  },
  {
    id: 54,
    nerve_id: "UBERON:0036216",
    label: "tympanic nerve",
    "FMA subclasses (in human nerves)": ["FMA:53481", "FMA:53482"],
    "subclass labels": ["Right tympanic nerve", "Left tympanic nerve"]
  },
  {
    id: 55,
    nerve_id: "ILX:0793216",
    label: "white communicating ramus of tenth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 56,
    nerve_id: "ILX:0793362",
    label: "White communicating ramus of fourth lumbar anterior ramus",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 57,
    nerve_id: "ILX:0793561",
    label: "Internal branch of superior laryngeal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53539", "FMA:53540"],
    "subclass labels": ["Right internal laryngeal nerve", "Left internal laryngeal nerve"]
  },
  {
    id: 58,
    nerve_id: "ILX:0738312",
    label: "Aortic arch depressor nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 59,
    nerve_id: "ILX:0793218",
    label: "white communicating ramus of twelfth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 60,
    nerve_id: "ILX:0738308",
    label: "External branch of inferior laryngeal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 61,
    nerve_id: "ILX:0739299",
    label: "gray communicating ramus of sixth lumbar nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 62,
    nerve_id: "ILX:0793559",
    label: "bladder nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 63,
    nerve_id: "ILX:0793822",
    label: "Superior ovarian nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 64,
    nerve_id: "ILX:0793807",
    label: "Penile cavernous nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 65,
    nerve_id: "UBERON:0011390",
    label: "pudendal nerve",
    "FMA subclasses (in human nerves)": ["FMA:21863", "FMA:21864"],
    "subclass labels": ["Right pudendal nerve", "Left pudendal nerve"]
  },
  {
    id: 66,
    nerve_id: "UBERON:0008810",
    label: "nasopalatine nerve",
    "FMA subclasses (in human nerves)": ["FMA:52799", "FMA:52798"],
    "subclass labels": ["Left nasopalatine nerve", "Right nasopalatine nerve"]
  },
  {
    id: 67,
    nerve_id: "ILX:0793219",
    label: "white communicating ramus of thirteenth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 68,
    nerve_id: "ILX:0793632",
    label: "lumbar colonic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 69,
    nerve_id: "ILX:0784439",
    label: "gray communicating ramus of the fifth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6760", "FMA:6761"],
    "subclass labels": ["Left T5 grey ramus communicans", "Right T5 grey ramus communicans"]
  },
  {
    id: 70,
    nerve_id: "ILX:0794977",
    label: "deep branch of radial nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 71,
    nerve_id: "UBERON:0001884",
    label: "phrenic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6193", "FMA:6192"],
    "subclass labels": ["Left phrenic nerve", "Right phrenic nerve"]
  },
  {
    id: 72,
    nerve_id: "UBERON:0035110",
    label: "lateral plantar nerve",
    "FMA subclasses (in human nerves)": ["FMA:45450", "FMA:45451"],
    "subclass labels": ["Right lateral plantar nerve", "Left lateral plantar nerve"]
  },
  {
    id: 73,
    nerve_id: "ILX:0793711",
    label: "Communicating branch of zygomatic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 74,
    nerve_id: "ILX:0793560",
    label: "External branch of superior laryngeal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53537", "FMA:53538"],
    "subclass labels": ["Right external laryngeal nerve", "Left external laryngeal nerve"]
  },
  {
    id: 75,
    nerve_id: "ILX:0738309",
    label: "Internal branch of inferior laryngeal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 76,
    nerve_id: "UBERON:0001021",
    label: "nerve",
    "FMA subclasses (in human nerves)": ["FMA:6775", "FMA:6894", "FMA:6784", "FMA:6728", "FMA:65325", "FMA:21873", "FMA:45429", "FMA:6844", "FMA:53609", "FMA:7116", "FMA:44770", "FMA:8916", "FMA:52995", "FMA:6071", "FMA:45309", "FMA:6122", "FMA:6892", "FMA:6767", "FMA:16405", "FMA:53560", "FMA:6092", "FMA:65343", "FMA:37066", "FMA:8894", "FMA:8868", "FMA:65341", "FMA:53559", "FMA:8897", "FMA:82956", "FMA:20633", "FMA:6763", "FMA:65339", "FMA:8829", "FMA:16493", "FMA:8817", "FMA:8821", "FMA:11757", "FMA:45456", "FMA:45422", "FMA:11261", "FMA:65388", "FMA:6192", "FMA:65347", "FMA:37068", "FMA:65995", "FMA:6764", "FMA:39081", "FMA:45338", "FMA:53402", "FMA:11210", "FMA:52644", "FMA:37067", "FMA:65313", "FMA:11153", "FMA:6155", "FMA:8797", "FMA:53302", "FMA:8883", "FMA:53067", "FMA:52939", "FMA:53301", "FMA:292889", "FMA:45423", "FMA:8791", "FMA:45380", "FMA:11759", "FMA:7305", "FMA:8830", "FMA:78650", "FMA:65389", "FMA:45387", "FMA:8827", "FMA:8912", "FMA:52941", "FMA:6743", "FMA:7126", "FMA:53485", "FMA:16492", "FMA:53399", "FMA:65337", "FMA:11209", "FMA:6772", "FMA:52726", "FMA:6121", "FMA:52627", "FMA:52974", "FMA:53571", "FMA:6729", "FMA:8729", "FMA:53606", "FMA:80025", "FMA:53481", "FMA:53575", "FMA:45451", "FMA:11218", "FMA:22109", "FMA:6852", "FMA:8909", "FMA:11751", "FMA:65991", "FMA:8836", "FMA:65350", "FMA:53423", "FMA:65569", "FMA:65314", "FMA:82957", "FMA:65438", "FMA:39146", "FMA:8911", "FMA:22111", "FMA:65916", "FMA:65739", "FMA:65917", "FMA:6779", "FMA:8889", "FMA:65924", "FMA:65316", "FMA:53002", "FMA:16887", "FMA:53366", "FMA:6890", "FMA:8790", "FMA:6730", "FMA:45358", "FMA:52716", "FMA:53494", "FMA:7115", "FMA:53561", "FMA:78655", "FMA:45366", "FMA:11219", "FMA:11555", "FMA:7092", "FMA:53220", "FMA:45428", "FMA:6193", "FMA:20604", "FMA:45433", "FMA:21874", "FMA:21875", "FMA:53244", "FMA:45432", "FMA:6770", "FMA:52640", "FMA:11249", "FMA:20630", "FMA:53308", "FMA:11216", "FMA:65399", "FMA:78649", "FMA:11084", "FMA:6897", "FMA:53633", "FMA:6085", "FMA:6851", "FMA:45457", "FMA:6757", "FMA:8732", "FMA:8824", "FMA:20632", "FMA:6137", "FMA:52730", "FMA:7301", "FMA:52699", "FMA:53607", "FMA:7300", "FMA:53576", "FMA:44904", "FMA:65342", "FMA:7127", "FMA:6737", "FMA:52669", "FMA:21876", "FMA:45425", "FMA:65999", "FMA:8728", "FMA:21871", "FMA:55172", "FMA:6149", "FMA:45453", "FMA:44932", "FMA:292832", "FMA:6744", "FMA:6781", "FMA:44769", "FMA:45326", "FMA:6760", "FMA:53634", "FMA:53605", "FMA:53530", "FMA:6821", "FMA:52968", "FMA:53001", "FMA:11552", "FMA:45264", "FMA:8835", "FMA:6888", "FMA:55160", "FMA:44899", "FMA:52979", "FMA:45333", "FMA:45310", "FMA:6084", "FMA:11781", "FMA:82962", "FMA:53280", "FMA:52715", "FMA:53311", "FMA:16491", "FMA:21880", "FMA:44952", "FMA:11687", "FMA:11212", "FMA:65335", "FMA:52940", "FMA:6774", "FMA:8823", "FMA:45388", "FMA:6666", "FMA:6072", "FMA:16886", "FMA:53312", "FMA:65915", "FMA:45357", "FMA:11262", "FMA:65921", "FMA:0328826", "FMA:81290", "FMA:53279", "FMA:11551", "FMA:7293", "FMA:6677", "FMA:11756", "FMA:53598", "FMA:52732", "FMA:44902", "FMA:53545", "FMA:6740", "FMA:53502", "FMA:53562", "FMA:52700", "FMA:7122", "FMA:6118", "FMA:65918", "FMA:8814", "FMA:16403", "FMA:65346", "FMA:6667", "FMA:52630", "FMA:52629", "FMA:8871", "FMA:16500", "FMA:52725", "FMA:6108", "FMA:45363", "FMA:65340", "FMA:8872", "FMA:11760", "FMA:53604", "FMA:11214", "FMA:52777", "FMA:21864", "FMA:53503", "FMA:6738", "FMA:66000", "FMA:6776", "FMA:6777", "FMA:6765", "FMA:6111", "FMA:8890", "FMA:20607", "FMA:52643", "FMA:8908", "FMA:65437", "FMA:6762", "FMA:11154", "FMA:65344", "FMA:52937", "FMA:8919", "FMA:45354", "FMA:6766", "FMA:53424", "FMA:6145", "FMA:65568", "FMA:20634", "FMA:6732", "FMA:8893", "FMA:11758", "FMA:6889", "FMA:11554", "FMA:65922", "FMA:7118", "FMA:16884", "FMA:45308", "FMA:7290", "FMA:6758", "FMA:65743", "FMA:11063", "FMA:16885", "FMA:8882", "FMA:65286", "FMA:291238", "FMA:53482", "FMA:52976", "FMA:11308", "FMA:53432", "FMA:53540", "FMA:45379", "FMA:44871", "FMA:6714", "FMA:82955", "FMA:65993", "FMA:45452", "FMA:52626", "FMA:6083", "FMA:53582", "FMA:65919", "FMA:52936", "FMA:53506", "FMA:8918", "FMA:44901", "FMA:6073", "FMA:65315", "FMA:53219", "FMA:11194", "FMA:6792", "FMA:7119", "FMA:52785", "FMA:7296", "FMA:53068", "FMA:6845", "FMA:52677", "FMA:53504", "FMA:53548", "FMA:52698", "FMA:53570", "FMA:6771", "FMA:7078", "FMA:65997", "FMA:65338", "FMA:52969", "FMA:16401", "FMA:65416", "FMA:6835", "FMA:39082", "FMA:8726", "FMA:45254", "FMA:8879", "FMA:11250", "FMA:53049", "FMA:45382", "FMA:8795", "FMA:53495", "FMA:45434", "FMA:82963", "FMA:0328827", "FMA:52656", "FMA:82961", "FMA:11753", "FMA:39147", "FMA:45339", "FMA:20605", "FMA:20631", "FMA:8898", "FMA:6070", "FMA:44892", "FMA:16404", "FMA:52942", "FMA:6082", "FMA:8861", "FMA:82953", "FMA:8808", "FMA:8805", "FMA:52994", "FMA:65348", "FMA:55173", "FMA:7129", "FMA:52674", "FMA:44894", "FMA:55159", "FMA:65327", "FMA:37320", "FMA:6761", "FMA:65349", "FMA:11253", "FMA:53507", "FMA:11213", "FMA:7307", "FMA:6769", "FMA:6759", "FMA:55155", "FMA:53675", "FMA:53599", "FMA:65282", "FMA:53251", "FMA:6731", "FMA:11111", "FMA:16497", "FMA:8878", "FMA:11211", "FMA:65740", "FMA:45367", "FMA:53588", "FMA:45365", "UBERON:0011766", "FMA:16502", "FMA:6891", "FMA:6091", "FMA:11018", "FMA:6090", "FMA:292887", "FMA:65401", "FMA:65326", "FMA:11215", "FMA:44735", "FMA:8735", "FMA:53538", "FMA:6849", "FMA:53608", "FMA:11217", "FMA:8860", "FMA:6134", "FMA:6893", "FMA:53534", "FMA:45361", "FMA:37321", "FMA:82734", "FMA:22112", "FMA:7294", "FMA:52987", "FMA:65247", "FMA:53535", "FMA:6895", "FMA:52787", "FMA:53635", "FMA:65920", "FMA:55156", "FMA:16498", "FMA:53569", "FMA:6739", "FMA:8807", "FMA:22110", "FMA:81294", "FMA:45450", "FMA:8922", "FMA:8725", "FMA:20608", "FMA:7308", "FMA:65281", "FMA:39084", "FMA:78656", "FMA:6133", "FMA:53581", "FMA:16494", "FMA:53252", "FMA:11789", "FMA:45364", "FMA:65345", "FMA:44870", "FMA:39083", "FMA:45355", "FMA:11193", "FMA:16400", "FMA:81287", "FMA:52776", "FMA:65747", "FMA:8900", "UBERON:0011767", "FMA:45424", "FMA:292830", "FMA:44734", "FMA:45381", "FMA:82960", "FMA:0328831", "FMA:6689", "FMA:7077", "FMA:291236", "FMA:8886", "FMA:276381", "FMA:6124", "FMA:65336", "FMA:65328", "FMA:52670", "FMA:53537", "FMA:53636", "FMA:6896", "FMA:21879", "FMA:8798", "FMA:81288", "FMA:53542", "FMA:45368", "FMA:53547", "FMA:55157", "FMA:65415", "FMA:53309", "FMA:65744", "FMA:53367", "FMA:53590", "FMA:65923", "FMA:53048", "FMA:16499", "FMA:53610", "FMA:44951", "FMA:44953", "FMA:8832", "FMA:45426", "FMA:6114", "FMA:52799", "FMA:11039", "FMA:53546", "FMA:53589", "FMA:8901", "FMA:11681", "FMA:52639", "FMA:8905", "FMA:52733", "FMA:65992", "FMA:52807", "FMA:45435", "FMA:53484", "FMA:52975", "FMA:7289", "FMA:44905", "FMA:37071", "FMA:7130", "FMA:65996", "FMA:6132", "FMA:8826", "FMA:6741", "FMA:11252", "FMA:8917", "FMA:82954", "FMA:6832", "FMA:37073", "FMA:37074", "FMA:44893", "FMA:82959", "FMA:20635", "FMA:6093", "FMA:65248", "FMA:45362", "FMA:52622", "FMA:53508", "FMA:11755", "FMA:82958", "FMA:52997", "FMA:16501", "FMA:65402", "FMA:45427", "FMA:52803", "FMA:16402", "FMA:8734", "FMA:52784", "FMA:45454", "FMA:6736", "FMA:7304", "FMA:6742", "FMA:52998", "FMA:52804", "FMA:11788", "FMA:6713", "FMA:52623", "FMA:53536", "FMA:11780", "FMA:45334", "FMA:52701", "FMA:65998", "FMA:11092", "FMA:6684", "FMA:52779", "FMA:52778", "FMA:78652", "FMA:0328830", "FMA:6733", "FMA:44950", "FMA:78653", "FMA:45455", "FMA:8864", "FMA:8833", "FMA:8876", "FMA:8867", "FMA:11752", "FMA:53541", "FMA:53611", "FMA:8904", "FMA:6745", "FMA:21863", "FMA:7297", "FMA:52676", "FMA:52798", "FMA:8818", "FMA:82735", "FMA:52657", "FMA:52786", "FMA:6773", "FMA:45253", "FMA:6127", "FMA:45263", "FMA:8875", "FMA:81295", "FMA:11754", "FMA:8812", "FMA:45311", "FMA:53568", "FMA:276379", "FMA:6842", "FMA:8794", "FMA:8820", "FMA:53572", "FMA:53409", "FMA:37070", "FMA:6119", "FMA:53433", "FMA:7123", "FMA:8811", "FMA:65444", "FMA:52806", "FMA:53245", "FMA:65285", "FMA:6768", "FMA:8731", "FMA:11220", "FMA:6778", "FMA:53509", "FMA:55158", "FMA:53567", "FMA:65994", "FMA:53539", "FMA:45327", "FMA:8865", "FMA:44898", "FMA:52673", "FMA:80026", "FMA:52980", "FMA:53505", "FMA:82952", "FMA:21872", "FMA:37065", "FMA:52988", "FMA:8815", "FMA:53398", "FMA:52729", "FMA:81289", "FMA:65398", "FMA:52977", "FMA:8887"],
    "subclass labels": ["Left T9 white ramus communicans", "Right T10 grey ramus communicans", "Right T4 spinal nerve posterior ramus", "Right fourth intercostal nerve", "Right anterior interosseous nerve", "Right perineal nerve", "Left lateral calcaneal branch A of left sural nerve", "Right C3 spinal nerve posterior ramus medial branch", "Oesophageal branch of left recurrent laryngeal nerve", "Anterior branch of lateral cutaneous branch of left third intercostal nerve", "Left common plantar digital nerve F", "Anterior cutaneous branch of right subcostal nerve", "Left superior labial branch of infraorbital nerve", "Left T1 spinal nerve posterior ramus", "Anterior branch of left obturator nerve", "Right T2 grey ramus communicans", "Right T9 grey ramus communicans", "Left T5 white ramus communicans", "Left L3 spinal nerve posterior ramus lateral branch", "Communicating branch of left vagus nerve with left glossopharyngeal nerve", "Right second intercostal nerve", "Right proper palmar digital nerve G", "Left musculocutaneous nerve", "Anterior cutaneous branch of left ninth intercostal nerve", "Posterior branch of lateral cutaneous branch of left sixth intercostal nerve", "Right proper palmar digital nerve H", "Communicating branch of right vagus nerve with right glossopharyngeal nerve", "Anterior branch of lateral cutaneous branch of right ninth intercostal nerve", "Right proper plantar digital nerve C", "Left genital branch of genitofemoral nerve", "Left T6 grey ramus communicans", "Right proper palmar digital nerve I", "Right T12 spinal nerve posterior ramus", "Right ilioinguinal nerve", "Right T8 spinal nerve posterior ramus", "Left T9 spinal nerve posterior ramus", "Right T11 spinal nerve posterior ramus lateral branch", "Right proper plantar digital nerve J", "Right medial sural cutaneous nerve", "Right T6 spinal nerve posterior ramus medial branch", "Right lesser occipital nerve", "Right phrenic nerve", "Right proper palmar digital nerve E", "Left median nerve", "Right S3 grey ramus communicans", "Right T4 white ramus communicans", "Right medial cutaneous nerve of forearm", "Right posterior femoral cutaneous nerve", "Right vestibular nerve", "Lateral cutaneous branch of left sixth intercostal nerve", "Left supratrochlear nerve", "Right median nerve", "Anterior branch of right medial cutaneous nerve of forearm", "Right T5 spinal nerve posterior ramus medial branch", "Anterior cutaneous branch of right third intercostal nerve", "Right C6 spinal nerve posterior ramus", "Temporal branch of left facial nerve", "Anterior cutaneous branch of left eighth intercostal nerve", "Right buccal nerve", "Right middle superior alveolar nerve", "Temporal branch of right facial nerve", "Left superficial branch of radial nerve", "Left medial sural cutaneous nerve", "Left C4 spinal nerve posterior ramus", "Left lateral dorsal digital nerve of the third toe", "Right T12 spinal nerve posterior ramus lateral branch", "Anterior branch of lateral cutaneous branch of left eleventh intercostal nerve", "Left T12 spinal nerve posterior ramus", "Left anterior supraclavicular nerve", "Left lesser occipital nerve", "Right deep fibular nerve", "Left T11 spinal nerve posterior ramus", "Posterior branch of lateral cutaneous branch of left tenth intercostal nerve", "Right anterior superior alveolar nerve", "Left tenth intercostal nerve", "Anterior branch of lateral cutaneous branch of right fourth intercostal nerve", "Communicating branch of left glossopharyngeal nerve with auricular branch of left vagus nerve", "Left iliohypogastric nerve", "Cervical branch of left facial nerve", "Right proper palmar digital nerve J", "Lateral cutaneous branch of right sixth intercostal nerve", "Right T8 white ramus communicans", "Left maxillary nerve", "Left intercostobrachial nerve", "Left tentorial nerve", "Right zygomaticotemporal nerve", "Communicating branch of right internal laryngeal nerve with right recurrent laryngeal nerve", "Left fourth intercostal nerve", "Brachial plexus left C7 root", "Vagal branch to right carotid body", "Right proper plantar digital nerve G", "Right tympanic nerve", "Left lateral plantar nerve", "Lateral cutaneous branch of left tenth intercostal nerve", "Right tibial nerve", "Left third occipital nerve", "Anterior branch of lateral cutaneous branch of left tenth intercostal nerve", "Right T8 spinal nerve posterior ramus lateral branch", "Right S1 grey ramus communicans", "Left L3 spinal nerve posterior ramus", "Palmar cutaneous branch of left ulnar nerve", "Right greater petrosal nerve", "Left subcostal nerve", "Anterior branch of left medial cutaneous nerve of forearm", "Left proper plantar digital nerve C", "Left C3 spinal nerve branch to left supraclavicular nerve", "Right posterior cutaneous nerve of forearm", "Posterior branch of lateral cutaneous branch of right tenth intercostal nerve", "Right sciatic nerve", "Left L5 grey ramus communicans", "Right C4 spinal nerve posterior ramus medial branch", "Right L4 grey ramus communicans", "Left T11 white ramus communicans", "Posterior branch of lateral cutaneous branch of right eighth intercostal nerve", "Left L1 grey ramus communicans", "Posterior branch of left medial cutaneous nerve of forearm", "Left auriculotemporal nerve", "Left L2 white ramus communicans", "Marginal mandibular branch of right facial nerve", "Right T8 grey ramus communicans", "Right C4 spinal nerve posterior ramus", "Right fifth intercostal nerve", "Left common fibular nerve", "Left posterior ethmoidal nerve", "Pharyngeal branch of right glossopharyngeal nerve", "Anterior branch of lateral cutaneous branch of right third intercostal nerve", "Communicating branch of right external laryngeal nerve with right superior cardiac nerve", "Right posterior supraclavicular nerve", "Left medial dorsal cutaneous nerve", "Lateral cutaneous branch of right eleventh intercostal nerve", "Posterior branch of lateral cutaneous branch of left subcostal nerve", "Anterior cutaneous branch of left second intercostal nerve", "Left lingual nerve", "Right lateral calcaneal branch A of right sural nerve", "Left phrenic nerve", "Right hypogastric nerve", "Medial calcaneal branch A of left tibial nerve", "Left perineal nerve", "Right posterior scrotal nerve", "Right inferior alveolar nerve", "Medial calcaneal branch A of right tibial nerve", "Right T7 white ramus communicans", "Left frontal nerve", "Right T1 spinal nerve posterior ramus medial branch", "Right genitofemoral nerve", "Zygomatic branch of right facial nerve", "Lateral cutaneous branch of left ninth intercostal nerve", "Left C2 spinal nerve branch to left great auricular nerve", "Right anterior supraclavicular nerve", "Lateral cutaneous branch of right fourth intercostal nerve", "Left T11 grey ramus communicans", "Lingual branch of right vagus nerve", "Left T1 white ramus communicans", "Left C3 spinal nerve posterior ramus medial branch", "Left proper plantar digital nerve J", "Left T2 grey ramus communicans", "Brachial plexus left C6 root", "Left T10 spinal nerve posterior ramus", "Right genital branch of genitofemoral nerve", "Anterior cutaneous branch of right first intercostal nerve", "Left middle meningeal nerve", "Anterior cutaneous branch of left eleventh intercostal nerve", "Left infratrochlear nerve", "Vagal branch to left carotid body", "Anterior cutaneous branch of right eleventh intercostal nerve", "Right proper palmar digital nerve B", "Left proper palmar digital nerve H", "Anterior branch of lateral cutaneous branch of left fourth intercostal nerve", "Left seventh intercostal nerve", "Right nasociliary nerve", "Left posterior scrotal nerve", "Left sural nerve", "Right S5 grey ramus communicans", "Brachial plexus right C7 root", "Right inferior rectal nerve", "Right transverse cervical nerve", "Anterior cutaneous branch of left third intercostal nerve", "Left proper plantar digital nerve H", "Superficial branch of left ulnar nerve", "Dorsal branch of left ulnar nerve", "Right eleventh intercostal nerve", "Right T2 white ramus communicans", "Right common plantar digital nerve F", "Infrapatellar branch of right saphenous nerve", "Left T5 grey ramus communicans", "Lingual branch of left vagus nerve", "Thoracic cardiac branch of left vagus nerve", "Right superior laryngeal nerve", "Right C2 spinal nerve posterior ramus", "Right zygomatic nerve", "Right auriculotemporal nerve", "Anterior branch of lateral cutaneous branch of left subcostal nerve", "Left saphenous nerve", "Right L3 spinal nerve posterior ramus", "Right T7 grey ramus communicans", "Left great auricular nerve posterior branch", "Left proper palmar digital nerve A", "Right infraorbital nerve", "Cutaneous branch of right obturator nerve", "Posterior branch of right obturator nerve", "Left T1 grey ramus communicans", "Right T12 white ramus communicans", "Right proper plantar digital nerve F", "Left posterior auricular nerve", "Right posterior ethmoidal nerve", "Buccal branch of right facial nerve", "Right iliohypogastric nerve", "Left dorsal nerve of penis", "Right inferior lateral cutaneous nerve of arm", "Left T7 spinal nerve posterior ramus lateral branch", "Lateral cutaneous branch of left seventh intercostal nerve", "Right posterior interosseous nerve", "Left middle superior alveolar nerve", "Right T9 white ramus communicans", "Right T10 spinal nerve posterior ramus", "Left deep fibular nerve", "Hepatic branch of anterior vagal trunk", "Left first intercostal nerve", "Right L2 white ramus communicans", "Buccal branch of left facial nerve", "Right L5 grey ramus communicans", "Right common fibular nerve", "Left T6 spinal nerve posterior ramus medial branch", "Right L2 grey ramus communicans", "Right deep petrosal nerve", "Left axillary nerve posterior branch", "Right posterior auricular nerve", "Anterior branch of lateral cutaneous branch of right subcostal nerve", "Anterior branch of lateral cutaneous branch of right fifth intercostal nerve", "Pyloric branch of greater posterior gastric nerve", "Left T10 spinal nerve posterior ramus lateral branch", "Superior cervical cardiac branch of right vagus nerve", "Ganglionic branch of right maxillary nerve to pterygopalatine ganglion", "Left proper palmar digital nerve C", "Right superior cervical cardiac nerve", "Right ninth intercostal nerve", "Right lesser petrosal nerve", "Communicating branch of left external laryngeal nerve with left superior cardiac nerve", "Right long ciliary nerve B", "Anterior cutaneous branch of right fourth intercostal nerve", "Right third intercostal nerve", "Left L4 grey ramus communicans", "Right T7 spinal nerve posterior ramus", "Left L2 spinal nerve posterior ramus lateral branch", "Left proper palmar digital nerve F", "Coeliac branch of posterior vagal trunk", "Left lacrimal nerve", "Right lacrimal nerve", "Anterior cutaneous branch of right seventh intercostal nerve", "Left femoral nerve", "Right maxillary nerve", "Lateral cutaneous branch of right third intercostal nerve", "Right superficial fibular nerve", "Left proper palmar digital nerve I", "Anterior cutaneous branch of left seventh intercostal nerve", "Left T12 spinal nerve posterior ramus lateral branch", "Thoracic cardiac branch of right vagus nerve", "Lateral cutaneous branch of left eighth intercostal nerve", "Orbital branch of left maxillary nerve to left ethmoidal sinus", "Left pudendal nerve", "Left lesser petrosal nerve", "Right eighth intercostal nerve", "Left S5 grey ramus communicans", "Right T10 white ramus communicans", "Left T10 white ramus communicans", "Left T4 white ramus communicans", "Lateral cutaneous branch of left third intercostal nerve", "Posterior branch of lateral cutaneous branch of left eighth intercostal nerve", "Lateral cutaneous branch of right iliohypogastric nerve", "Right supratrochlear nerve", "Anterior branch of lateral cutaneous branch of right tenth intercostal nerve", "Right C3 spinal nerve branch to right supraclavicular nerve", "Right T6 grey ramus communicans", "Left T5 spinal nerve posterior ramus medial branch", "Left proper palmar digital nerve G", "Left posterior superior alveolar nerve", "Lateral cutaneous branch of left subcostal nerve", "Gluteal branch A of right posterior femoral cutaneous nerve", "Right T5 white ramus communicans", "Left greater petrosal nerve", "Left T3 spinal nerve posterior ramus", "Right subcostal nerve", "Right femoral branch of genitofemoral nerve", "Right sixth intercostal nerve", "Anterior cutaneous branch of right ninth intercostal nerve", "Left T11 spinal nerve posterior ramus lateral branch", "Left T7 grey ramus communicans", "Posterior branch of lateral cutaneous branch of right subcostal nerve", "Left L2 grey ramus communicans", "Posterior branch of lateral cutaneous branch of right third intercostal nerve", "Right L1 white ramus communicans", "Anterior branch of right obturator nerve", "Anterior cutaneous branch of left fifth intercostal nerve", "Left T4 grey ramus communicans", "Right C5 spinal nerve posterior ramus medial branch", "Right T4 spinal nerve posterior ramus medial branch", "Left L1 white ramus communicans", "Anterior cutaneous branch of right eighth intercostal nerve", "Left subclavian nerve", "Pericardial branch of left phrenic nerve", "Left tympanic nerve", "Right zygomaticofacial nerve", "Right intercostobrachial nerve", "Right cochlear nerve", "Left internal laryngeal nerve", "Right lateral dorsal digital nerve of the third toe", "Left proper palmar digital nerve D", "Inferior cervical cardiac branch of left vagus nerve", "Left proper plantar digital nerve B", "Right S2 grey ramus communicans", "Right proper plantar digital nerve H", "Right tentorial nerve", "Right T1 white ramus communicans", "Inferior ramus of left internal laryngeal nerve", "Right L3 grey ramus communicans", "Right posterior superior alveolar nerve", "Tonsillar branch of right glossopharyngeal nerve", "Lateral cutaneous branch of right subcostal nerve", "Right proper palmar digital nerve C", "Right first intercostal nerve", "Posterior branch of right medial cutaneous nerve of forearm", "Right lingual nerve", "Lateral cutaneous branch of right fifth intercostal nerve", "Left T4 spinal nerve posterior ramus", "Posterior branch of lateral cutaneous branch of left third intercostal nerve", "Right posterior superior lateral nasal branch of maxillary nerve", "Posterior branch of lateral cutaneous branch of right fifth intercostal nerve", "Left buccal nerve", "Right third occipital nerve", "Left anterior ethmoidal nerve", "Right lingual branch of glossopharyngeal nerve", "Left laryngopharyngeal branch of superior cervical ganglion", "Right infratrochlear nerve", "Left external laryngeal nerve branch to pharyngeal plexus", "Left T7 white ramus communicans", "Left L1 spinal nerve posterior ramus", "Right S4 grey ramus communicans", "Left proper palmar digital nerve J", "Left zygomatic nerve", "Left L1 spinal nerve posterior ramus lateral branch", "Left greater occipital nerve", "Left medial cutaneous nerve of forearm", "Brachial plexus left C8 root", "Left anterior femoral cutaneous branch A", "Posterior branch of lateral cutaneous branch of left seventh intercostal nerve", "Left T1 spinal nerve posterior ramus medial branch", "Left meningeal branch of mandibular nerve", "Left medial dorsal digital nerve of the fourth toe", "Left C5 spinal nerve posterior ramus", "Pharyngeal branch of left glossopharyngeal nerve", "Right medial plantar nerve", "Left proper plantar digital nerve F", "Left deep petrosal nerve", "Right supraorbital nerve", "Left proper plantar digital nerve E", "Right T9 spinal nerve posterior ramus lateral branch", "Left posterior cutaneous nerve of forearm", "Left posterior femoral cutaneous nerve", "Left hypogastric nerve", "Left genitofemoral nerve", "Anterior branch of lateral cutaneous branch of left ninth intercostal nerve", "Right T1 spinal nerve posterior ramus", "Right common palmar digital nerve A", "Right L3 spinal nerve posterior ramus lateral branch", "Left anterior superior alveolar nerve", "Right T1 grey ramus communicans", "Anterior cutaneous branch of left sixth intercostal nerve", "Left proper plantar digital nerve A", "Left T5 spinal nerve posterior ramus", "Right T3 spinal nerve posterior ramus", "Right superior labial branch of infraorbital nerve", "Left proper palmar digital nerve E", "Left transverse cervical nerve", "Posterior branch of lateral cutaneous branch of right fourth intercostal nerve", "Left communicating branch of nasociliary nerve with ciliary ganglion", "Superficial branch of right ulnar nerve", "Right great auricular nerve posterior branch", "Palmar branch of right median nerve", "Right ulnar nerve", "Right T5 grey ramus communicans", "Palmar cutaneous branch of right ulnar nerve", "Left T2 spinal nerve posterior ramus medial branch", "Tonsillar branch of left glossopharyngeal nerve", "Lateral cutaneous branch of right eighth intercostal nerve", "Posterior branch of lateral cutaneous branch of right eleventh intercostal nerve", "Left T6 white ramus communicans", "Right T4 grey ramus communicans", "Branch of right vagus nerve to oesophageal nerve plexus", "Superior cervical cardiac branch of left vagus nerve", "Left long thoracic nerve", "Right mental nerve", "Left fifth intercostal nerve", "Lateral cutaneous branch of left fourth intercostal nerve", "Right lateral femoral cutaneous nerve", "Posterior branch of lateral cutaneous branch of right seventh intercostal nerve", "Lateral cutaneous branch of right seventh intercostal nerve", "Left C4 spinal nerve posterior ramus medial branch", "Right intermediate dorsal cutaneous nerve", "Right medial dorsal cutaneous nerve", "Left recurrent laryngeal nerve", "Left obturator nerve", "Left T8 grey ramus communicans", "Right T2 spinal nerve posterior ramus", "Right T3 spinal nerve posterior ramus medial branch", "Left T2 spinal nerve posterior ramus", "Right superficial branch of radial nerve", "Right C3 spinal nerve branch to right great auricular nerve", "Left anterior interosseous nerve", "Lateral cutaneous branch of right ninth intercostal nerve", "Left common plantar digital nerve E", "Brachial plexus left C5 root", "Left external laryngeal nerve", "Left C3 spinal nerve posterior ramus", "Oesophageal branch of right recurrent laryngeal nerve", "Lateral cutaneous branch of right tenth intercostal nerve", "Anterior cutaneous branch of right sixth intercostal nerve", "Right T3 white ramus communicans", "Left T9 grey ramus communicans", "Auricular branch of right vagus nerve", "Right lateral sural cutaneous nerve", "Left ulnar nerve", "Right long ciliary nerve A", "Left sciatic nerve", "Anterior branch of lateral cutaneous branch of left fifth intercostal nerve", "Right inferior palpebral branch of infraorbital nerve", "Right medial cutaneous nerve of arm", "Auricular branch of left vagus nerve", "Left T10 grey ramus communicans", "Left medial posterior superior nasal nerve", "Pharyngeal branch of right vagus nerve to pharyngeal nerve plexus", "Left L3 grey ramus communicans", "Left lateral femoral cutaneous nerve", "Right external laryngeal nerve branch to pharyngeal plexus", "Left eighth intercostal nerve", "Right T5 spinal nerve posterior ramus", "Left tibial nerve", "Right superior lateral cutaneous nerve of arm", "Right lateral plantar nerve", "Anterior cutaneous branch of left first intercostal nerve", "Brachial plexus right C8 root", "Lateral cutaneous branch of left iliohypogastric nerve", "Posterior branch of lateral cutaneous branch of left eleventh intercostal nerve", "Right long thoracic nerve", "Left lateral cutaneous nerve of forearm", "Left posterior supraclavicular nerve", "Left T3 grey ramus communicans", "Left ilioinguinal nerve", "Left mental nerve", "Left T12 white ramus communicans", "Left superficial fibular nerve", "Right proper palmar digital nerve F", "Right proper palmar digital nerve D", "Right lateral cutaneous nerve of forearm", "Gluteal branch A of left posterior femoral cutaneous nerve", "Lateral cutaneous branch of left fifth intercostal nerve", "Right L1 spinal nerve posterior ramus lateral branch", "Right axillary nerve anterior branch", "Orbital branch of right maxillary nerve to right ethmoidal sinus", "Right C6 spinal nerve posterior ramus medial branch", "Posterior branch of lateral cutaneous branch of right ninth intercostal nerve", "Right recurrent laryngeal nerve", "Right sural nerve", "Dorsal branch of right ulnar nerve", "Right common plantar digital nerve E", "Right medial dorsal digital nerve of the fourth toe", "Right proper plantar digital nerve E", "Left caroticotympanic nerve", "Greater posterior gastric nerve", "Right L1 spinal nerve posterior ramus", "Pericardial branch of right phrenic nerve", "Anterior branch of lateral cutaneous branch of right eighth intercostal nerve", "Left incisive branch of inferior alveolar nerve", "Right T3 grey ramus communicans", "Left posterior interosseous nerve", "Palmar branch of left median nerve", "Left nasociliary nerve", "Right external laryngeal nerve", "Pharyngeal branch of left vagus nerve to pharyngeal nerve plexus", "Right T11 grey ramus communicans", "Right dorsal nerve of penis", "Left C6 spinal nerve posterior ramus", "Left axillary nerve anterior branch", "Meningeal branch of left vagus nerve", "Left intermediate dorsal cutaneous nerve", "Right laryngopharyngeal branch of superior cervical ganglion", "Right great auricular nerve anterior branch", "Zygomatic branch of left facial nerve", "Left C5 spinal nerve posterior ramus medial branch", "Marginal mandibular branch of left facial nerve", "Right L1 grey ramus communicans", "Right meningeal branch of mandibular nerve", "Right femoral nerve", "Tracheal branch of right recurrent laryngeal nerve", "Left posterior cutaneous nerve of arm", "Left inferior lateral cutaneous nerve of arm", "Right L2 spinal nerve posterior ramus", "Right lateral dorsal cutaneous nerve", "Anterior cutaneous branch of right second intercostal nerve", "Left nasopalatine nerve", "Left T3 spinal nerve posterior ramus medial branch", "Left superior cervical cardiac nerve", "Posterior branch of lateral cutaneous branch of left ninth intercostal nerve", "Right T7 spinal nerve posterior ramus lateral branch", "Right frontal nerve", "Anterior cutaneous branch of left tenth intercostal nerve", "Ganglionic branch of left maxillary nerve to pterygopalatine ganglion", "Left S1 grey ramus communicans", "Left lesser palatine nerve", "Left medial plantar nerve", "Communicating branch of right glossopharyngeal nerve with auricular branch of right vagus nerve", "Left zygomaticotemporal nerve", "Anterior cutaneous branch of right fifth intercostal nerve", "Left proper palmar digital nerve B", "Left radial nerve", "Posterior branch of lateral cutaneous branch of left fourth intercostal nerve", "Left S3 grey ramus communicans", "Left T3 white ramus communicans", "Right T11 spinal nerve posterior ramus", "Left ninth intercostal nerve", "Right T2 spinal nerve posterior ramus medial branch", "Anterior cutaneous branch of left subcostal nerve", "Right proper plantar digital nerve B", "Left C2 spinal nerve posterior ramus", "Right axillary nerve", "Left axillary nerve", "Left common palmar digital nerve A", "Left proper plantar digital nerve D", "Left femoral branch of genitofemoral nerve", "Left second intercostal nerve", "Left medial cutaneous nerve of arm", "Left lateral sural cutaneous nerve", "Right ophthalmic nerve", "Right carotid sinus nerve", "Right T10 spinal nerve posterior ramus lateral branch", "Right proper plantar digital nerve D", "Right mandibular nerve", "Right obturator nerve", "Left C3 spinal nerve branch to left great auricular nerve", "Left lateral dorsal cutaneous nerve", "Right greater palatine nerve", "Right L2 spinal nerve posterior ramus lateral branch", "Brachial plexus right C5 root", "Left posterior superior lateral nasal branch of maxillary nerve", "Right proper plantar digital nerve I", "Right seventh intercostal nerve", "Anterior branch of lateral cutaneous branch of right eleventh intercostal nerve", "Right tenth intercostal nerve", "Left mandibular nerve", "Left greater palatine nerve", "Left T12 grey ramus communicans", "Inferior cervical cardiac branch of right vagus nerve", "Left ophthalmic nerve", "Left superior laryngeal nerve", "Right T12 grey ramus communicans", "Cutaneous branch of left obturator nerve", "Left long ciliary nerve B", "Left S4 grey ramus communicans", "Left T4 spinal nerve posterior ramus medial branch", "Greater anterior gastric nerve", "Orbital branch of left maxillary nerve to left sphenoidal sinus", "Orbital branch of right maxillary nerve to right sphenoidal sinus", "Right middle supraclavicular nerve", "Right caroticotympanic nerve", "Left sixth intercostal nerve", "Right posterior cutaneous nerve of arm", "Left middle supraclavicular nerve", "Left proper plantar digital nerve I", "Anterior branch of lateral cutaneous branch of right sixth intercostal nerve", "Left L2 spinal nerve posterior ramus", "Anterior branch of lateral cutaneous branch of left seventh intercostal nerve", "Posterior branch of lateral cutaneous branch of right sixth intercostal nerve", "Left T8 spinal nerve posterior ramus lateral branch", "Meningeal branch of right vagus nerve", "Tracheal branch of left recurrent laryngeal nerve", "Anterior cutaneous branch of right tenth intercostal nerve", "Left eleventh intercostal nerve", "Right pudendal nerve", "Posterior branch of lateral cutaneous branch of left fifth intercostal nerve", "Right anterior ethmoidal nerve", "Right nasopalatine nerve", "Left T8 spinal nerve posterior ramus", "Left long ciliary nerve A", "Left supraorbital nerve", "Right medial posterior superior nasal nerve", "Left T8 white ramus communicans", "Right anterior femoral cutaneous branch A", "Left T2 white ramus communicans", "Right saphenous nerve", "Anterior branch of lateral cutaneous branch of right seventh intercostal nerve", "Left superior lateral cutaneous nerve of arm", "Left T9 spinal nerve posterior ramus lateral branch", "Left T6 spinal nerve posterior ramus", "Posterior branch of left obturator nerve", "Left external laryngeal nerve branch to inferior pharyngeal constrictor", "Right incisive branch of inferior alveolar nerve", "Right C3 spinal nerve posterior ramus", "Right C5 spinal nerve posterior ramus", "Right T9 spinal nerve posterior ramus", "Communicating branch of left internal laryngeal nerve with left recurrent laryngeal nerve", "Left vestibular nerve", "Right radial nerve", "Left third intercostal nerve", "Left cochlear nerve", "Anterior cutaneous branch of left fourth intercostal nerve", "Right T6 spinal nerve posterior ramus", "Right greater occipital nerve", "Right lesser palatine nerve", "Left inferior alveolar nerve", "Right subclavian nerve", "Right T6 white ramus communicans", "Brachial plexus right C6 root", "Lateral cutaneous branch of left eleventh intercostal nerve", "Right T11 white ramus communicans", "Left carotid sinus nerve", "Left great auricular nerve anterior branch", "Right external laryngeal nerve branch to inferior pharyngeal constrictor", "Left S2 grey ramus communicans", "Right internal laryngeal nerve", "Infrapatellar branch of left saphenous nerve", "Anterior branch of lateral cutaneous branch of left sixth intercostal nerve", "Right proper palmar digital nerve A", "Right communicating branch of nasociliary nerve with ciliary ganglion", "Left proper plantar digital nerve G", "Left infraorbital nerve", "Left lingual branch of glossopharyngeal nerve", "Right proper plantar digital nerve A", "Left inferior rectal nerve", "Right musculocutaneous nerve", "Left inferior palpebral branch of infraorbital nerve", "Left T7 spinal nerve posterior ramus", "Cervical branch of right facial nerve", "Right middle meningeal nerve", "Right axillary nerve posterior branch", "Right C2 spinal nerve branch to right great auricular nerve", "Left zygomaticofacial nerve", "Anterior branch of lateral cutaneous branch of left eighth intercostal nerve"]
  },
  {
    id: 77,
    nerve_id: "UBERON:0001647",
    label: "facial nerve",
    "FMA subclasses (in human nerves)": ["FMA:50888", "FMA:50889"],
    "subclass labels": ["Right facial nerve", "Left facial nerve"]
  },
  {
    id: 78,
    nerve_id: "UBERON:0001148",
    label: "median nerve",
    "FMA subclasses (in human nerves)": ["FMA:37067", "FMA:37068"],
    "subclass labels": ["Right median nerve", "Left median nerve"]
  },
  {
    id: 79,
    nerve_id: "UBERON:0009009",
    label: "carotid sinus nerve",
    "FMA subclasses (in human nerves)": ["FMA:53508", "FMA:53509"],
    "subclass labels": ["Right carotid sinus nerve", "Left carotid sinus nerve"]
  },
  {
    id: 80,
    nerve_id: "UBERON:0003715",
    label: "splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6924", "FMA:6928", "FMA:6929", "FMA:6931", "FMA:6930", "FMA:6960", "FMA:6958", "FMA:6959", "FMA:6925", "FMA:6956", "FMA:6927", "FMA:6955", "FMA:6926", "FMA:6957"],
    "subclass labels": ["Right first lumbar splanchnic nerve", "Right third lumbar splanchnic nerve", "Left third lumbar splanchnic nerve", "Left fourth lumbar splanchnic nerve", "Right fourth lumbar splanchnic nerve", "Left least splanchnic nerve", "Left lesser splanchnic nerve", "Right least splanchnic nerve", "Left first lumbar splanchnic nerve", "Right greater splanchnic nerve", "Left second lumbar splanchnic nerve", "Left greater splanchnic nerve", "Right second lumbar splanchnic nerve", "Right lesser splanchnic nerve"]
  },
  {
    id: 81,
    nerve_id: "ILX:0793826",
    label: "anterior abdominal vagal trunk",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 82,
    nerve_id: "UBERON:0001650",
    label: "hypoglossal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 83,
    nerve_id: "ILX:0794967",
    label: "posterior interosseous nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 84,
    nerve_id: "ILX:0793713",
    label: "Deep petrosal nerve",
    "FMA subclasses (in human nerves)": ["FMA:0328827", "FMA:0328826"],
    "subclass labels": ["Left deep petrosal nerve", "Right deep petrosal nerve"]
  },
  {
    id: 85,
    nerve_id: "ILX:0793361",
    label: "white communicating ramus of third lumbar spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 86,
    nerve_id: "ILX:0787562",
    label: "gray communicating ramus of the third thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6133", "FMA:6124"],
    "subclass labels": ["Left T3 grey ramus communicans", "Right T3 grey ramus communicans"]
  },
  {
    id: 87,
    nerve_id: "ILX:0793211",
    label: "white communicating ramus of fifth thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 88,
    nerve_id: "UBERON:0018679",
    label: "thoracic splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6958", "FMA:6960", "FMA:6955", "FMA:6959", "FMA:6957", "FMA:6956"],
    "subclass labels": ["Left lesser splanchnic nerve", "Left least splanchnic nerve", "Left greater splanchnic nerve", "Right least splanchnic nerve", "Right lesser splanchnic nerve", "Right greater splanchnic nerve"]
  },
  {
    id: 89,
    nerve_id: "ILX:0731969",
    label: "least splanchnic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6960", "FMA:6959"],
    "subclass labels": ["Left least splanchnic nerve", "Right least splanchnic nerve"]
  },
  {
    id: 90,
    nerve_id: "ILX:0788771",
    label: "gray communicating ramus of seventh thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6888", "FMA:6889"],
    "subclass labels": ["Right T7 grey ramus communicans", "Left T7 grey ramus communicans"]
  },
  {
    id: 91,
    nerve_id: "UBERON:0022301",
    label: "long ciliary nerve",
    "FMA subclasses (in human nerves)": ["FMA:52701", "FMA:52700", "FMA:82734", "FMA:82735"],
    "subclass labels": ["Left long ciliary nerve B", "Right long ciliary nerve B", "Right long ciliary nerve A", "Left long ciliary nerve A"]
  },
  {
    id: 92,
    nerve_id: "ILX:0793221",
    label: "white communicating ramus of second lumbar spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 93,
    nerve_id: "ILX:0785825",
    label: "gray communicating ramus of first lumbar nerve",
    "FMA subclasses (in human nerves)": ["FMA:65924", "FMA:65923"],
    "subclass labels": ["Left L1 grey ramus communicans", "Right L1 grey ramus communicans"]
  },
  {
    id: 94,
    nerve_id: "ILX:0793208",
    label: "white communicating ramus of second thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 95,
    nerve_id: "UBERON:0018412",
    label: "vidian nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 96,
    nerve_id: "ILX:0739303",
    label: "gray communicating ramus of second thoracic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 97,
    nerve_id: "ILX:0795006",
    label: "Suboccipital nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 98,
    nerve_id: "ILX:0785733",
    label: "gray communicating ramus of second lumbar nerve",
    "FMA subclasses (in human nerves)": ["FMA:65921", "FMA:65922"],
    "subclass labels": ["Right L2 grey ramus communicans", "Left L2 grey ramus communicans"]
  },
  {
    id: 99,
    nerve_id: "UBERON:0035207",
    label: "deep fibular nerve",
    "FMA subclasses (in human nerves)": ["FMA:45387", "FMA:45388"],
    "subclass labels": ["Right deep fibular nerve", "Left deep fibular nerve"]
  },
  {
    id: 100,
    nerve_id: "ILX:0739304",
    label: "gray communicating ramus of third thoracic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 101,
    nerve_id: "UBERON:0002019",
    label: "accessory XI nerve",
    "FMA subclasses (in human nerves)": ["FMA:50899", "FMA:50897"],
    "subclass labels": ["Left accessory nerve", "Right accessory nerve"]
  },
  {
    id: 102,
    nerve_id: "ILX:0793217",
    label: "white communicating ramus of eleventh thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 103,
    nerve_id: "ILX:0793722",
    label: "Lesser petrosal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53503", "FMA:53502"],
    "subclass labels": ["Left lesser petrosal nerve", "Right lesser petrosal nerve"]
  },
  {
    id: 104,
    nerve_id: "UBERON:0018675",
    label: "pelvic splanchnic nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 105,
    nerve_id: "ILX:0793702",
    label: "Greater petrosal nerve",
    "FMA subclasses (in human nerves)": ["FMA:53423", "FMA:53424"],
    "subclass labels": ["Right greater petrosal nerve", "Left greater petrosal nerve"]
  },
  {
    id: 106,
    nerve_id: "ILX:0794916",
    label: "white ramus communicans",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 107,
    nerve_id: "UBERON:0003716",
    label: "Recurrent Laryngeal Nerve",
    "FMA subclasses (in human nerves)": ["UBERON:0011766", "UBERON:0011767"],
    "subclass labels": ["Left recurrent laryngeal nerve", "Right recurrent laryngeal nerve"]
  },
  {
    id: 108,
    nerve_id: "UBERON:0005465",
    label: "obturator nerve",
    "FMA subclasses (in human nerves)": ["FMA:16501", "FMA:16502"],
    "subclass labels": ["Right obturator nerve", "Left obturator nerve"]
  },
  {
    id: 109,
    nerve_id: "ILX:0793213",
    label: "white communicating ramus of seventh thoracic spinal nerve",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 110,
    nerve_id: "ILX:0785067",
    label: "gray communicating ramus of eleventh thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6897", "FMA:6896"],
    "subclass labels": ["Left T11 grey ramus communicans", "Right T11 grey ramus communicans"]
  },
  {
    id: 111,
    nerve_id: "UBERON:0001494",
    label: "ulnar nerve",
    "FMA subclasses (in human nerves)": ["FMA:37320", "FMA:37321"],
    "subclass labels": ["Right ulnar nerve", "Left ulnar nerve"]
  },
  {
    id: 112,
    nerve_id: "ILX:0794959",
    label: "posterior rami lower cervical nerves",
    "FMA subclasses (in human nerves)": [],
    "subclass labels": []
  },
  {
    id: 113,
    nerve_id: "UBERON:0001493",
    label: "axillary nerve",
    "FMA subclasses (in human nerves)": ["FMA:37074", "FMA:37073"],
    "subclass labels": ["Left axillary nerve", "Right axillary nerve"]
  },
  {
    id: 114,
    nerve_id: "ILX:0787946",
    label: "gray communicating ramus of sixth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6762", "FMA:6763"],
    "subclass labels": ["Right T6 grey ramus communicans", "Left T6 grey ramus communicans"]
  },
  {
    id: 115,
    nerve_id: "ILX:0785542",
    label: "gray communicating ramus of ninth thoracic nerve",
    "FMA subclasses (in human nerves)": ["FMA:6892", "FMA:6893"],
    "subclass labels": ["Right T9 grey ramus communicans", "Left T9 grey ramus communicans"]
  }
], B5 = () => {
  const n = {};
  return N5.forEach((e) => {
    e.nerve_id && e.label !== "nerve" && e["subclass labels"].forEach((t) => {
      t in n || (n[t.toLowerCase()] = e.nerve_id);
    });
  }), n;
}, U5 = [
  {
    label: "urinary bladder",
    anatomicalId: "UBERON:0001255"
  },
  {
    label: "brainstem",
    anatomicalId: "UBERON:0002298"
  },
  {
    label: "caecum",
    anatomicalId: "UBERON:0001153"
  },
  {
    label: "colon",
    anatomicalId: "UBERON:0001155"
  },
  {
    label: "esophagus",
    anatomicalId: "UBERON:0001043"
  },
  {
    label: "small intestine",
    anatomicalId: "UBERON:0002108"
  },
  {
    label: "stomach",
    anatomicalId: "UBERON:0000945"
  },
  {
    label: "heart",
    anatomicalId: "UBERON:0000948"
  },
  {
    label: "lung",
    anatomicalId: "UBERON:0002048"
  }
], z5 = () => {
  const n = {};
  return U5.forEach((e) => {
    const t = e.label.toLowerCase();
    t in n || (n[t.toLowerCase()] = e.anatomicalId);
  }), n;
}, Ov = B5(), Dv = z5(), k5 = {
  name: "ScaffoldVuer",
  components: {
    Button: Ko,
    Col: bi,
    Loading: b3,
    Option: Qo,
    Popover: cu,
    Radio: ty,
    RadioGroup: ny,
    Row: Ui,
    ScaffoldOverlay: My,
    Select: qo,
    Slider: ti,
    TabPane: xy,
    Tabs: by,
    MapSvgIcon: sw,
    MapSvgSpriteColor: ow,
    PrimitiveControls: TM,
    ScaffoldTooltip: CM,
    ElIconWarningFilled: u0,
    ElIconArrowDown: Xd,
    ElIconArrowLeft: zr,
    DrawToolbar: nw,
    ScaffoldTreeControls: EM
  },
  setup(n) {
    let e = pt("$annotator");
    return e || (e = An(new aw(`${n.flatmapAPI}annotator`)), sn("$annotator", e)), { annotator: e };
  },
  props: {
    /**
      * The option to show annotation information in sidebar
      */
    annotationSidebar: {
      type: Boolean,
      default: !1
    },
    /**
     * URL of the zincjs metadata. This value will be ignored if a valid
     * state prop is also provided.
     * If the url needs to be updated with state present, please use
     * the setURL method.
     */
    url: {
      type: String,
      default: ""
    },
    /**
     * Show the colour control of set to true.
     */
    showColourPicker: {
      type: Boolean,
      default: !1
    },
    /**
     * Flag to show/hide the UI.
     */
    displayUI: {
      type: Boolean,
      default: !0
    },
    /**
     * Display all graphics at start.
     *
     * This setting only works when traditional is set to false.
     */
    displayAtStartUp: {
      type: Boolean,
      default: !0
    },
    /**
     * Use for toggling the help tooltips.
     */
    helpMode: {
      type: Boolean,
      default: !1
    },
    /**
     * The active item index of help mode.
     */
    helpModeActiveItem: {
      type: Number,
      default: 0
    },
    /**
     * The option to use helpModeDialog.
     * On default, `false`, clicking help will show all tooltips.
     * If `true`, clicking help will show the help-mode-dialog.
     */
    helpModeDialog: {
      type: Boolean,
      default: !1
    },
    /**
     * The last item of help mode.
     */
    helpModeLastItem: {
      type: Boolean,
      default: !1
    },
    /**
     * The initial index number for help mode tooltips.
     * Set negative (e.g. -1) if there are other tooltips outside of `hoverVisibilities`.
     */
    helpModeInitialIndex: {
      type: Number,
      default: 0
    },
    /**
     * Use for show/display beta warning icon.
     */
    displayWarning: {
      type: Boolean,
      default: !0
    },
    /**
     * Warning message for the hovered over text
     * on the warning icon.
     */
    warningMessage: {
      type: String,
      default: "Beta feature - under active development"
    },
    displayLatestChanges: {
      type: Boolean,
      default: !1
    },
    latestChangesMessage: {
      type: String,
      default: "New feature - Local search is now available"
    },
    /**
     * Show/hide pickable markers for regions.
     */
    displayMarkers: {
      type: Boolean,
      default: !1
    },
    /**
     * Display adjacent markers with a cluster marker.
     */
    markerCluster: {
      type: Boolean,
      default: !1
    },
    /**
     * GroupName to value pair.
     * The value can be a single number or and object in the following
     * form:
     *
     * {
     *  number: Number,
     *  imgURL: String
     * }
     *
     * When imgURL is specified, scaffoldvuer will attempt to render
     * the image in imgURL as marker instead.
     *
     */
    markerLabels: {
      type: Object,
      default: function() {
        return {};
      }
    },
    /**
     * Show/hide minimap.
     */
    displayMinimap: {
      type: Boolean,
      default: !1
    },
    /**
     * Format of the input URL
     */
    format: {
      type: String,
      default: "metadata"
    },
    /**
     * Settings for minimap position, size and alignment.
     */
    minimapSettings: {
      type: Object,
      default: function() {
        return {
          x_offset: 16,
          y_offset: 16,
          width: 128,
          height: 128,
          align: "top-right"
        };
      }
    },
    /**
     * Flag to determine rather the open map UI icon and popup
     * should be shown or not.
     */
    enableOpenMapUI: {
      type: Boolean,
      default: !1
    },
    /**
     * Experimental feature to restrict rotation at
     * one-axis based on position of the initial click
     */
    positionalRotation: {
      type: Boolean,
      default: !1
    },
    /**
     * Define what is considered as nerves.
     */
    isNerves: {
      type: Object,
      default: function() {
        return {
          regions: ["nerves"]
        };
      }
    },
    /**
     * This array populate the the openMapOptions popup.
     * Each entry contains a pair of display and key.
     */
    openMapOptions: {
      type: Array,
      default: function() {
        return [
          {
            display: "Open AC Map",
            key: "AC"
          },
          {
            display: "Open FC Map",
            key: "FC"
          },
          {
            display: "Open 3D Human Map",
            key: "3D"
          }
        ];
      }
    },
    /**
     * State containing state of the scaffold.
     */
    state: {
      type: Object,
      default: void 0
    },
    /**
     * Optional prop for the name of the region to focus on,
     * this option is ignored if state or viewURL is also provided.
     */
    region: {
      type: String,
      default: ""
    },
    /**
     * Optional prop for an URL of containing information of a viewport.
     * This option is ignored if state is also provided.
     * It will use the provided URL as base if a relative parth is provided.
     */
    viewURL: {
      type: String,
      default: ""
    },
    /**
     * Settings for turning on/off rendering
     */
    render: {
      type: Boolean,
      default: !0
    },
    /**
     * Specify the endpoint of the flatmap server.
     * This is used by annotation service included in
     * third party flatmapvuer library.
     */
    flatmapAPI: {
      type: String,
      default: "https://mapcore-demo.org/current/flatmap/v3/"
    },
    /**
     * The option to show local settings UI
     * (background colour, viewing mode, etc.)
     */
    showLocalSettings: {
      type: Boolean,
      default: !0
    },
    /**
     * The option to show open new map button
     */
    showOpenMapButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Manage the settings when used in standalone or as child component.
     */
    usageConfig: {
      type: Object,
      default: function() {
        return {
          showTubeLinesControls: !0,
          tubeLines: !1
        };
      }
    }
  },
  provide() {
    return {
      flatmapAPI: this.flatmapAPI,
      scaffoldUrl: this.url,
      boundingDims: this.boundingDims
    };
  },
  data: function() {
    return {
      annotator: void 0,
      colourRadio: !0,
      createData: {
        drawingBox: !1,
        toBeConfirmed: !1,
        points: [],
        shape: "",
        x: 0,
        y: 0,
        editingIndex: -1,
        faceIndex: -1,
        toBeDeleted: !1
      },
      currentTime: 0,
      timeVarying: !1,
      isPlaying: !1,
      isReady: !1,
      /**
       * This is set when scene is transitioning.
       */
      isTransitioning: !1,
      tooltipAppendToBody: !1,
      hoverVisibilities: [
        { value: !1, ref: "zoomInPopover" },
        // 0
        { value: !1, ref: "zoomOutPopover" },
        // 1
        { value: !1, ref: "zoomFitPopover" },
        // 2
        { value: !1, ref: "openMapPopover" },
        // 3
        { value: !1, ref: "settingsPopover" },
        // 4
        { value: !1, ref: "sliderPopover" },
        // 5
        { value: !1, ref: "regionVisibilityPopover" },
        // 6
        { value: !1, ref: "warningPopover" },
        // 7
        { value: !1, ref: "whatsNewPopover" },
        // 8
        { value: !1, refs: "toolbarPopover", ref: "editPopover" },
        // 9
        { value: !1, refs: "toolbarPopover", ref: "pointPopover" },
        // 10
        { value: !1, refs: "toolbarPopover", ref: "lineStringPopover" },
        // 11
        { value: !1, refs: "toolbarPopover", ref: "deletePopover" }
        // 11
      ],
      inHelp: !1,
      helpModeActiveIndex: this.helpModeInitialIndex,
      loading: !1,
      duration: 3e3,
      drawerOpen: !0,
      currentBackground: "white",
      availableBackground: ["white", "lightskyblue", "black"],
      minimisedSlider: !1,
      sliderPosition: "",
      timeMax: 100,
      orginalDuration: "",
      animateDuration: "6secs",
      playSpeed: [
        {
          value: 0.1,
          label: "0.1x"
        },
        {
          value: 0.5,
          label: "0.5x"
        },
        {
          value: 1,
          label: "1x"
        },
        {
          value: 2,
          label: "2x"
        },
        {
          value: 5,
          label: "5x"
        },
        {
          value: 10,
          label: "10x"
        }
      ],
      currentSpeed: 1,
      timeStamps: {},
      defaultCheckedKeys: [],
      outlinesRadio: !0,
      tData: {
        label: "",
        region: "",
        visible: !1,
        x: 200,
        y: 200,
        active: !1
      },
      fileFormat: "metadata",
      previousMarkerLabels: An({}),
      viewingMode: "Exploration",
      viewingModes: {
        Exploration: "View and explore detailed visualization of 3D scaffolds",
        "Neuron Connection": "Discover nerve connections by selecting a nerve and viewing its associated connections",
        Annotation: ["View feature annotations", "Add, comment on and view feature annotations"]
      },
      openMapRef: void 0,
      backgroundIconRef: void 0,
      annotationFeature: {},
      offlineAnnotationEnabled: !1,
      offlineAnnotations: An([]),
      authorisedUser: void 0,
      toolbarOptions: [
        "Delete",
        "Edit",
        "Point",
        "LineString"
      ],
      existDrawnFeatures: An([]),
      // Store all exist drawn features
      activeDrawTool: void 0,
      activeDrawMode: void 0,
      boundingDims: {
        centre: [0, 0, 0],
        size: [1, 1, 1]
      },
      lastSelected: An({
        region: "",
        group: "",
        isSearch: !1
      })
      //checkedRegions: []
    };
  },
  watch: {
    format: {
      handler: function(n) {
        this.fileFormat = n;
      },
      immediate: !0
    },
    url: {
      handler: function(n) {
        (this.state === void 0 || this.state.url === void 0) && this.setURL(n);
      },
      immediate: !0
    },
    region: {
      handler: function(n) {
        this.state || this.viewURL || this.setFocusedRegion(n);
      },
      immediate: !0
    },
    state: {
      handler: function(n) {
        this.setState(n);
      },
      immediate: !0,
      deep: !0
    },
    viewURL: {
      handler: function(n) {
        this.updateViewURL(n);
      },
      immediate: !0
    },
    helpMode: function(n, e) {
      n !== e && this.setHelpMode(n);
    },
    helpModeActiveItem: function() {
      this.helpMode && (this.helpModeActiveIndex += 1, this.setHelpMode(this.helpMode));
    },
    displayMarkers: function(n) {
      this.$module.scene.displayMarkers = n, this.$module.scene.forcePickableObjectsUpdate = !0;
    },
    displayMinimap: function(n) {
      this.$module.scene.displayMinimap = n;
    },
    currentTime: {
      handler: function() {
        this.$emit("timeChanged", this.currentTime);
      }
    },
    duration: function() {
      this.$module.scene.setDuration(this.duration);
    },
    minimapSettings: {
      deep: !0,
      handler: "updateMinimapScissor"
    },
    render: function(n) {
      this.toggleRendering(n);
    },
    markerCluster: {
      handler: function(n) {
        this.$module.scene.enableMarkerCluster(n);
      },
      immediate: !0
    },
    markerLabels: function(n) {
      for (const [e, t] of Object.entries(this.previousMarkerLabels))
        this.setMarkerModeForObjectsWithName(e, t, "off");
      for (const [e, t] of Object.entries(n))
        this.setMarkerModeForObjectsWithName(e, t, "on");
      this.previousMarkerLabels = An({ ...n });
    }
  },
  beforeCreate: function() {
    this.$module = new LM(), this.selectedObjects = [], this.hoveredObjects = [], this.currentBackground = "white", this._currentURL = void 0, this.availableBackground = ["white", "black", "lightskyblue"], this.$_searchIndex = new D5();
  },
  mounted: function() {
    this.openMapRef = En(this.$refs.openMapRef), this.backgroundIconRef = En(this.$refs.backgroundIconRef), this.$refs.scaffoldTreeControls.setModule(this.$module);
    let n = new g5();
    n.subscribe(this, this.eventNotifierCallback), this.$module.addNotifier(n), this.$module.addOrganPartAddedCallback(this.zincObjectAdded), this.$module.addOrganPartRemovedCallback(this.zincObjectRemoved), this.$module.initialiseRenderer(this.$refs.display), this.toggleRendering(this.render), this.ro = new ResizeObserver(this.adjustLayout).observe(
      this.$refs.scaffoldContainer.$el
    ), this.helpTextWait = [], this.helpTextWait.length = this.hoverVisibilities.length, this.defaultRate = this.$module.getPlayRate(), this.$module.zincRenderer.addPreRenderCallbackFunction(() => {
      this.currentTime = this.$module.getCurrentTime();
    }), this.$module.zincRenderer.addContextRestoredCallbackFunction(() => {
      this.backgroundChangeCallback(this.currentBackground);
    });
  },
  beforeUnmount: function() {
    this.ro && this.ro.disconnect(), this.$module.destroy(), this.$module = void 0;
  },
  computed: {
    ...rw(Dd),
    ...Gv(Dd, ["userToken"]),
    annotationDisplay: function() {
      return this.viewingMode === "Annotation" && this.tData.active === !0 && this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString";
    },
    enableColourPicker: function() {
      return this.showColourPicker && this.colourRadio;
    },
    modeDescription: function() {
      let n = this.viewingModes[this.viewingMode];
      return this.viewingMode === "Annotation" ? this.authorisedUser ? n[1] : n[0] : n;
    }
  },
  methods: {
    /*
    setCheckedRegions: function (data) {
      this.checkedRegions = data;
    },
    */
    /**
     *
     * @param nerves array of nerve names, show all nerves if empty
     * @param processed boolean, whether unselect all checkboxes
     */
    zoomToNerves: function(n, e = !1) {
      if (this.$module.scene) {
        this.$module.setIgnorePicking(e);
        const t = [];
        this.$module.scene.getRootRegion().getChildRegions().forEach((r) => {
          r.getName() === "Nerves" && e && n.forEach((o) => {
            const a = this.findObjectsWithGroupName(o);
            t.push(...a);
          });
        }), this.$module.setSelectedByZincObjects(t, void 0, {}, !0), this.$module.scene.viewAll();
      }
    },
    enableAxisDisplay: function(n, e) {
      this.$module.scene && this.$module.scene.enableAxisDisplay(n, e);
    },
    createAxisDisplay: function(n) {
      this.$module.scene && this.$module.scene.createAxisDisplay(n);
    },
    /**
     * @public
     * Call this to manually add a zinc object into the current scene.
     * This will subsequently trigger a zincObjectAdded
     * @arg {Object} "ZincObject object to be added"
     */
    addZincObject: function(n) {
      this.$module.scene && this.$module.scene.addZincObject(n);
    },
    /**
     * Internal only.
     * This is called when a new zinc object is read into the scene.
     */
    zincObjectAdded: function(n) {
      var r;
      this.loading = !1, this.$_searchIndex.addZincObject(n, n.uuid), this.timeVarying === !1 && n.isTimeVarying() && (this.timeVarying = !0);
      const e = n.groupName.toLowerCase();
      e in Dv && n.setAnatomicalId(Dv[e]);
      const t = n.getGroup();
      t && t.position ? n.userData.originalPos = [
        t.position.x,
        t.position.y,
        t.position.z
      ] : n.userData.originalPos = [0, 0, 0];
      const i = (r = this.isNerves) == null ? void 0 : r.regions;
      if (i) {
        const s = n.getRegion().getFullPath().toLowerCase();
        for (let o = 0; o < i.length; o++)
          s.includes(i[o].toLowerCase()) ? (n.userData.isNerves = !0, n.userData.defaultColour = `#${n.getColourHex()}`, n.userData.isGreyScale = !1, e in Ov && n.setAnatomicalId(Ov[e])) : n.userData.isNerves = !1;
      }
      this.$emit("zinc-object-added", n);
    },
    /**
     * Internal only.
     * Remove an entry matching region and group from
     * local annotation list.
     */
    removeFromOfflineAnnotation: function(n, e) {
      for (let t = 0; t < this.offlineAnnotations.length; t++) {
        const i = this.offlineAnnotations[t];
        if (i.region === n && i.group === e) {
          this.offlineAnnotations.splice(t, 1);
          return;
        }
      }
    },
    /**
     * Internal only.
     * This is called when a zinc object is removed.
     */
    zincObjectRemoved: function(n) {
      if (this.$module.scene) {
        const e = n.groupName;
        n.region.findObjectsWithGroupName(e, !1).length === 0 && this.$_searchIndex.removeZincObject(n, n.uuid);
      }
    },
    /**
     * Internal only.
     * Add regions to search index.
     */
    addRegionsToSearchIndex: function() {
      this.$module.scene.getRootRegion().getChildRegions(!0).forEach((t) => {
        this.$_searchIndex.addRegion(t, t.uuid);
      });
    },
    /**
     * Internal only.
     * This is called when Change backgspeedround colour button
     * is pressed an causes the backgrouColornd colour to be changed
     * to one of the three preset colour: white, black and
     * lightskyblue.
     */
    backgroundChangeCallback: function(n) {
      this.currentBackground = n, this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground, 1);
    },
    /**
     * Internal only.
     * This is called by captueeScreenshot and after the last render
     * loop, it download a screenshot of the current scene with no UI.
     */
    captureScreenshotCallback: function() {
      this.$module.zincRenderer.removePostRenderCallbackFunction(
        this.captureID
      );
      let n = this.$module.zincRenderer.getThreeJSRenderer().domElement.toDataURL("image/png"), e = document.createElement("a");
      document.body.append(e), this.captureFilename ? e.download = this.captureFilename : e.download = "screenshot.png", e.href = n, e.click(), e.remove();
    },
    /**
     * @public
     * Function for capturing a screenshot of the current rendering.
     *
     * @arg {String} "filename given to the screenshot."
     */
    captureScreenshot: function(n) {
      this.captureFilename = n, this.captureID = this.$module.zincRenderer.addPostRenderCallbackFunction(
        this.captureScreenshotCallback
      );
    },
    /**
     * @public
     * Function to clear current scene, the tree controls and the search index.
     */
    clearScene: function() {
      this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.$_searchIndex && this.$_searchIndex.removeAll(), this.$module.scene && this.$module.scene.clearAll();
    },
    /**
     * @public
     * Add and edit local annotations
     * @arg `region`,
     * @arg `group`,
     * @arg `zincObject`,
     * @arg `comment`
     */
    addAndEditAnnotations: function(n, e, t, i) {
      const r = Tv(
        this.annotator,
        this.userToken,
        t,
        n,
        e,
        this.url,
        i
      );
      if (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((s) => s.id !== r.item.id)), this.existDrawnFeatures.push(r.feature), this.offlineAnnotationEnabled) {
        r.group = e;
        let s = n;
        s.slice(-1) === "/" && (s = s.slice(0, -1)), r.region = s, this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations.push(r), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations));
      }
      this.$emit("userPrimitivesUpdated", { region: n, group: e, zincObject: t });
    },
    /**
     * @public
     * Callback for when primitives have been update using primitive controls.
     * This is only called from callback.
     * @arg `object`
     */
    primitivesUpdated: function(n) {
      if (n.isZincObject && n.isEditable) {
        const e = n.groupName, t = n.region.getFullPath();
        this.addAndEditAnnotations(t, e, n, "Position Updated");
      }
    },
    /**
     * @public
     * Confirm creation of new primitive. This is only called from callback.
     * @arg `payload`
     */
    confirmCreate: function(n) {
      if (n) {
        let e;
        if (n.shape === "Point")
          e = this.$module.scene.createPoints(
            n.region,
            n.group,
            this.createData.points,
            n.group,
            8942
          );
        else if (n.shape === "LineString")
          e = this.$module.scene.createLines(
            n.region,
            n.group,
            [this.createData.points[0], this.createData.points[1]],
            60962
          );
        else if (n.editingIndex > -1 && this._editingZincObject) {
          this._editingZincObject.editVertices(
            [this.createData.points[1]],
            n.editingIndex
          );
          const t = this._editingZincObject.region.getFullPath() + "/", i = this._editingZincObject.groupName;
          this.addAndEditAnnotations(t, i, this._editingZincObject, "Position Updated");
        }
        e && (this.addAndEditAnnotations(n.region, n.group, e.zincObject, "Create"), e.zincObject.isEditable = !0, this.tData.region = n.region, this.tData.label = n.group, this.changeActiveByName([n.group], n.region, !1));
      }
      this.cancelCreate();
    },
    /**
     * Internal only.
     * Cancel create workflows. Reset all relevant UIs and data.
     */
    cancelCreate: function() {
      this.createData.points.length = 0, this.createData.toBeConfirmed = !1, this._editingZincObject = void 0, this.createData.editingIndex = -1, this.createData.faceIndex = -1, this.tData.visible = !1, this.createData.toBeDeleted = !1, this._tempLine && (this.$module.scene.removeTemporaryPrimitive(this._tempLine), this._tempLine = void 0), this._tempPoint && (this.$module.scene.removeTemporaryPrimitive(this._tempPoint), this._tempPoint = void 0), this.annotationSidebar && this.$emit("annotation-close");
    },
    /**
     * Internal only.
     * Confirm delete of user created primitive.
     * This is only called from callback.
     */
    confirmComment: function(n) {
      if (this._editingZincObject) {
        let e = n;
        this._editingZincObject.isEditable && (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((t) => t.id !== e.item.id)), this.existDrawnFeatures.push(n.feature)), this.offlineAnnotationEnabled && (e.group = this._editingZincObject.groupName, e.region = this._editingZincObject.region.getFullPath(), this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations.push(e), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations)));
      }
    },
    /**
     * Internal only.
     * Confirm delete of user created primitive.
     * This is only called from callback.
     */
    confirmDelete: function() {
      var n;
      if ((n = this._editingZincObject) != null && n.isEditable) {
        const e = this._editingZincObject.region.getFullPath() + "/", t = this._editingZincObject.groupName, i = Tv(
          this.annotator,
          this.userToken,
          this._editingZincObject,
          e,
          t,
          this.url,
          "Deleted"
        );
        i && (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((s) => s.id !== i.item.id)), this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(this._editingZincObject), this.offlineAnnotationEnabled && (this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations = this.offlineAnnotations.filter((s) => s.item.id !== i.item.id), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations))));
      }
      this.cancelCreate();
    },
    /**
     * Internal only.
     * This is triggered when tooltip is hidden
     */
    onTooltipHide: function() {
      this.createData.toBeConfirmed && !this.annotationSidebar && this.cancelCreate();
    },
    formatTooltip(n) {
      if (this.timeMax >= 1e3 && n) {
        let e = (n % 6e4 / 1e3).toFixed(2) + "s";
        return (n > 6e4 ? (n / 6e4).toFixed(0) + "m " : "") + e;
      }
      return n ? n.toFixed(2) + " ms" : "0 ms";
    },
    /**
     * @public
     * Function to reset the view to default.
     * Also called when the associated button is pressed.
     */
    fitWindow: function() {
      if (this.$module.scene) {
        let n = !1;
        this._boundingBoxGeo && (n = this._boundingBoxGeo.getVisibility(), this._boundingBoxGeo.setVisibility(!1)), this.$module.scene.viewAll(), this._boundingBoxGeo && (V4(this._boundingBoxGeo, this.$module.scene), this._boundingBoxGeo.setVisibility(n));
      }
    },
    /**
     * @public
     * Function to zoom in.
     * Also called when the associated button is pressed.
     */
    zoomIn: function() {
      this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(-1);
    },
    /**
     * Function to zoom out.
     * Also called when the associated button is pressed.
     *
     * @public
     */
    zoomOut: function() {
      this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(1);
    },
    /**
     * Function to change the current play speed.
     *
     * @public
     * @arg `speed`
     */
    speedChanged: function(n) {
      this.currentSpeed = n, this.$module.setPlayRate(this.defaultRate * this.currentSpeed);
    },
    /**
     * Function used to stop the free spin
     *
     * @public
     */
    stopFreeSpin: function() {
      this.$module.scene.getZincCameraControls().stopAutoTumble(), this.isTransitioning = !1;
    },
    /**
     * Return a list of obejcts with the provided name.
     * @arg "Group name to search."
     *
     * @public
     */
    findObjectsWithGroupName: function(n) {
      let e = [];
      return n && n != "" && this.$module.scene && (e = this.$module.scene.findObjectsWithGroupName(n)), e;
    },
    /**
     * @public
     * Switch active drawing type
     * @arg {String} `type`
     * @arg {String} `icon`
     */
    toggleDrawing: function(n, e) {
      this.createData.toBeDeleted = !1, n === "mode" ? (this.cancelCreate(), this.activeDrawMode = e, this.createData.shape = "", this.$module.selectObjectOnPick = !0) : n === "tool" && (this.activeDrawTool = e, this.createData.shape = this.activeDrawTool ? this.activeDrawTool : "", this.$module.selectObjectOnPick = !1);
    },
    /**
     * Toggle the drawing box which aid the drawing
     *
     * @public
     */
    toggleDrawingBox: function() {
      this.createData.drawingBox = !this.createData.drawingBox;
    },
    /**
     * Find and and zoom into objects with the provided list of names.
     * @arg "List of names"
     *
     * @public
     */
    viewRegion: function(n) {
      const e = this.$module.scene.getRootRegion(), t = Array.isArray(n) ? n : [n], i = xo(e, t, "", !0);
      let r = this.$module.scene.getBoundingBoxOfZincObjects(i);
      if (r) {
        if (this.$module.isSyncControl())
          this.$module.setSyncControlZoomToBox(r);
        else {
          const s = this.$module.scene.camera.far - this.$module.scene.camera.near;
          this.$module.scene.viewAllWithBoundingBox(r), this.$module.scene.camera.far = this.$module.scene.camera.near + s, this.$module.scene.camera.updateProjectionMatrix();
        }
        return !0;
      }
      return !1;
    },
    setFocusedRegion: function(n) {
      n && (this.isReady ? this.viewRegion(n) : this.$module.setFinishDownloadCallback(
        this.setURLFinishCallback({ region: n })
      ));
    },
    setRotationMode: function(n) {
      this.$module.scene && this.$module.scene.getZincCameraControls().setRotationMode(n);
    },
    updateViewURL: function(n) {
      if (n)
        if (this.isReady) {
          const e = new URL(n, this.url);
          this.$module.scene.loadViewURL(e);
        } else
          this.$module.setFinishDownloadCallback(
            this.setURLFinishCallback({ viewURL: n })
          );
    },
    createEditTemporaryLines: function(n) {
      const e = n[0].extraData.worldCoords;
      if (e && (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.createData.points.length === 1)
        if (this.showRegionTooltipWithAnnotations(n, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempLine) {
          const t = this._tempLine.geometry.getAttribute("position");
          t.setXYZ(1, e[0], e[1], e[2]), t.needsUpdate = !0;
        } else
          this._tempLine = this.$module.scene.addTemporaryLines(
            [this.createData.points[0], e],
            65535
          );
    },
    draw: function(n) {
      n && n.length > 0 && n[0].data.group && n[0].extraData.worldCoords && (this.createData.shape === "Point" ? this.drawPoint(n[0].extraData.worldCoords, n) : (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.drawLine(n[0].extraData.worldCoords, n));
    },
    drawPoint: function(n, e) {
      this.createData.toBeConfirmed === !1 && (this.createData.points.length = 0, this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960));
    },
    drawLine: function(n, e) {
      this.createData.toBeConfirmed === !1 && (this.createData.points.length === 1 ? (this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200) : (this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960), this.createData.points.push(n)));
    },
    /**
     * Return renderer information
     *
     * @public
     */
    getRendererInfo: function() {
      if (this.$module.zincRenderer)
        return this.$module.zincRenderer.getThreeJSRenderer().info;
    },
    /**
     * Function used to rotate the scene.
     * Also called when the associated button is pressed.
     *
     * @public
     */
    freeSpin: function() {
      if (this.$module.scene) {
        let n = this.$module.scene.getZincCameraControls();
        this.isTransitioning = !0, n.enableAutoTumble(), n.autoTumble([1, 0], Math.PI, !0), setTimeout(this.stopFreeSpin, 4e3);
      }
    },
    activateAnnotationMode: function(n, e) {
      if (this.authorisedUser || this.offlineAnnotationEnabled)
        if (this.createData.toBeDeleted = !1, this.createData.shape !== "" || this.createData.editingIndex > -1)
          n.length > 0 && e.identifiers[0].coords && (this.createData.x = e.identifiers[0].coords.x, this.createData.y = e.identifiers[0].coords.y, this.draw(e.identifiers));
        else {
          if (this.activeDrawMode === "Edit") {
            const t = B4(e);
            t && this.activateEditingMode(
              t.zincObject,
              t.faceIndex,
              t.vertexIndex,
              t.point
            );
          } else if (this.activeDrawMode === "Delete") {
            const t = z4(e);
            t && (this.createData.toBeDeleted = !0, this._editingZincObject = t);
          }
          this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString" ? this.showRegionTooltipWithAnnotations(e.identifiers, !0, !1) : this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0);
        }
      else
        this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0);
    },
    activateEditingMode: function(n, e, t, i) {
      this._editingZincObject = n, this.createData.faceIndex = e, this.createData.editingIndex = t, this.drawLine(i, void 0);
    },
    /**
     * Callback when a region is selected/highlighted.
     * It will also update other controls.
     *
     */
    eventNotifierCallback: function(n) {
      if (!(this.createData.toBeConfirmed || this.createData.toBeDeleted)) {
        const e = [];
        let t = [];
        (n.eventType == 1 || n.eventType == 2) && (n.identifiers.forEach((s) => {
          if (s) {
            let o = s.data.id ? s.data.id : s.data.group;
            e.push(o);
          }
        }), t = n.zincObjects);
        let i, r;
        if (n.identifiers.length > 0 && n.identifiers[0] && (i = n.identifiers[0].data.id ? n.identifiers[0].data.id : n.identifiers[0].data.group, n.identifiers[0].data.region && (r = n.identifiers[0].data.region)), n.eventType == 1)
          if (this.viewingMode === "Annotation") {
            this.tData.label = i, this.tData.region = r;
            const s = U4(n);
            if (this._editingZincObject = s, s) {
              const o = this._editingZincObject.region.getFullPath() + "/", a = this._editingZincObject.groupName;
              this.annotationFeature = xM(
                this._editingZincObject,
                o,
                a,
                this.url,
                ""
              ).feature;
            }
            this.activateAnnotationMode(e, n);
          } else
            this.$refs.scaffoldTreeControls && (e.length > 0 ? (this.$refs.scaffoldTreeControls.updateActiveUI(t), this.updatePrimitiveControls(t)) : (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls.removeActive(!1))), n.identifiers.length === 1 ? this.lastSelected = {
              isSearch: !1,
              region: r,
              group: n.identifiers[0].data.group
            } : n.identifiers.length === 0 && (this.lastSelected = {
              isSearch: !1,
              region: "",
              group: ""
            }), this.$emit("scaffold-selected", n.identifiers);
        else if (n.eventType == 2)
          this.hideRegionTooltip(), this.$refs.scaffoldTreeControls && (e.length > 0 ? this.$refs.scaffoldTreeControls.updateHoverUI(t) : this.$refs.scaffoldTreeControls.removeHover(!0)), n.identifiers.length > 0 && n.identifiers[0] && n.identifiers[0].coords && (this.tData.active = !1, (this.viewingMode !== "Annotation" || !this.annotationSidebar) && (this.tData.visible = !0), this.tData.label = i, this.tData.region = r, this.tData.x = n.identifiers[0].coords.x, this.tData.y = n.identifiers[0].coords.y, this.createEditTemporaryLines(n.identifiers)), this.$emit("scaffold-highlighted", n.identifiers);
        else if (n.eventType == 3 && n.identifiers.length > 0 && n.identifiers[0]) {
          if (n.identifiers[0].coords) {
            const s = this.$refs.scaffoldContainer.$el.getBoundingClientRect();
            this.tData.x = n.identifiers[0].coords.x - s.left, this.tData.y = n.identifiers[0].coords.y - s.top;
          }
          this.createEditTemporaryLines(n.identifiers);
        }
      }
    },
    /**
     * Get the coordinates of the current selected region.
     *
     * @public
     */
    getCoordinatesOfSelected: function() {
      if (this.selectedObjects && this.selectedObjects.length > 0)
        return this.$module.scene.getObjectsScreenXY(this.selectedObjects);
    },
    /**
     * Return an object containing the window coordinates of the
     * current selected region which will be updated after each render
     * loop.
     *
     * @public
     */
    getDynamicSelectedCoordinates: function() {
      return this.$module.selectedScreenCoordinates;
    },
    /**
     * Callback when time is changed through the UI.
     */
    timeChange: function(n) {
      let e = n / this.timeMax * 100;
      e != this.currentTime && this.$module.updateTime(e);
    },
    /**
     * Update primitive controls UI with the specified objects
     *
     * @arg objects objects to be set for the selected
     */
    updatePrimitiveControls: function(n) {
      (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") && (this.selectedObjects = n, this.selectedObjects && this.selectedObjects.length > 0 ? this.$refs.primitiveControls.setObject(this.selectedObjects[0]) : this.$refs.primitiveControls.setObject(void 0));
    },
    /**
     * A callback used by children components. Set the selected zinc object
     *
     * @arg Selected zinc objects
     * @arg Flag to determine if callback should be triggered when new selection
     * is made
     */
    objectSelected: function(n, e) {
      this.$module.isIgnorePicking() || (this.updatePrimitiveControls(n), this.$module.setSelectedByZincObjects(n, void 0, {}, e));
    },
    /**
     * A callback used by children components. Set the highlighted zinc object
     *
     * @arg Hovered zinc objects
     * @arg Flag to determine if callback should be triggered when new selection
     * is made
     */
    objectHovered: function(n, e) {
      this.hoveredObjects = n, this.$module.setHighlightedByZincObjects(n, void 0, {}, e);
    },
    /**
     * Set the selected by name.
     *
     * @param {} name Name of the group
     */
    changeActiveByName: function(n, e, t) {
      const i = Array.isArray(n);
      if (n === void 0 || i && n.length === 0)
        this.$refs.scaffoldTreeControls.removeActive(t);
      else {
        let r = n;
        i || (r = [r]), this.$refs.scaffoldTreeControls.changeActiveByNames(r, e, t);
      }
    },
    /**
     * Set the highlighted by name.
     *
     * @param {name} name Name of the group
     */
    changeHighlightedByName: function(n, e, t) {
      const i = Array.isArray(n);
      if (n === void 0 || i && n.length === 0)
        this.$refs.scaffoldTreeControls.removeHover(t);
      else {
        let r = n;
        i || (r = [r]), this.$refs.scaffoldTreeControls.changeHoverByNames(r, e, t);
      }
    },
    /**
     * @public
     * Start the animation.
     *
     * @arg "flag to turn the animation on/off"
     */
    play: function(n) {
      this.$module.playAnimation(n), this.isPlaying = n;
    },
    /**
     * @public
     * Function to toggle on/off overlay help.
     */
    setHelpMode: function(n) {
      const e = this.hoverVisibilities.length, t = e - 1, i = this.hoverVisibilities[this.helpModeActiveIndex];
      if (i) {
        const r = i == null ? void 0 : i.refs, s = i == null ? void 0 : i.ref;
        this.$refs[r || s] || (this.helpModeActiveIndex += 1);
      }
      n || (this.helpModeActiveIndex = this.helpModeInitialIndex), n && this.helpModeActiveIndex >= t && this.$emit("help-mode-last-item", !0), n && !this.helpModeDialog ? (this.inHelp = !0, this.hoverVisibilities.forEach((r) => {
        r.value = !0;
      })) : n && this.helpModeDialog && e > this.helpModeActiveIndex ? this.helpModeActiveIndex > -1 && setTimeout(() => {
        this.inHelp = !1, this.hoverVisibilities.forEach((r) => {
          r.value = !1;
        }), this.showHelpText(this.helpModeActiveIndex, 200);
      }, 300) : (this.inHelp = !1, this.hoverVisibilities.forEach((r) => {
        r.value = !1;
      }));
    },
    /**
     * Callback function used by showRegionTooltip in the case when the tooltip
     * is out of view.
     */
    displayTooltipOfObjectsCallback: function(n, e, t, i, r) {
      const s = this;
      return function() {
        s.$module.zincRenderer.removePostRenderCallbackFunction(
          s.$_regionTooltipCallback
        ), s.$_regionTooltipCallback = void 0, s.displayTooltipOfObjects(n, e, t, i, r);
      };
    },
    liveUpdateTooltipPosition: function() {
      this.$module.selectedCenter && (this.tData.x = this.$module.selectedScreenCoordinates.x, this.tData.y = this.$module.selectedScreenCoordinates.y);
    },
    displayTooltipOfObjects: function(n, e, t, i, r) {
      if (e.length > 0) {
        let s = e[0].getClosestVertexDOMElementCoords(
          this.$module.scene
        );
        if (s)
          return s.inView ? (n.includes("Search Results for") ? this.tData.active = !1 : this.tData.active = !0, this.tData.visible = !0, this.tData.label = n, this.tData.x = s.position.x, this.tData.y = s.position.y, this.tData.region = t, this.$_liveCoordinatesUpdated && this.$module.zincRenderer.removePostRenderCallbackFunction(
            this.$_liveCoordinatesUpdated
          ), r && (this.$module.setupLiveCoordinates(e), this.$_liveCoordinatesUpdated = this.$module.zincRenderer.addPostRenderCallbackFunction(
            this.liveUpdateTooltipPosition
          ))) : (this.hideRegionTooltip(), i && (this.$module.scene.viewAll(), this.$_regionTooltipCallback && this.$module.zincRenderer.removePostRenderCallbackFunction(
            this.$_regionTooltipCallback
          ), this.$_regionTooltipCallback = this.$module.zincRenderer.addPostRenderCallbackFunction(
            this.displayTooltipOfObjectsCallback(
              n,
              e,
              t,
              i,
              r
            )
          ))), !0;
      }
      return this.hideRegionTooltip(), !1;
    },
    /**
     * Display the tooltip used for displaying search result.
     * When resetView is set to true, it will
     * reset view if the tooltip is not in view.
     * Setting liveUpdates to true will update the tooltip location
     * at every rendering loop.
     */
    showRegionTooltipWithObjects: function(n, e, t, i, r) {
      return n && e && e.length > 0 && this.$module.scene ? this.displayTooltipOfObjects(
        n,
        e,
        t,
        i,
        r
      ) : (this.hideRegionTooltip(), !1);
    },
    /**
     * Display the tooltip. When resetView is set to true, it will
     * reset view if the tooltip is not in view.
     * Setting liveUpdates to true will update the tooltip location
     * at every rendering loop.
     */
    showRegionTooltip: function(n, e, t) {
      if (n && this.$module.scene) {
        const i = this.$module.scene.getRootRegion(), s = xo(i, [n], "", !0);
        let o;
        return s && s.length > 0 && (o = s[0].getRegion().getFullPath()), this.showRegionTooltipWithObjects(
          n,
          s,
          o,
          e,
          t
        );
      }
      return this.hideRegionTooltip(), !1;
    },
    /**
     * Display the tooltip using the list of annotations.
     * When resetView is set to true, it will
     * reset view if the tooltip is not in view.
     * Setting liveUpdates to true will update the tooltip location
     * at every rendering loop.
     */
    showRegionTooltipWithAnnotations: function(n, e, t) {
      if (this.$module.scene) {
        const i = _v(this.$module.scene, n);
        if (i && i.objects.length > 0)
          if (this.annotationSidebar) {
            const s = [{
              featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label,
              resourceId: this.url,
              resource: this.url,
              feature: this.annotationFeature,
              offline: this.offlineAnnotationEnabled
            }];
            this.$emit("annotation-open", {
              annotationEntry: s,
              createData: this.createData,
              confirmCreate: this.confirmCreate,
              cancelCreate: this.cancelCreate,
              confirmDelete: this.confirmDelete,
              confirmComment: this.confirmComment
            });
            return;
          } else
            return this.showRegionTooltipWithObjects(
              i.label,
              i.objects,
              i.regionPath,
              e,
              t
            );
      }
      return this.hideRegionTooltip(), !1;
    },
    clearAnnotationFeature: function() {
      const n = this.getOfflineAnnotations();
      this.existDrawnFeatures.map((t) => decodeURIComponent(t.id).split("/").pop()).forEach((t) => {
        const i = this.$module.scene.findObjectsWithGroupName(t, !1);
        if (i && i.length) {
          const r = i[0].region.getFullPath() + "/";
          this.$module.scene.getRootRegion().findChildFromPath(r).removeZincObject(i[0]);
        }
      }), this.$refs.scaffoldTreeControls.removeRegion("__annotation"), this.offlineAnnotations = n;
    },
    addAnnotationFeature: async function() {
      let n;
      if (this.offlineAnnotationEnabled)
        this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], n = this.offlineAnnotations.filter((e) => e.resource === this.url && e.feature.properties.drawn).map((e) => e.feature);
      else {
        n = [];
        const e = await Ev(this.annotator, this.userToken, this.url);
        e && e.features && (n = [...e.features]);
        const t = await Ev(this.annotator, this.userToken, encodeURIComponent(this.url));
        t && t.features && (n = [...n, ...t.features]);
      }
      this.existDrawnFeatures = An(n), Cv(this.$module.scene, n);
    },
    /**
     * Callback on viewing mode change
     * Optional, can be used to update the view mode.
     */
    changeViewingMode: function(n) {
      let e = !0;
      this.$module && (n && (this.viewingMode = n), this.clearAnnotationFeature(), this.viewingMode === "Annotation" ? (this.loading = !0, this.annotator.authenticate(this.userToken).then((t) => {
        t.name && t.email && t.canUpdate ? (this.authorisedUser = t, this.offlineAnnotationEnabled = !1) : (this.authorisedUser = void 0, this.offlineAnnotationEnabled = !0), this.emitOfflineAnnotationUpdate(), this.addAnnotationFeature(), this.loading = !1;
      })) : this.viewingMode === "Exploration" ? (this.activeDrawTool = void 0, this.activeDrawMode = void 0, this.createData.shape = "") : this.viewingMode === "Neuron Connection" && (e = !1), this.viewingMode === "Exploration" || this.viewingMode === "Neuron Connection" || this.viewingMode === "Annotation" && this.createData.shape === "" ? this.$module.selectObjectOnPick = !0 : this.$module.selectObjectOnPick = !1, this.cancelCreate(), n && this.setObjectIsPickable(e));
    },
    /**
     * Function to emit offline annotation enabled status
     */
    emitOfflineAnnotationUpdate: function() {
      this.$emit("update-offline-annotation-enabled", this.offlineAnnotationEnabled);
    },
    forceContextRestore: function() {
      this.$module.zincRenderer.forceContextRestore();
    },
    forceContextLoss: function() {
      this.$module.zincRenderer.forceContextLoss();
    },
    /**
     * @public
     * Hide the tooltip
     */
    hideRegionTooltip: function() {
      this.$_liveCoordinatesUpdated && (this.$module.zincRenderer.removePostRenderCallbackFunction(
        this.$_liveCoordinatesUpdated
      ), this.$module.setupLiveCoordinates(void 0)), this.tData.active = !1, this.tData.visible = !1, this.tData.region = void 0;
    },
    /**
     * Currently will apply to non-nerve object and object without anatomical id
     * @param flag boolean to control whether objects pickable
     */
    setObjectIsPickable: function(n) {
      this.$module.scene.getRootRegion().getAllObjects(!0).forEach((t) => {
        var i;
        !((i = t.userData) != null && i.isNerves) && !t.anatomicalId && t.setIsPickable(n);
      });
    },
    /**
     * Update objects to greyscale or colour.
     * This will update all objects except those with the provided nerves labels.
     * @param flag boolean
     * @param labels array of nerve names that exclude from greyscale
     */
    setGreyScale: function(n, e = []) {
      this.$module.scene.getRootRegion().getAllObjects(!0).forEach((i) => {
        var a;
        const r = i.groupName.toLowerCase(), s = (a = i.userData) == null ? void 0 : a.isNerves;
        (e.length > 0 && s && !e.includes(r) || e.length === 0 && !s) && (i.setGreyScale(n), i.userData.isGreyScale = n);
      }), this.$refs.scaffoldTreeControls.updateAllNodeColours();
    },
    /**
     * @public
     * Function to toggle colour/greyscale of primitives.
     * The parameter ``flag`` is a boolean, ``true`` (colour) and ``false`` (greyscale).
     * @arg {Boolean} `flag`
     */
    setColour: function(n, e = !1) {
      this.isReady && this.$module.scene && typeof n == "boolean" && (e || n !== this.colourRadio) && (this.loading = !0, setTimeout(() => {
        this.setGreyScale(!n), this.loading = !1, this.colourRadio = n;
      }, 100));
    },
    /**
     * @public
     * Function to toggle lines graphics.
     * The parameter ``flag`` is a boolean, ``true`` to show lines, ``false`` to hide them.
     * @arg {Boolean} `flag`
     */
    setOutlines: function(n, e = !1) {
      this.isReady && this.$module.scene && typeof n == "boolean" && (e || n !== this.outlinesRadio) && (this.outlinesRadio = n, this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(n)));
    },
    /**
     * Set the marker modes for objects with the provided name, mode can
     * be "on", "off" or "inherited".
     * Value can either be number or an object containing number and
     * imgURL.
     */
    setMarkerModeForObjectsWithName: function(n, e, t) {
      if (n && this.$module.scene) {
        let i = e;
        typeof e == "number" && (i = { number: e, imgURL: void 0 });
        const r = this.$module.scene.getRootRegion();
        xo(r, [n], "", !0).forEach((a) => a.setMarkerMode(t, i));
      }
    },
    /**
     * @public
     * Set the marker modes for objects specified by the list of annotations
     * @arg `annotations`
     * @arg `mode`
     */
    setMarkerModeWithAnnotations: function(n, e) {
      if (this.$module.scene) {
        const t = _v(this.$module.scene, n);
        t && t.objects.length > 0 && t.objects.forEach((i) => i.setMarkerMode(e));
      }
    },
    /**
     * This is called when mouse cursor enters supported elements
     * with help tootltips.
     */
    showHelpText: function(n, e = 500) {
      this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => {
        this.hoverVisibilities[n].value = !0, this.$emit("shown-tooltip");
      }, e));
    },
    /**
     * This is called when mouse cursor exits supported element..
     */
    hideHelpText: function(n, e = 500) {
      this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => {
        this.hoverVisibilities[n].value = !1;
      }, e));
    },
    /**
     * @public
     *
     * Search a object and display the tooltip
     * @arg "text to search across"
     * @arg "toggle the tooltip if this is set"
     */
    search: function(n, e) {
      if (this.$_searchIndex) {
        if (n === void 0 || n === "" || Array.isArray(n) && n.length === 0)
          return this.lastSelected = {
            region: "",
            group: "",
            isSearch: !0
          }, this.objectSelected([], !0), !1;
        {
          this.lastSelected = {
            region: "",
            group: n,
            isSearch: !0
          };
          const t = this.$_searchIndex.searchAndProcessResult(n), i = t.zincObjects;
          if (i.length > 0) {
            if (this.objectSelected(i, !0), e)
              for (let r = 0; r < i.length; r++)
                i[r] && i[r].groupName && this.showRegionTooltipWithObjects(
                  t.label,
                  i,
                  t.regionPath,
                  !0,
                  !0
                );
            return !0;
          } else
            this.objectSelected([], !0);
        }
      }
      return !1;
    },
    /**
     * @public
     *
     * Get the list of suggested terms based on the provided term.
     * This can be used for autocomplete.
     * @arg `term`
     */
    fetchSuggestions: function(n) {
      return this.$_searchIndex === void 0 ? [] : this.$_searchIndex.auto_suggest(n);
    },
    /**
     * Called when minimap settings has changed. Pass the
     * parameters to ZincJS and marked it for update.
     */
    updateMinimapScissor: function() {
      Object.keys(this.minimapSettings).forEach((n) => {
        this.$module.scene.minimapScissor[n] = this.minimapSettings[n];
      }), this.$module.scene.minimapScissor.updateRequired = !0;
    },
    updateSettingsfromScene: function() {
      this.currentSpeed = 1, this.$module.setPlayRate(this.defaultRate), this.orginalDuration = this.$module.scene.getMetadataTag("OriginalDuration"), this.animateDuration = this.$module.scene.getMetadataTag("Duration");
      let n = this.$module.scene.getMetadataTag("TimeStamps");
      this.timeStamps = {};
      for (const e in n)
        this.timeStamps[n[e]] = e;
      this.timeMax = this.$module.scene.getDuration();
    },
    restoreSettings: function(n) {
      if (n) {
        if (n.viewport)
          this.$module.scene.getZincCameraControls().setCurrentCameraSettings(n.viewport);
        else if (n.viewURL && n.viewURL !== "") {
          const t = new URL(n.viewURL, this.url);
          this.$module.scene.loadViewURL(t);
        } else n.region && n.region !== "" && this.viewRegion(n.region);
        n.visibility && this.$nextTick(() => {
          this.$refs.scaffoldTreeControls.setState(n.visibility);
        }), n.background && this.backgroundChangeCallback(n.background), "colour" in n && this.setColour(n.colour), n.offlineAnnotations && sessionStorage.setItem("anonymous-annotation", n.offlineAnnotations), "outlines" in n && this.setOutlines(n.outlines), n.viewingMode && this.changeViewingMode(n.viewingMode);
        const e = n.search;
        e && e.group && (e.isSearch ? this.search(e.group, !0) : this.changeActiveByName(e.group, e.region, !0));
      }
    },
    downloadErrorCallback: function() {
      return (n) => {
        this.$emit("on-error", n);
      };
    },
    setURLFinishCallback: function(n) {
      return () => {
        this.offlineAnnotations.length = 0, this.updateSettingsfromScene(), this.$module.updateTime(0.01), this.$module.updateTime(0), this.$module.unsetFinishDownloadCallback(), this.addRegionsToSearchIndex(), this.setMarkers(), this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive(
          "_helper",
          "boundingBox",
          4251856,
          0.15
        ), this._slides = this.$module.scene.addSlicesPrimitive(
          "_helper",
          ["x-plane", "y-plane", "z-plane"],
          [16733525, 5635925, 5592575],
          0.5
        );
        const { centre: e, size: t } = this.$module.getCentreAndSize();
        this.boundingDims.centre = e, this.boundingDims.size = t, this.isReady = !0, this.$nextTick(() => {
          this.restoreSettings(n), this.$emit("on-ready");
        });
      };
    },
    /**
     * Function used for getting the current states of the scene. This exported states
     * can be imported using the importStates method.
     *
     * @public
     */
    getState: function() {
      let n = {
        format: this.fileFormat,
        url: this._currentURL,
        viewport: void 0,
        visibility: void 0,
        background: this.currentBackground,
        colour: this.colourRadio,
        outlines: this.outlinesRadio,
        viewingMode: this.viewingMode,
        usageConfig: this.usageConfig
      };
      if (this.$refs.scaffoldTreeControls && (n.visibility = this.$refs.scaffoldTreeControls.getState()), this.$module.scene) {
        let e = this.$module.scene.getZincCameraControls();
        n.viewport = e.getCurrentViewport();
      }
      return this.lastSelected && this.lastSelected.group && (n.search = { ...this.lastSelected }), this.offlineAnnotationEnabled && (n.offlineAnnotations = sessionStorage.getItem("anonymous-annotation")), n;
    },
    /**
     * Function used for importing the states of the scene. This exported states
     * can be imported using the read states method.
     *
     * @public
     * @arg `state`
     */
    setState: function(n) {
      n && (n.url && n.url !== this._currentURL ? this.setURLAndState(n.url, {
        fileFormat: n.fileFormat,
        viewport: n.viewport,
        visibility: n.visibility,
        background: n.background,
        colour: n.colour,
        outlines: n.outlines,
        viewingMode: n.viewingMode,
        search: n.search,
        offlineAnnotations: n.offlineAnnotations
      }) : (n.background || n.colour || n.search || n.outlines || n.viewport || n.viewingMode || n.visibility) && (this.isReady && this.$module.scene ? this.restoreSettings(n) : this.$module.setFinishDownloadCallback(
        this.setURLFinishCallback({
          background: n.background,
          colour: n.colour,
          search: n.search,
          offlineAnnotations: n.offlineAnnotations,
          outlines: n.outlines,
          viewingMode: n.viewingMode,
          viewport: n.viewport,
          visibility: n.visibility
        })
      )));
    },
    /**
     * export current scene in GLTF.
     * @arg "Return in binary form when set to true"
     *
     * @public
     */
    exportGLTF: function(n) {
      return this.$module.scene.exportGLTF(n);
    },
    /**
     * Return a copy of the local annotations list.
     * This list is used for storing user created annotation
     * when offlineAnnotationEnabled is set to true.
     *
     * @public
     */
    getOfflineAnnotations: function() {
      return [...this.offlineAnnotations];
    },
    /**
     * Import local annotations. The annotations will only
     * be imported when offlineAnnotationEnabled is set to
     * true;
     *
     * @public
     * @arg {Array} `annotationsList`
     */
    importOfflineAnnotations: function(n) {
      if (this.offlineAnnotationEnabled) {
        n.forEach((t) => {
          const i = t.group, r = t.region;
          let s = r.slice(-1) === "/" ? r : r + "/";
          const o = s.slice(0, -1);
          t.region = o, s = s + i;
          const a = s;
          t.item.id = a, t.feature.id = a;
        });
        const e = n.map((t) => t.feature);
        Cv(this.$module.scene, e), n.forEach((t) => {
          this.offlineAnnotations.push({ ...t });
        }), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations));
      }
    },
    /**
     * Function used for reading in new scaffold metadata and a custom
     * viewport. This function will ignore the state prop and
     * read in the new url.
     *
     * @public
     * @arg `newValue`
     * @arg `state`
     */
    setURLAndState: function(n, e) {
      var t, i;
      if (n != this._currentURL) {
        const r = {};
        e != null && e.format && (this.fileFormat = e.format), this._currentURL = n, this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.loading = !0, this.timeVarying = !1, this.isReady = !1, this.$_searchIndex.removeAll(), this.hideRegionTooltip(), this.$module.setDownloadErrorCallback(
          this.downloadErrorCallback()
        ), this.$module.setFinishDownloadCallback(
          this.setURLFinishCallback({
            background: e == null ? void 0 : e.background,
            colour: e == null ? void 0 : e.colour,
            outlines: e == null ? void 0 : e.outlines,
            region: this.region,
            search: e == null ? void 0 : e.search,
            viewingMode: e == null ? void 0 : e.viewingMode,
            viewURL: this.viewURL,
            viewport: e == null ? void 0 : e.viewport,
            visibility: e == null ? void 0 : e.visibility,
            offlineAnnotations: e == null ? void 0 : e.offlineAnnotations
          })
        ), this.fileFormat === "gltf" ? this.$module.loadGLTFFromURL(n, "scene", !0) : (((t = this == null ? void 0 : this.usageConfig) != null && t.tubeLines || (i = e == null ? void 0 : e.usageConfig) != null && i.tubeLines) && (r.tubeLines = !0), this.$module.loadOrgansFromURL(
          n,
          void 0,
          void 0,
          "scene",
          void 0,
          !0,
          r
        )), this.$module && this.$module.scene && (this.$module.scene.displayMarkers = this.displayMarkers, this.$module.scene.forcePickableObjectsUpdate = !0, this.$module.scene.displayMinimap = this.displayMinimap, this.updateMinimapScissor());
      }
    },
    /**
     * Function used for reading in new scaffold metadata. This function will ignore
     * the state prop and read in the new url.
     *
     * @public
     * @arg `newValue`
     */
    setURL: function(n) {
      this.setURLAndState(n, void 0);
    },
    /**
     * Callback when drawer is toggled.
     */
    drawerToggled: function(n) {
      this.drawerOpen = n, this.adjustLayout();
    },
    /**
     * Callback using ResizeObserver.
     */
    adjustLayout: function() {
      var n;
      if ((n = this.$refs.scaffoldContainer) != null && n.$el) {
        let e = this.$refs.scaffoldContainer.$el.clientWidth;
        this.minimisedSlider = e < 812, this.minimisedSlider ? this.sliderPosition = this.drawerOpen ? "right" : "left" : this.sliderPosition = "";
      }
    },
    toggleRendering: function(n) {
      this.$module.zincRenderer && (n ? (this.forceContextRestore(), this.$module.zincRenderer.animate()) : (this.$module.zincRenderer.stopAnimate(), this.forceContextLoss()));
    },
    /**
     * @public
     *
     * Force the renderer to resize
     */
    forceResize: function() {
      this.$module.zincRenderer && this.$module.zincRenderer.onWindowResize();
    },
    syncControlCallback: function() {
      const n = this.$module.NDCCameraControl.getPanZoom();
      this.tData.visible && this.showRegionTooltip(this.tData.label, !0, !0), this.$emit("scaffold-navigated", n);
    },
    /**
     * Rotate mode - "none", "horizontal", "vertical", "free" but
     * it will be ignored if flag is set to false.
     */
    toggleSyncControl: function(n, e) {
      this.$module.toggleSyncControl(n, e), this.$module.setSyncControlCallback(this.syncControlCallback);
    },
    /**
     * Set the markers for the scene.
     */
    setMarkers: function() {
      for (const [n, e] of Object.entries(this.markerLabels))
        this.setMarkerModeForObjectsWithName(n, e, "on");
    }
  }
}, V5 = { class: "primitive-controls-box" }, G5 = { class: "animation-data" }, H5 = { class: "purple" }, W5 = { class: "animation-data" }, j5 = { class: "purple" }, $5 = { class: "animation-data" }, Z5 = { class: "bottom-right-control control-layer" }, X5 = { class: "control-layer" }, Y5 = { style: { "margin-bottom": "2px" } }, J5 = {
  key: 0,
  class: "viewing-mode-title"
}, K5 = ["onClick"], q5 = ["onClick"];
function Q5(n, e, t, i, r, s) {
  const o = Vn("map-svg-sprite-color"), a = CM, c = Vn("DrawToolbar"), l = u0, d = It, h = cu, f = EM, g = TM, p = Vn("map-svg-icon"), u = ti, y = Ui, v = xy, m = Qo, x = qo, w = by, A = Ko, M = ty, R = ny, L = My, _ = td;
  return Lt((ve(), Ve(L, {
    ref: "scaffoldContainer",
    class: "scaffold-container",
    "element-loading-text": "Loading...",
    "element-loading-background": "rgba(0, 0, 0, 0.3)",
    positionalRotation: t.positionalRotation,
    onOnRotationModeChange: s.setRotationMode
  }, {
    default: de(() => [
      le(o),
      le(a, {
        createData: n.createData,
        label: n.tData.label,
        region: n.tData.region,
        visible: n.tData.visible,
        x: n.tData.x,
        y: n.tData.y,
        annotationDisplay: s.annotationDisplay,
        annotationFeature: n.annotationFeature,
        offlineAnnotationEnabled: n.offlineAnnotationEnabled,
        onConfirmCreate: e[0] || (e[0] = (F) => s.confirmCreate(F)),
        onCancelCreate: e[1] || (e[1] = (F) => s.cancelCreate()),
        onConfirmComment: e[2] || (e[2] = (F) => s.confirmComment(F)),
        onConfirmDelete: e[3] || (e[3] = (F) => s.confirmDelete()),
        onTooltipHide: e[4] || (e[4] = (F) => s.onTooltipHide())
      }, null, 8, ["createData", "label", "region", "visible", "x", "y", "annotationDisplay", "annotationFeature", "offlineAnnotationEnabled"]),
      Ne("div", {
        id: "organsDisplayArea",
        ref: "display",
        tabindex: "-1",
        style: { height: "100%", width: "100%" },
        onKeydown: e[5] || (e[5] = ui((...F) => s.backgroundChangeCallback && s.backgroundChangeCallback(...F), ["66"]))
      }, null, 544),
      Lt(Ne("div", null, [
        n.viewingMode === "Annotation" && (n.authorisedUser || n.offlineAnnotationEnabled) ? (ve(), Ve(c, {
          key: 0,
          class: "control-layer",
          toolbarOptions: n.toolbarOptions,
          activeDrawTool: n.activeDrawTool,
          activeDrawMode: n.activeDrawMode,
          hoverVisibilities: n.hoverVisibilities,
          onClickToolbar: s.toggleDrawing,
          onShowTooltip: s.showHelpText,
          onHideTooltip: s.hideHelpText,
          ref: "toolbarPopover"
        }, null, 8, ["toolbarOptions", "activeDrawTool", "activeDrawMode", "hoverVisibilities", "onClickToolbar", "onShowTooltip", "onHideTooltip"])) : ke("", !0),
        t.displayWarning ? (ve(), Ve(h, {
          key: 1,
          ref: "warningPopover",
          visible: n.hoverVisibilities[7].value,
          content: t.warningMessage,
          placement: "right",
          width: "max-content",
          teleported: !1,
          "popper-class": "scaffold-popper message-popper right-popper non-selectable"
        }, {
          reference: de(() => [
            t.displayWarning ? (ve(), Ce("div", {
              key: 0,
              class: "message-icon warning-icon control-layer",
              onMouseover: e[6] || (e[6] = (F) => s.showHelpText(7)),
              onMouseout: e[7] || (e[7] = (F) => s.hideHelpText(7))
            }, [
              le(d, null, {
                default: de(() => [
                  le(l)
                ]),
                _: 1
              }),
              e[31] || (e[31] = Ne("span", { class: "message-text" }, "Beta", -1))
            ], 32)) : ke("", !0)
          ]),
          _: 1
        }, 8, ["visible", "content"])) : ke("", !0),
        t.displayLatestChanges ? (ve(), Ve(h, {
          key: 2,
          visible: n.hoverVisibilities[8].value,
          content: t.latestChangesMessage,
          placement: "right",
          teleported: !1,
          trigger: "manual",
          "popper-class": "scaffold-popper message-popper right-popper non-selectable",
          ref: "whatsNewPopover"
        }, {
          reference: de(() => [
            t.displayLatestChanges && t.latestChangesMessage ? (ve(), Ce("div", {
              key: 0,
              class: "el-icon-warning message-icon latest-changesicon control-layer",
              onMouseover: e[8] || (e[8] = (F) => s.showHelpText(8)),
              onMouseout: e[9] || (e[9] = (F) => s.hideHelpText(8))
            }, [
              le(d, null, {
                default: de(() => [
                  le(l)
                ]),
                _: 1
              }),
              e[32] || (e[32] = Ne("span", { class: "message-text" }, "What's new?", -1))
            ], 32)) : ke("", !0)
          ]),
          _: 1
        }, 8, ["visible", "content"])) : ke("", !0),
        le(h, {
          visible: n.hoverVisibilities[6].value,
          content: "Change region visibility",
          placement: "right",
          width: "max-content",
          teleported: !1,
          trigger: "manual",
          "popper-class": "scaffold-popper right-popper non-selectable",
          ref: "regionVisibilityPopover"
        }, {
          reference: de(() => [
            le(f, {
              class: "control-layer",
              ref: "scaffoldTreeControls",
              isReady: n.isReady,
              "show-colour-picker": s.enableColourPicker,
              onObjectSelected: s.objectSelected,
              onObjectHovered: s.objectHovered,
              onDrawerToggled: s.drawerToggled
            }, null, 8, ["isReady", "show-colour-picker", "onObjectSelected", "onObjectHovered", "onDrawerToggled"])
          ]),
          _: 1
        }, 8, ["visible"]),
        Ne("div", V5, [
          le(g, {
            class: "control-layer",
            ref: "primitiveControls",
            createData: n.createData,
            viewingMode: n.viewingMode,
            usageConfig: t.usageConfig,
            onPrimitivesUpdated: s.primitivesUpdated
          }, null, 8, ["createData", "viewingMode", "usageConfig", "onPrimitivesUpdated"])
        ]),
        n.timeVarying ? (ve(), Ve(h, {
          key: 3,
          ref: "sliderPopover",
          width: "max-content",
          visible: n.hoverVisibilities[5].value,
          content: "Move the slider to animate the region",
          placement: "top",
          teleported: !1,
          trigger: "manual",
          "popper-class": "scaffold-popper top-popper non-selectable"
        }, {
          reference: de(() => [
            n.timeVarying ? (ve(), Ce("div", {
              key: 0,
              class: Te(["time-slider-container control-layer", [n.minimisedSlider ? "minimised" : "", n.sliderPosition]])
            }, [
              le(w, { type: "card" }, {
                default: de(() => [
                  le(v, { label: "Animate scaffold" }, {
                    default: de(() => [
                      le(y, { class: "tab-content" }, {
                        default: de(() => [
                          n.isPlaying ? (ve(), Ve(p, {
                            key: 0,
                            icon: "pause",
                            class: "icon-button video-button",
                            onClick: e[10] || (e[10] = (F) => s.play(!1))
                          })) : (ve(), Ve(p, {
                            key: 1,
                            icon: "play",
                            class: "video-button icon-button",
                            onClick: e[11] || (e[11] = (F) => s.play(!0))
                          })),
                          le(u, {
                            min: 0,
                            max: n.timeMax,
                            "model-value": n.currentTime / 100 * n.timeMax,
                            step: 0.1,
                            "tooltip-class": "time-slider-tooltip",
                            class: "slider",
                            "format-tooltip": s.formatTooltip,
                            marks: n.timeStamps,
                            onInput: e[12] || (e[12] = (F) => s.timeChange(F))
                          }, null, 8, ["max", "model-value", "format-tooltip", "marks"])
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }),
                  le(v, { label: "Animation data" }, {
                    default: de(() => [
                      le(y, { class: "tab-content" }, {
                        default: de(() => [
                          Ne("div", G5, [
                            e[33] || (e[33] = rt(" Original duration: ")),
                            Ne("div", H5, gt(n.orginalDuration), 1)
                          ]),
                          Ne("div", W5, [
                            e[34] || (e[34] = rt(" Animation duration: ")),
                            Ne("div", j5, gt(n.animateDuration), 1)
                          ]),
                          Ne("div", $5, [
                            e[35] || (e[35] = rt(" Playback speed ")),
                            le(x, {
                              teleported: !0,
                              "model-value": n.currentSpeed,
                              placeholder: "Select",
                              class: "scaffold-select-box speed",
                              "popper-class": "scaffold_viewer_dropdown",
                              onChange: e[13] || (e[13] = (F) => s.speedChanged(F))
                            }, {
                              default: de(() => [
                                (ve(!0), Ce(Ft, null, Gn(n.playSpeed, (F) => (ve(), Ve(m, {
                                  key: F.value,
                                  label: F.label,
                                  value: F.value
                                }, null, 8, ["label", "value"]))), 128))
                              ]),
                              _: 1
                            }, 8, ["model-value"])
                          ])
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              })
            ], 2)) : ke("", !0)
          ]),
          _: 1
        }, 8, ["visible"])) : ke("", !0),
        Ne("div", Z5, [
          le(h, {
            visible: n.hoverVisibilities[0].value,
            content: "Zoom in",
            width: "max-content",
            placement: "left",
            teleported: !1,
            trigger: "manual",
            "popper-class": "scaffold-popper left-popper non-selectable",
            ref: "zoomInPopover"
          }, {
            reference: de(() => [
              le(p, {
                icon: "zoomIn",
                class: "icon-button zoomIn",
                onClick: e[14] || (e[14] = (F) => s.zoomIn()),
                onMouseover: e[15] || (e[15] = (F) => s.showHelpText(0)),
                onMouseout: e[16] || (e[16] = (F) => s.hideHelpText(0))
              })
            ]),
            _: 1
          }, 8, ["visible"]),
          le(h, {
            visible: n.hoverVisibilities[1].value,
            content: "Zoom out",
            placement: "top-end",
            width: "max-content",
            teleported: !1,
            trigger: "manual",
            "popper-class": "scaffold-popper popper-zoomout non-selectable",
            ref: "zoomOutPopover"
          }, {
            reference: de(() => [
              le(p, {
                icon: "zoomOut",
                class: "icon-button zoomOut",
                onClick: e[17] || (e[17] = (F) => s.zoomOut()),
                onMouseover: e[18] || (e[18] = (F) => s.showHelpText(1)),
                onMouseout: e[19] || (e[19] = (F) => s.hideHelpText(1))
              })
            ]),
            _: 1
          }, 8, ["visible"]),
          le(h, {
            visible: n.hoverVisibilities[2].value,
            placement: "top",
            teleported: !1,
            trigger: "manual",
            width: "max-content",
            "popper-class": "scaffold-popper non-selectable",
            ref: "zoomFitPopover"
          }, {
            reference: de(() => [
              le(p, {
                icon: "fitWindow",
                class: "icon-button fitWindow",
                onClick: e[20] || (e[20] = (F) => s.fitWindow()),
                onMouseover: e[21] || (e[21] = (F) => s.showHelpText(2)),
                onMouseout: e[22] || (e[22] = (F) => s.hideHelpText(2))
              })
            ]),
            default: de(() => [
              e[36] || (e[36] = Ne("div", null, [
                rt(" Fit to "),
                Ne("br"),
                rt(" window ")
              ], -1))
            ]),
            _: 1
          }, 8, ["visible"])
        ]),
        n.openMapRef ? (ve(), Ve(h, {
          key: 4,
          ref: "open-map-popover",
          "virtual-ref": n.openMapRef,
          placement: "top-start",
          width: "128",
          teleported: !1,
          trigger: "click",
          "popper-class": "open-map-popper",
          "virtual-triggering": ""
        }, {
          default: de(() => [
            (ve(!0), Ce(Ft, null, Gn(t.openMapOptions, (F) => (ve(), Ve(y, {
              key: F.key
            }, {
              default: de(() => [
                le(A, {
                  type: "primary",
                  plain: "",
                  onClick: (S) => n.$emit("open-map", F.key)
                }, {
                  default: de(() => [
                    rt(gt(F.display), 1)
                  ]),
                  _: 2
                }, 1032, ["onClick"])
              ]),
              _: 2
            }, 1024))), 128))
          ]),
          _: 1
        }, 8, ["virtual-ref"])) : ke("", !0),
        le(h, {
          ref: "backgroundPopover",
          "virtual-ref": n.backgroundIconRef,
          placement: "top-start",
          width: "320",
          teleported: !1,
          trigger: "click",
          "popper-class": "background-popper non-selectable h-auto",
          "virtual-triggering": ""
        }, {
          default: de(() => [
            Ne("div", X5, [
              le(y, { class: "backgroundText" }, {
                default: de(() => e[37] || (e[37] = [
                  rt("Viewing Mode")
                ])),
                _: 1
              }),
              le(y, { class: "backgroundControl" }, {
                default: de(() => [
                  Ne("div", Y5, [
                    (ve(!0), Ce(Ft, null, Gn(n.viewingModes, (F, S, T) => (ve(), Ce(Ft, { key: S }, [
                      S === n.viewingMode ? (ve(), Ce("span", J5, [
                        Ne("b", null, gt(S), 1)
                      ])) : (ve(), Ce("span", {
                        key: 1,
                        class: "viewing-mode-unselected",
                        onClick: (E) => s.changeViewingMode(S)
                      }, gt(S), 9, K5))
                    ], 64))), 128))
                  ]),
                  le(y, { class: "viewing-mode-description" }, {
                    default: de(() => [
                      rt(gt(s.modeDescription), 1)
                    ]),
                    _: 1
                  }),
                  n.viewingMode === "Annotation" && n.offlineAnnotationEnabled ? (ve(), Ve(y, {
                    key: 0,
                    class: "viewing-mode-description"
                  }, {
                    default: de(() => e[38] || (e[38] = [
                      rt(" (Anonymous annotate) ")
                    ])),
                    _: 1
                  })) : ke("", !0)
                ]),
                _: 1
              }),
              le(y, { class: "backgroundSpacer" }),
              le(y, { class: "backgroundText" }, {
                default: de(() => e[39] || (e[39] = [
                  rt("Organs display")
                ])),
                _: 1
              }),
              le(y, { class: "backgroundControl" }, {
                default: de(() => [
                  le(R, {
                    modelValue: n.colourRadio,
                    "onUpdate:modelValue": e[23] || (e[23] = (F) => n.colourRadio = F),
                    class: "scaffold-radio",
                    onChange: e[24] || (e[24] = (F) => s.setColour(n.colourRadio, !0))
                  }, {
                    default: de(() => [
                      le(M, { value: !0 }, {
                        default: de(() => e[40] || (e[40] = [
                          rt("Colour")
                        ])),
                        _: 1
                      }),
                      le(M, { value: !1 }, {
                        default: de(() => e[41] || (e[41] = [
                          rt("Greyscale")
                        ])),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["modelValue"])
                ]),
                _: 1
              }),
              le(y, { class: "backgroundSpacer" }),
              le(y, { class: "backgroundText" }, {
                default: de(() => e[42] || (e[42] = [
                  rt("Outlines display")
                ])),
                _: 1
              }),
              le(y, { class: "backgroundControl" }, {
                default: de(() => [
                  le(R, {
                    modelValue: n.outlinesRadio,
                    "onUpdate:modelValue": e[25] || (e[25] = (F) => n.outlinesRadio = F),
                    class: "scaffold-radio",
                    onChange: e[26] || (e[26] = (F) => s.setOutlines(n.outlinesRadio, !0))
                  }, {
                    default: de(() => [
                      le(M, { value: !0 }, {
                        default: de(() => e[43] || (e[43] = [
                          rt("Show")
                        ])),
                        _: 1
                      }),
                      le(M, { value: !1 }, {
                        default: de(() => e[44] || (e[44] = [
                          rt("Hide")
                        ])),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["modelValue"])
                ]),
                _: 1
              }),
              le(y, { class: "backgroundSpacer" }),
              le(y, { class: "backgroundText" }, {
                default: de(() => e[45] || (e[45] = [
                  rt(" Change background ")
                ])),
                _: 1
              }),
              le(y, { class: "backgroundChooser" }, {
                default: de(() => [
                  (ve(!0), Ce(Ft, null, Gn(n.availableBackground, (F) => (ve(), Ce("div", {
                    key: F,
                    class: Te([
                      "backgroundChoice",
                      F,
                      F == n.currentBackground ? "active" : ""
                    ]),
                    onClick: (S) => s.backgroundChangeCallback(F)
                  }, null, 10, q5))), 128))
                ]),
                _: 1
              })
            ])
          ]),
          _: 1
        }, 8, ["virtual-ref"]),
        Ne("div", {
          class: Te(["settings-group control-layer", { open: n.drawerOpen, close: !n.drawerOpen }])
        }, [
          t.showOpenMapButton ? (ve(), Ve(y, { key: 0 }, {
            default: de(() => [
              le(h, {
                visible: n.hoverVisibilities[3].value,
                content: "Open new map",
                placement: "right",
                teleported: !1,
                trigger: "manual",
                width: "max-content",
                "popper-class": "scaffold-popper right-popper non-selectable",
                ref: "openMapPopover"
              }, {
                reference: de(() => [
                  t.enableOpenMapUI && t.openMapOptions.length > 0 ? (ve(), Ve(p, {
                    key: 0,
                    ref: "openMapRef",
                    icon: "openMap",
                    class: "icon-button open-map-button",
                    onMouseover: e[27] || (e[27] = (F) => s.showHelpText(3)),
                    onMouseout: e[28] || (e[28] = (F) => s.hideHelpText(3))
                  }, null, 512)) : ke("", !0)
                ]),
                _: 1
              }, 8, ["visible"])
            ]),
            _: 1
          })) : ke("", !0),
          t.showLocalSettings ? (ve(), Ve(y, { key: 1 }, {
            default: de(() => [
              le(h, {
                visible: n.hoverVisibilities[4].value,
                content: "Change background color",
                placement: "right",
                width: "max-content",
                teleported: !1,
                trigger: "manual",
                "popper-class": "scaffold-popper right-popper non-selectable",
                ref: "settingsPopover"
              }, {
                reference: de(() => [
                  le(p, {
                    ref: "backgroundIconRef",
                    icon: "changeBckgd",
                    class: "icon-button",
                    onMouseover: e[29] || (e[29] = (F) => s.showHelpText(4)),
                    onMouseout: e[30] || (e[30] = (F) => s.hideHelpText(4))
                  }, null, 512)
                ]),
                _: 1
              }, 8, ["visible"])
            ]),
            _: 1
          })) : ke("", !0)
        ], 2)
      ], 512), [
        [mn, t.displayUI && !n.isTransitioning]
      ])
    ]),
    _: 1
  }, 8, ["positionalRotation", "onOnRotationModeChange"])), [
    [_, n.loading]
  ]);
}
const sU = /* @__PURE__ */ ki(k5, [["render", Q5], ["__scopeId", "data-v-75641bca"]]);
export {
  sU as ScaffoldVuer
};
