import {
  CA,
  EA,
  kA,
  yA
} from "./chunk-WCFS3QHU.js";
import {
  hn,
  wn
} from "./chunk-EEZUFMIV.js";
import {
  Comment,
  Fragment,
  Teleport,
  Text,
  Transition,
  cloneVNode,
  computed,
  createApp,
  createBaseVNode,
  createBlock,
  createCommentVNode,
  createElementBlock,
  createSlots,
  createTextVNode,
  createVNode,
  defineComponent,
  effectScope,
  getCurrentInstance,
  getCurrentScope,
  h,
  hasInjectionContext,
  inject,
  isReactive,
  isRef,
  isVNode,
  markRaw,
  mergeProps,
  nextTick,
  normalizeClass,
  normalizeStyle,
  onActivated,
  onBeforeMount,
  onBeforeUnmount,
  onDeactivated,
  onMounted,
  onScopeDispose,
  onUnmounted,
  onUpdated,
  openBlock,
  provide,
  reactive,
  readonly,
  ref,
  renderList,
  renderSlot,
  resolveComponent,
  resolveDirective,
  resolveDynamicComponent,
  shallowRef,
  toDisplayString,
  toHandlerKey,
  toHandlers,
  toRaw,
  toRef,
  toRefs,
  unref,
  useAttrs,
  useSlots,
  vModelText,
  vShow,
  warn,
  watch,
  watchEffect,
  withCtx,
  withDirectives,
  withKeys,
  withModifiers
} from "./chunk-6UGCK2MK.js";
import "./chunk-DC5AMYBS.js";

// node_modules/@abi-software/scaffoldvuer/dist/scaffoldvuer.js
var qi = (n, e, { checkForDefaultPrevented: t = true } = {}) => (r) => {
  const s = n == null ? void 0 : n(r);
  if (t === false || !s)
    return e == null ? void 0 : e(r);
};
var b1 = Object.defineProperty;
var x1 = Object.defineProperties;
var w1 = Object.getOwnPropertyDescriptors;
var kp = Object.getOwnPropertySymbols;
var M1 = Object.prototype.hasOwnProperty;
var _1 = Object.prototype.propertyIsEnumerable;
var Gp = (n, e, t) => e in n ? b1(n, e, { enumerable: true, configurable: true, writable: true, value: t }) : n[e] = t;
var S1 = (n, e) => {
  for (var t in e || (e = {}))
    M1.call(e, t) && Gp(n, t, e[t]);
  if (kp)
    for (var t of kp(e))
      _1.call(e, t) && Gp(n, t, e[t]);
  return n;
};
var T1 = (n, e) => x1(n, w1(e));
function Hp(n, e) {
  var t;
  const i = shallowRef();
  return watchEffect(() => {
    i.value = n();
  }, T1(S1({}, e), {
    flush: (t = void 0) != null ? t : "sync"
  })), readonly(i);
}
var Wp;
var Qt = typeof window < "u";
var E1 = (n) => typeof n == "string";
var u0 = () => {
};
var td = Qt && ((Wp = window == null ? void 0 : window.navigator) == null ? void 0 : Wp.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function h0(n) {
  return typeof n == "function" ? n() : unref(n);
}
function A1(n) {
  return n;
}
function au(n) {
  return getCurrentScope() ? (onScopeDispose(n), true) : false;
}
function C1(n, e = true) {
  getCurrentInstance() ? onMounted(n) : e ? n() : nextTick(n);
}
function nr(n) {
  var e;
  const t = h0(n);
  return (e = t == null ? void 0 : t.$el) != null ? e : t;
}
var dl = Qt ? window : void 0;
var L1 = Qt ? window.document : void 0;
function un(...n) {
  let e, t, i, r;
  if (E1(n[0]) || Array.isArray(n[0]) ? ([t, i, r] = n, e = dl) : [e, t, i, r] = n, !e)
    return u0;
  Array.isArray(t) || (t = [t]), Array.isArray(i) || (i = [i]);
  const s = [], o = () => {
    s.forEach((d) => d()), s.length = 0;
  }, a = (d, h4, f, g) => (d.addEventListener(h4, f, g), () => d.removeEventListener(h4, f, g)), c = watch(() => [nr(e), h0(r)], ([d, h4]) => {
    o(), d && s.push(...t.flatMap((f) => i.map((g) => a(d, f, g, h4))));
  }, { immediate: true, flush: "post" }), l = () => {
    c(), o();
  };
  return au(l), l;
}
var jp = false;
function R1(n, e, t = {}) {
  const { window: i = dl, ignore: r = [], capture: s = true, detectIframe: o = false } = t;
  if (!i)
    return;
  td && !jp && (jp = true, Array.from(i.document.body.children).forEach((f) => f.addEventListener("click", u0)));
  let a = true;
  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 = nr(g);
      return p && (f.target === p || f.composedPath().includes(p));
    }
  }), d = [
    un(i, "click", (f) => {
      const g = nr(n);
      if (!(!g || g === f.target || f.composedPath().includes(g))) {
        if (f.detail === 0 && (a = !c(f)), !a) {
          a = true;
          return;
        }
        e(f);
      }
    }, { passive: true, capture: s }),
    un(i, "pointerdown", (f) => {
      const g = nr(n);
      g && (a = !f.composedPath().includes(g) && !c(f));
    }, { passive: true }),
    o && un(i, "blur", (f) => {
      var g;
      const p = nr(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 d0(n, e = false) {
  const t = ref(), i = () => t.value = !!n();
  return i(), C1(i, e), t;
}
var $p = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
var Zp = "__vueuse_ssr_handlers__";
$p[Zp] = $p[Zp] || {};
function P1({ document: n = L1 } = {}) {
  if (!n)
    return ref("visible");
  const e = ref(n.visibilityState);
  return un(n, "visibilitychange", () => {
    e.value = n.visibilityState;
  }), e;
}
var Xp = Object.getOwnPropertySymbols;
var O1 = Object.prototype.hasOwnProperty;
var I1 = Object.prototype.propertyIsEnumerable;
var D1 = (n, e) => {
  var t = {};
  for (var i in n)
    O1.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
  if (n != null && Xp)
    for (var i of Xp(n))
      e.indexOf(i) < 0 && I1.call(n, i) && (t[i] = n[i]);
  return t;
};
function Qn(n, e, t = {}) {
  const i = t, { window: r = dl } = i, s = D1(i, ["window"]);
  let o;
  const a = d0(() => r && "ResizeObserver" in r), c = () => {
    o && (o.disconnect(), o = void 0);
  }, l = watch(() => nr(n), (h4) => {
    c(), a.value && r && h4 && (o = new ResizeObserver(e), o.observe(h4, s));
  }, { immediate: true, flush: "post" }), d = () => {
    c(), l();
  };
  return au(d), {
    isSupported: a,
    stop: d
  };
}
var Yp = Object.getOwnPropertySymbols;
var N1 = Object.prototype.hasOwnProperty;
var B1 = Object.prototype.propertyIsEnumerable;
var F1 = (n, e) => {
  var t = {};
  for (var i in n)
    N1.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]);
  if (n != null && Yp)
    for (var i of Yp(n))
      e.indexOf(i) < 0 && B1.call(n, i) && (t[i] = n[i]);
  return t;
};
function z1(n, e, t = {}) {
  const i = t, { window: r = dl } = i, s = F1(i, ["window"]);
  let o;
  const a = d0(() => r && "MutationObserver" in r), c = () => {
    o && (o.disconnect(), o = void 0);
  }, l = watch(() => nr(n), (h4) => {
    c(), a.value && r && h4 && (o = new MutationObserver(e), o.observe(h4, s));
  }, { immediate: true }), d = () => {
    c(), l();
  };
  return au(d), {
    isSupported: a,
    stop: d
  };
}
var Jp;
(function(n) {
  n.UP = "UP", n.RIGHT = "RIGHT", n.DOWN = "DOWN", n.LEFT = "LEFT", n.NONE = "NONE";
})(Jp || (Jp = {}));
var U1 = Object.defineProperty;
var Kp = Object.getOwnPropertySymbols;
var V1 = Object.prototype.hasOwnProperty;
var k1 = Object.prototype.propertyIsEnumerable;
var qp = (n, e, t) => e in n ? U1(n, e, { enumerable: true, configurable: true, writable: true, value: t }) : n[e] = t;
var G1 = (n, e) => {
  for (var t in e || (e = {}))
    V1.call(e, t) && qp(n, t, e[t]);
  if (Kp)
    for (var t of Kp(e))
      k1.call(e, t) && qp(n, t, e[t]);
  return n;
};
var H1 = {
  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]
};
G1({
  linear: A1
}, H1);
function W1({ window: n = dl } = {}) {
  if (!n)
    return ref(false);
  const e = ref(n.document.hasFocus());
  return un(n, "blur", () => {
    e.value = false;
  }), un(n, "focus", () => {
    e.value = true;
  }), e;
}
var j1 = () => Qt && /firefox/i.test(window.navigator.userAgent);
Object.freeze({});
Object.freeze([]);
var $a = () => {
};
var $1 = Object.prototype.hasOwnProperty;
var Qp = (n, e) => $1.call(n, e);
var Nn = Array.isArray;
var Tn = (n) => typeof n == "function";
var Ln = (n) => typeof n == "string";
var An = (n) => n !== null && typeof n == "object";
var Z1 = Object.prototype.toString;
var X1 = (n) => Z1.call(n);
var ju = (n) => X1(n).slice(8, -1);
var lf = (n) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (t) => e[t] || (e[t] = n(t));
};
var Y1 = /-(\w)/g;
var J1 = lf(
  (n) => n.replace(Y1, (e, t) => t ? t.toUpperCase() : "")
);
var K1 = /\B([A-Z])/g;
var q1 = lf(
  (n) => n.replace(K1, "-$1").toLowerCase()
);
var Q1 = lf((n) => n.charAt(0).toUpperCase() + n.slice(1));
var f0 = typeof global == "object" && global && global.Object === Object && global;
var eM = typeof self == "object" && self && self.Object === Object && self;
var Ui = f0 || eM || Function("return this")();
var Di = Ui.Symbol;
var p0 = Object.prototype;
var tM = p0.hasOwnProperty;
var nM = p0.toString;
var ga = Di ? Di.toStringTag : void 0;
function iM(n) {
  var e = tM.call(n, ga), t = n[ga];
  try {
    n[ga] = void 0;
    var i = true;
  } catch {
  }
  var r = nM.call(n);
  return i && (e ? n[ga] = t : delete n[ga]), r;
}
var rM = Object.prototype;
var sM = rM.toString;
function oM(n) {
  return sM.call(n);
}
var aM = "[object Null]";
var lM = "[object Undefined]";
var em = Di ? Di.toStringTag : void 0;
function ta(n) {
  return n == null ? n === void 0 ? lM : aM : em && em in Object(n) ? iM(n) : oM(n);
}
function Co(n) {
  return n != null && typeof n == "object";
}
var cM = "[object Symbol]";
function lu(n) {
  return typeof n == "symbol" || Co(n) && ta(n) == cM;
}
function uM(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 vi = Array.isArray;
var hM = 1 / 0;
var tm = Di ? Di.prototype : void 0;
var nm = tm ? tm.toString : void 0;
function m0(n) {
  if (typeof n == "string")
    return n;
  if (vi(n))
    return uM(n, m0) + "";
  if (lu(n))
    return nm ? nm.call(n) : "";
  var e = n + "";
  return e == "0" && 1 / n == -hM ? "-0" : e;
}
var dM = /\s/;
function fM(n) {
  for (var e = n.length; e-- && dM.test(n.charAt(e)); )
    ;
  return e;
}
var pM = /^\s+/;
function mM(n) {
  return n && n.slice(0, fM(n) + 1).replace(pM, "");
}
function Hr(n) {
  var e = typeof n;
  return n != null && (e == "object" || e == "function");
}
var im = NaN;
var gM = /^[-+]0x[0-9a-f]+$/i;
var vM = /^0b[01]+$/i;
var yM = /^0o[0-7]+$/i;
var bM = parseInt;
function rm(n) {
  if (typeof n == "number")
    return n;
  if (lu(n))
    return im;
  if (Hr(n)) {
    var e = typeof n.valueOf == "function" ? n.valueOf() : n;
    n = Hr(e) ? e + "" : e;
  }
  if (typeof n != "string")
    return n === 0 ? n : +n;
  n = mM(n);
  var t = vM.test(n);
  return t || yM.test(n) ? bM(n.slice(2), t ? 2 : 8) : gM.test(n) ? im : +n;
}
function g0(n) {
  return n;
}
var xM = "[object AsyncFunction]";
var wM = "[object Function]";
var MM = "[object GeneratorFunction]";
var _M = "[object Proxy]";
function v0(n) {
  if (!Hr(n))
    return false;
  var e = ta(n);
  return e == wM || e == MM || e == xM || e == _M;
}
var $u = Ui["__core-js_shared__"];
var sm = function() {
  var n = /[^.]+$/.exec($u && $u.keys && $u.keys.IE_PROTO || "");
  return n ? "Symbol(src)_1." + n : "";
}();
function SM(n) {
  return !!sm && sm in n;
}
var TM = Function.prototype;
var EM = TM.toString;
function Vs(n) {
  if (n != null) {
    try {
      return EM.call(n);
    } catch {
    }
    try {
      return n + "";
    } catch {
    }
  }
  return "";
}
var AM = /[\\^$.*+?()[\]{}|]/g;
var CM = /^\[object .+?Constructor\]$/;
var LM = Function.prototype;
var RM = Object.prototype;
var PM = LM.toString;
var OM = RM.hasOwnProperty;
var IM = RegExp(
  "^" + PM.call(OM).replace(AM, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function DM(n) {
  if (!Hr(n) || SM(n))
    return false;
  var e = v0(n) ? IM : CM;
  return e.test(Vs(n));
}
function NM(n, e) {
  return n == null ? void 0 : n[e];
}
function ks(n, e) {
  var t = NM(n, e);
  return DM(t) ? t : void 0;
}
var nd = ks(Ui, "WeakMap");
function BM(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 FM = 800;
var zM = 16;
var UM = Date.now;
function VM(n) {
  var e = 0, t = 0;
  return function() {
    var i = UM(), r = zM - (i - t);
    if (t = i, r > 0) {
      if (++e >= FM)
        return arguments[0];
    } else
      e = 0;
    return n.apply(void 0, arguments);
  };
}
function kM(n) {
  return function() {
    return n;
  };
}
var Hc = function() {
  try {
    var n = ks(Object, "defineProperty");
    return n({}, "", {}), n;
  } catch {
  }
}();
var GM = Hc ? function(n, e) {
  return Hc(n, "toString", {
    configurable: true,
    enumerable: false,
    value: kM(e),
    writable: true
  });
} : g0;
var HM = VM(GM);
function WM(n, e, t, i) {
  n.length;
  for (var r = t + 1; r--; )
    if (e(n[r], r, n))
      return r;
  return -1;
}
var jM = 9007199254740991;
var $M = /^(?:0|[1-9]\d*)$/;
function cf(n, e) {
  var t = typeof n;
  return e = e ?? jM, !!e && (t == "number" || t != "symbol" && $M.test(n)) && n > -1 && n % 1 == 0 && n < e;
}
function ZM(n, e, t) {
  e == "__proto__" && Hc ? Hc(n, e, {
    configurable: true,
    enumerable: true,
    value: t,
    writable: true
  }) : n[e] = t;
}
function uf(n, e) {
  return n === e || n !== n && e !== e;
}
var XM = Object.prototype;
var YM = XM.hasOwnProperty;
function JM(n, e, t) {
  var i = n[e];
  (!(YM.call(n, e) && uf(i, t)) || t === void 0 && !(e in n)) && ZM(n, e, t);
}
var om = Math.max;
function KM(n, e, t) {
  return e = om(e === void 0 ? n.length - 1 : e, 0), function() {
    for (var i = arguments, r = -1, s = om(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), BM(n, this, a);
  };
}
var qM = 9007199254740991;
function hf(n) {
  return typeof n == "number" && n > -1 && n % 1 == 0 && n <= qM;
}
function QM(n) {
  return n != null && hf(n.length) && !v0(n);
}
var e_ = Object.prototype;
function t_(n) {
  var e = n && n.constructor, t = typeof e == "function" && e.prototype || e_;
  return n === t;
}
function n_(n, e) {
  for (var t = -1, i = Array(n); ++t < n; )
    i[t] = e(t);
  return i;
}
var i_ = "[object Arguments]";
function am(n) {
  return Co(n) && ta(n) == i_;
}
var y0 = Object.prototype;
var r_ = y0.hasOwnProperty;
var s_ = y0.propertyIsEnumerable;
var df = am(/* @__PURE__ */ function() {
  return arguments;
}()) ? am : function(n) {
  return Co(n) && r_.call(n, "callee") && !s_.call(n, "callee");
};
function o_() {
  return false;
}
var b0 = typeof exports == "object" && exports && !exports.nodeType && exports;
var lm = b0 && typeof module == "object" && module && !module.nodeType && module;
var a_ = lm && lm.exports === b0;
var cm = a_ ? Ui.Buffer : void 0;
var l_ = cm ? cm.isBuffer : void 0;
var id = l_ || o_;
var c_ = "[object Arguments]";
var u_ = "[object Array]";
var h_ = "[object Boolean]";
var d_ = "[object Date]";
var f_ = "[object Error]";
var p_ = "[object Function]";
var m_ = "[object Map]";
var g_ = "[object Number]";
var v_ = "[object Object]";
var y_ = "[object RegExp]";
var b_ = "[object Set]";
var x_ = "[object String]";
var w_ = "[object WeakMap]";
var M_ = "[object ArrayBuffer]";
var __ = "[object DataView]";
var S_ = "[object Float32Array]";
var T_ = "[object Float64Array]";
var E_ = "[object Int8Array]";
var A_ = "[object Int16Array]";
var C_ = "[object Int32Array]";
var L_ = "[object Uint8Array]";
var R_ = "[object Uint8ClampedArray]";
var P_ = "[object Uint16Array]";
var O_ = "[object Uint32Array]";
var Et = {};
Et[S_] = Et[T_] = Et[E_] = Et[A_] = Et[C_] = Et[L_] = Et[R_] = Et[P_] = Et[O_] = true;
Et[c_] = Et[u_] = Et[M_] = Et[h_] = Et[__] = Et[d_] = Et[f_] = Et[p_] = Et[m_] = Et[g_] = Et[v_] = Et[y_] = Et[b_] = Et[x_] = Et[w_] = false;
function I_(n) {
  return Co(n) && hf(n.length) && !!Et[ta(n)];
}
function D_(n) {
  return function(e) {
    return n(e);
  };
}
var x0 = typeof exports == "object" && exports && !exports.nodeType && exports;
var Fa = x0 && typeof module == "object" && module && !module.nodeType && module;
var N_ = Fa && Fa.exports === x0;
var Zu = N_ && f0.process;
var um = function() {
  try {
    var n = Fa && Fa.require && Fa.require("util").types;
    return n || Zu && Zu.binding && Zu.binding("util");
  } catch {
  }
}();
var hm = um && um.isTypedArray;
var w0 = hm ? D_(hm) : I_;
var B_ = Object.prototype;
var F_ = B_.hasOwnProperty;
function z_(n, e) {
  var t = vi(n), i = !t && df(n), r = !t && !i && id(n), s = !t && !i && !r && w0(n), o = t || i || r || s, a = o ? n_(n.length, String) : [], c = a.length;
  for (var l in n)
    F_.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.
    cf(l, c))) && a.push(l);
  return a;
}
function U_(n, e) {
  return function(t) {
    return n(e(t));
  };
}
var V_ = U_(Object.keys, Object);
var k_ = Object.prototype;
var G_ = k_.hasOwnProperty;
function H_(n) {
  if (!t_(n))
    return V_(n);
  var e = [];
  for (var t in Object(n))
    G_.call(n, t) && t != "constructor" && e.push(t);
  return e;
}
function M0(n) {
  return QM(n) ? z_(n) : H_(n);
}
var W_ = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var j_ = /^\w*$/;
function ff(n, e) {
  if (vi(n))
    return false;
  var t = typeof n;
  return t == "number" || t == "symbol" || t == "boolean" || n == null || lu(n) ? true : j_.test(n) || !W_.test(n) || e != null && n in Object(e);
}
var Za = ks(Object, "create");
function $_() {
  this.__data__ = Za ? Za(null) : {}, this.size = 0;
}
function Z_(n) {
  var e = this.has(n) && delete this.__data__[n];
  return this.size -= e ? 1 : 0, e;
}
var X_ = "__lodash_hash_undefined__";
var Y_ = Object.prototype;
var J_ = Y_.hasOwnProperty;
function K_(n) {
  var e = this.__data__;
  if (Za) {
    var t = e[n];
    return t === X_ ? void 0 : t;
  }
  return J_.call(e, n) ? e[n] : void 0;
}
var q_ = Object.prototype;
var Q_ = q_.hasOwnProperty;
function eS(n) {
  var e = this.__data__;
  return Za ? e[n] !== void 0 : Q_.call(e, n);
}
var tS = "__lodash_hash_undefined__";
function nS(n, e) {
  var t = this.__data__;
  return this.size += this.has(n) ? 0 : 1, t[n] = Za && e === void 0 ? tS : e, this;
}
function Rs(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]);
  }
}
Rs.prototype.clear = $_;
Rs.prototype.delete = Z_;
Rs.prototype.get = K_;
Rs.prototype.has = eS;
Rs.prototype.set = nS;
function iS() {
  this.__data__ = [], this.size = 0;
}
function cu(n, e) {
  for (var t = n.length; t--; )
    if (uf(n[t][0], e))
      return t;
  return -1;
}
var rS = Array.prototype;
var sS = rS.splice;
function oS(n) {
  var e = this.__data__, t = cu(e, n);
  if (t < 0)
    return false;
  var i = e.length - 1;
  return t == i ? e.pop() : sS.call(e, t, 1), --this.size, true;
}
function aS(n) {
  var e = this.__data__, t = cu(e, n);
  return t < 0 ? void 0 : e[t][1];
}
function lS(n) {
  return cu(this.__data__, n) > -1;
}
function cS(n, e) {
  var t = this.__data__, i = cu(t, n);
  return i < 0 ? (++this.size, t.push([n, e])) : t[i][1] = e, this;
}
function fr(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]);
  }
}
fr.prototype.clear = iS;
fr.prototype.delete = oS;
fr.prototype.get = aS;
fr.prototype.has = lS;
fr.prototype.set = cS;
var Xa = ks(Ui, "Map");
function uS() {
  this.size = 0, this.__data__ = {
    hash: new Rs(),
    map: new (Xa || fr)(),
    string: new Rs()
  };
}
function hS(n) {
  var e = typeof n;
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? n !== "__proto__" : n === null;
}
function uu(n, e) {
  var t = n.__data__;
  return hS(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
}
function dS(n) {
  var e = uu(this, n).delete(n);
  return this.size -= e ? 1 : 0, e;
}
function fS(n) {
  return uu(this, n).get(n);
}
function pS(n) {
  return uu(this, n).has(n);
}
function mS(n, e) {
  var t = uu(this, n), i = t.size;
  return t.set(n, e), this.size += t.size == i ? 0 : 1, this;
}
function pr(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]);
  }
}
pr.prototype.clear = uS;
pr.prototype.delete = dS;
pr.prototype.get = fS;
pr.prototype.has = pS;
pr.prototype.set = mS;
var gS = "Expected a function";
function pf(n, e) {
  if (typeof n != "function" || e != null && typeof e != "function")
    throw new TypeError(gS);
  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 (pf.Cache || pr)(), t;
}
pf.Cache = pr;
var vS = 500;
function yS(n) {
  var e = pf(n, function(i) {
    return t.size === vS && t.clear(), i;
  }), t = e.cache;
  return e;
}
var bS = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var xS = /\\(\\)?/g;
var wS = yS(function(n) {
  var e = [];
  return n.charCodeAt(0) === 46 && e.push(""), n.replace(bS, function(t, i, r, s) {
    e.push(r ? s.replace(xS, "$1") : i || t);
  }), e;
});
function MS(n) {
  return n == null ? "" : m0(n);
}
function hu(n, e) {
  return vi(n) ? n : ff(n, e) ? [n] : wS(MS(n));
}
var _S = 1 / 0;
function fl(n) {
  if (typeof n == "string" || lu(n))
    return n;
  var e = n + "";
  return e == "0" && 1 / n == -_S ? "-0" : e;
}
function mf(n, e) {
  e = hu(e, n);
  for (var t = 0, i = e.length; n != null && t < i; )
    n = n[fl(e[t++])];
  return t && t == i ? n : void 0;
}
function Qi(n, e, t) {
  var i = n == null ? void 0 : mf(n, e);
  return i === void 0 ? t : i;
}
function _0(n, e) {
  for (var t = -1, i = e.length, r = n.length; ++t < i; )
    n[r + t] = e[t];
  return n;
}
var dm = Di ? Di.isConcatSpreadable : void 0;
function SS(n) {
  return vi(n) || df(n) || !!(dm && n && n[dm]);
}
function TS(n, e, t, i, r) {
  var s = -1, o = n.length;
  for (t || (t = SS), r || (r = []); ++s < o; ) {
    var a = n[s];
    t(a) ? _0(r, a) : r[r.length] = a;
  }
  return r;
}
function ES(n) {
  var e = n == null ? 0 : n.length;
  return e ? TS(n) : [];
}
function AS(n) {
  return HM(KM(n, void 0, ES), n + "");
}
function Ai() {
  if (!arguments.length)
    return [];
  var n = arguments[0];
  return vi(n) ? n : [n];
}
function CS() {
  this.__data__ = new fr(), this.size = 0;
}
function LS(n) {
  var e = this.__data__, t = e.delete(n);
  return this.size = e.size, t;
}
function RS(n) {
  return this.__data__.get(n);
}
function PS(n) {
  return this.__data__.has(n);
}
var OS = 200;
function IS(n, e) {
  var t = this.__data__;
  if (t instanceof fr) {
    var i = t.__data__;
    if (!Xa || i.length < OS - 1)
      return i.push([n, e]), this.size = ++t.size, this;
    t = this.__data__ = new pr(i);
  }
  return t.set(n, e), this.size = t.size, this;
}
function ir(n) {
  var e = this.__data__ = new fr(n);
  this.size = e.size;
}
ir.prototype.clear = CS;
ir.prototype.delete = LS;
ir.prototype.get = RS;
ir.prototype.has = PS;
ir.prototype.set = IS;
function DS(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 NS() {
  return [];
}
var BS = Object.prototype;
var FS = BS.propertyIsEnumerable;
var fm = Object.getOwnPropertySymbols;
var zS = fm ? function(n) {
  return n == null ? [] : (n = Object(n), DS(fm(n), function(e) {
    return FS.call(n, e);
  }));
} : NS;
function US(n, e, t) {
  var i = e(n);
  return vi(n) ? i : _0(i, t(n));
}
function pm(n) {
  return US(n, M0, zS);
}
var rd = ks(Ui, "DataView");
var sd = ks(Ui, "Promise");
var od = ks(Ui, "Set");
var mm = "[object Map]";
var VS = "[object Object]";
var gm = "[object Promise]";
var vm = "[object Set]";
var ym = "[object WeakMap]";
var bm = "[object DataView]";
var kS = Vs(rd);
var GS = Vs(Xa);
var HS = Vs(sd);
var WS = Vs(od);
var jS = Vs(nd);
var Dr = ta;
(rd && Dr(new rd(new ArrayBuffer(1))) != bm || Xa && Dr(new Xa()) != mm || sd && Dr(sd.resolve()) != gm || od && Dr(new od()) != vm || nd && Dr(new nd()) != ym) && (Dr = function(n) {
  var e = ta(n), t = e == VS ? n.constructor : void 0, i = t ? Vs(t) : "";
  if (i)
    switch (i) {
      case kS:
        return bm;
      case GS:
        return mm;
      case HS:
        return gm;
      case WS:
        return vm;
      case jS:
        return ym;
    }
  return e;
});
var xm = Ui.Uint8Array;
var $S = "__lodash_hash_undefined__";
function ZS(n) {
  return this.__data__.set(n, $S), this;
}
function XS(n) {
  return this.__data__.has(n);
}
function Wc(n) {
  var e = -1, t = n == null ? 0 : n.length;
  for (this.__data__ = new pr(); ++e < t; )
    this.add(n[e]);
}
Wc.prototype.add = Wc.prototype.push = ZS;
Wc.prototype.has = XS;
function YS(n, e) {
  for (var t = -1, i = n == null ? 0 : n.length; ++t < i; )
    if (e(n[t], t, n))
      return true;
  return false;
}
function JS(n, e) {
  return n.has(e);
}
var KS = 1;
var qS = 2;
function S0(n, e, t, i, r, s) {
  var o = t & KS, a = n.length, c = e.length;
  if (a != c && !(o && c > a))
    return false;
  var l = s.get(n), d = s.get(e);
  if (l && d)
    return l == e && d == n;
  var h4 = -1, f = true, g = t & qS ? new Wc() : void 0;
  for (s.set(n, e), s.set(e, n); ++h4 < a; ) {
    var p = n[h4], u = e[h4];
    if (i)
      var y = o ? i(u, p, h4, e, n, s) : i(p, u, h4, n, e, s);
    if (y !== void 0) {
      if (y)
        continue;
      f = false;
      break;
    }
    if (g) {
      if (!YS(e, function(v, m) {
        if (!JS(g, m) && (p === v || r(p, v, t, i, s)))
          return g.push(m);
      })) {
        f = false;
        break;
      }
    } else if (!(p === u || r(p, u, t, i, s))) {
      f = false;
      break;
    }
  }
  return s.delete(n), s.delete(e), f;
}
function QS(n) {
  var e = -1, t = Array(n.size);
  return n.forEach(function(i, r) {
    t[++e] = [r, i];
  }), t;
}
function eT(n) {
  var e = -1, t = Array(n.size);
  return n.forEach(function(i) {
    t[++e] = i;
  }), t;
}
var tT = 1;
var nT = 2;
var iT = "[object Boolean]";
var rT = "[object Date]";
var sT = "[object Error]";
var oT = "[object Map]";
var aT = "[object Number]";
var lT = "[object RegExp]";
var cT = "[object Set]";
var uT = "[object String]";
var hT = "[object Symbol]";
var dT = "[object ArrayBuffer]";
var fT = "[object DataView]";
var wm = Di ? Di.prototype : void 0;
var Xu = wm ? wm.valueOf : void 0;
function pT(n, e, t, i, r, s, o) {
  switch (t) {
    case fT:
      if (n.byteLength != e.byteLength || n.byteOffset != e.byteOffset)
        return false;
      n = n.buffer, e = e.buffer;
    case dT:
      return !(n.byteLength != e.byteLength || !s(new xm(n), new xm(e)));
    case iT:
    case rT:
    case aT:
      return uf(+n, +e);
    case sT:
      return n.name == e.name && n.message == e.message;
    case lT:
    case uT:
      return n == e + "";
    case oT:
      var a = QS;
    case cT:
      var c = i & tT;
      if (a || (a = eT), n.size != e.size && !c)
        return false;
      var l = o.get(n);
      if (l)
        return l == e;
      i |= nT, o.set(n, e);
      var d = S0(a(n), a(e), i, r, s, o);
      return o.delete(n), d;
    case hT:
      if (Xu)
        return Xu.call(n) == Xu.call(e);
  }
  return false;
}
var mT = 1;
var gT = Object.prototype;
var vT = gT.hasOwnProperty;
function yT(n, e, t, i, r, s) {
  var o = t & mT, a = pm(n), c = a.length, l = pm(e), d = l.length;
  if (c != d && !o)
    return false;
  for (var h4 = c; h4--; ) {
    var f = a[h4];
    if (!(o ? f in e : vT.call(e, f)))
      return false;
  }
  var g = s.get(n), p = s.get(e);
  if (g && p)
    return g == e && p == n;
  var u = true;
  s.set(n, e), s.set(e, n);
  for (var y = o; ++h4 < c; ) {
    f = a[h4];
    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 = false;
      break;
    }
    y || (y = f == "constructor");
  }
  if (u && !y) {
    var M = n.constructor, T = e.constructor;
    M != T && "constructor" in n && "constructor" in e && !(typeof M == "function" && M instanceof M && typeof T == "function" && T instanceof T) && (u = false);
  }
  return s.delete(n), s.delete(e), u;
}
var bT = 1;
var Mm = "[object Arguments]";
var _m = "[object Array]";
var Nl = "[object Object]";
var xT = Object.prototype;
var Sm = xT.hasOwnProperty;
function wT(n, e, t, i, r, s) {
  var o = vi(n), a = vi(e), c = o ? _m : Dr(n), l = a ? _m : Dr(e);
  c = c == Mm ? Nl : c, l = l == Mm ? Nl : l;
  var d = c == Nl, h4 = l == Nl, f = c == l;
  if (f && id(n)) {
    if (!id(e))
      return false;
    o = true, d = false;
  }
  if (f && !d)
    return s || (s = new ir()), o || w0(n) ? S0(n, e, t, i, r, s) : pT(n, e, c, t, i, r, s);
  if (!(t & bT)) {
    var g = d && Sm.call(n, "__wrapped__"), p = h4 && Sm.call(e, "__wrapped__");
    if (g || p) {
      var u = g ? n.value() : n, y = p ? e.value() : e;
      return s || (s = new ir()), r(u, y, t, i, s);
    }
  }
  return f ? (s || (s = new ir()), yT(n, e, t, i, r, s)) : false;
}
function du(n, e, t, i, r) {
  return n === e ? true : n == null || e == null || !Co(n) && !Co(e) ? n !== n && e !== e : wT(n, e, t, i, du, r);
}
var MT = 1;
var _T = 2;
function ST(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 false;
  }
  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 false;
    } else {
      var d = new ir(), h4;
      if (!(h4 === void 0 ? du(l, c, MT | _T, i, d) : h4))
        return false;
    }
  }
  return true;
}
function T0(n) {
  return n === n && !Hr(n);
}
function TT(n) {
  for (var e = M0(n), t = e.length; t--; ) {
    var i = e[t], r = n[i];
    e[t] = [i, r, T0(r)];
  }
  return e;
}
function E0(n, e) {
  return function(t) {
    return t == null ? false : t[n] === e && (e !== void 0 || n in Object(t));
  };
}
function ET(n) {
  var e = TT(n);
  return e.length == 1 && e[0][2] ? E0(e[0][0], e[0][1]) : function(t) {
    return t === n || ST(t, n, e);
  };
}
function AT(n, e) {
  return n != null && e in Object(n);
}
function CT(n, e, t) {
  e = hu(e, n);
  for (var i = -1, r = e.length, s = false; ++i < r; ) {
    var o = fl(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 && hf(r) && cf(o, r) && (vi(n) || df(n)));
}
function A0(n, e) {
  return n != null && CT(n, e, AT);
}
var LT = 1;
var RT = 2;
function PT(n, e) {
  return ff(n) && T0(e) ? E0(fl(n), e) : function(t) {
    var i = Qi(t, n);
    return i === void 0 && i === e ? A0(t, n) : du(e, i, LT | RT);
  };
}
function OT(n) {
  return function(e) {
    return e == null ? void 0 : e[n];
  };
}
function IT(n) {
  return function(e) {
    return mf(e, n);
  };
}
function DT(n) {
  return ff(n) ? OT(fl(n)) : IT(n);
}
function NT(n) {
  return typeof n == "function" ? n : n == null ? g0 : typeof n == "object" ? vi(n) ? PT(n[0], n[1]) : ET(n) : DT(n);
}
var Yu = function() {
  return Ui.Date.now();
};
var BT = "Expected a function";
var FT = Math.max;
var zT = Math.min;
function ad(n, e, t) {
  var i, r, s, o, a, c, l = 0, d = false, h4 = false, f = true;
  if (typeof n != "function")
    throw new TypeError(BT);
  e = rm(e) || 0, Hr(t) && (d = !!t.leading, h4 = "maxWait" in t, s = h4 ? FT(rm(t.maxWait) || 0, e) : s, f = "trailing" in t ? !!t.trailing : f);
  function g(w) {
    var _ = i, E = r;
    return i = r = void 0, l = w, o = n.apply(E, _), o;
  }
  function p(w) {
    return l = w, a = setTimeout(v, e), d ? g(w) : o;
  }
  function u(w) {
    var _ = w - c, E = w - l, P = e - _;
    return h4 ? zT(P, s - E) : P;
  }
  function y(w) {
    var _ = w - c, E = w - l;
    return c === void 0 || _ >= e || _ < 0 || h4 && E >= s;
  }
  function v() {
    var w = Yu();
    if (y(w))
      return m(w);
    a = setTimeout(v, u(w));
  }
  function m(w) {
    return a = void 0, f && i ? g(w) : (i = r = void 0, o);
  }
  function x() {
    a !== void 0 && clearTimeout(a), l = 0, i = c = r = a = void 0;
  }
  function M() {
    return a === void 0 ? o : m(Yu());
  }
  function T() {
    var w = Yu(), _ = y(w);
    if (i = arguments, r = this, c = w, _) {
      if (a === void 0)
        return p(c);
      if (h4)
        return clearTimeout(a), a = setTimeout(v, e), g(c);
    }
    return a === void 0 && (a = setTimeout(v, e)), o;
  }
  return T.cancel = x, T.flush = M, T;
}
function UT(n, e, t) {
  var i = n == null ? 0 : n.length;
  if (!i)
    return -1;
  var r = i - 1;
  return WM(n, NT(e), r);
}
function jc(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 ld(n, e) {
  return du(n, e);
}
function rr(n) {
  return n == null;
}
function VT(n) {
  return n === void 0;
}
function kT(n, e, t, i) {
  if (!Hr(n))
    return n;
  e = hu(e, n);
  for (var r = -1, s = e.length, o = s - 1, a = n; a != null && ++r < s; ) {
    var c = fl(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 = Hr(d) ? d : cf(e[r + 1]) ? [] : {});
    }
    JM(a, c, l), a = a[c];
  }
  return n;
}
function GT(n, e, t) {
  for (var i = -1, r = e.length, s = {}; ++i < r; ) {
    var o = e[i], a = mf(n, o);
    t(a, o) && kT(s, hu(o, n), a);
  }
  return s;
}
function HT(n, e) {
  return GT(n, e, function(t, i) {
    return A0(n, i);
  });
}
var WT = AS(function(n, e) {
  return n == null ? {} : HT(n, e);
});
var mi = (n) => n === void 0;
var gf = (n) => typeof n == "boolean";
var bt = (n) => typeof n == "number";
var Ms = (n) => typeof Element > "u" ? false : n instanceof Element;
var jT = (n) => Ln(n) ? !Number.isNaN(Number(n)) : false;
var $T = (n = "") => n.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
var Br = (n) => Q1(n);
var Tm = (n) => Object.keys(n);
var C0 = class extends Error {
  constructor(e) {
    super(e), this.name = "ElementPlusError";
  }
};
function na(n, e) {
  throw new C0(`[${n}] ${e}`);
}
function Xt(n, e) {
  if (true) {
    const t = Ln(n) ? new C0(`[${n}] ${e}`) : n;
    console.warn(t);
  }
}
var ZT = "utils/dom/style";
var L0 = (n = "") => n.split(" ").filter((e) => !!e.trim());
var Em = (n, e) => {
  !n || !e.trim() || n.classList.add(...L0(e));
};
var $c = (n, e) => {
  !n || !e.trim() || n.classList.remove(...L0(e));
};
var va = (n, e) => {
  var t;
  if (!Qt || !n || !e)
    return "";
  let i = J1(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 Zc(n, e = "px") {
  if (!n)
    return "";
  if (bt(n) || jT(n))
    return `${n}${e}`;
  if (Ln(n))
    return n;
  Xt(ZT, "binding value must be a string or number");
}
function XT(n, e) {
  if (!Qt)
    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);
}
var YT = defineComponent({
  name: "ArrowDown",
  __name: "arrow-down",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var vf = YT;
var JT = defineComponent({
  name: "ArrowLeft",
  __name: "arrow-left",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var Wr = JT;
var KT = defineComponent({
  name: "ArrowRight",
  __name: "arrow-right",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var jr = KT;
var qT = defineComponent({
  name: "ArrowUp",
  __name: "arrow-up",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var QT = qT;
var eE = defineComponent({
  name: "CircleCheck",
  __name: "circle-check",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      }),
      createBaseVNode("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"
      })
    ]));
  }
});
var tE = eE;
var nE = defineComponent({
  name: "CircleClose",
  __name: "circle-close",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      }),
      createBaseVNode("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"
      })
    ]));
  }
});
var yf = nE;
var iE = defineComponent({
  name: "Close",
  __name: "close",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var cd = iE;
var rE = defineComponent({
  name: "Delete",
  __name: "delete",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var Xc = rE;
var sE = defineComponent({
  name: "Hide",
  __name: "hide",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      }),
      createBaseVNode("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"
      })
    ]));
  }
});
var oE = sE;
var aE = defineComponent({
  name: "Loading",
  __name: "loading",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var R0 = aE;
var lE = defineComponent({
  name: "Minus",
  __name: "minus",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("path", {
        fill: "currentColor",
        d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
      })
    ]));
  }
});
var cE = lE;
var uE = defineComponent({
  name: "Plus",
  __name: "plus",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var fu = uE;
var hE = defineComponent({
  name: "View",
  __name: "view",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var dE = hE;
var fE = defineComponent({
  name: "WarningFilled",
  __name: "warning-filled",
  setup(n) {
    return (e, t) => (openBlock(), createElementBlock("svg", {
      xmlns: "http://www.w3.org/2000/svg",
      viewBox: "0 0 1024 1024"
    }, [
      createBaseVNode("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"
      })
    ]));
  }
});
var P0 = fE;
var O0 = "__epPropKey";
var Je = (n) => n;
var pE = (n) => An(n) && !!n[O0];
var pu = (n, e) => {
  if (!An(n) || pE(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 = false, h4 = [];
      if (t && (h4 = Array.from(t), Qp(n, "default") && h4.push(r), d || (d = h4.includes(l))), o && (d || (d = o(l))), !d && h4.length > 0) {
        const f = [...new Set(h4)].map((g) => JSON.stringify(g)).join(", ");
        warn(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${f}], got value ${JSON.stringify(l)}.`);
      }
      return d;
    } : void 0,
    [O0]: true
  };
  return Qp(n, "default") && (c.default = r), c;
};
var ft = (n) => jc(Object.entries(n).map(([e, t]) => [
  e,
  pu(t, e)
]));
var $r = Je([
  String,
  Object,
  Function
]);
var I0 = {
  validating: R0,
  success: tE,
  error: yf
};
var fn = (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;
};
var mE = (n, e) => (n.install = (t) => {
  t.directive(e, n);
}, n);
var mr = (n) => (n.install = $a, n);
var Pi = {
  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"
};
var Lt = "update:modelValue";
var qr = "change";
var _s = "input";
var D0 = ["", "default", "small", "large"];
var Bc = (n) => {
  const e = Nn(n) ? n : [n], t = [];
  return e.forEach((i) => {
    var r;
    Nn(i) ? t.push(...Bc(i)) : isVNode(i) && Nn(i.children) ? t.push(...Bc(i.children)) : (t.push(i), isVNode(i) && ((r = i.component) != null && r.subTree) && t.push(...Bc(i.component.subTree)));
  }), t;
};
var gE = (n) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(n);
var er = (n) => n;
var vE = ["class", "style"];
var yE = /^on[A-Z]/;
var bE = (n = {}) => {
  const { excludeListeners: e = false, excludeKeys: t } = n, i = computed(() => ((t == null ? void 0 : t.value) || []).concat(vE)), r = getCurrentInstance();
  return r ? computed(() => {
    var s;
    return jc(Object.entries((s = r.proxy) == null ? void 0 : s.$attrs).filter(([o]) => !i.value.includes(o) && !(e && yE.test(o))));
  }) : (Xt("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), computed(() => ({})));
};
var xE = ({ from: n, replacement: e, scope: t, version: i, ref: r, type: s = "API" }, o) => {
  watch(() => unref(o), (a) => {
    a && Xt(t, `[${s}] ${n} is about to be deprecated in version ${i}, please use ${e} instead.
For more detail, please visit: ${r}
`);
  }, {
    immediate: true
  });
};
var wE = {
  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}"
    }
  }
};
var ME = (n) => (e, t) => _E(e, t, unref(n));
var _E = (n, e, t) => Qi(t, n, n).replace(/\{(\w+)\}/g, (i, r) => {
  var s;
  return `${(s = e == null ? void 0 : e[r]) != null ? s : `{${r}}`}`;
});
var SE = (n) => {
  const e = computed(() => unref(n).name), t = isRef(n) ? n : ref(n);
  return {
    lang: e,
    locale: t,
    t: ME(n)
  };
};
var N0 = Symbol("localeContextKey");
var mu = (n) => {
  const e = n || inject(N0, ref());
  return SE(computed(() => e.value || wE));
};
var Fc = "el";
var TE = "is-";
var ls = (n, e, t, i, r) => {
  let s = `${n}-${e}`;
  return t && (s += `-${t}`), i && (s += `__${i}`), r && (s += `--${r}`), s;
};
var B0 = Symbol("namespaceContextKey");
var bf = (n) => {
  const e = n || (getCurrentInstance() ? inject(B0, ref(Fc)) : ref(Fc));
  return computed(() => unref(e) || Fc);
};
var st = (n, e) => {
  const t = bf(e);
  return {
    namespace: t,
    b: (u = "") => ls(t.value, n, u, "", ""),
    e: (u) => u ? ls(t.value, n, "", u, "") : "",
    m: (u) => u ? ls(t.value, n, "", "", u) : "",
    be: (u, y) => u && y ? ls(t.value, n, u, y, "") : "",
    em: (u, y) => u && y ? ls(t.value, n, "", u, y) : "",
    bm: (u, y) => u && y ? ls(t.value, n, u, "", y) : "",
    bem: (u, y, v) => u && y && v ? ls(t.value, n, u, y, v) : "",
    is: (u, ...y) => {
      const v = y.length >= 1 ? y[0] : true;
      return u && v ? `${TE}${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}`
  };
};
var EE = pu({
  type: Je(Boolean),
  default: null
});
var AE = pu({
  type: Je(Function)
});
var CE = (n) => {
  const e = `update:${n}`, t = `onUpdate:${n}`, i = [e], r = {
    [n]: EE,
    [t]: AE
  };
  return {
    useModelToggle: ({
      indicator: o,
      toggleReason: a,
      shouldHideWhenRouteChanges: c,
      shouldProceed: l,
      onShow: d,
      onHide: h4
    }) => {
      const f = getCurrentInstance(), { emit: g } = f, p = f.props, u = computed(() => Tn(p[t])), y = computed(() => p[n] === null), v = (_) => {
        o.value !== true && (o.value = true, a && (a.value = _), Tn(d) && d(_));
      }, m = (_) => {
        o.value !== false && (o.value = false, a && (a.value = _), Tn(h4) && h4(_));
      }, x = (_) => {
        if (p.disabled === true || Tn(l) && !l())
          return;
        const E = u.value && Qt;
        E && g(e, true), (y.value || !E) && v(_);
      }, M = (_) => {
        if (p.disabled === true || !Qt)
          return;
        const E = u.value && Qt;
        E && g(e, false), (y.value || !E) && m(_);
      }, T = (_) => {
        gf(_) && (p.disabled && _ ? u.value && g(e, false) : o.value !== _ && (_ ? v() : m()));
      }, w = () => {
        o.value ? M() : x();
      };
      return watch(() => p[n], T), c && f.appContext.config.globalProperties.$route !== void 0 && watch(() => ({
        ...f.proxy.$route
      }), () => {
        c.value && o.value && M();
      }), onMounted(() => {
        T(p[n]);
      }), {
        hide: M,
        show: x,
        toggle: w,
        hasUpdateHandler: u
      };
    },
    useModelToggleProps: r,
    useModelToggleEmits: i
  };
};
var F0 = (n) => {
  const e = getCurrentInstance();
  return computed(() => {
    var t, i;
    return (i = (t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$props) == null ? void 0 : i[n];
  });
};
var Fn = "top";
var ni = "bottom";
var ii = "right";
var zn = "left";
var xf = "auto";
var pl = [Fn, ni, ii, zn];
var Lo = "start";
var Ya = "end";
var LE = "clippingParents";
var z0 = "viewport";
var ya = "popper";
var RE = "reference";
var Am = pl.reduce(function(n, e) {
  return n.concat([e + "-" + Lo, e + "-" + Ya]);
}, []);
var ia = [].concat(pl, [xf]).reduce(function(n, e) {
  return n.concat([e, e + "-" + Lo, e + "-" + Ya]);
}, []);
var PE = "beforeRead";
var OE = "read";
var IE = "afterRead";
var DE = "beforeMain";
var NE = "main";
var BE = "afterMain";
var FE = "beforeWrite";
var zE = "write";
var UE = "afterWrite";
var VE = [PE, OE, IE, DE, NE, BE, FE, zE, UE];
function Ni(n) {
  return n ? (n.nodeName || "").toLowerCase() : null;
}
function xi(n) {
  if (n == null) return window;
  if (n.toString() !== "[object Window]") {
    var e = n.ownerDocument;
    return e && e.defaultView || window;
  }
  return n;
}
function Ro(n) {
  var e = xi(n).Element;
  return n instanceof e || n instanceof Element;
}
function ti(n) {
  var e = xi(n).HTMLElement;
  return n instanceof e || n instanceof HTMLElement;
}
function wf(n) {
  if (typeof ShadowRoot > "u") return false;
  var e = xi(n).ShadowRoot;
  return n instanceof e || n instanceof ShadowRoot;
}
function kE(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];
    !ti(s) || !Ni(s) || (Object.assign(s.style, i), Object.keys(r).forEach(function(o) {
      var a = r[o];
      a === false ? s.removeAttribute(o) : s.setAttribute(o, a === true ? "" : a);
    }));
  });
}
function GE(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;
      }, {});
      !ti(r) || !Ni(r) || (Object.assign(r.style, a), Object.keys(s).forEach(function(c) {
        r.removeAttribute(c);
      }));
    });
  };
}
var U0 = { name: "applyStyles", enabled: true, phase: "write", fn: kE, effect: GE, requires: ["computeStyles"] };
function Oi(n) {
  return n.split("-")[0];
}
var Ss = Math.max;
var Yc = Math.min;
var Po = Math.round;
function Oo(n, e) {
  e === void 0 && (e = false);
  var t = n.getBoundingClientRect(), i = 1, r = 1;
  if (ti(n) && e) {
    var s = n.offsetHeight, o = n.offsetWidth;
    o > 0 && (i = Po(t.width) / o || 1), s > 0 && (r = Po(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 Mf(n) {
  var e = Oo(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 V0(n, e) {
  var t = e.getRootNode && e.getRootNode();
  if (n.contains(e)) return true;
  if (t && wf(t)) {
    var i = e;
    do {
      if (i && n.isSameNode(i)) return true;
      i = i.parentNode || i.host;
    } while (i);
  }
  return false;
}
function cr(n) {
  return xi(n).getComputedStyle(n);
}
function HE(n) {
  return ["table", "td", "th"].indexOf(Ni(n)) >= 0;
}
function Qr(n) {
  return ((Ro(n) ? n.ownerDocument : n.document) || window.document).documentElement;
}
function gu(n) {
  return Ni(n) === "html" ? n : n.assignedSlot || n.parentNode || (wf(n) ? n.host : null) || Qr(n);
}
function Cm(n) {
  return !ti(n) || cr(n).position === "fixed" ? null : n.offsetParent;
}
function WE(n) {
  var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1;
  if (t && ti(n)) {
    var i = cr(n);
    if (i.position === "fixed") return null;
  }
  var r = gu(n);
  for (wf(r) && (r = r.host); ti(r) && ["html", "body"].indexOf(Ni(r)) < 0; ) {
    var s = cr(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 ml(n) {
  for (var e = xi(n), t = Cm(n); t && HE(t) && cr(t).position === "static"; ) t = Cm(t);
  return t && (Ni(t) === "html" || Ni(t) === "body" && cr(t).position === "static") ? e : t || WE(n) || e;
}
function _f(n) {
  return ["top", "bottom"].indexOf(n) >= 0 ? "x" : "y";
}
function za(n, e, t) {
  return Ss(n, Yc(e, t));
}
function jE(n, e, t) {
  var i = za(n, e, t);
  return i > t ? t : i;
}
function k0() {
  return { top: 0, right: 0, bottom: 0, left: 0 };
}
function G0(n) {
  return Object.assign({}, k0(), n);
}
function H0(n, e) {
  return e.reduce(function(t, i) {
    return t[i] = n, t;
  }, {});
}
var $E = function(n, e) {
  return n = typeof n == "function" ? n(Object.assign({}, e.rects, { placement: e.placement })) : n, G0(typeof n != "number" ? n : H0(n, pl));
};
function ZE(n) {
  var e, t = n.state, i = n.name, r = n.options, s = t.elements.arrow, o = t.modifiersData.popperOffsets, a = Oi(t.placement), c = _f(a), l = [zn, ii].indexOf(a) >= 0, d = l ? "height" : "width";
  if (!(!s || !o)) {
    var h4 = $E(r.padding, t), f = Mf(s), g = c === "y" ? Fn : zn, p = c === "y" ? ni : ii, u = t.rects.reference[d] + t.rects.reference[c] - o[c] - t.rects.popper[d], y = o[c] - t.rects.reference[c], v = ml(s), m = v ? c === "y" ? v.clientHeight || 0 : v.clientWidth || 0 : 0, x = u / 2 - y / 2, M = h4[g], T = m - f[d] - h4[p], w = m / 2 - f[d] / 2 + x, _ = za(M, w, T), E = c;
    t.modifiersData[i] = (e = {}, e[E] = _, e.centerOffset = _ - w, e);
  }
}
function XE(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) || !V0(e.elements.popper, r) || (e.elements.arrow = r));
}
var YE = { name: "arrow", enabled: true, phase: "main", fn: ZE, effect: XE, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
function Io(n) {
  return n.split("-")[1];
}
var JE = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
function KE(n) {
  var e = n.x, t = n.y, i = window, r = i.devicePixelRatio || 1;
  return { x: Po(e * r) / r || 0, y: Po(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, h4 = 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 = zn, M = Fn, T = window;
  if (l) {
    var w = ml(t), _ = "clientHeight", E = "clientWidth";
    if (w === xi(t) && (w = Qr(t), cr(w).position !== "static" && a === "absolute" && (_ = "scrollHeight", E = "scrollWidth")), w = w, r === Fn || (r === zn || r === ii) && s === Ya) {
      M = ni;
      var P = h4 && w === T && T.visualViewport ? T.visualViewport.height : w[_];
      u -= P - i.height, u *= c ? 1 : -1;
    }
    if (r === zn || (r === Fn || r === ni) && s === Ya) {
      x = ii;
      var S = h4 && w === T && T.visualViewport ? T.visualViewport.width : w[E];
      g -= S - i.width, g *= c ? 1 : -1;
    }
  }
  var R = Object.assign({ position: a }, l && JE), A = d === true ? KE({ x: g, y: u }) : { x: g, y: u };
  if (g = A.x, u = A.y, c) {
    var C;
    return Object.assign({}, R, (C = {}, C[M] = m ? "0" : "", C[x] = v ? "0" : "", C.transform = (T.devicePixelRatio || 1) <= 1 ? "translate(" + g + "px, " + u + "px)" : "translate3d(" + g + "px, " + u + "px, 0)", C));
  }
  return Object.assign({}, R, (e = {}, e[M] = m ? u + "px" : "", e[x] = v ? g + "px" : "", e.transform = "", e));
}
function qE(n) {
  var e = n.state, t = n.options, i = t.gpuAcceleration, r = i === void 0 ? true : i, s = t.adaptive, o = s === void 0 ? true : s, a = t.roundOffsets, c = a === void 0 ? true : a, l = { placement: Oi(e.placement), variation: Io(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: false, roundOffsets: c })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
}
var W0 = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: qE, data: {} };
var Bl = { passive: true };
function QE(n) {
  var e = n.state, t = n.instance, i = n.options, r = i.scroll, s = r === void 0 ? true : r, o = i.resize, a = o === void 0 ? true : o, c = xi(e.elements.popper), l = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  return s && l.forEach(function(d) {
    d.addEventListener("scroll", t.update, Bl);
  }), a && c.addEventListener("resize", t.update, Bl), function() {
    s && l.forEach(function(d) {
      d.removeEventListener("scroll", t.update, Bl);
    }), a && c.removeEventListener("resize", t.update, Bl);
  };
}
var j0 = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
}, effect: QE, data: {} };
var eA = { left: "right", right: "left", bottom: "top", top: "bottom" };
function zc(n) {
  return n.replace(/left|right|bottom|top/g, function(e) {
    return eA[e];
  });
}
var tA = { start: "end", end: "start" };
function Rm(n) {
  return n.replace(/start|end/g, function(e) {
    return tA[e];
  });
}
function Sf(n) {
  var e = xi(n), t = e.pageXOffset, i = e.pageYOffset;
  return { scrollLeft: t, scrollTop: i };
}
function Tf(n) {
  return Oo(Qr(n)).left + Sf(n).scrollLeft;
}
function nA(n) {
  var e = xi(n), t = Qr(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 + Tf(n), y: a };
}
function iA(n) {
  var e, t = Qr(n), i = Sf(n), r = (e = n.ownerDocument) == null ? void 0 : e.body, s = Ss(t.scrollWidth, t.clientWidth, r ? r.scrollWidth : 0, r ? r.clientWidth : 0), o = Ss(t.scrollHeight, t.clientHeight, r ? r.scrollHeight : 0, r ? r.clientHeight : 0), a = -i.scrollLeft + Tf(n), c = -i.scrollTop;
  return cr(r || t).direction === "rtl" && (a += Ss(t.clientWidth, r ? r.clientWidth : 0) - s), { width: s, height: o, x: a, y: c };
}
function Ef(n) {
  var e = cr(n), t = e.overflow, i = e.overflowX, r = e.overflowY;
  return /auto|scroll|overlay|hidden/.test(t + r + i);
}
function $0(n) {
  return ["html", "body", "#document"].indexOf(Ni(n)) >= 0 ? n.ownerDocument.body : ti(n) && Ef(n) ? n : $0(gu(n));
}
function Ua(n, e) {
  var t;
  e === void 0 && (e = []);
  var i = $0(n), r = i === ((t = n.ownerDocument) == null ? void 0 : t.body), s = xi(i), o = r ? [s].concat(s.visualViewport || [], Ef(i) ? i : []) : i, a = e.concat(o);
  return r ? a : a.concat(Ua(gu(o)));
}
function ud(n) {
  return Object.assign({}, n, { left: n.x, top: n.y, right: n.x + n.width, bottom: n.y + n.height });
}
function rA(n) {
  var e = Oo(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 Pm(n, e) {
  return e === z0 ? ud(nA(n)) : Ro(e) ? rA(e) : ud(iA(Qr(n)));
}
function sA(n) {
  var e = Ua(gu(n)), t = ["absolute", "fixed"].indexOf(cr(n).position) >= 0, i = t && ti(n) ? ml(n) : n;
  return Ro(i) ? e.filter(function(r) {
    return Ro(r) && V0(r, i) && Ni(r) !== "body";
  }) : [];
}
function oA(n, e, t) {
  var i = e === "clippingParents" ? sA(n) : [].concat(e), r = [].concat(i, [t]), s = r[0], o = r.reduce(function(a, c) {
    var l = Pm(n, c);
    return a.top = Ss(l.top, a.top), a.right = Yc(l.right, a.right), a.bottom = Yc(l.bottom, a.bottom), a.left = Ss(l.left, a.left), a;
  }, Pm(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 Z0(n) {
  var e = n.reference, t = n.element, i = n.placement, r = i ? Oi(i) : null, s = i ? Io(i) : null, o = e.x + e.width / 2 - t.width / 2, a = e.y + e.height / 2 - t.height / 2, c;
  switch (r) {
    case Fn:
      c = { x: o, y: e.y - t.height };
      break;
    case ni:
      c = { x: o, y: e.y + e.height };
      break;
    case ii:
      c = { x: e.x + e.width, y: a };
      break;
    case zn:
      c = { x: e.x - t.width, y: a };
      break;
    default:
      c = { x: e.x, y: e.y };
  }
  var l = r ? _f(r) : null;
  if (l != null) {
    var d = l === "y" ? "height" : "width";
    switch (s) {
      case Lo:
        c[l] = c[l] - (e[d] / 2 - t[d] / 2);
        break;
      case Ya:
        c[l] = c[l] + (e[d] / 2 - t[d] / 2);
        break;
    }
  }
  return c;
}
function Ja(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 ? LE : s, a = t.rootBoundary, c = a === void 0 ? z0 : a, l = t.elementContext, d = l === void 0 ? ya : l, h4 = t.altBoundary, f = h4 === void 0 ? false : h4, g = t.padding, p = g === void 0 ? 0 : g, u = G0(typeof p != "number" ? p : H0(p, pl)), y = d === ya ? RE : ya, v = n.rects.popper, m = n.elements[f ? y : d], x = oA(Ro(m) ? m : m.contextElement || Qr(n.elements.popper), o, c), M = Oo(n.elements.reference), T = Z0({ reference: M, element: v, strategy: "absolute", placement: r }), w = ud(Object.assign({}, v, T)), _ = d === ya ? w : M, E = { top: x.top - _.top + u.top, bottom: _.bottom - x.bottom + u.bottom, left: x.left - _.left + u.left, right: _.right - x.right + u.right }, P = n.modifiersData.offset;
  if (d === ya && P) {
    var S = P[r];
    Object.keys(E).forEach(function(R) {
      var A = [ii, ni].indexOf(R) >= 0 ? 1 : -1, C = [Fn, ni].indexOf(R) >= 0 ? "y" : "x";
      E[R] += S[C] * A;
    });
  }
  return E;
}
function aA(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 ? ia : c, d = Io(i), h4 = d ? a ? Am : Am.filter(function(p) {
    return Io(p) === d;
  }) : pl, f = h4.filter(function(p) {
    return l.indexOf(p) >= 0;
  });
  f.length === 0 && (f = h4);
  var g = f.reduce(function(p, u) {
    return p[u] = Ja(n, { placement: u, boundary: r, rootBoundary: s, padding: o })[Oi(u)], p;
  }, {});
  return Object.keys(g).sort(function(p, u) {
    return g[p] - g[u];
  });
}
function lA(n) {
  if (Oi(n) === xf) return [];
  var e = zc(n);
  return [Rm(n), e, Rm(e)];
}
function cA(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 ? true : r, o = t.altAxis, a = o === void 0 ? true : o, c = t.fallbackPlacements, l = t.padding, d = t.boundary, h4 = t.rootBoundary, f = t.altBoundary, g = t.flipVariations, p = g === void 0 ? true : g, u = t.allowedAutoPlacements, y = e.options.placement, v = Oi(y), m = v === y, x = c || (m || !p ? [zc(y)] : lA(y)), M = [y].concat(x).reduce(function(re, ae) {
      return re.concat(Oi(ae) === xf ? aA(e, { placement: ae, boundary: d, rootBoundary: h4, padding: l, flipVariations: p, allowedAutoPlacements: u }) : ae);
    }, []), T = e.rects.reference, w = e.rects.popper, _ = /* @__PURE__ */ new Map(), E = true, P = M[0], S = 0; S < M.length; S++) {
      var R = M[S], A = Oi(R), C = Io(R) === Lo, L = [Fn, ni].indexOf(A) >= 0, I = L ? "width" : "height", b = Ja(e, { placement: R, boundary: d, rootBoundary: h4, altBoundary: f, padding: l }), O = L ? C ? ii : zn : C ? ni : Fn;
      T[I] > w[I] && (O = zc(O));
      var N = zc(O), D = [];
      if (s && D.push(b[A] <= 0), a && D.push(b[O] <= 0, b[N] <= 0), D.every(function(re) {
        return re;
      })) {
        P = R, E = false;
        break;
      }
      _.set(R, D);
    }
    if (E) for (var U = p ? 3 : 1, V = function(re) {
      var ae = M.find(function(ee) {
        var oe = _.get(ee);
        if (oe) return oe.slice(0, re).every(function(j) {
          return j;
        });
      });
      if (ae) return P = ae, "break";
    }, H = U; H > 0; H--) {
      var Y = V(H);
      if (Y === "break") break;
    }
    e.placement !== P && (e.modifiersData[i]._skip = true, e.placement = P, e.reset = true);
  }
}
var uA = { name: "flip", enabled: true, phase: "main", fn: cA, requiresIfExists: ["offset"], data: { _skip: false } };
function Om(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 Im(n) {
  return [Fn, ii, ni, zn].some(function(e) {
    return n[e] >= 0;
  });
}
function hA(n) {
  var e = n.state, t = n.name, i = e.rects.reference, r = e.rects.popper, s = e.modifiersData.preventOverflow, o = Ja(e, { elementContext: "reference" }), a = Ja(e, { altBoundary: true }), c = Om(o, i), l = Om(a, r, s), d = Im(c), h4 = Im(l);
  e.modifiersData[t] = { referenceClippingOffsets: c, popperEscapeOffsets: l, isReferenceHidden: d, hasPopperEscaped: h4 }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": d, "data-popper-escaped": h4 });
}
var dA = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: hA };
function fA(n, e, t) {
  var i = Oi(n), r = [zn, Fn].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, [zn, ii].indexOf(i) >= 0 ? { x: a, y: o } : { x: o, y: a };
}
function pA(n) {
  var e = n.state, t = n.options, i = n.name, r = t.offset, s = r === void 0 ? [0, 0] : r, o = ia.reduce(function(d, h4) {
    return d[h4] = fA(h4, 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 mA = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: pA };
function gA(n) {
  var e = n.state, t = n.name;
  e.modifiersData[t] = Z0({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
}
var X0 = { name: "popperOffsets", enabled: true, phase: "read", fn: gA, data: {} };
function vA(n) {
  return n === "x" ? "y" : "x";
}
function yA2(n) {
  var e = n.state, t = n.options, i = n.name, r = t.mainAxis, s = r === void 0 ? true : r, o = t.altAxis, a = o === void 0 ? false : o, c = t.boundary, l = t.rootBoundary, d = t.altBoundary, h4 = t.padding, f = t.tether, g = f === void 0 ? true : f, p = t.tetherOffset, u = p === void 0 ? 0 : p, y = Ja(e, { boundary: c, rootBoundary: l, padding: h4, altBoundary: d }), v = Oi(e.placement), m = Io(e.placement), x = !m, M = _f(v), T = vA(M), w = e.modifiersData.popperOffsets, _ = e.rects.reference, E = e.rects.popper, P = typeof u == "function" ? u(Object.assign({}, e.rects, { placement: e.placement })) : u, S = typeof P == "number" ? { mainAxis: P, altAxis: P } : Object.assign({ mainAxis: 0, altAxis: 0 }, P), R = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, A = { x: 0, y: 0 };
  if (w) {
    if (s) {
      var C, L = M === "y" ? Fn : zn, I = M === "y" ? ni : ii, b = M === "y" ? "height" : "width", O = w[M], N = O + y[L], D = O - y[I], U = g ? -E[b] / 2 : 0, V = m === Lo ? _[b] : E[b], H = m === Lo ? -E[b] : -_[b], Y = e.elements.arrow, re = g && Y ? Mf(Y) : { width: 0, height: 0 }, ae = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : k0(), ee = ae[L], oe = ae[I], j = za(0, _[b], re[b]), K = x ? _[b] / 2 - U - j - ee - S.mainAxis : V - j - ee - S.mainAxis, $ = x ? -_[b] / 2 + U + j + oe + S.mainAxis : H + j + oe + S.mainAxis, ne = e.elements.arrow && ml(e.elements.arrow), k = ne ? M === "y" ? ne.clientTop || 0 : ne.clientLeft || 0 : 0, W = (C = R == null ? void 0 : R[M]) != null ? C : 0, B = O + K - W - k, X = O + $ - W, J = za(g ? Yc(N, B) : N, O, g ? Ss(D, X) : D);
      w[M] = J, A[M] = J - O;
    }
    if (a) {
      var F, z = M === "x" ? Fn : zn, te = M === "x" ? ni : ii, se = w[T], le = T === "y" ? "height" : "width", me = se + y[z], Te = se - y[te], _e = [Fn, zn].indexOf(v) !== -1, fe = (F = R == null ? void 0 : R[T]) != null ? F : 0, we = _e ? me : se - _[le] - E[le] - fe + S.altAxis, ie = _e ? se + _[le] + E[le] - fe - S.altAxis : Te, pe = g && _e ? jE(we, se, ie) : za(g ? we : me, se, g ? ie : Te);
      w[T] = pe, A[T] = pe - se;
    }
    e.modifiersData[i] = A;
  }
}
var bA = { name: "preventOverflow", enabled: true, phase: "main", fn: yA2, requiresIfExists: ["offset"] };
function xA(n) {
  return { scrollLeft: n.scrollLeft, scrollTop: n.scrollTop };
}
function wA(n) {
  return n === xi(n) || !ti(n) ? Sf(n) : xA(n);
}
function MA(n) {
  var e = n.getBoundingClientRect(), t = Po(e.width) / n.offsetWidth || 1, i = Po(e.height) / n.offsetHeight || 1;
  return t !== 1 || i !== 1;
}
function _A(n, e, t) {
  t === void 0 && (t = false);
  var i = ti(e), r = ti(e) && MA(e), s = Qr(e), o = Oo(n, r), a = { scrollLeft: 0, scrollTop: 0 }, c = { x: 0, y: 0 };
  return (i || !i && !t) && ((Ni(e) !== "body" || Ef(s)) && (a = wA(e)), ti(e) ? (c = Oo(e, true), c.x += e.clientLeft, c.y += e.clientTop) : s && (c.x = Tf(s))), { x: o.left + a.scrollLeft - c.x, y: o.top + a.scrollTop - c.y, width: o.width, height: o.height };
}
function SA(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 TA(n) {
  var e = SA(n);
  return VE.reduce(function(t, i) {
    return t.concat(e.filter(function(r) {
      return r.phase === i;
    }));
  }, []);
}
function EA2(n) {
  var e;
  return function() {
    return e || (e = new Promise(function(t) {
      Promise.resolve().then(function() {
        e = void 0, t(n());
      });
    })), e;
  };
}
function AA(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 Dm = { placement: "bottom", modifiers: [], strategy: "absolute" };
function Nm() {
  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 Af(n) {
  n === void 0 && (n = {});
  var e = n, t = e.defaultModifiers, i = t === void 0 ? [] : t, r = e.defaultOptions, s = r === void 0 ? Dm : r;
  return function(o, a, c) {
    c === void 0 && (c = s);
    var l = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Dm, s), modifiersData: {}, elements: { reference: o, popper: a }, attributes: {}, styles: {} }, d = [], h4 = false, 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: Ro(o) ? Ua(o) : o.contextElement ? Ua(o.contextElement) : [], popper: Ua(a) };
      var v = TA(AA([].concat(i, l.options.modifiers)));
      return l.orderedModifiers = v.filter(function(m) {
        return m.enabled;
      }), g(), f.update();
    }, forceUpdate: function() {
      if (!h4) {
        var u = l.elements, y = u.reference, v = u.popper;
        if (Nm(y, v)) {
          l.rects = { reference: _A(y, ml(v), l.options.strategy === "fixed"), popper: Mf(v) }, l.reset = false, l.placement = l.options.placement, l.orderedModifiers.forEach(function(E) {
            return l.modifiersData[E.name] = Object.assign({}, E.data);
          });
          for (var m = 0; m < l.orderedModifiers.length; m++) {
            if (l.reset === true) {
              l.reset = false, m = -1;
              continue;
            }
            var x = l.orderedModifiers[m], M = x.fn, T = x.options, w = T === void 0 ? {} : T, _ = x.name;
            typeof M == "function" && (l = M({ state: l, options: w, name: _, instance: f }) || l);
          }
        }
      }
    }, update: EA2(function() {
      return new Promise(function(u) {
        f.forceUpdate(), u(l);
      });
    }), destroy: function() {
      p(), h4 = true;
    } };
    if (!Nm(o, a)) return f;
    f.setOptions(c).then(function(u) {
      !h4 && 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 M = x({ state: l, name: y, instance: f, options: m }), T = function() {
          };
          d.push(M || T);
        }
      });
    }
    function p() {
      d.forEach(function(u) {
        return u();
      }), d = [];
    }
    return f;
  };
}
Af();
var CA2 = [j0, X0, W0, U0];
Af({ defaultModifiers: CA2 });
var LA = [j0, X0, W0, U0, mA, uA, bA, YE, dA];
var RA = Af({ defaultModifiers: LA });
var PA = (n, e, t = {}) => {
  const i = {
    name: "updateState",
    enabled: true,
    phase: "write",
    fn: ({ state: c }) => {
      const l = OA(c);
      Object.assign(o.value, l);
    },
    requires: ["computeStyles"]
  }, r = computed(() => {
    const { onFirstUpdate: c, placement: l, strategy: d, modifiers: h4 } = unref(t);
    return {
      onFirstUpdate: c,
      placement: l || "bottom",
      strategy: d || "absolute",
      modifiers: [
        ...h4 || [],
        i,
        { name: "applyStyles", enabled: false }
      ]
    };
  }), s = shallowRef(), o = ref({
    styles: {
      popper: {
        position: unref(r).strategy,
        left: "0",
        top: "0"
      },
      arrow: {
        position: "absolute"
      }
    },
    attributes: {}
  }), a = () => {
    s.value && (s.value.destroy(), s.value = void 0);
  };
  return watch(r, (c) => {
    const l = unref(s);
    l && l.setOptions(c);
  }, {
    deep: true
  }), watch([n, e], ([c, l]) => {
    a(), !(!c || !l) && (s.value = RA(c, l, unref(r)));
  }), onBeforeUnmount(() => {
    a();
  }), {
    state: computed(() => {
      var c;
      return { ...((c = unref(s)) == null ? void 0 : c.state) || {} };
    }),
    styles: computed(() => unref(o).styles),
    attributes: computed(() => unref(o).attributes),
    update: () => {
      var c;
      return (c = unref(s)) == null ? void 0 : c.update();
    },
    forceUpdate: () => {
      var c;
      return (c = unref(s)) == null ? void 0 : c.forceUpdate();
    },
    instanceRef: computed(() => unref(s))
  };
};
function OA(n) {
  const e = Object.keys(n.elements), t = jc(e.map((r) => [r, n.styles[r] || {}])), i = jc(e.map((r) => [r, n.attributes[r]]));
  return {
    styles: t,
    attributes: i
  };
}
function Bm() {
  let n;
  const e = (i, r) => {
    t(), n = window.setTimeout(i, r);
  }, t = () => window.clearTimeout(n);
  return au(() => t()), {
    registerTimeout: e,
    cancelTimeout: t
  };
}
var hd = {
  prefix: Math.floor(Math.random() * 1e4),
  current: 0
};
var IA = Symbol("elIdInjection");
var Cf = () => getCurrentInstance() ? inject(IA, hd) : hd;
var vu = (n) => {
  const e = Cf();
  !Qt && e === hd && Xt("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 = bf();
  return computed(() => unref(n) || `${t.value}-id-${e.prefix}-${e.current++}`);
};
var xo = [];
var Fm = (n) => {
  const e = n;
  e.key === Pi.esc && xo.forEach((t) => t(e));
};
var DA = (n) => {
  onMounted(() => {
    xo.length === 0 && document.addEventListener("keydown", Fm), Qt && xo.push(n);
  }), onBeforeUnmount(() => {
    xo = xo.filter((e) => e !== n), xo.length === 0 && Qt && document.removeEventListener("keydown", Fm);
  });
};
var zm;
var Y0 = () => {
  const n = bf(), e = Cf(), t = computed(() => `${n.value}-popper-container-${e.prefix}`), i = computed(() => `#${t.value}`);
  return {
    id: t,
    selector: i
  };
};
var NA = (n) => {
  const e = document.createElement("div");
  return e.id = n, document.body.appendChild(e), e;
};
var BA = () => {
  const { id: n, selector: e } = Y0();
  return onBeforeMount(() => {
    Qt && (!zm || !document.body.querySelector(e.value)) && (zm = NA(n.value));
  }), {
    id: n,
    selector: e
  };
};
var FA = ft({
  showAfter: {
    type: Number,
    default: 0
  },
  hideAfter: {
    type: Number,
    default: 200
  },
  autoClose: {
    type: Number,
    default: 0
  }
});
var zA = ({
  showAfter: n,
  hideAfter: e,
  autoClose: t,
  open: i,
  close: r
}) => {
  const { registerTimeout: s } = Bm(), {
    registerTimeout: o,
    cancelTimeout: a
  } = Bm();
  return {
    onOpen: (d) => {
      s(() => {
        i(d);
        const h4 = unref(t);
        bt(h4) && h4 > 0 && o(() => {
          r(d);
        }, h4);
      }, unref(n));
    },
    onClose: (d) => {
      a(), s(() => {
        r(d);
      }, unref(e));
    }
  };
};
var J0 = Symbol("elForwardRef");
var UA = (n) => {
  provide(J0, {
    setForwardRef: (t) => {
      n.value = t;
    }
  });
};
var VA = (n) => ({
  mounted(e) {
    n(e);
  },
  updated(e) {
    n(e);
  },
  unmounted() {
    n(null);
  }
});
var Um = {
  current: 0
};
var Vm = ref(0);
var K0 = 2e3;
var km = Symbol("elZIndexContextKey");
var q0 = Symbol("zIndexContextKey");
var Q0 = (n) => {
  const e = getCurrentInstance() ? inject(km, Um) : Um, t = n || (getCurrentInstance() ? inject(q0, void 0) : void 0), i = computed(() => {
    const o = unref(t);
    return bt(o) ? o : K0;
  }), r = computed(() => i.value + Vm.value), s = () => (e.current++, Vm.value = e.current, r.value);
  return !Qt && !inject(km) && Xt("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 kA2(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];
}
var GA = (n, e, t) => Bc(n.subTree).filter((s) => {
  var o;
  return isVNode(s) && ((o = s.type) == null ? void 0 : o.name) === e && !!s.component;
}).map((s) => s.component.uid).map((s) => t[s]).filter((s) => !!s);
var HA = (n, e) => {
  const t = {}, i = shallowRef([]);
  return {
    children: i,
    addChild: (o) => {
      t[o.uid] = o, i.value = GA(n, e, t);
    },
    removeChild: (o) => {
      delete t[o], i.value = i.value.filter((a) => a.uid !== o);
    }
  };
};
var Do = pu({
  type: String,
  values: D0,
  required: false
});
var ey = Symbol("size");
var WA = () => {
  const n = inject(ey, {});
  return computed(() => unref(n.size) || "");
};
function ty(n, {
  beforeFocus: e,
  afterFocus: t,
  beforeBlur: i,
  afterBlur: r
} = {}) {
  const s = getCurrentInstance(), { emit: o } = s, a = shallowRef(), c = ref(false), l = (f) => {
    Tn(e) && e(f) || c.value || (c.value = true, o("focus", f), t == null || t());
  }, d = (f) => {
    var g;
    Tn(i) && i(f) || f.relatedTarget && ((g = a.value) != null && g.contains(f.relatedTarget)) || (c.value = false, o("blur", f), r == null || r());
  }, h4 = () => {
    var f, g;
    (f = a.value) != null && f.contains(document.activeElement) && a.value !== document.activeElement || (g = n.value) == null || g.focus();
  };
  return watch(a, (f) => {
    f && f.setAttribute("tabindex", "-1");
  }), un(a, "focus", l, true), un(a, "blur", d, true), un(a, "click", h4, true), false, {
    isFocused: c,
    wrapperRef: a,
    handleFocus: l,
    handleBlur: d
  };
}
function ny({
  afterComposition: n,
  emit: e
}) {
  const t = ref(false), i = (a) => {
    e == null || e("compositionstart", a), t.value = true;
  }, 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 = !gE(d);
  }, s = (a) => {
    e == null || e("compositionend", a), t.value && (t.value = false, nextTick(() => n(a)));
  };
  return {
    isComposing: t,
    handleComposition: (a) => {
      a.type === "compositionend" ? s(a) : r(a);
    },
    handleCompositionStart: i,
    handleCompositionUpdate: r,
    handleCompositionEnd: s
  };
}
var iy = Symbol("emptyValuesContextKey");
var jA = "use-empty-values";
var $A = ["", void 0, null];
var ZA = void 0;
var XA = ft({
  emptyValues: Array,
  valueOnClear: {
    type: [String, Number, Boolean, Function],
    default: void 0,
    validator: (n) => Tn(n) ? !n() : !n
  }
});
var YA = (n, e) => {
  const t = getCurrentInstance() ? inject(iy, ref({})) : ref({}), i = computed(() => n.emptyValues || t.value.emptyValues || $A), r = computed(() => Tn(n.valueOnClear) ? n.valueOnClear() : n.valueOnClear !== void 0 ? n.valueOnClear : Tn(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : ZA), s = (o) => i.value.includes(o);
  return i.value.includes(r.value) || Xt(jA, "value-on-clear should be a value of empty-values"), {
    emptyValues: i,
    valueOnClear: r,
    isEmptyValue: s
  };
};
var JA = ft({
  ariaLabel: String,
  ariaOrientation: {
    type: String,
    values: ["horizontal", "vertical", "undefined"]
  },
  ariaControls: String
});
var Gs = (n) => WT(JA, n);
var ry = Symbol();
var Jc = ref();
function Lf(n, e = void 0) {
  const t = getCurrentInstance() ? inject(ry, Jc) : Jc;
  return n ? computed(() => {
    var i, r;
    return (r = (i = t.value) == null ? void 0 : i[n]) != null ? r : e;
  }) : t;
}
function KA(n, e) {
  const t = Lf(), i = st(n, computed(() => {
    var a;
    return ((a = t.value) == null ? void 0 : a.namespace) || Fc;
  })), r = mu(computed(() => {
    var a;
    return (a = t.value) == null ? void 0 : a.locale;
  })), s = Q0(computed(() => {
    var a;
    return ((a = t.value) == null ? void 0 : a.zIndex) || K0;
  })), o = computed(() => {
    var a;
    return unref(e) || ((a = t.value) == null ? void 0 : a.size) || "";
  });
  return qA(computed(() => unref(t) || {})), {
    ns: i,
    locale: r,
    zIndex: s,
    size: o
  };
}
var qA = (n, e, t = false) => {
  var i;
  const r = !!getCurrentInstance(), s = r ? Lf() : void 0, o = (i = void 0) != null ? i : r ? provide : void 0;
  if (!o) {
    Xt("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
    return;
  }
  const a = computed(() => {
    const c = unref(n);
    return s != null && s.value ? QA(s.value, c) : c;
  });
  return o(ry, a), o(N0, computed(() => a.value.locale)), o(B0, computed(() => a.value.namespace)), o(q0, computed(() => a.value.zIndex)), o(ey, {
    size: computed(() => a.value.size || "")
  }), o(iy, computed(() => ({
    emptyValues: a.value.emptyValues,
    valueOnClear: a.value.valueOnClear
  }))), (t || !Jc.value) && (Jc.value = a.value), a;
};
var QA = (n, e) => {
  const t = [.../* @__PURE__ */ new Set([...Tm(n), ...Tm(e)])], i = {};
  for (const r of t)
    i[r] = e[r] !== void 0 ? e[r] : n[r];
  return i;
};
var ct = (n, e) => {
  const t = n.__vccOpts || n;
  for (const [i, r] of e)
    t[i] = r;
  return t;
};
var eC = ft({
  size: {
    type: Je([Number, String])
  },
  color: {
    type: String
  }
});
var tC = defineComponent({
  name: "ElIcon",
  inheritAttrs: false
});
var nC = defineComponent({
  ...tC,
  props: eC,
  setup(n) {
    const e = n, t = st("icon"), i = computed(() => {
      const { size: r, color: s } = e;
      return !r && !s ? {} : {
        fontSize: mi(r) ? void 0 : Zc(r),
        "--color": s
      };
    });
    return (r, s) => (openBlock(), createElementBlock("i", mergeProps({
      class: unref(t).b(),
      style: unref(i)
    }, r.$attrs), [
      renderSlot(r.$slots, "default")
    ], 16));
  }
});
var iC = ct(nC, [["__file", "icon.vue"]]);
var Ot = fn(iC);
var Rf = Symbol("formContextKey");
var Kc = Symbol("formItemContextKey");
var ra = (n, e = {}) => {
  const t = ref(void 0), i = e.prop ? t : F0("size"), r = e.global ? t : WA(), s = e.form ? { size: void 0 } : inject(Rf, void 0), o = e.formItem ? { size: void 0 } : inject(Kc, void 0);
  return computed(() => i.value || unref(n) || (o == null ? void 0 : o.size) || (s == null ? void 0 : s.size) || r.value || "");
};
var yu = (n) => {
  const e = F0("disabled"), t = inject(Rf, void 0);
  return computed(() => e.value || unref(n) || (t == null ? void 0 : t.disabled) || false);
};
var gl = () => {
  const n = inject(Rf, void 0), e = inject(Kc, void 0);
  return {
    form: n,
    formItem: e
  };
};
var Pf = (n, {
  formItemContext: e,
  disableIdGeneration: t,
  disableIdManagement: i
}) => {
  t || (t = ref(false)), i || (i = ref(false));
  const r = ref();
  let s;
  const o = computed(() => {
    var a;
    return !!(!(n.label || n.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1);
  });
  return onMounted(() => {
    s = watch([toRef(n, "id"), t], ([a, c]) => {
      const l = a ?? (c ? void 0 : vu().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: true });
  }), onUnmounted(() => {
    s && s(), e != null && e.removeInputId && r.value && e.removeInputId(r.value);
  }), {
    isLabeledByFormItem: o,
    inputId: r
  };
};
var ai;
var rC = `
  height:0 !important;
  visibility:hidden !important;
  ${j1() ? "" : "overflow:hidden !important;"}
  position:absolute !important;
  z-index:-1000 !important;
  top:0 !important;
  right:0 !important;
`;
var sC = [
  "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 oC(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: sC.map((o) => `${o}:${e.getPropertyValue(o)}`).join(";"), paddingSize: i, borderSize: r, boxSizing: t };
}
function Gm(n, e = 1, t) {
  var i;
  ai || (ai = document.createElement("textarea"), document.body.appendChild(ai));
  const { paddingSize: r, borderSize: s, boxSizing: o, contextStyle: a } = oC(n);
  ai.setAttribute("style", `${a};${rC}`), ai.value = n.value || n.placeholder || "";
  let c = ai.scrollHeight;
  const l = {};
  o === "border-box" ? c = c + s : o === "content-box" && (c = c - r), ai.value = "";
  const d = ai.scrollHeight - r;
  if (bt(e)) {
    let h4 = d * e;
    o === "border-box" && (h4 = h4 + r + s), c = Math.max(h4, c), l.minHeight = `${h4}px`;
  }
  if (bt(t)) {
    let h4 = d * t;
    o === "border-box" && (h4 = h4 + r + s), c = Math.min(h4, c);
  }
  return l.height = `${c}px`, (i = ai.parentNode) == null || i.removeChild(ai), ai = void 0, l;
}
var aC = ft({
  id: {
    type: String,
    default: void 0
  },
  size: Do,
  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: false
  },
  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: $r
  },
  prefixIcon: {
    type: $r
  },
  containerRole: {
    type: String,
    default: void 0
  },
  tabindex: {
    type: [String, Number],
    default: 0
  },
  validateEvent: {
    type: Boolean,
    default: true
  },
  inputStyle: {
    type: Je([Object, Array, String]),
    default: () => er({})
  },
  autofocus: Boolean,
  rows: {
    type: Number,
    default: 2
  },
  ...Gs(["ariaLabel"])
});
var lC = {
  [Lt]: (n) => Ln(n),
  input: (n) => Ln(n),
  change: (n) => Ln(n),
  focus: (n) => n instanceof FocusEvent,
  blur: (n) => n instanceof FocusEvent,
  clear: () => true,
  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
};
var cC = defineComponent({
  name: "ElInput",
  inheritAttrs: false
});
var uC = defineComponent({
  ...cC,
  props: aC,
  emits: lC,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = useAttrs(), s = useSlots(), o = computed(() => {
      const fe = {};
      return i.containerRole === "combobox" && (fe["aria-haspopup"] = r["aria-haspopup"], fe["aria-owns"] = r["aria-owns"], fe["aria-expanded"] = r["aria-expanded"]), fe;
    }), a = computed(() => [
      i.type === "textarea" ? y.b() : u.b(),
      u.m(g.value),
      u.is("disabled", p.value),
      u.is("exceed", Y.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")]: D.value && U.value,
        [u.b("hidden")]: i.type === "hidden"
      },
      r.class
    ]), c = computed(() => [
      u.e("wrapper"),
      u.is("focus", P.value)
    ]), l = bE({
      excludeKeys: computed(() => Object.keys(o.value))
    }), { form: d, formItem: h4 } = gl(), { inputId: f } = Pf(i, {
      formItemContext: h4
    }), g = ra(), p = yu(), u = st("input"), y = st("textarea"), v = shallowRef(), m = shallowRef(), x = ref(false), M = ref(false), T = ref(), w = shallowRef(i.inputStyle), _ = computed(() => v.value || m.value), { wrapperRef: E, isFocused: P, handleFocus: S, handleBlur: R } = ty(_, {
      beforeFocus() {
        return p.value;
      },
      afterBlur() {
        var fe;
        i.validateEvent && ((fe = h4 == null ? void 0 : h4.validate) == null || fe.call(h4, "blur").catch((we) => Xt(we)));
      }
    }), A = computed(() => {
      var fe;
      return (fe = d == null ? void 0 : d.statusIcon) != null ? fe : false;
    }), C = computed(() => (h4 == null ? void 0 : h4.validateState) || ""), L = computed(() => C.value && I0[C.value]), I = computed(() => M.value ? dE : oE), b = computed(() => [
      r.style
    ]), O = computed(() => [
      i.inputStyle,
      w.value,
      { resize: i.resize }
    ]), N = computed(() => rr(i.modelValue) ? "" : String(i.modelValue)), D = computed(() => i.clearable && !p.value && !i.readonly && !!N.value && (P.value || x.value)), U = computed(() => i.showPassword && !p.value && !i.readonly && !!N.value && (!!N.value || P.value)), V = computed(() => i.showWordLimit && !!i.maxlength && (i.type === "text" || i.type === "textarea") && !p.value && !i.readonly && !i.showPassword), H = computed(() => N.value.length), Y = computed(() => !!V.value && H.value > Number(i.maxlength)), re = computed(() => !!s.suffix || !!i.suffixIcon || D.value || i.showPassword || V.value || !!C.value && A.value), [ae, ee] = kA2(v);
    Qn(m, (fe) => {
      if (K(), !V.value || i.resize !== "both")
        return;
      const we = fe[0], { width: ie } = we.contentRect;
      T.value = {
        right: `calc(100% - ${ie + 15 + 6}px)`
      };
    });
    const oe = () => {
      const { type: fe, autosize: we } = i;
      if (!(!Qt || fe !== "textarea" || !m.value))
        if (we) {
          const ie = An(we) ? we.minRows : void 0, pe = An(we) ? we.maxRows : void 0, be = Gm(m.value, ie, pe);
          w.value = {
            overflowY: "hidden",
            ...be
          }, nextTick(() => {
            m.value.offsetHeight, w.value = be;
          });
        } else
          w.value = {
            minHeight: Gm(m.value).minHeight
          };
    }, K = /* @__PURE__ */ ((fe) => {
      let we = false;
      return () => {
        var ie;
        if (we || !i.autosize)
          return;
        ((ie = m.value) == null ? void 0 : ie.offsetParent) === null || (fe(), we = true);
      };
    })(oe), $ = () => {
      const fe = _.value, we = i.formatter ? i.formatter(N.value) : N.value;
      !fe || fe.value === we || (fe.value = we);
    }, ne = async (fe) => {
      ae();
      let { value: we } = fe.target;
      if (i.formatter && (we = i.parser ? i.parser(we) : we), !W.value) {
        if (we === N.value) {
          $();
          return;
        }
        t(Lt, we), t("input", we), await nextTick(), $(), ee();
      }
    }, k = (fe) => {
      t("change", fe.target.value);
    }, {
      isComposing: W,
      handleCompositionStart: B,
      handleCompositionUpdate: X,
      handleCompositionEnd: J
    } = ny({ emit: t, afterComposition: ne }), F = () => {
      M.value = !M.value, z();
    }, z = async () => {
      var fe;
      await nextTick(), (fe = _.value) == null || fe.focus();
    }, te = () => {
      var fe;
      return (fe = _.value) == null ? void 0 : fe.blur();
    }, se = (fe) => {
      x.value = false, t("mouseleave", fe);
    }, le = (fe) => {
      x.value = true, t("mouseenter", fe);
    }, me = (fe) => {
      t("keydown", fe);
    }, Te = () => {
      var fe;
      (fe = _.value) == null || fe.select();
    }, _e = () => {
      t(Lt, ""), t("change", ""), t("clear"), t("input", "");
    };
    return watch(() => i.modelValue, () => {
      var fe;
      nextTick(() => oe()), i.validateEvent && ((fe = h4 == null ? void 0 : h4.validate) == null || fe.call(h4, "change").catch((we) => Xt(we)));
    }), watch(N, () => $()), watch(() => i.type, async () => {
      await nextTick(), $(), oe();
    }), onMounted(() => {
      !i.formatter && i.parser && Xt("ElInput", "If you set the parser, you also need to set the formatter."), $(), nextTick(oe);
    }), e({
      input: v,
      textarea: m,
      ref: _,
      textareaStyle: O,
      autosize: toRef(i, "autosize"),
      isComposing: W,
      focus: z,
      blur: te,
      select: Te,
      clear: _e,
      resizeTextarea: oe
    }), (fe, we) => (openBlock(), createElementBlock("div", mergeProps(unref(o), {
      class: [
        unref(a),
        {
          [unref(u).bm("group", "append")]: fe.$slots.append,
          [unref(u).bm("group", "prepend")]: fe.$slots.prepend
        }
      ],
      style: unref(b),
      role: fe.containerRole,
      onMouseenter: le,
      onMouseleave: se
    }), [
      createCommentVNode(" input "),
      fe.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
        createCommentVNode(" prepend slot "),
        fe.$slots.prepend ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: normalizeClass(unref(u).be("group", "prepend"))
        }, [
          renderSlot(fe.$slots, "prepend")
        ], 2)) : createCommentVNode("v-if", true),
        createBaseVNode("div", {
          ref_key: "wrapperRef",
          ref: E,
          class: normalizeClass(unref(c))
        }, [
          createCommentVNode(" prefix slot "),
          fe.$slots.prefix || fe.prefixIcon ? (openBlock(), createElementBlock("span", {
            key: 0,
            class: normalizeClass(unref(u).e("prefix"))
          }, [
            createBaseVNode("span", {
              class: normalizeClass(unref(u).e("prefix-inner"))
            }, [
              renderSlot(fe.$slots, "prefix"),
              fe.prefixIcon ? (openBlock(), createBlock(unref(Ot), {
                key: 0,
                class: normalizeClass(unref(u).e("icon"))
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(fe.prefixIcon)))
                ]),
                _: 1
              }, 8, ["class"])) : createCommentVNode("v-if", true)
            ], 2)
          ], 2)) : createCommentVNode("v-if", true),
          createBaseVNode("input", mergeProps({
            id: unref(f),
            ref_key: "input",
            ref: v,
            class: unref(u).e("inner")
          }, unref(l), {
            minlength: fe.minlength,
            maxlength: fe.maxlength,
            type: fe.showPassword ? M.value ? "text" : "password" : fe.type,
            disabled: unref(p),
            readonly: fe.readonly,
            autocomplete: fe.autocomplete,
            tabindex: fe.tabindex,
            "aria-label": fe.ariaLabel,
            placeholder: fe.placeholder,
            style: fe.inputStyle,
            form: fe.form,
            autofocus: fe.autofocus,
            onCompositionstart: unref(B),
            onCompositionupdate: unref(X),
            onCompositionend: unref(J),
            onInput: ne,
            onChange: k,
            onKeydown: me
          }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
          createCommentVNode(" suffix slot "),
          unref(re) ? (openBlock(), createElementBlock("span", {
            key: 1,
            class: normalizeClass(unref(u).e("suffix"))
          }, [
            createBaseVNode("span", {
              class: normalizeClass(unref(u).e("suffix-inner"))
            }, [
              !unref(D) || !unref(U) || !unref(V) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
                renderSlot(fe.$slots, "suffix"),
                fe.suffixIcon ? (openBlock(), createBlock(unref(Ot), {
                  key: 0,
                  class: normalizeClass(unref(u).e("icon"))
                }, {
                  default: withCtx(() => [
                    (openBlock(), createBlock(resolveDynamicComponent(fe.suffixIcon)))
                  ]),
                  _: 1
                }, 8, ["class"])) : createCommentVNode("v-if", true)
              ], 64)) : createCommentVNode("v-if", true),
              unref(D) ? (openBlock(), createBlock(unref(Ot), {
                key: 1,
                class: normalizeClass([unref(u).e("icon"), unref(u).e("clear")]),
                onMousedown: withModifiers(unref($a), ["prevent"]),
                onClick: _e
              }, {
                default: withCtx(() => [
                  createVNode(unref(yf))
                ]),
                _: 1
              }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
              unref(U) ? (openBlock(), createBlock(unref(Ot), {
                key: 2,
                class: normalizeClass([unref(u).e("icon"), unref(u).e("password")]),
                onClick: F
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(unref(I))))
                ]),
                _: 1
              }, 8, ["class"])) : createCommentVNode("v-if", true),
              unref(V) ? (openBlock(), createElementBlock("span", {
                key: 3,
                class: normalizeClass(unref(u).e("count"))
              }, [
                createBaseVNode("span", {
                  class: normalizeClass(unref(u).e("count-inner"))
                }, toDisplayString(unref(H)) + " / " + toDisplayString(fe.maxlength), 3)
              ], 2)) : createCommentVNode("v-if", true),
              unref(C) && unref(L) && unref(A) ? (openBlock(), createBlock(unref(Ot), {
                key: 4,
                class: normalizeClass([
                  unref(u).e("icon"),
                  unref(u).e("validateIcon"),
                  unref(u).is("loading", unref(C) === "validating")
                ])
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(unref(L))))
                ]),
                _: 1
              }, 8, ["class"])) : createCommentVNode("v-if", true)
            ], 2)
          ], 2)) : createCommentVNode("v-if", true)
        ], 2),
        createCommentVNode(" append slot "),
        fe.$slots.append ? (openBlock(), createElementBlock("div", {
          key: 1,
          class: normalizeClass(unref(u).be("group", "append"))
        }, [
          renderSlot(fe.$slots, "append")
        ], 2)) : createCommentVNode("v-if", true)
      ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
        createCommentVNode(" textarea "),
        createBaseVNode("textarea", mergeProps({
          id: unref(f),
          ref_key: "textarea",
          ref: m,
          class: [unref(y).e("inner"), unref(u).is("focus", unref(P))]
        }, unref(l), {
          minlength: fe.minlength,
          maxlength: fe.maxlength,
          tabindex: fe.tabindex,
          disabled: unref(p),
          readonly: fe.readonly,
          autocomplete: fe.autocomplete,
          style: unref(O),
          "aria-label": fe.ariaLabel,
          placeholder: fe.placeholder,
          form: fe.form,
          autofocus: fe.autofocus,
          rows: fe.rows,
          onCompositionstart: unref(B),
          onCompositionupdate: unref(X),
          onCompositionend: unref(J),
          onInput: ne,
          onFocus: unref(S),
          onBlur: unref(R),
          onChange: k,
          onKeydown: me
        }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
        unref(V) ? (openBlock(), createElementBlock("span", {
          key: 0,
          style: normalizeStyle(T.value),
          class: normalizeClass(unref(u).e("count"))
        }, toDisplayString(unref(H)) + " / " + toDisplayString(fe.maxlength), 7)) : createCommentVNode("v-if", true)
      ], 64))
    ], 16, ["role"]));
  }
});
var hC = ct(uC, [["__file", "input.vue"]]);
var dC = fn(hC);
var Ys = 4;
var fC = {
  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"
  }
};
var pC = ({
  move: n,
  size: e,
  bar: t
}) => ({
  [t.size]: e,
  transform: `translate${t.axis}(${n}%)`
});
var Of = Symbol("scrollbarContextKey");
var mC = ft({
  vertical: Boolean,
  size: String,
  move: Number,
  ratio: {
    type: Number,
    required: true
  },
  always: Boolean
});
var gC = "Thumb";
var vC = defineComponent({
  __name: "thumb",
  props: mC,
  setup(n) {
    const e = n, t = inject(Of), i = st("scrollbar");
    t || na(gC, "can not inject scrollbar context");
    const r = ref(), s = ref(), o = ref({}), a = ref(false);
    let c = false, l = false, d = Qt ? document.onselectstart : null;
    const h4 = computed(() => fC[e.vertical ? "vertical" : "horizontal"]), f = computed(() => pC({
      size: e.size,
      move: e.move,
      bar: h4.value
    })), g = computed(() => r.value[h4.value.offset] ** 2 / t.wrapElement[h4.value.scrollSize] / e.ratio / s.value[h4.value.offset]), p = (w) => {
      var _;
      if (w.stopPropagation(), w.ctrlKey || [1, 2].includes(w.button))
        return;
      (_ = window.getSelection()) == null || _.removeAllRanges(), y(w);
      const E = w.currentTarget;
      E && (o.value[h4.value.axis] = E[h4.value.offset] - (w[h4.value.client] - E.getBoundingClientRect()[h4.value.direction]));
    }, u = (w) => {
      if (!s.value || !r.value || !t.wrapElement)
        return;
      const _ = Math.abs(w.target.getBoundingClientRect()[h4.value.direction] - w[h4.value.client]), E = s.value[h4.value.offset] / 2, P = (_ - E) * 100 * g.value / r.value[h4.value.offset];
      t.wrapElement[h4.value.scroll] = P * t.wrapElement[h4.value.scrollSize] / 100;
    }, y = (w) => {
      w.stopImmediatePropagation(), c = true, document.addEventListener("mousemove", v), document.addEventListener("mouseup", m), d = document.onselectstart, document.onselectstart = () => false;
    }, v = (w) => {
      if (!r.value || !s.value || c === false)
        return;
      const _ = o.value[h4.value.axis];
      if (!_)
        return;
      const E = (r.value.getBoundingClientRect()[h4.value.direction] - w[h4.value.client]) * -1, P = s.value[h4.value.offset] - _, S = (E - P) * 100 * g.value / r.value[h4.value.offset];
      t.wrapElement[h4.value.scroll] = S * t.wrapElement[h4.value.scrollSize] / 100;
    }, m = () => {
      c = false, o.value[h4.value.axis] = 0, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m), T(), l && (a.value = false);
    }, x = () => {
      l = false, a.value = !!e.size;
    }, M = () => {
      l = true, a.value = c;
    };
    onBeforeUnmount(() => {
      T(), document.removeEventListener("mouseup", m);
    });
    const T = () => {
      document.onselectstart !== d && (document.onselectstart = d);
    };
    return un(toRef(t, "scrollbarElement"), "mousemove", x), un(toRef(t, "scrollbarElement"), "mouseleave", M), (w, _) => (openBlock(), createBlock(Transition, {
      name: unref(i).b("fade"),
      persisted: ""
    }, {
      default: withCtx(() => [
        withDirectives(createBaseVNode("div", {
          ref_key: "instance",
          ref: r,
          class: normalizeClass([unref(i).e("bar"), unref(i).is(unref(h4).key)]),
          onMousedown: u
        }, [
          createBaseVNode("div", {
            ref_key: "thumb",
            ref: s,
            class: normalizeClass(unref(i).e("thumb")),
            style: normalizeStyle(unref(f)),
            onMousedown: p
          }, null, 38)
        ], 34), [
          [vShow, w.always || a.value]
        ])
      ]),
      _: 1
    }, 8, ["name"]));
  }
});
var Hm = ct(vC, [["__file", "thumb.vue"]]);
var yC = ft({
  always: {
    type: Boolean,
    default: true
  },
  minSize: {
    type: Number,
    required: true
  }
});
var bC = defineComponent({
  __name: "bar",
  props: yC,
  setup(n, { expose: e }) {
    const t = n, i = inject(Of), r = ref(0), s = ref(0), o = ref(""), a = ref(""), c = ref(1), l = ref(1);
    return e({
      handleScroll: (f) => {
        if (f) {
          const g = f.offsetHeight - Ys, p = f.offsetWidth - Ys;
          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 - Ys, p = f.offsetWidth - Ys, 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 + Ys < g ? `${v}px` : "", o.value = m + Ys < p ? `${m}px` : "";
      }
    }), (f, g) => (openBlock(), createElementBlock(Fragment, null, [
      createVNode(Hm, {
        move: r.value,
        ratio: l.value,
        size: o.value,
        always: f.always
      }, null, 8, ["move", "ratio", "size", "always"]),
      createVNode(Hm, {
        move: s.value,
        ratio: c.value,
        size: a.value,
        vertical: "",
        always: f.always
      }, null, 8, ["move", "ratio", "size", "always"])
    ], 64));
  }
});
var xC = ct(bC, [["__file", "bar.vue"]]);
var wC = ft({
  height: {
    type: [String, Number],
    default: ""
  },
  maxHeight: {
    type: [String, Number],
    default: ""
  },
  native: {
    type: Boolean,
    default: false
  },
  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,
  ...Gs(["ariaLabel", "ariaOrientation"])
});
var MC = {
  scroll: ({
    scrollTop: n,
    scrollLeft: e
  }) => [n, e].every(bt)
};
var dd = "ElScrollbar";
var _C = defineComponent({
  name: dd
});
var SC = defineComponent({
  ..._C,
  props: wC,
  emits: MC,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = st("scrollbar");
    let s, o, a = 0, c = 0;
    const l = ref(), d = ref(), h4 = ref(), f = ref(), g = computed(() => {
      const T = {};
      return i.height && (T.height = Zc(i.height)), i.maxHeight && (T.maxHeight = Zc(i.maxHeight)), [i.wrapStyle, T];
    }), p = computed(() => [
      i.wrapClass,
      r.e("wrap"),
      { [r.em("wrap", "hidden-default")]: !i.native }
    ]), u = computed(() => [r.e("view"), i.viewClass]), y = () => {
      var T;
      d.value && ((T = f.value) == null || T.handleScroll(d.value), a = d.value.scrollTop, c = d.value.scrollLeft, t("scroll", {
        scrollTop: d.value.scrollTop,
        scrollLeft: d.value.scrollLeft
      }));
    };
    function v(T, w) {
      An(T) ? d.value.scrollTo(T) : bt(T) && bt(w) && d.value.scrollTo(T, w);
    }
    const m = (T) => {
      if (!bt(T)) {
        Xt(dd, "value must be a number");
        return;
      }
      d.value.scrollTop = T;
    }, x = (T) => {
      if (!bt(T)) {
        Xt(dd, "value must be a number");
        return;
      }
      d.value.scrollLeft = T;
    }, M = () => {
      var T;
      (T = f.value) == null || T.update();
    };
    return watch(() => i.noresize, (T) => {
      T ? (s == null || s(), o == null || o()) : ({ stop: s } = Qn(h4, M), o = un("resize", M));
    }, { immediate: true }), watch(() => [i.maxHeight, i.height], () => {
      i.native || nextTick(() => {
        var T;
        M(), d.value && ((T = f.value) == null || T.handleScroll(d.value));
      });
    }), provide(Of, reactive({
      scrollbarElement: l,
      wrapElement: d
    })), onActivated(() => {
      d.value && (d.value.scrollTop = a, d.value.scrollLeft = c);
    }), onMounted(() => {
      i.native || nextTick(() => {
        M();
      });
    }), onUpdated(() => M()), e({
      wrapRef: d,
      update: M,
      scrollTo: v,
      setScrollTop: m,
      setScrollLeft: x,
      handleScroll: y
    }), (T, w) => (openBlock(), createElementBlock("div", {
      ref_key: "scrollbarRef",
      ref: l,
      class: normalizeClass(unref(r).b())
    }, [
      createBaseVNode("div", {
        ref_key: "wrapRef",
        ref: d,
        class: normalizeClass(unref(p)),
        style: normalizeStyle(unref(g)),
        tabindex: T.tabindex,
        onScroll: y
      }, [
        (openBlock(), createBlock(resolveDynamicComponent(T.tag), {
          id: T.id,
          ref_key: "resizeRef",
          ref: h4,
          class: normalizeClass(unref(u)),
          style: normalizeStyle(T.viewStyle),
          role: T.role,
          "aria-label": T.ariaLabel,
          "aria-orientation": T.ariaOrientation
        }, {
          default: withCtx(() => [
            renderSlot(T.$slots, "default")
          ]),
          _: 3
        }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
      ], 46, ["tabindex"]),
      T.native ? createCommentVNode("v-if", true) : (openBlock(), createBlock(xC, {
        key: 0,
        ref_key: "barRef",
        ref: f,
        always: T.always,
        "min-size": T.minSize
      }, null, 8, ["always", "min-size"]))
    ], 2));
  }
});
var TC = ct(SC, [["__file", "scrollbar.vue"]]);
var EC = fn(TC);
var If = Symbol("popper");
var sy = Symbol("popperContent");
var AC = [
  "dialog",
  "grid",
  "group",
  "listbox",
  "menu",
  "navigation",
  "tooltip",
  "tree"
];
var oy = ft({
  role: {
    type: String,
    values: AC,
    default: "tooltip"
  }
});
var CC = defineComponent({
  name: "ElPopper",
  inheritAttrs: false
});
var LC = defineComponent({
  ...CC,
  props: oy,
  setup(n, { expose: e }) {
    const t = n, i = ref(), r = ref(), s = ref(), o = ref(), a = computed(() => t.role), c = {
      triggerRef: i,
      popperInstanceRef: r,
      contentRef: s,
      referenceRef: o,
      role: a
    };
    return e(c), provide(If, c), (l, d) => renderSlot(l.$slots, "default");
  }
});
var RC = ct(LC, [["__file", "popper.vue"]]);
var ay = ft({
  arrowOffset: {
    type: Number,
    default: 5
  }
});
var PC = defineComponent({
  name: "ElPopperArrow",
  inheritAttrs: false
});
var OC = defineComponent({
  ...PC,
  props: ay,
  setup(n, { expose: e }) {
    const t = n, i = st("popper"), { arrowOffset: r, arrowRef: s, arrowStyle: o } = inject(sy, void 0);
    return watch(() => t.arrowOffset, (a) => {
      r.value = a;
    }), onBeforeUnmount(() => {
      s.value = void 0;
    }), e({
      arrowRef: s
    }), (a, c) => (openBlock(), createElementBlock("span", {
      ref_key: "arrowRef",
      ref: s,
      class: normalizeClass(unref(i).e("arrow")),
      style: normalizeStyle(unref(o)),
      "data-popper-arrow": ""
    }, null, 6));
  }
});
var IC = ct(OC, [["__file", "arrow.vue"]]);
var Ju = "ElOnlyChild";
var DC = defineComponent({
  name: Ju,
  setup(n, {
    slots: e,
    attrs: t
  }) {
    var i;
    const r = inject(J0), s = VA((i = r == null ? void 0 : r.setForwardRef) != null ? i : $a);
    return () => {
      var o;
      const a = (o = e.default) == null ? void 0 : o.call(e, t);
      if (!a)
        return null;
      if (a.length > 1)
        return Xt(Ju, "requires exact only one valid child."), null;
      const c = ly(a);
      return c ? withDirectives(cloneVNode(c, t), [[s]]) : (Xt(Ju, "no valid child node found"), null);
    };
  }
});
function ly(n) {
  if (!n)
    return null;
  const e = n;
  for (const t of e) {
    if (An(t))
      switch (t.type) {
        case Comment:
          continue;
        case Text:
        case "svg":
          return Wm(t);
        case Fragment:
          return ly(t.children);
        default:
          return t;
      }
    return Wm(t);
  }
  return null;
}
function Wm(n) {
  const e = st("only-child");
  return createVNode("span", {
    class: e.e("content")
  }, [n]);
}
var cy = ft({
  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
});
var NC = defineComponent({
  name: "ElPopperTrigger",
  inheritAttrs: false
});
var BC = defineComponent({
  ...NC,
  props: cy,
  setup(n, { expose: e }) {
    const t = n, { role: i, triggerRef: r } = inject(If, void 0);
    UA(r);
    const s = computed(() => a.value ? t.id : void 0), o = computed(() => {
      if (i && i.value === "tooltip")
        return t.open && t.id ? t.id : void 0;
    }), a = computed(() => {
      if (i && i.value !== "tooltip")
        return i.value;
    }), c = computed(() => a.value ? `${t.open}` : void 0);
    let l;
    const d = [
      "onMouseenter",
      "onMouseleave",
      "onClick",
      "onKeydown",
      "onFocus",
      "onBlur",
      "onContextmenu"
    ];
    return onMounted(() => {
      watch(() => t.virtualRef, (h4) => {
        h4 && (r.value = nr(h4));
      }, {
        immediate: true
      }), watch(r, (h4, f) => {
        l == null || l(), l = void 0, Ms(h4) && (d.forEach((g) => {
          var p;
          const u = t[g];
          u && (h4.addEventListener(g.slice(2).toLowerCase(), u), (p = f == null ? void 0 : f.removeEventListener) == null || p.call(f, g.slice(2).toLowerCase(), u));
        }), l = watch([s, o, a, c], (g) => {
          [
            "aria-controls",
            "aria-describedby",
            "aria-haspopup",
            "aria-expanded"
          ].forEach((p, u) => {
            rr(g[u]) ? h4.removeAttribute(p) : h4.setAttribute(p, g[u]);
          });
        }, { immediate: true })), Ms(f) && [
          "aria-controls",
          "aria-describedby",
          "aria-haspopup",
          "aria-expanded"
        ].forEach((g) => f.removeAttribute(g));
      }, {
        immediate: true
      });
    }), onBeforeUnmount(() => {
      if (l == null || l(), l = void 0, r.value && Ms(r.value)) {
        const h4 = r.value;
        d.forEach((f) => {
          const g = t[f];
          g && h4.removeEventListener(f.slice(2).toLowerCase(), g);
        }), r.value = void 0;
      }
    }), e({
      triggerRef: r
    }), (h4, f) => h4.virtualTriggering ? createCommentVNode("v-if", true) : (openBlock(), createBlock(unref(DC), mergeProps({ key: 0 }, h4.$attrs, {
      "aria-controls": unref(s),
      "aria-describedby": unref(o),
      "aria-expanded": unref(c),
      "aria-haspopup": unref(a)
    }), {
      default: withCtx(() => [
        renderSlot(h4.$slots, "default")
      ]),
      _: 3
    }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"]));
  }
});
var FC = ct(BC, [["__file", "trigger.vue"]]);
var Ku = "focus-trap.focus-after-trapped";
var qu = "focus-trap.focus-after-released";
var zC = "focus-trap.focusout-prevented";
var jm = {
  cancelable: true,
  bubbles: false
};
var UC = {
  cancelable: true,
  bubbles: false
};
var $m = "focusAfterTrapped";
var Zm = "focusAfterReleased";
var VC = Symbol("elFocusTrap");
var Df = ref();
var bu = ref(0);
var Nf = ref(0);
var Fl = 0;
var uy = (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;
};
var Xm = (n, e) => {
  for (const t of n)
    if (!kC(t, e))
      return t;
};
var kC = (n, e) => {
  if (false)
    return false;
  if (getComputedStyle(n).visibility === "hidden")
    return true;
  for (; n; ) {
    if (e && n === e)
      return false;
    if (getComputedStyle(n).display === "none")
      return true;
    n = n.parentElement;
  }
  return false;
};
var GC = (n) => {
  const e = uy(n), t = Xm(e, n), i = Xm(e.reverse(), n);
  return [t, i];
};
var HC = (n) => n instanceof HTMLInputElement && "select" in n;
var Pr = (n, e) => {
  if (n && n.focus) {
    const t = document.activeElement;
    n.focus({ preventScroll: true }), Nf.value = window.performance.now(), n !== t && HC(n) && e && n.select();
  }
};
function Ym(n, e) {
  const t = [...n], i = n.indexOf(e);
  return i !== -1 && t.splice(i, 1), t;
}
var WC = () => {
  let n = [];
  return {
    push: (i) => {
      const r = n[0];
      r && i !== r && r.pause(), n = Ym(n, i), n.unshift(i);
    },
    remove: (i) => {
      var r, s;
      n = Ym(n, i), (s = (r = n[0]) == null ? void 0 : r.resume) == null || s.call(r);
    }
  };
};
var jC = (n, e = false) => {
  const t = document.activeElement;
  for (const i of n)
    if (Pr(i, e), document.activeElement !== t)
      return;
};
var Jm = WC();
var $C = () => bu.value > Nf.value;
var zl = () => {
  Df.value = "pointer", bu.value = window.performance.now();
};
var Km = () => {
  Df.value = "keyboard", bu.value = window.performance.now();
};
var ZC = () => (onMounted(() => {
  Fl === 0 && (document.addEventListener("mousedown", zl), document.addEventListener("touchstart", zl), document.addEventListener("keydown", Km)), Fl++;
}), onBeforeUnmount(() => {
  Fl--, Fl <= 0 && (document.removeEventListener("mousedown", zl), document.removeEventListener("touchstart", zl), document.removeEventListener("keydown", Km));
}), {
  focusReason: Df,
  lastUserFocusTimestamp: bu,
  lastAutomatedFocusTimestamp: Nf
});
var Ul = (n) => new CustomEvent(zC, {
  ...UC,
  detail: n
});
var XC = defineComponent({
  name: "ElFocusTrap",
  inheritAttrs: false,
  props: {
    loop: Boolean,
    trapped: Boolean,
    focusTrapEl: Object,
    focusStartEl: {
      type: [Object, String],
      default: "first"
    }
  },
  emits: [
    $m,
    Zm,
    "focusin",
    "focusout",
    "focusout-prevented",
    "release-requested"
  ],
  setup(n, { emit: e }) {
    const t = ref();
    let i, r;
    const { focusReason: s } = ZC();
    DA((p) => {
      n.trapped && !o.paused && e("release-requested", p);
    });
    const o = {
      paused: false,
      pause() {
        this.paused = true;
      },
      resume() {
        this.paused = false;
      }
    }, a = (p) => {
      if (!n.loop && !n.trapped || o.paused)
        return;
      const { key: u, altKey: y, ctrlKey: v, metaKey: m, currentTarget: x, shiftKey: M } = p, { loop: T } = n, w = u === Pi.tab && !y && !v && !m, _ = document.activeElement;
      if (w && _) {
        const E = x, [P, S] = GC(E);
        if (P && S) {
          if (!M && _ === S) {
            const A = Ul({
              focusReason: s.value
            });
            e("focusout-prevented", A), A.defaultPrevented || (p.preventDefault(), T && Pr(P, true));
          } else if (M && [P, E].includes(_)) {
            const A = Ul({
              focusReason: s.value
            });
            e("focusout-prevented", A), A.defaultPrevented || (p.preventDefault(), T && Pr(S, true));
          }
        } else if (_ === E) {
          const A = Ul({
            focusReason: s.value
          });
          e("focusout-prevented", A), A.defaultPrevented || p.preventDefault();
        }
      }
    };
    provide(VC, {
      focusTrapRef: t,
      onKeydown: a
    }), watch(() => n.focusTrapEl, (p) => {
      p && (t.value = p);
    }, { immediate: true }), watch([t], ([p], [u]) => {
      p && (p.addEventListener("keydown", a), p.addEventListener("focusin", d), p.addEventListener("focusout", h4)), u && (u.removeEventListener("keydown", a), u.removeEventListener("focusin", d), u.removeEventListener("focusout", h4));
    });
    const c = (p) => {
      e($m, p);
    }, l = (p) => e(Zm, p), d = (p) => {
      const u = unref(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 : Pr(r, true));
    }, h4 = (p) => {
      const u = unref(t);
      if (!(o.paused || !u))
        if (n.trapped) {
          const y = p.relatedTarget;
          !rr(y) && !u.contains(y) && setTimeout(() => {
            if (!o.paused && n.trapped) {
              const v = Ul({
                focusReason: s.value
              });
              e("focusout-prevented", v), v.defaultPrevented || Pr(r, true);
            }
          }, 0);
        } else {
          const y = p.target;
          y && u.contains(y) || e("focusout", p);
        }
    };
    async function f() {
      await nextTick();
      const p = unref(t);
      if (p) {
        Jm.push(o);
        const u = p.contains(document.activeElement) ? i : document.activeElement;
        if (i = u, !p.contains(u)) {
          const v = new Event(Ku, jm);
          p.addEventListener(Ku, c), p.dispatchEvent(v), v.defaultPrevented || nextTick(() => {
            let m = n.focusStartEl;
            Ln(m) || (Pr(m), document.activeElement !== m && (m = "first")), m === "first" && jC(uy(p), true), (document.activeElement === u || m === "container") && Pr(p);
          });
        }
      }
    }
    function g() {
      const p = unref(t);
      if (p) {
        p.removeEventListener(Ku, c);
        const u = new CustomEvent(qu, {
          ...jm,
          detail: {
            focusReason: s.value
          }
        });
        p.addEventListener(qu, l), p.dispatchEvent(u), !u.defaultPrevented && (s.value == "keyboard" || !$C() || p.contains(document.activeElement)) && Pr(i ?? document.body), p.removeEventListener(qu, l), Jm.remove(o);
      }
    }
    return onMounted(() => {
      n.trapped && f(), watch(() => n.trapped, (p) => {
        p ? f() : g();
      });
    }), onBeforeUnmount(() => {
      n.trapped && g(), t.value && (t.value.removeEventListener("keydown", a), t.value.removeEventListener("focusin", d), t.value.removeEventListener("focusout", h4), t.value = void 0);
    }), {
      onKeydown: a
    };
  }
});
function YC(n, e, t, i, r, s) {
  return renderSlot(n.$slots, "default", { handleKeydown: n.onKeydown });
}
var JC = ct(XC, [["render", YC], ["__file", "focus-trap.vue"]]);
var KC = ["fixed", "absolute"];
var qC = ft({
  boundariesPadding: {
    type: Number,
    default: 0
  },
  fallbackPlacements: {
    type: Je(Array),
    default: void 0
  },
  gpuAcceleration: {
    type: Boolean,
    default: true
  },
  offset: {
    type: Number,
    default: 12
  },
  placement: {
    type: String,
    values: ia,
    default: "bottom"
  },
  popperOptions: {
    type: Je(Object),
    default: () => ({})
  },
  strategy: {
    type: String,
    values: KC,
    default: "absolute"
  }
});
var hy = ft({
  ...qC,
  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: true
  },
  pure: Boolean,
  focusOnShow: {
    type: Boolean,
    default: false
  },
  trapping: {
    type: Boolean,
    default: false
  },
  popperClass: {
    type: Je([String, Array, Object])
  },
  popperStyle: {
    type: Je([String, Array, Object])
  },
  referenceEl: {
    type: Je(Object)
  },
  triggerTargetEl: {
    type: Je(Object)
  },
  stopPopperMouseEvent: {
    type: Boolean,
    default: true
  },
  virtualTriggering: Boolean,
  zIndex: Number,
  ...Gs(["ariaLabel"])
});
var QC = {
  mouseenter: (n) => n instanceof MouseEvent,
  mouseleave: (n) => n instanceof MouseEvent,
  focus: () => true,
  blur: () => true,
  close: () => true
};
var e2 = (n, e = []) => {
  const { placement: t, strategy: i, popperOptions: r } = n, s = {
    placement: t,
    strategy: i,
    ...r,
    modifiers: [...n2(n), ...e]
  };
  return i2(s, r == null ? void 0 : r.modifiers), s;
};
var t2 = (n) => {
  if (Qt)
    return nr(n);
};
function n2(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 i2(n, e) {
  e && (n.modifiers = [...n.modifiers, ...e ?? []]);
}
var r2 = 0;
var s2 = (n) => {
  const { popperInstanceRef: e, contentRef: t, triggerRef: i, role: r } = inject(If, void 0), s = ref(), o = ref(), a = computed(() => ({
    name: "eventListeners",
    enabled: !!n.visible
  })), c = computed(() => {
    var v;
    const m = unref(s), x = (v = unref(o)) != null ? v : r2;
    return {
      name: "arrow",
      enabled: !VT(m),
      options: {
        element: m,
        padding: x
      }
    };
  }), l = computed(() => ({
    onFirstUpdate: () => {
      p();
    },
    ...e2(n, [
      unref(c),
      unref(a)
    ])
  })), d = computed(() => t2(n.referenceEl) || unref(i)), { attributes: h4, state: f, styles: g, update: p, forceUpdate: u, instanceRef: y } = PA(d, t, l);
  return watch(y, (v) => e.value = v), onMounted(() => {
    watch(() => {
      var v;
      return (v = unref(d)) == null ? void 0 : v.getBoundingClientRect();
    }, () => {
      p();
    });
  }), {
    attributes: h4,
    arrowRef: s,
    contentRef: t,
    instanceRef: y,
    state: f,
    styles: g,
    role: r,
    forceUpdate: u,
    update: p
  };
};
var o2 = (n, {
  attributes: e,
  styles: t,
  role: i
}) => {
  const { nextZIndex: r } = Q0(), s = st("popper"), o = computed(() => unref(e).popper), a = ref(bt(n.zIndex) ? n.zIndex : r()), c = computed(() => [
    s.b(),
    s.is("pure", n.pure),
    s.is(n.effect),
    n.popperClass
  ]), l = computed(() => [
    { zIndex: unref(a) },
    unref(t).popper,
    n.popperStyle || {}
  ]), d = computed(() => i.value === "dialog" ? "false" : void 0), h4 = computed(() => unref(t).arrow || {});
  return {
    ariaModal: d,
    arrowStyle: h4,
    contentAttrs: o,
    contentClass: c,
    contentStyle: l,
    contentZIndex: a,
    updateZIndex: () => {
      a.value = bt(n.zIndex) ? n.zIndex : r();
    }
  };
};
var a2 = (n, e) => {
  const t = ref(false), i = ref();
  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 = true);
    },
    onFocusoutPrevented: (l) => {
      n.trapping || (l.detail.focusReason === "pointer" && l.preventDefault(), t.value = false);
    },
    onReleaseRequested: () => {
      t.value = false, e("close");
    }
  };
};
var l2 = defineComponent({
  name: "ElPopperContent"
});
var c2 = defineComponent({
  ...l2,
  props: hy,
  emits: QC,
  setup(n, { expose: e, emit: t }) {
    const i = n, {
      focusStartRef: r,
      trapped: s,
      onFocusAfterReleased: o,
      onFocusAfterTrapped: a,
      onFocusInTrap: c,
      onFocusoutPrevented: l,
      onReleaseRequested: d
    } = a2(i, t), { attributes: h4, arrowRef: f, contentRef: g, styles: p, instanceRef: u, role: y, update: v } = s2(i), {
      ariaModal: m,
      arrowStyle: x,
      contentAttrs: M,
      contentClass: T,
      contentStyle: w,
      updateZIndex: _
    } = o2(i, {
      styles: p,
      attributes: h4,
      role: y
    }), E = inject(Kc, void 0), P = ref();
    provide(sy, {
      arrowStyle: x,
      arrowRef: f,
      arrowOffset: P
    }), E && provide(Kc, {
      ...E,
      addInputId: $a,
      removeInputId: $a
    });
    let S;
    const R = (C = true) => {
      v(), C && _();
    }, A = () => {
      R(false), i.visible && i.focusOnShow ? s.value = true : i.visible === false && (s.value = false);
    };
    return onMounted(() => {
      watch(() => i.triggerTargetEl, (C, L) => {
        S == null || S(), S = void 0;
        const I = unref(C || g.value), b = unref(L || g.value);
        Ms(I) && (S = watch([y, () => i.ariaLabel, m, () => i.id], (O) => {
          ["role", "aria-label", "aria-modal", "id"].forEach((N, D) => {
            rr(O[D]) ? I.removeAttribute(N) : I.setAttribute(N, O[D]);
          });
        }, { immediate: true })), b !== I && Ms(b) && ["role", "aria-label", "aria-modal", "id"].forEach((O) => {
          b.removeAttribute(O);
        });
      }, { immediate: true }), watch(() => i.visible, A, { immediate: true });
    }), onBeforeUnmount(() => {
      S == null || S(), S = void 0;
    }), e({
      popperContentRef: g,
      popperInstanceRef: u,
      updatePopper: R,
      contentStyle: w
    }), (C, L) => (openBlock(), createElementBlock("div", mergeProps({
      ref_key: "contentRef",
      ref: g
    }, unref(M), {
      style: unref(w),
      class: unref(T),
      tabindex: "-1",
      onMouseenter: (I) => C.$emit("mouseenter", I),
      onMouseleave: (I) => C.$emit("mouseleave", I)
    }), [
      createVNode(unref(JC), {
        trapped: unref(s),
        "trap-on-focus-in": true,
        "focus-trap-el": unref(g),
        "focus-start-el": unref(r),
        onFocusAfterTrapped: unref(a),
        onFocusAfterReleased: unref(o),
        onFocusin: unref(c),
        onFocusoutPrevented: unref(l),
        onReleaseRequested: unref(d)
      }, {
        default: withCtx(() => [
          renderSlot(C.$slots, "default")
        ]),
        _: 3
      }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
    ], 16, ["onMouseenter", "onMouseleave"]));
  }
});
var u2 = ct(c2, [["__file", "content.vue"]]);
var h2 = fn(RC);
var Bf = Symbol("elTooltip");
var Hn = ft({
  ...FA,
  ...hy,
  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: true
  },
  disabled: Boolean,
  ...Gs(["ariaLabel"])
});
var Ka = ft({
  ...cy,
  disabled: Boolean,
  trigger: {
    type: Je([String, Array]),
    default: "hover"
  },
  triggerKeys: {
    type: Je(Array),
    default: () => [Pi.enter, Pi.space]
  }
});
var {
  useModelToggleProps: d2,
  useModelToggleEmits: f2,
  useModelToggle: p2
} = CE("visible");
var m2 = ft({
  ...oy,
  ...d2,
  ...Hn,
  ...Ka,
  ...ay,
  showArrow: {
    type: Boolean,
    default: true
  }
});
var g2 = [
  ...f2,
  "before-show",
  "before-hide",
  "show",
  "hide",
  "open",
  "close"
];
var v2 = (n, e) => Nn(n) ? n.includes(e) : n === e;
var Js = (n, e, t) => (i) => {
  v2(unref(n), e) && t(i);
};
var y2 = defineComponent({
  name: "ElTooltipTrigger"
});
var b2 = defineComponent({
  ...y2,
  props: Ka,
  setup(n, { expose: e }) {
    const t = n, i = st("tooltip"), { controlled: r, id: s, open: o, onOpen: a, onClose: c, onToggle: l } = inject(Bf, void 0), d = ref(null), h4 = () => {
      if (unref(r) || t.disabled)
        return true;
    }, f = toRef(t, "trigger"), g = qi(h4, Js(f, "hover", a)), p = qi(h4, Js(f, "hover", c)), u = qi(h4, Js(f, "click", (M) => {
      M.button === 0 && l(M);
    })), y = qi(h4, Js(f, "focus", a)), v = qi(h4, Js(f, "focus", c)), m = qi(h4, Js(f, "contextmenu", (M) => {
      M.preventDefault(), l(M);
    })), x = qi(h4, (M) => {
      const { code: T } = M;
      t.triggerKeys.includes(T) && (M.preventDefault(), l(M));
    });
    return e({
      triggerRef: d
    }), (M, T) => (openBlock(), createBlock(unref(FC), {
      id: unref(s),
      "virtual-ref": M.virtualRef,
      open: unref(o),
      "virtual-triggering": M.virtualTriggering,
      class: normalizeClass(unref(i).e("trigger")),
      onBlur: unref(v),
      onClick: unref(u),
      onContextmenu: unref(m),
      onFocus: unref(y),
      onMouseenter: unref(g),
      onMouseleave: unref(p),
      onKeydown: unref(x)
    }, {
      default: withCtx(() => [
        renderSlot(M.$slots, "default")
      ]),
      _: 3
    }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]));
  }
});
var x2 = ct(b2, [["__file", "trigger.vue"]]);
var w2 = ft({
  to: {
    type: Je([String, Object]),
    required: true
  },
  disabled: Boolean
});
var M2 = defineComponent({
  __name: "teleport",
  props: w2,
  setup(n) {
    return (e, t) => e.disabled ? renderSlot(e.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport, {
      key: 1,
      to: e.to
    }, [
      renderSlot(e.$slots, "default")
    ], 8, ["to"]));
  }
});
var _2 = ct(M2, [["__file", "teleport.vue"]]);
var S2 = fn(_2);
var T2 = defineComponent({
  name: "ElTooltipContent",
  inheritAttrs: false
});
var E2 = defineComponent({
  ...T2,
  props: Hn,
  setup(n, { expose: e }) {
    const t = n, { selector: i } = Y0(), r = st("tooltip"), s = ref(null);
    let o;
    const {
      controlled: a,
      id: c,
      open: l,
      trigger: d,
      onClose: h4,
      onOpen: f,
      onShow: g,
      onHide: p,
      onBeforeShow: u,
      onBeforeHide: y
    } = inject(Bf, void 0), v = computed(() => t.transition || `${r.namespace.value}-fade-in-linear`), m = computed(() => false ? true : t.persistent);
    onBeforeUnmount(() => {
      o == null || o();
    });
    const x = computed(() => unref(m) ? true : unref(l)), M = computed(() => t.disabled ? false : unref(l)), T = computed(() => t.appendTo || i.value), w = computed(() => {
      var b;
      return (b = t.style) != null ? b : {};
    }), _ = ref(true), E = () => {
      p(), _.value = true;
    }, P = () => {
      if (unref(a))
        return true;
    }, S = qi(P, () => {
      t.enterable && unref(d) === "hover" && f();
    }), R = qi(P, () => {
      unref(d) === "hover" && h4();
    }), A = () => {
      var b, O;
      (O = (b = s.value) == null ? void 0 : b.updatePopper) == null || O.call(b), u == null || u();
    }, C = () => {
      y == null || y();
    }, L = () => {
      g(), o = R1(computed(() => {
        var b;
        return (b = s.value) == null ? void 0 : b.popperContentRef;
      }), () => {
        if (unref(a))
          return;
        unref(d) !== "hover" && h4();
      });
    }, I = () => {
      t.virtualTriggering || h4();
    };
    return watch(() => unref(l), (b) => {
      b ? _.value = false : o == null || o();
    }, {
      flush: "post"
    }), watch(() => t.content, () => {
      var b, O;
      (O = (b = s.value) == null ? void 0 : b.updatePopper) == null || O.call(b);
    }), e({
      contentRef: s
    }), (b, O) => (openBlock(), createBlock(unref(S2), {
      disabled: !b.teleported,
      to: unref(T)
    }, {
      default: withCtx(() => [
        createVNode(Transition, {
          name: unref(v),
          onAfterLeave: E,
          onBeforeEnter: A,
          onAfterEnter: L,
          onBeforeLeave: C
        }, {
          default: withCtx(() => [
            unref(x) ? withDirectives((openBlock(), createBlock(unref(u2), mergeProps({
              key: 0,
              id: unref(c),
              ref_key: "contentRef",
              ref: s
            }, b.$attrs, {
              "aria-label": b.ariaLabel,
              "aria-hidden": _.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, unref(w)],
              "reference-el": b.referenceEl,
              "trigger-target-el": b.triggerTargetEl,
              visible: unref(M),
              "z-index": b.zIndex,
              onMouseenter: unref(S),
              onMouseleave: unref(R),
              onBlur: I,
              onClose: unref(h4)
            }), {
              default: withCtx(() => [
                renderSlot(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"])), [
              [vShow, unref(M)]
            ]) : createCommentVNode("v-if", true)
          ]),
          _: 3
        }, 8, ["name"])
      ]),
      _: 3
    }, 8, ["disabled", "to"]));
  }
});
var A2 = ct(E2, [["__file", "content.vue"]]);
var C2 = defineComponent({
  name: "ElTooltip"
});
var L2 = defineComponent({
  ...C2,
  props: m2,
  emits: g2,
  setup(n, { expose: e, emit: t }) {
    const i = n;
    BA();
    const r = vu(), s = ref(), o = ref(), a = () => {
      var v;
      const m = unref(s);
      m && ((v = m.popperInstanceRef) == null || v.update());
    }, c = ref(false), l = ref(), { show: d, hide: h4, hasUpdateHandler: f } = p2({
      indicator: c,
      toggleReason: l
    }), { onOpen: g, onClose: p } = zA({
      showAfter: toRef(i, "showAfter"),
      hideAfter: toRef(i, "hideAfter"),
      autoClose: toRef(i, "autoClose"),
      open: d,
      close: h4
    }), u = computed(() => gf(i.visible) && !f.value);
    provide(Bf, {
      controlled: u,
      id: r,
      open: readonly(c),
      trigger: toRef(i, "trigger"),
      onOpen: (v) => {
        g(v);
      },
      onClose: (v) => {
        p(v);
      },
      onToggle: (v) => {
        unref(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
    }), watch(() => i.disabled, (v) => {
      v && c.value && (c.value = false);
    });
    const y = (v) => {
      var m, x;
      const M = (x = (m = o.value) == null ? void 0 : m.contentRef) == null ? void 0 : x.popperContentRef, T = (v == null ? void 0 : v.relatedTarget) || document.activeElement;
      return M && M.contains(T);
    };
    return onDeactivated(() => c.value && h4()), e({
      popperRef: s,
      contentRef: o,
      isFocusInsideContent: y,
      updatePopper: a,
      onOpen: g,
      onClose: p,
      hide: h4
    }), (v, m) => (openBlock(), createBlock(unref(h2), {
      ref_key: "popperRef",
      ref: s,
      role: v.role
    }, {
      default: withCtx(() => [
        createVNode(x2, {
          disabled: v.disabled,
          trigger: v.trigger,
          "trigger-keys": v.triggerKeys,
          "virtual-ref": v.virtualRef,
          "virtual-triggering": v.virtualTriggering
        }, {
          default: withCtx(() => [
            v.$slots.default ? renderSlot(v.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
          ]),
          _: 3
        }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
        createVNode(A2, {
          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: withCtx(() => [
            renderSlot(v.$slots, "content", {}, () => [
              v.rawContent ? (openBlock(), createElementBlock("span", {
                key: 0,
                innerHTML: v.content
              }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(v.content), 1))
            ]),
            v.showArrow ? (openBlock(), createBlock(unref(IC), {
              key: 0,
              "arrow-offset": v.arrowOffset
            }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
          ]),
          _: 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 R2 = ct(L2, [["__file", "tooltip.vue"]]);
var Ff = fn(R2);
var dy = Symbol("buttonGroupContextKey");
var P2 = (n, e) => {
  xE({
    from: "type.text",
    replacement: "link",
    version: "3.0.0",
    scope: "props",
    ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  }, computed(() => n.type === "text"));
  const t = inject(dy, void 0), i = Lf("button"), { form: r } = gl(), s = ra(computed(() => t == null ? void 0 : t.size)), o = yu(), a = ref(), c = useSlots(), l = computed(() => n.type || (t == null ? void 0 : t.type) || ""), d = computed(() => {
    var p, u, y;
    return (y = (u = n.autoInsertSpace) != null ? u : (p = i.value) == null ? void 0 : p.autoInsertSpace) != null ? y : false;
  }), h4 = computed(() => n.tag === "button" ? {
    ariaDisabled: o.value || n.loading,
    disabled: o.value || n.loading,
    autofocus: n.autofocus,
    type: n.nativeType
  } : {}), f = computed(() => {
    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) === Text) {
        const v = y.children;
        return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(v.trim());
      }
    }
    return false;
  });
  return {
    _disabled: o,
    _size: s,
    _type: l,
    _ref: a,
    _props: h4,
    shouldAddSpace: f,
    handleClick: (p) => {
      if (o.value || n.loading) {
        p.stopPropagation();
        return;
      }
      n.nativeType === "reset" && (r == null || r.resetFields()), e("click", p);
    }
  };
};
var O2 = [
  "default",
  "primary",
  "success",
  "warning",
  "info",
  "danger",
  "text",
  ""
];
var I2 = ["button", "submit", "reset"];
var fd = ft({
  size: Do,
  disabled: Boolean,
  type: {
    type: String,
    values: O2,
    default: ""
  },
  icon: {
    type: $r
  },
  nativeType: {
    type: String,
    values: I2,
    default: "button"
  },
  loading: Boolean,
  loadingIcon: {
    type: $r,
    default: () => R0
  },
  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"
  }
});
var D2 = {
  click: (n) => n instanceof MouseEvent
};
function yn(n, e) {
  N2(n) && (n = "100%");
  var t = B2(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 Vl(n) {
  return Math.min(1, Math.max(0, n));
}
function N2(n) {
  return typeof n == "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
}
function B2(n) {
  return typeof n == "string" && n.indexOf("%") !== -1;
}
function fy(n) {
  return n = parseFloat(n), (isNaN(n) || n < 0 || n > 1) && (n = 1), n;
}
function kl(n) {
  return n <= 1 ? "".concat(Number(n) * 100, "%") : n;
}
function bs(n) {
  return n.length === 1 ? "0" + n : String(n);
}
function F2(n, e, t) {
  return {
    r: yn(n, 255) * 255,
    g: yn(e, 255) * 255,
    b: yn(t, 255) * 255
  };
}
function qm(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 Qu(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 z2(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 = Qu(a, o, n + 1 / 3), r = Qu(a, o, n), s = Qu(a, o, n - 1 / 3);
  }
  return { r: i * 255, g: r * 255, b: s * 255 };
}
function Qm(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 U2(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], h4 = [s, s, a, t, t, o][c];
  return { r: l * 255, g: d * 255, b: h4 * 255 };
}
function eg(n, e, t, i) {
  var r = [
    bs(Math.round(n).toString(16)),
    bs(Math.round(e).toString(16)),
    bs(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 V2(n, e, t, i, r) {
  var s = [
    bs(Math.round(n).toString(16)),
    bs(Math.round(e).toString(16)),
    bs(Math.round(t).toString(16)),
    bs(k2(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 k2(n) {
  return Math.round(parseFloat(n) * 255).toString(16);
}
function tg(n) {
  return Gn(n) / 255;
}
function Gn(n) {
  return parseInt(n, 16);
}
function G2(n) {
  return {
    r: n >> 16,
    g: (n & 65280) >> 8,
    b: n & 255
  };
}
var pd = {
  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 H2(n) {
  var e = { r: 0, g: 0, b: 0 }, t = 1, i = null, r = null, s = null, o = false, a = false;
  return typeof n == "string" && (n = $2(n)), typeof n == "object" && (Wi(n.r) && Wi(n.g) && Wi(n.b) ? (e = F2(n.r, n.g, n.b), o = true, a = String(n.r).substr(-1) === "%" ? "prgb" : "rgb") : Wi(n.h) && Wi(n.s) && Wi(n.v) ? (i = kl(n.s), r = kl(n.v), e = U2(n.h, i, r), o = true, a = "hsv") : Wi(n.h) && Wi(n.s) && Wi(n.l) && (i = kl(n.s), s = kl(n.l), e = z2(n.h, i, s), o = true, a = "hsl"), Object.prototype.hasOwnProperty.call(n, "a") && (t = n.a)), t = fy(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 W2 = "[-\\+]?\\d+%?";
var j2 = "[-\\+]?\\d*\\.\\d+%?";
var Fr = "(?:".concat(j2, ")|(?:").concat(W2, ")");
var eh = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?");
var th = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?");
var di = {
  CSS_UNIT: new RegExp(Fr),
  rgb: new RegExp("rgb" + eh),
  rgba: new RegExp("rgba" + th),
  hsl: new RegExp("hsl" + eh),
  hsla: new RegExp("hsla" + th),
  hsv: new RegExp("hsv" + eh),
  hsva: new RegExp("hsva" + th),
  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 $2(n) {
  if (n = n.trim().toLowerCase(), n.length === 0)
    return false;
  var e = false;
  if (pd[n])
    n = pd[n], e = true;
  else if (n === "transparent")
    return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  var t = di.rgb.exec(n);
  return t ? { r: t[1], g: t[2], b: t[3] } : (t = di.rgba.exec(n), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = di.hsl.exec(n), t ? { h: t[1], s: t[2], l: t[3] } : (t = di.hsla.exec(n), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = di.hsv.exec(n), t ? { h: t[1], s: t[2], v: t[3] } : (t = di.hsva.exec(n), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = di.hex8.exec(n), t ? {
    r: Gn(t[1]),
    g: Gn(t[2]),
    b: Gn(t[3]),
    a: tg(t[4]),
    format: e ? "name" : "hex8"
  } : (t = di.hex6.exec(n), t ? {
    r: Gn(t[1]),
    g: Gn(t[2]),
    b: Gn(t[3]),
    format: e ? "name" : "hex"
  } : (t = di.hex4.exec(n), t ? {
    r: Gn(t[1] + t[1]),
    g: Gn(t[2] + t[2]),
    b: Gn(t[3] + t[3]),
    a: tg(t[4] + t[4]),
    format: e ? "name" : "hex8"
  } : (t = di.hex3.exec(n), t ? {
    r: Gn(t[1] + t[1]),
    g: Gn(t[2] + t[2]),
    b: Gn(t[3] + t[3]),
    format: e ? "name" : "hex"
  } : false)))))))));
}
function Wi(n) {
  return !!di.CSS_UNIT.exec(String(n));
}
var Z2 = (
  /** @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 = G2(e)), this.originalInput = e;
      var r = H2(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 = fy(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 = Qm(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 = Qm(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 = qm(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 = qm(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 = false), eg(this.r, this.g, this.b, e);
    }, n.prototype.toHexString = function(e) {
      return e === void 0 && (e = false), "#" + this.toHex(e);
    }, n.prototype.toHex8 = function(e) {
      return e === void 0 && (e = false), V2(this.r, this.g, this.b, this.a, e);
    }, n.prototype.toHex8String = function(e) {
      return e === void 0 && (e = false), "#" + this.toHex8(e);
    }, n.prototype.toHexShortString = function(e) {
      return e === void 0 && (e = false), 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 false;
      for (var e = "#" + eg(this.r, this.g, this.b, false), t = 0, i = Object.entries(pd); t < i.length; t++) {
        var r = i[t], s = r[0], o = r[1];
        if (e === o)
          return s;
      }
      return false;
    }, n.prototype.toString = function(e) {
      var t = !!e;
      e = e ?? this.format;
      var i = false, 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(true)), e === "hex4" && (i = this.toHex8String(true)), 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 = Vl(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 = Vl(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 = Vl(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 = Vl(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 wr(n, e = 20) {
  return n.mix("#141414", e).toString();
}
function X2(n) {
  const e = yu(), t = st("button");
  return computed(() => {
    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 Z2(r), a = n.dark ? o.tint(20).toString() : wr(o, 20);
      if (n.plain)
        i = t.cssVarBlock({
          "bg-color": n.dark ? wr(o, 90) : o.tint(90).toString(),
          "text-color": r,
          "border-color": n.dark ? wr(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 ? wr(o, 90) : o.tint(90).toString(), i[t.cssVarBlockName("disabled-text-color")] = n.dark ? wr(o, 50) : o.tint(50).toString(), i[t.cssVarBlockName("disabled-border-color")] = n.dark ? wr(o, 80) : o.tint(80).toString());
      else {
        const c = n.dark ? wr(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 ? wr(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;
  });
}
var Y2 = defineComponent({
  name: "ElButton"
});
var J2 = defineComponent({
  ...Y2,
  props: fd,
  emits: D2,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = X2(i), s = st("button"), { _ref: o, _size: a, _type: c, _disabled: l, _props: d, shouldAddSpace: h4, handleClick: f } = P2(i, t), g = computed(() => [
      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: h4
    }), (p, u) => (openBlock(), createBlock(resolveDynamicComponent(p.tag), mergeProps({
      ref_key: "_ref",
      ref: o
    }, unref(d), {
      class: unref(g),
      style: unref(r),
      onClick: unref(f)
    }), {
      default: withCtx(() => [
        p.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
          p.$slots.loading ? renderSlot(p.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(Ot), {
            key: 1,
            class: normalizeClass(unref(s).is("loading"))
          }, {
            default: withCtx(() => [
              (openBlock(), createBlock(resolveDynamicComponent(p.loadingIcon)))
            ]),
            _: 1
          }, 8, ["class"]))
        ], 64)) : p.icon || p.$slots.icon ? (openBlock(), createBlock(unref(Ot), { key: 1 }, {
          default: withCtx(() => [
            p.icon ? (openBlock(), createBlock(resolveDynamicComponent(p.icon), { key: 0 })) : renderSlot(p.$slots, "icon", { key: 1 })
          ]),
          _: 3
        })) : createCommentVNode("v-if", true),
        p.$slots.default ? (openBlock(), createElementBlock("span", {
          key: 2,
          class: normalizeClass({ [unref(s).em("text", "expand")]: unref(h4) })
        }, [
          renderSlot(p.$slots, "default")
        ], 2)) : createCommentVNode("v-if", true)
      ]),
      _: 3
    }, 16, ["class", "style", "onClick"]));
  }
});
var K2 = ct(J2, [["__file", "button.vue"]]);
var q2 = {
  size: fd.size,
  type: fd.type
};
var Q2 = defineComponent({
  name: "ElButtonGroup"
});
var eL = defineComponent({
  ...Q2,
  props: q2,
  setup(n) {
    const e = n;
    provide(dy, reactive({
      size: toRef(e, "size"),
      type: toRef(e, "type")
    }));
    const t = st("button");
    return (i, r) => (openBlock(), createElementBlock("div", {
      class: normalizeClass(unref(t).b("group"))
    }, [
      renderSlot(i.$slots, "default")
    ], 2));
  }
});
var py = ct(eL, [["__file", "button-group.vue"]]);
var sa = fn(K2, {
  ButtonGroup: py
});
mr(py);
var Nr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function tL(n) {
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
}
function xu(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: true }), Object.keys(n).forEach(function(i) {
    var r = Object.getOwnPropertyDescriptor(n, i);
    Object.defineProperty(t, i, r.get ? r : {
      enumerable: true,
      get: function() {
        return n[i];
      }
    });
  }), t;
}
var Or = /* @__PURE__ */ new Map();
if (Qt) {
  let n;
  document.addEventListener("mousedown", (e) => n = e), document.addEventListener("mouseup", (e) => {
    if (n) {
      for (const t of Or.values())
        for (const { documentHandler: i } of t)
          i(e, n);
      n = void 0;
    }
  });
}
function ng(n, e) {
  let t = [];
  return Array.isArray(e.arg) ? t = e.arg : Ms(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), h4 = 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 || h4 || f || g || e.value(i, r);
  };
}
var nL = {
  beforeMount(n, e) {
    Or.has(n) || Or.set(n, []), Or.get(n).push({
      documentHandler: ng(n, e),
      bindingFn: e.value
    });
  },
  updated(n, e) {
    Or.has(n) || Or.set(n, []);
    const t = Or.get(n), i = t.findIndex((s) => s.bindingFn === e.oldValue), r = {
      documentHandler: ng(n, e),
      bindingFn: e.value
    };
    i >= 0 ? t.splice(i, 1, r) : t.push(r);
  },
  unmounted(n) {
    Or.delete(n);
  }
};
var iL = 100;
var rL = 600;
var ig = {
  beforeMount(n, e) {
    const t = e.value, { interval: i = iL, delay: r = rL } = Tn(t) ? {} : t;
    let s, o;
    const a = () => Tn(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: true
      }), o = setTimeout(() => {
        s = setInterval(() => {
          a();
        }, i);
      }, r));
    });
  }
};
var md = ft({
  type: {
    type: String,
    values: ["primary", "success", "info", "warning", "danger"],
    default: "primary"
  },
  closable: Boolean,
  disableTransitions: Boolean,
  hit: Boolean,
  color: String,
  size: {
    type: String,
    values: D0
  },
  effect: {
    type: String,
    values: ["dark", "light", "plain"],
    default: "light"
  },
  round: Boolean
});
var sL = {
  close: (n) => n instanceof MouseEvent,
  click: (n) => n instanceof MouseEvent
};
var oL = defineComponent({
  name: "ElTag"
});
var aL = defineComponent({
  ...oL,
  props: md,
  emits: sL,
  setup(n, { emit: e }) {
    const t = n, i = ra(), r = st("tag"), s = computed(() => {
      const { type: l, hit: d, effect: h4, closable: f, round: g } = t;
      return [
        r.b(),
        r.is("closable", f),
        r.m(l || "primary"),
        r.m(i.value),
        r.m(h4),
        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 ? (openBlock(), createElementBlock("span", {
      key: 0,
      class: normalizeClass(unref(s)),
      style: normalizeStyle({ backgroundColor: l.color }),
      onClick: a
    }, [
      createBaseVNode("span", {
        class: normalizeClass(unref(r).e("content"))
      }, [
        renderSlot(l.$slots, "default")
      ], 2),
      l.closable ? (openBlock(), createBlock(unref(Ot), {
        key: 0,
        class: normalizeClass(unref(r).e("close")),
        onClick: withModifiers(o, ["stop"])
      }, {
        default: withCtx(() => [
          createVNode(unref(cd))
        ]),
        _: 1
      }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
    ], 6)) : (openBlock(), createBlock(Transition, {
      key: 1,
      name: `${unref(r).namespace.value}-zoom-in-center`,
      appear: "",
      onVnodeMounted: c
    }, {
      default: withCtx(() => [
        createBaseVNode("span", {
          class: normalizeClass(unref(s)),
          style: normalizeStyle({ backgroundColor: l.color }),
          onClick: a
        }, [
          createBaseVNode("span", {
            class: normalizeClass(unref(r).e("content"))
          }, [
            renderSlot(l.$slots, "default")
          ], 2),
          l.closable ? (openBlock(), createBlock(unref(Ot), {
            key: 0,
            class: normalizeClass(unref(r).e("close")),
            onClick: withModifiers(o, ["stop"])
          }, {
            default: withCtx(() => [
              createVNode(unref(cd))
            ]),
            _: 1
          }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
        ], 6)
      ]),
      _: 3
    }, 8, ["name"]));
  }
});
var lL = ct(aL, [["__file", "tag.vue"]]);
var cL = fn(lL);
var my = Symbol("rowContextKey");
var uL = [
  "start",
  "center",
  "end",
  "space-around",
  "space-between",
  "space-evenly"
];
var hL = ["top", "middle", "bottom"];
var dL = ft({
  tag: {
    type: String,
    default: "div"
  },
  gutter: {
    type: Number,
    default: 0
  },
  justify: {
    type: String,
    values: uL,
    default: "start"
  },
  align: {
    type: String,
    values: hL
  }
});
var fL = defineComponent({
  name: "ElRow"
});
var pL = defineComponent({
  ...fL,
  props: dL,
  setup(n) {
    const e = n, t = st("row"), i = computed(() => e.gutter);
    provide(my, {
      gutter: i
    });
    const r = computed(() => {
      const o = {};
      return e.gutter && (o.marginRight = o.marginLeft = `-${e.gutter / 2}px`), o;
    }), s = computed(() => [
      t.b(),
      t.is(`justify-${e.justify}`, e.justify !== "start"),
      t.is(`align-${e.align}`, !!e.align)
    ]);
    return (o, a) => (openBlock(), createBlock(resolveDynamicComponent(o.tag), {
      class: normalizeClass(unref(s)),
      style: normalizeStyle(unref(r))
    }, {
      default: withCtx(() => [
        renderSlot(o.$slots, "default")
      ]),
      _: 3
    }, 8, ["class", "style"]));
  }
});
var mL = ct(pL, [["__file", "row.vue"]]);
var Vi = fn(mL);
var gL = ft({
  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: () => er({})
  },
  sm: {
    type: Je([Number, Object]),
    default: () => er({})
  },
  md: {
    type: Je([Number, Object]),
    default: () => er({})
  },
  lg: {
    type: Je([Number, Object]),
    default: () => er({})
  },
  xl: {
    type: Je([Number, Object]),
    default: () => er({})
  }
});
var vL = defineComponent({
  name: "ElCol"
});
var yL = defineComponent({
  ...vL,
  props: gL,
  setup(n) {
    const e = n, { gutter: t } = inject(my, { gutter: computed(() => 0) }), i = st("col"), r = computed(() => {
      const o = {};
      return t.value && (o.paddingLeft = o.paddingRight = `${t.value / 2}px`), o;
    }), s = computed(() => {
      const o = [];
      return ["span", "offset", "pull", "push"].forEach((l) => {
        const d = e[l];
        bt(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) => {
        bt(e[l]) ? o.push(i.b(`${l}-${e[l]}`)) : An(e[l]) && Object.entries(e[l]).forEach(([d, h4]) => {
          o.push(d !== "span" ? i.b(`${l}-${d}-${h4}`) : i.b(`${l}-${h4}`));
        });
      }), t.value && o.push(i.is("guttered")), [i.b(), o];
    });
    return (o, a) => (openBlock(), createBlock(resolveDynamicComponent(o.tag), {
      class: normalizeClass(unref(s)),
      style: normalizeStyle(unref(r))
    }, {
      default: withCtx(() => [
        renderSlot(o.$slots, "default")
      ]),
      _: 3
    }, 8, ["class", "style"]));
  }
});
var bL = ct(yL, [["__file", "col.vue"]]);
var wi = fn(bL);
var rg = (n) => bt(n) || Ln(n) || Nn(n);
var xL = ft({
  accordion: Boolean,
  modelValue: {
    type: Je([Array, String, Number]),
    default: () => er([])
  }
});
var wL = {
  [Lt]: rg,
  [qr]: rg
};
var gy = Symbol("collapseContextKey");
var ML = (n, e) => {
  const t = ref(Ai(n.modelValue)), i = (s) => {
    t.value = s;
    const o = n.accordion ? t.value[0] : t.value;
    e(Lt, o), e(qr, 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 watch(() => n.modelValue, () => t.value = Ai(n.modelValue), { deep: true }), provide(gy, {
    activeNames: t,
    handleItemClick: r
  }), {
    activeNames: t,
    setActiveNames: i
  };
};
var _L = () => {
  const n = st("collapse");
  return {
    rootKls: computed(() => n.b())
  };
};
var SL = defineComponent({
  name: "ElCollapse"
});
var TL = defineComponent({
  ...SL,
  props: xL,
  emits: wL,
  setup(n, { expose: e, emit: t }) {
    const i = n, { activeNames: r, setActiveNames: s } = ML(i, t), { rootKls: o } = _L();
    return e({
      activeNames: r,
      setActiveNames: s
    }), (a, c) => (openBlock(), createElementBlock("div", {
      class: normalizeClass(unref(o))
    }, [
      renderSlot(a.$slots, "default")
    ], 2));
  }
});
var EL = ct(TL, [["__file", "collapse.vue"]]);
var AL = defineComponent({
  name: "ElCollapseTransition"
});
var CL = defineComponent({
  ...AL,
  setup(n) {
    const e = st("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) => (openBlock(), createBlock(Transition, mergeProps({
      name: unref(e).b()
    }, toHandlers(i)), {
      default: withCtx(() => [
        renderSlot(r.$slots, "default")
      ]),
      _: 3
    }, 16, ["name"]));
  }
});
var LL = ct(CL, [["__file", "collapse-transition.vue"]]);
var RL = fn(LL);
var PL = ft({
  title: {
    type: String,
    default: ""
  },
  name: {
    type: Je([String, Number]),
    default: void 0
  },
  icon: {
    type: $r,
    default: jr
  },
  disabled: Boolean
});
var OL = (n) => {
  const e = inject(gy), { namespace: t } = st("collapse"), i = ref(false), r = ref(false), s = Cf(), o = computed(() => s.current++), a = computed(() => {
    var f;
    return (f = n.name) != null ? f : `${t.value}-id-${s.prefix}-${unref(o)}`;
  }), c = computed(() => e == null ? void 0 : e.activeNames.value.includes(unref(a)));
  return {
    focusing: i,
    id: o,
    isActive: c,
    handleFocus: () => {
      setTimeout(() => {
        r.value ? r.value = false : i.value = true;
      }, 50);
    },
    handleHeaderClick: () => {
      n.disabled || (e == null || e.handleItemClick(unref(a)), i.value = false, r.value = true);
    },
    handleEnterClick: () => {
      e == null || e.handleItemClick(unref(a));
    }
  };
};
var IL = (n, { focusing: e, isActive: t, id: i }) => {
  const r = st("collapse"), s = computed(() => [
    r.b("item"),
    r.is("active", unref(t)),
    r.is("disabled", n.disabled)
  ]), o = computed(() => [
    r.be("item", "header"),
    r.is("active", unref(t)),
    { focusing: unref(e) && !n.disabled }
  ]), a = computed(() => [
    r.be("item", "arrow"),
    r.is("active", unref(t))
  ]), c = computed(() => r.be("item", "wrap")), l = computed(() => r.be("item", "content")), d = computed(() => r.b(`content-${unref(i)}`)), h4 = computed(() => r.b(`head-${unref(i)}`));
  return {
    arrowKls: a,
    headKls: o,
    rootKls: s,
    itemWrapperKls: c,
    itemContentKls: l,
    scopedContentId: d,
    scopedHeadId: h4
  };
};
var DL = defineComponent({
  name: "ElCollapseItem"
});
var NL = defineComponent({
  ...DL,
  props: PL,
  setup(n, { expose: e }) {
    const t = n, {
      focusing: i,
      id: r,
      isActive: s,
      handleFocus: o,
      handleHeaderClick: a,
      handleEnterClick: c
    } = OL(t), {
      arrowKls: l,
      headKls: d,
      rootKls: h4,
      itemWrapperKls: f,
      itemContentKls: g,
      scopedContentId: p,
      scopedHeadId: u
    } = IL(t, { focusing: i, isActive: s, id: r });
    return e({
      isActive: s
    }), (y, v) => (openBlock(), createElementBlock("div", {
      class: normalizeClass(unref(h4))
    }, [
      createBaseVNode("button", {
        id: unref(u),
        class: normalizeClass(unref(d)),
        "aria-expanded": unref(s),
        "aria-controls": unref(p),
        "aria-describedby": unref(p),
        tabindex: y.disabled ? -1 : 0,
        type: "button",
        onClick: unref(a),
        onKeydown: withKeys(withModifiers(unref(c), ["stop", "prevent"]), ["space", "enter"]),
        onFocus: unref(o),
        onBlur: (m) => i.value = false
      }, [
        renderSlot(y.$slots, "title", {}, () => [
          createTextVNode(toDisplayString(y.title), 1)
        ]),
        renderSlot(y.$slots, "icon", { isActive: unref(s) }, () => [
          createVNode(unref(Ot), {
            class: normalizeClass(unref(l))
          }, {
            default: withCtx(() => [
              (openBlock(), createBlock(resolveDynamicComponent(y.icon)))
            ]),
            _: 1
          }, 8, ["class"])
        ])
      ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
      createVNode(unref(RL), null, {
        default: withCtx(() => [
          withDirectives(createBaseVNode("div", {
            id: unref(p),
            role: "region",
            class: normalizeClass(unref(f)),
            "aria-hidden": !unref(s),
            "aria-labelledby": unref(u)
          }, [
            createBaseVNode("div", {
              class: normalizeClass(unref(g))
            }, [
              renderSlot(y.$slots, "default")
            ], 2)
          ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
            [vShow, unref(s)]
          ])
        ]),
        _: 3
      })
    ], 2));
  }
});
var vy = ct(NL, [["__file", "collapse-item.vue"]]);
var yy = fn(EL, {
  CollapseItem: vy
});
var by = mr(vy);
var BL = defineComponent({
  name: "ElContainer"
});
var FL = defineComponent({
  ...BL,
  props: {
    direction: {
      type: String
    }
  },
  setup(n) {
    const e = n, t = useSlots(), i = st("container"), r = computed(() => e.direction === "vertical" ? true : e.direction === "horizontal" ? false : t && t.default ? t.default().some((o) => {
      const a = o.type.name;
      return a === "ElHeader" || a === "ElFooter";
    }) : false);
    return (s, o) => (openBlock(), createElementBlock("section", {
      class: normalizeClass([unref(i).b(), unref(i).is("vertical", unref(r))])
    }, [
      renderSlot(s.$slots, "default")
    ], 2));
  }
});
var zL = ct(FL, [["__file", "container.vue"]]);
var UL = defineComponent({
  name: "ElAside"
});
var VL = defineComponent({
  ...UL,
  props: {
    width: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = st("aside"), i = computed(() => e.width ? t.cssVarBlock({ width: e.width }) : {});
    return (r, s) => (openBlock(), createElementBlock("aside", {
      class: normalizeClass(unref(t).b()),
      style: normalizeStyle(unref(i))
    }, [
      renderSlot(r.$slots, "default")
    ], 6));
  }
});
var xy = ct(VL, [["__file", "aside.vue"]]);
var kL = defineComponent({
  name: "ElFooter"
});
var GL = defineComponent({
  ...kL,
  props: {
    height: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = st("footer"), i = computed(() => e.height ? t.cssVarBlock({ height: e.height }) : {});
    return (r, s) => (openBlock(), createElementBlock("footer", {
      class: normalizeClass(unref(t).b()),
      style: normalizeStyle(unref(i))
    }, [
      renderSlot(r.$slots, "default")
    ], 6));
  }
});
var wy = ct(GL, [["__file", "footer.vue"]]);
var HL = defineComponent({
  name: "ElHeader"
});
var WL = defineComponent({
  ...HL,
  props: {
    height: {
      type: String,
      default: null
    }
  },
  setup(n) {
    const e = n, t = st("header"), i = computed(() => e.height ? t.cssVarBlock({
      height: e.height
    }) : {});
    return (r, s) => (openBlock(), createElementBlock("header", {
      class: normalizeClass(unref(t).b()),
      style: normalizeStyle(unref(i))
    }, [
      renderSlot(r.$slots, "default")
    ], 6));
  }
});
var My = ct(WL, [["__file", "header.vue"]]);
var jL = defineComponent({
  name: "ElMain"
});
var $L = defineComponent({
  ...jL,
  setup(n) {
    const e = st("main");
    return (t, i) => (openBlock(), createElementBlock("main", {
      class: normalizeClass(unref(e).b())
    }, [
      renderSlot(t.$slots, "default")
    ], 2));
  }
});
var _y = ct($L, [["__file", "main.vue"]]);
var ki = fn(zL, {
  Aside: xy,
  Footer: wy,
  Header: My,
  Main: _y
});
mr(xy);
var Sy = mr(wy);
var ZL = mr(My);
var gr = mr(_y);
var XL = defineComponent({
  inheritAttrs: false
});
function YL(n, e, t, i, r, s) {
  return renderSlot(n.$slots, "default");
}
var JL = ct(XL, [["render", YL], ["__file", "collection.vue"]]);
var KL = defineComponent({
  name: "ElCollectionItem",
  inheritAttrs: false
});
function qL(n, e, t, i, r, s) {
  return renderSlot(n.$slots, "default");
}
var QL = ct(KL, [["render", qL], ["__file", "collection-item.vue"]]);
var eR = "data-el-collection-item";
var tR = (n) => {
  const e = `El${n}Collection`, t = `${e}Item`, i = Symbol(e), r = Symbol(t), s = {
    ...JL,
    name: e,
    setup() {
      const a = ref(null), c = /* @__PURE__ */ new Map();
      provide(i, {
        itemMap: c,
        getItems: () => {
          const d = unref(a);
          if (!d)
            return [];
          const h4 = Array.from(d.querySelectorAll(`[${eR}]`));
          return [...c.values()].sort((g, p) => h4.indexOf(g.ref) - h4.indexOf(p.ref));
        },
        collectionRef: a
      });
    }
  }, o = {
    ...QL,
    name: t,
    setup(a, { attrs: c }) {
      const l = ref(null), d = inject(i, void 0);
      provide(r, {
        collectionItemRef: l
      }), onMounted(() => {
        const h4 = unref(l);
        h4 && d.itemMap.set(h4, {
          ref: h4,
          ...c
        });
      }), onBeforeUnmount(() => {
        const h4 = unref(l);
        d.itemMap.delete(h4);
      });
    }
  };
  return {
    COLLECTION_INJECTION_KEY: i,
    COLLECTION_ITEM_INJECTION_KEY: r,
    ElCollection: s,
    ElCollectionItem: o
  };
};
var nh = ft({
  trigger: Ka.trigger,
  effect: {
    ...Hn.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: true
  },
  loop: {
    type: Boolean,
    default: true
  },
  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: Hn.teleported
});
ft({
  command: {
    type: [Object, String, Number],
    default: () => ({})
  },
  disabled: Boolean,
  divided: Boolean,
  textValue: String,
  icon: {
    type: $r
  }
});
ft({
  onKeydown: { type: Je(Function) }
});
tR("Dropdown");
var nR = ft({
  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: Do,
  controls: {
    type: Boolean,
    default: true
  },
  controlsPosition: {
    type: String,
    default: "",
    values: ["", "right"]
  },
  valueOnClear: {
    type: [String, Number, null],
    validator: (n) => n === null || bt(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: true
  },
  ...Gs(["ariaLabel"])
});
var iR = {
  [qr]: (n, e) => e !== n,
  blur: (n) => n instanceof FocusEvent,
  focus: (n) => n instanceof FocusEvent,
  [_s]: (n) => bt(n) || rr(n),
  [Lt]: (n) => bt(n) || rr(n)
};
var rR = defineComponent({
  name: "ElInputNumber"
});
var sR = defineComponent({
  ...rR,
  props: nR,
  emits: iR,
  setup(n, { expose: e, emit: t }) {
    const i = n, { t: r } = mu(), s = st("input-number"), o = ref(), a = reactive({
      currentValue: i.modelValue,
      userInput: null
    }), { formItem: c } = gl(), l = computed(() => bt(i.modelValue) && i.modelValue <= i.min), d = computed(() => bt(i.modelValue) && i.modelValue >= i.max), h4 = computed(() => {
      const I = v(i.step);
      return mi(i.precision) ? Math.max(v(i.modelValue), I) : (I > i.precision && Xt("InputNumber", "precision should not be less than the decimal places of step"), i.precision);
    }), f = computed(() => i.controls && i.controlsPosition === "right"), g = ra(), p = yu(), u = computed(() => {
      if (a.userInput !== null)
        return a.userInput;
      let I = a.currentValue;
      if (rr(I))
        return "";
      if (bt(I)) {
        if (Number.isNaN(I))
          return "";
        mi(i.precision) || (I = I.toFixed(i.precision));
      }
      return I;
    }), y = (I, b) => {
      if (mi(b) && (b = h4.value), b === 0)
        return Math.round(I);
      let O = String(I);
      const N = O.indexOf(".");
      if (N === -1 || !O.replace(".", "").split("")[N + b])
        return I;
      const V = O.length;
      return O.charAt(V - 1) === "5" && (O = `${O.slice(0, Math.max(0, V - 1))}6`), Number.parseFloat(Number(O).toFixed(b));
    }, v = (I) => {
      if (rr(I))
        return 0;
      const b = I.toString(), O = b.indexOf(".");
      let N = 0;
      return O !== -1 && (N = b.length - O - 1), N;
    }, m = (I, b = 1) => bt(I) ? y(I + i.step * b) : a.currentValue, x = () => {
      if (i.readonly || p.value || d.value)
        return;
      const I = Number(u.value) || 0, b = m(I);
      w(b), t(_s, a.currentValue), C();
    }, M = () => {
      if (i.readonly || p.value || l.value)
        return;
      const I = Number(u.value) || 0, b = m(I, -1);
      w(b), t(_s, a.currentValue), C();
    }, T = (I, b) => {
      const { max: O, min: N, step: D, precision: U, stepStrictly: V, valueOnClear: H } = i;
      O < N && na("InputNumber", "min should not be greater than max.");
      let Y = Number(I);
      if (rr(I) || Number.isNaN(Y))
        return null;
      if (I === "") {
        if (H === null)
          return null;
        Y = Ln(H) ? { min: N, max: O }[H] : H;
      }
      return V && (Y = y(Math.round(Y / D) * D, U), Y !== I && b && t(Lt, Y)), mi(U) || (Y = y(Y, U)), (Y > O || Y < N) && (Y = Y > O ? O : N, b && t(Lt, Y)), Y;
    }, w = (I, b = true) => {
      var O;
      const N = a.currentValue, D = T(I);
      if (!b) {
        t(Lt, D);
        return;
      }
      N === D && I || (a.userInput = null, t(Lt, D), N !== D && t(qr, D, N), i.validateEvent && ((O = c == null ? void 0 : c.validate) == null || O.call(c, "change").catch((U) => Xt(U))), a.currentValue = D);
    }, _ = (I) => {
      a.userInput = I;
      const b = I === "" ? null : Number(I);
      t(_s, b), w(b, false);
    }, E = (I) => {
      const b = I !== "" ? Number(I) : "";
      (bt(b) && !Number.isNaN(b) || I === "") && w(b), C(), a.userInput = null;
    }, P = () => {
      var I, b;
      (b = (I = o.value) == null ? void 0 : I.focus) == null || b.call(I);
    }, S = () => {
      var I, b;
      (b = (I = o.value) == null ? void 0 : I.blur) == null || b.call(I);
    }, R = (I) => {
      t("focus", I);
    }, A = (I) => {
      var b;
      a.userInput = null, t("blur", I), i.validateEvent && ((b = c == null ? void 0 : c.validate) == null || b.call(c, "blur").catch((O) => Xt(O)));
    }, C = () => {
      a.currentValue !== i.modelValue && (a.currentValue = i.modelValue);
    }, L = (I) => {
      document.activeElement === I.target && I.preventDefault();
    };
    return watch(() => i.modelValue, (I, b) => {
      const O = T(I, true);
      a.userInput === null && O !== b && (a.currentValue = O);
    }, { immediate: true }), onMounted(() => {
      var I;
      const { min: b, max: O, modelValue: N } = i, D = (I = o.value) == null ? void 0 : I.input;
      if (D.setAttribute("role", "spinbutton"), Number.isFinite(O) ? D.setAttribute("aria-valuemax", String(O)) : D.removeAttribute("aria-valuemax"), Number.isFinite(b) ? D.setAttribute("aria-valuemin", String(b)) : D.removeAttribute("aria-valuemin"), D.setAttribute("aria-valuenow", a.currentValue || a.currentValue === 0 ? String(a.currentValue) : ""), D.setAttribute("aria-disabled", String(p.value)), !bt(N) && N != null) {
        let U = Number(N);
        Number.isNaN(U) && (U = null), t(Lt, U);
      }
      D.addEventListener("wheel", L, { passive: false });
    }), onUpdated(() => {
      var I, b;
      const O = (I = o.value) == null ? void 0 : I.input;
      O == null || O.setAttribute("aria-valuenow", `${(b = a.currentValue) != null ? b : ""}`);
    }), e({
      focus: P,
      blur: S
    }), (I, b) => (openBlock(), createElementBlock("div", {
      class: normalizeClass([
        unref(s).b(),
        unref(s).m(unref(g)),
        unref(s).is("disabled", unref(p)),
        unref(s).is("without-controls", !I.controls),
        unref(s).is("controls-right", unref(f))
      ]),
      onDragstart: withModifiers(() => {
      }, ["prevent"])
    }, [
      I.controls ? withDirectives((openBlock(), createElementBlock("span", {
        key: 0,
        role: "button",
        "aria-label": unref(r)("el.inputNumber.decrease"),
        class: normalizeClass([unref(s).e("decrease"), unref(s).is("disabled", unref(l))]),
        onKeydown: withKeys(M, ["enter"])
      }, [
        renderSlot(I.$slots, "decrease-icon", {}, () => [
          createVNode(unref(Ot), null, {
            default: withCtx(() => [
              unref(f) ? (openBlock(), createBlock(unref(vf), { key: 0 })) : (openBlock(), createBlock(unref(cE), { key: 1 }))
            ]),
            _: 1
          })
        ])
      ], 42, ["aria-label", "onKeydown"])), [
        [unref(ig), M]
      ]) : createCommentVNode("v-if", true),
      I.controls ? withDirectives((openBlock(), createElementBlock("span", {
        key: 1,
        role: "button",
        "aria-label": unref(r)("el.inputNumber.increase"),
        class: normalizeClass([unref(s).e("increase"), unref(s).is("disabled", unref(d))]),
        onKeydown: withKeys(x, ["enter"])
      }, [
        renderSlot(I.$slots, "increase-icon", {}, () => [
          createVNode(unref(Ot), null, {
            default: withCtx(() => [
              unref(f) ? (openBlock(), createBlock(unref(QT), { key: 0 })) : (openBlock(), createBlock(unref(fu), { key: 1 }))
            ]),
            _: 1
          })
        ])
      ], 42, ["aria-label", "onKeydown"])), [
        [unref(ig), x]
      ]) : createCommentVNode("v-if", true),
      createVNode(unref(dC), {
        id: I.id,
        ref_key: "input",
        ref: o,
        type: "number",
        step: I.step,
        "model-value": unref(u),
        placeholder: I.placeholder,
        readonly: I.readonly,
        disabled: unref(p),
        size: unref(g),
        max: I.max,
        min: I.min,
        name: I.name,
        "aria-label": I.ariaLabel,
        "validate-event": false,
        onKeydown: [
          withKeys(withModifiers(x, ["prevent"]), ["up"]),
          withKeys(withModifiers(M, ["prevent"]), ["down"])
        ],
        onBlur: A,
        onFocus: R,
        onInput: _,
        onChange: E
      }, createSlots({ _: 2 }, [
        I.$slots.prefix ? {
          name: "prefix",
          fn: withCtx(() => [
            renderSlot(I.$slots, "prefix")
          ])
        } : void 0,
        I.$slots.suffix ? {
          name: "suffix",
          fn: withCtx(() => [
            renderSlot(I.$slots, "suffix")
          ])
        } : void 0
      ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
    ], 42, ["onDragstart"]));
  }
});
var oR = ct(sR, [["__file", "input-number.vue"]]);
var vr = fn(oR);
var Ty = Symbol("ElSelectGroup");
var wu = Symbol("ElSelect");
function aR(n, e) {
  const t = inject(wu), i = inject(Ty, { disabled: false }), r = computed(() => d(Ai(t.props.modelValue), n.value)), s = computed(() => {
    var g;
    if (t.props.multiple) {
      const p = Ai((g = t.props.modelValue) != null ? g : []);
      return !r.value && p.length >= t.props.multipleLimit && t.props.multipleLimit > 0;
    } else
      return false;
  }), o = computed(() => n.label || (An(n.value) ? "" : n.value)), a = computed(() => n.value || n.label || ""), c = computed(() => n.disabled || e.groupDisabled || s.value), l = getCurrentInstance(), d = (g = [], p) => {
    if (An(n.value)) {
      const u = t.props.valueKey;
      return g && g.some((y) => toRaw(Qi(y, u)) === Qi(p, u));
    } else
      return g && g.includes(p);
  }, h4 = () => {
    !n.disabled && !i.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(l.proxy));
  }, f = (g) => {
    const p = new RegExp($T(g), "i");
    e.visible = p.test(o.value) || n.created;
  };
  return watch(() => o.value, () => {
    !n.created && !t.props.remote && t.setSelected();
  }), watch(() => 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 && An(g) && An(p) && g[y] === p[y])
        return;
      t.setSelected();
    }
  }), watch(() => i.disabled, () => {
    e.groupDisabled = i.disabled;
  }, { immediate: true }), {
    select: t,
    currentLabel: o,
    currentValue: a,
    itemSelected: r,
    isDisabled: c,
    hoverItem: h4,
    updateOption: f
  };
}
var lR = defineComponent({
  name: "ElOption",
  componentName: "ElOption",
  props: {
    value: {
      required: true,
      type: [String, Number, Boolean, Object]
    },
    label: [String, Number],
    created: Boolean,
    disabled: Boolean
  },
  setup(n) {
    const e = st("select"), t = vu(), i = computed(() => [
      e.be("dropdown", "item"),
      e.is("disabled", unref(a)),
      e.is("selected", unref(o)),
      e.is("hovering", unref(f))
    ]), r = reactive({
      index: -1,
      groupDisabled: false,
      visible: true,
      hover: false
    }), {
      currentLabel: s,
      itemSelected: o,
      isDisabled: a,
      select: c,
      hoverItem: l,
      updateOption: d
    } = aR(n, r), { visible: h4, hover: f } = toRefs(r), g = getCurrentInstance().proxy;
    c.onOptionCreate(g), onBeforeUnmount(() => {
      const u = g.value, { selected: y } = c.states, m = (c.props.multiple ? y : [y]).some((x) => x.value === g.value);
      nextTick(() => {
        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: h4,
      hover: f,
      selectOptionClick: p,
      states: r
    };
  }
});
function cR(n, e, t, i, r, s) {
  return withDirectives((openBlock(), createElementBlock("li", {
    id: n.id,
    class: normalizeClass(n.containerKls),
    role: "option",
    "aria-disabled": n.isDisabled || void 0,
    "aria-selected": n.itemSelected,
    onMouseenter: n.hoverItem,
    onClick: withModifiers(n.selectOptionClick, ["stop"])
  }, [
    renderSlot(n.$slots, "default", {}, () => [
      createBaseVNode("span", null, toDisplayString(n.currentLabel), 1)
    ])
  ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [
    [vShow, n.visible]
  ]);
}
var zf = ct(lR, [["render", cR], ["__file", "option.vue"]]);
var uR = defineComponent({
  name: "ElSelectDropdown",
  componentName: "ElSelectDropdown",
  setup() {
    const n = inject(wu), e = st("select"), t = computed(() => n.props.popperClass), i = computed(() => n.props.multiple), r = computed(() => n.props.fitInputWidth), s = ref("");
    function o() {
      var a;
      s.value = `${(a = n.selectRef) == null ? void 0 : a.offsetWidth}px`;
    }
    return onMounted(() => {
      o(), Qn(n.selectRef, o);
    }), {
      ns: e,
      minWidth: s,
      popperClass: t,
      isMultiple: i,
      isFitInputWidth: r
    };
  }
});
function hR(n, e, t, i, r, s) {
  return openBlock(), createElementBlock("div", {
    class: normalizeClass([n.ns.b("dropdown"), n.ns.is("multiple", n.isMultiple), n.popperClass]),
    style: normalizeStyle({ [n.isFitInputWidth ? "width" : "minWidth"]: n.minWidth })
  }, [
    n.$slots.header ? (openBlock(), createElementBlock("div", {
      key: 0,
      class: normalizeClass(n.ns.be("dropdown", "header"))
    }, [
      renderSlot(n.$slots, "header")
    ], 2)) : createCommentVNode("v-if", true),
    renderSlot(n.$slots, "default"),
    n.$slots.footer ? (openBlock(), createElementBlock("div", {
      key: 1,
      class: normalizeClass(n.ns.be("dropdown", "footer"))
    }, [
      renderSlot(n.$slots, "footer")
    ], 2)) : createCommentVNode("v-if", true)
  ], 6);
}
var dR = ct(uR, [["render", hR], ["__file", "select-dropdown.vue"]]);
var fR = 11;
var pR = (n, e) => {
  const { t } = mu(), i = vu(), r = st("select"), s = st("input"), o = reactive({
    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: false,
    menuVisibleOnFocus: false,
    isBeforeHide: false
  }), a = ref(null), c = ref(null), l = ref(null), d = ref(null), h4 = ref(null), f = ref(null), g = ref(null), p = ref(null), u = ref(null), y = ref(null), v = ref(null), m = ref(null), {
    isComposing: x,
    handleCompositionStart: M,
    handleCompositionUpdate: T,
    handleCompositionEnd: w
  } = ny({
    afterComposition: (de) => ie(de)
  }), { wrapperRef: _, isFocused: E } = ty(h4, {
    beforeFocus() {
      return b.value;
    },
    afterFocus() {
      n.automaticDropdown && !P.value && (P.value = true, o.menuVisibleOnFocus = true);
    },
    beforeBlur(de) {
      var Me, Pe;
      return ((Me = l.value) == null ? void 0 : Me.isFocusInsideContent(de)) || ((Pe = d.value) == null ? void 0 : Pe.isFocusInsideContent(de));
    },
    afterBlur() {
      P.value = false, o.menuVisibleOnFocus = false;
    }
  }), P = ref(false), S = ref(), { form: R, formItem: A } = gl(), { inputId: C } = Pf(n, {
    formItemContext: A
  }), { valueOnClear: L, isEmptyValue: I } = YA(n), b = computed(() => n.disabled || (R == null ? void 0 : R.disabled)), O = computed(() => Nn(n.modelValue) ? n.modelValue.length > 0 : !I(n.modelValue)), N = computed(() => n.clearable && !b.value && o.inputHovering && O.value), D = computed(() => n.remote && n.filterable && !n.remoteShowSuffix ? "" : n.suffixIcon), U = computed(() => r.is("reverse", D.value && P.value)), V = computed(() => (A == null ? void 0 : A.validateState) || ""), H = computed(() => I0[V.value]), Y = computed(() => n.remote ? 300 : 0), re = computed(() => n.loading ? n.loadingText || t("el.select.loading") : n.remote && !o.inputValue && o.options.size === 0 ? false : n.filterable && o.inputValue && o.options.size > 0 && ae.value === 0 ? n.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? n.noDataText || t("el.select.noData") : null), ae = computed(() => ee.value.filter((de) => de.visible).length), ee = computed(() => {
    const de = Array.from(o.options.values()), Me = [];
    return o.optionValues.forEach((Pe) => {
      const Ve = de.findIndex((je) => je.value === Pe);
      Ve > -1 && Me.push(de[Ve]);
    }), Me.length >= de.length ? Me : de;
  }), oe = computed(() => Array.from(o.cachedOptions.values())), j = computed(() => {
    const de = ee.value.filter((Me) => !Me.created).some((Me) => Me.currentLabel === o.inputValue);
    return n.filterable && n.allowCreate && o.inputValue !== "" && !de;
  }), K = () => {
    n.filterable && Tn(n.filterMethod) || n.filterable && n.remote && Tn(n.remoteMethod) || ee.value.forEach((de) => {
      var Me;
      (Me = de.updateOption) == null || Me.call(de, o.inputValue);
    });
  }, $ = ra(), ne = computed(() => ["small"].includes($.value) ? "small" : "default"), k = computed({
    get() {
      return P.value && re.value !== false;
    },
    set(de) {
      P.value = de;
    }
  }), W = computed(() => {
    if (n.multiple && !mi(n.modelValue))
      return Ai(n.modelValue).length === 0 && !o.inputValue;
    const de = Nn(n.modelValue) ? n.modelValue[0] : n.modelValue;
    return n.filterable || mi(de) ? !o.inputValue : true;
  }), B = computed(() => {
    var de;
    const Me = (de = n.placeholder) != null ? de : t("el.select.placeholder");
    return n.multiple || !O.value ? Me : o.selectedLabel;
  }), X = computed(() => td ? null : "mouseenter");
  watch(() => n.modelValue, (de, Me) => {
    n.multiple && n.filterable && !n.reserveKeyword && (o.inputValue = "", J("")), z(), !ld(de, Me) && n.validateEvent && (A == null || A.validate("change").catch((Pe) => Xt(Pe)));
  }, {
    flush: "post",
    deep: true
  }), watch(() => P.value, (de) => {
    de ? J(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = true), e("visible-change", de);
  }), watch(() => o.options.entries(), () => {
    var de;
    if (!Qt)
      return;
    const Me = ((de = a.value) == null ? void 0 : de.querySelectorAll("input")) || [];
    (!n.filterable && !n.defaultFirstOption && !mi(n.modelValue) || !Array.from(Me).includes(document.activeElement)) && z(), n.defaultFirstOption && (n.filterable || n.remote) && ae.value && F();
  }, {
    flush: "post"
  }), watch(() => o.hoveringIndex, (de) => {
    bt(de) && de > -1 ? S.value = ee.value[de] || {} : S.value = {}, ee.value.forEach((Me) => {
      Me.hover = S.value === Me;
    });
  }), watchEffect(() => {
    o.isBeforeHide || K();
  });
  const J = (de) => {
    o.previousQuery === de || x.value || (o.previousQuery = de, n.filterable && Tn(n.filterMethod) ? n.filterMethod(de) : n.filterable && n.remote && Tn(n.remoteMethod) && n.remoteMethod(de), n.defaultFirstOption && (n.filterable || n.remote) && ae.value ? nextTick(F) : nextTick(se));
  }, F = () => {
    const de = ee.value.filter((Ve) => Ve.visible && !Ve.disabled && !Ve.states.groupDisabled), Me = de.find((Ve) => Ve.created), Pe = de[0];
    o.hoveringIndex = wt(ee.value, Me || Pe);
  }, z = () => {
    if (n.multiple)
      o.selectedLabel = "";
    else {
      const Me = Nn(n.modelValue) ? n.modelValue[0] : n.modelValue, Pe = te(Me);
      o.selectedLabel = Pe.currentLabel, o.selected = [Pe];
      return;
    }
    const de = [];
    mi(n.modelValue) || Ai(n.modelValue).forEach((Me) => {
      de.push(te(Me));
    }), o.selected = de;
  }, te = (de) => {
    let Me;
    const Pe = ju(de).toLowerCase() === "object", Ve = ju(de).toLowerCase() === "null", je = ju(de).toLowerCase() === "undefined";
    for (let ht = o.cachedOptions.size - 1; ht >= 0; ht--) {
      const kt = oe.value[ht];
      if (Pe ? Qi(kt.value, n.valueKey) === Qi(de, n.valueKey) : kt.value === de) {
        Me = {
          value: de,
          currentLabel: kt.currentLabel,
          get isDisabled() {
            return kt.isDisabled;
          }
        };
        break;
      }
    }
    if (Me)
      return Me;
    const et = Pe ? de.label : !Ve && !je ? de : "";
    return {
      value: de,
      currentLabel: et
    };
  }, se = () => {
    o.hoveringIndex = ee.value.findIndex((de) => o.selected.some((Me) => Se(Me) === Se(de)));
  }, le = () => {
    o.selectionWidth = c.value.getBoundingClientRect().width;
  }, me = () => {
    o.calculatorWidth = f.value.getBoundingClientRect().width;
  }, Te = () => {
    o.collapseItemWidth = v.value.getBoundingClientRect().width;
  }, _e = () => {
    var de, Me;
    (Me = (de = l.value) == null ? void 0 : de.updatePopper) == null || Me.call(de);
  }, fe = () => {
    var de, Me;
    (Me = (de = d.value) == null ? void 0 : de.updatePopper) == null || Me.call(de);
  }, we = () => {
    o.inputValue.length > 0 && !P.value && (P.value = true), J(o.inputValue);
  }, ie = (de) => {
    if (o.inputValue = de.target.value, n.remote)
      pe();
    else
      return we();
  }, pe = ad(() => {
    we();
  }, Y.value), be = (de) => {
    ld(n.modelValue, de) || e(qr, de);
  }, Be = (de) => UT(de, (Me) => !o.disabledOptions.has(Me)), Oe = (de) => {
    if (n.multiple && de.code !== Pi.delete && de.target.value.length <= 0) {
      const Me = Ai(n.modelValue).slice(), Pe = Be(Me);
      if (Pe < 0)
        return;
      const Ve = Me[Pe];
      Me.splice(Pe, 1), e(Lt, Me), be(Me), e("remove-tag", Ve);
    }
  }, $e = (de, Me) => {
    const Pe = o.selected.indexOf(Me);
    if (Pe > -1 && !b.value) {
      const Ve = Ai(n.modelValue).slice();
      Ve.splice(Pe, 1), e(Lt, Ve), be(Ve), e("remove-tag", Me.value);
    }
    de.stopPropagation(), Rt();
  }, ot = (de) => {
    de.stopPropagation();
    const Me = n.multiple ? [] : L.value;
    if (n.multiple)
      for (const Pe of o.selected)
        Pe.isDisabled && Me.push(Pe.value);
    e(Lt, Me), be(Me), o.hoveringIndex = -1, P.value = false, e("clear"), Rt();
  }, qe = (de) => {
    var Me;
    if (n.multiple) {
      const Pe = Ai((Me = n.modelValue) != null ? Me : []).slice(), Ve = wt(Pe, de.value);
      Ve > -1 ? Pe.splice(Ve, 1) : (n.multipleLimit <= 0 || Pe.length < n.multipleLimit) && Pe.push(de.value), e(Lt, Pe), be(Pe), de.created && J(""), n.filterable && !n.reserveKeyword && (o.inputValue = "");
    } else
      e(Lt, de.value), be(de.value), P.value = false;
    Rt(), !P.value && nextTick(() => {
      Ne(de);
    });
  }, wt = (de = [], Me) => {
    if (!An(Me))
      return de.indexOf(Me);
    const Pe = n.valueKey;
    let Ve = -1;
    return de.some((je, et) => toRaw(Qi(je, Pe)) === Qi(Me, Pe) ? (Ve = et, true) : false), Ve;
  }, Ne = (de) => {
    var Me, Pe, Ve, je, et;
    const Ye = Nn(de) ? de[0] : de;
    let ht = null;
    if (Ye != null && Ye.value) {
      const kt = ee.value.filter((an) => an.value === Ye.value);
      kt.length > 0 && (ht = kt[0].$el);
    }
    if (l.value && ht) {
      const kt = (je = (Ve = (Pe = (Me = l.value) == null ? void 0 : Me.popperRef) == null ? void 0 : Pe.contentRef) == null ? void 0 : Ve.querySelector) == null ? void 0 : je.call(Ve, `.${r.be("dropdown", "wrap")}`);
      kt && XT(kt, ht);
    }
    (et = m.value) == null || et.handleScroll();
  }, nt = (de) => {
    o.options.set(de.value, de), o.cachedOptions.set(de.value, de), de.disabled && o.disabledOptions.set(de.value, de);
  }, tt = (de, Me) => {
    o.options.get(de) === Me && o.options.delete(de);
  }, Kt = computed(() => {
    var de, Me;
    return (Me = (de = l.value) == null ? void 0 : de.popperRef) == null ? void 0 : Me.contentRef;
  }), qt = () => {
    o.isBeforeHide = false, nextTick(() => Ne(o.selected));
  }, Rt = () => {
    var de;
    (de = h4.value) == null || de.focus();
  }, Nt = () => {
    var de;
    (de = h4.value) == null || de.blur();
  }, Gi = (de) => {
    ot(de);
  }, Hi = () => {
    P.value = false, E.value && Nt();
  }, oi = () => {
    o.inputValue.length > 0 ? o.inputValue = "" : P.value = false;
  }, ss = () => {
    b.value || (td && (o.inputHovering = true), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = false : P.value = !P.value);
  }, Q = () => {
    P.value ? ee.value[o.hoveringIndex] && qe(ee.value[o.hoveringIndex]) : ss();
  }, Se = (de) => An(de.value) ? Qi(de.value, n.valueKey) : de.value, Ie = computed(() => ee.value.filter((de) => de.visible).every((de) => de.disabled)), He = computed(() => n.multiple ? n.collapseTags ? o.selected.slice(0, n.maxCollapseTags) : o.selected : []), it = computed(() => n.multiple ? n.collapseTags ? o.selected.slice(n.maxCollapseTags) : [] : []), Z = (de) => {
    if (!P.value) {
      P.value = true;
      return;
    }
    if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || x.value) && !Ie.value) {
      de === "next" ? (o.hoveringIndex++, o.hoveringIndex === o.options.size && (o.hoveringIndex = 0)) : de === "prev" && (o.hoveringIndex--, o.hoveringIndex < 0 && (o.hoveringIndex = o.options.size - 1));
      const Me = ee.value[o.hoveringIndex];
      (Me.disabled === true || Me.states.groupDisabled === true || !Me.visible) && Z(de), nextTick(() => Ne(S.value));
    }
  }, ge = () => {
    if (!c.value)
      return 0;
    const de = window.getComputedStyle(c.value);
    return Number.parseFloat(de.gap || "6px");
  }, he = computed(() => {
    const de = ge();
    return { maxWidth: `${v.value && n.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - de : o.selectionWidth}px` };
  }), xe = computed(() => ({ maxWidth: `${o.selectionWidth}px` })), Ae = computed(() => ({
    width: `${Math.max(o.calculatorWidth, fR)}px`
  }));
  return Qn(c, le), Qn(f, me), Qn(u, _e), Qn(_, _e), Qn(y, fe), Qn(v, Te), onMounted(() => {
    z();
  }), {
    inputId: C,
    contentId: i,
    nsSelect: r,
    nsInput: s,
    states: o,
    isFocused: E,
    expanded: P,
    optionsArray: ee,
    hoverOption: S,
    selectSize: $,
    filteredOptionsCount: ae,
    resetCalculatorWidth: me,
    updateTooltip: _e,
    updateTagTooltip: fe,
    debouncedOnInputChange: pe,
    onInput: ie,
    deletePrevTag: Oe,
    deleteTag: $e,
    deleteSelected: ot,
    handleOptionSelect: qe,
    scrollToOption: Ne,
    hasModelValue: O,
    shouldShowPlaceholder: W,
    currentPlaceholder: B,
    mouseEnterEventName: X,
    showClose: N,
    iconComponent: D,
    iconReverse: U,
    validateState: V,
    validateIcon: H,
    showNewOption: j,
    updateOptions: K,
    collapseTagSize: ne,
    setSelected: z,
    selectDisabled: b,
    emptyText: re,
    handleCompositionStart: M,
    handleCompositionUpdate: T,
    handleCompositionEnd: w,
    onOptionCreate: nt,
    onOptionDestroy: tt,
    handleMenuEnter: qt,
    focus: Rt,
    blur: Nt,
    handleClearClick: Gi,
    handleClickOutside: Hi,
    handleEsc: oi,
    toggleMenu: ss,
    selectOption: Q,
    getValueKey: Se,
    navigateOptions: Z,
    dropdownMenuVisible: k,
    showTagList: He,
    collapseTagList: it,
    tagStyle: he,
    collapseTagStyle: xe,
    inputStyle: Ae,
    popperRef: Kt,
    inputRef: h4,
    tooltipRef: l,
    tagTooltipRef: d,
    calculatorRef: f,
    prefixRef: g,
    suffixRef: p,
    selectRef: a,
    wrapperRef: _,
    selectionRef: c,
    scrollbarRef: m,
    menuRef: u,
    tagMenuRef: y,
    collapseItemRef: v
  };
};
var mR = defineComponent({
  name: "ElOptions",
  setup(n, { slots: e }) {
    const t = inject(wu);
    let i = [];
    return () => {
      var r, s;
      const o = (r = e.default) == null ? void 0 : r.call(e), a = [];
      function c(l) {
        Nn(l) && l.forEach((d) => {
          var h4, f, g, p;
          const u = (h4 = (d == null ? void 0 : d.type) || {}) == null ? void 0 : h4.name;
          u === "ElOptionGroup" ? c(!Ln(d.children) && !Nn(d.children) && Tn((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) : Nn(d.children) && c(d.children);
        });
      }
      return o.length && c((s = o[0]) == null ? void 0 : s.children), ld(a, i) || (i = a, t && (t.states.optionValues = a)), o;
    };
  }
});
var gR = ft({
  name: String,
  id: String,
  modelValue: {
    type: [Array, String, Number, Boolean, Object],
    default: void 0
  },
  autocomplete: {
    type: String,
    default: "off"
  },
  automaticDropdown: Boolean,
  size: Do,
  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: true
  },
  valueKey: {
    type: String,
    default: "value"
  },
  collapseTags: Boolean,
  collapseTagsTooltip: Boolean,
  maxCollapseTags: {
    type: Number,
    default: 1
  },
  teleported: Hn.teleported,
  persistent: {
    type: Boolean,
    default: true
  },
  clearIcon: {
    type: $r,
    default: yf
  },
  fitInputWidth: Boolean,
  suffixIcon: {
    type: $r,
    default: vf
  },
  tagType: { ...md.type, default: "info" },
  tagEffect: { ...md.effect, default: "light" },
  validateEvent: {
    type: Boolean,
    default: true
  },
  remoteShowSuffix: Boolean,
  placement: {
    type: Je(String),
    values: ia,
    default: "bottom-start"
  },
  fallbackPlacements: {
    type: Je(Array),
    default: ["bottom-start", "top-start", "right", "left"]
  },
  appendTo: String,
  ...XA,
  ...Gs(["ariaLabel"])
});
var sg = "ElSelect";
var vR = defineComponent({
  name: sg,
  componentName: sg,
  components: {
    ElSelectMenu: dR,
    ElOption: zf,
    ElOptions: mR,
    ElTag: cL,
    ElScrollbar: EC,
    ElTooltip: Ff,
    ElIcon: Ot
  },
  directives: { ClickOutside: nL },
  props: gR,
  emits: [
    Lt,
    qr,
    "remove-tag",
    "clear",
    "visible-change",
    "focus",
    "blur"
  ],
  setup(n, { emit: e }) {
    const t = computed(() => {
      const { modelValue: s, multiple: o } = n, a = o ? [] : void 0;
      return Nn(s) ? o ? s : a : o ? a : s;
    }), i = reactive({
      ...toRefs(n),
      modelValue: t
    }), r = pR(i, e);
    return provide(wu, reactive({
      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 yR(n, e, t, i, r, s) {
  const o = resolveComponent("el-tag"), a = resolveComponent("el-tooltip"), c = resolveComponent("el-icon"), l = resolveComponent("el-option"), d = resolveComponent("el-options"), h4 = resolveComponent("el-scrollbar"), f = resolveComponent("el-select-menu"), g = resolveDirective("click-outside");
  return withDirectives((openBlock(), createElementBlock("div", {
    ref: "selectRef",
    class: normalizeClass([n.nsSelect.b(), n.nsSelect.m(n.selectSize)]),
    [toHandlerKey(n.mouseEnterEventName)]: (p) => n.states.inputHovering = true,
    onMouseleave: (p) => n.states.inputHovering = false
  }, [
    createVNode(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": false,
      "gpu-acceleration": false,
      persistent: n.persistent,
      "append-to": n.appendTo,
      onBeforeShow: n.handleMenuEnter,
      onHide: (p) => n.states.isBeforeHide = false
    }, {
      default: withCtx(() => {
        var p;
        return [
          createBaseVNode("div", {
            ref: "wrapperRef",
            class: normalizeClass([
              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: withModifiers(n.toggleMenu, ["prevent"])
          }, [
            n.$slots.prefix ? (openBlock(), createElementBlock("div", {
              key: 0,
              ref: "prefixRef",
              class: normalizeClass(n.nsSelect.e("prefix"))
            }, [
              renderSlot(n.$slots, "prefix")
            ], 2)) : createCommentVNode("v-if", true),
            createBaseVNode("div", {
              ref: "selectionRef",
              class: normalizeClass([
                n.nsSelect.e("selection"),
                n.nsSelect.is("near", n.multiple && !n.$slots.prefix && !!n.states.selected.length)
              ])
            }, [
              n.multiple ? renderSlot(n.$slots, "tag", { key: 0 }, () => [
                (openBlock(true), createElementBlock(Fragment, null, renderList(n.showTagList, (u) => (openBlock(), createElementBlock("div", {
                  key: n.getValueKey(u),
                  class: normalizeClass(n.nsSelect.e("selected-item"))
                }, [
                  createVNode(o, {
                    closable: !n.selectDisabled && !u.isDisabled,
                    size: n.collapseTagSize,
                    type: n.tagType,
                    effect: n.tagEffect,
                    "disable-transitions": "",
                    style: normalizeStyle(n.tagStyle),
                    onClose: (y) => n.deleteTag(y, u)
                  }, {
                    default: withCtx(() => [
                      createBaseVNode("span", {
                        class: normalizeClass(n.nsSelect.e("tags-text"))
                      }, [
                        renderSlot(n.$slots, "label", {
                          label: u.currentLabel,
                          value: u.value
                        }, () => [
                          createTextVNode(toDisplayString(u.currentLabel), 1)
                        ])
                      ], 2)
                    ]),
                    _: 2
                  }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
                ], 2))), 128)),
                n.collapseTags && n.states.selected.length > n.maxCollapseTags ? (openBlock(), createBlock(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: withCtx(() => [
                    createBaseVNode("div", {
                      ref: "collapseItemRef",
                      class: normalizeClass(n.nsSelect.e("selected-item"))
                    }, [
                      createVNode(o, {
                        closable: false,
                        size: n.collapseTagSize,
                        type: n.tagType,
                        effect: n.tagEffect,
                        "disable-transitions": "",
                        style: normalizeStyle(n.collapseTagStyle)
                      }, {
                        default: withCtx(() => [
                          createBaseVNode("span", {
                            class: normalizeClass(n.nsSelect.e("tags-text"))
                          }, " + " + toDisplayString(n.states.selected.length - n.maxCollapseTags), 3)
                        ]),
                        _: 1
                      }, 8, ["size", "type", "effect", "style"])
                    ], 2)
                  ]),
                  content: withCtx(() => [
                    createBaseVNode("div", {
                      ref: "tagMenuRef",
                      class: normalizeClass(n.nsSelect.e("selection"))
                    }, [
                      (openBlock(true), createElementBlock(Fragment, null, renderList(n.collapseTagList, (u) => (openBlock(), createElementBlock("div", {
                        key: n.getValueKey(u),
                        class: normalizeClass(n.nsSelect.e("selected-item"))
                      }, [
                        createVNode(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: withCtx(() => [
                            createBaseVNode("span", {
                              class: normalizeClass(n.nsSelect.e("tags-text"))
                            }, [
                              renderSlot(n.$slots, "label", {
                                label: u.currentLabel,
                                value: u.value
                              }, () => [
                                createTextVNode(toDisplayString(u.currentLabel), 1)
                              ])
                            ], 2)
                          ]),
                          _: 2
                        }, 1032, ["closable", "size", "type", "effect", "onClose"])
                      ], 2))), 128))
                    ], 2)
                  ]),
                  _: 3
                }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
              ]) : createCommentVNode("v-if", true),
              n.selectDisabled ? createCommentVNode("v-if", true) : (openBlock(), createElementBlock("div", {
                key: 1,
                class: normalizeClass([
                  n.nsSelect.e("selected-item"),
                  n.nsSelect.e("input-wrapper"),
                  n.nsSelect.is("hidden", !n.filterable)
                ])
              }, [
                withDirectives(createBaseVNode("input", {
                  id: n.inputId,
                  ref: "inputRef",
                  "onUpdate:modelValue": (u) => n.states.inputValue = u,
                  type: "text",
                  name: n.name,
                  class: normalizeClass([n.nsSelect.e("input"), n.nsSelect.is(n.selectSize)]),
                  disabled: n.selectDisabled,
                  autocomplete: n.autocomplete,
                  style: normalizeStyle(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: [
                    withKeys(withModifiers((u) => n.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
                    withKeys(withModifiers((u) => n.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
                    withKeys(withModifiers(n.handleEsc, ["stop", "prevent"]), ["esc"]),
                    withKeys(withModifiers(n.selectOption, ["stop", "prevent"]), ["enter"]),
                    withKeys(withModifiers(n.deletePrevTag, ["stop"]), ["delete"])
                  ],
                  onCompositionstart: n.handleCompositionStart,
                  onCompositionupdate: n.handleCompositionUpdate,
                  onCompositionend: n.handleCompositionEnd,
                  onInput: n.onInput,
                  onClick: withModifiers(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"]), [
                  [vModelText, n.states.inputValue]
                ]),
                n.filterable ? (openBlock(), createElementBlock("span", {
                  key: 0,
                  ref: "calculatorRef",
                  "aria-hidden": "true",
                  class: normalizeClass(n.nsSelect.e("input-calculator")),
                  textContent: toDisplayString(n.states.inputValue)
                }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
              ], 2)),
              n.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
                key: 2,
                class: normalizeClass([
                  n.nsSelect.e("selected-item"),
                  n.nsSelect.e("placeholder"),
                  n.nsSelect.is("transparent", !n.hasModelValue || n.expanded && !n.states.inputValue)
                ])
              }, [
                n.hasModelValue ? renderSlot(n.$slots, "label", {
                  key: 0,
                  label: n.currentPlaceholder,
                  value: n.modelValue
                }, () => [
                  createBaseVNode("span", null, toDisplayString(n.currentPlaceholder), 1)
                ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(n.currentPlaceholder), 1))
              ], 2)) : createCommentVNode("v-if", true)
            ], 2),
            createBaseVNode("div", {
              ref: "suffixRef",
              class: normalizeClass(n.nsSelect.e("suffix"))
            }, [
              n.iconComponent && !n.showClose ? (openBlock(), createBlock(c, {
                key: 0,
                class: normalizeClass([n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.iconReverse])
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(n.iconComponent)))
                ]),
                _: 1
              }, 8, ["class"])) : createCommentVNode("v-if", true),
              n.showClose && n.clearIcon ? (openBlock(), createBlock(c, {
                key: 1,
                class: normalizeClass([
                  n.nsSelect.e("caret"),
                  n.nsSelect.e("icon"),
                  n.nsSelect.e("clear")
                ]),
                onClick: n.handleClearClick
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(n.clearIcon)))
                ]),
                _: 1
              }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
              n.validateState && n.validateIcon ? (openBlock(), createBlock(c, {
                key: 2,
                class: normalizeClass([n.nsInput.e("icon"), n.nsInput.e("validateIcon")])
              }, {
                default: withCtx(() => [
                  (openBlock(), createBlock(resolveDynamicComponent(n.validateIcon)))
                ]),
                _: 1
              }, 8, ["class"])) : createCommentVNode("v-if", true)
            ], 2)
          ], 10, ["onClick"])
        ];
      }),
      content: withCtx(() => [
        createVNode(f, { ref: "menuRef" }, {
          default: withCtx(() => [
            n.$slots.header ? (openBlock(), createElementBlock("div", {
              key: 0,
              class: normalizeClass(n.nsSelect.be("dropdown", "header")),
              onClick: withModifiers(() => {
              }, ["stop"])
            }, [
              renderSlot(n.$slots, "header")
            ], 10, ["onClick"])) : createCommentVNode("v-if", true),
            withDirectives(createVNode(h4, {
              id: n.contentId,
              ref: "scrollbarRef",
              tag: "ul",
              "wrap-class": n.nsSelect.be("dropdown", "wrap"),
              "view-class": n.nsSelect.be("dropdown", "list"),
              class: normalizeClass([n.nsSelect.is("empty", n.filteredOptionsCount === 0)]),
              role: "listbox",
              "aria-label": n.ariaLabel,
              "aria-orientation": "vertical"
            }, {
              default: withCtx(() => [
                n.showNewOption ? (openBlock(), createBlock(l, {
                  key: 0,
                  value: n.states.inputValue,
                  created: true
                }, null, 8, ["value"])) : createCommentVNode("v-if", true),
                createVNode(d, null, {
                  default: withCtx(() => [
                    renderSlot(n.$slots, "default")
                  ]),
                  _: 3
                })
              ]),
              _: 3
            }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
              [vShow, n.states.options.size > 0 && !n.loading]
            ]),
            n.$slots.loading && n.loading ? (openBlock(), createElementBlock("div", {
              key: 1,
              class: normalizeClass(n.nsSelect.be("dropdown", "loading"))
            }, [
              renderSlot(n.$slots, "loading")
            ], 2)) : n.loading || n.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
              key: 2,
              class: normalizeClass(n.nsSelect.be("dropdown", "empty"))
            }, [
              renderSlot(n.$slots, "empty", {}, () => [
                createBaseVNode("span", null, toDisplayString(n.emptyText), 1)
              ])
            ], 2)) : createCommentVNode("v-if", true),
            n.$slots.footer ? (openBlock(), createElementBlock("div", {
              key: 3,
              class: normalizeClass(n.nsSelect.be("dropdown", "footer")),
              onClick: withModifiers(() => {
              }, ["stop"])
            }, [
              renderSlot(n.$slots, "footer")
            ], 10, ["onClick"])) : createCommentVNode("v-if", true)
          ]),
          _: 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 bR = ct(vR, [["render", yR], ["__file", "select.vue"]]);
var xR = defineComponent({
  name: "ElOptionGroup",
  componentName: "ElOptionGroup",
  props: {
    label: String,
    disabled: Boolean
  },
  setup(n) {
    const e = st("select"), t = ref(null), i = getCurrentInstance(), r = ref([]);
    provide(Ty, reactive({
      ...toRefs(n)
    }));
    const s = computed(() => r.value.some((l) => l.visible === true)), o = (l) => {
      var d, h4;
      return ((d = l.type) == null ? void 0 : d.name) === "ElOption" && !!((h4 = l.component) != null && h4.proxy);
    }, a = (l) => {
      const d = Ai(l), h4 = [];
      return d.forEach((f) => {
        var g, p;
        o(f) ? h4.push(f.component.proxy) : (g = f.children) != null && g.length ? h4.push(...a(f.children)) : (p = f.component) != null && p.subTree && h4.push(...a(f.component.subTree));
      }), h4;
    }, c = () => {
      r.value = a(i.subTree);
    };
    return onMounted(() => {
      c();
    }), z1(t, c, {
      attributes: true,
      subtree: true,
      childList: true
    }), {
      groupRef: t,
      visible: s,
      ns: e
    };
  }
});
function wR(n, e, t, i, r, s) {
  return withDirectives((openBlock(), createElementBlock("ul", {
    ref: "groupRef",
    class: normalizeClass(n.ns.be("group", "wrap"))
  }, [
    createBaseVNode("li", {
      class: normalizeClass(n.ns.be("group", "title"))
    }, toDisplayString(n.label), 3),
    createBaseVNode("li", null, [
      createBaseVNode("ul", {
        class: normalizeClass(n.ns.b("group"))
      }, [
        renderSlot(n.$slots, "default")
      ], 2)
    ])
  ], 2)), [
    [vShow, n.visible]
  ]);
}
var Ey = ct(xR, [["render", wR], ["__file", "option-group.vue"]]);
var oa = fn(bR, {
  Option: zf,
  OptionGroup: Ey
});
var aa = mr(zf);
mr(Ey);
var MR = ft({
  trigger: Ka.trigger,
  placement: nh.placement,
  disabled: Ka.disabled,
  visible: Hn.visible,
  transition: Hn.transition,
  popperOptions: nh.popperOptions,
  tabindex: nh.tabindex,
  content: Hn.content,
  popperStyle: Hn.popperStyle,
  popperClass: Hn.popperClass,
  enterable: {
    ...Hn.enterable,
    default: true
  },
  effect: {
    ...Hn.effect,
    default: "light"
  },
  teleported: Hn.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: true
  },
  persistent: {
    type: Boolean,
    default: true
  },
  "onUpdate:visible": {
    type: Function
  }
});
var _R = {
  "update:visible": (n) => gf(n),
  "before-enter": () => true,
  "before-leave": () => true,
  "after-enter": () => true,
  "after-leave": () => true
};
var SR = "onUpdate:visible";
var TR = defineComponent({
  name: "ElPopover"
});
var ER = defineComponent({
  ...TR,
  props: MR,
  emits: _R,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = computed(() => i[SR]), s = st("popover"), o = ref(), a = computed(() => {
      var y;
      return (y = unref(o)) == null ? void 0 : y.popperRef;
    }), c = computed(() => [
      {
        width: Zc(i.width)
      },
      i.popperStyle
    ]), l = computed(() => [s.b(), i.popperClass, { [s.m("plain")]: !!i.content }]), d = computed(() => i.transition === `${s.namespace.value}-fade-in-linear`), h4 = () => {
      var y;
      (y = o.value) == null || y.hide();
    }, f = () => {
      t("before-enter");
    }, g = () => {
      t("before-leave");
    }, p = () => {
      t("after-enter");
    }, u = () => {
      t("update:visible", false), t("after-leave");
    };
    return e({
      popperRef: a,
      hide: h4
    }), (y, v) => (openBlock(), createBlock(unref(Ff), mergeProps({
      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": unref(l),
      "popper-style": unref(c),
      teleported: y.teleported,
      persistent: y.persistent,
      "gpu-acceleration": unref(d),
      "onUpdate:visible": unref(r),
      onBeforeShow: f,
      onBeforeHide: g,
      onShow: p,
      onHide: u
    }), {
      content: withCtx(() => [
        y.title ? (openBlock(), createElementBlock("div", {
          key: 0,
          class: normalizeClass(unref(s).e("title")),
          role: "title"
        }, toDisplayString(y.title), 3)) : createCommentVNode("v-if", true),
        renderSlot(y.$slots, "default", {}, () => [
          createTextVNode(toDisplayString(y.content), 1)
        ])
      ]),
      default: withCtx(() => [
        y.$slots.reference ? renderSlot(y.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
      ]),
      _: 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 AR = ct(ER, [["__file", "popover.vue"]]);
var og = (n, e) => {
  const t = e.arg || e.value, i = t == null ? void 0 : t.popperRef;
  i && (i.triggerRef = n);
};
var CR = {
  mounted(n, e) {
    og(n, e);
  },
  updated(n, e) {
    og(n, e);
  }
};
var LR = "popover";
var RR = mE(CR, LR);
var Mu = fn(AR, {
  directive: RR
});
var Ay = Symbol("sliderContextKey");
var PR = ft({
  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: true
  },
  size: Do,
  inputSize: Do,
  showStops: Boolean,
  showTooltip: {
    type: Boolean,
    default: true
  },
  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: ia,
    default: "top"
  },
  marks: {
    type: Je(Object)
  },
  validateEvent: {
    type: Boolean,
    default: true
  },
  ...Gs(["ariaLabel"])
});
var ih = (n) => bt(n) || Nn(n) && n.every(bt);
var OR = {
  [Lt]: ih,
  [_s]: ih,
  [qr]: ih
};
var IR = (n, e, t) => {
  const i = ref();
  return onMounted(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 nextTick(), t();
  }), {
    sliderWrapper: i
  };
};
var DR = (n) => computed(() => 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]
})) : []);
var NR = (n, e, t) => {
  const { form: i, formItem: r } = gl(), s = shallowRef(), o = ref(), a = ref(), c = {
    firstButton: o,
    secondButton: a
  }, l = computed(() => n.disabled || (i == null ? void 0 : i.disabled) || false), d = computed(() => Math.min(e.firstValue, e.secondValue)), h4 = computed(() => Math.max(e.firstValue, e.secondValue)), f = computed(() => n.range ? `${100 * (h4.value - d.value) / (n.max - n.min)}%` : `${100 * (e.firstValue - n.min) / (n.max - n.min)}%`), g = computed(() => n.range ? `${100 * (d.value - n.min) / (n.max - n.min)}%` : "0%"), p = computed(() => n.vertical ? { height: n.height } : {}), u = computed(() => 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 = (A) => {
    const C = n.min + A * (n.max - n.min) / 100;
    if (!n.range)
      return o;
    let L;
    return Math.abs(d.value - C) < Math.abs(h4.value - C) ? L = e.firstValue < e.secondValue ? "firstButton" : "secondButton" : L = e.firstValue > e.secondValue ? "firstButton" : "secondButton", c[L];
  }, m = (A) => {
    const C = v(A);
    return C.value.setPosition(A), C;
  }, x = (A) => {
    e.firstValue = A ?? n.min, T(n.range ? [d.value, h4.value] : A ?? n.min);
  }, M = (A) => {
    e.secondValue = A, n.range && T([d.value, h4.value]);
  }, T = (A) => {
    t(Lt, A), t(_s, A);
  }, w = async () => {
    await nextTick(), t(qr, n.range ? [d.value, h4.value] : n.modelValue);
  }, _ = (A) => {
    var C, L, I, b, O, N;
    if (l.value || e.dragging)
      return;
    y();
    let D = 0;
    if (n.vertical) {
      const U = (I = (L = (C = A.touches) == null ? void 0 : C.item(0)) == null ? void 0 : L.clientY) != null ? I : A.clientY;
      D = (s.value.getBoundingClientRect().bottom - U) / e.sliderSize * 100;
    } else {
      const U = (N = (O = (b = A.touches) == null ? void 0 : b.item(0)) == null ? void 0 : O.clientX) != null ? N : A.clientX, V = s.value.getBoundingClientRect().left;
      D = (U - V) / e.sliderSize * 100;
    }
    if (!(D < 0 || D > 100))
      return m(D);
  };
  return {
    elFormItem: r,
    slider: s,
    firstButton: o,
    secondButton: a,
    sliderDisabled: l,
    minValue: d,
    maxValue: h4,
    runwayStyle: p,
    barStyle: u,
    resetSize: y,
    setPosition: m,
    emitChange: w,
    onSliderWrapperPrevent: (A) => {
      var C, L;
      ((C = c.firstButton.value) != null && C.dragging || (L = c.secondButton.value) != null && L.dragging) && A.preventDefault();
    },
    onSliderClick: (A) => {
      _(A) && w();
    },
    onSliderDown: async (A) => {
      const C = _(A);
      C && (await nextTick(), C.value.onButtonDown(A));
    },
    onSliderMarkerDown: (A) => {
      l.value || e.dragging || m(A);
    },
    setFirstValue: x,
    setSecondValue: M
  };
};
var { left: BR, down: FR, right: zR, up: UR, home: VR, end: kR, pageUp: GR, pageDown: HR } = Pi;
var WR = (n, e, t) => {
  const i = ref(), r = ref(false), s = computed(() => e.value instanceof Function), o = computed(() => s.value && e.value(n.modelValue) || n.modelValue), a = ad(() => {
    t.value && (r.value = true);
  }, 50), c = ad(() => {
    t.value && (r.value = false);
  }, 50);
  return {
    tooltip: i,
    tooltipVisible: r,
    formatValue: o,
    displayTooltip: a,
    hideTooltip: c
  };
};
var jR = (n, e, t) => {
  const {
    disabled: i,
    min: r,
    max: s,
    step: o,
    showTooltip: a,
    precision: c,
    sliderSize: l,
    formatTooltip: d,
    emitChange: h4,
    resetSize: f,
    updateDragging: g
  } = inject(Ay), { tooltip: p, tooltipVisible: u, formatValue: y, displayTooltip: v, hideTooltip: m } = WR(n, d, a), x = ref(), M = computed(() => `${(n.modelValue - r.value) / (s.value - r.value) * 100}%`), T = computed(() => n.vertical ? { bottom: M.value } : { left: M.value }), w = () => {
    e.hovering = true, v();
  }, _ = () => {
    e.hovering = false, e.dragging || m();
  }, E = (H) => {
    i.value || (H.preventDefault(), N(H), window.addEventListener("mousemove", D), window.addEventListener("touchmove", D), window.addEventListener("mouseup", U), window.addEventListener("touchend", U), window.addEventListener("contextmenu", U), x.value.focus());
  }, P = (H) => {
    i.value || (e.newPosition = Number.parseFloat(M.value) + H / (s.value - r.value) * 100, V(e.newPosition), h4());
  }, S = () => {
    P(-o.value);
  }, R = () => {
    P(o.value);
  }, A = () => {
    P(-o.value * 4);
  }, C = () => {
    P(o.value * 4);
  }, L = () => {
    i.value || (V(0), h4());
  }, I = () => {
    i.value || (V(100), h4());
  }, b = (H) => {
    let Y = true;
    [BR, FR].includes(H.key) ? S() : [zR, UR].includes(H.key) ? R() : H.key === VR ? L() : H.key === kR ? I() : H.key === HR ? A() : H.key === GR ? C() : Y = false, Y && H.preventDefault();
  }, O = (H) => {
    let Y, re;
    return H.type.startsWith("touch") ? (re = H.touches[0].clientY, Y = H.touches[0].clientX) : (re = H.clientY, Y = H.clientX), {
      clientX: Y,
      clientY: re
    };
  }, N = (H) => {
    e.dragging = true, e.isClick = true;
    const { clientX: Y, clientY: re } = O(H);
    n.vertical ? e.startY = re : e.startX = Y, e.startPosition = Number.parseFloat(M.value), e.newPosition = e.startPosition;
  }, D = (H) => {
    if (e.dragging) {
      e.isClick = false, v(), f();
      let Y;
      const { clientX: re, clientY: ae } = O(H);
      n.vertical ? (e.currentY = ae, Y = (e.startY - e.currentY) / l.value * 100) : (e.currentX = re, Y = (e.currentX - e.startX) / l.value * 100), e.newPosition = e.startPosition + Y, V(e.newPosition);
    }
  }, U = () => {
    e.dragging && (setTimeout(() => {
      e.dragging = false, e.hovering || m(), e.isClick || V(e.newPosition), h4();
    }, 0), window.removeEventListener("mousemove", D), window.removeEventListener("touchmove", D), window.removeEventListener("mouseup", U), window.removeEventListener("touchend", U), window.removeEventListener("contextmenu", U));
  }, V = async (H) => {
    if (H === null || Number.isNaN(+H))
      return;
    H < 0 ? H = 0 : H > 100 && (H = 100);
    const Y = 100 / ((s.value - r.value) / o.value);
    let ae = Math.round(H / Y) * Y * (s.value - r.value) * 0.01 + r.value;
    ae = Number.parseFloat(ae.toFixed(c.value)), ae !== n.modelValue && t(Lt, ae), !e.dragging && n.modelValue !== e.oldValue && (e.oldValue = n.modelValue), await nextTick(), e.dragging && v(), p.value.updatePopper();
  };
  return watch(() => e.dragging, (H) => {
    g(H);
  }), un(x, "touchstart", E, { passive: false }), {
    disabled: i,
    button: x,
    tooltip: p,
    tooltipVisible: u,
    showTooltip: a,
    wrapperStyle: T,
    formatValue: y,
    handleMouseEnter: w,
    handleMouseLeave: _,
    onButtonDown: E,
    onKeyDown: b,
    setPosition: V
  };
};
var $R = (n, e, t, i) => ({
  stops: computed(() => {
    if (!n.showStops || n.min > n.max)
      return [];
    if (n.step === 0)
      return Xt("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}%` }
});
var ZR = (n, e, t, i, r, s) => {
  const o = (l) => {
    r(Lt, l), r(_s, 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 && na("Slider", "min should not be greater than max.");
    const h4 = n.modelValue;
    n.range && Array.isArray(h4) ? h4[1] < n.min ? o([n.min, n.min]) : h4[0] > n.max ? o([n.max, n.max]) : h4[0] < n.min ? o([n.min, h4[1]]) : h4[1] > n.max ? o([h4[0], n.max]) : (e.firstValue = h4[0], e.secondValue = h4[1], a() && (n.validateEvent && ((l = s == null ? void 0 : s.validate) == null || l.call(s, "change").catch((f) => Xt(f))), e.oldValue = h4.slice())) : !n.range && typeof h4 == "number" && !Number.isNaN(h4) && (h4 < n.min ? o(n.min) : h4 > n.max ? o(n.max) : (e.firstValue = h4, a() && (n.validateEvent && ((d = s == null ? void 0 : s.validate) == null || d.call(s, "change").catch((f) => Xt(f))), e.oldValue = h4)));
  };
  c(), watch(() => e.dragging, (l) => {
    l || c();
  }), watch(() => n.modelValue, (l, d) => {
    e.dragging || Array.isArray(l) && Array.isArray(d) && l.every((h4, f) => h4 === d[f]) && e.firstValue === l[0] && e.secondValue === l[1] || c();
  }, {
    deep: true
  }), watch(() => [n.min, n.max], () => {
    c();
  });
};
var XR = ft({
  modelValue: {
    type: Number,
    default: 0
  },
  vertical: Boolean,
  tooltipClass: String,
  placement: {
    type: String,
    values: ia,
    default: "top"
  }
});
var YR = {
  [Lt]: (n) => bt(n)
};
var JR = defineComponent({
  name: "ElSliderButton"
});
var KR = defineComponent({
  ...JR,
  props: XR,
  emits: YR,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = st("slider"), s = reactive({
      hovering: false,
      dragging: false,
      isClick: false,
      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: h4,
      formatValue: f,
      handleMouseEnter: g,
      handleMouseLeave: p,
      onButtonDown: u,
      onKeyDown: y,
      setPosition: v
    } = jR(i, s, t), { hovering: m, dragging: x } = toRefs(s);
    return e({
      onButtonDown: u,
      onKeyDown: y,
      setPosition: v,
      hovering: m,
      dragging: x
    }), (M, T) => (openBlock(), createElementBlock("div", {
      ref_key: "button",
      ref: a,
      class: normalizeClass([unref(r).e("button-wrapper"), { hover: unref(m), dragging: unref(x) }]),
      style: normalizeStyle(unref(h4)),
      tabindex: unref(o) ? -1 : 0,
      onMouseenter: unref(g),
      onMouseleave: unref(p),
      onMousedown: unref(u),
      onFocus: unref(g),
      onBlur: unref(p),
      onKeydown: unref(y)
    }, [
      createVNode(unref(Ff), {
        ref_key: "tooltip",
        ref: c,
        visible: unref(d),
        placement: M.placement,
        "fallback-placements": ["top", "bottom", "right", "left"],
        "stop-popper-mouse-event": false,
        "popper-class": M.tooltipClass,
        disabled: !unref(l),
        persistent: ""
      }, {
        content: withCtx(() => [
          createBaseVNode("span", null, toDisplayString(unref(f)), 1)
        ]),
        default: withCtx(() => [
          createBaseVNode("div", {
            class: normalizeClass([unref(r).e("button"), { hover: unref(m), dragging: unref(x) }])
          }, null, 2)
        ]),
        _: 1
      }, 8, ["visible", "placement", "popper-class", "disabled"])
    ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]));
  }
});
var ag = ct(KR, [["__file", "button.vue"]]);
var qR = ft({
  mark: {
    type: Je([String, Object]),
    default: void 0
  }
});
var QR = defineComponent({
  name: "ElSliderMarker",
  props: qR,
  setup(n) {
    const e = st("slider"), t = computed(() => Ln(n.mark) ? n.mark : n.mark.label), i = computed(() => Ln(n.mark) ? void 0 : n.mark.style);
    return () => h("div", {
      class: e.e("marks-text"),
      style: i.value
    }, t.value);
  }
});
var eP = defineComponent({
  name: "ElSlider"
});
var tP = defineComponent({
  ...eP,
  props: PR,
  emits: OR,
  setup(n, { expose: e, emit: t }) {
    const i = n, r = st("slider"), { t: s } = mu(), o = reactive({
      firstValue: 0,
      secondValue: 0,
      oldValue: 0,
      dragging: false,
      sliderSize: 1
    }), {
      elFormItem: a,
      slider: c,
      firstButton: l,
      secondButton: d,
      sliderDisabled: h4,
      minValue: f,
      maxValue: g,
      runwayStyle: p,
      barStyle: u,
      resetSize: y,
      emitChange: v,
      onSliderWrapperPrevent: m,
      onSliderClick: x,
      onSliderDown: M,
      onSliderMarkerDown: T,
      setFirstValue: w,
      setSecondValue: _
    } = NR(i, o, t), { stops: E, getStopStyle: P } = $R(i, o, f, g), { inputId: S, isLabeledByFormItem: R } = Pf(i, {
      formItemContext: a
    }), A = ra(), C = computed(() => i.inputSize || A.value), L = computed(() => i.ariaLabel || s("el.slider.defaultLabel", {
      min: i.min,
      max: i.max
    })), I = computed(() => i.range ? i.rangeStartLabel || s("el.slider.defaultRangeStartLabel") : L.value), b = computed(() => i.formatValueText ? i.formatValueText(Y.value) : `${Y.value}`), O = computed(() => i.rangeEndLabel || s("el.slider.defaultRangeEndLabel")), N = computed(() => i.formatValueText ? i.formatValueText(re.value) : `${re.value}`), D = computed(() => [
      r.b(),
      r.m(A.value),
      r.is("vertical", i.vertical),
      { [r.m("with-input")]: i.showInput }
    ]), U = DR(i);
    ZR(i, o, f, g, t, a);
    const V = computed(() => {
      const oe = [i.min, i.max, i.step].map((j) => {
        const K = `${j}`.split(".")[1];
        return K ? K.length : 0;
      });
      return Math.max.apply(null, oe);
    }), { sliderWrapper: H } = IR(i, o, y), { firstValue: Y, secondValue: re, sliderSize: ae } = toRefs(o), ee = (oe) => {
      o.dragging = oe;
    };
    return un(H, "touchstart", m, {
      passive: false
    }), un(H, "touchmove", m, {
      passive: false
    }), provide(Ay, {
      ...toRefs(i),
      sliderSize: ae,
      disabled: h4,
      precision: V,
      emitChange: v,
      resetSize: y,
      updateDragging: ee
    }), e({
      onSliderClick: x
    }), (oe, j) => {
      var K, $;
      return openBlock(), createElementBlock("div", {
        id: oe.range ? unref(S) : void 0,
        ref_key: "sliderWrapper",
        ref: H,
        class: normalizeClass(unref(D)),
        role: oe.range ? "group" : void 0,
        "aria-label": oe.range && !unref(R) ? unref(L) : void 0,
        "aria-labelledby": oe.range && unref(R) ? (K = unref(a)) == null ? void 0 : K.labelId : void 0
      }, [
        createBaseVNode("div", {
          ref_key: "slider",
          ref: c,
          class: normalizeClass([
            unref(r).e("runway"),
            { "show-input": oe.showInput && !oe.range },
            unref(r).is("disabled", unref(h4))
          ]),
          style: normalizeStyle(unref(p)),
          onMousedown: unref(M),
          onTouchstartPassive: unref(M)
        }, [
          createBaseVNode("div", {
            class: normalizeClass(unref(r).e("bar")),
            style: normalizeStyle(unref(u))
          }, null, 6),
          createVNode(ag, {
            id: oe.range ? void 0 : unref(S),
            ref_key: "firstButton",
            ref: l,
            "model-value": unref(Y),
            vertical: oe.vertical,
            "tooltip-class": oe.tooltipClass,
            placement: oe.placement,
            role: "slider",
            "aria-label": oe.range || !unref(R) ? unref(I) : void 0,
            "aria-labelledby": !oe.range && unref(R) ? ($ = unref(a)) == null ? void 0 : $.labelId : void 0,
            "aria-valuemin": oe.min,
            "aria-valuemax": oe.range ? unref(re) : oe.max,
            "aria-valuenow": unref(Y),
            "aria-valuetext": unref(b),
            "aria-orientation": oe.vertical ? "vertical" : "horizontal",
            "aria-disabled": unref(h4),
            "onUpdate:modelValue": unref(w)
          }, 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"]),
          oe.range ? (openBlock(), createBlock(ag, {
            key: 0,
            ref_key: "secondButton",
            ref: d,
            "model-value": unref(re),
            vertical: oe.vertical,
            "tooltip-class": oe.tooltipClass,
            placement: oe.placement,
            role: "slider",
            "aria-label": unref(O),
            "aria-valuemin": unref(Y),
            "aria-valuemax": oe.max,
            "aria-valuenow": unref(re),
            "aria-valuetext": unref(N),
            "aria-orientation": oe.vertical ? "vertical" : "horizontal",
            "aria-disabled": unref(h4),
            "onUpdate:modelValue": unref(_)
          }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
          oe.showStops ? (openBlock(), createElementBlock("div", { key: 1 }, [
            (openBlock(true), createElementBlock(Fragment, null, renderList(unref(E), (ne, k) => (openBlock(), createElementBlock("div", {
              key: k,
              class: normalizeClass(unref(r).e("stop")),
              style: normalizeStyle(unref(P)(ne))
            }, null, 6))), 128))
          ])) : createCommentVNode("v-if", true),
          unref(U).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
            createBaseVNode("div", null, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(U), (ne, k) => (openBlock(), createElementBlock("div", {
                key: k,
                style: normalizeStyle(unref(P)(ne.position)),
                class: normalizeClass([unref(r).e("stop"), unref(r).e("marks-stop")])
              }, null, 6))), 128))
            ]),
            createBaseVNode("div", {
              class: normalizeClass(unref(r).e("marks"))
            }, [
              (openBlock(true), createElementBlock(Fragment, null, renderList(unref(U), (ne, k) => (openBlock(), createBlock(unref(QR), {
                key: k,
                mark: ne.mark,
                style: normalizeStyle(unref(P)(ne.position)),
                onMousedown: withModifiers((W) => unref(T)(ne.position), ["stop"])
              }, null, 8, ["mark", "style", "onMousedown"]))), 128))
            ], 2)
          ], 64)) : createCommentVNode("v-if", true)
        ], 46, ["onMousedown", "onTouchstartPassive"]),
        oe.showInput && !oe.range ? (openBlock(), createBlock(unref(vr), {
          key: 0,
          ref: "input",
          "model-value": unref(Y),
          class: normalizeClass(unref(r).e("input")),
          step: oe.step,
          disabled: unref(h4),
          controls: oe.showInputControls,
          min: oe.min,
          max: oe.max,
          precision: unref(V),
          debounce: oe.debounce,
          size: unref(C),
          "onUpdate:modelValue": unref(w),
          onChange: unref(v)
        }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
      ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
    };
  }
});
var nP = ct(tP, [["__file", "slider.vue"]]);
var si = fn(nP);
var _u = Symbol("tabsRootContextKey");
var iP = ft({
  tabs: {
    type: Je(Array),
    default: () => er([])
  }
});
var Cy = "ElTabBar";
var rP = defineComponent({
  name: Cy
});
var sP = defineComponent({
  ...rP,
  props: iP,
  setup(n, { expose: e }) {
    const t = n, i = getCurrentInstance(), r = inject(_u);
    r || na(Cy, "<el-tabs><el-tab-bar /></el-tabs>");
    const s = st("tabs"), o = ref(), a = ref(), 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, M;
        const T = (M = (x = i.parent) == null ? void 0 : x.refs) == null ? void 0 : M[`tab-${m.uid}`];
        if (!T)
          return false;
        if (!m.active)
          return true;
        g = T[`offset${Br(v)}`], p = T[`client${Br(u)}`];
        const w = window.getComputedStyle(T);
        return u === "width" && (p -= Number.parseFloat(w.paddingLeft) + Number.parseFloat(w.paddingRight), g += Number.parseFloat(w.paddingLeft)), false;
      }), {
        [u]: `${p}px`,
        transform: `translate${Br(y)}(${g}px)`
      };
    }, l = () => a.value = c(), d = [], h4 = () => {
      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(Qn(y, l));
          }
      }
    };
    watch(() => t.tabs, async () => {
      await nextTick(), l(), h4();
    }, { immediate: true });
    const f = Qn(o, () => l());
    return onBeforeUnmount(() => {
      d.forEach((g) => g.stop()), d.length = 0, f.stop();
    }), e({
      ref: o,
      update: l
    }), (g, p) => (openBlock(), createElementBlock("div", {
      ref_key: "barRef",
      ref: o,
      class: normalizeClass([unref(s).e("active-bar"), unref(s).is(unref(r).props.tabPosition)]),
      style: normalizeStyle(a.value)
    }, null, 6));
  }
});
var oP = ct(sP, [["__file", "tab-bar.vue"]]);
var aP = ft({
  panes: {
    type: Je(Array),
    default: () => er([])
  },
  currentName: {
    type: [String, Number],
    default: ""
  },
  editable: Boolean,
  type: {
    type: String,
    values: ["card", "border-card", ""],
    default: ""
  },
  stretch: Boolean
});
var lP = {
  tabClick: (n, e, t) => t instanceof Event,
  tabRemove: (n, e) => e instanceof Event
};
var lg = "ElTabNav";
var cP = defineComponent({
  name: lg,
  props: aP,
  emits: lP,
  setup(n, {
    expose: e,
    emit: t
  }) {
    const i = inject(_u);
    i || na(lg, "<el-tabs><tab-nav /></el-tabs>");
    const r = st("tabs"), s = P1(), o = W1(), a = ref(), c = ref(), l = ref(), d = ref(), h4 = ref(false), f = ref(0), g = ref(false), p = ref(true), u = computed(() => ["top", "bottom"].includes(i.props.tabPosition) ? "width" : "height"), y = computed(() => ({
      transform: `translate${u.value === "width" ? "X" : "Y"}(-${f.value}px)`
    })), v = () => {
      if (!a.value)
        return;
      const E = a.value[`offset${Br(u.value)}`], P = f.value;
      if (!P)
        return;
      const S = P > E ? P - E : 0;
      f.value = S;
    }, m = () => {
      if (!a.value || !c.value)
        return;
      const E = c.value[`offset${Br(u.value)}`], P = a.value[`offset${Br(u.value)}`], S = f.value;
      if (E - S <= P)
        return;
      const R = E - S > P * 2 ? S + P : E - P;
      f.value = R;
    }, x = async () => {
      const E = c.value;
      if (!h4.value || !l.value || !a.value || !E)
        return;
      await nextTick();
      const P = l.value.querySelector(".is-active");
      if (!P)
        return;
      const S = a.value, R = ["top", "bottom"].includes(i.props.tabPosition), A = P.getBoundingClientRect(), C = S.getBoundingClientRect(), L = R ? E.offsetWidth - C.width : E.offsetHeight - C.height, I = f.value;
      let b = I;
      R ? (A.left < C.left && (b = I - (C.left - A.left)), A.right > C.right && (b = I + A.right - C.right)) : (A.top < C.top && (b = I - (C.top - A.top)), A.bottom > C.bottom && (b = I + (A.bottom - C.bottom))), b = Math.max(b, 0), f.value = Math.min(b, L);
    }, M = () => {
      var E;
      if (!c.value || !a.value)
        return;
      n.stretch && ((E = d.value) == null || E.update());
      const P = c.value[`offset${Br(u.value)}`], S = a.value[`offset${Br(u.value)}`], R = f.value;
      S < P ? (h4.value = h4.value || {}, h4.value.prev = R, h4.value.next = R + S < P, P - R < S && (f.value = P - S)) : (h4.value = false, R > 0 && (f.value = 0));
    }, T = (E) => {
      const P = E.code, {
        up: S,
        down: R,
        left: A,
        right: C
      } = Pi;
      if (![S, R, A, C].includes(P))
        return;
      const L = Array.from(E.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), I = L.indexOf(E.target);
      let b;
      P === A || P === S ? I === 0 ? b = L.length - 1 : b = I - 1 : I < L.length - 1 ? b = I + 1 : b = 0, L[b].focus({
        preventScroll: true
      }), L[b].click(), w();
    }, w = () => {
      p.value && (g.value = true);
    }, _ = () => g.value = false;
    return watch(s, (E) => {
      E === "hidden" ? p.value = false : E === "visible" && setTimeout(() => p.value = true, 50);
    }), watch(o, (E) => {
      E ? setTimeout(() => p.value = true, 50) : p.value = false;
    }), Qn(l, M), onMounted(() => setTimeout(() => x(), 0)), onUpdated(() => M()), e({
      scrollToActiveTab: x,
      removeFocus: _
    }), () => {
      const E = h4.value ? [createVNode("span", {
        class: [r.e("nav-prev"), r.is("disabled", !h4.value.prev)],
        onClick: v
      }, [createVNode(Ot, null, {
        default: () => [createVNode(Wr, null, null)]
      })]), createVNode("span", {
        class: [r.e("nav-next"), r.is("disabled", !h4.value.next)],
        onClick: m
      }, [createVNode(Ot, null, {
        default: () => [createVNode(jr, null, null)]
      })])] : null, P = n.panes.map((S, R) => {
        var A, C, L, I;
        const b = S.uid, O = S.props.disabled, N = (C = (A = S.props.name) != null ? A : S.index) != null ? C : `${R}`, D = !O && (S.isClosable || n.editable);
        S.index = `${R}`;
        const U = D ? createVNode(Ot, {
          class: "is-icon-close",
          onClick: (Y) => t("tabRemove", S, Y)
        }, {
          default: () => [createVNode(cd, null, null)]
        }) : null, V = ((I = (L = S.slots).label) == null ? void 0 : I.call(L)) || S.props.label, H = !O && S.active ? 0 : -1;
        return createVNode("div", {
          ref: `tab-${b}`,
          class: [r.e("item"), r.is(i.props.tabPosition), r.is("active", S.active), r.is("disabled", O), r.is("closable", D), r.is("focus", g.value)],
          id: `tab-${N}`,
          key: `tab-${b}`,
          "aria-controls": `pane-${N}`,
          role: "tab",
          "aria-selected": S.active,
          tabindex: H,
          onFocus: () => w(),
          onBlur: () => _(),
          onClick: (Y) => {
            _(), t("tabClick", S, N, Y);
          },
          onKeydown: (Y) => {
            D && (Y.code === Pi.delete || Y.code === Pi.backspace) && t("tabRemove", S, Y);
          }
        }, [V, U]);
      });
      return createVNode("div", {
        ref: l,
        class: [r.e("nav-wrap"), r.is("scrollable", !!h4.value), r.is(i.props.tabPosition)]
      }, [E, createVNode("div", {
        class: r.e("nav-scroll"),
        ref: a
      }, [createVNode("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: T
      }, [n.type ? null : createVNode(oP, {
        ref: d,
        tabs: [...n.panes]
      }, null), P])])]);
    };
  }
});
var uP = ft({
  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: () => true
  },
  stretch: Boolean
});
var rh = (n) => Ln(n) || bt(n);
var hP = {
  [Lt]: (n) => rh(n),
  tabClick: (n, e) => e instanceof Event,
  tabChange: (n) => rh(n),
  edit: (n, e) => ["remove", "add"].includes(e),
  tabRemove: (n) => rh(n),
  tabAdd: () => true
};
var dP = defineComponent({
  name: "ElTabs",
  props: uP,
  emits: hP,
  setup(n, {
    emit: e,
    slots: t,
    expose: i
  }) {
    var r;
    const s = st("tabs"), o = computed(() => ["left", "right"].includes(n.tabPosition)), {
      children: a,
      addChild: c,
      removeChild: l
    } = HA(getCurrentInstance(), "ElTabPane"), d = ref(), h4 = ref((r = n.modelValue) != null ? r : "0"), f = async (v, m = false) => {
      var x, M, T;
      if (!(h4.value === v || mi(v)))
        try {
          await ((x = n.beforeLeave) == null ? void 0 : x.call(n, v, h4.value)) !== false && (h4.value = v, m && (e(Lt, v), e("tabChange", v)), (T = (M = d.value) == null ? void 0 : M.removeFocus) == null || T.call(M));
        } catch {
        }
    }, g = (v, m, x) => {
      v.props.disabled || (f(m, true), e("tabClick", v, x));
    }, p = (v, m) => {
      v.props.disabled || mi(v.props.name) || (m.stopPropagation(), e("edit", v.props.name, "remove"), e("tabRemove", v.props.name));
    }, u = () => {
      e("edit", void 0, "add"), e("tabAdd");
    };
    watch(() => n.modelValue, (v) => f(v)), watch(h4, async () => {
      var v;
      await nextTick(), (v = d.value) == null || v.scrollToActiveTab();
    }), provide(_u, {
      props: n,
      currentName: h4,
      registerPane: (v) => {
        a.value.push(v);
      },
      sortPane: c,
      unregisterPane: l
    }), i({
      currentName: h4
    });
    const y = ({
      render: v
    }) => v();
    return () => {
      const v = t["add-icon"], m = n.editable || n.addable ? createVNode("div", {
        class: [s.e("new-tab"), o.value && s.e("new-tab-vertical")],
        tabindex: "0",
        onClick: u,
        onKeydown: (T) => {
          T.code === Pi.enter && u();
        }
      }, [v ? renderSlot(t, "add-icon") : createVNode(Ot, {
        class: s.is("icon-plus")
      }, {
        default: () => [createVNode(fu, null, null)]
      })]) : null, x = createVNode("div", {
        class: [s.e("header"), o.value && s.e("header-vertical"), s.is(n.tabPosition)]
      }, [createVNode(y, {
        render: () => {
          const T = a.value.some((w) => w.slots.label);
          return createVNode(cP, {
            ref: d,
            currentName: h4.value,
            editable: n.editable,
            type: n.type,
            panes: a.value,
            stretch: n.stretch,
            onTabClick: g,
            onTabRemove: p
          }, {
            $stable: !T
          });
        }
      }, null), m]), M = createVNode("div", {
        class: s.e("content")
      }, [renderSlot(t, "default")]);
      return createVNode("div", {
        class: [s.b(), s.m(n.tabPosition), {
          [s.m("card")]: n.type === "card",
          [s.m("border-card")]: n.type === "border-card"
        }]
      }, [M, x]);
    };
  }
});
var fP = ft({
  label: {
    type: String,
    default: ""
  },
  name: {
    type: [String, Number]
  },
  closable: Boolean,
  disabled: Boolean,
  lazy: Boolean
});
var Ly = "ElTabPane";
var pP = defineComponent({
  name: Ly
});
var mP = defineComponent({
  ...pP,
  props: fP,
  setup(n) {
    const e = n, t = getCurrentInstance(), i = useSlots(), r = inject(_u);
    r || na(Ly, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
    const s = st("tab-pane"), o = ref(), a = computed(() => e.closable || r.props.closable), c = Hp(() => {
      var g;
      return r.currentName.value === ((g = e.name) != null ? g : o.value);
    }), l = ref(c.value), d = computed(() => {
      var g;
      return (g = e.name) != null ? g : o.value;
    }), h4 = Hp(() => !e.lazy || l.value || c.value);
    watch(c, (g) => {
      g && (l.value = true);
    });
    const f = reactive({
      uid: t.uid,
      slots: i,
      props: e,
      paneName: d,
      active: c,
      index: o,
      isClosable: a
    });
    return r.registerPane(f), onMounted(() => {
      r.sortPane(f);
    }), onUnmounted(() => {
      r.unregisterPane(f.uid);
    }), (g, p) => unref(h4) ? withDirectives((openBlock(), createElementBlock("div", {
      key: 0,
      id: `pane-${unref(d)}`,
      class: normalizeClass(unref(s).b()),
      role: "tabpanel",
      "aria-hidden": !unref(c),
      "aria-labelledby": `tab-${unref(d)}`
    }, [
      renderSlot(g.$slots, "default")
    ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
      [vShow, unref(c)]
    ]) : createCommentVNode("v-if", true);
  }
});
var Ry = ct(mP, [["__file", "tab-pane.vue"]]);
var Py = fn(dP, {
  TabPane: Ry
});
var Oy = mr(Ry);
function gP(n) {
  let e;
  const t = ref(false), i = reactive({
    ...n,
    originalPosition: "",
    originalOverflow: "",
    visible: false
  });
  function r(f) {
    i.text = f;
  }
  function s() {
    const f = i.parent, g = h4.ns;
    if (!f.vLoadingAddClassList) {
      let p = f.getAttribute("loading-number");
      p = Number.parseInt(p) - 1, p ? f.setAttribute("loading-number", p.toString()) : ($c(f, g.bm("parent", "relative")), f.removeAttribute("loading-number")), $c(f, g.bm("parent", "hidden"));
    }
    o(), d.unmount();
  }
  function o() {
    var f, g;
    (g = (f = h4.$el) == null ? void 0 : f.parentNode) == null || g.removeChild(h4.$el);
  }
  function a() {
    var f;
    n.beforeClose && !n.beforeClose() || (t.value = true, clearTimeout(e), e = setTimeout(c, 400), i.visible = false, (f = n.closed) == null || f.call(n));
  }
  function c() {
    if (!t.value)
      return;
    const f = i.parent;
    t.value = false, f.vLoadingAddClassList = void 0, s();
  }
  const l = defineComponent({
    name: "ElLoading",
    setup(f, { expose: g }) {
      const { ns: p, zIndex: u } = KA("loading");
      return g({
        ns: p,
        zIndex: u
      }), () => {
        const y = i.spinner || i.svg, v = h("svg", {
          class: "circular",
          viewBox: i.svgViewBox ? i.svgViewBox : "0 0 50 50",
          ...y ? { innerHTML: y } : {}
        }, [
          h("circle", {
            class: "path",
            cx: "25",
            cy: "25",
            r: "20",
            fill: "none"
          })
        ]), m = i.text ? h("p", { class: p.b("text") }, [i.text]) : void 0;
        return h(Transition, {
          name: p.b("fade"),
          onAfterLeave: c
        }, {
          default: withCtx(() => [
            withDirectives(createVNode("div", {
              style: {
                backgroundColor: i.background || ""
              },
              class: [
                p.b("mask"),
                i.customClass,
                i.fullscreen ? "is-fullscreen" : ""
              ]
            }, [
              h("div", {
                class: p.b("spinner")
              }, [v, m])
            ]), [[vShow, i.visible]])
          ])
        });
      };
    }
  }), d = createApp(l), h4 = d.mount(document.createElement("div"));
  return {
    ...toRefs(i),
    setText: r,
    removeElLoadingChild: o,
    close: a,
    handleAfterLeave: c,
    vm: h4,
    get $el() {
      return h4.$el;
    }
  };
}
var Gl;
var gd = function(n = {}) {
  if (!Qt)
    return;
  const e = vP(n);
  if (e.fullscreen && Gl)
    return Gl;
  const t = gP({
    ...e,
    closed: () => {
      var r;
      (r = e.closed) == null || r.call(e), e.fullscreen && (Gl = void 0);
    }
  });
  yP(e, e.parent, t), cg(e, e.parent, t), e.parent.vLoadingAddClassList = () => cg(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), nextTick(() => t.visible.value = e.visible), e.fullscreen && (Gl = t), t;
};
var vP = (n) => {
  var e, t, i, r;
  let s;
  return Ln(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 || false,
    text: n.text || "",
    fullscreen: s === document.body && ((t = n.fullscreen) != null ? t : true),
    lock: (i = n.lock) != null ? i : false,
    customClass: n.customClass || "",
    visible: (r = n.visible) != null ? r : true,
    beforeClose: n.beforeClose,
    closed: n.closed,
    target: s
  };
};
var yP = async (n, e, t) => {
  const { nextZIndex: i } = t.vm.zIndex || t.vm._.exposed.zIndex, r = {};
  if (n.fullscreen)
    t.originalPosition.value = va(document.body, "position"), t.originalOverflow.value = va(document.body, "overflow"), r.zIndex = i();
  else if (n.parent === document.body) {
    t.originalPosition.value = va(document.body, "position"), await nextTick();
    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(va(document.body, `margin-${s}`), 10)}px`;
    }
    for (const s of ["height", "width"])
      r[s] = `${n.target.getBoundingClientRect()[s]}px`;
  } else
    t.originalPosition.value = va(e, "position");
  for (const [s, o] of Object.entries(r))
    t.$el.style[s] = o;
};
var cg = (n, e, t) => {
  const i = t.vm.ns || t.vm._.exposed.ns;
  ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? $c(e, i.bm("parent", "relative")) : Em(e, i.bm("parent", "relative")), n.fullscreen && n.lock ? Em(e, i.bm("parent", "hidden")) : $c(e, i.bm("parent", "hidden"));
};
var Uc = Symbol("ElLoading");
var ug = (n, e) => {
  var t, i, r, s;
  const o = e.instance, a = (f) => An(e.value) ? e.value[f] : void 0, c = (f) => {
    const g = Ln(f) && (o == null ? void 0 : o[f]) || f;
    return g && ref(g);
  }, l = (f) => c(a(f) || n.getAttribute(`element-loading-${q1(f)}`)), d = (t = a("fullscreen")) != null ? t : e.modifiers.fullscreen, h4 = {
    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[Uc] = {
    options: h4,
    instance: gd(h4)
  };
};
var bP = (n, e) => {
  for (const t of Object.keys(e))
    isRef(e[t]) && (e[t].value = n[t]);
};
var vd = {
  mounted(n, e) {
    e.value && ug(n, e);
  },
  updated(n, e) {
    const t = n[Uc];
    e.oldValue !== e.value && (e.value && !e.oldValue ? ug(n, e) : e.value && e.oldValue ? An(e.value) && bP(e.value, t.options) : t == null || t.instance.close());
  },
  unmounted(n) {
    var e;
    (e = n[Uc]) == null || e.instance.close(), n[Uc] = null;
  }
};
var xP = {
  install(n) {
    n.directive("loading", vd), n.config.globalProperties.$loading = gd;
  },
  directive: vd,
  service: gd
};
var Iy = { exports: {} };
var hg = {};
var dg;
function wP() {
  return dg || (dg = 1, function(n) {
    var e = function() {
      try {
        return !!Symbol.iterator;
      } catch {
        return false;
      }
    }, t = e(), i = function(l) {
      var d = {
        next: function() {
          var h4 = l.shift();
          return { done: h4 === void 0, value: h4 };
        }
      };
      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(h4) {
        Object.defineProperty(this, "_entries", { writable: true, value: {} });
        var f = typeof h4;
        if (f !== "undefined") if (f === "string")
          h4 !== "" && this._fromString(h4);
        else if (h4 instanceof l) {
          var g = this;
          h4.forEach(function(v, m) {
            g.append(m, v);
          });
        } else if (h4 !== null && f === "object")
          if (Object.prototype.toString.call(h4) === "[object Array]")
            for (var p = 0; p < h4.length; p++) {
              var u = h4[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 h4)
              h4.hasOwnProperty(y) && this.append(y, h4[y]);
        else
          throw new TypeError("Unsupported input's type for URLSearchParams");
      }, d = l.prototype;
      d.append = function(h4, f) {
        h4 in this._entries ? this._entries[h4].push(String(f)) : this._entries[h4] = [String(f)];
      }, d.delete = function(h4) {
        delete this._entries[h4];
      }, d.get = function(h4) {
        return h4 in this._entries ? this._entries[h4][0] : null;
      }, d.getAll = function(h4) {
        return h4 in this._entries ? this._entries[h4].slice(0) : [];
      }, d.has = function(h4) {
        return h4 in this._entries;
      }, d.set = function(h4, f) {
        this._entries[h4] = [String(f)];
      }, d.forEach = function(h4, 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++)
              h4.call(f, g[u], p, this);
          }
      }, d.keys = function() {
        var h4 = [];
        return this.forEach(function(f, g) {
          h4.push(g);
        }), i(h4);
      }, d.values = function() {
        var h4 = [];
        return this.forEach(function(f) {
          h4.push(f);
        }), i(h4);
      }, d.entries = function() {
        var h4 = [];
        return this.forEach(function(f, g) {
          h4.push([g, f]);
        }), i(h4);
      }, t && (d[Symbol.iterator] = d.entries), d.toString = function() {
        var h4 = [];
        return this.forEach(function(f, g) {
          h4.push(r(g) + "=" + r(f));
        }), h4.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 false;
      }
    };
    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 h4 = 0; h4 < d.length; h4++)
        this.append(d[h4][0], d[h4][1]);
    }), typeof c._fromString != "function" && Object.defineProperty(c, "_fromString", {
      enumerable: false,
      configurable: false,
      writable: false,
      value: function(l) {
        if (this._entries)
          this._entries = {};
        else {
          var d = [];
          this.forEach(function(p, u) {
            d.push(u);
          });
          for (var h4 = 0; h4 < d.length; h4++)
            this.delete(d[h4]);
        }
        l = l.replace(/^\?/, "");
        for (var f = l.split("&"), g, h4 = 0; h4 < f.length; h4++)
          g = f[h4].split("="), this.append(
            s(g[0]),
            g.length > 1 ? s(g[1]) : ""
          );
      }
    });
  }(
    typeof Nr < "u" ? Nr : typeof window < "u" ? window : typeof self < "u" ? self : Nr
  ), 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 false;
      }
    }, 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, h4;
        if (l && (n.location === void 0 || l !== n.location.href)) {
          l = l.toLowerCase(), d = document.implementation.createHTMLDocument(""), h4 = d.createElement("base"), h4.href = l, d.head.appendChild(h4);
          try {
            if (h4.href.indexOf(l) !== 0) throw new Error(h4.href);
          } catch (x) {
            throw new Error("URL unable to set base " + l + " due to " + x);
          }
        }
        var f = d.createElement("a");
        f.href = c, h4 && (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 = true, y = true, v = this;
        ["append", "delete", "set"].forEach(function(x) {
          var M = p[x];
          p[x] = function() {
            M.apply(p, arguments), u && (y = false, v.search = p.toString(), y = true);
          };
        }), Object.defineProperty(this, "searchParams", {
          value: p,
          enumerable: true
        });
        var m = void 0;
        Object.defineProperty(this, "_updateSearchParams", {
          enumerable: false,
          configurable: false,
          writable: false,
          value: function() {
            this.search !== m && (m = this.search, y && (u = false, this.searchParams._fromString(this.search), u = true));
          }
        });
      }, o = s.prototype, a = function(c) {
        Object.defineProperty(o, c, {
          get: function() {
            return this._anchorElement[c];
          },
          set: function(l) {
            this._anchorElement[c] = l;
          },
          enumerable: true
        });
      };
      ["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: true
      }), 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: true
        },
        pathname: {
          get: function() {
            return this._anchorElement.pathname.replace(/(^\/?)/, "/");
          },
          set: function(c) {
            this._anchorElement.pathname = c;
          },
          enumerable: true
        },
        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: true
        },
        password: {
          // TODO
          get: function() {
            return "";
          },
          set: function(c) {
          },
          enumerable: true
        },
        username: {
          // TODO
          get: function() {
            return "";
          },
          set: function(c) {
          },
          enumerable: true
        }
      }), 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: true
        });
      } catch {
        setInterval(function() {
          n.location.origin = i();
        }, 100);
      }
    }
  }(
    typeof Nr < "u" ? Nr : typeof window < "u" ? window : typeof self < "u" ? self : Nr
  )), hg;
}
var Uf = "130";
var MP = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
var _P = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
var Dy = 0;
var yd = 1;
var Ny = 2;
var SP = 3;
var TP = 0;
var Vf = 1;
var By = 2;
var wo = 3;
var Zr = 0;
var jt = 1;
var Xr = 2;
var kf = 1;
var EP = 2;
var sr = 0;
var So = 1;
var bd = 2;
var xd = 3;
var wd = 4;
var Fy = 5;
var ys = 100;
var zy = 101;
var Uy = 102;
var Md = 103;
var _d = 104;
var Vy = 200;
var ky = 201;
var Gy = 202;
var Hy = 203;
var Gf = 204;
var Hf = 205;
var Wy = 206;
var jy = 207;
var $y = 208;
var Zy = 209;
var Xy = 210;
var Yy = 0;
var Jy = 1;
var Ky = 2;
var qc = 3;
var qy = 4;
var Qy = 5;
var eb = 6;
var tb = 7;
var vl = 0;
var nb = 1;
var ib = 2;
var Ur = 0;
var rb = 1;
var sb = 2;
var ob = 3;
var ab = 4;
var lb = 5;
var Su = 300;
var yl = 301;
var bl = 302;
var Qc = 303;
var eu = 304;
var la = 306;
var xl = 307;
var Yr = 1e3;
var hn2 = 1001;
var No = 1002;
var $t = 1003;
var qa = 1004;
var AP = 1004;
var Qa = 1005;
var CP = 1005;
var Ut = 1006;
var Tu = 1007;
var LP = 1007;
var yr = 1008;
var RP = 1008;
var Ps = 1009;
var cb = 1010;
var ub = 1011;
var el = 1012;
var hb = 1013;
var Va = 1014;
var tr = 1015;
var Ts = 1016;
var db = 1017;
var fb = 1018;
var pb = 1019;
var To = 1020;
var mb = 1021;
var or = 1022;
var jn = 1023;
var gb = 1024;
var vb = 1025;
var yb = jn;
var Es = 1026;
var Bo = 1027;
var bb = 1028;
var xb = 1029;
var wb = 1030;
var Mb = 1031;
var _b = 1032;
var Sb = 1033;
var Sd = 33776;
var Td = 33777;
var Ed = 33778;
var Ad = 33779;
var Cd = 35840;
var Ld = 35841;
var Rd = 35842;
var Pd = 35843;
var Tb = 36196;
var Od = 37492;
var Id = 37496;
var Eb = 37808;
var Ab = 37809;
var Cb = 37810;
var Lb = 37811;
var Rb = 37812;
var Pb = 37813;
var Ob = 37814;
var Ib = 37815;
var Db = 37816;
var Nb = 37817;
var Bb = 37818;
var Fb = 37819;
var zb = 37820;
var Ub = 37821;
var Vb = 36492;
var kb = 37840;
var Gb = 37841;
var Hb = 37842;
var Wb = 37843;
var jb = 37844;
var $b = 37845;
var Zb = 37846;
var Xb = 37847;
var Yb = 37848;
var Jb = 37849;
var Kb = 37850;
var qb = 37851;
var Qb = 37852;
var ex = 37853;
var tx = 2200;
var nx = 2201;
var ix = 2202;
var Fo = 2300;
var Os = 2301;
var Vc = 2302;
var xs = 2400;
var ws = 2401;
var tl = 2402;
var Eu = 2500;
var Wf = 2501;
var rx = 0;
var sx = 1;
var jf = 2;
var Rn = 3e3;
var Is = 3001;
var Au = 3007;
var Cu = 3002;
var ox = 3003;
var $f = 3004;
var Zf = 3005;
var Xf = 3006;
var ax = 3200;
var lx = 3201;
var es = 0;
var cx = 1;
var PP = 0;
var kc = 7680;
var OP = 7681;
var IP = 7682;
var DP = 7683;
var NP = 34055;
var BP = 34056;
var FP = 5386;
var zP = 512;
var UP = 513;
var VP = 514;
var kP = 515;
var GP = 516;
var HP = 517;
var WP = 518;
var ux = 519;
var zo = 35044;
var Uo = 35048;
var jP = 35040;
var $P = 35045;
var ZP = 35049;
var XP = 35041;
var YP = 35046;
var JP = 35050;
var KP = 35042;
var qP = "100";
var Dd = "300 es";
var ts = class {
  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 false;
    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;
    }
  }
};
var pn = [];
for (let n = 0; n < 256; n++)
  pn[n] = (n < 16 ? "0" : "") + n.toString(16);
var Hl = 1234567;
var As = Math.PI / 180;
var nl = 180 / Math.PI;
function $n() {
  const n = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0;
  return (pn[n & 255] + pn[n >> 8 & 255] + pn[n >> 16 & 255] + pn[n >> 24 & 255] + "-" + pn[e & 255] + pn[e >> 8 & 255] + "-" + pn[e >> 16 & 15 | 64] + pn[e >> 24 & 255] + "-" + pn[t & 63 | 128] + pn[t >> 8 & 255] + "-" + pn[t >> 16 & 255] + pn[t >> 24 & 255] + pn[i & 255] + pn[i >> 8 & 255] + pn[i >> 16 & 255] + pn[i >> 24 & 255]).toUpperCase();
}
function vn(n, e, t) {
  return Math.max(e, Math.min(t, n));
}
function Yf(n, e) {
  return (n % e + e) % e;
}
function QP(n, e, t, i, r) {
  return i + (n - e) * (r - i) / (t - e);
}
function eO(n, e, t) {
  return n !== e ? (t - n) / (e - n) : 0;
}
function ka(n, e, t) {
  return (1 - t) * n + t * e;
}
function tO(n, e, t, i) {
  return ka(n, e, 1 - Math.exp(-t * i));
}
function nO(n, e = 1) {
  return e - Math.abs(Yf(n, e * 2) - e);
}
function iO(n, e, t) {
  return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * (3 - 2 * n));
}
function rO(n, e, t) {
  return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * n * (n * (n * 6 - 15) + 10));
}
function sO(n, e) {
  return n + Math.floor(Math.random() * (e - n + 1));
}
function oO(n, e) {
  return n + Math.random() * (e - n);
}
function aO(n) {
  return n * (0.5 - Math.random());
}
function lO(n) {
  return n !== void 0 && (Hl = n % 2147483647), Hl = Hl * 16807 % 2147483647, (Hl - 1) / 2147483646;
}
function cO(n) {
  return n * As;
}
function uO(n) {
  return n * nl;
}
function Nd(n) {
  return (n & n - 1) === 0 && n !== 0;
}
function hx(n) {
  return Math.pow(2, Math.ceil(Math.log(n) / Math.LN2));
}
function dx(n) {
  return Math.pow(2, Math.floor(Math.log(n) / Math.LN2));
}
function hO(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), h4 = 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 * h4, c * f, a * l);
      break;
    case "YZY":
      n.set(c * f, a * d, c * h4, a * l);
      break;
    case "ZXZ":
      n.set(c * h4, 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 Bd = Object.freeze({
  __proto__: null,
  DEG2RAD: As,
  RAD2DEG: nl,
  generateUUID: $n,
  clamp: vn,
  euclideanModulo: Yf,
  mapLinear: QP,
  inverseLerp: eO,
  lerp: ka,
  damp: tO,
  pingpong: nO,
  smoothstep: iO,
  smootherstep: rO,
  randInt: sO,
  randFloat: oO,
  randFloatSpread: aO,
  seededRandom: lO,
  degToRad: cO,
  radToDeg: uO,
  isPowerOfTwo: Nd,
  ceilPowerOfTwo: hx,
  floorPowerOfTwo: dx,
  setQuaternionFromProperEuler: hO
});
var Re = class {
  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 = true;
var rn = class {
  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], h4 = 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], M = r[7], T = r[2], w = r[5], _ = r[8];
    return s[0] = o * u + a * m + c * T, s[3] = o * y + a * x + c * w, s[6] = o * v + a * M + c * _, s[1] = l * u + d * m + h4 * T, s[4] = l * y + d * x + h4 * w, s[7] = l * v + d * M + h4 * _, s[2] = f * u + g * m + p * T, s[5] = f * y + g * x + p * w, s[8] = f * v + g * M + p * _, 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], h4 = d * o - a * l, f = a * c - d * s, g = l * s - o * c, p = t * h4 + 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] = h4 * 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 false;
    return true;
  }
  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 = true;
var Ks;
var Hs = class {
  static getDataURL(e) {
    if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u")
      return e.src;
    let t;
    if (e instanceof HTMLCanvasElement)
      t = e;
    else {
      Ks === void 0 && (Ks = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), Ks.width = e.width, Ks.height = e.height;
      const i = Ks.getContext("2d");
      e instanceof ImageData ? i.putImageData(e, 0, 0) : i.drawImage(e, 0, 0, e.width, e.height), t = Ks;
    }
    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");
  }
};
var dO = 0;
var Jt = class _Jt extends ts {
  constructor(e = _Jt.DEFAULT_IMAGE, t = _Jt.DEFAULT_MAPPING, i = hn2, r = hn2, s = Ut, o = yr, a = jn, c = Ps, l = 1, d = Rn) {
    super(), Object.defineProperty(this, "id", { value: dO++ }), this.uuid = $n(), 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 = true, this.matrix = new rn(), this.generateMipmaps = true, this.premultiplyAlpha = false, this.flipY = true, 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 = $n()), !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(sh(r[o].image)) : s.push(sh(r[o]));
        } else
          s = sh(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 !== Su) return e;
    if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1)
      switch (this.wrapS) {
        case Yr:
          e.x = e.x - Math.floor(e.x);
          break;
        case hn2:
          e.x = e.x < 0 ? 0 : 1;
          break;
        case No:
          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 Yr:
          e.y = e.y - Math.floor(e.y);
          break;
        case hn2:
          e.y = e.y < 0 ? 0 : 1;
          break;
        case No:
          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 === true && this.version++;
  }
};
Jt.DEFAULT_IMAGE = void 0;
Jt.DEFAULT_MAPPING = Su;
Jt.prototype.isTexture = true;
function sh(n) {
  return typeof HTMLImageElement < "u" && n instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && n instanceof ImageBitmap ? Hs.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."), {});
}
var xt = class {
  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], h4 = 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(h4 - u) < 0.01 && Math.abs(p - y) < 0.01) {
      if (Math.abs(d + f) < 0.1 && Math.abs(h4 + 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, M = (g + 1) / 2, T = (v + 1) / 2, w = (d + f) / 4, _ = (h4 + u) / 4, E = (p + y) / 4;
      return x > M && x > T ? x < 0.01 ? (i = 0, r = 0.707106781, s = 0.707106781) : (i = Math.sqrt(x), r = w / i, s = _ / i) : M > T ? M < 0.01 ? (i = 0.707106781, r = 0, s = 0.707106781) : (r = Math.sqrt(M), i = w / r, s = E / r) : T < 0.01 ? (i = 0.707106781, r = 0.707106781, s = 0) : (s = Math.sqrt(T), i = _ / s, r = E / s), this.set(i, r, s, t), this;
    }
    let m = Math.sqrt((y - p) * (y - p) + (h4 - u) * (h4 - u) + (f - d) * (f - d));
    return Math.abs(m) < 1e-3 && (m = 1), this.x = (y - p) / m, this.y = (h4 - 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 = true;
var gi = class extends ts {
  constructor(e, t, i = {}) {
    super(), this.width = e, this.height = t, this.depth = 1, this.scissor = new xt(0, 0, e, t), this.scissorTest = false, this.viewport = new xt(0, 0, e, t), this.texture = new Jt(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 : false, this.texture.minFilter = i.minFilter !== void 0 ? i.minFilter : Ut, this.depthBuffer = i.depthBuffer !== void 0 ? i.depthBuffer : true, this.stencilBuffer = i.stencilBuffer !== void 0 ? i.stencilBuffer : false, 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" });
  }
};
gi.prototype.isWebGLRenderTarget = true;
var fx = class extends gi {
  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;
  }
};
fx.prototype.isWebGLMultipleRenderTargets = true;
var Jf = class extends gi {
  constructor(e, t, i) {
    super(e, t, i), this.samples = 4;
  }
  copy(e) {
    return super.copy.call(this, e), this.samples = e.samples, this;
  }
};
Jf.prototype.isWebGLMultisampleRenderTarget = true;
var bn = class {
  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], h4 = 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] = h4;
      return;
    }
    if (a === 1) {
      e[t + 0] = f, e[t + 1] = g, e[t + 2] = p, e[t + 3] = u;
      return;
    }
    if (h4 !== u || c !== f || l !== g || d !== p) {
      let y = 1 - a;
      const v = c * f + l * g + d * p + h4 * u, m = v >= 0 ? 1 : -1, x = 1 - v * v;
      if (x > Number.EPSILON) {
        const T = Math.sqrt(x), w = Math.atan2(T, v * m);
        y = Math.sin(y * w) / T, a = Math.sin(a * w) / T;
      }
      const M = a * m;
      if (c = c * y + f * M, l = l * y + g * M, d = d * y + p * M, h4 = h4 * y + u * M, y === 1 - a) {
        const T = 1 / Math.sqrt(c * c + l * l + d * d + h4 * h4);
        c *= T, l *= T, d *= T, h4 *= T;
      }
    }
    e[t] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h4;
  }
  static multiplyQuaternionsFlat(e, t, i, r, s, o) {
    const a = i[r], c = i[r + 1], l = i[r + 2], d = i[r + 3], h4 = s[o], f = s[o + 1], g = s[o + 2], p = s[o + 3];
    return e[t] = a * p + d * h4 + c * g - l * f, e[t + 1] = c * p + d * f + l * h4 - a * g, e[t + 2] = l * p + d * g + a * f - c * h4, e[t + 3] = d * p - a * h4 - 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), h4 = a(s / 2), f = c(i / 2), g = c(r / 2), p = c(s / 2);
    switch (o) {
      case "XYZ":
        this._x = f * d * h4 + l * g * p, this._y = l * g * h4 - f * d * p, this._z = l * d * p + f * g * h4, this._w = l * d * h4 - f * g * p;
        break;
      case "YXZ":
        this._x = f * d * h4 + l * g * p, this._y = l * g * h4 - f * d * p, this._z = l * d * p - f * g * h4, this._w = l * d * h4 + f * g * p;
        break;
      case "ZXY":
        this._x = f * d * h4 - l * g * p, this._y = l * g * h4 + f * d * p, this._z = l * d * p + f * g * h4, this._w = l * d * h4 - f * g * p;
        break;
      case "ZYX":
        this._x = f * d * h4 - l * g * p, this._y = l * g * h4 + f * d * p, this._z = l * d * p - f * g * h4, this._w = l * d * h4 + f * g * p;
        break;
      case "YZX":
        this._x = f * d * h4 + l * g * p, this._y = l * g * h4 + f * d * p, this._z = l * d * p - f * g * h4, this._w = l * d * h4 - f * g * p;
        break;
      case "XZY":
        this._x = f * d * h4 - l * g * p, this._y = l * g * h4 - f * d * p, this._z = l * d * p + f * g * h4, this._w = l * d * h4 + f * g * p;
        break;
      default:
        console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + o);
    }
    return t !== false && 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], h4 = t[10], f = i + a + h4;
    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 > h4) {
      const g = 2 * Math.sqrt(1 + i - a - h4);
      this._w = (d - c) / g, this._x = 0.25 * g, this._y = (r + o) / g, this._z = (s + l) / g;
    } else if (a > h4) {
      const g = 2 * Math.sqrt(1 + a - i - h4);
      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 + h4 - 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(vn(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), h4 = Math.sin((1 - t) * d) / l, f = Math.sin(t * d) / l;
    return this._w = o * h4 + this._w * f, this._x = i * h4 + this._x * f, this._y = r * h4 + this._y * f, this._z = s * h4 + 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 = true;
var q = class {
  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(fg.setFromEuler(e));
  }
  applyAxisAngle(e, t) {
    return this.applyQuaternion(fg.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, h4 = c * r + s * i - o * t, f = -s * t - o * i - a * r;
    return this.x = l * c + f * -s + d * -a - h4 * -o, this.y = d * c + f * -o + h4 * -s - l * -a, this.z = h4 * 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 oh.copy(this).projectOnVector(e), this.sub(oh);
  }
  reflect(e) {
    return this.sub(oh.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(vn(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 = true;
var oh = new q();
var fg = new bn();
var Un = class {
  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], h4 = e[c + 1], f = e[c + 2];
      d < t && (t = d), h4 < i && (i = h4), f < r && (r = f), d > s && (s = d), h4 > o && (o = h4), 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), h4 = e.getY(c), f = e.getZ(c);
      d < t && (t = d), h4 < i && (i = h4), f < r && (r = f), d > s && (s = d), h4 > o && (o = h4), 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 = ba.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(false, false);
    const t = e.geometry;
    t !== void 0 && (t.boundingBox === null && t.computeBoundingBox(), ah.copy(t.boundingBox), ah.applyMatrix4(e.matrixWorld), this.union(ah));
    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, ba), ba.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 false;
    this.getCenter(xa), Wl.subVectors(this.max, xa), qs.subVectors(e.a, xa), Qs.subVectors(e.b, xa), eo.subVectors(e.c, xa), Mr.subVectors(Qs, qs), _r.subVectors(eo, Qs), cs.subVectors(qs, eo);
    let t = [
      0,
      -Mr.z,
      Mr.y,
      0,
      -_r.z,
      _r.y,
      0,
      -cs.z,
      cs.y,
      Mr.z,
      0,
      -Mr.x,
      _r.z,
      0,
      -_r.x,
      cs.z,
      0,
      -cs.x,
      -Mr.y,
      Mr.x,
      0,
      -_r.y,
      _r.x,
      0,
      -cs.y,
      cs.x,
      0
    ];
    return !lh(t, qs, Qs, eo, Wl) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !lh(t, qs, Qs, eo, Wl)) ? false : (jl.crossVectors(Mr, _r), t = [jl.x, jl.y, jl.z], lh(t, qs, Qs, eo, Wl));
  }
  clampPoint(e, t) {
    return t.copy(e).clamp(this.min, this.max);
  }
  distanceToPoint(e) {
    return ba.copy(e).clamp(this.min, this.max).sub(e).length();
  }
  getBoundingSphere(e) {
    return this.getCenter(e.center), e.radius = this.getSize(ba).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 : (ji[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), ji[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), ji[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), ji[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), ji[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), ji[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), ji[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), ji[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(ji), 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);
  }
};
Un.prototype.isBox3 = true;
var ji = [
  new q(),
  new q(),
  new q(),
  new q(),
  new q(),
  new q(),
  new q(),
  new q()
];
var ba = new q();
var ah = new Un();
var qs = new q();
var Qs = new q();
var eo = new q();
var Mr = new q();
var _r = new q();
var cs = new q();
var xa = new q();
var Wl = new q();
var jl = new q();
var us = new q();
function lh(n, e, t, i, r) {
  for (let s = 0, o = n.length - 3; s <= o; s += 3) {
    us.fromArray(n, s);
    const a = r.x * Math.abs(us.x) + r.y * Math.abs(us.y) + r.z * Math.abs(us.z), c = e.dot(us), l = t.dot(us), d = i.dot(us);
    if (Math.max(-Math.max(c, l, d), Math.min(c, l, d)) > a)
      return false;
  }
  return true;
}
var fO = new Un();
var pg = new q();
var ch = new q();
var uh = new q();
var br = class {
  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) : fO.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) {
    uh.subVectors(e, this.center);
    const t = uh.lengthSq();
    if (t > this.radius * this.radius) {
      const i = Math.sqrt(t), r = (i - this.radius) * 0.5;
      this.center.add(uh.multiplyScalar(r / i)), this.radius += r;
    }
    return this;
  }
  union(e) {
    return ch.subVectors(e.center, this.center).normalize().multiplyScalar(e.radius), this.expandByPoint(pg.copy(e.center).add(ch)), this.expandByPoint(pg.copy(e.center).sub(ch)), this;
  }
  equals(e) {
    return e.center.equals(this.center) && e.radius === this.radius;
  }
  clone() {
    return new this.constructor().copy(this);
  }
};
var $i = new q();
var hh = new q();
var $l = new q();
var Sr = new q();
var dh = new q();
var Zl = new q();
var fh = new q();
var ns = class {
  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, $i)), 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 = $i.subVectors(e, this.origin).dot(this.direction);
    return t < 0 ? this.origin.distanceToSquared(e) : ($i.copy(this.direction).multiplyScalar(t).add(this.origin), $i.distanceToSquared(e));
  }
  distanceSqToSegment(e, t, i, r) {
    hh.copy(e).add(t).multiplyScalar(0.5), $l.copy(t).sub(e).normalize(), Sr.copy(this.origin).sub(hh);
    const s = e.distanceTo(t) * 0.5, o = -this.direction.dot($l), a = Sr.dot(this.direction), c = -Sr.dot($l), l = Sr.lengthSq(), d = Math.abs(1 - o * o);
    let h4, f, g, p;
    if (d > 0)
      if (h4 = o * c - a, f = o * a - c, p = s * d, h4 >= 0)
        if (f >= -p)
          if (f <= p) {
            const u = 1 / d;
            h4 *= u, f *= u, g = h4 * (h4 + o * f + 2 * a) + f * (o * h4 + f + 2 * c) + l;
          } else
            f = s, h4 = Math.max(0, -(o * f + a)), g = -h4 * h4 + f * (f + 2 * c) + l;
        else
          f = -s, h4 = Math.max(0, -(o * f + a)), g = -h4 * h4 + f * (f + 2 * c) + l;
      else
        f <= -p ? (h4 = Math.max(0, -(-o * s + a)), f = h4 > 0 ? -s : Math.min(Math.max(-s, -c), s), g = -h4 * h4 + f * (f + 2 * c) + l) : f <= p ? (h4 = 0, f = Math.min(Math.max(-s, -c), s), g = f * (f + 2 * c) + l) : (h4 = Math.max(0, -(o * s + a)), f = h4 > 0 ? s : Math.min(Math.max(-s, -c), s), g = -h4 * h4 + f * (f + 2 * c) + l);
    else
      f = o > 0 ? -s : s, h4 = Math.max(0, -(o * f + a)), g = -h4 * h4 + f * (f + 2 * c) + l;
    return i && i.copy(this.direction).multiplyScalar(h4).add(this.origin), r && r.copy($l).multiplyScalar(f).add(hh), g;
  }
  intersectSphere(e, t) {
    $i.subVectors(e.center, this.origin);
    const i = $i.dot(this.direction), r = $i.dot($i) - 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, h4 = 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), h4 >= 0 ? (a = (e.min.z - f.z) * h4, c = (e.max.z - f.z) * h4) : (a = (e.max.z - f.z) * h4, c = (e.min.z - f.z) * h4), 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, $i) !== null;
  }
  intersectTriangle(e, t, i, r, s) {
    dh.subVectors(t, e), Zl.subVectors(i, e), fh.crossVectors(dh, Zl);
    let o = this.direction.dot(fh), a;
    if (o > 0) {
      if (r) return null;
      a = 1;
    } else if (o < 0)
      a = -1, o = -o;
    else
      return null;
    Sr.subVectors(this.origin, e);
    const c = a * this.direction.dot(Zl.crossVectors(Sr, Zl));
    if (c < 0)
      return null;
    const l = a * this.direction.dot(dh.cross(Sr));
    if (l < 0 || c + l > o)
      return null;
    const d = -a * Sr.dot(fh);
    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);
  }
};
var Ze = class _Ze {
  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, h4, 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] = h4, 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 _Ze().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 / to.setFromMatrixColumn(e, 0).length(), s = 1 / to.setFromMatrixColumn(e, 1).length(), o = 1 / to.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), h4 = Math.sin(s);
    if (e.order === "XYZ") {
      const f = o * d, g = o * h4, p = a * d, u = a * h4;
      t[0] = c * d, t[4] = -c * h4, 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 * h4, p = l * d, u = l * h4;
      t[0] = f + u * a, t[4] = p * a - g, t[8] = o * l, t[1] = o * h4, 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 * h4, p = l * d, u = l * h4;
      t[0] = f - u * a, t[4] = -o * h4, 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 * h4, p = a * d, u = a * h4;
      t[0] = c * d, t[4] = p * l - g, t[8] = f * l + u, t[1] = c * h4, 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 * h4, t[8] = p * h4 + g, t[1] = h4, t[5] = o * d, t[9] = -a * d, t[2] = -l * d, t[6] = g * h4 + p, t[10] = f - u * h4;
    } else if (e.order === "XZY") {
      const f = o * c, g = o * l, p = a * c, u = a * l;
      t[0] = c * d, t[4] = -h4, t[8] = l * d, t[1] = f * h4 + u, t[5] = o * d, t[9] = g * h4 - p, t[2] = p * h4 - g, t[6] = a * d, t[10] = u * h4 + 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(pO, e, mO);
  }
  lookAt(e, t, i) {
    const r = this.elements;
    return Vn.subVectors(e, t), Vn.lengthSq() === 0 && (Vn.z = 1), Vn.normalize(), Tr.crossVectors(i, Vn), Tr.lengthSq() === 0 && (Math.abs(i.z) === 1 ? Vn.x += 1e-4 : Vn.z += 1e-4, Vn.normalize(), Tr.crossVectors(i, Vn)), Tr.normalize(), Xl.crossVectors(Vn, Tr), r[0] = Tr.x, r[4] = Xl.x, r[8] = Vn.x, r[1] = Tr.y, r[5] = Xl.y, r[9] = Vn.y, r[2] = Tr.z, r[6] = Xl.z, r[10] = Vn.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], h4 = 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], M = i[11], T = i[15], w = r[0], _ = r[4], E = r[8], P = r[12], S = r[1], R = r[5], A = r[9], C = r[13], L = r[2], I = r[6], b = r[10], O = r[14], N = r[3], D = r[7], U = r[11], V = r[15];
    return s[0] = o * w + a * S + c * L + l * N, s[4] = o * _ + a * R + c * I + l * D, s[8] = o * E + a * A + c * b + l * U, s[12] = o * P + a * C + c * O + l * V, s[1] = d * w + h4 * S + f * L + g * N, s[5] = d * _ + h4 * R + f * I + g * D, s[9] = d * E + h4 * A + f * b + g * U, s[13] = d * P + h4 * C + f * O + g * V, s[2] = p * w + u * S + y * L + v * N, s[6] = p * _ + u * R + y * I + v * D, s[10] = p * E + u * A + y * b + v * U, s[14] = p * P + u * C + y * O + v * V, s[3] = m * w + x * S + M * L + T * N, s[7] = m * _ + x * R + M * I + T * D, s[11] = m * E + x * A + M * b + T * U, s[15] = m * P + x * C + M * O + T * V, 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], h4 = e[6], f = e[10], g = e[14], p = e[3], u = e[7], y = e[11], v = e[15];
    return p * (+s * c * h4 - r * l * h4 - 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 * h4 - t * a * g - s * o * h4 + i * o * g + s * a * d - i * l * d) + v * (-r * a * d - t * c * h4 + t * a * f + r * o * h4 - 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], h4 = e[9], f = e[10], g = e[11], p = e[12], u = e[13], y = e[14], v = e[15], m = h4 * y * l - u * f * l + u * c * g - a * y * g - h4 * c * v + a * f * v, x = p * f * l - d * y * l - p * c * g + o * y * g + d * c * v - o * f * v, M = d * u * l - p * h4 * l + p * a * g - o * u * g - d * a * v + o * h4 * v, T = p * h4 * c - d * u * c - p * a * f + o * u * f + d * a * y - o * h4 * y, w = t * m + i * x + r * M + s * T;
    if (w === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    const _ = 1 / w;
    return e[0] = m * _, e[1] = (u * f * s - h4 * y * s - u * r * g + i * y * g + h4 * r * v - i * f * v) * _, e[2] = (a * y * s - u * c * s + u * r * l - i * y * l - a * r * v + i * c * v) * _, e[3] = (h4 * c * s - a * f * s - h4 * r * l + i * f * l + a * r * g - i * c * g) * _, e[4] = x * _, e[5] = (d * y * s - p * f * s + p * r * g - t * y * g - d * r * v + t * f * v) * _, e[6] = (p * c * s - o * y * s - p * r * l + t * y * l + o * r * v - t * c * v) * _, e[7] = (o * f * s - d * c * s + d * r * l - t * f * l - o * r * g + t * c * g) * _, e[8] = M * _, e[9] = (p * h4 * s - d * u * s - p * i * g + t * u * g + d * i * v - t * h4 * v) * _, e[10] = (o * u * s - p * a * s + p * i * l - t * u * l - o * i * v + t * a * v) * _, e[11] = (d * a * s - o * h4 * s - d * i * l + t * h4 * l + o * i * g - t * a * g) * _, e[12] = T * _, e[13] = (d * u * r - p * h4 * r + p * i * f - t * u * f - d * i * y + t * h4 * y) * _, e[14] = (p * a * r - o * u * r - p * i * c + t * u * c + o * i * y - t * a * y) * _, e[15] = (o * h4 * r - d * a * r + d * i * c - t * h4 * c - o * i * f + t * a * f) * _, 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, h4 = a + a, f = s * l, g = s * d, p = s * h4, u = o * d, y = o * h4, v = a * h4, m = c * l, x = c * d, M = c * h4, T = i.x, w = i.y, _ = i.z;
    return r[0] = (1 - (u + v)) * T, r[1] = (g + M) * T, r[2] = (p - x) * T, r[3] = 0, r[4] = (g - M) * w, r[5] = (1 - (f + v)) * w, r[6] = (y + m) * w, r[7] = 0, r[8] = (p + x) * _, r[9] = (y - m) * _, r[10] = (1 - (f + u)) * _, 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 = to.set(r[0], r[1], r[2]).length();
    const o = to.set(r[4], r[5], r[6]).length(), a = to.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], li.copy(this);
    const l = 1 / s, d = 1 / o, h4 = 1 / a;
    return li.elements[0] *= l, li.elements[1] *= l, li.elements[2] *= l, li.elements[4] *= d, li.elements[5] *= d, li.elements[6] *= d, li.elements[8] *= h4, li.elements[9] *= h4, li.elements[10] *= h4, t.setFromRotationMatrix(li), 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), h4 = (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] = h4, 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), h4 = (t + e) * c, f = (i + r) * l, g = (o + s) * d;
    return a[0] = 2 * c, a[4] = 0, a[8] = 0, a[12] = -h4, 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 false;
    return true;
  }
  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;
  }
};
Ze.prototype.isMatrix4 = true;
var to = new q();
var li = new Ze();
var pO = new q(0, 0, 0);
var mO = new q(1, 1, 1);
var Tr = new q();
var Xl = new q();
var Vn = new q();
var mg = new Ze();
var gg = new bn();
var Ws = class _Ws {
  constructor(e = 0, t = 0, i = 0, r = _Ws.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 = true) {
    const r = e.elements, s = r[0], o = r[4], a = r[8], c = r[1], l = r[5], d = r[9], h4 = r[2], f = r[6], g = r[10];
    switch (t) {
      case "XYZ":
        this._y = Math.asin(vn(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(-vn(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(a, g), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-h4, s), this._z = 0);
        break;
      case "ZXY":
        this._x = Math.asin(vn(f, -1, 1)), Math.abs(f) < 0.9999999 ? (this._y = Math.atan2(-h4, g), this._z = Math.atan2(-o, l)) : (this._y = 0, this._z = Math.atan2(c, s));
        break;
      case "ZYX":
        this._y = Math.asin(-vn(h4, -1, 1)), Math.abs(h4) < 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(vn(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-d, l), this._y = Math.atan2(-h4, s)) : (this._x = 0, this._y = Math.atan2(a, g));
        break;
      case "XZY":
        this._z = Math.asin(-vn(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 === true && this._onChangeCallback(), this;
  }
  setFromQuaternion(e, t, i) {
    return mg.makeRotationFromQuaternion(e), this.setFromRotationMatrix(mg, t, i);
  }
  setFromVector3(e, t = this._order) {
    return this.set(e.x, e.y, e.z, t);
  }
  reorder(e) {
    return gg.setFromEuler(this), this.setFromQuaternion(gg, 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() {
  }
};
Ws.prototype.isEuler = true;
Ws.DefaultOrder = "XYZ";
Ws.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"];
var Kf = class {
  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;
  }
};
var gO = 0;
var vg = new q();
var no = new bn();
var Zi = new Ze();
var Yl = new q();
var wa = new q();
var vO = new q();
var yO = new bn();
var yg = new q(1, 0, 0);
var bg = new q(0, 1, 0);
var xg = new q(0, 0, 1);
var bO = { type: "added" };
var wg = { type: "removed" };
var lt = class _lt extends ts {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: gO++ }), this.uuid = $n(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = _lt.DefaultUp.clone();
    const e = new q(), t = new Ws(), i = new bn(), r = new q(1, 1, 1);
    function s() {
      i.setFromEuler(t, false);
    }
    function o() {
      t.setFromQuaternion(i, void 0, false);
    }
    t._onChange(s), i._onChange(o), Object.defineProperties(this, {
      position: {
        configurable: true,
        enumerable: true,
        value: e
      },
      rotation: {
        configurable: true,
        enumerable: true,
        value: t
      },
      quaternion: {
        configurable: true,
        enumerable: true,
        value: i
      },
      scale: {
        configurable: true,
        enumerable: true,
        value: r
      },
      modelViewMatrix: {
        value: new Ze()
      },
      normalMatrix: {
        value: new rn()
      }
    }), this.matrix = new Ze(), this.matrixWorld = new Ze(), this.matrixAutoUpdate = _lt.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = false, this.layers = new Kf(), this.visible = true, this.castShadow = false, this.receiveShadow = false, this.frustumCulled = true, 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, true);
  }
  setRotationFromMatrix(e) {
    this.quaternion.setFromRotationMatrix(e);
  }
  setRotationFromQuaternion(e) {
    this.quaternion.copy(e);
  }
  rotateOnAxis(e, t) {
    return no.setFromAxisAngle(e, t), this.quaternion.multiply(no), this;
  }
  rotateOnWorldAxis(e, t) {
    return no.setFromAxisAngle(e, t), this.quaternion.premultiply(no), this;
  }
  rotateX(e) {
    return this.rotateOnAxis(yg, e);
  }
  rotateY(e) {
    return this.rotateOnAxis(bg, e);
  }
  rotateZ(e) {
    return this.rotateOnAxis(xg, e);
  }
  translateOnAxis(e, t) {
    return vg.copy(e).applyQuaternion(this.quaternion), this.position.add(vg.multiplyScalar(t)), this;
  }
  translateX(e) {
    return this.translateOnAxis(yg, e);
  }
  translateY(e) {
    return this.translateOnAxis(bg, e);
  }
  translateZ(e) {
    return this.translateOnAxis(xg, e);
  }
  localToWorld(e) {
    return e.applyMatrix4(this.matrixWorld);
  }
  worldToLocal(e) {
    return e.applyMatrix4(Zi.copy(this.matrixWorld).invert());
  }
  lookAt(e, t, i) {
    e.isVector3 ? Yl.copy(e) : Yl.set(e, t, i);
    const r = this.parent;
    this.updateWorldMatrix(true, false), wa.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Zi.lookAt(wa, Yl, this.up) : Zi.lookAt(Yl, wa, this.up), this.quaternion.setFromRotationMatrix(Zi), r && (Zi.extractRotation(r.matrixWorld), no.setFromRotationMatrix(Zi), this.quaternion.premultiply(no.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(bO)) : 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(wg)), 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(wg);
    }
    return this.children.length = 0, this;
  }
  attach(e) {
    return this.updateWorldMatrix(true, false), Zi.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(true, false), Zi.multiply(e.parent.matrixWorld)), e.applyMatrix4(Zi), this.add(e), e.updateWorldMatrix(false, true), 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(true, false), e.setFromMatrixPosition(this.matrixWorld);
  }
  getWorldQuaternion(e) {
    return this.updateWorldMatrix(true, false), this.matrixWorld.decompose(wa, e, vO), e;
  }
  getWorldScale(e) {
    return this.updateWorldMatrix(true, false), this.matrixWorld.decompose(wa, yO, e), e;
  }
  getWorldDirection(e) {
    this.updateWorldMatrix(true, false);
    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 === false) 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 = true;
  }
  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 = false, e = true);
    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 === true && i !== null && i.updateWorldMatrix(true, false), this.matrixAutoUpdate && this.updateMatrix(), this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), t === true) {
      const r = this.children;
      for (let s = 0, o = r.length; s < o; s++)
        r[s].updateWorldMatrix(false, true);
    }
  }
  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 === true && (r.castShadow = true), this.receiveShadow === true && (r.receiveShadow = true), this.visible === false && (r.visible = false), this.frustumCulled === false && (r.frustumCulled = false), 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 === false && (r.matrixAutoUpdate = false), 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 h4 = c[l];
            s(e.shapes, h4);
          }
        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), h4 = 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), h4.length > 0 && (i.shapes = h4), 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 = true) {
    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 === true)
      for (let i = 0; i < e.children.length; i++) {
        const r = e.children[i];
        this.add(r.clone());
      }
    return this;
  }
};
lt.DefaultUp = new q(0, 1, 0);
lt.DefaultMatrixAutoUpdate = true;
lt.prototype.isObject3D = true;
var ci = new q();
var Xi = new q();
var ph = new q();
var Yi = new q();
var io = new q();
var ro = new q();
var Mg = new q();
var mh = new q();
var gh = new q();
var vh = new q();
var Zt = 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), ci.subVectors(e, t), r.cross(ci);
    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) {
    ci.subVectors(r, t), Xi.subVectors(i, t), ph.subVectors(e, t);
    const o = ci.dot(ci), a = ci.dot(Xi), c = ci.dot(ph), l = Xi.dot(Xi), d = Xi.dot(ph), h4 = o * l - a * a;
    if (h4 === 0)
      return s.set(-2, -1, -1);
    const f = 1 / h4, 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, Yi), Yi.x >= 0 && Yi.y >= 0 && Yi.x + Yi.y <= 1;
  }
  static getUV(e, t, i, r, s, o, a, c) {
    return this.getBarycoord(e, t, i, r, Yi), c.set(0, 0), c.addScaledVector(s, Yi.x), c.addScaledVector(o, Yi.y), c.addScaledVector(a, Yi.z), c;
  }
  static isFrontFacing(e, t, i, r) {
    return ci.subVectors(i, t), Xi.subVectors(e, t), ci.cross(Xi).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 ci.subVectors(this.c, this.b), Xi.subVectors(this.a, this.b), ci.cross(Xi).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;
    io.subVectors(r, i), ro.subVectors(s, i), mh.subVectors(e, i);
    const c = io.dot(mh), l = ro.dot(mh);
    if (c <= 0 && l <= 0)
      return t.copy(i);
    gh.subVectors(e, r);
    const d = io.dot(gh), h4 = ro.dot(gh);
    if (d >= 0 && h4 <= d)
      return t.copy(r);
    const f = c * h4 - d * l;
    if (f <= 0 && c >= 0 && d <= 0)
      return o = c / (c - d), t.copy(i).addScaledVector(io, o);
    vh.subVectors(e, s);
    const g = io.dot(vh), p = ro.dot(vh);
    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(ro, a);
    const y = d * p - g * h4;
    if (y <= 0 && h4 - d >= 0 && g - p >= 0)
      return Mg.subVectors(s, r), a = (h4 - d) / (h4 - d + (g - p)), t.copy(r).addScaledVector(Mg, a);
    const v = 1 / (y + u + f);
    return o = u * v, a = f * v, t.copy(i).addScaledVector(io, o).addScaledVector(ro, a);
  }
  equals(e) {
    return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
  }
};
var xO = 0;
var en = class extends ts {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: xO++ }), this.uuid = $n(), this.name = "", this.type = "Material", this.fog = true, this.blending = So, this.side = Zr, this.vertexColors = false, this.opacity = 1, this.transparent = false, this.blendSrc = Gf, this.blendDst = Hf, this.blendEquation = ys, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = qc, this.depthTest = true, this.depthWrite = true, this.stencilWriteMask = 255, this.stencilFunc = ux, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = kc, this.stencilZFail = kc, this.stencilZPass = kc, this.stencilWrite = false, this.clippingPlanes = null, this.clipIntersection = false, this.clipShadows = false, this.shadowSide = null, this.colorWrite = true, this.precision = null, this.polygonOffset = false, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = false, this.alphaTest = 0, this.alphaToCoverage = false, this.premultipliedAlpha = false, this.visible = true, this.toneMapped = true, 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 === kf;
          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 !== So && (i.blending = this.blending), this.side !== Zr && (i.side = this.side), this.vertexColors && (i.vertexColors = true), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === true && (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 === true && (i.polygonOffset = true), 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 === true && (i.dithering = true), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaToCoverage === true && (i.alphaToCoverage = this.alphaToCoverage), this.premultipliedAlpha === true && (i.premultipliedAlpha = this.premultipliedAlpha), this.wireframe === true && (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 === true && (i.morphTargets = true), this.morphNormals === true && (i.morphNormals = true), this.flatShading === true && (i.flatShading = this.flatShading), this.visible === false && (i.visible = false), this.toneMapped === false && (i.toneMapped = false), 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 === true && this.version++;
  }
};
en.prototype.isMaterial = true;
var px = {
  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
};
var ui = { h: 0, s: 0, l: 0 };
var Jl = { h: 0, s: 0, l: 0 };
function yh(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 bh(n) {
  return n < 0.04045 ? n * 0.0773993808 : Math.pow(n * 0.9478672986 + 0.0521327014, 2.4);
}
function xh(n) {
  return n < 31308e-7 ? n * 12.92 : 1.055 * Math.pow(n, 0.41666) - 0.055;
}
var Fe = class {
  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 = Yf(e, 1), t = vn(t, 0, 1), i = vn(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 = yh(s, r, e + 1 / 3), this.g = yh(s, r, e), this.b = yh(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 = px[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 = bh(e.r), this.g = bh(e.g), this.b = bh(e.b), this;
  }
  copyLinearToSRGB(e) {
    return this.r = xh(e.r), this.g = xh(e.g), this.b = xh(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(ui), ui.h += e, ui.s += t, ui.l += i, this.setHSL(ui.h, ui.s, ui.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(ui), e.getHSL(Jl);
    const i = ka(ui.h, Jl.h, t), r = ka(ui.s, Jl.s, t), s = ka(ui.l, Jl.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 === true && (this.r /= 255, this.g /= 255, this.b /= 255), this;
  }
  toJSON() {
    return this.getHex();
  }
};
Fe.NAMES = px;
Fe.prototype.isColor = true;
Fe.prototype.r = 1;
Fe.prototype.g = 1;
Fe.prototype.b = 1;
var Bn = class extends en {
  constructor(e) {
    super(), this.type = "MeshBasicMaterial", this.color = new Fe(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 = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = false, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = false, 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;
  }
};
Bn.prototype.isMeshBasicMaterial = true;
var _t = new q();
var Kl = new Re();
var rt = class {
  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 === true, this.usage = zo, this.updateRange = { offset: 0, count: -1 }, this.version = 0;
  }
  onUploadCallback() {
  }
  set needsUpdate(e) {
    e === true && 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 Fe()), 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++)
        Kl.fromBufferAttribute(this, t), Kl.applyMatrix3(e), this.setXY(t, Kl.x, Kl.y);
    else if (this.itemSize === 3)
      for (let t = 0, i = this.count; t < i; t++)
        _t.fromBufferAttribute(this, t), _t.applyMatrix3(e), this.setXYZ(t, _t.x, _t.y, _t.z);
    return this;
  }
  applyMatrix4(e) {
    for (let t = 0, i = this.count; t < i; t++)
      _t.x = this.getX(t), _t.y = this.getY(t), _t.z = this.getZ(t), _t.applyMatrix4(e), this.setXYZ(t, _t.x, _t.y, _t.z);
    return this;
  }
  applyNormalMatrix(e) {
    for (let t = 0, i = this.count; t < i; t++)
      _t.x = this.getX(t), _t.y = this.getY(t), _t.z = this.getZ(t), _t.applyNormalMatrix(e), this.setXYZ(t, _t.x, _t.y, _t.z);
    return this;
  }
  transformDirection(e) {
    for (let t = 0, i = this.count; t < i; t++)
      _t.x = this.getX(t), _t.y = this.getY(t), _t.z = this.getZ(t), _t.transformDirection(e), this.setXYZ(t, _t.x, _t.y, _t.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 !== zo && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e;
  }
};
rt.prototype.isBufferAttribute = true;
var mx = class extends rt {
  constructor(e, t, i) {
    super(new Int8Array(e), t, i);
  }
};
var gx = class extends rt {
  constructor(e, t, i) {
    super(new Uint8Array(e), t, i);
  }
};
var vx = class extends rt {
  constructor(e, t, i) {
    super(new Uint8ClampedArray(e), t, i);
  }
};
var yx = class extends rt {
  constructor(e, t, i) {
    super(new Int16Array(e), t, i);
  }
};
var Lu = class extends rt {
  constructor(e, t, i) {
    super(new Uint16Array(e), t, i);
  }
};
var bx = class extends rt {
  constructor(e, t, i) {
    super(new Int32Array(e), t, i);
  }
};
var Ru = class extends rt {
  constructor(e, t, i) {
    super(new Uint32Array(e), t, i);
  }
};
var xx = class extends rt {
  constructor(e, t, i) {
    super(new Uint16Array(e), t, i);
  }
};
xx.prototype.isFloat16BufferAttribute = true;
var We = class extends rt {
  constructor(e, t, i) {
    super(new Float32Array(e), t, i);
  }
};
var wx = class extends rt {
  constructor(e, t, i) {
    super(new Float64Array(e), t, i);
  }
};
function Mx(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;
}
var wO = {
  Int8Array,
  Uint8Array,
  Uint8ClampedArray,
  Int16Array,
  Uint16Array,
  Int32Array,
  Uint32Array,
  Float32Array,
  Float64Array
};
function Mo(n, e) {
  return new wO[n](e);
}
var MO = 0;
var Kn = new Ze();
var wh = new lt();
var so = new q();
var kn = new Un();
var Ma = new Un();
var ln = new q();
var Ke = class _Ke extends ts {
  constructor() {
    super(), Object.defineProperty(this, "id", { value: MO++ }), this.uuid = $n(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = false, 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 (Mx(e) > 65535 ? Ru : Lu)(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 = true);
    const i = this.attributes.normal;
    if (i !== void 0) {
      const s = new rn().getNormalMatrix(e);
      i.applyNormalMatrix(s), i.needsUpdate = true;
    }
    const r = this.attributes.tangent;
    return r !== void 0 && (r.transformDirection(e), r.needsUpdate = true), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this;
  }
  applyQuaternion(e) {
    return Kn.makeRotationFromQuaternion(e), this.applyMatrix4(Kn), this;
  }
  rotateX(e) {
    return Kn.makeRotationX(e), this.applyMatrix4(Kn), this;
  }
  rotateY(e) {
    return Kn.makeRotationY(e), this.applyMatrix4(Kn), this;
  }
  rotateZ(e) {
    return Kn.makeRotationZ(e), this.applyMatrix4(Kn), this;
  }
  translate(e, t, i) {
    return Kn.makeTranslation(e, t, i), this.applyMatrix4(Kn), this;
  }
  scale(e, t, i) {
    return Kn.makeScale(e, t, i), this.applyMatrix4(Kn), this;
  }
  lookAt(e) {
    return wh.lookAt(e), wh.updateMatrix(), this.applyMatrix4(wh.matrix), this;
  }
  center() {
    return this.computeBoundingBox(), this.boundingBox.getCenter(so).negate(), this.translate(so.x, so.y, so.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 Un());
    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];
          kn.setFromBufferAttribute(s), this.morphTargetsRelative ? (ln.addVectors(this.boundingBox.min, kn.min), this.boundingBox.expandByPoint(ln), ln.addVectors(this.boundingBox.max, kn.max), this.boundingBox.expandByPoint(ln)) : (this.boundingBox.expandByPoint(kn.min), this.boundingBox.expandByPoint(kn.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 br());
    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 (kn.setFromBufferAttribute(e), t)
        for (let s = 0, o = t.length; s < o; s++) {
          const a = t[s];
          Ma.setFromBufferAttribute(a), this.morphTargetsRelative ? (ln.addVectors(kn.min, Ma.min), kn.expandByPoint(ln), ln.addVectors(kn.max, Ma.max), kn.expandByPoint(ln)) : (kn.expandByPoint(Ma.min), kn.expandByPoint(Ma.max));
        }
      kn.getCenter(i);
      let r = 0;
      for (let s = 0, o = e.count; s < o; s++)
        ln.fromBufferAttribute(e, s), r = Math.max(r, i.distanceToSquared(ln));
      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++)
            ln.fromBufferAttribute(a, l), c && (so.fromBufferAttribute(e, l), ln.add(so)), r = Math.max(r, i.distanceToSquared(ln));
        }
      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 rt(new Float32Array(4 * a), 4));
    const c = t.tangent.array, l = [], d = [];
    for (let S = 0; S < a; S++)
      l[S] = new q(), d[S] = new q();
    const h4 = 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(S, R, A) {
      h4.fromArray(r, S * 3), f.fromArray(r, R * 3), g.fromArray(r, A * 3), p.fromArray(o, S * 2), u.fromArray(o, R * 2), y.fromArray(o, A * 2), f.sub(h4), g.sub(h4), u.sub(p), y.sub(p);
      const C = 1 / (u.x * y.y - y.x * u.y);
      isFinite(C) && (v.copy(f).multiplyScalar(y.y).addScaledVector(g, -u.y).multiplyScalar(C), m.copy(g).multiplyScalar(u.x).addScaledVector(f, -y.x).multiplyScalar(C), l[S].add(v), l[R].add(v), l[A].add(v), d[S].add(m), d[R].add(m), d[A].add(m));
    }
    let M = this.groups;
    M.length === 0 && (M = [{
      start: 0,
      count: i.length
    }]);
    for (let S = 0, R = M.length; S < R; ++S) {
      const A = M[S], C = A.start, L = A.count;
      for (let I = C, b = C + L; I < b; I += 3)
        x(
          i[I + 0],
          i[I + 1],
          i[I + 2]
        );
    }
    const T = new q(), w = new q(), _ = new q(), E = new q();
    function P(S) {
      _.fromArray(s, S * 3), E.copy(_);
      const R = l[S];
      T.copy(R), T.sub(_.multiplyScalar(_.dot(R))).normalize(), w.crossVectors(E, R);
      const C = w.dot(d[S]) < 0 ? -1 : 1;
      c[S * 4] = T.x, c[S * 4 + 1] = T.y, c[S * 4 + 2] = T.z, c[S * 4 + 3] = C;
    }
    for (let S = 0, R = M.length; S < R; ++S) {
      const A = M[S], C = A.start, L = A.count;
      for (let I = C, b = C + L; I < b; I += 3)
        P(i[I + 0]), P(i[I + 1]), P(i[I + 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 rt(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(), h4 = 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), h4.subVectors(r, s), d.cross(h4), 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), h4.subVectors(r, s), d.cross(h4), 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 = true;
    }
  }
  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 h4 = 0, f = l; h4 < d; h4++, f++)
        o[f] = c[h4];
    }
    return this;
  }
  normalizeNormals() {
    const e = this.attributes.normal;
    for (let t = 0, i = e.count; t < i; t++)
      ln.fromBufferAttribute(e, t), ln.normalize(), e.setXYZ(t, ln.x, ln.y, ln.z);
  }
  toNonIndexed() {
    function e(a, c) {
      const l = a.array, d = a.itemSize, h4 = 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 rt(f, d, h4);
    }
    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, h4 = l.length; d < h4; 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 = false;
    for (const c in this.morphAttributes) {
      const l = this.morphAttributes[c], d = [];
      for (let h4 = 0, f = l.length; h4 < f; h4++) {
        const g = l[h4];
        d.push(g.toJSON(e.data));
      }
      d.length > 0 && (r[c] = d, s = true);
    }
    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 = [], h4 = s[l];
      for (let f = 0, g = h4.length; f < g; f++)
        d.push(h4[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 h4 = o[l];
      this.addGroup(h4.start, h4.count, h4.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 = true;
var _g = new Ze();
var oo = new ns();
var Mh = new br();
var Er = new q();
var Ar = new q();
var Cr = new q();
var _h = new q();
var Sh = new q();
var Th = new q();
var ql = new q();
var Ql = new q();
var ec = new q();
var tc = new Re();
var nc = new Re();
var ic = new Re();
var Eh = new q();
var rc = new q();
var Yt = class extends lt {
  constructor(e = new Ke(), t = new Bn()) {
    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(), Mh.copy(i.boundingSphere), Mh.applyMatrix4(s), e.ray.intersectsSphere(Mh) === false) || (_g.copy(s).invert(), oo.copy(e.ray).applyMatrix4(_g), i.boundingBox !== null && oo.intersectsBox(i.boundingBox) === false))
      return;
    let o;
    if (i.isBufferGeometry) {
      const a = i.index, c = i.attributes.position, l = i.morphAttributes.position, d = i.morphTargetsRelative, h4 = 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), M = Math.min(v.start + v.count, p.start + p.count);
            for (let T = x, w = M; T < w; T += 3) {
              const _ = a.getX(T), E = a.getX(T + 1), P = a.getX(T + 2);
              o = sc(this, m, e, oo, c, l, d, h4, f, _, E, P), o && (o.faceIndex = Math.floor(T / 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), M = a.getX(v + 1), T = a.getX(v + 2);
            o = sc(this, r, e, oo, c, l, d, h4, f, x, M, T), 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), M = Math.min(v.start + v.count, p.start + p.count);
            for (let T = x, w = M; T < w; T += 3) {
              const _ = T, E = T + 1, P = T + 2;
              o = sc(this, m, e, oo, c, l, d, h4, f, _, E, P), o && (o.faceIndex = Math.floor(T / 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, M = v + 1, T = v + 2;
            o = sc(this, r, e, oo, c, l, d, h4, f, x, M, T), 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.");
  }
};
Yt.prototype.isMesh = true;
function _O(n, e, t, i, r, s, o, a) {
  let c;
  if (e.side === jt ? c = i.intersectTriangle(o, s, r, true, a) : c = i.intersectTriangle(r, s, o, e.side !== Xr, a), c === null) return null;
  rc.copy(a), rc.applyMatrix4(n.matrixWorld);
  const l = t.ray.origin.distanceTo(rc);
  return l < t.near || l > t.far ? null : {
    distance: l,
    point: rc.clone(),
    object: n
  };
}
function sc(n, e, t, i, r, s, o, a, c, l, d, h4) {
  Er.fromBufferAttribute(r, l), Ar.fromBufferAttribute(r, d), Cr.fromBufferAttribute(r, h4);
  const f = n.morphTargetInfluences;
  if (e.morphTargets && s && f) {
    ql.set(0, 0, 0), Ql.set(0, 0, 0), ec.set(0, 0, 0);
    for (let p = 0, u = s.length; p < u; p++) {
      const y = f[p], v = s[p];
      y !== 0 && (_h.fromBufferAttribute(v, l), Sh.fromBufferAttribute(v, d), Th.fromBufferAttribute(v, h4), o ? (ql.addScaledVector(_h, y), Ql.addScaledVector(Sh, y), ec.addScaledVector(Th, y)) : (ql.addScaledVector(_h.sub(Er), y), Ql.addScaledVector(Sh.sub(Ar), y), ec.addScaledVector(Th.sub(Cr), y)));
    }
    Er.add(ql), Ar.add(Ql), Cr.add(ec);
  }
  n.isSkinnedMesh && (n.boneTransform(l, Er), n.boneTransform(d, Ar), n.boneTransform(h4, Cr));
  const g = _O(n, e, t, i, Er, Ar, Cr, Eh);
  if (g) {
    a && (tc.fromBufferAttribute(a, l), nc.fromBufferAttribute(a, d), ic.fromBufferAttribute(a, h4), g.uv = Zt.getUV(Eh, Er, Ar, Cr, tc, nc, ic, new Re())), c && (tc.fromBufferAttribute(c, l), nc.fromBufferAttribute(c, d), ic.fromBufferAttribute(c, h4), g.uv2 = Zt.getUV(Eh, Er, Ar, Cr, tc, nc, ic, new Re()));
    const p = {
      a: l,
      b: d,
      c: h4,
      normal: new q(),
      materialIndex: 0
    };
    Zt.getNormal(Er, Ar, Cr, p.normal), g.face = p;
  }
  return g;
}
var ur = class _ur 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 = [], h4 = [];
    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(h4, 2));
    function p(u, y, v, m, x, M, T, w, _, E, P) {
      const S = M / _, R = T / E, A = M / 2, C = T / 2, L = w / 2, I = _ + 1, b = E + 1;
      let O = 0, N = 0;
      const D = new q();
      for (let U = 0; U < b; U++) {
        const V = U * R - C;
        for (let H = 0; H < I; H++) {
          const Y = H * S - A;
          D[u] = Y * m, D[y] = V * x, D[v] = L, l.push(D.x, D.y, D.z), D[u] = 0, D[y] = 0, D[v] = w > 0 ? 1 : -1, d.push(D.x, D.y, D.z), h4.push(H / _), h4.push(1 - U / E), O += 1;
        }
      }
      for (let U = 0; U < E; U++)
        for (let V = 0; V < _; V++) {
          const H = f + V + I * U, Y = f + V + I * (U + 1), re = f + (V + 1) + I * (U + 1), ae = f + (V + 1) + I * U;
          c.push(H, Y, ae), c.push(Y, re, ae), N += 6;
        }
      a.addGroup(g, N, P), g += N, f += O;
    }
  }
  static fromJSON(e) {
    return new _ur(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments);
  }
};
function Vo(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 Mn(n) {
  const e = {};
  for (let t = 0; t < n.length; t++) {
    const i = Vo(n[t]);
    for (const r in i)
      e[r] = i[r];
  }
  return e;
}
var _x = { clone: Vo, merge: Mn };
var SO = `void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`;
var TO = `void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;
var hr = class extends en {
  constructor(e) {
    super(), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = SO, this.fragmentShader = TO, this.linewidth = 1, this.wireframe = false, this.wireframeLinewidth = 1, this.fog = false, this.lights = false, this.clipping = false, this.morphTargets = false, this.morphNormals = false, this.extensions = {
      derivatives: false,
      // set to use derivatives
      fragDepth: false,
      // set to use fragment depth values
      drawBuffers: false,
      // set to use draw buffers
      shaderTextureLOD: false
      // set to use shader texture LOD
    }, this.defaultAttributeValues = {
      color: [1, 1, 1],
      uv: [0, 0],
      uv2: [0, 0]
    }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = false, 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 = Vo(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] === true && (i[r] = true);
    return Object.keys(i).length > 0 && (t.extensions = i), t;
  }
};
hr.prototype.isShaderMaterial = true;
var wl = class extends lt {
  constructor() {
    super(), this.type = "Camera", this.matrixWorldInverse = new Ze(), this.projectionMatrix = new Ze(), this.projectionMatrixInverse = new Ze();
  }
  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(true, false);
    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);
  }
};
wl.prototype.isCamera = true;
var nn = class extends wl {
  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 = nl * 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 nl * 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: true,
      fullWidth: 1,
      fullHeight: 1,
      offsetX: 0,
      offsetY: 0,
      width: 1,
      height: 1
    }), this.view.enabled = true, 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 = false), 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 = true;
var ao = 90;
var lo = 1;
var Pu = class extends lt {
  constructor(e, t, i) {
    if (super(), this.type = "CubeCamera", i.isWebGLCubeRenderTarget !== true) {
      console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");
      return;
    }
    this.renderTarget = i;
    const r = new nn(ao, lo, 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(ao, lo, 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(ao, lo, 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(ao, lo, 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(ao, lo, 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(ao, lo, 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, h4 = e.getRenderTarget();
    e.xr.enabled = false;
    const f = i.texture.generateMipmaps;
    i.texture.generateMipmaps = false, 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(h4), e.xr.enabled = d;
  }
};
var ca = class extends Jt {
  constructor(e, t, i, r, s, o, a, c, l, d) {
    e = e !== void 0 ? e : [], t = t !== void 0 ? t : yl, a = a !== void 0 ? a : or, super(e, t, i, r, s, o, a, c, l, d), this._needsFlipEnvMap = true, this.flipY = false;
  }
  get images() {
    return this.image;
  }
  set images(e) {
    this.image = e;
  }
};
ca.prototype.isCubeTexture = true;
var Ou = class extends gi {
  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 ca(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 : false, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : Ut, this.texture._needsFlipEnvMap = false;
  }
  fromEquirectangularTexture(e, t) {
    this.texture.type = t.type, this.texture.format = jn, 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 ur(5, 5, 5), s = new hr({
      name: "CubemapFromEquirect",
      uniforms: Vo(i.uniforms),
      vertexShader: i.vertexShader,
      fragmentShader: i.fragmentShader,
      side: jt,
      blending: sr
    });
    s.uniforms.tEquirect.value = t;
    const o = new Yt(r, s), a = t.minFilter;
    return t.minFilter === yr && (t.minFilter = Ut), new Pu(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);
  }
};
Ou.prototype.isWebGLCubeRenderTarget = true;
var Ah = new q();
var EO = new q();
var AO = new rn();
var Ei = class {
  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 = Ah.subVectors(i, t).cross(EO.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(Ah), 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 || AO.getNormalMatrix(e), r = this.coplanarPoint(Ah).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);
  }
};
Ei.prototype.isPlane = true;
var co = new br();
var oc = new q();
var Ml = class {
  constructor(e = new Ei(), t = new Ei(), i = new Ei(), r = new Ei(), s = new Ei(), o = new Ei()) {
    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], h4 = 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, h4 - c, u - f, x - y).normalize(), t[1].setComponents(a + r, h4 + c, u + f, x + y).normalize(), t[2].setComponents(a + s, h4 + l, u + g, x + v).normalize(), t[3].setComponents(a - s, h4 - l, u - g, x - v).normalize(), t[4].setComponents(a - o, h4 - d, u - p, x - m).normalize(), t[5].setComponents(a + o, h4 + d, u + p, x + m).normalize(), this;
  }
  intersectsObject(e) {
    const t = e.geometry;
    return t.boundingSphere === null && t.computeBoundingSphere(), co.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(co);
  }
  intersectsSprite(e) {
    return co.center.set(0, 0, 0), co.radius = 0.7071067811865476, co.applyMatrix4(e.matrixWorld), this.intersectsSphere(co);
  }
  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 false;
    return true;
  }
  intersectsBox(e) {
    const t = this.planes;
    for (let i = 0; i < 6; i++) {
      const r = t[i];
      if (oc.x = r.normal.x > 0 ? e.max.x : e.min.x, oc.y = r.normal.y > 0 ? e.max.y : e.min.y, oc.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(oc) < 0)
        return false;
    }
    return true;
  }
  containsPoint(e) {
    const t = this.planes;
    for (let i = 0; i < 6; i++)
      if (t[i].distanceToPoint(e) < 0)
        return false;
    return true;
  }
  clone() {
    return new this.constructor().copy(this);
  }
};
function Sx() {
  let n = null, e = false, t = null, i = null;
  function r(s, o) {
    t(s, o), i = n.requestAnimationFrame(r);
  }
  return {
    start: function() {
      e !== true && t !== null && (i = n.requestAnimationFrame(r), e = true);
    },
    stop: function() {
      n.cancelAnimationFrame(i), e = false;
    },
    setAnimationLoop: function(s) {
      t = s;
    },
    setContext: function(s) {
      n = s;
    }
  };
}
function CO(n, e) {
  const t = e.isWebGL2, i = /* @__PURE__ */ new WeakMap();
  function r(l, d) {
    const h4 = l.array, f = l.usage, g = n.createBuffer();
    n.bindBuffer(d, g), n.bufferData(d, h4, f), l.onUploadCallback();
    let p = 5126;
    return h4 instanceof Float32Array ? p = 5126 : h4 instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : h4 instanceof Uint16Array ? l.isFloat16BufferAttribute ? t ? p = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : p = 5123 : h4 instanceof Int16Array ? p = 5122 : h4 instanceof Uint32Array ? p = 5125 : h4 instanceof Int32Array ? p = 5124 : h4 instanceof Int8Array ? p = 5120 : (h4 instanceof Uint8Array || h4 instanceof Uint8ClampedArray) && (p = 5121), {
      buffer: g,
      type: p,
      bytesPerElement: h4.BYTES_PER_ELEMENT,
      version: l.version
    };
  }
  function s(l, d, h4) {
    const f = d.array, g = d.updateRange;
    n.bindBuffer(h4, l), g.count === -1 ? n.bufferSubData(h4, 0, f) : (t ? n.bufferSubData(
      h4,
      g.offset * f.BYTES_PER_ELEMENT,
      f,
      g.offset,
      g.count
    ) : n.bufferSubData(
      h4,
      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 h4 = i.get(l);
    h4 === void 0 ? i.set(l, r(l, d)) : h4.version < l.version && (s(h4.buffer, l, d), h4.version = l.version);
  }
  return {
    get: o,
    remove: a,
    update: c
  };
}
var Ds = class _Ds 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, h4 = 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 M = x * h4 - s;
        p.push(M, -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, M = m + l * (v + 1), T = m + 1 + l * (v + 1), w = m + 1 + l * v;
        g.push(x, M, w), g.push(M, T, w);
      }
    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 _Ds(e.width, e.height, e.widthSegments, e.heightSegments);
  }
};
var LO = `#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`;
var RO = `#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`;
var PO = `#ifdef ALPHATEST
	if ( diffuseColor.a < ALPHATEST ) discard;
#endif`;
var OO = `#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`;
var IO = `#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`;
var DO = "vec3 transformed = vec3( position );";
var NO = `vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`;
var BO = `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`;
var FO = `#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`;
var zO = `#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`;
var UO = `#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`;
var VO = `#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`;
var kO = `#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`;
var GO = `#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`;
var HO = `#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`;
var WO = `#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	varying vec3 vColor;
#endif`;
var jO = `#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`;
var $O = `#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 );
}`;
var ZO = `#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`;
var XO = `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`;
var YO = `#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`;
var JO = `#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`;
var KO = `#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vUv );
	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`;
var qO = `#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`;
var QO = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
var eI = `
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 );
}`;
var tI = `#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`;
var nI = `#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`;
var iI = `#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`;
var rI = `#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`;
var sI = `#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`;
var oI = `#ifdef USE_FOG
	fogDepth = - mvPosition.z;
#endif`;
var aI = `#ifdef USE_FOG
	varying float fogDepth;
#endif`;
var lI = `#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`;
var cI = `#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float fogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`;
var uI = `#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
}`;
var hI = `#ifdef USE_LIGHTMAP
	vec4 lightMapTexel= texture2D( lightMap, vUv2 );
	reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#endif`;
var dI = `#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`;
var fI = `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`;
var pI = `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`;
var mI = `#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`;
var gI = `ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`;
var vI = `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)`;
var yI = `BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`;
var bI = `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)`;
var xI = `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`;
var wI = `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 );
}`;
var MI = `
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`;
var _I = `#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`;
var SI = `#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`;
var TI = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`;
var EI = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`;
var AI = `#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		varying float vFragDepth;
		varying float vIsPerspective;
	#else
		uniform float logDepthBufFC;
	#endif
#endif`;
var CI = `#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`;
var LI = `#ifdef USE_MAP
	vec4 texelColor = texture2D( map, vUv );
	texelColor = mapTexelToLinear( texelColor );
	diffuseColor *= texelColor;
#endif`;
var RI = `#ifdef USE_MAP
	uniform sampler2D map;
#endif`;
var PI = `#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`;
var OI = `#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`;
var II = `float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vUv );
	metalnessFactor *= texelMetalness.b;
#endif`;
var DI = `#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`;
var NI = `#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
	objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
	objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
	objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif`;
var BI = `#ifdef USE_MORPHTARGETS
	uniform float morphTargetBaseInfluence;
	#ifndef USE_MORPHNORMALS
		uniform float morphTargetInfluences[ 8 ];
	#else
		uniform float morphTargetInfluences[ 4 ];
	#endif
#endif`;
var FI = `#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`;
var zI = `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;`;
var UI = `#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`;
var VI = `#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`;
var kI = `#ifdef CLEARCOAT
	vec3 clearcoatNormal = geometryNormal;
#endif`;
var GI = `#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`;
var HI = `#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`;
var WI = `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 );
}`;
var jI = `#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`;
var $I = `vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`;
var ZI = `#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`;
var XI = `#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`;
var YI = `float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vUv );
	roughnessFactor *= texelRoughness.g;
#endif`;
var JI = `#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`;
var KI = `#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`;
var qI = `#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`;
var QI = `#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`;
var e3 = `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;
}`;
var t3 = `#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`;
var n3 = `#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`;
var i3 = `#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`;
var r3 = `#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`;
var s3 = `float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`;
var o3 = `#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`;
var a3 = `#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`;
var l3 = `#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; }`;
var c3 = `#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`;
var u3 = `#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`;
var h3 = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
	varying vec2 vUv;
#endif`;
var d3 = `#ifdef USE_UV
	#ifdef UVS_VERTEX_ONLY
		vec2 vUv;
	#else
		varying vec2 vUv;
	#endif
	uniform mat3 uvTransform;
#endif`;
var f3 = `#ifdef USE_UV
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`;
var p3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	varying vec2 vUv2;
#endif`;
var m3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	attribute vec2 uv2;
	varying vec2 vUv2;
	uniform mat3 uv2Transform;
#endif`;
var g3 = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`;
var v3 = `#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`;
var y3 = `uniform sampler2D t2D;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	gl_FragColor = mapTexelToLinear( texColor );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`;
var b3 = `varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`;
var x3 = `#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>
}`;
var w3 = `varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`;
var M3 = `#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
}`;
var _3 = `#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;
}`;
var S3 = `#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 );
}`;
var T3 = `#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;
}`;
var E3 = `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>
}`;
var A3 = `varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`;
var C3 = `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>
}`;
var L3 = `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>
}`;
var R3 = `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>
}`;
var P3 = `#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>
}`;
var O3 = `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>
}`;
var I3 = `#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>
}`;
var D3 = `#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>
}`;
var N3 = `#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;
}`;
var B3 = `#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>
}`;
var F3 = `#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>
}`;
var z3 = `#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>
}`;
var U3 = `#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>
}`;
var V3 = `#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>
}`;
var k3 = `#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
}`;
var G3 = `#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 );
}`;
var H3 = `#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
}`;
var W3 = `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>
}`;
var j3 = `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>
}`;
var $3 = `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>
}`;
var Z3 = `#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>
}`;
var X3 = `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>
}`;
var Y3 = `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>
}`;
var ut = {
  alphamap_fragment: LO,
  alphamap_pars_fragment: RO,
  alphatest_fragment: PO,
  aomap_fragment: OO,
  aomap_pars_fragment: IO,
  begin_vertex: DO,
  beginnormal_vertex: NO,
  bsdfs: BO,
  bumpmap_pars_fragment: FO,
  clipping_planes_fragment: zO,
  clipping_planes_pars_fragment: UO,
  clipping_planes_pars_vertex: VO,
  clipping_planes_vertex: kO,
  color_fragment: GO,
  color_pars_fragment: HO,
  color_pars_vertex: WO,
  color_vertex: jO,
  common: $O,
  cube_uv_reflection_fragment: ZO,
  defaultnormal_vertex: XO,
  displacementmap_pars_vertex: YO,
  displacementmap_vertex: JO,
  emissivemap_fragment: KO,
  emissivemap_pars_fragment: qO,
  encodings_fragment: QO,
  encodings_pars_fragment: eI,
  envmap_fragment: tI,
  envmap_common_pars_fragment: nI,
  envmap_pars_fragment: iI,
  envmap_pars_vertex: rI,
  envmap_physical_pars_fragment: mI,
  envmap_vertex: sI,
  fog_vertex: oI,
  fog_pars_vertex: aI,
  fog_fragment: lI,
  fog_pars_fragment: cI,
  gradientmap_pars_fragment: uI,
  lightmap_fragment: hI,
  lightmap_pars_fragment: dI,
  lights_lambert_vertex: fI,
  lights_pars_begin: pI,
  lights_toon_fragment: gI,
  lights_toon_pars_fragment: vI,
  lights_phong_fragment: yI,
  lights_phong_pars_fragment: bI,
  lights_physical_fragment: xI,
  lights_physical_pars_fragment: wI,
  lights_fragment_begin: MI,
  lights_fragment_maps: _I,
  lights_fragment_end: SI,
  logdepthbuf_fragment: TI,
  logdepthbuf_pars_fragment: EI,
  logdepthbuf_pars_vertex: AI,
  logdepthbuf_vertex: CI,
  map_fragment: LI,
  map_pars_fragment: RI,
  map_particle_fragment: PI,
  map_particle_pars_fragment: OI,
  metalnessmap_fragment: II,
  metalnessmap_pars_fragment: DI,
  morphnormal_vertex: NI,
  morphtarget_pars_vertex: BI,
  morphtarget_vertex: FI,
  normal_fragment_begin: zI,
  normal_fragment_maps: UI,
  normalmap_pars_fragment: VI,
  clearcoat_normal_fragment_begin: kI,
  clearcoat_normal_fragment_maps: GI,
  clearcoat_pars_fragment: HI,
  packing: WI,
  premultiplied_alpha_fragment: jI,
  project_vertex: $I,
  dithering_fragment: ZI,
  dithering_pars_fragment: XI,
  roughnessmap_fragment: YI,
  roughnessmap_pars_fragment: JI,
  shadowmap_pars_fragment: KI,
  shadowmap_pars_vertex: qI,
  shadowmap_vertex: QI,
  shadowmask_pars_fragment: e3,
  skinbase_vertex: t3,
  skinning_pars_vertex: n3,
  skinning_vertex: i3,
  skinnormal_vertex: r3,
  specularmap_fragment: s3,
  specularmap_pars_fragment: o3,
  tonemapping_fragment: a3,
  tonemapping_pars_fragment: l3,
  transmission_fragment: c3,
  transmission_pars_fragment: u3,
  uv_pars_fragment: h3,
  uv_pars_vertex: d3,
  uv_vertex: f3,
  uv2_pars_fragment: p3,
  uv2_pars_vertex: m3,
  uv2_vertex: g3,
  worldpos_vertex: v3,
  background_frag: y3,
  background_vert: b3,
  cube_frag: x3,
  cube_vert: w3,
  depth_frag: M3,
  depth_vert: _3,
  distanceRGBA_frag: S3,
  distanceRGBA_vert: T3,
  equirect_frag: E3,
  equirect_vert: A3,
  linedashed_frag: C3,
  linedashed_vert: L3,
  meshbasic_frag: R3,
  meshbasic_vert: P3,
  meshlambert_frag: O3,
  meshlambert_vert: I3,
  meshmatcap_frag: D3,
  meshmatcap_vert: N3,
  meshtoon_frag: B3,
  meshtoon_vert: F3,
  meshphong_frag: z3,
  meshphong_vert: U3,
  meshphysical_frag: V3,
  meshphysical_vert: k3,
  normal_frag: G3,
  normal_vert: H3,
  points_frag: W3,
  points_vert: j3,
  shadow_frag: $3,
  shadow_vert: Z3,
  sprite_frag: X3,
  sprite_vert: Y3
};
var Ue = {
  common: {
    diffuse: { value: new Fe(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 Fe(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 Fe(16777215) },
    opacity: { value: 1 },
    size: { value: 1 },
    scale: { value: 1 },
    map: { value: null },
    alphaMap: { value: null },
    uvTransform: { value: new rn() }
  },
  sprite: {
    diffuse: { value: new Fe(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() }
  }
};
var fi = {
  basic: {
    uniforms: Mn([
      Ue.common,
      Ue.specularmap,
      Ue.envmap,
      Ue.aomap,
      Ue.lightmap,
      Ue.fog
    ]),
    vertexShader: ut.meshbasic_vert,
    fragmentShader: ut.meshbasic_frag
  },
  lambert: {
    uniforms: Mn([
      Ue.common,
      Ue.specularmap,
      Ue.envmap,
      Ue.aomap,
      Ue.lightmap,
      Ue.emissivemap,
      Ue.fog,
      Ue.lights,
      {
        emissive: { value: new Fe(0) }
      }
    ]),
    vertexShader: ut.meshlambert_vert,
    fragmentShader: ut.meshlambert_frag
  },
  phong: {
    uniforms: Mn([
      Ue.common,
      Ue.specularmap,
      Ue.envmap,
      Ue.aomap,
      Ue.lightmap,
      Ue.emissivemap,
      Ue.bumpmap,
      Ue.normalmap,
      Ue.displacementmap,
      Ue.fog,
      Ue.lights,
      {
        emissive: { value: new Fe(0) },
        specular: { value: new Fe(1118481) },
        shininess: { value: 30 }
      }
    ]),
    vertexShader: ut.meshphong_vert,
    fragmentShader: ut.meshphong_frag
  },
  standard: {
    uniforms: Mn([
      Ue.common,
      Ue.envmap,
      Ue.aomap,
      Ue.lightmap,
      Ue.emissivemap,
      Ue.bumpmap,
      Ue.normalmap,
      Ue.displacementmap,
      Ue.roughnessmap,
      Ue.metalnessmap,
      Ue.fog,
      Ue.lights,
      {
        emissive: { value: new Fe(0) },
        roughness: { value: 1 },
        metalness: { value: 0 },
        envMapIntensity: { value: 1 }
        // temporary
      }
    ]),
    vertexShader: ut.meshphysical_vert,
    fragmentShader: ut.meshphysical_frag
  },
  toon: {
    uniforms: Mn([
      Ue.common,
      Ue.aomap,
      Ue.lightmap,
      Ue.emissivemap,
      Ue.bumpmap,
      Ue.normalmap,
      Ue.displacementmap,
      Ue.gradientmap,
      Ue.fog,
      Ue.lights,
      {
        emissive: { value: new Fe(0) }
      }
    ]),
    vertexShader: ut.meshtoon_vert,
    fragmentShader: ut.meshtoon_frag
  },
  matcap: {
    uniforms: Mn([
      Ue.common,
      Ue.bumpmap,
      Ue.normalmap,
      Ue.displacementmap,
      Ue.fog,
      {
        matcap: { value: null }
      }
    ]),
    vertexShader: ut.meshmatcap_vert,
    fragmentShader: ut.meshmatcap_frag
  },
  points: {
    uniforms: Mn([
      Ue.points,
      Ue.fog
    ]),
    vertexShader: ut.points_vert,
    fragmentShader: ut.points_frag
  },
  dashed: {
    uniforms: Mn([
      Ue.common,
      Ue.fog,
      {
        scale: { value: 1 },
        dashSize: { value: 1 },
        totalSize: { value: 2 }
      }
    ]),
    vertexShader: ut.linedashed_vert,
    fragmentShader: ut.linedashed_frag
  },
  depth: {
    uniforms: Mn([
      Ue.common,
      Ue.displacementmap
    ]),
    vertexShader: ut.depth_vert,
    fragmentShader: ut.depth_frag
  },
  normal: {
    uniforms: Mn([
      Ue.common,
      Ue.bumpmap,
      Ue.normalmap,
      Ue.displacementmap,
      {
        opacity: { value: 1 }
      }
    ]),
    vertexShader: ut.normal_vert,
    fragmentShader: ut.normal_frag
  },
  sprite: {
    uniforms: Mn([
      Ue.sprite,
      Ue.fog
    ]),
    vertexShader: ut.sprite_vert,
    fragmentShader: ut.sprite_frag
  },
  background: {
    uniforms: {
      uvTransform: { value: new rn() },
      t2D: { value: null }
    },
    vertexShader: ut.background_vert,
    fragmentShader: ut.background_frag
  },
  /* -------------------------------------------------------------------------
  //	Cube map shader
   ------------------------------------------------------------------------- */
  cube: {
    uniforms: Mn([
      Ue.envmap,
      {
        opacity: { value: 1 }
      }
    ]),
    vertexShader: ut.cube_vert,
    fragmentShader: ut.cube_frag
  },
  equirect: {
    uniforms: {
      tEquirect: { value: null }
    },
    vertexShader: ut.equirect_vert,
    fragmentShader: ut.equirect_frag
  },
  distanceRGBA: {
    uniforms: Mn([
      Ue.common,
      Ue.displacementmap,
      {
        referencePosition: { value: new q() },
        nearDistance: { value: 1 },
        farDistance: { value: 1e3 }
      }
    ]),
    vertexShader: ut.distanceRGBA_vert,
    fragmentShader: ut.distanceRGBA_frag
  },
  shadow: {
    uniforms: Mn([
      Ue.lights,
      Ue.fog,
      {
        color: { value: new Fe(0) },
        opacity: { value: 1 }
      }
    ]),
    vertexShader: ut.shadow_vert,
    fragmentShader: ut.shadow_frag
  }
};
fi.physical = {
  uniforms: Mn([
    fi.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 Fe(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 Fe(0) }
    }
  ]),
  vertexShader: ut.meshphysical_vert,
  fragmentShader: ut.meshphysical_frag
};
function J3(n, e, t, i, r) {
  const s = new Fe(0);
  let o = 0, a, c, l = null, d = 0, h4 = null;
  function f(p, u) {
    let y = false, v = u.isScene === true ? 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 = true), (n.autoClear || y) && n.clear(n.autoClearColor, n.autoClearDepth, n.autoClearStencil), v && (v.isCubeTexture || v.mapping === la) ? (c === void 0 && (c = new Yt(
      new ur(1, 1, 1),
      new hr({
        name: "BackgroundCubeMaterial",
        uniforms: Vo(fi.cube.uniforms),
        vertexShader: fi.cube.vertexShader,
        fragmentShader: fi.cube.fragmentShader,
        side: jt,
        depthTest: false,
        depthWrite: false,
        fog: false
      })
    ), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(M, T, w) {
      this.matrixWorld.copyPosition(w.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 || h4 !== n.toneMapping) && (c.material.needsUpdate = true, l = v, d = v.version, h4 = n.toneMapping), p.unshift(c, c.geometry, c.material, 0, 0, null)) : v && v.isTexture && (a === void 0 && (a = new Yt(
      new Ds(2, 2),
      new hr({
        name: "BackgroundMaterial",
        uniforms: Vo(fi.background.uniforms),
        vertexShader: fi.background.vertexShader,
        fragmentShader: fi.background.fragmentShader,
        side: Zr,
        depthTest: false,
        depthWrite: false,
        fog: false
      })
    ), 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 === true && v.updateMatrix(), a.material.uniforms.uvTransform.value.copy(v.matrix), (l !== v || d !== v.version || h4 !== n.toneMapping) && (a.material.needsUpdate = true, l = v, d = v.version, h4 = 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 K3(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(C, L, I, b, O) {
    let N = false;
    if (o) {
      const D = p(b, I, L);
      l !== D && (l = D, f(l.object)), N = y(b, O), N && v(b, O);
    } else {
      const D = L.wireframe === true;
      (l.geometry !== b.id || l.program !== I.id || l.wireframe !== D) && (l.geometry = b.id, l.program = I.id, l.wireframe = D, N = true);
    }
    C.isInstancedMesh === true && (N = true), O !== null && t.update(O, 34963), N && (_(C, L, I, b), O !== null && n.bindBuffer(34963, t.get(O).buffer));
  }
  function h4() {
    return i.isWebGL2 ? n.createVertexArray() : s.createVertexArrayOES();
  }
  function f(C) {
    return i.isWebGL2 ? n.bindVertexArray(C) : s.bindVertexArrayOES(C);
  }
  function g(C) {
    return i.isWebGL2 ? n.deleteVertexArray(C) : s.deleteVertexArrayOES(C);
  }
  function p(C, L, I) {
    const b = I.wireframe === true;
    let O = a[C.id];
    O === void 0 && (O = {}, a[C.id] = O);
    let N = O[L.id];
    N === void 0 && (N = {}, O[L.id] = N);
    let D = N[b];
    return D === void 0 && (D = u(h4()), N[b] = D), D;
  }
  function u(C) {
    const L = [], I = [], b = [];
    for (let O = 0; O < r; O++)
      L[O] = 0, I[O] = 0, b[O] = 0;
    return {
      // for backward compatibility on non-VAO support browser
      geometry: null,
      program: null,
      wireframe: false,
      newAttributes: L,
      enabledAttributes: I,
      attributeDivisors: b,
      object: C,
      attributes: {},
      index: null
    };
  }
  function y(C, L) {
    const I = l.attributes, b = C.attributes;
    let O = 0;
    for (const N in b) {
      const D = I[N], U = b[N];
      if (D === void 0 || D.attribute !== U || D.data !== U.data) return true;
      O++;
    }
    return l.attributesNum !== O || l.index !== L;
  }
  function v(C, L) {
    const I = {}, b = C.attributes;
    let O = 0;
    for (const N in b) {
      const D = b[N], U = {};
      U.attribute = D, D.data && (U.data = D.data), I[N] = U, O++;
    }
    l.attributes = I, l.attributesNum = O, l.index = L;
  }
  function m() {
    const C = l.newAttributes;
    for (let L = 0, I = C.length; L < I; L++)
      C[L] = 0;
  }
  function x(C) {
    M(C, 0);
  }
  function M(C, L) {
    const I = l.newAttributes, b = l.enabledAttributes, O = l.attributeDivisors;
    I[C] = 1, b[C] === 0 && (n.enableVertexAttribArray(C), b[C] = 1), O[C] !== L && ((i.isWebGL2 ? n : e.get("ANGLE_instanced_arrays"))[i.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](C, L), O[C] = L);
  }
  function T() {
    const C = l.newAttributes, L = l.enabledAttributes;
    for (let I = 0, b = L.length; I < b; I++)
      L[I] !== C[I] && (n.disableVertexAttribArray(I), L[I] = 0);
  }
  function w(C, L, I, b, O, N) {
    i.isWebGL2 === true && (I === 5124 || I === 5125) ? n.vertexAttribIPointer(C, L, I, O, N) : n.vertexAttribPointer(C, L, I, b, O, N);
  }
  function _(C, L, I, b) {
    if (i.isWebGL2 === false && (C.isInstancedMesh || b.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null)
      return;
    m();
    const O = b.attributes, N = I.getAttributes(), D = L.defaultAttributeValues;
    for (const U in N) {
      const V = N[U];
      if (V >= 0) {
        const H = O[U];
        if (H !== void 0) {
          const Y = H.normalized, re = H.itemSize, ae = t.get(H);
          if (ae === void 0) continue;
          const ee = ae.buffer, oe = ae.type, j = ae.bytesPerElement;
          if (H.isInterleavedBufferAttribute) {
            const K = H.data, $ = K.stride, ne = H.offset;
            K && K.isInstancedInterleavedBuffer ? (M(V, K.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = K.meshPerAttribute * K.count)) : x(V), n.bindBuffer(34962, ee), w(V, re, oe, Y, $ * j, ne * j);
          } else
            H.isInstancedBufferAttribute ? (M(V, H.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = H.meshPerAttribute * H.count)) : x(V), n.bindBuffer(34962, ee), w(V, re, oe, Y, 0, 0);
        } else if (U === "instanceMatrix") {
          const Y = t.get(C.instanceMatrix);
          if (Y === void 0) continue;
          const re = Y.buffer, ae = Y.type;
          M(V + 0, 1), M(V + 1, 1), M(V + 2, 1), M(V + 3, 1), n.bindBuffer(34962, re), n.vertexAttribPointer(V + 0, 4, ae, false, 64, 0), n.vertexAttribPointer(V + 1, 4, ae, false, 64, 16), n.vertexAttribPointer(V + 2, 4, ae, false, 64, 32), n.vertexAttribPointer(V + 3, 4, ae, false, 64, 48);
        } else if (U === "instanceColor") {
          const Y = t.get(C.instanceColor);
          if (Y === void 0) continue;
          const re = Y.buffer, ae = Y.type;
          M(V, 1), n.bindBuffer(34962, re), n.vertexAttribPointer(V, 3, ae, false, 12, 0);
        } else if (D !== void 0) {
          const Y = D[U];
          if (Y !== void 0)
            switch (Y.length) {
              case 2:
                n.vertexAttrib2fv(V, Y);
                break;
              case 3:
                n.vertexAttrib3fv(V, Y);
                break;
              case 4:
                n.vertexAttrib4fv(V, Y);
                break;
              default:
                n.vertexAttrib1fv(V, Y);
            }
        }
      }
    }
    T();
  }
  function E() {
    R();
    for (const C in a) {
      const L = a[C];
      for (const I in L) {
        const b = L[I];
        for (const O in b)
          g(b[O].object), delete b[O];
        delete L[I];
      }
      delete a[C];
    }
  }
  function P(C) {
    if (a[C.id] === void 0) return;
    const L = a[C.id];
    for (const I in L) {
      const b = L[I];
      for (const O in b)
        g(b[O].object), delete b[O];
      delete L[I];
    }
    delete a[C.id];
  }
  function S(C) {
    for (const L in a) {
      const I = a[L];
      if (I[C.id] === void 0) continue;
      const b = I[C.id];
      for (const O in b)
        g(b[O].object), delete b[O];
      delete I[C.id];
    }
  }
  function R() {
    A(), l !== c && (l = c, f(l.object));
  }
  function A() {
    c.geometry = null, c.program = null, c.wireframe = false;
  }
  return {
    setup: d,
    reset: R,
    resetDefaultState: A,
    dispose: E,
    releaseStatesOfGeometry: P,
    releaseStatesOfProgram: S,
    initAttributes: m,
    enableAttribute: x,
    disableUnusedAttributes: T
  };
}
function q3(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, h4) {
    if (h4 === 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, h4), t.update(d, s, h4);
  }
  this.setMode = o, this.render = a, this.renderInstances = c;
}
function Q3(n, e, t) {
  let i;
  function r() {
    if (i !== void 0) return i;
    if (e.has("EXT_texture_filter_anisotropic") === true) {
      const _ = e.get("EXT_texture_filter_anisotropic");
      i = n.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
    } else
      i = 0;
    return i;
  }
  function s(_) {
    if (_ === "highp") {
      if (n.getShaderPrecisionFormat(35633, 36338).precision > 0 && n.getShaderPrecisionFormat(35632, 36338).precision > 0)
        return "highp";
      _ = "mediump";
    }
    return _ === "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 === true, h4 = 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, M = o || e.has("OES_texture_float"), T = x && M, w = o ? n.getParameter(36183) : 0;
  return {
    isWebGL2: o,
    drawBuffers: l,
    getMaxAnisotropy: r,
    getMaxPrecision: s,
    precision: a,
    logarithmicDepthBuffer: d,
    maxTextures: h4,
    maxVertexTextures: f,
    maxTextureSize: g,
    maxCubemapSize: p,
    maxAttributes: u,
    maxVertexUniforms: y,
    maxVaryings: v,
    maxFragmentUniforms: m,
    vertexTextures: x,
    floatFragmentTextures: M,
    floatVertexTextures: T,
    maxSamples: w
  };
}
function eD(n) {
  const e = this;
  let t = null, i = 0, r = false, s = false;
  const o = new Ei(), a = new rn(), c = { value: null, needsUpdate: false };
  this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(h4, f, g) {
    const p = h4.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(h4, g, 0), i = h4.length, p;
  }, this.beginShadows = function() {
    s = true, d(null);
  }, this.endShadows = function() {
    s = false, l();
  }, this.setState = function(h4, f, g) {
    const p = h4.clippingPlanes, u = h4.clipIntersection, y = h4.clipShadows, v = n.get(h4);
    if (!r || p === null || p.length === 0 || s && !y)
      s ? d(null) : l();
    else {
      const m = s ? 0 : i, x = m * 4;
      let M = v.clippingState || null;
      c.value = M, M = d(p, f, x, g);
      for (let T = 0; T !== x; ++T)
        M[T] = t[T];
      v.clippingState = M, 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(h4, f, g, p) {
    const u = h4 !== null ? h4.length : 0;
    let y = null;
    if (u !== 0) {
      if (y = c.value, p !== true || 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, M = g; x !== u; ++x, M += 4)
          o.copy(h4[x]).applyMatrix4(m, a), o.normal.toArray(y, M), y[M + 3] = o.constant;
      }
      c.value = y, c.needsUpdate = true;
    }
    return e.numPlanes = u, e.numIntersection = 0, y;
  }
}
function tD(n) {
  let e = /* @__PURE__ */ new WeakMap();
  function t(o, a) {
    return a === Qc ? o.mapping = yl : a === eu && (o.mapping = bl), o;
  }
  function i(o) {
    if (o && o.isTexture) {
      const a = o.mapping;
      if (a === Qc || a === eu)
        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 Ou(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 nD(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 iD(n, e, t, i) {
  const r = {}, s = /* @__PURE__ */ new WeakMap();
  function o(h4) {
    const f = h4.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 === true && delete f._maxInstanceCount, t.memory.geometries--;
  }
  function a(h4, f) {
    return r[f.id] === true || (f.addEventListener("dispose", o), r[f.id] = true, t.memory.geometries++), f;
  }
  function c(h4) {
    const f = h4.attributes;
    for (const p in f)
      e.update(f[p], 34962);
    const g = h4.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(h4) {
    const f = [], g = h4.index, p = h4.attributes.position;
    let u = 0;
    if (g !== null) {
      const m = g.array;
      u = g.version;
      for (let x = 0, M = m.length; x < M; x += 3) {
        const T = m[x + 0], w = m[x + 1], _ = m[x + 2];
        f.push(T, w, w, _, _, T);
      }
    } else {
      const m = p.array;
      u = p.version;
      for (let x = 0, M = m.length / 3 - 1; x < M; x += 3) {
        const T = x + 0, w = x + 1, _ = x + 2;
        f.push(T, w, w, _, _, T);
      }
    }
    const y = new (Mx(f) > 65535 ? Ru : Lu)(f, 1);
    y.version = u;
    const v = s.get(h4);
    v && e.remove(v), s.set(h4, y);
  }
  function d(h4) {
    const f = s.get(h4);
    if (f) {
      const g = h4.index;
      g !== null && f.version < g.version && l(h4);
    } else
      l(h4);
    return s.get(h4);
  }
  return {
    get: a,
    update: c,
    getWireframeAttribute: d
  };
}
function rD(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 h4(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 = h4;
}
function sD(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: true,
    reset: r,
    update: i
  };
}
function oD(n, e) {
  return n[0] - e[0];
}
function aD(n, e) {
  return Math.abs(e[1]) - Math.abs(n[1]);
}
function lD(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 h4 = e[o.id];
    if (h4 === void 0 || h4.length !== d) {
      h4 = [];
      for (let y = 0; y < d; y++)
        h4[y] = [y, 0];
      e[o.id] = h4;
    }
    for (let y = 0; y < d; y++) {
      const v = h4[y];
      v[0] = y, v[1] = l[y];
    }
    h4.sort(aD);
    for (let y = 0; y < 8; y++)
      y < d && h4[y][1] ? (i[y][0] = h4[y][0], i[y][1] = h4[y][1]) : (i[y][0] = Number.MAX_SAFE_INTEGER, i[y][1] = 0);
    i.sort(oD);
    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) === true && o.deleteAttribute("morphTarget" + y), g && o.hasAttribute("morphNormal" + y) === true && 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 cD(n, e, t, i) {
  let r = /* @__PURE__ */ new WeakMap();
  function s(c) {
    const l = i.render.frame, d = c.geometry, h4 = e.get(c, d);
    return r.get(h4) !== l && (e.update(h4), r.set(h4, l)), c.isInstancedMesh && (c.hasEventListener("dispose", a) === false && c.addEventListener("dispose", a), t.update(c.instanceMatrix, 34962), c.instanceColor !== null && t.update(c.instanceColor, 34962)), h4;
  }
  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
  };
}
var qf = class extends Jt {
  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 = hn2, this.generateMipmaps = false, this.flipY = false, this.unpackAlignment = 1, this.needsUpdate = true;
  }
};
qf.prototype.isDataTexture2DArray = true;
var Qf = class extends Jt {
  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 = hn2, this.generateMipmaps = false, this.flipY = false, this.unpackAlignment = 1, this.needsUpdate = true;
  }
};
Qf.prototype.isDataTexture3D = true;
var Tx = new Jt();
var uD = new qf();
var hD = new Qf();
var Ex = new ca();
var Sg = [];
var Tg = [];
var Eg = new Float32Array(16);
var Ag = new Float32Array(9);
var Cg = new Float32Array(4);
function ua(n, e, t) {
  const i = n[0];
  if (i <= 0 || i > 0) return n;
  const r = e * t;
  let s = Sg[r];
  if (s === void 0 && (s = new Float32Array(r), Sg[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 Pn(n, e) {
  if (n.length !== e.length) return false;
  for (let t = 0, i = n.length; t < i; t++)
    if (n[t] !== e[t]) return false;
  return true;
}
function En(n, e) {
  for (let t = 0, i = e.length; t < i; t++)
    n[t] = e[t];
}
function Ax(n, e) {
  let t = Tg[e];
  t === void 0 && (t = new Int32Array(e), Tg[e] = t);
  for (let i = 0; i !== e; ++i)
    t[i] = n.allocateTextureUnit();
  return t;
}
function dD(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1f(this.addr, e), t[0] = e);
}
function fD(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 (Pn(t, e)) return;
    n.uniform2fv(this.addr, e), En(t, e);
  }
}
function pD(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 (Pn(t, e)) return;
    n.uniform3fv(this.addr, e), En(t, e);
  }
}
function mD(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 (Pn(t, e)) return;
    n.uniform4fv(this.addr, e), En(t, e);
  }
}
function gD(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Pn(t, e)) return;
    n.uniformMatrix2fv(this.addr, false, e), En(t, e);
  } else {
    if (Pn(t, i)) return;
    Cg.set(i), n.uniformMatrix2fv(this.addr, false, Cg), En(t, i);
  }
}
function vD(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Pn(t, e)) return;
    n.uniformMatrix3fv(this.addr, false, e), En(t, e);
  } else {
    if (Pn(t, i)) return;
    Ag.set(i), n.uniformMatrix3fv(this.addr, false, Ag), En(t, i);
  }
}
function yD(n, e) {
  const t = this.cache, i = e.elements;
  if (i === void 0) {
    if (Pn(t, e)) return;
    n.uniformMatrix4fv(this.addr, false, e), En(t, e);
  } else {
    if (Pn(t, i)) return;
    Eg.set(i), n.uniformMatrix4fv(this.addr, false, Eg), En(t, i);
  }
}
function bD(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1i(this.addr, e), t[0] = e);
}
function xD(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform2iv(this.addr, e), En(t, e));
}
function wD(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform3iv(this.addr, e), En(t, e));
}
function MD(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform4iv(this.addr, e), En(t, e));
}
function _D(n, e) {
  const t = this.cache;
  t[0] !== e && (n.uniform1ui(this.addr, e), t[0] = e);
}
function SD(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform2uiv(this.addr, e), En(t, e));
}
function TD(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform3uiv(this.addr, e), En(t, e));
}
function ED(n, e) {
  const t = this.cache;
  Pn(t, e) || (n.uniform4uiv(this.addr, e), En(t, e));
}
function AD(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTexture2D(e || Tx, r);
}
function CD(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture3D(e || hD, r);
}
function LD(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTextureCube(e || Ex, r);
}
function RD(n, e, t) {
  const i = this.cache, r = t.allocateTextureUnit();
  i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture2DArray(e || uD, r);
}
function PD(n) {
  switch (n) {
    case 5126:
      return dD;
    case 35664:
      return fD;
    case 35665:
      return pD;
    case 35666:
      return mD;
    case 35674:
      return gD;
    case 35675:
      return vD;
    case 35676:
      return yD;
    case 5124:
    case 35670:
      return bD;
    case 35667:
    case 35671:
      return xD;
    case 35668:
    case 35672:
      return wD;
    case 35669:
    case 35673:
      return MD;
    case 5125:
      return _D;
    case 36294:
      return SD;
    case 36295:
      return TD;
    case 36296:
      return ED;
    case 35678:
    case 36198:
    case 36298:
    case 36306:
    case 35682:
      return AD;
    case 35679:
    case 36299:
    case 36307:
      return CD;
    case 35680:
    case 36300:
    case 36308:
    case 36293:
      return LD;
    case 36289:
    case 36303:
    case 36311:
    case 36292:
      return RD;
  }
}
function OD(n, e) {
  n.uniform1fv(this.addr, e);
}
function ID(n, e) {
  const t = ua(e, this.size, 2);
  n.uniform2fv(this.addr, t);
}
function DD(n, e) {
  const t = ua(e, this.size, 3);
  n.uniform3fv(this.addr, t);
}
function ND(n, e) {
  const t = ua(e, this.size, 4);
  n.uniform4fv(this.addr, t);
}
function BD(n, e) {
  const t = ua(e, this.size, 4);
  n.uniformMatrix2fv(this.addr, false, t);
}
function FD(n, e) {
  const t = ua(e, this.size, 9);
  n.uniformMatrix3fv(this.addr, false, t);
}
function zD(n, e) {
  const t = ua(e, this.size, 16);
  n.uniformMatrix4fv(this.addr, false, t);
}
function UD(n, e) {
  n.uniform1iv(this.addr, e);
}
function VD(n, e) {
  n.uniform2iv(this.addr, e);
}
function kD(n, e) {
  n.uniform3iv(this.addr, e);
}
function GD(n, e) {
  n.uniform4iv(this.addr, e);
}
function HD(n, e) {
  n.uniform1uiv(this.addr, e);
}
function WD(n, e) {
  n.uniform2uiv(this.addr, e);
}
function jD(n, e) {
  n.uniform3uiv(this.addr, e);
}
function $D(n, e) {
  n.uniform4uiv(this.addr, e);
}
function ZD(n, e, t) {
  const i = e.length, r = Ax(t, i);
  n.uniform1iv(this.addr, r);
  for (let s = 0; s !== i; ++s)
    t.safeSetTexture2D(e[s] || Tx, r[s]);
}
function XD(n, e, t) {
  const i = e.length, r = Ax(t, i);
  n.uniform1iv(this.addr, r);
  for (let s = 0; s !== i; ++s)
    t.safeSetTextureCube(e[s] || Ex, r[s]);
}
function YD(n) {
  switch (n) {
    case 5126:
      return OD;
    case 35664:
      return ID;
    case 35665:
      return DD;
    case 35666:
      return ND;
    case 35674:
      return BD;
    case 35675:
      return FD;
    case 35676:
      return zD;
    case 5124:
    case 35670:
      return UD;
    case 35667:
    case 35671:
      return VD;
    case 35668:
    case 35672:
      return kD;
    case 35669:
    case 35673:
      return GD;
    case 5125:
      return HD;
    case 36294:
      return WD;
    case 36295:
      return jD;
    case 36296:
      return $D;
    case 35678:
    case 36198:
    case 36298:
    case 36306:
    case 35682:
      return ZD;
    case 35680:
    case 36300:
    case 36308:
    case 36293:
      return XD;
  }
}
function JD(n, e, t) {
  this.id = n, this.addr = t, this.cache = [], this.setValue = PD(e.type);
}
function Cx(n, e, t) {
  this.id = n, this.addr = t, this.cache = [], this.size = e.size, this.setValue = YD(e.type);
}
Cx.prototype.updateCache = function(n) {
  const e = this.cache;
  n instanceof Float32Array && e.length !== n.length && (this.cache = new Float32Array(n.length)), En(e, n);
};
function Lx(n) {
  this.id = n, this.seq = [], this.map = {};
}
Lx.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);
  }
};
var Ch = /(\w+)(\])?(\[|\.)?/g;
function Lg(n, e) {
  n.seq.push(e), n.map[e.id] = e;
}
function KD(n, e, t) {
  const i = n.name, r = i.length;
  for (Ch.lastIndex = 0; ; ) {
    const s = Ch.exec(i), o = Ch.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 JD(a, n, e) : new Cx(a, n, e));
      break;
    } else {
      let h4 = t.map[a];
      h4 === void 0 && (h4 = new Lx(a), Lg(t, h4)), t = h4;
    }
  }
}
function Vr(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);
    KD(r, s, this);
  }
}
Vr.prototype.setValue = function(n, e, t, i) {
  const r = this.map[e];
  r !== void 0 && r.setValue(n, t, i);
};
Vr.prototype.setOptional = function(n, e, t) {
  const i = e[t];
  i !== void 0 && this.setValue(n, t, i);
};
Vr.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 !== false && o.setValue(n, a.value, i);
  }
};
Vr.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 Rg(n, e, t) {
  const i = n.createShader(e);
  return n.shaderSource(i, t), n.compileShader(i), i;
}
var qD = 0;
function QD(n) {
  const e = n.split(`
`);
  for (let t = 0; t < e.length; t++)
    e[t] = t + 1 + ": " + e[t];
  return e.join(`
`);
}
function Rx(n) {
  switch (n) {
    case Rn:
      return ["Linear", "( value )"];
    case Is:
      return ["sRGB", "( value )"];
    case Cu:
      return ["RGBE", "( value )"];
    case $f:
      return ["RGBM", "( value, 7.0 )"];
    case Zf:
      return ["RGBM", "( value, 16.0 )"];
    case Xf:
      return ["RGBD", "( value, 256.0 )"];
    case Au:
      return ["Gamma", "( value, float( GAMMA_FACTOR ) )"];
    case ox:
      return ["LogLuv", "( value )"];
    default:
      return console.warn("THREE.WebGLProgram: Unsupported encoding:", n), ["Linear", "( value )"];
  }
}
function Pg(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 + QD(s);
}
function _a(n, e) {
  const t = Rx(e);
  return "vec4 " + n + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }";
}
function eN(n, e) {
  const t = Rx(e);
  return "vec4 " + n + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }";
}
function tN(n, e) {
  let t;
  switch (e) {
    case rb:
      t = "Linear";
      break;
    case sb:
      t = "Reinhard";
      break;
    case ob:
      t = "OptimizedCineon";
      break;
    case ab:
      t = "ACESFilmic";
      break;
    case lb:
      t = "Custom";
      break;
    default:
      console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), t = "Linear";
  }
  return "vec3 " + n + "( vec3 color ) { return " + t + "ToneMapping( color ); }";
}
function nN(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(Da).join(`
`);
}
function iN(n) {
  const e = [];
  for (const t in n) {
    const i = n[t];
    i !== false && e.push("#define " + t + " " + i);
  }
  return e.join(`
`);
}
function rN(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 Da(n) {
  return n !== "";
}
function Og(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 Ig(n, e) {
  return n.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection);
}
var sN = /^[ \t]*#include +<([\w\d./]+)>/gm;
function Fd(n) {
  return n.replace(sN, oN);
}
function oN(n, e) {
  const t = ut[e];
  if (t === void 0)
    throw new Error("Can not resolve #include <" + e + ">");
  return Fd(t);
}
var aN = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
var lN = /#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 Dg(n) {
  return n.replace(lN, Px).replace(aN, cN);
}
function cN(n, e, t, i) {
  return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), Px(n, e, t, i);
}
function Px(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 Ng(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 uN(n) {
  let e = "SHADOWMAP_TYPE_BASIC";
  return n.shadowMapType === Vf ? e = "SHADOWMAP_TYPE_PCF" : n.shadowMapType === By ? e = "SHADOWMAP_TYPE_PCF_SOFT" : n.shadowMapType === wo && (e = "SHADOWMAP_TYPE_VSM"), e;
}
function hN(n) {
  let e = "ENVMAP_TYPE_CUBE";
  if (n.envMap)
    switch (n.envMapMode) {
      case yl:
      case bl:
        e = "ENVMAP_TYPE_CUBE";
        break;
      case la:
      case xl:
        e = "ENVMAP_TYPE_CUBE_UV";
        break;
    }
  return e;
}
function dN(n) {
  let e = "ENVMAP_MODE_REFLECTION";
  if (n.envMap)
    switch (n.envMapMode) {
      case bl:
      case xl:
        e = "ENVMAP_MODE_REFRACTION";
        break;
    }
  return e;
}
function fN(n) {
  let e = "ENVMAP_BLENDING_NONE";
  if (n.envMap)
    switch (n.combine) {
      case vl:
        e = "ENVMAP_BLENDING_MULTIPLY";
        break;
      case nb:
        e = "ENVMAP_BLENDING_MIX";
        break;
      case ib:
        e = "ENVMAP_BLENDING_ADD";
        break;
    }
  return e;
}
function pN(n, e, t, i) {
  const r = n.getContext(), s = t.defines;
  let o = t.vertexShader, a = t.fragmentShader;
  const c = uN(t), l = hN(t), d = dN(t), h4 = fN(t), f = n.gammaFactor > 0 ? n.gammaFactor : 1, g = t.isWebGL2 ? "" : nN(t), p = iN(s), u = r.createProgram();
  let y, v, m = t.glslVersion ? "#version " + t.glslVersion + `
` : "";
  t.isRawShaderMaterial ? (y = [
    p
  ].filter(Da).join(`
`), y.length > 0 && (y += `
`), v = [
    g,
    p
  ].filter(Da).join(`
`), v.length > 0 && (v += `
`)) : (y = [
    Ng(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 === false ? "#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(Da).join(`
`), v = [
    g,
    Ng(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 " + h4 : "",
    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 !== Ur ? "#define TONE_MAPPING" : "",
    t.toneMapping !== Ur ? ut.tonemapping_pars_fragment : "",
    // this code is required here because it is used by the toneMapping() function defined below
    t.toneMapping !== Ur ? tN("toneMapping", t.toneMapping) : "",
    t.dithering ? "#define DITHERING" : "",
    ut.encodings_pars_fragment,
    // this code is required here because it is used by the various encoding/decoding function defined below
    t.map ? _a("mapTexelToLinear", t.mapEncoding) : "",
    t.matcap ? _a("matcapTexelToLinear", t.matcapEncoding) : "",
    t.envMap ? _a("envMapTexelToLinear", t.envMapEncoding) : "",
    t.emissiveMap ? _a("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "",
    t.lightMap ? _a("lightMapTexelToLinear", t.lightMapEncoding) : "",
    eN("linearToOutputTexel", t.outputEncoding),
    t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "",
    `
`
  ].filter(Da).join(`
`)), o = Fd(o), o = Og(o, t), o = Ig(o, t), a = Fd(a), a = Og(a, t), a = Ig(a, t), o = Dg(o), a = Dg(a), t.isWebGL2 && t.isRawShaderMaterial !== true && (m = `#version 300 es
`, y = [
    "#define attribute in",
    "#define varying out",
    "#define texture2D texture"
  ].join(`
`) + `
` + y, v = [
    "#define varying in",
    t.glslVersion === Dd ? "" : "out highp vec4 pc_fragColor;",
    t.glslVersion === Dd ? "" : "#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, M = m + v + a, T = Rg(r, 35633, x), w = Rg(r, 35632, M);
  if (r.attachShader(u, T), r.attachShader(u, w), t.index0AttributeName !== void 0 ? r.bindAttribLocation(u, 0, t.index0AttributeName) : t.morphTargets === true && r.bindAttribLocation(u, 0, "position"), r.linkProgram(u), n.debug.checkShaderErrors) {
    const P = r.getProgramInfoLog(u).trim(), S = r.getShaderInfoLog(T).trim(), R = r.getShaderInfoLog(w).trim();
    let A = true, C = true;
    if (r.getProgramParameter(u, 35714) === false) {
      A = false;
      const L = Pg(r, T, "vertex"), I = Pg(r, w, "fragment");
      console.error("THREE.WebGLProgram: shader error: ", r.getError(), "35715", r.getProgramParameter(u, 35715), "gl.getProgramInfoLog", P, L, I);
    } else P !== "" ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", P) : (S === "" || R === "") && (C = false);
    C && (this.diagnostics = {
      runnable: A,
      programLog: P,
      vertexShader: {
        log: S,
        prefix: y
      },
      fragmentShader: {
        log: R,
        prefix: v
      }
    });
  }
  r.deleteShader(T), r.deleteShader(w);
  let _;
  this.getUniforms = function() {
    return _ === void 0 && (_ = new Vr(r, u)), _;
  };
  let E;
  return this.getAttributes = function() {
    return E === void 0 && (E = rN(r, u)), E;
  }, this.destroy = function() {
    i.releaseStatesOfProgram(this), r.deleteProgram(u), this.program = void 0;
  }, this.name = t.shaderName, this.id = qD++, this.cacheKey = e, this.usedTimes = 1, this.program = u, this.vertexShader = T, this.fragmentShader = w, this;
}
function mN(n, e, t, i, r, s) {
  const o = [], a = i.isWebGL2, c = i.logarithmicDepthBuffer, l = i.floatVertexTextures, d = i.maxVertexUniforms, h4 = 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(w) {
    const E = w.skeleton.bones;
    if (l)
      return 1024;
    {
      const S = Math.floor((d - 20) / 4), R = Math.min(S, E.length);
      return R < E.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + E.length + " bones. This GPU supports " + R + "."), 0) : R;
    }
  }
  function y(w) {
    let _;
    return w && w.isTexture ? _ = w.encoding : w && w.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), _ = w.texture.encoding) : _ = Rn, _;
  }
  function v(w, _, E, P, S) {
    const R = P.fog, A = w.isMeshStandardMaterial ? P.environment : null, C = e.get(w.envMap || A), L = g[w.type], I = S.isSkinnedMesh ? u(S) : 0;
    w.precision !== null && (f = i.getMaxPrecision(w.precision), f !== w.precision && console.warn("THREE.WebGLProgram.getParameters:", w.precision, "not supported, using", f, "instead."));
    let b, O;
    if (L) {
      const U = fi[L];
      b = U.vertexShader, O = U.fragmentShader;
    } else
      b = w.vertexShader, O = w.fragmentShader;
    const N = n.getRenderTarget();
    return {
      isWebGL2: a,
      shaderID: L,
      shaderName: w.type,
      vertexShader: b,
      fragmentShader: O,
      defines: w.defines,
      isRawShaderMaterial: w.isRawShaderMaterial === true,
      glslVersion: w.glslVersion,
      precision: f,
      instancing: S.isInstancedMesh === true,
      instancingColor: S.isInstancedMesh === true && S.instanceColor !== null,
      supportsVertexTextures: h4,
      outputEncoding: N !== null ? y(N.texture) : n.outputEncoding,
      map: !!w.map,
      mapEncoding: y(w.map),
      matcap: !!w.matcap,
      matcapEncoding: y(w.matcap),
      envMap: !!C,
      envMapMode: C && C.mapping,
      envMapEncoding: y(C),
      envMapCubeUV: !!C && (C.mapping === la || C.mapping === xl),
      lightMap: !!w.lightMap,
      lightMapEncoding: y(w.lightMap),
      aoMap: !!w.aoMap,
      emissiveMap: !!w.emissiveMap,
      emissiveMapEncoding: y(w.emissiveMap),
      bumpMap: !!w.bumpMap,
      normalMap: !!w.normalMap,
      objectSpaceNormalMap: w.normalMapType === cx,
      tangentSpaceNormalMap: w.normalMapType === es,
      clearcoatMap: !!w.clearcoatMap,
      clearcoatRoughnessMap: !!w.clearcoatRoughnessMap,
      clearcoatNormalMap: !!w.clearcoatNormalMap,
      displacementMap: !!w.displacementMap,
      roughnessMap: !!w.roughnessMap,
      metalnessMap: !!w.metalnessMap,
      specularMap: !!w.specularMap,
      alphaMap: !!w.alphaMap,
      gradientMap: !!w.gradientMap,
      sheen: !!w.sheen,
      transmission: !!w.transmission,
      transmissionMap: !!w.transmissionMap,
      thicknessMap: !!w.thicknessMap,
      combine: w.combine,
      vertexTangents: w.normalMap && w.vertexTangents,
      vertexColors: w.vertexColors,
      vertexAlphas: w.vertexColors === true && S.geometry && S.geometry.attributes.color && S.geometry.attributes.color.itemSize === 4,
      vertexUvs: !!w.map || !!w.bumpMap || !!w.normalMap || !!w.specularMap || !!w.alphaMap || !!w.emissiveMap || !!w.roughnessMap || !!w.metalnessMap || !!w.clearcoatMap || !!w.clearcoatRoughnessMap || !!w.clearcoatNormalMap || !!w.displacementMap || !!w.transmissionMap || !!w.thicknessMap,
      uvsVertexOnly: !(w.map || w.bumpMap || w.normalMap || w.specularMap || w.alphaMap || w.emissiveMap || w.roughnessMap || w.metalnessMap || w.clearcoatNormalMap || w.transmission || w.transmissionMap || w.thicknessMap) && !!w.displacementMap,
      fog: !!R,
      useFog: w.fog,
      fogExp2: R && R.isFogExp2,
      flatShading: !!w.flatShading,
      sizeAttenuation: w.sizeAttenuation,
      logarithmicDepthBuffer: c,
      skinning: S.isSkinnedMesh === true && I > 0,
      maxBones: I,
      useVertexTexture: l,
      morphTargets: w.morphTargets,
      morphNormals: w.morphNormals,
      numDirLights: _.directional.length,
      numPointLights: _.point.length,
      numSpotLights: _.spot.length,
      numRectAreaLights: _.rectArea.length,
      numHemiLights: _.hemi.length,
      numDirLightShadows: _.directionalShadowMap.length,
      numPointLightShadows: _.pointShadowMap.length,
      numSpotLightShadows: _.spotShadowMap.length,
      numClippingPlanes: s.numPlanes,
      numClipIntersection: s.numIntersection,
      dithering: w.dithering,
      shadowMapEnabled: n.shadowMap.enabled && E.length > 0,
      shadowMapType: n.shadowMap.type,
      toneMapping: w.toneMapped ? n.toneMapping : Ur,
      physicallyCorrectLights: n.physicallyCorrectLights,
      premultipliedAlpha: w.premultipliedAlpha,
      alphaTest: w.alphaTest,
      doubleSided: w.side === Xr,
      flipSided: w.side === jt,
      depthPacking: w.depthPacking !== void 0 ? w.depthPacking : false,
      index0AttributeName: w.index0AttributeName,
      extensionDerivatives: w.extensions && w.extensions.derivatives,
      extensionFragDepth: w.extensions && w.extensions.fragDepth,
      extensionDrawBuffers: w.extensions && w.extensions.drawBuffers,
      extensionShaderTextureLOD: w.extensions && w.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: w.customProgramCacheKey()
    };
  }
  function m(w) {
    const _ = [];
    if (w.shaderID ? _.push(w.shaderID) : (_.push(w.fragmentShader), _.push(w.vertexShader)), w.defines !== void 0)
      for (const E in w.defines)
        _.push(E), _.push(w.defines[E]);
    if (w.isRawShaderMaterial === false) {
      for (let E = 0; E < p.length; E++)
        _.push(w[p[E]]);
      _.push(n.outputEncoding), _.push(n.gammaFactor);
    }
    return _.push(w.customProgramCacheKey), _.join();
  }
  function x(w) {
    const _ = g[w.type];
    let E;
    if (_) {
      const P = fi[_];
      E = _x.clone(P.uniforms);
    } else
      E = w.uniforms;
    return E;
  }
  function M(w, _) {
    let E;
    for (let P = 0, S = o.length; P < S; P++) {
      const R = o[P];
      if (R.cacheKey === _) {
        E = R, ++E.usedTimes;
        break;
      }
    }
    return E === void 0 && (E = new pN(n, _, w, r), o.push(E)), E;
  }
  function T(w) {
    if (--w.usedTimes === 0) {
      const _ = o.indexOf(w);
      o[_] = o[o.length - 1], o.pop(), w.destroy();
    }
  }
  return {
    getParameters: v,
    getProgramCacheKey: m,
    getUniforms: x,
    acquireProgram: M,
    releaseProgram: T,
    // Exposed for resource monitoring & error feedback via renderer.info:
    programs: o
  };
}
function gN() {
  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 vN(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 Bg(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 Fg(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 M = n.get(u);
    return x === void 0 ? (x = {
      id: g.id,
      object: g,
      geometry: p,
      material: u,
      program: M.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 = M.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 === true ? 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 === true ? s.unshift(x) : i.unshift(x);
  }
  function h4(g, p) {
    i.length > 1 && i.sort(g || vN), r.length > 1 && r.sort(p || Bg), s.length > 1 && s.sort(p || Bg);
  }
  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: h4
  };
}
function yN(n) {
  let e = /* @__PURE__ */ new WeakMap();
  function t(r, s) {
    let o;
    return e.has(r) === false ? (o = new Fg(n), e.set(r, [o])) : s >= e.get(r).length ? (o = new Fg(n), e.get(r).push(o)) : o = e.get(r)[s], o;
  }
  function i() {
    e = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: t,
    dispose: i
  };
}
function bN() {
  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 Fe()
          };
          break;
        case "SpotLight":
          t = {
            position: new q(),
            direction: new q(),
            color: new Fe(),
            distance: 0,
            coneCos: 0,
            penumbraCos: 0,
            decay: 0
          };
          break;
        case "PointLight":
          t = {
            position: new q(),
            color: new Fe(),
            distance: 0,
            decay: 0
          };
          break;
        case "HemisphereLight":
          t = {
            direction: new q(),
            skyColor: new Fe(),
            groundColor: new Fe()
          };
          break;
        case "RectAreaLight":
          t = {
            color: new Fe(),
            position: new q(),
            halfWidth: new q(),
            halfHeight: new q()
          };
          break;
      }
      return n[e.id] = t, t;
    }
  };
}
function xN() {
  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;
    }
  };
}
var wN = 0;
function MN(n, e) {
  return (e.castShadow ? 1 : 0) - (n.castShadow ? 1 : 0);
}
function _N(n, e) {
  const t = new bN(), i = xN(), 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 Ze(), a = new Ze();
  function c(d) {
    let h4 = 0, f = 0, g = 0;
    for (let _ = 0; _ < 9; _++) r.probe[_].set(0, 0, 0);
    let p = 0, u = 0, y = 0, v = 0, m = 0, x = 0, M = 0, T = 0;
    d.sort(MN);
    for (let _ = 0, E = d.length; _ < E; _++) {
      const P = d[_], S = P.color, R = P.intensity, A = P.distance, C = P.shadow && P.shadow.map ? P.shadow.map.texture : null;
      if (P.isAmbientLight)
        h4 += S.r * R, f += S.g * R, g += S.b * R;
      else if (P.isLightProbe)
        for (let L = 0; L < 9; L++)
          r.probe[L].addScaledVector(P.sh.coefficients[L], R);
      else if (P.isDirectionalLight) {
        const L = t.get(P);
        if (L.color.copy(P.color).multiplyScalar(P.intensity), P.castShadow) {
          const I = P.shadow, b = i.get(P);
          b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, r.directionalShadow[p] = b, r.directionalShadowMap[p] = C, r.directionalShadowMatrix[p] = P.shadow.matrix, x++;
        }
        r.directional[p] = L, p++;
      } else if (P.isSpotLight) {
        const L = t.get(P);
        if (L.position.setFromMatrixPosition(P.matrixWorld), L.color.copy(S).multiplyScalar(R), L.distance = A, L.coneCos = Math.cos(P.angle), L.penumbraCos = Math.cos(P.angle * (1 - P.penumbra)), L.decay = P.decay, P.castShadow) {
          const I = P.shadow, b = i.get(P);
          b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, r.spotShadow[y] = b, r.spotShadowMap[y] = C, r.spotShadowMatrix[y] = P.shadow.matrix, T++;
        }
        r.spot[y] = L, y++;
      } else if (P.isRectAreaLight) {
        const L = t.get(P);
        L.color.copy(S).multiplyScalar(R), L.halfWidth.set(P.width * 0.5, 0, 0), L.halfHeight.set(0, P.height * 0.5, 0), r.rectArea[v] = L, v++;
      } else if (P.isPointLight) {
        const L = t.get(P);
        if (L.color.copy(P.color).multiplyScalar(P.intensity), L.distance = P.distance, L.decay = P.decay, P.castShadow) {
          const I = P.shadow, b = i.get(P);
          b.shadowBias = I.bias, b.shadowNormalBias = I.normalBias, b.shadowRadius = I.radius, b.shadowMapSize = I.mapSize, b.shadowCameraNear = I.camera.near, b.shadowCameraFar = I.camera.far, r.pointShadow[u] = b, r.pointShadowMap[u] = C, r.pointShadowMatrix[u] = P.shadow.matrix, M++;
        }
        r.point[u] = L, u++;
      } else if (P.isHemisphereLight) {
        const L = t.get(P);
        L.skyColor.copy(P.color).multiplyScalar(R), L.groundColor.copy(P.groundColor).multiplyScalar(R), r.hemi[m] = L, m++;
      }
    }
    v > 0 && (e.isWebGL2 || n.has("OES_texture_float_linear") === true ? (r.rectAreaLTC1 = Ue.LTC_FLOAT_1, r.rectAreaLTC2 = Ue.LTC_FLOAT_2) : n.has("OES_texture_half_float_linear") === true ? (r.rectAreaLTC1 = Ue.LTC_HALF_1, r.rectAreaLTC2 = Ue.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), r.ambient[0] = h4, r.ambient[1] = f, r.ambient[2] = g;
    const w = r.hash;
    (w.directionalLength !== p || w.pointLength !== u || w.spotLength !== y || w.rectAreaLength !== v || w.hemiLength !== m || w.numDirectionalShadows !== x || w.numPointShadows !== M || w.numSpotShadows !== T) && (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 = M, r.pointShadowMap.length = M, r.spotShadow.length = T, r.spotShadowMap.length = T, r.directionalShadowMatrix.length = x, r.pointShadowMatrix.length = M, r.spotShadowMatrix.length = T, w.directionalLength = p, w.pointLength = u, w.spotLength = y, w.rectAreaLength = v, w.hemiLength = m, w.numDirectionalShadows = x, w.numPointShadows = M, w.numSpotShadows = T, r.version = wN++);
  }
  function l(d, h4) {
    let f = 0, g = 0, p = 0, u = 0, y = 0;
    const v = h4.matrixWorldInverse;
    for (let m = 0, x = d.length; m < x; m++) {
      const M = d[m];
      if (M.isDirectionalLight) {
        const T = r.directional[f];
        T.direction.setFromMatrixPosition(M.matrixWorld), s.setFromMatrixPosition(M.target.matrixWorld), T.direction.sub(s), T.direction.transformDirection(v), f++;
      } else if (M.isSpotLight) {
        const T = r.spot[p];
        T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(v), T.direction.setFromMatrixPosition(M.matrixWorld), s.setFromMatrixPosition(M.target.matrixWorld), T.direction.sub(s), T.direction.transformDirection(v), p++;
      } else if (M.isRectAreaLight) {
        const T = r.rectArea[u];
        T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(v), a.identity(), o.copy(M.matrixWorld), o.premultiply(v), a.extractRotation(o), T.halfWidth.set(M.width * 0.5, 0, 0), T.halfHeight.set(0, M.height * 0.5, 0), T.halfWidth.applyMatrix4(a), T.halfHeight.applyMatrix4(a), u++;
      } else if (M.isPointLight) {
        const T = r.point[g];
        T.position.setFromMatrixPosition(M.matrixWorld), T.position.applyMatrix4(v), g++;
      } else if (M.isHemisphereLight) {
        const T = r.hemi[y];
        T.direction.setFromMatrixPosition(M.matrixWorld), T.direction.transformDirection(v), T.direction.normalize(), y++;
      }
    }
  }
  return {
    setup: c,
    setupView: l,
    state: r
  };
}
function zg(n, e) {
  const t = new _N(n, e), i = [], r = [];
  function s() {
    i.length = 0, r.length = 0;
  }
  function o(h4) {
    i.push(h4);
  }
  function a(h4) {
    r.push(h4);
  }
  function c() {
    t.setup(i);
  }
  function l(h4) {
    t.setupView(i, h4);
  }
  return {
    init: s,
    state: {
      lightsArray: i,
      shadowsArray: r,
      lights: t
    },
    setupLights: c,
    setupLightsView: l,
    pushLight: o,
    pushShadow: a
  };
}
function SN(n, e) {
  let t = /* @__PURE__ */ new WeakMap();
  function i(s, o = 0) {
    let a;
    return t.has(s) === false ? (a = new zg(n, e), t.set(s, [a])) : o >= t.get(s).length ? (a = new zg(n, e), t.get(s).push(a)) : a = t.get(s)[o], a;
  }
  function r() {
    t = /* @__PURE__ */ new WeakMap();
  }
  return {
    get: i,
    dispose: r
  };
}
var Iu = class extends en {
  constructor(e) {
    super(), this.type = "MeshDepthMaterial", this.depthPacking = ax, this.morphTargets = false, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = false, this.wireframeLinewidth = 1, this.fog = false, 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;
  }
};
Iu.prototype.isMeshDepthMaterial = true;
var Du = class extends en {
  constructor(e) {
    super(), this.type = "MeshDistanceMaterial", this.referencePosition = new q(), this.nearDistance = 1, this.farDistance = 1e3, this.morphTargets = false, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = false, 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;
  }
};
Du.prototype.isMeshDistanceMaterial = true;
var TN = `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 ) );
}`;
var EN = `void main() {
	gl_Position = vec4( position, 1.0 );
}`;
function Ox(n, e, t) {
  let i = new Ml();
  const r = new Re(), s = new Re(), o = new xt(), a = [], c = [], l = {}, d = t.maxTextureSize, h4 = { 0: jt, 1: Zr, 2: Xr }, f = new hr({
    defines: {
      SAMPLE_RATE: 2 / 8,
      HALF_SAMPLE_RATE: 1 / 8
    },
    uniforms: {
      shadow_pass: { value: null },
      resolution: { value: new Re() },
      radius: { value: 4 }
    },
    vertexShader: EN,
    fragmentShader: TN
  }), g = f.clone();
  g.defines.HORIZONTAL_PASS = 1;
  const p = new Ke();
  p.setAttribute(
    "position",
    new rt(
      new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]),
      3
    )
  );
  const u = new Yt(p, f), y = this;
  this.enabled = false, this.autoUpdate = true, this.needsUpdate = false, this.type = Vf, this.render = function(w, _, E) {
    if (y.enabled === false || y.autoUpdate === false && y.needsUpdate === false || w.length === 0) return;
    const P = n.getRenderTarget(), S = n.getActiveCubeFace(), R = n.getActiveMipmapLevel(), A = n.state;
    A.setBlending(sr), A.buffers.color.setClear(1, 1, 1, 1), A.buffers.depth.setTest(true), A.setScissorTest(false);
    for (let C = 0, L = w.length; C < L; C++) {
      const I = w[C], b = I.shadow;
      if (b === void 0) {
        console.warn("THREE.WebGLShadowMap:", I, "has no shadow.");
        continue;
      }
      if (b.autoUpdate === false && b.needsUpdate === false) continue;
      r.copy(b.mapSize);
      const O = b.getFrameExtents();
      if (r.multiply(O), s.copy(b.mapSize), (r.x > d || r.y > d) && (r.x > d && (s.x = Math.floor(d / O.x), r.x = s.x * O.x, b.mapSize.x = s.x), r.y > d && (s.y = Math.floor(d / O.y), r.y = s.y * O.y, b.mapSize.y = s.y)), b.map === null && !b.isPointLightShadow && this.type === wo) {
        const D = { minFilter: Ut, magFilter: Ut, format: jn };
        b.map = new gi(r.x, r.y, D), b.map.texture.name = I.name + ".shadowMap", b.mapPass = new gi(r.x, r.y, D), b.camera.updateProjectionMatrix();
      }
      if (b.map === null) {
        const D = { minFilter: $t, magFilter: $t, format: jn };
        b.map = new gi(r.x, r.y, D), b.map.texture.name = I.name + ".shadowMap", b.camera.updateProjectionMatrix();
      }
      n.setRenderTarget(b.map), n.clear();
      const N = b.getViewportCount();
      for (let D = 0; D < N; D++) {
        const U = b.getViewport(D);
        o.set(
          s.x * U.x,
          s.y * U.y,
          s.x * U.z,
          s.y * U.w
        ), A.viewport(o), b.updateMatrices(I, D), i = b.getFrustum(), T(_, E, b.camera, I, this.type);
      }
      !b.isPointLightShadow && this.type === wo && v(b, E), b.needsUpdate = false;
    }
    y.needsUpdate = false, n.setRenderTarget(P, S, R);
  };
  function v(w, _) {
    const E = e.update(u);
    f.uniforms.shadow_pass.value = w.map.texture, f.uniforms.resolution.value = w.mapSize, f.uniforms.radius.value = w.radius, n.setRenderTarget(w.mapPass), n.clear(), n.renderBufferDirect(_, null, E, f, u, null), g.uniforms.shadow_pass.value = w.mapPass.texture, g.uniforms.resolution.value = w.mapSize, g.uniforms.radius.value = w.radius, n.setRenderTarget(w.map), n.clear(), n.renderBufferDirect(_, null, E, g, u, null);
  }
  function m(w) {
    const _ = w << 0;
    let E = a[_];
    return E === void 0 && (E = new Iu({
      depthPacking: lx,
      morphTargets: w
    }), a[_] = E), E;
  }
  function x(w) {
    const _ = w << 0;
    let E = c[_];
    return E === void 0 && (E = new Du({
      morphTargets: w
    }), c[_] = E), E;
  }
  function M(w, _, E, P, S, R, A) {
    let C = null, L = m, I = w.customDepthMaterial;
    if (P.isPointLight === true && (L = x, I = w.customDistanceMaterial), I === void 0) {
      let b = false;
      E.morphTargets === true && (b = _.morphAttributes && _.morphAttributes.position && _.morphAttributes.position.length > 0), C = L(b);
    } else
      C = I;
    if (n.localClippingEnabled && E.clipShadows === true && E.clippingPlanes.length !== 0) {
      const b = C.uuid, O = E.uuid;
      let N = l[b];
      N === void 0 && (N = {}, l[b] = N);
      let D = N[O];
      D === void 0 && (D = C.clone(), N[O] = D), C = D;
    }
    return C.visible = E.visible, C.wireframe = E.wireframe, A === wo ? C.side = E.shadowSide !== null ? E.shadowSide : E.side : C.side = E.shadowSide !== null ? E.shadowSide : h4[E.side], C.clipShadows = E.clipShadows, C.clippingPlanes = E.clippingPlanes, C.clipIntersection = E.clipIntersection, C.wireframeLinewidth = E.wireframeLinewidth, C.linewidth = E.linewidth, P.isPointLight === true && C.isMeshDistanceMaterial === true && (C.referencePosition.setFromMatrixPosition(P.matrixWorld), C.nearDistance = S, C.farDistance = R), C;
  }
  function T(w, _, E, P, S) {
    if (w.visible === false) return;
    if (w.layers.test(_.layers) && (w.isMesh || w.isLine || w.isPoints) && (w.castShadow || w.receiveShadow && S === wo) && (!w.frustumCulled || i.intersectsObject(w))) {
      w.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse, w.matrixWorld);
      const C = e.update(w), L = w.material;
      if (Array.isArray(L)) {
        const I = C.groups;
        for (let b = 0, O = I.length; b < O; b++) {
          const N = I[b], D = L[N.materialIndex];
          if (D && D.visible) {
            const U = M(w, C, D, P, E.near, E.far, S);
            n.renderBufferDirect(E, null, C, U, w, N);
          }
        }
      } else if (L.visible) {
        const I = M(w, C, L, P, E.near, E.far, S);
        n.renderBufferDirect(E, null, C, I, w, null);
      }
    }
    const A = w.children;
    for (let C = 0, L = A.length; C < L; C++)
      T(A[C], _, E, P, S);
  }
}
function AN(n, e, t) {
  const i = t.isWebGL2;
  function r() {
    let ie = false;
    const pe = new xt();
    let be = null;
    const Be = new xt(0, 0, 0, 0);
    return {
      setMask: function(Oe) {
        be !== Oe && !ie && (n.colorMask(Oe, Oe, Oe, Oe), be = Oe);
      },
      setLocked: function(Oe) {
        ie = Oe;
      },
      setClear: function(Oe, $e, ot, qe, wt) {
        wt === true && (Oe *= qe, $e *= qe, ot *= qe), pe.set(Oe, $e, ot, qe), Be.equals(pe) === false && (n.clearColor(Oe, $e, ot, qe), Be.copy(pe));
      },
      reset: function() {
        ie = false, be = null, Be.set(-1, 0, 0, 0);
      }
    };
  }
  function s() {
    let ie = false, pe = null, be = null, Be = null;
    return {
      setTest: function(Oe) {
        Oe ? re(2929) : ae(2929);
      },
      setMask: function(Oe) {
        pe !== Oe && !ie && (n.depthMask(Oe), pe = Oe);
      },
      setFunc: function(Oe) {
        if (be !== Oe) {
          if (Oe)
            switch (Oe) {
              case Yy:
                n.depthFunc(512);
                break;
              case Jy:
                n.depthFunc(519);
                break;
              case Ky:
                n.depthFunc(513);
                break;
              case qc:
                n.depthFunc(515);
                break;
              case qy:
                n.depthFunc(514);
                break;
              case Qy:
                n.depthFunc(518);
                break;
              case eb:
                n.depthFunc(516);
                break;
              case tb:
                n.depthFunc(517);
                break;
              default:
                n.depthFunc(515);
            }
          else
            n.depthFunc(515);
          be = Oe;
        }
      },
      setLocked: function(Oe) {
        ie = Oe;
      },
      setClear: function(Oe) {
        Be !== Oe && (n.clearDepth(Oe), Be = Oe);
      },
      reset: function() {
        ie = false, pe = null, be = null, Be = null;
      }
    };
  }
  function o() {
    let ie = false, pe = null, be = null, Be = null, Oe = null, $e = null, ot = null, qe = null, wt = null;
    return {
      setTest: function(Ne) {
        ie || (Ne ? re(2960) : ae(2960));
      },
      setMask: function(Ne) {
        pe !== Ne && !ie && (n.stencilMask(Ne), pe = Ne);
      },
      setFunc: function(Ne, nt, tt) {
        (be !== Ne || Be !== nt || Oe !== tt) && (n.stencilFunc(Ne, nt, tt), be = Ne, Be = nt, Oe = tt);
      },
      setOp: function(Ne, nt, tt) {
        ($e !== Ne || ot !== nt || qe !== tt) && (n.stencilOp(Ne, nt, tt), $e = Ne, ot = nt, qe = tt);
      },
      setLocked: function(Ne) {
        ie = Ne;
      },
      setClear: function(Ne) {
        wt !== Ne && (n.clearStencil(Ne), wt = Ne);
      },
      reset: function() {
        ie = false, pe = null, be = null, Be = null, Oe = null, $e = null, ot = null, qe = null, wt = null;
      }
    };
  }
  const a = new r(), c = new s(), l = new o();
  let d = {}, h4 = null, f = {}, g = null, p = false, u = null, y = null, v = null, m = null, x = null, M = null, T = null, w = false, _ = null, E = null, P = null, S = null, R = null;
  const A = n.getParameter(35661);
  let C = false, L = 0;
  const I = n.getParameter(7938);
  I.indexOf("WebGL") !== -1 ? (L = parseFloat(/^WebGL (\d)/.exec(I)[1]), C = L >= 1) : I.indexOf("OpenGL ES") !== -1 && (L = parseFloat(/^OpenGL ES (\d)/.exec(I)[1]), C = L >= 2);
  let b = null, O = {};
  const N = n.getParameter(3088), D = n.getParameter(2978), U = new xt().fromArray(N), V = new xt().fromArray(D);
  function H(ie, pe, be) {
    const Be = new Uint8Array(4), Oe = n.createTexture();
    n.bindTexture(ie, Oe), n.texParameteri(ie, 10241, 9728), n.texParameteri(ie, 10240, 9728);
    for (let $e = 0; $e < be; $e++)
      n.texImage2D(pe + $e, 0, 6408, 1, 1, 0, 6408, 5121, Be);
    return Oe;
  }
  const Y = {};
  Y[3553] = H(3553, 3553, 1), Y[34067] = H(34067, 34069, 6), a.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), re(2929), c.setFunc(qc), W(false), B(yd), re(2884), ne(sr);
  function re(ie) {
    d[ie] !== true && (n.enable(ie), d[ie] = true);
  }
  function ae(ie) {
    d[ie] !== false && (n.disable(ie), d[ie] = false);
  }
  function ee(ie) {
    ie !== h4 && (n.bindFramebuffer(36160, ie), h4 = ie);
  }
  function oe(ie, pe) {
    return pe === null && h4 !== null && (pe = h4), f[ie] !== pe ? (n.bindFramebuffer(ie, pe), f[ie] = pe, i && (ie === 36009 && (f[36160] = pe), ie === 36160 && (f[36009] = pe)), true) : false;
  }
  function j(ie) {
    return g !== ie ? (n.useProgram(ie), g = ie, true) : false;
  }
  const K = {
    [ys]: 32774,
    [zy]: 32778,
    [Uy]: 32779
  };
  if (i)
    K[Md] = 32775, K[_d] = 32776;
  else {
    const ie = e.get("EXT_blend_minmax");
    ie !== null && (K[Md] = ie.MIN_EXT, K[_d] = ie.MAX_EXT);
  }
  const $ = {
    [Vy]: 0,
    [ky]: 1,
    [Gy]: 768,
    [Gf]: 770,
    [Xy]: 776,
    [$y]: 774,
    [Wy]: 772,
    [Hy]: 769,
    [Hf]: 771,
    [Zy]: 775,
    [jy]: 773
  };
  function ne(ie, pe, be, Be, Oe, $e, ot, qe) {
    if (ie === sr) {
      p === true && (ae(3042), p = false);
      return;
    }
    if (p === false && (re(3042), p = true), ie !== Fy) {
      if (ie !== u || qe !== w) {
        if ((y !== ys || x !== ys) && (n.blendEquation(32774), y = ys, x = ys), qe)
          switch (ie) {
            case So:
              n.blendFuncSeparate(1, 771, 1, 771);
              break;
            case bd:
              n.blendFunc(1, 1);
              break;
            case xd:
              n.blendFuncSeparate(0, 0, 769, 771);
              break;
            case wd:
              n.blendFuncSeparate(0, 768, 0, 770);
              break;
            default:
              console.error("THREE.WebGLState: Invalid blending: ", ie);
              break;
          }
        else
          switch (ie) {
            case So:
              n.blendFuncSeparate(770, 771, 1, 771);
              break;
            case bd:
              n.blendFunc(770, 1);
              break;
            case xd:
              n.blendFunc(0, 769);
              break;
            case wd:
              n.blendFunc(0, 768);
              break;
            default:
              console.error("THREE.WebGLState: Invalid blending: ", ie);
              break;
          }
        v = null, m = null, M = null, T = null, u = ie, w = qe;
      }
      return;
    }
    Oe = Oe || pe, $e = $e || be, ot = ot || Be, (pe !== y || Oe !== x) && (n.blendEquationSeparate(K[pe], K[Oe]), y = pe, x = Oe), (be !== v || Be !== m || $e !== M || ot !== T) && (n.blendFuncSeparate($[be], $[Be], $[$e], $[ot]), v = be, m = Be, M = $e, T = ot), u = ie, w = null;
  }
  function k(ie, pe) {
    ie.side === Xr ? ae(2884) : re(2884);
    let be = ie.side === jt;
    pe && (be = !be), W(be), ie.blending === So && ie.transparent === false ? ne(sr) : ne(ie.blending, ie.blendEquation, ie.blendSrc, ie.blendDst, ie.blendEquationAlpha, ie.blendSrcAlpha, ie.blendDstAlpha, ie.premultipliedAlpha), c.setFunc(ie.depthFunc), c.setTest(ie.depthTest), c.setMask(ie.depthWrite), a.setMask(ie.colorWrite);
    const Be = ie.stencilWrite;
    l.setTest(Be), Be && (l.setMask(ie.stencilWriteMask), l.setFunc(ie.stencilFunc, ie.stencilRef, ie.stencilFuncMask), l.setOp(ie.stencilFail, ie.stencilZFail, ie.stencilZPass)), J(ie.polygonOffset, ie.polygonOffsetFactor, ie.polygonOffsetUnits), ie.alphaToCoverage === true ? re(32926) : ae(32926);
  }
  function W(ie) {
    _ !== ie && (ie ? n.frontFace(2304) : n.frontFace(2305), _ = ie);
  }
  function B(ie) {
    ie !== Dy ? (re(2884), ie !== E && (ie === yd ? n.cullFace(1029) : ie === Ny ? n.cullFace(1028) : n.cullFace(1032))) : ae(2884), E = ie;
  }
  function X(ie) {
    ie !== P && (C && n.lineWidth(ie), P = ie);
  }
  function J(ie, pe, be) {
    ie ? (re(32823), (S !== pe || R !== be) && (n.polygonOffset(pe, be), S = pe, R = be)) : ae(32823);
  }
  function F(ie) {
    ie ? re(3089) : ae(3089);
  }
  function z(ie) {
    ie === void 0 && (ie = 33984 + A - 1), b !== ie && (n.activeTexture(ie), b = ie);
  }
  function te(ie, pe) {
    b === null && z();
    let be = O[b];
    be === void 0 && (be = { type: void 0, texture: void 0 }, O[b] = be), (be.type !== ie || be.texture !== pe) && (n.bindTexture(ie, pe || Y[ie]), be.type = ie, be.texture = pe);
  }
  function se() {
    const ie = O[b];
    ie !== void 0 && ie.type !== void 0 && (n.bindTexture(ie.type, null), ie.type = void 0, ie.texture = void 0);
  }
  function le() {
    try {
      n.compressedTexImage2D.apply(n, arguments);
    } catch (ie) {
      console.error("THREE.WebGLState:", ie);
    }
  }
  function me() {
    try {
      n.texImage2D.apply(n, arguments);
    } catch (ie) {
      console.error("THREE.WebGLState:", ie);
    }
  }
  function Te() {
    try {
      n.texImage3D.apply(n, arguments);
    } catch (ie) {
      console.error("THREE.WebGLState:", ie);
    }
  }
  function _e(ie) {
    U.equals(ie) === false && (n.scissor(ie.x, ie.y, ie.z, ie.w), U.copy(ie));
  }
  function fe(ie) {
    V.equals(ie) === false && (n.viewport(ie.x, ie.y, ie.z, ie.w), V.copy(ie));
  }
  function we() {
    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(true, true, true, true), n.clearColor(0, 0, 0, 0), n.depthMask(true), 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 === true && (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, O = {}, h4 = null, f = {}, g = null, p = false, u = null, y = null, v = null, m = null, x = null, M = null, T = null, w = false, _ = null, E = null, P = null, S = null, R = null, U.set(0, 0, n.canvas.width, n.canvas.height), V.set(0, 0, n.canvas.width, n.canvas.height), a.reset(), c.reset(), l.reset();
  }
  return {
    buffers: {
      color: a,
      depth: c,
      stencil: l
    },
    enable: re,
    disable: ae,
    bindFramebuffer: oe,
    bindXRFramebuffer: ee,
    useProgram: j,
    setBlending: ne,
    setMaterial: k,
    setFlipSided: W,
    setCullFace: B,
    setLineWidth: X,
    setPolygonOffset: J,
    setScissorTest: F,
    activeTexture: z,
    bindTexture: te,
    unbindTexture: se,
    compressedTexImage2D: le,
    texImage2D: me,
    texImage3D: Te,
    scissor: _e,
    viewport: fe,
    reset: we
  };
}
function CN(n, e, t, i, r, s, o) {
  const a = r.isWebGL2, c = r.maxTextures, l = r.maxCubemapSize, d = r.maxTextureSize, h4 = r.maxSamples, f = /* @__PURE__ */ new WeakMap();
  let g, p = false;
  try {
    p = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null;
  } catch {
  }
  function u(F, z) {
    return p ? new OffscreenCanvas(F, z) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  }
  function y(F, z, te, se) {
    let le = 1;
    if ((F.width > se || F.height > se) && (le = se / Math.max(F.width, F.height)), le < 1 || z === true)
      if (typeof HTMLImageElement < "u" && F instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && F instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && F instanceof ImageBitmap) {
        const me = z ? dx : Math.floor, Te = me(le * F.width), _e = me(le * F.height);
        g === void 0 && (g = u(Te, _e));
        const fe = te ? u(Te, _e) : g;
        return fe.width = Te, fe.height = _e, fe.getContext("2d").drawImage(F, 0, 0, Te, _e), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + F.width + "x" + F.height + ") to (" + Te + "x" + _e + ")."), fe;
      } else
        return "data" in F && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + F.width + "x" + F.height + ")."), F;
    return F;
  }
  function v(F) {
    return Nd(F.width) && Nd(F.height);
  }
  function m(F) {
    return a ? false : F.wrapS !== hn2 || F.wrapT !== hn2 || F.minFilter !== $t && F.minFilter !== Ut;
  }
  function x(F, z) {
    return F.generateMipmaps && z && F.minFilter !== $t && F.minFilter !== Ut;
  }
  function M(F, z, te, se, le = 1) {
    n.generateMipmap(F);
    const me = i.get(z);
    me.__maxMipLevel = Math.log2(Math.max(te, se, le));
  }
  function T(F, z, te) {
    if (a === false) return z;
    if (F !== null) {
      if (n[F] !== void 0) return n[F];
      console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + F + "'");
    }
    let se = z;
    return z === 6403 && (te === 5126 && (se = 33326), te === 5131 && (se = 33325), te === 5121 && (se = 33321)), z === 6407 && (te === 5126 && (se = 34837), te === 5131 && (se = 34843), te === 5121 && (se = 32849)), z === 6408 && (te === 5126 && (se = 34836), te === 5131 && (se = 34842), te === 5121 && (se = 32856)), (se === 33325 || se === 33326 || se === 34842 || se === 34836) && e.get("EXT_color_buffer_float"), se;
  }
  function w(F) {
    return F === $t || F === qa || F === Qa ? 9728 : 9729;
  }
  function _(F) {
    const z = F.target;
    z.removeEventListener("dispose", _), P(z), z.isVideoTexture && f.delete(z), o.memory.textures--;
  }
  function E(F) {
    const z = F.target;
    z.removeEventListener("dispose", E), S(z);
  }
  function P(F) {
    const z = i.get(F);
    z.__webglInit !== void 0 && (n.deleteTexture(z.__webglTexture), i.remove(F));
  }
  function S(F) {
    const z = F.texture, te = i.get(F), se = i.get(z);
    if (F) {
      if (se.__webglTexture !== void 0 && (n.deleteTexture(se.__webglTexture), o.memory.textures--), F.depthTexture && F.depthTexture.dispose(), F.isWebGLCubeRenderTarget)
        for (let le = 0; le < 6; le++)
          n.deleteFramebuffer(te.__webglFramebuffer[le]), te.__webglDepthbuffer && n.deleteRenderbuffer(te.__webglDepthbuffer[le]);
      else
        n.deleteFramebuffer(te.__webglFramebuffer), te.__webglDepthbuffer && n.deleteRenderbuffer(te.__webglDepthbuffer), te.__webglMultisampledFramebuffer && n.deleteFramebuffer(te.__webglMultisampledFramebuffer), te.__webglColorRenderbuffer && n.deleteRenderbuffer(te.__webglColorRenderbuffer), te.__webglDepthRenderbuffer && n.deleteRenderbuffer(te.__webglDepthRenderbuffer);
      if (F.isWebGLMultipleRenderTargets)
        for (let le = 0, me = z.length; le < me; le++) {
          const Te = i.get(z[le]);
          Te.__webglTexture && (n.deleteTexture(Te.__webglTexture), o.memory.textures--), i.remove(z[le]);
        }
      i.remove(z), i.remove(F);
    }
  }
  let R = 0;
  function A() {
    R = 0;
  }
  function C() {
    const F = R;
    return F >= c && console.warn("THREE.WebGLTextures: Trying to use " + F + " texture units while this GPU supports only " + c), R += 1, F;
  }
  function L(F, z) {
    const te = i.get(F);
    if (F.isVideoTexture && k(F), F.version > 0 && te.__version !== F.version) {
      const se = F.image;
      if (se === void 0)
        console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
      else if (se.complete === false)
        console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");
      else {
        H(te, F, z);
        return;
      }
    }
    t.activeTexture(33984 + z), t.bindTexture(3553, te.__webglTexture);
  }
  function I(F, z) {
    const te = i.get(F);
    if (F.version > 0 && te.__version !== F.version) {
      H(te, F, z);
      return;
    }
    t.activeTexture(33984 + z), t.bindTexture(35866, te.__webglTexture);
  }
  function b(F, z) {
    const te = i.get(F);
    if (F.version > 0 && te.__version !== F.version) {
      H(te, F, z);
      return;
    }
    t.activeTexture(33984 + z), t.bindTexture(32879, te.__webglTexture);
  }
  function O(F, z) {
    const te = i.get(F);
    if (F.version > 0 && te.__version !== F.version) {
      Y(te, F, z);
      return;
    }
    t.activeTexture(33984 + z), t.bindTexture(34067, te.__webglTexture);
  }
  const N = {
    [Yr]: 10497,
    [hn2]: 33071,
    [No]: 33648
  }, D = {
    [$t]: 9728,
    [qa]: 9984,
    [Qa]: 9986,
    [Ut]: 9729,
    [Tu]: 9985,
    [yr]: 9987
  };
  function U(F, z, te) {
    if (te ? (n.texParameteri(F, 10242, N[z.wrapS]), n.texParameteri(F, 10243, N[z.wrapT]), (F === 32879 || F === 35866) && n.texParameteri(F, 32882, N[z.wrapR]), n.texParameteri(F, 10240, D[z.magFilter]), n.texParameteri(F, 10241, D[z.minFilter])) : (n.texParameteri(F, 10242, 33071), n.texParameteri(F, 10243, 33071), (F === 32879 || F === 35866) && n.texParameteri(F, 32882, 33071), (z.wrapS !== hn2 || z.wrapT !== hn2) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), n.texParameteri(F, 10240, w(z.magFilter)), n.texParameteri(F, 10241, w(z.minFilter)), z.minFilter !== $t && z.minFilter !== Ut && 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") === true) {
      const se = e.get("EXT_texture_filter_anisotropic");
      if (z.type === tr && e.has("OES_texture_float_linear") === false || a === false && z.type === Ts && e.has("OES_texture_half_float_linear") === false) return;
      (z.anisotropy > 1 || i.get(z).__currentAnisotropy) && (n.texParameterf(F, se.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(z.anisotropy, r.getMaxAnisotropy())), i.get(z).__currentAnisotropy = z.anisotropy);
    }
  }
  function V(F, z) {
    F.__webglInit === void 0 && (F.__webglInit = true, z.addEventListener("dispose", _), F.__webglTexture = n.createTexture(), o.memory.textures++);
  }
  function H(F, z, te) {
    let se = 3553;
    z.isDataTexture2DArray && (se = 35866), z.isDataTexture3D && (se = 32879), V(F, z), t.activeTexture(33984 + te), t.bindTexture(se, F.__webglTexture), n.pixelStorei(37440, z.flipY), n.pixelStorei(37441, z.premultiplyAlpha), n.pixelStorei(3317, z.unpackAlignment), n.pixelStorei(37443, 0);
    const le = m(z) && v(z.image) === false, me = y(z.image, le, false, d), Te = v(me) || a, _e = s.convert(z.format);
    let fe = s.convert(z.type), we = T(z.internalFormat, _e, fe);
    U(se, z, Te);
    let ie;
    const pe = z.mipmaps;
    if (z.isDepthTexture)
      we = 6402, a ? z.type === tr ? we = 36012 : z.type === Va ? we = 33190 : z.type === To ? we = 35056 : we = 33189 : z.type === tr && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), z.format === Es && we === 6402 && z.type !== el && z.type !== Va && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), z.type = el, fe = s.convert(z.type)), z.format === Bo && we === 6402 && (we = 34041, z.type !== To && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), z.type = To, fe = s.convert(z.type))), t.texImage2D(3553, 0, we, me.width, me.height, 0, _e, fe, null);
    else if (z.isDataTexture)
      if (pe.length > 0 && Te) {
        for (let be = 0, Be = pe.length; be < Be; be++)
          ie = pe[be], t.texImage2D(3553, be, we, ie.width, ie.height, 0, _e, fe, ie.data);
        z.generateMipmaps = false, F.__maxMipLevel = pe.length - 1;
      } else
        t.texImage2D(3553, 0, we, me.width, me.height, 0, _e, fe, me.data), F.__maxMipLevel = 0;
    else if (z.isCompressedTexture) {
      for (let be = 0, Be = pe.length; be < Be; be++)
        ie = pe[be], z.format !== jn && z.format !== or ? _e !== null ? t.compressedTexImage2D(3553, be, we, ie.width, ie.height, 0, ie.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, be, we, ie.width, ie.height, 0, _e, fe, ie.data);
      F.__maxMipLevel = pe.length - 1;
    } else if (z.isDataTexture2DArray)
      t.texImage3D(35866, 0, we, me.width, me.height, me.depth, 0, _e, fe, me.data), F.__maxMipLevel = 0;
    else if (z.isDataTexture3D)
      t.texImage3D(32879, 0, we, me.width, me.height, me.depth, 0, _e, fe, me.data), F.__maxMipLevel = 0;
    else if (pe.length > 0 && Te) {
      for (let be = 0, Be = pe.length; be < Be; be++)
        ie = pe[be], t.texImage2D(3553, be, we, _e, fe, ie);
      z.generateMipmaps = false, F.__maxMipLevel = pe.length - 1;
    } else
      t.texImage2D(3553, 0, we, _e, fe, me), F.__maxMipLevel = 0;
    x(z, Te) && M(se, z, me.width, me.height), F.__version = z.version, z.onUpdate && z.onUpdate(z);
  }
  function Y(F, z, te) {
    if (z.image.length !== 6) return;
    V(F, z), t.activeTexture(33984 + te), t.bindTexture(34067, F.__webglTexture), n.pixelStorei(37440, z.flipY), n.pixelStorei(37441, z.premultiplyAlpha), n.pixelStorei(3317, z.unpackAlignment), n.pixelStorei(37443, 0);
    const se = z && (z.isCompressedTexture || z.image[0].isCompressedTexture), le = z.image[0] && z.image[0].isDataTexture, me = [];
    for (let be = 0; be < 6; be++)
      !se && !le ? me[be] = y(z.image[be], false, true, l) : me[be] = le ? z.image[be].image : z.image[be];
    const Te = me[0], _e = v(Te) || a, fe = s.convert(z.format), we = s.convert(z.type), ie = T(z.internalFormat, fe, we);
    U(34067, z, _e);
    let pe;
    if (se) {
      for (let be = 0; be < 6; be++) {
        pe = me[be].mipmaps;
        for (let Be = 0; Be < pe.length; Be++) {
          const Oe = pe[Be];
          z.format !== jn && z.format !== or ? fe !== null ? t.compressedTexImage2D(34069 + be, Be, ie, Oe.width, Oe.height, 0, Oe.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + be, Be, ie, Oe.width, Oe.height, 0, fe, we, Oe.data);
        }
      }
      F.__maxMipLevel = pe.length - 1;
    } else {
      pe = z.mipmaps;
      for (let be = 0; be < 6; be++)
        if (le) {
          t.texImage2D(34069 + be, 0, ie, me[be].width, me[be].height, 0, fe, we, me[be].data);
          for (let Be = 0; Be < pe.length; Be++) {
            const $e = pe[Be].image[be].image;
            t.texImage2D(34069 + be, Be + 1, ie, $e.width, $e.height, 0, fe, we, $e.data);
          }
        } else {
          t.texImage2D(34069 + be, 0, ie, fe, we, me[be]);
          for (let Be = 0; Be < pe.length; Be++) {
            const Oe = pe[Be];
            t.texImage2D(34069 + be, Be + 1, ie, fe, we, Oe.image[be]);
          }
        }
      F.__maxMipLevel = pe.length;
    }
    x(z, _e) && M(34067, z, Te.width, Te.height), F.__version = z.version, z.onUpdate && z.onUpdate(z);
  }
  function re(F, z, te, se, le) {
    const me = s.convert(te.format), Te = s.convert(te.type), _e = T(te.internalFormat, me, Te);
    le === 32879 || le === 35866 ? t.texImage3D(le, 0, _e, z.width, z.height, z.depth, 0, me, Te, null) : t.texImage2D(le, 0, _e, z.width, z.height, 0, me, Te, null), t.bindFramebuffer(36160, F), n.framebufferTexture2D(36160, se, le, i.get(te).__webglTexture, 0), t.bindFramebuffer(36160, null);
  }
  function ae(F, z, te) {
    if (n.bindRenderbuffer(36161, F), z.depthBuffer && !z.stencilBuffer) {
      let se = 33189;
      if (te) {
        const le = z.depthTexture;
        le && le.isDepthTexture && (le.type === tr ? se = 36012 : le.type === Va && (se = 33190));
        const me = ne(z);
        n.renderbufferStorageMultisample(36161, me, se, z.width, z.height);
      } else
        n.renderbufferStorage(36161, se, z.width, z.height);
      n.framebufferRenderbuffer(36160, 36096, 36161, F);
    } else if (z.depthBuffer && z.stencilBuffer) {
      if (te) {
        const se = ne(z);
        n.renderbufferStorageMultisample(36161, se, 35056, z.width, z.height);
      } else
        n.renderbufferStorage(36161, 34041, z.width, z.height);
      n.framebufferRenderbuffer(36160, 33306, 36161, F);
    } else {
      const se = z.isWebGLMultipleRenderTargets === true ? z.texture[0] : z.texture, le = s.convert(se.format), me = s.convert(se.type), Te = T(se.internalFormat, le, me);
      if (te) {
        const _e = ne(z);
        n.renderbufferStorageMultisample(36161, _e, Te, z.width, z.height);
      } else
        n.renderbufferStorage(36161, Te, z.width, z.height);
    }
    n.bindRenderbuffer(36161, null);
  }
  function ee(F, z) {
    if (z && z.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported");
    if (t.bindFramebuffer(36160, F), !(z.depthTexture && z.depthTexture.isDepthTexture))
      throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
    (!i.get(z.depthTexture).__webglTexture || z.depthTexture.image.width !== z.width || z.depthTexture.image.height !== z.height) && (z.depthTexture.image.width = z.width, z.depthTexture.image.height = z.height, z.depthTexture.needsUpdate = true), L(z.depthTexture, 0);
    const se = i.get(z.depthTexture).__webglTexture;
    if (z.depthTexture.format === Es)
      n.framebufferTexture2D(36160, 36096, 3553, se, 0);
    else if (z.depthTexture.format === Bo)
      n.framebufferTexture2D(36160, 33306, 3553, se, 0);
    else
      throw new Error("Unknown depthTexture format");
  }
  function oe(F) {
    const z = i.get(F), te = F.isWebGLCubeRenderTarget === true;
    if (F.depthTexture) {
      if (te) throw new Error("target.depthTexture not supported in Cube render targets");
      ee(z.__webglFramebuffer, F);
    } else if (te) {
      z.__webglDepthbuffer = [];
      for (let se = 0; se < 6; se++)
        t.bindFramebuffer(36160, z.__webglFramebuffer[se]), z.__webglDepthbuffer[se] = n.createRenderbuffer(), ae(z.__webglDepthbuffer[se], F, false);
    } else
      t.bindFramebuffer(36160, z.__webglFramebuffer), z.__webglDepthbuffer = n.createRenderbuffer(), ae(z.__webglDepthbuffer, F, false);
    t.bindFramebuffer(36160, null);
  }
  function j(F) {
    const z = F.texture, te = i.get(F), se = i.get(z);
    F.addEventListener("dispose", E), F.isWebGLMultipleRenderTargets !== true && (se.__webglTexture = n.createTexture(), se.__version = z.version, o.memory.textures++);
    const le = F.isWebGLCubeRenderTarget === true, me = F.isWebGLMultipleRenderTargets === true, Te = F.isWebGLMultisampleRenderTarget === true, _e = z.isDataTexture3D || z.isDataTexture2DArray, fe = v(F) || a;
    if (a && z.format === or && (z.type === tr || z.type === Ts) && (z.format = jn, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), le) {
      te.__webglFramebuffer = [];
      for (let we = 0; we < 6; we++)
        te.__webglFramebuffer[we] = n.createFramebuffer();
    } else if (te.__webglFramebuffer = n.createFramebuffer(), me)
      if (r.drawBuffers) {
        const we = F.texture;
        for (let ie = 0, pe = we.length; ie < pe; ie++) {
          const be = i.get(we[ie]);
          be.__webglTexture === void 0 && (be.__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 (Te)
      if (a) {
        te.__webglMultisampledFramebuffer = n.createFramebuffer(), te.__webglColorRenderbuffer = n.createRenderbuffer(), n.bindRenderbuffer(36161, te.__webglColorRenderbuffer);
        const we = s.convert(z.format), ie = s.convert(z.type), pe = T(z.internalFormat, we, ie), be = ne(F);
        n.renderbufferStorageMultisample(36161, be, pe, F.width, F.height), t.bindFramebuffer(36160, te.__webglMultisampledFramebuffer), n.framebufferRenderbuffer(36160, 36064, 36161, te.__webglColorRenderbuffer), n.bindRenderbuffer(36161, null), F.depthBuffer && (te.__webglDepthRenderbuffer = n.createRenderbuffer(), ae(te.__webglDepthRenderbuffer, F, true)), t.bindFramebuffer(36160, null);
      } else
        console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");
    if (le) {
      t.bindTexture(34067, se.__webglTexture), U(34067, z, fe);
      for (let we = 0; we < 6; we++)
        re(te.__webglFramebuffer[we], F, z, 36064, 34069 + we);
      x(z, fe) && M(34067, z, F.width, F.height), t.bindTexture(34067, null);
    } else if (me) {
      const we = F.texture;
      for (let ie = 0, pe = we.length; ie < pe; ie++) {
        const be = we[ie], Be = i.get(be);
        t.bindTexture(3553, Be.__webglTexture), U(3553, be, fe), re(te.__webglFramebuffer, F, be, 36064 + ie, 3553), x(be, fe) && M(3553, be, F.width, F.height);
      }
      t.bindTexture(3553, null);
    } else {
      let we = 3553;
      _e && (a ? we = z.isDataTexture3D ? 32879 : 35866 : console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")), t.bindTexture(we, se.__webglTexture), U(we, z, fe), re(te.__webglFramebuffer, F, z, 36064, we), x(z, fe) && M(we, z, F.width, F.height, F.depth), t.bindTexture(we, null);
    }
    F.depthBuffer && oe(F);
  }
  function K(F) {
    const z = v(F) || a, te = F.isWebGLMultipleRenderTargets === true ? F.texture : [F.texture];
    for (let se = 0, le = te.length; se < le; se++) {
      const me = te[se];
      if (x(me, z)) {
        const Te = F.isWebGLCubeRenderTarget ? 34067 : 3553, _e = i.get(me).__webglTexture;
        t.bindTexture(Te, _e), M(Te, me, F.width, F.height), t.bindTexture(Te, null);
      }
    }
  }
  function $(F) {
    if (F.isWebGLMultisampleRenderTarget)
      if (a) {
        const z = F.width, te = F.height;
        let se = 16384;
        F.depthBuffer && (se |= 256), F.stencilBuffer && (se |= 1024);
        const le = i.get(F);
        t.bindFramebuffer(36008, le.__webglMultisampledFramebuffer), t.bindFramebuffer(36009, le.__webglFramebuffer), n.blitFramebuffer(0, 0, z, te, 0, 0, z, te, se, 9728), t.bindFramebuffer(36008, null), t.bindFramebuffer(36009, le.__webglMultisampledFramebuffer);
      } else
        console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");
  }
  function ne(F) {
    return a && F.isWebGLMultisampleRenderTarget ? Math.min(h4, F.samples) : 0;
  }
  function k(F) {
    const z = o.render.frame;
    f.get(F) !== z && (f.set(F, z), F.update());
  }
  let W = false, B = false;
  function X(F, z) {
    F && F.isWebGLRenderTarget && (W === false && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), W = true), F = F.texture), L(F, z);
  }
  function J(F, z) {
    F && F.isWebGLCubeRenderTarget && (B === false && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), B = true), F = F.texture), O(F, z);
  }
  this.allocateTextureUnit = C, this.resetTextureUnits = A, this.setTexture2D = L, this.setTexture2DArray = I, this.setTexture3D = b, this.setTextureCube = O, this.setupRenderTarget = j, this.updateRenderTargetMipmap = K, this.updateMultisampleRenderTarget = $, this.safeSetTexture2D = X, this.safeSetTextureCube = J;
}
function Ix(n, e, t) {
  const i = t.isWebGL2;
  function r(s) {
    let o;
    if (s === Ps) return 5121;
    if (s === db) return 32819;
    if (s === fb) return 32820;
    if (s === pb) return 33635;
    if (s === cb) return 5120;
    if (s === ub) return 5122;
    if (s === el) return 5123;
    if (s === hb) return 5124;
    if (s === Va) return 5125;
    if (s === tr) return 5126;
    if (s === Ts)
      return i ? 5131 : (o = e.get("OES_texture_half_float"), o !== null ? o.HALF_FLOAT_OES : null);
    if (s === mb) return 6406;
    if (s === or) return 6407;
    if (s === jn) return 6408;
    if (s === gb) return 6409;
    if (s === vb) return 6410;
    if (s === Es) return 6402;
    if (s === Bo) return 34041;
    if (s === bb) return 6403;
    if (s === xb) return 36244;
    if (s === wb) return 33319;
    if (s === Mb) return 33320;
    if (s === _b) return 36248;
    if (s === Sb) return 36249;
    if (s === Sd || s === Td || s === Ed || s === Ad)
      if (o = e.get("WEBGL_compressed_texture_s3tc"), o !== null) {
        if (s === Sd) return o.COMPRESSED_RGB_S3TC_DXT1_EXT;
        if (s === Td) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;
        if (s === Ed) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;
        if (s === Ad) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT;
      } else
        return null;
    if (s === Cd || s === Ld || s === Rd || s === Pd)
      if (o = e.get("WEBGL_compressed_texture_pvrtc"), o !== null) {
        if (s === Cd) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
        if (s === Ld) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
        if (s === Rd) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
        if (s === Pd) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
      } else
        return null;
    if (s === Tb)
      return o = e.get("WEBGL_compressed_texture_etc1"), o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null;
    if ((s === Od || s === Id) && (o = e.get("WEBGL_compressed_texture_etc"), o !== null)) {
      if (s === Od) return o.COMPRESSED_RGB8_ETC2;
      if (s === Id) return o.COMPRESSED_RGBA8_ETC2_EAC;
    }
    if (s === Eb || s === Ab || s === Cb || s === Lb || s === Rb || s === Pb || s === Ob || s === Ib || s === Db || s === Nb || s === Bb || s === Fb || s === zb || s === Ub || s === kb || s === Gb || s === Hb || s === Wb || s === jb || s === $b || s === Zb || s === Xb || s === Yb || s === Jb || s === Kb || s === qb || s === Qb || s === ex)
      return o = e.get("WEBGL_compressed_texture_astc"), o !== null ? s : null;
    if (s === Vb)
      return o = e.get("EXT_texture_compression_bptc"), o !== null ? s : null;
    if (s === To)
      return i ? 34042 : (o = e.get("WEBGL_depth_texture"), o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null);
  }
  return { convert: r };
}
var ep = class extends nn {
  constructor(e = []) {
    super(), this.cameras = e;
  }
};
ep.prototype.isArrayCamera = true;
var Ci = class extends lt {
  constructor() {
    super(), this.type = "Group";
  }
};
Ci.prototype.isGroup = true;
var LN = { type: "move" };
var Lh = class {
  constructor() {
    this._targetRay = null, this._grip = null, this._hand = null;
  }
  getHandSpace() {
    return this._hand === null && (this._hand = new Ci(), this._hand.matrixAutoUpdate = false, this._hand.visible = false, this._hand.joints = {}, this._hand.inputState = { pinching: false }), this._hand;
  }
  getTargetRaySpace() {
    return this._targetRay === null && (this._targetRay = new Ci(), this._targetRay.matrixAutoUpdate = false, this._targetRay.visible = false, this._targetRay.hasLinearVelocity = false, this._targetRay.linearVelocity = new q(), this._targetRay.hasAngularVelocity = false, this._targetRay.angularVelocity = new q()), this._targetRay;
  }
  getGripSpace() {
    return this._grip === null && (this._grip = new Ci(), this._grip.matrixAutoUpdate = false, this._grip.visible = false, this._grip.hasLinearVelocity = false, this._grip.linearVelocity = new q(), this._grip.hasAngularVelocity = false, 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 = false), this._grip !== null && (this._grip.visible = false), this._hand !== null && (this._hand.visible = false), 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 = true, a.linearVelocity.copy(r.linearVelocity)) : a.hasLinearVelocity = false, r.angularVelocity ? (a.hasAngularVelocity = true, a.angularVelocity.copy(r.angularVelocity)) : a.hasAngularVelocity = false, this.dispatchEvent(LN))), l && e.hand) {
        o = true;
        for (const u of e.hand.values()) {
          const y = t.getJointPose(u, i);
          if (l.joints[u.jointName] === void 0) {
            const m = new Ci();
            m.matrixAutoUpdate = false, m.visible = false, 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"], h4 = l.joints["thumb-tip"], f = d.position.distanceTo(h4.position), g = 0.02, p = 5e-3;
        l.inputState.pinching && f > g + p ? (l.inputState.pinching = false, this.dispatchEvent({
          type: "pinchend",
          handedness: e.handedness,
          target: this
        })) : !l.inputState.pinching && f <= g - p && (l.inputState.pinching = true, 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 = true, c.linearVelocity.copy(s.linearVelocity)) : c.hasLinearVelocity = false, s.angularVelocity ? (c.hasAngularVelocity = true, c.angularVelocity.copy(s.angularVelocity)) : c.hasAngularVelocity = false));
    return a !== null && (a.visible = r !== null), c !== null && (c.visible = s !== null), l !== null && (l.visible = o !== null), this;
  }
};
var RN = class extends ts {
  constructor(e, t) {
    super();
    const i = this, r = e.state;
    let s = null, o = 1, a = null, c = "local-floor", l = null, d = null, h4 = 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 ep();
    m.layers.enable(1), m.layers.enable(2);
    let x = null, M = null;
    this.cameraAutoUpdate = true, this.enabled = false, this.isPresenting = false, this.getController = function(I) {
      let b = g[I];
      return b === void 0 && (b = new Lh(), g[I] = b), b.getTargetRaySpace();
    }, this.getControllerGrip = function(I) {
      let b = g[I];
      return b === void 0 && (b = new Lh(), g[I] = b), b.getGripSpace();
    }, this.getHand = function(I) {
      let b = g[I];
      return b === void 0 && (b = new Lh(), g[I] = b), b.getHandSpace();
    };
    function T(I) {
      const b = p.get(I.inputSource);
      b && b.dispatchEvent({ type: I.type, data: I.inputSource });
    }
    function w() {
      p.forEach(function(I, b) {
        I.disconnect(b);
      }), p.clear(), x = null, M = null, r.bindXRFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), L.stop(), i.isPresenting = false, i.dispatchEvent({ type: "sessionend" });
    }
    this.setFramebufferScaleFactor = function(I) {
      o = I, i.isPresenting === true && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.");
    }, this.setReferenceSpaceType = function(I) {
      c = I, i.isPresenting === true && 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(I) {
      if (s = I, s !== null) {
        s.addEventListener("select", T), s.addEventListener("selectstart", T), s.addEventListener("selectend", T), s.addEventListener("squeeze", T), s.addEventListener("squeezestart", T), s.addEventListener("squeezeend", T), s.addEventListener("end", w), s.addEventListener("inputsourceschange", _);
        const b = t.getContextAttributes();
        if (b.xrCompatible !== true && await t.makeXRCompatible(), s.renderState.layers === void 0) {
          const O = {
            antialias: b.antialias,
            alpha: b.alpha,
            depth: b.depth,
            stencil: b.stencil,
            framebufferScaleFactor: o
          }, N = new XRWebGLLayer(s, t, O);
          s.updateRenderState({ baseLayer: N });
        } else {
          let O = 0;
          b.depth && (O = b.stencil ? 34041 : 6402);
          const N = {
            colorFormat: b.alpha ? 6408 : 6407,
            depthFormat: O,
            scaleFactor: o
          };
          d = new XRWebGLBinding(s, t), f = d.createProjectionLayer(N), h4 = t.createFramebuffer(), s.updateRenderState({ layers: [f] });
        }
        a = await s.requestReferenceSpace(c), L.setContext(s), L.start(), i.isPresenting = true, i.dispatchEvent({ type: "sessionstart" });
      }
    };
    function _(I) {
      const b = s.inputSources;
      for (let O = 0; O < g.length; O++)
        p.set(b[O], g[O]);
      for (let O = 0; O < I.removed.length; O++) {
        const N = I.removed[O], D = p.get(N);
        D && (D.dispatchEvent({ type: "disconnected", data: N }), p.delete(N));
      }
      for (let O = 0; O < I.added.length; O++) {
        const N = I.added[O], D = p.get(N);
        D && D.dispatchEvent({ type: "connected", data: N });
      }
    }
    const E = new q(), P = new q();
    function S(I, b, O) {
      E.setFromMatrixPosition(b.matrixWorld), P.setFromMatrixPosition(O.matrixWorld);
      const N = E.distanceTo(P), D = b.projectionMatrix.elements, U = O.projectionMatrix.elements, V = D[14] / (D[10] - 1), H = D[14] / (D[10] + 1), Y = (D[9] + 1) / D[5], re = (D[9] - 1) / D[5], ae = (D[8] - 1) / D[0], ee = (U[8] + 1) / U[0], oe = V * ae, j = V * ee, K = N / (-ae + ee), $ = K * -ae;
      b.matrixWorld.decompose(I.position, I.quaternion, I.scale), I.translateX($), I.translateZ(K), I.matrixWorld.compose(I.position, I.quaternion, I.scale), I.matrixWorldInverse.copy(I.matrixWorld).invert();
      const ne = V + K, k = H + K, W = oe - $, B = j + (N - $), X = Y * H / k * ne, J = re * H / k * ne;
      I.projectionMatrix.makePerspective(W, B, X, J, ne, k);
    }
    function R(I, b) {
      b === null ? I.matrixWorld.copy(I.matrix) : I.matrixWorld.multiplyMatrices(b.matrixWorld, I.matrix), I.matrixWorldInverse.copy(I.matrixWorld).invert();
    }
    this.updateCamera = function(I) {
      if (s === null) return;
      m.near = y.near = u.near = I.near, m.far = y.far = u.far = I.far, (x !== m.near || M !== m.far) && (s.updateRenderState({
        depthNear: m.near,
        depthFar: m.far
      }), x = m.near, M = m.far);
      const b = I.parent, O = m.cameras;
      R(m, b);
      for (let D = 0; D < O.length; D++)
        R(O[D], b);
      m.matrixWorld.decompose(m.position, m.quaternion, m.scale), I.position.copy(m.position), I.quaternion.copy(m.quaternion), I.scale.copy(m.scale), I.matrix.copy(m.matrix), I.matrixWorld.copy(m.matrixWorld);
      const N = I.children;
      for (let D = 0, U = N.length; D < U; D++)
        N[D].updateMatrixWorld(true);
      O.length === 2 ? S(m, u, y) : m.projectionMatrix.copy(u.projectionMatrix);
    }, this.getCamera = function() {
      return m;
    };
    let A = null;
    function C(I, b) {
      if (l = b.getViewerPose(a), l !== null) {
        const N = l.views, D = s.renderState.baseLayer;
        s.renderState.layers === void 0 && r.bindXRFramebuffer(D.framebuffer);
        let U = false;
        N.length !== m.cameras.length && (m.cameras.length = 0, U = true);
        for (let V = 0; V < N.length; V++) {
          const H = N[V];
          let Y = null;
          if (s.renderState.layers === void 0)
            Y = D.getViewport(H);
          else {
            const ae = d.getViewSubImage(f, H);
            r.bindXRFramebuffer(h4), t.framebufferTexture2D(36160, 36064, 3553, ae.colorTexture, 0), ae.depthStencilTexture !== void 0 && t.framebufferTexture2D(36160, 36096, 3553, ae.depthStencilTexture, 0), Y = ae.viewport;
          }
          const re = v[V];
          re.matrix.fromArray(H.transform.matrix), re.projectionMatrix.fromArray(H.projectionMatrix), re.viewport.set(Y.x, Y.y, Y.width, Y.height), V === 0 && m.matrix.copy(re.matrix), U === true && m.cameras.push(re);
        }
      }
      const O = s.inputSources;
      for (let N = 0; N < g.length; N++) {
        const D = g[N], U = O[N];
        D.update(U, b, a);
      }
      A && A(I, b);
    }
    const L = new Sx();
    L.setAnimationLoop(C), this.setAnimationLoop = function(I) {
      A = I;
    }, this.dispose = function() {
    };
  }
};
function PN(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, M, T) {
    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, T) : h4(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, M) : m.isSpriteMaterial ? a(v, m) : m.isShadowMaterial ? (v.color.value.copy(m.color), v.opacity.value = m.opacity) : m.isShaderMaterial && (m.uniformsNeedUpdate = false);
  }
  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 w = n.get(x).__maxMipLevel;
      w !== void 0 && (v.maxMipLevel.value = w);
    }
    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 M;
    m.map ? M = m.map : m.specularMap ? M = m.specularMap : m.displacementMap ? M = m.displacementMap : m.normalMap ? M = m.normalMap : m.bumpMap ? M = m.bumpMap : m.roughnessMap ? M = m.roughnessMap : m.metalnessMap ? M = m.metalnessMap : m.alphaMap ? M = m.alphaMap : m.emissiveMap ? M = m.emissiveMap : m.clearcoatMap ? M = m.clearcoatMap : m.clearcoatNormalMap ? M = m.clearcoatNormalMap : m.clearcoatRoughnessMap && (M = m.clearcoatRoughnessMap), M !== void 0 && (M.isWebGLRenderTarget && (M = M.texture), M.matrixAutoUpdate === true && M.updateMatrix(), v.uvTransform.value.copy(M.matrix));
    let T;
    m.aoMap ? T = m.aoMap : m.lightMap && (T = m.lightMap), T !== void 0 && (T.isWebGLRenderTarget && (T = T.texture), T.matrixAutoUpdate === true && T.updateMatrix(), v.uv2Transform.value.copy(T.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, M) {
    v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.size.value = m.size * x, v.scale.value = M * 0.5, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap);
    let T;
    m.map ? T = m.map : m.alphaMap && (T = m.alphaMap), T !== void 0 && (T.matrixAutoUpdate === true && T.updateMatrix(), v.uvTransform.value.copy(T.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 === true && 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 h4(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) {
    h4(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 ON() {
  const n = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  return n.style.display = "block", n;
}
function Mt(n = {}) {
  const e = n.canvas !== void 0 ? n.canvas : ON(), t = n.context !== void 0 ? n.context : null, i = n.alpha !== void 0 ? n.alpha : false, r = n.depth !== void 0 ? n.depth : true, s = n.stencil !== void 0 ? n.stencil : true, o = n.antialias !== void 0 ? n.antialias : false, a = n.premultipliedAlpha !== void 0 ? n.premultipliedAlpha : true, c = n.preserveDrawingBuffer !== void 0 ? n.preserveDrawingBuffer : false, l = n.powerPreference !== void 0 ? n.powerPreference : "default", d = n.failIfMajorPerformanceCaveat !== void 0 ? n.failIfMajorPerformanceCaveat : false;
  let h4 = 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: true
  }, this.autoClear = true, this.autoClearColor = true, this.autoClearDepth = true, this.autoClearStencil = true, this.sortObjects = true, this.clippingPlanes = [], this.localClippingEnabled = false, this.gammaFactor = 2, this.outputEncoding = Rn, this.physicallyCorrectLights = false, this.toneMapping = Ur, this.toneMappingExposure = 1;
  const u = this;
  let y = false, v = 0, m = 0, x = null, M = -1, T = null;
  const w = new xt(), _ = new xt();
  let E = null, P = e.width, S = e.height, R = 1, A = null, C = null;
  const L = new xt(0, 0, P, S), I = new xt(0, 0, P, S);
  let b = false;
  const O = [], N = new Ml();
  let D = false, U = false, V = null;
  const H = new Ze(), Y = new q(), re = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: true };
  function ae() {
    return x === null ? R : 1;
  }
  let ee = t;
  function oe(Z, ge) {
    for (let he = 0; he < Z.length; he++) {
      const xe = Z[he], Ae = e.getContext(xe, ge);
      if (Ae !== null) return Ae;
    }
    return null;
  }
  try {
    const Z = {
      alpha: i,
      depth: r,
      stencil: s,
      antialias: o,
      premultipliedAlpha: a,
      preserveDrawingBuffer: c,
      powerPreference: l,
      failIfMajorPerformanceCaveat: d
    };
    if (e.addEventListener("webglcontextlost", $e, false), e.addEventListener("webglcontextrestored", ot, false), ee === null) {
      const ge = ["webgl2", "webgl", "experimental-webgl"];
      if (u.isWebGL1Renderer === true && ge.shift(), ee = oe(ge, Z), ee === null)
        throw oe(ge) ? 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 (Z) {
    throw console.error("THREE.WebGLRenderer: " + Z.message), Z;
  }
  let j, K, $, ne, k, W, B, X, J, F, z, te, se, le, me, Te, _e, fe, we, ie, pe, be;
  function Be() {
    j = new nD(ee), K = new Q3(ee, j, n), j.init(K), pe = new Ix(ee, j, K), $ = new AN(ee, j, K), O[0] = 1029, ne = new sD(), k = new gN(), W = new CN(ee, j, $, k, K, pe, ne), B = new tD(u), X = new CO(ee, K), be = new K3(ee, j, X, K), J = new iD(ee, X, ne, be), F = new cD(ee, J, X, ne), fe = new lD(ee), me = new eD(k), z = new mN(u, B, j, K, be, me), te = new PN(k), se = new yN(k), le = new SN(j, K), _e = new J3(u, B, $, F, a), Te = new Ox(u, F, K), we = new q3(ee, j, ne, K), ie = new rD(ee, j, ne, K), ne.programs = z.programs, u.capabilities = K, u.extensions = j, u.properties = k, u.renderLists = se, u.shadowMap = Te, u.state = $, u.info = ne;
  }
  Be();
  const Oe = new RN(u, ee);
  this.xr = Oe, this.getContext = function() {
    return ee;
  }, this.getContextAttributes = function() {
    return ee.getContextAttributes();
  }, this.forceContextLoss = function() {
    const Z = j.get("WEBGL_lose_context");
    Z && Z.loseContext();
  }, this.forceContextRestore = function() {
    const Z = j.get("WEBGL_lose_context");
    Z && Z.restoreContext();
  }, this.getPixelRatio = function() {
    return R;
  }, this.setPixelRatio = function(Z) {
    Z !== void 0 && (R = Z, this.setSize(P, S, false));
  }, this.getSize = function(Z) {
    return Z.set(P, S);
  }, this.setSize = function(Z, ge, he) {
    if (Oe.isPresenting) {
      console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");
      return;
    }
    P = Z, S = ge, e.width = Math.floor(Z * R), e.height = Math.floor(ge * R), he !== false && (e.style.width = Z + "px", e.style.height = ge + "px"), this.setViewport(0, 0, Z, ge);
  }, this.getDrawingBufferSize = function(Z) {
    return Z.set(P * R, S * R).floor();
  }, this.setDrawingBufferSize = function(Z, ge, he) {
    P = Z, S = ge, R = he, e.width = Math.floor(Z * he), e.height = Math.floor(ge * he), this.setViewport(0, 0, Z, ge);
  }, this.getCurrentViewport = function(Z) {
    return Z.copy(w);
  }, this.getViewport = function(Z) {
    return Z.copy(L);
  }, this.setViewport = function(Z, ge, he, xe) {
    Z.isVector4 ? L.set(Z.x, Z.y, Z.z, Z.w) : L.set(Z, ge, he, xe), $.viewport(w.copy(L).multiplyScalar(R).floor());
  }, this.getScissor = function(Z) {
    return Z.copy(I);
  }, this.setScissor = function(Z, ge, he, xe) {
    Z.isVector4 ? I.set(Z.x, Z.y, Z.z, Z.w) : I.set(Z, ge, he, xe), $.scissor(_.copy(I).multiplyScalar(R).floor());
  }, this.getScissorTest = function() {
    return b;
  }, this.setScissorTest = function(Z) {
    $.setScissorTest(b = Z);
  }, this.setOpaqueSort = function(Z) {
    A = Z;
  }, this.setTransparentSort = function(Z) {
    C = Z;
  }, this.getClearColor = function(Z) {
    return Z.copy(_e.getClearColor());
  }, this.setClearColor = function() {
    _e.setClearColor.apply(_e, arguments);
  }, this.getClearAlpha = function() {
    return _e.getClearAlpha();
  }, this.setClearAlpha = function() {
    _e.setClearAlpha.apply(_e, arguments);
  }, this.clear = function(Z, ge, he) {
    let xe = 0;
    (Z === void 0 || Z) && (xe |= 16384), (ge === void 0 || ge) && (xe |= 256), (he === void 0 || he) && (xe |= 1024), ee.clear(xe);
  }, this.clearColor = function() {
    this.clear(true, false, false);
  }, this.clearDepth = function() {
    this.clear(false, true, false);
  }, this.clearStencil = function() {
    this.clear(false, false, true);
  }, this.dispose = function() {
    e.removeEventListener("webglcontextlost", $e, false), e.removeEventListener("webglcontextrestored", ot, false), se.dispose(), le.dispose(), k.dispose(), B.dispose(), F.dispose(), be.dispose(), Oe.dispose(), Oe.removeEventListener("sessionstart", qt), Oe.removeEventListener("sessionend", Rt), V && (V.dispose(), V = null), Nt.stop();
  };
  function $e(Z) {
    Z.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = true;
  }
  function ot() {
    console.log("THREE.WebGLRenderer: Context Restored."), y = false;
    const Z = ne.autoReset, ge = Te.enabled, he = Te.autoUpdate, xe = Te.needsUpdate, Ae = Te.type;
    Be(), ne.autoReset = Z, Te.enabled = ge, Te.autoUpdate = he, Te.needsUpdate = xe, Te.type = Ae;
  }
  function qe(Z) {
    const ge = Z.target;
    ge.removeEventListener("dispose", qe), wt(ge);
  }
  function wt(Z) {
    Ne(Z), k.remove(Z);
  }
  function Ne(Z) {
    const ge = k.get(Z).programs;
    ge !== void 0 && ge.forEach(function(he) {
      z.releaseProgram(he);
    });
  }
  function nt(Z, ge) {
    Z.render(function(he) {
      u.renderBufferImmediate(he, ge);
    });
  }
  this.renderBufferImmediate = function(Z, ge) {
    be.initAttributes();
    const he = k.get(Z);
    Z.hasPositions && !he.position && (he.position = ee.createBuffer()), Z.hasNormals && !he.normal && (he.normal = ee.createBuffer()), Z.hasUvs && !he.uv && (he.uv = ee.createBuffer()), Z.hasColors && !he.color && (he.color = ee.createBuffer());
    const xe = ge.getAttributes();
    Z.hasPositions && (ee.bindBuffer(34962, he.position), ee.bufferData(34962, Z.positionArray, 35048), be.enableAttribute(xe.position), ee.vertexAttribPointer(xe.position, 3, 5126, false, 0, 0)), Z.hasNormals && (ee.bindBuffer(34962, he.normal), ee.bufferData(34962, Z.normalArray, 35048), be.enableAttribute(xe.normal), ee.vertexAttribPointer(xe.normal, 3, 5126, false, 0, 0)), Z.hasUvs && (ee.bindBuffer(34962, he.uv), ee.bufferData(34962, Z.uvArray, 35048), be.enableAttribute(xe.uv), ee.vertexAttribPointer(xe.uv, 2, 5126, false, 0, 0)), Z.hasColors && (ee.bindBuffer(34962, he.color), ee.bufferData(34962, Z.colorArray, 35048), be.enableAttribute(xe.color), ee.vertexAttribPointer(xe.color, 3, 5126, false, 0, 0)), be.disableUnusedAttributes(), ee.drawArrays(4, 0, Z.count), Z.count = 0;
  }, this.renderBufferDirect = function(Z, ge, he, xe, Ae, de) {
    ge === null && (ge = re);
    const Me = Ae.isMesh && Ae.matrixWorld.determinant() < 0, Pe = Ie(Z, ge, xe, Ae);
    $.setMaterial(xe, Me);
    let Ve = he.index;
    const je = he.attributes.position;
    if (Ve === null) {
      if (je === void 0 || je.count === 0) return;
    } else if (Ve.count === 0)
      return;
    let et = 1;
    xe.wireframe === true && (Ve = J.getWireframeAttribute(he), et = 2), (xe.morphTargets || xe.morphNormals) && fe.update(Ae, he, xe, Pe), be.setup(Ae, xe, Pe, he, Ve);
    let Ye, ht = we;
    Ve !== null && (Ye = X.get(Ve), ht = ie, ht.setIndex(Ye));
    const kt = Ve !== null ? Ve.count : je.count, an = he.drawRange.start * et, os = he.drawRange.count * et, Tt = de !== null ? de.start * et : 0, as = de !== null ? de.count * et : 1 / 0, wn2 = Math.max(an, Tt), Jw = Math.min(kt, an + os, Tt + as) - 1, Dl = Math.max(0, Jw - wn2 + 1);
    if (Dl !== 0) {
      if (Ae.isMesh)
        xe.wireframe === true ? ($.setLineWidth(xe.wireframeLinewidth * ae()), ht.setMode(1)) : ht.setMode(4);
      else if (Ae.isLine) {
        let ma = xe.linewidth;
        ma === void 0 && (ma = 1), $.setLineWidth(ma * ae()), Ae.isLineSegments ? ht.setMode(1) : Ae.isLineLoop ? ht.setMode(2) : ht.setMode(3);
      } else Ae.isPoints ? ht.setMode(0) : Ae.isSprite && ht.setMode(4);
      if (Ae.isInstancedMesh)
        ht.renderInstances(wn2, Dl, Ae.count);
      else if (he.isInstancedBufferGeometry) {
        const ma = Math.min(he.instanceCount, he._maxInstanceCount);
        ht.renderInstances(wn2, Dl, ma);
      } else
        ht.render(wn2, Dl);
    }
  }, this.compile = function(Z, ge) {
    f = le.get(Z), f.init(), Z.traverseVisible(function(he) {
      he.isLight && he.layers.test(ge.layers) && (f.pushLight(he), he.castShadow && f.pushShadow(he));
    }), f.setupLights(), Z.traverse(function(he) {
      const xe = he.material;
      if (xe)
        if (Array.isArray(xe))
          for (let Ae = 0; Ae < xe.length; Ae++) {
            const de = xe[Ae];
            Q(de, Z, he);
          }
        else
          Q(xe, Z, he);
    });
  };
  let tt = null;
  function Kt(Z) {
    tt && tt(Z);
  }
  function qt() {
    Nt.stop();
  }
  function Rt() {
    Nt.start();
  }
  const Nt = new Sx();
  Nt.setAnimationLoop(Kt), typeof window < "u" && Nt.setContext(window), this.setAnimationLoop = function(Z) {
    tt = Z, Oe.setAnimationLoop(Z), Z === null ? Nt.stop() : Nt.start();
  }, Oe.addEventListener("sessionstart", qt), Oe.addEventListener("sessionend", Rt), this.render = function(Z, ge) {
    if (ge !== void 0 && ge.isCamera !== true) {
      console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
      return;
    }
    if (y === true) return;
    Z.autoUpdate === true && Z.updateMatrixWorld(), ge.parent === null && ge.updateMatrixWorld(), Oe.enabled === true && Oe.isPresenting === true && (Oe.cameraAutoUpdate === true && Oe.updateCamera(ge), ge = Oe.getCamera()), Z.isScene === true && Z.onBeforeRender(u, Z, ge, x), f = le.get(Z, p.length), f.init(), p.push(f), H.multiplyMatrices(ge.projectionMatrix, ge.matrixWorldInverse), N.setFromProjectionMatrix(H), U = this.localClippingEnabled, D = me.init(this.clippingPlanes, U, ge), h4 = se.get(Z, g.length), h4.init(), g.push(h4), Gi(Z, ge, 0, u.sortObjects), h4.finish(), u.sortObjects === true && h4.sort(A, C), D === true && me.beginShadows();
    const he = f.state.shadowsArray;
    Te.render(he, Z, ge), f.setupLights(), f.setupLightsView(ge), D === true && me.endShadows(), this.info.autoReset === true && this.info.reset(), _e.render(h4, Z);
    const xe = h4.opaque, Ae = h4.transmissive, de = h4.transparent;
    xe.length > 0 && oi(xe, Z, ge), Ae.length > 0 && Hi(xe, Ae, Z, ge), de.length > 0 && oi(de, Z, ge), x !== null && (W.updateMultisampleRenderTarget(x), W.updateRenderTargetMipmap(x)), Z.isScene === true && Z.onAfterRender(u, Z, ge), $.buffers.depth.setTest(true), $.buffers.depth.setMask(true), $.buffers.color.setMask(true), $.setPolygonOffset(false), be.resetDefaultState(), M = -1, T = null, p.pop(), p.length > 0 ? f = p[p.length - 1] : f = null, g.pop(), g.length > 0 ? h4 = g[g.length - 1] : h4 = null;
  };
  function Gi(Z, ge, he, xe) {
    if (Z.visible === false) return;
    if (Z.layers.test(ge.layers)) {
      if (Z.isGroup)
        he = Z.renderOrder;
      else if (Z.isLOD)
        Z.autoUpdate === true && Z.update(ge);
      else if (Z.isLight)
        f.pushLight(Z), Z.castShadow && f.pushShadow(Z);
      else if (Z.isSprite) {
        if (!Z.frustumCulled || N.intersectsSprite(Z)) {
          xe && Y.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(H);
          const Me = F.update(Z), Pe = Z.material;
          Pe.visible && h4.push(Z, Me, Pe, he, Y.z, null);
        }
      } else if (Z.isImmediateRenderObject)
        xe && Y.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(H), h4.push(Z, null, Z.material, he, Y.z, null);
      else if ((Z.isMesh || Z.isLine || Z.isPoints) && (Z.isSkinnedMesh && Z.skeleton.frame !== ne.render.frame && (Z.skeleton.update(), Z.skeleton.frame = ne.render.frame), !Z.frustumCulled || N.intersectsObject(Z))) {
        xe && Y.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(H);
        const Me = F.update(Z), Pe = Z.material;
        if (Array.isArray(Pe)) {
          const Ve = Me.groups;
          for (let je = 0, et = Ve.length; je < et; je++) {
            const Ye = Ve[je], ht = Pe[Ye.materialIndex];
            ht && ht.visible && h4.push(Z, Me, ht, he, Y.z, Ye);
          }
        } else Pe.visible && h4.push(Z, Me, Pe, he, Y.z, null);
      }
    }
    const de = Z.children;
    for (let Me = 0, Pe = de.length; Me < Pe; Me++)
      Gi(de[Me], ge, he, xe);
  }
  function Hi(Z, ge, he, xe) {
    if (V === null) {
      const Pe = o === true && K.isWebGL2 === true ? Jf : gi;
      V = new Pe(1024, 1024, {
        generateMipmaps: true,
        type: pe.convert(Ts) !== null ? Ts : Ps,
        minFilter: yr,
        magFilter: $t,
        wrapS: hn2,
        wrapT: hn2
      });
    }
    const Ae = u.getRenderTarget();
    u.setRenderTarget(V), u.clear();
    const de = u.toneMapping;
    u.toneMapping = Ur, oi(Z, he, xe), u.toneMapping = de, W.updateMultisampleRenderTarget(V), W.updateRenderTargetMipmap(V), u.setRenderTarget(Ae), oi(ge, he, xe);
  }
  function oi(Z, ge, he) {
    const xe = ge.isScene === true ? ge.overrideMaterial : null;
    for (let Ae = 0, de = Z.length; Ae < de; Ae++) {
      const Me = Z[Ae], Pe = Me.object, Ve = Me.geometry, je = xe === null ? Me.material : xe, et = Me.group;
      if (he.isArrayCamera) {
        const Ye = he.cameras;
        for (let ht = 0, kt = Ye.length; ht < kt; ht++) {
          const an = Ye[ht];
          Pe.layers.test(an.layers) && ($.viewport(w.copy(an.viewport)), f.setupLightsView(an), ss(Pe, ge, an, Ve, je, et));
        }
      } else
        ss(Pe, ge, he, Ve, je, et);
    }
  }
  function ss(Z, ge, he, xe, Ae, de) {
    if (Z.onBeforeRender(u, ge, he, xe, Ae, de), Z.modelViewMatrix.multiplyMatrices(he.matrixWorldInverse, Z.matrixWorld), Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix), Z.isImmediateRenderObject) {
      const Me = Ie(he, ge, Ae, Z);
      $.setMaterial(Ae), be.reset(), nt(Z, Me);
    } else
      Ae.transparent === true && Ae.side === Xr ? (Ae.side = jt, Ae.needsUpdate = true, u.renderBufferDirect(he, ge, xe, Ae, Z, de), Ae.side = Zr, Ae.needsUpdate = true, u.renderBufferDirect(he, ge, xe, Ae, Z, de), Ae.side = Xr) : u.renderBufferDirect(he, ge, xe, Ae, Z, de);
    Z.onAfterRender(u, ge, he, xe, Ae, de);
  }
  function Q(Z, ge, he) {
    ge.isScene !== true && (ge = re);
    const xe = k.get(Z), Ae = f.state.lights, de = f.state.shadowsArray, Me = Ae.state.version, Pe = z.getParameters(Z, Ae.state, de, ge, he), Ve = z.getProgramCacheKey(Pe);
    let je = xe.programs;
    xe.environment = Z.isMeshStandardMaterial ? ge.environment : null, xe.fog = ge.fog, xe.envMap = B.get(Z.envMap || xe.environment), je === void 0 && (Z.addEventListener("dispose", qe), je = /* @__PURE__ */ new Map(), xe.programs = je);
    let et = je.get(Ve);
    if (et !== void 0) {
      if (xe.currentProgram === et && xe.lightsStateVersion === Me)
        return Se(Z, Pe), et;
    } else
      Pe.uniforms = z.getUniforms(Z), Z.onBuild(Pe, u), Z.onBeforeCompile(Pe, u), et = z.acquireProgram(Pe, Ve), je.set(Ve, et), xe.uniforms = Pe.uniforms;
    const Ye = xe.uniforms;
    (!Z.isShaderMaterial && !Z.isRawShaderMaterial || Z.clipping === true) && (Ye.clippingPlanes = me.uniform), Se(Z, Pe), xe.needsLights = it(Z), xe.lightsStateVersion = Me, xe.needsLights && (Ye.ambientLightColor.value = Ae.state.ambient, Ye.lightProbe.value = Ae.state.probe, Ye.directionalLights.value = Ae.state.directional, Ye.directionalLightShadows.value = Ae.state.directionalShadow, Ye.spotLights.value = Ae.state.spot, Ye.spotLightShadows.value = Ae.state.spotShadow, Ye.rectAreaLights.value = Ae.state.rectArea, Ye.ltc_1.value = Ae.state.rectAreaLTC1, Ye.ltc_2.value = Ae.state.rectAreaLTC2, Ye.pointLights.value = Ae.state.point, Ye.pointLightShadows.value = Ae.state.pointShadow, Ye.hemisphereLights.value = Ae.state.hemi, Ye.directionalShadowMap.value = Ae.state.directionalShadowMap, Ye.directionalShadowMatrix.value = Ae.state.directionalShadowMatrix, Ye.spotShadowMap.value = Ae.state.spotShadowMap, Ye.spotShadowMatrix.value = Ae.state.spotShadowMatrix, Ye.pointShadowMap.value = Ae.state.pointShadowMap, Ye.pointShadowMatrix.value = Ae.state.pointShadowMatrix);
    const ht = et.getUniforms(), kt = Vr.seqWithValue(ht.seq, Ye);
    return xe.currentProgram = et, xe.uniformsList = kt, et;
  }
  function Se(Z, ge) {
    const he = k.get(Z);
    he.outputEncoding = ge.outputEncoding, he.instancing = ge.instancing, he.skinning = ge.skinning, he.numClippingPlanes = ge.numClippingPlanes, he.numIntersection = ge.numClipIntersection, he.vertexAlphas = ge.vertexAlphas;
  }
  function Ie(Z, ge, he, xe) {
    ge.isScene !== true && (ge = re), W.resetTextureUnits();
    const Ae = ge.fog, de = he.isMeshStandardMaterial ? ge.environment : null, Me = x === null ? u.outputEncoding : x.texture.encoding, Pe = B.get(he.envMap || de), Ve = he.vertexColors === true && xe.geometry && xe.geometry.attributes.color && xe.geometry.attributes.color.itemSize === 4, je = k.get(he), et = f.state.lights;
    if (D === true && (U === true || Z !== T)) {
      const wn2 = Z === T && he.id === M;
      me.setState(he, Z, wn2);
    }
    let Ye = false;
    he.version === je.__version ? (je.needsLights && je.lightsStateVersion !== et.state.version || je.outputEncoding !== Me || xe.isInstancedMesh && je.instancing === false || !xe.isInstancedMesh && je.instancing === true || xe.isSkinnedMesh && je.skinning === false || !xe.isSkinnedMesh && je.skinning === true || je.envMap !== Pe || he.fog && je.fog !== Ae || je.numClippingPlanes !== void 0 && (je.numClippingPlanes !== me.numPlanes || je.numIntersection !== me.numIntersection) || je.vertexAlphas !== Ve) && (Ye = true) : (Ye = true, je.__version = he.version);
    let ht = je.currentProgram;
    Ye === true && (ht = Q(he, ge, xe));
    let kt = false, an = false, os = false;
    const Tt = ht.getUniforms(), as = je.uniforms;
    if ($.useProgram(ht.program) && (kt = true, an = true, os = true), he.id !== M && (M = he.id, an = true), kt || T !== Z) {
      if (Tt.setValue(ee, "projectionMatrix", Z.projectionMatrix), K.logarithmicDepthBuffer && Tt.setValue(
        ee,
        "logDepthBufFC",
        2 / (Math.log(Z.far + 1) / Math.LN2)
      ), T !== Z && (T = Z, an = true, os = true), he.isShaderMaterial || he.isMeshPhongMaterial || he.isMeshToonMaterial || he.isMeshStandardMaterial || he.envMap) {
        const wn2 = Tt.map.cameraPosition;
        wn2 !== void 0 && wn2.setValue(
          ee,
          Y.setFromMatrixPosition(Z.matrixWorld)
        );
      }
      (he.isMeshPhongMaterial || he.isMeshToonMaterial || he.isMeshLambertMaterial || he.isMeshBasicMaterial || he.isMeshStandardMaterial || he.isShaderMaterial) && Tt.setValue(ee, "isOrthographic", Z.isOrthographicCamera === true), (he.isMeshPhongMaterial || he.isMeshToonMaterial || he.isMeshLambertMaterial || he.isMeshBasicMaterial || he.isMeshStandardMaterial || he.isShaderMaterial || he.isShadowMaterial || xe.isSkinnedMesh) && Tt.setValue(ee, "viewMatrix", Z.matrixWorldInverse);
    }
    if (xe.isSkinnedMesh) {
      Tt.setOptional(ee, xe, "bindMatrix"), Tt.setOptional(ee, xe, "bindMatrixInverse");
      const wn2 = xe.skeleton;
      wn2 && (K.floatVertexTextures ? (wn2.boneTexture === null && wn2.computeBoneTexture(), Tt.setValue(ee, "boneTexture", wn2.boneTexture, W), Tt.setValue(ee, "boneTextureSize", wn2.boneTextureSize)) : Tt.setOptional(ee, wn2, "boneMatrices"));
    }
    return (an || je.receiveShadow !== xe.receiveShadow) && (je.receiveShadow = xe.receiveShadow, Tt.setValue(ee, "receiveShadow", xe.receiveShadow)), an && (Tt.setValue(ee, "toneMappingExposure", u.toneMappingExposure), je.needsLights && He(as, os), Ae && he.fog && te.refreshFogUniforms(as, Ae), te.refreshMaterialUniforms(as, he, R, S, V), Vr.upload(ee, je.uniformsList, as, W)), he.isShaderMaterial && he.uniformsNeedUpdate === true && (Vr.upload(ee, je.uniformsList, as, W), he.uniformsNeedUpdate = false), he.isSpriteMaterial && Tt.setValue(ee, "center", xe.center), Tt.setValue(ee, "modelViewMatrix", xe.modelViewMatrix), Tt.setValue(ee, "normalMatrix", xe.normalMatrix), Tt.setValue(ee, "modelMatrix", xe.matrixWorld), ht;
  }
  function He(Z, ge) {
    Z.ambientLightColor.needsUpdate = ge, Z.lightProbe.needsUpdate = ge, Z.directionalLights.needsUpdate = ge, Z.directionalLightShadows.needsUpdate = ge, Z.pointLights.needsUpdate = ge, Z.pointLightShadows.needsUpdate = ge, Z.spotLights.needsUpdate = ge, Z.spotLightShadows.needsUpdate = ge, Z.rectAreaLights.needsUpdate = ge, Z.hemisphereLights.needsUpdate = ge;
  }
  function it(Z) {
    return Z.isMeshLambertMaterial || Z.isMeshToonMaterial || Z.isMeshPhongMaterial || Z.isMeshStandardMaterial || Z.isShadowMaterial || Z.isShaderMaterial && Z.lights === true;
  }
  this.getActiveCubeFace = function() {
    return v;
  }, this.getActiveMipmapLevel = function() {
    return m;
  }, this.getRenderTarget = function() {
    return x;
  }, this.setRenderTarget = function(Z, ge = 0, he = 0) {
    x = Z, v = ge, m = he, Z && k.get(Z).__webglFramebuffer === void 0 && W.setupRenderTarget(Z);
    let xe = null, Ae = false, de = false;
    if (Z) {
      const Pe = Z.texture;
      (Pe.isDataTexture3D || Pe.isDataTexture2DArray) && (de = true);
      const Ve = k.get(Z).__webglFramebuffer;
      Z.isWebGLCubeRenderTarget ? (xe = Ve[ge], Ae = true) : Z.isWebGLMultisampleRenderTarget ? xe = k.get(Z).__webglMultisampledFramebuffer : xe = Ve, w.copy(Z.viewport), _.copy(Z.scissor), E = Z.scissorTest;
    } else
      w.copy(L).multiplyScalar(R).floor(), _.copy(I).multiplyScalar(R).floor(), E = b;
    if ($.bindFramebuffer(36160, xe) && K.drawBuffers) {
      let Pe = false;
      if (Z)
        if (Z.isWebGLMultipleRenderTargets) {
          const Ve = Z.texture;
          if (O.length !== Ve.length || O[0] !== 36064) {
            for (let je = 0, et = Ve.length; je < et; je++)
              O[je] = 36064 + je;
            O.length = Ve.length, Pe = true;
          }
        } else
          (O.length !== 1 || O[0] !== 36064) && (O[0] = 36064, O.length = 1, Pe = true);
      else
        (O.length !== 1 || O[0] !== 1029) && (O[0] = 1029, O.length = 1, Pe = true);
      Pe && (K.isWebGL2 ? ee.drawBuffers(O) : j.get("WEBGL_draw_buffers").drawBuffersWEBGL(O));
    }
    if ($.viewport(w), $.scissor(_), $.setScissorTest(E), Ae) {
      const Pe = k.get(Z.texture);
      ee.framebufferTexture2D(36160, 36064, 34069 + ge, Pe.__webglTexture, he);
    } else if (de) {
      const Pe = k.get(Z.texture), Ve = ge || 0;
      ee.framebufferTextureLayer(36160, 36064, Pe.__webglTexture, he || 0, Ve);
    }
  }, this.readRenderTargetPixels = function(Z, ge, he, xe, Ae, de, Me) {
    if (!(Z && Z.isWebGLRenderTarget)) {
      console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
      return;
    }
    let Pe = k.get(Z).__webglFramebuffer;
    if (Z.isWebGLCubeRenderTarget && Me !== void 0 && (Pe = Pe[Me]), Pe) {
      $.bindFramebuffer(36160, Pe);
      try {
        const Ve = Z.texture, je = Ve.format, et = Ve.type;
        if (je !== jn && pe.convert(je) !== ee.getParameter(35739)) {
          console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
          return;
        }
        const Ye = et === Ts && (j.has("EXT_color_buffer_half_float") || K.isWebGL2 && j.has("EXT_color_buffer_float"));
        if (et !== Ps && pe.convert(et) !== ee.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513)
        !(et === tr && (K.isWebGL2 || j.has("OES_texture_float") || j.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 ? ge >= 0 && ge <= Z.width - xe && he >= 0 && he <= Z.height - Ae && ee.readPixels(ge, he, xe, Ae, pe.convert(je), pe.convert(et), de) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.");
      } finally {
        const Ve = x !== null ? k.get(x).__webglFramebuffer : null;
        $.bindFramebuffer(36160, Ve);
      }
    }
  }, this.copyFramebufferToTexture = function(Z, ge, he = 0) {
    const xe = Math.pow(2, -he), Ae = Math.floor(ge.image.width * xe), de = Math.floor(ge.image.height * xe);
    let Me = pe.convert(ge.format);
    K.isWebGL2 && (Me === 6407 && (Me = 32849), Me === 6408 && (Me = 32856)), W.setTexture2D(ge, 0), ee.copyTexImage2D(3553, he, Me, Z.x, Z.y, Ae, de, 0), $.unbindTexture();
  }, this.copyTextureToTexture = function(Z, ge, he, xe = 0) {
    const Ae = ge.image.width, de = ge.image.height, Me = pe.convert(he.format), Pe = pe.convert(he.type);
    W.setTexture2D(he, 0), ee.pixelStorei(37440, he.flipY), ee.pixelStorei(37441, he.premultiplyAlpha), ee.pixelStorei(3317, he.unpackAlignment), ge.isDataTexture ? ee.texSubImage2D(3553, xe, Z.x, Z.y, Ae, de, Me, Pe, ge.image.data) : ge.isCompressedTexture ? ee.compressedTexSubImage2D(3553, xe, Z.x, Z.y, ge.mipmaps[0].width, ge.mipmaps[0].height, Me, ge.mipmaps[0].data) : ee.texSubImage2D(3553, xe, Z.x, Z.y, Me, Pe, ge.image), xe === 0 && he.generateMipmaps && ee.generateMipmap(3553), $.unbindTexture();
  }, this.copyTextureToTexture3D = function(Z, ge, he, xe, Ae = 0) {
    if (u.isWebGL1Renderer) {
      console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");
      return;
    }
    const de = Z.max.x - Z.min.x + 1, Me = Z.max.y - Z.min.y + 1, Pe = Z.max.z - Z.min.z + 1, Ve = pe.convert(xe.format), je = pe.convert(xe.type);
    let et;
    if (xe.isDataTexture3D)
      W.setTexture3D(xe, 0), et = 32879;
    else if (xe.isDataTexture2DArray)
      W.setTexture2DArray(xe, 0), et = 35866;
    else {
      console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");
      return;
    }
    ee.pixelStorei(37440, xe.flipY), ee.pixelStorei(37441, xe.premultiplyAlpha), ee.pixelStorei(3317, xe.unpackAlignment);
    const Ye = ee.getParameter(3314), ht = ee.getParameter(32878), kt = ee.getParameter(3316), an = ee.getParameter(3315), os = ee.getParameter(32877), Tt = he.isCompressedTexture ? he.mipmaps[0] : he.image;
    ee.pixelStorei(3314, Tt.width), ee.pixelStorei(32878, Tt.height), ee.pixelStorei(3316, Z.min.x), ee.pixelStorei(3315, Z.min.y), ee.pixelStorei(32877, Z.min.z), he.isDataTexture || he.isDataTexture3D ? ee.texSubImage3D(et, Ae, ge.x, ge.y, ge.z, de, Me, Pe, Ve, je, Tt.data) : he.isCompressedTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), ee.compressedTexSubImage3D(et, Ae, ge.x, ge.y, ge.z, de, Me, Pe, Ve, Tt.data)) : ee.texSubImage3D(et, Ae, ge.x, ge.y, ge.z, de, Me, Pe, Ve, je, Tt), ee.pixelStorei(3314, Ye), ee.pixelStorei(32878, ht), ee.pixelStorei(3316, kt), ee.pixelStorei(3315, an), ee.pixelStorei(32877, os), Ae === 0 && xe.generateMipmaps && ee.generateMipmap(et), $.unbindTexture();
  }, this.initTexture = function(Z) {
    W.setTexture2D(Z, 0), $.unbindTexture();
  }, this.resetState = function() {
    v = 0, m = 0, x = null, $.reset(), be.reset();
  }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
var Dx = class extends Mt {
};
Dx.prototype.isWebGL1Renderer = true;
var _l = class __l {
  constructor(e, t = 25e-5) {
    this.name = "", this.color = new Fe(e), this.density = t;
  }
  clone() {
    return new __l(this.color, this.density);
  }
  toJSON() {
    return {
      type: "FogExp2",
      color: this.color.getHex(),
      density: this.density
    };
  }
};
_l.prototype.isFogExp2 = true;
var Sl = class _Sl {
  constructor(e, t = 1, i = 1e3) {
    this.name = "", this.color = new Fe(e), this.near = t, this.far = i;
  }
  clone() {
    return new _Sl(this.color, this.near, this.far);
  }
  toJSON() {
    return {
      type: "Fog",
      color: this.color.getHex(),
      near: this.near,
      far: this.far
    };
  }
};
Sl.prototype.isFog = true;
var Nu = class extends lt {
  constructor() {
    super(), this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = true, 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;
  }
};
Nu.prototype.isScene = true;
var is = class {
  constructor(e, t) {
    this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = zo, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = $n();
  }
  onUploadCallback() {
  }
  set needsUpdate(e) {
    e === true && 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 = $n()), 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 = $n()), 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
    };
  }
};
is.prototype.isInterleavedBuffer = true;
var Gt = new q();
var dr = class _dr {
  constructor(e, t, i, r = false) {
    this.name = "", this.data = e, this.itemSize = t, this.offset = i, this.normalized = r === true;
  }
  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 rt(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 _dr(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: true,
        itemSize: this.itemSize,
        data: this.data.uuid,
        offset: this.offset,
        normalized: this.normalized
      };
  }
};
dr.prototype.isInterleavedBufferAttribute = true;
var Tl = class extends en {
  constructor(e) {
    super(), this.type = "SpriteMaterial", this.color = new Fe(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = true, this.transparent = true, 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;
  }
};
Tl.prototype.isSpriteMaterial = true;
var uo;
var Sa = new q();
var ho = new q();
var fo = new q();
var po = new Re();
var Ta = new Re();
var Nx = new Ze();
var ac = new q();
var Ea = new q();
var lc = new q();
var Ug = new Re();
var Rh = new Re();
var Vg = new Re();
var El = class extends lt {
  constructor(e) {
    if (super(), this.type = "Sprite", uo === void 0) {
      uo = 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 is(t, 5);
      uo.setIndex([0, 1, 2, 0, 2, 3]), uo.setAttribute("position", new dr(i, 3, 0, false)), uo.setAttribute("uv", new dr(i, 2, 3, false));
    }
    this.geometry = uo, this.material = e !== void 0 ? e : new Tl(), 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.'), ho.setFromMatrixScale(this.matrixWorld), Nx.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), fo.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === false && ho.multiplyScalar(-fo.z);
    const i = this.material.rotation;
    let r, s;
    i !== 0 && (s = Math.cos(i), r = Math.sin(i));
    const o = this.center;
    cc(ac.set(-0.5, -0.5, 0), fo, o, ho, r, s), cc(Ea.set(0.5, -0.5, 0), fo, o, ho, r, s), cc(lc.set(0.5, 0.5, 0), fo, o, ho, r, s), Ug.set(0, 0), Rh.set(1, 0), Vg.set(1, 1);
    let a = e.ray.intersectTriangle(ac, Ea, lc, false, Sa);
    if (a === null && (cc(Ea.set(-0.5, 0.5, 0), fo, o, ho, r, s), Rh.set(0, 1), a = e.ray.intersectTriangle(ac, lc, Ea, false, Sa), a === null))
      return;
    const c = e.ray.origin.distanceTo(Sa);
    c < e.near || c > e.far || t.push({
      distance: c,
      point: Sa.clone(),
      uv: Zt.getUV(Sa, ac, Ea, lc, Ug, Rh, Vg, 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;
  }
};
El.prototype.isSprite = true;
function cc(n, e, t, i, r, s) {
  po.subVectors(n, t).addScalar(0.5).multiply(i), r !== void 0 ? (Ta.x = s * po.x - r * po.y, Ta.y = r * po.x + s * po.y) : Ta.copy(po), n.copy(e), n.x += Ta.x, n.y += Ta.y, n.applyMatrix4(Nx);
}
var uc = new q();
var kg = new q();
var Bx = class extends lt {
  constructor() {
    super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, {
      levels: {
        enumerable: true,
        value: []
      },
      isLOD: {
        value: true
      }
    }), this.autoUpdate = true;
  }
  copy(e) {
    super.copy(e, false);
    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) {
      uc.setFromMatrixPosition(this.matrixWorld);
      const r = e.ray.origin.distanceTo(uc);
      this.getObjectForDistance(r).raycast(e, t);
    }
  }
  update(e) {
    const t = this.levels;
    if (t.length > 1) {
      uc.setFromMatrixPosition(e.matrixWorld), kg.setFromMatrixPosition(this.matrixWorld);
      const i = uc.distanceTo(kg) / e.zoom;
      t[0].object.visible = true;
      let r, s;
      for (r = 1, s = t.length; r < s && i >= t[r].distance; r++)
        t[r - 1].object.visible = false, t[r].object.visible = true;
      for (this._currentLevel = r - 1; r < s; r++)
        t[r].object.visible = false;
    }
  }
  toJSON(e) {
    const t = super.toJSON(e);
    this.autoUpdate === false && (t.object.autoUpdate = false), 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;
  }
};
var Gg = new q();
var Hg = new xt();
var Wg = new xt();
var IN = new q();
var jg = new Ze();
var Al = class extends Yt {
  constructor(e, t) {
    super(e, t), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new Ze(), this.bindMatrixInverse = new Ze();
  }
  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(true), 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;
    Hg.fromBufferAttribute(r.attributes.skinIndex, e), Wg.fromBufferAttribute(r.attributes.skinWeight, e), Gg.fromBufferAttribute(r.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
    for (let s = 0; s < 4; s++) {
      const o = Wg.getComponent(s);
      if (o !== 0) {
        const a = Hg.getComponent(s);
        jg.multiplyMatrices(i.bones[a].matrixWorld, i.boneInverses[a]), t.addScaledVector(IN.copy(Gg).applyMatrix4(jg), o);
      }
    }
    return t.applyMatrix4(this.bindMatrixInverse);
  }
};
Al.prototype.isSkinnedMesh = true;
var Cl = class extends lt {
  constructor() {
    super(), this.type = "Bone";
  }
};
Cl.prototype.isBone = true;
var Cs = class extends Jt {
  constructor(e = null, t = 1, i = 1, r, s, o, a, c, l = $t, d = $t, h4, f) {
    super(null, o, a, c, l, d, r, s, h4, f), this.image = { data: e, width: t, height: i }, this.magFilter = l, this.minFilter = d, this.generateMipmaps = false, this.flipY = false, this.unpackAlignment = 1, this.needsUpdate = true;
  }
};
Cs.prototype.isDataTexture = true;
var $g = new Ze();
var DN = new Ze();
var Ll = class _Ll {
  constructor(e = [], t = []) {
    this.uuid = $n(), 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 Ze());
    }
  }
  calculateInverses() {
    this.boneInverses.length = 0;
    for (let e = 0, t = this.bones.length; e < t; e++) {
      const i = new Ze();
      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 : DN;
      $g.multiplyMatrices(a, t[s]), $g.toArray(i, s * 16);
    }
    r !== null && (r.needsUpdate = true);
  }
  clone() {
    return new _Ll(this.bones, this.boneInverses);
  }
  computeBoneTexture() {
    let e = Math.sqrt(this.bones.length * 4);
    e = hx(e), e = Math.max(e, 4);
    const t = new Float32Array(e * e * 4);
    t.set(this.boneMatrices);
    const i = new Cs(t, e, e, jn, tr);
    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 Cl()), this.bones.push(o), this.boneInverses.push(new Ze().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;
  }
};
var Zg = new Ze();
var Xg = new Ze();
var hc = [];
var Aa = new Yt();
var tp = class extends Yt {
  constructor(e, t, i) {
    super(e, t), this.instanceMatrix = new rt(new Float32Array(i * 16), 16), this.instanceColor = null, this.count = i, this.frustumCulled = false;
  }
  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 (Aa.geometry = this.geometry, Aa.material = this.material, Aa.material !== void 0)
      for (let s = 0; s < r; s++) {
        this.getMatrixAt(s, Zg), Xg.multiplyMatrices(i, Zg), Aa.matrixWorld = Xg, Aa.raycast(e, hc);
        for (let o = 0, a = hc.length; o < a; o++) {
          const c = hc[o];
          c.instanceId = s, c.object = this, t.push(c);
        }
        hc.length = 0;
      }
  }
  setColorAt(e, t) {
    this.instanceColor === null && (this.instanceColor = new rt(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" });
  }
};
tp.prototype.isInstancedMesh = true;
var on = class extends en {
  constructor(e) {
    super(), this.type = "LineBasicMaterial", this.color = new Fe(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.morphTargets = false, 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;
  }
};
on.prototype.isLineBasicMaterial = true;
var Yg = new q();
var Jg = new q();
var Kg = new Ze();
var Ph = new ns();
var dc = new br();
var Bi = class extends lt {
  constructor(e = new Ke(), t = new on()) {
    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++)
          Yg.fromBufferAttribute(t, r - 1), Jg.fromBufferAttribute(t, r), i[r] = i[r - 1], i[r] += Yg.distanceTo(Jg);
        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(), dc.copy(i.boundingSphere), dc.applyMatrix4(r), dc.radius += s, e.ray.intersectsSphere(dc) === false) return;
    Kg.copy(r).invert(), Ph.copy(e.ray).applyMatrix4(Kg);
    const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a, l = new q(), d = new q(), h4 = 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, M = m - 1; x < M; x += g) {
          const T = p.getX(x), w = p.getX(x + 1);
          if (l.fromBufferAttribute(y, T), d.fromBufferAttribute(y, w), Ph.distanceSqToSegment(l, d, f, h4) > c) continue;
          f.applyMatrix4(this.matrixWorld);
          const E = e.ray.origin.distanceTo(f);
          E < e.near || E > e.far || t.push({
            distance: E,
            // What do we want? intersection point on the ray or on the segment??
            // point: raycaster.ray.at( distance ),
            point: h4.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, M = m - 1; x < M; x += g) {
          if (l.fromBufferAttribute(y, x), d.fromBufferAttribute(y, x + 1), Ph.distanceSqToSegment(l, d, f, h4) > c) continue;
          f.applyMatrix4(this.matrixWorld);
          const w = e.ray.origin.distanceTo(f);
          w < e.near || w > e.far || t.push({
            distance: w,
            // What do we want? intersection point on the ray or on the segment??
            // point: raycaster.ray.at( distance ),
            point: h4.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.");
    }
  }
};
Bi.prototype.isLine = true;
var qg = new q();
var Qg = new q();
var On = class extends Bi {
  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)
          qg.fromBufferAttribute(t, r), Qg.fromBufferAttribute(t, r + 1), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + qg.distanceTo(Qg);
        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;
  }
};
On.prototype.isLineSegments = true;
var Bu = class extends Bi {
  constructor(e, t) {
    super(e, t), this.type = "LineLoop";
  }
};
Bu.prototype.isLineLoop = true;
var rs = class extends en {
  constructor(e) {
    super(), this.type = "PointsMaterial", this.color = new Fe(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = true, this.morphTargets = false, 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;
  }
};
rs.prototype.isPointsMaterial = true;
var ev = new Ze();
var zd = new ns();
var fc = new br();
var pc = new q();
var ha = class extends lt {
  constructor(e = new Ke(), t = new rs()) {
    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(), fc.copy(i.boundingSphere), fc.applyMatrix4(r), fc.radius += s, e.ray.intersectsSphere(fc) === false) return;
    ev.copy(r).invert(), zd.copy(e.ray).applyMatrix4(ev);
    const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a;
    if (i.isBufferGeometry) {
      const l = i.index, h4 = 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);
          pc.fromBufferAttribute(h4, y), tv(pc, y, c, r, e, t, this);
        }
      } else {
        const f = Math.max(0, o.start), g = Math.min(h4.count, o.start + o.count);
        for (let p = f, u = g; p < u; p++)
          pc.fromBufferAttribute(h4, p), tv(pc, 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.");
    }
  }
};
ha.prototype.isPoints = true;
function tv(n, e, t, i, r, s, o) {
  const a = zd.distanceSqToPoint(n);
  if (a < t) {
    const c = new q();
    zd.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
    });
  }
}
var Fx = class extends Jt {
  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 : or, this.minFilter = o !== void 0 ? o : Ut, this.magFilter = s !== void 0 ? s : Ut, this.generateMipmaps = false;
    const d = this;
    function h4() {
      d.needsUpdate = true, e.requestVideoFrameCallback(h4);
    }
    "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(h4);
  }
  clone() {
    return new this.constructor(this.image).copy(this);
  }
  update() {
    const e = this.image;
    "requestVideoFrameCallback" in e === false && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = true);
  }
};
Fx.prototype.isVideoTexture = true;
var np = class extends Jt {
  constructor(e, t, i, r, s, o, a, c, l, d, h4, f) {
    super(null, o, a, c, l, d, r, s, h4, f), this.image = { width: t, height: i }, this.mipmaps = e, this.flipY = false, this.generateMipmaps = false;
  }
};
np.prototype.isCompressedTexture = true;
var zx = class extends Jt {
  constructor(e, t, i, r, s, o, a, c, l) {
    super(e, t, i, r, s, o, a, c, l), this.needsUpdate = true;
  }
};
zx.prototype.isCanvasTexture = true;
var Ux = class extends Jt {
  constructor(e, t, i, r, s, o, a, c, l, d) {
    if (d = d !== void 0 ? d : Es, d !== Es && d !== Bo)
      throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
    i === void 0 && d === Es && (i = el), i === void 0 && d === Bo && (i = To), 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 = false, this.generateMipmaps = false;
  }
};
Ux.prototype.isDepthTexture = true;
var ko = class _ko 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 h4 = 0, f = 3; h4 <= t; h4++, f += 3) {
      const g = i + h4 / 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 h4 = 1; h4 <= t; h4++)
      s.push(h4, h4 + 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 _ko(e.radius, e.segments, e.thetaStart, e.thetaLength);
  }
};
var Jr = class _Jr extends Ke {
  constructor(e = 1, t = 1, i = 1, r = 8, s = 1, o = false, 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 = [], h4 = [], f = [], g = [];
    let p = 0;
    const u = [], y = i / 2;
    let v = 0;
    m(), o === false && (e > 0 && x(true), t > 0 && x(false)), this.setIndex(d), this.setAttribute("position", new We(h4, 3)), this.setAttribute("normal", new We(f, 3)), this.setAttribute("uv", new We(g, 2));
    function m() {
      const M = new q(), T = new q();
      let w = 0;
      const _ = (t - e) / i;
      for (let E = 0; E <= s; E++) {
        const P = [], S = E / s, R = S * (t - e) + e;
        for (let A = 0; A <= r; A++) {
          const C = A / r, L = C * c + a, I = Math.sin(L), b = Math.cos(L);
          T.x = R * I, T.y = -S * i + y, T.z = R * b, h4.push(T.x, T.y, T.z), M.set(I, _, b).normalize(), f.push(M.x, M.y, M.z), g.push(C, 1 - S), P.push(p++);
        }
        u.push(P);
      }
      for (let E = 0; E < r; E++)
        for (let P = 0; P < s; P++) {
          const S = u[P][E], R = u[P + 1][E], A = u[P + 1][E + 1], C = u[P][E + 1];
          d.push(S, R, C), d.push(R, A, C), w += 6;
        }
      l.addGroup(v, w, 0), v += w;
    }
    function x(M) {
      const T = p, w = new Re(), _ = new q();
      let E = 0;
      const P = M === true ? e : t, S = M === true ? 1 : -1;
      for (let A = 1; A <= r; A++)
        h4.push(0, y * S, 0), f.push(0, S, 0), g.push(0.5, 0.5), p++;
      const R = p;
      for (let A = 0; A <= r; A++) {
        const L = A / r * c + a, I = Math.cos(L), b = Math.sin(L);
        _.x = P * b, _.y = y * S, _.z = P * I, h4.push(_.x, _.y, _.z), f.push(0, S, 0), w.x = I * 0.5 + 0.5, w.y = b * 0.5 * S + 0.5, g.push(w.x, w.y), p++;
      }
      for (let A = 0; A < r; A++) {
        const C = T + A, L = R + A;
        M === true ? d.push(L, L + 1, C) : d.push(L + 1, L, C), E += 3;
      }
      l.addGroup(v, E, M === true ? 1 : 2), v += E;
    }
  }
  static fromJSON(e) {
    return new _Jr(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength);
  }
};
var Go = class _Go extends Jr {
  constructor(e = 1, t = 1, i = 8, r = 1, s = false, 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 _Go(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength);
  }
};
var Fi = class _Fi 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(), M = new q(), T = new q();
      for (let w = 0; w < t.length; w += 3)
        g(t[w + 0], x), g(t[w + 1], M), g(t[w + 2], T), c(x, M, T, m);
    }
    function c(m, x, M, T) {
      const w = T + 1, _ = [];
      for (let E = 0; E <= w; E++) {
        _[E] = [];
        const P = m.clone().lerp(M, E / w), S = x.clone().lerp(M, E / w), R = w - E;
        for (let A = 0; A <= R; A++)
          A === 0 && E === w ? _[E][A] = P : _[E][A] = P.clone().lerp(S, A / R);
      }
      for (let E = 0; E < w; E++)
        for (let P = 0; P < 2 * (w - E) - 1; P++) {
          const S = Math.floor(P / 2);
          P % 2 === 0 ? (f(_[E][S + 1]), f(_[E + 1][S]), f(_[E][S])) : (f(_[E][S + 1]), f(_[E + 1][S + 1]), f(_[E + 1][S]));
        }
    }
    function l(m) {
      const x = new q();
      for (let M = 0; M < s.length; M += 3)
        x.x = s[M + 0], x.y = s[M + 1], x.z = s[M + 2], x.normalize().multiplyScalar(m), s[M + 0] = x.x, s[M + 1] = x.y, s[M + 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 M = y(m) / 2 / Math.PI + 0.5, T = v(m) / Math.PI + 0.5;
        o.push(M, 1 - T);
      }
      p(), h4();
    }
    function h4() {
      for (let m = 0; m < o.length; m += 6) {
        const x = o[m + 0], M = o[m + 2], T = o[m + 4], w = Math.max(x, M, T), _ = Math.min(x, M, T);
        w > 0.9 && _ < 0.1 && (x < 0.2 && (o[m + 0] += 1), M < 0.2 && (o[m + 2] += 1), T < 0.2 && (o[m + 4] += 1));
      }
    }
    function f(m) {
      s.push(m.x, m.y, m.z);
    }
    function g(m, x) {
      const M = m * 3;
      x.x = e[M + 0], x.y = e[M + 1], x.z = e[M + 2];
    }
    function p() {
      const m = new q(), x = new q(), M = new q(), T = new q(), w = new Re(), _ = new Re(), E = new Re();
      for (let P = 0, S = 0; P < s.length; P += 9, S += 6) {
        m.set(s[P + 0], s[P + 1], s[P + 2]), x.set(s[P + 3], s[P + 4], s[P + 5]), M.set(s[P + 6], s[P + 7], s[P + 8]), w.set(o[S + 0], o[S + 1]), _.set(o[S + 2], o[S + 3]), E.set(o[S + 4], o[S + 5]), T.copy(m).add(x).add(M).divideScalar(3);
        const R = y(T);
        u(w, S + 0, m, R), u(_, S + 2, x, R), u(E, S + 4, M, R);
      }
    }
    function u(m, x, M, T) {
      T < 0 && m.x === 1 && (o[x] = m.x - 1), M.x === 0 && M.z === 0 && (o[x] = T / 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 _Fi(e.vertices, e.indices, e.radius, e.details);
  }
};
var Ho = class _Ho extends Fi {
  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 _Ho(e.radius, e.detail);
  }
};
var mc = new q();
var gc = new q();
var Oh = new q();
var vc = new Zt();
var ip = class extends Ke {
  constructor(e, t) {
    if (super(), this.type = "EdgesGeometry", this.parameters = {
      thresholdAngle: t
    }, t = t !== void 0 ? t : 1, e.isGeometry === true) {
      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"], h4 = 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 } = vc;
      if (u.fromBufferAttribute(a, l[0]), y.fromBufferAttribute(a, l[1]), v.fromBufferAttribute(a, l[2]), vc.getNormal(Oh), h4[0] = `${Math.round(u.x * r)},${Math.round(u.y * r)},${Math.round(u.z * r)}`, h4[1] = `${Math.round(y.x * r)},${Math.round(y.y * r)},${Math.round(y.z * r)}`, h4[2] = `${Math.round(v.x * r)},${Math.round(v.y * r)},${Math.round(v.z * r)}`, !(h4[0] === h4[1] || h4[1] === h4[2] || h4[2] === h4[0]))
        for (let m = 0; m < 3; m++) {
          const x = (m + 1) % 3, M = h4[m], T = h4[x], w = vc[d[m]], _ = vc[d[x]], E = `${M}_${T}`, P = `${T}_${M}`;
          P in f && f[P] ? (Oh.dot(f[P].normal) <= s && (g.push(w.x, w.y, w.z), g.push(_.x, _.y, _.z)), f[P] = null) : E in f || (f[E] = {
            index0: l[m],
            index1: l[x],
            normal: Oh.clone()
          });
        }
    }
    for (const p in f)
      if (f[p]) {
        const { index0: u, index1: y } = f[p];
        mc.fromBufferAttribute(a, u), gc.fromBufferAttribute(a, y), g.push(mc.x, mc.y, mc.z), g.push(gc.x, gc.y, gc.z);
      }
    this.setAttribute("position", new We(g, 3));
  }
};
var Xn = class {
  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 = false;
    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 = true, 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 Ze();
    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), h4 = Math.abs(r[0].y), f = Math.abs(r[0].z);
    d <= l && (l = d, i.set(1, 0, 0)), h4 <= l && (l = h4, 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(vn(r[g - 1].dot(r[g]), -1, 1));
        s[g].applyMatrix4(c.makeRotationAxis(a, p));
      }
      o[g].crossVectors(r[g], s[g]);
    }
    if (t === true) {
      let g = Math.acos(vn(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;
  }
};
var Rl = class extends Xn {
  constructor(e = 0, t = 0, i = 1, r = 1, s = 0, o = Math.PI * 2, a = false, 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 === true && !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), h4 = Math.sin(this.aRotation), f = c - this.aX, g = l - this.aY;
      c = f * d - g * h4 + this.aX, l = f * h4 + 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;
  }
};
Rl.prototype.isEllipseCurve = true;
var rp = class extends Rl {
  constructor(e, t, i, r, s, o) {
    super(e, t, i, i, r, s, o), this.type = "ArcCurve";
  }
};
rp.prototype.isArcCurve = true;
function sp() {
  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, h4) {
      let f = (o - s) / l - (a - s) / (l + d) + (a - o) / d, g = (a - o) / d - (c - o) / (d + h4) + (c - a) / h4;
      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;
    }
  };
}
var yc = new q();
var Ih = new sp();
var Dh = new sp();
var Nh = new sp();
var op = class extends Xn {
  constructor(e = [], t = false, 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] : (yc.subVectors(r[0], r[1]).add(r[0]), l = yc);
    const h4 = r[a % s], f = r[(a + 1) % s];
    if (this.closed || a + 2 < s ? d = r[(a + 2) % s] : (yc.subVectors(r[s - 1], r[s - 2]).add(r[s - 1]), d = yc), this.curveType === "centripetal" || this.curveType === "chordal") {
      const g = this.curveType === "chordal" ? 0.5 : 0.25;
      let p = Math.pow(l.distanceToSquared(h4), g), u = Math.pow(h4.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), Ih.initNonuniformCatmullRom(l.x, h4.x, f.x, d.x, p, u, y), Dh.initNonuniformCatmullRom(l.y, h4.y, f.y, d.y, p, u, y), Nh.initNonuniformCatmullRom(l.z, h4.z, f.z, d.z, p, u, y);
    } else this.curveType === "catmullrom" && (Ih.initCatmullRom(l.x, h4.x, f.x, d.x, this.tension), Dh.initCatmullRom(l.y, h4.y, f.y, d.y, this.tension), Nh.initCatmullRom(l.z, h4.z, f.z, d.z, this.tension));
    return i.set(
      Ih.calc(c),
      Dh.calc(c),
      Nh.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;
  }
};
op.prototype.isCatmullRomCurve3 = true;
function nv(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 NN(n, e) {
  const t = 1 - n;
  return t * t * e;
}
function BN(n, e) {
  return 2 * (1 - n) * n * e;
}
function FN(n, e) {
  return n * n * e;
}
function Ga(n, e, t, i) {
  return NN(n, e) + BN(n, t) + FN(n, i);
}
function zN(n, e) {
  const t = 1 - n;
  return t * t * t * e;
}
function UN(n, e) {
  const t = 1 - n;
  return 3 * t * t * n * e;
}
function VN(n, e) {
  return 3 * (1 - n) * n * n * e;
}
function kN(n, e) {
  return n * n * n * e;
}
function Ha(n, e, t, i, r) {
  return zN(n, e) + UN(n, t) + VN(n, i) + kN(n, r);
}
var Fu = class extends Xn {
  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(
      Ha(e, r.x, s.x, o.x, a.x),
      Ha(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;
  }
};
Fu.prototype.isCubicBezierCurve = true;
var ap = class extends Xn {
  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(
      Ha(e, r.x, s.x, o.x, a.x),
      Ha(e, r.y, s.y, o.y, a.y),
      Ha(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;
  }
};
ap.prototype.isCubicBezierCurve3 = true;
var Pl = class extends Xn {
  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;
  }
};
Pl.prototype.isLineCurve = true;
var Vx = class extends Xn {
  constructor(e = new q(), t = new q()) {
    super(), this.type = "LineCurve3", this.isLineCurve3 = true, 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;
  }
};
var zu = class extends Xn {
  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(
      Ga(e, r.x, s.x, o.x),
      Ga(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;
  }
};
zu.prototype.isQuadraticBezierCurve = true;
var lp = class extends Xn {
  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(
      Ga(e, r.x, s.x, o.x),
      Ga(e, r.y, s.y, o.y),
      Ga(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;
  }
};
lp.prototype.isQuadraticBezierCurve3 = true;
var Uu = class extends Xn {
  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], h4 = r[o > r.length - 3 ? r.length - 1 : o + 2];
    return i.set(
      nv(a, c.x, l.x, d.x, h4.x),
      nv(a, c.y, l.y, d.y, h4.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;
  }
};
Uu.prototype.isSplineCurve = true;
var cp = Object.freeze({
  __proto__: null,
  ArcCurve: rp,
  CatmullRomCurve3: op,
  CubicBezierCurve: Fu,
  CubicBezierCurve3: ap,
  EllipseCurve: Rl,
  LineCurve: Pl,
  LineCurve3: Vx,
  QuadraticBezierCurve: zu,
  QuadraticBezierCurve3: lp,
  SplineCurve: Uu
});
var GN = {
  triangulate: function(n, e, t = 2) {
    const i = e && e.length, r = i ? e[0] * t : n.length;
    let s = kx(n, 0, r, t, true);
    const o = [];
    if (!s || s.next === s.prev) return o;
    let a, c, l, d, h4, f, g;
    if (i && (s = ZN(n, e, s, t)), n.length > 80 * t) {
      a = l = n[0], c = d = n[1];
      for (let p = t; p < r; p += t)
        h4 = n[p], f = n[p + 1], h4 < a && (a = h4), f < c && (c = f), h4 > l && (l = h4), f > d && (d = f);
      g = Math.max(l - a, d - c), g = g !== 0 ? 1 / g : 0;
    }
    return il(s, o, t, a, c, g), o;
  }
};
function kx(n, e, t, i, r) {
  let s, o;
  if (r === rB(n, e, t, i) > 0)
    for (s = e; s < t; s += i) o = iv(s, n[s], n[s + 1], o);
  else
    for (s = t - i; s >= e; s -= i) o = iv(s, n[s], n[s + 1], o);
  return o && Vu(o, o.next) && (sl(o), o = o.next), o;
}
function Kr(n, e) {
  if (!n) return n;
  e || (e = n);
  let t = n, i;
  do
    if (i = false, !t.steiner && (Vu(t, t.next) || It(t.prev, t, t.next) === 0)) {
      if (sl(t), t = e = t.prev, t === t.next) break;
      i = true;
    } else
      t = t.next;
  while (i || t !== e);
  return e;
}
function il(n, e, t, i, r, s, o) {
  if (!n) return;
  !o && s && qN(n, i, r, s);
  let a = n, c, l;
  for (; n.prev !== n.next; ) {
    if (c = n.prev, l = n.next, s ? WN(n, i, r, s) : HN(n)) {
      e.push(c.i / t), e.push(n.i / t), e.push(l.i / t), sl(n), n = l.next, a = l.next;
      continue;
    }
    if (n = l, n === a) {
      o ? o === 1 ? (n = jN(Kr(n), e, t), il(n, e, t, i, r, s, 2)) : o === 2 && $N(n, e, t, i, r, s) : il(Kr(n), e, t, i, r, s, 1);
      break;
    }
  }
}
function HN(n) {
  const e = n.prev, t = n, i = n.next;
  if (It(e, t, i) >= 0) return false;
  let r = n.next.next;
  for (; r !== n.prev; ) {
    if (_o(e.x, e.y, t.x, t.y, i.x, i.y, r.x, r.y) && It(r.prev, r, r.next) >= 0) return false;
    r = r.next;
  }
  return true;
}
function WN(n, e, t, i) {
  const r = n.prev, s = n, o = n.next;
  if (It(r, s, o) >= 0) return false;
  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, h4 = Ud(a, c, e, t, i), f = Ud(l, d, e, t, i);
  let g = n.prevZ, p = n.nextZ;
  for (; g && g.z >= h4 && p && p.z <= f; ) {
    if (g !== n.prev && g !== n.next && _o(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && It(g.prev, g, g.next) >= 0 || (g = g.prevZ, p !== n.prev && p !== n.next && _o(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && It(p.prev, p, p.next) >= 0)) return false;
    p = p.nextZ;
  }
  for (; g && g.z >= h4; ) {
    if (g !== n.prev && g !== n.next && _o(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && It(g.prev, g, g.next) >= 0) return false;
    g = g.prevZ;
  }
  for (; p && p.z <= f; ) {
    if (p !== n.prev && p !== n.next && _o(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && It(p.prev, p, p.next) >= 0) return false;
    p = p.nextZ;
  }
  return true;
}
function jN(n, e, t) {
  let i = n;
  do {
    const r = i.prev, s = i.next.next;
    !Vu(r, s) && Gx(r, i, i.next, s) && rl(r, s) && rl(s, r) && (e.push(r.i / t), e.push(i.i / t), e.push(s.i / t), sl(i), sl(i.next), i = n = s), i = i.next;
  } while (i !== n);
  return Kr(i);
}
function $N(n, e, t, i, r, s) {
  let o = n;
  do {
    let a = o.next.next;
    for (; a !== o.prev; ) {
      if (o.i !== a.i && tB(o, a)) {
        let c = Hx(o, a);
        o = Kr(o, o.next), c = Kr(c, c.next), il(o, e, t, i, r, s), il(c, e, t, i, r, s);
        return;
      }
      a = a.next;
    }
    o = o.next;
  } while (o !== n);
}
function ZN(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 = kx(n, a, c, i, false), l === l.next && (l.steiner = true), r.push(eB(l));
  for (r.sort(XN), s = 0; s < r.length; s++)
    YN(r[s], t), t = Kr(t, t.next);
  return t;
}
function XN(n, e) {
  return n.x - e.x;
}
function YN(n, e) {
  if (e = JN(n, e), e) {
    const t = Hx(e, n);
    Kr(e, e.next), Kr(t, t.next);
  }
}
function JN(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, h4;
  t = o;
  do
    i >= t.x && t.x >= c && i !== t.x && _o(r < l ? i : s, r, c, l, r < l ? s : i, r, t.x, t.y) && (h4 = Math.abs(r - t.y) / (i - t.x), rl(t, n) && (h4 < d || h4 === d && (t.x > o.x || t.x === o.x && KN(o, t))) && (o = t, d = h4)), t = t.next;
  while (t !== a);
  return o;
}
function KN(n, e) {
  return It(n.prev, n, e.prev) < 0 && It(e.next, n, n.next) < 0;
}
function qN(n, e, t, i) {
  let r = n;
  do
    r.z === null && (r.z = Ud(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, QN(r);
}
function QN(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 Ud(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 eB(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 _o(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 tB(n, e) {
  return n.next.i !== e.i && n.prev.i !== e.i && !nB(n, e) && // dones't intersect other edges
  (rl(n, e) && rl(e, n) && iB(n, e) && // locally visible
  (It(n.prev, n, e.prev) || It(n, e.prev, e)) || // does not create opposite-facing sectors
  Vu(n, e) && It(n.prev, n, n.next) > 0 && It(e.prev, e, e.next) > 0);
}
function It(n, e, t) {
  return (e.y - n.y) * (t.x - e.x) - (e.x - n.x) * (t.y - e.y);
}
function Vu(n, e) {
  return n.x === e.x && n.y === e.y;
}
function Gx(n, e, t, i) {
  const r = xc(It(n, e, t)), s = xc(It(n, e, i)), o = xc(It(t, i, n)), a = xc(It(t, i, e));
  return !!(r !== s && o !== a || r === 0 && bc(n, t, e) || s === 0 && bc(n, i, e) || o === 0 && bc(t, n, i) || a === 0 && bc(t, e, i));
}
function bc(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 xc(n) {
  return n > 0 ? 1 : n < 0 ? -1 : 0;
}
function nB(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 && Gx(t, t.next, n, e)) return true;
    t = t.next;
  } while (t !== n);
  return false;
}
function rl(n, e) {
  return It(n.prev, n, n.next) < 0 ? It(n, e, n.next) >= 0 && It(n, n.prev, e) >= 0 : It(n, e, n.prev) < 0 || It(n, n.next, e) < 0;
}
function iB(n, e) {
  let t = n, i = false;
  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 Hx(n, e) {
  const t = new Vd(n.i, n.x, n.y), i = new Vd(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 iv(n, e, t, i) {
  const r = new Vd(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 sl(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 Vd(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 = false;
}
function rB(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;
}
var Ii = class _Ii {
  // 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 _Ii.area(e) < 0;
  }
  static triangulateShape(e, t) {
    const i = [], r = [], s = [];
    rv(e), sv(i, e);
    let o = e.length;
    t.forEach(rv);
    for (let c = 0; c < t.length; c++)
      r.push(o), o += t[c].length, sv(i, t[c]);
    const a = GN.triangulate(i, r);
    for (let c = 0; c < a.length; c += 3)
      s.push(a.slice(c, c + 3));
    return s;
  }
};
function rv(n) {
  const e = n.length;
  e > 2 && n[e - 1].equals(n[0]) && n.pop();
}
function sv(n, e) {
  for (let t = 0; t < e.length; t++)
    n.push(e[t].x), n.push(e[t].y);
}
var yi = class _yi 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 h4 = t.depth !== void 0 ? t.depth : 100, f = t.bevelEnabled !== void 0 ? t.bevelEnabled : true, 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 : sB;
      t.amount !== void 0 && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), h4 = t.amount);
      let x, M = false, T, w, _, E;
      v && (x = v.getSpacedPoints(d), M = true, f = false, T = v.computeFrenetFrames(d, false), w = new q(), _ = new q(), E = new q()), f || (y = 0, g = 0, p = 0, u = 0);
      const P = a.extractPoints(l);
      let S = P.shape;
      const R = P.holes;
      if (!Ii.isClockWise(S)) {
        S = S.reverse();
        for (let k = 0, W = R.length; k < W; k++) {
          const B = R[k];
          Ii.isClockWise(B) && (R[k] = B.reverse());
        }
      }
      const C = Ii.triangulateShape(S, R), L = S;
      for (let k = 0, W = R.length; k < W; k++) {
        const B = R[k];
        S = S.concat(B);
      }
      function I(k, W, B) {
        return W || console.error("THREE.ExtrudeGeometry: vec does not exist"), W.clone().multiplyScalar(B).add(k);
      }
      const b = S.length, O = C.length;
      function N(k, W, B) {
        let X, J, F;
        const z = k.x - W.x, te = k.y - W.y, se = B.x - k.x, le = B.y - k.y, me = z * z + te * te, Te = z * le - te * se;
        if (Math.abs(Te) > Number.EPSILON) {
          const _e = Math.sqrt(me), fe = Math.sqrt(se * se + le * le), we = W.x - te / _e, ie = W.y + z / _e, pe = B.x - le / fe, be = B.y + se / fe, Be = ((pe - we) * le - (be - ie) * se) / (z * le - te * se);
          X = we + z * Be - k.x, J = ie + te * Be - k.y;
          const Oe = X * X + J * J;
          if (Oe <= 2)
            return new Re(X, J);
          F = Math.sqrt(Oe / 2);
        } else {
          let _e = false;
          z > Number.EPSILON ? se > Number.EPSILON && (_e = true) : z < -Number.EPSILON ? se < -Number.EPSILON && (_e = true) : Math.sign(te) === Math.sign(le) && (_e = true), _e ? (X = -te, J = z, F = Math.sqrt(me)) : (X = z, J = te, F = Math.sqrt(me / 2));
        }
        return new Re(X / F, J / F);
      }
      const D = [];
      for (let k = 0, W = L.length, B = W - 1, X = k + 1; k < W; k++, B++, X++)
        B === W && (B = 0), X === W && (X = 0), D[k] = N(L[k], L[B], L[X]);
      const U = [];
      let V, H = D.concat();
      for (let k = 0, W = R.length; k < W; k++) {
        const B = R[k];
        V = [];
        for (let X = 0, J = B.length, F = J - 1, z = X + 1; X < J; X++, F++, z++)
          F === J && (F = 0), z === J && (z = 0), V[X] = N(B[X], B[F], B[z]);
        U.push(V), H = H.concat(V);
      }
      for (let k = 0; k < y; k++) {
        const W = k / y, B = g * Math.cos(W * Math.PI / 2), X = p * Math.sin(W * Math.PI / 2) + u;
        for (let J = 0, F = L.length; J < F; J++) {
          const z = I(L[J], D[J], X);
          oe(z.x, z.y, -B);
        }
        for (let J = 0, F = R.length; J < F; J++) {
          const z = R[J];
          V = U[J];
          for (let te = 0, se = z.length; te < se; te++) {
            const le = I(z[te], V[te], X);
            oe(le.x, le.y, -B);
          }
        }
      }
      const Y = p + u;
      for (let k = 0; k < b; k++) {
        const W = f ? I(S[k], H[k], Y) : S[k];
        M ? (_.copy(T.normals[0]).multiplyScalar(W.x), w.copy(T.binormals[0]).multiplyScalar(W.y), E.copy(x[0]).add(_).add(w), oe(E.x, E.y, E.z)) : oe(W.x, W.y, 0);
      }
      for (let k = 1; k <= d; k++)
        for (let W = 0; W < b; W++) {
          const B = f ? I(S[W], H[W], Y) : S[W];
          M ? (_.copy(T.normals[k]).multiplyScalar(B.x), w.copy(T.binormals[k]).multiplyScalar(B.y), E.copy(x[k]).add(_).add(w), oe(E.x, E.y, E.z)) : oe(B.x, B.y, h4 / d * k);
        }
      for (let k = y - 1; k >= 0; k--) {
        const W = k / y, B = g * Math.cos(W * Math.PI / 2), X = p * Math.sin(W * Math.PI / 2) + u;
        for (let J = 0, F = L.length; J < F; J++) {
          const z = I(L[J], D[J], X);
          oe(z.x, z.y, h4 + B);
        }
        for (let J = 0, F = R.length; J < F; J++) {
          const z = R[J];
          V = U[J];
          for (let te = 0, se = z.length; te < se; te++) {
            const le = I(z[te], V[te], X);
            M ? oe(le.x, le.y + x[d - 1].y, x[d - 1].x + B) : oe(le.x, le.y, h4 + B);
          }
        }
      }
      re(), ae();
      function re() {
        const k = r.length / 3;
        if (f) {
          let W = 0, B = b * W;
          for (let X = 0; X < O; X++) {
            const J = C[X];
            j(J[2] + B, J[1] + B, J[0] + B);
          }
          W = d + y * 2, B = b * W;
          for (let X = 0; X < O; X++) {
            const J = C[X];
            j(J[0] + B, J[1] + B, J[2] + B);
          }
        } else {
          for (let W = 0; W < O; W++) {
            const B = C[W];
            j(B[2], B[1], B[0]);
          }
          for (let W = 0; W < O; W++) {
            const B = C[W];
            j(B[0] + b * d, B[1] + b * d, B[2] + b * d);
          }
        }
        i.addGroup(k, r.length / 3 - k, 0);
      }
      function ae() {
        const k = r.length / 3;
        let W = 0;
        ee(L, W), W += L.length;
        for (let B = 0, X = R.length; B < X; B++) {
          const J = R[B];
          ee(J, W), W += J.length;
        }
        i.addGroup(k, r.length / 3 - k, 1);
      }
      function ee(k, W) {
        let B = k.length;
        for (; --B >= 0; ) {
          const X = B;
          let J = B - 1;
          J < 0 && (J = k.length - 1);
          for (let F = 0, z = d + y * 2; F < z; F++) {
            const te = b * F, se = b * (F + 1), le = W + X + te, me = W + J + te, Te = W + J + se, _e = W + X + se;
            K(le, me, Te, _e);
          }
        }
      }
      function oe(k, W, B) {
        c.push(k), c.push(W), c.push(B);
      }
      function j(k, W, B) {
        $(k), $(W), $(B);
        const X = r.length / 3, J = m.generateTopUV(i, r, X - 3, X - 2, X - 1);
        ne(J[0]), ne(J[1]), ne(J[2]);
      }
      function K(k, W, B, X) {
        $(k), $(W), $(X), $(W), $(B), $(X);
        const J = r.length / 3, F = m.generateSideWallUV(i, r, J - 6, J - 3, J - 2, J - 1);
        ne(F[0]), ne(F[1]), ne(F[3]), ne(F[1]), ne(F[2]), ne(F[3]);
      }
      function $(k) {
        r.push(c[k * 3 + 0]), r.push(c[k * 3 + 1]), r.push(c[k * 3 + 2]);
      }
      function ne(k) {
        s.push(k.x), s.push(k.y);
      }
    }
  }
  toJSON() {
    const e = super.toJSON(), t = this.parameters.shapes, i = this.parameters.options;
    return oB(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 cp[r.type]().fromJSON(r)), new _yi(i, e.options);
  }
};
var sB = {
  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], h4 = 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 - h4),
      new Re(f, 1 - p),
      new Re(u, 1 - v)
    ] : [
      new Re(a, 1 - c),
      new Re(d, 1 - h4),
      new Re(g, 1 - p),
      new Re(y, 1 - v)
    ];
  }
};
function oB(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;
}
var Wo = class _Wo extends Fi {
  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 _Wo(e.radius, e.detail);
  }
};
var jo = class _jo 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 = vn(r, 0, Math.PI * 2);
    const s = [], o = [], a = [], c = 1 / t, l = new q(), d = new Re();
    for (let h4 = 0; h4 <= t; h4++) {
      const f = i + h4 * 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 = h4 / t, d.y = u / (e.length - 1), a.push(d.x, d.y);
    }
    for (let h4 = 0; h4 < t; h4++)
      for (let f = 0; f < e.length - 1; f++) {
        const g = f + h4 * 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 h4 = 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 = h4[v + 0], f.y = h4[v + 1], f.z = h4[v + 2], g.x = h4[u + v + 0], g.y = h4[u + v + 1], g.z = h4[u + v + 2], p.addVectors(f, g).normalize(), h4[v + 0] = h4[u + v + 0] = p.x, h4[v + 1] = h4[u + v + 1] = p.y, h4[v + 2] = h4[u + v + 2] = p.z;
    }
  }
  static fromJSON(e) {
    return new _jo(e.points, e.segments, e.phiStart, e.phiLength);
  }
};
var Ns = class _Ns extends Fi {
  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 _Ns(e.radius, e.detail);
  }
};
var tu = class 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(), h4 = 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, h4), f.subVectors(d, h4)) : (e(m + c, y, h4), f.subVectors(h4, d)), y - c >= 0 ? (e(m, y - c, h4), g.subVectors(d, h4)) : (e(m, y + c, h4), g.subVectors(h4, 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, M = (u + 1) * p + y;
        r.push(v, m, M), r.push(m, x, M);
      }
    this.setIndex(r), this.setAttribute("position", new We(s, 3)), this.setAttribute("normal", new We(o, 3)), this.setAttribute("uv", new We(a, 2));
  }
};
var $o = class _$o 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 h4 = 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 = h4 * Math.cos(v), g.y = h4 * 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);
      }
      h4 += 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, M = m + i + 1, T = m + i + 2, w = m + 1;
        a.push(x, M, w), a.push(M, T, w);
      }
    }
    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 _$o(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength);
  }
};
var Bs = class _Bs 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) === false)
      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 h4 = r.length / 3, f = d.extractPoints(t);
      let g = f.shape;
      const p = f.holes;
      Ii.isClockWise(g) === false && (g = g.reverse());
      for (let y = 0, v = p.length; y < v; y++) {
        const m = p[y];
        Ii.isClockWise(m) === true && (p[y] = m.reverse());
      }
      const u = Ii.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] + h4, M = m[1] + h4, T = m[2] + h4;
        i.push(x, M, T), c += 3;
      }
    }
  }
  toJSON() {
    const e = super.toJSON(), t = this.parameters.shapes;
    return aB(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 _Bs(i, e.curveSegments);
  }
};
function aB(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;
}
var Fs = class _Fs 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 = [], h4 = new q(), f = new q(), g = [], p = [], u = [], y = [];
    for (let v = 0; v <= i; v++) {
      const m = [], x = v / i;
      let M = 0;
      v == 0 && o == 0 ? M = 0.5 / t : v == i && c == Math.PI && (M = -0.5 / t);
      for (let T = 0; T <= t; T++) {
        const w = T / t;
        h4.x = -e * Math.cos(r + w * s) * Math.sin(o + x * a), h4.y = e * Math.cos(o + x * a), h4.z = e * Math.sin(r + w * s) * Math.sin(o + x * a), p.push(h4.x, h4.y, h4.z), f.copy(h4).normalize(), u.push(f.x, f.y, f.z), y.push(w + M, 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], M = d[v][m], T = d[v + 1][m], w = d[v + 1][m + 1];
        (v !== 0 || o > 0) && g.push(x, M, w), (v !== i - 1 || c < Math.PI) && g.push(M, T, w);
      }
    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 _Fs(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength);
  }
};
var Zo = class _Zo extends Fi {
  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);
  }
};
var nu = class extends yi {
  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 = false), super(r, t), this.type = "TextGeometry";
  }
};
var Xo = class _Xo 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(), h4 = 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;
        h4.x = (e + t * Math.cos(y)) * Math.cos(u), h4.y = (e + t * Math.cos(y)) * Math.sin(u), h4.z = t * Math.sin(y), a.push(h4.x, h4.y, h4.z), d.x = e * Math.cos(u), d.y = e * Math.sin(u), f.subVectors(h4, 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 _Xo(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc);
  }
};
var Yo = class _Yo 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 = [], h4 = 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 M = x / i * s * Math.PI * 2;
      m(M, s, o, e, g), m(M + 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 T = 0; T <= r; ++T) {
        const w = T / r * Math.PI * 2, _ = -t * Math.cos(w), E = t * Math.sin(w);
        h4.x = g.x + (_ * v.x + E * u.x), h4.y = g.y + (_ * v.y + E * u.y), h4.z = g.z + (_ * v.z + E * u.z), c.push(h4.x, h4.y, h4.z), f.subVectors(h4, g).normalize(), l.push(f.x, f.y, f.z), d.push(x / i), d.push(T / r);
      }
    }
    for (let x = 1; x <= i; x++)
      for (let M = 1; M <= r; M++) {
        const T = (r + 1) * (x - 1) + (M - 1), w = (r + 1) * x + (M - 1), _ = (r + 1) * x + M, E = (r + 1) * (x - 1) + M;
        a.push(T, w, E), a.push(w, _, E);
      }
    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, M, T, w, _) {
      const E = Math.cos(x), P = Math.sin(x), S = T / M * x, R = Math.cos(S);
      _.x = w * (2 + R) * 0.5 * E, _.y = w * (2 + R) * P * 0.5, _.z = w * Math.sin(S) * 0.5;
    }
  }
  static fromJSON(e) {
    return new _Yo(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q);
  }
};
var Jo = class _Jo extends Ke {
  constructor(e, t = 64, i = 1, r = 8, s = false) {
    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 h4 = [], f = [], g = [], p = [];
    u(), this.setIndex(p), this.setAttribute("position", new We(h4, 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 === false ? t : 0), m(), v();
    }
    function y(x) {
      d = e.getPointAt(x / t, d);
      const M = o.normals[x], T = o.binormals[x];
      for (let w = 0; w <= r; w++) {
        const _ = w / r * Math.PI * 2, E = Math.sin(_), P = -Math.cos(_);
        c.x = P * M.x + E * T.x, c.y = P * M.y + E * T.y, c.z = P * M.z + E * T.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, h4.push(a.x, a.y, a.z);
      }
    }
    function v() {
      for (let x = 1; x <= t; x++)
        for (let M = 1; M <= r; M++) {
          const T = (r + 1) * (x - 1) + (M - 1), w = (r + 1) * x + (M - 1), _ = (r + 1) * x + M, E = (r + 1) * (x - 1) + M;
          p.push(T, w, E), p.push(w, _, E);
        }
    }
    function m() {
      for (let x = 0; x <= t; x++)
        for (let M = 0; M <= r; M++)
          l.x = x / t, l.y = M / 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 _Jo(
      new cp[e.path.type]().fromJSON(e.path),
      e.tubularSegments,
      e.radius,
      e.radialSegments,
      e.closed
    );
  }
};
var up = class extends Ke {
  constructor(e) {
    if (super(), this.type = "WireframeGeometry", e.isGeometry === true) {
      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 h4 = c[l], f = h4.start, g = h4.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 h4 = 3 * a + (l + 1) % 3;
          s.fromBufferAttribute(o, h4), t.push(s.x, s.y, s.z);
        }
    }
    this.setAttribute("position", new We(t, 3));
  }
};
var ov = Object.freeze({
  __proto__: null,
  BoxGeometry: ur,
  BoxBufferGeometry: ur,
  CircleGeometry: ko,
  CircleBufferGeometry: ko,
  ConeGeometry: Go,
  ConeBufferGeometry: Go,
  CylinderGeometry: Jr,
  CylinderBufferGeometry: Jr,
  DodecahedronGeometry: Ho,
  DodecahedronBufferGeometry: Ho,
  EdgesGeometry: ip,
  ExtrudeGeometry: yi,
  ExtrudeBufferGeometry: yi,
  IcosahedronGeometry: Wo,
  IcosahedronBufferGeometry: Wo,
  LatheGeometry: jo,
  LatheBufferGeometry: jo,
  OctahedronGeometry: Ns,
  OctahedronBufferGeometry: Ns,
  ParametricGeometry: tu,
  ParametricBufferGeometry: tu,
  PlaneGeometry: Ds,
  PlaneBufferGeometry: Ds,
  PolyhedronGeometry: Fi,
  PolyhedronBufferGeometry: Fi,
  RingGeometry: $o,
  RingBufferGeometry: $o,
  ShapeGeometry: Bs,
  ShapeBufferGeometry: Bs,
  SphereGeometry: Fs,
  SphereBufferGeometry: Fs,
  TetrahedronGeometry: Zo,
  TetrahedronBufferGeometry: Zo,
  TextGeometry: nu,
  TextBufferGeometry: nu,
  TorusGeometry: Xo,
  TorusBufferGeometry: Xo,
  TorusKnotGeometry: Yo,
  TorusKnotBufferGeometry: Yo,
  TubeGeometry: Jo,
  TubeBufferGeometry: Jo,
  WireframeGeometry: up
});
var hp = class extends en {
  constructor(e) {
    super(), this.type = "ShadowMaterial", this.color = new Fe(0), this.transparent = true, this.setValues(e);
  }
  copy(e) {
    return super.copy(e), this.color.copy(e.color), this;
  }
};
hp.prototype.isShadowMaterial = true;
var da = class extends hr {
  constructor(e) {
    super(e), this.type = "RawShaderMaterial";
  }
};
da.prototype.isRawShaderMaterial = true;
var js = class extends en {
  constructor(e) {
    super(), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Fe(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 Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = es, 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 = false, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = false, this.morphNormals = false, this.flatShading = false, this.vertexTangents = false, 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;
  }
};
js.prototype.isMeshStandardMaterial = true;
var Ol = class extends js {
  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 = vn(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 Fe(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 Fe()).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;
  }
};
Ol.prototype.isMeshPhysicalMaterial = true;
var dp = class extends en {
  constructor(e) {
    super(), this.type = "MeshPhongMaterial", this.color = new Fe(16777215), this.specular = new Fe(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = es, 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 = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = false, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = false, this.morphNormals = false, this.flatShading = false, 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;
  }
};
dp.prototype.isMeshPhongMaterial = true;
var fp = class extends en {
  constructor(e) {
    super(), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Fe(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = es, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = false, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = false, this.morphNormals = false, 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;
  }
};
fp.prototype.isMeshToonMaterial = true;
var pp = class extends en {
  constructor(e) {
    super(), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = es, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = false, this.wireframeLinewidth = 1, this.fog = false, this.morphTargets = false, this.morphNormals = false, this.flatShading = false, 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;
  }
};
pp.prototype.isMeshNormalMaterial = true;
var mp = class extends en {
  constructor(e) {
    super(), this.type = "MeshLambertMaterial", this.color = new Fe(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Fe(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = vl, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = false, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = false, this.morphNormals = false, 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;
  }
};
mp.prototype.isMeshLambertMaterial = true;
var gp = class extends en {
  constructor(e) {
    super(), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Fe(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = es, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.morphTargets = false, this.morphNormals = false, this.flatShading = false, 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;
  }
};
gp.prototype.isMeshMatcapMaterial = true;
var vp = class extends on {
  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;
  }
};
vp.prototype.isLineDashedMaterial = true;
var lB = Object.freeze({
  __proto__: null,
  ShadowMaterial: hp,
  SpriteMaterial: Tl,
  RawShaderMaterial: da,
  ShaderMaterial: hr,
  PointsMaterial: rs,
  MeshPhysicalMaterial: Ol,
  MeshStandardMaterial: js,
  MeshPhongMaterial: dp,
  MeshToonMaterial: fp,
  MeshNormalMaterial: pp,
  MeshLambertMaterial: mp,
  MeshDepthMaterial: Iu,
  MeshDistanceMaterial: Du,
  MeshBasicMaterial: Bn,
  MeshMatcapMaterial: gp,
  LineDashedMaterial: vp,
  LineBasicMaterial: on,
  Material: en
});
var At = {
  // same as Array.prototype.slice, but also works on typed arrays
  arraySlice: function(n, e, t) {
    return At.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(), h4 = [], f = [];
      for (let g = 0; g < l.times.length; ++g) {
        const p = l.times[g] * r;
        if (!(p < t || p >= i)) {
          h4.push(l.times[g]);
          for (let u = 0; u < d; ++u)
            f.push(l.values[g * d + u]);
        }
      }
      h4.length !== 0 && (l.times = At.convertArray(h4, l.times.constructor), l.values = At.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 h4 = a.getValueSize();
      a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = h4 / 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 = h4 - d;
        u = At.arraySlice(a.values, v, m);
      } else if (s >= a.times[p]) {
        const v = p * h4 + d, m = v + h4 - d;
        u = At.arraySlice(a.values, v, m);
      } else {
        const v = a.createInterpolant(), m = d, x = h4 - d;
        v.evaluate(s), u = At.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 M = 0; M < x; ++M)
            l.values[m + M] -= u[M];
        }
      }
    }
    return n.blendMode = Wf, n;
  }
};
var zi = class {
  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_() {
  }
};
zi.prototype.beforeStart_ = zi.prototype.copySampleValue_;
zi.prototype.afterEnd_ = zi.prototype.copySampleValue_;
var Wx = class extends zi {
  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: xs,
      endingEnd: xs
    };
  }
  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 ws:
          s = e, a = 2 * t - i;
          break;
        case tl:
          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 ws:
          o = e, c = 2 * i - t;
          break;
        case tl:
          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, h4 = 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, M = g * y - g * u;
    for (let T = 0; T !== a; ++T)
      s[T] = v * o[d + T] + m * o[l + T] + x * o[c + T] + M * o[h4 + T];
    return s;
  }
};
var yp = class extends zi {
  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), h4 = 1 - d;
    for (let f = 0; f !== a; ++f)
      s[f] = o[l + f] * h4 + o[c + f] * d;
    return s;
  }
};
var jx = class extends zi {
  constructor(e, t, i, r) {
    super(e, t, i, r);
  }
  interpolate_(e) {
    return this.copySampleValue_(e - 1);
  }
};
var Mi = class {
  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 = At.convertArray(t, this.TimeBufferType), this.values = At.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: At.convertArray(e.times, Array),
        values: At.convertArray(e.values, Array)
      };
      const r = e.getInterpolation();
      r !== e.DefaultInterpolation && (i.interpolation = r);
    }
    return i.type = e.ValueTypeName, i;
  }
  InterpolantFactoryMethodDiscrete(e) {
    return new jx(this.times, this.values, this.getValueSize(), e);
  }
  InterpolantFactoryMethodLinear(e) {
    return new yp(this.times, this.values, this.getValueSize(), e);
  }
  InterpolantFactoryMethodSmooth(e) {
    return new Wx(this.times, this.values, this.getValueSize(), e);
  }
  setInterpolation(e) {
    let t;
    switch (e) {
      case Fo:
        t = this.InterpolantFactoryMethodDiscrete;
        break;
      case Os:
        t = this.InterpolantFactoryMethodLinear;
        break;
      case Vc:
        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 Fo;
      case this.InterpolantFactoryMethodLinear:
        return Os;
      case this.InterpolantFactoryMethodSmooth:
        return Vc;
    }
  }
  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 = At.arraySlice(i, s, o), this.values = At.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 = true;
    const t = this.getValueSize();
    t - Math.floor(t) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = false);
    const i = this.times, r = this.values, s = i.length;
    s === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = false);
    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 = false;
        break;
      }
      if (o !== null && o > c) {
        console.error("THREE.KeyframeTrack: Out of order keys.", this, a, c, o), e = false;
        break;
      }
      o = c;
    }
    if (r !== void 0 && At.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 = false;
          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 = At.arraySlice(this.times), t = At.arraySlice(this.values), i = this.getValueSize(), r = this.getInterpolation() === Vc, s = e.length - 1;
    let o = 1;
    for (let a = 1; a < s; ++a) {
      let c = false;
      const l = e[a], d = e[a + 1];
      if (l !== d && (a !== 1 || l !== e[0]))
        if (r)
          c = true;
        else {
          const h4 = a * i, f = h4 - i, g = h4 + i;
          for (let p = 0; p !== i; ++p) {
            const u = t[h4 + p];
            if (u !== t[f + p] || u !== t[g + p]) {
              c = true;
              break;
            }
          }
        }
      if (c) {
        if (a !== o) {
          e[o] = e[a];
          const h4 = a * i, f = o * i;
          for (let g = 0; g !== i; ++g)
            t[f + g] = t[h4 + 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 = At.arraySlice(e, 0, o), this.values = At.arraySlice(t, 0, o * i)) : (this.times = e, this.values = t), this;
  }
  clone() {
    const e = At.arraySlice(this.times, 0), t = At.arraySlice(this.values, 0), i = this.constructor, r = new i(this.name, e, t);
    return r.createInterpolant = this.createInterpolant, r;
  }
};
Mi.prototype.TimeBufferType = Float32Array;
Mi.prototype.ValueBufferType = Float32Array;
Mi.prototype.DefaultInterpolation = Os;
var $s = class extends Mi {
};
$s.prototype.ValueTypeName = "bool";
$s.prototype.ValueBufferType = Array;
$s.prototype.DefaultInterpolation = Fo;
$s.prototype.InterpolantFactoryMethodLinear = void 0;
$s.prototype.InterpolantFactoryMethodSmooth = void 0;
var bp = class extends Mi {
};
bp.prototype.ValueTypeName = "color";
var Ko = class extends Mi {
};
Ko.prototype.ValueTypeName = "number";
var $x = class extends zi {
  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;
  }
};
var Zs = class extends Mi {
  InterpolantFactoryMethodLinear(e) {
    return new $x(this.times, this.values, this.getValueSize(), e);
  }
};
Zs.prototype.ValueTypeName = "quaternion";
Zs.prototype.DefaultInterpolation = Os;
Zs.prototype.InterpolantFactoryMethodSmooth = void 0;
var Xs = class extends Mi {
};
Xs.prototype.ValueTypeName = "string";
Xs.prototype.ValueBufferType = Array;
Xs.prototype.DefaultInterpolation = Fo;
Xs.prototype.InterpolantFactoryMethodLinear = void 0;
Xs.prototype.InterpolantFactoryMethodSmooth = void 0;
var qo = class extends Mi {
};
qo.prototype.ValueTypeName = "vector";
var Qo = class {
  constructor(e, t = -1, i, r = Eu) {
    this.name = e, this.tracks = i, this.duration = t, this.blendMode = r, this.uuid = $n(), 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(uB(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(Mi.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 = At.getKeyframeOrder(c);
      c = At.sortedArray(c, 1, d), l = At.sortedArray(l, 1, d), !r && c[0] === 0 && (c.push(s), l.push(l[0])), o.push(
        new Ko(
          ".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 h4 = d[1];
        let f = r[h4];
        f || (r[h4] = 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(h4, f, g, p, u) {
      if (g.length !== 0) {
        const y = [], v = [];
        At.flattenJSON(g, y, v, p), y.length !== 0 && u.push(new h4(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 h4 = 0; h4 < l.length; h4++) {
      const f = l[h4].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 Ko(".morphTargetInfluence[" + u + "]", y, v));
          }
          c = g.length * (o || 1);
        } else {
          const g = ".bones[" + t[h4].name + "]";
          i(
            qo,
            g + ".position",
            f,
            "pos",
            r
          ), i(
            Zs,
            g + ".quaternion",
            f,
            "rot",
            r
          ), i(
            qo,
            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 = true;
    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 cB(n) {
  switch (n.toLowerCase()) {
    case "scalar":
    case "double":
    case "float":
    case "number":
    case "integer":
      return Ko;
    case "vector":
    case "vector2":
    case "vector3":
    case "vector4":
      return qo;
    case "color":
      return bp;
    case "quaternion":
      return Zs;
    case "bool":
    case "boolean":
      return $s;
    case "string":
      return Xs;
  }
  throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + n);
}
function uB(n) {
  if (n.type === void 0)
    throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
  const e = cB(n.type);
  if (n.times === void 0) {
    const t = [], i = [];
    At.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);
}
var zs = {
  enabled: false,
  files: {},
  add: function(n, e) {
    this.enabled !== false && (this.files[n] = e);
  },
  get: function(n) {
    if (this.enabled !== false)
      return this.files[n];
  },
  remove: function(n) {
    delete this.files[n];
  },
  clear: function() {
    this.files = {};
  }
};
var xp = class {
  constructor(e, t, i) {
    const r = this;
    let s = false, 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 === false && r.onStart !== void 0 && r.onStart(d, o, a), s = true;
    }, this.itemEnd = function(d) {
      o++, r.onProgress !== void 0 && r.onProgress(d, o, a), o === a && (s = false, 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, h4) {
      return l.push(d, h4), this;
    }, this.removeHandler = function(d) {
      const h4 = l.indexOf(d);
      return h4 !== -1 && l.splice(h4, 2), this;
    }, this.getHandler = function(d) {
      for (let h4 = 0, f = l.length; h4 < f; h4 += 2) {
        const g = l[h4], p = l[h4 + 1];
        if (g.global && (g.lastIndex = 0), g.test(d))
          return p;
      }
      return null;
    };
  }
};
var Zx = new xp();
var xn = class {
  constructor(e) {
    this.manager = e !== void 0 ? e : Zx, this.crossOrigin = "anonymous", this.withCredentials = false, 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;
  }
};
var hi = {};
var Yn = class 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 = zs.get(e);
    if (o !== void 0)
      return s.manager.itemStart(e), setTimeout(function() {
        t && t(o), s.manager.itemEnd(e);
      }, 0), o;
    if (hi[e] !== void 0) {
      hi[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], h4 = !!c[2];
      let f = c[3];
      f = decodeURIComponent(f), h4 && (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 {
      hi[e] = [], hi[e].push({
        onLoad: t,
        onProgress: i,
        onError: r
      }), l = new XMLHttpRequest(), l.open("GET", e, true), l.addEventListener("load", function(d) {
        const h4 = this.response, f = hi[e];
        if (delete hi[e], this.status === 200 || this.status === 0) {
          this.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), zs.add(e, h4);
          for (let g = 0, p = f.length; g < p; g++) {
            const u = f[g];
            u.onLoad && u.onLoad(h4);
          }
          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);
        }
      }, false), l.addEventListener("progress", function(d) {
        const h4 = hi[e];
        for (let f = 0, g = h4.length; f < g; f++) {
          const p = h4[f];
          p.onProgress && p.onProgress(d);
        }
      }, false), l.addEventListener("error", function(d) {
        const h4 = hi[e];
        delete hi[e];
        for (let f = 0, g = h4.length; f < g; f++) {
          const p = h4[f];
          p.onError && p.onError(d);
        }
        s.manager.itemError(e), s.manager.itemEnd(e);
      }, false), l.addEventListener("abort", function(d) {
        const h4 = hi[e];
        delete hi[e];
        for (let f = 0, g = h4.length; f < g; f++) {
          const p = h4[f];
          p.onError && p.onError(d);
        }
        s.manager.itemError(e), s.manager.itemEnd(e);
      }, false), 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;
  }
};
var hB = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Yn(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 = Qo.parse(e[i]);
      t.push(r);
    }
    return t;
  }
};
var dB = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = [], a = new np(), c = new Yn(this.manager);
    c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(s.withCredentials);
    let l = 0;
    function d(h4) {
      c.load(e[h4], function(f) {
        const g = s.parse(f, true);
        o[h4] = {
          width: g.width,
          height: g.height,
          format: g.format,
          mipmaps: g.mipmaps
        }, l += 1, l === 6 && (g.mipmapCount === 1 && (a.minFilter = Ut), a.image = o, a.format = g.format, a.needsUpdate = true, t && t(a));
      }, i, r);
    }
    if (Array.isArray(e))
      for (let h4 = 0, f = e.length; h4 < f; ++h4)
        d(h4);
    else
      c.load(e, function(h4) {
        const f = s.parse(h4, true);
        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 = Ut), a.format = f.format, a.needsUpdate = true, t && t(a);
      }, i, r);
    return a;
  }
};
var ol = class 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 = zs.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, false), a.removeEventListener("error", l, false), zs.add(e, this), t && t(this), s.manager.itemEnd(e);
    }
    function l(d) {
      a.removeEventListener("load", c, false), a.removeEventListener("error", l, false), r && r(d), s.manager.itemError(e), s.manager.itemEnd(e);
    }
    return a.addEventListener("load", c, false), a.addEventListener("error", l, false), e.substr(0, 5) !== "data:" && this.crossOrigin !== void 0 && (a.crossOrigin = this.crossOrigin), s.manager.itemStart(e), a.src = e, a;
  }
};
var Xx = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = new ca(), o = new ol(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 = true, t && t(s));
      }, void 0, r);
    }
    for (let l = 0; l < e.length; ++l)
      c(l);
    return s;
  }
};
var Yx = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Cs(), a = new Yn(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 : hn2, o.wrapT = l.wrapT !== void 0 ? l.wrapT : hn2, o.magFilter = l.magFilter !== void 0 ? l.magFilter : Ut, o.minFilter = l.minFilter !== void 0 ? l.minFilter : Ut, 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 = yr), l.mipmapCount === 1 && (o.minFilter = Ut), l.generateMipmaps !== void 0 && (o.generateMipmaps = l.generateMipmaps), o.needsUpdate = true, t && t(o, l));
    }, i, r), o;
  }
};
var wp = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = new Jt(), o = new ol(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 ? or : jn, s.needsUpdate = true, t !== void 0 && t(s);
    }, i, r), s;
  }
};
var Jx = class extends Xn {
  constructor() {
    super(), this.type = "CurvePath", this.curves = [], this.autoClose = false;
  }
  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 Pl(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 = true, 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 cp[r.type]().fromJSON(r));
    }
    return this;
  }
};
var al = class extends Jx {
  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 Pl(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 zu(
      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 Fu(
      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 Uu(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 Rl(e, t, i, r, s, o, a, c);
    if (this.curves.length > 0) {
      const h4 = l.getPoint(0);
      h4.equals(this.currentPoint) || this.lineTo(h4.x, h4.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;
  }
};
var kr = class extends al {
  constructor(e) {
    super(e), this.uuid = $n(), 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 al().fromJSON(r));
    }
    return this;
  }
};
var bi = class extends lt {
  constructor(e, t = 1) {
    super(), this.type = "Light", this.color = new Fe(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;
  }
};
bi.prototype.isLight = true;
var Mp = class extends bi {
  constructor(e, t, i) {
    super(e, i), this.type = "HemisphereLight", this.position.copy(lt.DefaultUp), this.updateMatrix(), this.groundColor = new Fe(t);
  }
  copy(e) {
    return bi.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this;
  }
};
Mp.prototype.isHemisphereLight = true;
var av = new Ze();
var lv = new q();
var cv = new q();
var _p = class {
  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 Ze(), this.autoUpdate = true, this.needsUpdate = false, this._frustum = new Ml(), 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;
    lv.setFromMatrixPosition(e.matrixWorld), t.position.copy(lv), cv.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(cv), t.updateMatrixWorld(), av.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(av), 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(false).object, delete e.camera.matrix, e;
  }
};
var Kx = class extends _p {
  constructor() {
    super(new nn(50, 1, 0.5, 500)), this.focus = 1;
  }
  updateMatrices(e) {
    const t = this.camera, i = nl * 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 = true;
var ku = class extends bi {
  constructor(e, t, i = 0, r = Math.PI / 3, s = 0, o = 1) {
    super(e, t), this.type = "SpotLight", this.position.copy(lt.DefaultUp), this.updateMatrix(), this.target = new lt(), 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;
  }
};
ku.prototype.isSpotLight = true;
var uv = new Ze();
var Ca = new q();
var Bh = new q();
var qx = class extends _p {
  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()), Ca.setFromMatrixPosition(e.matrixWorld), i.position.copy(Ca), Bh.copy(i.position), Bh.add(this._cubeDirections[t]), i.up.copy(this._cubeUps[t]), i.lookAt(Bh), i.updateMatrixWorld(), r.makeTranslation(-Ca.x, -Ca.y, -Ca.z), uv.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse), this._frustum.setFromProjectionMatrix(uv);
  }
};
qx.prototype.isPointLightShadow = true;
var Gu = class extends bi {
  constructor(e, t, i = 0, r = 1) {
    super(e, t), this.type = "PointLight", this.distance = i, this.decay = r, this.shadow = new qx();
  }
  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;
  }
};
Gu.prototype.isPointLight = true;
var fa = class extends wl {
  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: true,
      fullWidth: 1,
      fullHeight: 1,
      offsetX: 0,
      offsetY: 0,
      width: 1,
      height: 1
    }), this.view.enabled = true, 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 = false), 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;
  }
};
fa.prototype.isOrthographicCamera = true;
var Qx = class extends _p {
  constructor() {
    super(new fa(-5, 5, 5, -5, 0.5, 500));
  }
};
Qx.prototype.isDirectionalLightShadow = true;
var Hu = class extends bi {
  constructor(e, t) {
    super(e, t), this.type = "DirectionalLight", this.position.copy(lt.DefaultUp), this.updateMatrix(), this.target = new lt(), this.shadow = new Qx();
  }
  dispose() {
    this.shadow.dispose();
  }
  copy(e) {
    return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
  }
};
Hu.prototype.isDirectionalLight = true;
var Sp = class extends bi {
  constructor(e, t) {
    super(e, t), this.type = "AmbientLight";
  }
};
Sp.prototype.isAmbientLight = true;
var Tp = class extends bi {
  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;
  }
};
Tp.prototype.isRectAreaLight = true;
var Ep = class {
  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 false;
    return true;
  }
  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);
  }
};
Ep.prototype.isSphericalHarmonics3 = true;
var Il = class extends bi {
  constructor(e = new Ep(), 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;
  }
};
Il.prototype.isLightProbe = true;
var ew = class extends xn {
  constructor(e) {
    super(e), this.textures = {};
  }
  load(e, t, i, r) {
    const s = this, o = new Yn(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 lB[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 Fe().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 Fe().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 Ze().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) === false && (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;
  }
};
var ar = class {
  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);
  }
};
var Ap = class 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 = true, e;
  }
};
Ap.prototype.isInstancedBufferGeometry = true;
var Cp = class extends rt {
  constructor(e, t, i, r = 1) {
    typeof i == "number" && (r = i, i = false, 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 = true, e;
  }
};
Cp.prototype.isInstancedBufferAttribute = true;
var tw = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Yn(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 is(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 Ap() : new Ke(), a = e.data.index;
    if (a !== void 0) {
      const g = Mo(a.type, a.array);
      o.setIndex(new rt(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 dr(y, p.itemSize, p.offset, p.normalized);
      } else {
        const y = Mo(p.type, p.array), v = p.isInstancedBufferAttribute ? Cp : rt;
        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 M = r(e.data, m.data);
            x = new dr(M, m.itemSize, m.offset, m.normalized);
          } else {
            const M = Mo(m.type, m.array);
            x = new rt(M, m.itemSize, m.normalized);
          }
          m.name !== void 0 && (x.name = m.name), u.push(x);
        }
        o.morphAttributes[g] = u;
      }
    e.data.morphTargetsRelative && (o.morphTargetsRelative = true);
    const h4 = e.data.groups || e.data.drawcalls || e.data.offsets;
    if (h4 !== void 0)
      for (let g = 0, p = h4.length; g !== p; ++g) {
        const u = h4[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 br(g, f.radius);
    }
    return e.name && (o.name = e.name), e.userData && (o.userData = e.userData), o;
  }
};
var fB = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = this.path === "" ? ar.extractUrlBase(e) : this.path;
    this.resourcePath = this.resourcePath || o;
    const a = new Yn(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 (h4) {
        r !== void 0 && r(h4), console.error("THREE:ObjectLoader: Can't parse " + e + ".", h4.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 === "" ? ar.extractUrlBase(e) : this.path;
    this.resourcePath = this.resourcePath || r;
    const s = new Yn(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 h4 = false;
      for (const f in o)
        if (o[f] instanceof HTMLImageElement) {
          h4 = true;
          break;
        }
      h4 === false && 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 kr().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 Ll().fromJSON(e[s], r);
        i[a.uuid] = a;
      }
    return i;
  }
  parseGeometries(e, t) {
    const i = {};
    if (e !== void 0) {
      const r = new tw();
      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 ov ? a = ov[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 === true && 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 ew();
      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 h4 = c.materials[d];
            i[h4.uuid] === void 0 && (i[h4.uuid] = s.parse(h4)), l.push(i[h4.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 = Qo.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 xp(t);
      s = new ol(c), s.setCrossOrigin(this.crossOrigin);
      for (let l = 0, d = e.length; l < d; l++) {
        const h4 = e[l], f = h4.url;
        if (Array.isArray(f)) {
          r[h4.uuid] = [];
          for (let g = 0, p = f.length; g < p; g++) {
            const u = f[g], y = a(u);
            y !== null && (y instanceof HTMLImageElement ? r[h4.uuid].push(y) : r[h4.uuid].push(new Cs(y.data, y.width, y.height)));
          }
        } else {
          const g = a(h4.url);
          g !== null && (r[h4.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 ol(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, h4 = l.length; d < h4; d++) {
            const f = l[d], g = await s(f);
            g !== null && (g instanceof HTMLImageElement ? i[c.uuid].push(g) : i[c.uuid].push(new Cs(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 ca(l), l.length === 6 && (c.needsUpdate = true)) : (l && l.data ? c = new Cs(l.data, l.width, l.height) : c = new Jt(l), l && (c.needsUpdate = true)), c.uuid = a.uuid, a.name !== void 0 && (c.name = a.name), a.mapping !== void 0 && (c.mapping = i(a.mapping, pB)), 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], hv), c.wrapT = i(a.wrap[1], hv)), 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, dv)), a.magFilter !== void 0 && (c.magFilter = i(a.magFilter, dv)), 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, h4;
    switch (e.type) {
      case "Scene":
        o = new Nu(), e.background !== void 0 && (Number.isInteger(e.background) ? o.background = new Fe(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 Sl(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (o.fog = new _l(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 fa(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 Sp(e.color, e.intensity);
        break;
      case "DirectionalLight":
        o = new Hu(e.color, e.intensity);
        break;
      case "PointLight":
        o = new Gu(e.color, e.intensity, e.distance, e.decay);
        break;
      case "RectAreaLight":
        o = new Tp(e.color, e.intensity, e.width, e.height);
        break;
      case "SpotLight":
        o = new ku(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay);
        break;
      case "HemisphereLight":
        o = new Mp(e.color, e.groundColor, e.intensity);
        break;
      case "LightProbe":
        o = new Il().fromJSON(e);
        break;
      case "SkinnedMesh":
        d = a(e.geometry), h4 = c(e.material), o = new Al(d, h4), 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), h4 = c(e.material), o = new Yt(d, h4);
        break;
      case "InstancedMesh":
        d = a(e.geometry), h4 = c(e.material);
        const f = e.count, g = e.instanceMatrix, p = e.instanceColor;
        o = new tp(d, h4, f), o.instanceMatrix = new rt(new Float32Array(g.array), 16), p !== void 0 && (o.instanceColor = new rt(new Float32Array(p.array), p.itemSize));
        break;
      case "LOD":
        o = new Bx();
        break;
      case "Line":
        o = new Bi(a(e.geometry), c(e.material));
        break;
      case "LineLoop":
        o = new Bu(a(e.geometry), c(e.material));
        break;
      case "LineSegments":
        o = new On(a(e.geometry), c(e.material));
        break;
      case "PointCloud":
      case "Points":
        o = new ha(a(e.geometry), c(e.material));
        break;
      case "Sprite":
        o = new El(c(e.material));
        break;
      case "Group":
        o = new Ci();
        break;
      case "Bone":
        o = new Cl();
        break;
      default:
        o = new lt();
    }
    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 === true && 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);
  }
};
var pB = {
  UVMapping: Su,
  CubeReflectionMapping: yl,
  CubeRefractionMapping: bl,
  EquirectangularReflectionMapping: Qc,
  EquirectangularRefractionMapping: eu,
  CubeUVReflectionMapping: la,
  CubeUVRefractionMapping: xl
};
var hv = {
  RepeatWrapping: Yr,
  ClampToEdgeWrapping: hn2,
  MirroredRepeatWrapping: No
};
var dv = {
  NearestFilter: $t,
  NearestMipmapNearestFilter: qa,
  NearestMipmapLinearFilter: Qa,
  LinearFilter: Ut,
  LinearMipmapNearestFilter: Tu,
  LinearMipmapLinearFilter: yr
};
var Lp = class 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 = zs.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) {
      zs.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);
  }
};
Lp.prototype.isImageBitmapLoader = true;
var nw = class {
  constructor() {
    this.type = "ShapePath", this.color = new Fe(), this.subPaths = [], this.currentPath = null;
  }
  moveTo(e, t) {
    return this.currentPath = new al(), 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 M = 0, T = m.length; M < T; M++) {
        const w = m[M], _ = new kr();
        _.curves = w.curves, x.push(_);
      }
      return x;
    }
    function r(m, x) {
      const M = x.length;
      let T = false;
      for (let w = M - 1, _ = 0; _ < M; w = _++) {
        let E = x[w], P = x[_], S = P.x - E.x, R = P.y - E.y;
        if (Math.abs(R) > Number.EPSILON) {
          if (R < 0 && (E = x[_], S = -S, P = x[w], R = -R), m.y < E.y || m.y > P.y) continue;
          if (m.y === E.y) {
            if (m.x === E.x) return true;
          } else {
            const A = R * (m.x - E.x) - S * (m.y - E.y);
            if (A === 0) return true;
            if (A < 0) continue;
            T = !T;
          }
        } else {
          if (m.y !== E.y) continue;
          if (P.x <= m.x && m.x <= E.x || E.x <= m.x && m.x <= P.x) return true;
        }
      }
      return T;
    }
    const s = Ii.isClockWise, o = this.subPaths;
    if (o.length === 0) return [];
    if (t === true) return i(o);
    let a, c, l;
    const d = [];
    if (o.length === 1)
      return c = o[0], l = new kr(), l.curves = c.curves, d.push(l), d;
    let h4 = !s(o[0].getPoints());
    h4 = e ? !h4 : h4;
    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 ? (!h4 && g[u] && u++, g[u] = { s: new kr(), p: y }, g[u].s.curves = c.curves, h4 && u++, p[u] = []) : p[u].push({ h: c, p: y[0] });
    if (!g[0]) return i(o);
    if (g.length > 1) {
      let m = false;
      const x = [];
      for (let M = 0, T = g.length; M < T; M++)
        f[M] = [];
      for (let M = 0, T = g.length; M < T; M++) {
        const w = p[M];
        for (let _ = 0; _ < w.length; _++) {
          const E = w[_];
          let P = true;
          for (let S = 0; S < g.length; S++)
            r(E.p, g[S].p) && (M !== S && x.push({ froms: M, tos: S, hole: _ }), P ? (P = false, f[S].push(E)) : m = true);
          P && f[M].push(E);
        }
      }
      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 M = 0, T = v.length; M < T; M++)
        l.holes.push(v[M].h);
    }
    return d;
  }
};
var Rp = class {
  constructor(e) {
    this.type = "Font", this.data = e;
  }
  generateShapes(e, t = 100) {
    const i = [], r = mB(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 mB(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 h4 = gB(d, r, a, c, t);
      a += h4.offsetX, o.push(h4.path);
    }
  }
  return o;
}
function gB(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 nw();
  let a, c, l, d, h4, 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, h4 = u[y++] * e + t, f = u[y++] * e + i, o.quadraticCurveTo(h4, f, l, d);
          break;
        case "b":
          l = u[y++] * e + t, d = u[y++] * e + i, h4 = u[y++] * e + t, f = u[y++] * e + i, g = u[y++] * e + t, p = u[y++] * e + i, o.bezierCurveTo(h4, f, g, p, l, d);
          break;
      }
  }
  return { offsetX: s.ha * e, path: o };
}
Rp.prototype.isFont = true;
var vB = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Yn(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 Rp(e);
  }
};
var wc;
var Pp = {
  getContext: function() {
    return wc === void 0 && (wc = new (window.AudioContext || window.webkitAudioContext)()), wc;
  },
  setContext: function(n) {
    wc = n;
  }
};
var iw = class extends xn {
  constructor(e) {
    super(e);
  }
  load(e, t, i, r) {
    const s = this, o = new Yn(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);
        Pp.getContext().decodeAudioData(c, function(d) {
          t(d);
        });
      } catch (c) {
        r ? r(c) : console.error(c), s.manager.itemError(e);
      }
    }, i, r);
  }
};
var rw = class extends Il {
  constructor(e, t, i = 1) {
    super(void 0, i);
    const r = new Fe().set(e), s = new Fe().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);
  }
};
rw.prototype.isHemisphereLightProbe = true;
var sw = class extends Il {
  constructor(e, t = 1) {
    super(void 0, t);
    const i = new Fe().set(e);
    this.sh.coefficients[0].set(i.r, i.g, i.b).multiplyScalar(2 * Math.sqrt(Math.PI));
  }
};
sw.prototype.isAmbientLightProbe = true;
var fv = new Ze();
var pv = new Ze();
var yB = class {
  constructor() {
    this.type = "StereoCamera", this.aspect = 1, this.eyeSep = 0.064, this.cameraL = new nn(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = false, this.cameraR = new nn(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = false, 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;
      pv.elements[12] = -s, fv.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(pv), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(fv);
  }
};
var ow = class {
  constructor(e = true) {
    this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = false;
  }
  start() {
    this.startTime = mv(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = true;
  }
  stop() {
    this.getElapsedTime(), this.running = false, this.autoStart = false;
  }
  getElapsedTime() {
    return this.getDelta(), this.elapsedTime;
  }
  getDelta() {
    let e = 0;
    if (this.autoStart && !this.running)
      return this.start(), 0;
    if (this.running) {
      const t = mv();
      e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e;
    }
    return e;
  }
};
function mv() {
  return (typeof performance > "u" ? Date : performance).now();
}
var hs = new q();
var gv = new bn();
var bB = new q();
var ds = new q();
var xB = class extends lt {
  constructor() {
    super(), this.type = "AudioListener", this.context = Pp.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new ow();
  }
  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(hs, gv, bB), ds.set(0, 0, -1).applyQuaternion(gv), t.positionX) {
      const r = this.context.currentTime + this.timeDelta;
      t.positionX.linearRampToValueAtTime(hs.x, r), t.positionY.linearRampToValueAtTime(hs.y, r), t.positionZ.linearRampToValueAtTime(hs.z, r), t.forwardX.linearRampToValueAtTime(ds.x, r), t.forwardY.linearRampToValueAtTime(ds.y, r), t.forwardZ.linearRampToValueAtTime(ds.z, r), t.upX.linearRampToValueAtTime(i.x, r), t.upY.linearRampToValueAtTime(i.y, r), t.upZ.linearRampToValueAtTime(i.z, r);
    } else
      t.setPosition(hs.x, hs.y, hs.z), t.setOrientation(ds.x, ds.y, ds.z, i.x, i.y, i.z);
  }
};
var Op = class extends lt {
  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 = false, this.buffer = null, this.detune = 0, this.loop = false, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = false, this.hasPlaybackControl = true, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = false, this.filters = [];
  }
  getOutput() {
    return this.gain;
  }
  setNodeSource(e) {
    return this.hasPlaybackControl = false, this.sourceType = "audioNode", this.source = e, this.connect(), this;
  }
  setMediaElementSource(e) {
    return this.hasPlaybackControl = false, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this;
  }
  setMediaStreamSource(e) {
    return this.hasPlaybackControl = false, 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 === true) {
      console.warn("THREE.Audio: Audio is already playing.");
      return;
    }
    if (this.hasPlaybackControl === false) {
      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 = true, this.source = t, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect();
  }
  pause() {
    if (this.hasPlaybackControl === false) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.isPlaying === true && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === true && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = false), this;
  }
  stop() {
    if (this.hasPlaybackControl === false) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this._progress = 0, this.source.stop(), this.source.onended = null, this.isPlaying = false, 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 = true, 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 = false, this;
  }
  getFilters() {
    return this.filters;
  }
  setFilters(e) {
    return e || (e = []), this._connected === true ? (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 === true && 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 === false) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.playbackRate = e, this.isPlaying === true && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01), this;
  }
  getPlaybackRate() {
    return this.playbackRate;
  }
  onEnded() {
    this.isPlaying = false;
  }
  getLoop() {
    return this.hasPlaybackControl === false ? (console.warn("THREE.Audio: this Audio has no playback control."), false) : this.loop;
  }
  setLoop(e) {
    if (this.hasPlaybackControl === false) {
      console.warn("THREE.Audio: this Audio has no playback control.");
      return;
    }
    return this.loop = e, this.isPlaying === true && (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;
  }
};
var fs = new q();
var vv = new bn();
var wB = new q();
var ps = new q();
var MB = class extends Op {
  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 === true && this.isPlaying === false) return;
    this.matrixWorld.decompose(fs, vv, wB), ps.set(0, 0, 1).applyQuaternion(vv);
    const t = this.panner;
    if (t.positionX) {
      const i = this.context.currentTime + this.listener.timeDelta;
      t.positionX.linearRampToValueAtTime(fs.x, i), t.positionY.linearRampToValueAtTime(fs.y, i), t.positionZ.linearRampToValueAtTime(fs.z, i), t.orientationX.linearRampToValueAtTime(ps.x, i), t.orientationY.linearRampToValueAtTime(ps.y, i), t.orientationZ.linearRampToValueAtTime(ps.z, i);
    } else
      t.setPosition(fs.x, fs.y, fs.z), t.setOrientation(ps.x, ps.y, ps.z);
  }
};
var aw = class {
  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;
  }
};
var lw = class {
  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;
    }
  }
};
var Ip = "\\[\\]\\.:\\/";
var _B = new RegExp("[" + Ip + "]", "g");
var Dp = "[^" + Ip + "]";
var SB = "[^" + Ip.replace("\\.", "") + "]";
var TB = /((?:WC+[\/:])*)/.source.replace("WC", Dp);
var EB = /(WCOD+)?/.source.replace("WCOD", SB);
var AB = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Dp);
var CB = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Dp);
var LB = new RegExp(
  "^" + TB + EB + AB + CB + "$"
);
var RB = ["material", "materials", "bones"];
var PB = class {
  constructor(e, t, i) {
    const r = i || pt.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();
  }
};
var pt = class _pt {
  constructor(e, t, i) {
    this.path = t, this.parsedPath = i || _pt.parseTrackName(t), this.node = _pt.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 _pt.Composite(e, t, i) : new _pt(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(_B, "");
  }
  static parseTrackName(e) {
    const t = LB.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);
      RB.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 = true;
  }
  _setValue_direct_setMatrixWorldNeedsUpdate(e, t) {
    this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = true;
  }
  // 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 = true;
  }
  _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 = true;
  }
  // 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 = true;
  }
  _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) {
    this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = true;
  }
  // HasToFromArray
  _setValue_fromArray(e, t) {
    this.resolvedProperty.fromArray(e, t);
  }
  _setValue_fromArray_setNeedsUpdate(e, t) {
    this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = true;
  }
  _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) {
    this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = true;
  }
  _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 = _pt.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;
  }
};
pt.Composite = PB;
pt.prototype.BindingType = {
  Direct: 0,
  EntireArray: 1,
  ArrayElement: 2,
  HasFromToArray: 3
};
pt.prototype.Versioning = {
  None: 0,
  NeedsUpdate: 1,
  MatrixWorldNeedsUpdate: 2
};
pt.prototype.GetterByBindingType = [
  pt.prototype._getValue_direct,
  pt.prototype._getValue_array,
  pt.prototype._getValue_arrayElement,
  pt.prototype._getValue_toArray
];
pt.prototype.SetterByBindingTypeAndVersioning = [
  [
    // Direct
    pt.prototype._setValue_direct,
    pt.prototype._setValue_direct_setNeedsUpdate,
    pt.prototype._setValue_direct_setMatrixWorldNeedsUpdate
  ],
  [
    // EntireArray
    pt.prototype._setValue_array,
    pt.prototype._setValue_array_setNeedsUpdate,
    pt.prototype._setValue_array_setMatrixWorldNeedsUpdate
  ],
  [
    // ArrayElement
    pt.prototype._setValue_arrayElement,
    pt.prototype._setValue_arrayElement_setNeedsUpdate,
    pt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
  ],
  [
    // HasToFromArray
    pt.prototype._setValue_fromArray,
    pt.prototype._setValue_fromArray_setNeedsUpdate,
    pt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
  ]
];
var cw = class {
  constructor() {
    this.uuid = $n(), 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, h4 = arguments.length; d !== h4; ++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 pt(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], M = x[u];
          let T = x[p];
          x[p] = M, T === void 0 && (T = new pt(f, i[v], r[v])), x[u] = T;
        }
      } 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 h4 = s++, f = e[h4];
        t[f.uuid] = d, e[d] = f, t[l] = h4, e[h4] = c;
        for (let g = 0, p = r; g !== p; ++g) {
          const u = i[g], y = u[h4], v = u[d];
          u[d] = y, u[h4] = 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, h4 = t[d];
      if (h4 !== void 0)
        if (delete t[d], h4 < s) {
          const f = --s, g = e[f], p = --o, u = e[p];
          t[g.uuid] = h4, e[h4] = 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], M = m[p];
            m[h4] = x, m[f] = M, m.pop();
          }
        } else {
          const f = --o, g = e[f];
          f > 0 && (t[g.uuid] = h4), e[h4] = g, e.pop();
          for (let p = 0, u = r; p !== u; ++p) {
            const y = i[p];
            y[h4] = 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_, h4 = new Array(l);
    r = s.length, i[e] = r, o.push(e), a.push(t), s.push(h4);
    for (let f = d, g = c.length; f !== g; ++f) {
      const p = c[f];
      h4[f] = new pt(p, e, t);
    }
    return h4;
  }
  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();
    }
  }
};
cw.prototype.isAnimationObjectGroup = true;
var OB = class {
  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: xs,
      endingEnd: xs
    };
    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 = nx, 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 = false, this.enabled = true, this.clampWhenFinished = false, this.zeroSlopeAtStart = true, this.zeroSlopeAtEnd = true;
  }
  // State & Scheduling
  play() {
    return this._mixer._activateAction(this), this;
  }
  stop() {
    return this._mixer._deactivateAction(this), this.reset();
  }
  reset() {
    return this.paused = false, this.enabled = true, 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 Wf:
          for (let d = 0, h4 = c.length; d !== h4; ++d)
            c[d].evaluate(o), l[d].accumulateAdditive(a);
          break;
        case Eu:
        default:
          for (let d = 0, h4 = c.length; d !== h4; ++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 = false));
      }
    }
    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 = true : 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 === ix;
    if (e === 0)
      return s === -1 ? r : o && (s & 1) === 1 ? t - r : r;
    if (i === tx) {
      s === -1 && (this._loopCount = 0, this._setEndings(true, true, false));
      e: {
        if (r >= t)
          r = t;
        else if (r < 0)
          r = 0;
        else {
          this.time = r;
          break e;
        }
        this.clampWhenFinished ? this.paused = true : this.enabled = false, 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(true, this.repetitions === 0, o)) : this._setEndings(this.repetitions === 0, true, 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 = true : this.enabled = false, 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(false, false, 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 = ws, r.endingEnd = ws) : (e ? r.endingStart = this.zeroSlopeAtStart ? ws : xs : r.endingStart = tl, t ? r.endingEnd = this.zeroSlopeAtEnd ? ws : xs : r.endingEnd = tl);
  }
  _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;
  }
};
var uw = class extends ts {
  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 h4 = 0; h4 !== s; ++h4) {
      const f = r[h4], g = f.name;
      let p = d[g];
      if (p !== void 0)
        o[h4] = p;
      else {
        if (p = o[h4], p !== void 0) {
          p._cacheIndex === null && (++p.referenceCount, this._addInactiveBinding(p, c, g));
          continue;
        }
        const u = t && t._propertyBindings[h4].binding.parsedPath;
        p = new lw(
          pt.create(i, g, u),
          f.ValueTypeName,
          f.getValueSize()
        ), ++p.referenceCount, this._addInactiveBinding(p, c, g), o[h4] = p;
      }
      a[h4].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 h4 = a.actionByRoot, f = (e._localRoot || this._root).uuid;
    delete h4[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 yp(
      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" ? Qo.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 = Eu), c !== void 0) {
      const h4 = c.actionByRoot[s];
      if (h4 !== void 0 && h4.blendMode === i)
        return h4;
      l = c.knownActions[0], o === null && (o = l._clip);
    }
    if (o === null) return null;
    const d = new OB(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" ? Qo.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, h4 = t[t.length - 1];
        l._cacheIndex = null, l._byClipCacheIndex = null, h4._cacheIndex = d, t[d] = h4, 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));
  }
};
uw.prototype._controlInterpolantsResultBuffer = new Float32Array(1);
var Wu = class _Wu {
  constructor(e) {
    typeof e == "string" && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e;
  }
  clone() {
    return new _Wu(this.value.clone === void 0 ? this.value : this.value.clone());
  }
};
var hw = class extends is {
  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 = true, t.meshPerAttribute = this.meshPerAttribute, t;
  }
};
hw.prototype.isInstancedInterleavedBuffer = true;
var dw = class {
  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 === true && 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;
  }
};
dw.prototype.isGLBufferAttribute = true;
var IB = class {
  constructor(e, t, i = 0, r = 1 / 0) {
    this.ray = new ns(e, t), this.near = i, this.far = r, this.camera = null, this.layers = new Kf(), 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 = false, i = []) {
    return kd(e, this, i, t), i.sort(yv), i;
  }
  intersectObjects(e, t = false, i = []) {
    for (let r = 0, s = e.length; r < s; r++)
      kd(e[r], this, i, t);
    return i.sort(yv), i;
  }
};
function yv(n, e) {
  return n.distance - e.distance;
}
function kd(n, e, t, i) {
  if (n.layers.test(e.layers) && n.raycast(e, t), i === true) {
    const r = n.children;
    for (let s = 0, o = r.length; s < o; s++)
      kd(r[s], e, t, true);
  }
}
var DB = class {
  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(vn(t / this.radius, -1, 1))), this;
  }
  clone() {
    return new this.constructor().copy(this);
  }
};
var NB = class {
  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);
  }
};
var bv = new Re();
var pa = class {
  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 = bv.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 bv.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);
  }
};
pa.prototype.isBox2 = true;
var xv = new q();
var Mc = new q();
var fw = class {
  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) {
    xv.subVectors(e, this.start), Mc.subVectors(this.end, this.start);
    const i = Mc.dot(Mc);
    let s = Mc.dot(xv) / i;
    return t && (s = vn(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);
  }
};
var pw = class extends lt {
  constructor(e) {
    super(), this.material = e, this.render = function() {
    }, this.hasPositions = false, this.hasNormals = false, this.hasColors = false, this.hasUvs = false, this.positionArray = null, this.normalArray = null, this.colorArray = null, this.uvArray = null, this.count = 0;
  }
};
pw.prototype.isImmediateRenderObject = true;
var wv = new q();
var BB = class extends lt {
  constructor(e, t) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = false, 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 on({ fog: false, toneMapped: false });
    this.cone = new On(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), wv.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(wv), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color);
  }
};
var Lr = new q();
var _c = new Ze();
var Fh = new Ze();
var mw = class extends On {
  constructor(e) {
    const t = gw(e), i = new Ke(), r = [], s = [], o = new Fe(0, 0, 1), a = new Fe(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 on({ vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true });
    super(i, c), this.type = "SkeletonHelper", this.isSkeletonHelper = true, this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = false;
  }
  updateMatrixWorld(e) {
    const t = this.bones, i = this.geometry, r = i.getAttribute("position");
    Fh.copy(this.root.matrixWorld).invert();
    for (let s = 0, o = 0; s < t.length; s++) {
      const a = t[s];
      a.parent && a.parent.isBone && (_c.multiplyMatrices(Fh, a.matrixWorld), Lr.setFromMatrixPosition(_c), r.setXYZ(o, Lr.x, Lr.y, Lr.z), _c.multiplyMatrices(Fh, a.parent.matrixWorld), Lr.setFromMatrixPosition(_c), r.setXYZ(o + 1, Lr.x, Lr.y, Lr.z), o += 2);
    }
    i.getAttribute("position").needsUpdate = true, super.updateMatrixWorld(e);
  }
};
function gw(n) {
  const e = [];
  n && n.isBone && e.push(n);
  for (let t = 0; t < n.children.length; t++)
    e.push.apply(e, gw(n.children[t]));
  return e;
}
var FB = class extends Yt {
  constructor(e, t, i) {
    const r = new Fs(t, 4, 2), s = new Bn({ wireframe: true, fog: false, toneMapped: false });
    super(r, s), this.light = e, this.light.updateMatrixWorld(), this.color = i, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = false, 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);
  }
};
var zB = new q();
var Mv = new Fe();
var _v = new Fe();
var UB = class extends lt {
  constructor(e, t, i) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = false, this.color = i;
    const r = new Ns(t);
    r.rotateY(Math.PI * 0.5), this.material = new Bn({ wireframe: true, fog: false, toneMapped: false }), this.color === void 0 && (this.material.vertexColors = true);
    const s = r.getAttribute("position"), o = new Float32Array(s.count * 3);
    r.setAttribute("color", new rt(o, 3)), this.add(new Yt(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");
      Mv.copy(this.light.color), _v.copy(this.light.groundColor);
      for (let i = 0, r = t.count; i < r; i++) {
        const s = i < r / 2 ? Mv : _v;
        t.setXYZ(i, s.r, s.g, s.b);
      }
      t.needsUpdate = true;
    }
    e.lookAt(zB.setFromMatrixPosition(this.light.matrixWorld).negate());
  }
};
var vw = class extends On {
  constructor(e = 10, t = 10, i = 4473924, r = 8947848) {
    i = new Fe(i), r = new Fe(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 h4 = new on({ vertexColors: true, toneMapped: false });
    super(d, h4), this.type = "GridHelper";
  }
};
var VB = class extends On {
  constructor(e = 10, t = 16, i = 8, r = 64, s = 4473924, o = 8947848) {
    s = new Fe(s), o = new Fe(o);
    const a = [], c = [];
    for (let h4 = 0; h4 <= t; h4++) {
      const f = h4 / 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 = h4 & 1 ? s : o;
      c.push(u.r, u.g, u.b), c.push(u.r, u.g, u.b);
    }
    for (let h4 = 0; h4 <= i; h4++) {
      const f = h4 & 1 ? s : o, g = e - e / i * h4;
      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 on({ vertexColors: true, toneMapped: false });
    super(l, d), this.type = "PolarGridHelper";
  }
};
var Sv = new q();
var Sc = new q();
var Tv = new q();
var kB = class extends lt {
  constructor(e, t, i) {
    super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = false, 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 on({ fog: false, toneMapped: false });
    this.lightPlane = new Bi(r, s), this.add(this.lightPlane), r = new Ke(), r.setAttribute("position", new We([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Bi(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() {
    Sv.setFromMatrixPosition(this.light.matrixWorld), Sc.setFromMatrixPosition(this.light.target.matrixWorld), Tv.subVectors(Sc, Sv), this.lightPlane.lookAt(Sc), 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(Sc), this.targetLine.scale.z = Tv.length();
  }
};
var Tc = new q();
var Bt = new wl();
var GB = class extends On {
  constructor(e) {
    const t = new Ke(), i = new on({ color: 16777215, vertexColors: true, toneMapped: false }), r = [], s = [], o = {}, a = new Fe(16755200), c = new Fe(16711680), l = new Fe(43775), d = new Fe(16777215), h4 = new Fe(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", h4), f("cn1", "cn2", h4), f("cn3", "cn4", h4), f("cf1", "cf2", h4), f("cf3", "cf4", h4);
    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 = false, 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 = true;
  }
  dispose() {
    this.geometry.dispose(), this.material.dispose();
  }
};
function Ht(n, e, t, i, r, s, o) {
  Tc.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], Tc.x, Tc.y, Tc.z);
  }
}
var Ec = new Un();
var yw = class extends On {
  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 rt(i, 1)), s.setAttribute("position", new rt(r, 3)), super(s, new on({ color: t, toneMapped: false })), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = false, this.update();
  }
  update(e) {
    if (e !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && Ec.setFromObject(this.object), Ec.isEmpty()) return;
    const t = Ec.min, i = Ec.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 = true, this.geometry.computeBoundingSphere();
  }
  setFromObject(e) {
    return this.object = e, this.update(), this;
  }
  copy(e) {
    return On.prototype.copy.call(this, e), this.object = e.object, this;
  }
};
var HB = class extends On {
  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 rt(i, 1)), s.setAttribute("position", new We(r, 3)), super(s, new on({ color: t, toneMapped: false })), 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));
  }
};
var WB = class extends Bi {
  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 on({ color: r, toneMapped: false })), 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 Yt(c, new Bn({ color: r, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false })));
  }
  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 : Zr, this.lookAt(this.plane.normal), super.updateMatrixWorld(e);
  }
};
var Ev = new q();
var Ac;
var zh;
var jB = class extends lt {
  // 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", Ac === void 0 && (Ac = new Ke(), Ac.setAttribute("position", new We([0, 0, 0, 0, 1, 0], 3)), zh = new Jr(0, 0.5, 1, 5, 1), zh.translate(0, -0.5, 0)), this.position.copy(t), this.line = new Bi(Ac, new on({ color: r, toneMapped: false })), this.line.matrixAutoUpdate = false, this.add(this.line), this.cone = new Yt(zh, new Bn({ color: r, toneMapped: false })), this.cone.matrixAutoUpdate = false, 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 {
      Ev.set(e.z, 0, -e.x).normalize();
      const t = Math.acos(e.y);
      this.quaternion.setFromAxisAngle(Ev, 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, false), this.line.copy(e.line), this.cone.copy(e.cone), this;
  }
};
var bw = class extends On {
  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 on({ vertexColors: true, toneMapped: false });
    super(r, s), this.type = "AxesHelper";
  }
  setColors(e, t, i) {
    const r = new Fe(), 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 = true, this;
  }
  dispose() {
    this.geometry.dispose(), this.material.dispose();
  }
};
var xw = new Float32Array(1);
var $B = new Int32Array(xw.buffer);
var ZB = class {
  // Converts float32 to float16 (stored as uint16 value).
  static toHalfFloat(e) {
    xw[0] = e;
    const t = $B[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);
  }
};
var Eo = 4;
var Gr = 8;
var Ti = Math.pow(2, Gr);
var ww = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
var Mw = Gr - Eo + 1 + ww.length;
var mo = 20;
var Li = {
  [Rn]: 0,
  [Is]: 1,
  [Cu]: 2,
  [$f]: 3,
  [Zf]: 4,
  [Xf]: 5,
  [Au]: 6
};
var ms = new Bn({
  side: jt,
  depthWrite: false,
  depthTest: false
});
var XB = new Yt(new ur(), ms);
var Uh = new fa();
var { _lodPlanes: La, _sizeLods: Av, _sigmas: Cc } = KB();
var Cv = new Fe();
var Vh = null;
var gs = (1 + Math.sqrt(5)) / 2;
var go = 1 / gs;
var Lv = [
  new q(1, 1, 1),
  new q(-1, 1, 1),
  new q(1, 1, -1),
  new q(-1, 1, -1),
  new q(0, gs, go),
  new q(0, gs, -go),
  new q(go, 0, gs),
  new q(-go, 0, gs),
  new q(gs, go, 0),
  new q(-gs, go, 0)
];
function Rv(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;
}
var YB = class {
  constructor(e) {
    this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = qB(mo), 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) {
    Vh = 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 = Iv(), 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 = Ov(), 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 < La.length; e++)
      La[e].dispose();
  }
  // private interface
  _cleanup(e) {
    this._pingPongRenderTarget.dispose(), this._renderer.setRenderTarget(Vh), e.scissorTest = false, Lc(e, 0, 0, e.width, e.height);
  }
  _fromTexture(e) {
    Vh = 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: false,
      type: Ps,
      format: yb,
      encoding: JB(e) ? e.encoding : Cu,
      depthBuffer: false
    }, i = Pv(t);
    return i.depthBuffer = !e, this._pingPongRenderTarget = Pv(t), i;
  }
  _compileMaterial(e) {
    const t = new Yt(La[0], e);
    this._renderer.compile(t, Uh);
  }
  _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, h4 = d.autoClear, f = d.outputEncoding, g = d.toneMapping;
    d.getClearColor(Cv), d.toneMapping = Ur, d.outputEncoding = Rn, d.autoClear = false;
    let p = false;
    const u = e.background;
    if (u) {
      if (u.isColor) {
        ms.color.copy(u).convertSRGBToLinear(), e.background = null;
        const y = Rv(ms.color);
        ms.opacity = y, p = true;
      }
    } else {
      ms.color.copy(Cv).convertSRGBToLinear();
      const y = Rv(ms.color);
      ms.opacity = y, p = true;
    }
    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])), Lc(
        r,
        v * Ti,
        y > 2 ? Ti : 0,
        Ti,
        Ti
      ), d.setRenderTarget(r), p && d.render(XB, a), d.render(e, a);
    }
    d.toneMapping = g, d.outputEncoding = f, d.autoClear = h4;
  }
  _textureToCubeUV(e, t) {
    const i = this._renderer;
    e.isCubeTexture ? this._cubemapShader == null && (this._cubemapShader = Iv()) : this._equirectShader == null && (this._equirectShader = Ov());
    const r = e.isCubeTexture ? this._cubemapShader : this._equirectShader, s = new Yt(La[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 = Li[e.encoding], o.outputEncoding.value = Li[t.texture.encoding], Lc(t, 0, 0, 3 * Ti, 2 * Ti), i.setRenderTarget(t), i.render(s, Uh);
  }
  _applyPMREM(e) {
    const t = this._renderer, i = t.autoClear;
    t.autoClear = false;
    for (let r = 1; r < Mw; r++) {
      const s = Math.sqrt(Cc[r] * Cc[r] - Cc[r - 1] * Cc[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, h4 = new Yt(La[r], l), f = l.uniforms, g = Av[i] - 1, p = isFinite(s) ? Math.PI / (2 * g) : 2 * Math.PI / (2 * mo - 1), u = s / p, y = isFinite(s) ? 1 + Math.floor(d * u) : mo;
    y > mo && console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${mo}`);
    const v = [];
    let m = 0;
    for (let w = 0; w < mo; ++w) {
      const _ = w / u, E = Math.exp(-_ * _ / 2);
      v.push(E), w == 0 ? m += E : w < y && (m += 2 * E);
    }
    for (let w = 0; w < v.length; w++)
      v[w] = v[w] / 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 = Gr - i, f.inputEncoding.value = Li[e.texture.encoding], f.outputEncoding.value = Li[e.texture.encoding];
    const x = Av[r], M = 3 * Math.max(0, Ti - 2 * x), T = (r === 0 ? 0 : 2 * Ti) + 2 * x * (r > Gr - Eo ? r - Gr + Eo : 0);
    Lc(t, M, T, 3 * x, 2 * x), c.setRenderTarget(t), c.render(h4, Uh);
  }
};
function JB(n) {
  return n === void 0 || n.type !== Ps ? false : n.encoding === Rn || n.encoding === Is || n.encoding === Au;
}
function KB() {
  const n = [], e = [], t = [];
  let i = Gr;
  for (let r = 0; r < Mw; r++) {
    const s = Math.pow(2, i);
    e.push(s);
    let o = 1 / s;
    r > Gr - Eo ? o = ww[r - Gr + Eo - 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], h4 = 6, f = 6, g = 3, p = 2, u = 1, y = new Float32Array(g * f * h4), v = new Float32Array(p * f * h4), m = new Float32Array(u * f * h4);
    for (let M = 0; M < h4; M++) {
      const T = M % 3 * 2 / 3 - 1, w = M > 2 ? 0 : -1, _ = [
        T,
        w,
        0,
        T + 2 / 3,
        w,
        0,
        T + 2 / 3,
        w + 1,
        0,
        T,
        w,
        0,
        T + 2 / 3,
        w + 1,
        0,
        T,
        w + 1,
        0
      ];
      y.set(_, g * f * M), v.set(d, p * f * M);
      const E = [M, M, M, M, M, M];
      m.set(E, u * f * M);
    }
    const x = new Ke();
    x.setAttribute("position", new rt(y, g)), x.setAttribute("uv", new rt(v, p)), x.setAttribute("faceIndex", new rt(m, u)), n.push(x), i > Eo && i--;
  }
  return { _lodPlanes: n, _sizeLods: e, _sigmas: t };
}
function Pv(n) {
  const e = new gi(3 * Ti, 3 * Ti, n);
  return e.texture.mapping = la, e.texture.name = "PMREM.cubeUv", e.scissorTest = true, e;
}
function Lc(n, e, t, i, r) {
  n.viewport.set(e, t, i, r), n.scissor.set(e, t, i, r);
}
function qB(n) {
  const e = new Float32Array(n), t = new q(0, 1, 0);
  return new da({
    name: "SphericalGaussianBlur",
    defines: { n },
    uniforms: {
      envMap: { value: null },
      samples: { value: 1 },
      weights: { value: e },
      latitudinal: { value: false },
      dTheta: { value: 0 },
      mipInt: { value: 0 },
      poleAxis: { value: t },
      inputEncoding: { value: Li[Rn] },
      outputEncoding: { value: Li[Rn] }
    },
    vertexShader: Np(),
    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;

			${Bp()}

			#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: sr,
    depthTest: false,
    depthWrite: false
  });
}
function Ov() {
  const n = new Re(1, 1);
  return new da({
    name: "EquirectangularToCubeUV",
    uniforms: {
      envMap: { value: null },
      texelSize: { value: n },
      inputEncoding: { value: Li[Rn] },
      outputEncoding: { value: Li[Rn] }
    },
    vertexShader: Np(),
    fragmentShader: (
      /* glsl */
      `

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform vec2 texelSize;

			${Bp()}

			#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: sr,
    depthTest: false,
    depthWrite: false
  });
}
function Iv() {
  return new da({
    name: "CubemapToCubeUV",
    uniforms: {
      envMap: { value: null },
      inputEncoding: { value: Li[Rn] },
      outputEncoding: { value: Li[Rn] }
    },
    vertexShader: Np(),
    fragmentShader: (
      /* glsl */
      `

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			${Bp()}

			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: sr,
    depthTest: false,
    depthWrite: false
  });
}
function Np() {
  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 Bp() {
  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 );

		}
	`
  );
}
var QB = 0;
var eF = 1;
var tF = 0;
var nF = 1;
var iF = 2;
function rF(n) {
  return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), n;
}
function sF(n = []) {
  return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), n.isMultiMaterial = true, n.materials = n, n.clone = function() {
    return n.slice();
  }, n;
}
function oF(n, e) {
  return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new ha(n, e);
}
function aF(n) {
  return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new El(n);
}
function lF(n, e) {
  return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new ha(n, e);
}
function cF(n) {
  return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new rs(n);
}
function uF(n) {
  return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new rs(n);
}
function hF(n) {
  return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new rs(n);
}
function dF(n, e, t) {
  return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new q(n, e, t);
}
function fF(n, e) {
  return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new rt(n, e).setUsage(Uo);
}
function pF(n, e) {
  return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new mx(n, e);
}
function mF(n, e) {
  return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new gx(n, e);
}
function gF(n, e) {
  return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new vx(n, e);
}
function vF(n, e) {
  return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new yx(n, e);
}
function yF(n, e) {
  return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new Lu(n, e);
}
function bF(n, e) {
  return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new bx(n, e);
}
function xF(n, e) {
  return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new Ru(n, e);
}
function wF(n, e) {
  return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new We(n, e);
}
function MF(n, e) {
  return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new wx(n, e);
}
Xn.create = function(n, e) {
  return console.log("THREE.Curve.create() has been deprecated"), n.prototype = Object.create(Xn.prototype), n.prototype.constructor = n, n.prototype.getPoint = e, n;
};
al.prototype.fromPoints = function(n) {
  return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(n);
};
function _F(n) {
  return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new bw(n);
}
function SF(n, e) {
  return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new yw(n, e);
}
function TF(n, e) {
  return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new On(new ip(n.geometry), new on({ color: e !== void 0 ? e : 16777215 }));
}
vw.prototype.setColors = function() {
  console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.");
};
mw.prototype.update = function() {
  console.error("THREE.SkeletonHelper: update() no longer needs to be called.");
};
function EF(n, e) {
  return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new On(new up(n.geometry), new on({ 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."), ar.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 AF(n) {
  return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new Yn(n);
}
function CF(n) {
  return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Yx(n);
}
pa.prototype.center = function(n) {
  return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(n);
};
pa.prototype.empty = function() {
  return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
pa.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
pa.prototype.size = function(n) {
  return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(n);
};
Un.prototype.center = function(n) {
  return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(n);
};
Un.prototype.empty = function() {
  return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
Un.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
Un.prototype.isIntersectionSphere = function(n) {
  return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n);
};
Un.prototype.size = function(n) {
  return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(n);
};
br.prototype.empty = function() {
  return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty();
};
Ml.prototype.setFromMatrix = function(n) {
  return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(n);
};
fw.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();
};
Ze.prototype.extractPosition = function(n) {
  return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(n);
};
Ze.prototype.flattenToArrayOffset = function(n, e) {
  return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e);
};
Ze.prototype.getPosition = function() {
  return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), new q().setFromMatrixColumn(this, 3);
};
Ze.prototype.setRotationFromQuaternion = function(n) {
  return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(n);
};
Ze.prototype.multiplyToArray = function() {
  console.warn("THREE.Matrix4: .multiplyToArray() has been removed.");
};
Ze.prototype.multiplyVector3 = function(n) {
  return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Ze.prototype.multiplyVector4 = function(n) {
  return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Ze.prototype.multiplyVector3Array = function() {
  console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.");
};
Ze.prototype.rotateAxis = function(n) {
  console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), n.transformDirection(this);
};
Ze.prototype.crossVector = function(n) {
  return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Ze.prototype.translate = function() {
  console.error("THREE.Matrix4: .translate() has been removed.");
};
Ze.prototype.rotateX = function() {
  console.error("THREE.Matrix4: .rotateX() has been removed.");
};
Ze.prototype.rotateY = function() {
  console.error("THREE.Matrix4: .rotateY() has been removed.");
};
Ze.prototype.rotateZ = function() {
  console.error("THREE.Matrix4: .rotateZ() has been removed.");
};
Ze.prototype.rotateByAxis = function() {
  console.error("THREE.Matrix4: .rotateByAxis() has been removed.");
};
Ze.prototype.applyToBufferAttribute = function(n) {
  return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), n.applyMatrix4(this);
};
Ze.prototype.applyToVector3Array = function() {
  console.error("THREE.Matrix4: .applyToVector3Array() has been removed.");
};
Ze.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);
};
Ze.prototype.getInverse = function(n) {
  return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert();
};
Ei.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();
};
ns.prototype.isIntersectionBox = function(n) {
  return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n);
};
ns.prototype.isIntersectionPlane = function(n) {
  return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(n);
};
ns.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);
};
kr.prototype.extractAllPoints = function(n) {
  return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(n);
};
kr.prototype.extrude = function(n) {
  return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new yi(this, n);
};
kr.prototype.makeGeometry = function(n) {
  return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new Bs(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();
};
lt.prototype.getChildByName = function(n) {
  return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(n);
};
lt.prototype.renderDepth = function() {
  console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.");
};
lt.prototype.translate = function(n, e) {
  return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, n);
};
lt.prototype.getWorldRotation = function() {
  console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.");
};
lt.prototype.applyMatrix = function(n) {
  return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n);
};
Object.defineProperties(lt.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.");
    }
  }
});
Yt.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(Yt.prototype, {
  drawMode: {
    get: function() {
      return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), rx;
    },
    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.");
    }
  }
});
Al.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(bi.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(rt.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 === Uo;
    },
    set: function() {
      console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(Uo);
    }
  }
});
rt.prototype.setDynamic = function(n) {
  return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === true ? Uo : zo), this;
};
rt.prototype.copyIndicesArray = function() {
  console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.");
}, rt.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 rt(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;
    }
  }
});
is.prototype.setDynamic = function(n) {
  return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === true ? Uo : zo), this;
};
is.prototype.setArray = function() {
  console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers");
};
yi.prototype.getArrays = function() {
  console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.");
};
yi.prototype.addShapeList = function() {
  console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.");
};
yi.prototype.addShape = function() {
  console.error("THREE.ExtrudeGeometry: .addShape() has been removed.");
};
Nu.prototype.dispose = function() {
  console.error("THREE.Scene: .dispose() has been removed.");
};
Wu.prototype.onUpdate = function() {
  return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this;
};
Object.defineProperties(en.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 Fe();
    }
  },
  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 === kf;
    }
  },
  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(hr.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;
    }
  }
});
Mt.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);
};
Mt.prototype.animate = function(n) {
  console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(n);
};
Mt.prototype.getCurrentRenderTarget = function() {
  return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget();
};
Mt.prototype.getMaxAnisotropy = function() {
  return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy();
};
Mt.prototype.getPrecision = function() {
  return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision;
};
Mt.prototype.resetGLState = function() {
  return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset();
};
Mt.prototype.supportsFloatTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float");
};
Mt.prototype.supportsHalfFloatTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float");
};
Mt.prototype.supportsStandardDerivatives = function() {
  return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives");
};
Mt.prototype.supportsCompressedTextureS3TC = function() {
  return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc");
};
Mt.prototype.supportsCompressedTexturePVRTC = function() {
  return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc");
};
Mt.prototype.supportsBlendMinMax = function() {
  return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax");
};
Mt.prototype.supportsVertexTextures = function() {
  return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures;
};
Mt.prototype.supportsInstancedArrays = function() {
  return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays");
};
Mt.prototype.enableScissorTest = function(n) {
  console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(n);
};
Mt.prototype.initMaterial = function() {
  console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.");
};
Mt.prototype.addPrePlugin = function() {
  console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.");
};
Mt.prototype.addPostPlugin = function() {
  console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.");
};
Mt.prototype.updateShadowMap = function() {
  console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.");
};
Mt.prototype.setFaceCulling = function() {
  console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.");
};
Mt.prototype.allocTextureUnit = function() {
  console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.");
};
Mt.prototype.setTexture = function() {
  console.warn("THREE.WebGLRenderer: .setTexture() has been removed.");
};
Mt.prototype.setTexture2D = function() {
  console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.");
};
Mt.prototype.setTextureCube = function() {
  console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.");
};
Mt.prototype.getActiveMipMapLevel = function() {
  return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."), this.getActiveMipmapLevel();
};
Object.defineProperties(Mt.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."), false;
    },
    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."), false;
    },
    set: function(n) {
      console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = n === true ? Is : Rn;
    }
  },
  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(Ox.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 LF(n, e, t) {
  return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new Ou(n, t);
}
Object.defineProperties(gi.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;
    }
  }
});
Op.prototype.load = function(n) {
  console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");
  const e = this;
  return new iw().load(n, function(i) {
    e.setBuffer(i);
  }), this;
};
aw.prototype.getData = function() {
  return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData();
};
Pu.prototype.updateCubeMap = function(n, e) {
  return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(n, e);
};
Pu.prototype.clear = function(n, e, t, i) {
  return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(n, e, t, i);
};
Hs.crossOrigin = void 0;
Hs.loadTexture = function(n, e, t, i) {
  console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");
  const r = new wp();
  r.setCrossOrigin(this.crossOrigin);
  const s = r.load(n, t, void 0, i);
  return e && (s.mapping = e), s;
};
Hs.loadTextureCube = function(n, e, t, i) {
  console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
  const r = new Xx();
  r.setCrossOrigin(this.crossOrigin);
  const s = r.load(n, t, void 0, i);
  return e && (s.mapping = e), s;
};
Hs.loadCompressedTexture = function() {
  console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.");
};
Hs.loadCompressedTextureCube = function() {
  console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.");
};
function RF() {
  console.error("THREE.CanvasRenderer has been removed");
}
function PF() {
  console.error("THREE.JSONLoader has been removed.");
}
var OF = {
  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 IF() {
  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: Uf
} }));
typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = Uf);
var DF = Object.freeze(Object.defineProperty({
  __proto__: null,
  ACESFilmicToneMapping: ab,
  AddEquation: ys,
  AddOperation: ib,
  AdditiveAnimationBlendMode: Wf,
  AdditiveBlending: bd,
  AlphaFormat: mb,
  AlwaysDepth: Jy,
  AlwaysStencilFunc: ux,
  AmbientLight: Sp,
  AmbientLightProbe: sw,
  AnimationClip: Qo,
  AnimationLoader: hB,
  AnimationMixer: uw,
  AnimationObjectGroup: cw,
  AnimationUtils: At,
  ArcCurve: rp,
  ArrayCamera: ep,
  ArrowHelper: jB,
  Audio: Op,
  AudioAnalyser: aw,
  AudioContext: Pp,
  AudioListener: xB,
  AudioLoader: iw,
  AxesHelper: bw,
  AxisHelper: _F,
  BackSide: jt,
  BasicDepthPacking: ax,
  BasicShadowMap: TP,
  BinaryTextureLoader: CF,
  Bone: Cl,
  BooleanKeyframeTrack: $s,
  BoundingBoxHelper: SF,
  Box2: pa,
  Box3: Un,
  Box3Helper: HB,
  BoxBufferGeometry: ur,
  BoxGeometry: ur,
  BoxHelper: yw,
  BufferAttribute: rt,
  BufferGeometry: Ke,
  BufferGeometryLoader: tw,
  ByteType: cb,
  Cache: zs,
  Camera: wl,
  CameraHelper: GB,
  CanvasRenderer: RF,
  CanvasTexture: zx,
  CatmullRomCurve3: op,
  CineonToneMapping: ob,
  CircleBufferGeometry: ko,
  CircleGeometry: ko,
  ClampToEdgeWrapping: hn2,
  Clock: ow,
  Color: Fe,
  ColorKeyframeTrack: bp,
  CompressedTexture: np,
  CompressedTextureLoader: dB,
  ConeBufferGeometry: Go,
  ConeGeometry: Go,
  CubeCamera: Pu,
  CubeReflectionMapping: yl,
  CubeRefractionMapping: bl,
  CubeTexture: ca,
  CubeTextureLoader: Xx,
  CubeUVReflectionMapping: la,
  CubeUVRefractionMapping: xl,
  CubicBezierCurve: Fu,
  CubicBezierCurve3: ap,
  CubicInterpolant: Wx,
  CullFaceBack: yd,
  CullFaceFront: Ny,
  CullFaceFrontBack: SP,
  CullFaceNone: Dy,
  Curve: Xn,
  CurvePath: Jx,
  CustomBlending: Fy,
  CustomToneMapping: lb,
  CylinderBufferGeometry: Jr,
  CylinderGeometry: Jr,
  Cylindrical: NB,
  DataTexture: Cs,
  DataTexture2DArray: qf,
  DataTexture3D: Qf,
  DataTextureLoader: Yx,
  DataUtils: ZB,
  DecrementStencilOp: DP,
  DecrementWrapStencilOp: BP,
  DefaultLoadingManager: Zx,
  DepthFormat: Es,
  DepthStencilFormat: Bo,
  DepthTexture: Ux,
  DirectionalLight: Hu,
  DirectionalLightHelper: kB,
  DiscreteInterpolant: jx,
  DodecahedronBufferGeometry: Ho,
  DodecahedronGeometry: Ho,
  DoubleSide: Xr,
  DstAlphaFactor: Wy,
  DstColorFactor: $y,
  DynamicBufferAttribute: fF,
  DynamicCopyUsage: JP,
  DynamicDrawUsage: Uo,
  DynamicReadUsage: ZP,
  EdgesGeometry: ip,
  EdgesHelper: TF,
  EllipseCurve: Rl,
  EqualDepth: qy,
  EqualStencilFunc: VP,
  EquirectangularReflectionMapping: Qc,
  EquirectangularRefractionMapping: eu,
  Euler: Ws,
  EventDispatcher: ts,
  ExtrudeBufferGeometry: yi,
  ExtrudeGeometry: yi,
  FaceColors: nF,
  FileLoader: Yn,
  FlatShading: kf,
  Float16BufferAttribute: xx,
  Float32Attribute: wF,
  Float32BufferAttribute: We,
  Float64Attribute: MF,
  Float64BufferAttribute: wx,
  FloatType: tr,
  Fog: Sl,
  FogExp2: _l,
  Font: Rp,
  FontLoader: vB,
  FrontSide: Zr,
  Frustum: Ml,
  GLBufferAttribute: dw,
  GLSL1: qP,
  GLSL3: Dd,
  GammaEncoding: Au,
  GreaterDepth: eb,
  GreaterEqualDepth: Qy,
  GreaterEqualStencilFunc: WP,
  GreaterStencilFunc: GP,
  GridHelper: vw,
  Group: Ci,
  HalfFloatType: Ts,
  HemisphereLight: Mp,
  HemisphereLightHelper: UB,
  HemisphereLightProbe: rw,
  IcosahedronBufferGeometry: Wo,
  IcosahedronGeometry: Wo,
  ImageBitmapLoader: Lp,
  ImageLoader: ol,
  ImageUtils: Hs,
  ImmediateRenderObject: pw,
  IncrementStencilOp: IP,
  IncrementWrapStencilOp: NP,
  InstancedBufferAttribute: Cp,
  InstancedBufferGeometry: Ap,
  InstancedInterleavedBuffer: hw,
  InstancedMesh: tp,
  Int16Attribute: vF,
  Int16BufferAttribute: yx,
  Int32Attribute: bF,
  Int32BufferAttribute: bx,
  Int8Attribute: pF,
  Int8BufferAttribute: mx,
  IntType: hb,
  InterleavedBuffer: is,
  InterleavedBufferAttribute: dr,
  Interpolant: zi,
  InterpolateDiscrete: Fo,
  InterpolateLinear: Os,
  InterpolateSmooth: Vc,
  InvertStencilOp: FP,
  JSONLoader: PF,
  KeepStencilOp: kc,
  KeyframeTrack: Mi,
  LOD: Bx,
  LatheBufferGeometry: jo,
  LatheGeometry: jo,
  Layers: Kf,
  LensFlare: IF,
  LessDepth: Ky,
  LessEqualDepth: qc,
  LessEqualStencilFunc: kP,
  LessStencilFunc: UP,
  Light: bi,
  LightProbe: Il,
  Line: Bi,
  Line3: fw,
  LineBasicMaterial: on,
  LineCurve: Pl,
  LineCurve3: Vx,
  LineDashedMaterial: vp,
  LineLoop: Bu,
  LinePieces: eF,
  LineSegments: On,
  LineStrip: QB,
  LinearEncoding: Rn,
  LinearFilter: Ut,
  LinearInterpolant: yp,
  LinearMipMapLinearFilter: RP,
  LinearMipMapNearestFilter: LP,
  LinearMipmapLinearFilter: yr,
  LinearMipmapNearestFilter: Tu,
  LinearToneMapping: rb,
  Loader: xn,
  LoaderUtils: ar,
  LoadingManager: xp,
  LogLuvEncoding: ox,
  LoopOnce: tx,
  LoopPingPong: ix,
  LoopRepeat: nx,
  LuminanceAlphaFormat: vb,
  LuminanceFormat: gb,
  MOUSE: MP,
  Material: en,
  MaterialLoader: ew,
  Math: Bd,
  MathUtils: Bd,
  Matrix3: rn,
  Matrix4: Ze,
  MaxEquation: _d,
  Mesh: Yt,
  MeshBasicMaterial: Bn,
  MeshDepthMaterial: Iu,
  MeshDistanceMaterial: Du,
  MeshFaceMaterial: rF,
  MeshLambertMaterial: mp,
  MeshMatcapMaterial: gp,
  MeshNormalMaterial: pp,
  MeshPhongMaterial: dp,
  MeshPhysicalMaterial: Ol,
  MeshStandardMaterial: js,
  MeshToonMaterial: fp,
  MinEquation: Md,
  MirroredRepeatWrapping: No,
  MixOperation: nb,
  MultiMaterial: sF,
  MultiplyBlending: wd,
  MultiplyOperation: vl,
  NearestFilter: $t,
  NearestMipMapLinearFilter: CP,
  NearestMipMapNearestFilter: AP,
  NearestMipmapLinearFilter: Qa,
  NearestMipmapNearestFilter: qa,
  NeverDepth: Yy,
  NeverStencilFunc: zP,
  NoBlending: sr,
  NoColors: tF,
  NoToneMapping: Ur,
  NormalAnimationBlendMode: Eu,
  NormalBlending: So,
  NotEqualDepth: tb,
  NotEqualStencilFunc: HP,
  NumberKeyframeTrack: Ko,
  Object3D: lt,
  ObjectLoader: fB,
  ObjectSpaceNormalMap: cx,
  OctahedronBufferGeometry: Ns,
  OctahedronGeometry: Ns,
  OneFactor: ky,
  OneMinusDstAlphaFactor: jy,
  OneMinusDstColorFactor: Zy,
  OneMinusSrcAlphaFactor: Hf,
  OneMinusSrcColorFactor: Hy,
  OrthographicCamera: fa,
  PCFShadowMap: Vf,
  PCFSoftShadowMap: By,
  PMREMGenerator: YB,
  ParametricBufferGeometry: tu,
  ParametricGeometry: tu,
  Particle: aF,
  ParticleBasicMaterial: uF,
  ParticleSystem: lF,
  ParticleSystemMaterial: hF,
  Path: al,
  PerspectiveCamera: nn,
  Plane: Ei,
  PlaneBufferGeometry: Ds,
  PlaneGeometry: Ds,
  PlaneHelper: WB,
  PointCloud: oF,
  PointCloudMaterial: cF,
  PointLight: Gu,
  PointLightHelper: FB,
  Points: ha,
  PointsMaterial: rs,
  PolarGridHelper: VB,
  PolyhedronBufferGeometry: Fi,
  PolyhedronGeometry: Fi,
  PositionalAudio: MB,
  PropertyBinding: pt,
  PropertyMixer: lw,
  QuadraticBezierCurve: zu,
  QuadraticBezierCurve3: lp,
  Quaternion: bn,
  QuaternionKeyframeTrack: Zs,
  QuaternionLinearInterpolant: $x,
  REVISION: Uf,
  RGBADepthPacking: lx,
  RGBAFormat: jn,
  RGBAIntegerFormat: Sb,
  RGBA_ASTC_10x10_Format: Fb,
  RGBA_ASTC_10x5_Format: Db,
  RGBA_ASTC_10x6_Format: Nb,
  RGBA_ASTC_10x8_Format: Bb,
  RGBA_ASTC_12x10_Format: zb,
  RGBA_ASTC_12x12_Format: Ub,
  RGBA_ASTC_4x4_Format: Eb,
  RGBA_ASTC_5x4_Format: Ab,
  RGBA_ASTC_5x5_Format: Cb,
  RGBA_ASTC_6x5_Format: Lb,
  RGBA_ASTC_6x6_Format: Rb,
  RGBA_ASTC_8x5_Format: Pb,
  RGBA_ASTC_8x6_Format: Ob,
  RGBA_ASTC_8x8_Format: Ib,
  RGBA_BPTC_Format: Vb,
  RGBA_ETC2_EAC_Format: Id,
  RGBA_PVRTC_2BPPV1_Format: Pd,
  RGBA_PVRTC_4BPPV1_Format: Rd,
  RGBA_S3TC_DXT1_Format: Td,
  RGBA_S3TC_DXT3_Format: Ed,
  RGBA_S3TC_DXT5_Format: Ad,
  RGBDEncoding: Xf,
  RGBEEncoding: Cu,
  RGBEFormat: yb,
  RGBFormat: or,
  RGBIntegerFormat: _b,
  RGBM16Encoding: Zf,
  RGBM7Encoding: $f,
  RGB_ETC1_Format: Tb,
  RGB_ETC2_Format: Od,
  RGB_PVRTC_2BPPV1_Format: Ld,
  RGB_PVRTC_4BPPV1_Format: Cd,
  RGB_S3TC_DXT1_Format: Sd,
  RGFormat: wb,
  RGIntegerFormat: Mb,
  RawShaderMaterial: da,
  Ray: ns,
  Raycaster: IB,
  RectAreaLight: Tp,
  RedFormat: bb,
  RedIntegerFormat: xb,
  ReinhardToneMapping: sb,
  RepeatWrapping: Yr,
  ReplaceStencilOp: OP,
  ReverseSubtractEquation: Uy,
  RingBufferGeometry: $o,
  RingGeometry: $o,
  SRGB8_ALPHA8_ASTC_10x10_Format: qb,
  SRGB8_ALPHA8_ASTC_10x5_Format: Yb,
  SRGB8_ALPHA8_ASTC_10x6_Format: Jb,
  SRGB8_ALPHA8_ASTC_10x8_Format: Kb,
  SRGB8_ALPHA8_ASTC_12x10_Format: Qb,
  SRGB8_ALPHA8_ASTC_12x12_Format: ex,
  SRGB8_ALPHA8_ASTC_4x4_Format: kb,
  SRGB8_ALPHA8_ASTC_5x4_Format: Gb,
  SRGB8_ALPHA8_ASTC_5x5_Format: Hb,
  SRGB8_ALPHA8_ASTC_6x5_Format: Wb,
  SRGB8_ALPHA8_ASTC_6x6_Format: jb,
  SRGB8_ALPHA8_ASTC_8x5_Format: $b,
  SRGB8_ALPHA8_ASTC_8x6_Format: Zb,
  SRGB8_ALPHA8_ASTC_8x8_Format: Xb,
  Scene: Nu,
  SceneUtils: OF,
  ShaderChunk: ut,
  ShaderLib: fi,
  ShaderMaterial: hr,
  ShadowMaterial: hp,
  Shape: kr,
  ShapeBufferGeometry: Bs,
  ShapeGeometry: Bs,
  ShapePath: nw,
  ShapeUtils: Ii,
  ShortType: ub,
  Skeleton: Ll,
  SkeletonHelper: mw,
  SkinnedMesh: Al,
  SmoothShading: EP,
  Sphere: br,
  SphereBufferGeometry: Fs,
  SphereGeometry: Fs,
  Spherical: DB,
  SphericalHarmonics3: Ep,
  SplineCurve: Uu,
  SpotLight: ku,
  SpotLightHelper: BB,
  Sprite: El,
  SpriteMaterial: Tl,
  SrcAlphaFactor: Gf,
  SrcAlphaSaturateFactor: Xy,
  SrcColorFactor: Gy,
  StaticCopyUsage: YP,
  StaticDrawUsage: zo,
  StaticReadUsage: $P,
  StereoCamera: yB,
  StreamCopyUsage: KP,
  StreamDrawUsage: jP,
  StreamReadUsage: XP,
  StringKeyframeTrack: Xs,
  SubtractEquation: zy,
  SubtractiveBlending: xd,
  TOUCH: _P,
  TangentSpaceNormalMap: es,
  TetrahedronBufferGeometry: Zo,
  TetrahedronGeometry: Zo,
  TextBufferGeometry: nu,
  TextGeometry: nu,
  Texture: Jt,
  TextureLoader: wp,
  TorusBufferGeometry: Xo,
  TorusGeometry: Xo,
  TorusKnotBufferGeometry: Yo,
  TorusKnotGeometry: Yo,
  Triangle: Zt,
  TriangleFanDrawMode: jf,
  TriangleStripDrawMode: sx,
  TrianglesDrawMode: rx,
  TubeBufferGeometry: Jo,
  TubeGeometry: Jo,
  UVMapping: Su,
  Uint16Attribute: yF,
  Uint16BufferAttribute: Lu,
  Uint32Attribute: xF,
  Uint32BufferAttribute: Ru,
  Uint8Attribute: mF,
  Uint8BufferAttribute: gx,
  Uint8ClampedAttribute: gF,
  Uint8ClampedBufferAttribute: vx,
  Uniform: Wu,
  UniformsLib: Ue,
  UniformsUtils: _x,
  UnsignedByteType: Ps,
  UnsignedInt248Type: To,
  UnsignedIntType: Va,
  UnsignedShort4444Type: db,
  UnsignedShort5551Type: fb,
  UnsignedShort565Type: pb,
  UnsignedShortType: el,
  VSMShadowMap: wo,
  Vector2: Re,
  Vector3: q,
  Vector4: xt,
  VectorKeyframeTrack: qo,
  Vertex: dF,
  VertexColors: iF,
  VideoTexture: Fx,
  WebGL1Renderer: Dx,
  WebGLCubeRenderTarget: Ou,
  WebGLMultipleRenderTargets: fx,
  WebGLMultisampleRenderTarget: Jf,
  WebGLRenderTarget: gi,
  WebGLRenderTargetCube: LF,
  WebGLRenderer: Mt,
  WebGLUtils: Ix,
  WireframeGeometry: up,
  WireframeHelper: EF,
  WrapAroundEnding: tl,
  XHRLoader: AF,
  ZeroCurvatureEnding: xs,
  ZeroFactor: Vy,
  ZeroSlopeEnding: ws,
  ZeroStencilOp: PP,
  sRGBEncoding: Is
}, Symbol.toStringTag, { value: "Module" }));
var NF = xu(DF);
function BF(n, e) {
  if (!(n instanceof e))
    throw new TypeError("Cannot call a class as a function");
}
function FF(n, e) {
  for (var t = 0; t < e.length; t++) {
    var i = e[t];
    i.enumerable = i.enumerable || false, i.configurable = true, "value" in i && (i.writable = true), Object.defineProperty(n, i.key, i);
  }
}
function zF(n, e, t) {
  return e && FF(n.prototype, e), n;
}
function UF(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: true,
      configurable: true
    }
  }), e && Gd(n, e);
}
function iu(n) {
  return iu = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) {
    return t.__proto__ || Object.getPrototypeOf(t);
  }, iu(n);
}
function Gd(n, e) {
  return Gd = Object.setPrototypeOf || function(i, r) {
    return i.__proto__ = r, i;
  }, Gd(n, e);
}
function VF() {
  if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return false;
  if (typeof Proxy == "function") return true;
  try {
    return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    })), true;
  } catch {
    return false;
  }
}
function kF(n) {
  if (n === void 0)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return n;
}
function GF(n, e) {
  return e && (typeof e == "object" || typeof e == "function") ? e : kF(n);
}
function HF(n) {
  var e = VF();
  return function() {
    var i = iu(n), r;
    if (e) {
      var s = iu(this).constructor;
      r = Reflect.construct(i, arguments, s);
    } else
      r = i.apply(this, arguments);
    return GF(this, r);
  };
}
function Dv(n, e) {
  return jF(n) || ZF(n, e) || _w(n, e) || YF();
}
function Rc(n) {
  return WF(n) || $F(n) || _w(n) || XF();
}
function WF(n) {
  if (Array.isArray(n)) return Hd(n);
}
function jF(n) {
  if (Array.isArray(n)) return n;
}
function $F(n) {
  if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n);
}
function ZF(n, e) {
  var t = n && (typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"]);
  if (t != null) {
    var i = [], r = true, s = false, o, a;
    try {
      for (t = t.call(n); !(r = (o = t.next()).done) && (i.push(o.value), !(e && i.length === e)); r = true)
        ;
    } catch (c) {
      s = true, a = c;
    } finally {
      try {
        !r && t.return != null && t.return();
      } finally {
        if (s) throw a;
      }
    }
    return i;
  }
}
function _w(n, e) {
  if (n) {
    if (typeof n == "string") return Hd(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 Hd(n, e);
  }
}
function Hd(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 XF() {
  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 YF() {
  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 Ra = typeof window < "u" && window.THREE ? window.THREE : {
  LinearFilter: Ut,
  Sprite: El,
  SpriteMaterial: Tl,
  Texture: Jt
};
var JF = function(n) {
  UF(t, n);
  var e = HF(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 BF(this, t), i = e.call(this, new Ra.SpriteMaterial({
      map: new Ra.Texture()
    })), i._text = "".concat(r), i._textHeight = s, i._color = o, i._backgroundColor = false, 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 = Ra.LinearFilter, i._genCanvas(), i;
  }
  return zF(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(_) {
        return _ * r.fontSize * 0.1;
      }), l = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius], d = l.map(function(_) {
        return _ * r.fontSize * 0.1;
      }), h4 = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding], f = h4.map(function(_) {
        return _ * 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, Rc(g.map(function(_) {
        return o.measureText(_).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, Rc(c)), M = x / 2;
          o.lineWidth = x, o.beginPath(), [!!d[0] && [d[0], M, M, d[0]], !!d[1] && [s.width - d[1], s.width - M, M, d[1]], !!d[2] && [s.width - d[2], s.width - M, s.height - M, s.height - d[2]], !!d[3] && [d[3], M, s.height - M, s.height - d[3]]].filter(function(_) {
            return _;
          }).forEach(function(_) {
            var E = Dv(_, 4), P = E[0], S = E[1], R = E[2], A = E[3];
            o.moveTo(P, R), o.quadraticCurveTo(S, R, S, A);
          }), 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(_) {
        var E = Dv(_, 6), P = E[0], S = E[1], R = E[2], A = E[3], C = E[4], L = E[5];
        o.quadraticCurveTo(P, A, S, C), o.lineTo(R, L);
      }), o.closePath(), o.fill()) : o.fillRect(c[0], c[1], s.width - c[0] * 2, s.height - c[1] * 2)), o.translate.apply(o, Rc(c)), o.translate.apply(o, Rc(f)), o.font = p, o.fillStyle = this.color, o.textBaseline = "bottom";
      var T = this.strokeWidth > 0;
      T && (o.lineWidth = this.strokeWidth * this.fontSize / 10, o.strokeStyle = this.strokeColor), g.forEach(function(_, E) {
        var P = (u - o.measureText(_).width) / 2, S = (E + 1) * r.fontSize;
        T && o.strokeText(_, P, S), o.fillText(_, P, S);
      }), this._texture.image = s, this._texture.needsUpdate = true;
      var w = this.textHeight * g.length + a[1] * 2 + h4[1] * 2;
      this.scale.set(w * s.width / s.height, w, 0);
    }
  }, {
    key: "clone",
    value: function() {
      return new this.constructor(this.text, this.textHeight, this.color).copy(this);
    }
  }, {
    key: "copy",
    value: function(r) {
      return Ra.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;
}(Ra.Sprite);
var KF = Object.freeze(Object.defineProperty({
  __proto__: null,
  default: JF
}, Symbol.toStringTag, { value: "Module" }));
var qF = xu(KF);
var kh = { exports: {} };
var Nv;
function QF() {
  return Nv || (Nv = 1, function(n, e) {
    (function(t, i) {
      n.exports = i();
    })(typeof window < "u" ? window : Nr, 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, h4) {
        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++)
            h4(d[p]);
        else
          h4(d);
      }
      function o(d) {
        if (!d.getBoundingClientRect)
          return {
            width: d.offsetWidth,
            height: d.offsetHeight
          };
        var h4 = d.getBoundingClientRect();
        return {
          width: Math.round(h4.width),
          height: Math.round(h4.height)
        };
      }
      function a(d, h4) {
        Object.keys(h4).forEach(function(f) {
          d.style[f] = h4[f];
        });
      }
      var c = function(d, h4) {
        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 M = document.createElement("div");
            a(M, m), x.appendChild(M);
            var T = document.createElement("div");
            T.className = "resize-sensor-shrink", a(T, v);
            var w = document.createElement("div");
            a(w, m), a(w, { width: "200%", height: "200%" }), T.appendChild(w), u.resizeSensor.appendChild(x), u.resizeSensor.appendChild(T), u.appendChild(u.resizeSensor);
            var _ = window.getComputedStyle(u), E = _ ? _.getPropertyValue("position") : null;
            E !== "absolute" && E !== "relative" && E !== "fixed" && E !== "sticky" && (u.style.position = "relative");
            var P = false, S = 0, R = o(u), A = 0, C = 0, L = true;
            f = 0;
            var I = function() {
              var U = u.offsetWidth, V = u.offsetHeight;
              M.style.width = U + 10 + "px", M.style.height = V + 10 + "px", x.scrollLeft = U + 10, x.scrollTop = V + 10, T.scrollLeft = U + 10, T.scrollTop = V + 10;
            }, b = function() {
              if (L) {
                var U = u.offsetWidth === 0 && u.offsetHeight === 0;
                if (U) {
                  f || (f = i(function() {
                    f = 0, b();
                  }));
                  return;
                } else
                  L = false;
              }
              I();
            };
            u.resizeSensor.resetSensor = b;
            var O = function() {
              S = 0, P && (A = R.width, C = R.height, u.resizedAttached && u.resizedAttached.call(R));
            }, N = function() {
              R = o(u), P = R.width !== A || R.height !== C, P && !S && (S = i(O)), b();
            }, D = function(U, V, H) {
              U.attachEvent ? U.attachEvent("on" + V, H) : U.addEventListener(V, H);
            };
            D(x, "scroll", N), D(T, "scroll", N), f = i(function() {
              f = 0, b();
            });
          }
        }
        s(d, function(u) {
          p(u, h4);
        }), 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(h4) {
          h4.resizeSensor.resetSensor();
        });
      }, c.detach = function(d, h4) {
        s(d, function(f) {
          f && (f.resizedAttached && typeof h4 == "function" && (f.resizedAttached.remove(h4), 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 h4 in d)
            if (d.hasOwnProperty(h4))
              for (var f = d[h4].addedNodes, g = 0; g < f.length; g++)
                f[g].resizeSensor && c.reset(f[g]);
        });
        document.addEventListener("DOMContentLoaded", function(d) {
          l.observe(document.body, {
            childList: true,
            subtree: true
          });
        });
      }
      return c;
    });
  }(kh)), kh.exports;
}
var ez = class extends xn {
  constructor(e) {
    super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) {
      return new rz(t);
    }), this.register(function(t) {
      return new oz(t);
    }), this.register(function(t) {
      return new az(t);
    }), this.register(function(t) {
      return new sz(t);
    }), this.register(function(t) {
      return new nz(t);
    }), this.register(function(t) {
      return new lz(t);
    });
  }
  load(e, t, i, r) {
    const s = this;
    let o;
    this.resourcePath !== "" ? o = this.resourcePath : this.path !== "" ? o = this.path : o = ar.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 Yn(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 (ar.decodeText(new Uint8Array(e, 0, 4)) === Sw) {
      try {
        o[mt.KHR_BINARY_GLTF] = new cz(e);
      } catch (h4) {
        r && r(h4);
        return;
      }
      s = o[mt.KHR_BINARY_GLTF].content;
    } else
      s = ar.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 bz(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 h4 = this.pluginCallbacks[d](l);
      a[h4.name] = h4, o[h4.name] = true;
    }
    if (c.extensionsUsed)
      for (let d = 0; d < c.extensionsUsed.length; ++d) {
        const h4 = c.extensionsUsed[d], f = c.extensionsRequired || [];
        switch (h4) {
          case mt.KHR_MATERIALS_UNLIT:
            o[h4] = new iz();
            break;
          case mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
            o[h4] = new dz();
            break;
          case mt.KHR_DRACO_MESH_COMPRESSION:
            o[h4] = new uz(c, this.dracoLoader);
            break;
          case mt.KHR_TEXTURE_TRANSFORM:
            o[h4] = new hz();
            break;
          case mt.KHR_MESH_QUANTIZATION:
            o[h4] = new fz();
            break;
          default:
            f.indexOf(h4) >= 0 && a[h4] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h4 + '".');
        }
      }
    l.setExtensions(o), l.setPlugins(a), l.parse(i, r);
  }
};
function tz() {
  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 = {};
    }
  };
}
var mt = {
  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"
};
var nz = class {
  constructor(e) {
    this.parser = e, this.name = mt.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 Fe(16777215);
    c.color !== void 0 && d.fromArray(c.color);
    const h4 = c.range !== void 0 ? c.range : 0;
    switch (c.type) {
      case "directional":
        l = new Hu(d), l.target.position.set(0, 0, -1), l.add(l.target);
        break;
      case "point":
        l = new Gu(d), l.distance = h4;
        break;
      case "spot":
        l = new ku(d), l.distance = h4, 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);
    });
  }
};
var iz = class {
  constructor() {
    this.name = mt.KHR_MATERIALS_UNLIT;
  }
  getMaterialType() {
    return Bn;
  }
  extendParams(e, t, i) {
    const r = [];
    e.color = new Fe(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);
  }
};
var rz = class {
  constructor(e) {
    this.parser = e, this.name = mt.KHR_MATERIALS_CLEARCOAT;
  }
  getMaterialType(e) {
    const i = this.parser.json.materials[e];
    return !i.extensions || !i.extensions[this.name] ? null : Ol;
  }
  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);
  }
};
var sz = class {
  constructor(e) {
    this.parser = e, this.name = mt.KHR_MATERIALS_TRANSMISSION;
  }
  getMaterialType(e) {
    const i = this.parser.json.materials[e];
    return !i.extensions || !i.extensions[this.name] ? null : Ol;
  }
  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);
  }
};
var oz = class {
  constructor(e) {
    this.parser = e, this.name = mt.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);
  }
};
var az = class {
  constructor(e) {
    this.parser = e, this.name = mt.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;
  }
};
var lz = class {
  constructor(e) {
    this.name = mt.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, h4 = r.byteStride, f = new ArrayBuffer(d * h4), g = new Uint8Array(a[0], c, l);
        return o.decodeGltfBuffer(new Uint8Array(f), d, h4, g, r.mode, r.filter), f;
      });
    } else
      return null;
  }
};
var Sw = "glTF";
var Pa = 12;
var Bv = { JSON: 1313821514, BIN: 5130562 };
var cz = class {
  constructor(e) {
    this.name = mt.KHR_BINARY_GLTF, this.content = null, this.body = null;
    const t = new DataView(e, 0, Pa);
    if (this.header = {
      magic: ar.decodeText(new Uint8Array(e.slice(0, 4))),
      version: t.getUint32(4, true),
      length: t.getUint32(8, true)
    }, this.header.magic !== Sw)
      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 - Pa, r = new DataView(e, Pa);
    let s = 0;
    for (; s < i; ) {
      const o = r.getUint32(s, true);
      s += 4;
      const a = r.getUint32(s, true);
      if (s += 4, a === Bv.JSON) {
        const c = new Uint8Array(e, Pa + s, o);
        this.content = ar.decodeText(c);
      } else if (a === Bv.BIN) {
        const c = Pa + s;
        this.body = e.slice(c, c + o);
      }
      s += o;
    }
    if (this.content === null)
      throw new Error("THREE.GLTFLoader: JSON content not found.");
  }
};
var uz = class {
  constructor(e, t) {
    if (!t)
      throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
    this.name = mt.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 h4 = jd[d] || d.toLowerCase();
      a[h4] = o[d];
    }
    for (const d in e.attributes) {
      const h4 = jd[d] || d.toLowerCase();
      if (o[d] !== void 0) {
        const f = i.accessors[e.attributes[d]], g = ll[f.componentType];
        l[h4] = g, c[h4] = f.normalized === true;
      }
    }
    return t.getDependency("bufferView", s).then(function(d) {
      return new Promise(function(h4) {
        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);
          }
          h4(f);
        }, a, l);
      });
    });
  }
};
var hz = class {
  constructor() {
    this.name = mt.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 = true), e;
  }
};
var Wd = class extends js {
  constructor(e) {
    super(), this.isGLTFSpecularGlossinessMaterial = true;
    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 Fe().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;
  }
};
var dz = class {
  constructor() {
    this.name = mt.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 Wd;
  }
  extendParams(e, t, i) {
    const r = t.extensions[this.name];
    e.color = new Fe(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 Fe(0, 0, 0), e.glossiness = r.glossinessFactor !== void 0 ? r.glossinessFactor : 1, e.specular = new Fe(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 Wd(e);
    return t.fog = true, 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 = es, 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;
  }
};
var fz = class {
  constructor() {
    this.name = mt.KHR_MESH_QUANTIZATION;
  }
};
var ea = class extends zi {
  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;
  }
};
ea.prototype.beforeStart_ = ea.prototype.copySampleValue_;
ea.prototype.afterEnd_ = ea.prototype.copySampleValue_;
ea.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, h4 = d * d, f = h4 * d, g = n * c, p = g - c, u = -2 * f + 3 * h4, y = f - h4, v = 1 - u, m = y - h4 + d;
  for (let x = 0; x !== o; x++) {
    const M = s[p + x + o], T = s[p + x + a] * l, w = s[g + x + o], _ = s[g + x] * l;
    r[x] = v * M + m * T + u * w + y * _;
  }
  return r;
};
var Ji = {
  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
};
var ll = {
  5120: Int8Array,
  5121: Uint8Array,
  5122: Int16Array,
  5123: Uint16Array,
  5125: Uint32Array,
  5126: Float32Array
};
var Fv = {
  9728: $t,
  9729: Ut,
  9984: qa,
  9985: Tu,
  9986: Qa,
  9987: yr
};
var zv = {
  33071: hn2,
  33648: No,
  10497: Yr
};
var Uv = {
  SCALAR: 1,
  VEC2: 2,
  VEC3: 3,
  VEC4: 4,
  MAT2: 4,
  MAT3: 9,
  MAT4: 16
};
var jd = {
  POSITION: "position",
  NORMAL: "normal",
  TANGENT: "tangent",
  TEXCOORD_0: "uv",
  TEXCOORD_1: "uv2",
  COLOR_0: "color",
  WEIGHTS_0: "skinWeight",
  JOINTS_0: "skinIndex"
};
var Rr = {
  scale: "scale",
  translation: "position",
  rotation: "quaternion",
  weights: "morphTargetInfluences"
};
var pz = {
  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: Os,
  STEP: Fo
};
var Gh = {
  OPAQUE: "OPAQUE",
  MASK: "MASK",
  BLEND: "BLEND"
};
function Vv(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 mz(n) {
  return n.DefaultMaterial === void 0 && (n.DefaultMaterial = new js({
    color: 16777215,
    emissive: 0,
    metalness: 1,
    roughness: 1,
    transparent: false,
    depthTest: true,
    side: Zr
  })), n.DefaultMaterial;
}
function Oa(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 vs(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 gz(n, e, t) {
  let i = false, r = false;
  for (let a = 0, c = e.length; a < c; a++) {
    const l = e[a];
    if (l.POSITION !== void 0 && (i = true), l.NORMAL !== void 0 && (r = true), 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 = true, n;
  });
}
function vz(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 yz(n) {
  const e = n.extensions && n.extensions[mt.KHR_DRACO_MESH_COMPRESSION];
  let t;
  return e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + kv(e.attributes) : t = n.indices + ":" + kv(n.attributes) + ":" + n.mode, t;
}
function kv(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 $d(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.");
  }
}
var bz = class {
  constructor(e = {}, t = {}) {
    this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new tz(), 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) === false ? this.textureLoader = new Lp(this.options.manager) : this.textureLoader = new wp(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Yn(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(true);
  }
  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: {}
      };
      Oa(s, a, r), vs(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 = true;
    }
    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 = true)), 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[mt.KHR_BINARY_GLTF].body);
    const r = this.options;
    return new Promise(function(s, o) {
      i.load(Vv(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 = Uv[r.type], l = ll[r.componentType], d = l.BYTES_PER_ELEMENT, h4 = d * c, f = r.byteOffset || 0, g = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, p = r.normalized === true;
      let u, y;
      if (g && g !== h4) {
        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 is(u, g / d), t.cache.add(m, x)), y = new dr(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 rt(u, c, p);
      if (r.sparse !== void 0) {
        const v = Uv.SCALAR, m = ll[r.sparse.indices.componentType], x = r.sparse.indices.byteOffset || 0, M = r.sparse.values.byteOffset || 0, T = new m(o[1], x, r.sparse.count * v), w = new l(o[2], M, r.sparse.count * c);
        a !== null && (y = new rt(y.array.slice(), y.itemSize, y.normalized));
        for (let _ = 0, E = T.length; _ < E; _++) {
          const P = T[_];
          if (y.setX(P, w[_ * c]), c >= 2 && y.setY(P, w[_ * c + 1]), c >= 3 && y.setZ(P, w[_ * c + 2]), c >= 4 && y.setW(P, w[_ * 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 || "", h4 = false, f = true;
    const g = d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0;
    if ((t.mimeType === "image/jpeg" || g) && (f = false), 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, false);
          f = v === 6 || v === 4 || v === 3;
        }
        h4 = true;
        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 === true && (m = function(x) {
          const M = new Jt(x);
          M.needsUpdate = true, y(M);
        }), i.load(Vv(u, o.path), m, void 0, v);
      });
    }).then(function(u) {
      h4 === true && l.revokeObjectURL(d), u.flipY = false, a.name && (u.name = a.name), f || (u.format = or);
      const v = (s.samplers || {})[a.sampler] || {};
      return u.magFilter = Fv[v.magFilter] || Ut, u.minFilter = Fv[v.minFilter] || yr, u.wrapS = zv[v.wrapS] || Yr, u.wrapT = zv[v.wrapT] || Yr, 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[mt.KHR_TEXTURE_TRANSFORM]) {
        const o = i.extensions !== void 0 ? i.extensions[mt.KHR_TEXTURE_TRANSFORM] : void 0;
        if (o) {
          const a = r.associations.get(s);
          s = r.extensions[mt.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 rs(), en.prototype.copy.call(d, i), d.color.copy(i.color), d.map = i.map, d.sizeAttenuation = false, 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 on(), en.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 = true), o && (d.flatShading = true), a && (d.morphTargets = true), c && (d.morphNormals = true), r && (d.vertexTangents = true, 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 js;
  }
  /**
   * 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[mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
      const h4 = r[mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
      o = h4.getMaterialType(), l.push(h4.extendParams(a, s, t));
    } else if (c[mt.KHR_MATERIALS_UNLIT]) {
      const h4 = r[mt.KHR_MATERIALS_UNLIT];
      o = h4.getMaterialType(), l.push(h4.extendParams(a, s, t));
    } else {
      const h4 = s.pbrMetallicRoughness || {};
      if (a.color = new Fe(1, 1, 1), a.opacity = 1, Array.isArray(h4.baseColorFactor)) {
        const f = h4.baseColorFactor;
        a.color.fromArray(f), a.opacity = f[3];
      }
      h4.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", h4.baseColorTexture)), a.metalness = h4.metallicFactor !== void 0 ? h4.metallicFactor : 1, a.roughness = h4.roughnessFactor !== void 0 ? h4.roughnessFactor : 1, h4.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", h4.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", h4.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 === true && (a.side = Xr);
    const d = s.alphaMode || Gh.OPAQUE;
    return d === Gh.BLEND ? (a.transparent = true, a.depthWrite = false) : (a.transparent = false, d === Gh.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== Bn && (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 !== Bn && (l.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== Bn && (a.emissive = new Fe().fromArray(s.emissiveFactor)), s.emissiveTexture !== void 0 && o !== Bn && l.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture)), Promise.all(l).then(function() {
      let h4;
      return o === Wd ? h4 = r[mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a) : h4 = new o(a), s.name && (h4.name = s.name), h4.map && (h4.map.encoding = Is), h4.emissiveMap && (h4.emissiveMap.encoding = Is), vs(h4, s), t.associations.set(h4, { type: "materials", index: e }), s.extensions && Oa(r, h4, s), h4;
    });
  }
  /** When Object3D instances are targeted by animation, they need unique names. */
  createUniqueName(e) {
    const t = pt.sanitizeNodeName(e || "");
    let i = t;
    for (let r = 1; this.nodeNamesUsed[i]; ++r)
      i = t + "_" + r;
    return this.nodeNamesUsed[i] = true, 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[mt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) {
        return Gv(c, a, t);
      });
    }
    const o = [];
    for (let a = 0, c = e.length; a < c; a++) {
      const l = e[a], d = yz(l), h4 = r[d];
      if (h4)
        o.push(h4.promise);
      else {
        let f;
        l.extensions && l.extensions[mt.KHR_DRACO_MESH_COMPRESSION] ? f = s(l) : f = Gv(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 ? mz(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], h4 = [];
      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 === Ji.TRIANGLES || y.mode === Ji.TRIANGLE_STRIP || y.mode === Ji.TRIANGLE_FAN || y.mode === void 0)
          v = s.isSkinnedMesh === true ? new Al(u, m) : new Yt(u, m), v.isSkinnedMesh === true && !v.geometry.attributes.skinWeight.normalized && v.normalizeSkinWeights(), y.mode === Ji.TRIANGLE_STRIP ? v.geometry = Hv(v.geometry, sx) : y.mode === Ji.TRIANGLE_FAN && (v.geometry = Hv(v.geometry, jf));
        else if (y.mode === Ji.LINES)
          v = new On(u, m);
        else if (y.mode === Ji.LINE_STRIP)
          v = new Bi(u, m);
        else if (y.mode === Ji.LINE_LOOP)
          v = new Bu(u, m);
        else if (y.mode === Ji.POINTS)
          v = new ha(u, m);
        else
          throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode);
        Object.keys(v.geometry.morphAttributes).length > 0 && vz(v, s), v.name = t.createUniqueName(s.name || "mesh_" + e), vs(v, s), y.extensions && Oa(r, v, y), t.assignFinalMaterial(v), h4.push(v);
      }
      if (h4.length === 1)
        return h4[0];
      const f = new Ci();
      for (let g = 0, p = h4.length; g < p; g++)
        f.add(h4[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(Bd.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new fa(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), vs(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 h4 = i.channels[l], f = i.samplers[h4.sampler], g = h4.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], h4 = 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], M = h4[v], T = f[v], w = g[v], _ = p[v];
        if (x === void 0) continue;
        x.updateMatrix(), x.matrixAutoUpdate = true;
        let E;
        switch (Rr[_.path]) {
          case Rr.weights:
            E = Ko;
            break;
          case Rr.rotation:
            E = Zs;
            break;
          case Rr.position:
          case Rr.scale:
          default:
            E = qo;
            break;
        }
        const P = x.name ? x.name : x.uuid, S = w.interpolation !== void 0 ? pz[w.interpolation] : Os, R = [];
        Rr[_.path] === Rr.weights ? x.traverse(function(C) {
          C.isMesh === true && C.morphTargetInfluences && R.push(C.name ? C.name : C.uuid);
        }) : R.push(P);
        let A = T.array;
        if (T.normalized) {
          const C = $d(A.constructor), L = new Float32Array(A.length);
          for (let I = 0, b = A.length; I < b; I++)
            L[I] = A[I] * C;
          A = L;
        }
        for (let C = 0, L = R.length; C < L; C++) {
          const I = new E(
            R[C] + "." + Rr[_.path],
            M.array,
            A,
            S
          );
          w.interpolation === "CUBICSPLINE" && (I.createInterpolant = function(O) {
            return new ea(this.times, this.values, this.getValueSize() / 3, O);
          }, I.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true), u.push(I);
        }
      }
      const y = i.name ? i.name : "animation_" + e;
      return new Qo(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 === true ? c = new Cl() : a.length > 1 ? c = new Ci() : a.length === 1 ? c = a[0] : c = new lt(), 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), vs(c, s), s.extensions && Oa(i, c, s), s.matrix !== void 0) {
        const l = new Ze();
        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 Ci();
    r.name && (o.name = s.createUniqueName(r.name)), vs(o, r), r.extensions && Oa(i, o, r);
    const a = r.nodes || [], c = [];
    for (let l = 0, d = a.length; l < d; l++)
      c.push(Tw(a[l], o, t, s));
    return Promise.all(c).then(function() {
      return o;
    });
  }
};
function Tw(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 h4 = 0, f = a.length; h4 < f; h4++) {
          const g = a[h4];
          if (g) {
            l.push(g);
            const p = new Ze();
            o.inverseBindMatrices !== void 0 && p.fromArray(o.inverseBindMatrices.array, h4 * 16), d.push(p);
          } else
            console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', o.joints[h4]);
        }
        c.bind(new Ll(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(Tw(d, s, t, i));
      }
    }
    return Promise.all(o);
  });
}
function xz(n, e, t) {
  const i = e.attributes, r = new Un();
  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 = $d(ll[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 h4 = s[l];
      if (h4.POSITION !== void 0) {
        const f = t.json.accessors[h4.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 = $d(ll[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 br();
  r.getCenter(o.center), o.radius = r.min.distanceTo(r.max) / 2, n.boundingSphere = o;
}
function Gv(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 = jd[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 vs(n, e), xz(n, e, t), Promise.all(r).then(function() {
    return e.targets !== void 0 ? gz(n, e.targets, t) : n;
  });
}
function Hv(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 === jf)
    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;
}
var wz = Object.freeze(Object.defineProperty({
  __proto__: null,
  GLTFLoader: ez
}, Symbol.toStringTag, { value: "Module" }));
var Mz = xu(wz);
var Hh = { exports: {} };
var Wv;
function _z() {
  return Wv || (Wv = 1, function(n) {
    function e(l) {
      var d = {};
      function h4(g) {
        if (d[g])
          return d[g].exports;
        var p = d[g] = {
          /******/
          i: g,
          /******/
          l: false,
          /******/
          exports: {}
          /******/
        };
        return l[g].call(p.exports, p, p.exports, h4), p.l = true, p.exports;
      }
      h4.m = l, h4.c = d, h4.i = function(g) {
        return g;
      }, h4.d = function(g, p, u) {
        h4.o(g, p) || Object.defineProperty(g, p, {
          /******/
          configurable: false,
          /******/
          enumerable: true,
          /******/
          get: u
          /******/
        });
      }, h4.r = function(g) {
        Object.defineProperty(g, "__esModule", { value: true });
      }, h4.n = function(g) {
        var p = g && g.__esModule ? (
          /******/
          function() {
            return g.default;
          }
        ) : (
          /******/
          function() {
            return g;
          }
        );
        return h4.d(p, "a", p), p;
      }, h4.o = function(g, p) {
        return Object.prototype.hasOwnProperty.call(g, p);
      }, h4.p = "/", h4.oe = function(g) {
        throw console.error(g), g;
      };
      var f = h4(h4.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, h4) {
      var f = {};
      f[h4] = [];
      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[h4].push(v[3]);
      for (y = new RegExp("\\(" + r(u) + '\\("(dll-reference\\s(' + t + '))"\\)\\)' + i, "g"); v = y.exec(g); )
        l[v[2]] || (f[h4].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 M = 0; M < f[m[x]].length; M++)
          s(f[m[x]][M]) && (f[m[x]][M] = 1 * f[m[x]][M]);
      return f;
    }
    function a(l) {
      var d = Object.keys(l);
      return d.reduce(function(h4, f) {
        return h4 || l[f].length > 0;
      }, false);
    }
    function c(l, d) {
      for (var h4 = {
        main: [d]
      }, f = {
        main: []
      }, g = {
        main: {}
      }; a(h4); )
        for (var p = Object.keys(h4), u = 0; u < p.length; u++) {
          var y = p[u], v = h4[y], m = v.pop();
          if (g[y] = g[y] || {}, !(g[y][m] || !l[y][m])) {
            g[y][m] = true, f[y] = f[y] || [], f[y].push(m);
            for (var x = o(l, l[y][m], y), M = Object.keys(x), T = 0; T < M.length; T++)
              h4[M[T]] = h4[M[T]] || [], h4[M[T]] = h4[M[T]].concat(x[M[T]]);
          }
        }
      return f;
    }
    n.exports = function(l, d) {
      d = d || {};
      var h4 = {
        main: __webpack_modules__
      }, f = d.all ? { main: Object.keys(h4.main) } : c(h4, 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), h4[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(M) {
          return "" + JSON.stringify(M) + ": " + h4[m][M].toString();
        }).join(",") + `});
`;
      }), g = g + "new ((" + e.toString().replace("ENTRY_MODULE", JSON.stringify(l)) + ")({" + f.main.map(function(m) {
        return "" + JSON.stringify(m) + ": " + h4.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;
    };
  }(Hh)), Hh.exports;
}
function Sz(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 Tz(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(h4) {
              o(c, h4);
            },
            function(h4) {
              r[c] = { status: "rejected", reason: h4 }, --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 Ew(n, e) {
  this.name = "AggregateError", this.errors = n, this.message = e || "";
}
Ew.prototype = Error.prototype;
function Ez(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 Ew(
              s,
              "All promises were rejected"
            )
          );
        });
      } catch (a) {
        i(a);
      }
  });
}
var Az = setTimeout;
function Aw(n) {
  return !!(n && typeof n.length < "u");
}
function Cz() {
}
function Lz(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 = false, this._value = void 0, this._deferreds = [], Lw(n, this);
}
function Cw(n, e) {
  for (; n._state === 3; )
    n = n._value;
  if (n._state === 0) {
    n._deferreds.push(e);
    return;
  }
  n._handled = true, Dt._immediateFn(function() {
    var t = n._state === 1 ? e.onFulfilled : e.onRejected;
    if (t === null) {
      (n._state === 1 ? Zd : cl)(e.promise, n._value);
      return;
    }
    var i;
    try {
      i = t(n._value);
    } catch (r) {
      cl(e.promise, r);
      return;
    }
    Zd(e.promise, i);
  });
}
function Zd(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, Xd(n);
        return;
      } else if (typeof t == "function") {
        Lw(Lz(t, e), n);
        return;
      }
    }
    n._state = 1, n._value = e, Xd(n);
  } catch (i) {
    cl(n, i);
  }
}
function cl(n, e) {
  n._state = 2, n._value = e, Xd(n);
}
function Xd(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++)
    Cw(n, n._deferreds[e]);
  n._deferreds = null;
}
function Rz(n, e, t) {
  this.onFulfilled = typeof n == "function" ? n : null, this.onRejected = typeof e == "function" ? e : null, this.promise = t;
}
function Lw(n, e) {
  var t = false;
  try {
    n(
      function(i) {
        t || (t = true, Zd(e, i));
      },
      function(i) {
        t || (t = true, cl(e, i));
      }
    );
  } catch (i) {
    if (t) return;
    t = true, cl(e, i);
  }
}
Dt.prototype.catch = function(n) {
  return this.then(null, n);
};
Dt.prototype.then = function(n, e) {
  var t = new this.constructor(Cz);
  return Cw(this, new Rz(n, e, t)), t;
};
Dt.prototype.finally = Sz;
Dt.all = function(n) {
  return new Dt(function(e, t) {
    if (!Aw(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 = Ez;
Dt.allSettled = Tz;
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 (!Aw(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) {
  Az(n, 0);
};
Dt._unhandledRejectionFn = function(e) {
  typeof console < "u" && console && console.warn("Possible Unhandled Promise Rejection:", e);
};
var Pz = Object.freeze(Object.defineProperty({
  __proto__: null,
  default: Dt
}, Symbol.toStringTag, { value: "Module" }));
var Oz = xu(Pz);
(function(n, e) {
  (function(i, r) {
    n.exports = r();
  })(Nr, () => (
    /******/
    (() => {
      var t = [
        /* 0 */
        /***/
        (o, a, c) => {
          c(1);
          var l = c(2), d = l.version, h4 = 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(50).GeometryCSG, this.GlyphsetCSG = c(56).GlyphsetCSG, this.Viewport = c(43).Viewport, this.CameraControls = c(43).CameraControls, this.SmoothCameraTransition = c(43).SmoothCameraTransition, this.RayCaster = c(43).RayCaster, this.CameraAutoTumble = c(43).CameraAutoTumble, this.StereoEffect = c(43).StereoEffect, this.loadExternalFile = c(5).loadExternalFile, this.loadExternalFiles = c(5).loadExternalFiles, this.THREE = c(4);
          };
          o.exports = new h4();
        },
        /* 1 */
        /***/
        (o) => {
          o.exports = wP();
        },
        /* 2 */
        /***/
        (o) => {
          o.exports = JSON.parse('{"name":"zincjs","version":"1.12.1","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, h4 = (g, p, u) => {
            var y = d(g, u), v = false;
            1 > u.opacity && (v = true);
            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 M = y._video.createCanvasVideoTexture();
              m = new l.MeshBasicMaterial({ morphTargets: u.localTimeEnabled, color: new l.Color(1, 1, 1), transparent: v, opacity: u.opacity, map: M, 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 = true, this.createMesh = (g, p, u) => {
              if (!(this.morph && this.morph.geometry && g != null)) {
                var y = h4(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], M = 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((M.x + u.x) / y.x, (M.y + u.y) / y.y)]);
              }
              geometry.uvsNeedUpdate = true;
            }, 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 = true, u.geometry.computeBoundingBox(), u.geometry.computeBoundingSphere(), this.boundingBoxUpdateRequired = true;
              }
            };
          };
          f.prototype = Object.create(c(10).ZincObject.prototype), a.Geometry = f;
        },
        /* 4 */
        /***/
        (o) => {
          o.exports = NF;
        },
        /* 5 */
        /***/
        (o, a, c) => {
          function l(E) {
            throw new TypeError('"' + E + '" is read-only');
          }
          var d = c(4), h4 = c(6).Geometry, f = c(7).default;
          function g(E) {
            var P = E, S = c(0).modelPrefix;
            return S && (S[S.length - 1] != "/" && l("prefix"), /^(?:[a-z]+:)?\/\//i.test(E) || (P = S + E)), P;
          }
          function p(E, P) {
            var S = (A, C) => {
              try {
                var L = new URL(A, C).href;
                if (A && 2 > A.split("?").length) {
                  var I = C.split("?");
                  I.length === 2 && (L = L + "?" + I[1]);
                }
                return L;
              } catch {
                console.error("There is an issue creating the url link with: ".concat(A, "."));
              }
            };
            if (!Array.isArray(E)) return S(E, P);
            var R = [];
            return E.forEach((A) => {
              R.push(S(A, P));
            }), R;
          }
          function u(E, P, S, R, A) {
            var C = E.morphTargetInfluences, L = void 0;
            E.geometry && (L = E.geometry.morphAttributes);
            var I = false;
            if (C && L && L.position) {
              R.set(0, 0, 0), A.set(0, 0, 0);
              for (var b = 0; b < C.length; b++) 0 < C[b] && (I = true, S.setFromArray(L.position[b].array), R.add(S.min.multiplyScalar(C[b])), A.add(S.max.multiplyScalar(C[b])));
              I && P.set(R, A);
            }
            I || P.setFromBufferAttribute(E.geometry.attributes.position), E.updateWorldMatrix(true, true), P.applyMatrix4(E.matrixWorld);
          }
          function y(E, P, S, R) {
            var A = new XMLHttpRequest();
            A.open("GET", g(E), true), A.onreadystatechange = () => {
              A.readyState == 4 && (A.status == 200 ? S(A.responseText, P) : R(E));
            }, A.send(null);
          }
          function v(E, P, S) {
            function R(b, O) {
              L[O] = b, C++, C == A && P(L);
            }
            for (var A = E.length, C = 0, L = [], I = 0; I < A; I++) y(E[I], I, R, S);
          }
          a.getColorsRGB = (E, P) => {
            var S = Math.floor(P / 3), R = P % 3, A = 0;
            R == 0 ? A = E[S].r : R == 1 ? A = E[S].g : R == 2 && (A = E[S].b);
            var C = new d.Color(A);
            return [C.r, C.g, C.b];
          }, a.updateMorphColorAttribute = function(E, P) {
            if (P && E && E.morphAttributes && E.morphAttributes.color) {
              var S = E.morphAttributes.color, R = P.morphTargetInfluences, A = R.length;
              E.deleteAttribute("morphColor0"), E.deleteAttribute("morphColor1");
              for (var C = 0, L = [], I = 0; 1 > C || I < A; I++) 0 < R[I] && (C++, L.push([I, R[I]]));
              L.length == 2 ? (E.setAttribute("morphColor0", S[L[0][0]]), E.setAttribute("morphColor1", S[L[1][0]])) : L.length == 1 && (E.setAttribute("morphColor0", S[L[0][0]]), E.setAttribute("morphColor1", S[L[0][0]]));
            }
          }, a.toBufferGeometry = (E, P) => {
            var S;
            return E instanceof h4 ? (P.localTimeEnabled && !E.morphNormalsReady && (E.morphNormals == null || E.morphNormals.length == 0) && E.computeMorphNormals(), S = E.toIndexedBufferGeometry(), P.localMorphColour && m(E, S)) : E instanceof d.BufferGeometry && (S = E.clone()), S.colorsNeedUpdate = true, S.computeBoundingBox(), S.computeBoundingSphere(), E._video && (S._video = E._video), S;
          }, a.copyMorphColorsToBufferGeometry = (E, P) => {
            if (E && E.morphColors && 0 < E.morphColors.length) {
              for (var S = [], R = E.morphColors, A = c(5).getColorsRGB, C = 0, L = R.length; C < L; C++) {
                for (var I = R[C], b = [], O = 0; O < E.faces.length; O++) {
                  var N = E.faces[O], D = A(I.colors, N.a);
                  b.push(D[0], D[1], D[2]), D = A(I.colors, N.b), b.push(D[0], D[1], D[2]), D = A(I.colors, N.c), b.push(D[0], D[1], D[2]);
                }
                var U = new d.Float32BufferAttribute(3 * (3 * E.faces.length), 3);
                U.name = I.name, S.push(U.copyArray(b));
              }
              P.morphAttributes.color = S;
            }
          };
          var m = (E, P) => {
            if (E && E.morphColors && 0 < E.morphColors.length) {
              for (var S = [], R = E.morphColors, A = c(5).getColorsRGB, C = 0, L = R.length; C < L; C++) {
                for (var I, b = R[C], O = [], N = 0; N < 3 * b.colors.length; N++) I = A(b.colors, N), O.push(I[0], I[1], I[2]);
                var D = new d.Float32BufferAttribute(O, 3);
                D.name = b.name, S.push(D);
              }
              P.morphAttributes.color = S;
            }
          };
          a.mergeVertices = function(E) {
            var P = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 1e-4;
            P = Math.max(P, Number.EPSILON);
            for (var S, R = {}, A = E.getIndex(), C = E.getAttribute("position"), L = A ? A.count : C.count, I = 0, b = Object.keys(E.attributes), O = {}, N = {}, me = [], D = ["getX", "getY", "getZ", "getW"], U = 0, V = b.length; U < V; U++) {
              S = b[U], O[S] = [];
              var H = E.morphAttributes[S];
              H && (N[S] = Array(H.length).fill().map(() => []));
            }
            for (var Y = Math.log10(1 / P), re = Math.pow(10, Y), U = 0; U < L; U++) {
              for (var ae = A ? A.getX(U) : U, ee = "", oe = 0, V = b.length; oe < V; oe++) for (var S = b[oe], j = E.getAttribute(S), K = j.itemSize, $ = 0; $ < K; $++)
                ee += "".concat(~~(j[D[$]](ae) * re), ",");
              if (ee in R) me.push(R[ee]);
              else {
                for (var oe = 0, V = b.length; oe < V; oe++) for (var ne, S = b[oe], j = E.getAttribute(S), H = E.morphAttributes[S], K = j.itemSize, k = O[S], W = N[S], $ = 0; $ < K; $++) if (ne = D[$], k.push(j[ne](ae)), H) for (var B = 0, X = H.length; B < X; B++) W[B].push(H[B][ne](ae));
                R[ee] = I, me.push(I), I++;
              }
            }
            for (var J = E.clone(), U = 0, V = b.length; U < V; U++) {
              var j, S = b[U], F = E.getAttribute(S), z = new F.array.constructor(O[S]);
              if (F.isInterleavedBufferAttribute ? j = new d.BufferAttribute(z, F.itemSize, F.itemSize) : (j = E.getAttribute(S).clone(), j.setArray(z)), J.setAttribute(S, j), S in N) for (var te, oe = 0; oe < N[S].length; oe++) te = E.morphAttributes[S][oe].clone(), te.setArray(new te.array.constructor(N[S][oe])), J.morphAttributes[S][oe] = te;
            }
            var se = Uint8Array;
            me.length >= Math.pow(2, 8) && (se = Uint16Array), me.length >= Math.pow(2, 16) && (se = Uint32Array);
            var le = new se(me), me = null;
            return A === null ? me = new d.BufferAttribute(le, 1) : (me = E.getIndex().clone(), me.setArray(le)), J.setIndex(me), J;
          };
          function x(E) {
            if (E.isMeshPhongMaterial) {
              var P = new d.MeshToonMaterial({ color: E.color.clone(), morphTargets: E.morphTargets, morphNormals: E.morphNormals, vertexColors: E.vertexColors, transparent: E.transparent, opacity: E.opacity, side: E.side });
              return E.map && (P.map = E.map), P;
            }
            return E;
          }
          function M(E, P) {
            if (P && E >= P.length) {
              var S = new d.BufferGeometry(), R = new Float32Array(3 * E), A = 0;
              return P.forEach((C) => {
                R[A++] = C[0], R[A++] = C[1], R[A++] = C[2];
              }), S.setAttribute("position", new d.BufferAttribute(R, 3)), S.setDrawRange(0, P.length), S;
            }
          }
          function T() {
            var E = new Image();
            E.src = c(8);
            var P = new d.Texture();
            return P.image = E, P.needsUpdate = true, P;
          }
          function w(E, P, S, R, A, C) {
            var L = new f(E, P, S, R, A, C);
            return L.fontFace = R, L.fontSize = A, L.fontWeight = C, L.material.map.generateMipmaps = false, L.material.map.anisotropy = 4, L.material.sizeAttenuation = false, L.material.alphaTest = 0.5, L.material.transparent = true, L.material.depthWrite = false, L.material.depthTest = false, L.center.set(0.5, -1.2), L.renderOrder = 1e4, L;
          }
          function _(E, P, S) {
            if (S) {
              var R = E || "", A = P || "", C = S.lastIndexOf("/");
              if (-1 < C) {
                var L = void 0, I = void 0;
                if (L = S.substring(0, C), I = S.substring(C + 1), (L === "*" || L === "**" || L.toLowerCase() === R.toLowerCase()) && (I === "*" || I === "**" || I.toLowerCase() === A.toLowerCase())) return true;
              } else if (R.toLowerCase() === S.toLowerCase() || A.toLowerCase() === S.toLowerCase()) return true;
            }
            return false;
          }
          a.getBoundingBox = u, a.createNewURL = p, a.createBufferGeometry = M, a.getCircularTexture = T, a.resolveURL = g, a.loadExternalFile = y, a.loadExternalFiles = v, a.PhongToToon = x, a.createNewSpriteText = w, a.isRegionGroup = _;
        },
        /* 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(), h4 = 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 = false, this.verticesNeedUpdate = false, this.uvsNeedUpdate = false, this.normalsNeedUpdate = false, this.colorsNeedUpdate = false, this.lineDistancesNeedUpdate = false, this.groupsNeedUpdate = false, this.morphNormalsReady = false;
          }
          p.prototype = Object.assign(Object.create(l.EventDispatcher.prototype), {
            constructor: p,
            isGeometry: true,
            applyMatrix4: function(m) {
              for (var x, M = new l.Matrix3().getNormalMatrix(m), T = 0, w = this.vertices.length; T < w; T++) x = this.vertices[T], x.applyMatrix4(m);
              for (var _, E = 0, P = this.faces.length; E < P; E++) {
                _ = this.faces[E], _.normal.applyMatrix3(M).normalize();
                for (var S = 0, R = _.vertexNormals.length; S < R; S++) _.vertexNormals[S].applyMatrix3(M).normalize();
              }
              return this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this.verticesNeedUpdate = true, this.normalsNeedUpdate = true, 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, M) {
              return d.makeTranslation(m, x, M), this.applyMatrix4(d), this;
            },
            scale: function(m, x, M) {
              return d.makeScale(m, x, M), this.applyMatrix4(d), this;
            },
            lookAt: function(m) {
              return h4.lookAt(m), h4.updateMatrix(), this.applyMatrix4(h4.matrix), this;
            },
            fromBufferGeometry: function(m) {
              function x(H, Y, re, ae) {
                var ee = P === void 0 ? [] : [M.colors[H].clone(), M.colors[Y].clone(), M.colors[re].clone()], oe = E === void 0 ? [] : [new l.Vector3().fromBufferAttribute(E, H), new l.Vector3().fromBufferAttribute(E, Y), new l.Vector3().fromBufferAttribute(E, re)], j = new y(H, Y, re, oe, ee, ae);
                M.faces.push(j), S !== void 0 && M.faceVertexUvs[0].push([new l.Vector2().fromBufferAttribute(S, H), new l.Vector2().fromBufferAttribute(S, Y), new l.Vector2().fromBufferAttribute(S, re)]), R !== void 0 && M.faceVertexUvs[1].push([new l.Vector2().fromBufferAttribute(R, H), new l.Vector2().fromBufferAttribute(R, Y), new l.Vector2().fromBufferAttribute(R, re)]);
              }
              var M = this, T = m.index === null ? void 0 : m.index, w = m.attributes;
              if (w.position === void 0) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this;
              var _ = w.position, E = w.normal, P = w.color, S = w.uv, R = w.uv2;
              R !== void 0 && (this.faceVertexUvs[1] = []);
              for (var A = 0; A < _.count; A++) M.vertices.push(new l.Vector3().fromBufferAttribute(_, A)), P !== void 0 && M.colors.push(new l.Color().fromBufferAttribute(P, A));
              var C = m.groups;
              if (0 < C.length) for (var L = 0; L < C.length; L++) for (var I = C[L], b = I.start, O = I.count, N = b, D = b + O; N < D; N += 3) T === void 0 ? x(N, N + 1, N + 2, I.materialIndex) : x(T.getX(N), T.getX(N + 1), T.getX(N + 2), I.materialIndex);
              else if (T !== void 0) for (var U = 0; U < T.count; U += 3) x(T.getX(U), T.getX(U + 1), T.getX(U + 2));
              else for (var V = 0; V < _.count; V += 3) x(V, V + 1, V + 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, M = x === 0 ? 1 : 1 / x, T = new l.Matrix4();
              return T.set(M, 0, 0, -M * m.x, 0, M, 0, -M * m.y, 0, 0, M, -M * m.z, 0, 0, 0, 1), this.applyMatrix4(T), this;
            },
            computeFaceNormals: function() {
              for (var m = new l.Vector3(), x = new l.Vector3(), M = 0, T = this.faces.length; M < T; M++) {
                var w = this.faces[M], _ = this.vertices[w.a], E = this.vertices[w.b], P = this.vertices[w.c];
                m.subVectors(P, E), x.subVectors(_, E), m.cross(x), m.normalize(), w.normal.copy(m);
              }
            },
            computeVertexNormals: function() {
              for (var m = !(0 < arguments.length && arguments[0] !== void 0) || arguments[0], x = Array(this.vertices.length), M = 0, T = this.vertices.length; M < T; M++) x[M] = new l.Vector3();
              if (m)
                for (var w = new l.Vector3(), _ = new l.Vector3(), E = 0, P = this.faces.length; E < P; E++) {
                  var S = this.faces[E], R = this.vertices[S.a], A = this.vertices[S.b], C = this.vertices[S.c];
                  w.subVectors(C, A), _.subVectors(R, A), w.cross(_), x[S.a].add(w), x[S.b].add(w), x[S.c].add(w);
                }
              else {
                this.computeFaceNormals();
                for (var L, I = 0, b = this.faces.length; I < b; I++) L = this.faces[I], x[L.a].add(L.normal), x[L.b].add(L.normal), x[L.c].add(L.normal);
              }
              for (var O = 0, N = this.vertices.length; O < N; O++) x[O].normalize();
              for (var D = 0, U = this.faces.length; D < U; D++) {
                var V = this.faces[D], H = V.vertexNormals;
                H.length === 3 ? (H[0].copy(x[V.a]), H[1].copy(x[V.b]), H[2].copy(x[V.c])) : (H[0] = x[V.a].clone(), H[1] = x[V.b].clone(), H[2] = x[V.c].clone());
              }
              return 0 < this.faces.length && (this.normalsNeedUpdate = true), x;
            },
            computeFlatVertexNormals: function() {
              this.computeFaceNormals();
              for (var m = 0, x = this.faces.length; m < x; m++) {
                var M = this.faces[m], T = M.vertexNormals;
                T.length === 3 ? (T[0].copy(M.normal), T[1].copy(M.normal), T[2].copy(M.normal)) : (T[0] = M.normal.clone(), T[1] = M.normal.clone(), T[2] = M.normal.clone());
              }
              0 < this.faces.length && (this.normalsNeedUpdate = true);
            },
            computeMorphNormals: function() {
              for (var m, x = 0, M = this.faces.length; x < M; x++) {
                m = this.faces[x], m.__originalFaceNormal ? m.__originalFaceNormal.copy(m.normal) : m.__originalFaceNormal = m.normal.clone(), m.__originalVertexNormals || (m.__originalVertexNormals = []);
                for (var T = 0, w = m.vertexNormals.length; T < w; T++) m.__originalVertexNormals[T] ? m.__originalVertexNormals[T].copy(m.vertexNormals[T]) : m.__originalVertexNormals[T] = m.vertexNormals[T].clone();
              }
              var _ = new p();
              _.faces = this.faces;
              for (var E = 0, P = this.morphTargets.length; E < P; E++) {
                if (!this.morphNormals[E]) {
                  this.morphNormals[E] = {}, this.morphNormals[E].faceNormals = [], this.morphNormals[E].vertexNormals = [];
                  for (var S = this.morphNormals[E].faceNormals, R = this.morphNormals[E].vertexNormals, A = 0, C = this.faces.length; A < C; A++) {
                    var L = new l.Vector3(), I = { a: new l.Vector3(), b: new l.Vector3(), c: new l.Vector3() };
                    S.push(L), R.push(I);
                  }
                }
                var b = this.morphNormals[E];
                _.vertices = this.morphTargets[E].vertices, _.computeFaceNormals();
                var O = _.computeVertexNormals();
                if (O && 0 < O.length) {
                  this.morphTargets[E].normals = Array(this.vertices.length);
                  for (var N = 0; N < O.length; N++) this.morphTargets[E].normals[N] = O[N].clone();
                }
                for (var D = 0, U = this.faces.length; D < U; D++) {
                  var V = this.faces[D], H = b.faceNormals[D], Y = b.vertexNormals[D];
                  H.copy(V.normal), Y.a.copy(V.vertexNormals[0]), Y.b.copy(V.vertexNormals[1]), Y.c.copy(V.vertexNormals[2]);
                }
              }
              for (var re, ae = 0, ee = this.faces.length; ae < ee; ae++) re = this.faces[ae], re.normal = re.__originalFaceNormal, re.vertexNormals = re.__originalVertexNormals;
              this.morphNormalsReady = true;
            },
            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 M = this.morphTargets.length, T = this.morphTargets, w = m.morphTargets, _ = this.morphColors.length, E = this.morphColors, P = m.morphColors;
              if (0 < M && M == w.length) for (var S = 0, R = T.length; S < R; S++) {
                for (var A = T[S], C = w[S], L = 0, I = C.vertices.length; L < I; L++) {
                  var b = C.vertices[L], O = b.clone();
                  x !== void 0 && O.applyMatrix4(x), A.vertices.push(O);
                }
                if (A.normals && C.normals) for (var N = 0; N < C.normals.length; N += 3) g.set(C.normals2[N], C.normals2[N + 1], C.normals2[N + 2]), x !== void 0 && g.applyMatrix4(x), A.normals.push(g.x, g.y, g.z);
              }
              if (0 < _ && _ == P.length) for (var D = 0, U = E.length; D < U; D++) for (var V = E[D], H = P[D], Y = 0, re = H.colors; Y < re; Y++) V.colors.push(H.colors[Y].clone());
            },
            merge: function(m, x) {
              var M = 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 T, w = this.vertices.length, _ = this.vertices, E = m.vertices, P = m.normals, S = this.faces, R = m.faces, A = this.colors, C = m.colors;
              x !== void 0 && (T = new l.Matrix3().getNormalMatrix(x));
              for (var L = 0, I = E.length; L < I; L++) {
                var b = E[L], O = b.clone();
                x !== void 0 && O.applyMatrix4(x), _.push(O);
              }
              for (var N = 0; N < P.length; N += 3) g.set(P[N], P[N + 1], P[N + 2]), x !== void 0 && g.applyMatrix4(x), this.normals.push(g.x, g.y, g.z);
              for (var D = 0, U = C.length; D < U; D++) typeof C[D] == "number" ? A.push(C[D]) : A.push(C[D].clone());
              for (var V = 0, H = R.length; V < H; V++) {
                var Y = R[V], re = void 0, ae = void 0, ee = Y.vertexNormals, oe = Y.vertexColors, j = new y(Y.a + w, Y.b + w, Y.c + w);
                j.normal.copy(Y.normal), T !== void 0 && j.normal.applyMatrix3(T).normalize();
                for (var K = 0, $ = ee.length; K < $; K++) re = ee[K].clone(), T !== void 0 && re.applyMatrix3(T).normalize(), j.vertexNormals.push(re);
                j.color.copy(Y.color);
                for (var ne = 0, k = oe.length; ne < k; ne++) ae = oe[ne], j.vertexColors.push(ae.clone());
                j.materialIndex = Y.materialIndex + M, S.push(j);
              }
              for (var W, B = 0, X = m.faceVertexUvs.length; B < X; B++) {
                W = m.faceVertexUvs[B], this.faceVertexUvs[B] === void 0 && (this.faceVertexUvs[B] = []);
                for (var J = 0, F = W.length; J < F; J++) {
                  for (var z = W[J], te = [], se = 0, le = z.length; se < le; se++) te.push(z[se].clone());
                  this.faceVertexUvs[B].push(te);
                }
              }
              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 = {}, M = [], T = [], w = Math.pow(10, m), _ = 0, E = this.vertices.length; _ < E; _++) {
                var P = this.vertices[_], S = Math.round(P.x * w) + "_" + Math.round(P.y * w) + "_" + Math.round(P.z * w);
                x[S] === void 0 ? (x[S] = _, M.push(this.vertices[_]), T[_] = M.length - 1) : T[_] = T[x[S]];
              }
              for (var R, A = [], C = 0, L = this.faces.length; C < L; C++) {
                R = this.faces[C], R.a = T[R.a], R.b = T[R.b], R.c = T[R.c];
                for (var I = [R.a, R.b, R.c], b = 0; 3 > b; b++) if (I[b] === I[(b + 1) % 3]) {
                  A.push(C);
                  break;
                }
              }
              for (var O, N = A.length - 1; 0 <= N; N--) {
                O = A[N], this.faces.splice(O, 1);
                for (var D = 0, U = this.faceVertexUvs.length; D < U; D++) this.faceVertexUvs[D].splice(O, 1);
              }
              var V = this.vertices.length - M.length;
              return this.vertices = M, V;
            },
            setFromPoints: function(m) {
              this.vertices = [];
              for (var x, M = 0, T = m.length; M < T; M++) x = m[M], 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, M = 0; M < x; M++) m[M]._id = M;
              m.sort(function(R, A) {
                return R.materialIndex - A.materialIndex;
              });
              var T, w, _ = this.faceVertexUvs[0], E = this.faceVertexUvs[1];
              _ && _.length === x && (T = []), E && E.length === x && (w = []);
              for (var P, S = 0; S < x; S++) P = m[S]._id, T && T.push(_[P]), w && w.push(E[P]);
              T && (this.faceVertexUvs[0] = T), w && (this.faceVertexUvs[1] = w);
            },
            toJSON: function() {
              function m(k, W, B) {
                return B ? k | 1 << W : k & ~(1 << W);
              }
              function x(k) {
                var W = k.x.toString() + k.y.toString() + k.z.toString();
                return L[W] === void 0 && (L[W] = C.length / 3, C.push(k.x, k.y, k.z)), L[W];
              }
              function M(k) {
                var W = k.r.toString() + k.g.toString() + k.b.toString();
                return b[W] === void 0 && (b[W] = I.length, I.push(k.getHex())), b[W];
              }
              function T(k) {
                var W = k.x.toString() + k.y.toString();
                return N[W] === void 0 && (N[W] = O.length / 2, O.push(k.x, k.y)), N[W];
              }
              var w = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } };
              if (w.uuid = this.uuid, w.type = this.type, this.name !== "" && (w.name = this.name), this.parameters !== void 0) {
                var _ = this.parameters;
                for (var E in _) _[E] !== void 0 && (w[E] = _[E]);
                return w;
              }
              for (var P, S = [], R = 0; R < this.vertices.length; R++) P = this.vertices[R], S.push(P.x, P.y, P.z);
              for (var A = [], C = [], L = {}, I = [], b = {}, O = [], N = {}, D = 0; D < this.faces.length; D++) {
                var U = this.faces[D], V = true, H = false, Y = this.faceVertexUvs[0][D] !== void 0, re = 0 < U.normal.length(), ae = 0 < U.vertexNormals.length, ee = U.color.r !== 1 || U.color.g !== 1 || U.color.b !== 1, oe = 0 < U.vertexColors.length, j = 0;
                if (j = m(j, 0, 0), j = m(j, 1, V), j = m(j, 2, H), j = m(j, 3, Y), j = m(j, 4, re), j = m(j, 5, ae), j = m(j, 6, ee), j = m(j, 7, oe), A.push(j), A.push(U.a, U.b, U.c), A.push(U.materialIndex), Y) {
                  var K = this.faceVertexUvs[0][D];
                  A.push(T(K[0]), T(K[1]), T(K[2]));
                }
                if (re && A.push(x(U.normal)), ae) {
                  var $ = U.vertexNormals;
                  A.push(x($[0]), x($[1]), x($[2]));
                }
                if (ee && A.push(M(U.color)), oe) {
                  var ne = U.vertexColors;
                  A.push(M(ne[0]), M(ne[1]), M(ne[2]));
                }
              }
              return w.data = {}, w.data.vertices = S, w.data.normals = C, 0 < I.length && (w.data.colors = I), 0 < O.length && (w.data.uvs = [O]), w.data.faces = A, w;
            },
            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, M = 0, T = x.length; M < T; M++) this.vertices.push(x[M].clone());
              for (var w = m.colors, _ = 0, E = w.length; _ < E; _++) this.colors.push(w[_].clone());
              for (var P = m.faces, S = 0, R = P.length; S < R; S++) this.faces.push(P[S].clone());
              for (var A, C = 0, L = m.faceVertexUvs.length; C < L; C++) {
                A = m.faceVertexUvs[C], this.faceVertexUvs[C] === void 0 && (this.faceVertexUvs[C] = []);
                for (var I = 0, b = A.length; I < b; I++) {
                  for (var O, N = A[I], D = [], U = 0, V = N.length; U < V; U++) O = N[U], D.push(O.clone());
                  this.faceVertexUvs[C].push(D);
                }
              }
              for (var H, Y = m.morphTargets, re = 0, ae = Y.length; re < ae; re++) {
                if (H = {}, H.name = Y[re].name, Y[re].vertices !== void 0) {
                  H.vertices = [];
                  for (var ee = 0, oe = Y[re].vertices.length; ee < oe; ee++) H.vertices.push(Y[re].vertices[ee].clone());
                }
                if (Y[re].normals !== void 0) {
                  H.normals = [];
                  for (var j = 0, K = Y[re].normals.length; j < K; j++) H.normals.push(Y[re].normals[j].clone());
                }
                this.morphTargets.push(H);
              }
              for (var $, ne = m.morphNormals, k = 0, W = ne.length; k < W; k++) {
                if ($ = {}, ne[k].vertexNormals !== void 0) {
                  $.vertexNormals = [];
                  for (var B = 0, X = ne[k].vertexNormals.length; B < X; B++) {
                    var J = ne[k].vertexNormals[B], F = {};
                    F.a = J.a.clone(), F.b = J.b.clone(), F.c = J.c.clone(), $.vertexNormals.push(F);
                  }
                }
                if (ne[k].faceNormals !== void 0) {
                  $.faceNormals = [];
                  for (var z = 0, te = ne[k].faceNormals.length; z < te; z++) $.faceNormals.push(ne[k].faceNormals[z].clone());
                }
                this.morphNormals.push($);
              }
              for (var se = m.skinWeights, le = 0, me = se.length; le < me; le++) this.skinWeights.push(se[le].clone());
              for (var Te = m.skinIndices, _e = 0, fe = Te.length; _e < fe; _e++) this.skinIndices.push(Te[_e].clone());
              for (var we = m.lineDistances, ie = 0, pe = we.length; ie < pe; ie++) this.lineDistances.push(we[ie]);
              var be = m.boundingBox;
              be !== null && (this.boundingBox = be.clone());
              var Be = m.boundingSphere;
              return Be !== null && (this.boundingSphere = Be.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 = [], M = void 0, T = this.faces;
              for (m = 0; m < T.length; m++) {
                var w = T[m];
                w.materialIndex !== M && (M = w.materialIndex, v !== void 0 && (v.count = 3 * m - v.start, x.push(v)), v = { start: 3 * m, materialIndex: M });
              }
              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(), M = new Float32Array(3 * m.vertices.length);
              if (x.setAttribute("position", new l.BufferAttribute(M, 3).copyVector3sArray(m.vertices)), 0 < m.normals.length) {
                var T = new Float32Array(3 * m.normals.length);
                x.setAttribute("normal", new l.BufferAttribute(T, 3).copyVector3sArray(m.normals));
              }
              if (0 < m.colors.length) {
                var w = new Float32Array(3 * m.colors.length);
                x.setAttribute("color", new l.BufferAttribute(w, 3).copyColorsArray(m.colors));
              }
              if (0 < m.uvs.length) {
                var _ = new Float32Array(2 * m.uvs.length);
                x.setAttribute("uv", new l.BufferAttribute(_, 2).copyVector2sArray(m.uvs));
              }
              if (0 < m.uvs2.length) {
                var E = new Float32Array(2 * m.uvs2.length);
                x.setAttribute("uv2", new l.BufferAttribute(E, 2).copyVector2sArray(m.uvs2));
              }
              for (var P in x.groups = m.groups, m.morphTargets) {
                for (var S = [], R = m.morphTargets[P], A = 0, C = R.length; A < C; A++) {
                  var L = R[A], I = new l.Float32BufferAttribute(3 * L.data.length, 3);
                  I.name = L.name, S.push(I.copyVector3sArray(L.data));
                }
                x.morphAttributes[P] = S;
              }
              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 O = new l.Float32BufferAttribute(4 * m.skinWeights.length, 4);
                x.setAttribute("skinWeight", O.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 M = new Float32Array(this.normals.length), T = new l.BufferAttribute(M, 3).copyArray(this.normals);
                m.setAttribute("normal", T);
              }
              if (0 < this.uvs.length && 0 < this.uvs[0].length) {
                var w = new Float32Array(2 * this.uvs[0].length);
                m.setAttribute("uv", new l.BufferAttribute(w, 2).copyArray(this.uvs[0]));
              }
              if (1 < this.uvs.length && 0 < this.uvs[1].length) {
                var _ = new Float32Array(2 * this.uvs[1].length);
                m.setAttribute("uv2", new l.BufferAttribute(_, 2).copyArray(this.uvs[1]));
              }
              if (0 < this.colors.length) {
                for (var E = [], P = 0; P < this.colors.length; P++) E.push(new l.Color(this.colors[P]));
                var S = new Float32Array(3 * E.length);
                m.setAttribute("color", new l.BufferAttribute(S, 3).copyColorsArray(E));
              } else {
                for (var R = new Float32Array(3 * this.vertices.length), A = 0; A < 3 * this.vertices.length; A++) R[A] = 1;
                m.setAttribute("color", new l.BufferAttribute(R, 3));
              }
              if (0 < this.faces.length) {
                for (var C = [], L = [], I = 0; I < this.faces.length; I++) {
                  L.push(this.faces[I].a, this.faces[I].b, this.faces[I].c);
                  var b = this.faces[I].vertexColors;
                  if (b.length === 3) C.push(b[0], b[1], b[2]);
                  else {
                    var O = this.faces[I].color;
                    C.push(O, O, O);
                  }
                }
                m.setIndex(L), m.groups = this.computeGroups();
              }
              if (0 < this.morphTargets.length) {
                for (var N = [], D = [], U = 0, V = this.morphTargets.length; U < V; U++) {
                  var H = this.morphTargets[U], Y = new l.Float32BufferAttribute(3 * H.vertices.length, 3);
                  if (Y.name = H.name, N.push(Y.copyVector3sArray(H.vertices)), H.normals) {
                    var re = new l.Float32BufferAttribute(3 * H.normals.length, 3);
                    re.name = H.name, D.push(re.copyVector3sArray(H.normals));
                  }
                }
                m.morphAttributes.position = N, m.morphAttributes.normal = D;
              }
              if (0 < this.skinIndices.length) {
                var ae = new l.Float32BufferAttribute(4 * this.skinIndices.length, 4);
                m.setAttribute("skinIndex", ae.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 M = new l.Float32BufferAttribute(3 * x.vertices.length, 3), T = new l.Float32BufferAttribute(3 * x.colors.length, 3);
              if (m.setAttribute("position", M.copyVector3sArray(x.vertices)), m.setAttribute("color", T.copyColorsArray(x.colors)), x.lineDistances && x.lineDistances.length === x.vertices.length) {
                var w = new l.Float32BufferAttribute(x.lineDistances.length, 1);
                m.setAttribute("lineDistance", w.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 = false, this.normalsNeedUpdate = false, this.colorsNeedUpdate = false, this.uvsNeedUpdate = false, this.groupsNeedUpdate = false;
            }
            computeGroups(m) {
              var x, M, T = [], w = void 0, _ = m.faces;
              for (M = 0; M < _.length; M++) {
                var E = _[M];
                E.materialIndex !== w && (w = E.materialIndex, x !== void 0 && (x.count = 3 * M - x.start, T.push(x)), x = { start: 3 * M, materialIndex: w });
              }
              x !== void 0 && (x.count = 3 * M - x.start, T.push(x)), this.groups = T;
            }
            fromGeometry(m) {
              var x, M = m.faces, T = m.vertices, w = m.faceVertexUvs, _ = w[0] && 0 < w[0].length, E = w[1] && 0 < w[1].length, P = m.morphTargets, S = P.length;
              if (0 < S) {
                x = [];
                for (var R = 0; R < S; R++) x[R] = { name: P[R].name, data: [] };
                this.morphTargets.position = x;
              }
              var A, C = m.morphNormals, L = C.length;
              if (0 < L) {
                A = [];
                for (var I = 0; I < L; I++) A[I] = { name: C[I].name, data: [] };
                this.morphTargets.normal = A;
              }
              var b = m.skinIndices, O = m.skinWeights, N = b.length === T.length, D = O.length === T.length;
              0 < T.length && M.length === 0 && console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
              for (var U, V = 0; V < M.length; V++) {
                U = M[V], this.vertices.push(T[U.a], T[U.b], T[U.c]);
                var H = U.vertexNormals;
                if (H.length === 3) this.normals.push(H[0], H[1], H[2]);
                else {
                  var Y = U.normal;
                  this.normals.push(Y, Y, Y);
                }
                var re = U.vertexColors;
                if (re.length === 3) this.colors.push(re[0], re[1], re[2]);
                else {
                  var ae = U.color;
                  this.colors.push(ae, ae, ae);
                }
                if (_ === true) {
                  var ee = w[0][V];
                  ee === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", V), this.uvs.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs.push(ee[0], ee[1], ee[2]);
                }
                if (E === true) {
                  var oe = w[1][V];
                  oe === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", V), this.uvs2.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs2.push(oe[0], oe[1], oe[2]);
                }
                for (var j, K = 0; K < S; K++) j = P[K].vertices, x[K].data.push(j[U.a], j[U.b], j[U.c]);
                for (var $, ne = 0; ne < L; ne++) $ = C[ne].vertexNormals[V], A[ne].data.push($.a, $.b, $.c);
                N && this.skinIndices.push(b[U.a], b[U.b], b[U.c]), D && this.skinWeights.push(O[U.a], O[U.b], O[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, M, T, w) {
              var _ = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : 0;
              this.a = m, this.b = x, this.c = M, this.normal = T && T.isVector3 ? T : new l.Vector3(), this.vertexNormals = Array.isArray(T) ? T : [], this.color = w && w.isColor ? w : new l.Color(), this.vertexColors = Array.isArray(w) ? w : [], this.materialIndex = _;
            }
            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, M = m.vertexNormals.length; x < M; x++) this.vertexNormals[x] = m.vertexNormals[x].clone();
              for (var T = 0, w = m.vertexColors.length; T < w; T++) this.vertexColors[T] = m.vertexColors[T].clone();
              return this;
            }
          }
        },
        /* 7 */
        /***/
        (o) => {
          o.exports = qF;
        },
        /* 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, h4 = c(5).resolveURL, f = 0, g = function() {
            return "pr" + f++;
          }, p = function() {
            this.isZincObject = true, 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 = false, this.morphColour = false, 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 = true, this.closestVertexIndex = -1, this.boundingBoxUpdateRequired = true, 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 = true, this.drawRange = -1;
          };
          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, true), 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 = true, this.clipAction.play()));
            }
            this.timeEnabled = y, this.morphColour = v, u.userData = this, u.matrixAutoUpdate = false, this.setMorph(u), this.checkTransparentMesh(), this.timeEnabled ? this.setFrustumCulled(false) : this.morphColour && (m.setAttribute("morphTarget0", m.getAttribute("position")), m.setAttribute("morphTarget1", m.getAttribute("position"))), this.boundingBoxUpdateRequired = true;
          }, 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 = false;
            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 = true), y && this.isTimeVarying() && this.mixer.update(0);
            } else {
              var M = u;
              M = u > this.duration ? this.duration : 0 > u ? 0 : u, M != this.inbuildTime && (this.inbuildTime = M, y = true);
            }
            y && (this.boundingBoxUpdateRequired = true, this._lod.updateMorphColorAttribute(true), this.timeEnabled && (this.markerUpdateRequired = true));
          }, 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 = true));
          }, p.prototype.setAlpha = function(u) {
            var y = this._lod._material, v = false;
            1 > u && (v = true), 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.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, M = 0; M < v.count; M++) this._v2.fromArray(v.array, 3 * M), x = this._v2.distanceTo(this._v1), m == -1 ? m = x : m > x && (m = x, u = M);
            }
            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 M = false, T = 0; T < m.length; T++) 0 < m[T] && (M = true, this._v1.fromArray(x.position[T].array, 3 * this.closestVertexIndex), y.add(this._v1.multiplyScalar(m[T])));
                if (M) 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 = false), 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 == false && this.markerIsRequired(y)) {
              var v = y.ndcToBeUpdated;
              if (this.groupName) {
                if (this.marker || (this.marker = new (c(14)).Marker(this), this.markerUpdateRequired = true), this.markerUpdateRequired) {
                  var m = this.getClosestVertex(false);
                  m && (this.marker.setPosition(m.x, m.y, m.z), this.markerUpdateRequired = false);
                }
                this.marker.isEnabled() || (y.markersList && !(this.marker.uuid in y.markersList) && (v = true, 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 = true);
              }
            } 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 = true, delete y.markersList[this.marker.uuid])), this.markerUpdateRequired = true;
          }, 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(false);
          }, p.prototype.setRenderOrder = function(u) {
            this._lod.setRenderOrder(u);
          }, p.prototype.getClosestVertexDOMElementCoords = function(u) {
            if (u && u.camera) {
              var y = true, v = this.getClosestVertex(true);
              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 = false), 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 = true)), 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 == true) {
              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 = true, this.morphColour == 1 && this._lod.updateMorphColorAttribute(true));
            }
            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 = true, y.geometry.setDrawRange(0, this.drawRange), y.geometry.computeBoundingBox(), y.geometry.computeBoundingSphere(), v = y.geoemtry, this.boundingBoxUpdateRequired = true;
            }
            return v;
          }, p.prototype.setPosition = function(u, y, v) {
            var m = this.getGroup();
            m && (m.position.set(u, y, v), m.updateMatrix(), this.boundingBoxUpdateRequired = true);
          }, p.prototype.loadAdditionalSources = function(u) {
            u.load(h4(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 = true);
          }, a.ZincObject = p;
        },
        /* 11 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).updateMorphColorAttribute, h4 = 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: true, loading: false, 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 = true, this.levels[m].loading = false;
                  break;
                }
                this.checkTransparentMesh();
              }
            }, this.addLevelFromURL = (u, y, v, m, x) => {
              this._loader = u;
              var M, T = this.calculateDistance(y);
              for (M = 0; M < this.levels.length && !(T < this.levels[M].distance); M++) ;
              this.levels.splice(M, 0, { distance: T, morph: void 0, loaded: false, loading: false, url: v, index: m }), x && this.loadLevel(M);
            }, this.loadLevel = (u) => {
              var y = this.levels[u];
              return y.morph || y.loaded || y.loading || (y.loading = true, 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 = true, !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 = true, !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 = true));
            }, 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 = h4(y, m), M = void 0;
                this._parent.isGeometry ? M = new l.Mesh(x, v) : this._parent.isLines && (M = new (c(12)).LineSegments(x, v)), M.userData = this._parent, M.renderOrder = this._renderOrder, y.dispose(), this.levelLoaded(M, u);
              };
            }, this.updateMorphColorAttribute = (u) => {
              if (this._material && (this._material.vertexColors == l.VertexColors || this._material.vertexColors == true)) 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 = true, this.levels.forEach((y) => {
                y.morph && (y.morph.material = this._material, y.morph.geometry && (y.morph.geometry.colorsNeedUpdate = true)), 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, M = u.cameraObject.position.distanceTo(y), T = -1, w = -1;
                for (m = 0, x = v.length; m < x && M >= v[m].distance; m++) v[m].morph ? (-1 < T && v[T].morph && (v[T].morph.visible = false), T = m, v[m].morph.visible = true, w = -1) : w = m;
                for (-1 < w && this.loadLevel(w); m < x; m++) v[m].morph && (-1 < T ? v[m].morph.visible = false : (v[m].morph.visible = true, T = m));
                this._currentLevel != T && (this._currentLevel = T, 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 = true);
              });
            };
          };
          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), h4 = new d.Vector3(), f = 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) h4.fromBufferAttribute(y, m), f.fromBufferAttribute(y, m + 1), v[m] = m == 0 ? 0 : v[m - 1], v[m + 1] = v[m] + h4.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 = true;
        },
        /* 13 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            Line: () => (
              /* binding */
              x
            )
            /* harmony export */
          });
          var l = c(4), d = new l.Vector3(), h4 = new l.Vector3(), f = new l.Matrix4(), g = new l.Ray(), p = new l.Sphere(), u = new l.Vector3(), y = new l.Vector3(), v = new l.Vector3(), m = new l.Vector3();
          class x extends l.Object3D {
            constructor() {
              var w = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), _ = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.LineBasicMaterial();
              super(), this.type = "Line", this.geometry = w, this.material = _, this.updateMorphTargets();
            }
            copy(w) {
              return super.copy(w), this.material = w.material, this.geometry = w.geometry, this;
            }
            computeLineDistances() {
              var w = this.geometry;
              if (!w.isBufferGeometry) w.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              else if (w.index === null) {
                for (var _ = w.attributes.position, E = [0], P = 1, S = _.count; P < S; P++) d.fromBufferAttribute(_, P - 1), h4.fromBufferAttribute(_, P), E[P] = E[P - 1], E[P] += d.distanceTo(h4);
                w.setAttribute("lineDistance", new l.Float32BufferAttribute(E, 1));
              } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
              return this;
            }
            raycast(w, _) {
              var E = this.geometry, P = this.matrixWorld, S = w.params.Line.threshold, R = E.drawRange, A = E.morphAttributes.position;
              if (E.boundingSphere === null && E.computeBoundingSphere(), p.copy(E.boundingSphere), p.applyMatrix4(P), p.radius += S, w.ray.intersectsSphere(p) !== false) {
                f.copy(P).invert(), g.copy(w.ray).applyMatrix4(f);
                var C = S / ((this.scale.x + this.scale.y + this.scale.z) / 3), L = C * C, I = new l.Vector3(), b = new l.Vector3(), O = new l.Vector3(), N = new l.Vector3(), D = this.isLineSegments ? 2 : 1;
                if (E.isBufferGeometry) {
                  var U = E.index, V = E.attributes, H = V.position;
                  if (U !== null) for (var Y = Math.max(0, R.start), re = Math.min(U.count, R.start + R.count), ae = Y; ae < re - 1; ae += D) {
                    var ee = U.getX(ae), oe = U.getX(ae + 1);
                    M(I, b, this, H, A, ee, oe);
                    var j = g.distanceSqToSegment(I, b, N, O);
                    if (!(j > L)) {
                      N.applyMatrix4(this.matrixWorld);
                      var K = w.ray.origin.distanceTo(N);
                      K < w.near || K > w.far || _.push({
                        distance: K,
                        // What do we want? intersection point on the ray or on the segment??
                        // point: raycaster.ray.at( distance ),
                        point: O.clone().applyMatrix4(this.matrixWorld),
                        index: ae,
                        face: null,
                        faceIndex: null,
                        object: this
                      });
                    }
                  }
                  else for (var $ = Math.max(0, R.start), ne = Math.min(H.count, R.start + R.count), k = $; k < ne - 1; k += D) {
                    M(I, b, this, H, A, k, k + 1);
                    var W = g.distanceSqToSegment(I, b, N, O);
                    if (!(W > L)) {
                      N.applyMatrix4(this.matrixWorld);
                      var B = w.ray.origin.distanceTo(N);
                      B < w.near || B > w.far || _.push({
                        distance: B,
                        // What do we want? intersection point on the ray or on the segment??
                        // point: raycaster.ray.at( distance ),
                        point: O.clone().applyMatrix4(this.matrixWorld),
                        index: k,
                        face: null,
                        faceIndex: null,
                        object: this
                      });
                    }
                  }
                } else E.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
            updateMorphTargets() {
              var w = this.geometry;
              if (w.isBufferGeometry) {
                var _ = w.morphAttributes, E = Object.keys(_);
                if (0 < E.length) {
                  var P = _[E[0]];
                  if (P !== void 0) {
                    this.morphTargetInfluences = [], this.morphTargetDictionary = {};
                    for (var S, R = 0, A = P.length; R < A; R++) S = P[R].name || R + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[S] = R;
                  }
                }
              } else {
                var C = w.morphTargets;
                C !== void 0 && 0 < C.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
          }
          function M(T, w, _, E, P, S, R) {
            T.fromBufferAttribute(E, S), w.fromBufferAttribute(E, R);
            var A = _.morphTargetInfluences;
            if (_.material.morphTargets && P && A) {
              u.set(0, 0, 0), y.set(0, 0, 0);
              for (var C = 0, L = P.length; C < L; C++) {
                var I = A[C], b = P[C];
                I !== 0 && (v.fromBufferAttribute(b, S), m.fromBufferAttribute(b, R), u.addScaledVector(v.sub(T), I), y.addScaledVector(m.sub(w), I));
              }
              T.add(u), w.add(y);
            }
          }
          x.prototype.isLine = true;
        },
        /* 14 */
        /***/
        (o, a, c) => {
          var l = c(4), d = new Image(128, 128);
          d.src = c(15);
          var h4 = new l.Texture();
          h4.image = d, h4.needsUpdate = true;
          var f = [0.02, 0.03, 1], g = new l.SpriteMaterial({ map: h4, alphaTest: 0.5, transparent: true, depthTest: false, depthWrite: false, sizeAttenuation: false }), p = c(5).createNewSpriteText, u = function(y) {
            c(10).ZincObject.call(this), this.texture = h4;
            var v = void 0, m = void 0, x = void 0, M = void 0, T = void 0, w = true;
            this.morph = new l.Group(), this.group = this.morph, this.parent = y, this.isMarker = true;
            var _ = false;
            this.ndc = new l.Vector3();
            var E = void 0, P = void 0, S = () => {
              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 = (R, A) => {
              var C = 1, L = 0;
              R !== A && (L = 1 - (this.ndc.z - R) / (A - R), C = 0.6 + 0.4 * L), this.setSpriteSize(C);
            }, this.updateNDC = (R) => (this.ndc.copy(this.morph.position), this.ndc.project(R), this.ndc.z = Math.min(Math.max(this.ndc.z, 0), 1), this.ndc), this.setPosition = (R, A, C) => {
              this.morph.position.set(R, A, C);
            }, this.setSpriteSize = (R) => {
              v.scale.set(0.015, 0.02, 1), v.scale.multiplyScalar(R);
            }, this.setUserSprite = () => {
              M && (this.morph.add(M), w && (this.morph.remove(v), P && this.morph.remove(P), w = false));
            }, this.setImageForUserSprite = (R, A) => {
              M && (this.morph.remove(M), M = void 0), m && m.dispose(), x && x.dispose(), m = new l.Texture(), m.image = R, m.needsUpdate = true, x = new l.SpriteMaterial({ map: m, alphaTest: 0.5, transparent: true, depthTest: false, depthWrite: false, sizeAttenuation: false }), A || (A = [0.05, 0.05, 1]), M = new l.Sprite(x), M.center.set(0.5, 0), M.scale.set(A[0], A[1], A[2]), M.userData = this, this.setUserSprite();
            }, this.setDefaultSprite = () => {
              w || (w = true, this.morph.add(v), M && this.morph.remove(M), P && this.morph.add(P));
            }, this.loadUserSprite = (R, A) => {
              if (R) if (R !== T) {
                T = R;
                var C = new Image(128, 128);
                C.crossOrigin = "anonymous", C.onload = () => {
                  this.setImageForUserSprite(C, A);
                }, C.src = R;
              } else this.setUserSprite();
            }, this.dispose = () => {
              this.morph && this.morph.clear(), v && (v.clear(), v = void 0), P && (P.material.map.dispose(), P.material.dispose(), P = void 0);
            }, this.isEnabled = () => _, this.setNumber = (R) => {
              (!R || E != R) && P && (this.morph.remove(P), P.material.map.dispose(), P.material.dispose(), P = void 0), !P && R && (P = p(R, 0.012, "black", "Asap", 120, 700), this.morph.add(P)), E = R;
            }, this.getNumber = () => E || 1, this.setVisibility = function(R) {
              R !== this.visible && (this.visible = R, this.group.visible = R, this.parent.region && (this.parent.region.pickableUpdateRequired = true));
            }, this.enable = () => {
              _ = true, this.morph.visible = true, this.visible = true;
            }, this.disable = () => {
              _ = false, this.morph.visible = false, this.visible = false;
            }, S();
          };
          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(h4, 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 = true;
            var m = [0, 0, 0];
            this.fromMesh = (x) => !!(x && x.isMesh) && (this.morph = x.clone(), this.morph.userData = this, this.group.add(this.morph), true), h4 && u && this.fromMesh(new l.Mesh(h4, 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, M, T, w) => {
              this.morph && (this.morph.matrix.elements[0] = M[0], this.morph.matrix.elements[1] = M[1], this.morph.matrix.elements[2] = M[2], this.morph.matrix.elements[3] = 0, this.morph.matrix.elements[4] = T[0], this.morph.matrix.elements[5] = T[1], this.morph.matrix.elements[6] = T[2], this.morph.matrix.elements[7] = 0, this.morph.matrix.elements[8] = w[0], this.morph.matrix.elements[9] = w[1], this.morph.matrix.elements[10] = w[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 = false), 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 = true);
            }, 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, h4) {
            var f = d, g = void 0;
            g = h4 ? new l(f, 0.015, h4.getStyle()) : new l(f, 0.015), g.fontFace = "Asap", g.fontWeight = 700, g.material.map.generateMipmaps = false, g.material.sizeAttenuation = false, 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) => {
              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, h4 = 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, M = 0, T = 0, w = [0, 0, 0], _ = [0, 0, 0], E = [0, 0, 0], P = "NONE";
            this.ready = false;
            var S = false, R = false;
            this.isGlyphset = true;
            var A = new l.Matrix4(), C = new l.Color(), L = new l.Color(), I = new l.Box3(), b = new l.Box3(), O = new l.Box3(), N = [], D = [], U = [], V = [], H = [], Y = [], re = [];
            this.globalScale = 1;
            for (var ae = 0; 8 > ae; ae++) new l.Vector3();
            this.load = (k, W, B, X, J) => {
              g = k.axis1, p = k.axis2, u = k.axis3, y = k.positions, v = k.scale, m = k.colors, x = k.label, S = k.metadata.MorphColours, R = k.metadata.MorphVertices, M = k.metadata.number_of_time_steps, P = k.metadata.repeat_mode, T = k.metadata.number_of_vertices, P == "AXES_2D" || P == "MIRROR" ? T *= 2 : P == "AXES_3D" && (T *= 3), w = k.metadata.base_size, _ = k.metadata.offset, E = k.metadata.scale_factors;
              var F = new d();
              this.geometry = new l.BufferGeometry();
              var z = new l.InstancedMesh(this.geometry, void 0, T);
              if (this.setMorph(z), X) {
                var te = F.parse(W);
                ne(B, J)(te.geometry, te.materials), te.geometry.dispose();
              } else F.crossOrigin = "Anonymous", F.load(W, ne(B, J));
            };
            var ee = (k, W, B, X, J, F) => {
              if (P == "NONE" || P == "MIRROR") {
                for (var z, te = [0, 0, 0], se = [0, 0, 0], le = [0, 0, 0], me = [0, 0, 0], Te = [0, 0, 0], _e = [0, 0, 0], fe = [0, 0, 0], we = [0, 0, 0], ie = [0, 0, 0], pe = 0; 3 > pe; pe++) z = 0 > J[pe] ? -1 : 1, te[pe] = (z * w[pe] + J[pe] * E[pe]) * this.globalScale;
                for (var pe = 0; 3 > pe; pe++) se[pe] = W[pe] * te[0], le[pe] = B[pe] * te[1], me[pe] = X[pe] * te[2], Te[pe] = k[pe] + _[0] * se[pe] + _[1] * le[pe] + _[2] * me[pe], P == "MIRROR" && (_e[pe] = -se[pe], fe[pe] = -le[pe], we[pe] = -me[pe], ie[pe] = Te[pe], 0 > J[0] && (Te[pe] -= se[pe], ie[pe] -= _e[pe]));
                0 > me[0] * (se[1] * le[2] - se[2] * le[1]) + me[1] * (se[2] * le[0] - se[0] * le[2]) + me[2] * (se[0] * le[1] - se[1] * le[0]) && (me[0] = -me[0], me[1] = -me[1], me[2] = -me[2]), F[0] = [Te, se, le, me], P == "MIRROR" && (0 > we[0] * (_e[1] * fe[2] - _e[2] * fe[1]) + we[1] * (_e[2] * fe[0] - _e[0] * fe[2]) + we[2] * (_e[0] * fe[1] - _e[1] * fe[0]) && (we[0] = -we[0], we[1] = -we[1], we[2] = -we[2]), F[1] = [ie, _e, fe, we]);
              } else if (P == "AXES_2D" || P == "AXES_3D") {
                for (var z, be = [0, 0, 0], Be = [0, 0, 0], pe = 0; 3 > pe; pe++) z = 0 > J[pe] ? -1 : 1, be[pe] = (z * w[0] + J[pe] * E[0]) * this.globalScale;
                for (var pe = 0; 3 > pe; pe++) Be[pe] = k[pe] + _[0] * be[0] * W[pe] + _[1] * be[1] * B[pe] + _[2] * be[2] * X[pe];
                for (var Oe = glyph_repeat_mode == "AXES_2D" ? 2 : 3, $e = 0; $e < Oe; $e++) {
                  var ot = void 0, qe = void 0, wt = J[$e], Ne = [0, 0, 0], nt = [0, 0, 0], tt = [0, 0, 0];
                  $e == 0 ? (ot = W, qe = B) : $e == 1 ? (ot = B, qe = glyph_repeat_mode == "AXES_2D" ? W : X) : (ot = X, qe = W);
                  var Kt = (w[0] + wt * E[0]) * this.globalScale;
                  Ne[0] = ot[0] * Kt, Ne[1] = ot[1] * Kt, Ne[2] = ot[2] * Kt, tt[0] = Ne[1] * qe[2] - qe[1] * Ne[2], tt[1] = Ne[2] * qe[0] - qe[2] * Ne[0], tt[2] = Ne[0] * qe[1] - Ne[1] * qe[0];
                  var qt = Math.sqrt(tt[0] * tt[0] + tt[1] * tt[1] + tt[2] * tt[2]);
                  if (0 < qt) {
                    var Rt = (w[2] + wt * E[2]) * this.globalScale / qt;
                    P == "AXES_2D" && 0 < $e && (Rt *= -1), tt[0] *= Rt, tt[1] *= Rt, tt[2] *= Rt;
                  }
                  if (nt[0] = tt[1] * Ne[2] - Ne[1] * tt[2], nt[1] = tt[2] * Ne[0] - Ne[2] * tt[0], nt[2] = tt[0] * Ne[1] - tt[1] * Ne[0], qt = Math.sqrt(nt[0] * nt[0] + nt[1] * nt[1] + nt[2] * nt[2]), 0 < qt) {
                    var Nt = (w[1] + wt * E[1]) * this.globalScale / qt;
                    nt[0] *= Nt, nt[1] *= Nt, nt[2] *= Nt;
                  }
                  F[$e] = [Be, Ne, nt, tt];
                }
              }
              return F;
            }, oe = (k, W, B, X, J) => {
              var F = 1;
              P == "AXES_2D" || P == "MIRROR" ? F = 2 : P == "AXES_3D" && (F = 3);
              var z = k.length / 3, te = 0;
              re.length = F;
              for (var se = 0; se < z; se++) {
                var le = 3 * se, me = [k[le], k[le + 1], k[le + 2]], Te = [W[le], W[le + 1], W[le + 2]], _e = [B[le], B[le + 1], B[le + 2]], fe = [X[le], X[le + 1], X[le + 2]], we = [J[le], J[le + 1], J[le + 2]], ie = ee(me, Te, _e, fe, we, re);
                if (ie.length == F) for (var pe = 0; pe < F; pe++) {
                  A.elements[0] = ie[pe][1][0], A.elements[1] = ie[pe][1][1], A.elements[2] = ie[pe][1][2], A.elements[3] = 0, A.elements[4] = ie[pe][2][0], A.elements[5] = ie[pe][2][1], A.elements[6] = ie[pe][2][2], A.elements[7] = 0, A.elements[8] = ie[pe][3][0], A.elements[9] = ie[pe][3][1], A.elements[10] = ie[pe][3][2], A.elements[11] = 0, A.elements[12] = ie[pe][0][0], A.elements[13] = ie[pe][0][1], A.elements[14] = ie[pe][0][2], A.elements[15] = 1, this.morph.setMatrixAt(te, A);
                  var be = f[te];
                  be && be.setTransformation(ie[pe][0], ie[pe][1], ie[pe][2], ie[pe][3]), te++;
                }
              }
              this.morph.instanceMatrix.needsUpdate = true;
            }, j = (k) => {
              var W = 1;
              P == "AXES_2D" || P == "MIRROR" ? W = 2 : P == "AXES_3D" && (W = 3);
              for (var B, X = k.length, J = 0, F = 0; F < X; F++) {
                B = k[F];
                for (var z = 0; z < W; z++) {
                  C.setHex(B), this.morph.setColorAt(J, C);
                  var te = f[J];
                  te && te.setColour(C), J++;
                }
              }
              this.morph.instanceColor.needsUpdate = true;
            }, K = () => {
              var k = N, W = D, B = U, X = V, J = H, F = Y, z = this.inbuildTime / this.duration * (M - 1), te = Math.floor(z), se = 1 - (z - te), le = Math.ceil(z);
              if (R) {
                var me = y[te.toString()], Te = y[le.toString()], _e = g[te.toString()], fe = g[le.toString()], we = p[te.toString()], ie = p[le.toString()], pe = u[te.toString()], be = u[le.toString()], Be = v[te.toString()], Oe = v[le.toString()];
                N.length = me.length, D.length = me.length, U.length = me.length, V.length = me.length, H.length = me.length;
                for (var $e = 0; $e < me.length; $e++) k[$e] = se * me[$e] + (1 - se) * Te[$e], W[$e] = se * _e[$e] + (1 - se) * fe[$e], B[$e] = se * we[$e] + (1 - se) * ie[$e], X[$e] = se * pe[$e] + (1 - se) * be[$e], J[$e] = se * Be[$e] + (1 - se) * Oe[$e];
              } else k = y[0], W = g[0], B = p[0], X = u[0], J = v[0];
              if (oe(k, W, B, X, J), this.boundingBoxUpdateRequired = true, m != null) {
                if (S) {
                  var ot = m[te.toString()], qe = m[le.toString()];
                  F.length = ot.length;
                  for (var wt = 0; wt < ot.length; wt++) C.setHex(ot[wt]), L.setHex(qe[wt]), C.setRGB(C.r * se + L.r * (1 - se), C.g * se + L.g * (1 - se), C.b * se + L.b * (1 - se)), F[wt] = C.getHex();
                } else F = m[0];
                j(F);
              }
            };
            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 < T; W++) {
                var B = new (c(16)).Glyph(void 0, void 0, W, this), X = x ? x[W] : void 0;
                X = X || this.groupName, X && B.setLabel(X), 0 < M && B.setFrustumCulled(false), f[W] = B, this.morph.add(B.getGroup());
              }
              k && this.showLabel(), oe(y[0], g[0], p[0], u[0], v[0]), m != null && j(m[0]), this.ready = true, this.boundingBoxUpdateRequired = true;
            };
            this.addCustomGlyph = (k) => {
              k.isGlyph && f.push(k), this.ready = true, this.boundingBoxUpdateRequired = true;
            }, this.addMeshAsGlyph = (k, W) => {
              if (k.isMesh) {
                var B = new (c(16)).Glyph(void 0, void 0, W, this);
                return B.fromMesh(k), f.push(B), this.morph.add(B.getGroup()), this.ready = true, this.boundingBoxUpdateRequired = true, B;
              }
            }, this.forEachGlyph = (k) => {
              for (var W = 0; W < f.length; W++) k(f[W]);
            };
            var ne = (k, W) => (B, X) => {
              var J = B.toBufferGeometry();
              this.geometry.copy(J), this.geometry.computeBoundingSphere(), this.geometry.computeBoundingBox(), J.dispose(), X && X[0] && (this.morph.material = X[0]), $(W), this.morph.name = this.groupName, this.morph.userData = this, this.setMorph(this.morph), B.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, B = y[0], X = B.length / 3, J = -1, F = 0, z = 0; z < X; z++) W = 3 * z, this._v2.set(B[W], B[W + 1], B[W + 2]), F = this._v1.distanceTo(this._v2), (J == -1 || J > F) && (J = F, k = z);
              }
              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, A), k.setFromMatrixPosition(A), k;
              }
            }, this.getBoundingBox = () => {
              if (this.morph && this.ready && this.morph.visible) {
                if (this.boundingBoxUpdateRequired) {
                  I.setFromBufferAttribute(this.morph.geometry.attributes.position);
                  for (var k = 0; k < T; k++) this.morph.getMatrixAt(k, A), b.copy(I).applyMatrix4(A), k == 0 ? O.copy(b) : O.union(b);
                  if (O) this.cachedBoundingBox.copy(O), this.morph.updateWorldMatrix(true, true), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = false;
                  else return;
                }
                return this.cachedBoundingBox;
              }
            }, this.setMorphTime = (k) => {
              this.inbuildTime = k > this.duration ? this.duration : 0 > k ? 0 : k, (S || R) && (K(), R && (this.markerUpdateRequired = true));
            }, this.isTimeVarying = () => !!((this.ready === false || 0 < M) && (S || R)), this.getCurrentTime = () => this.inbuildTime, this.setScaleAll = function(k) {
              this.globalScale = k, K();
            }, 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 = false, this.groupName = void 0;
            }, this.render = (k, W, B) => {
              if (W == true) {
                var X = this.inbuildTime + k;
                X > this.duration && (X -= this.duration), this.inbuildTime = X, (S || R) && K();
              }
              this.updateMarker(W, B);
            };
          };
          h4.prototype = Object.create(c(10).ZincObject.prototype), a.Glyphset = h4;
        },
        /* 19 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            JSONLoader: () => (
              /* binding */
              w
            )
            /* harmony export */
          });
          var l = c(4), d = c(20).Loader, h4 = 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, M = l.DefaultLoadingManager, T = c(21).VideoHandler;
          function w(_) {
            typeof _ == "boolean" && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), _ = void 0), this.manager = _ === void 0 ? M : _, this.withCredentials = false, this.paramsString = "";
          }
          Object.assign(w.prototype, { load: function(E, P, S, R) {
            var A = this, C = this.texturePath && typeof this.texturePath == "string" ? this.texturePath : h4.extractUrlBase(E), L = new x(this.manager);
            E.split("?"), this.paramsString = E.length === 2 ? paramsStrings[1] : "", L.setWithCredentials(this.withCredentials), L.load(E, function(I) {
              var b;
              try {
                b = JSON.parse(I);
              } catch {
                if (console.error("The loader has encountered an error while parsing the content of a resource."), R) return void R({ responseURL: E });
              }
              var O = b.metadata;
              if (O !== void 0) {
                var N = O.type;
                if (N !== void 0 && N.toLowerCase() === "object") return void console.error("THREE.JSONLoader: " + E + " should be loaded with THREE.ObjectLoader instead.");
              }
              if (A && A.parse) {
                var D = A.parse(b, C);
                P(D.geometry, D.materials);
              }
            }, S, R);
          }, setTexturePath: function(E) {
            this.texturePath = E;
          }, parse: /* @__PURE__ */ function() {
            function _(R, A) {
              function C(pe, be) {
                return pe & 1 << be;
              }
              var L, I, b, O, N, D, U, V, H, Y, re, ae, ee, oe, j, K, $, ne, k, W, B, X, J, F, z, te, se, le = R.faces, me = R.vertices, Te = R.normals, _e = R.colors, fe = R.scale, we = 0;
              if (R.uvs !== void 0) {
                for (L = 0; L < R.uvs.length; L++) R.uvs[L].length && we++;
                for (L = 0; L < we; L++) A.faceVertexUvs[L] = [];
              }
              for (O = 0, N = me.length; O < N; ) ne = new g(), ne.x = me[O++] * fe, ne.y = me[O++] * fe, ne.z = me[O++] * fe, A.vertices.push(ne);
              if (O = 0, N = le.length, R.uvs) for (L = 0; L < R.uvs.length; L++) {
                A.uvs[L] = [];
                for (var ie = 0; ie < R.uvs[L].length; ie++) A.uvs[L][ie] = R.uvs[L][ie];
              }
              if (Te) for (L = 0; L < Te.length; L++) A.normals[L] = Te[L];
              if (_e) for (L = 0; L < _e.length; L++) A.colors[L] = _e[L];
              for (; O < N; )
                if (Y = le[O++], re = C(Y, 0), ae = C(Y, 1), ee = C(Y, 3), oe = C(Y, 4), j = C(Y, 5), K = C(Y, 6), $ = C(Y, 7), re) {
                  if (W = new v(), W.a = le[O], W.b = le[O + 1], W.c = le[O + 3], B = new v(), B.a = le[O + 1], B.b = le[O + 2], B.c = le[O + 3], O += 4, ae && (H = le[O++], W.materialIndex = H, B.materialIndex = H), b = A.faces.length, ee) for (L = 0; L < we; L++) for (F = R.uvs[L], A.faceVertexUvs[L][b] = [], A.faceVertexUvs[L][b + 1] = [], I = 0; 4 > I; I++) V = le[O++], te = F[2 * V], se = F[2 * V + 1], z = new y(te, se), I !== 2 && A.faceVertexUvs[L][b].push(z), I !== 0 && A.faceVertexUvs[L][b + 1].push(z);
                  if (oe && (U = 3 * le[O++], W.normal.set(Te[U++], Te[U++], Te[U]), B.normal.copy(W.normal)), j) for (L = 0; 4 > L; L++) U = 3 * le[O++], J = new g(Te[U++], Te[U++], Te[U]), L !== 2 && W.vertexNormals.push(J), L !== 0 && B.vertexNormals.push(J);
                  if (K && (D = le[O++], X = _e[D], W.color.setHex(X), B.color.setHex(X)), $) for (L = 0; 4 > L; L++) D = le[O++], X = _e[D], L !== 2 && W.vertexColors.push(new u(X)), L !== 0 && B.vertexColors.push(new u(X));
                  A.faces.push(W), A.faces.push(B);
                } else {
                  if (k = new v(), k.a = le[O++], k.b = le[O++], k.c = le[O++], ae && (H = le[O++], k.materialIndex = H), b = A.faces.length, ee) for (L = 0; L < we; L++) for (F = R.uvs[L], A.faceVertexUvs[L][b] = [], I = 0; 3 > I; I++) V = le[O++], te = F[2 * V], se = F[2 * V + 1], z = new y(te, se), A.faceVertexUvs[L][b].push(z);
                  if (oe && (U = 3 * le[O++], k.normal.set(Te[U++], Te[U++], Te[U])), j) for (L = 0; 3 > L; L++) U = 3 * le[O++], J = new g(Te[U++], Te[U++], Te[U]), k.vertexNormals.push(J);
                  if (K && (D = le[O++], k.color.setHex(_e[D])), $) for (L = 0; 3 > L; L++) D = le[O++], k.vertexColors.push(new u(_e[D]));
                  A.faces.push(k);
                }
            }
            function E(R, A) {
              var C = R.influencesPerVertex === void 0 ? 2 : R.influencesPerVertex;
              if (R.skinWeights) for (var L = 0, I = R.skinWeights.length; L < I; L += C) {
                var b = R.skinWeights[L], O = 1 < C ? R.skinWeights[L + 1] : 0, N = 2 < C ? R.skinWeights[L + 2] : 0, D = 3 < C ? R.skinWeights[L + 3] : 0;
                A.skinWeights.push(new p(b, O, N, D));
              }
              if (R.skinIndices) for (var L = 0, I = R.skinIndices.length; L < I; L += C) {
                var U = R.skinIndices[L], V = 1 < C ? R.skinIndices[L + 1] : 0, H = 2 < C ? R.skinIndices[L + 2] : 0, Y = 3 < C ? R.skinIndices[L + 3] : 0;
                A.skinIndices.push(new p(U, V, H, Y));
              }
              A.bones = R.bones, A.bones && 0 < A.bones.length && (A.skinWeights.length !== A.skinIndices.length || A.skinIndices.length !== A.vertices.length) && console.warn("When skinning, number of vertices (" + A.vertices.length + "), skinIndices (" + A.skinIndices.length + "), and skinWeights (" + A.skinWeights.length + ") should match.");
            }
            function P(R, A) {
              var C = R.scale;
              if (R.morphTargets !== void 0) for (var L = 0, I = R.morphTargets.length; L < I; L++) {
                A.morphTargets[L] = {}, A.morphTargets[L].name = R.morphTargets[L].name, A.morphTargets[L].vertices = [];
                for (var b, O = A.morphTargets[L].vertices, N = R.morphTargets[L].vertices, D = 0, U = N.length; D < U; D += 3) b = new g(), b.x = N[D] * C, b.y = N[D + 1] * C, b.z = N[D + 2] * C, O.push(b);
              }
              if (R.morphNormals !== void 0) {
                for (var L = 0, I = R.morphNormals.length; L < I; L++) if (A.morphTargets[L]) {
                  A.morphTargets[L].normals = [];
                  for (var V, H = A.morphTargets[L].normals, Y = R.morphNormals[L].normals, D = 0, U = Y.length; D < U; D += 3) V = new g(), V.x = Y[D], V.y = Y[D + 1], V.z = Y[D + 2], H.push(V);
                  A.morphNormalsReady = true;
                }
              }
              if (R.morphColors !== void 0) {
                var L, I, re, ae, ee, oe, j;
                for (L = 0, I = R.morphColors.length; L < I; L++) for (A.morphColors[L] = {}, A.morphColors[L].name = R.morphColors[L].name, A.morphColors[L].colors = [], ee = A.morphColors[L].colors, oe = R.morphColors[L].colors, re = 0, ae = oe.length; re < ae; re += 3) j = new l.Color(16755200), j.setRGB(oe[re], oe[re + 1], oe[re + 2]), ee.push(j);
              }
            }
            function S(R, A) {
              var C = [], L = [];
              R.animation !== void 0 && L.push(R.animation), R.animations !== void 0 && (R.animations.length ? L = L.concat(R.animations) : L.push(R.animations));
              for (var I, b = 0; b < L.length; b++) I = f.parseAnimation(L[b], A.bones), I && C.push(I);
              if (A.morphTargets) {
                var O = f.CreateClipsFromMorphTargetSequences(A.morphTargets, 10);
                C = C.concat(O);
              }
              0 < C.length && (A.animations = C);
            }
            return function(R, A) {
              R.data !== void 0 && (R = R.data), R.scale = R.scale === void 0 ? 1 : 1 / R.scale;
              var C = new m();
              if (C.morphColors = [], _(R, C), E(R, C), P(R, C), S(R, C), C.computeFaceNormals(), C.computeBoundingSphere(), R.materials === void 0 || R.materials.length === 0) return { geometry: C };
              var L = d.prototype.initMaterials(R.materials, A, "Anonymous");
              if (R.materials[0].video) {
                var I = A + R.materials[0].video;
                this.paramsString && (I += "?".concat(this.paramsString));
                var b = new T(I);
                C._video = b;
              }
              return L && 0 < L.length && (L[0].side = R.materials[0].singleSided ? l.FrontSide : R.materials[0].flipSided ? l.BackSide : l.DoubleSide, R.materials[0].specularCoef && (L[0].shininess = Math.floor(R.materials[0].specularCoef / 3))), { geometry: C, materials: L };
            };
          }() });
        },
        /* 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 h4 = { 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(_, E, P, S, R) {
                var A, C = y + _, L = d.Handlers.get(C);
                L === null ? (g.setCrossOrigin(v), A = g.load(C)) : A = L.load(C), E !== void 0 && (A.repeat.fromArray(E), E[0] !== 1 && (A.wrapS = l.RepeatWrapping), E[1] !== 1 && (A.wrapT = l.RepeatWrapping)), P !== void 0 && A.offset.fromArray(P), S !== void 0 && (S[0] === "repeat" && (A.wrapS = l.RepeatWrapping), S[0] === "mirror" && (A.wrapS = l.MirroredRepeatWrapping), S[1] === "repeat" && (A.wrapT = l.RepeatWrapping), S[1] === "mirror" && (A.wrapT = l.MirroredRepeatWrapping)), R !== void 0 && (A.anisotropy = R);
                var I = l.MathUtils.generateUUID();
                return x[I] = A, I;
              }
              var x = {}, M = { uuid: l.MathUtils.generateUUID(), type: "MeshLambertMaterial" };
              for (var T in u) {
                var w = u[T];
                switch (T) {
                  case "DbgColor":
                  case "DbgIndex":
                  case "opticalDensity":
                  case "illumination":
                    break;
                  case "DbgName":
                    M.name = w;
                    break;
                  case "blending":
                    M.blending = h4[w];
                    break;
                  case "colorAmbient":
                  case "mapAmbient":
                    console.warn("THREE.Loader.createMaterial:", T, "is no longer supported.");
                    break;
                  case "colorDiffuse":
                    M.color = f.fromArray(w).getHex();
                    break;
                  case "colorSpecular":
                    M.specular = f.fromArray(w).getHex();
                    break;
                  case "colorEmissive":
                    M.emissive = f.fromArray(w).getHex();
                    break;
                  case "specularCoef":
                    M.shininess = w;
                    break;
                  case "shading":
                    w.toLowerCase() === "basic" && (M.type = "MeshBasicMaterial"), w.toLowerCase() === "phong" && (M.type = "MeshPhongMaterial"), w.toLowerCase() === "standard" && (M.type = "MeshStandardMaterial");
                    break;
                  case "mapDiffuse":
                    M.map = m(w, u.mapDiffuseRepeat, u.mapDiffuseOffset, u.mapDiffuseWrap, u.mapDiffuseAnisotropy);
                    break;
                  case "mapDiffuseRepeat":
                  case "mapDiffuseOffset":
                  case "mapDiffuseWrap":
                  case "mapDiffuseAnisotropy":
                    break;
                  case "mapEmissive":
                    M.emissiveMap = m(w, u.mapEmissiveRepeat, u.mapEmissiveOffset, u.mapEmissiveWrap, u.mapEmissiveAnisotropy);
                    break;
                  case "mapEmissiveRepeat":
                  case "mapEmissiveOffset":
                  case "mapEmissiveWrap":
                  case "mapEmissiveAnisotropy":
                    break;
                  case "mapLight":
                    M.lightMap = m(w, u.mapLightRepeat, u.mapLightOffset, u.mapLightWrap, u.mapLightAnisotropy);
                    break;
                  case "mapLightRepeat":
                  case "mapLightOffset":
                  case "mapLightWrap":
                  case "mapLightAnisotropy":
                    break;
                  case "mapAO":
                    M.aoMap = m(w, u.mapAORepeat, u.mapAOOffset, u.mapAOWrap, u.mapAOAnisotropy);
                    break;
                  case "mapAORepeat":
                  case "mapAOOffset":
                  case "mapAOWrap":
                  case "mapAOAnisotropy":
                    break;
                  case "mapBump":
                    M.bumpMap = m(w, u.mapBumpRepeat, u.mapBumpOffset, u.mapBumpWrap, u.mapBumpAnisotropy);
                    break;
                  case "mapBumpScale":
                    M.bumpScale = w;
                    break;
                  case "mapBumpRepeat":
                  case "mapBumpOffset":
                  case "mapBumpWrap":
                  case "mapBumpAnisotropy":
                    break;
                  case "mapNormal":
                    M.normalMap = m(w, u.mapNormalRepeat, u.mapNormalOffset, u.mapNormalWrap, u.mapNormalAnisotropy);
                    break;
                  case "mapNormalFactor":
                    M.normalScale = w;
                    break;
                  case "mapNormalRepeat":
                  case "mapNormalOffset":
                  case "mapNormalWrap":
                  case "mapNormalAnisotropy":
                    break;
                  case "mapSpecular":
                    M.specularMap = m(w, u.mapSpecularRepeat, u.mapSpecularOffset, u.mapSpecularWrap, u.mapSpecularAnisotropy);
                    break;
                  case "mapSpecularRepeat":
                  case "mapSpecularOffset":
                  case "mapSpecularWrap":
                  case "mapSpecularAnisotropy":
                    break;
                  case "mapMetalness":
                    M.metalnessMap = m(w, u.mapMetalnessRepeat, u.mapMetalnessOffset, u.mapMetalnessWrap, u.mapMetalnessAnisotropy);
                    break;
                  case "mapMetalnessRepeat":
                  case "mapMetalnessOffset":
                  case "mapMetalnessWrap":
                  case "mapMetalnessAnisotropy":
                    break;
                  case "mapRoughness":
                    M.roughnessMap = m(w, u.mapRoughnessRepeat, u.mapRoughnessOffset, u.mapRoughnessWrap, u.mapRoughnessAnisotropy);
                    break;
                  case "mapRoughnessRepeat":
                  case "mapRoughnessOffset":
                  case "mapRoughnessWrap":
                  case "mapRoughnessAnisotropy":
                    break;
                  case "mapAlpha":
                    M.alphaMap = m(w, u.mapAlphaRepeat, u.mapAlphaOffset, u.mapAlphaWrap, u.mapAlphaAnisotropy);
                    break;
                  case "mapAlphaRepeat":
                  case "mapAlphaOffset":
                  case "mapAlphaWrap":
                  case "mapAlphaAnisotropy":
                    break;
                  case "flipSided":
                    M.side = l.BackSide;
                    break;
                  case "doubleSided":
                    M.side = l.DoubleSide;
                    break;
                  case "transparency":
                    console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), M.opacity = w;
                    break;
                  case "depthTest":
                  case "depthWrite":
                  case "colorWrite":
                  case "opacity":
                  case "reflectivity":
                  case "transparent":
                  case "visible":
                  case "wireframe":
                    M[T] = w;
                    break;
                  case "vertexColors":
                    w === true && (M.vertexColors = l.VertexColors), w === "face" && (M.vertexColors = l.FaceColors);
                    break;
                  default:
                    console.error("THREE.Loader.createMaterial: Unsupported", T, w);
                }
              }
              return M.type === "MeshBasicMaterial" && delete M.emissive, M.type !== "MeshPhongMaterial" && delete M.specular, 1 > M.opacity && (M.transparent = true), p.setTextures(x), p.parse(M);
            };
          }() });
        },
        /* 21 */
        /***/
        (o, a, c) => {
          var l = c(4);
          a.VideoHandler = function(d) {
            var h4 = this;
            this.video = void 0, this.videoTexture = void 0, this.setMorphTime = function(f, g) {
              var p = f / g * h4.video.duration;
              h4.video.currentTime = p;
            }, this.getVideoDuration = function() {
              return h4.video.duration;
            }, this.createCanvasVideoTexture = function() {
              return h4.videoTexture = new l.VideoTexture(h4.video), h4.videoTexture.minFilter = l.LinearFilter, h4.videoTexture.magFilter = l.LinearFilter, h4.videoTexture.format = l.RGBFormat, h4.video.currentTime = 0, h4.videoTexture;
            }, this.getCurrentTime = function(f) {
              return h4.video ? f * (h4.video.currentTime / h4.video.duration) : 0;
            }, this.isReadyToPlay = function() {
              return !!(h4.video && 3 <= h4.video.readyState);
            }, function() {
              document && (h4.video = document.createElement("video"), h4.video.crossOrigin = "anonymous", h4.video.src = d, h4.video.load(), h4.video.loop = true);
            }();
          };
        },
        /* 22 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(23).Points, h4 = c(5).toBufferGeometry, f = c(5).getCircularTexture, g = c(17).Label, p = function() {
            c(10).ZincObject.call(this), this.isPointset = true;
            var u = [];
            this.createMesh = (v, m, x) => {
              if (v && m) {
                var M = h4(v, x), T = f();
                m.map = T;
                var w = new d(M, m);
                this.setMesh(w, x.localTimeEnabled, x.localMorphColour);
              }
            };
            var y = (v, m, x, M) => {
              if (x) {
                var T = new l.Color(M), w = new g(x, T);
                w.setPosition(m[0], m[1], m[2]);
                var _ = w.getSprite();
                _.material.sizeAttenuation = false, _.material.alphaTest = 0.5, _.material.transparent = true, _.material.depthWrite = false, _.material.depthTest = false, this.group.add(_), u[v] = w;
              }
            };
            this.addPoints = (v, m, x) => {
              if (v && 0 < v.length) {
                var M = this.drawRange - 1, T = this.addVertices(v), w = this.getMorph();
                if (!w) {
                  var _ = new l.PointsMaterial({ alphaTest: 0.5, size: 10, color: x, sizeAttenuation: false });
                  T.colorsNeedUpdate = true, this.createMesh(T, _, { localTimeEnabled: false, localMorphColour: false });
                }
                var E = M + v.length, P = 0;
                if (Array.isArray(m) && m.length === v.length || typeof m == "string") for (M; M + P < E; ) {
                  var S = typeof m == "string" ? m : m[P];
                  y(P, v[P], S, x), P++;
                }
                this.region && (this.region.pickableUpdateRequired = true);
              }
            }, this.setSize = (v) => {
              this.morph && this.morph.material && (this.morph.material.size = v, this.morph.material.needsUpdate = true);
            }, this.setSizeAttenuation = (v) => {
              this.morph && this.morph.material && (this.morph.material.sizeAttenuation = v, this.morph.material.needsUpdate = true);
            }, 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(), M = m + v.length - 1;
                if (!x || 0 > m || M >= this.drawRange) return;
                var T = x.geometry.getAttribute("position"), w = m;
                v.forEach((_) => {
                  var E = u[w];
                  E && E.setPosition(_[0], _[1], _[2]), T.setXYZ(w++, _[0], _[1], _[2]);
                }), T.needsUpdate = true, this.boundingBoxUpdateRequired = true;
              }
            }, this.render = (v, m, x, M) => {
              this.morph && x && (this.morph.sizePerPixel = x.pixelHeight), p.prototype.render.call(this, v, m, x, M);
            };
          };
          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 = new l.Matrix4(), h4 = new l.Ray(), f = new l.Sphere(), g = new l.Vector3(), p = new l.Vector3(), u = new l.Vector3();
          class y extends l.Object3D {
            constructor() {
              var M = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), T = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.PointsMaterial();
              super(), this.type = "Points", this.geometry = M, this.material = T, this.sizePerPixel = 1, this.updateMorphTargets();
            }
            copy(M) {
              return super.copy(M), this.material = M.material, this.geometry = M.geometry, this;
            }
            raycast(M, T) {
              var w = this.geometry, _ = this.matrixWorld, E = M.params.Points.threshold, P = w.drawRange;
              if (w.boundingSphere === null && w.computeBoundingSphere(), f.copy(w.boundingSphere), f.applyMatrix4(_), f.radius += E, M.ray.intersectsSphere(f) !== false) {
                d.copy(_).invert(), h4.copy(M.ray).applyMatrix4(d);
                var S = E / ((this.scale.x + this.scale.y + this.scale.z) / 3) * this.material.size * this.sizePerPixel, R = S * S;
                if (w.isBufferGeometry) {
                  var A = w.index, C = w.attributes, L = C.position, I = w.morphAttributes.position;
                  if (A !== null) for (var b, O = Math.max(0, P.start), N = Math.min(A.count, P.start + P.count), D = O; D < N; D++) b = A.getX(D), m(this, L, I, b), v(g, b, R, _, M, T, this);
                  else for (var U = Math.max(0, P.start), V = Math.min(L.count, P.start + P.count), H = U; H < V; H++) m(this, L, I, H), v(g, H, R, _, M, T, this);
                } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
            updateMorphTargets() {
              var M = this.geometry;
              if (M.isBufferGeometry) {
                var T = M.morphAttributes, w = Object.keys(T);
                if (0 < w.length) {
                  var _ = T[w[0]];
                  if (_ !== void 0) {
                    this.morphTargetInfluences = [], this.morphTargetDictionary = {};
                    for (var E, P = 0, S = _.length; P < S; P++) E = _[P].name || P + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[E] = P;
                  }
                }
              } else {
                var R = M.morphTargets;
                R !== void 0 && 0 < R.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.");
              }
            }
          }
          y.prototype.isPoints = true;
          function v(x, M, T, w, _, E, P) {
            var S = h4.distanceSqToPoint(x);
            if (S < T) {
              var R = new l.Vector3();
              h4.closestPointToPoint(x, R), R.applyMatrix4(w);
              var A = _.ray.origin.distanceTo(R);
              if (A < _.near || A > _.far) return;
              E.push({ distance: A, distanceToRay: Math.sqrt(S), point: R, index: M, face: null, object: P });
            }
          }
          function m(x, M, T, w) {
            g.fromBufferAttribute(M, w);
            var _ = x.morphTargetInfluences;
            if (x.material.morphTargets && T && _) {
              p.set(0, 0, 0);
              for (var E = 0, P = T.length; E < P; E++) {
                var S = _[E], R = T[E];
                S !== 0 && (u.fromBufferAttribute(R, w), p.addScaledVector(u.sub(g), S));
              }
              g.add(p);
            }
          }
        },
        /* 24 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).toBufferGeometry, h4 = function() {
            c(10).ZincObject.call(this), this.isLines = true, 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 = true);
            }, 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 = true, this.createLineSegment(p, y, { localTimeEnabled: false, localMorphColour: false });
                }
                this.region && (this.region.pickableUpdateRequired = true);
              }
            };
          };
          h4.prototype = Object.create(c(10).ZincObject.prototype), a.Lines = h4;
        },
        /* 25 */
        /***/
        (o, a, c) => {
          function l(g, p, u, y, v, m, x) {
            try {
              var M = g[m](x), T = M.value;
            } catch (w) {
              return void u(w);
            }
            M.done ? p(T) : Promise.resolve(T).then(y, v);
          }
          function d(g) {
            return function() {
              var p = this, u = arguments;
              return new Promise(function(y, v) {
                function m(T) {
                  l(M, y, v, m, x, "next", T);
                }
                function x(T) {
                  l(M, y, v, m, x, "throw", T);
                }
                var M = g.apply(p, u);
                m(void 0);
              });
            };
          }
          var h4 = c(4), f = function() {
            var g = this;
            c(26).Texture.call(this), this.isTextureArray = true, this.loadFromImages = function() {
              var p = d(function* (u) {
                var y = 1, v = 1, m = 0;
                if (u && u.length) {
                  g.isLoading = true;
                  var x = new Image();
                  x.crossOrigin = "Anonymous";
                  for (var M, T = document.createElement("canvas"), w = 0, _ = Array(u.length), E = 0; E < u.length; E++) M = yield g.imageToUint8Array(g, x, u[E], T), M && M.array && (y = M.width, v = M.height, _[m] = M.array, w += _[m].length, m++);
                  var P = new Uint8Array(w);
                  w = 0, _.forEach((S) => {
                    P.set(S, w), w += S.length;
                  }), g.impl = new h4.DataTexture2DArray(P, y, v, m), g.size = { width: y, height: v, depth: m }, g.isLoading = false, g.impl.needsUpdate = true;
                }
              });
              return function() {
                return p.apply(this, arguments);
              };
            }(), this.getMaterial = (p) => {
              if (this.impl) {
                var u;
                if (!p) u = new h4.MeshBasicMaterial({ color: new h4.Color(1, 1, 1), transparent: false, opacity: 1, map: this.impl, side: h4.DoubleSide });
                else if (p.vs && p.fs) {
                  var y = true;
                  p.transparent && (y = p.transparent);
                  var v = h4.FrontSide;
                  p.side && (v = p.side), u = new h4.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 = true, 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 M = g[m](x), T = M.value;
            } catch (w) {
              return void u(w);
            }
            M.done ? p(T) : Promise.resolve(T).then(y, v);
          }
          function d(g) {
            return function() {
              var p = this, u = arguments;
              return new Promise(function(y, v) {
                function m(T) {
                  l(M, y, v, m, x, "next", T);
                }
                function x(T) {
                  l(M, y, v, m, x, "throw", T);
                }
                var M = g.apply(p, u);
                m(void 0);
              });
            };
          }
          var h4 = c(4), f = function() {
            this.isTexture = true, this.impl = void 0, this.isLoading = false, 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 = 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 = 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 h4.MeshBasicMaterial({ color: new h4.Color(1, 1, 1), transparent: false, opacity: 1, map: this.impl, side: h4.DoubleSide });
          }, a.Texture = f;
        },
        /* 27 */
        /***/
        (o, a, c) => {
          function l(v, m) {
            var x = Object.keys(v);
            if (Object.getOwnPropertySymbols) {
              var M = Object.getOwnPropertySymbols(v);
              m && (M = M.filter(function(T) {
                return Object.getOwnPropertyDescriptor(v, T).enumerable;
              })), x.push.apply(x, M);
            }
            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), true).forEach(function(M) {
              h4(v, M, m[M]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(v, Object.getOwnPropertyDescriptors(m)) : l(Object(m)).forEach(function(M) {
              Object.defineProperty(v, M, Object.getOwnPropertyDescriptor(m, M));
            });
            return v;
          }
          function h4(v, m, x) {
            return m = f(m), m in v ? Object.defineProperty(v, m, { value: x, enumerable: true, configurable: true, writable: true }) : 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 M = x.call(v, m || "default");
              if (typeof M != "object") return M;
              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 = true;
            var m = [], x = {};
            this.morph = new p.Group(), this.group = this.morph, this.morph.userData = this;
            var M = true;
            this.createSlides = (_) => {
              _.forEach((E) => this.createSlide(E));
            };
            var T = (_, E) => {
              var P = _.material, S = P.uniforms;
              switch (_.rotation.x = 0, _.rotation.y = 0, _.rotation.z = 0, _.position.x = 0, _.position.y = 0, _.position.z = 0, E.direction) {
                case "x":
                  var R = M ? -Math.PI / 2 : Math.PI / 2;
                  _.rotation.y = R, S.direction.value = 1, S.slide.value.set(E.value, 0, 0), _.position.x = E.value;
                  break;
                case "y":
                  _.rotation.x = Math.PI / 2, S.direction.value = 2, S.slide.value.set(0, E.value, 0), _.position.y = E.value;
                  break;
                case "z":
                  S.direction.value = 3, S.slide.value.set(0, 0, E.value), _.position.z = E.value;
                  break;
              }
              P.needsUpdate = true, this.boundingBoxUpdateRequired = true;
            };
            this.modifySlideSettings = (_) => {
              _ && _.id && _.id in x && x[_.id] && T(x[_.id], _);
            }, this.createSlide = (_) => {
              if (this.texture && this.texture.isTextureArray && this.texture.isReady() && _ && _.direction && _.value !== void 0) {
                var E = new p.PlaneGeometry(1, 1);
                E.translate(0.5, 0.5, 0);
                var P = u.getUniforms();
                P.diffuse.value = this.texture.impl, P.depth.value = this.texture.size.depth, P.flipY.value = M;
                var S = { fs: u.fs, vs: u.vs, uniforms: P, glslVersion: u.glslVersion, side: p.DoubleSide, transparent: false }, R = this.texture.getMaterial(S);
                R.needsUpdate = true;
                var A = new p.Mesh(E, R);
                A.name = this.groupName, A.userData = this;
                var C = { value: _.value, direction: _.direction, id: A.id };
                return m.push(C), T(A, C), x[A.id] = A, this.morph.add(A), this.boundingBoxUpdateRequired = true, C;
              }
            }, this.getTextureSettings = () => [...m], this.getTextureSettingsWithId = (_) => {
              for (var E = 0; E < m.length; E++) if (_ === m[E].id) return d({}, m[E]);
            }, this.getSlides = () => this.morph ? [...this.morph.children] : [], this.removeSlide = (_) => {
              _ && this.removeSlideWithId(_.id);
            }, this.removeSlideWithId = (_) => {
              if (this.morph && _ in x && x[_]) {
                if (this.morph.getObjectById(_)) {
                  var E = x[_];
                  this.morph.remove(E), E.clear(), E.geometry && E.geometry.dispose(), E.material && E.material.dispose(), this.boundingBoxUpdateRequired = true;
                }
                var P = m.findIndex((S) => S.id === _);
                -1 < P && m.splice(P, 1);
              }
            }, this.dispose = () => {
              this.morph.children.forEach((_) => {
                _.geometry && _.geometry.dispose(), _.material && _.material.dispose();
              }), c(29).TexturePrimitive.prototype.dispose.call(this), this.boundingBoxUpdateRequired = true;
            };
            var w = (_, E, P) => {
              switch (E.direction.value) {
                case 1:
                  P.copy(E.slide.value), _.expandByPoint(P), P.setY(1), P.setZ(1), _.expandByPoint(P);
                  break;
                case 2:
                  P.copy(E.slide.value), _.expandByPoint(P), P.setX(1), P.setZ(1), _.expandByPoint(P);
                  break;
                case 3:
                  P.copy(E.slide.value), _.expandByPoint(P), P.setX(1), P.setY(1), _.expandByPoint(P);
                  break;
              }
            };
            this.getBoundingBox = () => {
              if (this.morph && this.morph.children && this.morph.visible && this.boundingBoxUpdateRequired) {
                this.cachedBoundingBox.makeEmpty();
                var _ = new p.Vector3(0, 0, 0);
                this.morph.children.forEach((E) => {
                  w(this.cachedBoundingBox, E.material.uniforms, _);
                }), this.morph.updateMatrixWorld(true, true), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = false;
              }
              return this.cachedBoundingBox;
            }, this.applyTransformation = (_, E, P) => {
              var S = new p.Matrix4();
              S.set(_[0], _[1], _[2], 0, _[3], _[4], _[5], 0, _[6], _[7], _[8], 0, 0, 0, 0, 0);
              var R = new p.Quaternion().setFromRotationMatrix(S);
              this.morph.position.set(...E), this.morph.quaternion.copy(R), this.morph.scale.set(...P), this.morph.updateMatrix(), this.boundingBoxUpdateRequired = true;
            }, this.initialise = (_, E) => {
              if (_) {
                var P = _.locations;
                P && 0 < P.length && (this.applyTransformation(P[0].orientation, P[0].position, P[0].scale), "flipY" in P[0] && (M = P[0].flipY)), this.createSlides(_.settings.slides), E != null && typeof E == "function" && E(this);
              }
            };
          };
          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, h4 = `
precision highp float;
precision highp int;
precision highp sampler2DArray;

uniform sampler2DArray diffuse;
in vec3 vUw;

out vec4 outColor;

void main() {

  vec4 color = texture( diffuse, vUw );

  // lighten a bit
  outColor = vec4( color.rgb + .2, 1.0 );

}
`, 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: true } };
          };
          a.fs = h4, a.vs = f, a.glslVersion = d, a.getUniforms = g;
        },
        /* 29 */
        /***/
        (o, a, c) => {
          c(4);
          var l = c(5).resolveURL, d = function(h4) {
            c(10).ZincObject.call(this), this.isTexturePrimitive = true, this.texture = h4, 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(h4) {
            var f = h4, g = void 0, p = void 0, u = new l.Clock(false);
            this.playAnimation = true;
            var y = 1e3, v = [], m = 0, x = [], M = 0, T = void 0, w = void 0, _ = void 0, E = void 0, P = [], S = [], R = new l.Group(), A = void 0, C = void 0, L = false;
            this.getDrawingWidth = () => f ? f.clientWidth : A ? typeof A.clientWidth > "u" ? Math.round(A.width) : Math.round(A.clientWidth) : 0, this.getDrawingHeight = () => f ? f.clientHeight : A ? typeof A.clientHeight > "u" ? Math.round(A.height) : Math.round(A.clientHeight) : 0, this.onWindowResize = () => {
              p.onWindowResize();
              var O = this.getDrawingWidth(), N = this.getDrawingHeight();
              if (g != null) {
                var D;
                f ? (D = f.getBoundingClientRect(), g.setSize(O, N)) : A && (typeof A.getBoundingClientRect > "u" || (D = A.getBoundingClientRect(), A.width = O, A.height = N), g.setSize(O, N, false)), D && (D.left, D.top);
                var U = new l.Vector2();
                g.getSize(U), U.x, U.y;
              }
            }, this.initialiseVisualisation = (O) => {
              if (O = O || {}, O.antialias === void 0) {
                var N = false;
                try {
                  /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (N = true);
                } catch {
                  N = false;
                }
                O.antialias = !N;
              }
              O.canvas && (f = void 0, A = O.canvas), g = new l.WebGLRenderer(O), f !== void 0 && f.appendChild(g.domElement), g.setClearColor(16777215, 1), A && A.style && (A.style.height = "100%", A.style.width = "100%"), g.autoClear = false;
              var D = this.createScene("default");
              this.setCurrentScene(D);
            }, this.getCurrentScene = () => p, this.setCurrentScene = (O) => {
              if (O) {
                this.removeActiveScene(O);
                var N = p;
                p = O, N && N.setInteractiveControlEnable(false), p.setInteractiveControlEnable(true), p.setAdditionalScenesGroup(R), this.onWindowResize();
              }
            }, this.getSceneByName = (O) => P[O], this.createScene = (O) => {
              if (P[O] == null) {
                var N;
                return N = A ? new (c(32)).Scene(A, g) : new (c(32)).Scene(f, g), P[O] = N, N.sceneName = O, N;
              }
            }, this.resetView = () => {
              p.resetView();
            }, this.viewAll = () => {
              if (p) {
                var O = p.getBoundingBox();
                if (O) {
                  for (var N, D = 0; D < S.length; D++) N = S[D].getBoundingBox(), N && O.union(N);
                  p.viewAllWithBoundingBox(O);
                }
              }
            }, this.loadModelsURL = (O, N, D, U, V, H) => {
              p.loadModelsURL(O, N, D, U, V, H);
            }, this.loadViewURL = (O) => {
              p.loadViewURL(O);
            }, this.loadFromViewURL = (O, N) => {
              p.loadFromViewURL(O, N);
            }, this.updateDirectionalLight = () => {
              p.updateDirectionalLight();
            };
            var I = () => {
              L ? (T = requestAnimationFrame(I), this.render()) : (cancelAnimationFrame(T), T = void 0);
            };
            this.stopAnimate = () => {
              L && (u.stop(), L = false);
            }, this.animate = () => {
              L || (u.start(), L = true, I());
            }, this.addPreRenderCallbackFunction = (O) => (++m, v[m] = O, m), this.removePreRenderCallbackFunction = (O) => {
              O in v && delete v[O];
            }, this.addPostRenderCallbackFunction = (O) => (++M, x[M] = O, M), this.removePostRenderCallbackFunction = (O) => {
              O in x && delete x[O];
            }, this.getPlayRate = () => y, this.setPlayRate = (O) => {
              y = O;
            }, this.getCurrentTime = () => p.getCurrentTime(), this.setMorphsTime = (O) => {
              p.setMorphsTime(O);
            }, this.getZincGeometryByID = (O) => p.getZincGeometryByID(O), this.addToScene = (O) => {
              p.addObject(O);
            }, this.addToOrthoScene = (O) => {
              if (_ == null && (_ = new l.Scene()), w == null) {
                var N = this.getDrawingWidth(), D = this.getDrawingHeight();
                w = new l.OrthographicCamera(-N / 2, N / 2, D / 2, -D / 2, 1, 10), w.position.z = 10;
              }
              _.add(O);
            };
            var b = (O) => (N) => {
              N.needsUpdate = true;
              var D = new l.SpriteMaterial({ map: N }), U = D.map.image.width, V = D.map.image.height;
              O.material = D, O.scale.set(U, V, 1);
              var H = this.getDrawingWidth(), Y = this.getDrawingHeight();
              O.position.set((H - U) / 2, (-Y + V) / 2, 1), this.addToOrthoScene(O);
            };
            this.addLogo = () => {
              E = new l.Sprite(), l.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png", void 0, b(E));
            }, this.render = () => {
              C || (f ? 0 < f.clientWidth && 0 < f.clientHeight && (C = new d(f, this.onWindowResize)) : A && 0 < A.width && 0 < A.height && (C = new d(A, this.onWindowResize)));
              var O = u.getDelta();
              p.renderGeometries(y, O, this.playAnimation);
              for (var N, D = 0; D < S.length; D++) N = S[D], N.renderGeometries(y, O, this.playAnimation);
              for (var U in w != null && _ != null && (g.clearDepth(), g.render(_, w)), v) v.hasOwnProperty(U) && v[U].call();
              for (var V in p.render(g), x) x.hasOwnProperty(V) && x[V].call();
            }, this.getThreeJSRenderer = () => g, this.isSceneActive = (O) => {
              if (p === O) return true;
              for (var N, D = 0; D < S.length; D++) if (N = S[D], N === O) return true;
              return false;
            }, this.addActiveScene = (O) => {
              this.isSceneActive(O) || (S.push(O), R.add(O.getThreeJSScene()));
            }, this.removeActiveScene = (O) => {
              for (var N, D = 0; D < S.length; D++) if (N = S[D], N === O) return S.splice(D, 1), void R.remove(O.getThreeJSScene());
            }, this.clearAllActiveScene = () => {
              for (var O = 0; O < S.length; O++) R.remove(S[O].getThreeJSScene());
              S.splice(0, S.length);
            }, this.dispose = () => {
              for (var O in L && cancelAnimationFrame(T), P) P.hasOwnProperty(O) && P[O].clearAll();
              P = [], S = [], R = new l.Group(), this.stopAnimate(), v = [], m = 0, w = void 0, _ = void 0, E = void 0;
              var N = this.createScene("default");
              this.setCurrentScene(N), C = void 0;
            }, this.transitionScene = (O, N) => {
              if (p) {
                var D = p.getZincCameraControls(), U = O.getBoundingBox();
                if (U) {
                  var V = U.min.distanceTo(U.max) / 2, H = (U.min.x + U.max.x) / 2, Y = (U.min.y + U.max.y) / 2, re = (U.min.z + U.max.z) / 2, ae = D.getViewportFromCentreAndRadius(H, Y, re, V, 40, V * 4), ee = D.getCurrentViewport();
                  D.cameraTransition(ee, ae, N), D.enableCameraTransition();
                }
              }
            }, this.isWebGL2 = () => !!g && g.capabilities.isWebGL2;
          };
        },
        /* 31 */
        /***/
        (o) => {
          o.exports = QF();
        },
        /* 32 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(33).MarkerCluster, h4 = c(35).SceneLoader, f = c(41).SceneExporter, g = c(43).Viewport, p = c(5).createBufferGeometry, u = c(5).getCircularTexture, y = 0, v = function() {
            return "sc" + y++;
          }, m = function() {
            return { Duration: "6 secs", OriginalDuration: "-", TimeStamps: {} };
          }, x = 6e3;
          a.Scene = function(M, T) {
            var w = this, _ = M, E = void 0, P = new h4(this), S = void 0, R = {}, A = 0, C = {}, L = 0, I = new l.Scene(), b = new (c(44)).Region(void 0, this);
            I.add(b.getGroup());
            var O = new l.Group();
            I.add(O), this.directionalLight = void 0, this.ambient = void 0, this.camera = void 0;
            var N = 6e3, D = void 0;
            this.sceneName = void 0;
            var U = false, V = void 0;
            this.autoClearFlag = true, this.displayMarkers = false, this.displayMinimap = false, this.minimapScissor = { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-left", updateRequired: true };
            var H = { x: 0, y: 0 }, Y = m(), re = new l.Vector2(), ae = [];
            this.forcePickableObjectsUpdate = false, this.uuid = v();
            var ee = new d(this);
            ee.disable(), I.add(ee.group);
            var oe = () => _ ? typeof _.clientWidth > "u" ? _.width : _.clientWidth : 0, j = () => _ ? typeof _.clientHeight > "u" ? _.height : _.clientHeight : 0;
            this.getDownloadProgress = () => P.getDownloadProgress(), this.onWindowResize = () => {
              var B = j();
              this.camera.aspect = oe() / B, this.camera.updateProjectionMatrix(), this.minimapScissor.updateRequired = true, D.onResize(), D.calculateHeightPerPixelAtZeroDepth(B);
            }, this.resetView = () => {
              this.onWindowResize(), D.resetView();
            }, this.changeZoomByScrollRateUnit = (B) => {
              D.changeZoomByScrollRateUnit(B);
            };
            var K = () => {
              this.camera = new l.PerspectiveCamera(40, oe() / j(), 0, 10), this.ambient = new l.AmbientLight(16777215, 0.2), I.add(this.ambient), this.directionalLight = new l.DirectionalLight(16777215, 0.8), I.add(this.directionalLight), D = new (c(43)).CameraControls(this.camera, T.domElement, T, this), D.setDirectionalLight(this.directionalLight), D.resetView(), S = new (c(49)).Minimap(this);
            };
            K(), this.loadView = (B) => {
              var X = new g();
              return X.setFromObject(B), D.setCurrentCameraSettings(X), true;
            }, this.setupMultipleViews = (B, X) => {
              for (var [J, F] of Object.entries(X)) {
                var z = new g();
                z.setFromObject(F), D.addViewport(J, z);
              }
              D.setDefaultViewport(B);
            }, this.getBoundingBox = () => b.getBoundingBox(true), this.viewAllWithBoundingBox = (B) => {
              if (B) {
                var X = D.getViewportFromBoundingBox(B, 1);
                D.setCurrentCameraSettings(X), D.calculateHeightPerPixelAtZeroDepth(j()), ee.markerUpdateRequired = true;
              }
            }, this.viewAll = () => {
              var B = this.getBoundingBox();
              this.viewAllWithBoundingBox(B), ee.markerUpdateRequired = true;
            }, this.forEachGeometry = (B) => {
              b.forEachGeometry(B, true);
            }, this.forEachGlyphset = (B) => {
              b.forEachGlyphset(B, true);
            }, this.forEachPointset = (B) => {
              b.forEachPointset(B, true);
            }, this.forEachLine = (B) => {
              b.forEachLine(B, true);
            }, this.findGeometriesWithGroupName = (B) => b.findGeometriesWithGroupName(B, true), this.findPointsetsWithGroupName = (B) => b.findPointsetsWithGroupName(B, true), this.findGlyphsetsWithGroupName = (B) => b.findGlyphsetsWithGroupName(B, true), this.findLinesWithGroupName = (B) => b.findLinesWithGroupName(B, true), this.findObjectsWithGroupName = (B) => b.findObjectsWithGroupName(B, true), this.findObjectsWithAnatomicalId = (B) => b.findObjectsWithAnatomicalId(B, true), this.getBoundingBoxOfZincObjects = (B) => {
              for (var X, J = void 0, F = 0; F < B.length; F++) X = B[F].getBoundingBox(), X && (J ? J.union(X) : J = X);
              return J;
            }, this.vectorToScreenXY = (B) => {
              B.project(this.camera);
              var X = oe(), J = j(), F = X / 2, z = J / 2;
              return B.x = B.x * F + F, B.y = -(B.y * z) + z, B;
            }, this.getObjectsScreenXY = (B) => {
              if (B && 0 < B.length) {
                var X = this.getBoundingBoxOfZincObjects(B), J = new l.Vector3();
                return X.getCenter(J), this.vectorToScreenXY(J);
              }
            }, this.getNamedObjectsScreenXY = (B) => {
              var X = this.findObjectsWithGroupName(B);
              return this.getObjectsScreenXY(X);
            }, this.addZincObject = (B) => {
              B && (b.addZincObject(B), D && D.calculateMaxAllowedDistance(this));
            }, this.loadGlyphsetURL = (B, X, J, F) => {
              P.loadGlyphsetURL(b, B, X, J, F);
            }, this.loadPointsetURL = (B, X, J, F, z) => {
              P.loadPointsetURL(b, B, X, J, F, z);
            }, this.loadLinesURL = (B, X, J, F, z) => {
              P.loadLinesURL(b, B, X, J, F, z);
            }, this.loadSTL = (B, X, J) => {
              P.loadSTL(b, B, X, J);
            }, this.loadOBJ = (B, X, J) => {
              P.loadOBJ(b, B, X, J);
            }, this.loadMetadataURL = (B, X, J, F) => {
              P.loadMetadataURL(b, B, X, J, F);
            }, this.loadModelsURL = (B, X, J, F, z, te) => {
              P.loadModelsURL(b.urls, X, J, F, z, te);
            }, this.loadViewURL = (B) => {
              P.loadViewURL(B);
            }, this.loadFromViewURL = (B, X) => {
              P.loadFromViewURL(B, X);
            }, this.loadGLTF = (B, X, J, F) => {
              P.loadGLTF(b, B, X, J, F);
            }, this.updateDirectionalLight = () => {
              D.updateDirectionalLight();
            }, this.addObject = (B) => {
              I.add(B);
            }, this.removeObject = (B) => {
              I.remove(B);
            }, this.getCurrentTime = () => {
              if (E != null) return E.getCurrentTime(N);
              var B = b.getCurrentTime();
              return B === -1 ? 0 : B;
            }, this.setMorphsTime = (B) => {
              E != null && E.setMorphTime(B, N), b.setMorphTime(B, true);
            }, this.isTimeVarying = () => !!(E && E.video && !E.video.error) || b.isTimeVarying(), this.renderGeometries = (B, X, J) => {
              var F = {};
              if (F.camera = D, F.displayMarkers = this.displayMarkers, F.markerCluster = ee, F.markersList = ee.markers, F.ndcToBeUpdated = false, J && (F.markerCluster.markerUpdateRequired = true), !E) P.toBeDownloaded == 0 ? (F.ndcToBeUpdated = D.update(X), F.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(j()), b.renderGeometries(B, X, J, D, F, true)) : D.update(0);
              else if (E.isReadyToPlay()) {
                J ? E.video.play() : E.video.pause();
                var z = E.video.currentTime / E.getVideoDuration() * N;
                P.toBeDownloaded == 0 ? (D.setTime(z), F.ndcToBeUpdated = D.update(0), F.ndcToBeUpdated && D.calculateHeightPerPixelAtZeroDepth(j()), b.setMorphTime(z, true), b.renderGeometries(0, 0, J, D, F, true)) : D.update(0);
              } else myPlayRate = 0;
            }, this.getThreeJSScene = () => I, this.setVideoHandler = (B) => {
              E || (E = B);
            }, this.setAdditionalScenesGroup = (B) => {
              I.add(B);
            };
            var $ = (B, X, J, F, z, te, se) => {
              var le = 0, me = 0;
              return me = B.includes("top") ? se - z - J : B.includes("bottom") ? J : Math.floor((se - z) / 2), le = B.includes("left") ? X : B.includes("right") ? te - X - F : Math.floor((te - F) / 2), { x: le, y: me };
            }, ne = (B) => {
              this.displayMinimap === true && (B.setScissorTest(true), B.getSize(re), this.minimapScissor.updateRequired && (H = $(this.minimapScissor.align, this.minimapScissor.x_offset, this.minimapScissor.y_offset, this.minimapScissor.width, this.minimapScissor.height, re.x, re.y), this.minimapScissor.updateRequired = false), B.setScissor(H.x, H.y, this.minimapScissor.width, this.minimapScissor.height), B.setViewport(H.x, H.y, this.minimapScissor.width, this.minimapScissor.height), S.updateCamera(), I.add(S.mask), B.render(I, S.camera), I.remove(S.mask), B.setScissorTest(false), B.setViewport(0, 0, re.x, re.y));
            };
            this.render = (B) => {
              this.autoClearFlag && B.clear(), U && V ? V.render(I, this.camera) : (B.render(I, this.camera), ne(B));
            }, this.setInteractiveControlEnable = (B) => {
              B == true ? D.enable() : D.disable();
            }, this.getZincCameraControls = () => D, this.getThreeJSScene = () => I, this.setDuration = (B) => {
              b.setDuration(B), N = B, D.setPathDuration(B), P.duration = B;
            }, this.getDuration = () => N, this.setStereoEffectEnable = (B) => {
              B != true || V || (V = new c(43).StereoEffect(T)), T.setSize(oe(), j()), this.camera.updateProjectionMatrix(), U = B;
            }, this.objectIsInScene = (B) => b.objectIsInRegion(B, true), this.alignBoundingBoxToCameraView = (B, X) => {
              if (B) {
                var J = new l.Vector3();
                B.getCenter(J);
                var F = this.getZincCameraControls().getCurrentViewport(), z = new l.Vector3(F.targetPosition[0], F.targetPosition[1], F.targetPosition[2]), te = new l.Vector3(F.eyePosition[0], F.eyePosition[1], F.eyePosition[2]), se = new l.Vector3(), le = new l.Vector3();
                se.subVectors(z, te).normalize(), le.subVectors(z, J).normalize();
                var me = new l.Vector3();
                me.crossVectors(se, le);
                var Te = se.angleTo(le);
                0 < X ? (this.getZincCameraControls().rotateCameraTransition(me, Te, X), this.getZincCameraControls().enableCameraTransition()) : this.getZincCameraControls().rotateAboutLookAtpoint(me, Te), ee.markerUpdateRequired = true;
              }
            }, this.translateBoundingBoxToCameraView = (B, X, J) => {
              if (B) {
                var F = this.getZincCameraControls().getCurrentViewport(), z = this.getZincCameraControls().getViewportFromBoundingBox(B, X);
                0 < J && (this.getZincCameraControls().cameraTransition(F, z, J), this.getZincCameraControls().enableCameraTransition()), ee.markerUpdateRequired = true;
              }
            }, this.alignObjectToCameraView = (B, X) => {
              if (this.objectIsInScene(B)) {
                var J = B.getBoundingBox();
                this.alignBoundingBoxToCameraView(J, X);
              }
            }, this.setCameraTargetToObject = (B) => {
              if (this.objectIsInScene(B)) {
                var X = new l.Vector3(), J = B.getBoundingBox(), F = this.getZincCameraControls().getCurrentViewport();
                J.getCenter(X);
                var z = new l.Vector3(F.targetPosition[0], F.targetPosition[1], F.targetPosition[2]), te = new l.Vector3(F.eyePosition[0], F.eyePosition[1], F.eyePosition[2]), se = new l.Vector3(), le = new l.Vector3();
                se.subVectors(te, z), le.addVectors(X, se), F.eyePosition[0] = le.x, F.eyePosition[1] = le.y, F.eyePosition[2] = le.z, F.targetPosition[0] = X.x, F.targetPosition[1] = X.y, F.targetPosition[2] = X.z, this.getZincCameraControls().setCurrentCameraSettings(F), ee.markerUpdateRequired = true;
              }
            }, this.isStereoEffectEnable = () => U, this.removeZincObject = (B) => {
              b.removeZincObject(B), D && D.calculateMaxAllowedDistance(this), ee.markerUpdateRequired = true;
            }, this.updatePickableThreeJSObjects = () => {
              ae.length = 0, ee.isEnabled && ae.push(ee.group), b.getPickableThreeJSObjects(ae, true), this.forcePickableObjectsUpdate = false;
            }, this.getPickableThreeJSObjects = () => ((this.forcePickableObjectsUpdate || b.checkPickableUpdateRequred(true)) && this.updatePickableThreeJSObjects(), ae), this.getNormalisedMinimapCoordinates = (B, X) => {
              if (this.displayMinimap) {
                var J = new l.Vector2();
                B.getSize(J);
                var F = J.y - X.clientY;
                if (H.x + this.minimapScissor.width > X.clientX && X.clientX > H.x && H.y + this.minimapScissor.height > F && F > H.y) {
                  var z = 2 * ((X.clientX - H.x) / this.minimapScissor.width) - 1, te = 2 * ((F - H.y) / this.minimapScissor.height) - 1;
                  return { x: z, y: te };
                }
              }
            }, this.getMinimapDiffFromNormalised = (B, X) => S ? S.getDiffFromNormalised(B, X) : void 0, this.isWebGL2 = () => T.isWebGL2(), this.clearAll = () => {
              ee.clear(), b.clear(true), this.clearZincObjectAddedCallbacks(), this.clearZincObjectRemovedCallbacks(), P.toBeDwonloaded = 0, D && D.calculateMaxAllowedDistance(this), ee.markerUpdateRequired = true;
            }, this.addMetadataTimeStamp = (B, X) => {
              Y.TimeStamps[B] = W(X);
            }, this.getMetadataTag = (B) => Y[B], this.getMetadata = () => Y, this.setMetadataTag = (B, X) => {
              Y[B] = X;
            }, this.removeMetadataTag = (B) => {
              delete Y[B];
            }, this.resetMetadata = () => {
              Y = m();
            }, this.resetDuration = () => {
              this.setDuration(x);
            };
            var k = (B) => [...B.years ? ["".concat(B.years, "years")] : [], ...B.months ? ["".concat(B.months, "months")] : [], ...B.weeks ? ["".concat(B.weeks, "weeks")] : [], ...B.days ? ["".concat(B.days, "days")] : [], ...B.hours ? ["".concat(B.hours, "hours")] : [], ...B.mins ? ["".concat(B.mins, "mins")] : [], ...B.secs ? ["".concat(B.secs, "secs")] : []].join(" "), W = (B) => B.years ? 31536e6 * B.years : 0 + B.months ? 2592e6 * B.months : 0 + B.weeks ? 6048e5 * B.weeks : 0 + B.days ? 864e5 * B.days : 0 + B.hours ? 36e5 * B.hours : 0 + B.mins ? 6e4 * B.mins : 0 + B.secs ? 1e3 * B.secs : 0;
            this.setDurationFromObject = (B) => {
              var X = k(B), J = W(B);
              this.setMetadataTag("Duration", X), this.setDuration(J);
            }, this.setOriginalDurationFromObject = (B) => {
              var X = k(B);
              this.setMetadataTag("OriginalDuration", X);
            }, this.exportGLTF = (B) => {
              var X = new f(this);
              return X.exportGLTF(B);
            }, this.getRootRegion = () => b, this.createLines = (B, X, J, F) => {
              var z = b.findChildFromPath(B);
              return z === void 0 && (z = b.createChildFromPath(B)), z.createLines(X, J, F);
            }, this.createPoints = (B, X, J, F, z) => {
              var te = b.findChildFromPath(B);
              return te === void 0 && (te = b.createChildFromPath(B)), te.createPoints(X, J, F, z);
            }, this.addZincObjectAddedCallbacks = (B) => (++A, R[A] = B, A), this.addZincObjectRemovedCallbacks = (B) => (++L, C[L] = B, L), this.removeZincObjectAddedCallbacks = (B) => {
              B in A && delete R[B];
            }, this.removeZincObjectRemovedCallbacks = (B) => {
              B in L && delete C[B];
            }, this.clearZincObjectAddedCallbacks = () => {
              R = {}, A = 0;
            }, this.clearZincObjectRemovedCallbacks = () => {
              C = {}, L = 0;
            }, this.triggerObjectAddedCallback = (B) => {
              for (var X in R) R.hasOwnProperty(X) && R[X](B);
            }, this.triggerObjectRemovedCallback = (B) => {
              for (var X in C) C.hasOwnProperty(X) && C[X](B);
            }, this.addTemporaryPoints = (B, X) => {
              var J = p(B.length, B), F = new l.PointsMaterial({ alphaTest: 0.5, size: 15, color: X, sizeAttenuation: false }), z = u();
              F.map = z;
              var te = new (c(23)).Points(J, F);
              return O.add(te), te;
            }, this.addTemporaryLines = (B, X) => {
              var J = p(B.length, B), F = new l.LineBasicMaterial({ color: X }), z = new (c(12)).LineSegments(J, F);
              return O.add(z), z;
            }, this.removeTemporaryPrimitive = (B) => {
              O.remove(B), B.geometry.dispose(), B.material.dispose();
            }, this.clearTemporaryPrimitives = () => {
              var B = 0, X = O.children;
              return X.forEach((J) => {
                J.geometry.dispose(), J.material.dispose(), B++;
              }), O.clear(), B;
            }, this.addBoundingBoxPrimitive = function(B, X, J, F, z) {
              var te = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0, se = b.findChildFromPath(B);
              se === void 0 && (se = b.createChildFromPath(B));
              var le = te || w.getBoundingBox(), me = new l.Vector3().subVectors(le.max, le.min), Te = new l.BoxGeometry(me.x, me.y, me.z), _e = se.createGeometryFromThreeJSGeometry(X, Te, J, F, z, 1e4);
              return me.addVectors(le.min, le.max).multiplyScalar(0.5), _e.setPosition(me.x, me.y, me.z), _e;
            }, this.addSlicesPrimitive = function(B, X, J, F, z) {
              var te = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0;
              if (X && 3 <= X.length && J && 3 <= J.length) {
                var se = b.findChildFromPath(B);
                se === void 0 && (se = b.createChildFromPath(B));
                var le = te || w.getBoundingBox(), me = new l.Vector3().subVectors(le.max, le.min), Te = [], _e = 0;
                return ["x", "y", "z"].forEach((fe) => {
                  var we;
                  switch (fe) {
                    case "x":
                      we = new l.PlaneGeometry(me.z, me.y), we.rotateY(Math.PI / 2);
                      break;
                    case "y":
                      we = new l.PlaneGeometry(me.x, me.z), we.rotateX(Math.PI / 2);
                      break;
                    case "z":
                      we = new l.PlaneGeometry(me.x, me.y);
                      break;
                  }
                  var ie = se.createGeometryFromThreeJSGeometry(X[_e], we, J[_e], F, z, 10001);
                  Te.push(ie), _e++;
                }), me.addVectors(le.min, le.max).multiplyScalar(0.5), Te.forEach((fe) => {
                  fe.setPosition(me.x, me.y, me.z);
                }), Te;
              }
            }, this.enableMarkerCluster = (B) => {
              B ? (ee.markerUpdateRequired = true, ee.enable()) : (ee.markerUpdateRequired = false, ee.disable()), this.forcePickableObjectsUpdate = true;
            };
          };
        },
        /* 33 */
        /***/
        (o, a, c) => {
          function l(T, w) {
            var _ = Object.keys(T);
            if (Object.getOwnPropertySymbols) {
              var E = Object.getOwnPropertySymbols(T);
              w && (E = E.filter(function(P) {
                return Object.getOwnPropertyDescriptor(T, P).enumerable;
              })), _.push.apply(_, E);
            }
            return _;
          }
          function d(T) {
            for (var w, _ = 1; _ < arguments.length; _++) w = arguments[_] == null ? {} : arguments[_], _ % 2 ? l(Object(w), true).forEach(function(E) {
              h4(T, E, w[E]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(T, Object.getOwnPropertyDescriptors(w)) : l(Object(w)).forEach(function(E) {
              Object.defineProperty(T, E, Object.getOwnPropertyDescriptor(w, E));
            });
            return T;
          }
          function h4(T, w, _) {
            return w = f(w), w in T ? Object.defineProperty(T, w, { value: _, enumerable: true, configurable: true, writable: true }) : T[w] = _, T;
          }
          function f(T) {
            var w = g(T, "string");
            return typeof w == "symbol" ? w : w + "";
          }
          function g(T, w) {
            if (typeof T != "object" || !T) return T;
            var _ = T[Symbol.toPrimitive];
            if (_ !== void 0) {
              var E = _.call(T, w || "default");
              if (typeof E != "object") return E;
              throw new TypeError("@@toPrimitive must return a primitive value.");
            }
            return (w === "string" ? String : Number)(T);
          }
          var p = c(4), u = new Image(128, 128);
          u.src = c(34);
          var y = new p.Texture();
          y.image = u, y.needsUpdate = true;
          var v = [0.02, 0.03, 1], m = new p.SpriteMaterial({ map: y, alphaTest: 0.5, transparent: true, depthTest: false, depthWrite: false, sizeAttenuation: false }), x = c(5).createNewSpriteText, M = function(T) {
            c(10).ZincObject.call(this), this.texture = y;
            var w = void 0;
            this.morph = new p.Group(), this.group = this.morph, this.isMarkerCluster = true;
            var _ = true, E = [];
            this.markers = {};
            var P = new p.Vector2(), S = new p.Vector2(), R = Date.now();
            this.setSpriteSize = (b) => {
              w.scale.set(0.015, 0.02, 1), w.scale.multiplyScalar(b);
            }, this.clear = () => {
              this.group.clear(), this.markers = {};
            }, this.dispose = () => {
              this.clear(), this.morph && this.morph.clear();
            };
            var A = (b) => {
              var O = new p.Group(), N = new p.Sprite(m);
              return N.clusterIndex = b, N.center.set(0.5, 0), N.position.set(0, 0, 0), N.renderOrder = 1e4, N.scale.set(v[0], v[1], v[2]), N.userData = this, O.add(N), this.group.add(O), { group: O, marker: N, label: void 0, number: 0, min: [0, 0, 0], max: [1, 1, 1] };
            }, C = (b, O, N) => {
              b.group.visible = true, b.group.position.set(O.coords[0], O.coords[1], O.coords[2]), (b.label === void 0 || N !== b.number) && (b.label && (b.group.remove(b.label), b.label.material.map.dispose(), b.label.material.dispose()), b.label = x(N, 0.012, "black", "Asap", 120, 700), b.number = N, b.group.add(b.label)), b.min = O.min, b.max = O.max;
            }, L = (b) => {
              var O = 0;
              for (b.forEach((N) => {
                var D = N.members.length, U = 0;
                D === 1 ? N.members[0].setVisibility(true) : (N.members.forEach((V) => {
                  U += V.getNumber(), V.setVisibility(false);
                }), !E[O] && E.push(A(O)), C(E[O], N, U), O++);
              }), O; O < E.length; O++) E[O].group.visible = false;
            }, I = (b, O) => {
              var N = true, D = { members: [], coords: [0, 0, 0], min: [0, 0, 0], max: [1, 1, 1] }, U = 0;
              for (var V in b) N ? (P.set(b[V].ndc.x, b[V].ndc.y), this._b1.setFromPoints([b[V].morph.position]), N = false, D.members.push(b[V]), D.coords = [b[V].morph.position.x, b[V].morph.position.y, b[V].morph.position.z], O.push(D), delete b[V]) : (S.set(b[V].ndc.x, b[V].ndc.y), U = P.distanceTo(S), 0.1 > U && (D.members.push(b[V]), this._b1.expandByPoint(b[V].morph.position), delete b[V]));
              D.min = [this._b1.min.x, this._b1.min.y, this._b1.min.z], D.max = [this._b1.max.x, this._b1.max.y, this._b1.max.z], N != true && I(b, O);
            };
            this.calculate = () => {
              if (_) {
                var b = Date.now();
                if (500 < b - R) {
                  var O = [];
                  I(d({}, this.markers), O), L(O), R = Date.now(), this.markerUpdateRequired = false;
                }
              }
            }, this.isEnabled = () => _, this.enable = () => {
              _ = true, this.morph.visible = true;
            }, this.disable = () => {
              for (var b in _ = false, this.morph.visible = false, this.markers) {
                var O;
                (O = this.markers[b]) !== null && O !== void 0 && O.isMarker && this.markers[b].isEnabled() && this.markers[b].setVisibility(true);
              }
            }, this.zoomToCluster = (b) => !!(b !== void 0 && -1 < b && (this._v1.set(...E[b].min), this._v2.set(...E[b].max), Math.abs(0 < this._v1.distanceTo(this._v2)))) && (this._b1.set(this._v1, this._v2), T.translateBoundingBoxToCameraView(this._b1, 3, 300), this.markerUpdateRequired = true, true), this.clusterIsVisible = (b) => {
              if (b !== void 0 && -1 < b && E[b]) {
                var O;
                return (O = E[b].group) === null || O === void 0 ? void 0 : O.visible;
              }
              return false;
            };
          };
          M.prototype = Object.create(c(10).ZincObject.prototype), a.MarkerCluster = M;
        },
        /* 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, h4 = 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 = false, x = false, M = new u();
            this.getDownloadProgress = () => {
              var j = 0, K = 0, $ = false;
              for (var ne in this.progressMap) {
                var k = this.progressMap[ne];
                j += k[1], K += k[0], k[1] == 0 && ($ = true);
              }
              return $ && (j = 0), [j, K, x];
            }, this.onProgress = (j) => (K) => {
              this.progressMap[j] = [K.loaded, K.total];
            }, this.onError = (j) => (K) => {
              --this.toBeDownloaded, x = true, console.error("There is an issue with external resource: ".concat(K == null ? void 0 : K.responseURL, ".")), j && j({ type: "Error", xhr: K });
            };
            var T = (j, K) => {
              var $ = K.Default;
              if (K.Inline) v.setupMultipleViews($, K.Entries);
              else {
                var ne = [], k = function(J) {
                  j && (newURL = h4(B, j), ne.push(new Promise((F, z) => {
                    fetch(newURL).then((te) => te.json()).then((te) => F({ key: J, data: te })).catch((te) => z(te));
                  })));
                };
                for (var [W, B] of Object.entries(K.Entries)) k(W);
                Promise.all(ne).then((X) => {
                  var J = {};
                  X.forEach((z) => {
                    J[z.key] = z.data;
                  }), v.setupMultipleViews($, J);
                  var F = v.getZincCameraControls();
                  F && F.setCurrentViewport($), m = true;
                });
              }
            };
            this.loadViewURL = (j, K) => {
              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 = true, --this.toBeDownloaded, K != null && typeof K == "function" && K();
                } else this.onError();
              };
              var ne = d(j);
              $.open("GET", ne, true), $.send();
            }, this.loadModelsURL = (j, K, $, ne, k, W, B) => {
              var X = K.length;
              this.toBeDownloaded += X;
              for (var J = 0; J < X; J++) {
                var F = K[J], z = c(0).defaultMaterialColor, te = c(0).defaultOpacity;
                $ != null && $[J] != null && (z = !!$[J]), ne != null && ne[J] != null && (te = ne[J]);
                var se = 0;
                k != null && k[J] != null && (se = !!k[J]);
                var le = 0;
                W != null && W[J] != null && (le = !!W[J]), M.load(d(F), I(j, z, te, se, le, void 0, void 0, void 0, void 0, B), this.onProgress(F), this.onError(B));
              }
            }, this.loadFromViewURL = (j, K, $) => {
              var ne = new XMLHttpRequest();
              ne.onreadystatechange = () => {
                if (ne.readyState == 4 && ne.status == 200) {
                  var W = JSON.parse(ne.responseText);
                  v.loadView(W);
                  for (var B, X = [], J = K + "_", F = 0; F < W.numberOfResources; F++) B = J + (F + 1) + ".json", X.push(B);
                  this.loadModelsURL(j, X, W.colour, W.opacity, W.timeEnabled, W.morphColour, $);
                }
              };
              var k = d(K + "_view.json");
              ne.open("GET", k, true), ne.send();
            };
            var w = (j, K, $, ne, k, W, B, X) => (J, F) => {
              var z = new (c(24)).Lines(), te = void 0;
              F && F[0] && (te = new l.LineBasicMaterial({ color: F[0].color.clone() }), 1 > F[0].opacity && (te.transparent = true), te.opacity = F[0].opacity, te.morphTargets = K, te.vertexColors = F[0].vertexColors);
              var se = { localTimeEnabled: K, localMorphColour: $ };
              if (z && (z.createLineSegment(J, te, se), z.setName(ne), z.anatomicalId = k, z.setRenderOrder(W), j.addZincObject(z), z.setDuration(v.getDuration()), B && B.levels)) for (var [le, me] of Object.entries(B.levels)) z.addLOD(M, le, me.URL, me.Index, B.preload);
              --this.toBeDownloaded, J.dispose(), X != null && typeof X == "function" && X(z);
            };
            this.loadLinesURL = (j, K, $, ne, k, W, B) => {
              var X = 0;
              this.toBeDownloaded += 1;
              var J = !!(B && B.isInline) && B.isInline, F = B && B.anatomicalId ? B.anatomicalId : void 0, z = B && B.renderOrder ? B.renderOrder : void 0;
              $ != null && (X = !!$);
              var te = 0;
              if (ne != null && (te = !!ne), J) {
                var se = M.parse(K);
                w(j, X, te, k, F, z, B.lod, W)(se.geometry, se.materials);
              } else M.load(K, w(j, X, te, k, F, z, B.lod, W), this.onProgress(K), this.onError(W), B.loaderOptions);
            };
            var _ = (j, K, $, ne, k, W) => {
              var B = W && W.isInline ? W.isInline : void 0, X = W && W.anatomicalId ? W.anatomicalId : void 0, J = W && W.displayLabels ? W.displayLabels : void 0, F = W && W.renderOrder ? W.renderOrder : void 0, z = new (c(18)).Glyphset();
              z.setDuration(v.getDuration()), z.groupName = ne;
              var te = () => {
                --this.toBeDownloaded, k != null && typeof k == "function" && k(z);
              };
              ++this.toBeDownloaded, B ? z.load(K, $, te, B, J) : z.load(K, d($), te, B, J), z.anatomicalId = X, z.setRenderOrder(F), j.addZincObject(z);
            }, E = (j, K, $, ne, k, W) => () => {
              if (K.readyState == 4 && K.status == 200) {
                var B = JSON.parse(K.responseText);
                _(j, B, $, ne, k, W);
              }
            }, P = (j, K, $, ne, k, W, B) => (X, J) => {
              var F = new (c(22)).Pointset(), z = new l.PointsMaterial({ alphaTest: 0.5, size: 10, sizeAttenuation: false });
              J && J[0] && (1 > J[0].opacity && (z.transparent = true), z.opacity = J[0].opacity, z.color = J[0].color, z.morphTargets = K, z.vertexColors = J[0].vertexColors);
              var te = {};
              te.localTimeEnabled = K, te.localMorphColour = $, F && (F.createMesh(X, z, te), F.setName(ne), F.anatomicalId = k, j.addZincObject(F), F.setDuration(v.getDuration()), F.setRenderOrder(W)), X.dispose(), --this.toBeDownloaded, B != null && typeof B == "function" && B(F);
            };
            this.loadSTL = (j, K, $, ne) => {
              this.toBeDownloaded += 1;
              var k = c(0).defaultMaterialColor, W = c(0).defaultOpacity, B = new g();
              B.crossOrigin = "Anonymous", B.load(d(K), I(j, k, W, false, false, $, void 0, void 0, void 0, ne));
            }, this.loadOBJ = (j, K, $, ne) => {
              this.toBeDownloaded += 1;
              var k = c(0).defaultMaterialColor, W = c(0).defaultOpacity, B = new p();
              B.crossOrigin = "Anonymous", B.load(d(K), I(j, k, W, false, false, $, void 0, void 0, void 0, ne));
            };
            var S = (j, K, $, ne, k, W, B) => {
              this.toBeDownloaded += 1;
              var X = c(0).defaultMaterialColor, J = c(0).defaultOpacity, F = 0, z = !!(B && B.isInline) && B.isInline, te = B && B.fileFormat ? B.fileFormat : void 0, se = B && B.anatomicalId ? B.anatomicalId : void 0, le = B && B.renderOrder ? B.renderOrder : void 0;
              $ != null && (F = !!$);
              var me = 0;
              ne != null && (me = !!ne);
              var Te = M;
              if (te !== void 0) {
                if (te == "STL") Te = new g();
                else if (te == "OBJ") return Te = new p(), Te.crossOrigin = "Anonymous", void Te.load(K, objloader(j, X, J, F, me, k, se, W), this.onProgress(K), this.onError, B.loaderOptions);
              }
              if (z) {
                var _e = M.parse(K);
                I(j, X, J, F, me, k, se, le, B, W)(_e.geometry, _e.materials);
              } else Te.crossOrigin = "Anonymous", M.load(K, I(j, X, J, F, me, k, se, le, B, W), this.onProgress(K), this.onError(W), B.loaderOptions);
            }, R = function(K, $, ne) {
              var k = 0;
              return (W) => {
                if (++k, W && $ != null && typeof $ == "function" && $(W), k == K && (m == false && v.viewAll(), ne != null && typeof ne == "function")) {
                  ne();
                  var B = v.getZincCameraControls();
                  B && B.calculateMaxAllowedDistance(v);
                }
              };
            };
            this.loadPointsetURL = (j, K, $, ne, k, W, B) => {
              var X = 0;
              this.toBeDownloaded += 1, $ != null && (X = !!$);
              var J = 0;
              ne != null && (J = !!ne);
              var F = !!(B && B.isInline) && B.isInline, z = B && B.anatomicalId ? B.anatomicalId : void 0, te = B && B.renderOrder ? B.renderOrder : void 0;
              if (F) {
                var se = M.parse(K);
                P(j, X, J, k, z, te, W)(se.geometry, se.materials);
              } else M.load(K, P(j, X, J, k, z, te, W), this.onProgress(K), this.onError(W), B.loaderOptions);
            };
            var A = (j, K, $, ne, k, W) => {
              var B = W && W.isInline ? W.isInline : void 0, X = W && W.anatomicalId ? W.anatomicalId : void 0, J = W && W.renderOrder ? W.renderOrder : void 0, F = void 0;
              if ($) {
                if (K && $.images && $.images.source) for (var z, te = $.images.source, se = 0; se < te.length; se++) z = h4(te[se], K), $.images.source[se] = z;
                if ($.type === "slides" && (F = new (c(27)).TextureSlides()), F) {
                  F.groupName = ne;
                  var le = () => {
                    --this.toBeDownloaded, k != null && typeof k == "function" && k(F);
                  };
                  ++this.toBeDownloaded, F.load($, le, B), F.anatomicalId = X, F.setRenderOrder(J), j.addZincObject(F);
                }
              }
            }, C = (j, K, $, ne, k) => () => {
              if (K.readyState == 4 && K.status == 200) {
                var W = JSON.parse(K.responseText);
                A(j, K.responseURL, W, $, ne, k);
              }
            };
            this.loadTextureURL = (j, K, $, ne, k) => {
              var W = !!(k && k.isInline) && k.isInline;
              if (W) A(j, void 0, K, $, ne, k);
              else {
                var B = new XMLHttpRequest();
                B.onreadystatechange = C(j, B, $, ne, k), B.open("GET", d(K), true), B.send();
              }
            }, this.loadGlyphsetURL = (j, K, $, ne, k, W) => {
              var B = !!(W && W.isInline) && W.isInline;
              if (B) _(j, K, $, ne, k, W);
              else {
                var X = new XMLHttpRequest();
                X.onreadystatechange = E(j, X, $, ne, k, W), X.open("GET", d(K), true), X.send();
              }
            };
            var L = (j, K, $, ne, k, W, B, X, J) => {
              var F = { colour: $, opacity: ne, localTimeEnabled: k, localMorphColour: W }, z = new (c(3)).Geometry();
              return z.createMesh(K, X, F), z.getMorph() ? (z.setName(J), j && j.addZincObject(z), z.setDuration(v.getDuration()), z.videoHandler && v.setVideoHandler(z.videoHandler), z) : void 0;
            }, I = (j, K, $, ne, k, W, B, X, J, F) => (z, te) => {
              var se;
              te && te[0] && (se = te[0]);
              var le = L(j, z, K, $, ne, k, void 0, se, W);
              if (le.anatomicalId = B, le.setRenderOrder(X), J.lod && J.lod.levels) for (var [me, Te] of Object.entries(J.lod.levels)) le.addLOD(M, me, Te.URL, Te.Index, J.lod.preload);
              --this.toBeDownloaded, z.dispose(), F != null && typeof F == "function" && F(le);
            }, b = (j) => {
              var K = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/, [, $, ne, k, W, B, X, J] = j.match(K);
              return { years: $, months: ne, weeks: k, days: W, hours: B, mins: X, secs: J };
            };
            this.loadSettings = (j) => {
              if (j) {
                if (j.Duration) {
                  var K = b(j.Duration);
                  v.setDurationFromObject(K);
                }
                if (j.OriginalDuration) {
                  var $ = b(j.OriginalDuration);
                  v.setOriginalDurationFromObject($);
                }
                if (j.TimeStamps) for (var ne in j.TimeStamps) {
                  var k = b(j.TimeStamps[ne]);
                  v.addMetadataTimeStamp(ne, k);
                }
              }
            };
            var O = (j, K, $, ne, k) => {
              if ($) {
                var W = void 0, B = false;
                $.URL ? (W = $.URL, K && (W = h4(W, K))) : $.Inline && (W = $.Inline.URL, B = true);
                var X = {};
                if ($.LOD && $.LOD.Levels) {
                  X.preload = !!$.LOD.Preload, X.levels = {};
                  for (var [J, F] of Object.entries($.LOD.Levels)) X.levels[J] = {}, X.levels[J].URL = h4(F.URL, K), X.levels[J].Index = F.Index;
                }
                var z = $.GroupName;
                (z === void 0 || z === "") && (z = "_Unnamed");
                var te = { loaderOptions: { index: $.Index }, isInline: B, fileFormat: $.FileFormat, anatomicalId: $.AnatomicalId, compression: $.compression, lod: X, renderOrder: ne };
                switch ($.Type) {
                  case "Surfaces":
                    S(j, W, $.MorphVertices, $.MorphColours, z, k, te);
                    break;
                  case "Glyph":
                    var se;
                    B ? se = $.Inline.GlyphGeometriesURL : (se = $.GlyphGeometriesURL, se = h4($.GlyphGeometriesURL, K)), $.DisplayLabels && (te.displayLabels = true), this.loadGlyphsetURL(j, W, se, z, k, te);
                    break;
                  case "Points":
                    this.loadPointsetURL(j, W, $.MorphVertices, $.MorphColours, z, k, te);
                    break;
                  case "Lines":
                    this.loadLinesURL(j, W, $.MorphVertices, $.MorphColours, z, k, te);
                    break;
                  case "Texture":
                    this.loadTextureURL(j, W, z, k, te);
                    break;
                }
              }
            }, N = (j, K, $) => {
              if (K) {
                var ne = void 0, k = false;
                switch (K.URL ? (ne = K.URL, j && (ne = h4(K.URL, j))) : K.Inline && (ne = K.Inline.URL, k = true), K.Type) {
                  case "View":
                    k ? (v.setupMultipleViews("default", { default: ne }), m = true, $ != null && typeof $ == "function" && $()) : this.loadViewURL(ne, $);
                    break;
                  case "Settings":
                    this.loadSettings(K);
                    break;
                }
              }
            };
            this.loadGLTF = (j, K, $, ne, k) => {
              var W = new (c(39)).GLTFToZincJSLoader();
              W.load(v, j, K, $, ne, k);
            };
            var D = (j, K, $, ne) => {
              if ($.Primitives && $.Primitives.forEach((X) => {
                var J = 1;
                X.Order && (J = X.Order), O(j, K, X, J, ne);
              }), $.Transformation && j.setTransformation($.Transformation), $.Children) for (var [k, W] of Object.entries($.Children)) {
                var B = j.findOrCreateChildFromPath(k);
                B && D(B, K, W, ne);
              }
            }, U = (j, K) => {
              var $, ne, k = j, W = K == null || ($ = K.enabled) === null || $ === void 0 ? void 0 : $.include, B = K == null || (ne = K.enabled) === null || ne === void 0 ? void 0 : ne.exclude;
              return (W != null && W.length || B != null && B.length) && (W && (k = j.filter((X) => {
                if (X.Type === "View") return true;
                for (var J = 0; J < W.length; J++) if (f(X.RegionPath, X.GroupName, W[J])) return true;
                return false;
              })), B && (k = k.filter((X) => {
                if (X.Type === "View") return true;
                for (var J = 0; J < B.length; J++) if (f(X.RegionPath, X.GroupName, B[J])) return false;
                return true;
              }))), k;
            }, V = (j, K) => Array.isArray(j) ? U(j, K) : j, H = (j, K) => {
              if (Array.isArray(j)) {
                for (var $ = 0, ne = 0; ne < j.length; ne++) j[ne].Type && (K && j[ne].Type === "View" || j[ne].Type === "Surfaces" || j[ne].Type === "Glyph" || j[ne].Type === "Points" || j[ne].Type === "Lines" || j[ne].Type === "Texture") && $++;
                return $;
              }
              return 0;
            }, Y = (j) => {
              var K = j.Primitives ? H(j.Primitives, false) : 0;
              return j.Children && Object.values(j.Children).forEach(($) => {
                K += Y($);
              }), K;
            }, re = (j) => Array.isArray(j) ? H(j, true) : typeof j == "object" && j !== null && j.Version === "2.0" ? Y(j.Regions) : void 0, ae = (j, K, $, ne, k) => {
              var W = j;
              $.RegionPath && $.RegionPath !== "" && (W = j.findOrCreateChildFromPath($.RegionPath)), O(W, K, $, 2 * ne, k);
            }, ee = (j, K, $, ne, k, W) => {
              for (var B = V(K, W), X = re(B), J = new R(X, ne, k), F = 0; F < K.length; F++) N($, B[F], J);
              for (var z = 0; z < K.length; z++) ae(j, $, B[z], z, J);
            }, oe = (j, K, $, ne, k) => {
              var W = re(K), B = new R(W, ne, k);
              K.Settings && this.loadSettings(K.Settings), K.Views && T($, K.Views), K.Regions && D(j, $, K.Regions, B);
            };
            this.loadMetadataURL = (j, K, $, ne, k) => {
              var W = new XMLHttpRequest(), B = d(K);
              W.onreadystatechange = () => {
                if (W.readyState == 4 && W.status == 200) {
                  v.resetMetadata(), v.resetDuration(), m = false;
                  var X = W.responseURL;
                  X === void 0 && (X = new URL(B).href);
                  var J = JSON.parse(W.responseText);
                  Array.isArray(J) ? ee(j, J, X, $, ne, k) : typeof J == "object" && J !== null && J.Version == "2.0" && oe(j, J, X, $, ne);
                }
              }, W.open("GET", B, true), 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, false)) return false;
                return true;
              }
              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, true);
                if (84 + v * 50 === y.byteLength) return true;
                for (var m = [115, 111, 108, 105, 100], x = 0; 5 > x; x++)
                  if (g(m, y, x)) return false;
                return true;
              }(p) ? function(u) {
                for (var y, v, m, x, M, T, w, _, E = new DataView(u), P = E.getUint32(80, true), S = false, R = 0; R < 70; R++) E.getUint32(R, false) == 1129270351 && E.getUint8(R + 4) == 82 && E.getUint8(R + 5) == 61 && (S = true, x = new Float32Array(3 * (3 * P)), M = E.getUint8(R + 6) / 255, T = E.getUint8(R + 7) / 255, w = E.getUint8(R + 8) / 255, _ = E.getUint8(R + 9) / 255);
                for (var A = new l.BufferGeometry(), C = new Float32Array(3 * (3 * P)), L = new Float32Array(3 * (3 * P)), I = 0; I < P; I++) {
                  var b = 84 + I * 50, O = E.getFloat32(b, true), N = E.getFloat32(b + 4, true), D = E.getFloat32(b + 8, true);
                  if (S) {
                    var U = E.getUint16(b + 48, true);
                    32768 & U ? (y = M, v = T, m = w) : (y = (31 & U) / 31, v = (31 & U >> 5) / 31, m = (31 & U >> 10) / 31);
                  }
                  for (var V = 1; 3 >= V; V++) {
                    var H = b + 12 * V, Y = 3 * (3 * I) + 3 * (V - 1);
                    C[Y] = E.getFloat32(H, true), C[Y + 1] = E.getFloat32(H + 4, true), C[Y + 2] = E.getFloat32(H + 8, true), L[Y] = O, L[Y + 1] = N, L[Y + 2] = D, S && (x[Y] = y, x[Y + 1] = v, x[Y + 2] = m);
                  }
                }
                return A.setAttribute("position", new l.BufferAttribute(C, 3)), A.setAttribute("normal", new l.BufferAttribute(L, 3)), S && (A.setAttribute("color", new l.BufferAttribute(x, 3)), A.hasColors = true, A.alpha = _), A;
              }(p) : function(u) {
                for (var y, v = new l.BufferGeometry(), m = /solid([\s\S]*?)endsolid/g, x = /facet([\s\S]*?)endfacet/g, M = 0, T = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, w = new RegExp("vertex" + T + T + T, "g"), _ = new RegExp("normal" + T + T + T, "g"), E = [], P = [], S = new l.Vector3(), R = 0, A = 0, C = 0; (y = m.exec(u)) !== null; ) {
                  A = C;
                  for (var L = y[0]; (y = x.exec(L)) !== null; ) {
                    for (var I = 0, b = 0, O = y[0]; (y = _.exec(O)) !== null; ) S.x = parseFloat(y[1]), S.y = parseFloat(y[2]), S.z = parseFloat(y[3]), b++;
                    for (; (y = w.exec(O)) !== null; ) E.push(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])), P.push(S.x, S.y, S.z), I++, C++;
                    b !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + M), I !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + M), M++;
                  }
                  var N = A, D = C - A;
                  v.addGroup(N, D, R), R++;
                }
                return v.setAttribute("position", new l.Float32BufferAttribute(E, 3)), v.setAttribute("normal", new l.Float32BufferAttribute(P, 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 */
              M
            )
            /* harmony export */
          });
          var l = c(4), d = /^[og]\s*(.+)?/, h4 = /^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 T = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(_, E) {
              if (this.object && this.object.fromDeclaration === false) return this.object.name = _, void (this.object.fromDeclaration = E !== false);
              var P = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
              if (this.object && typeof this.object._finalize == "function" && this.object._finalize(true), this.object = { name: _ || "", fromDeclaration: E !== false, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: false }, materials: [], smooth: true, startMaterial: function(A, C) {
                var L = this._finalize(false);
                L && (L.inherited || 0 >= L.groupCount) && this.materials.splice(L.index, 1);
                var I = { index: this.materials.length, name: A || "", mtllib: Array.isArray(C) && 0 < C.length ? C[C.length - 1] : "", smooth: L === void 0 ? this.smooth : L.smooth, groupStart: L === void 0 ? 0 : L.groupEnd, groupEnd: -1, groupCount: -1, inherited: false, clone: function(O) {
                  var N = { index: typeof O == "number" ? O : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: false };
                  return N.clone = this.clone.bind(N), N;
                } };
                return this.materials.push(I), I;
              }, currentMaterial: function() {
                return 0 < this.materials.length ? this.materials[this.materials.length - 1] : void 0;
              }, _finalize: function(A) {
                var C = this.currentMaterial();
                if (C && C.groupEnd === -1 && (C.groupEnd = this.geometry.vertices.length / 3, C.groupCount = C.groupEnd - C.groupStart, C.inherited = false), A && 1 < this.materials.length) for (var L = this.materials.length - 1; 0 <= L; L--) 0 >= this.materials[L].groupCount && this.materials.splice(L, 1);
                return A && this.materials.length === 0 && this.materials.push({ name: "", smooth: this.smooth }), C;
              } }, P && P.name && typeof P.clone == "function") {
                var S = P.clone(0);
                S.inherited = true, this.object.materials.push(S);
              }
              this.objects.push(this.object);
            }, finalize: function() {
              this.object && typeof this.object._finalize == "function" && this.object._finalize(true);
            }, parseVertexIndex: function(_, E) {
              var P = parseInt(_, 10);
              return 3 * (0 <= P ? P - 1 : P + E / 3);
            }, parseNormalIndex: function(_, E) {
              var P = parseInt(_, 10);
              return 3 * (0 <= P ? P - 1 : P + E / 3);
            }, parseUVIndex: function(_, E) {
              var P = parseInt(_, 10);
              return 2 * (0 <= P ? P - 1 : P + E / 2);
            }, addVertex: function(_, E, P) {
              var S = this.vertices, R = this.object.geometry.vertices;
              R.push(S[_ + 0], S[_ + 1], S[_ + 2]), R.push(S[E + 0], S[E + 1], S[E + 2]), R.push(S[P + 0], S[P + 1], S[P + 2]);
            }, addVertexPoint: function(_) {
              var E = this.vertices, P = this.object.geometry.vertices;
              P.push(E[_ + 0], E[_ + 1], E[_ + 2]);
            }, addVertexLine: function(_) {
              var E = this.vertices, P = this.object.geometry.vertices;
              P.push(E[_ + 0], E[_ + 1], E[_ + 2]);
            }, addNormal: function(_, E, P) {
              var S = this.normals, R = this.object.geometry.normals;
              R.push(S[_ + 0], S[_ + 1], S[_ + 2]), R.push(S[E + 0], S[E + 1], S[E + 2]), R.push(S[P + 0], S[P + 1], S[P + 2]);
            }, addFaceNormal: function(_, E, P) {
              var S = this.vertices, R = this.object.geometry.normals;
              p.fromArray(S, _), u.fromArray(S, E), y.fromArray(S, P), m.subVectors(y, u), v.subVectors(p, u), m.cross(v), m.normalize(), R.push(m.x, m.y, m.z), R.push(m.x, m.y, m.z), R.push(m.x, m.y, m.z);
            }, addColor: function(_, E, P) {
              var S = this.colors, R = this.object.geometry.colors;
              S[_] !== void 0 && R.push(S[_ + 0], S[_ + 1], S[_ + 2]), S[E] !== void 0 && R.push(S[E + 0], S[E + 1], S[E + 2]), S[P] !== void 0 && R.push(S[P + 0], S[P + 1], S[P + 2]);
            }, addUV: function(_, E, P) {
              var S = this.uvs, R = this.object.geometry.uvs;
              R.push(S[_ + 0], S[_ + 1]), R.push(S[E + 0], S[E + 1]), R.push(S[P + 0], S[P + 1]);
            }, addDefaultUV: function() {
              var _ = this.object.geometry.uvs;
              _.push(0, 0), _.push(0, 0), _.push(0, 0);
            }, addUVLine: function(_) {
              var E = this.uvs, P = this.object.geometry.uvs;
              P.push(E[_ + 0], E[_ + 1]);
            }, addFace: function(_, E, P, S, R, A, C, L, I) {
              var b = this.vertices.length, O = this.parseVertexIndex(_, b), N = this.parseVertexIndex(E, b), D = this.parseVertexIndex(P, b);
              if (this.addVertex(O, N, D), this.addColor(O, N, D), C !== void 0 && C !== "") {
                var U = this.normals.length;
                O = this.parseNormalIndex(C, U), N = this.parseNormalIndex(L, U), D = this.parseNormalIndex(I, U), this.addNormal(O, N, D);
              } else this.addFaceNormal(O, N, D);
              if (S !== void 0 && S !== "") {
                var V = this.uvs.length;
                O = this.parseUVIndex(S, V), N = this.parseUVIndex(R, V), D = this.parseUVIndex(A, V), this.addUV(O, N, D), this.object.geometry.hasUVIndices = true;
              } else
                this.addDefaultUV();
            }, addPointGeometry: function(_) {
              this.object.geometry.type = "Points";
              for (var E, P = this.vertices.length, S = 0, R = _.length; S < R; S++) E = this.parseVertexIndex(_[S], P), this.addVertexPoint(E), this.addColor(E);
            }, addLineGeometry: function(_, E) {
              this.object.geometry.type = "Line";
              for (var P = this.vertices.length, S = this.uvs.length, R = 0, A = _.length; R < A; R++) this.addVertexLine(this.parseVertexIndex(_[R], P));
              for (var C = 0, L = E.length; C < L; C++) this.addUVLine(this.parseUVIndex(E[C], S));
            } };
            return T.startObject("", false), T;
          }
          class M extends l.Loader {
            constructor(w) {
              super(w), this.materials = null;
            }
            load(w, _, E, P) {
              var S = this, R = new l.FileLoader(this.manager);
              R.setPath(this.path), R.setRequestHeader(this.requestHeader), R.setWithCredentials(this.withCredentials), R.load(w, function(A) {
                try {
                  _(S.parse(A));
                } catch (C) {
                  P ? P(C) : console.error(C), S.manager.itemError(w);
                }
              }, E, P);
            }
            setMaterials(w) {
              return this.materials = w, this;
            }
            parse(w) {
              var _ = new x();
              w.indexOf(`\r
`) !== -1 && (w = w.replace(/\r\n/g, `
`)), w.indexOf(`\\
`) !== -1 && (w = w.replace(/\\\n/g, ""));
              for (var E = w.split(`
`), P = "", S = "", R = 0, A = [], C = typeof "".trimLeft == "function", L = 0, I = E.length; L < I; L++) if (P = E[L], P = C ? P.trimLeft() : P.trim(), R = P.length, R !== 0 && (S = P.charAt(0), S !== "#"))
                if (S === "v") {
                  var b = P.split(/\s+/);
                  switch (b[0]) {
                    case "v":
                      _.vertices.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])), 7 <= b.length ? _.colors.push(parseFloat(b[4]), parseFloat(b[5]), parseFloat(b[6])) : _.colors.push(void 0, void 0, void 0);
                      break;
                    case "vn":
                      _.normals.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3]));
                      break;
                    case "vt":
                      _.uvs.push(parseFloat(b[1]), parseFloat(b[2]));
                  }
                } else if (S === "f") {
                  for (var O, N = P.substr(1).trim(), D = N.split(/\s+/), U = [], V = 0, H = D.length; V < H; V++) if (O = D[V], 0 < O.length) {
                    var Y = O.split("/");
                    U.push(Y);
                  }
                  for (var re = U[0], ae = 1, ee = U.length - 1; ae < ee; ae++) {
                    var oe = U[ae], j = U[ae + 1];
                    _.addFace(re[0], oe[0], j[0], re[1], oe[1], j[1], re[2], oe[2], j[2]);
                  }
                } else if (S === "l") {
                  var K = P.substring(1).trim().split(" "), $ = [], ne = [];
                  if (P.indexOf("/") === -1) $ = K;
                  else for (var k, W = 0, B = K.length; W < B; W++) k = K[W].split("/"), k[0] !== "" && $.push(k[0]), k[1] !== "" && ne.push(k[1]);
                  _.addLineGeometry($, ne);
                } else if (S === "p") {
                  var X = P.substr(1).trim(), J = X.split(" ");
                  _.addPointGeometry(J);
                } else if ((A = d.exec(P)) !== null) {
                  var F = (" " + A[0].substr(1).trim()).substr(1);
                  _.startObject(F);
                } else if (f.test(P))
                  _.object.startMaterial(P.substring(7).trim(), _.materialLibraries);
                else if (h4.test(P))
                  _.materialLibraries.push(P.substring(7).trim());
                else if (g.test(P))
                  console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
                else if (S === "s") {
                  if (A = P.split(" "), 1 < A.length) {
                    var z = A[1].trim().toLowerCase();
                    _.object.smooth = z !== "0" && z !== "off";
                  } else
                    _.object.smooth = true;
                  var te = _.object.currentMaterial();
                  te && (te.smooth = _.object.smooth);
                } else {
                  if (P === "\0") continue;
                  console.warn('THREE.OBJLoader: Unexpected line: "' + P + '"');
                }
              _.finalize();
              var se = new l.Group();
              se.materialLibraries = [].concat(_.materialLibraries);
              var le = _.objects.length !== 1 || _.objects[0].geometry.vertices.length !== 0;
              if (le == true) for (var me = 0, Te = _.objects.length; me < Te; me++) {
                var _e = _.objects[me], fe = _e.geometry, we = _e.materials, ie = fe.type === "Line", pe = fe.type === "Points", be = false;
                if (fe.vertices.length !== 0) {
                  var Be = new l.BufferGeometry();
                  Be.setAttribute("position", new l.Float32BufferAttribute(fe.vertices, 3)), 0 < fe.normals.length && Be.setAttribute("normal", new l.Float32BufferAttribute(fe.normals, 3)), 0 < fe.colors.length && (be = true, Be.setAttribute("color", new l.Float32BufferAttribute(fe.colors, 3))), fe.hasUVIndices === true && Be.setAttribute("uv", new l.Float32BufferAttribute(fe.uvs, 2));
                  for (var Oe = [], $e = 0, ot = we.length; $e < ot; $e++) {
                    var qe = we[$e], wt = qe.name + "_" + qe.smooth + "_" + be, Ne = _.materials[wt];
                    if (this.materials !== null) {
                      if (Ne = this.materials.create(qe.name), ie && Ne && !(Ne instanceof l.LineBasicMaterial)) {
                        var nt = new l.LineBasicMaterial();
                        l.Material.prototype.copy.call(nt, Ne), nt.color.copy(Ne.color), Ne = nt;
                      } else if (pe && Ne && !(Ne instanceof l.PointsMaterial)) {
                        var tt = new l.PointsMaterial({ size: 10, sizeAttenuation: false });
                        l.Material.prototype.copy.call(tt, Ne), tt.color.copy(Ne.color), tt.map = Ne.map, Ne = tt;
                      }
                    }
                    Ne === void 0 && (Ne = ie ? new l.LineBasicMaterial() : pe ? new l.PointsMaterial({ size: 1, sizeAttenuation: false }) : new l.MeshPhongMaterial(), Ne.name = qe.name, Ne.flatShading = !qe.smooth, Ne.vertexColors = be, _.materials[wt] = Ne), Oe.push(Ne);
                  }
                  var Kt = void 0;
                  if (1 < Oe.length) {
                    for (var qt, Rt = 0, Nt = we.length; Rt < Nt; Rt++) qt = we[Rt], Be.addGroup(qt.groupStart, qt.groupCount, Rt);
                    Kt = ie ? new l.LineSegments(Be, Oe) : pe ? new l.Points(Be, Oe) : new l.Mesh(Be, Oe);
                  } else Kt = ie ? new l.LineSegments(Be, Oe[0]) : pe ? new l.Points(Be, Oe[0]) : new l.Mesh(Be, Oe[0]);
                  Kt.name = _e.name, se.add(Kt);
                }
              }
              else if (0 < _.vertices.length) {
                var Gi = new l.PointsMaterial({ size: 1, sizeAttenuation: false }), Hi = new l.BufferGeometry();
                Hi.setAttribute("position", new l.Float32BufferAttribute(_.vertices, 3)), 0 < _.colors.length && _.colors[0] !== void 0 && (Hi.setAttribute("color", new l.Float32BufferAttribute(_.colors, 3)), Gi.vertexColors = true);
                var oi = new l.Points(Hi, Gi);
                se.add(oi);
              }
              return se;
            }
          }
        },
        /* 38 */
        /***/
        (o, a, c) => {
          function l(M, T) {
            var w = Object.keys(M);
            if (Object.getOwnPropertySymbols) {
              var _ = Object.getOwnPropertySymbols(M);
              T && (_ = _.filter(function(E) {
                return Object.getOwnPropertyDescriptor(M, E).enumerable;
              })), w.push.apply(w, _);
            }
            return w;
          }
          function d(M) {
            for (var T, w = 1; w < arguments.length; w++) T = arguments[w] == null ? {} : arguments[w], w % 2 ? l(Object(T), true).forEach(function(_) {
              h4(M, _, T[_]);
            }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(M, Object.getOwnPropertyDescriptors(T)) : l(Object(T)).forEach(function(_) {
              Object.defineProperty(M, _, Object.getOwnPropertyDescriptor(T, _));
            });
            return M;
          }
          function h4(M, T, w) {
            return T = f(T), T in M ? Object.defineProperty(M, T, { value: w, enumerable: true, configurable: true, writable: true }) : M[T] = w, M;
          }
          function f(M) {
            var T = g(M, "string");
            return typeof T == "symbol" ? T : T + "";
          }
          function g(M, T) {
            if (typeof M != "object" || !M) return M;
            var w = M[Symbol.toPrimitive];
            if (w !== void 0) {
              var _ = w.call(M, T || "default");
              if (typeof _ != "object") return _;
              throw new TypeError("@@toPrimitive must return a primitive value.");
            }
            return (T === "string" ? String : Number)(M);
          }
          var p = c(19).JSONLoader, u = c(4), y = u.FileLoader, v = (M) => {
            var T = (_, E) => {
              _.merge(E);
            };
            if (M && 0 < M.length) {
              for (; 1 < M.length; ) {
                var w = M.splice(1, 1);
                T(M[0], w[0]);
              }
              return M[0];
            }
          }, m = function(T, w, _) {
            var E = new y(), P = new p();
            E.crossOrigin = w;
            var S = T, R = _, A = void 0, C = false, L = false, I = void 0, b = [], O = (V) => {
              var H = A[V.index];
              if (H) {
                var Y = P.parse(H);
                V.onLoad(Y.geometry, Y.materials);
              } else N(V);
            }, N = (V) => {
              V.onError && (!I && (I = { responseURL: S }), V.onError(I));
            };
            this.downloadCompleted = (V) => {
              try {
                A = JSON.parse(V[0]), C = false, L = true, Array.isArray(A) ? b.forEach((H) => O(H)) : b.forEach((H) => N(H));
              } catch {
                b.forEach((Y) => N(Y));
              }
            };
            var D = () => (V) => {
              I = V, L = true, C = false, b.forEach((H) => {
                N(H);
              });
            }, U = () => (V) => {
              b.forEach((H) => {
                H.onProgress && H.onProgress(V);
              });
            };
            this.load = (V, H, Y, re) => {
              var ae = { index: V, onLoad: H, onProgress: Y, onError: re };
              L ? A ? O(ae) : N(I) : C ? b.push(ae) : (b.push(ae), C = true, E.load(S, R, U, D));
            };
          }, x = function(T, w) {
            var _ = [], E = T, P = w, S = 0;
            this.itemDownloaded = (R, A) => {
              if (_[R] = A, S++, S == E) {
                for (var C = _[0][1], L = _.map((O) => O[0]), I = v(L), b = 1; b < E; b++) _[R][0].dispose(), _[R][1].forEach((O) => O.dispose());
                P(I, C);
              }
            };
          };
          a.PrimitivesLoader = function() {
            var M = 0, T = 20;
            this.crossOrigin = "Anonymous";
            var w = new p(), _ = [], E = {}, P = (C, L, I, b, O) => {
              var N = C.length, D = new x(N, L), U = 0;
              C.forEach((V) => {
                var H = O ? d({}, O) : {};
                H.msHandler = D, H.order = U, U++, R(V, L, I, b, H);
              });
            }, S = (C, L, I, b, O) => {
              var N = O ? d({}, O) : {}, D = E[C];
              if (!D) if (T > M) {
                var U = new A(void 0, this, N);
                ++M, D = new m(C, this.crossOrigin, U), E[C] = D;
              } else _.push({ url: C, onLoad: L, onProgress: I, onError: b, options: O });
              D && (N.isHandler = D, D.load(O.index, L, I, b));
            }, R = (C, L, I, b, O) => {
              if (O && O.index !== void 0) S(C, L, I, b, O);
              else if (T > M) {
                ++M;
                var N = new A(L, this, O), D = new A(b, this, O);
                w.crossOrigin = this.crossOrigin, w.load(C, N, I, D);
              } else _.push({ url: C, onLoad: L, onProgress: I, onError: b, options: O });
            };
            this.load = (C, L, I, b, O) => {
              Array.isArray(C) ? P(C, L, I, b, O) : R(C, L, I, b, O);
            }, this.loadFromWaitingList = () => {
              for (; T > M; ) {
                var C = _.shift();
                if (C) this.load(C.url, C.onLoad, C.onProgress, C.onError, C.options);
                else return;
              }
            }, this.itemRemainingCheck = () => {
              if (_.length === 0 && M == 0) for (var C in E) E.hasOwnProperty(C) && delete E[C];
            };
            var A = function(L, I, b) {
              return function() {
                --M;
                for (var O = arguments.length, N = Array(O), D = 0; D < O; D++) N[D] = arguments[D];
                b != null && b.msHandler ? b.msHandler.itemDownloaded(b.order, N) : b != null && b.isHandler ? b.isHandler.downloadCompleted(N) : L && L(...N), I.loadFromWaitingList(), I.itemRemainingCheck();
              };
            };
            this.parse = (C) => w.parse(C);
          };
        },
        /* 39 */
        /***/
        (o, a, c) => {
          c(4);
          var l = c(40).GLTFLoader, d = function() {
            var h4 = 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 = false, x = false;
                    f.geometry && f.geometry.morphAttributes && (m = !!f.geometry.morphAttributes.position, x = !!f.geometry.morphAttributes.color), v.setMesh(f.clone(), m, x);
                    var M = v.getMorph();
                    v.groupName = M.name, M.matrixAutoUpdate = true, g.addZincObject(v), u != null && typeof u == "function" && u(v);
                  }
                } else if (f.name !== "" && (g && (y = g.findOrCreateChildFromPath(f.name)), y)) {
                  var T = y.getGroup();
                  T.position.copy(f.position), T.rotation.copy(f.rotation), T.quaternion.copy(f.quaternion), T.matrixAutoUpdate = true;
                }
              }
              p++, f.children.forEach((w) => {
                h4.parseGLTFObjects(w, 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(M) {
                console.log(M), h4.parseGLTFObjects(M.scene, g, 0, u), h4.setCamera(f), y != null && typeof y == "function" && y();
              });
            };
          };
          a.GLTFToZincJSLoader = d;
        },
        /* 40 */
        /***/
        (o) => {
          o.exports = Mz;
        },
        /* 41 */
        /***/
        (o, a, c) => {
          var l = c(42).GLTFExporter, d = function(h4) {
            var f = h4;
            this.exportGLTF = (g) => {
              var p = f.getRootRegion(), u = p.getAllObjects(true), 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(M) {
                  x(M);
                }, m);
              });
            };
          };
          a.SceneExporter = d;
        },
        /* 42 */
        /***/
        (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 A(b);
              }), this.register(function(b) {
                return new C(b);
              }), this.register(function(b) {
                return new L(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, O, N) {
              for (var D = new R(), U = [], V = 0, H = this.pluginCallbacks.length; V < H; V++) U.push(this.pluginCallbacks[V](D));
              D.setPlugins(U), D.write(b, O, N);
            }
          }
          var h4 = { 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] = h4.NEAREST, f[l.NearestMipmapNearestFilter] = h4.NEAREST_MIPMAP_NEAREST, f[l.NearestMipmapLinearFilter] = h4.NEAREST_MIPMAP_LINEAR, f[l.LinearFilter] = h4.LINEAR, f[l.LinearMipmapNearestFilter] = h4.LINEAR_MIPMAP_NEAREST, f[l.LinearMipmapLinearFilter] = h4.LINEAR_MIPMAP_LINEAR, f[l.ClampToEdgeWrapping] = h4.CLAMP_TO_EDGE, f[l.RepeatWrapping] = h4.REPEAT, f[l.MirroredRepeatWrapping] = h4.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 M(I, b) {
            return I.length === b.length && I.every(function(O, N) {
              return O === b[N];
            });
          }
          function T(I) {
            if (window.TextEncoder !== void 0) return new TextEncoder().encode(I).buffer;
            for (var b, O = new Uint8Array(new ArrayBuffer(I.length)), N = 0, D = I.length; N < D; N++)
              b = I.charCodeAt(N), O[N] = 255 < b ? 32 : b;
            return O.buffer;
          }
          function w(I) {
            return M(I.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
          }
          function _(I, b, O) {
            for (var N = { min: Array(I.itemSize).fill(Number.POSITIVE_INFINITY), max: Array(I.itemSize).fill(Number.NEGATIVE_INFINITY) }, D = b; D < b + O; D++) for (var U, V = 0; V < I.itemSize; V++) U = void 0, 4 < I.itemSize ? U = I.array[D * I.itemSize + V] : V === 0 ? U = I.getX(D) : V === 1 ? U = I.getY(D) : V === 2 ? U = I.getZ(D) : V == 3 && (U = I.getW(D)), N.min[V] = Math.min(N.min[V], U), N.max[V] = Math.max(N.max[V], U);
            return N;
          }
          function E(I) {
            return 4 * Math.ceil(I / 4);
          }
          function P(I) {
            var b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 0, O = E(I.byteLength);
            if (O !== I.byteLength) {
              var N = new Uint8Array(O);
              if (N.set(new Uint8Array(I)), b !== 0) for (var D = I.byteLength; D < O; D++) N[D] = b;
              return N.buffer;
            }
            return I;
          }
          var S = null;
          class R {
            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, O, N) {
              this.options = Object.assign({}, {
                // default options
                binary: false,
                trs: false,
                onlyVisible: true,
                truncateDrawRange: true,
                embedImages: true,
                maxTextureSize: 1 / 0,
                animations: [],
                includeCustomExtensions: false
              }, N), 0 < this.options.animations.length && (this.options.trs = true), this.processInput(b);
              var D = this;
              Promise.all(this.pending).then(function() {
                var U = D.buffers, V = D.json, H = D.options, Y = D.extensionsUsed, re = new Blob(U, { type: "application/octet-stream" }), ae = Object.keys(Y);
                if (0 < ae.length && (V.extensionsUsed = ae), V.buffers && 0 < V.buffers.length && (V.buffers[0].byteLength = re.size), H.binary === true) {
                  var ee = new window.FileReader();
                  ee.readAsArrayBuffer(re), ee.onloadend = function() {
                    var j = P(ee.result), K = new DataView(new ArrayBuffer(v));
                    K.setUint32(0, j.byteLength, true), K.setUint32(4, x, true);
                    var $ = P(T(JSON.stringify(V)), 32), ne = new DataView(new ArrayBuffer(v));
                    ne.setUint32(0, $.byteLength, true), ne.setUint32(4, m, true);
                    var k = new ArrayBuffer(p), W = new DataView(k);
                    W.setUint32(0, u, true), W.setUint32(4, y, true);
                    var B = p + ne.byteLength + $.byteLength + K.byteLength + j.byteLength;
                    W.setUint32(8, B, true);
                    var X = new Blob([k, ne, $, K, j], { type: "application/octet-stream" }), J = new window.FileReader();
                    J.readAsArrayBuffer(X), J.onloadend = function() {
                      O(J.result);
                    };
                  };
                } else if (V.buffers && 0 < V.buffers.length) {
                  var oe = new window.FileReader();
                  oe.readAsDataURL(re), oe.onloadend = function() {
                    var j = oe.result;
                    V.buffers[0].uri = j, O(V);
                  };
                } else O(V);
              });
            }
            /**
            * Serializes a userData.
            *
            * @param {THREE.Object3D|THREE.Material} object
            * @param {Object} objectDef
            */
            serializeUserData(b, O) {
              if (!(b.userData && b.userData.isZincObject) && Object.keys(b.userData).length !== 0) {
                var N = this.options, D = this.extensionsUsed;
                try {
                  var U = JSON.parse(JSON.stringify(b.userData));
                  if (N.includeCustomExtensions && U.gltfExtensions) {
                    for (var V in O.extensions === void 0 && (O.extensions = {}), U.gltfExtensions) O.extensions[V] = U.gltfExtensions[V], D[V] = true;
                    delete U.gltfExtensions;
                  }
                  0 < Object.keys(U).length && (O.extras = U);
                } catch (H) {
                  console.warn("THREE.GLTFExporter: userData of '" + b.name + "' won't be serialized because of JSON.stringify error - " + H.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 O = this.cache;
              if (O.attributesNormalized.has(b)) return false;
              for (var N = new l.Vector3(), D = 0, U = b.count; D < U; D++)
                if (5e-4 < Math.abs(N.fromBufferAttribute(b, D).length() - 1)) return false;
              return true;
            }
            /**
            * Creates normalized normal buffer attribute.
            *
            * @param {BufferAttribute} normal
            * @returns {BufferAttribute}
            *
            */
            createNormalizedNormalAttribute(b) {
              var O = this.cache;
              if (O.attributesNormalized.has(b)) return O.attributesNormalized.get(b);
              for (var N = b.clone(), D = new l.Vector3(), U = 0, V = N.count; U < V; U++) D.fromBufferAttribute(N, U), D.x === 0 && D.y === 0 && D.z === 0 ? D.setX(1) : D.normalize(), N.setXYZ(U, D.x, D.y, D.z);
              return O.attributesNormalized.set(b, N), N;
            }
            /**
            * 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, O) {
              var N = false, D = {};
              (O.offset.x !== 0 || O.offset.y !== 0) && (D.offset = O.offset.toArray(), N = true), O.rotation !== 0 && (D.rotation = O.rotation, N = true), (O.repeat.x !== 1 || O.repeat.y !== 1) && (D.scale = O.repeat.toArray(), N = true), N && (b.extensions = b.extensions || {}, b.extensions.KHR_texture_transform = D, this.extensionsUsed.KHR_texture_transform = true);
            }
            /**
            * Process a buffer to append to the default one.
            * @param  {ArrayBuffer} buffer
            * @return {Integer}
            */
            processBuffer(b) {
              var O = this.json, N = this.buffers;
              return O.buffers || (O.buffers = [{ byteLength: 0 }]), N.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, O, N, D, U) {
              var V = this.json;
              V.bufferViews || (V.bufferViews = []);
              for (var H = O === h4.UNSIGNED_BYTE ? 1 : O === h4.UNSIGNED_SHORT ? 2 : 4, Y = E(D * b.itemSize * H), re = new DataView(new ArrayBuffer(Y)), ae = 0, ee = N; ee < N + D; ee++) for (var oe, j = 0; j < b.itemSize; j++) oe = void 0, 4 < b.itemSize ? oe = b.array[ee * b.itemSize + j] : j === 0 ? oe = b.getX(ee) : j === 1 ? oe = b.getY(ee) : j === 2 ? oe = b.getZ(ee) : j == 3 && (oe = b.getW(ee)), O === h4.FLOAT ? re.setFloat32(ae, oe, true) : O === h4.UNSIGNED_INT ? re.setUint32(ae, oe, true) : O === h4.UNSIGNED_SHORT ? re.setUint16(ae, oe, true) : O === h4.UNSIGNED_BYTE && re.setUint8(ae, oe), ae += H;
              var K = { buffer: this.processBuffer(re.buffer), byteOffset: this.byteOffset, byteLength: Y };
              U !== void 0 && (K.target = U), U === h4.ARRAY_BUFFER && (K.byteStride = b.itemSize * H), this.byteOffset += Y, V.bufferViews.push(K);
              var $ = { id: V.bufferViews.length - 1, byteLength: 0 };
              return $;
            }
            /**
            * Process and generate a BufferView from an image Blob.
            * @param {Blob} blob
            * @return {Promise<Integer>}
            */
            processBufferViewImage(b) {
              var O = this, N = O.json;
              return N.bufferViews || (N.bufferViews = []), new Promise(function(D) {
                var U = new window.FileReader();
                U.readAsArrayBuffer(b), U.onloadend = function() {
                  var V = P(U.result), H = { buffer: O.processBuffer(V), byteOffset: O.byteOffset, byteLength: V.byteLength };
                  O.byteOffset += V.byteLength, D(N.bufferViews.push(H) - 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, O, N, D) {
              var U, V = this.options, H = this.json;
              if (b.array.constructor === Float32Array) U = h4.FLOAT;
              else if (b.array.constructor === Uint32Array) U = h4.UNSIGNED_INT;
              else if (b.array.constructor === Uint16Array) U = h4.UNSIGNED_SHORT;
              else if (b.array.constructor === Uint8Array) U = h4.UNSIGNED_BYTE;
              else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");
              if (N === void 0 && (N = 0), D === void 0 && (D = b.count), V.truncateDrawRange && O !== void 0 && O.index === null) {
                var Y = N + D, re = O.drawRange.count === 1 / 0 ? b.count : O.drawRange.start + O.drawRange.count;
                N = Math.max(N, O.drawRange.start), D = Math.min(Y, re) - N, 0 > D && (D = 0);
              }
              if (D === 0) return null;
              var ae, ee = _(b, N, D);
              O !== void 0 && (ae = b === O.index ? h4.ELEMENT_ARRAY_BUFFER : h4.ARRAY_BUFFER);
              var oe = this.processBufferView(b, U, N, D, ae), j = { bufferView: oe.id, byteOffset: oe.byteOffset, componentType: U, count: D, max: ee.max, min: ee.min, type: { 1: "SCALAR", 2: "VEC2", 3: "VEC3", 4: "VEC4", 16: "MAT4" }[b.itemSize] };
              return b.normalized === true && (j.normalized = true), H.accessors || (H.accessors = []), H.accessors.push(j) - 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, O, N) {
              var D = this, U = D.cache, V = D.json, H = D.options, Y = D.pending;
              U.images.has(b) || U.images.set(b, {});
              var re = U.images.get(b), ae = O === l.RGBAFormat ? "image/png" : "image/jpeg", ee = ae + ":flipY/" + N.toString();
              if (re[ee] !== void 0) return re[ee];
              V.images || (V.images = []);
              var oe = { mimeType: ae };
              if (H.embedImages) {
                var j = S = S || document.createElement("canvas");
                j.width = Math.min(b.width, H.maxTextureSize), j.height = Math.min(b.height, H.maxTextureSize);
                var K = j.getContext("2d");
                if (N === true && (K.translate(0, j.height), K.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) K.drawImage(b, 0, 0, j.width, j.height);
                else {
                  O !== l.RGBAFormat && O !== l.RGBFormat && console.error("GLTFExporter: Only RGB and RGBA formats are supported."), (b.width > H.maxTextureSize || b.height > H.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", b);
                  var $ = new Uint8ClampedArray(4 * (b.height * b.width));
                  if (O === l.RGBAFormat) for (var ne = 0; ne < $.length; ne += 4) $[ne + 0] = b.data[ne + 0], $[ne + 1] = b.data[ne + 1], $[ne + 2] = b.data[ne + 2], $[ne + 3] = b.data[ne + 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;
                  K.putImageData(new ImageData($, b.width, b.height), 0, 0);
                }
                H.binary === true ? Y.push(new Promise(function(X) {
                  j.toBlob(function(J) {
                    D.processBufferViewImage(J).then(function(F) {
                      oe.bufferView = F, X();
                    });
                  }, ae);
                })) : oe.uri = j.toDataURL(ae);
              } else oe.uri = b.src;
              var B = V.images.push(oe) - 1;
              return re[ee] = B, B;
            }
            /**
            * Process sampler
            * @param  {Texture} map Texture to process
            * @return {Integer}     Index of the processed texture in the "samplers" array
            */
            processSampler(b) {
              var O = this.json;
              O.samplers || (O.samplers = []);
              var N = { magFilter: f[b.magFilter], minFilter: f[b.minFilter], wrapS: f[b.wrapS], wrapT: f[b.wrapT] };
              return O.samplers.push(N) - 1;
            }
            /**
            * Process texture
            * @param  {Texture} map Map to process
            * @return {Integer} Index of the processed texture in the "textures" array
            */
            processTexture(b) {
              var O = this.cache, N = this.json;
              if (O.textures.has(b)) return O.textures.get(b);
              N.textures || (N.textures = []);
              var D = { sampler: this.processSampler(b), source: this.processImage(b.image, b.format, b.flipY) };
              b.name && (D.name = b.name), this._invokeAll(function(V) {
                V.writeTexture && V.writeTexture(b, D);
              });
              var U = N.textures.push(D) - 1;
              return O.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 O = this.cache, N = this.json;
              if (O.materials.has(b)) return O.materials.get(b);
              if (b.isShaderMaterial) return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null;
              N.materials || (N.materials = []);
              var D = { pbrMetallicRoughness: {} };
              b.isMeshStandardMaterial !== true && b.isMeshBasicMaterial !== true && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
              var U = b.color.toArray().concat([b.opacity]);
              if (M(U, [1, 1, 1, 1]) || (D.pbrMetallicRoughness.baseColorFactor = U), b.isMeshStandardMaterial ? (D.pbrMetallicRoughness.metallicFactor = b.metalness, D.pbrMetallicRoughness.roughnessFactor = b.roughness) : (D.pbrMetallicRoughness.metallicFactor = 0.5, D.pbrMetallicRoughness.roughnessFactor = 0.5), b.metalnessMap || b.roughnessMap) if (b.metalnessMap === b.roughnessMap) {
                var V = { index: this.processTexture(b.metalnessMap) };
                this.applyTextureTransform(V, b.metalnessMap), D.pbrMetallicRoughness.metallicRoughnessTexture = V;
              } else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");
              if (b.map) {
                var H = { index: this.processTexture(b.map) };
                this.applyTextureTransform(H, b.map), D.pbrMetallicRoughness.baseColorTexture = H;
              }
              if (b.emissive) {
                var Y = b.emissive.clone().multiplyScalar(b.emissiveIntensity), re = Math.max(Y.r, Y.g, Y.b);
                if (1 < re && (Y.multiplyScalar(1 / re), console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")), 0 < re && (D.emissiveFactor = Y.toArray()), b.emissiveMap) {
                  var ae = { index: this.processTexture(b.emissiveMap) };
                  this.applyTextureTransform(ae, b.emissiveMap), D.emissiveTexture = ae;
                }
              }
              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), D.normalTexture = ee;
              }
              if (b.aoMap) {
                var oe = { index: this.processTexture(b.aoMap), texCoord: 1 };
                b.aoMapIntensity !== 1 && (oe.strength = b.aoMapIntensity), this.applyTextureTransform(oe, b.aoMap), D.occlusionTexture = oe;
              }
              b.transparent ? D.alphaMode = "BLEND" : 0 < b.alphaTest && (D.alphaMode = "MASK", D.alphaCutoff = b.alphaTest), b.side === l.DoubleSide && (D.doubleSided = true), b.name !== "" && (D.name = b.name), this.serializeUserData(b, D), this._invokeAll(function(K) {
                K.writeMaterial && K.writeMaterial(b, D);
              });
              var j = N.materials.push(D) - 1;
              return O.materials.set(b, j), j;
            }
            /**
            * Process mesh
            * @param  {THREE.Mesh} mesh Mesh to process
            * @return {Integer|null} Index of the processed mesh in the "meshes" array
            */
            processMesh(b) {
              var O = this.cache, N = this.json, D = [b.geometry.uuid];
              if (Array.isArray(b.material)) for (var U = 0, V = b.material.length; U < V; U++) D.push(b.material[U].uuid);
              else D.push(b.material.uuid);
              var H = D.join(":");
              if (O.meshes.has(H)) return O.meshes.get(H);
              var Y, re = b.geometry;
              if (Y = b.isLineSegments ? h4.LINES : b.isLineLoop ? h4.LINE_LOOP : b.isLine ? h4.LINE_STRIP : b.isPoints ? h4.POINTS : b.material.wireframe ? h4.LINES : h4.TRIANGLES, re.isBufferGeometry !== true) throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");
              var ae = {}, ee = {}, oe = [], j = [], K = { uv: "TEXCOORD_0", uv2: "TEXCOORD_1", color: "COLOR_0", skinWeight: "WEIGHTS_0", skinIndex: "JOINTS_0" }, $ = re.getAttribute("normal");
              $ === void 0 || this.isNormalizedNormalAttribute($) || (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), re.setAttribute("normal", this.createNormalizedNormalAttribute($)));
              var ne = null;
              for (var k in re.attributes)
                if (k.substr(0, 5) !== "morph") {
                  var W = re.attributes[k];
                  k = K[k] || k.toUpperCase();
                  var B = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;
                  if (B.test(k) || (k = "_" + k), O.attributes.has(this.getUID(W))) {
                    ee[k] = O.attributes.get(this.getUID(W));
                    continue;
                  }
                  ne = null;
                  var X = W.array;
                  k !== "JOINTS_0" || X instanceof Uint16Array || X instanceof Uint8Array || (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), ne = new l.BufferAttribute(new Uint16Array(X), W.itemSize, W.normalized));
                  var J = this.processAccessor(ne || W, re);
                  J !== null && (ee[k] = J, O.attributes.set(this.getUID(W), J));
                }
              if ($ !== void 0 && re.setAttribute("normal", $), Object.keys(ee).length === 0) return null;
              if (b.morphTargetInfluences !== void 0 && 0 < b.morphTargetInfluences.length) {
                var F = [], z = [], te = {};
                if (b.morphTargetDictionary !== void 0) for (var se in b.morphTargetDictionary) te[b.morphTargetDictionary[se]] = se;
                for (var le = 0; le < b.morphTargetInfluences.length; ++le) {
                  var me = {}, Te = false;
                  for (var _e in re.morphAttributes) {
                    if (_e != "position" && _e !== "normal" && _e !== "color") {
                      Te || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), Te = true);
                      continue;
                    }
                    var fe = re.morphAttributes[_e][le], we = _e.toUpperCase();
                    K[_e] && (we = K[_e]);
                    var ie = re.attributes[_e];
                    if (O.attributes.has(this.getUID(fe))) {
                      me[we] = O.attributes.get(this.getUID(fe));
                      continue;
                    }
                    var pe = ie.clone();
                    if (!re.morphTargetsRelative) if (ie) for (var be = 0, Be = fe.count; be < Be; be++) ie.count > be && pe.setXYZ(be, fe.getX(be) - ie.getX(be), fe.getY(be) - ie.getY(be), fe.getZ(be) - ie.getZ(be));
                    else for (var Oe = 0, $e = fe.count; Oe < $e; Oe++) pe.setXYZ(Oe, 0, 0, 0);
                    me[we] = this.processAccessor(pe, re), O.attributes.set(this.getUID(ie), me[we]);
                  }
                  j.push(me), F.push(b.morphTargetInfluences[le]), b.morphTargetDictionary !== void 0 && z.push(te[le]);
                }
                ae.weights = F, 0 < z.length && (ae.extras = {}, ae.extras.targetNames = z);
              }
              var ot = Array.isArray(b.material);
              if (ot && re.groups.length === 0) return null;
              for (var qe, wt = ot ? b.material : [b.material], Ne = ot ? re.groups : [{ materialIndex: 0, start: void 0, count: void 0 }], nt = 0, tt = Ne.length; nt < tt; nt++) {
                if (qe = { mode: Y, attributes: ee }, this.serializeUserData(re, qe), 0 < j.length && (qe.targets = j), re.index !== null) {
                  var Kt = this.getUID(re.index);
                  (Ne[nt].start !== void 0 || Ne[nt].count !== void 0) && (Kt += ":" + Ne[nt].start + ":" + Ne[nt].count), O.attributes.has(Kt) ? qe.indices = O.attributes.get(Kt) : (qe.indices = this.processAccessor(re.index, re, Ne[nt].start, Ne[nt].count), O.attributes.set(Kt, qe.indices)), qe.indices === null && delete qe.indices;
                }
                var qt = this.processMaterial(wt[Ne[nt].materialIndex]);
                qt !== null && (qe.material = qt), oe.push(qe);
              }
              ae.primitives = oe, N.meshes || (N.meshes = []), this._invokeAll(function(Nt) {
                Nt.writeMesh && Nt.writeMesh(b, ae);
              });
              var Rt = N.meshes.push(ae) - 1;
              return O.meshes.set(H, Rt), Rt;
            }
            /**
            * Process camera
            * @param  {THREE.Camera} camera Camera to process
            * @return {Integer}      Index of the processed mesh in the "camera" array
            */
            processCamera(b) {
              var O = this.json;
              O.cameras || (O.cameras = []);
              var N = b.isOrthographicCamera, D = { type: N ? "orthographic" : "perspective" };
              return N ? D.orthographic = { xmag: 2 * b.right, ymag: 2 * b.top, zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near } : D.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 !== "" && (D.name = b.type), O.cameras.push(D) - 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, O) {
              var N = this.json, D = this.nodeMap;
              N.animations || (N.animations = []), b = d.Utils.mergeMorphTargetTracks(b.clone(), O);
              for (var U = b.tracks, V = [], H = [], Y = 0; Y < U.length; ++Y) {
                var re = U[Y], ae = l.PropertyBinding.parseTrackName(re.name), ee = l.PropertyBinding.findNode(O, ae.nodeName), oe = g[ae.propertyName];
                if (ae.objectName === "bones" && (ee.isSkinnedMesh === true ? ee = ee.skeleton.getBoneByName(ae.objectIndex) : ee = void 0), !ee || !oe) return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', re.name), null;
                var j = 1, K = re.values.length / re.times.length;
                oe === g.morphTargetInfluences && (K /= ee.morphTargetInfluences.length);
                var $ = void 0;
                re.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true ? ($ = "CUBICSPLINE", K /= 3) : re.getInterpolation() === l.InterpolateDiscrete ? $ = "STEP" : $ = "LINEAR", H.push({ input: this.processAccessor(new l.BufferAttribute(re.times, j)), output: this.processAccessor(new l.BufferAttribute(re.values, K)), interpolation: $ }), V.push({ sampler: H.length - 1, target: { node: D.get(ee), path: oe } });
              }
              return N.animations.push({ name: b.name || "clip_" + N.animations.length, samplers: H, channels: V }), N.animations.length - 1;
            }
            /**
            * @param {THREE.Object3D} object
            * @return {number|null}
            */
            processSkin(b) {
              var O = this.json, N = this.nodeMap, D = O.nodes[N.get(b)], U = b.skeleton;
              if (U === void 0) return null;
              var V = b.skeleton.bones[0];
              if (V === void 0) return null;
              for (var H = [], Y = new Float32Array(16 * U.bones.length), re = new l.Matrix4(), ae = 0; ae < U.bones.length; ++ae) H.push(N.get(U.bones[ae])), re.copy(U.boneInverses[ae]), re.multiply(b.bindMatrix).toArray(Y, 16 * ae);
              O.skins === void 0 && (O.skins = []), O.skins.push({ inverseBindMatrices: this.processAccessor(new l.BufferAttribute(Y, 16)), joints: H, skeleton: N.get(V) });
              var ee = D.skin = O.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 O = this.json, N = this.options, D = this.nodeMap;
              O.nodes || (O.nodes = []);
              var U = {};
              if (N.trs) {
                var V = b.quaternion.toArray(), H = b.position.toArray(), Y = b.scale.toArray();
                M(V, [0, 0, 0, 1]) || (U.rotation = V), M(H, [0, 0, 0]) || (U.translation = H), M(Y, [1, 1, 1]) || (U.scale = Y);
              } else b.matrixAutoUpdate && b.updateMatrix(), w(b.matrix) === false && (U.matrix = b.matrix.elements);
              if (b.name !== "" && (U.name = b.name + ""), this.serializeUserData(b, U), b.isMesh || b.isLine || b.isPoints) {
                var re = this.processMesh(b);
                re !== null && (U.mesh = re);
              } else b.isCamera && (U.camera = this.processCamera(b));
              if (b.isSkinnedMesh && this.skins.push(b), 0 < b.children.length) {
                for (var ae, ee = [], oe = 0, j = b.children.length; oe < j; oe++) if (ae = b.children[oe], ae.visible || N.onlyVisible === false) {
                  var K = this.processNode(ae);
                  K !== null && ee.push(K);
                }
                0 < ee.length && (U.children = ee);
              }
              this._invokeAll(function(ne) {
                ne.writeNode && ne.writeNode(b, U);
              });
              var $ = O.nodes.push(U) - 1;
              return D.set(b, $), $;
            }
            /**
            * Process Scene
            * @param  {Scene} node Scene to process
            */
            processScene(b) {
              var O = this.json, N = this.options;
              O.scenes || (O.scenes = [], O.scene = 0);
              var D = {};
              b.name !== "" && (D.name = b.name), O.scenes.push(D);
              for (var U, V = [], H = 0, Y = b.children.length; H < Y; H++) if (U = b.children[H], U.visible || N.onlyVisible === false) {
                var re = this.processNode(U);
                re !== null && V.push(re);
              }
              0 < V.length && (D.nodes = V), this.serializeUserData(b, D);
            }
            /**
            * Creates a Scene to hold a list of objects and parse it
            * @param  {Array} objects List of objects to process
            */
            processObjects(b) {
              var O = new l.Scene();
              O.name = "AuxScene";
              for (var N = 0; N < b.length; N++)
                O.children.push(b[N]);
              this.processScene(O);
            }
            /**
            * @param {THREE.Object3D|Array<THREE.Object3D>} input
            */
            processInput(b) {
              var O = this.options;
              b = b instanceof Array ? b : [b], this._invokeAll(function(H) {
                H.beforeParse && H.beforeParse(b);
              });
              for (var N = [], D = 0; D < b.length; D++) b[D] instanceof l.Scene ? this.processScene(b[D]) : N.push(b[D]);
              0 < N.length && this.processObjects(N);
              for (var U = 0; U < this.skins.length; ++U) this.processSkin(this.skins[U]);
              for (var V = 0; V < O.animations.length; ++V) this.processAnimation(O.animations[V].clip, O.animations[V].mesh);
              this._invokeAll(function(H) {
                H.afterParse && H.afterParse(b);
              });
            }
            _invokeAll(b) {
              for (var O = 0, N = this.plugins.length; O < N; O++) b(this.plugins[O]);
            }
          }
          class A {
            constructor(b) {
              this.writer = b, this.name = "KHR_lights_punctual";
            }
            writeNode(b, O) {
              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 N = this.writer, D = N.json, U = N.extensionsUsed, V = {};
                b.name && (V.name = b.name), V.color = b.color.toArray(), V.intensity = b.intensity, b.isDirectionalLight ? V.type = "directional" : b.isPointLight ? (V.type = "point", 0 < b.distance && (V.range = b.distance)) : b.isSpotLight && (V.type = "spot", 0 < b.distance && (V.range = b.distance), V.spot = {}, V.spot.innerConeAngle = -1 * ((b.penumbra - 1) * b.angle), V.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] || (D.extensions = D.extensions || {}, D.extensions[this.name] = { lights: [] }, U[this.name] = true);
                var H = D.extensions[this.name].lights;
                H.push(V), O.extensions = O.extensions || {}, O.extensions[this.name] = { light: H.length - 1 };
              }
            }
          }
          class C {
            constructor(b) {
              this.writer = b, this.name = "KHR_materials_unlit";
            }
            writeMaterial(b, O) {
              if (b.isMeshBasicMaterial) {
                var N = this.writer, D = N.extensionsUsed;
                O.extensions = O.extensions || {}, O.extensions[this.name] = {}, D[this.name] = true, O.pbrMetallicRoughness.metallicFactor = 0, O.pbrMetallicRoughness.roughnessFactor = 0.9;
              }
            }
          }
          class L {
            constructor(b) {
              this.writer = b, this.name = "KHR_materials_pbrSpecularGlossiness";
            }
            writeMaterial(b, O) {
              if (b.isGLTFSpecularGlossinessMaterial) {
                var N = this.writer, D = N.extensionsUsed, U = {};
                O.pbrMetallicRoughness.baseColorFactor && (U.diffuseFactor = O.pbrMetallicRoughness.baseColorFactor);
                var V = [1, 1, 1];
                if (b.specular.toArray(V, 0), U.specularFactor = V, U.glossinessFactor = b.glossiness, O.pbrMetallicRoughness.baseColorTexture && (U.diffuseTexture = O.pbrMetallicRoughness.baseColorTexture), b.specularMap) {
                  var H = { index: N.processTexture(b.specularMap) };
                  N.applyTextureTransform(H, b.specularMap), U.specularGlossinessTexture = H;
                }
                O.extensions = O.extensions || {}, O.extensions[this.name] = U, D[this.name] = true;
              }
            }
          }
          d.Utils = { insertKeyframe: function(b, O) {
            var N, D = 1e-3, U = b.getValueSize(), V = new b.TimeBufferType(b.times.length + 1), H = new b.ValueBufferType(b.values.length + U), Y = b.createInterpolant(new b.ValueBufferType(U));
            if (b.times.length === 0) {
              V[0] = O;
              for (var re = 0; re < U; re++) H[re] = 0;
              N = 0;
            } else if (O < b.times[0]) {
              if (Math.abs(b.times[0] - O) < D) return 0;
              V[0] = O, V.set(b.times, 1), H.set(Y.evaluate(O), 0), H.set(b.values, U), N = 0;
            } else if (O > b.times[b.times.length - 1]) {
              if (Math.abs(b.times[b.times.length - 1] - O) < D) return b.times.length - 1;
              V[V.length - 1] = O, V.set(b.times, 0), H.set(b.values, 0), H.set(Y.evaluate(O), b.values.length), N = V.length - 1;
            } else for (var ae = 0; ae < b.times.length; ae++) {
              if (Math.abs(b.times[ae] - O) < D) return ae;
              if (b.times[ae] < O && b.times[ae + 1] > O) {
                V.set(b.times.slice(0, ae + 1), 0), V[ae + 1] = O, V.set(b.times.slice(ae + 1), ae + 2), H.set(b.values.slice(0, (ae + 1) * U), 0), H.set(Y.evaluate(O), (ae + 1) * U), H.set(b.values.slice((ae + 1) * U), (ae + 2) * U), N = ae + 1;
                break;
              }
            }
            return b.times = V, b.values = H, N;
          }, mergeMorphTargetTracks: function(b, O) {
            for (var N = [], D = {}, U = b.tracks, V = 0; V < U.length; ++V) {
              var H = U[V], Y = l.PropertyBinding.parseTrackName(H.name), re = l.PropertyBinding.findNode(O, Y.nodeName);
              if (Y.propertyName !== "morphTargetInfluences" || Y.propertyIndex === void 0) {
                N.push(H);
                continue;
              }
              if (H.createInterpolant !== H.InterpolantFactoryMethodDiscrete && H.createInterpolant !== H.InterpolantFactoryMethodLinear) {
                if (H.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."), H = H.clone(), H.setInterpolation(l.InterpolateLinear);
              }
              var ae = re.morphTargetInfluences.length, ee = re.morphTargetDictionary[Y.propertyIndex];
              if (ee === void 0) throw new Error("THREE.GLTFExporter: Morph target name not found: " + Y.propertyIndex);
              var oe = void 0;
              if (D[re.uuid] === void 0) {
                oe = H.clone();
                for (var j = new oe.ValueBufferType(ae * oe.times.length), K = 0; K < oe.times.length; K++) j[K * ae + ee] = oe.values[K];
                oe.name = (Y.nodeName || "") + ".morphTargetInfluences", oe.values = j, D[re.uuid] = oe, N.push(oe);
                continue;
              }
              var $ = H.createInterpolant(new H.ValueBufferType(1));
              oe = D[re.uuid];
              for (var ne = 0; ne < oe.times.length; ne++) oe.values[ne * ae + ee] = $.evaluate(oe.times[ne]);
              for (var k, W = 0; W < H.times.length; W++) k = this.insertKeyframe(oe, H.times[W]), oe.values[k * ae + ee] = H.values[W];
            }
            return b.tracks = N, b;
          } };
        },
        /* 43 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(5).resolveURL, h4 = 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 T = this;
            this.setFromObject = (w) => {
              var { nearPlane: _, farPlane: E, eyePosition: P, targetPosition: S, upVector: R } = w;
              T.nearPlane = _, T.farPlane = E, T.eyePosition = P, T.targetPosition = S, T.upVector = R;
            };
          }, f = function(T, w, _, E) {
            var P = { NONE: -1, DEFAULT: 0, PATH: 1, SMOOTH_CAMERA_TRANSITION: 2, AUTO_TUMBLE: 3, ROTATE_TRANSITION: 4, MINIMAP: 5, SYNC_CONTROL: 6 }, S = { 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 }, R = { NONE: -1, FREE: 1, HORIZONTAL: 2, VERTICAL: 3 }, A = { ARROWLEFT: 37, ARROWUP: 38, ARROWRIGHT: 39, ARROWDOWN: 40, NUMPADADD: 107, NUMPADSUBTRACT: 109, EQUAL: 187, MINUS: 189 }, C = {};
            C.MAIN = S.ROTATE, C.AUXILIARY = S.ZOOM, C.SECONDARY = S.PAN, this.cameraObject = T, this.domElement = w === void 0 ? document : w, this.renderer = _, this.scene = E, 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 L = 6e3, I = true, b = 0, O = void 0, N = void 0, D = false, U = 500, V = void 0, H = "default", Y = P.DEFAULT, re = void 0, ae = void 0, ee = void 0, oe = 0, j = R.FREE;
            this._state = S.NONE;
            var K;
            this.targetTouchId = -1;
            var $ = void 0, ne = new l.Vector3(), k = new l.Vector3(), W = new l.Vector3(), B = new l.Vector3(), X = new l.Vector3(), J = new l.Vector3(), F = new l.Vector3(), z = new l.Vector3(), te = new l.Sphere(), se = new l.Vector3(), le = false, me = void 0, Te = 0, _e = { default: new h4() };
            _e.default.nearPlane = 0.1, _e.default.farPlane = 2e3, _e.default.eyePosition = [0, 0, 0], _e.default.targetPosition = [0, 0, -1], _e.default.upVector = [0, 1, 0], this.cameraObject.target === void 0 && (this.cameraObject.target = new l.Vector3(..._e.default.targetPosition)), this.calculateMaxAllowedDistance = (Q) => {
              var Se = Q.getBoundingBox();
              if (Se) {
                Se.getBoundingSphere(te), Te = 6 * te.radius;
                var Ie = 0;
                this.cameraObject && (Ie = this.cameraObject.position.distanceTo(te.center)), Te = Ie > Te ? 1.5 * Ie : Te;
              } else Te = 0;
            }, this.addViewport = (Q, Se) => {
              Q && Se && (_e[Q] = Se);
            }, this.setDefaultViewport = (Q) => !!(Q && Q in _e) && (H = Q, true), this.getDefaultViewport = () => H, this.getViewportOfName = (Q) => _e[Q], this.setCurrentViewport = (Q) => Q in _e && (this.setCurrentCameraSettings(_e[Q]), true), this.setRotationMode = (Q) => {
              switch (Q) {
                case "none":
                  j = R.NONE;
                  break;
                case "horizontal":
                  j = R.HORIZONTAL;
                  break;
                case "vertical":
                  j = R.VERTICAL;
                  break;
                case "free":
                default:
                  j = R.FREE;
              }
            }, this.onResize = () => {
              $ && ($ = void 0), me && me.setCurrentCameraSettings(this.cameraObject, _e[H]);
            }, this.getVisibleHeightAtZDepth = (Q) => {
              var Se = this.cameraObject.position.distanceTo(this.cameraObject.target);
              Q < Se ? Q -= Se : Q += Se;
              var Ie = this.cameraObject.fov * Math.PI / 180;
              return 2 * Math.tan(Ie / 2) * Math.abs(Q);
            }, this.calculateHeightPerPixelAtZeroDepth = (Q) => {
              var Se = this.getVisibleHeightAtZDepth(0);
              return this.pixelHeight = Se / Q, this.pixelHeight;
            }, this.getNDCFromDocumentCoords = (Q, Se, Ie) => {
              Ne(false);
              var He = Ie || new l.Vector2(), it = 2 * ((Q - $.left) / $.width) - 1, Z = 2 * -((Se - $.top) / $.height) + 1;
              return He.set(it, Z);
            }, this.getRelativeCoordsFromNDC = (Q, Se, Ie) => {
              Ne(false);
              var He = Ie || new l.Vector2();
              return He.x = (Q + 1) * $.width / 2, He.y = (1 - Se) * $.height / 2, He;
            }, this.setMouseButtonAction = (Q, Se) => {
              C[Q] = S[Se];
            };
            var fe = (Q, Se) => {
              Q instanceof HTMLCanvasElement && (Q.tabIndex = Se);
            }, we = () => {
              if (0 < Te) {
                var Q = se.distanceTo(te.center);
                return Te > Q || this.cameraObject.position.distanceTo(te.center) > Q;
              }
              return true;
            }, ie = (Q) => {
              se.copy(this.cameraObject.position).add(Q), we() && (this.cameraObject.target.add(Q), this.cameraObject.position.add(Q), this.updateDirectionalLight());
            }, pe = (Q) => {
              Ne(false);
              var Se;
              if (Y === P.DEFAULT && (Se = this.scene.getNormalisedMinimapCoordinates(this.renderer, Q)), !Se) Q.button == 0 ? Q.ctrlKey ? this._state = C.AUXILIARY : Q.shiftKey ? this._state = C.SECONDARY : this._state = C.MAIN : Q.button == 1 ? (Q.preventDefault(), this._state = C.AUXILIARY) : Q.button == 2 && (this._state = C.SECONDARY), this.pointer_x = Q.clientX - $.left, this.pointer_y = Q.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 {
                Y = P.MINIMAP;
                var Ie = this.scene.getMinimapDiffFromNormalised(Se.x, Se.y);
                ie(Ie);
              }
            }, be = (Q) => {
              if (Ne(false), $) if (this.pointer_x = Q.clientX - $.left, this.pointer_y = Q.clientY - $.top, Y === P.MINIMAP) {
                var Se = this.scene.getNormalisedMinimapCoordinates(this.renderer, Q);
                if (Se) {
                  var Ie = this.scene.getMinimapDiffFromNormalised(Se.x, Se.y);
                  ie(Ie);
                }
              } else this._state === S.NONE && K !== void 0 && K.move(this, Q.clientX, Q.clientY, this.renderer);
            }, Be = (Q) => {
              this._state = S.NONE, Y == P.MINIMAP && (Y = P.DEFAULT), K !== void 0 && this.pointer_x_start == Q.clientX - $.left && this.pointer_y_start == Q.clientY - $.top && K.pick(this, Q.clientX, Q.clientY, this.renderer);
            }, Oe = (Q) => {
              this._state = S.NONE;
            }, $e = (Q) => {
              Ne(false);
              var Se = Q.touches.length;
              if (Se == 1) {
                var Ie, He;
                this._state = S.TOUCH_ROTATE, this.pointer_x = Q.touches[0].clientX - ((Ie = $) === null || Ie === void 0 ? void 0 : Ie.left), this.pointer_y = Q.touches[0].clientY - ((He = $) === null || He === void 0 ? void 0 : He.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 (Se == 2) {
                this._state = S.TOUCH_ZOOM;
                var it = Q.touches[0].clientX - Q.touches[1].clientX, Z = Q.touches[0].clientY - Q.touches[1].clientY;
                this.touchZoomDistanceEnd = this.touchZoomDistanceStart = Math.sqrt(it * it + Z * Z);
              } else if (Se == 3) {
                var ge, he;
                this._state = S.TOUCH_PAN, this.targetTouchId = Q.touches[0].identifier, this.pointer_x = Q.touches[0].clientX - ((ge = $) === null || ge === void 0 ? void 0 : ge.left), this.pointer_y = Q.touches[0].clientY - ((he = $) === null || he === void 0 ? void 0 : he.top), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
              }
            }, ot = (Q) => {
              Q.preventDefault(), Q.stopPropagation();
              var Se = Q.touches.length;
              if (Se == 1) this.pointer_x = Q.touches[0].clientX - $.left, this.pointer_y = Q.touches[0].clientY - $.top;
              else if (Se == 2) {
                if (this._state === S.TOUCH_ZOOM) {
                  var Ie = Q.touches[0].clientX - Q.touches[1].clientX, He = Q.touches[0].clientY - Q.touches[1].clientY;
                  this.touchZoomDistanceEnd = Math.sqrt(Ie * Ie + He * He);
                }
              } else if (Se == 3 && this._state === S.TOUCH_PAN) for (var it = 0; 3 > it; it++) Q.touches[it].identifier == this.targetTouchId && (this.pointer_x = Q.touches[0].clientX - $.left, this.pointer_y = Q.touches[0].clientY - $.top);
            }, qe = (Q) => {
              var Se = Q.touches.length;
              this.touchZoomDistanceStart = this.touchZoomDistanceEnd = 0, this.targetTouchId = -1, this._state = S.NONE, Se == 1 && K !== void 0 && this.pointer_x_start == Q.touches[0].clientX - $.left && this.pointer_y_start == Q.touches[0].clientY - $.top && K.pick(this.cameraObject, Q.touches[0].clientX, Q.touches[0].clientY, this.renderer);
            }, wt = () => {
              Ne(true);
            }, Ne = (Q) => {
              if (Q || $ === void 0) {
                var Se = new IntersectionObserver((Ie) => {
                  for (var He of Ie) $ = He.boundingClientRect;
                  Se.disconnect();
                });
                Se.observe(this.domElement);
              }
            }, nt = (Q) => {
              Ne(false), this._state = S.SCROLL;
              var Se = 0;
              0 < Q.deltaY ? Se = this.zoomRate : 0 > Q.deltaY && (Se = -1 * this.zoomRate), oe += Se, Q.preventDefault(), Q.stopImmediatePropagation();
            }, tt = (Q) => {
              Ne(false);
              var Se = 0;
              if (Q.keyCode === A.EQUAL || Q.keyCode === A.MINUS || Q.keyCode === A.NUMPADADD || Q.keyCode === A.NUMPADSUBTRACT) {
                this._state = S.KEYBOARD_ZOOM;
                var Ie = 1;
                Q.shiftKey && (Ie *= 2), Q.keyCode === A.EQUAL || Q.keyCode === A.NUMPADADD ? Se = -1 * (this.zoomRate * Ie) : (Q.keyCode === A.MINUS || Q.keyCode === A.NUMPADSUBTRACT) && (Se = this.zoomRate * Ie), oe += Se;
              } else (Q.keyCode === A.ARROWLEFT || Q.keyCode === A.ARROWUP || Q.keyCode === A.ARROWRIGHT || Q.keyCode === A.ARROWDOWN) && (Q.shiftKey ? (this._state = S.KEYBOARD_ROTATE, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, Se = this.rotateRate) : (this._state = S.KEYBOARD_PAN, Se = this.panRate), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, Q.keyCode === A.ARROWLEFT ? this.pointer_x -= Se : Q.keyCode === A.ARROWUP ? this.pointer_y -= Se : Q.keyCode === A.ARROWRIGHT ? this.pointer_x += Se : Q.keyCode === A.ARROWDOWN && (this.pointer_y += Se));
              Object.values(A).includes(Q.keyCode) && Q.preventDefault();
            }, Kt = (Q) => {
              this._state = S.NONE;
            }, qt = () => {
              if (typeof this.cameraObject < "u") {
                var Q = $.height, Se = this.cameraObject.position.distanceTo(this.cameraObject.target), Ie = 0;
                this.cameraObject.far > this.cameraObject.near && Se >= this.cameraObject.near && Se <= this.cameraObject.far && (Ie = (Se - this.cameraObject.near) / (this.cameraObject.far - this.cameraObject.near)), k.set(this.previous_pointer_x, Q - this.previous_pointer_y, 0), W.set(this.previous_pointer_x, Q - this.previous_pointer_y, 1), B.set(this.pointer_x, Q - this.pointer_y, 0), X.set(this.pointer_x, Q - this.pointer_y, 1), k.unproject(this.cameraObject), W.unproject(this.cameraObject), B.unproject(this.cameraObject), X.unproject(this.cameraObject);
                var He = -2e-3;
                B.sub(k).multiplyScalar(1 - Ie), X.sub(W).multiplyScalar(Ie), B.add(X).multiplyScalar(He), ie(B);
              }
              this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
            };
            this.getVectorsFromRotateAboutLookAtPoints = (Q, Se) => {
              Q.normalize(), F.copy(this.cameraObject.position).sub(this.cameraObject.target), z.copy(F), F.normalize(), 0.8 < Math.abs(F.dot(Q)) && F.copy(this.cameraObject.up), k.crossVectors(Q, F).normalize(), W.crossVectors(Q, k);
              var Ie = Q.dot(z), He = k.dot(z), it = W.dot(z), Z = Q.dot(this.cameraObject.up), ge = k.dot(this.cameraObject.up), he = W.dot(this.cameraObject.up), xe = Math.cos(Se), Ae = Math.sin(Se);
              return B.set(xe * k.x + Ae * W.x, xe * k.y + Ae * W.y, xe * k.z + Ae * W.z), X.set(xe * W.x - Ae * k.x, xe * W.y - Ae * k.y, xe * W.z - Ae * k.z), F.copy(this.cameraObject.target), F.x = F.x + Q.x * Ie + B.x * He + X.x * it, F.y = F.y + Q.y * Ie + B.y * He + X.y * it, F.z = F.z + Q.z * Ie + B.z * He + X.z * it, ne.set(Q.x * Z + B.x * ge + X.x * he, Q.y * Z + B.y * ge + X.y * he, Q.z * Z + B.z * ge + X.z * he), { position: F, up: ne };
            }, this.alignCameraWithAxis = (Q) => {
              if (Q instanceof l.Vector3 || Array.isArray(Q) || typeof Q == "string") {
                if (Q instanceof l.Vector3 && 0 < Q.length()) ne.copy(Q).normalize();
                else if (Array.isArray(Q) && Q.length === 3) ne.fromArray(Q).normalize();
                else if (typeof Q == "string" && 0 < Q.trim().length) {
                  if (!this.planeAxis) {
                    var Se = this.cameraObject.quaternion, Ie = new l.Vector3(0, 0, 1).applyQuaternion(Se), He = new l.Vector3(1, 0, 0).applyQuaternion(Se), it = new l.Vector3(0, 1, 0).applyQuaternion(Se);
                    this.planeAxis = { front: Ie, back: Ie.clone().negate(), left: He.clone().negate(), right: He, up: it, down: it.clone().negate() };
                  }
                  ne.copy(this.planeAxis[Q]).normalize();
                }
                F.copy(this.cameraObject.position).sub(this.cameraObject.target);
                var Z = F.length();
                F.x = this.cameraObject.target.x + Z * ne.x, F.y = this.cameraObject.target.y + Z * ne.y, F.z = this.cameraObject.target.z + Z * ne.z, this.cameraObject.position.copy(F), this.updateDirectionalLight(), this.cameraObject.updateProjectionMatrix();
              }
            }, this.rotateAboutLookAtpoint = (Q, Se) => {
              var Ie = this.getVectorsFromRotateAboutLookAtPoints(Q, Se);
              this.cameraObject.position.copy(Ie.position), this.updateDirectionalLight(), this.cameraObject.up.copy(Ie.up);
            };
            var Rt = () => {
              if (typeof this.cameraObject < "u") {
                var Q, Se, Ie = (Q = $) === null || Q === void 0 ? void 0 : Q.width, He = (Se = $) === null || Se === void 0 ? void 0 : Se.height;
                if (0 < Ie && 0 < He) {
                  var it = 0.25 * (Ie + He), Z = 0, ge = 0;
                  (j === R.FREE || j === R.HORIZONTAL) && (Z = this.pointer_x - this.previous_pointer_x), (j === R.FREE || j === R.VERTICAL) && (ge = this.previous_pointer_y - this.pointer_y);
                  var he = Math.sqrt(Z * Z + ge * ge);
                  if (0 < he) {
                    var xe = 1 * -ge / he, Ae = 1 * Z / he, de = 0;
                    j === R.FREE && xe * (this.pointer_x - 0.5 * (Ie - 1)) + Ae * (0.5 * (He - 1) - this.pointer_y);
                    var Me = Math.acos(de / it) - 0.5 * Math.PI, Pe = this.tumble_rate * he / it;
                    ne.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(), k.copy(this.cameraObject.up).normalize(), W.copy(k).cross(ne).normalize().multiplyScalar(xe), k.multiplyScalar(Ae), J.addVectors(W, k).multiplyScalar(Math.cos(Me)), ne.multiplyScalar(Math.sin(Me)), J.add(ne), this.rotateAboutLookAtpoint(J, -Pe);
                  }
                }
              }
              this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y;
            }, Nt = () => {
              var Q = 0;
              return this._state === S.ZOOM ? Q = this.previous_pointer_y - this.pointer_y : this._state === S.SCROLL || this._state === S.KEYBOARD_ZOOM ? Q = oe : (Q = -1 * (this.touchZoomDistanceEnd - this.touchZoomDistanceStart), this.touchZoomDistanceStart = this.touchZoomDistanceEnd), Q;
            };
            this.changeZoomByScrollRateUnit = (Q) => {
              var Se = Q * this.zoomRate;
              this.changeZoomByValue(Se);
            }, this.changeZoomByValue = (Q) => {
              if (typeof this.cameraObject < "u") {
                var Se = $.height, Ie = this.cameraObject.position.clone();
                Ie.sub(this.cameraObject.target);
                var He = Ie.length(), it = 1.5 * Q / Se;
                if (0.01 < He + it * He && (Ie.normalize(), se.copy(this.cameraObject.position), se.x += Ie.x * it * He, se.y += Ie.y * it * He, se.z += Ie.z * it * He, we())) {
                  this.cameraObject.position.copy(se), this.updateDirectionalLight();
                  var Z = 1e-5;
                  if (Z * this.cameraObject.far < this.cameraObject.near + it * He + this.near_plane_fly_debt) this.near_plane_fly_debt != 0 && (this.near_plane_fly_debt += it * He, 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 += it * He, this.cameraObject.far += it * He));
                  else {
                    if (this.near_plane_fly_debt == 0) {
                      var ge = this.cameraObject.near - Z * this.cameraObject.far;
                      this.cameraObject.near = Z * this.cameraObject.far, this.cameraObject.far -= ge, this.near_plane_fly_debt -= Z * this.cameraObject.far;
                    }
                    this.near_plane_fly_debt += it * He;
                  }
                  le = true;
                }
              }
            };
            var Gi = () => {
              var Q = Nt();
              this.changeZoomByValue(Q), this._state === S.ZOOM && (this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y), (this._state === S.SCROLL || this._state === S.KEYBOARD_ZOOM) && (oe = 0, this._state = S.NONE);
            };
            this.setDirectionalLight = (Q) => {
              this.directionalLight = Q;
            }, this.updateDirectionalLight = () => {
              this.directionalLight != 0 && this.directionalLight.position.set(this.cameraObject.position.x, this.cameraObject.position.y, this.cameraObject.position.z);
            }, this.enable = function() {
              I = true, this.domElement && this.domElement.addEventListener && (fe(this.domElement, 0), this.domElement.addEventListener("mousedown", pe, false), this.domElement.addEventListener("mousemove", be, false), this.domElement.addEventListener("mouseup", Be, false), this.domElement.addEventListener("mouseleave", Oe, false), this.domElement.addEventListener("touchstart", $e, false), this.domElement.addEventListener("touchmove", ot, false), this.domElement.addEventListener("touchend", qe, false), this.domElement.addEventListener("wheel", nt, false), this.domElement.addEventListener("mouseenter", wt, false), this.domElement.addEventListener("contextmenu", (Q) => {
                Q.preventDefault();
              }, false), this.domElement.addEventListener("keydown", tt, false), this.domElement.addEventListener("keyup", Kt, false));
            }, this.disable = function() {
              I = false, this.domElement && this.domElement.removeEventListener && (this.domElement.removeEventListener("mousedown", pe, false), this.domElement.removeEventListener("mousemove", be, false), this.domElement.removeEventListener("mouseup", Be, false), this.domElement.removeEventListener("mouseleave", Oe, false), this.domElement.removeEventListener("touchstart", $e, false), this.domElement.removeEventListener("touchmove", ot, false), this.domElement.removeEventListener("touchend", qe, false), this.domElement.removeEventListener("wheel", nt, false), this.domElement.removeEventListener("mouseenter", wt, false), this.domElement.removeEventListener("contextmenu", (Q) => {
                Q.preventDefault();
              }, false), this.domElement.removeEventListener("keydown", tt, false), this.domElement.removeEventListener("keyup", Kt, false), fe(this.domElement, -1));
            }, this.loadPath = (Q) => {
              O = Q.CameraPath, N = Q.NumberOfPoints;
            }, this.loadPathURL = (Q, Se) => {
              var Ie = new XMLHttpRequest();
              Ie.onreadystatechange = () => {
                if (Ie.readyState == 4 && Ie.status == 200) {
                  var it = JSON.parse(Ie.responseText);
                  this.loadPath(it), Se != null && typeof Se == "function" && Se();
                }
              };
              var He = d(Q);
              Ie.open("GET", He, true), Ie.send();
            }, this.setPathDuration = (Q) => {
              L = Q, re && re.setDuration(L), ae && ae.setDuration(L);
            }, this.getPlayRate = () => U, this.setPlayRate = (Q) => {
              U = Q;
            };
            var Hi = (Q) => {
              var Se = b + Q;
              Se > L && (Se -= L), b = Se;
            };
            this.getTime = () => b, this.setTime = (Q) => {
              b = Q > L ? L : 0 > Q ? 0 : Q;
            }, this.getNumberOfTimeFrame = () => N, this.getCurrentTimeFrame = () => {
              if (2 < N) {
                var Q = b / L * (N - 1), Se = Math.floor(Q), Ie = 1 - (Q - Se), He = Math.ceil(Q);
                return Se == He ? Se == N - 1 ? [Se - 1, He, 0] : [Se, He + 1, 1] : [Se, He, Ie];
              }
              return N == 1 ? [0, 0, 0] : void 0;
            }, this.setCurrentTimeFrame = (Q) => {
              2 < N && (b = L * Q / (N - 1), 0 > b && (b = 0), b > L && (b = L));
            };
            var oi = (Q) => {
              if (Y === P.PATH && (Hi(Q), O)) {
                for (var Se = this.getCurrentTimeFrame(), Ie = Se[0], He = Se[1], it = Se[2], Z = [O[3 * Ie], O[3 * Ie + 1], O[3 * Ie + 2]], ge = [O[3 * He], O[3 * He + 1], O[3 * He + 2]], he = [], xe = 0; xe < Z.length; xe++) he.push(it * Z[xe] + (1 - it) * ge[xe]);
                this.cameraObject.position.set(he[0], he[1], he[2]), this.cameraObject.target.set(ge[0], ge[1], ge[2]), V && this.cameraObject.lookAt(this.cameraObject.target), D && (this.directionalLight.position.set(he[0], he[1], he[2]), this.directionalLight.target.position.set(ge[0], ge[1], ge[2]));
              }
            };
            this.calculatePathNow = () => {
              oi(0);
            };
            var ss = () => {
              this._state === S.ROTATE || this._state === S.TOUCH_ROTATE || this._state === S.KEYBOARD_ROTATE ? Rt() : this._state === S.PAN || this._state === S.TOUCH_PAN || this._state === S.KEYBOARD_PAN ? (qt(), me.triggerCallback()) : (this._state === S.ZOOM || this._state === S.TOUCH_ZOOM || this._state === S.SCROLL || this._state === S.KEYBOARD_ZOOM) && (me.zoom(Nt()), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, (this._state === S.SCROLL || this._state === S.KEYBOARD_ZOOM) && (this._state = S.NONE), oe = 0, me.triggerCallback());
            };
            this.update = (Q) => {
              var Se = Q * U, Ie = I, He = true;
              return Y === P.PATH ? oi(Se) : Y === P.SMOOTH_CAMERA_TRANSITION && re ? (re.update(Se), re.isTransitionCompleted() && (Y = P.DEFAULT), Ie = false) : Y === P.ROTATE_CAMERA_TRANSITION && ae ? (ae.update(Se), ae.isTransitionCompleted() && (Y = P.DEFAULT), Ie = false) : Y === P.AUTO_TUMBLE && ee ? ee.update(Se) : Y === P.SYNC_CONTROL && me ? (ss(), Ie = false) : He = false, Ie && (this._state !== S.NONE && (He = true), this._state === S.ROTATE || this._state === S.TOUCH_ROTATE || this._state === S.KEYBOARD_ROTATE ? Rt() : this._state === S.PAN || this._state === S.TOUCH_PAN || this._state === S.KEYBOARD_PAN ? qt() : (this._state === S.ZOOM || this._state === S.TOUCH_ZOOM || this._state === S.SCROLL || this._state === S.KEYBOARD_ZOOM) && Gi(), this._state !== S.NONE && Y === P.AUTO_TUMBLE && ee && ee.stopOnCameraInput, this._state === S.SCROLL && (this._state = S.NONE)), V ? (He = true, V.update()) : this.cameraObject.lookAt(this.cameraObject.target), He = He || le, le = false, He;
            }, this.playPath = () => {
              Y = P.PATH;
            }, this.stopPath = () => {
              Y = P.DEFAULT;
            }, this.isPlayingPath = () => Y === P.PATH, this.enableDirectionalLightUpdateWithPath = (Q) => {
              D = Q;
            }, this.enableDeviceOrientation = () => {
              V || (V = new x(this.cameraObject));
            }, this.disableDeviceOrientation = () => {
              V && (V.dispose(), V = void 0);
            }, this.isDeviceOrientationEnabled = () => !!V, this.resetView = () => {
              var Q = _e[H];
              this.cameraObject.near = Q.nearPlane, this.cameraObject.far = Q.farPlane, this.cameraObject.position.set(Q.eyePosition[0], Q.eyePosition[1], Q.eyePosition[2]), this.cameraObject.target.set(Q.targetPosition[0], Q.targetPosition[1], Q.targetPosition[2]), this.cameraObject.up.set(Q.upVector[0], Q.upVector[1], Q.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight();
            }, this.setCurrentCameraSettings = (Q) => {
              Q.nearPlane && (this.cameraObject.near = Q.nearPlane), Q.farPlane && (this.cameraObject.far = Q.farPlane), Q.eyePosition && this.cameraObject.position.set(Q.eyePosition[0], Q.eyePosition[1], Q.eyePosition[2]), Q.targetPosition && this.cameraObject.target.set(Q.targetPosition[0], Q.targetPosition[1], Q.targetPosition[2]), Q.upVector && this.cameraObject.up.set(Q.upVector[0], Q.upVector[1], Q.upVector[2]), this.cameraObject.updateProjectionMatrix(), this.updateDirectionalLight(), le = true;
            }, this.getViewportFromCentreAndRadius = (Q, Se, Ie, He, it, Z) => {
              var ge = this.cameraObject.position.x - this.cameraObject.target.x, he = this.cameraObject.position.y - this.cameraObject.target.y, xe = this.cameraObject.position.z - this.cameraObject.target.z, Ae = 1 / Math.sqrt(ge * ge + he * he + xe * xe);
              ge *= Ae, he *= Ae, xe *= Ae;
              var de = [Q, Se, Ie], Me = He / Math.tan(it * Math.PI / 360), Pe = [Q + ge * Me, Se + he * Me, Ie + xe * Me], Ve = Me + Z, je = 0, et = 0.95;
              je = Z > et * Me ? (1 - et) * Me : Me - Z;
              var Ye = new h4();
              return Ye.nearPlane = je, Ye.farPlane = Ve, Ye.eyePosition = Pe, Ye.targetPosition = de, Ye.upVector = [this.cameraObject.up.x, this.cameraObject.up.y, this.cameraObject.up.z], Ye;
            }, this.getViewportFromBoundingBox = (Q, Se) => {
              var Ie = Q.min.distanceTo(Q.max) / 2 * Se, He = (Q.min.x + Q.max.x) / 2, it = (Q.min.y + Q.max.y) / 2, Z = (Q.min.z + Q.max.z) / 2, ge = 4, he = this.getViewportFromCentreAndRadius(He, it, Z, Ie, 40, Ie * ge);
              return he;
            }, this.getCurrentViewport = () => {
              var Q = new h4();
              return Q.nearPlane = this.cameraObject.near, Q.farPlane = this.cameraObject.far, Q.eyePosition[0] = this.cameraObject.position.x, Q.eyePosition[1] = this.cameraObject.position.y, Q.eyePosition[2] = this.cameraObject.position.z, Q.targetPosition[0] = this.cameraObject.target.x, Q.targetPosition[1] = this.cameraObject.target.y, Q.targetPosition[2] = this.cameraObject.target.z, Q.upVector[0] = this.cameraObject.up.x, Q.upVector[1] = this.cameraObject.up.y, Q.upVector[2] = this.cameraObject.up.z, Q;
            }, this.getDefaultEyePosition = () => eyePosition, this.getDefaultTargetPosition = () => targetPosition, this.cameraTransition = (Q, Se, Ie) => {
              ae == null && (re = new g(Q, Se, this, Ie));
            }, this.rotateCameraTransition = (Q, Se, Ie) => {
              re == null && (ae = new p(Q, Se, this, Ie));
            }, this.enableCameraTransition = () => {
              re && (Y = P.SMOOTH_CAMERA_TRANSITION), ae && (Y = P.ROTATE_CAMERA_TRANSITION);
            }, this.pauseCameraTransition = () => {
              Y = P.DEFAULT;
            }, this.stopCameraTransition = () => {
              Y = P.DEFAULT, re = void 0, ae = void 0;
            }, this.isTransitioningCamera = () => Y === P.SMOOTH_CAMERA_TRANSITION || Y === P.ROTATE_CAMERA_TRANSITION, this.autoTumble = (Q, Se, Ie) => {
              ee = new y(Q, Se, Ie, this);
            }, this.enableAutoTumble = () => {
              Y = P.AUTO_TUMBLE;
            }, this.stopAutoTumble = () => {
              Y = P.DEFAULT, ee = void 0;
            }, this.updateAutoTumble = () => {
              ee && (ee.requireUpdate = true);
            }, this.isAutoTumble = () => Y === P.AUTO_TUMBLE, this.enableRaycaster = (Q, Se, Ie) => {
              K == null && (K = new u(Q, this.scene, Se, Ie, this.renderer));
            }, this.disableRaycaster = () => {
              K.disable(), K = void 0;
            }, this.isSyncControl = () => currentMpde === P.SYNC_CONTROL, this.enableSyncControl = () => (Y = P.SYNC_CONTROL, me || (me = new M()), me.setCurrentCameraSettings(this.cameraObject, _e[H]), me), this.disableSyncControl = () => {
              Y = P.DEFAULT, this.cameraObject.zoom = 1, this.cameraObject.updateProjectionMatrix();
            }, this.enable();
          }, g = function(w, _, E, P) {
            var S = w.eyePosition, R = w.targetPosition, A = w.upVector, C = _.eyePosition, L = _.targetPosition, I = _.upVector, b = E, O = P, N = 0, D = false;
            b.near = Math.min(w.nearPlane, _.nearPlane), b.far = Math.max(w.farPlane, _.farPlane), b.cameraObject.up.set(_.upVector[0], _.upVector[1], _.upVector[2]), this.setDuration = (H) => {
              O = H;
            };
            var U = (H) => {
              var Y = N + H;
              Y > O && (Y = O), N = Y;
            }, V = () => {
              var H = N / O, Y = [S[0] * (1 - H) + C[0] * H, S[1] * (1 - H) + C[1] * H, S[2] * (1 - H) + C[2] * H], re = [R[0] * (1 - H) + L[0] * H, R[1] * (1 - H) + L[1] * H, R[2] * (1 - H) + L[2] * H];
              A[0] * (1 - H) + I[0] * H, A[1] * (1 - H) + I[1] * H, A[2] * (1 - H) + I[2] * H, b.cameraObject.position.set(Y[0], Y[1], Y[2]), b.cameraObject.target.set(re[0], re[1], re[2]);
            };
            this.update = (H) => {
              this.enabled === false || (U(H), V(), N == O && (D = true));
            }, this.isTransitionCompleted = () => D;
          }, p = function(w, _, E, P) {
            var S = w, R = _, A = E, C = P, L = 0, I = false;
            this.setDuration = (O) => {
              C = O;
            };
            var b = (O) => {
              var N = L, D = L + O;
              D > C && (D = C), L = D;
              var U = L - N, V = U / C, H = V * R;
              A.rotateAboutLookAtpoint(S, H);
            };
            this.update = (O) => {
              this.enabled === false || (b(O), L == C && (I = true));
            }, this.isTransitionCompleted = () => I;
          }, u = function(w, _, E, P, S) {
            var R = w, A = _, C = S, L = E, I = P, b = new l.Raycaster();
            b.params.Line.threshold = 0.1, b.params.Points.threshold = 1;
            var O = new l.Vector2(), N = false, D = /* @__PURE__ */ new Date(), U = false, V = 0, H = [], Y = { zincCamera: void 0, x: -1, y: -1 }, re = void 0;
            this.enable = () => {
              enable = true;
            }, this.disable = () => {
              enable = false;
            }, this.getIntersectsObject = (oe) => {
              if (A !== R) {
                var j = R.getThreeJSScene();
                C.render(j, oe.cameraObject);
              }
              var K = re || R.getPickableThreeJSObjects();
              return H.length = 0, b.intersectObjects(K, true, H);
            }, this.setPickableObjects = (oe) => {
              oe === void 0 ? re = void 0 : (re = [], oe.forEach((j) => {
                j.getGroup() && j.getGroup().visible && re.push(j.getGroup());
              }));
            }, this.getIntersectsObjectWithOrigin = (oe, j, K) => (b.set(j, K), this.getIntersectsObject(oe)), this.getIntersectsObjectWithCamera = (oe, j, K) => (oe.getNDCFromDocumentCoords(j, K, O), b.setFromCamera(O, oe.cameraObject), this.getIntersectsObject(oe)), this.pick = (oe, j, K) => {
              if (C && R && oe && L) {
                this.getIntersectsObjectWithCamera(oe, j, K);
                for (var $, ne = H.length, k = 0; k < ne; k++) if ($ = H[k].object ? H[k].object.userData : void 0, $ && $.isMarkerCluster && $.visible && $.clusterIsVisible(H[k].object.clusterIndex) && $.zoomToCluster(H[k].object.clusterIndex))
                  return;
                L(H, j, K);
              }
            };
            var ae = (oe, j, K) => {
              if (C && R && oe && I) {
                if (this.getIntersectsObjectWithCamera(oe, j, K), D.setTime(Date.now()), H.length === 0) {
                  if (U) return;
                  U = true;
                } else U = false;
                I(H, j, K);
              }
            };
            this.move = (oe, j, K) => {
              C && R && oe && I && (R.displayMarkers ? ae(oe, j, K) : (Y.zincCamera = oe, Y.x = j, Y.y = K, !N && (V = D ? Date.now() - D.getTime() : 250, 250 <= V ? ae(oe, j, K) : (N = true, setTimeout(ee(Y), V)))));
            };
            var ee = (oe) => function() {
              N = false, ae(oe.zincCamera, oe.x, oe.y);
            };
          }, y = function(w, _, E, P) {
            var S = new l.Vector3(), R = -_, A = P, C = w;
            this.stopOnCameraInput = E, this.requireUpdate = true;
            var L = new l.Vector3(), I = new l.Vector3(), b = (O) => {
              var N = Math.sqrt(O[0] * O[0] + O[1] * O[1]), D = 4 * Math.abs(O[0]), U = 4 * Math.abs(O[1]), V = 0.25 * (D + U), H = -O[1] / N, Y = O[0] / N, re = H * O[0] + Y * -O[1];
              re > V ? re = V : re < -V && (re = -V);
              var ae = Math.acos(re / V) - 0.5 * Math.PI;
              S.copy(A.cameraObject.position).sub(A.cameraObject.target).normalize(), L.copy(A.cameraObject.up).normalize(), I.crossVectors(L, S).normalize().multiplyScalar(H), L.multiplyScalar(Y), L.add(I).multiplyScalar(Math.cos(ae)), S.multiplyScalar(Math.sin(ae)).add(L);
            };
            this.update = (O) => {
              this.enabled === false || (this.requireUpdate && (b(C), this.requireUpdate = false), A.rotateAboutLookAtpoint(S, R * O / 1e3));
            };
          }, v = function() {
            this.type = "StereoCamera", this.aspect = 1, this.cameraL = new l.PerspectiveCamera(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = false, this.cameraR = new l.PerspectiveCamera(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = false;
          };
          Object.assign(v.prototype, { update: (() => {
            var T, w, _, E, P, S, R = new l.Matrix4(), A = new l.Matrix4();
            return function(L) {
              var I = T !== L.focus || w !== L.fov || _ !== L.aspect * this.aspect || E !== L.near || P !== L.far || S !== L.zoom;
              if (I) {
                T = L.focus, w = L.fov, _ = L.aspect * this.aspect, E = L.near, P = L.far, S = L.zoom;
                var b, O, N = L.projectionMatrix.clone(), D = 0.064 / 2, U = D * E / T, V = E * Math.tan(0.5 * (l.Math.DEG2RAD * w)) / L.zoom;
                A.elements[12] = -D, R.elements[12] = D, b = -V * _ + U, O = V * _ + U, N.elements[0] = 2 * E / (O - b), N.elements[8] = (O + b) / (O - b), this.cameraL.projectionMatrix.copy(N), b = -V * _ - U, O = V * _ - U, N.elements[0] = 2 * E / (O - b), N.elements[8] = (O + b) / (O - b), this.cameraR.projectionMatrix.copy(N);
              }
              this.cameraL.matrixWorld.copy(L.matrixWorld).multiply(A), this.cameraR.matrixWorld.copy(L.matrixWorld).multiply(R);
            };
          })() });
          var m = function(w) {
            var _ = new v();
            _.aspect = 0.5, this.setSize = (E, P) => {
              w.setSize(E, P);
            }, this.render = (E, P) => {
              E.updateMatrixWorld(), P.parent === null && P.updateMatrixWorld(), _.update(P);
              var S = w.getSize();
              w.setScissorTest(true), w.clear(), w.setScissor(0, 0, S.width / 2, S.height), w.setViewport(0, 0, S.width / 2, S.height), w.render(E, _.cameraL), w.setScissor(S.width / 2, 0, S.width / 2, S.height), w.setViewport(S.width / 2, 0, S.width / 2, S.height), w.render(E, _.cameraR), w.setScissorTest(false);
            };
          }, x = function(w) {
            var _ = this;
            this.object = w, this.object.rotation.reorder("YXZ"), this.enabled = true, this.deviceOrientation = {}, this.screenOrientation = 0;
            var E = (R) => {
              _.deviceOrientation = R;
            }, P = () => {
              typeof window < "u" && (_.screenOrientation = window.orientation || 0);
            }, S = (() => {
              var R = new l.Vector3(0, 0, 1), A = new l.Euler(), C = new l.Quaternion(), L = new l.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5));
              return (I, b, O, N, D) => {
                var U = new l.Vector3(0, 0, 1);
                U.subVectors(I.target, I.position), A.set(O, b, -N, "YXZ");
                var V = new l.Quaternion();
                V.setFromEuler(A), V.multiply(L), V.multiply(C.setFromAxisAngle(R, -D)), U.applyQuaternion(V), U.addVectors(I.position, U), I.lookAt(U);
              };
            })();
            this.connect = () => {
              P(), typeof window < "u" && (window.addEventListener("orientationchange", P, false), window.addEventListener("deviceorientation", E, false)), _.enabled = true;
            }, this.disconnect = () => {
              typeof window < "u" && (window.removeEventListener("orientationchange", P, false), window.removeEventListener("deviceorientation", E, false)), _.enabled = false;
            }, this.update = () => {
              if (_.enabled !== false) {
                var R = _.deviceOrientation.alpha ? l.Math.degToRad(_.deviceOrientation.alpha) : 0, A = _.deviceOrientation.beta ? l.Math.degToRad(_.deviceOrientation.beta) : 0, C = _.deviceOrientation.gamma ? l.Math.degToRad(_.deviceOrientation.gamma) : 0, L = _.screenOrientation ? l.Math.degToRad(_.screenOrientation) : 0;
                S(_.object, R, A, C, L);
              }
            }, this.dispose = function() {
              this.disconnect();
            }, this.connect();
          }, M = function() {
            var w = void 0, _ = void 0, E = void 0, P = new l.Vector3(), S = new l.Vector3(), R = new l.Vector3(), A = new l.Vector3(), C = void 0;
            this.setCurrentCameraSettings = (L, I) => {
              w = L.clone(), _ = L, E = I, w.near = E.nearPlane, E.farPlane && (w.far = E.farPlane), E.eyePosition && w.position.set(E.eyePosition[0], E.eyePosition[1], E.eyePosition[2]), E.upVector && w.up.set(E.upVector[0], E.upVector[1], E.upVector[2]), E.targetPosition && (w.target = new l.Vector3(E.targetPosition[0], E.targetPosition[1], E.targetPosition[2]), w.lookAt(w.target)), w.updateProjectionMatrix(), P.copy(w.position).project(w), S.copy(w.target).project(w);
            }, this.getCurrentPosition = () => (S.copy(_.target).project(w), [S.x, S.y]), this.zoom = (L) => {
              var I = 2e-3 * L, b = Math.max(_.zoom - I, 1);
              _.zoom = b, _.updateProjectionMatrix();
            }, this.zoomToBox = (L, I) => {
              L.getCenter(R), R.project(w), this.setCenterZoom([R.x, R.y], I);
            }, this.getPanZoom = () => ({ target: this.getCurrentPosition(), zoom: _.zoom }), this.setCenterZoom = (L, I) => {
              R.set(L[0], L[1], S.z).unproject(w), A.copy(R).sub(_.target), _.target.copy(R), _.lookAt(_.target), _.position.add(A), _.zoom = I, _.updateProjectionMatrix();
            }, this.setEventCallback = (L) => {
              (L === void 0 || typeof L == "function") && (C = L);
            }, this.triggerCallback = () => {
              C !== void 0 && typeof C == "function" && C();
            };
          };
          a.Viewport = h4, a.CameraControls = f, a.SmoothCameraTransition = g, a.RotateCameraTransition = p, a.RayCaster = u, a.CameraAutoTumble = y, a.StereoEffect = m, a.NDCCameraControl = M;
        },
        /* 44 */
        /***/
        (o, a, c) => {
          var { Group: l, Matrix4: d } = c(4), h4 = c(22).Pointset;
          c(24).Lines;
          var f = c(45).Lines2, g = c(3).Geometry, p = c(4), u = 0, y = function() {
            return "re" + u++;
          }, v = function(m, x) {
            var M = m, T = new l();
            T.matrixAutoUpdate = false, T.userData = this;
            var w = [], _ = "", E = [], P = x, S = new d(), R = 3e3;
            S.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this.pickableUpdateRequired = true, this.isRegion = true, this.uuid = y(), this.hideAllPrimitives = () => {
              w.forEach((A) => A.hideAllPrimitives()), E.forEach((A) => A.setVisibility(false));
            }, this.showAllPrimitives = () => {
              w.forEach((A) => A.showAllPrimitives()), E.forEach((A) => A.setVisibility(true));
            }, this.setVisibility = (A) => {
              A != T.visible && (T.visible = A, this.pickableUpdateRequired = true);
            }, this.getVisibility = () => T.visible, this.getGroup = () => T, this.setTransformation = (A) => {
              S.set(...A), T.matrix.copy(S), T.updateMatrixWorld();
            }, this.setName = (A) => {
              A && A !== "" && (_ = A);
            }, this.getName = () => _, this.getParent = () => M, this.getFullSeparatedPath = () => {
              var A = [];
              if (_ !== "") {
                A.push(_);
                for (var C, L = M; L !== void 0; ) C = L.getName(), C !== "" && A.unshift(C), L = L.getParent();
              }
              return A;
            }, this.getFullPath = () => {
              var A = this.getFullSeparatedPath();
              if (0 < A.length) {
                var C = A.shift();
                return A.forEach((L) => {
                  C = C.concat("/", L);
                }), C;
              }
              return "";
            }, this.createChild = (A) => {
              var C = new v(this, P);
              return C.setName(A), w.push(C), T.add(C.getGroup()), C;
            }, this.getChildWithName = (A) => {
              if (A) {
                for (var C = A.toLowerCase(), L = 0; L < w.length; L++) if (w[L].getName().toLowerCase() === C) return w[L];
              }
            }, this.findChildFromSeparatedPath = (A) => {
              if (A && 0 < A.length && A[0] === "" && A.shift(), A && 0 < A.length) {
                var C = this.getChildWithName(A[0]);
                return C ? (A.shift(), C.findChildFromSeparatedPath(A)) : void 0;
              }
              return this;
            }, this.findChildFromPath = (A) => {
              var C = A.split("/");
              return this.findChildFromSeparatedPath(C);
            }, this.createChildFromSeparatedPath = (A) => {
              if (0 < A.length && A[0] === "" && A.shift(), 0 < A.length) {
                var C = this.getChildWithName(A[0]);
                return C || (C = this.createChild(A[0])), A.shift(), C.createChildFromSeparatedPath(A);
              }
              return this;
            }, this.createChildFromPath = (A) => {
              var C = A.split("/");
              return this.createChildFromSeparatedPath(C);
            }, this.findOrCreateChildFromPath = (A) => {
              var C = this.findChildFromPath(A);
              return C || (C = this.createChildFromPath(A)), C;
            }, this.addZincObject = (A) => {
              A && (A.setRegion(this), T.add(A.getGroup()), E.push(A), this.pickableUpdateRequired = true, P && P.triggerObjectAddedCallback(A));
            }, this.removeZincObject = (A) => {
              for (var C = 0; C < E.length; C++) if (A === E[C]) return T.remove(A.getGroup()), E.splice(C, 1), P && P.triggerObjectRemovedCallback(A), A.dispose(), void (this.pickableUpdateRequired = true);
            }, this.checkPickableUpdateRequred = (A) => {
              if (this.pickableUpdateRequired) return true;
              if (A) {
                for (var C = false, L = 0; L < w.length; L++) if (C = w[L].checkPickableUpdateRequred(A), C) return true;
              }
              return false;
            }, this.getPickableThreeJSObjects = (A, C) => (T.visible && (E.forEach((L) => {
              if (L.getGroup() && L.getGroup().visible) {
                var I = L.marker;
                I && I.isEnabled() && A.push(I.getMorph()), A.push(L.getGroup());
              }
            }), C && w.forEach((L) => {
              L.getPickableThreeJSObjects(A, C);
            }), this.pickableUpdateRequired = false), A), this.setDuration = (A) => {
              R = A, E.forEach((C) => C.setDuration(A)), w.forEach((C) => C.setDuration(A));
            }, this.getDuration = () => R, this.getBoundingBox = (A) => {
              var C, L;
              return E.forEach((I) => {
                L = I.getBoundingBox(), L && (C == null ? C = L.clone() : C.union(L));
              }), A && w.forEach((I) => {
                L = I.getBoundingBox(A), L && (C == null ? C = L.clone() : C.union(L));
              }), C;
            }, this.clear = (A) => {
              A && w.forEach((C) => C.clear(A)), E.forEach((C) => {
                T.remove(C.getGroup()), C.dispose();
              }), w = [], E = [];
            }, this.objectIsInRegion = (A, C) => {
              for (var L = 0; L < E.length; L++) if (A === E[L]) return true;
              if (C) {
                for (var I = 0; I < w.length; I++) if (w[I].objectIsInRegion(A, C)) return true;
              }
              return false;
            }, this.forEachGeometry = (A, C) => {
              E.forEach((L) => {
                L.isGeometry && A(L);
              }), C && w.forEach((L) => L.forEachGeometry(A, C));
            }, this.forEachGlyphset = (A, C) => {
              E.forEach((L) => {
                L.isGlyphset && A(L);
              }), C && w.forEach((L) => L.forEachGlyphset(A, C));
            }, this.forEachPointset = (A, C) => {
              E.forEach((L) => {
                L.isPointset && A(L);
              }), C && w.forEach((L) => L.forEachPointset(A, C));
            }, this.forEachLine = (A, C) => {
              E.forEach((L) => {
                L.isLines && A(L);
              }), C && w.forEach((L) => L.forEachLine(A, C));
            }, this.findObjectsWithAnatomicalId = (A, C) => (E.forEach((L) => {
              L.anatomicalId === A && objectsArray.push(L);
            }), C && w.forEach((L) => {
              var I = L.findObjectsWithAnatomicalId(A, C);
              objectsArray.push(...I);
            }), objectsArray), this.findObjectsWithGroupName = (A, C) => {
              var L = [];
              return E.forEach((I) => {
                var b = I.groupName ? I.groupName.toLowerCase() : I.groupName, O = A && A.toLowerCase();
                b === O && L.push(I);
              }), C && w.forEach((I) => {
                var b = I.findObjectsWithGroupName(A, C);
                L.push(...b);
              }), L;
            }, this.findGeometriesWithGroupName = (A, C) => {
              var L = this.findObjectsWithGroupName(A, C), I = L.filter((b) => b.isGeometry);
              return I;
            }, this.findPointsetsWithGroupName = (A, C) => {
              var L = this.findObjectsWithGroupName(A, C), I = L.filter((b) => b.isPointset);
              return I;
            }, this.findGlyphsetsWithGroupName = (A, C) => {
              var L = this.findObjectsWithGroupName(A, C), I = L.filter((b) => b.isGlyphset);
              return I;
            }, this.findLinesWithGroupName = (A, C) => {
              var L = this.findObjectsWithGroupName(A, C), I = L.filter((b) => b.isLines);
              return I;
            }, this.getAllObjects = (A) => {
              var C = [...E];
              return A && w.forEach((L) => {
                var I = L.getAllObjects(A);
                C.push(...I);
              }), C;
            }, this.getChildRegions = (A) => {
              var C = [...w];
              return A && w.forEach((L) => {
                var I = L.getChildRegions(A);
                C.push(...I);
              }), C;
            }, this.getCurrentTime = () => {
              if (E[0] != null) return E[0].getCurrentTime();
              for (var A, C = 0; C < w.length; C++) if (A = w[C].getCurrentTime(), A !== -1) return A;
              return -1;
            }, this.setMorphTime = (A, C) => {
              E.forEach((L) => {
                L.setMorphTime(A);
              }), C && w.forEach((L) => {
                L.setMorphTime(A);
              });
            }, this.isTimeVarying = () => {
              for (var A = 0; A < E.length; A++) if (E[A].isTimeVarying()) return true;
              for (var C = 0; C < w.length; C++) if (w[C].isTimeVarying()) return true;
              return false;
            }, this.renderGeometries = (A, C, L, I, b, O) => {
              var N, D = this.getAllObjects(O);
              D.forEach((U) => {
                U.render(A * C, L, I, b);
              }), b && L === false && (N = b.markerCluster) !== null && N !== void 0 && N.markerUpdateRequired && b.markerCluster.calculate();
            }, this.createPoints = (A, C, L, I) => {
              var b = false, O = this.findObjectsWithGroupName(A, false), N = O.findIndex((U) => U.isPointset), D = -1 < N ? O[N] : new h4();
              return D.addPoints(C, L, I), N === -1 ? (D.setName(A), this.addZincObject(D), b = true) : this.pickableUpdateRequired = true, { zincObject: D, isNew: b };
            }, this.createLines = (A, C, L) => {
              var I = false, b = this.findObjectsWithGroupName(A, false), O = b.findIndex((D) => D.isLines), N = -1 < O ? b[O] : new f();
              return N.addLines(C, L), O === -1 ? (N.setName(A), this.addZincObject(N), I = true) : this.pickableUpdateRequired = true, { zincObject: N, isNew: I };
            }, this.createGeometryFromThreeJSGeometry = (A, C, L, I, b, O) => {
              var N = new g(), D = new p.MeshPhongMaterial({ color: L, morphTargets: false, morphNormals: false, transparent: true, opacity: I, side: p.DoubleSide });
              return N.createMesh(C, D, { localTimeEnabled: false, localMorphColour: false }), N.getMorph() ? (N.setVisibility(false), N.setName(A), N.setRenderOrder(O), this.addZincObject(N), N) : void 0;
            };
          };
          a.Region = v;
        },
        /* 45 */
        /***/
        (o, a, c) => {
          c(4), c(5).toBufferGeometry;
          var l = c(46).LineSegments2, d = c(48).LineMaterial, h4 = c(47).LineSegmentsGeometry, f = function() {
            c(24).Lines.call(this), this.isLines2 = true;
            var g = Array(300);
            this.createLineSegment = (p, u, y) => {
              if (p && u) {
                var v = new h4();
                v.setPositions(p), v.colorsNeedUpdate = true;
                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 = true);
            }, 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 = true);
              }
              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 = true;
              }
              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: false, worldUnits: false });
                  v.resolution.set(window.innerWidth, window.innerHeight), this.createLineSegment(g, v, { localTimeEnabled: false, localMorphColour: false });
                }
                this.region && (this.region.pickableUpdateRequired = true);
              }
            }, 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;
        },
        /* 46 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineSegments2: () => (
              /* binding */
              E
            )
            /* harmony export */
          });
          var l = c(4), d = c(47), h4 = c(48), 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(), M = new l.Vector3(), T = new l.Box3(), w = new l.Sphere(), _ = new l.Vector4();
          class E extends l.Mesh {
            constructor() {
              var S = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new d.LineSegmentsGeometry(), R = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new h4.LineMaterial({ color: 16777215 * Math.random() });
              super(S, R), this.type = "LineSegments2";
            }
            // for backwards-compatability, but could be a method of LineSegmentsGeometry...
            computeLineDistances() {
              for (var S = this.geometry, R = S.attributes.instanceStart, A = S.attributes.instanceEnd, C = new Float32Array(2 * R.count), L = 0, I = 0, b = R.count; L < b; L++, I += 2) f.fromBufferAttribute(R, L), g.fromBufferAttribute(A, L), C[I] = I == 0 ? 0 : C[I - 1], C[I + 1] = C[I] + f.distanceTo(g);
              var O = new l.InstancedInterleavedBuffer(C, 2, 1);
              return S.setAttribute("instanceDistanceStart", new l.InterleavedBufferAttribute(O, 1, 0)), S.setAttribute("instanceDistanceEnd", new l.InterleavedBufferAttribute(O, 1, 1)), this;
            }
            raycast(S, R) {
              S.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');
              var A = S.params.Line2 === void 0 ? 0 : S.params.Line2.threshold || 0, C = S.ray, L = S.camera, I = L.projectionMatrix, b = this.matrixWorld, O = this.geometry, N = this.material, D = N.resolution, U = N.linewidth + A, V = O.attributes.instanceStart, H = O.attributes.instanceEnd, Y = -L.near, re = 2 * Math.max(U / D.width, U / D.height);
              O.boundingSphere === null && O.computeBoundingSphere(), w.copy(O.boundingSphere).applyMatrix4(b);
              var ae = Math.max(L.near, w.distanceToPoint(C.origin));
              _.set(0, 0, -ae, 1).applyMatrix4(L.projectionMatrix), _.multiplyScalar(1 / _.w), _.applyMatrix4(L.projectionMatrixInverse);
              var ee = 0.5 * Math.abs(re / _.w);
              if (w.radius += ee, S.ray.intersectsSphere(w) !== false) {
                O.boundingBox === null && O.computeBoundingBox(), T.copy(O.boundingBox).applyMatrix4(b);
                var oe = Math.max(L.near, T.distanceToPoint(C.origin));
                _.set(0, 0, -oe, 1).applyMatrix4(L.projectionMatrix), _.multiplyScalar(1 / _.w), _.applyMatrix4(L.projectionMatrixInverse);
                var j = 0.5 * Math.abs(re / _.w);
                if (T.max.x += j, T.max.y += j, T.max.z += j, T.min.x -= j, T.min.y -= j, T.min.z -= j, S.ray.intersectsBox(T) !== false) {
                  C.at(1, y), y.w = 1, y.applyMatrix4(L.matrixWorldInverse), y.applyMatrix4(I), y.multiplyScalar(1 / y.w), y.x *= D.x / 2, y.y *= D.y / 2, y.z = 0, v.copy(y), m.multiplyMatrices(L.matrixWorldInverse, b);
                  for (var K = 0, $ = V.count; K < $; K++) {
                    p.fromBufferAttribute(V, K), u.fromBufferAttribute(H, K), p.w = 1, u.w = 1, p.applyMatrix4(m), u.applyMatrix4(m);
                    var ne = p.z > Y && u.z > Y;
                    if (!ne) {
                      if (p.z > Y) {
                        var k = p.z - u.z, W = (p.z - Y) / k;
                        p.lerp(u, W);
                      } else if (u.z > Y) {
                        var B = u.z - p.z, X = (u.z - Y) / B;
                        u.lerp(p, X);
                      }
                      p.applyMatrix4(I), u.applyMatrix4(I), p.multiplyScalar(1 / p.w), u.multiplyScalar(1 / u.w), p.x *= D.x / 2, p.y *= D.y / 2, u.x *= D.x / 2, u.y *= D.y / 2, x.start.copy(p), x.start.z = 0, x.end.copy(u), x.end.z = 0;
                      var J = x.closestPointToPointParameter(v, true);
                      x.at(J, M);
                      var F = l.MathUtils.lerp(p.z, u.z, J), z = -1 <= F && 1 >= F, te = v.distanceTo(M) < 0.5 * U;
                      if (z && te) {
                        x.start.fromBufferAttribute(V, K), x.end.fromBufferAttribute(H, K), x.start.applyMatrix4(b), x.end.applyMatrix4(b);
                        var se = new l.Vector3(), le = new l.Vector3();
                        C.distanceSqToSegment(x.start, x.end, le, se), R.push({ point: le, pointOnLine: se, distance: C.origin.distanceTo(le), object: this, face: null, faceIndex: K, uv: null, uv2: null });
                      }
                    }
                  }
                }
              }
            }
          }
          E.prototype.LineSegments2 = true;
        },
        /* 47 */
        /***/
        (o, a, c) => {
          c.r(a), c.d(a, {
            /* harmony export */
            LineSegmentsGeometry: () => (
              /* binding */
              f
            )
            /* harmony export */
          });
          var l = c(4), d = new l.Box3(), h4 = 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 = true), 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++) h4.fromBufferAttribute(p, m), v = Math.max(v, y.distanceToSquared(h4)), h4.fromBufferAttribute(u, m), v = Math.max(v, y.distanceToSquared(h4));
                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 = true;
        },
        /* 48 */
        /***/
        (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: true
                // required for clipping support
              }), Object.defineProperties(this, { color: { enumerable: true, get: function() {
                return this.uniforms.diffuse.value;
              }, set: function(p) {
                this.uniforms.diffuse.value = p;
              } }, linewidth: { enumerable: true, get: function() {
                return this.uniforms.linewidth.value;
              }, set: function(p) {
                this.uniforms.linewidth.value = p;
              } }, dashed: { enumerable: true, get: function() {
                return "USE_DASH" in this.defines;
              }, set(g) {
                !!g != "USE_DASH" in this.defines && (this.needsUpdate = true), g === true ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH;
              } }, dashScale: { enumerable: true, get: function() {
                return this.uniforms.dashScale.value;
              }, set: function(p) {
                this.uniforms.dashScale.value = p;
              } }, dashSize: { enumerable: true, get: function() {
                return this.uniforms.dashSize.value;
              }, set: function(p) {
                this.uniforms.dashSize.value = p;
              } }, dashOffset: { enumerable: true, get: function() {
                return this.uniforms.dashOffset.value;
              }, set: function(p) {
                this.uniforms.dashOffset.value = p;
              } }, gapSize: { enumerable: true, get: function() {
                return this.uniforms.gapSize.value;
              }, set: function(p) {
                this.uniforms.gapSize.value = p;
              } }, opacity: { enumerable: true, get: function() {
                return this.uniforms.opacity.value;
              }, set: function(p) {
                this.uniforms.opacity.value = p;
              } }, resolution: { enumerable: true, get: function() {
                return this.uniforms.resolution.value;
              }, set: function(p) {
                this.uniforms.resolution.value.copy(p);
              } }, alphaToCoverage: { enumerable: true, get: function() {
                return "ALPHA_TO_COVERAGE" in this.defines;
              }, set: function(p) {
                !!p != "ALPHA_TO_COVERAGE" in this.defines && (this.needsUpdate = true), p === true ? (this.defines.ALPHA_TO_COVERAGE = "", this.extensions.derivatives = true) : (delete this.defines.ALPHA_TO_COVERAGE, this.extensions.derivatives = false);
              } } }), this.setValues(f);
            }
          }
          d.prototype.isLineMaterial = true;
        },
        /* 49 */
        /***/
        (o, a, c) => {
          var l = c(4);
          a.Minimap = function(d) {
            var h4 = 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: false, depthWrite: false, opacity: 0.5, transparent: true });
            this.mask = new l.Mesh(f, u);
            var y = new l.Box3(), v = new l.Vector3();
            this.getDiffFromNormalised = (x, M) => {
              y.setFromBufferAttribute(p).getCenter(v);
              var T = v.clone().project(this.camera), w = new l.Vector3(x, M, T.z).unproject(this.camera);
              return w.sub(v);
            };
            var m = (x, M) => {
              h4.camera.near && (this.camera.near = h4.camera.near), M.farPlane && (this.camera.far = M.farPlane), M.eyePosition && this.camera.position.set(M.eyePosition[0], M.eyePosition[1], M.eyePosition[2]), M.upVector && this.camera.up.set(M.upVector[0], M.upVector[1], M.upVector[2]), M.targetPosition && this.camera.lookAt(new l.Vector3(M.targetPosition[0], M.targetPosition[1], M.targetPosition[2])), this.camera.zoom = 1 / x, this.camera.updateProjectionMatrix();
            };
            this.getBoundary = () => {
              var x = new l.Vector3().copy(h4.camera.target).project(h4.camera), M = new l.Vector3(-1, -1, x.z).unproject(h4.camera), T = new l.Vector3(1, -1, x.z).unproject(h4.camera), w = new l.Vector3(1, 1, x.z).unproject(h4.camera), _ = new l.Vector3(-1, 1, x.z).unproject(h4.camera);
              p.copyVector3sArray([M, T, w, w, _, M]), p.needsUpdate = true;
            }, this.updateCamera = () => {
              this.getBoundary();
              var x = h4.getZincCameraControls(), M = h4.getBoundingBox();
              if (M) {
                var T = M.min.distanceTo(M.max), w = T / 2, _ = (M.min.x + M.max.x) / 2, E = (M.min.y + M.max.y) / 2, P = (M.min.z + M.max.z) / 2, S = x.getViewportFromCentreAndRadius(_, E, P, w, 40, w * 4);
                m(T, S);
              }
            };
          };
        },
        /* 50 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(51)(l), h4 = c(3).Geometry, f = c(52), g = c(53).default, p = l.BufferGeometryLoader, u = function(y) {
            var v;
            y && y.isGeometry && (v = y);
            var m = void 0, x = void 0, M = false, T = void 0, w = (R) => {
              var A = v.getMorph().material.clone();
              A.morphTargets = false;
              var C = new h4(), L = new p(), I = L.parse(R), b = new l.Mesh(I.geometry, A);
              return C.geometry = b.geometry, b.userData = C, C.setMorph(b), C;
            }, _ = (R) => {
              switch (R.data.action) {
                case "message":
                  console.log(R.data.message);
                  break;
                case "result":
                  var A = new u(w(R.data.object));
                  T && T(A), T = void 0, M = false;
                  break;
                default:
                  throw "Cannot handle specified action.";
              }
            }, E = (R) => {
              if (f !== void 0 && (x = f(
                /*require.resolve*/
                54
              )), !x) m = new (c(55)).GeometryCSGInternal(R);
              else if (R && R.isGeometry) {
                var A = R.getMorph(), C = A.geometry.clone().applyMatrix(A.matrix).toJSON();
                x.addEventListener("message", function(L) {
                  _(L);
                }), x.postMessage({ action: "initialise", object: C });
              }
            };
            this.getHostGeometry = () => {
              var R = new d(v.getMorph());
              return new P(R);
            }, this.getGeometry = () => v;
            var P = (R) => {
              var A = v.getMorph().material.clone();
              A.morphTargets = false;
              var C = R.toMesh(A), L = new h4();
              return L.geometry = C.geometry, C.userData = L, L.setMorph(C), L;
            };
            this.setCSG = (R) => {
              m.setCSG(R);
            };
            var S = (R, A, C, L) => {
              if (M)
                L("On progress");
              else {
                var I = R.getMorph(), b = I.geometry.clone().applyMatrix(I.matrix).toJSON();
                T = C, M = true, x.postMessage({ action: A, object: b });
              }
            };
            this.intersect = (R) => new g((A, C) => {
              if (x) S(R, "intersect", A, C);
              else {
                var L = m.intersect(R), I = new u(P(L));
                I.setCSG(L), A(I);
              }
            }), this.subtract = (R) => new g((A, C) => {
              if (x) S(R, "intersect", A, C);
              else {
                var L = m.subtract(R), I = new u(P(L));
                I.setCSG(L), A(I);
              }
            }), this.union = (R) => new g((A, C) => {
              if (x) S(R, "intersect", A, C);
              else {
                var L = m.union(R), I = new u(P(L));
                I.setCSG(L), A(I);
              }
            }), this.terminateWorker = () => {
              x && x.terminate();
            }, E(y);
          };
          a.GeometryCSG = u;
        },
        /* 51 */
        /***/
        (o) => {
          var a = 1e-5, c = 0, l = 1, d = 2, h4 = 3;
          o.exports = function(f) {
            var g = function(p) {
              var u, y, v, m, x, M, T, w = [];
              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(false);
              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], T = new g.Polygon(), v instanceof f.Face3 ? (m = p.vertices[v.a], M = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], M), m.applyMatrix4(this.matrix), T.vertices.push(m), m = p.vertices[v.b], M = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], M), m.applyMatrix4(this.matrix), T.vertices.push(m), m = p.vertices[v.c], M = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], M), m.applyMatrix4(this.matrix), T.vertices.push(m)) : (f.Face4, m = p.vertices[v.a], M = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], M), m.applyMatrix4(this.matrix), T.vertices.push(m), m = p.vertices[v.b], M = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[1], M), m.applyMatrix4(this.matrix), T.vertices.push(m), m = p.vertices[v.c], M = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], M), m.applyMatrix4(this.matrix), T.vertices.push(m), m = p.vertices[v.d], M = x ? new f.Vector2(x[3].x, x[3].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[3], M), m.applyMatrix4(this.matrix), T.vertices.push(m)), T.calculateProperties(), w.push(T);
              this.tree = new g.Node(w);
            };
            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, M, T, w, _, E = new f.Matrix4().getInverse(this.matrix), P = new f.Geometry(), S = this.tree.allPolygons(), R = S.length, A = {};
              for (p = 0; p < R; p++) for (y = S[p], v = y.vertices.length, u = 2; u < v; u++) _ = [], T = y.vertices[0], _.push(new f.Vector2(T.uv.x, T.uv.y)), T = new f.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof A[T.x + "," + T.y + "," + T.z] > "u" ? (P.vertices.push(T), m = A[T.x + "," + T.y + "," + T.z] = P.vertices.length - 1) : m = A[T.x + "," + T.y + "," + T.z], T = y.vertices[u - 1], _.push(new f.Vector2(T.uv.x, T.uv.y)), T = new f.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof A[T.x + "," + T.y + "," + T.z] > "u" ? (P.vertices.push(T), x = A[T.x + "," + T.y + "," + T.z] = P.vertices.length - 1) : x = A[T.x + "," + T.y + "," + T.z], T = y.vertices[u], _.push(new f.Vector2(T.uv.x, T.uv.y)), T = new f.Vector3(T.x, T.y, T.z), T.applyMatrix4(E), typeof A[T.x + "," + T.y + "," + T.z] > "u" ? (P.vertices.push(T), M = A[T.x + "," + T.y + "," + T.z] = P.vertices.length - 1) : M = A[T.x + "," + T.y + "," + T.z], w = new f.Face3(m, x, M, new f.Vector3(y.normal.x, y.normal.y, y.normal.z)), P.faces.push(w), P.faceVertexUvs[0].push(_);
              return P;
            }, 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, M = p.vertices.length;
              for (u = 0; u < M; 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 : h4;
            }, 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 M, T, w, _, E, P, S, R, A, C = [], L = [];
                for (T = 0, M = p.vertices.length; T < M; T++) w = (T + 1) % M, P = p.vertices[T], S = p.vertices[w], _ = this.classifyVertex(P), E = this.classifyVertex(S), _ != d && C.push(P), _ != l && L.push(P), (_ | E) == h4 && (R = (this.w - this.normal.dot(P)) / this.normal.dot(S.clone().subtract(P)), A = P.interpolate(S, R), C.push(A), L.push(A));
                3 <= C.length && v.push(new g.Polygon(C).calculateProperties()), 3 <= L.length && m.push(new g.Polygon(L).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 false;
              return true;
            }, 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;
          };
        },
        /* 52 */
        /***/
        (o) => {
          o.exports = _z();
        },
        /* 53 */
        /***/
        (o) => {
          o.exports = Oz;
        },
        /* 54 */
        /***/
        (o, a, c) => {
          var l = c(3).Geometry, d = c(4), h4 = d.BufferGeometryLoader;
          o.exports = function(f) {
            var g = void 0, p = function(M) {
              var T = new h4(), w = T.parse(M), _ = new d.MeshPhongMaterial(), E = new d.Mesh(w.geometry, _), P = new l();
              return P.setMorph(E), P;
            }, u = function(M) {
              var T = p(M);
              g = new (c(55)).GeometryCSGInternal(T), f.postMessage({ action: "message", message: "Initialised" });
            }, y = function(M) {
              if (g) {
                var T = p(M), w = g.intersect(T), _ = w.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: _ });
              }
            }, v = function(M) {
              if (g) {
                var T = p(M), w = g.subtract(T), _ = w.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: _ });
              }
            }, m = function(M) {
              if (g) {
                var T = p(M), w = g.union(T), _ = w.toBufferGeometry().toJSON();
                f.postMessage({ action: "result", object: _ });
              }
            };
            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.";
              }
            });
          };
        },
        /* 55 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(51)(l);
          c(3).Geometry, c(50).GeometryCSG;
          var h4 = 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 = h4;
        },
        /* 56 */
        /***/
        (o, a, c) => {
          var l = c(4), d = c(51)(l);
          c(18).Glyphset;
          var h4 = 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 M = new d(m.geometry.clone().applyMatrix(m.matrix)), T = [];
                T.csg = M, T.label = x, m.material && (T.material = m.material.clone()), p.push(T);
              }
            }, 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(), M = 0; M < p.length; M++) {
                  var T = p[M], w = T.csg.intersect(m), _ = w.toMesh();
                  if (_ && _.geometry && 0 < _.geometry.vertices.length) {
                    T.material && (_.material = T.material, _.material.side = l.DoubleSide, _.material.clippingPlanes = null);
                    var E = x.addMeshAsGlyph(_, M + 1);
                    E.setLabel(T.label);
                  }
                }
                var P = new h4(x);
                return P;
              }
            };
          };
          a.GlyphsetCSG = h4;
        }
        /******/
      ], 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: true, 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: true });
      };
      var s = r(0);
      return s;
    })()
  ));
})(Iy);
var zr = Iy.exports;
var Gc = tL(zr);
var jv = (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;
};
var Yd = (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);
};
var Iz = (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 = Yd(r[0], [s.x, s.y, s.z]), a = Yd(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] };
        }
      }
    }
  }
};
var Dz = (n) => {
  const e = n.zincObjects;
  if (e.length > 0 && e[0]) {
    const t = e[0];
    if (t.isEditable)
      return t;
  }
};
var Nz = (n, e, t) => {
  if (n != null && n.isEditable && (n != null && n.isPointset)) {
    let i = false;
    for (let r = 0; r < 3 && !i; r++)
      t[r] !== 0 && (i = true);
    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 = true, true;
    }
  }
  return false;
};
var Pc = (n, e) => {
  if (n != null && n.isEditable && (n != null && n.isLines2) && e > -1) {
    const t = n.getVerticesByFaceIndex(e);
    if (t && t.length > 1)
      return Yd(t[1], t[0]);
  }
  return 0;
};
var Wh = (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 = true, true;
  }
  return false;
};
var Bz = (n, e) => {
  const t = e.getBoundingBox(), i = new zr.THREE.Vector3().subVectors(t.max, t.min), r = new zr.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();
};
var Rw = (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) => Rw(i, e));
};
var Ao = (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;
};
var Jd = (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;
};
var Fz = (n, e) => {
  const t = [];
  if (n && e && e.length > 0) {
    const i = {}, r = {}, s = [n, ...n.getChildRegions(true)];
    let o, a, c;
    e.forEach((l) => {
      const d = l.split("/");
      c = d[0], o = Jd(s, c, false), o && (r[c] || (r[c] = o.getFullPath()), d[1] ? (i[c] || (i[c] = o.getAllObjects(false)), a = Jd(i[c], d[1], true), a && t.push(`${r[c]}/${a.groupName}`)) : t.push(`__r/${r[c]}`));
    });
  }
  return t;
};
var zz = (n) => {
  if (n) {
    const e = [];
    return n.forEach((i) => {
      i.isZincObject ? e.push(i) : i.isRegion && e.push(...i.getAllObjects(true));
    }), Object.values(
      e.reduce((i, r) => ({ ...i, [r.uuid]: r }), {})
    );
  }
  return [];
};
var $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(false));
      const a = Jd(i[o.uuid], s.data.uuid);
      a && t.objects.push(a);
    });
  }
  return t;
};
var Uz = (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;
};
var Vz = (n, e, t, i, r) => {
  let s;
  if (n.isPointset ? s = "MultiPoint" : n.isLines2 && (s = "MultiLineString"), s) {
    const o = Uz(n);
    let a = e.slice(-1) === "/" ? e : e + "/";
    a = a + t;
    const c = a, l = {
      resource: i,
      item: {
        id: c
      },
      body: {
        evidence: [],
        comment: r
      },
      feature: {
        id: c,
        properties: {
          drawn: true,
          label: "Drawn annotation"
        },
        geometry: {
          coordinates: o,
          type: s
        }
      }
    };
    return r === "Deleted" && (l.feature = void 0), l;
  }
};
var Zv = (n, e, t, i, r, s, o) => {
  const a = Vz(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;
};
var Xv = async (n, e, t) => {
  const i = t;
  return await n.drawnFeatures(e, i);
};
var jh = (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 = true);
  });
};
var xr = (n, e) => {
  const t = n.__vccOpts || n;
  for (const [i, r] of e)
    t[i] = r;
  return t;
};
var kz = {
  name: "LinesControls",
  components: {
    Button: sa,
    Col: wi,
    Container: ki,
    InputNumber: vr,
    Main: gr,
    Slider: si,
    ElIconArrowLeft: Wr,
    ElIconArrowRight: jr
  },
  props: {
    createData: {
      type: Object
    }
  },
  data: function() {
    return {
      adjust: 0,
      pAdjust: 0,
      lengthScale: 0,
      distance: 0,
      newDistance: 0,
      width: 1,
      currentIndex: 0,
      ElIconArrowLeft: shallowRef(Wr),
      ElIconArrowRight: shallowRef(jr),
      edited: false,
      zincObject: void 0
    };
  },
  watch: {
    "createData.faceIndex": {
      handler: function(n) {
        var e;
        (e = this.zincObject) != null && e.isLines2 && (this.currentIndex = n, this.distance = Pc(this.zincObject, this.currentIndex));
      },
      immediate: true
    }
  },
  methods: {
    changeIndex: function(n) {
      n ? Pc(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 = Wh(
        this.zincObject,
        this.currentIndex,
        this.newDistance,
        true
      ) || this.edited) : this.newDistance = this.distance;
    },
    onLengthSliding: function() {
      this.newDistance = Math.pow(10, this.lengthScale) * this.distance, this.edited = Wh(
        this.zincObject,
        this.currentIndex,
        this.newDistance,
        true
      ) || this.edited;
    },
    onMoveSliding: function() {
      const n = (this.adjust - this.pAdjust) * this.distance;
      this.edited = Wh(
        this.zincObject,
        this.currentIndex,
        n,
        false
      ) || this.edited, this.pAdjust = this.adjust;
    },
    reset: function() {
      this.adjust = 0, this.pAdjust = 0, this.lengthScale = 0, this.distance = Pc(this.zincObject, this.currentIndex), this.newDistance = this.distance, this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = false);
    },
    setObject: function(n) {
      this.currentIndex = -1, this.distance = 0, n.isLines2 ? (this.zincObject = markRaw(n), this.width = this.zincObject.getMorph().material.linewidth, n.isEditable && (this.currentIndex = 0, this.distance = Pc(n, this.currentIndex))) : (this.zincObject = void 0, this.width = 10);
    },
    modifyWidth: function() {
      this.zincObject.setWidth(this.width);
    }
  }
};
function Gz(n, e, t, i, r, s) {
  const o = wi, a = si, c = vr, l = Vi, d = sa, h4 = gr, f = ki;
  return openBlock(), createBlock(f, { class: "lines-container" }, {
    default: withCtx(() => [
      createVNode(h4, { class: "slides-block" }, {
        default: withCtx(() => [
          createVNode(l, null, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[11] || (e[11] = [
                  createTextVNode(" Width: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 12
              }, {
                default: withCtx(() => [
                  createVNode(a, {
                    modelValue: n.width,
                    "onUpdate:modelValue": e[0] || (e[0] = (g) => n.width = g),
                    class: "my-slider",
                    step: 1,
                    min: 1,
                    max: 100,
                    "show-tooltip": false,
                    onInput: s.modifyWidth
                  }, null, 8, ["modelValue", "onInput"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 4
              }, {
                default: withCtx(() => [
                  createVNode(c, {
                    modelValue: n.width,
                    "onUpdate:modelValue": e[1] || (e[1] = (g) => n.width = g),
                    step: 1,
                    min: 1,
                    max: 100,
                    controls: false,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          n.currentIndex > -1 && n.distance > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: withCtx(() => [
                    createVNode(d, {
                      size: "small",
                      disabled: n.currentIndex === 0,
                      icon: n.ElIconArrowLeft,
                      onClick: e[2] || (e[2] = (g) => s.changeIndex(false))
                    }, null, 8, ["disabled", "icon"])
                  ]),
                  _: 1
                }),
                createVNode(o, {
                  offset: 4,
                  span: 9
                }, {
                  default: withCtx(() => [
                    createTextVNode(" Editing Line " + toDisplayString(n.currentIndex + 1), 1)
                  ]),
                  _: 1
                }),
                createVNode(o, {
                  offset: 2,
                  span: 2
                }, {
                  default: withCtx(() => [
                    createVNode(d, {
                      size: "small",
                      icon: n.ElIconArrowRight,
                      onClick: e[3] || (e[3] = (g) => s.changeIndex(true))
                    }, null, 8, ["icon"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => e[12] || (e[12] = [
                    createTextVNode(" Move: ")
                  ])),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: withCtx(() => [
                    createVNode(a, {
                      modelValue: n.adjust,
                      "onUpdate:modelValue": e[4] || (e[4] = (g) => n.adjust = g),
                      step: 0.01,
                      min: -3,
                      max: 3,
                      "show-tooltip": false,
                      onInput: e[5] || (e[5] = (g) => s.onMoveSliding()),
                      onChange: e[6] || (e[6] = (g) => s.reset())
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => e[13] || (e[13] = [
                    createTextVNode(" Length: ")
                  ])),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 10
                }, {
                  default: withCtx(() => [
                    createVNode(a, {
                      modelValue: n.lengthScale,
                      "onUpdate:modelValue": e[7] || (e[7] = (g) => n.lengthScale = g),
                      step: 0.01,
                      min: -1,
                      max: 1,
                      "show-tooltip": false,
                      onInput: e[8] || (e[8] = (g) => s.onLengthSliding()),
                      onChange: e[9] || (e[9] = (g) => s.reset())
                    }, null, 8, ["modelValue"])
                  ]),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => [
                    createVNode(c, {
                      modelValue: n.newDistance,
                      "onUpdate:modelValue": e[10] || (e[10] = (g) => n.newDistance = g),
                      controls: false,
                      class: "input-box number-input",
                      onChange: s.onLengthInput
                    }, null, 8, ["modelValue", "onChange"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 64)) : createCommentVNode("", true)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
var Pw = xr(kz, [["render", Gz], ["__scopeId", "data-v-6581aa67"]]);
var Hz = {
  name: "PointsControls",
  components: {
    Col: wi,
    Container: ki,
    InputNumber: vr,
    Main: gr,
    Select: oa,
    Slider: si,
    Row: Vi,
    Option: aa,
    ElIconArrowLeft: Wr,
    ElIconArrowRight: jr
  },
  inject: ["boundingDims"],
  data: function() {
    return {
      attenuation: false,
      size: 10,
      choices: [
        {
          value: true,
          label: "On"
        },
        {
          value: false,
          label: "off"
        }
      ],
      min: [0, 0, 0],
      max: [1, 1, 1],
      translation: [0, 0, 0],
      pTranslation: [0, 0, 0],
      currentIndex: -1,
      ElIconArrowLeft: shallowRef(Wr),
      ElIconArrowRight: shallowRef(jr),
      edited: false,
      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: true,
      deep: true
    }
  },
  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 = Nz(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 = false);
    },
    setObject: function(n) {
      this.currentIndex = -1, n.isPointset ? (this.zincObject = markRaw(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 = false);
    },
    modifyAttenuation: function(n) {
      this.attenuation = n, this.zincObject.setSizeAttenuation(n);
    },
    modifySize: function() {
      this.zincObject.setSize(this.size);
    }
  }
};
function Wz(n, e, t, i, r, s) {
  const o = wi, a = si, c = vr, l = Vi, d = aa, h4 = oa, f = sa, g = gr, p = ki;
  return openBlock(), createBlock(p, { class: "pointset-container" }, {
    default: withCtx(() => [
      createVNode(g, { class: "slides-block" }, {
        default: withCtx(() => [
          createVNode(l, null, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[15] || (e[15] = [
                  createTextVNode(" Size: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(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": false,
                    onInput: e[1] || (e[1] = (u) => s.modifySize())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(c, {
                    modelValue: n.size,
                    "onUpdate:modelValue": e[2] || (e[2] = (u) => n.size = u),
                    step: 1,
                    min: 0,
                    max: 100,
                    controls: false,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          createVNode(l, null, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 16
              }, {
                default: withCtx(() => e[16] || (e[16] = [
                  createTextVNode(" Size attenuation: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 5
              }, {
                default: withCtx(() => [
                  createVNode(h4, {
                    teleported: false,
                    "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: withCtx(() => [
                      (openBlock(true), createElementBlock(Fragment, null, renderList(n.choices, (u) => (openBlock(), createBlock(d, {
                        key: u.value,
                        label: u.label,
                        value: u.value
                      }, null, 8, ["label", "value"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["model-value"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          n.currentIndex > -1 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 4
                }, {
                  default: withCtx(() => [
                    createVNode(f, {
                      size: "small",
                      disabled: n.currentIndex === 0,
                      icon: n.ElIconArrowLeft,
                      onClick: e[4] || (e[4] = (u) => s.changeIndex(false))
                    }, null, 8, ["disabled", "icon"])
                  ]),
                  _: 1
                }),
                createVNode(o, {
                  offset: 4,
                  span: 9
                }, {
                  default: withCtx(() => [
                    createTextVNode(" Editing Point " + toDisplayString(n.currentIndex + 1), 1)
                  ]),
                  _: 1
                }),
                createVNode(o, {
                  offset: 2,
                  span: 2
                }, {
                  default: withCtx(() => [
                    createVNode(f, {
                      size: "small",
                      icon: n.ElIconArrowRight,
                      onClick: e[5] || (e[5] = (u) => s.changeIndex(true))
                    }, null, 8, ["icon"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => e[17] || (e[17] = [
                    createTextVNode(" x: ")
                  ])),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: withCtx(() => [
                    createVNode(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": false,
                      onInput: e[7] || (e[7] = (u) => s.onMoveSliding()),
                      onChange: e[8] || (e[8] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => e[18] || (e[18] = [
                    createTextVNode(" y: ")
                  ])),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: withCtx(() => [
                    createVNode(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": false,
                      onInput: e[10] || (e[10] = (u) => s.onMoveSliding()),
                      onChange: e[11] || (e[11] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(l, null, {
              default: withCtx(() => [
                createVNode(o, {
                  offset: 0,
                  span: 6
                }, {
                  default: withCtx(() => e[19] || (e[19] = [
                    createTextVNode(" z: ")
                  ])),
                  _: 1
                }),
                createVNode(o, {
                  offset: 0,
                  span: 16
                }, {
                  default: withCtx(() => [
                    createVNode(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": false,
                      onInput: e[13] || (e[13] = (u) => s.onMoveSliding()),
                      onChange: e[14] || (e[14] = (u) => s.reset())
                    }, null, 8, ["modelValue", "min", "max"])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 64)) : createCommentVNode("", true)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
var Ow = xr(Hz, [["render", Wz], ["__scopeId", "data-v-d1de9c65"]]);
var jz = {
  name: "TextureSlidesControls",
  components: {
    Col: wi,
    Container: ki,
    Footer: Sy,
    Icon: Ot,
    InputNumber: vr,
    Main: gr,
    Row: Vi,
    Select: oa,
    Slider: si,
    Option: aa,
    ElIconDelete: Xc,
    ElIconPlus: fu
  },
  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 = markRaw(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 $z(n, e, t, i, r, s) {
  const o = aa, a = oa, c = wi, l = si, d = vr, h4 = Xc, f = Ot, g = Vi, p = gr, u = fu, y = Sy, v = ki;
  return openBlock(), createBlock(v, { class: "t-slides-container" }, {
    default: withCtx(() => [
      createVNode(p, { class: "slides-block" }, {
        default: withCtx(() => [
          (openBlock(true), createElementBlock(Fragment, null, renderList(n.settings, (m, x) => (openBlock(), createBlock(g, {
            key: m.id,
            class: "slide-row"
          }, {
            default: withCtx(() => [
              createVNode(c, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(a, {
                    teleported: false,
                    "model-value": m.direction,
                    placeholder: "Select",
                    class: "input-box",
                    "popper-class": "viewer_dropdown",
                    onChange: (M) => s.modifyDirection(M, m)
                  }, {
                    default: withCtx(() => [
                      (openBlock(true), createElementBlock(Fragment, null, renderList(n.directions, (M) => (openBlock(), createBlock(o, {
                        key: M.value,
                        label: M.label,
                        value: M.value
                      }, null, 8, ["label", "value"]))), 128))
                    ]),
                    _: 2
                  }, 1032, ["model-value", "onChange"])
                ]),
                _: 2
              }, 1024),
              createVNode(c, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(l, {
                    modelValue: m.value,
                    "onUpdate:modelValue": (M) => m.value = M,
                    class: "my-slider",
                    step: 0.01,
                    min: 0,
                    max: 1,
                    "show-tooltip": false,
                    onInput: (M) => s.modifySlide(m)
                  }, null, 8, ["modelValue", "onUpdate:modelValue", "onInput"])
                ]),
                _: 2
              }, 1024),
              createVNode(c, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(d, {
                    modelValue: m.value,
                    "onUpdate:modelValue": (M) => m.value = M,
                    step: 0.01,
                    min: 0,
                    max: 1,
                    controls: false,
                    class: "input-box number-input"
                  }, null, 8, ["modelValue", "onUpdate:modelValue"])
                ]),
                _: 2
              }, 1024),
              createVNode(c, {
                offset: 0,
                span: 2
              }, {
                default: withCtx(() => [
                  createVNode(f, {
                    class: "delete-icon",
                    onClick: (M) => s.removeSlide(x, m)
                  }, {
                    default: withCtx(() => [
                      createVNode(h4)
                    ]),
                    _: 2
                  }, 1032, ["onClick"])
                ]),
                _: 2
              }, 1024)
            ]),
            _: 2
          }, 1024))), 128))
        ]),
        _: 1
      }),
      createVNode(y, {
        height: "30px",
        class: "add-slides-text",
        onClick: s.addNewSlide
      }, {
        default: withCtx(() => [
          createVNode(g, null, {
            default: withCtx(() => [
              createVNode(c, { span: 2 }, {
                default: withCtx(() => [
                  createVNode(f, null, {
                    default: withCtx(() => [
                      createVNode(u)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              }),
              createVNode(c, { span: 20 }, {
                default: withCtx(() => e[0] || (e[0] = [
                  createTextVNode(" Add a new slide ")
                ])),
                _: 1
              })
            ]),
            _: 1
          })
        ]),
        _: 1
      }, 8, ["onClick"])
    ]),
    _: 1
  });
}
var Iw = xr(jz, [["render", $z], ["__scopeId", "data-v-12185b7f"]]);
var Zz = {
  name: "TransformationControls",
  components: {
    Col: wi,
    Container: ki,
    InputNumber: vr,
    Main: gr,
    Slider: si
  },
  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: true
    };
  },
  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: true,
      deep: true
    }
  },
  methods: {
    setObject: function(n) {
      if (n.isZincObject) {
        this.zincObject = markRaw(n);
        const e = this.zincObject.getGroup();
        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);
      } else
        this.zincObject = void 0, this.x = 0, this.y = 0, this.z = 0, this.scale = 1;
    },
    modifyPosition: function() {
      this.zincObject.setPosition(this.x, this.y, this.z);
    },
    modifyScale: function() {
      this.zincObject.setScaleAll(this.scale);
    }
  }
};
function Xz(n, e, t, i, r, s) {
  const o = wi, a = si, c = vr, l = Vi, d = gr, h4 = ki;
  return openBlock(), createBlock(h4, { class: "transformation-container" }, {
    default: withCtx(() => [
      createVNode(d, { class: "slides-block" }, {
        default: withCtx(() => [
          createVNode(l, { class: "tool-row" }, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[16] || (e[16] = [
                  createTextVNode(" x: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(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": false,
                    onInput: e[1] || (e[1] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(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: false,
                    class: "input-box number-input",
                    onChange: e[3] || (e[3] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          createVNode(l, { class: "tool-row" }, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[17] || (e[17] = [
                  createTextVNode(" y: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(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": false,
                    onInput: e[5] || (e[5] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(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: false,
                    class: "input-box number-input",
                    onChange: e[7] || (e[7] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          createVNode(l, { class: "tool-row" }, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[18] || (e[18] = [
                  createTextVNode(" z: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(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": false,
                    onInput: e[9] || (e[9] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(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: false,
                    class: "input-box number-input",
                    onChange: e[11] || (e[11] = (f) => s.modifyPosition())
                  }, null, 8, ["modelValue", "min", "max"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          n.enableScaling ? (openBlock(), createBlock(l, {
            key: 0,
            class: "tool-row"
          }, {
            default: withCtx(() => [
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => e[19] || (e[19] = [
                  createTextVNode(" Scale: ")
                ])),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 10
              }, {
                default: withCtx(() => [
                  createVNode(a, {
                    modelValue: n.scale,
                    "onUpdate:modelValue": e[12] || (e[12] = (f) => n.scale = f),
                    step: 0.01,
                    min: 0,
                    max: 5,
                    "show-tooltip": false,
                    onInput: e[13] || (e[13] = (f) => s.modifyScale())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              }),
              createVNode(o, {
                offset: 0,
                span: 6
              }, {
                default: withCtx(() => [
                  createVNode(c, {
                    modelValue: n.scale,
                    "onUpdate:modelValue": e[14] || (e[14] = (f) => n.scale = f),
                    step: 0.01,
                    min: 0,
                    max: 5,
                    controls: false,
                    class: "input-box number-input",
                    onChange: e[15] || (e[15] = (f) => s.modifyScale())
                  }, null, 8, ["modelValue"])
                ]),
                _: 1
              })
            ]),
            _: 1
          })) : createCommentVNode("", true)
        ]),
        _: 1
      })
    ]),
    _: 1
  });
}
var Dw = xr(Zz, [["render", Xz], ["__scopeId", "data-v-69c1b94a"]]);
var Yz = {
  name: "OpacityControls",
  components: {
    Container: ki,
    Header: ZL,
    Main: gr,
    Slider: si
  },
  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;
    }
  }
};
var Jz = { class: "block" };
var Kz = { class: "display" };
function qz(n, e, t, i, r, s) {
  const o = si, a = ki;
  return t.material ? (openBlock(), createBlock(a, {
    key: 0,
    class: "opacity-container"
  }, {
    default: withCtx(() => [
      createBaseVNode("div", Jz, [
        createBaseVNode("span", Kz, toDisplayString(n.displayString), 1),
        createVNode(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": false
        }, null, 8, ["modelValue", "format-tooltip"])
      ])
    ]),
    _: 1
  })) : createCommentVNode("", true);
}
var Nw = xr(Yz, [["render", qz], ["__scopeId", "data-v-cbfc46a5"]]);
var Qz = {
  name: "PrimitiveControls",
  components: {
    Collapse: yy,
    CollapseItem: by,
    LinesControls: Pw,
    OpacityControls: Nw,
    PointsControls: Ow,
    TextureSlidesControls: Iw,
    TransformationControls: Dw,
    ElIconArrowRight: jr
  },
  props: {
    createData: {
      type: Object
    }
  },
  data: function() {
    return {
      activeName: "oControls",
      material: void 0,
      isTextureSlides: false,
      isPointset: false,
      isLines: false,
      drawerOpen: true,
      zincObject: void 0,
      isEditable: false,
      displayString: "100%"
    };
  },
  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;
      n ? this.zincObject = markRaw(n) : this.zincObject = void 0, this.isEditable = !!((e = this.zincObject) != null && e.isEditable), this.isPointset = false, this.isTextureSlides = false, this.isLines = false, this.activeName = "trControls", n && (n.isTextureSlides ? (this.isTextureSlides = true, this.$refs.tSlidesControls.setObject(n), this.activeName = "tsControls") : n.isPointset ? (this.isPointset = true, this.$refs.pointsetControls.setObject(n), this.activeName = "pControls") : n.isLines2 && (this.isLines = true, 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 eU(n, e, t, i, r, s) {
  const o = Nw, a = by, c = Dw, l = Iw, d = Ow, h4 = Pw, f = yy, g = jr, p = Ot;
  return withDirectives((openBlock(), createElementBlock("div", {
    class: normalizeClass(["primitive-controls", { open: n.drawerOpen, close: !n.drawerOpen }])
  }, [
    createBaseVNode("div", {
      class: normalizeClass(["my-drawer", { open: n.drawerOpen, close: !n.drawerOpen }])
    }, [
      createVNode(f, {
        class: "collapse",
        modelValue: n.activeName,
        "onUpdate:modelValue": e[2] || (e[2] = (u) => n.activeName = u),
        accordion: ""
      }, {
        default: withCtx(() => [
          withDirectives(createVNode(a, {
            title: "Opacity",
            name: "oControls"
          }, {
            default: withCtx(() => [
              createVNode(o, {
                material: n.material,
                zincObject: n.zincObject,
                ref: "opacityControls"
              }, null, 8, ["material", "zincObject"])
            ]),
            _: 1
          }, 512), [
            [vShow, !n.isTextureSlides]
          ]),
          withDirectives(createVNode(a, {
            title: "Transformation",
            name: "trControls"
          }, {
            default: withCtx(() => [
              createVNode(c, {
                class: "transformation-controls",
                ref: "transformationControls"
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [vShow, !n.isEditable]
          ]),
          withDirectives(createVNode(a, {
            title: "Texture Slides",
            name: "tsControls"
          }, {
            default: withCtx(() => [
              createVNode(l, {
                class: "texture-controls",
                ref: "tSlidesControls"
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [vShow, n.isTextureSlides]
          ]),
          withDirectives(createVNode(a, {
            title: "Points",
            name: "pControls"
          }, {
            default: withCtx(() => [
              createVNode(d, {
                class: "pointset-controls",
                ref: "pointsetControls",
                onPrimitivesUpdated: e[0] || (e[0] = (u) => n.$emit("primitivesUpdated", u))
              }, null, 512)
            ]),
            _: 1
          }, 512), [
            [vShow, n.isPointset]
          ]),
          withDirectives(createVNode(a, {
            title: "Lines",
            name: "lControls"
          }, {
            default: withCtx(() => [
              createVNode(h4, {
                class: "lines-controls",
                ref: "linesControls",
                createData: t.createData,
                onPrimitivesUpdated: e[1] || (e[1] = (u) => n.$emit("primitivesUpdated", u))
              }, null, 8, ["createData"])
            ]),
            _: 1
          }, 512), [
            [vShow, n.isLines]
          ])
        ]),
        _: 1
      }, 8, ["modelValue"])
    ], 2),
    createBaseVNode("div", {
      class: normalizeClass(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]),
      onClick: e[3] || (e[3] = (...u) => s.toggleDrawer && s.toggleDrawer(...u))
    }, [
      createVNode(p, null, {
        default: withCtx(() => [
          createVNode(g)
        ]),
        _: 1
      })
    ], 2)
  ], 2)), [
    [vShow, n.material || n.isTextureSlides]
  ]);
}
var Bw = xr(Qz, [["render", eU], ["__scopeId", "data-v-d55fc9a4"]]);
var tU = (n, e) => {
  const t = n.label.toUpperCase(), i = e.label.toUpperCase();
  return t < i ? -1 : t > i ? 1 : 0;
};
var nU = {
  name: "ScaffoldTreeControls",
  components: {
    ElIconArrowLeft: Wr,
    TreeControls: kA
  },
  props: {
    /**
     * Enable/disable colour picker
     */
    showColourPicker: Boolean,
    isReady: Boolean
  },
  data: function() {
    return {
      treeData: [
        { label: "Root", regionPath: "", id: void 0, children: [] }
      ],
      active: [],
      hover: [],
      drawerOpen: true,
      nodeNumbers: 0,
      module: void 0
    };
  },
  computed: {
    treeDataEntry: function() {
      return this.treeData[0].children;
    }
  },
  watch: {
    treeDataEntry: {
      deep: true,
      handler: function(n) {
        this.isReady && this.setColourField(n);
      }
    }
  },
  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) => tU(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, true);
      }));
    },
    // 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 = true), 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: true
        }, this.addTreeItem(n.children, r, o), s === "/_helper" && this.$nextTick(() => {
          this.$refs.treeControls.$refs.regionTree.setChecked(r.id, false);
        })), i.shift(), this.findOrCreateRegion(r, i, s);
      } else
        return n;
    },
    /**
     * 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 = {
            label: n.groupName,
            id: e.uuid + "/" + n.uuid,
            isPrimitives: true,
            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, false).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) => {
        a.setVisibility(r);
      });
    },
    updateActiveUI: function(n) {
      this.active.length = 0, jv(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, jv(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 = Ao(
        i,
        n,
        e,
        true
      );
      this.changeActiveByPrimitives(r, t);
    },
    /**
     * Hover a region by its name.
     */
    changeHoverByNames: function(n, e, t) {
      const i = this.module.scene.getRootRegion(), r = Ao(
        i,
        n,
        e,
        true
      );
      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, false);
        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", []);
    },
    getColour: function(n) {
      if (n) {
        let t = this.getZincObjectsFromNode(n, false)[0];
        if (t) {
          let i = t.getColourHex();
          if (i) return "#" + i;
        }
      }
      return "#FFFFFF";
    },
    getZincObjectsFromNode: function(n, e) {
      const t = this.module.scene.getRootRegion();
      if (n.isPrimitives)
        return Ao(
          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 = markRaw(n), this.nodeNumbers = 0, this.module.scene.getRootRegion().getAllObjects(true).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 : true).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, false).forEach((i) => {
        let s = (e || n.defaultColour).replace("#", "0x");
        i.setColourHex(s), this.setColourField(this.treeData[0].children, n);
      });
    },
    visibilityToggle: function(n, e) {
      this.module.changeOrganPartsVisibility(n, e), e == false && (this.activeRegion === n && this.removeActive(true), this.hoverRegion === n && this.removeHover(true));
    },
    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 = false, s = "";
      n.isRegion && (s = `__r${n.regionPath}`), n.isPrimitives && (s = `${n.regionPath}/${n.label}`);
      const o = e.indexOf(s);
      o > -1 && (r = true, 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, true);
      });
    },
    checkAllKeys: function() {
      const n = [], e = [];
      Rw(this.treeData[0], n), this.setTreeVisibilityWithFullPaths(
        this.treeData[0],
        n,
        e,
        true
      ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e);
    },
    getState: function() {
      let n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys();
      return n.length === this.nodeNumbers ? { checkAll: true, version: "2.0" } : { checkedItems: Fz(
        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,
            true
          ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t);
        }
      }
    }
  }
};
var iU = { class: "traditional-container" };
function rU(n, e, t, i, r, s) {
  const o = resolveComponent("TreeControls"), a = Wr, c = Ot;
  return openBlock(), createElementBlock("div", {
    class: normalizeClass(["tree-controls", { open: n.drawerOpen, close: !n.drawerOpen }])
  }, [
    createBaseVNode("div", iU, [
      createVNode(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"
      }, null, 8, ["isReady", "treeData", "active", "hover", "showColourPicker", "onSetColour", "onCheckChanged", "onChangeActive", "onChangeHover"])
    ]),
    createBaseVNode("div", {
      class: normalizeClass(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]),
      onClick: e[0] || (e[0] = (...l) => s.toggleDrawer && s.toggleDrawer(...l))
    }, [
      createVNode(c, null, {
        default: withCtx(() => [
          createVNode(a)
        ]),
        _: 1
      })
    ], 2)
  ], 2);
}
var Fw = xr(nU, [["render", rU], ["__scopeId", "data-v-13a8c030"]]);
var sU = false;
function Oc(n, e, t) {
  return Array.isArray(n) ? (n.length = Math.max(n.length, e), n.splice(e, 1, t), t) : (n[e] = t, t);
}
function $h(n, e) {
  if (Array.isArray(n)) {
    n.splice(e, 1);
    return;
  }
  delete n[e];
}
var Na;
var ru = (n) => Na = n;
var oU = true ? Symbol("pinia") : (
  /* istanbul ignore next */
  Symbol()
);
function Us(n) {
  return n && typeof n == "object" && Object.prototype.toString.call(n) === "[object Object]" && typeof n.toJSON != "function";
}
var Wa;
(function(n) {
  n.direct = "direct", n.patchObject = "patch object", n.patchFunction = "patch function";
})(Wa || (Wa = {}));
var Ba = typeof window < "u";
function zw(n, e) {
  for (const t in e) {
    const i = e[t];
    if (!(t in n))
      continue;
    const r = n[t];
    Us(r) && Us(i) && !isRef(i) && !isReactive(i) ? n[t] = zw(r, i) : n[t] = i;
  }
  return n;
}
var Uw = () => {
};
function Yv(n, e, t, i = Uw) {
  n.push(e);
  const r = () => {
    const s = n.indexOf(e);
    s > -1 && (n.splice(s, 1), i());
  };
  return !t && getCurrentScope() && onScopeDispose(r), r;
}
function vo(n, ...e) {
  n.slice().forEach((t) => {
    t(...e);
  });
}
var aU = (n) => n();
var Jv = Symbol();
var Zh = Symbol();
function Kd(n, e) {
  n instanceof Map && e instanceof Map ? e.forEach((t, i) => n.set(i, t)) : n instanceof Set && e instanceof Set && e.forEach(n.add, n);
  for (const t in e) {
    if (!e.hasOwnProperty(t))
      continue;
    const i = e[t], r = n[t];
    Us(r) && Us(i) && n.hasOwnProperty(t) && !isRef(i) && !isReactive(i) ? n[t] = Kd(r, i) : n[t] = i;
  }
  return n;
}
var lU = true ? Symbol("pinia:skipHydration") : (
  /* istanbul ignore next */
  Symbol()
);
function cU(n) {
  return !Us(n) || !n.hasOwnProperty(lU);
}
var { assign: qn } = Object;
function Kv(n) {
  return !!(isRef(n) && n.effect);
}
function qv(n, e, t, i) {
  const { state: r, actions: s, getters: o } = e, a = t.state.value[n];
  let c;
  function l() {
    !a && !i && (t.state.value[n] = r ? r() : {});
    const d = i ? (
      // use ref() to unwrap refs inside state TODO: check if this is still necessary
      toRefs(ref(r ? r() : {}).value)
    ) : toRefs(t.state.value[n]);
    return qn(d, s, Object.keys(o || {}).reduce((h4, f) => (f in d && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${f}" in store "${n}".`), h4[f] = markRaw(computed(() => {
      ru(t);
      const g = t._s.get(n);
      return o[f].call(g, g);
    })), h4), {}));
  }
  return c = qd(n, l, e, t, i, true), c;
}
function qd(n, e, t = {}, i, r, s) {
  let o;
  const a = qn({ actions: {} }, t);
  if (!i._e.active)
    throw new Error("Pinia destroyed");
  const c = { deep: true };
  !sU && (c.onTrigger = (S) => {
    l ? g = S : l == false && !_._hotUpdating && (Array.isArray(g) ? g.push(S) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
  });
  let l, d, h4 = [], f = [], g;
  const p = i.state.value[n];
  !s && !p && !r && (i.state.value[n] = {});
  const u = ref({});
  let y;
  function v(S) {
    let R;
    l = d = false, g = [], typeof S == "function" ? (S(i.state.value[n]), R = {
      type: Wa.patchFunction,
      storeId: n,
      events: g
    }) : (Kd(i.state.value[n], S), R = {
      type: Wa.patchObject,
      payload: S,
      storeId: n,
      events: g
    });
    const A = y = Symbol();
    nextTick().then(() => {
      y === A && (l = true);
    }), d = true, vo(h4, R, i.state.value[n]);
  }
  const m = s ? function() {
    const { state: R } = t, A = R ? R() : {};
    this.$patch((C) => {
      qn(C, A);
    });
  } : (
    /* istanbul ignore next */
    true ? () => {
      throw new Error(`🍍: Store "${n}" is built using the setup syntax and does not implement $reset().`);
    } : Uw
  );
  function x() {
    o.stop(), h4 = [], f = [], i._s.delete(n);
  }
  const M = (S, R = "") => {
    if (Jv in S)
      return S[Zh] = R, S;
    const A = function() {
      ru(i);
      const C = Array.from(arguments), L = [], I = [];
      function b(D) {
        L.push(D);
      }
      function O(D) {
        I.push(D);
      }
      vo(f, {
        args: C,
        name: A[Zh],
        store: _,
        after: b,
        onError: O
      });
      let N;
      try {
        N = S.apply(this && this.$id === n ? this : _, C);
      } catch (D) {
        throw vo(I, D), D;
      }
      return N instanceof Promise ? N.then((D) => (vo(L, D), D)).catch((D) => (vo(I, D), Promise.reject(D))) : (vo(L, N), N);
    };
    return A[Jv] = true, A[Zh] = R, A;
  }, T = markRaw({
    actions: {},
    getters: {},
    state: [],
    hotState: u
  }), w = {
    _p: i,
    // _s: scope,
    $id: n,
    $onAction: Yv.bind(null, f),
    $patch: v,
    $reset: m,
    $subscribe(S, R = {}) {
      const A = Yv(h4, S, R.detached, () => C()), C = o.run(() => watch(() => i.state.value[n], (L) => {
        (R.flush === "sync" ? d : l) && S({
          storeId: n,
          type: Wa.direct,
          events: g
        }, L);
      }, qn({}, c, R)));
      return A;
    },
    $dispose: x
  }, _ = reactive(true ? qn(
    {
      _hmrPayload: T,
      _customProperties: markRaw(/* @__PURE__ */ new Set())
      // devtools custom properties
    },
    w
    // must be added later
    // setupStore
  ) : w);
  i._s.set(n, _);
  const P = (i._a && i._a.runWithContext || aU)(() => i._e.run(() => (o = effectScope()).run(() => e({ action: M }))));
  for (const S in P) {
    const R = P[S];
    if (isRef(R) && !Kv(R) || isReactive(R))
      r ? Oc(u.value, S, toRef(P, S)) : s || (p && cU(R) && (isRef(R) ? R.value = p[S] : Kd(R, p[S])), i.state.value[n][S] = R), T.state.push(S);
    else if (typeof R == "function") {
      const A = r ? R : M(R, S);
      P[S] = A, T.actions[S] = R, a.actions[S] = R;
    } else Kv(R) && (T.getters[S] = s ? (
      // @ts-expect-error
      t.getters[S]
    ) : R, Ba && (P._getters || // @ts-expect-error: same
    (P._getters = markRaw([]))).push(S));
  }
  if (qn(_, P), qn(toRaw(_), P), Object.defineProperty(_, "$state", {
    get: () => r ? u.value : i.state.value[n],
    set: (S) => {
      if (r)
        throw new Error("cannot set hotState");
      v((R) => {
        qn(R, S);
      });
    }
  }), _._hotUpdate = markRaw((S) => {
    _._hotUpdating = true, S._hmrPayload.state.forEach((R) => {
      if (R in _.$state) {
        const A = S.$state[R], C = _.$state[R];
        typeof A == "object" && Us(A) && Us(C) ? zw(A, C) : S.$state[R] = C;
      }
      Oc(_, R, toRef(S.$state, R));
    }), Object.keys(_.$state).forEach((R) => {
      R in S.$state || $h(_, R);
    }), l = false, d = false, i.state.value[n] = toRef(S._hmrPayload, "hotState"), d = true, nextTick().then(() => {
      l = true;
    });
    for (const R in S._hmrPayload.actions) {
      const A = S[R];
      Oc(_, R, M(A, R));
    }
    for (const R in S._hmrPayload.getters) {
      const A = S._hmrPayload.getters[R], C = s ? (
        // special handling of options api
        computed(() => (ru(i), A.call(_, _)))
      ) : A;
      Oc(_, R, C);
    }
    Object.keys(_._hmrPayload.getters).forEach((R) => {
      R in S._hmrPayload.getters || $h(_, R);
    }), Object.keys(_._hmrPayload.actions).forEach((R) => {
      R in S._hmrPayload.actions || $h(_, R);
    }), _._hmrPayload = S._hmrPayload, _._getters = S._getters, _._hotUpdating = false;
  }), Ba) {
    const S = {
      writable: true,
      configurable: true,
      // avoid warning on devtools trying to display this property
      enumerable: false
    };
    ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((R) => {
      Object.defineProperty(_, R, qn({ value: _[R] }, S));
    });
  }
  return i._p.forEach((S) => {
    if (Ba) {
      const R = o.run(() => S({
        store: _,
        app: i._a,
        pinia: i,
        options: a
      }));
      Object.keys(R || {}).forEach((A) => _._customProperties.add(A)), qn(_, R);
    } else
      qn(_, o.run(() => S({
        store: _,
        app: i._a,
        pinia: i,
        options: a
      })));
  }), _.$state && typeof _.$state == "object" && typeof _.$state.constructor == "function" && !_.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
	state: () => new MyClass()
Found in store "${_.$id}".`), p && s && t.hydrate && t.hydrate(_.$state, p), l = true, d = true, _;
}
function uU(n, e, t) {
  let i, r;
  const s = typeof e == "function";
  i = n, r = s ? t : e;
  function o(a, c) {
    const l = hasInjectionContext();
    if (a = // in test mode, ignore the argument provided as we can always retrieve a
    // pinia instance with getActivePinia()
    (false ? null : a) || (l ? inject(oU, null) : null), a && ru(a), !Na)
      throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
This will fail in production.`);
    a = Na, a._s.has(i) || (s ? qd(i, e, r, a) : qv(i, r, a), o._pinia = a);
    const d = a._s.get(i);
    if (c) {
      const h4 = "__hot:" + i, f = s ? qd(h4, e, r, a, true) : qv(h4, qn({}, r), a, true);
      c._hotUpdate(f), delete a.state.value[h4], a._s.delete(h4);
    }
    if (Ba) {
      const h4 = getCurrentInstance();
      if (h4 && h4.proxy && // avoid adding stores that are just built for hot module replacement
      !c) {
        const f = h4.proxy, g = "_pStores" in f ? f._pStores : f._pStores = {};
        g[i] = d;
      }
    }
    return d;
  }
  return o.$id = i, o;
}
function Vw(n, e) {
  return Array.isArray(e) ? e.reduce((t, i) => (t[i] = function() {
    return n(this.$pinia)[i];
  }, t), {}) : Object.keys(e).reduce((t, i) => (t[i] = function() {
    const r = n(this.$pinia), s = e[i];
    return typeof s == "function" ? s.call(this, r) : r[s];
  }, t), {});
}
var kw = uU("main", {
  state: () => ({
    userProfile: {
      token: ""
    }
  }),
  getters: {
    userToken(n) {
      return n.userProfile.token;
    }
  },
  actions: {
    setUserToken(n) {
      this.userProfile.token = n;
    }
  }
});
var hU = {
  name: "ScaffoldTooltip",
  components: {
    Col: wi,
    CreateTooltipContent: yA,
    ElIconDelete: Xc,
    Icon: Ot,
    Popover: Mu,
    Row: Vi,
    Tooltip: EA
  },
  props: {
    createData: {
      type: Object,
      default: {
        toBeConfirmed: false,
        points: [],
        shape: "",
        x: 0,
        y: 0
      }
    },
    label: {
      type: String,
      default: ""
    },
    annotationDisplay: {
      type: Boolean,
      default: false
    },
    region: {
      type: String,
      default: ""
    },
    visible: {
      type: Boolean,
      default: false
    },
    x: {
      type: Number,
      default: 200
    },
    y: {
      type: Number,
      default: 200
    }
  },
  inject: ["scaffoldUrl"],
  provide() {
    return {
      userApiKey: this.userToken
    };
  },
  data: function() {
    return {
      display: false,
      annotationEntry: {},
      ElIconDelete: shallowRef(Xc)
    };
  },
  computed: {
    ...Vw(kw, ["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 = true, this.annotationDisplay) {
          const n = this.region ? this.region + "/" : "";
          this.annotationEntry = {
            featureId: n + this.label,
            resourceId: this.scaffoldUrl,
            resource: this.scaffoldUrl
          };
        }
      } else
        this.display = false, this.annotationEntry = {};
    },
    hideTriggered: function() {
      this.$emit("tooltip-hide");
    }
  },
  watch: {
    label: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: true
    },
    visible: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: true
    },
    annotationDisplay: {
      handler: function() {
        this.checkForDisplay();
      },
      immediate: true
    }
  }
};
var dU = { class: "tooltip-text" };
var fU = {
  key: 0,
  class: "tooltip-text"
};
var pU = {
  key: 1,
  class: "delete-container"
};
function mU(n, e, t, i, r, s) {
  const o = resolveComponent("CreateTooltipContent"), a = resolveComponent("Tooltip"), c = wi, l = sa, d = Vi, h4 = Mu;
  return openBlock(), createElementBlock("div", {
    style: normalizeStyle(s.position),
    class: "region-tooltip"
  }, [
    createVNode(h4, {
      ref: "tooltip",
      visible: t.visible,
      placement: "top",
      "show-arrow": false,
      teleported: false,
      trigger: "manual",
      "popper-class": "tooltip-popper non-selectable",
      "virtual-triggering": "",
      onHide: s.hideTriggered
    }, {
      default: withCtx(() => [
        createBaseVNode("div", dU, toDisplayString(t.label), 1),
        t.region ? (openBlock(), createElementBlock("div", fU, "Region: " + toDisplayString(t.region), 1)) : createCommentVNode("", true),
        withDirectives(createVNode(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"]), [
          [vShow, t.createData.toBeConfirmed]
        ]),
        withDirectives(createVNode(a, {
          class: "p-tooltip",
          ref: "annotationTooltip",
          annotationDisplay: true,
          annotationEntry: n.annotationEntry
        }, null, 8, ["annotationEntry"]), [
          [vShow, t.annotationDisplay && !t.createData.toBeConfirmed]
        ]),
        t.createData.toBeDeleted ? (openBlock(), createElementBlock("div", pU, [
          createVNode(d, null, {
            default: withCtx(() => [
              createVNode(c, { span: 10 }, {
                default: withCtx(() => e[4] || (e[4] = [
                  createTextVNode("Delete this feature?")
                ])),
                _: 1
              }),
              createVNode(c, { span: 7 }, {
                default: withCtx(() => [
                  createVNode(l, {
                    class: "delete-button",
                    icon: n.ElIconDelete,
                    onClick: e[2] || (e[2] = (f) => n.$emit("confirm-delete"))
                  }, {
                    default: withCtx(() => e[5] || (e[5] = [
                      createTextVNode(" Delete ")
                    ])),
                    _: 1
                  }, 8, ["icon"])
                ]),
                _: 1
              }),
              createVNode(c, { span: 6 }, {
                default: withCtx(() => [
                  createVNode(l, {
                    class: "delete-button",
                    onClick: e[3] || (e[3] = (f) => n.$emit("cancel-create"))
                  }, {
                    default: withCtx(() => e[6] || (e[6] = [
                      createTextVNode(" Dismiss ")
                    ])),
                    _: 1
                  })
                ]),
                _: 1
              })
            ]),
            _: 1
          })
        ])) : createCommentVNode("", true)
      ]),
      _: 1
    }, 8, ["visible", "onHide"])
  ], 4);
}
var Gw = xr(hU, [["render", mU], ["__scopeId", "data-v-e665391a"]]);
function Ic(n) {
  for (var e = 1; e < arguments.length; e++) {
    var t = arguments[e];
    for (var i in t)
      n[i] = t[i];
  }
  return n;
}
var gU = {
  read: function(n) {
    return n[0] === '"' && (n = n.slice(1, -1)), n.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
  },
  write: function(n) {
    return encodeURIComponent(n).replace(
      /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
      decodeURIComponent
    );
  }
};
function Qd(n, e) {
  function t(r, s, o) {
    if (!(typeof document > "u")) {
      o = Ic({}, e, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
      var a = "";
      for (var c in o)
        o[c] && (a += "; " + c, o[c] !== true && (a += "=" + o[c].split(";")[0]));
      return document.cookie = r + "=" + n.write(s, r) + a;
    }
  }
  function i(r) {
    if (!(typeof document > "u" || arguments.length && !r)) {
      for (var s = document.cookie ? document.cookie.split("; ") : [], o = {}, a = 0; a < s.length; a++) {
        var c = s[a].split("="), l = c.slice(1).join("=");
        try {
          var d = decodeURIComponent(c[0]);
          if (o[d] = n.read(l, d), r === d)
            break;
        } catch {
        }
      }
      return r ? o[r] : o;
    }
  }
  return Object.create(
    {
      set: t,
      get: i,
      remove: function(r, s) {
        t(
          r,
          "",
          Ic({}, s, {
            expires: -1
          })
        );
      },
      withAttributes: function(r) {
        return Qd(this.converter, Ic({}, this.attributes, r));
      },
      withConverter: function(r) {
        return Qd(Ic({}, this.converter, r), this.attributes);
      }
    },
    {
      attributes: { value: Object.freeze(e) },
      converter: { value: Object.freeze(n) }
    }
  );
}
var ef = Qd(gU, { path: "/" });
var _i = function(n, e, t, i, r) {
  if (i === "m") throw new TypeError("Private method is not writable");
  if (i === "a" && !r) throw new TypeError("Private accessor was defined without a setter");
  if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return i === "a" ? r.call(n, t) : r ? r.value = t : e.set(n, t), t;
};
var Ft = function(n, e, t, i) {
  if (t === "a" && !i) throw new TypeError("Private accessor was defined without a getter");
  if (typeof e == "function" ? n !== e || !i : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return t === "m" ? i : t === "a" ? i.call(n) : i ? i.value : e.get(n);
};
var Ki;
var ja;
var Si;
var _n;
var Ir;
var vU = 1e4;
var yU = class {
  /**
   * @param  serverEndpoint  The URL of a map annotation service.
   */
  constructor(e) {
    Ki.add(this), ja.set(this, void 0), Si.set(this, null), _n.set(
      this,
      null
      /**
       * @param  serverEndpoint  The URL of a map annotation service.
       */
    ), e.slice(-1) === "/" ? _i(this, ja, e.slice(0, -1), "f") : _i(this, ja, e, "f");
  }
  /**
   * Get information about the logged-in SPARC user.
   *
   * Requires {@linkcode authenticate} to first be called.
   */
  get currentUser() {
    return Ft(this, Si, "f");
  }
  /**
   * Get information about any error from the last call
   * to {@linkcode authenticate}.
   */
  get currentError() {
    return Ft(this, _n, "f");
  }
  /**
   * Authenticate the logged-in SPARC user.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @return  A Promise resolving to either data about a valid user
   *          or a reason why the user is invalid.
   */
  async authenticate(e) {
    _i(this, _n, null, "f"), _i(this, Si, null, "f");
    const t = await Ft(this, Ki, "m", Ir).call(this, e, "authenticate");
    return "error" in t ? (ef.remove("annotation-key"), Promise.resolve(Ft(this, _n, "f"))) : (ef.set("annotation-key", t.session, { secure: true, expires: 1 }), _i(this, Si, t.data, "f"), Promise.resolve(Ft(this, Si, "f")));
  }
  /**
   * Unauthenticate with the annotation service.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @return A Promise with data about the call.
   */
  async unauthenticate(e) {
    _i(this, _n, null, "f"), _i(this, Si, null, "f");
    const t = await Ft(this, Ki, "m", Ir).call(this, e, "unauthenticate");
    return "success" in t ? Promise.resolve(t) : Promise.resolve(Ft(this, _n, "f"));
  }
  /**
   * Get identifiers of all annotated items in a resource.
   *
   * @param  userApiKey    The Api token of the logged-in Pennsieve user
   * @param  resourceId    The resource's identifier
   * @param  userId        A user identifier (ORCID). Optional
   * @param  participated  Get items the user was involved in annotating or not.
   *                       Optional, default ``true``
   * @return A Promise resolving to either a list of identifiers of annotated
   *         items or a reason why identifiers couldn't be retrieved.
   */
  async annotatedItemIds(e, t, i, r) {
    const s = {
      resource: t
    };
    i !== void 0 && (s.user = i), r !== void 0 && (s.participated = r);
    const o = await Ft(this, Ki, "m", Ir).call(this, e, "items/", "GET", s);
    return "error" in o ? Promise.resolve(Ft(this, _n, "f")) : Promise.resolve(o);
  }
  /**
   * Get all annotated features drawn on a resource.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @param  resourceId  The resource's identifier
   * @return             A Promise resolving to either a list of annotated
   *                     features drawn on the resource or a reason why
   *                     features couldn't be retrieved.
   */
  async drawnFeatures(e, t, i) {
    const r = {
      resource: t
    };
    i !== void 0 && (r.items = i);
    const s = await Ft(this, Ki, "m", Ir).call(this, e, "features/", "GET", r);
    return "error" in s ? Promise.resolve(Ft(this, _n, "f")) : Promise.resolve(s);
  }
  /**
   * Get all annotations about a specific item in a resource.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @param  resourceId  The resource's identifier
   * @param  itemId      The item's identifier within the resource
   * @return             A Promise resolving to either a list of
   *                     annotations about the item or a reason
   *                     why annotations couldn't be retrieved.
   */
  async itemAnnotations(e, t, i) {
    const r = await Ft(this, Ki, "m", Ir).call(this, e, "annotations/", "GET", {
      resource: t,
      item: i
    });
    return "error" in r ? Promise.resolve(Ft(this, _n, "f")) : Promise.resolve(r);
  }
  /**
   * Get details of a specific annotation.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @param  annotationId  The annotation's URI
   * @return               A Promise resolving to either an annotation
   *                       with the given URI or a reason why the
   *                       annotation couldn't be retrieved.
   */
  async annotation(e, t) {
    const i = await Ft(this, Ki, "m", Ir).call(this, e, "annotation/", "GET", {
      annotation: t
    });
    return "error" in i ? Promise.resolve(Ft(this, _n, "f")) : Promise.resolve(i);
  }
  /**
   * Add an annotation about a specific item in a resource.
   *
   * @param  userApiKey  The Api token of the logged-in Pennsieve user
   * @param   annotation  Annotation about the feature
   * @return              A Promise resolving to either the resulting
   *                      full annotation or a reason why the
   *                      annotation couldn't be added
   */
  async addAnnotation(e, t) {
    if (Ft(this, Si, "f") && Ft(this, Si, "f").canUpdate) {
      const i = Object.assign({
        creator: Ft(this, Si, "f"),
        created: (/* @__PURE__ */ new Date()).toISOString()
      }, t), r = await Ft(this, Ki, "m", Ir).call(this, e, "annotation/", "POST", {
        data: i
      });
      if (!("error" in r))
        return Promise.resolve(r);
      _i(this, _n, r, "f");
    } else
      _i(this, _n, { error: "user cannot add annotation" }, "f");
    return Promise.resolve(Ft(this, _n, "f"));
  }
};
ja = /* @__PURE__ */ new WeakMap(), Si = /* @__PURE__ */ new WeakMap(), _n = /* @__PURE__ */ new WeakMap(), Ki = /* @__PURE__ */ new WeakSet(), Ir = async function(e, t, i = "GET", r = {}) {
  let s = true;
  const o = new AbortController();
  setTimeout(() => {
    s && (console.log("Annotation server timeout..."), o.abort());
  }, vU);
  const a = {
    method: i,
    signal: o.signal
  };
  let c = `${Ft(this, ja, "f")}/${t}`;
  const l = ef.get("annotation-key") || "";
  if (i === "GET") {
    const h4 = [];
    for (const [f, g] of Object.entries(r))
      h4.push(`${f}=${encodeURIComponent(JSON.stringify(g))}`);
    h4.push(`key=${encodeURIComponent(e)}`), h4.push(`session=${encodeURIComponent(l)}`), c += "?" + h4.join("&"), a.headers = {
      Accept: "application/json; charset=utf-8",
      "Cache-Control": "no-store"
    };
  } else if (i === "POST") {
    const h4 = Object.assign({
      key: e,
      session: l
    }, r);
    a.body = JSON.stringify(h4), a.headers = {
      Accept: "application/json; charset=utf-8",
      "Content-Type": "application/json; charset=utf-8",
      "Cache-Control": "no-store"
    };
  }
  const d = await fetch(c, a);
  return s = false, d.ok ? Promise.resolve(await d.json()) : (_i(this, _n, { error: `${d.status} ${d.statusText}` }, "f"), Promise.resolve(Ft(this, _n, "f")));
};
var ul = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 };
var bU = function(n, e, t) {
  this.eventType = n, this.identifiers = e, this.zincObjects = t;
};
var xU = function(n, e, t) {
  this.targetedID = [];
  const i = n, r = e;
  this.targetEventType = t;
  const s = this;
  t === void 0 && (this.targetEventType = ul.ALL), this.getEventType = function() {
    return t;
  }, this.notify = function(o, a, c, l) {
    if (o !== i && (s.targetEventType === ul.ALL || s.targetEventType === a)) {
      const d = new bU(a, c, l);
      r(d);
    }
  };
};
var wU = 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 xU(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;
      }
  };
};
var Qv = {
  isWebGLAvailable: function() {
    try {
      var n = document.createElement("canvas");
      return !!(window.WebGLRenderingContext && (n.getContext("webgl") || n.getContext("experimental-webgl")));
    } catch {
      return false;
    }
  },
  isWebGL2Available: function() {
    try {
      var n = document.createElement("canvas");
      return !!(window.WebGL2RenderingContext && n.getContext("webgl2"));
    } catch {
      return false;
    }
  },
  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;
  }
};
var Fp = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 };
var Jn = function() {
  this.typeName = "Base Module", this.instanceName = "default", this.onChangedCallbacks = [], this.eventNotifiers = [];
};
Jn.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, Fp.NAME_CHANGED);
  }
};
Jn.prototype.settingsChanged = function() {
  const n = this.onChangedCallbacks.slice();
  for (let e = 0; e < n.length; e++)
    n[e](this, Fp.SETTINGS_CHANGED);
};
Jn.prototype.exportSettings = function() {
  const n = {};
  return n.dialog = this.typeName, n.name = this.instanceName, n;
};
Jn.prototype.importSettings = function(n) {
  return n.dialog == this.typeName ? (this.setName(n.name), true) : false;
};
Jn.prototype.publishChanges = function(n, e, t) {
  for (let i = 0; i < this.eventNotifiers.length; i++)
    this.eventNotifiers[i].publish(this, e, n, t);
};
Jn.prototype.getName = function() {
  return this.instanceName;
};
Jn.prototype.destroy = function() {
  const n = this.onChangedCallbacks.slice();
  for (let e = 0; e < n.length; e++)
    n[e](this, Fp.DESTROYED);
  delete this;
};
Jn.prototype.addChangedCallback = function(n) {
  this.onChangedCallbacks.includes(n) == false && this.onChangedCallbacks.push(n);
};
Jn.prototype.removeChangedCallback = function(n) {
  const e = this.onChangedCallbacks.indexOf(n);
  e > -1 && this.onChangedCallbacks.splice(e, 1);
};
Jn.prototype.addNotifier = function(n) {
  this.eventNotifiers.push(n);
};
var Dc = (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 = zr.THREE.LessEqualDepth), n[i].children.forEach((s) => {
        const o = s.userData;
        o && o.isZincObject && s.material && s.material.emissive && s.material.emissive.setRGB(...e);
      });
    }
};
var MU = 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 false;
    for (let d = 0; d < c.length; d++) {
      let h4 = false;
      for (let f = 0; f < l.length; f++)
        c[d] === l[f] && (h4 = true);
      if (!h4)
        return true;
    }
    for (let d = 0; d < l.length; d++) {
      let h4 = false;
      for (let f = 0; f < c.length; f++)
        l[d] === c[f] && (h4 = true);
      if (!h4)
        return true;
    }
    return false;
  }, o = function(c, l) {
    if (t.length = 0, l.length == 0)
      return c;
    for (let d = 0; d < c.length; d++) {
      let h4 = false;
      for (let f = 0; f < l.length; f++)
        c[d] === l[f] && (h4 = true);
      h4 || t.push(c[d]);
    }
    return t;
  };
  this.setHighlighted = function(c) {
    const l = [...n];
    r.resetHighlighted();
    const d = o(c, e), h4 = a(d);
    return Dc(h4, r.highlightColour, false), n = d, s(n, l);
  }, this.setSelected = function(c) {
    const l = [...e];
    r.resetHighlighted(), r.resetSelected();
    const d = a(c);
    return Dc(d, r.selectColour, false), 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.resetHighlighted = function() {
    const c = a(n);
    Dc(c, r.originalColour, true), n = [];
  }, this.resetSelected = function() {
    const c = a(e);
    Dc(c, r.originalColour, true), e = [];
  }, this.getSelected = function() {
    return e;
  }, this.reset = function() {
    r.resetSelected(), r.resetHighlighted();
  };
};
var zp = Gc.THREE;
var _U = function() {
  const n = document.createElement("div");
  let e;
  if (n.style.height = "100%", Qv.isWebGLAvailable())
    e = new Gc.Renderer(n, window), Gc.defaultMaterialColor = 16777116, e.initialiseVisualisation(), e.playAnimation = false;
  else {
    const t = Qv.getWebGLErrorMessage();
    n.appendChild(t);
  }
  return { Zinc: Gc, renderer: e, container: n };
};
var Vt = function() {
  Jn.call(this), this.scene = void 0, this.rendererContainer = void 0, this.displayArea = void 0, this.graphicsHighlight = new MU(), this.selectObjectOnPick = true, this.zincRenderer = null, this.selectedScreenCoordinates = new zp.Vector3(), this.selectedCenter = void 0, this.liveUpdatesObjects = void 0, this.ignorePreviousSelected = false;
};
Vt.prototype = Object.create(Jn.prototype);
Vt.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];
  }
};
Vt.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.zincObject = i);
    }
    r && e.push(r);
  }
  return e;
};
Vt.prototype.setHighlightedByObjects = function(n, e, t, i) {
  const r = this.graphicsHighlight.setHighlighted(n), s = this.objectsToZincObjects(n);
  if (i) {
    let o = ul.MOVE;
    r && (o = ul.HIGHLIGHTED);
    const a = this.getAnnotationsFromObjects(n);
    a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s);
  }
  return r;
};
Vt.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);
};
Vt.prototype.setupLiveCoordinates = function(n) {
  if (this.liveUpdatesObjects = n, n && n.length > 0) {
    const e = this.scene.getBoundingBoxOfZincObjects(n);
    let t = new zp.Vector3();
    e ? (e.getCenter(t), this.selectedCenter == null ? this.selectedCenter = t : this.selectedCenter.copy(t)) : this.selectedCenter = void 0;
  } else
    this.selectedCenter = void 0;
};
Vt.prototype.objectsToZincObjects = 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;
};
Vt.prototype.setSelectedByObjects = function(n, e, t, i) {
  let r = false;
  if (this.selectObjectOnPick ? r = this.graphicsHighlight.setSelected(n) : r = true, r || this.ignorePreviousSelected) {
    const s = this.objectsToZincObjects(n);
    if (this.selectObjectOnPick && this.setupLiveCoordinates(s), i) {
      const o = ul.SELECTED, a = this.getAnnotationsFromObjects(n);
      a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s);
    }
  }
  return r;
};
Vt.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);
};
Vt.prototype.findObjectsByGroupName = function(n) {
  return this.scene.findObjectsWithGroupName(n);
};
Vt.prototype.setHighlightedByGroupName = function(n, e) {
  const t = this.findObjectsByGroupName(n);
  return this.setHighlightedByObjects(t, void 0, {}, e);
};
Vt.prototype.setSelectedByGroupName = function(n, e) {
  const t = this.findObjectsByGroupName(n);
  return this.setSelectedByObjects(t, void 0, {}, e);
};
Vt.prototype.changeBackgroundColour = function(n) {
  const e = new zp.Color(n);
  this.zincRenderer && this.zincRenderer.getThreeJSRenderer().setClearColor(e, 1);
};
Vt.prototype.resetView = function() {
  this.zincRenderer && this.zincRenderer.resetView();
};
Vt.prototype.viewAll = function() {
  this.zincRenderer && this.zincRenderer.viewAll();
};
Vt.prototype.playAnimation = function(n) {
  this.zincRenderer && (this.zincRenderer.playAnimation = n);
};
Vt.prototype.setPlayRate = function(n) {
  this.zincRenderer && this.zincRenderer.setPlayRate(n);
};
Vt.prototype.getPlayRate = function(n) {
  return this.zincRenderer ? this.zincRenderer.getPlayRate() : 0;
};
Vt.prototype.initialiseRenderer = function(n) {
  if (this.zincRenderer === void 0 || this.rendererContainer === void 0) {
    let e = _U();
    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());
};
Vt.prototype.destroy = function() {
  this.zincRenderer && (this.zincRenderer.dispose(), this.zincRenderer.getThreeJSRenderer().dispose(), this.zincRenderer = void 0), Jn.prototype.destroy.call(this);
};
var SU = function() {
  this.type = "anatomical", this.data = void 0, this.isAnnotation = true;
};
var TU = function() {
  this.currentName = "", this.currentSystem = "", this.currentPart = "", this.currentSpecies = "", this.metaURL = "", this.viewURL = "", this.timeVarying = false, this.currentTime = 0;
};
var Hw = function(n) {
  Vt.call(this);
  const e = this;
  let t;
  this.sceneData = new TU();
  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", this.getSceneData = function() {
    return e.sceneData;
  }, this.updateTime = function(S) {
    let R = 6e3;
    e.scene && (R = e.scene.getDuration());
    const A = S / 100 * R;
    e.sceneData.nerveMapIsActive || e.scene && e.scene.setMorphsTime(A), e.sceneData.currentTime = S;
  };
  const d = function() {
    let S = 3e3;
    e.scene && (S = e.scene.getDuration());
    const R = e.zincRenderer.getCurrentTime();
    for (let A = 0; A < i.length; A++)
      i[A](R);
    !e.sceneData.nerveMapIsActive && t && t.setMorphsTime(R), e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setTime(R / S), e.sceneData.currentTime = R / S * 100;
  };
  this.getCurrentTime = function() {
    return e.sceneData.currentTime;
  }, this.toggleSyncControl = (S, R) => {
    let A = this.scene.getZincCameraControls();
    S ? (A.resetView(), this.NDCCameraControl = A.enableSyncControl(), A.setRotationMode(R)) : (A.disableSyncControl(), this.NDCCameraControl = void 0, A.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, R) => {
    this.NDCCameraControl && this.NDCCameraControl.setCenterZoom(S, R);
  };
  const h4 = function() {
    if (e.zincRenderer.playAnimation && e.liveUpdatesObjects && e.setupLiveCoordinates(e.liveUpdatesObjects), e.selectedCenter) {
      const S = new zr.THREE.Vector3();
      S.copy(e.selectedCenter);
      const R = e.scene.vectorToScreenXY(S);
      e.selectedScreenCoordinates.x = R.x, e.selectedScreenCoordinates.y = R.y;
    }
  }, f = function() {
    return function() {
      d();
    };
  }, g = function() {
    return function() {
      h4();
    };
  };
  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, R) {
    const A = new zr.THREE.Vector3();
    A.setFromMatrixPosition(obj.matrixWorld);
    const C = width / 2, L = height / 2;
    return A.project(R), A.x = A.x * C + C, A.y = -(A.y * L) + L, A;
  };
  const p = function(S) {
    let R, A;
    if (S !== void 0) {
      let C = false;
      S.object.userData && S.object.userData.isMarker ? (C = true, A = S.object.userData.parent.getMorph()) : A = S.object;
      try {
        A.userData.userData.annotation.data.lastActionOnMarker = C;
      } finally {
      }
      if (A)
        if (A.name)
          R = A.name;
        else {
          const L = e.getAnnotationsFromObjects(
            [A]
          );
          L && L[0] && (R = L[0].data.group);
        }
    }
    return { id: R, object: A };
  }, u = function() {
    return function(S, R, A) {
      var O;
      const C = e.getIntersectedObject(S), L = p(C), I = {
        worldCoords: [
          C ? C.point.x : 0,
          C ? C.point.y : 0,
          C ? C.point.z : 0
        ],
        intersected: C,
        intersects: S
      }, b = { x: R, y: A };
      if (L.id) {
        I.threeID = (O = L.object) == null ? void 0 : O.id, L.object.userData.isGlyph ? L.object.name ? e.setSelectedByObjects(
          [L.object],
          b,
          I,
          true
        ) : e.setSelectedByZincObjects(
          L.object.userData.getGlyphset(),
          b,
          I,
          true
        ) : e.setSelectedByObjects([L.object], b, I, true);
        return;
      } else
        e.setSelectedByObjects([], b, I, true);
    };
  }, y = function() {
    return function(S, R, A) {
      var O;
      const C = e.getIntersectedObject(S), L = p(C), I = {
        worldCoords: [
          C ? C.point.x : 0,
          C ? C.point.y : 0,
          C ? C.point.z : 0
        ]
      }, b = { x: R, y: A };
      if (L.id) {
        I.threeID = (O = L.object) == null ? void 0 : O.id, e.displayArea.style.cursor = "pointer", e.setHighlightedByObjects([L.object], b, I, true);
        return;
      } else
        e.displayArea.style.cursor = "auto", e.setHighlightedByObjects([], b, I, true);
    };
  }, v = function(S, R, A, C) {
    if (C == "all" || C == "geometries") {
      const L = S.findGeometriesWithGroupName(R);
      for (let I = 0; I < L.length; I++)
        L[I].setVisibility(A);
    }
    if (C == "all" || C == "glyphsets") {
      const L = S.findGlyphsetsWithGroupName(R);
      for (let I = 0; I < L.length; I++)
        L[I].setVisibility(A);
    }
    if (C == "all" || C == "pointsets") {
      const L = S.findPointsetsWithGroupName(R);
      for (let I = 0; I < L.length; I++)
        L[I].setVisibility(A);
    }
    if (C == "all" || C == "lines") {
      const L = S.findLinesWithGroupName(R);
      for (let I = 0; I < L.length; I++)
        L[I].setVisibility(A);
    }
  };
  this.changeGeometriesVisibility = function(S, R) {
    v(e.scene, S, R, "geometries");
  }, this.changeGlyphsetsVisibility = function(S, R) {
    v(e.scene, S, R, "glyphsets");
  }, this.changeLinesVisibility = function(S, R) {
    v(e.scene, S, R, "lines");
  }, this.changePointsetsVisibility = function(S, R) {
    v(e.scene, S, R, "pointsets");
  }, this.changeOrganPartsVisibility = function(S, R, A) {
    let C = "all";
    A !== void 0 && (C = A), v(e.scene, S, R, C);
  }, this.changeOrganPartsVisibilityCallback = function(S) {
    return function(R) {
      e.changeOrganPartsVisibility(S, R);
    };
  }, this.changeBackgroundColour = function(S) {
    const R = new zr.THREE.Color(S);
    e.zincRenderer && e.zincRenderer.getThreeJSRenderer().setClearColor(R, 1);
  };
  const m = function(S, R, A, C) {
    for (let b = 0; b < s.length; b++)
      s[b](C, e.scene.isTimeVarying());
    const L = new SU(), I = C.region.getFullPath();
    L.data = {
      species: e.sceneData.currentSpecies,
      system: S,
      part: R,
      group: C.groupName,
      region: I,
      uuid: C.uuid,
      lastActionOnMarker: false
    }, C.userData.annotation = L;
  }, x = function(S, R, A, C) {
    for (let L = 0; L < o.length; L++)
      o[L](C);
  }, M = function(S, R, A) {
    return function(C) {
      m(S, R, A, C);
    };
  }, T = function(S, R, A) {
    return function(C) {
      x(S, R, A, C);
    };
  }, w = function() {
    return function() {
      e.settingsChanged(), e.sceneData.timeVarying = e.scene.isTimeVarying(), a && a();
    };
  }, _ = function() {
    return function(S) {
      if ((S == null ? void 0 : S.type) === "Error" && c) {
        const R = {
          xhr: S.xhr,
          type: "download-error"
        };
        c(R);
      }
    };
  };
  this.updateFieldvisibility = function(S, R) {
    for (let A = 0; A < S.length; A++)
      if (R != A) {
        const C = S[A].PartName;
        e.changeOrganPartsVisibility(C, false);
      }
    if (R > -1) {
      const A = S[R].PartName;
      if (e.scene.findGeometriesWithGroupName(A).length > 0 || e.scene.findGlyphsetsWithGroupName(A).length > 0)
        e.changeOrganPartsVisibility(A, true);
      else {
        const C = getOrganDetails(S[R].SystemName, A);
        C != null && e.scene.loadMetadataURL(l.getOrgansDirectoryPrefix() + "/" + C.meta);
      }
    }
  }, this.getAvailableSpecies = function(S, R, A) {
    const C = new Array();
    C.push("none");
    const L = Object.keys(organsFileMap);
    for (index in L) {
      const I = L[index];
      I != S && organsFileMap[I].hasOwnProperty(R) && organsFileMap[I][R].hasOwnProperty(A) && C.push(I);
    }
    return C;
  }, this.getCentreAndSize = function() {
    const S = new zr.THREE.Vector3(), R = this.scene.getBoundingBox();
    R.getCenter(S);
    const A = [S.x, S.y, S.z];
    R.getSize(S);
    const C = [S.x, S.y, S.z];
    return { centre: A, size: C };
  };
  const E = function(S, R, A, C) {
    e.sceneData.nerveMapIsActive = false, e.sceneData.nerveMap = void 0, e.sceneData.metaURL = "", e.sceneData.viewURL = "", e.sceneData.currentSpecies = S, e.sceneData.currentSystem = R, e.sceneData.currentPart = A, e.sceneData.currentTime = 0, e.sceneData.timeVarying = false;
    let L = "";
    S && (L = S + "/"), R && (L = R + "/"), A && (L = A), e.sceneData.currentName = L;
  };
  this.loadOrgansFromURL = function(S, R, A, C, L, I) {
    if (e.zincRenderer && C && e.sceneData.metaURL !== S) {
      E(R, A, C);
      const b = e.sceneData.currentName;
      let O = e.zincRenderer.getSceneByName(b);
      O ? I && O.clearAll() : O = e.zincRenderer.createScene(b), e.selectObjectOnPick = true;
      for (let D = 0; D < r.length; D++)
        r[D](e.sceneData);
      L && L != "" ? (e.sceneData.viewURL = L, O.loadViewURL(e.sceneData.viewURL)) : e.sceneData.viewURL = void 0, e.sceneData.metaURL = S, O.addZincObjectAddedCallbacks(M(A, C, false)), O.addZincObjectRemovedCallbacks(T(void 0, C, false)), O.loadMetadataURL(S, _(), w()), e.scene = O, e.zincRenderer.setCurrentScene(O), e.graphicsHighlight.reset();
      const N = O.getZincCameraControls();
      N.enableRaycaster(O, u(), y()), N.setMouseButtonAction("AUXILIARY", "ZOOM"), N.setMouseButtonAction("SECONDARY", "PAN");
    }
  }, this.loadGLTFFromURL = function(S, R, A) {
    if (e.zincRenderer && R && e.sceneData.metaURL !== S) {
      E(void 0, void 0, R);
      const C = e.sceneData.currentName;
      let L = e.zincRenderer.getSceneByName(C);
      L ? A && L.clearAll() : L = e.zincRenderer.createScene(C);
      for (let b = 0; b < r.length; b++)
        r[b](e.sceneData);
      e.sceneData.viewURL = void 0, e.sceneData.metaURL = S, L.addZincObjectAddedCallbacks(M(void 0, R, false)), L.addZincObjectRemovedCallbacks(T(void 0, R, false)), L.loadGLTF(S, void 0, w()), e.scene = L, e.zincRenderer.setCurrentScene(L), e.graphicsHighlight.reset();
      const I = L.getZincCameraControls();
      I.enableRaycaster(L, u(), y()), I.setMouseButtonAction("AUXILIARY", "ZOOM"), I.setMouseButtonAction("SECONDARY", "PAN");
    }
  }, this.alignCameraWithSelectedObject = function(S) {
    const R = e.graphicsHighlight.getSelected();
    R && R[0] && R[0].userData && e.scene.alignObjectToCameraView(R[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,
      true
    ) : e.loadOrgans(S.species, S.system, S.part), true) : false;
  }, function() {
    e.initialiseRenderer(void 0), e.zincRenderer && (e.zincRenderer.addPreRenderCallbackFunction(f()), e.zincRenderer.addPostRenderCallbackFunction(g()));
  }();
};
Hw.prototype = Object.create(Vt.prototype);
var St = function() {
  return St = 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;
  }, St.apply(this, arguments);
};
function EU(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 (h4) {
        o(h4);
      }
    }
    function c(d) {
      try {
        l(i.throw(d));
      } catch (h4) {
        o(h4);
      }
    }
    function l(d) {
      d.done ? s(d.value) : r(d.value).then(a, c);
    }
    l((i = i.apply(n, [])).next());
  });
}
function AU(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: false };
        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: true };
  }
}
function at(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 CU = "ENTRIES";
var Ww = "KEYS";
var jw = "VALUES";
var mn = "";
var Xh = (
  /** @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: true, value: void 0 };
      var e = yo(this._path), t = e.node, i = e.keys;
      if (yo(i) === mn)
        return { done: false, value: this.result() };
      var r = t.get(yo(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 = yo(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 yo(t);
      }).filter(function(e) {
        return e !== mn;
      }).join("");
    }, n.prototype.value = function() {
      return yo(this._path).node.get(mn);
    }, n.prototype.result = function() {
      switch (this._type) {
        case jw:
          return this.value();
        case Ww:
          return this.key();
        default:
          return [this.key(), this.value()];
      }
    }, n.prototype[Symbol.iterator] = function() {
      return this;
    }, n;
  }()
);
var yo = function(n) {
  return n[n.length - 1];
};
var LU = 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 $w(n, e, t, i, o, 1, r, ""), i;
};
var $w = function(n, e, t, i, r, s, o, a) {
  var c, l, d = s * o;
  try {
    e: for (var h4 = at(n.keys()), f = h4.next(); !f.done; f = h4.next()) {
      var g = f.value;
      if (g === mn) {
        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, M = r[m], T = Math.max(0, u - t - 1), w = Math.min(o - 1, u + t), _ = T; _ < w; ++_) {
            var E = v !== e[_], P = r[x + _] + +E, S = r[x + _ + 1] + 1, R = r[m + _] + 1, A = r[m + _ + 1] = Math.min(P, S, R);
            A < M && (M = A);
          }
          if (M > t)
            continue e;
        }
        $w(n.get(g), e, t, i, r, u, o, a + g);
      }
    }
  } catch (C) {
    c = { error: C };
  } finally {
    try {
      f && !f.done && (l = h4.return) && l.call(h4);
    } finally {
      if (c) throw c.error;
    }
  }
};
var Yh = (
  /** @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(su(this._tree, e.slice(this._prefix.length)), 2), s = r[0], o = r[1];
      if (s === void 0) {
        var a = Wt(Up(o), 2), c = a[0], l = a[1];
        try {
          for (var d = at(c.keys()), h4 = d.next(); !h4.done; h4 = d.next()) {
            var f = h4.value;
            if (f !== mn && 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 {
            h4 && !h4.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, RU(this._tree, e);
    }, n.prototype.entries = function() {
      return new Xh(this, CU);
    }, n.prototype.forEach = function(e) {
      var t, i;
      try {
        for (var r = at(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 LU(this._tree, e, t);
    }, n.prototype.get = function(e) {
      var t = tf(this._tree, e);
      return t !== void 0 ? t.get(mn) : void 0;
    }, n.prototype.has = function(e) {
      var t = tf(this._tree, e);
      return t !== void 0 && t.has(mn);
    }, n.prototype.keys = function() {
      return new Xh(this, Ww);
    }, n.prototype.set = function(e, t) {
      if (typeof e != "string")
        throw new Error("key must be a string");
      this._size = void 0;
      var i = Jh(this._tree, e);
      return i.set(mn, 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: false,
      configurable: true
    }), n.prototype.update = function(e, t) {
      if (typeof e != "string")
        throw new Error("key must be a string");
      this._size = void 0;
      var i = Jh(this._tree, e);
      return i.set(mn, t(i.get(mn))), 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 = Jh(this._tree, e), r = i.get(mn);
      return r === void 0 && i.set(mn, r = t()), r;
    }, n.prototype.values = function() {
      return new Xh(this, jw);
    }, n.prototype[Symbol.iterator] = function() {
      return this.entries();
    }, n.from = function(e) {
      var t, i, r = new n();
      try {
        for (var s = at(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;
  }()
);
var su = function(n, e, t) {
  var i, r;
  if (t === void 0 && (t = []), e.length === 0 || n == null)
    return [n, t];
  try {
    for (var s = at(n.keys()), o = s.next(); !o.done; o = s.next()) {
      var a = o.value;
      if (a !== mn && e.startsWith(a))
        return t.push([n, a]), su(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]), su(void 0, "", t);
};
var tf = function(n, e) {
  var t, i;
  if (e.length === 0 || n == null)
    return n;
  try {
    for (var r = at(n.keys()), s = r.next(); !s.done; s = r.next()) {
      var o = s.value;
      if (o !== mn && e.startsWith(o))
        return tf(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;
    }
  }
};
var Jh = function(n, e) {
  var t, i, r = e.length;
  e: for (var s = 0; n && s < r; ) {
    try {
      for (var o = (t = void 0, at(n.keys())), a = o.next(); !a.done; a = o.next()) {
        var c = a.value;
        if (c !== mn && e[s] === c[0]) {
          for (var l = Math.min(r - s, c.length), d = 1; d < l && e[s + d] === c[d]; )
            ++d;
          var h4 = n.get(c);
          if (d === c.length)
            n = h4;
          else {
            var f = /* @__PURE__ */ new Map();
            f.set(c.slice(d), h4), 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;
};
var RU = function(n, e) {
  var t = Wt(su(n, e), 2), i = t[0], r = t[1];
  if (i !== void 0) {
    if (i.delete(mn), i.size === 0)
      Zw(r);
    else if (i.size === 1) {
      var s = Wt(i.entries().next().value, 2), o = s[0], a = s[1];
      Xw(r, o, a);
    }
  }
};
var Zw = function(n) {
  if (n.length !== 0) {
    var e = Wt(Up(n), 2), t = e[0], i = e[1];
    if (t.delete(i), t.size === 0)
      Zw(n.slice(0, -1));
    else if (t.size === 1) {
      var r = Wt(t.entries().next().value, 2), s = r[0], o = r[1];
      s !== mn && Xw(n.slice(0, -1), s, o);
    }
  }
};
var Xw = function(n, e, t) {
  if (n.length !== 0) {
    var i = Wt(Up(n), 2), r = i[0], s = i[1];
    r.set(s + e, t), r.delete(s);
  }
};
var Up = function(n) {
  return n[n.length - 1];
};
var Ia;
var Vp = "or";
var Yw = "and";
var PU = "and_not";
var OU = (
  /** @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 === true ? Qh : e.autoVacuum;
      this._options = St(St(St({}, qh), e), { autoVacuum: t, searchOptions: St(St({}, e0), e.searchOptions || {}), autoSuggestOptions: St(St({}, FU), e.autoSuggestOptions || {}) }), this._index = new Yh(), 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 = rf, 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, h4 = 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 = at(f), v = y.next(); !v.done; v = y.next()) {
          var m = v.value, x = l(e, m);
          if (x != null) {
            var M = d(x.toString(), m), T = this._fieldIds[m], w = new Set(M).size;
            this.addFieldLength(u, T, this._documentCount - 1, w);
            try {
              for (var _ = (r = void 0, at(M)), E = _.next(); !E.done; E = _.next()) {
                var P = E.value, S = h4(P, m);
                if (Array.isArray(S))
                  try {
                    for (var R = (o = void 0, at(S)), A = R.next(); !A.done; A = R.next()) {
                      var C = A.value;
                      this.addTerm(T, u, C);
                    }
                  } catch (L) {
                    o = { error: L };
                  } finally {
                    try {
                      A && !A.done && (a = R.return) && a.call(R);
                    } finally {
                      if (o) throw o.error;
                    }
                  }
                else S && this.addTerm(T, u, S);
              }
            } catch (L) {
              r = { error: L };
            } finally {
              try {
                E && !E.done && (s = _.return) && s.call(_);
              } finally {
                if (r) throw r.error;
              }
            }
          }
        }
      } catch (L) {
        t = { error: L };
      } 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 = at(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, h4, f) {
        var g = d.chunk, p = d.promise;
        return g.push(h4), (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, h4 = c.extractField, f = c.fields, g = c.idField, p = h4(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 = at(f), v = y.next(); !v.done; v = y.next()) {
          var m = v.value, x = h4(e, m);
          if (x != null) {
            var M = l(x.toString(), m), T = this._fieldIds[m], w = new Set(M).size;
            this.removeFieldLength(u, T, this._documentCount, w);
            try {
              for (var _ = (r = void 0, at(M)), E = _.next(); !E.done; E = _.next()) {
                var P = E.value, S = d(P, m);
                if (Array.isArray(S))
                  try {
                    for (var R = (o = void 0, at(S)), A = R.next(); !A.done; A = R.next()) {
                      var C = A.value;
                      this.removeTerm(T, u, C);
                    }
                  } catch (L) {
                    o = { error: L };
                  } finally {
                    try {
                      A && !A.done && (a = R.return) && a.call(R);
                    } finally {
                      if (o) throw o.error;
                    }
                  }
                else S && this.removeTerm(T, u, S);
              }
            } catch (L) {
              r = { error: L };
            } finally {
              try {
                E && !E.done && (s = _.return) && s.call(_);
              } finally {
                if (r) throw r.error;
              }
            }
          }
        }
      } catch (L) {
        t = { error: L };
      } 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 = at(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 Yh(), 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 !== false) {
        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 = false;
        try {
          for (var s = at(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 = rf, i.performVacuuming(e, r);
      }), this._enqueuedVacuum)) : this.vacuumConditionsMet(t) === false ? Promise.resolve() : (this._currentVacuum = this.performVacuuming(e), this._currentVacuum);
    }, n.prototype.performVacuuming = function(e, t) {
      return EU(this, void 0, void 0, function() {
        var i, r, s, o, a, c, l, d, h4, f, g, p, u, y, v, m, x, M, T, w, _, E, P, S, R;
        return AU(this, function(A) {
          switch (A.label) {
            case 0:
              if (i = this._dirtCount, !this.vacuumConditionsMet(t)) return [3, 10];
              r = e.batchSize || nf.batchSize, s = e.batchWait || nf.batchWait, o = 1, A.label = 1;
            case 1:
              A.trys.push([1, 7, 8, 9]), a = at(this._index), c = a.next(), A.label = 2;
            case 2:
              if (c.done) return [3, 6];
              l = Wt(c.value, 2), d = l[0], h4 = l[1];
              try {
                for (f = (E = void 0, at(h4)), g = f.next(); !g.done; g = f.next()) {
                  p = Wt(g.value, 2), u = p[0], y = p[1];
                  try {
                    for (v = (S = void 0, at(y)), m = v.next(); !m.done; m = v.next())
                      x = Wt(m.value, 1), M = x[0], !this._documentIds.has(M) && (y.size <= 1 ? h4.delete(u) : y.delete(M));
                  } catch (C) {
                    S = { error: C };
                  } finally {
                    try {
                      m && !m.done && (R = v.return) && R.call(v);
                    } finally {
                      if (S) throw S.error;
                    }
                  }
                }
              } catch (C) {
                E = { error: C };
              } finally {
                try {
                  g && !g.done && (P = f.return) && P.call(f);
                } finally {
                  if (E) throw E.error;
                }
              }
              return this._index.get(d).size === 0 && this._index.delete(d), o % r !== 0 ? [3, 4] : [4, new Promise(function(C) {
                return setTimeout(C, s);
              })];
            case 3:
              A.sent(), A.label = 4;
            case 4:
              o += 1, A.label = 5;
            case 5:
              return c = a.next(), [3, 2];
            case 6:
              return [3, 9];
            case 7:
              return T = A.sent(), w = { error: T }, [3, 9];
            case 8:
              try {
                c && !c.done && (_ = a.return) && _.call(a);
              } finally {
                if (w) throw w.error;
              }
              return [
                7
                /*endfinally*/
              ];
            case 9:
              this._dirtCount -= i, A.label = 10;
            case 10:
              return [4, null];
            case 11:
              return A.sent(), this._currentVacuum = this._enqueuedVacuum, this._enqueuedVacuum = null, [
                2
                /*return*/
              ];
          }
        });
      });
    }, n.prototype.vacuumConditionsMet = function(e) {
      if (e == null)
        return true;
      var t = e.minDirtCount, i = e.minDirtFactor;
      return t = t || Qh.minDirtCount, i = i || Qh.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: false,
      configurable: true
    }), Object.defineProperty(n.prototype, "dirtCount", {
      /**
       * The number of documents discarded since the most recent vacuuming
       */
      get: function() {
        return this._dirtCount;
      },
      enumerable: false,
      configurable: true
    }), 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: false,
      configurable: true
    }), 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 = at(s), c = a.next(); !c.done; c = a.next()) {
          var l = Wt(c.value, 2), d = l[0], h4 = l[1], f = h4.score, g = h4.terms, p = h4.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(n0), o;
    }, n.prototype.autoSuggest = function(e, t) {
      var i, r, s, o;
      t === void 0 && (t = {}), t = St(St({}, this._options.autoSuggestOptions), t);
      var a = /* @__PURE__ */ new Map();
      try {
        for (var c = at(this.search(e, t)), l = c.next(); !l.done; l = c.next()) {
          var d = l.value, h4 = d.score, f = d.terms, g = f.join(" "), p = a.get(g);
          p != null ? (p.score += h4, p.count += 1) : a.set(g, { score: h4, terms: f, count: 1 });
        }
      } catch (T) {
        i = { error: T };
      } finally {
        try {
          l && !l.done && (r = c.return) && r.call(c);
        } finally {
          if (i) throw i.error;
        }
      }
      var u = [];
      try {
        for (var y = at(a), v = y.next(); !v.done; v = y.next()) {
          var m = Wt(v.value, 2), p = m[0], x = m[1], h4 = x.score, f = x.terms, M = x.count;
          u.push({ suggestion: p, terms: f, score: h4 / M });
        }
      } catch (T) {
        s = { error: T };
      } finally {
        try {
          v && !v.done && (o = y.return) && o.call(y);
        } finally {
          if (s) throw s.error;
        }
      }
      return u.sort(n0), u;
    }, Object.defineProperty(n.prototype, "documentCount", {
      /**
       * Total number of documents available to search
       */
      get: function() {
        return this._documentCount;
      },
      enumerable: false,
      configurable: true
    }), Object.defineProperty(n.prototype, "termCount", {
      /**
       * Number of terms in the index
       */
      get: function() {
        return this._index.size;
      },
      enumerable: false,
      configurable: true
    }), 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 (qh.hasOwnProperty(e))
        return Kh(qh, 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, h4 = 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 = h4, x._documentIds = Nc(f), x._idToShortId = /* @__PURE__ */ new Map(), x._fieldIds = g, x._fieldLength = Nc(p), x._avgFieldLength = u, x._storedFields = Nc(y), x._dirtCount = v || 0, x._index = new Yh();
      try {
        for (var M = at(x._documentIds), T = M.next(); !T.done; T = M.next()) {
          var w = Wt(T.value, 2), _ = w[0], E = w[1];
          x._idToShortId.set(E, _);
        }
      } catch (D) {
        i = { error: D };
      } finally {
        try {
          T && !T.done && (r = M.return) && r.call(M);
        } finally {
          if (i) throw i.error;
        }
      }
      try {
        for (var P = at(l), S = P.next(); !S.done; S = P.next()) {
          var R = Wt(S.value, 2), A = R[0], C = R[1], L = /* @__PURE__ */ new Map();
          try {
            for (var I = (a = void 0, at(Object.keys(C))), b = I.next(); !b.done; b = I.next()) {
              var O = b.value, N = C[O];
              m === 1 && (N = N.ds), L.set(parseInt(O, 10), Nc(N));
            }
          } catch (D) {
            a = { error: D };
          } finally {
            try {
              b && !b.done && (c = I.return) && c.call(I);
            } finally {
              if (a) throw a.error;
            }
          }
          x._index.set(A, L);
        }
      } catch (D) {
        s = { error: D };
      } finally {
        try {
          S && !S.done && (o = P.return) && o.call(P);
        } 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 = St(St(St({}, 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 = St(St({ tokenize: a, processTerm: c }, l), t), h4 = d.tokenize, f = d.processTerm, g = h4(e).flatMap(function(y) {
        return f(y);
      }).filter(function(y) {
        return !!y;
      }), p = g.map(BU(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 = St(St({}, this._options.searchOptions), t), c = (a.fields || this._options.fields).reduce(function(O, N) {
        var D;
        return St(St({}, O), (D = {}, D[N] = Kh(a.boost, N) || 1, D));
      }, {}), l = a.boostDocument, d = a.weights, h4 = a.maxFuzzy, f = a.bm25, g = St(St({}, e0.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 M = e.fuzzy === true ? 0.2 : e.fuzzy, T = M < 1 ? Math.min(h4, Math.round(e.term.length * M)) : M;
        T && (x = this._index.fuzzyGet(e.term, T));
      }
      if (m)
        try {
          for (var w = at(m), _ = w.next(); !_.done; _ = w.next()) {
            var E = Wt(_.value, 2), P = E[0], S = E[1], R = P.length - e.term.length;
            if (R) {
              x == null || x.delete(P);
              var A = u * P.length / (P.length + 0.3 * R);
              this.termResults(e.term, P, A, S, c, l, f, v);
            }
          }
        } catch (O) {
          i = { error: O };
        } finally {
          try {
            _ && !_.done && (r = w.return) && r.call(w);
          } finally {
            if (i) throw i.error;
          }
        }
      if (x)
        try {
          for (var C = at(x.keys()), L = C.next(); !L.done; L = C.next()) {
            var P = L.value, I = Wt(x.get(P), 2), b = I[0], R = I[1];
            if (R) {
              var A = p * P.length / (P.length + R);
              this.termResults(e.term, P, A, b, c, l, f, v);
            }
          }
        } catch (O) {
          s = { error: O };
        } finally {
          try {
            L && !L.done && (o = C.return) && o.call(C);
          } finally {
            if (s) throw s.error;
          }
        }
      return v;
    }, n.prototype.executeWildcardQuery = function(e) {
      var t, i, r = /* @__PURE__ */ new Map(), s = St(St({}, this._options.searchOptions), e);
      try {
        for (var o = at(this._documentIds), a = o.next(); !a.done; a = o.next()) {
          var c = Wt(a.value, 2), l = c[0], d = c[1], h4 = s.boostDocument ? s.boostDocument(d, "", this._storedFields.get(l)) : 1;
          r.set(l, {
            score: h4,
            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 = Vp), e.length === 0)
        return /* @__PURE__ */ new Map();
      var i = t.toLowerCase();
      return e.reduce(IU[i]) || /* @__PURE__ */ new Map();
    }, n.prototype.toJSON = function() {
      var e, t, i, r, s = [];
      try {
        for (var o = at(this._index), a = o.next(); !a.done; a = o.next()) {
          var c = Wt(a.value, 2), l = c[0], d = c[1], h4 = {};
          try {
            for (var f = (i = void 0, at(d)), g = f.next(); !g.done; g = f.next()) {
              var p = Wt(g.value, 2), u = p[0], y = p[1];
              h4[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, h4]);
        }
      } 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, h4, f, g;
      if (c === void 0 && (c = /* @__PURE__ */ new Map()), r == null)
        return c;
      try {
        for (var p = at(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 M = x.size, T = this._avgFieldLength[m];
            try {
              for (var w = (h4 = void 0, at(x.keys())), _ = w.next(); !_.done; _ = w.next()) {
                var E = _.value;
                if (!this._documentIds.has(E)) {
                  this.removeTerm(m, E, t), M -= 1;
                  continue;
                }
                var P = o ? o(this._documentIds.get(E), t, this._storedFields.get(E)) : 1;
                if (P) {
                  var S = x.get(E), R = this._fieldLength.get(E)[m], A = NU(S, M, this._documentCount, R, T, a), C = i * v * P * A, L = c.get(E);
                  if (L) {
                    L.score += C, zU(L.terms, e);
                    var I = Kh(L.match, t);
                    I ? I.push(y) : L.match[t] = [y];
                  } else
                    c.set(E, {
                      score: C,
                      terms: [e],
                      match: (g = {}, g[t] = [y], g)
                    });
                }
              }
            } catch (b) {
              h4 = { error: b };
            } finally {
              try {
                _ && !_.done && (f = w.return) && f.call(w);
              } finally {
                if (h4) throw h4.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, i0), 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, i0), 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 = at(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 = at(o), d = l.next(); !d.done; d = l.next()) {
            var h4 = d.value, f = a(t, h4);
            f !== void 0 && (c[h4] = 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;
  }()
);
var Kh = function(n, e) {
  return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0;
};
var IU = (Ia = {}, Ia[Vp] = function(n, e) {
  var t, i;
  try {
    for (var r = at(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, h4 = c.match;
        a.score = a.score + l, a.match = Object.assign(a.match, h4), t0(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;
}, Ia[Yw] = function(n, e) {
  var t, i, r = /* @__PURE__ */ new Map();
  try {
    for (var s = at(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, h4 = l.terms, f = l.match;
        t0(c.terms, h4), 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;
}, Ia[PU] = function(n, e) {
  var t, i;
  try {
    for (var r = at(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;
}, Ia);
var DU = { k: 1.2, b: 0.7, d: 0.5 };
var NU = 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)));
};
var BU = function(n) {
  return function(e, t, i) {
    var r = typeof n.fuzzy == "function" ? n.fuzzy(e, t, i) : n.fuzzy || false, s = typeof n.prefix == "function" ? n.prefix(e, t, i) : n.prefix === true;
    return { term: e, fuzzy: r, prefix: s };
  };
};
var qh = {
  idField: "id",
  extractField: function(n, e) {
    return n[e];
  },
  tokenize: function(n) {
    return n.split(UU);
  },
  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: true
};
var e0 = {
  combineWith: Vp,
  prefix: false,
  fuzzy: false,
  maxFuzzy: 6,
  boost: {},
  weights: { fuzzy: 0.45, prefix: 0.375 },
  bm25: DU
};
var FU = {
  combineWith: Yw,
  prefix: function(n, e, t) {
    return e === t.length - 1;
  }
};
var nf = { batchSize: 1e3, batchWait: 10 };
var rf = { minDirtFactor: 0.1, minDirtCount: 20 };
var Qh = St(St({}, nf), rf);
var zU = function(n, e) {
  n.includes(e) || n.push(e);
};
var t0 = function(n, e) {
  var t, i;
  try {
    for (var r = at(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;
    }
  }
};
var n0 = function(n, e) {
  var t = n.score, i = e.score;
  return i - t;
};
var i0 = function() {
  return /* @__PURE__ */ new Map();
};
var Nc = function(n) {
  var e, t, i = /* @__PURE__ */ new Map();
  try {
    for (var r = at(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;
};
var UU = /[\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;
var VU = class {
  constructor() {
    this._searchEngine = new OU({
      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: true, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: true }));
    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 = zz(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: true, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: true }));
    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);
  }
};
var kU = {
  name: "ScaffoldVuer",
  components: {
    Button: sa,
    Col: wi,
    Loading: xP,
    Option: aa,
    Popover: Mu,
    Row: Vi,
    Select: oa,
    Slider: si,
    TabPane: Oy,
    Tabs: Py,
    MapSvgIcon: wn,
    MapSvgSpriteColor: hn,
    PrimitiveControls: Bw,
    ScaffoldTooltip: Gw,
    ElIconWarningFilled: P0,
    ElIconArrowDown: vf,
    ElIconArrowLeft: Wr,
    DrawToolbar: CA,
    ScaffoldTreeControls: Fw
  },
  setup(n) {
    let e = inject("$annotator");
    return e || (e = markRaw(new yU(`${n.flatmapAPI}annotator`)), provide("$annotator", e)), { annotator: e };
  },
  props: {
    /**
      * The option to show annotation information in sidebar
      */
    annotationSidebar: {
      type: Boolean,
      default: false
    },
    /**
     * 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: false
    },
    /**
     * Flag to show/hide the UI.
     */
    displayUI: {
      type: Boolean,
      default: true
    },
    /**
     * Display all graphics at start.
     *
     * This setting only works when traditional is set to false.
     */
    displayAtStartUp: {
      type: Boolean,
      default: true
    },
    /**
     * Use for toggling the help tooltips.
     */
    helpMode: {
      type: Boolean,
      default: false
    },
    /**
     * 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: false
    },
    /**
     * The last item of help mode.
     */
    helpModeLastItem: {
      type: Boolean,
      default: false
    },
    /**
     * 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: true
    },
    /**
     * Warning message for the hovered over text
     * on the warning icon.
     */
    warningMessage: {
      type: String,
      default: "Beta feature - under active development"
    },
    displayLatestChanges: {
      type: Boolean,
      default: false
    },
    latestChangesMessage: {
      type: String,
      default: "New feature - Local search is now available"
    },
    /**
     * Show/hide pickable markers for regions.
     */
    displayMarkers: {
      type: Boolean,
      default: false
    },
    /**
     * Display adjacent markers with a cluster marker.
     */
    markerCluster: {
      type: Boolean,
      default: false
    },
    /**
     * 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: false
    },
    /**
     * 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: false
    },
    /**
     * 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: true
    },
    /**
     * 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/"
    },
    /**
     * Enable local annotations
     */
    enableLocalAnnotations: {
      type: Boolean,
      default: false
    }
  },
  provide() {
    return {
      flatmapAPI: this.flatmapAPI,
      scaffoldUrl: this.url,
      boundingDims: this.boundingDims
    };
  },
  data: function() {
    return {
      annotator: void 0,
      createData: {
        drawingBox: false,
        toBeConfirmed: false,
        points: [],
        shape: "",
        x: 0,
        y: 0,
        editingIndex: -1,
        faceIndex: -1,
        toBeDeleted: false
      },
      currentTime: 0,
      timeVarying: false,
      isPlaying: false,
      isReady: false,
      /**
       * This is set when scene is transitioning.
       */
      isTransitioning: false,
      tooltipAppendToBody: false,
      hoverVisibilities: [
        { value: false, ref: "zoomInPopover" },
        // 0
        { value: false, ref: "zoomOutPopover" },
        // 1
        { value: false, ref: "zoomFitPopover" },
        // 2
        { value: false, ref: "openMapPopover" },
        // 3
        { value: false, ref: "settingsPopover" },
        // 4
        { value: false, ref: "sliderPopover" },
        // 5
        { value: false, ref: "regionVisibilityPopover" },
        // 6
        { value: false, ref: "warningPopover" },
        // 7
        { value: false, ref: "whatsNewPopover" },
        // 8
        { value: false, refs: "toolbarPopover", ref: "editPopover" },
        // 9
        { value: false, refs: "toolbarPopover", ref: "pointPopover" },
        // 10
        { value: false, refs: "toolbarPopover", ref: "lineStringPopover" },
        // 11
        { value: false, refs: "toolbarPopover", ref: "deletePopover" }
        // 11
      ],
      inHelp: false,
      helpModeActiveIndex: this.helpModeInitialIndex,
      loading: false,
      duration: 3e3,
      drawerOpen: true,
      currentBackground: "white",
      availableBackground: ["white", "lightskyblue", "black"],
      minimisedSlider: false,
      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: [],
      tData: {
        label: "",
        region: "",
        visible: false,
        x: 200,
        y: 200,
        active: false
      },
      fileFormat: "metadata",
      previousMarkerLabels: markRaw({}),
      viewingMode: "Exploration",
      viewingModes: {
        Exploration: "View and explore detailed visualization of 3D scaffolds",
        Annotation: ["View feature annotations", "Add, comment on and view feature annotations"]
      },
      openMapRef: void 0,
      backgroundIconRef: void 0,
      userInformation: void 0,
      toolbarOptions: [
        "Delete",
        "Edit",
        "Point",
        "LineString"
      ],
      activeDrawTool: void 0,
      activeDrawMode: void 0,
      localAnnotationsList: markRaw([]),
      boundingDims: {
        centre: [0, 0, 0],
        size: [1, 1, 1]
      },
      lastSelected: markRaw({
        region: "",
        group: "",
        isSearch: false
      })
    };
  },
  watch: {
    format: {
      handler: function(n) {
        this.fileFormat = n;
      },
      immediate: true
    },
    url: {
      handler: function(n) {
        (this.state === void 0 || this.state.url === void 0) && this.setURL(n);
      },
      immediate: true
    },
    region: {
      handler: function(n) {
        this.state || this.viewURL || this.setFocusedRegion(n);
      },
      immediate: true
    },
    state: {
      handler: function(n) {
        this.setState(n);
      },
      immediate: true,
      deep: true
    },
    viewURL: {
      handler: function(n) {
        this.updateViewURL(n);
      },
      immediate: true
    },
    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 = true;
    },
    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: true,
      handler: "updateMinimapScissor"
    },
    render: function(n) {
      this.toggleRendering(n);
    },
    markerCluster: {
      handler: function(n) {
        this.$module.scene.enableMarkerCluster(n);
      },
      immediate: true
    },
    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 = markRaw({ ...n });
    }
  },
  beforeCreate: function() {
    this.$module = new Hw(), this.selectedObjects = [], this.hoveredObjects = [], this.currentBackground = "white", this._currentURL = void 0, this.availableBackground = ["white", "black", "lightskyblue"], this.$_searchIndex = new VU();
  },
  mounted: function() {
    this.openMapRef = shallowRef(this.$refs.openMapRef), this.backgroundIconRef = shallowRef(this.$refs.backgroundIconRef), this.$refs.scaffoldTreeControls.setModule(this.$module);
    let n = new wU();
    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
    ), this.helpTextWait = [], this.helpTextWait.length = this.hoverVisibilities.length, this.defaultRate = this.$module.getPlayRate(), this.$module.zincRenderer.addPreRenderCallbackFunction(() => {
      this.currentTime = this.$module.getCurrentTime();
    });
  },
  beforeUnmount: function() {
    this.ro && this.ro.disconnect(), this.$module.destroy(), this.$module = void 0;
  },
  computed: {
    ...Vw(kw, ["userToken"]),
    annotationDisplay: function() {
      return this.viewingMode === "Annotation" && this.tData.active === true && this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString";
    },
    modeDescription: function() {
      let n = this.viewingModes[this.viewingMode];
      return this.viewingMode === "Annotation" ? this.userInformation ? n[1] : n[0] : n;
    }
  },
  methods: {
    /**
     * @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) {
      this.loading = false, this.$_searchIndex.addZincObject(n, n.uuid), this.timeVarying === false && n.isTimeVarying() && (this.timeVarying = true), this.$emit("zinc-object-added", n);
    },
    /**
     * Internal only.
     * Remove an entry matching region and group from
     * local annotation list.
     */
    removeFromLocalAnnotationList: function(n, e) {
      for (let t = 0; t < this.localAnnotationsList.length; t++) {
        const i = this.localAnnotationsList[t];
        if (i.region === n && i.group === e) {
          this.localAnnotationsList.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.region.getFullPath(), t = n.groupName;
        n.region.findObjectsWithGroupName(t, false).length === 0 && (this.$_searchIndex.removeZincObject(n, n.uuid), this.removeFromLocalAnnotationList(e, t));
      }
    },
    /**
     * Internal only.
     * Add regions to search index.
     */
    addRegionsToSearchIndex: function() {
      this.$module.scene.getRootRegion().getChildRegions(true).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 = Zv(
        this.annotator,
        this.userToken,
        t,
        n,
        e,
        this.url,
        i
      );
      if (this.enableLocalAnnotations) {
        r.group = e;
        let s = n;
        s.slice(-1) === "/" && (s = s.slice(0, -1)), r.region = s, this.removeFromLocalAnnotationList(s, e), this.localAnnotationsList.push(r);
      }
      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 = true, this.tData.region = n.region, this.tData.label = n.group, this.changeActiveByName([n.group], n.region, false));
      }
      this.cancelCreate();
    },
    /**
     * Internal only.
     * Cancel create workflows. Reset all relevant UIs and data.
     */
    cancelCreate: function() {
      this.createData.points.length = 0, this.createData.toBeConfirmed = false, this._editingZincObject = void 0, this.createData.editingIndex = -1, this.createData.faceIndex = -1, this.tData.visible = false, this.createData.toBeDeleted = false, 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.
     */
    confirmDelete: function() {
      var n;
      if ((n = this._editingZincObject) != null && n.isEditable) {
        const e = this._editingZincObject.region.getFullPath() + "/", t = this._editingZincObject.groupName;
        Zv(
          this.annotator,
          this.userToken,
          this._editingZincObject,
          e,
          t,
          this.url,
          "Deleted"
        ) && this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(this._editingZincObject);
      }
      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 = false;
        this._boundingBoxGeo && (n = this._boundingBoxGeo.getVisibility(), this._boundingBoxGeo.setVisibility(false)), this.$module.scene.viewAll(), this._boundingBoxGeo && (Bz(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 = false;
    },
    /**
     * 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) {
      if (this.createData.toBeDeleted = false, n === "mode")
        this.cancelCreate(), this.activeDrawMode = e, this.createData.shape = "", this.$module.selectObjectOnPick = true;
      else if (n === "tool") {
        if (this.annotationDisplay) return;
        this.activeDrawTool = e, this.createData.shape = this.activeDrawTool ? this.activeDrawTool : "", this.$module.selectObjectOnPick = false;
      }
    },
    /**
     * 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 = Ao(e, t, "", true);
      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 true;
      }
      return false;
    },
    setFocusedRegion: function(n) {
      n && (this.isReady ? this.viewRegion(n) : this.$module.setFinishDownloadCallback(
        this.setURLFinishCallback({ region: 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, true, false), 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 = true;
        } 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 === false && (this.createData.points.length = 0, this.createData.points.push(n), this.createData.toBeConfirmed = true, this.showRegionTooltipWithAnnotations(e, true, false), this.tData.x = 50, this.tData.y = 200, this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960));
    },
    drawLine: function(n, e) {
      this.createData.toBeConfirmed === false && (this.createData.points.length === 1 ? (this.createData.points.push(n), this.createData.toBeConfirmed = true, this.showRegionTooltipWithAnnotations(e, true, false), 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 = true, n.enableAutoTumble(), n.autoTumble([1, 0], Math.PI, true), setTimeout(this.stopFreeSpin, 4e3);
      }
    },
    activateAnnotationMode: function(n, e) {
      if (this.userInformation || this.enableLocalAnnotations)
        if (this.createData.toBeDeleted = false, 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 = Iz(e);
            t && this.activateEditingMode(
              t.zincObject,
              t.faceIndex,
              t.vertexIndex,
              t.point
            );
          } else if (this.activeDrawMode === "Delete") {
            const t = Dz(e);
            t && (this.createData.toBeDeleted = true, this._editingZincObject = t);
          }
          this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString" ? this.showRegionTooltipWithAnnotations(e.identifiers, true, false) : this.showRegionTooltipWithAnnotations(e.identifiers, true, true);
        }
      else
        this.showRegionTooltipWithAnnotations(e.identifiers, true, true);
    },
    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)
          this.viewingMode === "Annotation" ? (this.tData.label = i, this.tData.region = r, this.activateAnnotationMode(e, n)) : (this.$refs.scaffoldTreeControls && (e.length > 0 ? (this.$refs.scaffoldTreeControls.updateActiveUI(t), this.updatePrimitiveControls(t)) : (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls.removeActive(false))), n.identifiers.length === 1 ? (this.lastSelected.isSearch = false, this.lastSelected.region = r, this.lastSelected.group = n.identifiers[0].data.group) : n.identifiers.length === 0 && (this.lastSelected.isSearch = false, this.lastSelected.region = "", this.lastSelected.group = ""), this.$emit("scaffold-selected", n.identifiers));
        else if (n.eventType == 2)
          this.selectedObjects.length === 0 && (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls && (e.length > 0 ? this.$refs.scaffoldTreeControls.updateHoverUI(t) : this.$refs.scaffoldTreeControls.removeHover(true)), n.identifiers.length > 0 && n.identifiers[0] && n.identifiers[0].coords && (this.tData.active = false, (this.viewingMode !== "Annotation" || !this.annotationSidebar) && (this.tData.visible = true), 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.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.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.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", true), n && !this.helpModeDialog ? (this.inHelp = true, this.hoverVisibilities.forEach((r) => {
        r.value = true;
      })) : n && this.helpModeDialog && e > this.helpModeActiveIndex ? this.helpModeActiveIndex > -1 && setTimeout(() => {
        this.inHelp = false, this.hoverVisibilities.forEach((r) => {
          r.value = false;
        }), this.showHelpText(this.helpModeActiveIndex, 200);
      }, 300) : (this.inHelp = false, this.hoverVisibilities.forEach((r) => {
        r.value = false;
      }));
    },
    /**
     * 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 = false : this.tData.active = true, this.tData.visible = true, 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
            )
          ))), true;
      }
      return this.hideRegionTooltip(), false;
    },
    /**
     * 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(), false);
    },
    /**
     * 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 = Ao(i, [n], "", true);
        let o;
        return s && s.length > 0 && (o = s[0].getRegion().getFullPath()), this.showRegionTooltipWithObjects(
          n,
          s,
          o,
          e,
          t
        );
      }
      return this.hideRegionTooltip(), false;
    },
    /**
     * 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
            };
            this.$emit("annotation-open", {
              annotationEntry: s,
              createData: this.createData,
              confirmCreate: this.confirmCreate,
              cancelCreate: this.cancelCreate,
              confirmDelete: this.confirmDelete
            });
            return;
          } else
            return this.showRegionTooltipWithObjects(
              i.label,
              i.objects,
              i.regionPath,
              e,
              t
            );
      }
      return this.hideRegionTooltip(), false;
    },
    /**
     * Callback on viewing mode change
     * Optional, can be used to update the view mode.
     */
    changeViewingMode: function(n) {
      if (this.$module) {
        if (n && (this.viewingMode = n), this.viewingMode === "Annotation") {
          let e = false;
          this.userInformation && (e = true), this.userInformation = void 0, this.annotator.authenticate(this.userToken).then((t) => {
            t.name && t.email && t.canUpdate && (this.userInformation = t, e || (Xv(this.annotator, this.userToken, this.url).then((i) => {
              i && i.features && jh(this.$module.scene, i.features);
            }), Xv(this.annotator, this.userToken, encodeURIComponent(this.url)).then((i) => {
              i && i.features && jh(this.$module.scene, i.features);
            })));
          });
        } else this.viewingMode === "Exploration" && (this.activeDrawTool = void 0, this.activeDrawMode = void 0, this.createData.shape = "");
        this.viewingMode === "Exploration" || this.viewingMode === "Annotation" && this.createData.shape === "" ? this.$module.selectObjectOnPick = true : this.$module.selectObjectOnPick = false, this.cancelCreate();
      }
    },
    /**
     * @public
     * Hide the tooltip
     */
    hideRegionTooltip: function() {
      this.$_liveCoordinatesUpdated && (this.$module.zincRenderer.removePostRenderCallbackFunction(
        this.$_liveCoordinatesUpdated
      ), this.$module.setupLiveCoordinates(void 0)), this.tData.active = false, this.tData.visible = false, this.tData.region = void 0;
    },
    /**
     * 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();
        Ao(r, [n], "", true).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 = true, 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 = false;
      }, 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 = "", this.lastSelected.group = "", this.lastSelected.isSearch = true, this.objectSelected([], true), false;
        {
          this.lastSelected.region = "", this.lastSelected.group = n, this.lastSelected.isSearch = true;
          const t = this.$_searchIndex.searchAndProcessResult(n), i = t.zincObjects;
          if (i.length > 0) {
            if (this.objectSelected(i, true), e)
              for (let r = 0; r < i.length; r++)
                i[r] && i[r].groupName && this.showRegionTooltipWithObjects(
                  t.label,
                  i,
                  t.regionPath,
                  true,
                  true
                );
            return true;
          } else
            this.objectSelected([], true);
        }
      }
      return false;
    },
    /**
     * @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 = true;
    },
    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), n.viewingMode && this.changeViewingMode(n.viewingMode);
        const e = n.search;
        e && e.group && (e.isSearch ? this.search(e.group, true) : this.changeActiveByName(e.group, e.region, true));
      }
    },
    downloadErrorCallback: function() {
      return (n) => {
        this.$emit("on-error", n);
      };
    },
    setURLFinishCallback: function(n) {
      return () => {
        this.localAnnotationsList.length = 0, this.updateSettingsfromScene(), this.$module.updateTime(0.01), this.$module.updateTime(0), this.$module.unsetFinishDownloadCallback(), this.addRegionsToSearchIndex(), this.$emit("on-ready"), 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.$nextTick(() => this.restoreSettings(n)), this.isReady = true;
      };
    },
    /**
     * 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,
        viewingMode: this.viewingMode
      };
      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 }), 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,
        viewingMode: this.viewingMode,
        search: n.search
      }) : (n.background || n.search || n.viewport || n.viewingMode || n.visibility) && (this.isReady && this.$module.scene ? this.restoreSettings(n) : this.$module.setFinishDownloadCallback(
        this.setURLFinishCallback({
          background: n.background,
          viewingMode: n.viewingMode,
          viewport: n.viewport,
          visibility: n.visibility,
          search: n.search
        })
      )));
    },
    /**
     * 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 enableLocalAnnotations is set to true.
     *
     * @public
     */
    getLocalAnnotations: function() {
      return [...this.localAnnotationsList];
    },
    /**
     * Import local annotations. The annotations will only
     * be imported when enableLocalAnnotations is set to
     * true;
     *
     * @public
     * @arg {Array} `annotationsList`
     */
    importLocalAnnotations: function(n) {
      if (this.enableLocalAnnotations) {
        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);
        jh(this.$module.scene, e), n.forEach((t) => {
          this.localAnnotationsList.push({ ...t });
        });
      }
    },
    /**
     * 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) {
      n != this._currentURL && (e != null && e.format && (this.fileFormat = e.format), this._currentURL = n, this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.loading = true, this.timeVarying = false, this.isReady = false, this.$_searchIndex.removeAll(), this.hideRegionTooltip(), this.$module.setDownloadErrorCallback(
        this.downloadErrorCallback()
      ), this.$module.setFinishDownloadCallback(
        this.setURLFinishCallback({
          background: e == null ? void 0 : e.background,
          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
        })
      ), this.fileFormat === "gltf" ? this.$module.loadGLTFFromURL(n, "scene", true) : this.$module.loadOrgansFromURL(
        n,
        void 0,
        void 0,
        "scene",
        void 0,
        true
      ), this.$module && this.$module.scene && (this.$module.scene.displayMarkers = this.displayMarkers, this.$module.scene.forcePickableObjectsUpdate = true, 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() {
      if (this.$refs.scaffoldContainer) {
        let n = this.$refs.scaffoldContainer.clientWidth;
        this.minimisedSlider = n < 812, this.minimisedSlider ? this.sliderPosition = this.drawerOpen ? "right" : "left" : this.sliderPosition = "";
      }
    },
    toggleRendering: function(n) {
      this.$module.zincRenderer && (n ? this.$module.zincRenderer.animate() : this.$module.zincRenderer.stopAnimate());
    },
    /**
     * @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, true, true), 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");
    }
  }
};
var GU = {
  ref: "scaffoldContainer",
  class: "scaffold-container",
  "element-loading-text": "Loading...",
  "element-loading-background": "rgba(0, 0, 0, 0.3)"
};
var HU = { class: "primitive-controls-box" };
var WU = { class: "animation-data" };
var jU = { class: "purple" };
var $U = { class: "animation-data" };
var ZU = { class: "purple" };
var XU = { class: "animation-data" };
var YU = { class: "bottom-right-control" };
var JU = { style: { "margin-bottom": "2px" } };
var KU = {
  key: 0,
  class: "viewing-mode-title"
};
var qU = ["onClick"];
var QU = ["onClick"];
function e4(n, e, t, i, r, s) {
  const o = resolveComponent("map-svg-sprite-color"), a = Gw, c = resolveComponent("DrawToolbar"), l = P0, d = Ot, h4 = Mu, f = Fw, g = Bw, p = resolveComponent("map-svg-icon"), u = si, y = Vi, v = Oy, m = aa, x = oa, M = Py, T = sa, w = vd;
  return withDirectives((openBlock(), createElementBlock("div", GU, [
    createVNode(o),
    createVNode(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,
      onConfirmCreate: e[0] || (e[0] = (_) => s.confirmCreate(_)),
      onCancelCreate: e[1] || (e[1] = (_) => s.cancelCreate()),
      onConfirmDelete: e[2] || (e[2] = (_) => s.confirmDelete()),
      onTooltipHide: e[3] || (e[3] = (_) => s.onTooltipHide())
    }, null, 8, ["createData", "label", "region", "visible", "x", "y", "annotationDisplay"]),
    createBaseVNode("div", {
      id: "organsDisplayArea",
      ref: "display",
      tabindex: "-1",
      style: { height: "100%", width: "100%" },
      onKeydown: e[4] || (e[4] = withKeys((..._) => s.backgroundChangeCallback && s.backgroundChangeCallback(..._), ["66"]))
    }, null, 544),
    withDirectives(createBaseVNode("div", null, [
      n.viewingMode === "Annotation" && (n.userInformation || t.enableLocalAnnotations) ? (openBlock(), createBlock(c, {
        key: 0,
        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"])) : createCommentVNode("", true),
      t.displayWarning ? (openBlock(), createBlock(h4, {
        key: 1,
        ref: "warningPopover",
        visible: n.hoverVisibilities[7].value,
        content: t.warningMessage,
        placement: "right",
        width: "max-content",
        teleported: false,
        "popper-class": "scaffold-popper message-popper right-popper non-selectable"
      }, {
        reference: withCtx(() => [
          t.displayWarning ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "message-icon warning-icon",
            onMouseover: e[5] || (e[5] = (_) => s.showHelpText(7)),
            onMouseout: e[6] || (e[6] = (_) => s.hideHelpText(7))
          }, [
            createVNode(d, null, {
              default: withCtx(() => [
                createVNode(l)
              ]),
              _: 1
            }),
            e[26] || (e[26] = createBaseVNode("span", { class: "message-text" }, "Beta", -1))
          ], 32)) : createCommentVNode("", true)
        ]),
        _: 1
      }, 8, ["visible", "content"])) : createCommentVNode("", true),
      t.displayLatestChanges ? (openBlock(), createBlock(h4, {
        key: 2,
        visible: n.hoverVisibilities[8].value,
        content: t.latestChangesMessage,
        placement: "right",
        teleported: false,
        trigger: "manual",
        "popper-class": "scaffold-popper message-popper right-popper non-selectable",
        ref: "whatsNewPopover"
      }, {
        reference: withCtx(() => [
          t.displayLatestChanges && t.latestChangesMessage ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: "el-icon-warning message-icon latest-changesicon",
            onMouseover: e[7] || (e[7] = (_) => s.showHelpText(8)),
            onMouseout: e[8] || (e[8] = (_) => s.hideHelpText(8))
          }, [
            createVNode(d, null, {
              default: withCtx(() => [
                createVNode(l)
              ]),
              _: 1
            }),
            e[27] || (e[27] = createBaseVNode("span", { class: "message-text" }, "What's new?", -1))
          ], 32)) : createCommentVNode("", true)
        ]),
        _: 1
      }, 8, ["visible", "content"])) : createCommentVNode("", true),
      createVNode(h4, {
        visible: n.hoverVisibilities[6].value,
        content: "Change region visibility",
        placement: "right",
        width: "max-content",
        teleported: false,
        trigger: "manual",
        "popper-class": "scaffold-popper right-popper non-selectable",
        ref: "regionVisibilityPopover"
      }, {
        reference: withCtx(() => [
          createVNode(f, {
            ref: "scaffoldTreeControls",
            isReady: n.isReady,
            "show-colour-picker": t.showColourPicker,
            onObjectSelected: s.objectSelected,
            onObjectHovered: s.objectHovered,
            onDrawerToggled: s.drawerToggled
          }, null, 8, ["isReady", "show-colour-picker", "onObjectSelected", "onObjectHovered", "onDrawerToggled"])
        ]),
        _: 1
      }, 8, ["visible"]),
      createBaseVNode("div", HU, [
        createVNode(g, {
          ref: "primitiveControls",
          createData: n.createData,
          onPrimitivesUpdated: s.primitivesUpdated
        }, null, 8, ["createData", "onPrimitivesUpdated"])
      ]),
      n.timeVarying ? (openBlock(), createBlock(h4, {
        key: 3,
        ref: "sliderPopover",
        width: "max-content",
        visible: n.hoverVisibilities[5].value,
        content: "Move the slider to animate the region",
        placement: "top",
        teleported: false,
        trigger: "manual",
        "popper-class": "scaffold-popper top-popper non-selectable"
      }, {
        reference: withCtx(() => [
          n.timeVarying ? (openBlock(), createElementBlock("div", {
            key: 0,
            class: normalizeClass(["time-slider-container", [n.minimisedSlider ? "minimised" : "", n.sliderPosition]])
          }, [
            createVNode(M, { type: "card" }, {
              default: withCtx(() => [
                createVNode(v, { label: "Animate scaffold" }, {
                  default: withCtx(() => [
                    createVNode(y, { class: "tab-content" }, {
                      default: withCtx(() => [
                        n.isPlaying ? (openBlock(), createBlock(p, {
                          key: 0,
                          icon: "pause",
                          class: "icon-button video-button",
                          onClick: e[9] || (e[9] = (_) => s.play(false))
                        })) : (openBlock(), createBlock(p, {
                          key: 1,
                          icon: "play",
                          class: "video-button icon-button",
                          onClick: e[10] || (e[10] = (_) => s.play(true))
                        })),
                        createVNode(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[11] || (e[11] = (_) => s.timeChange(_))
                        }, null, 8, ["max", "model-value", "format-tooltip", "marks"])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                }),
                createVNode(v, { label: "Animation data" }, {
                  default: withCtx(() => [
                    createVNode(y, { class: "tab-content" }, {
                      default: withCtx(() => [
                        createBaseVNode("div", WU, [
                          e[28] || (e[28] = createTextVNode(" Original duration: ")),
                          createBaseVNode("div", jU, toDisplayString(n.orginalDuration), 1)
                        ]),
                        createBaseVNode("div", $U, [
                          e[29] || (e[29] = createTextVNode(" Animation duration: ")),
                          createBaseVNode("div", ZU, toDisplayString(n.animateDuration), 1)
                        ]),
                        createBaseVNode("div", XU, [
                          e[30] || (e[30] = createTextVNode(" Playback speed ")),
                          createVNode(x, {
                            teleported: true,
                            "model-value": n.currentSpeed,
                            placeholder: "Select",
                            class: "scaffold-select-box speed",
                            "popper-class": "scaffold_viewer_dropdown",
                            onChange: e[12] || (e[12] = (_) => s.speedChanged(_))
                          }, {
                            default: withCtx(() => [
                              (openBlock(true), createElementBlock(Fragment, null, renderList(n.playSpeed, (_) => (openBlock(), createBlock(m, {
                                key: _.value,
                                label: _.label,
                                value: _.value
                              }, null, 8, ["label", "value"]))), 128))
                            ]),
                            _: 1
                          }, 8, ["model-value"])
                        ])
                      ]),
                      _: 1
                    })
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ], 2)) : createCommentVNode("", true)
        ]),
        _: 1
      }, 8, ["visible"])) : createCommentVNode("", true),
      createBaseVNode("div", YU, [
        createVNode(h4, {
          visible: n.hoverVisibilities[0].value,
          content: "Zoom in",
          width: "max-content",
          placement: "left",
          teleported: false,
          trigger: "manual",
          "popper-class": "scaffold-popper left-popper non-selectable",
          ref: "zoomInPopover"
        }, {
          reference: withCtx(() => [
            createVNode(p, {
              icon: "zoomIn",
              class: "icon-button zoomIn",
              onClick: e[13] || (e[13] = (_) => s.zoomIn()),
              onMouseover: e[14] || (e[14] = (_) => s.showHelpText(0)),
              onMouseout: e[15] || (e[15] = (_) => s.hideHelpText(0))
            })
          ]),
          _: 1
        }, 8, ["visible"]),
        createVNode(h4, {
          visible: n.hoverVisibilities[1].value,
          content: "Zoom out",
          placement: "top-end",
          width: "max-content",
          teleported: false,
          trigger: "manual",
          "popper-class": "scaffold-popper popper-zoomout non-selectable",
          ref: "zoomOutPopover"
        }, {
          reference: withCtx(() => [
            createVNode(p, {
              icon: "zoomOut",
              class: "icon-button zoomOut",
              onClick: e[16] || (e[16] = (_) => s.zoomOut()),
              onMouseover: e[17] || (e[17] = (_) => s.showHelpText(1)),
              onMouseout: e[18] || (e[18] = (_) => s.hideHelpText(1))
            })
          ]),
          _: 1
        }, 8, ["visible"]),
        createVNode(h4, {
          visible: n.hoverVisibilities[2].value,
          placement: "top",
          teleported: false,
          trigger: "manual",
          width: "max-content",
          "popper-class": "scaffold-popper non-selectable",
          ref: "zoomFitPopover"
        }, {
          reference: withCtx(() => [
            createVNode(p, {
              icon: "fitWindow",
              class: "icon-button fitWindow",
              onClick: e[19] || (e[19] = (_) => s.fitWindow()),
              onMouseover: e[20] || (e[20] = (_) => s.showHelpText(2)),
              onMouseout: e[21] || (e[21] = (_) => s.hideHelpText(2))
            })
          ]),
          default: withCtx(() => [
            e[31] || (e[31] = createBaseVNode("div", null, [
              createTextVNode(" Fit to "),
              createBaseVNode("br"),
              createTextVNode(" window ")
            ], -1))
          ]),
          _: 1
        }, 8, ["visible"])
      ]),
      n.openMapRef ? (openBlock(), createBlock(h4, {
        key: 4,
        ref: "open-map-popover",
        "virtual-ref": n.openMapRef,
        placement: "top-start",
        width: "128",
        teleported: false,
        trigger: "click",
        "popper-class": "open-map-popper",
        "virtual-triggering": ""
      }, {
        default: withCtx(() => [
          (openBlock(true), createElementBlock(Fragment, null, renderList(t.openMapOptions, (_) => (openBlock(), createBlock(y, {
            key: _.key
          }, {
            default: withCtx(() => [
              createVNode(T, {
                type: "primary",
                plain: "",
                onClick: (E) => n.$emit("open-map", _.key)
              }, {
                default: withCtx(() => [
                  createTextVNode(toDisplayString(_.display), 1)
                ]),
                _: 2
              }, 1032, ["onClick"])
            ]),
            _: 2
          }, 1024))), 128))
        ]),
        _: 1
      }, 8, ["virtual-ref"])) : createCommentVNode("", true),
      createVNode(h4, {
        ref: "backgroundPopover",
        "virtual-ref": n.backgroundIconRef,
        placement: "top-start",
        width: "128",
        teleported: false,
        trigger: "click",
        "popper-class": "background-popper non-selectable h-auto",
        "virtual-triggering": ""
      }, {
        default: withCtx(() => [
          createBaseVNode("div", null, [
            createVNode(y, { class: "backgroundText" }, {
              default: withCtx(() => e[32] || (e[32] = [
                createTextVNode("Viewing Mode")
              ])),
              _: 1
            }),
            createVNode(y, { class: "backgroundControl" }, {
              default: withCtx(() => [
                createBaseVNode("div", JU, [
                  (openBlock(true), createElementBlock(Fragment, null, renderList(n.viewingModes, (_, E, P) => (openBlock(), createElementBlock(Fragment, { key: E }, [
                    E === n.viewingMode ? (openBlock(), createElementBlock("span", KU, [
                      createBaseVNode("b", null, toDisplayString(E), 1)
                    ])) : (openBlock(), createElementBlock("span", {
                      key: 1,
                      class: "viewing-mode-unselected",
                      onClick: (S) => s.changeViewingMode(E)
                    }, toDisplayString(E), 9, qU))
                  ], 64))), 128))
                ]),
                createVNode(y, { class: "viewing-mode-description" }, {
                  default: withCtx(() => [
                    createTextVNode(toDisplayString(s.modeDescription), 1)
                  ]),
                  _: 1
                })
              ]),
              _: 1
            }),
            createVNode(y, { class: "backgroundSpacer" }),
            createVNode(y, { class: "backgroundText" }, {
              default: withCtx(() => e[33] || (e[33] = [
                createTextVNode(" Change background ")
              ])),
              _: 1
            }),
            createVNode(y, { class: "backgroundChooser" }, {
              default: withCtx(() => [
                (openBlock(true), createElementBlock(Fragment, null, renderList(n.availableBackground, (_) => (openBlock(), createElementBlock("div", {
                  key: _,
                  class: normalizeClass([
                    "backgroundChoice",
                    _,
                    _ == n.currentBackground ? "active" : ""
                  ]),
                  onClick: (E) => s.backgroundChangeCallback(_)
                }, null, 10, QU))), 128))
              ]),
              _: 1
            })
          ])
        ]),
        _: 1
      }, 8, ["virtual-ref"]),
      createBaseVNode("div", {
        class: normalizeClass(["settings-group", { open: n.drawerOpen, close: !n.drawerOpen }])
      }, [
        createVNode(y, null, {
          default: withCtx(() => [
            createVNode(h4, {
              visible: n.hoverVisibilities[3].value,
              content: "Open new map",
              placement: "right",
              teleported: false,
              trigger: "manual",
              width: "max-content",
              "popper-class": "scaffold-popper right-popper non-selectable",
              ref: "openMapPopover"
            }, {
              reference: withCtx(() => [
                t.enableOpenMapUI && t.openMapOptions.length > 0 ? (openBlock(), createBlock(p, {
                  key: 0,
                  ref: "openMapRef",
                  icon: "openMap",
                  class: "icon-button open-map-button",
                  onMouseover: e[22] || (e[22] = (_) => s.showHelpText(3)),
                  onMouseout: e[23] || (e[23] = (_) => s.hideHelpText(3))
                }, null, 512)) : createCommentVNode("", true)
              ]),
              _: 1
            }, 8, ["visible"])
          ]),
          _: 1
        }),
        createVNode(y, null, {
          default: withCtx(() => [
            createVNode(h4, {
              visible: n.hoverVisibilities[4].value,
              content: "Change background color",
              placement: "right",
              width: "max-content",
              teleported: false,
              trigger: "manual",
              "popper-class": "scaffold-popper right-popper non-selectable",
              ref: "settingsPopover"
            }, {
              reference: withCtx(() => [
                createVNode(p, {
                  ref: "backgroundIconRef",
                  icon: "changeBckgd",
                  class: "icon-button",
                  onMouseover: e[24] || (e[24] = (_) => s.showHelpText(4)),
                  onMouseout: e[25] || (e[25] = (_) => s.hideHelpText(4))
                }, null, 512)
              ]),
              _: 1
            }, 8, ["visible"])
          ]),
          _: 1
        })
      ], 2)
    ], 512), [
      [vShow, t.displayUI && !n.isTransitioning]
    ])
  ])), [
    [w, n.loading]
  ]);
}
var r4 = xr(kU, [["render", e4], ["__scopeId", "data-v-3f6a68de"]]);
export {
  r4 as ScaffoldVuer
};
/*! Bundled license information:

@abi-software/scaffoldvuer/dist/scaffoldvuer.js:
  (**
  * @vue/shared v3.5.13
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
  * @license MIT
  **)
  (*! Element Plus Icons Vue v2.3.1 *)
  (**
   * @license
   * Copyright 2010-2021 Three.js Authors
   * SPDX-License-Identifier: MIT
   *)
  (*!
   * pinia v2.2.1
   * (c) 2024 Eduardo San Martin Morote
   * @license MIT
   *)
  (*! js-cookie v3.0.5 | MIT *)
*/
//# sourceMappingURL=@abi-software_scaffoldvuer.js.map