import { shallowRef as En, watchEffect as Nv, readonly as Bv, unref as z, getCurrentScope as NM, onScopeDispose as BM, getCurrentInstance as dn, onMounted as Jt, nextTick as bt, watch as Qe, ref as Te, defineComponent as Pe, openBlock as ve, createElementBlock as Le, createElementVNode as Ne, warn as UM, isVNode as Uh, computed as ue, inject as pt, isRef as Zc, onBeforeUnmount as ei, onBeforeMount as zM, provide as sn, mergeProps as Ei, renderSlot as je, toRef as hi, onUnmounted as Uv, useAttrs as VM, useSlots as Xc, createCommentVNode as Ve, Fragment as Pt, normalizeClass as Ee, createBlock as ke, withCtx as de, resolveDynamicComponent as Fn, withModifiers as Ut, createVNode as oe, toDisplayString as vt, normalizeStyle as Rt, Transition as el, withDirectives as Lt, vShow as mn, reactive as Wn, onActivated as kM, onUpdated as zd, cloneVNode as GM, Text as zv, Comment as HM, Teleport as WM, onDeactivated as jM, vModelRadio as Vv, createTextVNode as rt, toRefs as Br, toHandlers as $M, withKeys as ui, createSlots as ZM, toRaw as kv, resolveComponent as kn, resolveDirective as XM, toHandlerKey as YM, renderList as Jn, vModelText as JM, h as ho, createApp as KM, markRaw as An } from "vue"; import { TreeControls as qM, CreateTooltipContent as QM, Tooltip as ew, DrawToolbar as tw } from "@abi-software/map-utilities"; import { defineStore as nw, mapState as Gv, mapStores as iw } from "pinia"; import { MapSvgIcon as rw, MapSvgSpriteColor as sw } from "@abi-software/svg-sprite"; import { AnnotationService as ow } from "@abi-software/sparc-annotation"; const Yi = (n, e, { checkForDefaultPrevented: t = !0 } = {}) => (r) => { const s = n == null ? void 0 : n(r); if (t === !1 || !s) return e == null ? void 0 : e(r); }; var aw = Object.defineProperty, lw = Object.defineProperties, cw = Object.getOwnPropertyDescriptors, bp = Object.getOwnPropertySymbols, uw = Object.prototype.hasOwnProperty, hw = Object.prototype.propertyIsEnumerable, xp = (n, e, t) => e in n ? aw(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, dw = (n, e) => { for (var t in e || (e = {})) uw.call(e, t) && xp(n, t, e[t]); if (bp) for (var t of bp(e)) hw.call(e, t) && xp(n, t, e[t]); return n; }, fw = (n, e) => lw(n, cw(e)); function Mp(n, e) { var t; const i = En(); return Nv(() => { i.value = n(); }, fw(dw({}, e), { flush: (t = void 0) != null ? t : "sync" })), Bv(i); } var wp; const en = typeof window < "u", pw = (n) => typeof n == "string", Hv = () => { }, zh = en && ((wp = window == null ? void 0 : window.navigator) == null ? void 0 : wp.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function Wv(n) { return typeof n == "function" ? n() : z(n); } function mw(n) { return n; } function Yc(n) { return NM() ? (BM(n), !0) : !1; } function gw(n, e = !0) { dn() ? Jt(n) : e ? n() : bt(n); } function Qi(n) { var e; const t = Wv(n); return (e = t == null ? void 0 : t.$el) != null ? e : t; } const tl = en ? window : void 0, vw = en ? window.document : void 0; function un(...n) { let e, t, i, r; if (pw(n[0]) || Array.isArray(n[0]) ? ([t, i, r] = n, e = tl) : [e, t, i, r] = n, !e) return Hv; Array.isArray(t) || (t = [t]), Array.isArray(i) || (i = [i]); const s = [], o = () => { s.forEach((d) => d()), s.length = 0; }, a = (d, h, f, g) => (d.addEventListener(h, f, g), () => d.removeEventListener(h, f, g)), c = Qe(() => [Qi(e), Wv(r)], ([d, h]) => { o(), d && s.push(...t.flatMap((f) => i.map((g) => a(d, f, g, h)))); }, { immediate: !0, flush: "post" }), l = () => { c(), o(); }; return Yc(l), l; } let Ap = !1; function yw(n, e, t = {}) { const { window: i = tl, ignore: r = [], capture: s = !0, detectIframe: o = !1 } = t; if (!i) return; zh && !Ap && (Ap = !0, Array.from(i.document.body.children).forEach((f) => f.addEventListener("click", Hv))); let a = !0; const c = (f) => r.some((g) => { if (typeof g == "string") return Array.from(i.document.querySelectorAll(g)).some((p) => p === f.target || f.composedPath().includes(p)); { const p = Qi(g); return p && (f.target === p || f.composedPath().includes(p)); } }), d = [ un(i, "click", (f) => { const g = Qi(n); if (!(!g || g === f.target || f.composedPath().includes(g))) { if (f.detail === 0 && (a = !c(f)), !a) { a = !0; return; } e(f); } }, { passive: !0, capture: s }), un(i, "pointerdown", (f) => { const g = Qi(n); g && (a = !f.composedPath().includes(g) && !c(f)); }, { passive: !0 }), o && un(i, "blur", (f) => { var g; const p = Qi(n); ((g = i.document.activeElement) == null ? void 0 : g.tagName) === "IFRAME" && !(p != null && p.contains(i.document.activeElement)) && e(f); }) ].filter(Boolean); return () => d.forEach((f) => f()); } function jv(n, e = !1) { const t = Te(), i = () => t.value = !!n(); return i(), gw(i, e), t; } const Sp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _p = "__vueuse_ssr_handlers__"; Sp[_p] = Sp[_p] || {}; function bw({ document: n = vw } = {}) { if (!n) return Te("visible"); const e = Te(n.visibilityState); return un(n, "visibilitychange", () => { e.value = n.visibilityState; }), e; } var Tp = Object.getOwnPropertySymbols, xw = Object.prototype.hasOwnProperty, Mw = Object.prototype.propertyIsEnumerable, ww = (n, e) => { var t = {}; for (var i in n) xw.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]); if (n != null && Tp) for (var i of Tp(n)) e.indexOf(i) < 0 && Mw.call(n, i) && (t[i] = n[i]); return t; }; function Yn(n, e, t = {}) { const i = t, { window: r = tl } = i, s = ww(i, ["window"]); let o; const a = jv(() => r && "ResizeObserver" in r), c = () => { o && (o.disconnect(), o = void 0); }, l = Qe(() => Qi(n), (h) => { c(), a.value && r && h && (o = new ResizeObserver(e), o.observe(h, s)); }, { immediate: !0, flush: "post" }), d = () => { c(), l(); }; return Yc(d), { isSupported: a, stop: d }; } var Ep = Object.getOwnPropertySymbols, Aw = Object.prototype.hasOwnProperty, Sw = Object.prototype.propertyIsEnumerable, _w = (n, e) => { var t = {}; for (var i in n) Aw.call(n, i) && e.indexOf(i) < 0 && (t[i] = n[i]); if (n != null && Ep) for (var i of Ep(n)) e.indexOf(i) < 0 && Sw.call(n, i) && (t[i] = n[i]); return t; }; function Tw(n, e, t = {}) { const i = t, { window: r = tl } = i, s = _w(i, ["window"]); let o; const a = jv(() => r && "MutationObserver" in r), c = () => { o && (o.disconnect(), o = void 0); }, l = Qe(() => Qi(n), (h) => { c(), a.value && r && h && (o = new MutationObserver(e), o.observe(h, s)); }, { immediate: !0 }), d = () => { c(), l(); }; return Yc(d), { isSupported: a, stop: d }; } var Cp; (function(n) { n.UP = "UP", n.RIGHT = "RIGHT", n.DOWN = "DOWN", n.LEFT = "LEFT", n.NONE = "NONE"; })(Cp || (Cp = {})); var Ew = Object.defineProperty, Lp = Object.getOwnPropertySymbols, Cw = Object.prototype.hasOwnProperty, Lw = Object.prototype.propertyIsEnumerable, Rp = (n, e, t) => e in n ? Ew(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, Rw = (n, e) => { for (var t in e || (e = {})) Cw.call(e, t) && Rp(n, t, e[t]); if (Lp) for (var t of Lp(e)) Lw.call(e, t) && Rp(n, t, e[t]); return n; }; const Fw = { 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] }; Rw({ linear: mw }, Fw); function Pw({ window: n = tl } = {}) { if (!n) return Te(!1); const e = Te(n.document.hasFocus()); return un(n, "blur", () => { e.value = !1; }), un(n, "focus", () => { e.value = !0; }), e; } const Iw = () => en && /firefox/i.test(window.navigator.userAgent); /** * @vue/shared v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ process.env.NODE_ENV !== "production" && Object.freeze({}); process.env.NODE_ENV !== "production" && Object.freeze([]); const Oa = () => { }, Ow = Object.prototype.hasOwnProperty, Fp = (n, e) => Ow.call(n, e), Pn = Array.isArray, Sn = (n) => typeof n == "function", vn = (n) => typeof n == "string", Tn = (n) => n !== null && typeof n == "object", Dw = Object.prototype.toString, Nw = (n) => Dw.call(n), Pu = (n) => Nw(n).slice(8, -1), Vd = (n) => { const e = /* @__PURE__ */ Object.create(null); return (t) => e[t] || (e[t] = n(t)); }, Bw = /-(\w)/g, Uw = Vd( (n) => n.replace(Bw, (e, t) => t ? t.toUpperCase() : "") ), zw = /\B([A-Z])/g, Vw = Vd( (n) => n.replace(zw, "-$1").toLowerCase() ), kw = Vd((n) => n.charAt(0).toUpperCase() + n.slice(1)); var $v = typeof global == "object" && global && global.Object === Object && global, Gw = typeof self == "object" && self && self.Object === Object && self, Bi = $v || Gw || Function("return this")(), Pi = Bi.Symbol, Zv = Object.prototype, Hw = Zv.hasOwnProperty, Ww = Zv.toString, la = Pi ? Pi.toStringTag : void 0; function jw(n) { var e = Hw.call(n, la), t = n[la]; try { n[la] = void 0; var i = !0; } catch { } var r = Ww.call(n); return i && (e ? n[la] = t : delete n[la]), r; } var $w = Object.prototype, Zw = $w.toString; function Xw(n) { return Zw.call(n); } var Yw = "[object Null]", Jw = "[object Undefined]", Pp = Pi ? Pi.toStringTag : void 0; function Zo(n) { return n == null ? n === void 0 ? Jw : Yw : Pp && Pp in Object(n) ? jw(n) : Xw(n); } function Mo(n) { return n != null && typeof n == "object"; } var Kw = "[object Symbol]"; function Jc(n) { return typeof n == "symbol" || Mo(n) && Zo(n) == Kw; } function qw(n, e) { for (var t = -1, i = n == null ? 0 : n.length, r = Array(i); ++t < i; ) r[t] = e(n[t], t, n); return r; } var pi = Array.isArray, Qw = 1 / 0, Ip = Pi ? Pi.prototype : void 0, Op = Ip ? Ip.toString : void 0; function Xv(n) { if (typeof n == "string") return n; if (pi(n)) return qw(n, Xv) + ""; if (Jc(n)) return Op ? Op.call(n) : ""; var e = n + ""; return e == "0" && 1 / n == -Qw ? "-0" : e; } var e1 = /\s/; function t1(n) { for (var e = n.length; e-- && e1.test(n.charAt(e)); ) ; return e; } var n1 = /^\s+/; function i1(n) { return n && n.slice(0, t1(n) + 1).replace(n1, ""); } function Ur(n) { var e = typeof n; return n != null && (e == "object" || e == "function"); } var Dp = NaN, r1 = /^[-+]0x[0-9a-f]+$/i, s1 = /^0b[01]+$/i, o1 = /^0o[0-7]+$/i, a1 = parseInt; function Np(n) { if (typeof n == "number") return n; if (Jc(n)) return Dp; if (Ur(n)) { var e = typeof n.valueOf == "function" ? n.valueOf() : n; n = Ur(e) ? e + "" : e; } if (typeof n != "string") return n === 0 ? n : +n; n = i1(n); var t = s1.test(n); return t || o1.test(n) ? a1(n.slice(2), t ? 2 : 8) : r1.test(n) ? Dp : +n; } function Yv(n) { return n; } var l1 = "[object AsyncFunction]", c1 = "[object Function]", u1 = "[object GeneratorFunction]", h1 = "[object Proxy]"; function Jv(n) { if (!Ur(n)) return !1; var e = Zo(n); return e == c1 || e == u1 || e == l1 || e == h1; } var Iu = Bi["__core-js_shared__"], Bp = function() { var n = /[^.]+$/.exec(Iu && Iu.keys && Iu.keys.IE_PROTO || ""); return n ? "Symbol(src)_1." + n : ""; }(); function d1(n) { return !!Bp && Bp in n; } var f1 = Function.prototype, p1 = f1.toString; function Os(n) { if (n != null) { try { return p1.call(n); } catch { } try { return n + ""; } catch { } } return ""; } var m1 = /[\\^$.*+?()[\]{}|]/g, g1 = /^\[object .+?Constructor\]$/, v1 = Function.prototype, y1 = Object.prototype, b1 = v1.toString, x1 = y1.hasOwnProperty, M1 = RegExp( "^" + b1.call(x1).replace(m1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function w1(n) { if (!Ur(n) || d1(n)) return !1; var e = Jv(n) ? M1 : g1; return e.test(Os(n)); } function A1(n, e) { return n == null ? void 0 : n[e]; } function Ds(n, e) { var t = A1(n, e); return w1(t) ? t : void 0; } var Vh = Ds(Bi, "WeakMap"); function S1(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 _1 = 800, T1 = 16, E1 = Date.now; function C1(n) { var e = 0, t = 0; return function() { var i = E1(), r = T1 - (i - t); if (t = i, r > 0) { if (++e >= _1) return arguments[0]; } else e = 0; return n.apply(void 0, arguments); }; } function L1(n) { return function() { return n; }; } var Fc = function() { try { var n = Ds(Object, "defineProperty"); return n({}, "", {}), n; } catch { } }(), R1 = Fc ? function(n, e) { return Fc(n, "toString", { configurable: !0, enumerable: !1, value: L1(e), writable: !0 }); } : Yv, F1 = C1(R1); function P1(n, e, t, i) { n.length; for (var r = t + 1; r--; ) if (e(n[r], r, n)) return r; return -1; } var I1 = 9007199254740991, O1 = /^(?:0|[1-9]\d*)$/; function kd(n, e) { var t = typeof n; return e = e ?? I1, !!e && (t == "number" || t != "symbol" && O1.test(n)) && n > -1 && n % 1 == 0 && n < e; } function D1(n, e, t) { e == "__proto__" && Fc ? Fc(n, e, { configurable: !0, enumerable: !0, value: t, writable: !0 }) : n[e] = t; } function Gd(n, e) { return n === e || n !== n && e !== e; } var N1 = Object.prototype, B1 = N1.hasOwnProperty; function U1(n, e, t) { var i = n[e]; (!(B1.call(n, e) && Gd(i, t)) || t === void 0 && !(e in n)) && D1(n, e, t); } var Up = Math.max; function z1(n, e, t) { return e = Up(e === void 0 ? n.length - 1 : e, 0), function() { for (var i = arguments, r = -1, s = Up(i.length - e, 0), o = Array(s); ++r < s; ) o[r] = i[e + r]; r = -1; for (var a = Array(e + 1); ++r < e; ) a[r] = i[r]; return a[e] = t(o), S1(n, this, a); }; } var V1 = 9007199254740991; function Hd(n) { return typeof n == "number" && n > -1 && n % 1 == 0 && n <= V1; } function k1(n) { return n != null && Hd(n.length) && !Jv(n); } var G1 = Object.prototype; function H1(n) { var e = n && n.constructor, t = typeof e == "function" && e.prototype || G1; return n === t; } function W1(n, e) { for (var t = -1, i = Array(n); ++t < n; ) i[t] = e(t); return i; } var j1 = "[object Arguments]"; function zp(n) { return Mo(n) && Zo(n) == j1; } var Kv = Object.prototype, $1 = Kv.hasOwnProperty, Z1 = Kv.propertyIsEnumerable, Wd = zp(/* @__PURE__ */ function() { return arguments; }()) ? zp : function(n) { return Mo(n) && $1.call(n, "callee") && !Z1.call(n, "callee"); }; function X1() { return !1; } var qv = typeof exports == "object" && exports && !exports.nodeType && exports, Vp = qv && typeof module == "object" && module && !module.nodeType && module, Y1 = Vp && Vp.exports === qv, kp = Y1 ? Bi.Buffer : void 0, J1 = kp ? kp.isBuffer : void 0, kh = J1 || X1, K1 = "[object Arguments]", q1 = "[object Array]", Q1 = "[object Boolean]", eA = "[object Date]", tA = "[object Error]", nA = "[object Function]", iA = "[object Map]", rA = "[object Number]", sA = "[object Object]", oA = "[object RegExp]", aA = "[object Set]", lA = "[object String]", cA = "[object WeakMap]", uA = "[object ArrayBuffer]", hA = "[object DataView]", dA = "[object Float32Array]", fA = "[object Float64Array]", pA = "[object Int8Array]", mA = "[object Int16Array]", gA = "[object Int32Array]", vA = "[object Uint8Array]", yA = "[object Uint8ClampedArray]", bA = "[object Uint16Array]", xA = "[object Uint32Array]", Et = {}; Et[dA] = Et[fA] = Et[pA] = Et[mA] = Et[gA] = Et[vA] = Et[yA] = Et[bA] = Et[xA] = !0; Et[K1] = Et[q1] = Et[uA] = Et[Q1] = Et[hA] = Et[eA] = Et[tA] = Et[nA] = Et[iA] = Et[rA] = Et[sA] = Et[oA] = Et[aA] = Et[lA] = Et[cA] = !1; function MA(n) { return Mo(n) && Hd(n.length) && !!Et[Zo(n)]; } function wA(n) { return function(e) { return n(e); }; } var Qv = typeof exports == "object" && exports && !exports.nodeType && exports, Ea = Qv && typeof module == "object" && module && !module.nodeType && module, AA = Ea && Ea.exports === Qv, Ou = AA && $v.process, Gp = function() { try { var n = Ea && Ea.require && Ea.require("util").types; return n || Ou && Ou.binding && Ou.binding("util"); } catch { } }(), Hp = Gp && Gp.isTypedArray, e0 = Hp ? wA(Hp) : MA, SA = Object.prototype, _A = SA.hasOwnProperty; function TA(n, e) { var t = pi(n), i = !t && Wd(n), r = !t && !i && kh(n), s = !t && !i && !r && e0(n), o = t || i || r || s, a = o ? W1(n.length, String) : [], c = a.length; for (var l in n) _A.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. kd(l, c))) && a.push(l); return a; } function EA(n, e) { return function(t) { return n(e(t)); }; } var CA = EA(Object.keys, Object), LA = Object.prototype, RA = LA.hasOwnProperty; function FA(n) { if (!H1(n)) return CA(n); var e = []; for (var t in Object(n)) RA.call(n, t) && t != "constructor" && e.push(t); return e; } function t0(n) { return k1(n) ? TA(n) : FA(n); } var PA = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, IA = /^\w*$/; function jd(n, e) { if (pi(n)) return !1; var t = typeof n; return t == "number" || t == "symbol" || t == "boolean" || n == null || Jc(n) ? !0 : IA.test(n) || !PA.test(n) || e != null && n in Object(e); } var Da = Ds(Object, "create"); function OA() { this.__data__ = Da ? Da(null) : {}, this.size = 0; } function DA(n) { var e = this.has(n) && delete this.__data__[n]; return this.size -= e ? 1 : 0, e; } var NA = "__lodash_hash_undefined__", BA = Object.prototype, UA = BA.hasOwnProperty; function zA(n) { var e = this.__data__; if (Da) { var t = e[n]; return t === NA ? void 0 : t; } return UA.call(e, n) ? e[n] : void 0; } var VA = Object.prototype, kA = VA.hasOwnProperty; function GA(n) { var e = this.__data__; return Da ? e[n] !== void 0 : kA.call(e, n); } var HA = "__lodash_hash_undefined__"; function WA(n, e) { var t = this.__data__; return this.size += this.has(n) ? 0 : 1, t[n] = Da && e === void 0 ? HA : e, this; } function _s(n) { var e = -1, t = n == null ? 0 : n.length; for (this.clear(); ++e < t; ) { var i = n[e]; this.set(i[0], i[1]); } } _s.prototype.clear = OA; _s.prototype.delete = DA; _s.prototype.get = zA; _s.prototype.has = GA; _s.prototype.set = WA; function jA() { this.__data__ = [], this.size = 0; } function Kc(n, e) { for (var t = n.length; t--; ) if (Gd(n[t][0], e)) return t; return -1; } var $A = Array.prototype, ZA = $A.splice; function XA(n) { var e = this.__data__, t = Kc(e, n); if (t < 0) return !1; var i = e.length - 1; return t == i ? e.pop() : ZA.call(e, t, 1), --this.size, !0; } function YA(n) { var e = this.__data__, t = Kc(e, n); return t < 0 ? void 0 : e[t][1]; } function JA(n) { return Kc(this.__data__, n) > -1; } function KA(n, e) { var t = this.__data__, i = Kc(t, n); return i < 0 ? (++this.size, t.push([n, e])) : t[i][1] = e, this; } function lr(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]); } } lr.prototype.clear = jA; lr.prototype.delete = XA; lr.prototype.get = YA; lr.prototype.has = JA; lr.prototype.set = KA; var Na = Ds(Bi, "Map"); function qA() { this.size = 0, this.__data__ = { hash: new _s(), map: new (Na || lr)(), string: new _s() }; } function QA(n) { var e = typeof n; return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? n !== "__proto__" : n === null; } function qc(n, e) { var t = n.__data__; return QA(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map; } function eS(n) { var e = qc(this, n).delete(n); return this.size -= e ? 1 : 0, e; } function tS(n) { return qc(this, n).get(n); } function nS(n) { return qc(this, n).has(n); } function iS(n, e) { var t = qc(this, n), i = t.size; return t.set(n, e), this.size += t.size == i ? 0 : 1, this; } function cr(n) { var e = -1, t = n == null ? 0 : n.length; for (this.clear(); ++e < t; ) { var i = n[e]; this.set(i[0], i[1]); } } cr.prototype.clear = qA; cr.prototype.delete = eS; cr.prototype.get = tS; cr.prototype.has = nS; cr.prototype.set = iS; var rS = "Expected a function"; function $d(n, e) { if (typeof n != "function" || e != null && typeof e != "function") throw new TypeError(rS); var t = function() { var i = arguments, r = e ? e.apply(this, i) : i[0], s = t.cache; if (s.has(r)) return s.get(r); var o = n.apply(this, i); return t.cache = s.set(r, o) || s, o; }; return t.cache = new ($d.Cache || cr)(), t; } $d.Cache = cr; var sS = 500; function oS(n) { var e = $d(n, function(i) { return t.size === sS && t.clear(), i; }), t = e.cache; return e; } var aS = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, lS = /\\(\\)?/g, cS = oS(function(n) { var e = []; return n.charCodeAt(0) === 46 && e.push(""), n.replace(aS, function(t, i, r, s) { e.push(r ? s.replace(lS, "$1") : i || t); }), e; }); function uS(n) { return n == null ? "" : Xv(n); } function Qc(n, e) { return pi(n) ? n : jd(n, e) ? [n] : cS(uS(n)); } var hS = 1 / 0; function nl(n) { if (typeof n == "string" || Jc(n)) return n; var e = n + ""; return e == "0" && 1 / n == -hS ? "-0" : e; } function Zd(n, e) { e = Qc(e, n); for (var t = 0, i = e.length; n != null && t < i; ) n = n[nl(e[t++])]; return t && t == i ? n : void 0; } function Ji(n, e, t) { var i = n == null ? void 0 : Zd(n, e); return i === void 0 ? t : i; } function n0(n, e) { for (var t = -1, i = e.length, r = n.length; ++t < i; ) n[r + t] = e[t]; return n; } var Wp = Pi ? Pi.isConcatSpreadable : void 0; function dS(n) { return pi(n) || Wd(n) || !!(Wp && n && n[Wp]); } function fS(n, e, t, i, r) { var s = -1, o = n.length; for (t || (t = dS), r || (r = []); ++s < o; ) { var a = n[s]; t(a) ? n0(r, a) : r[r.length] = a; } return r; } function pS(n) { var e = n == null ? 0 : n.length; return e ? fS(n) : []; } function mS(n) { return F1(z1(n, void 0, pS), n + ""); } function Si() { if (!arguments.length) return []; var n = arguments[0]; return pi(n) ? n : [n]; } function gS() { this.__data__ = new lr(), this.size = 0; } function vS(n) { var e = this.__data__, t = e.delete(n); return this.size = e.size, t; } function yS(n) { return this.__data__.get(n); } function bS(n) { return this.__data__.has(n); } var xS = 200; function MS(n, e) { var t = this.__data__; if (t instanceof lr) { var i = t.__data__; if (!Na || i.length < xS - 1) return i.push([n, e]), this.size = ++t.size, this; t = this.__data__ = new cr(i); } return t.set(n, e), this.size = t.size, this; } function er(n) { var e = this.__data__ = new lr(n); this.size = e.size; } er.prototype.clear = gS; er.prototype.delete = vS; er.prototype.get = yS; er.prototype.has = bS; er.prototype.set = MS; function wS(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 AS() { return []; } var SS = Object.prototype, _S = SS.propertyIsEnumerable, jp = Object.getOwnPropertySymbols, TS = jp ? function(n) { return n == null ? [] : (n = Object(n), wS(jp(n), function(e) { return _S.call(n, e); })); } : AS; function ES(n, e, t) { var i = e(n); return pi(n) ? i : n0(i, t(n)); } function $p(n) { return ES(n, t0, TS); } var Gh = Ds(Bi, "DataView"), Hh = Ds(Bi, "Promise"), Wh = Ds(Bi, "Set"), Zp = "[object Map]", CS = "[object Object]", Xp = "[object Promise]", Yp = "[object Set]", Jp = "[object WeakMap]", Kp = "[object DataView]", LS = Os(Gh), RS = Os(Na), FS = Os(Hh), PS = Os(Wh), IS = Os(Vh), Cr = Zo; (Gh && Cr(new Gh(new ArrayBuffer(1))) != Kp || Na && Cr(new Na()) != Zp || Hh && Cr(Hh.resolve()) != Xp || Wh && Cr(new Wh()) != Yp || Vh && Cr(new Vh()) != Jp) && (Cr = function(n) { var e = Zo(n), t = e == CS ? n.constructor : void 0, i = t ? Os(t) : ""; if (i) switch (i) { case LS: return Kp; case RS: return Zp; case FS: return Xp; case PS: return Yp; case IS: return Jp; } return e; }); var qp = Bi.Uint8Array, OS = "__lodash_hash_undefined__"; function DS(n) { return this.__data__.set(n, OS), this; } function NS(n) { return this.__data__.has(n); } function Pc(n) { var e = -1, t = n == null ? 0 : n.length; for (this.__data__ = new cr(); ++e < t; ) this.add(n[e]); } Pc.prototype.add = Pc.prototype.push = DS; Pc.prototype.has = NS; function BS(n, e) { for (var t = -1, i = n == null ? 0 : n.length; ++t < i; ) if (e(n[t], t, n)) return !0; return !1; } function US(n, e) { return n.has(e); } var zS = 1, VS = 2; function i0(n, e, t, i, r, s) { var o = t & zS, a = n.length, c = e.length; if (a != c && !(o && c > a)) return !1; var l = s.get(n), d = s.get(e); if (l && d) return l == e && d == n; var h = -1, f = !0, g = t & VS ? new Pc() : void 0; for (s.set(n, e), s.set(e, n); ++h < a; ) { var p = n[h], u = e[h]; if (i) var y = o ? i(u, p, h, e, n, s) : i(p, u, h, n, e, s); if (y !== void 0) { if (y) continue; f = !1; break; } if (g) { if (!BS(e, function(v, m) { if (!US(g, m) && (p === v || r(p, v, t, i, s))) return g.push(m); })) { f = !1; break; } } else if (!(p === u || r(p, u, t, i, s))) { f = !1; break; } } return s.delete(n), s.delete(e), f; } function kS(n) { var e = -1, t = Array(n.size); return n.forEach(function(i, r) { t[++e] = [r, i]; }), t; } function GS(n) { var e = -1, t = Array(n.size); return n.forEach(function(i) { t[++e] = i; }), t; } var HS = 1, WS = 2, jS = "[object Boolean]", $S = "[object Date]", ZS = "[object Error]", XS = "[object Map]", YS = "[object Number]", JS = "[object RegExp]", KS = "[object Set]", qS = "[object String]", QS = "[object Symbol]", e_ = "[object ArrayBuffer]", t_ = "[object DataView]", Qp = Pi ? Pi.prototype : void 0, Du = Qp ? Qp.valueOf : void 0; function n_(n, e, t, i, r, s, o) { switch (t) { case t_: if (n.byteLength != e.byteLength || n.byteOffset != e.byteOffset) return !1; n = n.buffer, e = e.buffer; case e_: return !(n.byteLength != e.byteLength || !s(new qp(n), new qp(e))); case jS: case $S: case YS: return Gd(+n, +e); case ZS: return n.name == e.name && n.message == e.message; case JS: case qS: return n == e + ""; case XS: var a = kS; case KS: var c = i & HS; if (a || (a = GS), n.size != e.size && !c) return !1; var l = o.get(n); if (l) return l == e; i |= WS, o.set(n, e); var d = i0(a(n), a(e), i, r, s, o); return o.delete(n), d; case QS: if (Du) return Du.call(n) == Du.call(e); } return !1; } var i_ = 1, r_ = Object.prototype, s_ = r_.hasOwnProperty; function o_(n, e, t, i, r, s) { var o = t & i_, a = $p(n), c = a.length, l = $p(e), d = l.length; if (c != d && !o) return !1; for (var h = c; h--; ) { var f = a[h]; if (!(o ? f in e : s_.call(e, f))) return !1; } var g = s.get(n), p = s.get(e); if (g && p) return g == e && p == n; var u = !0; s.set(n, e), s.set(e, n); for (var y = o; ++h < c; ) { f = a[h]; var v = n[f], m = e[f]; if (i) var x = o ? i(m, v, f, e, n, s) : i(v, m, f, n, e, s); if (!(x === void 0 ? v === m || r(v, m, t, i, s) : x)) { u = !1; break; } y || (y = f == "constructor"); } if (u && !y) { var w = n.constructor, A = e.constructor; w != A && "constructor" in n && "constructor" in e && !(typeof w == "function" && w instanceof w && typeof A == "function" && A instanceof A) && (u = !1); } return s.delete(n), s.delete(e), u; } var a_ = 1, em = "[object Arguments]", tm = "[object Array]", _l = "[object Object]", l_ = Object.prototype, nm = l_.hasOwnProperty; function c_(n, e, t, i, r, s) { var o = pi(n), a = pi(e), c = o ? tm : Cr(n), l = a ? tm : Cr(e); c = c == em ? _l : c, l = l == em ? _l : l; var d = c == _l, h = l == _l, f = c == l; if (f && kh(n)) { if (!kh(e)) return !1; o = !0, d = !1; } if (f && !d) return s || (s = new er()), o || e0(n) ? i0(n, e, t, i, r, s) : n_(n, e, c, t, i, r, s); if (!(t & a_)) { var g = d && nm.call(n, "__wrapped__"), p = h && nm.call(e, "__wrapped__"); if (g || p) { var u = g ? n.value() : n, y = p ? e.value() : e; return s || (s = new er()), r(u, y, t, i, s); } } return f ? (s || (s = new er()), o_(n, e, t, i, r, s)) : !1; } function eu(n, e, t, i, r) { return n === e ? !0 : n == null || e == null || !Mo(n) && !Mo(e) ? n !== n && e !== e : c_(n, e, t, i, eu, r); } var u_ = 1, h_ = 2; function d_(n, e, t, i) { var r = t.length, s = r; if (n == null) return !s; for (n = Object(n); r--; ) { var o = t[r]; if (o[2] ? o[1] !== n[o[0]] : !(o[0] in n)) return !1; } for (; ++r < s; ) { o = t[r]; var a = o[0], c = n[a], l = o[1]; if (o[2]) { if (c === void 0 && !(a in n)) return !1; } else { var d = new er(), h; if (!(h === void 0 ? eu(l, c, u_ | h_, i, d) : h)) return !1; } } return !0; } function r0(n) { return n === n && !Ur(n); } function f_(n) { for (var e = t0(n), t = e.length; t--; ) { var i = e[t], r = n[i]; e[t] = [i, r, r0(r)]; } return e; } function s0(n, e) { return function(t) { return t == null ? !1 : t[n] === e && (e !== void 0 || n in Object(t)); }; } function p_(n) { var e = f_(n); return e.length == 1 && e[0][2] ? s0(e[0][0], e[0][1]) : function(t) { return t === n || d_(t, n, e); }; } function m_(n, e) { return n != null && e in Object(n); } function g_(n, e, t) { e = Qc(e, n); for (var i = -1, r = e.length, s = !1; ++i < r; ) { var o = nl(e[i]); if (!(s = n != null && t(n, o))) break; n = n[o]; } return s || ++i != r ? s : (r = n == null ? 0 : n.length, !!r && Hd(r) && kd(o, r) && (pi(n) || Wd(n))); } function o0(n, e) { return n != null && g_(n, e, m_); } var v_ = 1, y_ = 2; function b_(n, e) { return jd(n) && r0(e) ? s0(nl(n), e) : function(t) { var i = Ji(t, n); return i === void 0 && i === e ? o0(t, n) : eu(e, i, v_ | y_); }; } function x_(n) { return function(e) { return e == null ? void 0 : e[n]; }; } function M_(n) { return function(e) { return Zd(e, n); }; } function w_(n) { return jd(n) ? x_(nl(n)) : M_(n); } function A_(n) { return typeof n == "function" ? n : n == null ? Yv : typeof n == "object" ? pi(n) ? b_(n[0], n[1]) : p_(n) : w_(n); } var Nu = function() { return Bi.Date.now(); }, S_ = "Expected a function", __ = Math.max, T_ = Math.min; function jh(n, e, t) { var i, r, s, o, a, c, l = 0, d = !1, h = !1, f = !0; if (typeof n != "function") throw new TypeError(S_); e = Np(e) || 0, Ur(t) && (d = !!t.leading, h = "maxWait" in t, s = h ? __(Np(t.maxWait) || 0, e) : s, f = "trailing" in t ? !!t.trailing : f); function g(M) { var R = i, L = r; return i = r = void 0, l = M, o = n.apply(L, R), o; } function p(M) { return l = M, a = setTimeout(v, e), d ? g(M) : o; } function u(M) { var R = M - c, L = M - l, S = e - R; return h ? T_(S, s - L) : S; } function y(M) { var R = M - c, L = M - l; return c === void 0 || R >= e || R < 0 || h && L >= s; } function v() { var M = Nu(); if (y(M)) return m(M); a = setTimeout(v, u(M)); } function m(M) { return a = void 0, f && i ? g(M) : (i = r = void 0, o); } function x() { a !== void 0 && clearTimeout(a), l = 0, i = c = r = a = void 0; } function w() { return a === void 0 ? o : m(Nu()); } function A() { var M = Nu(), R = y(M); if (i = arguments, r = this, c = M, R) { if (a === void 0) return p(c); if (h) return clearTimeout(a), a = setTimeout(v, e), g(c); } return a === void 0 && (a = setTimeout(v, e)), o; } return A.cancel = x, A.flush = w, A; } function E_(n, e, t) { var i = n == null ? 0 : n.length; if (!i) return -1; var r = i - 1; return P1(n, A_(e), r); } function Ic(n) { for (var e = -1, t = n == null ? 0 : n.length, i = {}; ++e < t; ) { var r = n[e]; i[r[0]] = r[1]; } return i; } function $h(n, e) { return eu(n, e); } function Ci(n) { return n == null; } function C_(n) { return n === void 0; } function L_(n, e, t, i) { if (!Ur(n)) return n; e = Qc(e, n); for (var r = -1, s = e.length, o = s - 1, a = n; a != null && ++r < s; ) { var c = nl(e[r]), l = t; if (c === "__proto__" || c === "constructor" || c === "prototype") return n; if (r != o) { var d = a[c]; l = void 0, l === void 0 && (l = Ur(d) ? d : kd(e[r + 1]) ? [] : {}); } U1(a, c, l), a = a[c]; } return n; } function R_(n, e, t) { for (var i = -1, r = e.length, s = {}; ++i < r; ) { var o = e[i], a = Zd(n, o); t(a, o) && L_(s, Qc(o, n), a); } return s; } function F_(n, e) { return R_(n, e, function(t, i) { return o0(n, i); }); } var P_ = mS(function(n, e) { return n == null ? {} : F_(n, e); }); const di = (n) => n === void 0, Ba = (n) => typeof n == "boolean", yt = (n) => typeof n == "number", ys = (n) => typeof Element > "u" ? !1 : n instanceof Element, im = (n) => Ci(n), I_ = (n) => vn(n) ? !Number.isNaN(Number(n)) : !1, O_ = (n = "") => n.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), Rr = (n) => kw(n), rm = (n) => Object.keys(n); class a0 extends Error { constructor(e) { super(e), this.name = "ElementPlusError"; } } function Xo(n, e) { throw new a0(`[${n}] ${e}`); } function Vt(n, e) { if (process.env.NODE_ENV !== "production") { const t = vn(n) ? new a0(`[${n}] ${e}`) : n; console.warn(t); } } const D_ = "utils/dom/style", l0 = (n = "") => n.split(" ").filter((e) => !!e.trim()), sm = (n, e) => { !n || !e.trim() || n.classList.add(...l0(e)); }, Oc = (n, e) => { !n || !e.trim() || n.classList.remove(...l0(e)); }, ca = (n, e) => { var t; if (!en || !n || !e) return ""; let i = Uw(e); i === "float" && (i = "cssFloat"); try { const r = n.style[i]; if (r) return r; const s = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(n, ""); return s ? s[i] : ""; } catch { return n.style[i]; } }; function Dc(n, e = "px") { if (!n) return ""; if (yt(n) || I_(n)) return `${n}${e}`; if (vn(n)) return n; Vt(D_, "binding value must be a string or number"); } function N_(n, e) { if (!en) return; if (!e) { n.scrollTop = 0; return; } const t = []; let i = e.offsetParent; for (; i !== null && n !== i && n.contains(i); ) t.push(i), i = i.offsetParent; const r = e.offsetTop + t.reduce((c, l) => c + l.offsetTop, 0), s = r + e.offsetHeight, o = n.scrollTop, a = o + n.clientHeight; r < o ? n.scrollTop = r : s > a && (n.scrollTop = s - n.clientHeight); } /*! Element Plus Icons Vue v2.3.1 */ var B_ = /* @__PURE__ */ Pe({ name: "ArrowDown", __name: "arrow-down", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z" }) ])); } }), Xd = B_, U_ = /* @__PURE__ */ Pe({ name: "ArrowLeft", __name: "arrow-left", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z" }) ])); } }), zr = U_, z_ = /* @__PURE__ */ Pe({ name: "ArrowRight", __name: "arrow-right", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z" }) ])); } }), Vr = z_, V_ = /* @__PURE__ */ Pe({ name: "ArrowUp", __name: "arrow-up", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0" }) ])); } }), k_ = V_, G_ = /* @__PURE__ */ Pe({ name: "CircleCheck", __name: "circle-check", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }), Ne("path", { fill: "currentColor", d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z" }) ])); } }), H_ = G_, W_ = /* @__PURE__ */ Pe({ name: "CircleClose", __name: "circle-close", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z" }), Ne("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }) ])); } }), Yd = W_, j_ = /* @__PURE__ */ Pe({ name: "Close", __name: "close", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z" }) ])); } }), Zh = j_, $_ = /* @__PURE__ */ Pe({ name: "Delete", __name: "delete", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32" }) ])); } }), Nc = $_, Z_ = /* @__PURE__ */ Pe({ name: "Hide", __name: "hide", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z" }), Ne("path", { fill: "currentColor", d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z" }) ])); } }), X_ = Z_, Y_ = /* @__PURE__ */ Pe({ name: "Loading", __name: "loading", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" }) ])); } }), c0 = Y_, J_ = /* @__PURE__ */ Pe({ name: "Minus", __name: "minus", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64" }) ])); } }), K_ = J_, q_ = /* @__PURE__ */ Pe({ name: "Plus", __name: "plus", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z" }) ])); } }), tu = q_, Q_ = /* @__PURE__ */ Pe({ name: "View", __name: "view", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160" }) ])); } }), eT = Q_, tT = /* @__PURE__ */ Pe({ name: "WarningFilled", __name: "warning-filled", setup(n) { return (e, t) => (ve(), Le("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ Ne("path", { fill: "currentColor", d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4" }) ])); } }), u0 = tT; const h0 = "__epPropKey", Je = (n) => n, nT = (n) => Tn(n) && !!n[h0], nu = (n, e) => { if (!Tn(n) || nT(n)) return n; const { values: t, required: i, default: r, type: s, validator: o } = n, c = { type: s, required: !!i, validator: t || o ? (l) => { let d = !1, h = []; if (t && (h = Array.from(t), Fp(n, "default") && h.push(r), d || (d = h.includes(l))), o && (d || (d = o(l))), !d && h.length > 0) { const f = [...new Set(h)].map((g) => JSON.stringify(g)).join(", "); UM(`Invalid prop: validation failed${e ? ` for prop "${e}"` : ""}. Expected one of [${f}], got value ${JSON.stringify(l)}.`); } return d; } : void 0, [h0]: !0 }; return Fp(n, "default") && (c.default = r), c; }, at = (n) => Ic(Object.entries(n).map(([e, t]) => [ e, nu(t, e) ])), kr = Je([ String, Object, Function ]), d0 = { validating: c0, success: H_, error: Yd }, on = (n, e) => { if (n.install = (t) => { for (const i of [n, ...Object.values(e ?? {})]) t.component(i.name, i); }, e) for (const [t, i] of Object.entries(e)) n[t] = i; return n; }, iT = (n, e) => (n.install = (t) => { t.directive(e, n); }, n), vi = (n) => (n.install = Oa, n), Li = { tab: "Tab", enter: "Enter", space: "Space", left: "ArrowLeft", up: "ArrowUp", right: "ArrowRight", down: "ArrowDown", esc: "Escape", delete: "Delete", backspace: "Backspace", numpadEnter: "NumpadEnter", pageUp: "PageUp", pageDown: "PageDown", home: "Home", end: "End" }, At = "update:modelValue", ur = "change", bs = "input", f0 = ["", "default", "small", "large"], Sc = (n) => { const e = Pn(n) ? n : [n], t = []; return e.forEach((i) => { var r; Pn(i) ? t.push(...Sc(i)) : Uh(i) && Pn(i.children) ? t.push(...Sc(i.children)) : (t.push(i), Uh(i) && ((r = i.component) != null && r.subTree) && t.push(...Sc(i.component.subTree))); }), t; }, rT = (n) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(n), Ki = (n) => n, sT = ["class", "style"], oT = /^on[A-Z]/, aT = (n = {}) => { const { excludeListeners: e = !1, excludeKeys: t } = n, i = ue(() => ((t == null ? void 0 : t.value) || []).concat(sT)), r = dn(); return r ? ue(() => { var s; return Ic(Object.entries((s = r.proxy) == null ? void 0 : s.$attrs).filter(([o]) => !i.value.includes(o) && !(e && oT.test(o)))); }) : (Vt("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), ue(() => ({}))); }, p0 = ({ from: n, replacement: e, scope: t, version: i, ref: r, type: s = "API" }, o) => { Qe(() => z(o), (a) => { a && Vt(t, `[${s}] ${n} is about to be deprecated in version ${i}, please use ${e} instead. For more detail, please visit: ${r} `); }, { immediate: !0 }); }; var lT = { name: "en", el: { breadcrumb: { label: "Breadcrumb" }, colorpicker: { confirm: "OK", clear: "Clear", defaultLabel: "color picker", description: "current color is {color}. press enter to select a new color.", alphaLabel: "pick alpha value" }, datepicker: { now: "Now", today: "Today", cancel: "Cancel", clear: "Clear", confirm: "OK", dateTablePrompt: "Use the arrow keys and enter to select the day of the month", monthTablePrompt: "Use the arrow keys and enter to select the month", yearTablePrompt: "Use the arrow keys and enter to select the year", selectedDate: "Selected date", selectDate: "Select date", selectTime: "Select time", startDate: "Start Date", startTime: "Start Time", endDate: "End Date", endTime: "End Time", prevYear: "Previous Year", nextYear: "Next Year", prevMonth: "Previous Month", nextMonth: "Next Month", year: "", month1: "January", month2: "February", month3: "March", month4: "April", month5: "May", month6: "June", month7: "July", month8: "August", month9: "September", month10: "October", month11: "November", month12: "December", week: "week", weeks: { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat" }, weeksFull: { sun: "Sunday", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday" }, months: { jan: "Jan", feb: "Feb", mar: "Mar", apr: "Apr", may: "May", jun: "Jun", jul: "Jul", aug: "Aug", sep: "Sep", oct: "Oct", nov: "Nov", dec: "Dec" } }, inputNumber: { decrease: "decrease number", increase: "increase number" }, select: { loading: "Loading", noMatch: "No matching data", noData: "No data", placeholder: "Select" }, mention: { loading: "Loading" }, dropdown: { toggleDropdown: "Toggle Dropdown" }, cascader: { noMatch: "No matching data", loading: "Loading", placeholder: "Select", noData: "No data" }, pagination: { goto: "Go to", pagesize: "/page", total: "Total {total}", pageClassifier: "", page: "Page", prev: "Go to previous page", next: "Go to next page", currentPage: "page {pager}", prevPages: "Previous {pager} pages", nextPages: "Next {pager} pages", deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" }, dialog: { close: "Close this dialog" }, drawer: { close: "Close this dialog" }, messagebox: { title: "Message", confirm: "OK", cancel: "Cancel", error: "Illegal input", close: "Close this dialog" }, upload: { deleteTip: "press delete to remove", delete: "Delete", preview: "Preview", continue: "Continue" }, slider: { defaultLabel: "slider between {min} and {max}", defaultRangeStartLabel: "pick start value", defaultRangeEndLabel: "pick end value" }, table: { emptyText: "No Data", confirmFilter: "Confirm", resetFilter: "Reset", clearFilter: "All", sumText: "Sum" }, tour: { next: "Next", previous: "Previous", finish: "Finish" }, tree: { emptyText: "No Data" }, transfer: { noMatch: "No matching data", noData: "No data", titles: ["List 1", "List 2"], filterPlaceholder: "Enter keyword", noCheckedFormat: "{total} items", hasCheckedFormat: "{checked}/{total} checked" }, image: { error: "FAILED" }, pageHeader: { title: "Back" }, popconfirm: { confirmButtonText: "Yes", cancelButtonText: "No" }, carousel: { leftArrow: "Carousel arrow left", rightArrow: "Carousel arrow right", indicator: "Carousel switch to index {index}" } } }; const cT = (n) => (e, t) => uT(e, t, z(n)), uT = (n, e, t) => Ji(t, n, n).replace(/\{(\w+)\}/g, (i, r) => { var s; return `${(s = e == null ? void 0 : e[r]) != null ? s : `{${r}}`}`; }), hT = (n) => { const e = ue(() => z(n).name), t = Zc(n) ? n : Te(n); return { lang: e, locale: t, t: cT(n) }; }, m0 = Symbol("localeContextKey"), iu = (n) => { const e = n || pt(m0, Te()); return hT(ue(() => e.value || lT)); }, _c = "el", dT = "is-", rs = (n, e, t, i, r) => { let s = `${n}-${e}`; return t && (s += `-${t}`), i && (s += `__${i}`), r && (s += `--${r}`), s; }, g0 = Symbol("namespaceContextKey"), Jd = (n) => { const e = n || (dn() ? pt(g0, Te(_c)) : Te(_c)); return ue(() => z(e) || _c); }, nt = (n, e) => { const t = Jd(e); return { namespace: t, b: (u = "") => rs(t.value, n, u, "", ""), e: (u) => u ? rs(t.value, n, "", u, "") : "", m: (u) => u ? rs(t.value, n, "", "", u) : "", be: (u, y) => u && y ? rs(t.value, n, u, y, "") : "", em: (u, y) => u && y ? rs(t.value, n, "", u, y) : "", bm: (u, y) => u && y ? rs(t.value, n, u, "", y) : "", bem: (u, y, v) => u && y && v ? rs(t.value, n, u, y, v) : "", is: (u, ...y) => { const v = y.length >= 1 ? y[0] : !0; return u && v ? `${dT}${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}` }; }, fT = nu({ type: Je(Boolean), default: null }), pT = nu({ type: Je(Function) }), mT = (n) => { const e = `update:${n}`, t = `onUpdate:${n}`, i = [e], r = { [n]: fT, [t]: pT }; return { useModelToggle: ({ indicator: o, toggleReason: a, shouldHideWhenRouteChanges: c, shouldProceed: l, onShow: d, onHide: h }) => { const f = dn(), { emit: g } = f, p = f.props, u = ue(() => Sn(p[t])), y = ue(() => p[n] === null), v = (R) => { o.value !== !0 && (o.value = !0, a && (a.value = R), Sn(d) && d(R)); }, m = (R) => { o.value !== !1 && (o.value = !1, a && (a.value = R), Sn(h) && h(R)); }, x = (R) => { if (p.disabled === !0 || Sn(l) && !l()) return; const L = u.value && en; L && g(e, !0), (y.value || !L) && v(R); }, w = (R) => { if (p.disabled === !0 || !en) return; const L = u.value && en; L && g(e, !1), (y.value || !L) && m(R); }, A = (R) => { Ba(R) && (p.disabled && R ? u.value && g(e, !1) : o.value !== R && (R ? v() : m())); }, M = () => { o.value ? w() : x(); }; return Qe(() => p[n], A), c && f.appContext.config.globalProperties.$route !== void 0 && Qe(() => ({ ...f.proxy.$route }), () => { c.value && o.value && w(); }), Jt(() => { A(p[n]); }), { hide: w, show: x, toggle: M, hasUpdateHandler: u }; }, useModelToggleProps: r, useModelToggleEmits: i }; }, v0 = (n) => { const e = dn(); return ue(() => { var t, i; return (i = (t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$props) == null ? void 0 : i[n]; }); }; var On = "top", qn = "bottom", Qn = "right", Dn = "left", Kd = "auto", il = [On, qn, Qn, Dn], wo = "start", Ua = "end", gT = "clippingParents", y0 = "viewport", ua = "popper", vT = "reference", om = il.reduce(function(n, e) { return n.concat([e + "-" + wo, e + "-" + Ua]); }, []), Yo = [].concat(il, [Kd]).reduce(function(n, e) { return n.concat([e, e + "-" + wo, e + "-" + Ua]); }, []), yT = "beforeRead", bT = "read", xT = "afterRead", MT = "beforeMain", wT = "main", AT = "afterMain", ST = "beforeWrite", _T = "write", TT = "afterWrite", ET = [yT, bT, xT, MT, wT, AT, ST, _T, TT]; function Ii(n) { return n ? (n.nodeName || "").toLowerCase() : null; } function yi(n) { if (n == null) return window; if (n.toString() !== "[object Window]") { var e = n.ownerDocument; return e && e.defaultView || window; } return n; } function Ao(n) { var e = yi(n).Element; return n instanceof e || n instanceof Element; } function Kn(n) { var e = yi(n).HTMLElement; return n instanceof e || n instanceof HTMLElement; } function qd(n) { if (typeof ShadowRoot > "u") return !1; var e = yi(n).ShadowRoot; return n instanceof e || n instanceof ShadowRoot; } function CT(n) { var e = n.state; Object.keys(e.elements).forEach(function(t) { var i = e.styles[t] || {}, r = e.attributes[t] || {}, s = e.elements[t]; !Kn(s) || !Ii(s) || (Object.assign(s.style, i), Object.keys(r).forEach(function(o) { var a = r[o]; a === !1 ? s.removeAttribute(o) : s.setAttribute(o, a === !0 ? "" : a); })); }); } function LT(n) { var e = n.state, t = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(e.elements.popper.style, t.popper), e.styles = t, e.elements.arrow && Object.assign(e.elements.arrow.style, t.arrow), function() { Object.keys(e.elements).forEach(function(i) { var r = e.elements[i], s = e.attributes[i] || {}, o = Object.keys(e.styles.hasOwnProperty(i) ? e.styles[i] : t[i]), a = o.reduce(function(c, l) { return c[l] = "", c; }, {}); !Kn(r) || !Ii(r) || (Object.assign(r.style, a), Object.keys(s).forEach(function(c) { r.removeAttribute(c); })); }); }; } var b0 = { name: "applyStyles", enabled: !0, phase: "write", fn: CT, effect: LT, requires: ["computeStyles"] }; function Ri(n) { return n.split("-")[0]; } var xs = Math.max, Bc = Math.min, So = Math.round; function _o(n, e) { e === void 0 && (e = !1); var t = n.getBoundingClientRect(), i = 1, r = 1; if (Kn(n) && e) { var s = n.offsetHeight, o = n.offsetWidth; o > 0 && (i = So(t.width) / o || 1), s > 0 && (r = So(t.height) / s || 1); } return { width: t.width / i, height: t.height / r, top: t.top / r, right: t.right / i, bottom: t.bottom / r, left: t.left / i, x: t.left / i, y: t.top / r }; } function Qd(n) { var e = _o(n), t = n.offsetWidth, i = n.offsetHeight; return Math.abs(e.width - t) <= 1 && (t = e.width), Math.abs(e.height - i) <= 1 && (i = e.height), { x: n.offsetLeft, y: n.offsetTop, width: t, height: i }; } function x0(n, e) { var t = e.getRootNode && e.getRootNode(); if (n.contains(e)) return !0; if (t && qd(t)) { var i = e; do { if (i && n.isSameNode(i)) return !0; i = i.parentNode || i.host; } while (i); } return !1; } function rr(n) { return yi(n).getComputedStyle(n); } function RT(n) { return ["table", "td", "th"].indexOf(Ii(n)) >= 0; } function Xr(n) { return ((Ao(n) ? n.ownerDocument : n.document) || window.document).documentElement; } function ru(n) { return Ii(n) === "html" ? n : n.assignedSlot || n.parentNode || (qd(n) ? n.host : null) || Xr(n); } function am(n) { return !Kn(n) || rr(n).position === "fixed" ? null : n.offsetParent; } function FT(n) { var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1; if (t && Kn(n)) { var i = rr(n); if (i.position === "fixed") return null; } var r = ru(n); for (qd(r) && (r = r.host); Kn(r) && ["html", "body"].indexOf(Ii(r)) < 0; ) { var s = rr(r); if (s.transform !== "none" || s.perspective !== "none" || s.contain === "paint" || ["transform", "perspective"].indexOf(s.willChange) !== -1 || e && s.willChange === "filter" || e && s.filter && s.filter !== "none") return r; r = r.parentNode; } return null; } function rl(n) { for (var e = yi(n), t = am(n); t && RT(t) && rr(t).position === "static"; ) t = am(t); return t && (Ii(t) === "html" || Ii(t) === "body" && rr(t).position === "static") ? e : t || FT(n) || e; } function ef(n) { return ["top", "bottom"].indexOf(n) >= 0 ? "x" : "y"; } function Ca(n, e, t) { return xs(n, Bc(e, t)); } function PT(n, e, t) { var i = Ca(n, e, t); return i > t ? t : i; } function M0() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function w0(n) { return Object.assign({}, M0(), n); } function A0(n, e) { return e.reduce(function(t, i) { return t[i] = n, t; }, {}); } var IT = function(n, e) { return n = typeof n == "function" ? n(Object.assign({}, e.rects, { placement: e.placement })) : n, w0(typeof n != "number" ? n : A0(n, il)); }; function OT(n) { var e, t = n.state, i = n.name, r = n.options, s = t.elements.arrow, o = t.modifiersData.popperOffsets, a = Ri(t.placement), c = ef(a), l = [Dn, Qn].indexOf(a) >= 0, d = l ? "height" : "width"; if (!(!s || !o)) { var h = IT(r.padding, t), f = Qd(s), g = c === "y" ? On : Dn, p = c === "y" ? qn : Qn, u = t.rects.reference[d] + t.rects.reference[c] - o[c] - t.rects.popper[d], y = o[c] - t.rects.reference[c], v = rl(s), m = v ? c === "y" ? v.clientHeight || 0 : v.clientWidth || 0 : 0, x = u / 2 - y / 2, w = h[g], A = m - f[d] - h[p], M = m / 2 - f[d] / 2 + x, R = Ca(w, M, A), L = c; t.modifiersData[i] = (e = {}, e[L] = R, e.centerOffset = R - M, e); } } function DT(n) { var e = n.state, t = n.options, i = t.element, r = i === void 0 ? "[data-popper-arrow]" : i; r != null && (typeof r == "string" && (r = e.elements.popper.querySelector(r), !r) || !x0(e.elements.popper, r) || (e.elements.arrow = r)); } var NT = { name: "arrow", enabled: !0, phase: "main", fn: OT, effect: DT, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function To(n) { return n.split("-")[1]; } var BT = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function UT(n) { var e = n.x, t = n.y, i = window, r = i.devicePixelRatio || 1; return { x: So(e * r) / r || 0, y: So(t * r) / r || 0 }; } function lm(n) { var e, t = n.popper, i = n.popperRect, r = n.placement, s = n.variation, o = n.offsets, a = n.position, c = n.gpuAcceleration, l = n.adaptive, d = n.roundOffsets, h = n.isFixed, f = o.x, g = f === void 0 ? 0 : f, p = o.y, u = p === void 0 ? 0 : p, y = typeof d == "function" ? d({ x: g, y: u }) : { x: g, y: u }; g = y.x, u = y.y; var v = o.hasOwnProperty("x"), m = o.hasOwnProperty("y"), x = Dn, w = On, A = window; if (l) { var M = rl(t), R = "clientHeight", L = "clientWidth"; if (M === yi(t) && (M = Xr(t), rr(M).position !== "static" && a === "absolute" && (R = "scrollHeight", L = "scrollWidth")), M = M, r === On || (r === Dn || r === Qn) && s === Ua) { w = qn; var S = h && M === A && A.visualViewport ? A.visualViewport.height : M[R]; u -= S - i.height, u *= c ? 1 : -1; } if (r === Dn || (r === On || r === qn) && s === Ua) { x = Qn; var I = h && M === A && A.visualViewport ? A.visualViewport.width : M[L]; g -= I - i.width, g *= c ? 1 : -1; } } var T = Object.assign({ position: a }, l && BT), _ = d === !0 ? UT({ x: g, y: u }) : { x: g, y: u }; if (g = _.x, u = _.y, c) { var E; return Object.assign({}, T, (E = {}, E[w] = m ? "0" : "", E[x] = v ? "0" : "", E.transform = (A.devicePixelRatio || 1) <= 1 ? "translate(" + g + "px, " + u + "px)" : "translate3d(" + g + "px, " + u + "px, 0)", E)); } return Object.assign({}, T, (e = {}, e[w] = m ? u + "px" : "", e[x] = v ? g + "px" : "", e.transform = "", e)); } function zT(n) { var e = n.state, t = n.options, i = t.gpuAcceleration, r = i === void 0 ? !0 : i, s = t.adaptive, o = s === void 0 ? !0 : s, a = t.roundOffsets, c = a === void 0 ? !0 : a, l = { placement: Ri(e.placement), variation: To(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: r, isFixed: e.options.strategy === "fixed" }; e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, lm(Object.assign({}, l, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: o, roundOffsets: c })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, lm(Object.assign({}, l, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: c })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement }); } var S0 = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: zT, data: {} }, Tl = { passive: !0 }; function VT(n) { var e = n.state, t = n.instance, i = n.options, r = i.scroll, s = r === void 0 ? !0 : r, o = i.resize, a = o === void 0 ? !0 : o, c = yi(e.elements.popper), l = [].concat(e.scrollParents.reference, e.scrollParents.popper); return s && l.forEach(function(d) { d.addEventListener("scroll", t.update, Tl); }), a && c.addEventListener("resize", t.update, Tl), function() { s && l.forEach(function(d) { d.removeEventListener("scroll", t.update, Tl); }), a && c.removeEventListener("resize", t.update, Tl); }; } var _0 = { name: "eventListeners", enabled: !0, phase: "write", fn: function() { }, effect: VT, data: {} }, kT = { left: "right", right: "left", bottom: "top", top: "bottom" }; function Tc(n) { return n.replace(/left|right|bottom|top/g, function(e) { return kT[e]; }); } var GT = { start: "end", end: "start" }; function cm(n) { return n.replace(/start|end/g, function(e) { return GT[e]; }); } function tf(n) { var e = yi(n), t = e.pageXOffset, i = e.pageYOffset; return { scrollLeft: t, scrollTop: i }; } function nf(n) { return _o(Xr(n)).left + tf(n).scrollLeft; } function HT(n) { var e = yi(n), t = Xr(n), i = e.visualViewport, r = t.clientWidth, s = t.clientHeight, o = 0, a = 0; return i && (r = i.width, s = i.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (o = i.offsetLeft, a = i.offsetTop)), { width: r, height: s, x: o + nf(n), y: a }; } function WT(n) { var e, t = Xr(n), i = tf(n), r = (e = n.ownerDocument) == null ? void 0 : e.body, s = xs(t.scrollWidth, t.clientWidth, r ? r.scrollWidth : 0, r ? r.clientWidth : 0), o = xs(t.scrollHeight, t.clientHeight, r ? r.scrollHeight : 0, r ? r.clientHeight : 0), a = -i.scrollLeft + nf(n), c = -i.scrollTop; return rr(r || t).direction === "rtl" && (a += xs(t.clientWidth, r ? r.clientWidth : 0) - s), { width: s, height: o, x: a, y: c }; } function rf(n) { var e = rr(n), t = e.overflow, i = e.overflowX, r = e.overflowY; return /auto|scroll|overlay|hidden/.test(t + r + i); } function T0(n) { return ["html", "body", "#document"].indexOf(Ii(n)) >= 0 ? n.ownerDocument.body : Kn(n) && rf(n) ? n : T0(ru(n)); } function La(n, e) { var t; e === void 0 && (e = []); var i = T0(n), r = i === ((t = n.ownerDocument) == null ? void 0 : t.body), s = yi(i), o = r ? [s].concat(s.visualViewport || [], rf(i) ? i : []) : i, a = e.concat(o); return r ? a : a.concat(La(ru(o))); } function Xh(n) { return Object.assign({}, n, { left: n.x, top: n.y, right: n.x + n.width, bottom: n.y + n.height }); } function jT(n) { var e = _o(n); return e.top = e.top + n.clientTop, e.left = e.left + n.clientLeft, e.bottom = e.top + n.clientHeight, e.right = e.left + n.clientWidth, e.width = n.clientWidth, e.height = n.clientHeight, e.x = e.left, e.y = e.top, e; } function um(n, e) { return e === y0 ? Xh(HT(n)) : Ao(e) ? jT(e) : Xh(WT(Xr(n))); } function $T(n) { var e = La(ru(n)), t = ["absolute", "fixed"].indexOf(rr(n).position) >= 0, i = t && Kn(n) ? rl(n) : n; return Ao(i) ? e.filter(function(r) { return Ao(r) && x0(r, i) && Ii(r) !== "body"; }) : []; } function ZT(n, e, t) { var i = e === "clippingParents" ? $T(n) : [].concat(e), r = [].concat(i, [t]), s = r[0], o = r.reduce(function(a, c) { var l = um(n, c); return a.top = xs(l.top, a.top), a.right = Bc(l.right, a.right), a.bottom = Bc(l.bottom, a.bottom), a.left = xs(l.left, a.left), a; }, um(n, s)); return o.width = o.right - o.left, o.height = o.bottom - o.top, o.x = o.left, o.y = o.top, o; } function E0(n) { var e = n.reference, t = n.element, i = n.placement, r = i ? Ri(i) : null, s = i ? To(i) : null, o = e.x + e.width / 2 - t.width / 2, a = e.y + e.height / 2 - t.height / 2, c; switch (r) { case On: c = { x: o, y: e.y - t.height }; break; case qn: c = { x: o, y: e.y + e.height }; break; case Qn: c = { x: e.x + e.width, y: a }; break; case Dn: c = { x: e.x - t.width, y: a }; break; default: c = { x: e.x, y: e.y }; } var l = r ? ef(r) : null; if (l != null) { var d = l === "y" ? "height" : "width"; switch (s) { case wo: c[l] = c[l] - (e[d] / 2 - t[d] / 2); break; case Ua: c[l] = c[l] + (e[d] / 2 - t[d] / 2); break; } } return c; } function za(n, e) { e === void 0 && (e = {}); var t = e, i = t.placement, r = i === void 0 ? n.placement : i, s = t.boundary, o = s === void 0 ? gT : s, a = t.rootBoundary, c = a === void 0 ? y0 : a, l = t.elementContext, d = l === void 0 ? ua : l, h = t.altBoundary, f = h === void 0 ? !1 : h, g = t.padding, p = g === void 0 ? 0 : g, u = w0(typeof p != "number" ? p : A0(p, il)), y = d === ua ? vT : ua, v = n.rects.popper, m = n.elements[f ? y : d], x = ZT(Ao(m) ? m : m.contextElement || Xr(n.elements.popper), o, c), w = _o(n.elements.reference), A = E0({ reference: w, element: v, strategy: "absolute", placement: r }), M = Xh(Object.assign({}, v, A)), R = d === ua ? M : w, L = { top: x.top - R.top + u.top, bottom: R.bottom - x.bottom + u.bottom, left: x.left - R.left + u.left, right: R.right - x.right + u.right }, S = n.modifiersData.offset; if (d === ua && S) { var I = S[r]; Object.keys(L).forEach(function(T) { var _ = [Qn, qn].indexOf(T) >= 0 ? 1 : -1, E = [On, qn].indexOf(T) >= 0 ? "y" : "x"; L[T] += I[E] * _; }); } return L; } function XT(n, e) { e === void 0 && (e = {}); var t = e, i = t.placement, r = t.boundary, s = t.rootBoundary, o = t.padding, a = t.flipVariations, c = t.allowedAutoPlacements, l = c === void 0 ? Yo : c, d = To(i), h = d ? a ? om : om.filter(function(p) { return To(p) === d; }) : il, f = h.filter(function(p) { return l.indexOf(p) >= 0; }); f.length === 0 && (f = h); var g = f.reduce(function(p, u) { return p[u] = za(n, { placement: u, boundary: r, rootBoundary: s, padding: o })[Ri(u)], p; }, {}); return Object.keys(g).sort(function(p, u) { return g[p] - g[u]; }); } function YT(n) { if (Ri(n) === Kd) return []; var e = Tc(n); return [cm(n), e, cm(e)]; } function JT(n) { var e = n.state, t = n.options, i = n.name; if (!e.modifiersData[i]._skip) { for (var r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !0 : o, c = t.fallbackPlacements, l = t.padding, d = t.boundary, h = t.rootBoundary, f = t.altBoundary, g = t.flipVariations, p = g === void 0 ? !0 : g, u = t.allowedAutoPlacements, y = e.options.placement, v = Ri(y), m = v === y, x = c || (m || !p ? [Tc(y)] : YT(y)), w = [y].concat(x).reduce(function(te, ae) { return te.concat(Ri(ae) === Kd ? XT(e, { placement: ae, boundary: d, rootBoundary: h, padding: l, flipVariations: p, allowedAutoPlacements: u }) : ae); }, []), A = e.rects.reference, M = e.rects.popper, R = /* @__PURE__ */ new Map(), L = !0, S = w[0], I = 0; I < w.length; I++) { var T = w[I], _ = Ri(T), E = To(T) === wo, C = [On, qn].indexOf(_) >= 0, P = C ? "width" : "height", b = za(e, { placement: T, boundary: d, rootBoundary: h, altBoundary: f, padding: l }), F = C ? E ? Qn : Dn : E ? qn : On; A[P] > M[P] && (F = Tc(F)); var D = Tc(F), N = []; if (s && N.push(b[_] <= 0), a && N.push(b[F] <= 0, b[D] <= 0), N.every(function(te) { return te; })) { S = T, L = !1; break; } R.set(T, N); } if (L) for (var B = p ? 3 : 1, U = function(te) { var ae = w.find(function(ie) { var le = R.get(ie); if (le) return le.slice(0, te).every(function(W) { return W; }); }); if (ae) return S = ae, "break"; }, G = B; G > 0; G--) { var Y = U(G); if (Y === "break") break; } e.placement !== S && (e.modifiersData[i]._skip = !0, e.placement = S, e.reset = !0); } } var KT = { name: "flip", enabled: !0, phase: "main", fn: JT, requiresIfExists: ["offset"], data: { _skip: !1 } }; function hm(n, e, t) { return t === void 0 && (t = { x: 0, y: 0 }), { top: n.top - e.height - t.y, right: n.right - e.width + t.x, bottom: n.bottom - e.height + t.y, left: n.left - e.width - t.x }; } function dm(n) { return [On, Qn, qn, Dn].some(function(e) { return n[e] >= 0; }); } function qT(n) { var e = n.state, t = n.name, i = e.rects.reference, r = e.rects.popper, s = e.modifiersData.preventOverflow, o = za(e, { elementContext: "reference" }), a = za(e, { altBoundary: !0 }), c = hm(o, i), l = hm(a, r, s), d = dm(c), h = dm(l); e.modifiersData[t] = { referenceClippingOffsets: c, popperEscapeOffsets: l, isReferenceHidden: d, hasPopperEscaped: h }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": d, "data-popper-escaped": h }); } var QT = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: qT }; function eE(n, e, t) { var i = Ri(n), r = [Dn, On].indexOf(i) >= 0 ? -1 : 1, s = typeof t == "function" ? t(Object.assign({}, e, { placement: n })) : t, o = s[0], a = s[1]; return o = o || 0, a = (a || 0) * r, [Dn, Qn].indexOf(i) >= 0 ? { x: a, y: o } : { x: o, y: a }; } function tE(n) { var e = n.state, t = n.options, i = n.name, r = t.offset, s = r === void 0 ? [0, 0] : r, o = Yo.reduce(function(d, h) { return d[h] = eE(h, e.rects, s), d; }, {}), a = o[e.placement], c = a.x, l = a.y; e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += c, e.modifiersData.popperOffsets.y += l), e.modifiersData[i] = o; } var nE = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: tE }; function iE(n) { var e = n.state, t = n.name; e.modifiersData[t] = E0({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement }); } var C0 = { name: "popperOffsets", enabled: !0, phase: "read", fn: iE, data: {} }; function rE(n) { return n === "x" ? "y" : "x"; } function sE(n) { var e = n.state, t = n.options, i = n.name, r = t.mainAxis, s = r === void 0 ? !0 : r, o = t.altAxis, a = o === void 0 ? !1 : o, c = t.boundary, l = t.rootBoundary, d = t.altBoundary, h = t.padding, f = t.tether, g = f === void 0 ? !0 : f, p = t.tetherOffset, u = p === void 0 ? 0 : p, y = za(e, { boundary: c, rootBoundary: l, padding: h, altBoundary: d }), v = Ri(e.placement), m = To(e.placement), x = !m, w = ef(v), A = rE(w), M = e.modifiersData.popperOffsets, R = e.rects.reference, L = e.rects.popper, S = typeof u == "function" ? u(Object.assign({}, e.rects, { placement: e.placement })) : u, I = typeof S == "number" ? { mainAxis: S, altAxis: S } : Object.assign({ mainAxis: 0, altAxis: 0 }, S), T = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, _ = { x: 0, y: 0 }; if (M) { if (s) { var E, C = w === "y" ? On : Dn, P = w === "y" ? qn : Qn, b = w === "y" ? "height" : "width", F = M[w], D = F + y[C], N = F - y[P], B = g ? -L[b] / 2 : 0, U = m === wo ? R[b] : L[b], G = m === wo ? -L[b] : -R[b], Y = e.elements.arrow, te = g && Y ? Qd(Y) : { width: 0, height: 0 }, ae = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : M0(), ie = ae[C], le = ae[P], W = Ca(0, R[b], te[b]), $ = x ? R[b] / 2 - B - W - ie - I.mainAxis : U - W - ie - I.mainAxis, j = x ? -R[b] / 2 + B + W + le + I.mainAxis : G + W + le + I.mainAxis, re = e.elements.arrow && rl(e.elements.arrow), V = re ? w === "y" ? re.clientTop || 0 : re.clientLeft || 0 : 0, H = (E = T == null ? void 0 : T[w]) != null ? E : 0, K = F + $ - H - V, ce = F + j - H, se = Ca(g ? Bc(D, K) : D, F, g ? xs(N, ce) : N); M[w] = se, _[w] = se - F; } if (a) { var k, O = w === "x" ? On : Dn, Z = w === "x" ? qn : Qn, X = M[A], ee = A === "y" ? "height" : "width", fe = X + y[O], be = X - y[Z], Ae = [On, Dn].indexOf(v) !== -1, he = (k = T == null ? void 0 : T[A]) != null ? k : 0, xe = Ae ? fe : X - R[ee] - L[ee] - he + I.altAxis, ne = Ae ? X + R[ee] + L[ee] - he - I.altAxis : be, me = g && Ae ? PT(xe, X, ne) : Ca(g ? xe : fe, X, g ? ne : be); M[A] = me, _[A] = me - X; } e.modifiersData[i] = _; } } var oE = { name: "preventOverflow", enabled: !0, phase: "main", fn: sE, requiresIfExists: ["offset"] }; function aE(n) { return { scrollLeft: n.scrollLeft, scrollTop: n.scrollTop }; } function lE(n) { return n === yi(n) || !Kn(n) ? tf(n) : aE(n); } function cE(n) { var e = n.getBoundingClientRect(), t = So(e.width) / n.offsetWidth || 1, i = So(e.height) / n.offsetHeight || 1; return t !== 1 || i !== 1; } function uE(n, e, t) { t === void 0 && (t = !1); var i = Kn(e), r = Kn(e) && cE(e), s = Xr(e), o = _o(n, r), a = { scrollLeft: 0, scrollTop: 0 }, c = { x: 0, y: 0 }; return (i || !i && !t) && ((Ii(e) !== "body" || rf(s)) && (a = lE(e)), Kn(e) ? (c = _o(e, !0), c.x += e.clientLeft, c.y += e.clientTop) : s && (c.x = nf(s))), { x: o.left + a.scrollLeft - c.x, y: o.top + a.scrollTop - c.y, width: o.width, height: o.height }; } function hE(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 dE(n) { var e = hE(n); return ET.reduce(function(t, i) { return t.concat(e.filter(function(r) { return r.phase === i; })); }, []); } function fE(n) { var e; return function() { return e || (e = new Promise(function(t) { Promise.resolve().then(function() { e = void 0, t(n()); }); })), e; }; } function pE(n) { var e = n.reduce(function(t, i) { var r = t[i.name]; return t[i.name] = r ? Object.assign({}, r, i, { options: Object.assign({}, r.options, i.options), data: Object.assign({}, r.data, i.data) }) : i, t; }, {}); return Object.keys(e).map(function(t) { return e[t]; }); } var fm = { placement: "bottom", modifiers: [], strategy: "absolute" }; function pm() { for (var n = arguments.length, e = new Array(n), t = 0; t < n; t++) e[t] = arguments[t]; return !e.some(function(i) { return !(i && typeof i.getBoundingClientRect == "function"); }); } function sf(n) { n === void 0 && (n = {}); var e = n, t = e.defaultModifiers, i = t === void 0 ? [] : t, r = e.defaultOptions, s = r === void 0 ? fm : r; return function(o, a, c) { c === void 0 && (c = s); var l = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, fm, s), modifiersData: {}, elements: { reference: o, popper: a }, attributes: {}, styles: {} }, d = [], h = !1, f = { state: l, setOptions: function(u) { var y = typeof u == "function" ? u(l.options) : u; p(), l.options = Object.assign({}, s, l.options, y), l.scrollParents = { reference: Ao(o) ? La(o) : o.contextElement ? La(o.contextElement) : [], popper: La(a) }; var v = dE(pE([].concat(i, l.options.modifiers))); return l.orderedModifiers = v.filter(function(m) { return m.enabled; }), g(), f.update(); }, forceUpdate: function() { if (!h) { var u = l.elements, y = u.reference, v = u.popper; if (pm(y, v)) { l.rects = { reference: uE(y, rl(v), l.options.strategy === "fixed"), popper: Qd(v) }, l.reset = !1, l.placement = l.options.placement, l.orderedModifiers.forEach(function(L) { return l.modifiersData[L.name] = Object.assign({}, L.data); }); for (var m = 0; m < l.orderedModifiers.length; m++) { if (l.reset === !0) { l.reset = !1, m = -1; continue; } var x = l.orderedModifiers[m], w = x.fn, A = x.options, M = A === void 0 ? {} : A, R = x.name; typeof w == "function" && (l = w({ state: l, options: M, name: R, instance: f }) || l); } } } }, update: fE(function() { return new Promise(function(u) { f.forceUpdate(), u(l); }); }), destroy: function() { p(), h = !0; } }; if (!pm(o, a)) return f; f.setOptions(c).then(function(u) { !h && c.onFirstUpdate && c.onFirstUpdate(u); }); function g() { l.orderedModifiers.forEach(function(u) { var y = u.name, v = u.options, m = v === void 0 ? {} : v, x = u.effect; if (typeof x == "function") { var w = x({ state: l, name: y, instance: f, options: m }), A = function() { }; d.push(w || A); } }); } function p() { d.forEach(function(u) { return u(); }), d = []; } return f; }; } sf(); var mE = [_0, C0, S0, b0]; sf({ defaultModifiers: mE }); var gE = [_0, C0, S0, b0, nE, KT, oE, NT, QT], vE = sf({ defaultModifiers: gE }); const yE = (n, e, t = {}) => { const i = { name: "updateState", enabled: !0, phase: "write", fn: ({ state: c }) => { const l = bE(c); Object.assign(o.value, l); }, requires: ["computeStyles"] }, r = ue(() => { const { onFirstUpdate: c, placement: l, strategy: d, modifiers: h } = z(t); return { onFirstUpdate: c, placement: l || "bottom", strategy: d || "absolute", modifiers: [ ...h || [], i, { name: "applyStyles", enabled: !1 } ] }; }), s = En(), o = Te({ styles: { popper: { position: z(r).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), a = () => { s.value && (s.value.destroy(), s.value = void 0); }; return Qe(r, (c) => { const l = z(s); l && l.setOptions(c); }, { deep: !0 }), Qe([n, e], ([c, l]) => { a(), !(!c || !l) && (s.value = vE(c, l, z(r))); }), ei(() => { a(); }), { state: ue(() => { var c; return { ...((c = z(s)) == null ? void 0 : c.state) || {} }; }), styles: ue(() => z(o).styles), attributes: ue(() => z(o).attributes), update: () => { var c; return (c = z(s)) == null ? void 0 : c.update(); }, forceUpdate: () => { var c; return (c = z(s)) == null ? void 0 : c.forceUpdate(); }, instanceRef: ue(() => z(s)) }; }; function bE(n) { const e = Object.keys(n.elements), t = Ic(e.map((r) => [r, n.styles[r] || {}])), i = Ic(e.map((r) => [r, n.attributes[r]])); return { styles: t, attributes: i }; } function mm() { let n; const e = (i, r) => { t(), n = window.setTimeout(i, r); }, t = () => window.clearTimeout(n); return Yc(() => t()), { registerTimeout: e, cancelTimeout: t }; } const Yh = { prefix: Math.floor(Math.random() * 1e4), current: 0 }, xE = Symbol("elIdInjection"), of = () => dn() ? pt(xE, Yh) : Yh, sl = (n) => { const e = of(); !en && e === Yh && Vt("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed usage: app.provide(ID_INJECTION_KEY, { prefix: number, current: number, })`); const t = Jd(); return ue(() => z(n) || `${t.value}-id-${e.prefix}-${e.current++}`); }; let fo = []; const gm = (n) => { const e = n; e.key === Li.esc && fo.forEach((t) => t(e)); }, ME = (n) => { Jt(() => { fo.length === 0 && document.addEventListener("keydown", gm), en && fo.push(n); }), ei(() => { fo = fo.filter((e) => e !== n), fo.length === 0 && en && document.removeEventListener("keydown", gm); }); }; let vm; const L0 = () => { const n = Jd(), e = of(), t = ue(() => `${n.value}-popper-container-${e.prefix}`), i = ue(() => `#${t.value}`); return { id: t, selector: i }; }, wE = (n) => { const e = document.createElement("div"); return e.id = n, document.body.appendChild(e), e; }, AE = () => { const { id: n, selector: e } = L0(); return zM(() => { en && (process.env.NODE_ENV === "test" || !vm || !document.body.querySelector(e.value)) && (vm = wE(n.value)); }), { id: n, selector: e }; }, SE = at({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }), _E = ({ showAfter: n, hideAfter: e, autoClose: t, open: i, close: r }) => { const { registerTimeout: s } = mm(), { registerTimeout: o, cancelTimeout: a } = mm(); return { onOpen: (d) => { s(() => { i(d); const h = z(t); yt(h) && h > 0 && o(() => { r(d); }, h); }, z(n)); }, onClose: (d) => { a(), s(() => { r(d); }, z(e)); } }; }, R0 = Symbol("elForwardRef"), TE = (n) => { sn(R0, { setForwardRef: (t) => { n.value = t; } }); }, EE = (n) => ({ mounted(e) { n(e); }, updated(e) { n(e); }, unmounted() { n(null); } }), ym = { current: 0 }, bm = Te(0), F0 = 2e3, xm = Symbol("elZIndexContextKey"), P0 = Symbol("zIndexContextKey"), I0 = (n) => { const e = dn() ? pt(xm, ym) : ym, t = n || (dn() ? pt(P0, void 0) : void 0), i = ue(() => { const o = z(t); return yt(o) ? o : F0; }), r = ue(() => i.value + bm.value), s = () => (e.current++, bm.value = e.current, r.value); return !en && !pt(xm) && Vt("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 CE(n) { let e; function t() { if (n.value == null) return; const { selectionStart: r, selectionEnd: s, value: o } = n.value; if (r == null || s == null) return; const a = o.slice(0, Math.max(0, r)), c = o.slice(Math.max(0, s)); e = { selectionStart: r, selectionEnd: s, value: o, beforeTxt: a, afterTxt: c }; } function i() { if (n.value == null || e == null) return; const { value: r } = n.value, { beforeTxt: s, afterTxt: o, selectionStart: a } = e; if (s == null || o == null || a == null) return; let c = r.length; if (r.endsWith(o)) c = r.length - o.length; else if (r.startsWith(s)) c = s.length; else { const l = s[a - 1], d = r.indexOf(l, a - 1); d !== -1 && (c = d + 1); } n.value.setSelectionRange(c, c); } return [t, i]; } const LE = (n, e, t) => Sc(n.subTree).filter((s) => { var o; return Uh(s) && ((o = s.type) == null ? void 0 : o.name) === e && !!s.component; }).map((s) => s.component.uid).map((s) => t[s]).filter((s) => !!s), RE = (n, e) => { const t = {}, i = En([]); return { children: i, addChild: (o) => { t[o.uid] = o, i.value = LE(n, e, t); }, removeChild: (o) => { delete t[o], i.value = i.value.filter((a) => a.uid !== o); } }; }, Gr = nu({ type: String, values: f0, required: !1 }), O0 = Symbol("size"), FE = () => { const n = pt(O0, {}); return ue(() => z(n.size) || ""); }; function D0(n, { beforeFocus: e, afterFocus: t, beforeBlur: i, afterBlur: r } = {}) { const s = dn(), { emit: o } = s, a = En(), c = Te(!1), l = (f) => { Sn(e) && e(f) || c.value || (c.value = !0, o("focus", f), t == null || t()); }, d = (f) => { var g; Sn(i) && i(f) || f.relatedTarget && ((g = a.value) != null && g.contains(f.relatedTarget)) || (c.value = !1, o("blur", f), r == null || r()); }, h = () => { var f, g; (f = a.value) != null && f.contains(document.activeElement) && a.value !== document.activeElement || (g = n.value) == null || g.focus(); }; return Qe(a, (f) => { f && f.setAttribute("tabindex", "-1"); }), un(a, "focus", l, !0), un(a, "blur", d, !0), un(a, "click", h, !0), process.env.NODE_ENV === "test" && Jt(() => { const f = ys(n.value) ? n.value : document.querySelector("input,textarea"); f && (un(f, "focus", l, !0), un(f, "blur", d, !0)); }), { isFocused: c, wrapperRef: a, handleFocus: l, handleBlur: d }; } function N0({ afterComposition: n, emit: e }) { const t = Te(!1), i = (a) => { e == null || e("compositionstart", a), t.value = !0; }, r = (a) => { var c; e == null || e("compositionupdate", a); const l = (c = a.target) == null ? void 0 : c.value, d = l[l.length - 1] || ""; t.value = !rT(d); }, s = (a) => { e == null || e("compositionend", a), t.value && (t.value = !1, bt(() => n(a))); }; return { isComposing: t, handleComposition: (a) => { a.type === "compositionend" ? s(a) : r(a); }, handleCompositionStart: i, handleCompositionUpdate: r, handleCompositionEnd: s }; } const B0 = Symbol("emptyValuesContextKey"), PE = "use-empty-values", IE = ["", void 0, null], OE = void 0, DE = at({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (n) => Sn(n) ? !n() : !n } }), NE = (n, e) => { const t = dn() ? pt(B0, Te({})) : Te({}), i = ue(() => n.emptyValues || t.value.emptyValues || IE), r = ue(() => Sn(n.valueOnClear) ? n.valueOnClear() : n.valueOnClear !== void 0 ? n.valueOnClear : Sn(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : OE), s = (o) => i.value.includes(o); return i.value.includes(r.value) || Vt(PE, "value-on-clear should be a value of empty-values"), { emptyValues: i, valueOnClear: r, isEmptyValue: s }; }, BE = at({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }), Yr = (n) => P_(BE, n), U0 = Symbol(), Uc = Te(); function af(n, e = void 0) { const t = dn() ? pt(U0, Uc) : Uc; return n ? ue(() => { var i, r; return (r = (i = t.value) == null ? void 0 : i[n]) != null ? r : e; }) : t; } function UE(n, e) { const t = af(), i = nt(n, ue(() => { var a; return ((a = t.value) == null ? void 0 : a.namespace) || _c; })), r = iu(ue(() => { var a; return (a = t.value) == null ? void 0 : a.locale; })), s = I0(ue(() => { var a; return ((a = t.value) == null ? void 0 : a.zIndex) || F0; })), o = ue(() => { var a; return z(e) || ((a = t.value) == null ? void 0 : a.size) || ""; }); return zE(ue(() => z(t) || {})), { ns: i, locale: r, zIndex: s, size: o }; } const zE = (n, e, t = !1) => { var i; const r = !!dn(), s = r ? af() : void 0, o = (i = void 0) != null ? i : r ? sn : void 0; if (!o) { Vt("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup()."); return; } const a = ue(() => { const c = z(n); return s != null && s.value ? VE(s.value, c) : c; }); return o(U0, a), o(m0, ue(() => a.value.locale)), o(g0, ue(() => a.value.namespace)), o(P0, ue(() => a.value.zIndex)), o(O0, { size: ue(() => a.value.size || "") }), o(B0, ue(() => ({ emptyValues: a.value.emptyValues, valueOnClear: a.value.valueOnClear }))), (t || !Uc.value) && (Uc.value = a.value), a; }, VE = (n, e) => { const t = [.../* @__PURE__ */ new Set([...rm(n), ...rm(e)])], i = {}; for (const r of t) i[r] = e[r] !== void 0 ? e[r] : n[r]; return i; }; var st = (n, e) => { const t = n.__vccOpts || n; for (const [i, r] of e) t[i] = r; return t; }; const kE = at({ size: { type: Je([Number, String]) }, color: { type: String } }), GE = Pe({ name: "ElIcon", inheritAttrs: !1 }), HE = /* @__PURE__ */ Pe({ ...GE, props: kE, setup(n) { const e = n, t = nt("icon"), i = ue(() => { const { size: r, color: s } = e; return !r && !s ? {} : { fontSize: di(r) ? void 0 : Dc(r), "--color": s }; }); return (r, s) => (ve(), Le("i", Ei({ class: z(t).b(), style: z(i) }, r.$attrs), [ je(r.$slots, "default") ], 16)); } }); var WE = /* @__PURE__ */ st(HE, [["__file", "icon.vue"]]); const It = on(WE), lf = Symbol("formContextKey"), zc = Symbol("formItemContextKey"), Ns = (n, e = {}) => { const t = Te(void 0), i = e.prop ? t : v0("size"), r = e.global ? t : FE(), s = e.form ? { size: void 0 } : pt(lf, void 0), o = e.formItem ? { size: void 0 } : pt(zc, void 0); return ue(() => i.value || z(n) || (o == null ? void 0 : o.size) || (s == null ? void 0 : s.size) || r.value || ""); }, ol = (n) => { const e = v0("disabled"), t = pt(lf, void 0); return ue(() => e.value || z(n) || (t == null ? void 0 : t.disabled) || !1); }, Jo = () => { const n = pt(lf, void 0), e = pt(zc, void 0); return { form: n, formItem: e }; }, su = (n, { formItemContext: e, disableIdGeneration: t, disableIdManagement: i }) => { t || (t = Te(!1)), i || (i = Te(!1)); const r = Te(); let s; const o = ue(() => { var a; return !!(!(n.label || n.ariaLabel) && e && e.inputIds && ((a = e.inputIds) == null ? void 0 : a.length) <= 1); }); return Jt(() => { s = Qe([hi(n, "id"), t], ([a, c]) => { const l = a ?? (c ? void 0 : sl().value); l !== r.value && (e != null && e.removeInputId && (r.value && e.removeInputId(r.value), !(i != null && i.value) && !c && l && e.addInputId(l)), r.value = l); }, { immediate: !0 }); }), Uv(() => { s && s(), e != null && e.removeInputId && r.value && e.removeInputId(r.value); }), { isLabeledByFormItem: o, inputId: r }; }; let ii; const jE = ` height:0 !important; visibility:hidden !important; ${Iw() ? "" : "overflow:hidden !important;"} position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; `, $E = [ "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 ZE(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: $E.map((o) => `${o}:${e.getPropertyValue(o)}`).join(";"), paddingSize: i, borderSize: r, boxSizing: t }; } function Mm(n, e = 1, t) { var i; ii || (ii = document.createElement("textarea"), document.body.appendChild(ii)); const { paddingSize: r, borderSize: s, boxSizing: o, contextStyle: a } = ZE(n); ii.setAttribute("style", `${a};${jE}`), ii.value = n.value || n.placeholder || ""; let c = ii.scrollHeight; const l = {}; o === "border-box" ? c = c + s : o === "content-box" && (c = c - r), ii.value = ""; const d = ii.scrollHeight - r; if (yt(e)) { let h = d * e; o === "border-box" && (h = h + r + s), c = Math.max(h, c), l.minHeight = `${h}px`; } if (yt(t)) { let h = d * t; o === "border-box" && (h = h + r + s), c = Math.min(h, c); } return l.height = `${c}px`, (i = ii.parentNode) == null || i.removeChild(ii), ii = void 0, l; } const XE = at({ id: { type: String, default: void 0 }, size: Gr, disabled: Boolean, modelValue: { type: Je([ String, Number, Object ]), default: "" }, maxlength: { type: [String, Number] }, minlength: { type: [String, Number] }, type: { type: String, default: "text" }, resize: { type: String, values: ["none", "both", "horizontal", "vertical"] }, autosize: { type: Je([Boolean, Object]), default: !1 }, autocomplete: { type: String, default: "off" }, formatter: { type: Function }, parser: { type: Function }, placeholder: { type: String }, form: { type: String }, readonly: Boolean, clearable: Boolean, showPassword: Boolean, showWordLimit: Boolean, suffixIcon: { type: kr }, prefixIcon: { type: kr }, containerRole: { type: String, default: void 0 }, tabindex: { type: [String, Number], default: 0 }, validateEvent: { type: Boolean, default: !0 }, inputStyle: { type: Je([Object, Array, String]), default: () => Ki({}) }, autofocus: Boolean, rows: { type: Number, default: 2 }, ...Yr(["ariaLabel"]) }), YE = { [At]: (n) => vn(n), input: (n) => vn(n), change: (n) => vn(n), focus: (n) => n instanceof FocusEvent, blur: (n) => n instanceof FocusEvent, clear: () => !0, mouseleave: (n) => n instanceof MouseEvent, mouseenter: (n) => n instanceof MouseEvent, keydown: (n) => n instanceof Event, compositionstart: (n) => n instanceof CompositionEvent, compositionupdate: (n) => n instanceof CompositionEvent, compositionend: (n) => n instanceof CompositionEvent }, JE = Pe({ name: "ElInput", inheritAttrs: !1 }), KE = /* @__PURE__ */ Pe({ ...JE, props: XE, emits: YE, setup(n, { expose: e, emit: t }) { const i = n, r = VM(), s = Xc(), o = ue(() => { const he = {}; return i.containerRole === "combobox" && (he["aria-haspopup"] = r["aria-haspopup"], he["aria-owns"] = r["aria-owns"], he["aria-expanded"] = r["aria-expanded"]), he; }), a = ue(() => [ i.type === "textarea" ? y.b() : u.b(), u.m(g.value), u.is("disabled", p.value), u.is("exceed", 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")]: N.value && B.value, [u.b("hidden")]: i.type === "hidden" }, r.class ]), c = ue(() => [ u.e("wrapper"), u.is("focus", S.value) ]), l = aT({ excludeKeys: ue(() => Object.keys(o.value)) }), { form: d, formItem: h } = Jo(), { inputId: f } = su(i, { formItemContext: h }), g = Ns(), p = ol(), u = nt("input"), y = nt("textarea"), v = En(), m = En(), x = Te(!1), w = Te(!1), A = Te(), M = En(i.inputStyle), R = ue(() => v.value || m.value), { wrapperRef: L, isFocused: S, handleFocus: I, handleBlur: T } = D0(R, { beforeFocus() { return p.value; }, afterBlur() { var he; i.validateEvent && ((he = h == null ? void 0 : h.validate) == null || he.call(h, "blur").catch((xe) => Vt(xe))); } }), _ = ue(() => { var he; return (he = d == null ? void 0 : d.statusIcon) != null ? he : !1; }), E = ue(() => (h == null ? void 0 : h.validateState) || ""), C = ue(() => E.value && d0[E.value]), P = ue(() => w.value ? eT : X_), b = ue(() => [ r.style ]), F = ue(() => [ i.inputStyle, M.value, { resize: i.resize } ]), D = ue(() => Ci(i.modelValue) ? "" : String(i.modelValue)), N = ue(() => i.clearable && !p.value && !i.readonly && !!D.value && (S.value || x.value)), B = ue(() => i.showPassword && !p.value && !i.readonly && !!D.value && (!!D.value || S.value)), U = ue(() => i.showWordLimit && !!i.maxlength && (i.type === "text" || i.type === "textarea") && !p.value && !i.readonly && !i.showPassword), G = ue(() => D.value.length), Y = ue(() => !!U.value && G.value > Number(i.maxlength)), te = ue(() => !!s.suffix || !!i.suffixIcon || N.value || i.showPassword || U.value || !!E.value && _.value), [ae, ie] = CE(v); Yn(m, (he) => { if ($(), !U.value || i.resize !== "both") return; const xe = he[0], { width: ne } = xe.contentRect; A.value = { right: `calc(100% - ${ne + 15 + 6}px)` }; }); const le = () => { const { type: he, autosize: xe } = i; if (!(!en || he !== "textarea" || !m.value)) if (xe) { const ne = Tn(xe) ? xe.minRows : void 0, me = Tn(xe) ? xe.maxRows : void 0, Me = Mm(m.value, ne, me); M.value = { overflowY: "hidden", ...Me }, bt(() => { m.value.offsetHeight, M.value = Me; }); } else M.value = { minHeight: Mm(m.value).minHeight }; }, $ = ((he) => { let xe = !1; return () => { var ne; if (xe || !i.autosize) return; ((ne = m.value) == null ? void 0 : ne.offsetParent) === null || (he(), xe = !0); }; })(le), j = () => { const he = R.value, xe = i.formatter ? i.formatter(D.value) : D.value; !he || he.value === xe || (he.value = xe); }, re = async (he) => { ae(); let { value: xe } = he.target; if (i.formatter && (xe = i.parser ? i.parser(xe) : xe), !H.value) { if (xe === D.value) { j(); return; } t(At, xe), t("input", xe), await bt(), j(), ie(); } }, V = (he) => { t("change", he.target.value); }, { isComposing: H, handleCompositionStart: K, handleCompositionUpdate: ce, handleCompositionEnd: se } = N0({ emit: t, afterComposition: re }), k = () => { w.value = !w.value, O(); }, O = async () => { var he; await bt(), (he = R.value) == null || he.focus(); }, Z = () => { var he; return (he = R.value) == null ? void 0 : he.blur(); }, X = (he) => { x.value = !1, t("mouseleave", he); }, ee = (he) => { x.value = !0, t("mouseenter", he); }, fe = (he) => { t("keydown", he); }, be = () => { var he; (he = R.value) == null || he.select(); }, Ae = () => { t(At, ""), t("change", ""), t("clear"), t("input", ""); }; return Qe(() => i.modelValue, () => { var he; bt(() => le()), i.validateEvent && ((he = h == null ? void 0 : h.validate) == null || he.call(h, "change").catch((xe) => Vt(xe))); }), Qe(D, () => j()), Qe(() => i.type, async () => { await bt(), j(), le(); }), Jt(() => { !i.formatter && i.parser && Vt("ElInput", "If you set the parser, you also need to set the formatter."), j(), bt(le); }), e({ input: v, textarea: m, ref: R, textareaStyle: F, autosize: hi(i, "autosize"), isComposing: H, focus: O, blur: Z, select: be, clear: Ae, resizeTextarea: le }), (he, xe) => (ve(), Le("div", Ei(z(o), { class: [ z(a), { [z(u).bm("group", "append")]: he.$slots.append, [z(u).bm("group", "prepend")]: he.$slots.prepend } ], style: z(b), role: he.containerRole, onMouseenter: ee, onMouseleave: X }), [ Ve(" input "), he.type !== "textarea" ? (ve(), Le(Pt, { key: 0 }, [ Ve(" prepend slot "), he.$slots.prepend ? (ve(), Le("div", { key: 0, class: Ee(z(u).be("group", "prepend")) }, [ je(he.$slots, "prepend") ], 2)) : Ve("v-if", !0), Ne("div", { ref_key: "wrapperRef", ref: L, class: Ee(z(c)) }, [ Ve(" prefix slot "), he.$slots.prefix || he.prefixIcon ? (ve(), Le("span", { key: 0, class: Ee(z(u).e("prefix")) }, [ Ne("span", { class: Ee(z(u).e("prefix-inner")) }, [ je(he.$slots, "prefix"), he.prefixIcon ? (ve(), ke(z(It), { key: 0, class: Ee(z(u).e("icon")) }, { default: de(() => [ (ve(), ke(Fn(he.prefixIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 2)) : Ve("v-if", !0), Ne("input", Ei({ id: z(f), ref_key: "input", ref: v, class: z(u).e("inner") }, z(l), { minlength: he.minlength, maxlength: he.maxlength, type: he.showPassword ? w.value ? "text" : "password" : he.type, disabled: z(p), readonly: he.readonly, autocomplete: he.autocomplete, tabindex: he.tabindex, "aria-label": he.ariaLabel, placeholder: he.placeholder, style: he.inputStyle, form: he.form, autofocus: he.autofocus, onCompositionstart: z(K), onCompositionupdate: z(ce), onCompositionend: z(se), onInput: re, onChange: V, onKeydown: fe }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]), Ve(" suffix slot "), z(te) ? (ve(), Le("span", { key: 1, class: Ee(z(u).e("suffix")) }, [ Ne("span", { class: Ee(z(u).e("suffix-inner")) }, [ !z(N) || !z(B) || !z(U) ? (ve(), Le(Pt, { key: 0 }, [ je(he.$slots, "suffix"), he.suffixIcon ? (ve(), ke(z(It), { key: 0, class: Ee(z(u).e("icon")) }, { default: de(() => [ (ve(), ke(Fn(he.suffixIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 64)) : Ve("v-if", !0), z(N) ? (ve(), ke(z(It), { key: 1, class: Ee([z(u).e("icon"), z(u).e("clear")]), onMousedown: Ut(z(Oa), ["prevent"]), onClick: Ae }, { default: de(() => [ oe(z(Yd)) ]), _: 1 }, 8, ["class", "onMousedown"])) : Ve("v-if", !0), z(B) ? (ve(), ke(z(It), { key: 2, class: Ee([z(u).e("icon"), z(u).e("password")]), onClick: k }, { default: de(() => [ (ve(), ke(Fn(z(P)))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0), z(U) ? (ve(), Le("span", { key: 3, class: Ee(z(u).e("count")) }, [ Ne("span", { class: Ee(z(u).e("count-inner")) }, vt(z(G)) + " / " + vt(he.maxlength), 3) ], 2)) : Ve("v-if", !0), z(E) && z(C) && z(_) ? (ve(), ke(z(It), { key: 4, class: Ee([ z(u).e("icon"), z(u).e("validateIcon"), z(u).is("loading", z(E) === "validating") ]) }, { default: de(() => [ (ve(), ke(Fn(z(C)))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 2)) : Ve("v-if", !0) ], 2), Ve(" append slot "), he.$slots.append ? (ve(), Le("div", { key: 1, class: Ee(z(u).be("group", "append")) }, [ je(he.$slots, "append") ], 2)) : Ve("v-if", !0) ], 64)) : (ve(), Le(Pt, { key: 1 }, [ Ve(" textarea "), Ne("textarea", Ei({ id: z(f), ref_key: "textarea", ref: m, class: [z(y).e("inner"), z(u).is("focus", z(S))] }, z(l), { minlength: he.minlength, maxlength: he.maxlength, tabindex: he.tabindex, disabled: z(p), readonly: he.readonly, autocomplete: he.autocomplete, style: z(F), "aria-label": he.ariaLabel, placeholder: he.placeholder, form: he.form, autofocus: he.autofocus, rows: he.rows, onCompositionstart: z(K), onCompositionupdate: z(ce), onCompositionend: z(se), onInput: re, onFocus: z(I), onBlur: z(T), onChange: V, onKeydown: fe }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]), z(U) ? (ve(), Le("span", { key: 0, style: Rt(A.value), class: Ee(z(u).e("count")) }, vt(z(G)) + " / " + vt(he.maxlength), 7)) : Ve("v-if", !0) ], 64)) ], 16, ["role"])); } }); var qE = /* @__PURE__ */ st(KE, [["__file", "input.vue"]]); const QE = on(qE), Hs = 4, e2 = { 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" } }, t2 = ({ move: n, size: e, bar: t }) => ({ [t.size]: e, transform: `translate${t.axis}(${n}%)` }), cf = Symbol("scrollbarContextKey"), n2 = at({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: !0 }, always: Boolean }), i2 = "Thumb", r2 = /* @__PURE__ */ Pe({ __name: "thumb", props: n2, setup(n) { const e = n, t = pt(cf), i = nt("scrollbar"); t || Xo(i2, "can not inject scrollbar context"); const r = Te(), s = Te(), o = Te({}), a = Te(!1); let c = !1, l = !1, d = en ? document.onselectstart : null; const h = ue(() => e2[e.vertical ? "vertical" : "horizontal"]), f = ue(() => t2({ size: e.size, move: e.move, bar: h.value })), g = ue(() => r.value[h.value.offset] ** 2 / t.wrapElement[h.value.scrollSize] / e.ratio / s.value[h.value.offset]), p = (M) => { var R; if (M.stopPropagation(), M.ctrlKey || [1, 2].includes(M.button)) return; (R = window.getSelection()) == null || R.removeAllRanges(), y(M); const L = M.currentTarget; L && (o.value[h.value.axis] = L[h.value.offset] - (M[h.value.client] - L.getBoundingClientRect()[h.value.direction])); }, u = (M) => { if (!s.value || !r.value || !t.wrapElement) return; const R = Math.abs(M.target.getBoundingClientRect()[h.value.direction] - M[h.value.client]), L = s.value[h.value.offset] / 2, S = (R - L) * 100 * g.value / r.value[h.value.offset]; t.wrapElement[h.value.scroll] = S * t.wrapElement[h.value.scrollSize] / 100; }, y = (M) => { M.stopImmediatePropagation(), c = !0, document.addEventListener("mousemove", v), document.addEventListener("mouseup", m), d = document.onselectstart, document.onselectstart = () => !1; }, v = (M) => { if (!r.value || !s.value || c === !1) return; const R = o.value[h.value.axis]; if (!R) return; const L = (r.value.getBoundingClientRect()[h.value.direction] - M[h.value.client]) * -1, S = s.value[h.value.offset] - R, I = (L - S) * 100 * g.value / r.value[h.value.offset]; t.wrapElement[h.value.scroll] = I * t.wrapElement[h.value.scrollSize] / 100; }, m = () => { c = !1, o.value[h.value.axis] = 0, document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", m), A(), l && (a.value = !1); }, x = () => { l = !1, a.value = !!e.size; }, w = () => { l = !0, a.value = c; }; ei(() => { A(), document.removeEventListener("mouseup", m); }); const A = () => { document.onselectstart !== d && (document.onselectstart = d); }; return un(hi(t, "scrollbarElement"), "mousemove", x), un(hi(t, "scrollbarElement"), "mouseleave", w), (M, R) => (ve(), ke(el, { name: z(i).b("fade"), persisted: "" }, { default: de(() => [ Lt(Ne("div", { ref_key: "instance", ref: r, class: Ee([z(i).e("bar"), z(i).is(z(h).key)]), onMousedown: u }, [ Ne("div", { ref_key: "thumb", ref: s, class: Ee(z(i).e("thumb")), style: Rt(z(f)), onMousedown: p }, null, 38) ], 34), [ [mn, M.always || a.value] ]) ]), _: 1 }, 8, ["name"])); } }); var wm = /* @__PURE__ */ st(r2, [["__file", "thumb.vue"]]); const s2 = at({ always: { type: Boolean, default: !0 }, minSize: { type: Number, required: !0 } }), o2 = /* @__PURE__ */ Pe({ __name: "bar", props: s2, setup(n, { expose: e }) { const t = n, i = pt(cf), r = Te(0), s = Te(0), o = Te(""), a = Te(""), c = Te(1), l = Te(1); return e({ handleScroll: (f) => { if (f) { const g = f.offsetHeight - Hs, p = f.offsetWidth - Hs; s.value = f.scrollTop * 100 / g * c.value, r.value = f.scrollLeft * 100 / p * l.value; } }, update: () => { const f = i == null ? void 0 : i.wrapElement; if (!f) return; const g = f.offsetHeight - Hs, p = f.offsetWidth - Hs, u = g ** 2 / f.scrollHeight, y = p ** 2 / f.scrollWidth, v = Math.max(u, t.minSize), m = Math.max(y, t.minSize); c.value = u / (g - u) / (v / (g - v)), l.value = y / (p - y) / (m / (p - m)), a.value = v + Hs < g ? `${v}px` : "", o.value = m + Hs < p ? `${m}px` : ""; } }), (f, g) => (ve(), Le(Pt, null, [ oe(wm, { move: r.value, ratio: l.value, size: o.value, always: f.always }, null, 8, ["move", "ratio", "size", "always"]), oe(wm, { move: s.value, ratio: c.value, size: a.value, vertical: "", always: f.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var a2 = /* @__PURE__ */ st(o2, [["__file", "bar.vue"]]); const l2 = at({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: !1 }, wrapStyle: { type: Je([String, Object, Array]), default: "" }, wrapClass: { type: [String, Array], default: "" }, viewClass: { type: [String, Array], default: "" }, viewStyle: { type: [String, Array, Object], default: "" }, noresize: Boolean, tag: { type: String, default: "div" }, always: Boolean, minSize: { type: Number, default: 20 }, tabindex: { type: [String, Number], default: void 0 }, id: String, role: String, ...Yr(["ariaLabel", "ariaOrientation"]) }), c2 = { scroll: ({ scrollTop: n, scrollLeft: e }) => [n, e].every(yt) }, Jh = "ElScrollbar", u2 = Pe({ name: Jh }), h2 = /* @__PURE__ */ Pe({ ...u2, props: l2, emits: c2, setup(n, { expose: e, emit: t }) { const i = n, r = nt("scrollbar"); let s, o, a = 0, c = 0; const l = Te(), d = Te(), h = Te(), f = Te(), g = ue(() => { const A = {}; return i.height && (A.height = Dc(i.height)), i.maxHeight && (A.maxHeight = Dc(i.maxHeight)), [i.wrapStyle, A]; }), p = ue(() => [ i.wrapClass, r.e("wrap"), { [r.em("wrap", "hidden-default")]: !i.native } ]), u = ue(() => [r.e("view"), i.viewClass]), y = () => { var A; d.value && ((A = f.value) == null || A.handleScroll(d.value), a = d.value.scrollTop, c = d.value.scrollLeft, t("scroll", { scrollTop: d.value.scrollTop, scrollLeft: d.value.scrollLeft })); }; function v(A, M) { Tn(A) ? d.value.scrollTo(A) : yt(A) && yt(M) && d.value.scrollTo(A, M); } const m = (A) => { if (!yt(A)) { Vt(Jh, "value must be a number"); return; } d.value.scrollTop = A; }, x = (A) => { if (!yt(A)) { Vt(Jh, "value must be a number"); return; } d.value.scrollLeft = A; }, w = () => { var A; (A = f.value) == null || A.update(); }; return Qe(() => i.noresize, (A) => { A ? (s == null || s(), o == null || o()) : ({ stop: s } = Yn(h, w), o = un("resize", w)); }, { immediate: !0 }), Qe(() => [i.maxHeight, i.height], () => { i.native || bt(() => { var A; w(), d.value && ((A = f.value) == null || A.handleScroll(d.value)); }); }), sn(cf, Wn({ scrollbarElement: l, wrapElement: d })), kM(() => { d.value && (d.value.scrollTop = a, d.value.scrollLeft = c); }), Jt(() => { i.native || bt(() => { w(); }); }), zd(() => w()), e({ wrapRef: d, update: w, scrollTo: v, setScrollTop: m, setScrollLeft: x, handleScroll: y }), (A, M) => (ve(), Le("div", { ref_key: "scrollbarRef", ref: l, class: Ee(z(r).b()) }, [ Ne("div", { ref_key: "wrapRef", ref: d, class: Ee(z(p)), style: Rt(z(g)), tabindex: A.tabindex, onScroll: y }, [ (ve(), ke(Fn(A.tag), { id: A.id, ref_key: "resizeRef", ref: h, class: Ee(z(u)), style: Rt(A.viewStyle), role: A.role, "aria-label": A.ariaLabel, "aria-orientation": A.ariaOrientation }, { default: de(() => [ je(A.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), A.native ? Ve("v-if", !0) : (ve(), ke(a2, { key: 0, ref_key: "barRef", ref: f, always: A.always, "min-size": A.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var d2 = /* @__PURE__ */ st(h2, [["__file", "scrollbar.vue"]]); const f2 = on(d2), uf = Symbol("popper"), z0 = Symbol("popperContent"), p2 = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ], V0 = at({ role: { type: String, values: p2, default: "tooltip" } }), m2 = Pe({ name: "ElPopper", inheritAttrs: !1 }), g2 = /* @__PURE__ */ Pe({ ...m2, props: V0, setup(n, { expose: e }) { const t = n, i = Te(), r = Te(), s = Te(), o = Te(), a = ue(() => t.role), c = { triggerRef: i, popperInstanceRef: r, contentRef: s, referenceRef: o, role: a }; return e(c), sn(uf, c), (l, d) => je(l.$slots, "default"); } }); var v2 = /* @__PURE__ */ st(g2, [["__file", "popper.vue"]]); const k0 = at({ arrowOffset: { type: Number, default: 5 } }), y2 = Pe({ name: "ElPopperArrow", inheritAttrs: !1 }), b2 = /* @__PURE__ */ Pe({ ...y2, props: k0, setup(n, { expose: e }) { const t = n, i = nt("popper"), { arrowOffset: r, arrowRef: s, arrowStyle: o } = pt(z0, void 0); return Qe(() => t.arrowOffset, (a) => { r.value = a; }), ei(() => { s.value = void 0; }), e({ arrowRef: s }), (a, c) => (ve(), Le("span", { ref_key: "arrowRef", ref: s, class: Ee(z(i).e("arrow")), style: Rt(z(o)), "data-popper-arrow": "" }, null, 6)); } }); var x2 = /* @__PURE__ */ st(b2, [["__file", "arrow.vue"]]); const Bu = "ElOnlyChild", M2 = Pe({ name: Bu, setup(n, { slots: e, attrs: t }) { var i; const r = pt(R0), s = EE((i = r == null ? void 0 : r.setForwardRef) != null ? i : Oa); return () => { var o; const a = (o = e.default) == null ? void 0 : o.call(e, t); if (!a) return null; if (a.length > 1) return Vt(Bu, "requires exact only one valid child."), null; const c = G0(a); return c ? Lt(GM(c, t), [[s]]) : (Vt(Bu, "no valid child node found"), null); }; } }); function G0(n) { if (!n) return null; const e = n; for (const t of e) { if (Tn(t)) switch (t.type) { case HM: continue; case zv: case "svg": return Am(t); case Pt: return G0(t.children); default: return t; } return Am(t); } return null; } function Am(n) { const e = nt("only-child"); return oe("span", { class: e.e("content") }, [n]); } const H0 = at({ virtualRef: { type: Je(Object) }, virtualTriggering: Boolean, onMouseenter: { type: Je(Function) }, onMouseleave: { type: Je(Function) }, onClick: { type: Je(Function) }, onKeydown: { type: Je(Function) }, onFocus: { type: Je(Function) }, onBlur: { type: Je(Function) }, onContextmenu: { type: Je(Function) }, id: String, open: Boolean }), w2 = Pe({ name: "ElPopperTrigger", inheritAttrs: !1 }), A2 = /* @__PURE__ */ Pe({ ...w2, props: H0, setup(n, { expose: e }) { const t = n, { role: i, triggerRef: r } = pt(uf, void 0); TE(r); const s = ue(() => a.value ? t.id : void 0), o = ue(() => { if (i && i.value === "tooltip") return t.open && t.id ? t.id : void 0; }), a = ue(() => { if (i && i.value !== "tooltip") return i.value; }), c = ue(() => a.value ? `${t.open}` : void 0); let l; const d = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return Jt(() => { Qe(() => t.virtualRef, (h) => { h && (r.value = Qi(h)); }, { immediate: !0 }), Qe(r, (h, f) => { l == null || l(), l = void 0, ys(h) && (d.forEach((g) => { var p; const u = t[g]; u && (h.addEventListener(g.slice(2).toLowerCase(), u), (p = f == null ? void 0 : f.removeEventListener) == null || p.call(f, g.slice(2).toLowerCase(), u)); }), l = Qe([s, o, a, c], (g) => { [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((p, u) => { Ci(g[u]) ? h.removeAttribute(p) : h.setAttribute(p, g[u]); }); }, { immediate: !0 })), ys(f) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((g) => f.removeAttribute(g)); }, { immediate: !0 }); }), ei(() => { if (l == null || l(), l = void 0, r.value && ys(r.value)) { const h = r.value; d.forEach((f) => { const g = t[f]; g && h.removeEventListener(f.slice(2).toLowerCase(), g); }), r.value = void 0; } }), e({ triggerRef: r }), (h, f) => h.virtualTriggering ? Ve("v-if", !0) : (ve(), ke(z(M2), Ei({ key: 0 }, h.$attrs, { "aria-controls": z(s), "aria-describedby": z(o), "aria-expanded": z(c), "aria-haspopup": z(a) }), { default: de(() => [ je(h.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var S2 = /* @__PURE__ */ st(A2, [["__file", "trigger.vue"]]); const Uu = "focus-trap.focus-after-trapped", zu = "focus-trap.focus-after-released", _2 = "focus-trap.focusout-prevented", Sm = { cancelable: !0, bubbles: !1 }, T2 = { cancelable: !0, bubbles: !1 }, _m = "focusAfterTrapped", Tm = "focusAfterReleased", E2 = Symbol("elFocusTrap"), hf = Te(), ou = Te(0), df = Te(0); let El = 0; const W0 = (n) => { const e = [], t = document.createTreeWalker(n, NodeFilter.SHOW_ELEMENT, { acceptNode: (i) => { const r = i.tagName === "INPUT" && i.type === "hidden"; return i.disabled || i.hidden || r ? NodeFilter.FILTER_SKIP : i.tabIndex >= 0 || i === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; t.nextNode(); ) e.push(t.currentNode); return e; }, Em = (n, e) => { for (const t of n) if (!C2(t, e)) return t; }, C2 = (n, e) => { if (process.env.NODE_ENV === "test") return !1; if (getComputedStyle(n).visibility === "hidden") return !0; for (; n; ) { if (e && n === e) return !1; if (getComputedStyle(n).display === "none") return !0; n = n.parentElement; } return !1; }, L2 = (n) => { const e = W0(n), t = Em(e, n), i = Em(e.reverse(), n); return [t, i]; }, R2 = (n) => n instanceof HTMLInputElement && "select" in n, Tr = (n, e) => { if (n && n.focus) { const t = document.activeElement; n.focus({ preventScroll: !0 }), df.value = window.performance.now(), n !== t && R2(n) && e && n.select(); } }; function Cm(n, e) { const t = [...n], i = n.indexOf(e); return i !== -1 && t.splice(i, 1), t; } const F2 = () => { let n = []; return { push: (i) => { const r = n[0]; r && i !== r && r.pause(), n = Cm(n, i), n.unshift(i); }, remove: (i) => { var r, s; n = Cm(n, i), (s = (r = n[0]) == null ? void 0 : r.resume) == null || s.call(r); } }; }, P2 = (n, e = !1) => { const t = document.activeElement; for (const i of n) if (Tr(i, e), document.activeElement !== t) return; }, Lm = F2(), I2 = () => ou.value > df.value, Cl = () => { hf.value = "pointer", ou.value = window.performance.now(); }, Rm = () => { hf.value = "keyboard", ou.value = window.performance.now(); }, O2 = () => (Jt(() => { El === 0 && (document.addEventListener("mousedown", Cl), document.addEventListener("touchstart", Cl), document.addEventListener("keydown", Rm)), El++; }), ei(() => { El--, El <= 0 && (document.removeEventListener("mousedown", Cl), document.removeEventListener("touchstart", Cl), document.removeEventListener("keydown", Rm)); }), { focusReason: hf, lastUserFocusTimestamp: ou, lastAutomatedFocusTimestamp: df }), Ll = (n) => new CustomEvent(_2, { ...T2, detail: n }), D2 = Pe({ name: "ElFocusTrap", inheritAttrs: !1, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ _m, Tm, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(n, { emit: e }) { const t = Te(); let i, r; const { focusReason: s } = O2(); ME((p) => { n.trapped && !o.paused && e("release-requested", p); }); const o = { paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }, a = (p) => { if (!n.loop && !n.trapped || o.paused) return; const { key: u, altKey: y, ctrlKey: v, metaKey: m, currentTarget: x, shiftKey: w } = p, { loop: A } = n, M = u === Li.tab && !y && !v && !m, R = document.activeElement; if (M && R) { const L = x, [S, I] = L2(L); if (S && I) { if (!w && R === I) { const _ = Ll({ focusReason: s.value }); e("focusout-prevented", _), _.defaultPrevented || (p.preventDefault(), A && Tr(S, !0)); } else if (w && [S, L].includes(R)) { const _ = Ll({ focusReason: s.value }); e("focusout-prevented", _), _.defaultPrevented || (p.preventDefault(), A && Tr(I, !0)); } } else if (R === L) { const _ = Ll({ focusReason: s.value }); e("focusout-prevented", _), _.defaultPrevented || p.preventDefault(); } } }; sn(E2, { focusTrapRef: t, onKeydown: a }), Qe(() => n.focusTrapEl, (p) => { p && (t.value = p); }, { immediate: !0 }), Qe([t], ([p], [u]) => { p && (p.addEventListener("keydown", a), p.addEventListener("focusin", d), p.addEventListener("focusout", h)), u && (u.removeEventListener("keydown", a), u.removeEventListener("focusin", d), u.removeEventListener("focusout", h)); }); const c = (p) => { e(_m, p); }, l = (p) => e(Tm, p), d = (p) => { const u = z(t); if (!u) return; const y = p.target, v = p.relatedTarget, m = y && u.contains(y); n.trapped || v && u.contains(v) || (i = v), m && e("focusin", p), !o.paused && n.trapped && (m ? r = y : Tr(r, !0)); }, h = (p) => { const u = z(t); if (!(o.paused || !u)) if (n.trapped) { const y = p.relatedTarget; !Ci(y) && !u.contains(y) && setTimeout(() => { if (!o.paused && n.trapped) { const v = Ll({ focusReason: s.value }); e("focusout-prevented", v), v.defaultPrevented || Tr(r, !0); } }, 0); } else { const y = p.target; y && u.contains(y) || e("focusout", p); } }; async function f() { await bt(); const p = z(t); if (p) { Lm.push(o); const u = p.contains(document.activeElement) ? i : document.activeElement; if (i = u, !p.contains(u)) { const v = new Event(Uu, Sm); p.addEventListener(Uu, c), p.dispatchEvent(v), v.defaultPrevented || bt(() => { let m = n.focusStartEl; vn(m) || (Tr(m), document.activeElement !== m && (m = "first")), m === "first" && P2(W0(p), !0), (document.activeElement === u || m === "container") && Tr(p); }); } } } function g() { const p = z(t); if (p) { p.removeEventListener(Uu, c); const u = new CustomEvent(zu, { ...Sm, detail: { focusReason: s.value } }); p.addEventListener(zu, l), p.dispatchEvent(u), !u.defaultPrevented && (s.value == "keyboard" || !I2() || p.contains(document.activeElement)) && Tr(i ?? document.body), p.removeEventListener(zu, l), Lm.remove(o); } } return Jt(() => { n.trapped && f(), Qe(() => n.trapped, (p) => { p ? f() : g(); }); }), ei(() => { n.trapped && g(), t.value && (t.value.removeEventListener("keydown", a), t.value.removeEventListener("focusin", d), t.value.removeEventListener("focusout", h), t.value = void 0); }), { onKeydown: a }; } }); function N2(n, e, t, i, r, s) { return je(n.$slots, "default", { handleKeydown: n.onKeydown }); } var B2 = /* @__PURE__ */ st(D2, [["render", N2], ["__file", "focus-trap.vue"]]); const U2 = ["fixed", "absolute"], z2 = at({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: Je(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: !0 }, offset: { type: Number, default: 12 }, placement: { type: String, values: Yo, default: "bottom" }, popperOptions: { type: Je(Object), default: () => ({}) }, strategy: { type: String, values: U2, default: "absolute" } }), j0 = at({ ...z2, id: String, style: { type: Je([String, Array, Object]) }, className: { type: Je([String, Array, Object]) }, effect: { type: Je(String), default: "dark" }, visible: Boolean, enterable: { type: Boolean, default: !0 }, pure: Boolean, focusOnShow: { type: Boolean, default: !1 }, trapping: { type: Boolean, default: !1 }, popperClass: { type: Je([String, Array, Object]) }, popperStyle: { type: Je([String, Array, Object]) }, referenceEl: { type: Je(Object) }, triggerTargetEl: { type: Je(Object) }, stopPopperMouseEvent: { type: Boolean, default: !0 }, virtualTriggering: Boolean, zIndex: Number, ...Yr(["ariaLabel"]) }), V2 = { mouseenter: (n) => n instanceof MouseEvent, mouseleave: (n) => n instanceof MouseEvent, focus: () => !0, blur: () => !0, close: () => !0 }, k2 = (n, e = []) => { const { placement: t, strategy: i, popperOptions: r } = n, s = { placement: t, strategy: i, ...r, modifiers: [...H2(n), ...e] }; return W2(s, r == null ? void 0 : r.modifiers), s; }, G2 = (n) => { if (en) return Qi(n); }; function H2(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 W2(n, e) { e && (n.modifiers = [...n.modifiers, ...e ?? []]); } const j2 = 0, $2 = (n) => { const { popperInstanceRef: e, contentRef: t, triggerRef: i, role: r } = pt(uf, void 0), s = Te(), o = Te(), a = ue(() => ({ name: "eventListeners", enabled: !!n.visible })), c = ue(() => { var v; const m = z(s), x = (v = z(o)) != null ? v : j2; return { name: "arrow", enabled: !C_(m), options: { element: m, padding: x } }; }), l = ue(() => ({ onFirstUpdate: () => { p(); }, ...k2(n, [ z(c), z(a) ]) })), d = ue(() => G2(n.referenceEl) || z(i)), { attributes: h, state: f, styles: g, update: p, forceUpdate: u, instanceRef: y } = yE(d, t, l); return Qe(y, (v) => e.value = v), Jt(() => { Qe(() => { var v; return (v = z(d)) == null ? void 0 : v.getBoundingClientRect(); }, () => { p(); }); }), { attributes: h, arrowRef: s, contentRef: t, instanceRef: y, state: f, styles: g, role: r, forceUpdate: u, update: p }; }, Z2 = (n, { attributes: e, styles: t, role: i }) => { const { nextZIndex: r } = I0(), s = nt("popper"), o = ue(() => z(e).popper), a = Te(yt(n.zIndex) ? n.zIndex : r()), c = ue(() => [ s.b(), s.is("pure", n.pure), s.is(n.effect), n.popperClass ]), l = ue(() => [ { zIndex: z(a) }, z(t).popper, n.popperStyle || {} ]), d = ue(() => i.value === "dialog" ? "false" : void 0), h = ue(() => z(t).arrow || {}); return { ariaModal: d, arrowStyle: h, contentAttrs: o, contentClass: c, contentStyle: l, contentZIndex: a, updateZIndex: () => { a.value = yt(n.zIndex) ? n.zIndex : r(); } }; }, X2 = (n, e) => { const t = Te(!1), i = Te(); return { focusStartRef: i, trapped: t, onFocusAfterReleased: (l) => { var d; ((d = l.detail) == null ? void 0 : d.focusReason) !== "pointer" && (i.value = "first", e("blur")); }, onFocusAfterTrapped: () => { e("focus"); }, onFocusInTrap: (l) => { n.visible && !t.value && (l.target && (i.value = l.target), t.value = !0); }, onFocusoutPrevented: (l) => { n.trapping || (l.detail.focusReason === "pointer" && l.preventDefault(), t.value = !1); }, onReleaseRequested: () => { t.value = !1, e("close"); } }; }, Y2 = Pe({ name: "ElPopperContent" }), J2 = /* @__PURE__ */ Pe({ ...Y2, props: j0, emits: V2, setup(n, { expose: e, emit: t }) { const i = n, { focusStartRef: r, trapped: s, onFocusAfterReleased: o, onFocusAfterTrapped: a, onFocusInTrap: c, onFocusoutPrevented: l, onReleaseRequested: d } = X2(i, t), { attributes: h, arrowRef: f, contentRef: g, styles: p, instanceRef: u, role: y, update: v } = $2(i), { ariaModal: m, arrowStyle: x, contentAttrs: w, contentClass: A, contentStyle: M, updateZIndex: R } = Z2(i, { styles: p, attributes: h, role: y }), L = pt(zc, void 0), S = Te(); sn(z0, { arrowStyle: x, arrowRef: f, arrowOffset: S }), L && sn(zc, { ...L, addInputId: Oa, removeInputId: Oa }); let I; const T = (E = !0) => { v(), E && R(); }, _ = () => { T(!1), i.visible && i.focusOnShow ? s.value = !0 : i.visible === !1 && (s.value = !1); }; return Jt(() => { Qe(() => i.triggerTargetEl, (E, C) => { I == null || I(), I = void 0; const P = z(E || g.value), b = z(C || g.value); ys(P) && (I = Qe([y, () => i.ariaLabel, m, () => i.id], (F) => { ["role", "aria-label", "aria-modal", "id"].forEach((D, N) => { Ci(F[N]) ? P.removeAttribute(D) : P.setAttribute(D, F[N]); }); }, { immediate: !0 })), b !== P && ys(b) && ["role", "aria-label", "aria-modal", "id"].forEach((F) => { b.removeAttribute(F); }); }, { immediate: !0 }), Qe(() => i.visible, _, { immediate: !0 }); }), ei(() => { I == null || I(), I = void 0; }), e({ popperContentRef: g, popperInstanceRef: u, updatePopper: T, contentStyle: M }), (E, C) => (ve(), Le("div", Ei({ ref_key: "contentRef", ref: g }, z(w), { style: z(M), class: z(A), tabindex: "-1", onMouseenter: (P) => E.$emit("mouseenter", P), onMouseleave: (P) => E.$emit("mouseleave", P) }), [ oe(z(B2), { trapped: z(s), "trap-on-focus-in": !0, "focus-trap-el": z(g), "focus-start-el": z(r), onFocusAfterTrapped: z(a), onFocusAfterReleased: z(o), onFocusin: z(c), onFocusoutPrevented: z(l), onReleaseRequested: z(d) }, { default: de(() => [ je(E.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var K2 = /* @__PURE__ */ st(J2, [["__file", "content.vue"]]); const q2 = on(v2), ff = Symbol("elTooltip"), Vn = at({ ...SE, ...j0, appendTo: { type: Je([String, Object]) }, content: { type: String, default: "" }, rawContent: Boolean, persistent: Boolean, visible: { type: Je(Boolean), default: null }, transition: String, teleported: { type: Boolean, default: !0 }, disabled: Boolean, ...Yr(["ariaLabel"]) }), Va = at({ ...H0, disabled: Boolean, trigger: { type: Je([String, Array]), default: "hover" }, triggerKeys: { type: Je(Array), default: () => [Li.enter, Li.space] } }), { useModelToggleProps: Q2, useModelToggleEmits: eC, useModelToggle: tC } = mT("visible"), nC = at({ ...V0, ...Q2, ...Vn, ...Va, ...k0, showArrow: { type: Boolean, default: !0 } }), iC = [ ...eC, "before-show", "before-hide", "show", "hide", "open", "close" ], rC = (n, e) => Pn(n) ? n.includes(e) : n === e, Ws = (n, e, t) => (i) => { rC(z(n), e) && t(i); }, sC = Pe({ name: "ElTooltipTrigger" }), oC = /* @__PURE__ */ Pe({ ...sC, props: Va, setup(n, { expose: e }) { const t = n, i = nt("tooltip"), { controlled: r, id: s, open: o, onOpen: a, onClose: c, onToggle: l } = pt(ff, void 0), d = Te(null), h = () => { if (z(r) || t.disabled) return !0; }, f = hi(t, "trigger"), g = Yi(h, Ws(f, "hover", a)), p = Yi(h, Ws(f, "hover", c)), u = Yi(h, Ws(f, "click", (w) => { w.button === 0 && l(w); })), y = Yi(h, Ws(f, "focus", a)), v = Yi(h, Ws(f, "focus", c)), m = Yi(h, Ws(f, "contextmenu", (w) => { w.preventDefault(), l(w); })), x = Yi(h, (w) => { const { code: A } = w; t.triggerKeys.includes(A) && (w.preventDefault(), l(w)); }); return e({ triggerRef: d }), (w, A) => (ve(), ke(z(S2), { id: z(s), "virtual-ref": w.virtualRef, open: z(o), "virtual-triggering": w.virtualTriggering, class: Ee(z(i).e("trigger")), onBlur: z(v), onClick: z(u), onContextmenu: z(m), onFocus: z(y), onMouseenter: z(g), onMouseleave: z(p), onKeydown: z(x) }, { default: de(() => [ je(w.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var aC = /* @__PURE__ */ st(oC, [["__file", "trigger.vue"]]); const lC = at({ to: { type: Je([String, Object]), required: !0 }, disabled: Boolean }), cC = /* @__PURE__ */ Pe({ __name: "teleport", props: lC, setup(n) { return (e, t) => e.disabled ? je(e.$slots, "default", { key: 0 }) : (ve(), ke(WM, { key: 1, to: e.to }, [ je(e.$slots, "default") ], 8, ["to"])); } }); var uC = /* @__PURE__ */ st(cC, [["__file", "teleport.vue"]]); const hC = on(uC), dC = Pe({ name: "ElTooltipContent", inheritAttrs: !1 }), fC = /* @__PURE__ */ Pe({ ...dC, props: Vn, setup(n, { expose: e }) { const t = n, { selector: i } = L0(), r = nt("tooltip"), s = Te(null); let o; const { controlled: a, id: c, open: l, trigger: d, onClose: h, onOpen: f, onShow: g, onHide: p, onBeforeShow: u, onBeforeHide: y } = pt(ff, void 0), v = ue(() => t.transition || `${r.namespace.value}-fade-in-linear`), m = ue(() => process.env.NODE_ENV === "test" ? !0 : t.persistent); ei(() => { o == null || o(); }); const x = ue(() => z(m) ? !0 : z(l)), w = ue(() => t.disabled ? !1 : z(l)), A = ue(() => t.appendTo || i.value), M = ue(() => { var b; return (b = t.style) != null ? b : {}; }), R = Te(!0), L = () => { p(), R.value = !0; }, S = () => { if (z(a)) return !0; }, I = Yi(S, () => { t.enterable && z(d) === "hover" && f(); }), T = Yi(S, () => { z(d) === "hover" && h(); }), _ = () => { var b, F; (F = (b = s.value) == null ? void 0 : b.updatePopper) == null || F.call(b), u == null || u(); }, E = () => { y == null || y(); }, C = () => { g(), o = yw(ue(() => { var b; return (b = s.value) == null ? void 0 : b.popperContentRef; }), () => { if (z(a)) return; z(d) !== "hover" && h(); }); }, P = () => { t.virtualTriggering || h(); }; return Qe(() => z(l), (b) => { b ? R.value = !1 : o == null || o(); }, { flush: "post" }), Qe(() => t.content, () => { var b, F; (F = (b = s.value) == null ? void 0 : b.updatePopper) == null || F.call(b); }), e({ contentRef: s }), (b, F) => (ve(), ke(z(hC), { disabled: !b.teleported, to: z(A) }, { default: de(() => [ oe(el, { name: z(v), onAfterLeave: L, onBeforeEnter: _, onAfterEnter: C, onBeforeLeave: E }, { default: de(() => [ z(x) ? Lt((ve(), ke(z(K2), Ei({ key: 0, id: z(c), ref_key: "contentRef", ref: s }, b.$attrs, { "aria-label": b.ariaLabel, "aria-hidden": R.value, "boundaries-padding": b.boundariesPadding, "fallback-placements": b.fallbackPlacements, "gpu-acceleration": b.gpuAcceleration, offset: b.offset, placement: b.placement, "popper-options": b.popperOptions, strategy: b.strategy, effect: b.effect, enterable: b.enterable, pure: b.pure, "popper-class": b.popperClass, "popper-style": [b.popperStyle, z(M)], "reference-el": b.referenceEl, "trigger-target-el": b.triggerTargetEl, visible: z(w), "z-index": b.zIndex, onMouseenter: z(I), onMouseleave: z(T), onBlur: P, onClose: z(h) }), { default: de(() => [ je(b.$slots, "default") ]), _: 3 }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [ [mn, z(w)] ]) : Ve("v-if", !0) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var pC = /* @__PURE__ */ st(fC, [["__file", "content.vue"]]); const mC = Pe({ name: "ElTooltip" }), gC = /* @__PURE__ */ Pe({ ...mC, props: nC, emits: iC, setup(n, { expose: e, emit: t }) { const i = n; AE(); const r = sl(), s = Te(), o = Te(), a = () => { var v; const m = z(s); m && ((v = m.popperInstanceRef) == null || v.update()); }, c = Te(!1), l = Te(), { show: d, hide: h, hasUpdateHandler: f } = tC({ indicator: c, toggleReason: l }), { onOpen: g, onClose: p } = _E({ showAfter: hi(i, "showAfter"), hideAfter: hi(i, "hideAfter"), autoClose: hi(i, "autoClose"), open: d, close: h }), u = ue(() => Ba(i.visible) && !f.value); sn(ff, { controlled: u, id: r, open: Bv(c), trigger: hi(i, "trigger"), onOpen: (v) => { g(v); }, onClose: (v) => { p(v); }, onToggle: (v) => { z(c) ? p(v) : g(v); }, onShow: () => { t("show", l.value); }, onHide: () => { t("hide", l.value); }, onBeforeShow: () => { t("before-show", l.value); }, onBeforeHide: () => { t("before-hide", l.value); }, updatePopper: a }), Qe(() => i.disabled, (v) => { v && c.value && (c.value = !1); }); const y = (v) => { var m, x; const w = (x = (m = o.value) == null ? void 0 : m.contentRef) == null ? void 0 : x.popperContentRef, A = (v == null ? void 0 : v.relatedTarget) || document.activeElement; return w && w.contains(A); }; return jM(() => c.value && h()), e({ popperRef: s, contentRef: o, isFocusInsideContent: y, updatePopper: a, onOpen: g, onClose: p, hide: h }), (v, m) => (ve(), ke(z(q2), { ref_key: "popperRef", ref: s, role: v.role }, { default: de(() => [ oe(aC, { disabled: v.disabled, trigger: v.trigger, "trigger-keys": v.triggerKeys, "virtual-ref": v.virtualRef, "virtual-triggering": v.virtualTriggering }, { default: de(() => [ v.$slots.default ? je(v.$slots, "default", { key: 0 }) : Ve("v-if", !0) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), oe(pC, { ref_key: "contentRef", ref: o, "aria-label": v.ariaLabel, "boundaries-padding": v.boundariesPadding, content: v.content, disabled: v.disabled, effect: v.effect, enterable: v.enterable, "fallback-placements": v.fallbackPlacements, "hide-after": v.hideAfter, "gpu-acceleration": v.gpuAcceleration, offset: v.offset, persistent: v.persistent, "popper-class": v.popperClass, "popper-style": v.popperStyle, placement: v.placement, "popper-options": v.popperOptions, pure: v.pure, "raw-content": v.rawContent, "reference-el": v.referenceEl, "trigger-target-el": v.triggerTargetEl, "show-after": v.showAfter, strategy: v.strategy, teleported: v.teleported, transition: v.transition, "virtual-triggering": v.virtualTriggering, "z-index": v.zIndex, "append-to": v.appendTo }, { default: de(() => [ je(v.$slots, "content", {}, () => [ v.rawContent ? (ve(), Le("span", { key: 0, innerHTML: v.content }, null, 8, ["innerHTML"])) : (ve(), Le("span", { key: 1 }, vt(v.content), 1)) ]), v.showArrow ? (ve(), ke(z(x2), { key: 0, "arrow-offset": v.arrowOffset }, null, 8, ["arrow-offset"])) : Ve("v-if", !0) ]), _: 3 }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"]) ]), _: 3 }, 8, ["role"])); } }); var vC = /* @__PURE__ */ st(gC, [["__file", "tooltip.vue"]]); const pf = on(vC), $0 = Symbol("buttonGroupContextKey"), yC = (n, e) => { p0({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, ue(() => n.type === "text")); const t = pt($0, void 0), i = af("button"), { form: r } = Jo(), s = Ns(ue(() => t == null ? void 0 : t.size)), o = ol(), a = Te(), c = Xc(), l = ue(() => n.type || (t == null ? void 0 : t.type) || ""), d = ue(() => { var p, u, y; return (y = (u = n.autoInsertSpace) != null ? u : (p = i.value) == null ? void 0 : p.autoInsertSpace) != null ? y : !1; }), h = ue(() => n.tag === "button" ? { ariaDisabled: o.value || n.loading, disabled: o.value || n.loading, autofocus: n.autofocus, type: n.nativeType } : {}), f = ue(() => { var p; const u = (p = c.default) == null ? void 0 : p.call(c); if (d.value && (u == null ? void 0 : u.length) === 1) { const y = u[0]; if ((y == null ? void 0 : y.type) === zv) { const v = y.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(v.trim()); } } return !1; }); return { _disabled: o, _size: s, _type: l, _ref: a, _props: h, shouldAddSpace: f, handleClick: (p) => { if (o.value || n.loading) { p.stopPropagation(); return; } n.nativeType === "reset" && (r == null || r.resetFields()), e("click", p); } }; }, bC = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ], xC = ["button", "submit", "reset"], Kh = at({ size: Gr, disabled: Boolean, type: { type: String, values: bC, default: "" }, icon: { type: kr }, nativeType: { type: String, values: xC, default: "button" }, loading: Boolean, loadingIcon: { type: kr, default: () => c0 }, plain: Boolean, text: Boolean, link: Boolean, bg: Boolean, autofocus: Boolean, round: Boolean, circle: Boolean, color: String, dark: Boolean, autoInsertSpace: { type: Boolean, default: void 0 }, tag: { type: Je([String, Object]), default: "button" } }), MC = { click: (n) => n instanceof MouseEvent }; function yn(n, e) { wC(n) && (n = "100%"); var t = AC(n); return n = e === 360 ? n : Math.min(e, Math.max(0, parseFloat(n))), t && (n = parseInt(String(n * e), 10) / 100), Math.abs(n - e) < 1e-6 ? 1 : (e === 360 ? n = (n < 0 ? n % e + e : n % e) / parseFloat(String(e)) : n = n % e / parseFloat(String(e)), n); } function Rl(n) { return Math.min(1, Math.max(0, n)); } function wC(n) { return typeof n == "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1; } function AC(n) { return typeof n == "string" && n.indexOf("%") !== -1; } function Z0(n) { return n = parseFloat(n), (isNaN(n) || n < 0 || n > 1) && (n = 1), n; } function Fl(n) { return n <= 1 ? "".concat(Number(n) * 100, "%") : n; } function ms(n) { return n.length === 1 ? "0" + n : String(n); } function SC(n, e, t) { return { r: yn(n, 255) * 255, g: yn(e, 255) * 255, b: yn(t, 255) * 255 }; } function Fm(n, e, t) { n = yn(n, 255), e = yn(e, 255), t = yn(t, 255); var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = 0, a = (i + r) / 2; if (i === r) o = 0, s = 0; else { var c = i - r; switch (o = a > 0.5 ? c / (2 - i - r) : c / (i + r), i) { case n: s = (e - t) / c + (e < t ? 6 : 0); break; case e: s = (t - n) / c + 2; break; case t: s = (n - e) / c + 4; break; } s /= 6; } return { h: s, s: o, l: a }; } function Vu(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 _C(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 = Vu(a, o, n + 1 / 3), r = Vu(a, o, n), s = Vu(a, o, n - 1 / 3); } return { r: i * 255, g: r * 255, b: s * 255 }; } function Pm(n, e, t) { n = yn(n, 255), e = yn(e, 255), t = yn(t, 255); var i = Math.max(n, e, t), r = Math.min(n, e, t), s = 0, o = i, a = i - r, c = i === 0 ? 0 : a / i; if (i === r) s = 0; else { switch (i) { case n: s = (e - t) / a + (e < t ? 6 : 0); break; case e: s = (t - n) / a + 2; break; case t: s = (n - e) / a + 4; break; } s /= 6; } return { h: s, s: c, v: o }; } function TC(n, e, t) { n = yn(n, 360) * 6, e = yn(e, 100), t = yn(t, 100); var i = Math.floor(n), r = n - i, s = t * (1 - e), o = t * (1 - r * e), a = t * (1 - (1 - r) * e), c = i % 6, l = [t, o, s, s, a, t][c], d = [a, t, t, o, s, s][c], h = [s, s, a, t, t, o][c]; return { r: l * 255, g: d * 255, b: h * 255 }; } function Im(n, e, t, i) { var r = [ ms(Math.round(n).toString(16)), ms(Math.round(e).toString(16)), ms(Math.round(t).toString(16)) ]; return i && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join(""); } function EC(n, e, t, i, r) { var s = [ ms(Math.round(n).toString(16)), ms(Math.round(e).toString(16)), ms(Math.round(t).toString(16)), ms(CC(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 CC(n) { return Math.round(parseFloat(n) * 255).toString(16); } function Om(n) { return zn(n) / 255; } function zn(n) { return parseInt(n, 16); } function LC(n) { return { r: n >> 16, g: (n & 65280) >> 8, b: n & 255 }; } var qh = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; function RC(n) { var e = { r: 0, g: 0, b: 0 }, t = 1, i = null, r = null, s = null, o = !1, a = !1; return typeof n == "string" && (n = IC(n)), typeof n == "object" && (Gi(n.r) && Gi(n.g) && Gi(n.b) ? (e = SC(n.r, n.g, n.b), o = !0, a = String(n.r).substr(-1) === "%" ? "prgb" : "rgb") : Gi(n.h) && Gi(n.s) && Gi(n.v) ? (i = Fl(n.s), r = Fl(n.v), e = TC(n.h, i, r), o = !0, a = "hsv") : Gi(n.h) && Gi(n.s) && Gi(n.l) && (i = Fl(n.s), s = Fl(n.l), e = _C(n.h, i, s), o = !0, a = "hsl"), Object.prototype.hasOwnProperty.call(n, "a") && (t = n.a)), t = Z0(t), { ok: o, format: n.format || a, r: Math.min(255, Math.max(e.r, 0)), g: Math.min(255, Math.max(e.g, 0)), b: Math.min(255, Math.max(e.b, 0)), a: t }; } var FC = "[-\\+]?\\d+%?", PC = "[-\\+]?\\d*\\.\\d+%?", Fr = "(?:".concat(PC, ")|(?:").concat(FC, ")"), ku = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?"), Gu = "[\\s|\\(]+(".concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")[,|\\s]+(").concat(Fr, ")\\s*\\)?"), li = { CSS_UNIT: new RegExp(Fr), rgb: new RegExp("rgb" + ku), rgba: new RegExp("rgba" + Gu), hsl: new RegExp("hsl" + ku), hsla: new RegExp("hsla" + Gu), hsv: new RegExp("hsv" + ku), hsva: new RegExp("hsva" + Gu), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function IC(n) { if (n = n.trim().toLowerCase(), n.length === 0) return !1; var e = !1; if (qh[n]) n = qh[n], e = !0; else if (n === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var t = li.rgb.exec(n); return t ? { r: t[1], g: t[2], b: t[3] } : (t = li.rgba.exec(n), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = li.hsl.exec(n), t ? { h: t[1], s: t[2], l: t[3] } : (t = li.hsla.exec(n), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = li.hsv.exec(n), t ? { h: t[1], s: t[2], v: t[3] } : (t = li.hsva.exec(n), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = li.hex8.exec(n), t ? { r: zn(t[1]), g: zn(t[2]), b: zn(t[3]), a: Om(t[4]), format: e ? "name" : "hex8" } : (t = li.hex6.exec(n), t ? { r: zn(t[1]), g: zn(t[2]), b: zn(t[3]), format: e ? "name" : "hex" } : (t = li.hex4.exec(n), t ? { r: zn(t[1] + t[1]), g: zn(t[2] + t[2]), b: zn(t[3] + t[3]), a: Om(t[4] + t[4]), format: e ? "name" : "hex8" } : (t = li.hex3.exec(n), t ? { r: zn(t[1] + t[1]), g: zn(t[2] + t[2]), b: zn(t[3] + t[3]), format: e ? "name" : "hex" } : !1))))))))); } function Gi(n) { return !!li.CSS_UNIT.exec(String(n)); } var OC = ( /** @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 = LC(e)), this.originalInput = e; var r = RC(e); this.originalInput = e, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (i = t.format) !== null && i !== void 0 ? i : r.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok; } return n.prototype.isDark = function() { return this.getBrightness() < 128; }, n.prototype.isLight = function() { return !this.isDark(); }, n.prototype.getBrightness = function() { var e = this.toRgb(); return (e.r * 299 + e.g * 587 + e.b * 114) / 1e3; }, n.prototype.getLuminance = function() { var e = this.toRgb(), t, i, r, s = e.r / 255, o = e.g / 255, a = e.b / 255; return s <= 0.03928 ? t = s / 12.92 : t = Math.pow((s + 0.055) / 1.055, 2.4), o <= 0.03928 ? i = o / 12.92 : i = Math.pow((o + 0.055) / 1.055, 2.4), a <= 0.03928 ? r = a / 12.92 : r = Math.pow((a + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * i + 0.0722 * r; }, n.prototype.getAlpha = function() { return this.a; }, n.prototype.setAlpha = function(e) { return this.a = Z0(e), this.roundA = Math.round(100 * this.a) / 100, this; }, n.prototype.isMonochrome = function() { var e = this.toHsl().s; return e === 0; }, n.prototype.toHsv = function() { var e = Pm(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, v: e.v, a: this.a }; }, n.prototype.toHsvString = function() { var e = Pm(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.v * 100); return this.a === 1 ? "hsv(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsva(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, n.prototype.toHsl = function() { var e = Fm(this.r, this.g, this.b); return { h: e.h * 360, s: e.s, l: e.l, a: this.a }; }, n.prototype.toHslString = function() { var e = Fm(this.r, this.g, this.b), t = Math.round(e.h * 360), i = Math.round(e.s * 100), r = Math.round(e.l * 100); return this.a === 1 ? "hsl(".concat(t, ", ").concat(i, "%, ").concat(r, "%)") : "hsla(".concat(t, ", ").concat(i, "%, ").concat(r, "%, ").concat(this.roundA, ")"); }, n.prototype.toHex = function(e) { return e === void 0 && (e = !1), Im(this.r, this.g, this.b, e); }, n.prototype.toHexString = function(e) { return e === void 0 && (e = !1), "#" + this.toHex(e); }, n.prototype.toHex8 = function(e) { return e === void 0 && (e = !1), EC(this.r, this.g, this.b, this.a, e); }, n.prototype.toHex8String = function(e) { return e === void 0 && (e = !1), "#" + this.toHex8(e); }, n.prototype.toHexShortString = function(e) { return e === void 0 && (e = !1), this.a === 1 ? this.toHexString(e) : this.toHex8String(e); }, n.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, n.prototype.toRgbString = function() { var e = Math.round(this.r), t = Math.round(this.g), i = Math.round(this.b); return this.a === 1 ? "rgb(".concat(e, ", ").concat(t, ", ").concat(i, ")") : "rgba(".concat(e, ", ").concat(t, ", ").concat(i, ", ").concat(this.roundA, ")"); }, n.prototype.toPercentageRgb = function() { var e = function(t) { return "".concat(Math.round(yn(t, 255) * 100), "%"); }; return { r: e(this.r), g: e(this.g), b: e(this.b), a: this.a }; }, n.prototype.toPercentageRgbString = function() { var e = function(t) { return Math.round(yn(t, 255) * 100); }; return this.a === 1 ? "rgb(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%)") : "rgba(".concat(e(this.r), "%, ").concat(e(this.g), "%, ").concat(e(this.b), "%, ").concat(this.roundA, ")"); }, n.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return !1; for (var e = "#" + Im(this.r, this.g, this.b, !1), t = 0, i = Object.entries(qh); t < i.length; t++) { var r = i[t], s = r[0], o = r[1]; if (e === o) return s; } return !1; }, n.prototype.toString = function(e) { var t = !!e; e = e ?? this.format; var i = !1, r = this.a < 1 && this.a >= 0, s = !t && r && (e.startsWith("hex") || e === "name"); return s ? e === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (i = this.toRgbString()), e === "prgb" && (i = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (i = this.toHexString()), e === "hex3" && (i = this.toHexString(!0)), e === "hex4" && (i = this.toHex8String(!0)), e === "hex8" && (i = this.toHex8String()), e === "name" && (i = this.toName()), e === "hsl" && (i = this.toHslString()), e === "hsv" && (i = this.toHsvString()), i || this.toHexString()); }, n.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, n.prototype.clone = function() { return new n(this.toString()); }, n.prototype.lighten = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l += e / 100, t.l = Rl(t.l), new n(t); }, n.prototype.brighten = function(e) { e === void 0 && (e = 10); var t = this.toRgb(); return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), new n(t); }, n.prototype.darken = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.l -= e / 100, t.l = Rl(t.l), new n(t); }, n.prototype.tint = function(e) { return e === void 0 && (e = 10), this.mix("white", e); }, n.prototype.shade = function(e) { return e === void 0 && (e = 10), this.mix("black", e); }, n.prototype.desaturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s -= e / 100, t.s = Rl(t.s), new n(t); }, n.prototype.saturate = function(e) { e === void 0 && (e = 10); var t = this.toHsl(); return t.s += e / 100, t.s = Rl(t.s), new n(t); }, n.prototype.greyscale = function() { return this.desaturate(100); }, n.prototype.spin = function(e) { var t = this.toHsl(), i = (t.h + e) % 360; return t.h = i < 0 ? 360 + i : i, new n(t); }, n.prototype.mix = function(e, t) { t === void 0 && (t = 50); var i = this.toRgb(), r = new n(e).toRgb(), s = t / 100, o = { r: (r.r - i.r) * s + i.r, g: (r.g - i.g) * s + i.g, b: (r.b - i.b) * s + i.b, a: (r.a - i.a) * s + i.a }; return new n(o); }, n.prototype.analogous = function(e, t) { e === void 0 && (e = 6), t === void 0 && (t = 30); var i = this.toHsl(), r = 360 / t, s = [this]; for (i.h = (i.h - (r * e >> 1) + 720) % 360; --e; ) i.h = (i.h + r) % 360, s.push(new n(i)); return s; }, n.prototype.complement = function() { var e = this.toHsl(); return e.h = (e.h + 180) % 360, new n(e); }, n.prototype.monochromatic = function(e) { e === void 0 && (e = 6); for (var t = this.toHsv(), i = t.h, r = t.s, s = t.v, o = [], a = 1 / e; e--; ) o.push(new n({ h: i, s: r, v: s })), s = (s + a) % 1; return o; }, n.prototype.splitcomplement = function() { var e = this.toHsl(), t = e.h; return [ this, new n({ h: (t + 72) % 360, s: e.s, l: e.l }), new n({ h: (t + 216) % 360, s: e.s, l: e.l }) ]; }, n.prototype.onBackground = function(e) { var t = this.toRgb(), i = new n(e).toRgb(), r = t.a + i.a * (1 - t.a); return new n({ r: (t.r * t.a + i.r * i.a * (1 - t.a)) / r, g: (t.g * t.a + i.g * i.a * (1 - t.a)) / r, b: (t.b * t.a + i.b * i.a * (1 - t.a)) / r, a: r }); }, n.prototype.triad = function() { return this.polyad(3); }, n.prototype.tetrad = function() { return this.polyad(4); }, n.prototype.polyad = function(e) { for (var t = this.toHsl(), i = t.h, r = [this], s = 360 / e, o = 1; o < e; o++) r.push(new n({ h: (i + o * s) % 360, s: t.s, l: t.l })); return r; }, n.prototype.equals = function(e) { return this.toRgbString() === new n(e).toRgbString(); }, n; }() ); function gr(n, e = 20) { return n.mix("#141414", e).toString(); } function DC(n) { const e = ol(), t = nt("button"); return ue(() => { let i = {}, r = n.color; if (r) { const s = r.match(/var\((.*?)\)/); s && (r = window.getComputedStyle(window.document.documentElement).getPropertyValue(s[1])); const o = new OC(r), a = n.dark ? o.tint(20).toString() : gr(o, 20); if (n.plain) i = t.cssVarBlock({ "bg-color": n.dark ? gr(o, 90) : o.tint(90).toString(), "text-color": r, "border-color": n.dark ? gr(o, 50) : o.tint(50).toString(), "hover-text-color": `var(${t.cssVarName("color-white")})`, "hover-bg-color": r, "hover-border-color": r, "active-bg-color": a, "active-text-color": `var(${t.cssVarName("color-white")})`, "active-border-color": a }), e.value && (i[t.cssVarBlockName("disabled-bg-color")] = n.dark ? gr(o, 90) : o.tint(90).toString(), i[t.cssVarBlockName("disabled-text-color")] = n.dark ? gr(o, 50) : o.tint(50).toString(), i[t.cssVarBlockName("disabled-border-color")] = n.dark ? gr(o, 80) : o.tint(80).toString()); else { const c = n.dark ? gr(o, 30) : o.tint(30).toString(), l = o.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`; if (i = t.cssVarBlock({ "bg-color": r, "text-color": l, "border-color": r, "hover-bg-color": c, "hover-text-color": l, "hover-border-color": c, "active-bg-color": a, "active-border-color": a }), e.value) { const d = n.dark ? gr(o, 50) : o.tint(50).toString(); i[t.cssVarBlockName("disabled-bg-color")] = d, i[t.cssVarBlockName("disabled-text-color")] = n.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, i[t.cssVarBlockName("disabled-border-color")] = d; } } } return i; }); } const NC = Pe({ name: "ElButton" }), BC = /* @__PURE__ */ Pe({ ...NC, props: Kh, emits: MC, setup(n, { expose: e, emit: t }) { const i = n, r = DC(i), s = nt("button"), { _ref: o, _size: a, _type: c, _disabled: l, _props: d, shouldAddSpace: h, handleClick: f } = yC(i, t), g = ue(() => [ s.b(), s.m(c.value), s.m(a.value), s.is("disabled", l.value), s.is("loading", i.loading), s.is("plain", i.plain), s.is("round", i.round), s.is("circle", i.circle), s.is("text", i.text), s.is("link", i.link), s.is("has-bg", i.bg) ]); return e({ ref: o, size: a, type: c, disabled: l, shouldAddSpace: h }), (p, u) => (ve(), ke(Fn(p.tag), Ei({ ref_key: "_ref", ref: o }, z(d), { class: z(g), style: z(r), onClick: z(f) }), { default: de(() => [ p.loading ? (ve(), Le(Pt, { key: 0 }, [ p.$slots.loading ? je(p.$slots, "loading", { key: 0 }) : (ve(), ke(z(It), { key: 1, class: Ee(z(s).is("loading")) }, { default: de(() => [ (ve(), ke(Fn(p.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : p.icon || p.$slots.icon ? (ve(), ke(z(It), { key: 1 }, { default: de(() => [ p.icon ? (ve(), ke(Fn(p.icon), { key: 0 })) : je(p.$slots, "icon", { key: 1 }) ]), _: 3 })) : Ve("v-if", !0), p.$slots.default ? (ve(), Le("span", { key: 2, class: Ee({ [z(s).em("text", "expand")]: z(h) }) }, [ je(p.$slots, "default") ], 2)) : Ve("v-if", !0) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var UC = /* @__PURE__ */ st(BC, [["__file", "button.vue"]]); const zC = { size: Kh.size, type: Kh.type }, VC = Pe({ name: "ElButtonGroup" }), kC = /* @__PURE__ */ Pe({ ...VC, props: zC, setup(n) { const e = n; sn($0, Wn({ size: hi(e, "size"), type: hi(e, "type") })); const t = nt("button"); return (i, r) => (ve(), Le("div", { class: Ee(z(t).b("group")) }, [ je(i.$slots, "default") ], 2)); } }); var X0 = /* @__PURE__ */ st(kC, [["__file", "button-group.vue"]]); const Ko = on(UC, { ButtonGroup: X0 }); vi(X0); var Lr = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function GC(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } function au(n) { if (n.__esModule) return n; var e = n.default; if (typeof e == "function") { var t = function i() { return this instanceof i ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; t.prototype = e.prototype; } else t = {}; return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(n).forEach(function(i) { var r = Object.getOwnPropertyDescriptor(n, i); Object.defineProperty(t, i, r.get ? r : { enumerable: !0, get: function() { return n[i]; } }); }), t; } const Er = /* @__PURE__ */ new Map(); if (en) { let n; document.addEventListener("mousedown", (e) => n = e), document.addEventListener("mouseup", (e) => { if (n) { for (const t of Er.values()) for (const { documentHandler: i } of t) i(e, n); n = void 0; } }); } function Dm(n, e) { let t = []; return Array.isArray(e.arg) ? t = e.arg : ys(e.arg) && t.push(e.arg), function(i, r) { const s = e.instance.popperRef, o = i.target, a = r == null ? void 0 : r.target, c = !e || !e.instance, l = !o || !a, d = n.contains(o) || n.contains(a), h = n === o, f = t.length && t.some((p) => p == null ? void 0 : p.contains(o)) || t.length && t.includes(a), g = s && (s.contains(o) || s.contains(a)); c || l || d || h || f || g || e.value(i, r); }; } const HC = { beforeMount(n, e) { Er.has(n) || Er.set(n, []), Er.get(n).push({ documentHandler: Dm(n, e), bindingFn: e.value }); }, updated(n, e) { Er.has(n) || Er.set(n, []); const t = Er.get(n), i = t.findIndex((s) => s.bindingFn === e.oldValue), r = { documentHandler: Dm(n, e), bindingFn: e.value }; i >= 0 ? t.splice(i, 1, r) : t.push(r); }, unmounted(n) { Er.delete(n); } }, WC = 100, jC = 600, Nm = { beforeMount(n, e) { const t = e.value, { interval: i = WC, delay: r = jC } = Sn(t) ? {} : t; let s, o; const a = () => Sn(t) ? t() : t.handler(), c = () => { o && (clearTimeout(o), o = void 0), s && (clearInterval(s), s = void 0); }; n.addEventListener("mousedown", (l) => { l.button === 0 && (c(), a(), document.addEventListener("mouseup", () => c(), { once: !0 }), o = setTimeout(() => { s = setInterval(() => { a(); }, i); }, r)); }); } }, Y0 = at({ modelValue: { type: [String, Number, Boolean], default: void 0 }, size: Gr, disabled: Boolean, label: { type: [String, Number, Boolean], default: void 0 }, value: { type: [String, Number, Boolean], default: void 0 }, name: { type: String, default: void 0 } }), $C = at({ ...Y0, border: Boolean }), J0 = { [At]: (n) => vn(n) || yt(n) || Ba(n), [ur]: (n) => vn(n) || yt(n) || Ba(n) }, K0 = Symbol("radioGroupKey"), q0 = (n, e) => { const t = Te(), i = pt(K0, void 0), r = ue(() => !!i), s = ue(() => im(n.value) ? n.label : n.value), o = ue({ get() { return r.value ? i.modelValue : n.modelValue; }, set(h) { r.value ? i.changeEvent(h) : e && e(At, h), t.value.checked = n.modelValue === s.value; } }), a = Ns(ue(() => i == null ? void 0 : i.size)), c = ol(ue(() => i == null ? void 0 : i.disabled)), l = Te(!1), d = ue(() => c.value || r.value && o.value !== s.value ? -1 : 0); return p0({ from: "label act as value", replacement: "value", version: "3.0.0", scope: "el-radio", ref: "https://element-plus.org/en-US/component/radio.html" }, ue(() => r.value && im(n.value))), { radioRef: t, isGroup: r, radioGroup: i, focus: l, size: a, disabled: c, tabIndex: d, modelValue: o, actualValue: s }; }, ZC = Pe({ name: "ElRadio" }), XC = /* @__PURE__ */ Pe({ ...ZC, props: $C, emits: J0, setup(n, { emit: e }) { const t = n, i = nt("radio"), { radioRef: r, radioGroup: s, focus: o, size: a, disabled: c, modelValue: l, actualValue: d } = q0(t, e); function h() { bt(() => e("change", l.value)); } return (f, g) => { var p; return ve(), Le("label", { class: Ee([ z(i).b(), z(i).is("disabled", z(c)), z(i).is("focus", z(o)), z(i).is("bordered", f.border), z(i).is("checked", z(l) === z(d)), z(i).m(z(a)) ]) }, [ Ne("span", { class: Ee([ z(i).e("input"), z(i).is("disabled", z(c)), z(i).is("checked", z(l) === z(d)) ]) }, [ Lt(Ne("input", { ref_key: "radioRef", ref: r, "onUpdate:modelValue": (u) => Zc(l) ? l.value = u : null, class: Ee(z(i).e("original")), value: z(d), name: f.name || ((p = z(s)) == null ? void 0 : p.name), disabled: z(c), checked: z(l) === z(d), type: "radio", onFocus: (u) => o.value = !0, onBlur: (u) => o.value = !1, onChange: h, onClick: Ut(() => { }, ["stop"]) }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [ [Vv, z(l)] ]), Ne("span", { class: Ee(z(i).e("inner")) }, null, 2) ], 2), Ne("span", { class: Ee(z(i).e("label")), onKeydown: Ut(() => { }, ["stop"]) }, [ je(f.$slots, "default", {}, () => [ rt(vt(f.label), 1) ]) ], 42, ["onKeydown"]) ], 2); }; } }); var YC = /* @__PURE__ */ st(XC, [["__file", "radio.vue"]]); const JC = at({ ...Y0 }), KC = Pe({ name: "ElRadioButton" }), qC = /* @__PURE__ */ Pe({ ...KC, props: JC, setup(n) { const e = n, t = nt("radio"), { radioRef: i, focus: r, size: s, disabled: o, modelValue: a, radioGroup: c, actualValue: l } = q0(e), d = ue(() => ({ backgroundColor: (c == null ? void 0 : c.fill) || "", borderColor: (c == null ? void 0 : c.fill) || "", boxShadow: c != null && c.fill ? `-1px 0 0 0 ${c.fill}` : "", color: (c == null ? void 0 : c.textColor) || "" })); return (h, f) => { var g; return ve(), Le("label", { class: Ee([ z(t).b("button"), z(t).is("active", z(a) === z(l)), z(t).is("disabled", z(o)), z(t).is("focus", z(r)), z(t).bm("button", z(s)) ]) }, [ Lt(Ne("input", { ref_key: "radioRef", ref: i, "onUpdate:modelValue": (p) => Zc(a) ? a.value = p : null, class: Ee(z(t).be("button", "original-radio")), value: z(l), type: "radio", name: h.name || ((g = z(c)) == null ? void 0 : g.name), disabled: z(o), onFocus: (p) => r.value = !0, onBlur: (p) => r.value = !1, onClick: Ut(() => { }, ["stop"]) }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [ [Vv, z(a)] ]), Ne("span", { class: Ee(z(t).be("button", "inner")), style: Rt(z(a) === z(l) ? z(d) : {}), onKeydown: Ut(() => { }, ["stop"]) }, [ je(h.$slots, "default", {}, () => [ rt(vt(h.label), 1) ]) ], 46, ["onKeydown"]) ], 2); }; } }); var Q0 = /* @__PURE__ */ st(qC, [["__file", "radio-button.vue"]]); const QC = at({ id: { type: String, default: void 0 }, size: Gr, disabled: Boolean, modelValue: { type: [String, Number, Boolean], default: void 0 }, fill: { type: String, default: "" }, textColor: { type: String, default: "" }, name: { type: String, default: void 0 }, validateEvent: { type: Boolean, default: !0 }, ...Yr(["ariaLabel"]) }), eL = J0, tL = Pe({ name: "ElRadioGroup" }), nL = /* @__PURE__ */ Pe({ ...tL, props: QC, emits: eL, setup(n, { emit: e }) { const t = n, i = nt("radio"), r = sl(), s = Te(), { formItem: o } = Jo(), { inputId: a, isLabeledByFormItem: c } = su(t, { formItemContext: o }), l = (h) => { e(At, h), bt(() => e("change", h)); }; Jt(() => { const h = s.value.querySelectorAll("[type=radio]"), f = h[0]; !Array.from(h).some((g) => g.checked) && f && (f.tabIndex = 0); }); const d = ue(() => t.name || r.value); return sn(K0, Wn({ ...Br(t), changeEvent: l, name: d })), Qe(() => t.modelValue, () => { t.validateEvent && (o == null || o.validate("change").catch((h) => Vt(h))); }), (h, f) => (ve(), Le("div", { id: z(a), ref_key: "radioGroupRef", ref: s, class: Ee(z(i).b("group")), role: "radiogroup", "aria-label": z(c) ? void 0 : h.ariaLabel || "radio-group", "aria-labelledby": z(c) ? z(o).labelId : void 0 }, [ je(h.$slots, "default") ], 10, ["id", "aria-label", "aria-labelledby"])); } }); var ey = /* @__PURE__ */ st(nL, [["__file", "radio-group.vue"]]); const ty = on(YC, { RadioButton: Q0, RadioGroup: ey }), ny = vi(ey); vi(Q0); const Qh = at({ type: { type: String, values: ["primary", "success", "info", "warning", "danger"], default: "primary" }, closable: Boolean, disableTransitions: Boolean, hit: Boolean, color: String, size: { type: String, values: f0 }, effect: { type: String, values: ["dark", "light", "plain"], default: "light" }, round: Boolean }), iL = { close: (n) => n instanceof MouseEvent, click: (n) => n instanceof MouseEvent }, rL = Pe({ name: "ElTag" }), sL = /* @__PURE__ */ Pe({ ...rL, props: Qh, emits: iL, setup(n, { emit: e }) { const t = n, i = Ns(), r = nt("tag"), s = ue(() => { const { type: l, hit: d, effect: h, closable: f, round: g } = t; return [ r.b(), r.is("closable", f), r.m(l || "primary"), r.m(i.value), r.m(h), r.is("hit", d), r.is("round", g) ]; }), o = (l) => { e("close", l); }, a = (l) => { e("click", l); }, c = (l) => { l.component.subTree.component.bum = null; }; return (l, d) => l.disableTransitions ? (ve(), Le("span", { key: 0, class: Ee(z(s)), style: Rt({ backgroundColor: l.color }), onClick: a }, [ Ne("span", { class: Ee(z(r).e("content")) }, [ je(l.$slots, "default") ], 2), l.closable ? (ve(), ke(z(It), { key: 0, class: Ee(z(r).e("close")), onClick: Ut(o, ["stop"]) }, { default: de(() => [ oe(z(Zh)) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0) ], 6)) : (ve(), ke(el, { key: 1, name: `${z(r).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: c }, { default: de(() => [ Ne("span", { class: Ee(z(s)), style: Rt({ backgroundColor: l.color }), onClick: a }, [ Ne("span", { class: Ee(z(r).e("content")) }, [ je(l.$slots, "default") ], 2), l.closable ? (ve(), ke(z(It), { key: 0, class: Ee(z(r).e("close")), onClick: Ut(o, ["stop"]) }, { default: de(() => [ oe(z(Zh)) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0) ], 6) ]), _: 3 }, 8, ["name"])); } }); var oL = /* @__PURE__ */ st(sL, [["__file", "tag.vue"]]); const aL = on(oL), iy = Symbol("rowContextKey"), lL = [ "start", "center", "end", "space-around", "space-between", "space-evenly" ], cL = ["top", "middle", "bottom"], uL = at({ tag: { type: String, default: "div" }, gutter: { type: Number, default: 0 }, justify: { type: String, values: lL, default: "start" }, align: { type: String, values: cL } }), hL = Pe({ name: "ElRow" }), dL = /* @__PURE__ */ Pe({ ...hL, props: uL, setup(n) { const e = n, t = nt("row"), i = ue(() => e.gutter); sn(iy, { gutter: i }); const r = ue(() => { const o = {}; return e.gutter && (o.marginRight = o.marginLeft = `-${e.gutter / 2}px`), o; }), s = ue(() => [ t.b(), t.is(`justify-${e.justify}`, e.justify !== "start"), t.is(`align-${e.align}`, !!e.align) ]); return (o, a) => (ve(), ke(Fn(o.tag), { class: Ee(z(s)), style: Rt(z(r)) }, { default: de(() => [ je(o.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var fL = /* @__PURE__ */ st(dL, [["__file", "row.vue"]]); const Ui = on(fL), pL = at({ tag: { type: String, default: "div" }, span: { type: Number, default: 24 }, offset: { type: Number, default: 0 }, pull: { type: Number, default: 0 }, push: { type: Number, default: 0 }, xs: { type: Je([Number, Object]), default: () => Ki({}) }, sm: { type: Je([Number, Object]), default: () => Ki({}) }, md: { type: Je([Number, Object]), default: () => Ki({}) }, lg: { type: Je([Number, Object]), default: () => Ki({}) }, xl: { type: Je([Number, Object]), default: () => Ki({}) } }), mL = Pe({ name: "ElCol" }), gL = /* @__PURE__ */ Pe({ ...mL, props: pL, setup(n) { const e = n, { gutter: t } = pt(iy, { gutter: ue(() => 0) }), i = nt("col"), r = ue(() => { const o = {}; return t.value && (o.paddingLeft = o.paddingRight = `${t.value / 2}px`), o; }), s = ue(() => { const o = []; return ["span", "offset", "pull", "push"].forEach((l) => { const d = e[l]; yt(d) && (l === "span" ? o.push(i.b(`${e[l]}`)) : d > 0 && o.push(i.b(`${l}-${e[l]}`))); }), ["xs", "sm", "md", "lg", "xl"].forEach((l) => { yt(e[l]) ? o.push(i.b(`${l}-${e[l]}`)) : Tn(e[l]) && Object.entries(e[l]).forEach(([d, h]) => { o.push(d !== "span" ? i.b(`${l}-${d}-${h}`) : i.b(`${l}-${h}`)); }); }), t.value && o.push(i.is("guttered")), [i.b(), o]; }); return (o, a) => (ve(), ke(Fn(o.tag), { class: Ee(z(s)), style: Rt(z(r)) }, { default: de(() => [ je(o.$slots, "default") ]), _: 3 }, 8, ["class", "style"])); } }); var vL = /* @__PURE__ */ st(gL, [["__file", "col.vue"]]); const bi = on(vL), Bm = (n) => yt(n) || vn(n) || Pn(n), yL = at({ accordion: Boolean, modelValue: { type: Je([Array, String, Number]), default: () => Ki([]) } }), bL = { [At]: Bm, [ur]: Bm }, ry = Symbol("collapseContextKey"), xL = (n, e) => { const t = Te(Si(n.modelValue)), i = (s) => { t.value = s; const o = n.accordion ? t.value[0] : t.value; e(At, o), e(ur, o); }, r = (s) => { if (n.accordion) i([t.value[0] === s ? "" : s]); else { const o = [...t.value], a = o.indexOf(s); a > -1 ? o.splice(a, 1) : o.push(s), i(o); } }; return Qe(() => n.modelValue, () => t.value = Si(n.modelValue), { deep: !0 }), sn(ry, { activeNames: t, handleItemClick: r }), { activeNames: t, setActiveNames: i }; }, ML = () => { const n = nt("collapse"); return { rootKls: ue(() => n.b()) }; }, wL = Pe({ name: "ElCollapse" }), AL = /* @__PURE__ */ Pe({ ...wL, props: yL, emits: bL, setup(n, { expose: e, emit: t }) { const i = n, { activeNames: r, setActiveNames: s } = xL(i, t), { rootKls: o } = ML(); return e({ activeNames: r, setActiveNames: s }), (a, c) => (ve(), Le("div", { class: Ee(z(o)) }, [ je(a.$slots, "default") ], 2)); } }); var SL = /* @__PURE__ */ st(AL, [["__file", "collapse.vue"]]); const _L = Pe({ name: "ElCollapseTransition" }), TL = /* @__PURE__ */ Pe({ ..._L, setup(n) { const e = nt("collapse-transition"), t = (r) => { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom; }, i = { beforeEnter(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.style.height && (r.dataset.elExistsHeight = r.style.height), r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0; }, enter(r) { requestAnimationFrame(() => { r.dataset.oldOverflow = r.style.overflow, r.dataset.elExistsHeight ? r.style.maxHeight = r.dataset.elExistsHeight : r.scrollHeight !== 0 ? r.style.maxHeight = `${r.scrollHeight}px` : r.style.maxHeight = 0, r.style.paddingTop = r.dataset.oldPaddingTop, r.style.paddingBottom = r.dataset.oldPaddingBottom, r.style.overflow = "hidden"; }); }, afterEnter(r) { r.style.maxHeight = "", r.style.overflow = r.dataset.oldOverflow; }, enterCancelled(r) { t(r); }, beforeLeave(r) { r.dataset || (r.dataset = {}), r.dataset.oldPaddingTop = r.style.paddingTop, r.dataset.oldPaddingBottom = r.style.paddingBottom, r.dataset.oldOverflow = r.style.overflow, r.style.maxHeight = `${r.scrollHeight}px`, r.style.overflow = "hidden"; }, leave(r) { r.scrollHeight !== 0 && (r.style.maxHeight = 0, r.style.paddingTop = 0, r.style.paddingBottom = 0); }, afterLeave(r) { t(r); }, leaveCancelled(r) { t(r); } }; return (r, s) => (ve(), ke(el, Ei({ name: z(e).b() }, $M(i)), { default: de(() => [ je(r.$slots, "default") ]), _: 3 }, 16, ["name"])); } }); var EL = /* @__PURE__ */ st(TL, [["__file", "collapse-transition.vue"]]); const CL = on(EL), LL = at({ title: { type: String, default: "" }, name: { type: Je([String, Number]), default: void 0 }, icon: { type: kr, default: Vr }, disabled: Boolean }), RL = (n) => { const e = pt(ry), { namespace: t } = nt("collapse"), i = Te(!1), r = Te(!1), s = of(), o = ue(() => s.current++), a = ue(() => { var f; return (f = n.name) != null ? f : `${t.value}-id-${s.prefix}-${z(o)}`; }), c = ue(() => e == null ? void 0 : e.activeNames.value.includes(z(a))); return { focusing: i, id: o, isActive: c, handleFocus: () => { setTimeout(() => { r.value ? r.value = !1 : i.value = !0; }, 50); }, handleHeaderClick: () => { n.disabled || (e == null || e.handleItemClick(z(a)), i.value = !1, r.value = !0); }, handleEnterClick: () => { e == null || e.handleItemClick(z(a)); } }; }, FL = (n, { focusing: e, isActive: t, id: i }) => { const r = nt("collapse"), s = ue(() => [ r.b("item"), r.is("active", z(t)), r.is("disabled", n.disabled) ]), o = ue(() => [ r.be("item", "header"), r.is("active", z(t)), { focusing: z(e) && !n.disabled } ]), a = ue(() => [ r.be("item", "arrow"), r.is("active", z(t)) ]), c = ue(() => r.be("item", "wrap")), l = ue(() => r.be("item", "content")), d = ue(() => r.b(`content-${z(i)}`)), h = ue(() => r.b(`head-${z(i)}`)); return { arrowKls: a, headKls: o, rootKls: s, itemWrapperKls: c, itemContentKls: l, scopedContentId: d, scopedHeadId: h }; }, PL = Pe({ name: "ElCollapseItem" }), IL = /* @__PURE__ */ Pe({ ...PL, props: LL, setup(n, { expose: e }) { const t = n, { focusing: i, id: r, isActive: s, handleFocus: o, handleHeaderClick: a, handleEnterClick: c } = RL(t), { arrowKls: l, headKls: d, rootKls: h, itemWrapperKls: f, itemContentKls: g, scopedContentId: p, scopedHeadId: u } = FL(t, { focusing: i, isActive: s, id: r }); return e({ isActive: s }), (y, v) => (ve(), Le("div", { class: Ee(z(h)) }, [ Ne("button", { id: z(u), class: Ee(z(d)), "aria-expanded": z(s), "aria-controls": z(p), "aria-describedby": z(p), tabindex: y.disabled ? -1 : 0, type: "button", onClick: z(a), onKeydown: ui(Ut(z(c), ["stop", "prevent"]), ["space", "enter"]), onFocus: z(o), onBlur: (m) => i.value = !1 }, [ je(y.$slots, "title", {}, () => [ rt(vt(y.title), 1) ]), je(y.$slots, "icon", { isActive: z(s) }, () => [ oe(z(It), { class: Ee(z(l)) }, { default: de(() => [ (ve(), ke(Fn(y.icon))) ]), _: 1 }, 8, ["class"]) ]) ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]), oe(z(CL), null, { default: de(() => [ Lt(Ne("div", { id: z(p), role: "region", class: Ee(z(f)), "aria-hidden": !z(s), "aria-labelledby": z(u) }, [ Ne("div", { class: Ee(z(g)) }, [ je(y.$slots, "default") ], 2) ], 10, ["id", "aria-hidden", "aria-labelledby"]), [ [mn, z(s)] ]) ]), _: 3 }) ], 2)); } }); var sy = /* @__PURE__ */ st(IL, [["__file", "collapse-item.vue"]]); const oy = on(SL, { CollapseItem: sy }), ay = vi(sy), OL = Pe({ name: "ElContainer" }), DL = /* @__PURE__ */ Pe({ ...OL, props: { direction: { type: String } }, setup(n) { const e = n, t = Xc(), i = nt("container"), r = ue(() => e.direction === "vertical" ? !0 : e.direction === "horizontal" ? !1 : t && t.default ? t.default().some((o) => { const a = o.type.name; return a === "ElHeader" || a === "ElFooter"; }) : !1); return (s, o) => (ve(), Le("section", { class: Ee([z(i).b(), z(i).is("vertical", z(r))]) }, [ je(s.$slots, "default") ], 2)); } }); var NL = /* @__PURE__ */ st(DL, [["__file", "container.vue"]]); const BL = Pe({ name: "ElAside" }), UL = /* @__PURE__ */ Pe({ ...BL, props: { width: { type: String, default: null } }, setup(n) { const e = n, t = nt("aside"), i = ue(() => e.width ? t.cssVarBlock({ width: e.width }) : {}); return (r, s) => (ve(), Le("aside", { class: Ee(z(t).b()), style: Rt(z(i)) }, [ je(r.$slots, "default") ], 6)); } }); var ly = /* @__PURE__ */ st(UL, [["__file", "aside.vue"]]); const zL = Pe({ name: "ElFooter" }), VL = /* @__PURE__ */ Pe({ ...zL, props: { height: { type: String, default: null } }, setup(n) { const e = n, t = nt("footer"), i = ue(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (r, s) => (ve(), Le("footer", { class: Ee(z(t).b()), style: Rt(z(i)) }, [ je(r.$slots, "default") ], 6)); } }); var cy = /* @__PURE__ */ st(VL, [["__file", "footer.vue"]]); const kL = Pe({ name: "ElHeader" }), GL = /* @__PURE__ */ Pe({ ...kL, props: { height: { type: String, default: null } }, setup(n) { const e = n, t = nt("header"), i = ue(() => e.height ? t.cssVarBlock({ height: e.height }) : {}); return (r, s) => (ve(), Le("header", { class: Ee(z(t).b()), style: Rt(z(i)) }, [ je(r.$slots, "default") ], 6)); } }); var uy = /* @__PURE__ */ st(GL, [["__file", "header.vue"]]); const HL = Pe({ name: "ElMain" }), WL = /* @__PURE__ */ Pe({ ...HL, setup(n) { const e = nt("main"); return (t, i) => (ve(), Le("main", { class: Ee(z(e).b()) }, [ je(t.$slots, "default") ], 2)); } }); var hy = /* @__PURE__ */ st(WL, [["__file", "main.vue"]]); const zi = on(NL, { Aside: ly, Footer: cy, Header: uy, Main: hy }); vi(ly); const dy = vi(cy), jL = vi(uy), hr = vi(hy), $L = /* @__PURE__ */ Pe({ inheritAttrs: !1 }); function ZL(n, e, t, i, r, s) { return je(n.$slots, "default"); } var XL = /* @__PURE__ */ st($L, [["render", ZL], ["__file", "collection.vue"]]); const YL = /* @__PURE__ */ Pe({ name: "ElCollectionItem", inheritAttrs: !1 }); function JL(n, e, t, i, r, s) { return je(n.$slots, "default"); } var KL = /* @__PURE__ */ st(YL, [["render", JL], ["__file", "collection-item.vue"]]); const qL = "data-el-collection-item", QL = (n) => { const e = `El${n}Collection`, t = `${e}Item`, i = Symbol(e), r = Symbol(t), s = { ...XL, name: e, setup() { const a = Te(null), c = /* @__PURE__ */ new Map(); sn(i, { itemMap: c, getItems: () => { const d = z(a); if (!d) return []; const h = Array.from(d.querySelectorAll(`[${qL}]`)); return [...c.values()].sort((g, p) => h.indexOf(g.ref) - h.indexOf(p.ref)); }, collectionRef: a }); } }, o = { ...KL, name: t, setup(a, { attrs: c }) { const l = Te(null), d = pt(i, void 0); sn(r, { collectionItemRef: l }), Jt(() => { const h = z(l); h && d.itemMap.set(h, { ref: h, ...c }); }), ei(() => { const h = z(l); d.itemMap.delete(h); }); } }; return { COLLECTION_INJECTION_KEY: i, COLLECTION_ITEM_INJECTION_KEY: r, ElCollection: s, ElCollectionItem: o }; }, Hu = at({ trigger: Va.trigger, effect: { ...Vn.effect, default: "light" }, type: { type: Je(String) }, placement: { type: Je(String), default: "bottom" }, popperOptions: { type: Je(Object), default: () => ({}) }, id: String, size: { type: String, default: "" }, splitButton: Boolean, hideOnClick: { type: Boolean, default: !0 }, loop: { type: Boolean, default: !0 }, showTimeout: { type: Number, default: 150 }, hideTimeout: { type: Number, default: 150 }, tabindex: { type: Je([Number, String]), default: 0 }, maxHeight: { type: Je([Number, String]), default: "" }, popperClass: { type: String, default: "" }, disabled: Boolean, role: { type: String, default: "menu" }, buttonProps: { type: Je(Object) }, teleported: Vn.teleported }); at({ command: { type: [Object, String, Number], default: () => ({}) }, disabled: Boolean, divided: Boolean, textValue: String, icon: { type: kr } }); at({ onKeydown: { type: Je(Function) } }); QL("Dropdown"); const eR = at({ id: { type: String, default: void 0 }, step: { type: Number, default: 1 }, stepStrictly: Boolean, max: { type: Number, default: Number.POSITIVE_INFINITY }, min: { type: Number, default: Number.NEGATIVE_INFINITY }, modelValue: Number, readonly: Boolean, disabled: Boolean, size: Gr, controls: { type: Boolean, default: !0 }, controlsPosition: { type: String, default: "", values: ["", "right"] }, valueOnClear: { type: [String, Number, null], validator: (n) => n === null || yt(n) || ["min", "max"].includes(n), default: null }, name: String, placeholder: String, precision: { type: Number, validator: (n) => n >= 0 && n === Number.parseInt(`${n}`, 10) }, validateEvent: { type: Boolean, default: !0 }, ...Yr(["ariaLabel"]) }), tR = { [ur]: (n, e) => e !== n, blur: (n) => n instanceof FocusEvent, focus: (n) => n instanceof FocusEvent, [bs]: (n) => yt(n) || Ci(n), [At]: (n) => yt(n) || Ci(n) }, nR = Pe({ name: "ElInputNumber" }), iR = /* @__PURE__ */ Pe({ ...nR, props: eR, emits: tR, setup(n, { expose: e, emit: t }) { const i = n, { t: r } = iu(), s = nt("input-number"), o = Te(), a = Wn({ currentValue: i.modelValue, userInput: null }), { formItem: c } = Jo(), l = ue(() => yt(i.modelValue) && i.modelValue <= i.min), d = ue(() => yt(i.modelValue) && i.modelValue >= i.max), h = ue(() => { const P = v(i.step); return di(i.precision) ? Math.max(v(i.modelValue), P) : (P > i.precision && Vt("InputNumber", "precision should not be less than the decimal places of step"), i.precision); }), f = ue(() => i.controls && i.controlsPosition === "right"), g = Ns(), p = ol(), u = ue(() => { if (a.userInput !== null) return a.userInput; let P = a.currentValue; if (Ci(P)) return ""; if (yt(P)) { if (Number.isNaN(P)) return ""; di(i.precision) || (P = P.toFixed(i.precision)); } return P; }), y = (P, b) => { if (di(b) && (b = h.value), b === 0) return Math.round(P); let F = String(P); const D = F.indexOf("."); if (D === -1 || !F.replace(".", "").split("")[D + b]) return P; const U = F.length; return F.charAt(U - 1) === "5" && (F = `${F.slice(0, Math.max(0, U - 1))}6`), Number.parseFloat(Number(F).toFixed(b)); }, v = (P) => { if (Ci(P)) return 0; const b = P.toString(), F = b.indexOf("."); let D = 0; return F !== -1 && (D = b.length - F - 1), D; }, m = (P, b = 1) => yt(P) ? y(P + i.step * b) : a.currentValue, x = () => { if (i.readonly || p.value || d.value) return; const P = Number(u.value) || 0, b = m(P); M(b), t(bs, a.currentValue), E(); }, w = () => { if (i.readonly || p.value || l.value) return; const P = Number(u.value) || 0, b = m(P, -1); M(b), t(bs, a.currentValue), E(); }, A = (P, b) => { const { max: F, min: D, step: N, precision: B, stepStrictly: U, valueOnClear: G } = i; F < D && Xo("InputNumber", "min should not be greater than max."); let Y = Number(P); if (Ci(P) || Number.isNaN(Y)) return null; if (P === "") { if (G === null) return null; Y = vn(G) ? { min: D, max: F }[G] : G; } return U && (Y = y(Math.round(Y / N) * N, B), Y !== P && b && t(At, Y)), di(B) || (Y = y(Y, B)), (Y > F || Y < D) && (Y = Y > F ? F : D, b && t(At, Y)), Y; }, M = (P, b = !0) => { var F; const D = a.currentValue, N = A(P); if (!b) { t(At, N); return; } D === N && P || (a.userInput = null, t(At, N), D !== N && t(ur, N, D), i.validateEvent && ((F = c == null ? void 0 : c.validate) == null || F.call(c, "change").catch((B) => Vt(B))), a.currentValue = N); }, R = (P) => { a.userInput = P; const b = P === "" ? null : Number(P); t(bs, b), M(b, !1); }, L = (P) => { const b = P !== "" ? Number(P) : ""; (yt(b) && !Number.isNaN(b) || P === "") && M(b), E(), a.userInput = null; }, S = () => { var P, b; (b = (P = o.value) == null ? void 0 : P.focus) == null || b.call(P); }, I = () => { var P, b; (b = (P = o.value) == null ? void 0 : P.blur) == null || b.call(P); }, T = (P) => { t("focus", P); }, _ = (P) => { var b; a.userInput = null, t("blur", P), i.validateEvent && ((b = c == null ? void 0 : c.validate) == null || b.call(c, "blur").catch((F) => Vt(F))); }, E = () => { a.currentValue !== i.modelValue && (a.currentValue = i.modelValue); }, C = (P) => { document.activeElement === P.target && P.preventDefault(); }; return Qe(() => i.modelValue, (P, b) => { const F = A(P, !0); a.userInput === null && F !== b && (a.currentValue = F); }, { immediate: !0 }), Jt(() => { var P; const { min: b, max: F, modelValue: D } = i, N = (P = o.value) == null ? void 0 : P.input; if (N.setAttribute("role", "spinbutton"), Number.isFinite(F) ? N.setAttribute("aria-valuemax", String(F)) : N.removeAttribute("aria-valuemax"), Number.isFinite(b) ? N.setAttribute("aria-valuemin", String(b)) : N.removeAttribute("aria-valuemin"), N.setAttribute("aria-valuenow", a.currentValue || a.currentValue === 0 ? String(a.currentValue) : ""), N.setAttribute("aria-disabled", String(p.value)), !yt(D) && D != null) { let B = Number(D); Number.isNaN(B) && (B = null), t(At, B); } N.addEventListener("wheel", C, { passive: !1 }); }), zd(() => { var P, b; const F = (P = o.value) == null ? void 0 : P.input; F == null || F.setAttribute("aria-valuenow", `${(b = a.currentValue) != null ? b : ""}`); }), e({ focus: S, blur: I }), (P, b) => (ve(), Le("div", { class: Ee([ z(s).b(), z(s).m(z(g)), z(s).is("disabled", z(p)), z(s).is("without-controls", !P.controls), z(s).is("controls-right", z(f)) ]), onDragstart: Ut(() => { }, ["prevent"]) }, [ P.controls ? Lt((ve(), Le("span", { key: 0, role: "button", "aria-label": z(r)("el.inputNumber.decrease"), class: Ee([z(s).e("decrease"), z(s).is("disabled", z(l))]), onKeydown: ui(w, ["enter"]) }, [ je(P.$slots, "decrease-icon", {}, () => [ oe(z(It), null, { default: de(() => [ z(f) ? (ve(), ke(z(Xd), { key: 0 })) : (ve(), ke(z(K_), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [z(Nm), w] ]) : Ve("v-if", !0), P.controls ? Lt((ve(), Le("span", { key: 1, role: "button", "aria-label": z(r)("el.inputNumber.increase"), class: Ee([z(s).e("increase"), z(s).is("disabled", z(d))]), onKeydown: ui(x, ["enter"]) }, [ je(P.$slots, "increase-icon", {}, () => [ oe(z(It), null, { default: de(() => [ z(f) ? (ve(), ke(z(k_), { key: 0 })) : (ve(), ke(z(tu), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [z(Nm), x] ]) : Ve("v-if", !0), oe(z(QE), { id: P.id, ref_key: "input", ref: o, type: "number", step: P.step, "model-value": z(u), placeholder: P.placeholder, readonly: P.readonly, disabled: z(p), size: z(g), max: P.max, min: P.min, name: P.name, "aria-label": P.ariaLabel, "validate-event": !1, onKeydown: [ ui(Ut(x, ["prevent"]), ["up"]), ui(Ut(w, ["prevent"]), ["down"]) ], onBlur: _, onFocus: T, onInput: R, onChange: L }, ZM({ _: 2 }, [ P.$slots.prefix ? { name: "prefix", fn: de(() => [ je(P.$slots, "prefix") ]) } : void 0, P.$slots.suffix ? { name: "suffix", fn: de(() => [ je(P.$slots, "suffix") ]) } : void 0 ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"]) ], 42, ["onDragstart"])); } }); var rR = /* @__PURE__ */ st(iR, [["__file", "input-number.vue"]]); const dr = on(rR), fy = Symbol("ElSelectGroup"), lu = Symbol("ElSelect"); function sR(n, e) { const t = pt(lu), i = pt(fy, { disabled: !1 }), r = ue(() => d(Si(t.props.modelValue), n.value)), s = ue(() => { var g; if (t.props.multiple) { const p = Si((g = t.props.modelValue) != null ? g : []); return !r.value && p.length >= t.props.multipleLimit && t.props.multipleLimit > 0; } else return !1; }), o = ue(() => n.label || (Tn(n.value) ? "" : n.value)), a = ue(() => n.value || n.label || ""), c = ue(() => n.disabled || e.groupDisabled || s.value), l = dn(), d = (g = [], p) => { if (Tn(n.value)) { const u = t.props.valueKey; return g && g.some((y) => kv(Ji(y, u)) === Ji(p, u)); } else return g && g.includes(p); }, h = () => { !n.disabled && !i.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(l.proxy)); }, f = (g) => { const p = new RegExp(O_(g), "i"); e.visible = p.test(o.value) || n.created; }; return Qe(() => o.value, () => { !n.created && !t.props.remote && t.setSelected(); }), Qe(() => n.value, (g, p) => { const { remote: u, valueKey: y } = t.props; if (g !== p && (t.onOptionDestroy(p, l.proxy), t.onOptionCreate(l.proxy)), !n.created && !u) { if (y && Tn(g) && Tn(p) && g[y] === p[y]) return; t.setSelected(); } }), Qe(() => i.disabled, () => { e.groupDisabled = i.disabled; }, { immediate: !0 }), { select: t, currentLabel: o, currentValue: a, itemSelected: r, isDisabled: c, hoverItem: h, updateOption: f }; } const oR = Pe({ name: "ElOption", componentName: "ElOption", props: { value: { required: !0, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(n) { const e = nt("select"), t = sl(), i = ue(() => [ e.be("dropdown", "item"), e.is("disabled", z(a)), e.is("selected", z(o)), e.is("hovering", z(f)) ]), r = Wn({ index: -1, groupDisabled: !1, visible: !0, hover: !1 }), { currentLabel: s, itemSelected: o, isDisabled: a, select: c, hoverItem: l, updateOption: d } = sR(n, r), { visible: h, hover: f } = Br(r), g = dn().proxy; c.onOptionCreate(g), ei(() => { const u = g.value, { selected: y } = c.states, m = (c.props.multiple ? y : [y]).some((x) => x.value === g.value); bt(() => { c.states.cachedOptions.get(u) === g && !m && c.states.cachedOptions.delete(u); }), c.onOptionDestroy(u, g); }); function p() { a.value || c.handleOptionSelect(g); } return { ns: e, id: t, containerKls: i, currentLabel: s, itemSelected: o, isDisabled: a, select: c, hoverItem: l, updateOption: d, visible: h, hover: f, selectOptionClick: p, states: r }; } }); function aR(n, e, t, i, r, s) { return Lt((ve(), Le("li", { id: n.id, class: Ee(n.containerKls), role: "option", "aria-disabled": n.isDisabled || void 0, "aria-selected": n.itemSelected, onMouseenter: n.hoverItem, onClick: Ut(n.selectOptionClick, ["stop"]) }, [ je(n.$slots, "default", {}, () => [ Ne("span", null, vt(n.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [mn, n.visible] ]); } var mf = /* @__PURE__ */ st(oR, [["render", aR], ["__file", "option.vue"]]); const lR = Pe({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const n = pt(lu), e = nt("select"), t = ue(() => n.props.popperClass), i = ue(() => n.props.multiple), r = ue(() => n.props.fitInputWidth), s = Te(""); function o() { var a; s.value = `${(a = n.selectRef) == null ? void 0 : a.offsetWidth}px`; } return Jt(() => { o(), Yn(n.selectRef, o); }), { ns: e, minWidth: s, popperClass: t, isMultiple: i, isFitInputWidth: r }; } }); function cR(n, e, t, i, r, s) { return ve(), Le("div", { class: Ee([n.ns.b("dropdown"), n.ns.is("multiple", n.isMultiple), n.popperClass]), style: Rt({ [n.isFitInputWidth ? "width" : "minWidth"]: n.minWidth }) }, [ n.$slots.header ? (ve(), Le("div", { key: 0, class: Ee(n.ns.be("dropdown", "header")) }, [ je(n.$slots, "header") ], 2)) : Ve("v-if", !0), je(n.$slots, "default"), n.$slots.footer ? (ve(), Le("div", { key: 1, class: Ee(n.ns.be("dropdown", "footer")) }, [ je(n.$slots, "footer") ], 2)) : Ve("v-if", !0) ], 6); } var uR = /* @__PURE__ */ st(lR, [["render", cR], ["__file", "select-dropdown.vue"]]); const hR = 11, dR = (n, e) => { const { t } = iu(), i = sl(), r = nt("select"), s = nt("input"), o = Wn({ inputValue: "", options: /* @__PURE__ */ new Map(), cachedOptions: /* @__PURE__ */ new Map(), disabledOptions: /* @__PURE__ */ new Map(), optionValues: [], selected: [], selectionWidth: 0, calculatorWidth: 0, collapseItemWidth: 0, selectedLabel: "", hoveringIndex: -1, previousQuery: null, inputHovering: !1, menuVisibleOnFocus: !1, isBeforeHide: !1 }), a = Te(null), c = Te(null), l = Te(null), d = Te(null), h = Te(null), f = Te(null), g = Te(null), p = Te(null), u = Te(null), y = Te(null), v = Te(null), m = Te(null), { isComposing: x, handleCompositionStart: w, handleCompositionUpdate: A, handleCompositionEnd: M } = N0({ afterComposition: (ge) => ne(ge) }), { wrapperRef: R, isFocused: L } = D0(h, { beforeFocus() { return b.value; }, afterFocus() { n.automaticDropdown && !S.value && (S.value = !0, o.menuVisibleOnFocus = !0); }, beforeBlur(ge) { var Se, Fe; return ((Se = l.value) == null ? void 0 : Se.isFocusInsideContent(ge)) || ((Fe = d.value) == null ? void 0 : Fe.isFocusInsideContent(ge)); }, afterBlur() { S.value = !1, o.menuVisibleOnFocus = !1; } }), S = Te(!1), I = Te(), { form: T, formItem: _ } = Jo(), { inputId: E } = su(n, { formItemContext: _ }), { valueOnClear: C, isEmptyValue: P } = NE(n), b = ue(() => n.disabled || (T == null ? void 0 : T.disabled)), F = ue(() => Pn(n.modelValue) ? n.modelValue.length > 0 : !P(n.modelValue)), D = ue(() => n.clearable && !b.value && o.inputHovering && F.value), N = ue(() => n.remote && n.filterable && !n.remoteShowSuffix ? "" : n.suffixIcon), B = ue(() => r.is("reverse", N.value && S.value)), U = ue(() => (_ == null ? void 0 : _.validateState) || ""), G = ue(() => d0[U.value]), Y = ue(() => n.remote ? 300 : 0), te = ue(() => n.loading ? n.loadingText || t("el.select.loading") : n.remote && !o.inputValue && o.options.size === 0 ? !1 : n.filterable && o.inputValue && o.options.size > 0 && ae.value === 0 ? n.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? n.noDataText || t("el.select.noData") : null), ae = ue(() => ie.value.filter((ge) => ge.visible).length), ie = ue(() => { const ge = Array.from(o.options.values()), Se = []; return o.optionValues.forEach((Fe) => { const Ge = ge.findIndex((We) => We.value === Fe); Ge > -1 && Se.push(ge[Ge]); }), Se.length >= ge.length ? Se : ge; }), le = ue(() => Array.from(o.cachedOptions.values())), W = ue(() => { const ge = ie.value.filter((Se) => !Se.created).some((Se) => Se.currentLabel === o.inputValue); return n.filterable && n.allowCreate && o.inputValue !== "" && !ge; }), $ = () => { n.filterable && Sn(n.filterMethod) || n.filterable && n.remote && Sn(n.remoteMethod) || ie.value.forEach((ge) => { var Se; (Se = ge.updateOption) == null || Se.call(ge, o.inputValue); }); }, j = Ns(), re = ue(() => ["small"].includes(j.value) ? "small" : "default"), V = ue({ get() { return S.value && te.value !== !1; }, set(ge) { S.value = ge; } }), H = ue(() => { if (n.multiple && !di(n.modelValue)) return Si(n.modelValue).length === 0 && !o.inputValue; const ge = Pn(n.modelValue) ? n.modelValue[0] : n.modelValue; return n.filterable || di(ge) ? !o.inputValue : !0; }), K = ue(() => { var ge; const Se = (ge = n.placeholder) != null ? ge : t("el.select.placeholder"); return n.multiple || !F.value ? Se : o.selectedLabel; }), ce = ue(() => zh ? null : "mouseenter"); Qe(() => n.modelValue, (ge, Se) => { n.multiple && n.filterable && !n.reserveKeyword && (o.inputValue = "", se("")), O(), !$h(ge, Se) && n.validateEvent && (_ == null || _.validate("change").catch((Fe) => Vt(Fe))); }, { flush: "post", deep: !0 }), Qe(() => S.value, (ge) => { ge ? se(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = !0), e("visible-change", ge); }), Qe(() => o.options.entries(), () => { var ge; if (!en) return; const Se = ((ge = a.value) == null ? void 0 : ge.querySelectorAll("input")) || []; (!n.filterable && !n.defaultFirstOption && !di(n.modelValue) || !Array.from(Se).includes(document.activeElement)) && O(), n.defaultFirstOption && (n.filterable || n.remote) && ae.value && k(); }, { flush: "post" }), Qe(() => o.hoveringIndex, (ge) => { yt(ge) && ge > -1 ? I.value = ie.value[ge] || {} : I.value = {}, ie.value.forEach((Se) => { Se.hover = I.value === Se; }); }), Nv(() => { o.isBeforeHide || $(); }); const se = (ge) => { o.previousQuery === ge || x.value || (o.previousQuery = ge, n.filterable && Sn(n.filterMethod) ? n.filterMethod(ge) : n.filterable && n.remote && Sn(n.remoteMethod) && n.remoteMethod(ge), n.defaultFirstOption && (n.filterable || n.remote) && ae.value ? bt(k) : bt(X)); }, k = () => { const ge = ie.value.filter((Ge) => Ge.visible && !Ge.disabled && !Ge.states.groupDisabled), Se = ge.find((Ge) => Ge.created), Fe = ge[0]; o.hoveringIndex = Mt(ie.value, Se || Fe); }, O = () => { if (n.multiple) o.selectedLabel = ""; else { const Se = Pn(n.modelValue) ? n.modelValue[0] : n.modelValue, Fe = Z(Se); o.selectedLabel = Fe.currentLabel, o.selected = [Fe]; return; } const ge = []; di(n.modelValue) || Si(n.modelValue).forEach((Se) => { ge.push(Z(Se)); }), o.selected = ge; }, Z = (ge) => { let Se; const Fe = Pu(ge).toLowerCase() === "object", Ge = Pu(ge).toLowerCase() === "null", We = Pu(ge).toLowerCase() === "undefined"; for (let ft = o.cachedOptions.size - 1; ft >= 0; ft--) { const kt = le.value[ft]; if (Fe ? Ji(kt.value, n.valueKey) === Ji(ge, n.valueKey) : kt.value === ge) { Se = { value: ge, currentLabel: kt.currentLabel, get isDisabled() { return kt.isDisabled; } }; break; } } if (Se) return Se; const et = Fe ? ge.label : !Ge && !We ? ge : ""; return { value: ge, currentLabel: et }; }, X = () => { o.hoveringIndex = ie.value.findIndex((ge) => o.selected.some((Se) => _e(Se) === _e(ge))); }, ee = () => { o.selectionWidth = c.value.getBoundingClientRect().width; }, fe = () => { o.calculatorWidth = f.value.getBoundingClientRect().width; }, be = () => { o.collapseItemWidth = v.value.getBoundingClientRect().width; }, Ae = () => { var ge, Se; (Se = (ge = l.value) == null ? void 0 : ge.updatePopper) == null || Se.call(ge); }, he = () => { var ge, Se; (Se = (ge = d.value) == null ? void 0 : ge.updatePopper) == null || Se.call(ge); }, xe = () => { o.inputValue.length > 0 && !S.value && (S.value = !0), se(o.inputValue); }, ne = (ge) => { if (o.inputValue = ge.target.value, n.remote) me(); else return xe(); }, me = jh(() => { xe(); }, Y.value), Me = (ge) => { $h(n.modelValue, ge) || e(ur, ge); }, De = (ge) => E_(ge, (Se) => !o.disabledOptions.has(Se)), Ie = (ge) => { if (n.multiple && ge.code !== Li.delete && ge.target.value.length <= 0) { const Se = Si(n.modelValue).slice(), Fe = De(Se); if (Fe < 0) return; const Ge = Se[Fe]; Se.splice(Fe, 1), e(At, Se), Me(Se), e("remove-tag", Ge); } }, $e = (ge, Se) => { const Fe = o.selected.indexOf(Se); if (Fe > -1 && !b.value) { const Ge = Si(n.modelValue).slice(); Ge.splice(Fe, 1), e(At, Ge), Me(Ge), e("remove-tag", Se.value); } ge.stopPropagation(), Ft(); }, lt = (ge) => { ge.stopPropagation(); const Se = n.multiple ? [] : C.value; if (n.multiple) for (const Fe of o.selected) Fe.isDisabled && Se.push(Fe.value); e(At, Se), Me(Se), o.hoveringIndex = -1, S.value = !1, e("clear"), Ft(); }, qe = (ge) => { var Se; if (n.multiple) { const Fe = Si((Se = n.modelValue) != null ? Se : []).slice(), Ge = Mt(Fe, ge.value); Ge > -1 ? Fe.splice(Ge, 1) : (n.multipleLimit <= 0 || Fe.length < n.multipleLimit) && Fe.push(ge.value), e(At, Fe), Me(Fe), ge.created && se(""), n.filterable && !n.reserveKeyword && (o.inputValue = ""); } else e(At, ge.value), Me(ge.value), S.value = !1; Ft(), !S.value && bt(() => { Be(ge); }); }, Mt = (ge = [], Se) => { if (!Tn(Se)) return ge.indexOf(Se); const Fe = n.valueKey; let Ge = -1; return ge.some((We, et) => kv(Ji(We, Fe)) === Ji(Se, Fe) ? (Ge = et, !0) : !1), Ge; }, Be = (ge) => { var Se, Fe, Ge, We, et; const Ye = Pn(ge) ? ge[0] : ge; let ft = null; if (Ye != null && Ye.value) { const kt = ie.value.filter((ln) => ln.value === Ye.value); kt.length > 0 && (ft = kt[0].$el); } if (l.value && ft) { const kt = (We = (Ge = (Fe = (Se = l.value) == null ? void 0 : Se.popperRef) == null ? void 0 : Fe.contentRef) == null ? void 0 : Ge.querySelector) == null ? void 0 : We.call(Ge, `.${r.be("dropdown", "wrap")}`); kt && N_(kt, ft); } (et = m.value) == null || et.handleScroll(); }, it = (ge) => { o.options.set(ge.value, ge), o.cachedOptions.set(ge.value, ge), ge.disabled && o.disabledOptions.set(ge.value, ge); }, tt = (ge, Se) => { o.options.get(ge) === Se && o.options.delete(ge); }, qt = ue(() => { var ge, Se; return (Se = (ge = l.value) == null ? void 0 : ge.popperRef) == null ? void 0 : Se.contentRef; }), Qt = () => { o.isBeforeHide = !1, bt(() => Be(o.selected)); }, Ft = () => { var ge; (ge = h.value) == null || ge.focus(); }, Nt = () => { var ge; (ge = h.value) == null || ge.blur(); }, Vi = (ge) => { lt(ge); }, ki = () => { S.value = !1, L.value && Nt(); }, ni = () => { o.inputValue.length > 0 ? o.inputValue = "" : S.value = !1; }, ts = () => { b.value || (zh && (o.inputHovering = !0), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = !1 : S.value = !S.value); }, Q = () => { S.value ? ie.value[o.hoveringIndex] && qe(ie.value[o.hoveringIndex]) : ts(); }, _e = (ge) => Tn(ge.value) ? Ji(ge.value, n.valueKey) : ge.value, Oe = ue(() => ie.value.filter((ge) => ge.visible).every((ge) => ge.disabled)), Ze = ue(() => n.multiple ? n.collapseTags ? o.selected.slice(0, n.maxCollapseTags) : o.selected : []), ht = ue(() => n.multiple ? n.collapseTags ? o.selected.slice(n.maxCollapseTags) : [] : []), J = (ge) => { if (!S.value) { S.value = !0; return; } if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || x.value) && !Oe.value) { ge === "next" ? (o.hoveringIndex++, o.hoveringIndex === o.options.size && (o.hoveringIndex = 0)) : ge === "prev" && (o.hoveringIndex--, o.hoveringIndex < 0 && (o.hoveringIndex = o.options.size - 1)); const Se = ie.value[o.hoveringIndex]; (Se.disabled === !0 || Se.states.groupDisabled === !0 || !Se.visible) && J(ge), bt(() => Be(I.value)); } }, ye = () => { if (!c.value) return 0; const ge = window.getComputedStyle(c.value); return Number.parseFloat(ge.gap || "6px"); }, pe = ue(() => { const ge = ye(); return { maxWidth: `${v.value && n.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - ge : o.selectionWidth}px` }; }), we = ue(() => ({ maxWidth: `${o.selectionWidth}px` })), Ce = ue(() => ({ width: `${Math.max(o.calculatorWidth, hR)}px` })); return Yn(c, ee), Yn(f, fe), Yn(u, Ae), Yn(R, Ae), Yn(y, he), Yn(v, be), Jt(() => { O(); }), { inputId: E, contentId: i, nsSelect: r, nsInput: s, states: o, isFocused: L, expanded: S, optionsArray: ie, hoverOption: I, selectSize: j, filteredOptionsCount: ae, resetCalculatorWidth: fe, updateTooltip: Ae, updateTagTooltip: he, debouncedOnInputChange: me, onInput: ne, deletePrevTag: Ie, deleteTag: $e, deleteSelected: lt, handleOptionSelect: qe, scrollToOption: Be, hasModelValue: F, shouldShowPlaceholder: H, currentPlaceholder: K, mouseEnterEventName: ce, showClose: D, iconComponent: N, iconReverse: B, validateState: U, validateIcon: G, showNewOption: W, updateOptions: $, collapseTagSize: re, setSelected: O, selectDisabled: b, emptyText: te, handleCompositionStart: w, handleCompositionUpdate: A, handleCompositionEnd: M, onOptionCreate: it, onOptionDestroy: tt, handleMenuEnter: Qt, focus: Ft, blur: Nt, handleClearClick: Vi, handleClickOutside: ki, handleEsc: ni, toggleMenu: ts, selectOption: Q, getValueKey: _e, navigateOptions: J, dropdownMenuVisible: V, showTagList: Ze, collapseTagList: ht, tagStyle: pe, collapseTagStyle: we, inputStyle: Ce, popperRef: qt, inputRef: h, tooltipRef: l, tagTooltipRef: d, calculatorRef: f, prefixRef: g, suffixRef: p, selectRef: a, wrapperRef: R, selectionRef: c, scrollbarRef: m, menuRef: u, tagMenuRef: y, collapseItemRef: v }; }; var fR = Pe({ name: "ElOptions", setup(n, { slots: e }) { const t = pt(lu); let i = []; return () => { var r, s; const o = (r = e.default) == null ? void 0 : r.call(e), a = []; function c(l) { Pn(l) && l.forEach((d) => { var h, f, g, p; const u = (h = (d == null ? void 0 : d.type) || {}) == null ? void 0 : h.name; u === "ElOptionGroup" ? c(!vn(d.children) && !Pn(d.children) && Sn((f = d.children) == null ? void 0 : f.default) ? (g = d.children) == null ? void 0 : g.default() : d.children) : u === "ElOption" ? a.push((p = d.props) == null ? void 0 : p.value) : Pn(d.children) && c(d.children); }); } return o.length && c((s = o[0]) == null ? void 0 : s.children), $h(a, i) || (i = a, t && (t.states.optionValues = a)), o; }; } }); const pR = at({ name: String, id: String, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, autocomplete: { type: String, default: "off" }, automaticDropdown: Boolean, size: Gr, effect: { type: Je(String), default: "light" }, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, popperClass: { type: String, default: "" }, popperOptions: { type: Je(Object), default: () => ({}) }, remote: Boolean, loadingText: String, noMatchText: String, noDataText: String, remoteMethod: Function, filterMethod: Function, multiple: Boolean, multipleLimit: { type: Number, default: 0 }, placeholder: { type: String }, defaultFirstOption: Boolean, reserveKeyword: { type: Boolean, default: !0 }, valueKey: { type: String, default: "value" }, collapseTags: Boolean, collapseTagsTooltip: Boolean, maxCollapseTags: { type: Number, default: 1 }, teleported: Vn.teleported, persistent: { type: Boolean, default: !0 }, clearIcon: { type: kr, default: Yd }, fitInputWidth: Boolean, suffixIcon: { type: kr, default: Xd }, tagType: { ...Qh.type, default: "info" }, tagEffect: { ...Qh.effect, default: "light" }, validateEvent: { type: Boolean, default: !0 }, remoteShowSuffix: Boolean, placement: { type: Je(String), values: Yo, default: "bottom-start" }, fallbackPlacements: { type: Je(Array), default: ["bottom-start", "top-start", "right", "left"] }, appendTo: String, ...DE, ...Yr(["ariaLabel"]) }), Um = "ElSelect", mR = Pe({ name: Um, componentName: Um, components: { ElSelectMenu: uR, ElOption: mf, ElOptions: fR, ElTag: aL, ElScrollbar: f2, ElTooltip: pf, ElIcon: It }, directives: { ClickOutside: HC }, props: pR, emits: [ At, ur, "remove-tag", "clear", "visible-change", "focus", "blur" ], setup(n, { emit: e }) { const t = ue(() => { const { modelValue: s, multiple: o } = n, a = o ? [] : void 0; return Pn(s) ? o ? s : a : o ? a : s; }), i = Wn({ ...Br(n), modelValue: t }), r = dR(i, e); return sn(lu, Wn({ 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 gR(n, e, t, i, r, s) { const o = kn("el-tag"), a = kn("el-tooltip"), c = kn("el-icon"), l = kn("el-option"), d = kn("el-options"), h = kn("el-scrollbar"), f = kn("el-select-menu"), g = XM("click-outside"); return Lt((ve(), Le("div", { ref: "selectRef", class: Ee([n.nsSelect.b(), n.nsSelect.m(n.selectSize)]), [YM(n.mouseEnterEventName)]: (p) => n.states.inputHovering = !0, onMouseleave: (p) => n.states.inputHovering = !1 }, [ oe(a, { ref: "tooltipRef", visible: n.dropdownMenuVisible, placement: n.placement, teleported: n.teleported, "popper-class": [n.nsSelect.e("popper"), n.popperClass], "popper-options": n.popperOptions, "fallback-placements": n.fallbackPlacements, effect: n.effect, pure: "", trigger: "click", transition: `${n.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": !1, "gpu-acceleration": !1, persistent: n.persistent, "append-to": n.appendTo, onBeforeShow: n.handleMenuEnter, onHide: (p) => n.states.isBeforeHide = !1 }, { default: de(() => { var p; return [ Ne("div", { ref: "wrapperRef", class: Ee([ n.nsSelect.e("wrapper"), n.nsSelect.is("focused", n.isFocused), n.nsSelect.is("hovering", n.states.inputHovering), n.nsSelect.is("filterable", n.filterable), n.nsSelect.is("disabled", n.selectDisabled) ]), onClick: Ut(n.toggleMenu, ["prevent"]) }, [ n.$slots.prefix ? (ve(), Le("div", { key: 0, ref: "prefixRef", class: Ee(n.nsSelect.e("prefix")) }, [ je(n.$slots, "prefix") ], 2)) : Ve("v-if", !0), Ne("div", { ref: "selectionRef", class: Ee([ n.nsSelect.e("selection"), n.nsSelect.is("near", n.multiple && !n.$slots.prefix && !!n.states.selected.length) ]) }, [ n.multiple ? je(n.$slots, "tag", { key: 0 }, () => [ (ve(!0), Le(Pt, null, Jn(n.showTagList, (u) => (ve(), Le("div", { key: n.getValueKey(u), class: Ee(n.nsSelect.e("selected-item")) }, [ oe(o, { closable: !n.selectDisabled && !u.isDisabled, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", style: Rt(n.tagStyle), onClose: (y) => n.deleteTag(y, u) }, { default: de(() => [ Ne("span", { class: Ee(n.nsSelect.e("tags-text")) }, [ je(n.$slots, "label", { label: u.currentLabel, value: u.value }, () => [ rt(vt(u.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), n.collapseTags && n.states.selected.length > n.maxCollapseTags ? (ve(), ke(a, { key: 0, ref: "tagTooltipRef", disabled: n.dropdownMenuVisible || !n.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: n.effect, placement: "bottom", teleported: n.teleported }, { default: de(() => [ Ne("div", { ref: "collapseItemRef", class: Ee(n.nsSelect.e("selected-item")) }, [ oe(o, { closable: !1, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", style: Rt(n.collapseTagStyle) }, { default: de(() => [ Ne("span", { class: Ee(n.nsSelect.e("tags-text")) }, " + " + vt(n.states.selected.length - n.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: de(() => [ Ne("div", { ref: "tagMenuRef", class: Ee(n.nsSelect.e("selection")) }, [ (ve(!0), Le(Pt, null, Jn(n.collapseTagList, (u) => (ve(), Le("div", { key: n.getValueKey(u), class: Ee(n.nsSelect.e("selected-item")) }, [ oe(o, { class: "in-tooltip", closable: !n.selectDisabled && !u.isDisabled, size: n.collapseTagSize, type: n.tagType, effect: n.tagEffect, "disable-transitions": "", onClose: (y) => n.deleteTag(y, u) }, { default: de(() => [ Ne("span", { class: Ee(n.nsSelect.e("tags-text")) }, [ je(n.$slots, "label", { label: u.currentLabel, value: u.value }, () => [ rt(vt(u.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : Ve("v-if", !0) ]) : Ve("v-if", !0), n.selectDisabled ? Ve("v-if", !0) : (ve(), Le("div", { key: 1, class: Ee([ n.nsSelect.e("selected-item"), n.nsSelect.e("input-wrapper"), n.nsSelect.is("hidden", !n.filterable) ]) }, [ Lt(Ne("input", { id: n.inputId, ref: "inputRef", "onUpdate:modelValue": (u) => n.states.inputValue = u, type: "text", name: n.name, class: Ee([n.nsSelect.e("input"), n.nsSelect.is(n.selectSize)]), disabled: n.selectDisabled, autocomplete: n.autocomplete, style: Rt(n.inputStyle), role: "combobox", readonly: !n.filterable, spellcheck: "false", "aria-activedescendant": ((p = n.hoverOption) == null ? void 0 : p.id) || "", "aria-controls": n.contentId, "aria-expanded": n.dropdownMenuVisible, "aria-label": n.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ ui(Ut((u) => n.navigateOptions("next"), ["stop", "prevent"]), ["down"]), ui(Ut((u) => n.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), ui(Ut(n.handleEsc, ["stop", "prevent"]), ["esc"]), ui(Ut(n.selectOption, ["stop", "prevent"]), ["enter"]), ui(Ut(n.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: n.handleCompositionStart, onCompositionupdate: n.handleCompositionUpdate, onCompositionend: n.handleCompositionEnd, onInput: n.onInput, onClick: Ut(n.toggleMenu, ["stop"]) }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [ [JM, n.states.inputValue] ]), n.filterable ? (ve(), Le("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: Ee(n.nsSelect.e("input-calculator")), textContent: vt(n.states.inputValue) }, null, 10, ["textContent"])) : Ve("v-if", !0) ], 2)), n.shouldShowPlaceholder ? (ve(), Le("div", { key: 2, class: Ee([ n.nsSelect.e("selected-item"), n.nsSelect.e("placeholder"), n.nsSelect.is("transparent", !n.hasModelValue || n.expanded && !n.states.inputValue) ]) }, [ n.hasModelValue ? je(n.$slots, "label", { key: 0, label: n.currentPlaceholder, value: n.modelValue }, () => [ Ne("span", null, vt(n.currentPlaceholder), 1) ]) : (ve(), Le("span", { key: 1 }, vt(n.currentPlaceholder), 1)) ], 2)) : Ve("v-if", !0) ], 2), Ne("div", { ref: "suffixRef", class: Ee(n.nsSelect.e("suffix")) }, [ n.iconComponent && !n.showClose ? (ve(), ke(c, { key: 0, class: Ee([n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.iconReverse]) }, { default: de(() => [ (ve(), ke(Fn(n.iconComponent))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0), n.showClose && n.clearIcon ? (ve(), ke(c, { key: 1, class: Ee([ n.nsSelect.e("caret"), n.nsSelect.e("icon"), n.nsSelect.e("clear") ]), onClick: n.handleClearClick }, { default: de(() => [ (ve(), ke(Fn(n.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : Ve("v-if", !0), n.validateState && n.validateIcon ? (ve(), ke(c, { key: 2, class: Ee([n.nsInput.e("icon"), n.nsInput.e("validateIcon")]) }, { default: de(() => [ (ve(), ke(Fn(n.validateIcon))) ]), _: 1 }, 8, ["class"])) : Ve("v-if", !0) ], 2) ], 10, ["onClick"]) ]; }), content: de(() => [ oe(f, { ref: "menuRef" }, { default: de(() => [ n.$slots.header ? (ve(), Le("div", { key: 0, class: Ee(n.nsSelect.be("dropdown", "header")), onClick: Ut(() => { }, ["stop"]) }, [ je(n.$slots, "header") ], 10, ["onClick"])) : Ve("v-if", !0), Lt(oe(h, { id: n.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": n.nsSelect.be("dropdown", "wrap"), "view-class": n.nsSelect.be("dropdown", "list"), class: Ee([n.nsSelect.is("empty", n.filteredOptionsCount === 0)]), role: "listbox", "aria-label": n.ariaLabel, "aria-orientation": "vertical" }, { default: de(() => [ n.showNewOption ? (ve(), ke(l, { key: 0, value: n.states.inputValue, created: !0 }, null, 8, ["value"])) : Ve("v-if", !0), oe(d, null, { default: de(() => [ je(n.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [mn, n.states.options.size > 0 && !n.loading] ]), n.$slots.loading && n.loading ? (ve(), Le("div", { key: 1, class: Ee(n.nsSelect.be("dropdown", "loading")) }, [ je(n.$slots, "loading") ], 2)) : n.loading || n.filteredOptionsCount === 0 ? (ve(), Le("div", { key: 2, class: Ee(n.nsSelect.be("dropdown", "empty")) }, [ je(n.$slots, "empty", {}, () => [ Ne("span", null, vt(n.emptyText), 1) ]) ], 2)) : Ve("v-if", !0), n.$slots.footer ? (ve(), Le("div", { key: 3, class: Ee(n.nsSelect.be("dropdown", "footer")), onClick: Ut(() => { }, ["stop"]) }, [ je(n.$slots, "footer") ], 10, ["onClick"])) : Ve("v-if", !0) ]), _: 3 }, 512) ]), _: 3 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"]) ], 16, ["onMouseleave"])), [ [g, n.handleClickOutside, n.popperRef] ]); } var vR = /* @__PURE__ */ st(mR, [["render", gR], ["__file", "select.vue"]]); const yR = Pe({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(n) { const e = nt("select"), t = Te(null), i = dn(), r = Te([]); sn(fy, Wn({ ...Br(n) })); const s = ue(() => r.value.some((l) => l.visible === !0)), o = (l) => { var d, h; return ((d = l.type) == null ? void 0 : d.name) === "ElOption" && !!((h = l.component) != null && h.proxy); }, a = (l) => { const d = Si(l), h = []; return d.forEach((f) => { var g, p; o(f) ? h.push(f.component.proxy) : (g = f.children) != null && g.length ? h.push(...a(f.children)) : (p = f.component) != null && p.subTree && h.push(...a(f.component.subTree)); }), h; }, c = () => { r.value = a(i.subTree); }; return Jt(() => { c(); }), Tw(t, c, { attributes: !0, subtree: !0, childList: !0 }), { groupRef: t, visible: s, ns: e }; } }); function bR(n, e, t, i, r, s) { return Lt((ve(), Le("ul", { ref: "groupRef", class: Ee(n.ns.be("group", "wrap")) }, [ Ne("li", { class: Ee(n.ns.be("group", "title")) }, vt(n.label), 3), Ne("li", null, [ Ne("ul", { class: Ee(n.ns.b("group")) }, [ je(n.$slots, "default") ], 2) ]) ], 2)), [ [mn, n.visible] ]); } var py = /* @__PURE__ */ st(yR, [["render", bR], ["__file", "option-group.vue"]]); const qo = on(vR, { Option: mf, OptionGroup: py }), Qo = vi(mf); vi(py); const xR = at({ trigger: Va.trigger, placement: Hu.placement, disabled: Va.disabled, visible: Vn.visible, transition: Vn.transition, popperOptions: Hu.popperOptions, tabindex: Hu.tabindex, content: Vn.content, popperStyle: Vn.popperStyle, popperClass: Vn.popperClass, enterable: { ...Vn.enterable, default: !0 }, effect: { ...Vn.effect, default: "light" }, teleported: Vn.teleported, title: String, width: { type: [String, Number], default: 150 }, offset: { type: Number, default: void 0 }, showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 }, showArrow: { type: Boolean, default: !0 }, persistent: { type: Boolean, default: !0 }, "onUpdate:visible": { type: Function } }), MR = { "update:visible": (n) => Ba(n), "before-enter": () => !0, "before-leave": () => !0, "after-enter": () => !0, "after-leave": () => !0 }, wR = "onUpdate:visible", AR = Pe({ name: "ElPopover" }), SR = /* @__PURE__ */ Pe({ ...AR, props: xR, emits: MR, setup(n, { expose: e, emit: t }) { const i = n, r = ue(() => i[wR]), s = nt("popover"), o = Te(), a = ue(() => { var y; return (y = z(o)) == null ? void 0 : y.popperRef; }), c = ue(() => [ { width: Dc(i.width) }, i.popperStyle ]), l = ue(() => [s.b(), i.popperClass, { [s.m("plain")]: !!i.content }]), d = ue(() => i.transition === `${s.namespace.value}-fade-in-linear`), h = () => { var y; (y = o.value) == null || y.hide(); }, f = () => { t("before-enter"); }, g = () => { t("before-leave"); }, p = () => { t("after-enter"); }, u = () => { t("update:visible", !1), t("after-leave"); }; return e({ popperRef: a, hide: h }), (y, v) => (ve(), ke(z(pf), Ei({ ref_key: "tooltipRef", ref: o }, y.$attrs, { trigger: y.trigger, placement: y.placement, disabled: y.disabled, visible: y.visible, transition: y.transition, "popper-options": y.popperOptions, tabindex: y.tabindex, content: y.content, offset: y.offset, "show-after": y.showAfter, "hide-after": y.hideAfter, "auto-close": y.autoClose, "show-arrow": y.showArrow, "aria-label": y.title, effect: y.effect, enterable: y.enterable, "popper-class": z(l), "popper-style": z(c), teleported: y.teleported, persistent: y.persistent, "gpu-acceleration": z(d), "onUpdate:visible": z(r), onBeforeShow: f, onBeforeHide: g, onShow: p, onHide: u }), { content: de(() => [ y.title ? (ve(), Le("div", { key: 0, class: Ee(z(s).e("title")), role: "title" }, vt(y.title), 3)) : Ve("v-if", !0), je(y.$slots, "default", {}, () => [ rt(vt(y.content), 1) ]) ]), default: de(() => [ y.$slots.reference ? je(y.$slots, "reference", { key: 0 }) : Ve("v-if", !0) ]), _: 3 }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"])); } }); var _R = /* @__PURE__ */ st(SR, [["__file", "popover.vue"]]); const zm = (n, e) => { const t = e.arg || e.value, i = t == null ? void 0 : t.popperRef; i && (i.triggerRef = n); }; var TR = { mounted(n, e) { zm(n, e); }, updated(n, e) { zm(n, e); } }; const ER = "popover", CR = iT(TR, ER), cu = on(_R, { directive: CR }), my = Symbol("sliderContextKey"), LR = at({ modelValue: { type: Je([Number, Array]), default: 0 }, id: { type: String, default: void 0 }, min: { type: Number, default: 0 }, max: { type: Number, default: 100 }, step: { type: Number, default: 1 }, showInput: Boolean, showInputControls: { type: Boolean, default: !0 }, size: Gr, inputSize: Gr, showStops: Boolean, showTooltip: { type: Boolean, default: !0 }, formatTooltip: { type: Je(Function), default: void 0 }, disabled: Boolean, range: Boolean, vertical: Boolean, height: String, debounce: { type: Number, default: 300 }, rangeStartLabel: { type: String, default: void 0 }, rangeEndLabel: { type: String, default: void 0 }, formatValueText: { type: Je(Function), default: void 0 }, tooltipClass: { type: String, default: void 0 }, placement: { type: String, values: Yo, default: "top" }, marks: { type: Je(Object) }, validateEvent: { type: Boolean, default: !0 }, ...Yr(["ariaLabel"]) }), Wu = (n) => yt(n) || Pn(n) && n.every(yt), RR = { [At]: Wu, [bs]: Wu, [ur]: Wu }, FR = (n, e, t) => { const i = Te(); return Jt(async () => { n.range ? (Array.isArray(n.modelValue) ? (e.firstValue = Math.max(n.min, n.modelValue[0]), e.secondValue = Math.min(n.max, n.modelValue[1])) : (e.firstValue = n.min, e.secondValue = n.max), e.oldValue = [e.firstValue, e.secondValue]) : (typeof n.modelValue != "number" || Number.isNaN(n.modelValue) ? e.firstValue = n.min : e.firstValue = Math.min(n.max, Math.max(n.min, n.modelValue)), e.oldValue = e.firstValue), un(window, "resize", t), await bt(), t(); }), { sliderWrapper: i }; }, PR = (n) => ue(() => n.marks ? Object.keys(n.marks).map(Number.parseFloat).sort((t, i) => t - i).filter((t) => t <= n.max && t >= n.min).map((t) => ({ point: t, position: (t - n.min) * 100 / (n.max - n.min), mark: n.marks[t] })) : []), IR = (n, e, t) => { const { form: i, formItem: r } = Jo(), s = En(), o = Te(), a = Te(), c = { firstButton: o, secondButton: a }, l = ue(() => n.disabled || (i == null ? void 0 : i.disabled) || !1), d = ue(() => Math.min(e.firstValue, e.secondValue)), h = ue(() => Math.max(e.firstValue, e.secondValue)), f = ue(() => n.range ? `${100 * (h.value - d.value) / (n.max - n.min)}%` : `${100 * (e.firstValue - n.min) / (n.max - n.min)}%`), g = ue(() => n.range ? `${100 * (d.value - n.min) / (n.max - n.min)}%` : "0%"), p = ue(() => n.vertical ? { height: n.height } : {}), u = ue(() => n.vertical ? { height: f.value, bottom: g.value } : { width: f.value, left: g.value }), y = () => { s.value && (e.sliderSize = s.value[`client${n.vertical ? "Height" : "Width"}`]); }, v = (_) => { const E = n.min + _ * (n.max - n.min) / 100; if (!n.range) return o; let C; return Math.abs(d.value - E) < Math.abs(h.value - E) ? C = e.firstValue < e.secondValue ? "firstButton" : "secondButton" : C = e.firstValue > e.secondValue ? "firstButton" : "secondButton", c[C]; }, m = (_) => { const E = v(_); return E.value.setPosition(_), E; }, x = (_) => { e.firstValue = _ ?? n.min, A(n.range ? [d.value, h.value] : _ ?? n.min); }, w = (_) => { e.secondValue = _, n.range && A([d.value, h.value]); }, A = (_) => { t(At, _), t(bs, _); }, M = async () => { await bt(), t(ur, n.range ? [d.value, h.value] : n.modelValue); }, R = (_) => { var E, C, P, b, F, D; if (l.value || e.dragging) return; y(); let N = 0; if (n.vertical) { const B = (P = (C = (E = _.touches) == null ? void 0 : E.item(0)) == null ? void 0 : C.clientY) != null ? P : _.clientY; N = (s.value.getBoundingClientRect().bottom - B) / e.sliderSize * 100; } else { const B = (D = (F = (b = _.touches) == null ? void 0 : b.item(0)) == null ? void 0 : F.clientX) != null ? D : _.clientX, U = s.value.getBoundingClientRect().left; N = (B - U) / e.sliderSize * 100; } if (!(N < 0 || N > 100)) return m(N); }; return { elFormItem: r, slider: s, firstButton: o, secondButton: a, sliderDisabled: l, minValue: d, maxValue: h, runwayStyle: p, barStyle: u, resetSize: y, setPosition: m, emitChange: M, onSliderWrapperPrevent: (_) => { var E, C; ((E = c.firstButton.value) != null && E.dragging || (C = c.secondButton.value) != null && C.dragging) && _.preventDefault(); }, onSliderClick: (_) => { R(_) && M(); }, onSliderDown: async (_) => { const E = R(_); E && (await bt(), E.value.onButtonDown(_)); }, onSliderMarkerDown: (_) => { l.value || e.dragging || m(_); }, setFirstValue: x, setSecondValue: w }; }, { left: OR, down: DR, right: NR, up: BR, home: UR, end: zR, pageUp: VR, pageDown: kR } = Li, GR = (n, e, t) => { const i = Te(), r = Te(!1), s = ue(() => e.value instanceof Function), o = ue(() => s.value && e.value(n.modelValue) || n.modelValue), a = jh(() => { t.value && (r.value = !0); }, 50), c = jh(() => { t.value && (r.value = !1); }, 50); return { tooltip: i, tooltipVisible: r, formatValue: o, displayTooltip: a, hideTooltip: c }; }, HR = (n, e, t) => { const { disabled: i, min: r, max: s, step: o, showTooltip: a, precision: c, sliderSize: l, formatTooltip: d, emitChange: h, resetSize: f, updateDragging: g } = pt(my), { tooltip: p, tooltipVisible: u, formatValue: y, displayTooltip: v, hideTooltip: m } = GR(n, d, a), x = Te(), w = ue(() => `${(n.modelValue - r.value) / (s.value - r.value) * 100}%`), A = ue(() => n.vertical ? { bottom: w.value } : { left: w.value }), M = () => { e.hovering = !0, v(); }, R = () => { e.hovering = !1, e.dragging || m(); }, L = (G) => { i.value || (G.preventDefault(), D(G), window.addEventListener("mousemove", N), window.addEventListener("touchmove", N), window.addEventListener("mouseup", B), window.addEventListener("touchend", B), window.addEventListener("contextmenu", B), x.value.focus()); }, S = (G) => { i.value || (e.newPosition = Number.parseFloat(w.value) + G / (s.value - r.value) * 100, U(e.newPosition), h()); }, I = () => { S(-o.value); }, T = () => { S(o.value); }, _ = () => { S(-o.value * 4); }, E = () => { S(o.value * 4); }, C = () => { i.value || (U(0), h()); }, P = () => { i.value || (U(100), h()); }, b = (G) => { let Y = !0; [OR, DR].includes(G.key) ? I() : [NR, BR].includes(G.key) ? T() : G.key === UR ? C() : G.key === zR ? P() : G.key === kR ? _() : G.key === VR ? E() : Y = !1, Y && G.preventDefault(); }, F = (G) => { let Y, te; return G.type.startsWith("touch") ? (te = G.touches[0].clientY, Y = G.touches[0].clientX) : (te = G.clientY, Y = G.clientX), { clientX: Y, clientY: te }; }, D = (G) => { e.dragging = !0, e.isClick = !0; const { clientX: Y, clientY: te } = F(G); n.vertical ? e.startY = te : e.startX = Y, e.startPosition = Number.parseFloat(w.value), e.newPosition = e.startPosition; }, N = (G) => { if (e.dragging) { e.isClick = !1, v(), f(); let Y; const { clientX: te, clientY: ae } = F(G); n.vertical ? (e.currentY = ae, Y = (e.startY - e.currentY) / l.value * 100) : (e.currentX = te, Y = (e.currentX - e.startX) / l.value * 100), e.newPosition = e.startPosition + Y, U(e.newPosition); } }, B = () => { e.dragging && (setTimeout(() => { e.dragging = !1, e.hovering || m(), e.isClick || U(e.newPosition), h(); }, 0), window.removeEventListener("mousemove", N), window.removeEventListener("touchmove", N), window.removeEventListener("mouseup", B), window.removeEventListener("touchend", B), window.removeEventListener("contextmenu", B)); }, U = async (G) => { if (G === null || Number.isNaN(+G)) return; G < 0 ? G = 0 : G > 100 && (G = 100); const Y = 100 / ((s.value - r.value) / o.value); let ae = Math.round(G / Y) * Y * (s.value - r.value) * 0.01 + r.value; ae = Number.parseFloat(ae.toFixed(c.value)), ae !== n.modelValue && t(At, ae), !e.dragging && n.modelValue !== e.oldValue && (e.oldValue = n.modelValue), await bt(), e.dragging && v(), p.value.updatePopper(); }; return Qe(() => e.dragging, (G) => { g(G); }), un(x, "touchstart", L, { passive: !1 }), { disabled: i, button: x, tooltip: p, tooltipVisible: u, showTooltip: a, wrapperStyle: A, formatValue: y, handleMouseEnter: M, handleMouseLeave: R, onButtonDown: L, onKeyDown: b, setPosition: U }; }, WR = (n, e, t, i) => ({ stops: ue(() => { if (!n.showStops || n.min > n.max) return []; if (n.step === 0) return Vt("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}%` } }), jR = (n, e, t, i, r, s) => { const o = (l) => { r(At, l), r(bs, l); }, a = () => n.range ? ![t.value, i.value].every((l, d) => l === e.oldValue[d]) : n.modelValue !== e.oldValue, c = () => { var l, d; n.min > n.max && Xo("Slider", "min should not be greater than max."); const h = n.modelValue; n.range && Array.isArray(h) ? h[1] < n.min ? o([n.min, n.min]) : h[0] > n.max ? o([n.max, n.max]) : h[0] < n.min ? o([n.min, h[1]]) : h[1] > n.max ? o([h[0], n.max]) : (e.firstValue = h[0], e.secondValue = h[1], a() && (n.validateEvent && ((l = s == null ? void 0 : s.validate) == null || l.call(s, "change").catch((f) => Vt(f))), e.oldValue = h.slice())) : !n.range && typeof h == "number" && !Number.isNaN(h) && (h < n.min ? o(n.min) : h > n.max ? o(n.max) : (e.firstValue = h, a() && (n.validateEvent && ((d = s == null ? void 0 : s.validate) == null || d.call(s, "change").catch((f) => Vt(f))), e.oldValue = h))); }; c(), Qe(() => e.dragging, (l) => { l || c(); }), Qe(() => n.modelValue, (l, d) => { e.dragging || Array.isArray(l) && Array.isArray(d) && l.every((h, f) => h === d[f]) && e.firstValue === l[0] && e.secondValue === l[1] || c(); }, { deep: !0 }), Qe(() => [n.min, n.max], () => { c(); }); }, $R = at({ modelValue: { type: Number, default: 0 }, vertical: Boolean, tooltipClass: String, placement: { type: String, values: Yo, default: "top" } }), ZR = { [At]: (n) => yt(n) }, XR = Pe({ name: "ElSliderButton" }), YR = /* @__PURE__ */ Pe({ ...XR, props: $R, emits: ZR, setup(n, { expose: e, emit: t }) { const i = n, r = nt("slider"), s = Wn({ hovering: !1, dragging: !1, isClick: !1, startX: 0, currentX: 0, startY: 0, currentY: 0, startPosition: 0, newPosition: 0, oldValue: i.modelValue }), { disabled: o, button: a, tooltip: c, showTooltip: l, tooltipVisible: d, wrapperStyle: h, formatValue: f, handleMouseEnter: g, handleMouseLeave: p, onButtonDown: u, onKeyDown: y, setPosition: v } = HR(i, s, t), { hovering: m, dragging: x } = Br(s); return e({ onButtonDown: u, onKeyDown: y, setPosition: v, hovering: m, dragging: x }), (w, A) => (ve(), Le("div", { ref_key: "button", ref: a, class: Ee([z(r).e("button-wrapper"), { hover: z(m), dragging: z(x) }]), style: Rt(z(h)), tabindex: z(o) ? -1 : 0, onMouseenter: z(g), onMouseleave: z(p), onMousedown: z(u), onFocus: z(g), onBlur: z(p), onKeydown: z(y) }, [ oe(z(pf), { ref_key: "tooltip", ref: c, visible: z(d), placement: w.placement, "fallback-placements": ["top", "bottom", "right", "left"], "stop-popper-mouse-event": !1, "popper-class": w.tooltipClass, disabled: !z(l), persistent: "" }, { content: de(() => [ Ne("span", null, vt(z(f)), 1) ]), default: de(() => [ Ne("div", { class: Ee([z(r).e("button"), { hover: z(m), dragging: z(x) }]) }, null, 2) ]), _: 1 }, 8, ["visible", "placement", "popper-class", "disabled"]) ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"])); } }); var Vm = /* @__PURE__ */ st(YR, [["__file", "button.vue"]]); const JR = at({ mark: { type: Je([String, Object]), default: void 0 } }); var KR = Pe({ name: "ElSliderMarker", props: JR, setup(n) { const e = nt("slider"), t = ue(() => vn(n.mark) ? n.mark : n.mark.label), i = ue(() => vn(n.mark) ? void 0 : n.mark.style); return () => ho("div", { class: e.e("marks-text"), style: i.value }, t.value); } }); const qR = Pe({ name: "ElSlider" }), QR = /* @__PURE__ */ Pe({ ...qR, props: LR, emits: RR, setup(n, { expose: e, emit: t }) { const i = n, r = nt("slider"), { t: s } = iu(), o = Wn({ firstValue: 0, secondValue: 0, oldValue: 0, dragging: !1, sliderSize: 1 }), { elFormItem: a, slider: c, firstButton: l, secondButton: d, sliderDisabled: h, minValue: f, maxValue: g, runwayStyle: p, barStyle: u, resetSize: y, emitChange: v, onSliderWrapperPrevent: m, onSliderClick: x, onSliderDown: w, onSliderMarkerDown: A, setFirstValue: M, setSecondValue: R } = IR(i, o, t), { stops: L, getStopStyle: S } = WR(i, o, f, g), { inputId: I, isLabeledByFormItem: T } = su(i, { formItemContext: a }), _ = Ns(), E = ue(() => i.inputSize || _.value), C = ue(() => i.ariaLabel || s("el.slider.defaultLabel", { min: i.min, max: i.max })), P = ue(() => i.range ? i.rangeStartLabel || s("el.slider.defaultRangeStartLabel") : C.value), b = ue(() => i.formatValueText ? i.formatValueText(Y.value) : `${Y.value}`), F = ue(() => i.rangeEndLabel || s("el.slider.defaultRangeEndLabel")), D = ue(() => i.formatValueText ? i.formatValueText(te.value) : `${te.value}`), N = ue(() => [ r.b(), r.m(_.value), r.is("vertical", i.vertical), { [r.m("with-input")]: i.showInput } ]), B = PR(i); jR(i, o, f, g, t, a); const U = ue(() => { const le = [i.min, i.max, i.step].map((W) => { const $ = `${W}`.split(".")[1]; return $ ? $.length : 0; }); return Math.max.apply(null, le); }), { sliderWrapper: G } = FR(i, o, y), { firstValue: Y, secondValue: te, sliderSize: ae } = Br(o), ie = (le) => { o.dragging = le; }; return un(G, "touchstart", m, { passive: !1 }), un(G, "touchmove", m, { passive: !1 }), sn(my, { ...Br(i), sliderSize: ae, disabled: h, precision: U, emitChange: v, resetSize: y, updateDragging: ie }), e({ onSliderClick: x }), (le, W) => { var $, j; return ve(), Le("div", { id: le.range ? z(I) : void 0, ref_key: "sliderWrapper", ref: G, class: Ee(z(N)), role: le.range ? "group" : void 0, "aria-label": le.range && !z(T) ? z(C) : void 0, "aria-labelledby": le.range && z(T) ? ($ = z(a)) == null ? void 0 : $.labelId : void 0 }, [ Ne("div", { ref_key: "slider", ref: c, class: Ee([ z(r).e("runway"), { "show-input": le.showInput && !le.range }, z(r).is("disabled", z(h)) ]), style: Rt(z(p)), onMousedown: z(w), onTouchstartPassive: z(w) }, [ Ne("div", { class: Ee(z(r).e("bar")), style: Rt(z(u)) }, null, 6), oe(Vm, { id: le.range ? void 0 : z(I), ref_key: "firstButton", ref: l, "model-value": z(Y), vertical: le.vertical, "tooltip-class": le.tooltipClass, placement: le.placement, role: "slider", "aria-label": le.range || !z(T) ? z(P) : void 0, "aria-labelledby": !le.range && z(T) ? (j = z(a)) == null ? void 0 : j.labelId : void 0, "aria-valuemin": le.min, "aria-valuemax": le.range ? z(te) : le.max, "aria-valuenow": z(Y), "aria-valuetext": z(b), "aria-orientation": le.vertical ? "vertical" : "horizontal", "aria-disabled": z(h), "onUpdate:modelValue": z(M) }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]), le.range ? (ve(), ke(Vm, { key: 0, ref_key: "secondButton", ref: d, "model-value": z(te), vertical: le.vertical, "tooltip-class": le.tooltipClass, placement: le.placement, role: "slider", "aria-label": z(F), "aria-valuemin": z(Y), "aria-valuemax": le.max, "aria-valuenow": z(te), "aria-valuetext": z(D), "aria-orientation": le.vertical ? "vertical" : "horizontal", "aria-disabled": z(h), "onUpdate:modelValue": z(R) }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : Ve("v-if", !0), le.showStops ? (ve(), Le("div", { key: 1 }, [ (ve(!0), Le(Pt, null, Jn(z(L), (re, V) => (ve(), Le("div", { key: V, class: Ee(z(r).e("stop")), style: Rt(z(S)(re)) }, null, 6))), 128)) ])) : Ve("v-if", !0), z(B).length > 0 ? (ve(), Le(Pt, { key: 2 }, [ Ne("div", null, [ (ve(!0), Le(Pt, null, Jn(z(B), (re, V) => (ve(), Le("div", { key: V, style: Rt(z(S)(re.position)), class: Ee([z(r).e("stop"), z(r).e("marks-stop")]) }, null, 6))), 128)) ]), Ne("div", { class: Ee(z(r).e("marks")) }, [ (ve(!0), Le(Pt, null, Jn(z(B), (re, V) => (ve(), ke(z(KR), { key: V, mark: re.mark, style: Rt(z(S)(re.position)), onMousedown: Ut((H) => z(A)(re.position), ["stop"]) }, null, 8, ["mark", "style", "onMousedown"]))), 128)) ], 2) ], 64)) : Ve("v-if", !0) ], 46, ["onMousedown", "onTouchstartPassive"]), le.showInput && !le.range ? (ve(), ke(z(dr), { key: 0, ref: "input", "model-value": z(Y), class: Ee(z(r).e("input")), step: le.step, disabled: z(h), controls: le.showInputControls, min: le.min, max: le.max, precision: z(U), debounce: le.debounce, size: z(E), "onUpdate:modelValue": z(M), onChange: z(v) }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : Ve("v-if", !0) ], 10, ["id", "role", "aria-label", "aria-labelledby"]); }; } }); var e3 = /* @__PURE__ */ st(QR, [["__file", "slider.vue"]]); const ti = on(e3), uu = Symbol("tabsRootContextKey"), t3 = at({ tabs: { type: Je(Array), default: () => Ki([]) } }), gy = "ElTabBar", n3 = Pe({ name: gy }), i3 = /* @__PURE__ */ Pe({ ...n3, props: t3, setup(n, { expose: e }) { const t = n, i = dn(), r = pt(uu); r || Xo(gy, ""); const s = nt("tabs"), o = Te(), a = Te(), c = () => { let g = 0, p = 0; const u = ["top", "bottom"].includes(r.props.tabPosition) ? "width" : "height", y = u === "width" ? "x" : "y", v = y === "x" ? "left" : "top"; return t.tabs.every((m) => { var x, w; const A = (w = (x = i.parent) == null ? void 0 : x.refs) == null ? void 0 : w[`tab-${m.uid}`]; if (!A) return !1; if (!m.active) return !0; g = A[`offset${Rr(v)}`], p = A[`client${Rr(u)}`]; const M = window.getComputedStyle(A); return u === "width" && (p -= Number.parseFloat(M.paddingLeft) + Number.parseFloat(M.paddingRight), g += Number.parseFloat(M.paddingLeft)), !1; }), { [u]: `${p}px`, transform: `translate${Rr(y)}(${g}px)` }; }, l = () => a.value = c(), d = [], h = () => { var g; d.forEach((u) => u.stop()), d.length = 0; const p = (g = i.parent) == null ? void 0 : g.refs; if (p) { for (const u in p) if (u.startsWith("tab-")) { const y = p[u]; y && d.push(Yn(y, l)); } } }; Qe(() => t.tabs, async () => { await bt(), l(), h(); }, { immediate: !0 }); const f = Yn(o, () => l()); return ei(() => { d.forEach((g) => g.stop()), d.length = 0, f.stop(); }), e({ ref: o, update: l }), (g, p) => (ve(), Le("div", { ref_key: "barRef", ref: o, class: Ee([z(s).e("active-bar"), z(s).is(z(r).props.tabPosition)]), style: Rt(a.value) }, null, 6)); } }); var r3 = /* @__PURE__ */ st(i3, [["__file", "tab-bar.vue"]]); const s3 = at({ panes: { type: Je(Array), default: () => Ki([]) }, currentName: { type: [String, Number], default: "" }, editable: Boolean, type: { type: String, values: ["card", "border-card", ""], default: "" }, stretch: Boolean }), o3 = { tabClick: (n, e, t) => t instanceof Event, tabRemove: (n, e) => e instanceof Event }, km = "ElTabNav", a3 = Pe({ name: km, props: s3, emits: o3, setup(n, { expose: e, emit: t }) { const i = pt(uu); i || Xo(km, ""); const r = nt("tabs"), s = bw(), o = Pw(), a = Te(), c = Te(), l = Te(), d = Te(), h = Te(!1), f = Te(0), g = Te(!1), p = Te(!0), u = ue(() => ["top", "bottom"].includes(i.props.tabPosition) ? "width" : "height"), y = ue(() => ({ transform: `translate${u.value === "width" ? "X" : "Y"}(-${f.value}px)` })), v = () => { if (!a.value) return; const L = a.value[`offset${Rr(u.value)}`], S = f.value; if (!S) return; const I = S > L ? S - L : 0; f.value = I; }, m = () => { if (!a.value || !c.value) return; const L = c.value[`offset${Rr(u.value)}`], S = a.value[`offset${Rr(u.value)}`], I = f.value; if (L - I <= S) return; const T = L - I > S * 2 ? I + S : L - S; f.value = T; }, x = async () => { const L = c.value; if (!h.value || !l.value || !a.value || !L) return; await bt(); const S = l.value.querySelector(".is-active"); if (!S) return; const I = a.value, T = ["top", "bottom"].includes(i.props.tabPosition), _ = S.getBoundingClientRect(), E = I.getBoundingClientRect(), C = T ? L.offsetWidth - E.width : L.offsetHeight - E.height, P = f.value; let b = P; T ? (_.left < E.left && (b = P - (E.left - _.left)), _.right > E.right && (b = P + _.right - E.right)) : (_.top < E.top && (b = P - (E.top - _.top)), _.bottom > E.bottom && (b = P + (_.bottom - E.bottom))), b = Math.max(b, 0), f.value = Math.min(b, C); }, w = () => { var L; if (!c.value || !a.value) return; n.stretch && ((L = d.value) == null || L.update()); const S = c.value[`offset${Rr(u.value)}`], I = a.value[`offset${Rr(u.value)}`], T = f.value; I < S ? (h.value = h.value || {}, h.value.prev = T, h.value.next = T + I < S, S - T < I && (f.value = S - I)) : (h.value = !1, T > 0 && (f.value = 0)); }, A = (L) => { const S = L.code, { up: I, down: T, left: _, right: E } = Li; if (![I, T, _, E].includes(S)) return; const C = Array.from(L.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")), P = C.indexOf(L.target); let b; S === _ || S === I ? P === 0 ? b = C.length - 1 : b = P - 1 : P < C.length - 1 ? b = P + 1 : b = 0, C[b].focus({ preventScroll: !0 }), C[b].click(), M(); }, M = () => { p.value && (g.value = !0); }, R = () => g.value = !1; return Qe(s, (L) => { L === "hidden" ? p.value = !1 : L === "visible" && setTimeout(() => p.value = !0, 50); }), Qe(o, (L) => { L ? setTimeout(() => p.value = !0, 50) : p.value = !1; }), Yn(l, w), Jt(() => setTimeout(() => x(), 0)), zd(() => w()), e({ scrollToActiveTab: x, removeFocus: R }), () => { const L = h.value ? [oe("span", { class: [r.e("nav-prev"), r.is("disabled", !h.value.prev)], onClick: v }, [oe(It, null, { default: () => [oe(zr, null, null)] })]), oe("span", { class: [r.e("nav-next"), r.is("disabled", !h.value.next)], onClick: m }, [oe(It, null, { default: () => [oe(Vr, null, null)] })])] : null, S = n.panes.map((I, T) => { var _, E, C, P; const b = I.uid, F = I.props.disabled, D = (E = (_ = I.props.name) != null ? _ : I.index) != null ? E : `${T}`, N = !F && (I.isClosable || n.editable); I.index = `${T}`; const B = N ? oe(It, { class: "is-icon-close", onClick: (Y) => t("tabRemove", I, Y) }, { default: () => [oe(Zh, null, null)] }) : null, U = ((P = (C = I.slots).label) == null ? void 0 : P.call(C)) || I.props.label, G = !F && I.active ? 0 : -1; return oe("div", { ref: `tab-${b}`, class: [r.e("item"), r.is(i.props.tabPosition), r.is("active", I.active), r.is("disabled", F), r.is("closable", N), r.is("focus", g.value)], id: `tab-${D}`, key: `tab-${b}`, "aria-controls": `pane-${D}`, role: "tab", "aria-selected": I.active, tabindex: G, onFocus: () => M(), onBlur: () => R(), onClick: (Y) => { R(), t("tabClick", I, D, Y); }, onKeydown: (Y) => { N && (Y.code === Li.delete || Y.code === Li.backspace) && t("tabRemove", I, Y); } }, [U, B]); }); return oe("div", { ref: l, class: [r.e("nav-wrap"), r.is("scrollable", !!h.value), r.is(i.props.tabPosition)] }, [L, oe("div", { class: r.e("nav-scroll"), ref: a }, [oe("div", { class: [r.e("nav"), r.is(i.props.tabPosition), r.is("stretch", n.stretch && ["top", "bottom"].includes(i.props.tabPosition))], ref: c, style: y.value, role: "tablist", onKeydown: A }, [n.type ? null : oe(r3, { ref: d, tabs: [...n.panes] }, null), S])])]); }; } }), l3 = at({ type: { type: String, values: ["card", "border-card", ""], default: "" }, closable: Boolean, addable: Boolean, modelValue: { type: [String, Number] }, editable: Boolean, tabPosition: { type: String, values: ["top", "right", "bottom", "left"], default: "top" }, beforeLeave: { type: Je(Function), default: () => !0 }, stretch: Boolean }), ju = (n) => vn(n) || yt(n), c3 = { [At]: (n) => ju(n), tabClick: (n, e) => e instanceof Event, tabChange: (n) => ju(n), edit: (n, e) => ["remove", "add"].includes(e), tabRemove: (n) => ju(n), tabAdd: () => !0 }, u3 = Pe({ name: "ElTabs", props: l3, emits: c3, setup(n, { emit: e, slots: t, expose: i }) { var r; const s = nt("tabs"), o = ue(() => ["left", "right"].includes(n.tabPosition)), { children: a, addChild: c, removeChild: l } = RE(dn(), "ElTabPane"), d = Te(), h = Te((r = n.modelValue) != null ? r : "0"), f = async (v, m = !1) => { var x, w, A; if (!(h.value === v || di(v))) try { await ((x = n.beforeLeave) == null ? void 0 : x.call(n, v, h.value)) !== !1 && (h.value = v, m && (e(At, v), e("tabChange", v)), (A = (w = d.value) == null ? void 0 : w.removeFocus) == null || A.call(w)); } catch { } }, g = (v, m, x) => { v.props.disabled || (f(m, !0), e("tabClick", v, x)); }, p = (v, m) => { v.props.disabled || di(v.props.name) || (m.stopPropagation(), e("edit", v.props.name, "remove"), e("tabRemove", v.props.name)); }, u = () => { e("edit", void 0, "add"), e("tabAdd"); }; Qe(() => n.modelValue, (v) => f(v)), Qe(h, async () => { var v; await bt(), (v = d.value) == null || v.scrollToActiveTab(); }), sn(uu, { props: n, currentName: h, registerPane: (v) => { a.value.push(v); }, sortPane: c, unregisterPane: l }), i({ currentName: h }); const y = ({ render: v }) => v(); return () => { const v = t["add-icon"], m = n.editable || n.addable ? oe("div", { class: [s.e("new-tab"), o.value && s.e("new-tab-vertical")], tabindex: "0", onClick: u, onKeydown: (A) => { A.code === Li.enter && u(); } }, [v ? je(t, "add-icon") : oe(It, { class: s.is("icon-plus") }, { default: () => [oe(tu, null, null)] })]) : null, x = oe("div", { class: [s.e("header"), o.value && s.e("header-vertical"), s.is(n.tabPosition)] }, [oe(y, { render: () => { const A = a.value.some((M) => M.slots.label); return oe(a3, { ref: d, currentName: h.value, editable: n.editable, type: n.type, panes: a.value, stretch: n.stretch, onTabClick: g, onTabRemove: p }, { $stable: !A }); } }, null), m]), w = oe("div", { class: s.e("content") }, [je(t, "default")]); return oe("div", { class: [s.b(), s.m(n.tabPosition), { [s.m("card")]: n.type === "card", [s.m("border-card")]: n.type === "border-card" }] }, [w, x]); }; } }), h3 = at({ label: { type: String, default: "" }, name: { type: [String, Number] }, closable: Boolean, disabled: Boolean, lazy: Boolean }), vy = "ElTabPane", d3 = Pe({ name: vy }), f3 = /* @__PURE__ */ Pe({ ...d3, props: h3, setup(n) { const e = n, t = dn(), i = Xc(), r = pt(uu); r || Xo(vy, "usage: "); const s = nt("tab-pane"), o = Te(), a = ue(() => e.closable || r.props.closable), c = Mp(() => { var g; return r.currentName.value === ((g = e.name) != null ? g : o.value); }), l = Te(c.value), d = ue(() => { var g; return (g = e.name) != null ? g : o.value; }), h = Mp(() => !e.lazy || l.value || c.value); Qe(c, (g) => { g && (l.value = !0); }); const f = Wn({ uid: t.uid, slots: i, props: e, paneName: d, active: c, index: o, isClosable: a }); return r.registerPane(f), Jt(() => { r.sortPane(f); }), Uv(() => { r.unregisterPane(f.uid); }), (g, p) => z(h) ? Lt((ve(), Le("div", { key: 0, id: `pane-${z(d)}`, class: Ee(z(s).b()), role: "tabpanel", "aria-hidden": !z(c), "aria-labelledby": `tab-${z(d)}` }, [ je(g.$slots, "default") ], 10, ["id", "aria-hidden", "aria-labelledby"])), [ [mn, z(c)] ]) : Ve("v-if", !0); } }); var yy = /* @__PURE__ */ st(f3, [["__file", "tab-pane.vue"]]); const by = on(u3, { TabPane: yy }), xy = vi(yy); function p3(n) { let e; const t = Te(!1), i = Wn({ ...n, originalPosition: "", originalOverflow: "", visible: !1 }); function r(f) { i.text = f; } function s() { const f = i.parent, g = h.ns; if (!f.vLoadingAddClassList) { let p = f.getAttribute("loading-number"); p = Number.parseInt(p) - 1, p ? f.setAttribute("loading-number", p.toString()) : (Oc(f, g.bm("parent", "relative")), f.removeAttribute("loading-number")), Oc(f, g.bm("parent", "hidden")); } o(), d.unmount(); } function o() { var f, g; (g = (f = h.$el) == null ? void 0 : f.parentNode) == null || g.removeChild(h.$el); } function a() { var f; n.beforeClose && !n.beforeClose() || (t.value = !0, clearTimeout(e), e = setTimeout(c, 400), i.visible = !1, (f = n.closed) == null || f.call(n)); } function c() { if (!t.value) return; const f = i.parent; t.value = !1, f.vLoadingAddClassList = void 0, s(); } const l = Pe({ name: "ElLoading", setup(f, { expose: g }) { const { ns: p, zIndex: u } = UE("loading"); return g({ ns: p, zIndex: u }), () => { const y = i.spinner || i.svg, v = ho("svg", { class: "circular", viewBox: i.svgViewBox ? i.svgViewBox : "0 0 50 50", ...y ? { innerHTML: y } : {} }, [ ho("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]), m = i.text ? ho("p", { class: p.b("text") }, [i.text]) : void 0; return ho(el, { name: p.b("fade"), onAfterLeave: c }, { default: de(() => [ Lt(oe("div", { style: { backgroundColor: i.background || "" }, class: [ p.b("mask"), i.customClass, i.fullscreen ? "is-fullscreen" : "" ] }, [ ho("div", { class: p.b("spinner") }, [v, m]) ]), [[mn, i.visible]]) ]) }); }; } }), d = KM(l), h = d.mount(document.createElement("div")); return { ...Br(i), setText: r, removeElLoadingChild: o, close: a, handleAfterLeave: c, vm: h, get $el() { return h.$el; } }; } let Pl; const ed = function(n = {}) { if (!en) return; const e = m3(n); if (e.fullscreen && Pl) return Pl; const t = p3({ ...e, closed: () => { var r; (r = e.closed) == null || r.call(e), e.fullscreen && (Pl = void 0); } }); g3(e, e.parent, t), Gm(e, e.parent, t), e.parent.vLoadingAddClassList = () => Gm(e, e.parent, t); let i = e.parent.getAttribute("loading-number"); return i ? i = `${Number.parseInt(i) + 1}` : i = "1", e.parent.setAttribute("loading-number", i), e.parent.appendChild(t.$el), bt(() => t.visible.value = e.visible), e.fullscreen && (Pl = t), t; }, m3 = (n) => { var e, t, i, r; let s; return vn(n.target) ? s = (e = document.querySelector(n.target)) != null ? e : document.body : s = n.target || document.body, { parent: s === document.body || n.body ? document.body : s, background: n.background || "", svg: n.svg || "", svgViewBox: n.svgViewBox || "", spinner: n.spinner || !1, text: n.text || "", fullscreen: s === document.body && ((t = n.fullscreen) != null ? t : !0), lock: (i = n.lock) != null ? i : !1, customClass: n.customClass || "", visible: (r = n.visible) != null ? r : !0, beforeClose: n.beforeClose, closed: n.closed, target: s }; }, g3 = async (n, e, t) => { const { nextZIndex: i } = t.vm.zIndex || t.vm._.exposed.zIndex, r = {}; if (n.fullscreen) t.originalPosition.value = ca(document.body, "position"), t.originalOverflow.value = ca(document.body, "overflow"), r.zIndex = i(); else if (n.parent === document.body) { t.originalPosition.value = ca(document.body, "position"), await bt(); for (const s of ["top", "left"]) { const o = s === "top" ? "scrollTop" : "scrollLeft"; r[s] = `${n.target.getBoundingClientRect()[s] + document.body[o] + document.documentElement[o] - Number.parseInt(ca(document.body, `margin-${s}`), 10)}px`; } for (const s of ["height", "width"]) r[s] = `${n.target.getBoundingClientRect()[s]}px`; } else t.originalPosition.value = ca(e, "position"); for (const [s, o] of Object.entries(r)) t.$el.style[s] = o; }, Gm = (n, e, t) => { const i = t.vm.ns || t.vm._.exposed.ns; ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? Oc(e, i.bm("parent", "relative")) : sm(e, i.bm("parent", "relative")), n.fullscreen && n.lock ? sm(e, i.bm("parent", "hidden")) : Oc(e, i.bm("parent", "hidden")); }, Ec = Symbol("ElLoading"), Hm = (n, e) => { var t, i, r, s; const o = e.instance, a = (f) => Tn(e.value) ? e.value[f] : void 0, c = (f) => { const g = vn(f) && (o == null ? void 0 : o[f]) || f; return g && Te(g); }, l = (f) => c(a(f) || n.getAttribute(`element-loading-${Vw(f)}`)), d = (t = a("fullscreen")) != null ? t : e.modifiers.fullscreen, h = { text: l("text"), svg: l("svg"), svgViewBox: l("svgViewBox"), spinner: l("spinner"), background: l("background"), customClass: l("customClass"), fullscreen: d, target: (i = a("target")) != null ? i : d ? void 0 : n, body: (r = a("body")) != null ? r : e.modifiers.body, lock: (s = a("lock")) != null ? s : e.modifiers.lock }; n[Ec] = { options: h, instance: ed(h) }; }, v3 = (n, e) => { for (const t of Object.keys(e)) Zc(e[t]) && (e[t].value = n[t]); }, td = { mounted(n, e) { e.value && Hm(n, e); }, updated(n, e) { const t = n[Ec]; e.oldValue !== e.value && (e.value && !e.oldValue ? Hm(n, e) : e.value && e.oldValue ? Tn(e.value) && v3(e.value, t.options) : t == null || t.instance.close()); }, unmounted(n) { var e; (e = n[Ec]) == null || e.instance.close(), n[Ec] = null; } }, y3 = { install(n) { n.directive("loading", td), n.config.globalProperties.$loading = ed; }, directive: td, service: ed }; var My = { exports: {} }, Wm = {}, jm; function b3() { return jm || (jm = 1, function(n) { var e = function() { try { return !!Symbol.iterator; } catch { return !1; } }, t = e(), i = function(l) { var d = { next: function() { var h = l.shift(); return { done: h === void 0, value: h }; } }; return t && (d[Symbol.iterator] = function() { return d; }), d; }, r = function(l) { return encodeURIComponent(l).replace(/%20/g, "+"); }, s = function(l) { return decodeURIComponent(String(l).replace(/\+/g, " ")); }, o = function() { var l = function(h) { Object.defineProperty(this, "_entries", { writable: !0, value: {} }); var f = typeof h; if (f !== "undefined") if (f === "string") h !== "" && this._fromString(h); else if (h instanceof l) { var g = this; h.forEach(function(v, m) { g.append(m, v); }); } else if (h !== null && f === "object") if (Object.prototype.toString.call(h) === "[object Array]") for (var p = 0; p < h.length; p++) { var u = h[p]; if (Object.prototype.toString.call(u) === "[object Array]" || u.length !== 2) this.append(u[0], u[1]); else throw new TypeError("Expected [string, any] as entry at index " + p + " of URLSearchParams's input"); } else for (var y in h) h.hasOwnProperty(y) && this.append(y, h[y]); else throw new TypeError("Unsupported input's type for URLSearchParams"); }, d = l.prototype; d.append = function(h, f) { h in this._entries ? this._entries[h].push(String(f)) : this._entries[h] = [String(f)]; }, d.delete = function(h) { delete this._entries[h]; }, d.get = function(h) { return h in this._entries ? this._entries[h][0] : null; }, d.getAll = function(h) { return h in this._entries ? this._entries[h].slice(0) : []; }, d.has = function(h) { return h in this._entries; }, d.set = function(h, f) { this._entries[h] = [String(f)]; }, d.forEach = function(h, f) { var g; for (var p in this._entries) if (this._entries.hasOwnProperty(p)) { g = this._entries[p]; for (var u = 0; u < g.length; u++) h.call(f, g[u], p, this); } }, d.keys = function() { var h = []; return this.forEach(function(f, g) { h.push(g); }), i(h); }, d.values = function() { var h = []; return this.forEach(function(f) { h.push(f); }), i(h); }, d.entries = function() { var h = []; return this.forEach(function(f, g) { h.push([g, f]); }), i(h); }, t && (d[Symbol.iterator] = d.entries), d.toString = function() { var h = []; return this.forEach(function(f, g) { h.push(r(g) + "=" + r(f)); }), h.join("&"); }, n.URLSearchParams = l; }, a = function() { try { var l = n.URLSearchParams; return new l("?a=1").toString() === "a=1" && typeof l.prototype.set == "function" && typeof l.prototype.entries == "function"; } catch { return !1; } }; a() || o(); var c = n.URLSearchParams.prototype; typeof c.sort != "function" && (c.sort = function() { var l = this, d = []; this.forEach(function(f, g) { d.push([g, f]), l._entries || l.delete(g); }), d.sort(function(f, g) { return f[0] < g[0] ? -1 : f[0] > g[0] ? 1 : 0; }), l._entries && (l._entries = {}); for (var h = 0; h < d.length; h++) this.append(d[h][0], d[h][1]); }), typeof c._fromString != "function" && Object.defineProperty(c, "_fromString", { enumerable: !1, configurable: !1, writable: !1, value: function(l) { if (this._entries) this._entries = {}; else { var d = []; this.forEach(function(p, u) { d.push(u); }); for (var h = 0; h < d.length; h++) this.delete(d[h]); } l = l.replace(/^\?/, ""); for (var f = l.split("&"), g, h = 0; h < f.length; h++) g = f[h].split("="), this.append( s(g[0]), g.length > 1 ? s(g[1]) : "" ); } }); }( typeof Lr < "u" ? Lr : typeof window < "u" ? window : typeof self < "u" ? self : Lr ), function(n) { var e = function() { try { var r = new n.URL("b", "http://a"); return r.pathname = "c d", r.href === "http://a/c%20d" && r.searchParams; } catch { return !1; } }, t = function() { var r = n.URL, s = function(c, l) { typeof c != "string" && (c = String(c)), l && typeof l != "string" && (l = String(l)); var d = document, h; if (l && (n.location === void 0 || l !== n.location.href)) { l = l.toLowerCase(), d = document.implementation.createHTMLDocument(""), h = d.createElement("base"), h.href = l, d.head.appendChild(h); try { if (h.href.indexOf(l) !== 0) throw new Error(h.href); } catch (x) { throw new Error("URL unable to set base " + l + " due to " + x); } } var f = d.createElement("a"); f.href = c, h && (d.body.appendChild(f), f.href = f.href); var g = d.createElement("input"); if (g.type = "url", g.value = c, f.protocol === ":" || !/:/.test(f.href) || !g.checkValidity() && !l) throw new TypeError("Invalid URL"); Object.defineProperty(this, "_anchorElement", { value: f }); var p = new n.URLSearchParams(this.search), u = !0, y = !0, v = this; ["append", "delete", "set"].forEach(function(x) { var w = p[x]; p[x] = function() { w.apply(p, arguments), u && (y = !1, v.search = p.toString(), y = !0); }; }), Object.defineProperty(this, "searchParams", { value: p, enumerable: !0 }); var m = void 0; Object.defineProperty(this, "_updateSearchParams", { enumerable: !1, configurable: !1, writable: !1, value: function() { this.search !== m && (m = this.search, y && (u = !1, this.searchParams._fromString(this.search), u = !0)); } }); }, o = s.prototype, a = function(c) { Object.defineProperty(o, c, { get: function() { return this._anchorElement[c]; }, set: function(l) { this._anchorElement[c] = l; }, enumerable: !0 }); }; ["hash", "host", "hostname", "port", "protocol"].forEach(function(c) { a(c); }), Object.defineProperty(o, "search", { get: function() { return this._anchorElement.search; }, set: function(c) { this._anchorElement.search = c, this._updateSearchParams(); }, enumerable: !0 }), Object.defineProperties(o, { toString: { get: function() { var c = this; return function() { return c.href; }; } }, href: { get: function() { return this._anchorElement.href.replace(/\?$/, ""); }, set: function(c) { this._anchorElement.href = c, this._updateSearchParams(); }, enumerable: !0 }, pathname: { get: function() { return this._anchorElement.pathname.replace(/(^\/?)/, "/"); }, set: function(c) { this._anchorElement.pathname = c; }, enumerable: !0 }, origin: { get: function() { var c = { "http:": 80, "https:": 443, "ftp:": 21 }[this._anchorElement.protocol], l = this._anchorElement.port != c && this._anchorElement.port !== ""; return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (l ? ":" + this._anchorElement.port : ""); }, enumerable: !0 }, password: { // TODO get: function() { return ""; }, set: function(c) { }, enumerable: !0 }, username: { // TODO get: function() { return ""; }, set: function(c) { }, enumerable: !0 } }), s.createObjectURL = function(c) { return r.createObjectURL.apply(r, arguments); }, s.revokeObjectURL = function(c) { return r.revokeObjectURL.apply(r, arguments); }, n.URL = s; }; if (e() || t(), n.location !== void 0 && !("origin" in n.location)) { var i = function() { return n.location.protocol + "//" + n.location.hostname + (n.location.port ? ":" + n.location.port : ""); }; try { Object.defineProperty(n.location, "origin", { get: i, enumerable: !0 }); } catch { setInterval(function() { n.location.origin = i(); }, 100); } } }( typeof Lr < "u" ? Lr : typeof window < "u" ? window : typeof self < "u" ? self : Lr )), Wm; } /** * @license * Copyright 2010-2021 Three.js Authors * SPDX-License-Identifier: MIT */ const gf = "130", x3 = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, M3 = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, wy = 0, nd = 1, Ay = 2, w3 = 3, A3 = 0, vf = 1, Sy = 2, po = 3, Hr = 0, jt = 1, Wr = 2, yf = 1, S3 = 2, tr = 0, vo = 1, id = 2, rd = 3, sd = 4, _y = 5, ps = 100, Ty = 101, Ey = 102, od = 103, ad = 104, Cy = 200, Ly = 201, Ry = 202, Fy = 203, bf = 204, xf = 205, Py = 206, Iy = 207, Oy = 208, Dy = 209, Ny = 210, By = 0, Uy = 1, zy = 2, Vc = 3, Vy = 4, ky = 5, Gy = 6, Hy = 7, al = 0, Wy = 1, jy = 2, Ir = 0, $y = 1, Zy = 2, Xy = 3, Yy = 4, Jy = 5, hu = 300, ll = 301, cl = 302, kc = 303, Gc = 304, ea = 306, ul = 307, jr = 1e3, hn = 1001, Eo = 1002, $t = 1003, ka = 1004, _3 = 1004, Ga = 1005, T3 = 1005, zt = 1006, du = 1007, E3 = 1007, fr = 1008, C3 = 1008, Ts = 1009, Ky = 1010, qy = 1011, Ha = 1012, Qy = 1013, Ra = 1014, qi = 1015, Ms = 1016, eb = 1017, tb = 1018, nb = 1019, yo = 1020, ib = 1021, nr = 1022, Gn = 1023, rb = 1024, sb = 1025, ob = Gn, ws = 1026, Co = 1027, ab = 1028, lb = 1029, cb = 1030, ub = 1031, hb = 1032, db = 1033, ld = 33776, cd = 33777, ud = 33778, hd = 33779, dd = 35840, fd = 35841, pd = 35842, md = 35843, fb = 36196, gd = 37492, vd = 37496, pb = 37808, mb = 37809, gb = 37810, vb = 37811, yb = 37812, bb = 37813, xb = 37814, Mb = 37815, wb = 37816, Ab = 37817, Sb = 37818, _b = 37819, Tb = 37820, Eb = 37821, Cb = 36492, Lb = 37840, Rb = 37841, Fb = 37842, Pb = 37843, Ib = 37844, Ob = 37845, Db = 37846, Nb = 37847, Bb = 37848, Ub = 37849, zb = 37850, Vb = 37851, kb = 37852, Gb = 37853, Hb = 2200, Wb = 2201, jb = 2202, Lo = 2300, Es = 2301, Cc = 2302, gs = 2400, vs = 2401, Wa = 2402, fu = 2500, Mf = 2501, $b = 0, Zb = 1, wf = 2, Cn = 3e3, Cs = 3001, pu = 3007, mu = 3002, Xb = 3003, Af = 3004, Sf = 3005, _f = 3006, Yb = 3200, Jb = 3201, Jr = 0, Kb = 1, L3 = 0, Lc = 7680, R3 = 7681, F3 = 7682, P3 = 7683, I3 = 34055, O3 = 34056, D3 = 5386, N3 = 512, B3 = 513, U3 = 514, z3 = 515, V3 = 516, k3 = 517, G3 = 518, qb = 519, Ro = 35044, Fo = 35048, H3 = 35040, W3 = 35045, j3 = 35049, $3 = 35041, Z3 = 35046, X3 = 35050, Y3 = 35042, J3 = "100", yd = "300 es"; class Kr { addEventListener(e, t) { this._listeners === void 0 && (this._listeners = {}); const i = this._listeners; i[e] === void 0 && (i[e] = []), i[e].indexOf(t) === -1 && i[e].push(t); } hasEventListener(e, t) { if (this._listeners === void 0) return !1; const i = this._listeners; return i[e] !== void 0 && i[e].indexOf(t) !== -1; } removeEventListener(e, t) { if (this._listeners === void 0) return; const r = this._listeners[e]; if (r !== void 0) { const s = r.indexOf(t); s !== -1 && r.splice(s, 1); } } dispatchEvent(e) { if (this._listeners === void 0) return; const i = this._listeners[e.type]; if (i !== void 0) { e.target = this; const r = i.slice(0); for (let s = 0, o = r.length; s < o; s++) r[s].call(this, e); e.target = null; } } } const fn = []; for (let n = 0; n < 256; n++) fn[n] = (n < 16 ? "0" : "") + n.toString(16); let Il = 1234567; const As = Math.PI / 180, ja = 180 / Math.PI; function Hn() { const n = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, i = Math.random() * 4294967295 | 0; return (fn[n & 255] + fn[n >> 8 & 255] + fn[n >> 16 & 255] + fn[n >> 24 & 255] + "-" + fn[e & 255] + fn[e >> 8 & 255] + "-" + fn[e >> 16 & 15 | 64] + fn[e >> 24 & 255] + "-" + fn[t & 63 | 128] + fn[t >> 8 & 255] + "-" + fn[t >> 16 & 255] + fn[t >> 24 & 255] + fn[i & 255] + fn[i >> 8 & 255] + fn[i >> 16 & 255] + fn[i >> 24 & 255]).toUpperCase(); } function gn(n, e, t) { return Math.max(e, Math.min(t, n)); } function Tf(n, e) { return (n % e + e) % e; } function K3(n, e, t, i, r) { return i + (n - e) * (r - i) / (t - e); } function q3(n, e, t) { return n !== e ? (t - n) / (e - n) : 0; } function Fa(n, e, t) { return (1 - t) * n + t * e; } function Q3(n, e, t, i) { return Fa(n, e, 1 - Math.exp(-t * i)); } function eF(n, e = 1) { return e - Math.abs(Tf(n, e * 2) - e); } function tF(n, e, t) { return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * (3 - 2 * n)); } function nF(n, e, t) { return n <= e ? 0 : n >= t ? 1 : (n = (n - e) / (t - e), n * n * n * (n * (n * 6 - 15) + 10)); } function iF(n, e) { return n + Math.floor(Math.random() * (e - n + 1)); } function rF(n, e) { return n + Math.random() * (e - n); } function sF(n) { return n * (0.5 - Math.random()); } function oF(n) { return n !== void 0 && (Il = n % 2147483647), Il = Il * 16807 % 2147483647, (Il - 1) / 2147483646; } function aF(n) { return n * As; } function lF(n) { return n * ja; } function bd(n) { return (n & n - 1) === 0 && n !== 0; } function Qb(n) { return Math.pow(2, Math.ceil(Math.log(n) / Math.LN2)); } function ex(n) { return Math.pow(2, Math.floor(Math.log(n) / Math.LN2)); } function cF(n, e, t, i, r) { const s = Math.cos, o = Math.sin, a = s(t / 2), c = o(t / 2), l = s((e + i) / 2), d = o((e + i) / 2), h = s((e - i) / 2), f = o((e - i) / 2), g = s((i - e) / 2), p = o((i - e) / 2); switch (r) { case "XYX": n.set(a * d, c * h, c * f, a * l); break; case "YZY": n.set(c * f, a * d, c * h, a * l); break; case "ZXZ": n.set(c * h, c * f, a * d, a * l); break; case "XZX": n.set(a * d, c * p, c * g, a * l); break; case "YXY": n.set(c * g, a * d, c * p, a * l); break; case "ZYZ": n.set(c * p, c * g, a * d, a * l); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r); } } var xd = /* @__PURE__ */ Object.freeze({ __proto__: null, DEG2RAD: As, RAD2DEG: ja, generateUUID: Hn, clamp: gn, euclideanModulo: Tf, mapLinear: K3, inverseLerp: q3, lerp: Fa, damp: Q3, pingpong: eF, smoothstep: tF, smootherstep: nF, randInt: iF, randFloat: rF, randFloatSpread: sF, seededRandom: oF, degToRad: aF, radToDeg: lF, isPowerOfTwo: bd, ceilPowerOfTwo: Qb, floorPowerOfTwo: ex, setQuaternionFromProperEuler: cF }); class Re { constructor(e = 0, t = 0) { this.x = e, this.y = t; } get width() { return this.x; } set width(e) { this.x = e; } get height() { return this.y; } set height(e) { this.y = e; } set(e, t) { return this.x = e, this.y = t, this; } setScalar(e) { return this.x = e, this.y = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y); } copy(e) { return this.x = e.x, this.y = e.y, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this); } addScalar(e) { return this.x += e, this.y += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this); } subScalar(e) { return this.x -= e, this.y -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this; } multiply(e) { return this.x *= e.x, this.y *= e.y, this; } multiplyScalar(e) { return this.x *= e, this.y *= e, this; } divide(e) { return this.x /= e.x, this.y /= e.y, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } applyMatrix3(e) { const t = this.x, i = this.y, r = e.elements; return this.x = r[0] * t + r[3] * i + r[6], this.y = r[1] * t + r[4] * i + r[7], this; } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this; } negate() { return this.x = -this.x, this.y = -this.y, this; } dot(e) { return this.x * e.x + this.y * e.y; } cross(e) { return this.x * e.y - this.y * e.x; } lengthSq() { return this.x * this.x + this.y * this.y; } length() { return Math.sqrt(this.x * this.x + this.y * this.y); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y); } normalize() { return this.divideScalar(this.length() || 1); } angle() { return Math.atan2(-this.y, -this.x) + Math.PI; } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const t = this.x - e.x, i = this.y - e.y; return t * t + i * i; } manhattanDistanceTo(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this; } equals(e) { return e.x === this.x && e.y === this.y; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this; } rotateAround(e, t) { const i = Math.cos(t), r = Math.sin(t), s = this.x - e.x, o = this.y - e.y; return this.x = s * i - o * r + e.x, this.y = s * r + o * i + e.y, this; } random() { return this.x = Math.random(), this.y = Math.random(), this; } } Re.prototype.isVector2 = !0; class rn { constructor() { this.elements = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ], arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead."); } set(e, t, i, r, s, o, a, c, l) { const d = this.elements; return d[0] = e, d[1] = r, d[2] = a, d[3] = t, d[4] = s, d[5] = c, d[6] = i, d[7] = o, d[8] = l, this; } identity() { return this.set( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), this; } copy(e) { const t = this.elements, i = e.elements; return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], this; } extractBasis(e, t, i) { return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), i.setFromMatrix3Column(this, 2), this; } setFromMatrix4(e) { const t = e.elements; return this.set( t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10] ), this; } multiply(e) { return this.multiplyMatrices(this, e); } premultiply(e) { return this.multiplyMatrices(e, this); } multiplyMatrices(e, t) { const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[3], c = i[6], l = i[1], d = i[4], h = i[7], f = i[2], g = i[5], p = i[8], u = r[0], y = r[3], v = r[6], m = r[1], x = r[4], w = r[7], A = r[2], M = r[5], R = r[8]; return s[0] = o * u + a * m + c * A, s[3] = o * y + a * x + c * M, s[6] = o * v + a * w + c * R, s[1] = l * u + d * m + h * A, s[4] = l * y + d * x + h * M, s[7] = l * v + d * w + h * R, s[2] = f * u + g * m + p * A, s[5] = f * y + g * x + p * M, s[8] = f * v + g * w + p * R, this; } multiplyScalar(e) { const t = this.elements; return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this; } determinant() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8]; return t * o * d - t * a * l - i * s * d + i * a * c + r * s * l - r * o * c; } invert() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = d * o - a * l, f = a * c - d * s, g = l * s - o * c, p = t * h + i * f + r * g; if (p === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const u = 1 / p; return e[0] = h * u, e[1] = (r * l - d * i) * u, e[2] = (a * i - r * o) * u, e[3] = f * u, e[4] = (d * t - r * c) * u, e[5] = (r * s - a * t) * u, e[6] = g * u, e[7] = (i * c - l * t) * u, e[8] = (o * t - i * s) * u, this; } transpose() { let e; const t = this.elements; return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this; } getNormalMatrix(e) { return this.setFromMatrix4(e).invert().transpose(); } transposeIntoArray(e) { const t = this.elements; return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this; } setUvTransform(e, t, i, r, s, o, a) { const c = Math.cos(s), l = Math.sin(s); return this.set( i * c, i * l, -i * (c * o + l * a) + o + e, -r * l, r * c, -r * (-l * o + c * a) + a + t, 0, 0, 1 ), this; } scale(e, t) { const i = this.elements; return i[0] *= e, i[3] *= e, i[6] *= e, i[1] *= t, i[4] *= t, i[7] *= t, this; } rotate(e) { const t = Math.cos(e), i = Math.sin(e), r = this.elements, s = r[0], o = r[3], a = r[6], c = r[1], l = r[4], d = r[7]; return r[0] = t * s + i * c, r[3] = t * o + i * l, r[6] = t * a + i * d, r[1] = -i * s + t * c, r[4] = -i * o + t * l, r[7] = -i * a + t * d, this; } translate(e, t) { const i = this.elements; return i[0] += e * i[2], i[3] += e * i[5], i[6] += e * i[8], i[1] += t * i[2], i[4] += t * i[5], i[7] += t * i[8], this; } equals(e) { const t = this.elements, i = e.elements; for (let r = 0; r < 9; r++) if (t[r] !== i[r]) return !1; return !0; } fromArray(e, t = 0) { for (let i = 0; i < 9; i++) this.elements[i] = e[i + t]; return this; } toArray(e = [], t = 0) { const i = this.elements; return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e; } clone() { return new this.constructor().fromArray(this.elements); } } rn.prototype.isMatrix3 = !0; let js; class Bs { static getDataURL(e) { if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; let t; if (e instanceof HTMLCanvasElement) t = e; else { js === void 0 && (js = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), js.width = e.width, js.height = e.height; const i = js.getContext("2d"); e instanceof ImageData ? i.putImageData(e, 0, 0) : i.drawImage(e, 0, 0, e.width, e.height), t = js; } return t.width > 2048 || t.height > 2048 ? (console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png"); } } let uF = 0; class Yt extends Kr { constructor(e = Yt.DEFAULT_IMAGE, t = Yt.DEFAULT_MAPPING, i = hn, r = hn, s = zt, o = fr, a = Gn, c = Ts, l = 1, d = Cn) { super(), Object.defineProperty(this, "id", { value: uF++ }), this.uuid = Hn(), this.name = "", this.image = e, this.mipmaps = [], this.mapping = t, this.wrapS = i, this.wrapT = r, this.magFilter = s, this.minFilter = o, this.anisotropy = l, this.format = a, this.internalFormat = null, this.type = c, this.offset = new Re(0, 0), this.repeat = new Re(1, 1), this.center = new Re(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new rn(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = d, this.version = 0, this.onUpdate = null; } updateMatrix() { this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); } clone() { return new this.constructor().copy(this); } copy(e) { return this.name = e.name, this.image = e.image, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.encoding = e.encoding, this; } toJSON(e) { const t = e === void 0 || typeof e == "string"; if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid]; const i = { metadata: { version: 4.5, type: "Texture", generator: "Texture.toJSON" }, uuid: this.uuid, name: this.name, mapping: this.mapping, repeat: [this.repeat.x, this.repeat.y], offset: [this.offset.x, this.offset.y], center: [this.center.x, this.center.y], rotation: this.rotation, wrap: [this.wrapS, this.wrapT], format: this.format, type: this.type, encoding: this.encoding, minFilter: this.minFilter, magFilter: this.magFilter, anisotropy: this.anisotropy, flipY: this.flipY, premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; if (this.image !== void 0) { const r = this.image; if (r.uuid === void 0 && (r.uuid = Hn()), !t && e.images[r.uuid] === void 0) { let s; if (Array.isArray(r)) { s = []; for (let o = 0, a = r.length; o < a; o++) r[o].isDataTexture ? s.push($u(r[o].image)) : s.push($u(r[o])); } else s = $u(r); e.images[r.uuid] = { uuid: r.uuid, url: s }; } i.image = r.uuid; } return t || (e.textures[this.uuid] = i), i; } dispose() { this.dispatchEvent({ type: "dispose" }); } transformUv(e) { if (this.mapping !== hu) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) { case jr: e.x = e.x - Math.floor(e.x); break; case hn: e.x = e.x < 0 ? 0 : 1; break; case Eo: Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x); break; } if (e.y < 0 || e.y > 1) switch (this.wrapT) { case jr: e.y = e.y - Math.floor(e.y); break; case hn: e.y = e.y < 0 ? 0 : 1; break; case Eo: Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y); break; } return this.flipY && (e.y = 1 - e.y), e; } set needsUpdate(e) { e === !0 && this.version++; } } Yt.DEFAULT_IMAGE = void 0; Yt.DEFAULT_MAPPING = hu; Yt.prototype.isTexture = !0; function $u(n) { return typeof HTMLImageElement < "u" && n instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && n instanceof ImageBitmap ? Bs.getDataURL(n) : n.data ? { data: Array.prototype.slice.call(n.data), width: n.width, height: n.height, type: n.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } class xt { constructor(e = 0, t = 0, i = 0, r = 1) { this.x = e, this.y = t, this.z = i, this.w = r; } get width() { return this.z; } set width(e) { this.z = e; } get height() { return this.w; } set height(e) { this.w = e; } set(e, t, i, r) { return this.x = e, this.y = t, this.z = i, this.w = r, this; } setScalar(e) { return this.x = e, this.y = e, this.z = e, this.w = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setZ(e) { return this.z = e, this; } setW(e) { return this.w = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; case 3: this.w = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; case 3: return this.w; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z, this.w); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w !== void 0 ? e.w : 1, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this); } addScalar(e) { return this.x += e, this.y += e, this.z += e, this.w += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this); } subScalar(e) { return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this; } multiply(e) { return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this; } multiplyScalar(e) { return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this; } applyMatrix4(e) { const t = this.x, i = this.y, r = this.z, s = this.w, o = e.elements; return this.x = o[0] * t + o[4] * i + o[8] * r + o[12] * s, this.y = o[1] * t + o[5] * i + o[9] * r + o[13] * s, this.z = o[2] * t + o[6] * i + o[10] * r + o[14] * s, this.w = o[3] * t + o[7] * i + o[11] * r + o[15] * s, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } setAxisAngleFromQuaternion(e) { this.w = 2 * Math.acos(e.w); const t = Math.sqrt(1 - e.w * e.w); return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this; } setAxisAngleFromRotationMatrix(e) { let t, i, r, s; const c = e.elements, l = c[0], d = c[4], h = c[8], f = c[1], g = c[5], p = c[9], u = c[2], y = c[6], v = c[10]; if (Math.abs(d - f) < 0.01 && Math.abs(h - u) < 0.01 && Math.abs(p - y) < 0.01) { if (Math.abs(d + f) < 0.1 && Math.abs(h + u) < 0.1 && Math.abs(p + y) < 0.1 && Math.abs(l + g + v - 3) < 0.1) return this.set(1, 0, 0, 0), this; t = Math.PI; const x = (l + 1) / 2, w = (g + 1) / 2, A = (v + 1) / 2, M = (d + f) / 4, R = (h + u) / 4, L = (p + y) / 4; return x > w && x > A ? x < 0.01 ? (i = 0, r = 0.707106781, s = 0.707106781) : (i = Math.sqrt(x), r = M / i, s = R / i) : w > A ? w < 0.01 ? (i = 0.707106781, r = 0, s = 0.707106781) : (r = Math.sqrt(w), i = M / r, s = L / r) : A < 0.01 ? (i = 0.707106781, r = 0.707106781, s = 0) : (s = Math.sqrt(A), i = R / s, r = L / s), this.set(i, r, s, t), this; } let m = Math.sqrt((y - p) * (y - p) + (h - u) * (h - u) + (f - d) * (f - d)); return Math.abs(m) < 1e-3 && (m = 1), this.x = (y - p) / m, this.y = (h - u) / m, this.z = (f - d) / m, this.w = Math.acos((l + g + v - 1) / 2), this; } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this; } negate() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this; } dot(e) { return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w; } lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; } length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); } normalize() { return this.divideScalar(this.length() || 1); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this.w = e.w + (t.w - e.w) * i, this; } equals(e) { return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this; } } xt.prototype.isVector4 = !0; class fi extends Kr { constructor(e, t, i = {}) { super(), this.width = e, this.height = t, this.depth = 1, this.scissor = new xt(0, 0, e, t), this.scissorTest = !1, this.viewport = new xt(0, 0, e, t), this.texture = new Yt(void 0, i.mapping, i.wrapS, i.wrapT, i.magFilter, i.minFilter, i.format, i.type, i.anisotropy, i.encoding), this.texture.image = { width: e, height: t, depth: 1 }, this.texture.generateMipmaps = i.generateMipmaps !== void 0 ? i.generateMipmaps : !1, this.texture.minFilter = i.minFilter !== void 0 ? i.minFilter : zt, this.depthBuffer = i.depthBuffer !== void 0 ? i.depthBuffer : !0, this.stencilBuffer = i.stencilBuffer !== void 0 ? i.stencilBuffer : !1, this.depthTexture = i.depthTexture !== void 0 ? i.depthTexture : null; } setTexture(e) { e.image = { width: this.width, height: this.height, depth: this.depth }, this.texture = e; } setSize(e, t, i = 1) { (this.width !== e || this.height !== t || this.depth !== i) && (this.width = e, this.height = t, this.depth = i, this.texture.image.width = e, this.texture.image.height = t, this.texture.image.depth = i, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t); } clone() { return new this.constructor().copy(this); } copy(e) { return this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.copy(e.viewport), this.texture = e.texture.clone(), this.texture.image = { ...this.texture.image }, this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } } fi.prototype.isWebGLRenderTarget = !0; class tx extends fi { constructor(e, t, i) { super(e, t); const r = this.texture; this.texture = []; for (let s = 0; s < i; s++) this.texture[s] = r.clone(); } setSize(e, t, i = 1) { if (this.width !== e || this.height !== t || this.depth !== i) { this.width = e, this.height = t, this.depth = i; for (let r = 0, s = this.texture.length; r < s; r++) this.texture[r].image.width = e, this.texture[r].image.height = t, this.texture[r].image.depth = i; this.dispose(); } return this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t), this; } copy(e) { this.dispose(), this.width = e.width, this.height = e.height, this.depth = e.depth, this.viewport.set(0, 0, this.width, this.height), this.scissor.set(0, 0, this.width, this.height), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.depthTexture = e.depthTexture, this.texture.length = 0; for (let t = 0, i = e.texture.length; t < i; t++) this.texture[t] = e.texture[t].clone(); return this; } } tx.prototype.isWebGLMultipleRenderTargets = !0; class Ef extends fi { constructor(e, t, i) { super(e, t, i), this.samples = 4; } copy(e) { return super.copy.call(this, e), this.samples = e.samples, this; } } Ef.prototype.isWebGLMultisampleRenderTarget = !0; class bn { constructor(e = 0, t = 0, i = 0, r = 1) { this._x = e, this._y = t, this._z = i, this._w = r; } static slerp(e, t, i, r) { return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."), i.slerpQuaternions(e, t, r); } static slerpFlat(e, t, i, r, s, o, a) { let c = i[r + 0], l = i[r + 1], d = i[r + 2], h = i[r + 3]; const f = s[o + 0], g = s[o + 1], p = s[o + 2], u = s[o + 3]; if (a === 0) { e[t + 0] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h; return; } if (a === 1) { e[t + 0] = f, e[t + 1] = g, e[t + 2] = p, e[t + 3] = u; return; } if (h !== u || c !== f || l !== g || d !== p) { let y = 1 - a; const v = c * f + l * g + d * p + h * u, m = v >= 0 ? 1 : -1, x = 1 - v * v; if (x > Number.EPSILON) { const A = Math.sqrt(x), M = Math.atan2(A, v * m); y = Math.sin(y * M) / A, a = Math.sin(a * M) / A; } const w = a * m; if (c = c * y + f * w, l = l * y + g * w, d = d * y + p * w, h = h * y + u * w, y === 1 - a) { const A = 1 / Math.sqrt(c * c + l * l + d * d + h * h); c *= A, l *= A, d *= A, h *= A; } } e[t] = c, e[t + 1] = l, e[t + 2] = d, e[t + 3] = h; } static multiplyQuaternionsFlat(e, t, i, r, s, o) { const a = i[r], c = i[r + 1], l = i[r + 2], d = i[r + 3], h = s[o], f = s[o + 1], g = s[o + 2], p = s[o + 3]; return e[t] = a * p + d * h + c * g - l * f, e[t + 1] = c * p + d * f + l * h - a * g, e[t + 2] = l * p + d * g + a * f - c * h, e[t + 3] = d * p - a * h - c * f - l * g, e; } get x() { return this._x; } set x(e) { this._x = e, this._onChangeCallback(); } get y() { return this._y; } set y(e) { this._y = e, this._onChangeCallback(); } get z() { return this._z; } set z(e) { this._z = e, this._onChangeCallback(); } get w() { return this._w; } set w(e) { this._w = e, this._onChangeCallback(); } set(e, t, i, r) { return this._x = e, this._y = t, this._z = i, this._w = r, this._onChangeCallback(), this; } clone() { return new this.constructor(this._x, this._y, this._z, this._w); } copy(e) { return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this; } setFromEuler(e, t) { if (!(e && e.isEuler)) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); const i = e._x, r = e._y, s = e._z, o = e._order, a = Math.cos, c = Math.sin, l = a(i / 2), d = a(r / 2), h = a(s / 2), f = c(i / 2), g = c(r / 2), p = c(s / 2); switch (o) { case "XYZ": this._x = f * d * h + l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h - f * g * p; break; case "YXZ": this._x = f * d * h + l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h + f * g * p; break; case "ZXY": this._x = f * d * h - l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h - f * g * p; break; case "ZYX": this._x = f * d * h - l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h + f * g * p; break; case "YZX": this._x = f * d * h + l * g * p, this._y = l * g * h + f * d * p, this._z = l * d * p - f * g * h, this._w = l * d * h - f * g * p; break; case "XZY": this._x = f * d * h - l * g * p, this._y = l * g * h - f * d * p, this._z = l * d * p + f * g * h, this._w = l * d * h + f * g * p; break; default: console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + o); } return t !== !1 && this._onChangeCallback(), this; } setFromAxisAngle(e, t) { const i = t / 2, r = Math.sin(i); return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(i), this._onChangeCallback(), this; } setFromRotationMatrix(e) { const t = e.elements, i = t[0], r = t[4], s = t[8], o = t[1], a = t[5], c = t[9], l = t[2], d = t[6], h = t[10], f = i + a + h; if (f > 0) { const g = 0.5 / Math.sqrt(f + 1); this._w = 0.25 / g, this._x = (d - c) * g, this._y = (s - l) * g, this._z = (o - r) * g; } else if (i > a && i > h) { const g = 2 * Math.sqrt(1 + i - a - h); this._w = (d - c) / g, this._x = 0.25 * g, this._y = (r + o) / g, this._z = (s + l) / g; } else if (a > h) { const g = 2 * Math.sqrt(1 + a - i - h); this._w = (s - l) / g, this._x = (r + o) / g, this._y = 0.25 * g, this._z = (c + d) / g; } else { const g = 2 * Math.sqrt(1 + h - i - a); this._w = (o - r) / g, this._x = (s + l) / g, this._y = (c + d) / g, this._z = 0.25 * g; } return this._onChangeCallback(), this; } setFromUnitVectors(e, t) { let i = e.dot(t) + 1; return i < Number.EPSILON ? (i = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = i) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = i)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = i), this.normalize(); } angleTo(e) { return 2 * Math.acos(Math.abs(gn(this.dot(e), -1, 1))); } rotateTowards(e, t) { const i = this.angleTo(e); if (i === 0) return this; const r = Math.min(1, t / i); return this.slerp(e, r), this; } identity() { return this.set(0, 0, 0, 1); } invert() { return this.conjugate(); } conjugate() { return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this; } dot(e) { return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w; } lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; } length() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); } normalize() { let e = this.length(); return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e); } premultiply(e) { return this.multiplyQuaternions(e, this); } multiplyQuaternions(e, t) { const i = e._x, r = e._y, s = e._z, o = e._w, a = t._x, c = t._y, l = t._z, d = t._w; return this._x = i * d + o * a + r * l - s * c, this._y = r * d + o * c + s * a - i * l, this._z = s * d + o * l + i * c - r * a, this._w = o * d - i * a - r * c - s * l, this._onChangeCallback(), this; } slerp(e, t) { if (t === 0) return this; if (t === 1) return this.copy(e); const i = this._x, r = this._y, s = this._z, o = this._w; let a = o * e._w + i * e._x + r * e._y + s * e._z; if (a < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, a = -a) : this.copy(e), a >= 1) return this._w = o, this._x = i, this._y = r, this._z = s, this; const c = 1 - a * a; if (c <= Number.EPSILON) { const g = 1 - t; return this._w = g * o + t * this._w, this._x = g * i + t * this._x, this._y = g * r + t * this._y, this._z = g * s + t * this._z, this.normalize(), this._onChangeCallback(), this; } const l = Math.sqrt(c), d = Math.atan2(l, a), h = Math.sin((1 - t) * d) / l, f = Math.sin(t * d) / l; return this._w = o * h + this._w * f, this._x = i * h + this._x * f, this._y = r * h + this._y * f, this._z = s * h + this._z * f, this._onChangeCallback(), this; } slerpQuaternions(e, t, i) { this.copy(e).slerp(t, i); } equals(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w; } fromArray(e, t = 0) { return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this; } toArray(e = [], t = 0) { return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e; } fromBufferAttribute(e, t) { return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this; } _onChange(e) { return this._onChangeCallback = e, this; } _onChangeCallback() { } } bn.prototype.isQuaternion = !0; class q { constructor(e = 0, t = 0, i = 0) { this.x = e, this.y = t, this.z = i; } set(e, t, i) { return i === void 0 && (i = this.z), this.x = e, this.y = t, this.z = i, this; } setScalar(e) { return this.x = e, this.y = e, this.z = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setZ(e) { return this.z = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this; } add(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this); } addScalar(e) { return this.x += e, this.y += e, this.z += e, this; } addVectors(e, t) { return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this; } addScaledVector(e, t) { return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this; } sub(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this); } subScalar(e) { return this.x -= e, this.y -= e, this.z -= e, this; } subVectors(e, t) { return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this); } multiplyScalar(e) { return this.x *= e, this.y *= e, this.z *= e, this; } multiplyVectors(e, t) { return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this; } applyEuler(e) { return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion($m.setFromEuler(e)); } applyAxisAngle(e, t) { return this.applyQuaternion($m.setFromAxisAngle(e, t)); } applyMatrix3(e) { const t = this.x, i = this.y, r = this.z, s = e.elements; return this.x = s[0] * t + s[3] * i + s[6] * r, this.y = s[1] * t + s[4] * i + s[7] * r, this.z = s[2] * t + s[5] * i + s[8] * r, this; } applyNormalMatrix(e) { return this.applyMatrix3(e).normalize(); } applyMatrix4(e) { const t = this.x, i = this.y, r = this.z, s = e.elements, o = 1 / (s[3] * t + s[7] * i + s[11] * r + s[15]); return this.x = (s[0] * t + s[4] * i + s[8] * r + s[12]) * o, this.y = (s[1] * t + s[5] * i + s[9] * r + s[13]) * o, this.z = (s[2] * t + s[6] * i + s[10] * r + s[14]) * o, this; } applyQuaternion(e) { const t = this.x, i = this.y, r = this.z, s = e.x, o = e.y, a = e.z, c = e.w, l = c * t + o * r - a * i, d = c * i + a * t - s * r, h = c * r + s * i - o * t, f = -s * t - o * i - a * r; return this.x = l * c + f * -s + d * -a - h * -o, this.y = d * c + f * -o + h * -s - l * -a, this.z = h * c + f * -a + l * -o - d * -s, this; } project(e) { return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix); } unproject(e) { return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld); } transformDirection(e) { const t = this.x, i = this.y, r = this.z, s = e.elements; return this.x = s[0] * t + s[4] * i + s[8] * r, this.y = s[1] * t + s[5] * i + s[9] * r, this.z = s[2] * t + s[6] * i + s[10] * r, this.normalize(); } divide(e) { return this.x /= e.x, this.y /= e.y, this.z /= e.z, this; } divideScalar(e) { return this.multiplyScalar(1 / e); } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this; } clampLength(e, t) { const i = this.length(); return this.divideScalar(i || 1).multiplyScalar(Math.max(e, Math.min(t, i))); } floor() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this; } ceil() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this; } round() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this; } roundToZero() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this; } negate() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this; } dot(e) { return this.x * e.x + this.y * e.y + this.z * e.z; } // TODO lengthSquared? lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; } length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); } manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); } normalize() { return this.divideScalar(this.length() || 1); } setLength(e) { return this.normalize().multiplyScalar(e); } lerp(e, t) { return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this; } lerpVectors(e, t, i) { return this.x = e.x + (t.x - e.x) * i, this.y = e.y + (t.y - e.y) * i, this.z = e.z + (t.z - e.z) * i, this; } cross(e, t) { return t !== void 0 ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(e, t)) : this.crossVectors(this, e); } crossVectors(e, t) { const i = e.x, r = e.y, s = e.z, o = t.x, a = t.y, c = t.z; return this.x = r * c - s * a, this.y = s * o - i * c, this.z = i * a - r * o, this; } projectOnVector(e) { const t = e.lengthSq(); if (t === 0) return this.set(0, 0, 0); const i = e.dot(this) / t; return this.copy(e).multiplyScalar(i); } projectOnPlane(e) { return Zu.copy(this).projectOnVector(e), this.sub(Zu); } reflect(e) { return this.sub(Zu.copy(e).multiplyScalar(2 * this.dot(e))); } angleTo(e) { const t = Math.sqrt(this.lengthSq() * e.lengthSq()); if (t === 0) return Math.PI / 2; const i = this.dot(e) / t; return Math.acos(gn(i, -1, 1)); } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const t = this.x - e.x, i = this.y - e.y, r = this.z - e.z; return t * t + i * i + r * r; } manhattanDistanceTo(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z); } setFromSpherical(e) { return this.setFromSphericalCoords(e.radius, e.phi, e.theta); } setFromSphericalCoords(e, t, i) { const r = Math.sin(t) * e; return this.x = r * Math.sin(i), this.y = Math.cos(t) * e, this.z = r * Math.cos(i), this; } setFromCylindrical(e) { return this.setFromCylindricalCoords(e.radius, e.theta, e.y); } setFromCylindricalCoords(e, t, i) { return this.x = e * Math.sin(t), this.y = i, this.z = e * Math.cos(t), this; } setFromMatrixPosition(e) { const t = e.elements; return this.x = t[12], this.y = t[13], this.z = t[14], this; } setFromMatrixScale(e) { const t = this.setFromMatrixColumn(e, 0).length(), i = this.setFromMatrixColumn(e, 1).length(), r = this.setFromMatrixColumn(e, 2).length(); return this.x = t, this.y = i, this.z = r, this; } setFromMatrixColumn(e, t) { return this.fromArray(e.elements, t * 4); } setFromMatrix3Column(e, t) { return this.fromArray(e.elements, t * 3); } equals(e) { return e.x === this.x && e.y === this.y && e.z === this.z; } fromArray(e, t = 0) { return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this; } toArray(e = [], t = 0) { return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e; } fromBufferAttribute(e, t, i) { return i !== void 0 && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this; } random() { return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this; } } q.prototype.isVector3 = !0; const Zu = /* @__PURE__ */ new q(), $m = /* @__PURE__ */ new bn(); class Nn { constructor(e = new q(1 / 0, 1 / 0, 1 / 0), t = new q(-1 / 0, -1 / 0, -1 / 0)) { this.min = e, this.max = t; } set(e, t) { return this.min.copy(e), this.max.copy(t), this; } setFromArray(e) { let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0; for (let c = 0, l = e.length; c < l; c += 3) { const d = e[c], h = e[c + 1], f = e[c + 2]; d < t && (t = d), h < i && (i = h), f < r && (r = f), d > s && (s = d), h > o && (o = h), f > a && (a = f); } return this.min.set(t, i, r), this.max.set(s, o, a), this; } setFromBufferAttribute(e) { let t = 1 / 0, i = 1 / 0, r = 1 / 0, s = -1 / 0, o = -1 / 0, a = -1 / 0; for (let c = 0, l = e.count; c < l; c++) { const d = e.getX(c), h = e.getY(c), f = e.getZ(c); d < t && (t = d), h < i && (i = h), f < r && (r = f), d > s && (s = d), h > o && (o = h), f > a && (a = f); } return this.min.set(t, i, r), this.max.set(s, o, a), this; } setFromPoints(e) { this.makeEmpty(); for (let t = 0, i = e.length; t < i; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const i = ha.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(i), this.max.copy(e).add(i), this; } setFromObject(e) { return this.makeEmpty(), this.expandByObject(e); } clone() { return new this.constructor().copy(this); } copy(e) { return this.min.copy(e.min), this.max.copy(e.max), this; } makeEmpty() { return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this; } isEmpty() { return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; } getCenter(e) { return this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5); } getSize(e) { return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min); } expandByPoint(e) { return this.min.min(e), this.max.max(e), this; } expandByVector(e) { return this.min.sub(e), this.max.add(e), this; } expandByScalar(e) { return this.min.addScalar(-e), this.max.addScalar(e), this; } expandByObject(e) { e.updateWorldMatrix(!1, !1); const t = e.geometry; t !== void 0 && (t.boundingBox === null && t.computeBoundingBox(), Xu.copy(t.boundingBox), Xu.applyMatrix4(e.matrixWorld), this.union(Xu)); const i = e.children; for (let r = 0, s = i.length; r < s; r++) this.expandByObject(i[r]); return this; } containsPoint(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y || e.z < this.min.z || e.z > this.max.z); } containsBox(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z; } getParameter(e, t) { return t.set( (e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z) ); } intersectsBox(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y || e.max.z < this.min.z || e.min.z > this.max.z); } intersectsSphere(e) { return this.clampPoint(e.center, ha), ha.distanceToSquared(e.center) <= e.radius * e.radius; } intersectsPlane(e) { let t, i; return e.normal.x > 0 ? (t = e.normal.x * this.min.x, i = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, i = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, i += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, i += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, i += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, i += e.normal.z * this.min.z), t <= -e.constant && i >= -e.constant; } intersectsTriangle(e) { if (this.isEmpty()) return !1; this.getCenter(da), Ol.subVectors(this.max, da), $s.subVectors(e.a, da), Zs.subVectors(e.b, da), Xs.subVectors(e.c, da), vr.subVectors(Zs, $s), yr.subVectors(Xs, Zs), ss.subVectors($s, Xs); let t = [ 0, -vr.z, vr.y, 0, -yr.z, yr.y, 0, -ss.z, ss.y, vr.z, 0, -vr.x, yr.z, 0, -yr.x, ss.z, 0, -ss.x, -vr.y, vr.x, 0, -yr.y, yr.x, 0, -ss.y, ss.x, 0 ]; return !Yu(t, $s, Zs, Xs, Ol) || (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !Yu(t, $s, Zs, Xs, Ol)) ? !1 : (Dl.crossVectors(vr, yr), t = [Dl.x, Dl.y, Dl.z], Yu(t, $s, Zs, Xs, Ol)); } clampPoint(e, t) { return t.copy(e).clamp(this.min, this.max); } distanceToPoint(e) { return ha.copy(e).clamp(this.min, this.max).sub(e).length(); } getBoundingSphere(e) { return this.getCenter(e.center), e.radius = this.getSize(ha).length() * 0.5, e; } intersect(e) { return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this; } union(e) { return this.min.min(e.min), this.max.max(e.max), this; } applyMatrix4(e) { return this.isEmpty() ? this : (Hi[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Hi[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Hi[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Hi[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Hi[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Hi[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Hi[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Hi[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Hi), this); } translate(e) { return this.min.add(e), this.max.add(e), this; } equals(e) { return e.min.equals(this.min) && e.max.equals(this.max); } } Nn.prototype.isBox3 = !0; const Hi = [ /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q(), /* @__PURE__ */ new q() ], ha = /* @__PURE__ */ new q(), Xu = /* @__PURE__ */ new Nn(), $s = /* @__PURE__ */ new q(), Zs = /* @__PURE__ */ new q(), Xs = /* @__PURE__ */ new q(), vr = /* @__PURE__ */ new q(), yr = /* @__PURE__ */ new q(), ss = /* @__PURE__ */ new q(), da = /* @__PURE__ */ new q(), Ol = /* @__PURE__ */ new q(), Dl = /* @__PURE__ */ new q(), os = /* @__PURE__ */ new q(); function Yu(n, e, t, i, r) { for (let s = 0, o = n.length - 3; s <= o; s += 3) { os.fromArray(n, s); const a = r.x * Math.abs(os.x) + r.y * Math.abs(os.y) + r.z * Math.abs(os.z), c = e.dot(os), l = t.dot(os), d = i.dot(os); if (Math.max(-Math.max(c, l, d), Math.min(c, l, d)) > a) return !1; } return !0; } const hF = /* @__PURE__ */ new Nn(), Zm = /* @__PURE__ */ new q(), Ju = /* @__PURE__ */ new q(), Ku = /* @__PURE__ */ new q(); class pr { 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) : hF.setFromPoints(e).getCenter(i); let r = 0; for (let s = 0, o = e.length; s < o; s++) r = Math.max(r, i.distanceToSquared(e[s])); return this.radius = Math.sqrt(r), this; } copy(e) { return this.center.copy(e.center), this.radius = e.radius, this; } isEmpty() { return this.radius < 0; } makeEmpty() { return this.center.set(0, 0, 0), this.radius = -1, this; } containsPoint(e) { return e.distanceToSquared(this.center) <= this.radius * this.radius; } distanceToPoint(e) { return e.distanceTo(this.center) - this.radius; } intersectsSphere(e) { const t = this.radius + e.radius; return e.center.distanceToSquared(this.center) <= t * t; } intersectsBox(e) { return e.intersectsSphere(this); } intersectsPlane(e) { return Math.abs(e.distanceToPoint(this.center)) <= this.radius; } clampPoint(e, t) { const i = this.center.distanceToSquared(e); return t.copy(e), i > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t; } getBoundingBox(e) { return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e); } applyMatrix4(e) { return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this; } translate(e) { return this.center.add(e), this; } expandByPoint(e) { Ku.subVectors(e, this.center); const t = Ku.lengthSq(); if (t > this.radius * this.radius) { const i = Math.sqrt(t), r = (i - this.radius) * 0.5; this.center.add(Ku.multiplyScalar(r / i)), this.radius += r; } return this; } union(e) { return Ju.subVectors(e.center, this.center).normalize().multiplyScalar(e.radius), this.expandByPoint(Zm.copy(e.center).add(Ju)), this.expandByPoint(Zm.copy(e.center).sub(Ju)), this; } equals(e) { return e.center.equals(this.center) && e.radius === this.radius; } clone() { return new this.constructor().copy(this); } } const Wi = /* @__PURE__ */ new q(), qu = /* @__PURE__ */ new q(), Nl = /* @__PURE__ */ new q(), br = /* @__PURE__ */ new q(), Qu = /* @__PURE__ */ new q(), Bl = /* @__PURE__ */ new q(), eh = /* @__PURE__ */ new q(); class qr { constructor(e = new q(), t = new q(0, 0, -1)) { this.origin = e, this.direction = t; } set(e, t) { return this.origin.copy(e), this.direction.copy(t), this; } copy(e) { return this.origin.copy(e.origin), this.direction.copy(e.direction), this; } at(e, t) { return t.copy(this.direction).multiplyScalar(e).add(this.origin); } lookAt(e) { return this.direction.copy(e).sub(this.origin).normalize(), this; } recast(e) { return this.origin.copy(this.at(e, Wi)), 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 = Wi.subVectors(e, this.origin).dot(this.direction); return t < 0 ? this.origin.distanceToSquared(e) : (Wi.copy(this.direction).multiplyScalar(t).add(this.origin), Wi.distanceToSquared(e)); } distanceSqToSegment(e, t, i, r) { qu.copy(e).add(t).multiplyScalar(0.5), Nl.copy(t).sub(e).normalize(), br.copy(this.origin).sub(qu); const s = e.distanceTo(t) * 0.5, o = -this.direction.dot(Nl), a = br.dot(this.direction), c = -br.dot(Nl), l = br.lengthSq(), d = Math.abs(1 - o * o); let h, f, g, p; if (d > 0) if (h = o * c - a, f = o * a - c, p = s * d, h >= 0) if (f >= -p) if (f <= p) { const u = 1 / d; h *= u, f *= u, g = h * (h + o * f + 2 * a) + f * (o * h + f + 2 * c) + l; } else f = s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l; else f = -s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l; else f <= -p ? (h = Math.max(0, -(-o * s + a)), f = h > 0 ? -s : Math.min(Math.max(-s, -c), s), g = -h * h + f * (f + 2 * c) + l) : f <= p ? (h = 0, f = Math.min(Math.max(-s, -c), s), g = f * (f + 2 * c) + l) : (h = Math.max(0, -(o * s + a)), f = h > 0 ? s : Math.min(Math.max(-s, -c), s), g = -h * h + f * (f + 2 * c) + l); else f = o > 0 ? -s : s, h = Math.max(0, -(o * f + a)), g = -h * h + f * (f + 2 * c) + l; return i && i.copy(this.direction).multiplyScalar(h).add(this.origin), r && r.copy(Nl).multiplyScalar(f).add(qu), g; } intersectSphere(e, t) { Wi.subVectors(e.center, this.origin); const i = Wi.dot(this.direction), r = Wi.dot(Wi) - i * i, s = e.radius * e.radius; if (r > s) return null; const o = Math.sqrt(s - r), a = i - o, c = i + o; return a < 0 && c < 0 ? null : a < 0 ? this.at(c, t) : this.at(a, t); } intersectsSphere(e) { return this.distanceSqToPoint(e.center) <= e.radius * e.radius; } distanceToPlane(e) { const t = e.normal.dot(this.direction); if (t === 0) return e.distanceToPoint(this.origin) === 0 ? 0 : null; const i = -(this.origin.dot(e.normal) + e.constant) / t; return i >= 0 ? i : null; } intersectPlane(e, t) { const i = this.distanceToPlane(e); return i === null ? null : this.at(i, t); } intersectsPlane(e) { const t = e.distanceToPoint(this.origin); return t === 0 || e.normal.dot(this.direction) * t < 0; } intersectBox(e, t) { let i, r, s, o, a, c; const l = 1 / this.direction.x, d = 1 / this.direction.y, h = 1 / this.direction.z, f = this.origin; return l >= 0 ? (i = (e.min.x - f.x) * l, r = (e.max.x - f.x) * l) : (i = (e.max.x - f.x) * l, r = (e.min.x - f.x) * l), d >= 0 ? (s = (e.min.y - f.y) * d, o = (e.max.y - f.y) * d) : (s = (e.max.y - f.y) * d, o = (e.min.y - f.y) * d), i > o || s > r || ((s > i || i !== i) && (i = s), (o < r || r !== r) && (r = o), h >= 0 ? (a = (e.min.z - f.z) * h, c = (e.max.z - f.z) * h) : (a = (e.max.z - f.z) * h, c = (e.min.z - f.z) * h), i > c || a > r) || ((a > i || i !== i) && (i = a), (c < r || r !== r) && (r = c), r < 0) ? null : this.at(i >= 0 ? i : r, t); } intersectsBox(e) { return this.intersectBox(e, Wi) !== null; } intersectTriangle(e, t, i, r, s) { Qu.subVectors(t, e), Bl.subVectors(i, e), eh.crossVectors(Qu, Bl); let o = this.direction.dot(eh), a; if (o > 0) { if (r) return null; a = 1; } else if (o < 0) a = -1, o = -o; else return null; br.subVectors(this.origin, e); const c = a * this.direction.dot(Bl.crossVectors(br, Bl)); if (c < 0) return null; const l = a * this.direction.dot(Qu.cross(br)); if (l < 0 || c + l > o) return null; const d = -a * br.dot(eh); return d < 0 ? null : this.at(d / o, s); } applyMatrix4(e) { return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this; } equals(e) { return e.origin.equals(this.origin) && e.direction.equals(this.direction); } clone() { return new this.constructor().copy(this); } } class Xe { constructor() { this.elements = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead."); } set(e, t, i, r, s, o, a, c, l, d, h, f, g, p, u, y) { const v = this.elements; return v[0] = e, v[4] = t, v[8] = i, v[12] = r, v[1] = s, v[5] = o, v[9] = a, v[13] = c, v[2] = l, v[6] = d, v[10] = h, v[14] = f, v[3] = g, v[7] = p, v[11] = u, v[15] = y, this; } identity() { return this.set( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ), this; } clone() { return new Xe().fromArray(this.elements); } copy(e) { const t = this.elements, i = e.elements; return t[0] = i[0], t[1] = i[1], t[2] = i[2], t[3] = i[3], t[4] = i[4], t[5] = i[5], t[6] = i[6], t[7] = i[7], t[8] = i[8], t[9] = i[9], t[10] = i[10], t[11] = i[11], t[12] = i[12], t[13] = i[13], t[14] = i[14], t[15] = i[15], this; } copyPosition(e) { const t = this.elements, i = e.elements; return t[12] = i[12], t[13] = i[13], t[14] = i[14], this; } setFromMatrix3(e) { const t = e.elements; return this.set( t[0], t[3], t[6], 0, t[1], t[4], t[7], 0, t[2], t[5], t[8], 0, 0, 0, 0, 1 ), this; } extractBasis(e, t, i) { return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), i.setFromMatrixColumn(this, 2), this; } makeBasis(e, t, i) { return this.set( e.x, t.x, i.x, 0, e.y, t.y, i.y, 0, e.z, t.z, i.z, 0, 0, 0, 0, 1 ), this; } extractRotation(e) { const t = this.elements, i = e.elements, r = 1 / Ys.setFromMatrixColumn(e, 0).length(), s = 1 / Ys.setFromMatrixColumn(e, 1).length(), o = 1 / Ys.setFromMatrixColumn(e, 2).length(); return t[0] = i[0] * r, t[1] = i[1] * r, t[2] = i[2] * r, t[3] = 0, t[4] = i[4] * s, t[5] = i[5] * s, t[6] = i[6] * s, t[7] = 0, t[8] = i[8] * o, t[9] = i[9] * o, t[10] = i[10] * o, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; } makeRotationFromEuler(e) { e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); const t = this.elements, i = e.x, r = e.y, s = e.z, o = Math.cos(i), a = Math.sin(i), c = Math.cos(r), l = Math.sin(r), d = Math.cos(s), h = Math.sin(s); if (e.order === "XYZ") { const f = o * d, g = o * h, p = a * d, u = a * h; t[0] = c * d, t[4] = -c * h, t[8] = l, t[1] = g + p * l, t[5] = f - u * l, t[9] = -a * c, t[2] = u - f * l, t[6] = p + g * l, t[10] = o * c; } else if (e.order === "YXZ") { const f = c * d, g = c * h, p = l * d, u = l * h; t[0] = f + u * a, t[4] = p * a - g, t[8] = o * l, t[1] = o * h, t[5] = o * d, t[9] = -a, t[2] = g * a - p, t[6] = u + f * a, t[10] = o * c; } else if (e.order === "ZXY") { const f = c * d, g = c * h, p = l * d, u = l * h; t[0] = f - u * a, t[4] = -o * h, t[8] = p + g * a, t[1] = g + p * a, t[5] = o * d, t[9] = u - f * a, t[2] = -o * l, t[6] = a, t[10] = o * c; } else if (e.order === "ZYX") { const f = o * d, g = o * h, p = a * d, u = a * h; t[0] = c * d, t[4] = p * l - g, t[8] = f * l + u, t[1] = c * h, t[5] = u * l + f, t[9] = g * l - p, t[2] = -l, t[6] = a * c, t[10] = o * c; } else if (e.order === "YZX") { const f = o * c, g = o * l, p = a * c, u = a * l; t[0] = c * d, t[4] = u - f * h, t[8] = p * h + g, t[1] = h, t[5] = o * d, t[9] = -a * d, t[2] = -l * d, t[6] = g * h + p, t[10] = f - u * h; } else if (e.order === "XZY") { const f = o * c, g = o * l, p = a * c, u = a * l; t[0] = c * d, t[4] = -h, t[8] = l * d, t[1] = f * h + u, t[5] = o * d, t[9] = g * h - p, t[2] = p * h - g, t[6] = a * d, t[10] = u * h + f; } return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this; } makeRotationFromQuaternion(e) { return this.compose(dF, e, fF); } lookAt(e, t, i) { const r = this.elements; return Bn.subVectors(e, t), Bn.lengthSq() === 0 && (Bn.z = 1), Bn.normalize(), xr.crossVectors(i, Bn), xr.lengthSq() === 0 && (Math.abs(i.z) === 1 ? Bn.x += 1e-4 : Bn.z += 1e-4, Bn.normalize(), xr.crossVectors(i, Bn)), xr.normalize(), Ul.crossVectors(Bn, xr), r[0] = xr.x, r[4] = Ul.x, r[8] = Bn.x, r[1] = xr.y, r[5] = Ul.y, r[9] = Bn.y, r[2] = xr.z, r[6] = Ul.z, r[10] = Bn.z, this; } multiply(e, t) { return t !== void 0 ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e); } premultiply(e) { return this.multiplyMatrices(e, this); } multiplyMatrices(e, t) { const i = e.elements, r = t.elements, s = this.elements, o = i[0], a = i[4], c = i[8], l = i[12], d = i[1], h = i[5], f = i[9], g = i[13], p = i[2], u = i[6], y = i[10], v = i[14], m = i[3], x = i[7], w = i[11], A = i[15], M = r[0], R = r[4], L = r[8], S = r[12], I = r[1], T = r[5], _ = r[9], E = r[13], C = r[2], P = r[6], b = r[10], F = r[14], D = r[3], N = r[7], B = r[11], U = r[15]; return s[0] = o * M + a * I + c * C + l * D, s[4] = o * R + a * T + c * P + l * N, s[8] = o * L + a * _ + c * b + l * B, s[12] = o * S + a * E + c * F + l * U, s[1] = d * M + h * I + f * C + g * D, s[5] = d * R + h * T + f * P + g * N, s[9] = d * L + h * _ + f * b + g * B, s[13] = d * S + h * E + f * F + g * U, s[2] = p * M + u * I + y * C + v * D, s[6] = p * R + u * T + y * P + v * N, s[10] = p * L + u * _ + y * b + v * B, s[14] = p * S + u * E + y * F + v * U, s[3] = m * M + x * I + w * C + A * D, s[7] = m * R + x * T + w * P + A * N, s[11] = m * L + x * _ + w * b + A * B, s[15] = m * S + x * E + w * F + A * U, this; } multiplyScalar(e) { const t = this.elements; return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this; } determinant() { const e = this.elements, t = e[0], i = e[4], r = e[8], s = e[12], o = e[1], a = e[5], c = e[9], l = e[13], d = e[2], h = e[6], f = e[10], g = e[14], p = e[3], u = e[7], y = e[11], v = e[15]; return p * (+s * c * h - r * l * h - s * a * f + i * l * f + r * a * g - i * c * g) + u * (+t * c * g - t * l * f + s * o * f - r * o * g + r * l * d - s * c * d) + y * (+t * l * h - t * a * g - s * o * h + i * o * g + s * a * d - i * l * d) + v * (-r * a * d - t * c * h + t * a * f + r * o * h - i * o * f + i * c * d); } transpose() { const e = this.elements; let t; return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this; } setPosition(e, t, i) { const r = this.elements; return e.isVector3 ? (r[12] = e.x, r[13] = e.y, r[14] = e.z) : (r[12] = e, r[13] = t, r[14] = i), this; } invert() { const e = this.elements, t = e[0], i = e[1], r = e[2], s = e[3], o = e[4], a = e[5], c = e[6], l = e[7], d = e[8], h = e[9], f = e[10], g = e[11], p = e[12], u = e[13], y = e[14], v = e[15], m = h * y * l - u * f * l + u * c * g - a * y * g - h * c * v + a * f * v, x = p * f * l - d * y * l - p * c * g + o * y * g + d * c * v - o * f * v, w = d * u * l - p * h * l + p * a * g - o * u * g - d * a * v + o * h * v, A = p * h * c - d * u * c - p * a * f + o * u * f + d * a * y - o * h * y, M = t * m + i * x + r * w + s * A; if (M === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); const R = 1 / M; return e[0] = m * R, e[1] = (u * f * s - h * y * s - u * r * g + i * y * g + h * r * v - i * f * v) * R, e[2] = (a * y * s - u * c * s + u * r * l - i * y * l - a * r * v + i * c * v) * R, e[3] = (h * c * s - a * f * s - h * r * l + i * f * l + a * r * g - i * c * g) * R, e[4] = x * R, e[5] = (d * y * s - p * f * s + p * r * g - t * y * g - d * r * v + t * f * v) * R, e[6] = (p * c * s - o * y * s - p * r * l + t * y * l + o * r * v - t * c * v) * R, e[7] = (o * f * s - d * c * s + d * r * l - t * f * l - o * r * g + t * c * g) * R, e[8] = w * R, e[9] = (p * h * s - d * u * s - p * i * g + t * u * g + d * i * v - t * h * v) * R, e[10] = (o * u * s - p * a * s + p * i * l - t * u * l - o * i * v + t * a * v) * R, e[11] = (d * a * s - o * h * s - d * i * l + t * h * l + o * i * g - t * a * g) * R, e[12] = A * R, e[13] = (d * u * r - p * h * r + p * i * f - t * u * f - d * i * y + t * h * y) * R, e[14] = (p * a * r - o * u * r - p * i * c + t * u * c + o * i * y - t * a * y) * R, e[15] = (o * h * r - d * a * r + d * i * c - t * h * c - o * i * f + t * a * f) * R, this; } scale(e) { const t = this.elements, i = e.x, r = e.y, s = e.z; return t[0] *= i, t[4] *= r, t[8] *= s, t[1] *= i, t[5] *= r, t[9] *= s, t[2] *= i, t[6] *= r, t[10] *= s, t[3] *= i, t[7] *= r, t[11] *= s, this; } getMaxScaleOnAxis() { const e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], i = e[4] * e[4] + e[5] * e[5] + e[6] * e[6], r = e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; return Math.sqrt(Math.max(t, i, r)); } makeTranslation(e, t, i) { return this.set( 1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, i, 0, 0, 0, 1 ), this; } makeRotationX(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( 1, 0, 0, 0, 0, t, -i, 0, 0, i, t, 0, 0, 0, 0, 1 ), this; } makeRotationY(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( t, 0, i, 0, 0, 1, 0, 0, -i, 0, t, 0, 0, 0, 0, 1 ), this; } makeRotationZ(e) { const t = Math.cos(e), i = Math.sin(e); return this.set( t, -i, 0, 0, i, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ), this; } makeRotationAxis(e, t) { const i = Math.cos(t), r = Math.sin(t), s = 1 - i, o = e.x, a = e.y, c = e.z, l = s * o, d = s * a; return this.set( l * o + i, l * a - r * c, l * c + r * a, 0, l * a + r * c, d * a + i, d * c - r * o, 0, l * c - r * a, d * c + r * o, s * c * c + i, 0, 0, 0, 0, 1 ), this; } makeScale(e, t, i) { return this.set( e, 0, 0, 0, 0, t, 0, 0, 0, 0, i, 0, 0, 0, 0, 1 ), this; } makeShear(e, t, i, r, s, o) { return this.set( 1, i, s, 0, e, 1, o, 0, t, r, 1, 0, 0, 0, 0, 1 ), this; } compose(e, t, i) { const r = this.elements, s = t._x, o = t._y, a = t._z, c = t._w, l = s + s, d = o + o, h = a + a, f = s * l, g = s * d, p = s * h, u = o * d, y = o * h, v = a * h, m = c * l, x = c * d, w = c * h, A = i.x, M = i.y, R = i.z; return r[0] = (1 - (u + v)) * A, r[1] = (g + w) * A, r[2] = (p - x) * A, r[3] = 0, r[4] = (g - w) * M, r[5] = (1 - (f + v)) * M, r[6] = (y + m) * M, r[7] = 0, r[8] = (p + x) * R, r[9] = (y - m) * R, r[10] = (1 - (f + u)) * R, r[11] = 0, r[12] = e.x, r[13] = e.y, r[14] = e.z, r[15] = 1, this; } decompose(e, t, i) { const r = this.elements; let s = Ys.set(r[0], r[1], r[2]).length(); const o = Ys.set(r[4], r[5], r[6]).length(), a = Ys.set(r[8], r[9], r[10]).length(); this.determinant() < 0 && (s = -s), e.x = r[12], e.y = r[13], e.z = r[14], ri.copy(this); const l = 1 / s, d = 1 / o, h = 1 / a; return ri.elements[0] *= l, ri.elements[1] *= l, ri.elements[2] *= l, ri.elements[4] *= d, ri.elements[5] *= d, ri.elements[6] *= d, ri.elements[8] *= h, ri.elements[9] *= h, ri.elements[10] *= h, t.setFromRotationMatrix(ri), i.x = s, i.y = o, i.z = a, this; } makePerspective(e, t, i, r, s, o) { o === void 0 && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); const a = this.elements, c = 2 * s / (t - e), l = 2 * s / (i - r), d = (t + e) / (t - e), h = (i + r) / (i - r), f = -(o + s) / (o - s), g = -2 * o * s / (o - s); return a[0] = c, a[4] = 0, a[8] = d, a[12] = 0, a[1] = 0, a[5] = l, a[9] = h, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = f, a[14] = g, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this; } makeOrthographic(e, t, i, r, s, o) { const a = this.elements, c = 1 / (t - e), l = 1 / (i - r), d = 1 / (o - s), h = (t + e) * c, f = (i + r) * l, g = (o + s) * d; return a[0] = 2 * c, a[4] = 0, a[8] = 0, a[12] = -h, a[1] = 0, a[5] = 2 * l, a[9] = 0, a[13] = -f, a[2] = 0, a[6] = 0, a[10] = -2 * d, a[14] = -g, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this; } equals(e) { const t = this.elements, i = e.elements; for (let r = 0; r < 16; r++) if (t[r] !== i[r]) return !1; return !0; } fromArray(e, t = 0) { for (let i = 0; i < 16; i++) this.elements[i] = e[i + t]; return this; } toArray(e = [], t = 0) { const i = this.elements; return e[t] = i[0], e[t + 1] = i[1], e[t + 2] = i[2], e[t + 3] = i[3], e[t + 4] = i[4], e[t + 5] = i[5], e[t + 6] = i[6], e[t + 7] = i[7], e[t + 8] = i[8], e[t + 9] = i[9], e[t + 10] = i[10], e[t + 11] = i[11], e[t + 12] = i[12], e[t + 13] = i[13], e[t + 14] = i[14], e[t + 15] = i[15], e; } } Xe.prototype.isMatrix4 = !0; const Ys = /* @__PURE__ */ new q(), ri = /* @__PURE__ */ new Xe(), dF = /* @__PURE__ */ new q(0, 0, 0), fF = /* @__PURE__ */ new q(1, 1, 1), xr = /* @__PURE__ */ new q(), Ul = /* @__PURE__ */ new q(), Bn = /* @__PURE__ */ new q(), Xm = /* @__PURE__ */ new Xe(), Ym = /* @__PURE__ */ new bn(); class Us { constructor(e = 0, t = 0, i = 0, r = Us.DefaultOrder) { this._x = e, this._y = t, this._z = i, this._order = r; } get x() { return this._x; } set x(e) { this._x = e, this._onChangeCallback(); } get y() { return this._y; } set y(e) { this._y = e, this._onChangeCallback(); } get z() { return this._z; } set z(e) { this._z = e, this._onChangeCallback(); } get order() { return this._order; } set order(e) { this._order = e, this._onChangeCallback(); } set(e, t, i, r = this._order) { return this._x = e, this._y = t, this._z = i, this._order = r, this._onChangeCallback(), this; } clone() { return new this.constructor(this._x, this._y, this._z, this._order); } copy(e) { return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this; } setFromRotationMatrix(e, t = this._order, i = !0) { const r = e.elements, s = r[0], o = r[4], a = r[8], c = r[1], l = r[5], d = r[9], h = r[2], f = r[6], g = r[10]; switch (t) { case "XYZ": this._y = Math.asin(gn(a, -1, 1)), Math.abs(a) < 0.9999999 ? (this._x = Math.atan2(-d, g), this._z = Math.atan2(-o, s)) : (this._x = Math.atan2(f, l), this._z = 0); break; case "YXZ": this._x = Math.asin(-gn(d, -1, 1)), Math.abs(d) < 0.9999999 ? (this._y = Math.atan2(a, g), this._z = Math.atan2(c, l)) : (this._y = Math.atan2(-h, s), this._z = 0); break; case "ZXY": this._x = Math.asin(gn(f, -1, 1)), Math.abs(f) < 0.9999999 ? (this._y = Math.atan2(-h, g), this._z = Math.atan2(-o, l)) : (this._y = 0, this._z = Math.atan2(c, s)); break; case "ZYX": this._y = Math.asin(-gn(h, -1, 1)), Math.abs(h) < 0.9999999 ? (this._x = Math.atan2(f, g), this._z = Math.atan2(c, s)) : (this._x = 0, this._z = Math.atan2(-o, l)); break; case "YZX": this._z = Math.asin(gn(c, -1, 1)), Math.abs(c) < 0.9999999 ? (this._x = Math.atan2(-d, l), this._y = Math.atan2(-h, s)) : (this._x = 0, this._y = Math.atan2(a, g)); break; case "XZY": this._z = Math.asin(-gn(o, -1, 1)), Math.abs(o) < 0.9999999 ? (this._x = Math.atan2(f, l), this._y = Math.atan2(a, s)) : (this._x = Math.atan2(-d, g), this._y = 0); break; default: console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t); } return this._order = t, i === !0 && this._onChangeCallback(), this; } setFromQuaternion(e, t, i) { return Xm.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Xm, t, i); } setFromVector3(e, t = this._order) { return this.set(e.x, e.y, e.z, t); } reorder(e) { return Ym.setFromEuler(this), this.setFromQuaternion(Ym, e); } equals(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order; } fromArray(e) { return this._x = e[0], this._y = e[1], this._z = e[2], e[3] !== void 0 && (this._order = e[3]), this._onChangeCallback(), this; } toArray(e = [], t = 0) { return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e; } toVector3(e) { return e ? e.set(this._x, this._y, this._z) : new q(this._x, this._y, this._z); } _onChange(e) { return this._onChangeCallback = e, this; } _onChangeCallback() { } } Us.prototype.isEuler = !0; Us.DefaultOrder = "XYZ"; Us.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"]; class Cf { constructor() { this.mask = 1; } set(e) { this.mask = 1 << e | 0; } enable(e) { this.mask |= 1 << e | 0; } enableAll() { this.mask = -1; } toggle(e) { this.mask ^= 1 << e | 0; } disable(e) { this.mask &= ~(1 << e | 0); } disableAll() { this.mask = 0; } test(e) { return (this.mask & e.mask) !== 0; } } let pF = 0; const Jm = /* @__PURE__ */ new q(), Js = /* @__PURE__ */ new bn(), ji = /* @__PURE__ */ new Xe(), zl = /* @__PURE__ */ new q(), fa = /* @__PURE__ */ new q(), mF = /* @__PURE__ */ new q(), gF = /* @__PURE__ */ new bn(), Km = /* @__PURE__ */ new q(1, 0, 0), qm = /* @__PURE__ */ new q(0, 1, 0), Qm = /* @__PURE__ */ new q(0, 0, 1), vF = { type: "added" }, eg = { type: "removed" }; class ut extends Kr { constructor() { super(), Object.defineProperty(this, "id", { value: pF++ }), this.uuid = Hn(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = ut.DefaultUp.clone(); const e = new q(), t = new Us(), i = new bn(), r = new q(1, 1, 1); function s() { i.setFromEuler(t, !1); } function o() { t.setFromQuaternion(i, void 0, !1); } t._onChange(s), i._onChange(o), Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, value: e }, rotation: { configurable: !0, enumerable: !0, value: t }, quaternion: { configurable: !0, enumerable: !0, value: i }, scale: { configurable: !0, enumerable: !0, value: r }, modelViewMatrix: { value: new Xe() }, normalMatrix: { value: new rn() } }), this.matrix = new Xe(), this.matrixWorld = new Xe(), this.matrixAutoUpdate = ut.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new Cf(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {}; } onBeforeRender() { } onAfterRender() { } applyMatrix4(e) { this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale); } applyQuaternion(e) { return this.quaternion.premultiply(e), this; } setRotationFromAxisAngle(e, t) { this.quaternion.setFromAxisAngle(e, t); } setRotationFromEuler(e) { this.quaternion.setFromEuler(e, !0); } setRotationFromMatrix(e) { this.quaternion.setFromRotationMatrix(e); } setRotationFromQuaternion(e) { this.quaternion.copy(e); } rotateOnAxis(e, t) { return Js.setFromAxisAngle(e, t), this.quaternion.multiply(Js), this; } rotateOnWorldAxis(e, t) { return Js.setFromAxisAngle(e, t), this.quaternion.premultiply(Js), this; } rotateX(e) { return this.rotateOnAxis(Km, e); } rotateY(e) { return this.rotateOnAxis(qm, e); } rotateZ(e) { return this.rotateOnAxis(Qm, e); } translateOnAxis(e, t) { return Jm.copy(e).applyQuaternion(this.quaternion), this.position.add(Jm.multiplyScalar(t)), this; } translateX(e) { return this.translateOnAxis(Km, e); } translateY(e) { return this.translateOnAxis(qm, e); } translateZ(e) { return this.translateOnAxis(Qm, e); } localToWorld(e) { return e.applyMatrix4(this.matrixWorld); } worldToLocal(e) { return e.applyMatrix4(ji.copy(this.matrixWorld).invert()); } lookAt(e, t, i) { e.isVector3 ? zl.copy(e) : zl.set(e, t, i); const r = this.parent; this.updateWorldMatrix(!0, !1), fa.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? ji.lookAt(fa, zl, this.up) : ji.lookAt(zl, fa, this.up), this.quaternion.setFromRotationMatrix(ji), r && (ji.extractRotation(r.matrixWorld), Js.setFromRotationMatrix(ji), this.quaternion.premultiply(Js.invert())); } add(e) { if (arguments.length > 1) { for (let t = 0; t < arguments.length; t++) this.add(arguments[t]); return this; } return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.parent !== null && e.parent.remove(e), e.parent = this, this.children.push(e), e.dispatchEvent(vF)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this); } remove(e) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) this.remove(arguments[i]); return this; } const t = this.children.indexOf(e); return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(eg)), this; } removeFromParent() { const e = this.parent; return e !== null && e.remove(this), this; } clear() { for (let e = 0; e < this.children.length; e++) { const t = this.children[e]; t.parent = null, t.dispatchEvent(eg); } return this.children.length = 0, this; } attach(e) { return this.updateWorldMatrix(!0, !1), ji.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), ji.multiply(e.parent.matrixWorld)), e.applyMatrix4(ji), this.add(e), e.updateWorldMatrix(!1, !0), this; } getObjectById(e) { return this.getObjectByProperty("id", e); } getObjectByName(e) { return this.getObjectByProperty("name", e); } getObjectByProperty(e, t) { if (this[e] === t) return this; for (let i = 0, r = this.children.length; i < r; i++) { const o = this.children[i].getObjectByProperty(e, t); if (o !== void 0) return o; } } getWorldPosition(e) { return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld); } getWorldQuaternion(e) { return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(fa, e, mF), e; } getWorldScale(e) { return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(fa, gF, e), e; } getWorldDirection(e) { this.updateWorldMatrix(!0, !1); const t = this.matrixWorld.elements; return e.set(t[8], t[9], t[10]).normalize(); } raycast() { } traverse(e) { e(this); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].traverse(e); } traverseVisible(e) { if (this.visible === !1) return; e(this); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].traverseVisible(e); } traverseAncestors(e) { const t = this.parent; t !== null && (e(t), t.traverseAncestors(e)); } updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0; } updateMatrixWorld(e) { this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, e = !0); const t = this.children; for (let i = 0, r = t.length; i < r; i++) t[i].updateMatrixWorld(e); } updateWorldMatrix(e, t) { const i = this.parent; if (e === !0 && i !== null && i.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), t === !0) { const r = this.children; for (let s = 0, o = r.length; s < o; s++) r[s].updateWorldMatrix(!1, !0); } } toJSON(e) { const t = e === void 0 || typeof e == "string", i = {}; t && (e = { geometries: {}, materials: {}, textures: {}, images: {}, shapes: {}, skeletons: {}, animations: {} }, i.metadata = { version: 4.5, type: "Object", generator: "Object3D.toJSON" }); const r = {}; r.uuid = this.uuid, r.type = this.type, this.name !== "" && (r.name = this.name), this.castShadow === !0 && (r.castShadow = !0), this.receiveShadow === !0 && (r.receiveShadow = !0), this.visible === !1 && (r.visible = !1), this.frustumCulled === !1 && (r.frustumCulled = !1), this.renderOrder !== 0 && (r.renderOrder = this.renderOrder), JSON.stringify(this.userData) !== "{}" && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), this.matrixAutoUpdate === !1 && (r.matrixAutoUpdate = !1), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON())); function s(a, c) { return a[c.uuid] === void 0 && (a[c.uuid] = c.toJSON(e)), c.uuid; } if (this.isScene) this.background && (this.background.isColor ? r.background = this.background.toJSON() : this.background.isTexture && (r.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && (r.environment = this.environment.toJSON(e).uuid); else if (this.isMesh || this.isLine || this.isPoints) { r.geometry = s(e.geometries, this.geometry); const a = this.geometry.parameters; if (a !== void 0 && a.shapes !== void 0) { const c = a.shapes; if (Array.isArray(c)) for (let l = 0, d = c.length; l < d; l++) { const h = c[l]; s(e.shapes, h); } else s(e.shapes, c); } } if (this.isSkinnedMesh && (r.bindMode = this.bindMode, r.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (s(e.skeletons, this.skeleton), r.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) { const a = []; for (let c = 0, l = this.material.length; c < l; c++) a.push(s(e.materials, this.material[c])); r.material = a; } else r.material = s(e.materials, this.material); if (this.children.length > 0) { r.children = []; for (let a = 0; a < this.children.length; a++) r.children.push(this.children[a].toJSON(e).object); } if (this.animations.length > 0) { r.animations = []; for (let a = 0; a < this.animations.length; a++) { const c = this.animations[a]; r.animations.push(s(e.animations, c)); } } if (t) { const a = o(e.geometries), c = o(e.materials), l = o(e.textures), d = o(e.images), h = o(e.shapes), f = o(e.skeletons), g = o(e.animations); a.length > 0 && (i.geometries = a), c.length > 0 && (i.materials = c), l.length > 0 && (i.textures = l), d.length > 0 && (i.images = d), h.length > 0 && (i.shapes = h), f.length > 0 && (i.skeletons = f), g.length > 0 && (i.animations = g); } return i.object = r, i; function o(a) { const c = []; for (const l in a) { const d = a[l]; delete d.metadata, c.push(d); } return c; } } clone(e) { return new this.constructor().copy(this, e); } copy(e, t = !0) { if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0) for (let i = 0; i < e.children.length; i++) { const r = e.children[i]; this.add(r.clone()); } return this; } } ut.DefaultUp = new q(0, 1, 0); ut.DefaultMatrixAutoUpdate = !0; ut.prototype.isObject3D = !0; const si = /* @__PURE__ */ new q(), $i = /* @__PURE__ */ new q(), th = /* @__PURE__ */ new q(), Zi = /* @__PURE__ */ new q(), Ks = /* @__PURE__ */ new q(), qs = /* @__PURE__ */ new q(), tg = /* @__PURE__ */ new q(), nh = /* @__PURE__ */ new q(), ih = /* @__PURE__ */ new q(), rh = /* @__PURE__ */ new q(); class Zt { constructor(e = new q(), t = new q(), i = new q()) { this.a = e, this.b = t, this.c = i; } static getNormal(e, t, i, r) { r.subVectors(i, t), si.subVectors(e, t), r.cross(si); const s = r.lengthSq(); return s > 0 ? r.multiplyScalar(1 / Math.sqrt(s)) : r.set(0, 0, 0); } // static/instance method to calculate barycentric coordinates // based on: http://www.blackpawn.com/texts/pointinpoly/default.html static getBarycoord(e, t, i, r, s) { si.subVectors(r, t), $i.subVectors(i, t), th.subVectors(e, t); const o = si.dot(si), a = si.dot($i), c = si.dot(th), l = $i.dot($i), d = $i.dot(th), h = o * l - a * a; if (h === 0) return s.set(-2, -1, -1); const f = 1 / h, g = (l * c - a * d) * f, p = (o * d - a * c) * f; return s.set(1 - g - p, p, g); } static containsPoint(e, t, i, r) { return this.getBarycoord(e, t, i, r, Zi), Zi.x >= 0 && Zi.y >= 0 && Zi.x + Zi.y <= 1; } static getUV(e, t, i, r, s, o, a, c) { return this.getBarycoord(e, t, i, r, Zi), c.set(0, 0), c.addScaledVector(s, Zi.x), c.addScaledVector(o, Zi.y), c.addScaledVector(a, Zi.z), c; } static isFrontFacing(e, t, i, r) { return si.subVectors(i, t), $i.subVectors(e, t), si.cross($i).dot(r) < 0; } set(e, t, i) { return this.a.copy(e), this.b.copy(t), this.c.copy(i), this; } setFromPointsAndIndices(e, t, i, r) { return this.a.copy(e[t]), this.b.copy(e[i]), this.c.copy(e[r]), this; } clone() { return new this.constructor().copy(this); } copy(e) { return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this; } getArea() { return si.subVectors(this.c, this.b), $i.subVectors(this.a, this.b), si.cross($i).length() * 0.5; } getMidpoint(e) { return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); } getNormal(e) { return Zt.getNormal(this.a, this.b, this.c, e); } getPlane(e) { return e.setFromCoplanarPoints(this.a, this.b, this.c); } getBarycoord(e, t) { return Zt.getBarycoord(e, this.a, this.b, this.c, t); } getUV(e, t, i, r, s) { return Zt.getUV(e, this.a, this.b, this.c, t, i, r, s); } containsPoint(e) { return Zt.containsPoint(e, this.a, this.b, this.c); } isFrontFacing(e) { return Zt.isFrontFacing(this.a, this.b, this.c, e); } intersectsBox(e) { return e.intersectsTriangle(this); } closestPointToPoint(e, t) { const i = this.a, r = this.b, s = this.c; let o, a; Ks.subVectors(r, i), qs.subVectors(s, i), nh.subVectors(e, i); const c = Ks.dot(nh), l = qs.dot(nh); if (c <= 0 && l <= 0) return t.copy(i); ih.subVectors(e, r); const d = Ks.dot(ih), h = qs.dot(ih); if (d >= 0 && h <= d) return t.copy(r); const f = c * h - d * l; if (f <= 0 && c >= 0 && d <= 0) return o = c / (c - d), t.copy(i).addScaledVector(Ks, o); rh.subVectors(e, s); const g = Ks.dot(rh), p = qs.dot(rh); if (p >= 0 && g <= p) return t.copy(s); const u = g * l - c * p; if (u <= 0 && l >= 0 && p <= 0) return a = l / (l - p), t.copy(i).addScaledVector(qs, a); const y = d * p - g * h; if (y <= 0 && h - d >= 0 && g - p >= 0) return tg.subVectors(s, r), a = (h - d) / (h - d + (g - p)), t.copy(r).addScaledVector(tg, a); const v = 1 / (y + u + f); return o = u * v, a = f * v, t.copy(i).addScaledVector(Ks, o).addScaledVector(qs, a); } equals(e) { return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c); } } let yF = 0; class tn extends Kr { constructor() { super(), Object.defineProperty(this, "id", { value: yF++ }), this.uuid = Hn(), this.name = "", this.type = "Material", this.fog = !0, this.blending = vo, this.side = Hr, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.blendSrc = bf, this.blendDst = xf, this.blendEquation = ps, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = Vc, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = qb, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = Lc, this.stencilZFail = Lc, this.stencilZPass = Lc, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaTest = 0, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0; } onBuild() { } onBeforeCompile() { } customProgramCacheKey() { return this.onBeforeCompile.toString(); } setValues(e) { if (e !== void 0) for (const t in e) { const i = e[t]; if (i === void 0) { console.warn("THREE.Material: '" + t + "' parameter is undefined."); continue; } if (t === "shading") { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = i === yf; continue; } const r = this[t]; if (r === void 0) { console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material."); continue; } r && r.isColor ? r.set(i) : r && r.isVector3 && i && i.isVector3 ? r.copy(i) : this[t] = i; } } toJSON(e) { const t = e === void 0 || typeof e == "string"; t && (e = { textures: {}, images: {} }); const i = { metadata: { version: 4.5, type: "Material", generator: "Material.toJSON" } }; i.uuid = this.uuid, i.type = this.type, this.name !== "" && (i.name = this.name), this.color && this.color.isColor && (i.color = this.color.getHex()), this.roughness !== void 0 && (i.roughness = this.roughness), this.metalness !== void 0 && (i.metalness = this.metalness), this.sheen && this.sheen.isColor && (i.sheen = this.sheen.getHex()), this.emissive && this.emissive.isColor && (i.emissive = this.emissive.getHex()), this.emissiveIntensity && this.emissiveIntensity !== 1 && (i.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (i.specular = this.specular.getHex()), this.shininess !== void 0 && (i.shininess = this.shininess), this.clearcoat !== void 0 && (i.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (i.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (i.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (i.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (i.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, i.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (i.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (i.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (i.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (i.lightMap = this.lightMap.toJSON(e).uuid, i.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (i.aoMap = this.aoMap.toJSON(e).uuid, i.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (i.bumpMap = this.bumpMap.toJSON(e).uuid, i.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (i.normalMap = this.normalMap.toJSON(e).uuid, i.normalMapType = this.normalMapType, i.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (i.displacementMap = this.displacementMap.toJSON(e).uuid, i.displacementScale = this.displacementScale, i.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (i.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (i.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (i.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (i.specularMap = this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (i.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (i.combine = this.combine)), this.envMapIntensity !== void 0 && (i.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (i.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (i.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (i.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (i.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (i.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (i.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (i.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && (i.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (i.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (i.size = this.size), this.shadowSide !== null && (i.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (i.sizeAttenuation = this.sizeAttenuation), this.blending !== vo && (i.blending = this.blending), this.side !== Hr && (i.side = this.side), this.vertexColors && (i.vertexColors = !0), this.opacity < 1 && (i.opacity = this.opacity), this.transparent === !0 && (i.transparent = this.transparent), i.depthFunc = this.depthFunc, i.depthTest = this.depthTest, i.depthWrite = this.depthWrite, i.colorWrite = this.colorWrite, i.stencilWrite = this.stencilWrite, i.stencilWriteMask = this.stencilWriteMask, i.stencilFunc = this.stencilFunc, i.stencilRef = this.stencilRef, i.stencilFuncMask = this.stencilFuncMask, i.stencilFail = this.stencilFail, i.stencilZFail = this.stencilZFail, i.stencilZPass = this.stencilZPass, this.rotation && this.rotation !== 0 && (i.rotation = this.rotation), this.polygonOffset === !0 && (i.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (i.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (i.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth && this.linewidth !== 1 && (i.linewidth = this.linewidth), this.dashSize !== void 0 && (i.dashSize = this.dashSize), this.gapSize !== void 0 && (i.gapSize = this.gapSize), this.scale !== void 0 && (i.scale = this.scale), this.dithering === !0 && (i.dithering = !0), this.alphaTest > 0 && (i.alphaTest = this.alphaTest), this.alphaToCoverage === !0 && (i.alphaToCoverage = this.alphaToCoverage), this.premultipliedAlpha === !0 && (i.premultipliedAlpha = this.premultipliedAlpha), this.wireframe === !0 && (i.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (i.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (i.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (i.wireframeLinejoin = this.wireframeLinejoin), this.morphTargets === !0 && (i.morphTargets = !0), this.morphNormals === !0 && (i.morphNormals = !0), this.flatShading === !0 && (i.flatShading = this.flatShading), this.visible === !1 && (i.visible = !1), this.toneMapped === !1 && (i.toneMapped = !1), JSON.stringify(this.userData) !== "{}" && (i.userData = this.userData); function r(s) { const o = []; for (const a in s) { const c = s[a]; delete c.metadata, o.push(c); } return o; } if (t) { const s = r(e.textures), o = r(e.images); s.length > 0 && (i.textures = s), o.length > 0 && (i.images = o); } return i; } clone() { return new this.constructor().copy(this); } copy(e) { this.name = e.name, this.fog = e.fog, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite; const t = e.clippingPlanes; let i = null; if (t !== null) { const r = t.length; i = new Array(r); for (let s = 0; s !== r; ++s) i[s] = t[s].clone(); } return this.clippingPlanes = i, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this; } dispose() { this.dispatchEvent({ type: "dispose" }); } set needsUpdate(e) { e === !0 && this.version++; } } tn.prototype.isMaterial = !0; const nx = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }, oi = { h: 0, s: 0, l: 0 }, Vl = { h: 0, s: 0, l: 0 }; function sh(n, e, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? n + (e - n) * 6 * t : t < 1 / 2 ? e : t < 2 / 3 ? n + (e - n) * 6 * (2 / 3 - t) : n; } function oh(n) { return n < 0.04045 ? n * 0.0773993808 : Math.pow(n * 0.9478672986 + 0.0521327014, 2.4); } function ah(n) { return n < 31308e-7 ? n * 12.92 : 1.055 * Math.pow(n, 0.41666) - 0.055; } class Ue { constructor(e, t, i) { return t === void 0 && i === void 0 ? this.set(e) : this.setRGB(e, t, i); } set(e) { return e && e.isColor ? this.copy(e) : typeof e == "number" ? this.setHex(e) : typeof e == "string" && this.setStyle(e), this; } setScalar(e) { return this.r = e, this.g = e, this.b = e, this; } setHex(e) { return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, this; } setRGB(e, t, i) { return this.r = e, this.g = t, this.b = i, this; } setHSL(e, t, i) { if (e = Tf(e, 1), t = gn(t, 0, 1), i = gn(i, 0, 1), t === 0) this.r = this.g = this.b = i; else { const r = i <= 0.5 ? i * (1 + t) : i + t - i * t, s = 2 * i - r; this.r = sh(s, r, e + 1 / 3), this.g = sh(s, r, e), this.b = sh(s, r, e - 1 / 3); } return this; } setStyle(e) { function t(r) { r !== void 0 && parseFloat(r) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored."); } let i; if (i = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)) { let r; const s = i[1], o = i[2]; switch (s) { case "rgb": case "rgba": if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return this.r = Math.min(255, parseInt(r[1], 10)) / 255, this.g = Math.min(255, parseInt(r[2], 10)) / 255, this.b = Math.min(255, parseInt(r[3], 10)) / 255, t(r[4]), this; if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return this.r = Math.min(100, parseInt(r[1], 10)) / 100, this.g = Math.min(100, parseInt(r[2], 10)) / 100, this.b = Math.min(100, parseInt(r[3], 10)) / 100, t(r[4]), this; break; case "hsl": case "hsla": if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) { const a = parseFloat(r[1]) / 360, c = parseInt(r[2], 10) / 100, l = parseInt(r[3], 10) / 100; return t(r[4]), this.setHSL(a, c, l); } break; } } else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) { const r = i[1], s = r.length; if (s === 3) return this.r = parseInt(r.charAt(0) + r.charAt(0), 16) / 255, this.g = parseInt(r.charAt(1) + r.charAt(1), 16) / 255, this.b = parseInt(r.charAt(2) + r.charAt(2), 16) / 255, this; if (s === 6) return this.r = parseInt(r.charAt(0) + r.charAt(1), 16) / 255, this.g = parseInt(r.charAt(2) + r.charAt(3), 16) / 255, this.b = parseInt(r.charAt(4) + r.charAt(5), 16) / 255, this; } return e && e.length > 0 ? this.setColorName(e) : this; } setColorName(e) { const t = nx[e.toLowerCase()]; return t !== void 0 ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e), this; } clone() { return new this.constructor(this.r, this.g, this.b); } copy(e) { return this.r = e.r, this.g = e.g, this.b = e.b, this; } copyGammaToLinear(e, t = 2) { return this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this; } copyLinearToGamma(e, t = 2) { const i = t > 0 ? 1 / t : 1; return this.r = Math.pow(e.r, i), this.g = Math.pow(e.g, i), this.b = Math.pow(e.b, i), this; } convertGammaToLinear(e) { return this.copyGammaToLinear(this, e), this; } convertLinearToGamma(e) { return this.copyLinearToGamma(this, e), this; } copySRGBToLinear(e) { return this.r = oh(e.r), this.g = oh(e.g), this.b = oh(e.b), this; } copyLinearToSRGB(e) { return this.r = ah(e.r), this.g = ah(e.g), this.b = ah(e.b), this; } convertSRGBToLinear() { return this.copySRGBToLinear(this), this; } convertLinearToSRGB() { return this.copyLinearToSRGB(this), this; } getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; } getHexString() { return ("000000" + this.getHex().toString(16)).slice(-6); } getHSL(e) { const t = this.r, i = this.g, r = this.b, s = Math.max(t, i, r), o = Math.min(t, i, r); let a, c; const l = (o + s) / 2; if (o === s) a = 0, c = 0; else { const d = s - o; switch (c = l <= 0.5 ? d / (s + o) : d / (2 - s - o), s) { case t: a = (i - r) / d + (i < r ? 6 : 0); break; case i: a = (r - t) / d + 2; break; case r: a = (t - i) / d + 4; break; } a /= 6; } return e.h = a, e.s = c, e.l = l, e; } getStyle() { return "rgb(" + (this.r * 255 | 0) + "," + (this.g * 255 | 0) + "," + (this.b * 255 | 0) + ")"; } offsetHSL(e, t, i) { return this.getHSL(oi), oi.h += e, oi.s += t, oi.l += i, this.setHSL(oi.h, oi.s, oi.l), this; } add(e) { return this.r += e.r, this.g += e.g, this.b += e.b, this; } addColors(e, t) { return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this; } addScalar(e) { return this.r += e, this.g += e, this.b += e, this; } sub(e) { return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this; } multiply(e) { return this.r *= e.r, this.g *= e.g, this.b *= e.b, this; } multiplyScalar(e) { return this.r *= e, this.g *= e, this.b *= e, this; } lerp(e, t) { return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this; } lerpColors(e, t, i) { return this.r = e.r + (t.r - e.r) * i, this.g = e.g + (t.g - e.g) * i, this.b = e.b + (t.b - e.b) * i, this; } lerpHSL(e, t) { this.getHSL(oi), e.getHSL(Vl); const i = Fa(oi.h, Vl.h, t), r = Fa(oi.s, Vl.s, t), s = Fa(oi.l, Vl.l, t); return this.setHSL(i, r, s), this; } equals(e) { return e.r === this.r && e.g === this.g && e.b === this.b; } fromArray(e, t = 0) { return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this; } toArray(e = [], t = 0) { return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e; } fromBufferAttribute(e, t) { return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), e.normalized === !0 && (this.r /= 255, this.g /= 255, this.b /= 255), this; } toJSON() { return this.getHex(); } } Ue.NAMES = nx; Ue.prototype.isColor = !0; Ue.prototype.r = 1; Ue.prototype.g = 1; Ue.prototype.b = 1; class In extends tn { constructor(e) { super(), this.type = "MeshBasicMaterial", this.color = new Ue(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this; } } In.prototype.isMeshBasicMaterial = !0; const St = /* @__PURE__ */ new q(), kl = /* @__PURE__ */ new Re(); class ot { constructor(e, t, i) { if (Array.isArray(e)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name = "", this.array = e, this.itemSize = t, this.count = e !== void 0 ? e.length / t : 0, this.normalized = i === !0, this.usage = Ro, this.updateRange = { offset: 0, count: -1 }, this.version = 0; } onUploadCallback() { } set needsUpdate(e) { e === !0 && this.version++; } setUsage(e) { return this.usage = e, this; } copy(e) { return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this; } copyAt(e, t, i) { e *= this.itemSize, i *= t.itemSize; for (let r = 0, s = this.itemSize; r < s; r++) this.array[e + r] = t.array[i + r]; return this; } copyArray(e) { return this.array.set(e), this; } copyColorsArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", r), o = new Ue()), t[i++] = o.r, t[i++] = o.g, t[i++] = o.b; } return this; } copyVector2sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", r), o = new Re()), t[i++] = o.x, t[i++] = o.y; } return this; } copyVector3sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", r), o = new q()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z; } return this; } copyVector4sArray(e) { const t = this.array; let i = 0; for (let r = 0, s = e.length; r < s; r++) { let o = e[r]; o === void 0 && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", r), o = new xt()), t[i++] = o.x, t[i++] = o.y, t[i++] = o.z, t[i++] = o.w; } return this; } applyMatrix3(e) { if (this.itemSize === 2) for (let t = 0, i = this.count; t < i; t++) 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++) St.fromBufferAttribute(this, t), St.applyMatrix3(e), this.setXYZ(t, St.x, St.y, St.z); return this; } applyMatrix4(e) { for (let t = 0, i = this.count; t < i; t++) St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.applyMatrix4(e), this.setXYZ(t, St.x, St.y, St.z); return this; } applyNormalMatrix(e) { for (let t = 0, i = this.count; t < i; t++) St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.applyNormalMatrix(e), this.setXYZ(t, St.x, St.y, St.z); return this; } transformDirection(e) { for (let t = 0, i = this.count; t < i; t++) St.x = this.getX(t), St.y = this.getY(t), St.z = this.getZ(t), St.transformDirection(e), this.setXYZ(t, St.x, St.y, St.z); return this; } set(e, t = 0) { return this.array.set(e, t), this; } getX(e) { return this.array[e * this.itemSize]; } setX(e, t) { return this.array[e * this.itemSize] = t, this; } getY(e) { return this.array[e * this.itemSize + 1]; } setY(e, t) { return this.array[e * this.itemSize + 1] = t, this; } getZ(e) { return this.array[e * this.itemSize + 2]; } setZ(e, t) { return this.array[e * this.itemSize + 2] = t, this; } getW(e) { return this.array[e * this.itemSize + 3]; } setW(e, t) { return this.array[e * this.itemSize + 3] = t, this; } setXY(e, t, i) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this; } setXYZ(e, t, i, r) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this; } setXYZW(e, t, i, r, s) { return e *= this.itemSize, this.array[e + 0] = t, this.array[e + 1] = i, this.array[e + 2] = r, this.array[e + 3] = s, this; } onUpload(e) { return this.onUploadCallback = e, this; } clone() { return new this.constructor(this.array, this.itemSize).copy(this); } toJSON() { const e = { itemSize: this.itemSize, type: this.array.constructor.name, array: Array.prototype.slice.call(this.array), normalized: this.normalized }; return this.name !== "" && (e.name = this.name), this.usage !== Ro && (e.usage = this.usage), (this.updateRange.offset !== 0 || this.updateRange.count !== -1) && (e.updateRange = this.updateRange), e; } } ot.prototype.isBufferAttribute = !0; class ix extends ot { constructor(e, t, i) { super(new Int8Array(e), t, i); } } class rx extends ot { constructor(e, t, i) { super(new Uint8Array(e), t, i); } } class sx extends ot { constructor(e, t, i) { super(new Uint8ClampedArray(e), t, i); } } class ox extends ot { constructor(e, t, i) { super(new Int16Array(e), t, i); } } class gu extends ot { constructor(e, t, i) { super(new Uint16Array(e), t, i); } } class ax extends ot { constructor(e, t, i) { super(new Int32Array(e), t, i); } } class vu extends ot { constructor(e, t, i) { super(new Uint32Array(e), t, i); } } class lx extends ot { constructor(e, t, i) { super(new Uint16Array(e), t, i); } } lx.prototype.isFloat16BufferAttribute = !0; class He extends ot { constructor(e, t, i) { super(new Float32Array(e), t, i); } } class cx extends ot { constructor(e, t, i) { super(new Float64Array(e), t, i); } } function ux(n) { if (n.length === 0) return -1 / 0; let e = n[0]; for (let t = 1, i = n.length; t < i; ++t) n[t] > e && (e = n[t]); return e; } const bF = { Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array }; function mo(n, e) { return new bF[n](e); } let xF = 0; const Xn = /* @__PURE__ */ new Xe(), lh = /* @__PURE__ */ new ut(), Qs = /* @__PURE__ */ new q(), Un = /* @__PURE__ */ new Nn(), pa = /* @__PURE__ */ new Nn(), cn = /* @__PURE__ */ new q(); class Ke extends Kr { constructor() { super(), Object.defineProperty(this, "id", { value: xF++ }), this.uuid = Hn(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { start: 0, count: 1 / 0 }, this.userData = {}; } getIndex() { return this.index; } setIndex(e) { return Array.isArray(e) ? this.index = new (ux(e) > 65535 ? vu : gu)(e, 1) : this.index = e, this; } getAttribute(e) { return this.attributes[e]; } setAttribute(e, t) { return this.attributes[e] = t, this; } deleteAttribute(e) { return delete this.attributes[e], this; } hasAttribute(e) { return this.attributes[e] !== void 0; } addGroup(e, t, i = 0) { this.groups.push({ start: e, count: t, materialIndex: i }); } clearGroups() { this.groups = []; } setDrawRange(e, t) { this.drawRange.start = e, this.drawRange.count = t; } applyMatrix4(e) { const t = this.attributes.position; t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0); const i = this.attributes.normal; if (i !== void 0) { const s = new rn().getNormalMatrix(e); i.applyNormalMatrix(s), i.needsUpdate = !0; } const r = this.attributes.tangent; return r !== void 0 && (r.transformDirection(e), r.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } applyQuaternion(e) { return Xn.makeRotationFromQuaternion(e), this.applyMatrix4(Xn), this; } rotateX(e) { return Xn.makeRotationX(e), this.applyMatrix4(Xn), this; } rotateY(e) { return Xn.makeRotationY(e), this.applyMatrix4(Xn), this; } rotateZ(e) { return Xn.makeRotationZ(e), this.applyMatrix4(Xn), this; } translate(e, t, i) { return Xn.makeTranslation(e, t, i), this.applyMatrix4(Xn), this; } scale(e, t, i) { return Xn.makeScale(e, t, i), this.applyMatrix4(Xn), this; } lookAt(e) { return lh.lookAt(e), lh.updateMatrix(), this.applyMatrix4(lh.matrix), this; } center() { return this.computeBoundingBox(), this.boundingBox.getCenter(Qs).negate(), this.translate(Qs.x, Qs.y, Qs.z), this; } setFromPoints(e) { const t = []; for (let i = 0, r = e.length; i < r; i++) { const s = e[i]; t.push(s.x, s.y, s.z || 0); } return this.setAttribute("position", new He(t, 3)), this; } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new Nn()); const e = this.attributes.position, t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingBox.set( new q(-1 / 0, -1 / 0, -1 / 0), new q(1 / 0, 1 / 0, 1 / 0) ); return; } if (e !== void 0) { if (this.boundingBox.setFromBufferAttribute(e), t) for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; Un.setFromBufferAttribute(s), this.morphTargetsRelative ? (cn.addVectors(this.boundingBox.min, Un.min), this.boundingBox.expandByPoint(cn), cn.addVectors(this.boundingBox.max, Un.max), this.boundingBox.expandByPoint(cn)) : (this.boundingBox.expandByPoint(Un.min), this.boundingBox.expandByPoint(Un.max)); } } else this.boundingBox.makeEmpty(); (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); } computeBoundingSphere() { this.boundingSphere === null && (this.boundingSphere = new pr()); const e = this.attributes.position, t = this.morphAttributes.position; if (e && e.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this), this.boundingSphere.set(new q(), 1 / 0); return; } if (e) { const i = this.boundingSphere.center; if (Un.setFromBufferAttribute(e), t) for (let s = 0, o = t.length; s < o; s++) { const a = t[s]; pa.setFromBufferAttribute(a), this.morphTargetsRelative ? (cn.addVectors(Un.min, pa.min), Un.expandByPoint(cn), cn.addVectors(Un.max, pa.max), Un.expandByPoint(cn)) : (Un.expandByPoint(pa.min), Un.expandByPoint(pa.max)); } Un.getCenter(i); let r = 0; for (let s = 0, o = e.count; s < o; s++) cn.fromBufferAttribute(e, s), r = Math.max(r, i.distanceToSquared(cn)); if (t) for (let s = 0, o = t.length; s < o; s++) { const a = t[s], c = this.morphTargetsRelative; for (let l = 0, d = a.count; l < d; l++) cn.fromBufferAttribute(a, l), c && (Qs.fromBufferAttribute(e, l), cn.add(Qs)), r = Math.max(r, i.distanceToSquared(cn)); } this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); } } computeFaceNormals() { } computeTangents() { const e = this.index, t = this.attributes; if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) { console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)"); return; } const i = e.array, r = t.position.array, s = t.normal.array, o = t.uv.array, a = r.length / 3; t.tangent === void 0 && this.setAttribute("tangent", new ot(new Float32Array(4 * a), 4)); const c = t.tangent.array, l = [], d = []; for (let I = 0; I < a; I++) l[I] = new q(), d[I] = new q(); const h = new q(), f = new q(), g = new q(), p = new Re(), u = new Re(), y = new Re(), v = new q(), m = new q(); function x(I, T, _) { h.fromArray(r, I * 3), f.fromArray(r, T * 3), g.fromArray(r, _ * 3), p.fromArray(o, I * 2), u.fromArray(o, T * 2), y.fromArray(o, _ * 2), f.sub(h), g.sub(h), u.sub(p), y.sub(p); const E = 1 / (u.x * y.y - y.x * u.y); isFinite(E) && (v.copy(f).multiplyScalar(y.y).addScaledVector(g, -u.y).multiplyScalar(E), m.copy(g).multiplyScalar(u.x).addScaledVector(f, -y.x).multiplyScalar(E), l[I].add(v), l[T].add(v), l[_].add(v), d[I].add(m), d[T].add(m), d[_].add(m)); } let w = this.groups; w.length === 0 && (w = [{ start: 0, count: i.length }]); for (let I = 0, T = w.length; I < T; ++I) { const _ = w[I], E = _.start, C = _.count; for (let P = E, b = E + C; P < b; P += 3) x( i[P + 0], i[P + 1], i[P + 2] ); } const A = new q(), M = new q(), R = new q(), L = new q(); function S(I) { R.fromArray(s, I * 3), L.copy(R); const T = l[I]; A.copy(T), A.sub(R.multiplyScalar(R.dot(T))).normalize(), M.crossVectors(L, T); const E = M.dot(d[I]) < 0 ? -1 : 1; c[I * 4] = A.x, c[I * 4 + 1] = A.y, c[I * 4 + 2] = A.z, c[I * 4 + 3] = E; } for (let I = 0, T = w.length; I < T; ++I) { const _ = w[I], E = _.start, C = _.count; for (let P = E, b = E + C; P < b; P += 3) S(i[P + 0]), S(i[P + 1]), S(i[P + 2]); } } computeVertexNormals() { const e = this.index, t = this.getAttribute("position"); if (t !== void 0) { let i = this.getAttribute("normal"); if (i === void 0) i = new ot(new Float32Array(t.count * 3), 3), this.setAttribute("normal", i); else for (let f = 0, g = i.count; f < g; f++) i.setXYZ(f, 0, 0, 0); const r = new q(), s = new q(), o = new q(), a = new q(), c = new q(), l = new q(), d = new q(), h = new q(); if (e) for (let f = 0, g = e.count; f < g; f += 3) { const p = e.getX(f + 0), u = e.getX(f + 1), y = e.getX(f + 2); r.fromBufferAttribute(t, p), s.fromBufferAttribute(t, u), o.fromBufferAttribute(t, y), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), a.fromBufferAttribute(i, p), c.fromBufferAttribute(i, u), l.fromBufferAttribute(i, y), a.add(d), c.add(d), l.add(d), i.setXYZ(p, a.x, a.y, a.z), i.setXYZ(u, c.x, c.y, c.z), i.setXYZ(y, l.x, l.y, l.z); } else for (let f = 0, g = t.count; f < g; f += 3) r.fromBufferAttribute(t, f + 0), s.fromBufferAttribute(t, f + 1), o.fromBufferAttribute(t, f + 2), d.subVectors(o, s), h.subVectors(r, s), d.cross(h), i.setXYZ(f + 0, d.x, d.y, d.z), i.setXYZ(f + 1, d.x, d.y, d.z), i.setXYZ(f + 2, d.x, d.y, d.z); this.normalizeNormals(), i.needsUpdate = !0; } } merge(e, t) { if (!(e && e.isBufferGeometry)) { console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e); return; } t === void 0 && (t = 0, console.warn( "THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge." )); const i = this.attributes; for (const r in i) { if (e.attributes[r] === void 0) continue; const o = i[r].array, a = e.attributes[r], c = a.array, l = a.itemSize * t, d = Math.min(c.length, o.length - l); for (let h = 0, f = l; h < d; h++, f++) o[f] = c[h]; } return this; } normalizeNormals() { const e = this.attributes.normal; for (let t = 0, i = e.count; t < i; t++) cn.fromBufferAttribute(e, t), cn.normalize(), e.setXYZ(t, cn.x, cn.y, cn.z); } toNonIndexed() { function e(a, c) { const l = a.array, d = a.itemSize, h = a.normalized, f = new l.constructor(c.length * d); let g = 0, p = 0; for (let u = 0, y = c.length; u < y; u++) { a.isInterleavedBufferAttribute ? g = c[u] * a.data.stride + a.offset : g = c[u] * d; for (let v = 0; v < d; v++) f[p++] = l[g++]; } return new ot(f, d, h); } if (this.index === null) return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this; const t = new Ke(), i = this.index.array, r = this.attributes; for (const a in r) { const c = r[a], l = e(c, i); t.setAttribute(a, l); } const s = this.morphAttributes; for (const a in s) { const c = [], l = s[a]; for (let d = 0, h = l.length; d < h; d++) { const f = l[d], g = e(f, i); c.push(g); } t.morphAttributes[a] = c; } t.morphTargetsRelative = this.morphTargetsRelative; const o = this.groups; for (let a = 0, c = o.length; a < c; a++) { const l = o[a]; t.addGroup(l.start, l.count, l.materialIndex); } return t; } toJSON() { const e = { metadata: { version: 4.5, type: "BufferGeometry", generator: "BufferGeometry.toJSON" } }; if (e.uuid = this.uuid, e.type = this.type, this.name !== "" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0) { const c = this.parameters; for (const l in c) c[l] !== void 0 && (e[l] = c[l]); return e; } e.data = { attributes: {} }; const t = this.index; t !== null && (e.data.index = { type: t.array.constructor.name, array: Array.prototype.slice.call(t.array) }); const i = this.attributes; for (const c in i) { const l = i[c]; e.data.attributes[c] = l.toJSON(e.data); } const r = {}; let s = !1; for (const c in this.morphAttributes) { const l = this.morphAttributes[c], d = []; for (let h = 0, f = l.length; h < f; h++) { const g = l[h]; d.push(g.toJSON(e.data)); } d.length > 0 && (r[c] = d, s = !0); } s && (e.data.morphAttributes = r, e.data.morphTargetsRelative = this.morphTargetsRelative); const o = this.groups; o.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(o))); const a = this.boundingSphere; return a !== null && (e.data.boundingSphere = { center: a.center.toArray(), radius: a.radius }), e; } clone() { return new Ke().copy(this); } copy(e) { this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null; const t = {}; this.name = e.name; const i = e.index; i !== null && this.setIndex(i.clone(t)); const r = e.attributes; for (const l in r) { const d = r[l]; this.setAttribute(l, d.clone(t)); } const s = e.morphAttributes; for (const l in s) { const d = [], h = s[l]; for (let f = 0, g = h.length; f < g; f++) d.push(h[f].clone(t)); this.morphAttributes[l] = d; } this.morphTargetsRelative = e.morphTargetsRelative; const o = e.groups; for (let l = 0, d = o.length; l < d; l++) { const h = o[l]; this.addGroup(h.start, h.count, h.materialIndex); } const a = e.boundingBox; a !== null && (this.boundingBox = a.clone()); const c = e.boundingSphere; return c !== null && (this.boundingSphere = c.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } } Ke.prototype.isBufferGeometry = !0; const ng = /* @__PURE__ */ new Xe(), eo = /* @__PURE__ */ new qr(), ch = /* @__PURE__ */ new pr(), Mr = /* @__PURE__ */ new q(), wr = /* @__PURE__ */ new q(), Ar = /* @__PURE__ */ new q(), uh = /* @__PURE__ */ new q(), hh = /* @__PURE__ */ new q(), dh = /* @__PURE__ */ new q(), Gl = /* @__PURE__ */ new q(), Hl = /* @__PURE__ */ new q(), Wl = /* @__PURE__ */ new q(), jl = /* @__PURE__ */ new Re(), $l = /* @__PURE__ */ new Re(), Zl = /* @__PURE__ */ new Re(), fh = /* @__PURE__ */ new q(), Xl = /* @__PURE__ */ new q(); class Xt extends ut { constructor(e = new Ke(), t = new In()) { super(), this.type = "Mesh", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = e.material, this.geometry = e.geometry, this; } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } raycast(e, t) { const i = this.geometry, r = this.material, s = this.matrixWorld; if (r === void 0 || (i.boundingSphere === null && i.computeBoundingSphere(), ch.copy(i.boundingSphere), ch.applyMatrix4(s), e.ray.intersectsSphere(ch) === !1) || (ng.copy(s).invert(), eo.copy(e.ray).applyMatrix4(ng), i.boundingBox !== null && eo.intersectsBox(i.boundingBox) === !1)) return; let o; if (i.isBufferGeometry) { const a = i.index, c = i.attributes.position, l = i.morphAttributes.position, d = i.morphTargetsRelative, h = i.attributes.uv, f = i.attributes.uv2, g = i.groups, p = i.drawRange; if (a !== null) if (Array.isArray(r)) for (let u = 0, y = g.length; u < y; u++) { const v = g[u], m = r[v.materialIndex], x = Math.max(v.start, p.start), w = Math.min(v.start + v.count, p.start + p.count); for (let A = x, M = w; A < M; A += 3) { const R = a.getX(A), L = a.getX(A + 1), S = a.getX(A + 2); o = Yl(this, m, e, eo, c, l, d, h, f, R, L, S), o && (o.faceIndex = Math.floor(A / 3), o.face.materialIndex = v.materialIndex, t.push(o)); } } else { const u = Math.max(0, p.start), y = Math.min(a.count, p.start + p.count); for (let v = u, m = y; v < m; v += 3) { const x = a.getX(v), w = a.getX(v + 1), A = a.getX(v + 2); o = Yl(this, r, e, eo, c, l, d, h, f, x, w, A), o && (o.faceIndex = Math.floor(v / 3), t.push(o)); } } else if (c !== void 0) if (Array.isArray(r)) for (let u = 0, y = g.length; u < y; u++) { const v = g[u], m = r[v.materialIndex], x = Math.max(v.start, p.start), w = Math.min(v.start + v.count, p.start + p.count); for (let A = x, M = w; A < M; A += 3) { const R = A, L = A + 1, S = A + 2; o = Yl(this, m, e, eo, c, l, d, h, f, R, L, S), o && (o.faceIndex = Math.floor(A / 3), o.face.materialIndex = v.materialIndex, t.push(o)); } } else { const u = Math.max(0, p.start), y = Math.min(c.count, p.start + p.count); for (let v = u, m = y; v < m; v += 3) { const x = v, w = v + 1, A = v + 2; o = Yl(this, r, e, eo, c, l, d, h, f, x, w, A), o && (o.faceIndex = Math.floor(v / 3), t.push(o)); } } } else i.isGeometry && console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } Xt.prototype.isMesh = !0; function MF(n, e, t, i, r, s, o, a) { let c; if (e.side === jt ? c = i.intersectTriangle(o, s, r, !0, a) : c = i.intersectTriangle(r, s, o, e.side !== Wr, a), c === null) return null; Xl.copy(a), Xl.applyMatrix4(n.matrixWorld); const l = t.ray.origin.distanceTo(Xl); return l < t.near || l > t.far ? null : { distance: l, point: Xl.clone(), object: n }; } function Yl(n, e, t, i, r, s, o, a, c, l, d, h) { Mr.fromBufferAttribute(r, l), wr.fromBufferAttribute(r, d), Ar.fromBufferAttribute(r, h); const f = n.morphTargetInfluences; if (e.morphTargets && s && f) { Gl.set(0, 0, 0), Hl.set(0, 0, 0), Wl.set(0, 0, 0); for (let p = 0, u = s.length; p < u; p++) { const y = f[p], v = s[p]; y !== 0 && (uh.fromBufferAttribute(v, l), hh.fromBufferAttribute(v, d), dh.fromBufferAttribute(v, h), o ? (Gl.addScaledVector(uh, y), Hl.addScaledVector(hh, y), Wl.addScaledVector(dh, y)) : (Gl.addScaledVector(uh.sub(Mr), y), Hl.addScaledVector(hh.sub(wr), y), Wl.addScaledVector(dh.sub(Ar), y))); } Mr.add(Gl), wr.add(Hl), Ar.add(Wl); } n.isSkinnedMesh && (n.boneTransform(l, Mr), n.boneTransform(d, wr), n.boneTransform(h, Ar)); const g = MF(n, e, t, i, Mr, wr, Ar, fh); if (g) { a && (jl.fromBufferAttribute(a, l), $l.fromBufferAttribute(a, d), Zl.fromBufferAttribute(a, h), g.uv = Zt.getUV(fh, Mr, wr, Ar, jl, $l, Zl, new Re())), c && (jl.fromBufferAttribute(c, l), $l.fromBufferAttribute(c, d), Zl.fromBufferAttribute(c, h), g.uv2 = Zt.getUV(fh, Mr, wr, Ar, jl, $l, Zl, new Re())); const p = { a: l, b: d, c: h, normal: new q(), materialIndex: 0 }; Zt.getNormal(Mr, wr, Ar, p.normal), g.face = p; } return g; } class sr extends Ke { constructor(e = 1, t = 1, i = 1, r = 1, s = 1, o = 1) { super(), this.type = "BoxGeometry", this.parameters = { width: e, height: t, depth: i, widthSegments: r, heightSegments: s, depthSegments: o }; const a = this; r = Math.floor(r), s = Math.floor(s), o = Math.floor(o); const c = [], l = [], d = [], h = []; let f = 0, g = 0; p("z", "y", "x", -1, -1, i, t, e, o, s, 0), p("z", "y", "x", 1, -1, i, t, -e, o, s, 1), p("x", "z", "y", 1, 1, e, i, t, r, o, 2), p("x", "z", "y", 1, -1, e, i, -t, r, o, 3), p("x", "y", "z", 1, -1, e, t, i, r, s, 4), p("x", "y", "z", -1, -1, e, t, -i, r, s, 5), this.setIndex(c), this.setAttribute("position", new He(l, 3)), this.setAttribute("normal", new He(d, 3)), this.setAttribute("uv", new He(h, 2)); function p(u, y, v, m, x, w, A, M, R, L, S) { const I = w / R, T = A / L, _ = w / 2, E = A / 2, C = M / 2, P = R + 1, b = L + 1; let F = 0, D = 0; const N = new q(); for (let B = 0; B < b; B++) { const U = B * T - E; for (let G = 0; G < P; G++) { const Y = G * I - _; N[u] = Y * m, N[y] = U * x, N[v] = C, l.push(N.x, N.y, N.z), N[u] = 0, N[y] = 0, N[v] = M > 0 ? 1 : -1, d.push(N.x, N.y, N.z), h.push(G / R), h.push(1 - B / L), F += 1; } } for (let B = 0; B < L; B++) for (let U = 0; U < R; U++) { const G = f + U + P * B, Y = f + U + P * (B + 1), te = f + (U + 1) + P * (B + 1), ae = f + (U + 1) + P * B; c.push(G, Y, ae), c.push(Y, te, ae), D += 6; } a.addGroup(g, D, S), g += D, f += F; } } static fromJSON(e) { return new sr(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments); } } function Po(n) { const e = {}; for (const t in n) { e[t] = {}; for (const i in n[t]) { const r = n[t][i]; r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? e[t][i] = r.clone() : Array.isArray(r) ? e[t][i] = r.slice() : e[t][i] = r; } } return e; } function wn(n) { const e = {}; for (let t = 0; t < n.length; t++) { const i = Po(n[t]); for (const r in i) e[r] = i[r]; } return e; } const hx = { clone: Po, merge: wn }; var wF = `void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`, AF = `void main() { gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); }`; class or extends tn { constructor(e) { super(), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.vertexShader = wF, this.fragmentShader = AF, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.morphTargets = !1, this.morphNormals = !1, this.extensions = { derivatives: !1, // set to use derivatives fragDepth: !1, // set to use fragment depth values drawBuffers: !1, // set to use draw buffers shaderTextureLOD: !1 // set to use shader texture LOD }, this.defaultAttributeValues = { color: [1, 1, 1], uv: [0, 0], uv2: [0, 0] }, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && (e.attributes !== void 0 && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(e)); } copy(e) { return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Po(e.uniforms), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.lights = e.lights, this.clipping = e.clipping, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this; } toJSON(e) { const t = super.toJSON(e); t.glslVersion = this.glslVersion, t.uniforms = {}; for (const r in this.uniforms) { const o = this.uniforms[r].value; o && o.isTexture ? t.uniforms[r] = { type: "t", value: o.toJSON(e).uuid } : o && o.isColor ? t.uniforms[r] = { type: "c", value: o.getHex() } : o && o.isVector2 ? t.uniforms[r] = { type: "v2", value: o.toArray() } : o && o.isVector3 ? t.uniforms[r] = { type: "v3", value: o.toArray() } : o && o.isVector4 ? t.uniforms[r] = { type: "v4", value: o.toArray() } : o && o.isMatrix3 ? t.uniforms[r] = { type: "m3", value: o.toArray() } : o && o.isMatrix4 ? t.uniforms[r] = { type: "m4", value: o.toArray() } : t.uniforms[r] = { value: o }; } Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader; const i = {}; for (const r in this.extensions) this.extensions[r] === !0 && (i[r] = !0); return Object.keys(i).length > 0 && (t.extensions = i), t; } } or.prototype.isShaderMaterial = !0; class hl extends ut { constructor() { super(), this.type = "Camera", this.matrixWorldInverse = new Xe(), this.projectionMatrix = new Xe(), this.projectionMatrixInverse = new Xe(); } copy(e, t) { return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this; } getWorldDirection(e) { this.updateWorldMatrix(!0, !1); const t = this.matrixWorld.elements; return e.set(-t[8], -t[9], -t[10]).normalize(); } updateMatrixWorld(e) { super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } updateWorldMatrix(e, t) { super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert(); } clone() { return new this.constructor().copy(this); } } hl.prototype.isCamera = !0; class nn extends hl { constructor(e = 50, t = 1, i = 0.1, r = 2e3) { super(), this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = i, this.far = r, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix(); } copy(e, t) { return super.copy(e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = e.view === null ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this; } /** * Sets the FOV by focal length in respect to the current .filmGauge. * * The default film gauge is 35, so that the focal length can be specified for * a 35mm (full frame) camera. * * Values for focal length and film gauge must have the same unit. */ setFocalLength(e) { const t = 0.5 * this.getFilmHeight() / e; this.fov = ja * 2 * Math.atan(t), this.updateProjectionMatrix(); } /** * Calculates the focal length from the current .fov and .filmGauge. */ getFocalLength() { const e = Math.tan(As * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / e; } getEffectiveFOV() { return ja * 2 * Math.atan( Math.tan(As * 0.5 * this.fov) / this.zoom ); } getFilmWidth() { return this.filmGauge * Math.min(this.aspect, 1); } getFilmHeight() { return this.filmGauge / Math.max(this.aspect, 1); } /** * Sets an offset in a larger frustum. This is useful for multi-window or * multi-monitor/multi-machine setups. * * For example, if you have 3x2 monitors and each monitor is 1920x1080 and * the monitors are in grid like this * * +---+---+---+ * | A | B | C | * +---+---+---+ * | D | E | F | * +---+---+---+ * * then for each monitor you would call it like this * * const w = 1920; * const h = 1080; * const fullWidth = w * 3; * const fullHeight = h * 2; * * --A-- * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); * --B-- * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); * --C-- * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); * --D-- * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); * --E-- * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); * --F-- * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); * * Note there is no reason monitors have to be the same size or in a grid. */ setViewOffset(e, t, i, r, s, o) { this.aspect = e / t, this.view === null && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { const e = this.near; let t = e * Math.tan(As * 0.5 * this.fov) / this.zoom, i = 2 * t, r = this.aspect * i, s = -0.5 * r; const o = this.view; if (this.view !== null && this.view.enabled) { const c = o.fullWidth, l = o.fullHeight; s += o.offsetX * r / c, t -= o.offsetY * i / l, r *= o.width / c, i *= o.height / l; } const a = this.filmOffset; a !== 0 && (s += e * a / this.getFilmWidth()), this.projectionMatrix.makePerspective(s, s + r, t, t - i, e, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } toJSON(e) { const t = super.toJSON(e); return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, this.view !== null && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t; } } nn.prototype.isPerspectiveCamera = !0; const to = 90, no = 1; class yu extends ut { constructor(e, t, i) { if (super(), this.type = "CubeCamera", i.isWebGLCubeRenderTarget !== !0) { console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."); return; } this.renderTarget = i; const r = new nn(to, no, e, t); r.layers = this.layers, r.up.set(0, -1, 0), r.lookAt(new q(1, 0, 0)), this.add(r); const s = new nn(to, no, e, t); s.layers = this.layers, s.up.set(0, -1, 0), s.lookAt(new q(-1, 0, 0)), this.add(s); const o = new nn(to, no, e, t); o.layers = this.layers, o.up.set(0, 0, 1), o.lookAt(new q(0, 1, 0)), this.add(o); const a = new nn(to, no, e, t); a.layers = this.layers, a.up.set(0, 0, -1), a.lookAt(new q(0, -1, 0)), this.add(a); const c = new nn(to, no, e, t); c.layers = this.layers, c.up.set(0, -1, 0), c.lookAt(new q(0, 0, 1)), this.add(c); const l = new nn(to, no, e, t); l.layers = this.layers, l.up.set(0, -1, 0), l.lookAt(new q(0, 0, -1)), this.add(l); } update(e, t) { this.parent === null && this.updateMatrixWorld(); const i = this.renderTarget, [r, s, o, a, c, l] = this.children, d = e.xr.enabled, h = e.getRenderTarget(); e.xr.enabled = !1; const f = i.texture.generateMipmaps; i.texture.generateMipmaps = !1, e.setRenderTarget(i, 0), e.render(t, r), e.setRenderTarget(i, 1), e.render(t, s), e.setRenderTarget(i, 2), e.render(t, o), e.setRenderTarget(i, 3), e.render(t, a), e.setRenderTarget(i, 4), e.render(t, c), i.texture.generateMipmaps = f, e.setRenderTarget(i, 5), e.render(t, l), e.setRenderTarget(h), e.xr.enabled = d; } } class ta extends Yt { constructor(e, t, i, r, s, o, a, c, l, d) { e = e !== void 0 ? e : [], t = t !== void 0 ? t : ll, a = a !== void 0 ? a : nr, super(e, t, i, r, s, o, a, c, l, d), this._needsFlipEnvMap = !0, this.flipY = !1; } get images() { return this.image; } set images(e) { this.image = e; } } ta.prototype.isCubeTexture = !0; class bu extends fi { constructor(e, t, i) { Number.isInteger(t) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"), t = i), super(e, e, t), t = t || {}, this.texture = new ta(void 0, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.encoding), this.texture.generateMipmaps = t.generateMipmaps !== void 0 ? t.generateMipmaps : !1, this.texture.minFilter = t.minFilter !== void 0 ? t.minFilter : zt, this.texture._needsFlipEnvMap = !1; } fromEquirectangularTexture(e, t) { this.texture.type = t.type, this.texture.format = Gn, 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 #include } ` ), fragmentShader: ( /* glsl */ ` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } ` ) }, r = new sr(5, 5, 5), s = new or({ name: "CubemapFromEquirect", uniforms: Po(i.uniforms), vertexShader: i.vertexShader, fragmentShader: i.fragmentShader, side: jt, blending: tr }); s.uniforms.tEquirect.value = t; const o = new Xt(r, s), a = t.minFilter; return t.minFilter === fr && (t.minFilter = zt), new yu(1, 10, this).update(e, o), t.minFilter = a, o.geometry.dispose(), o.material.dispose(), this; } clear(e, t, i, r) { const s = e.getRenderTarget(); for (let o = 0; o < 6; o++) e.setRenderTarget(this, o), e.clear(t, i, r); e.setRenderTarget(s); } } bu.prototype.isWebGLCubeRenderTarget = !0; const ph = /* @__PURE__ */ new q(), SF = /* @__PURE__ */ new q(), _F = /* @__PURE__ */ new rn(); class wi { constructor(e = new q(1, 0, 0), t = 0) { this.normal = e, this.constant = t; } set(e, t) { return this.normal.copy(e), this.constant = t, this; } setComponents(e, t, i, r) { return this.normal.set(e, t, i), this.constant = r, this; } setFromNormalAndCoplanarPoint(e, t) { return this.normal.copy(e), this.constant = -t.dot(this.normal), this; } setFromCoplanarPoints(e, t, i) { const r = ph.subVectors(i, t).cross(SF.subVectors(e, t)).normalize(); return this.setFromNormalAndCoplanarPoint(r, e), this; } copy(e) { return this.normal.copy(e.normal), this.constant = e.constant, this; } normalize() { const e = 1 / this.normal.length(); return this.normal.multiplyScalar(e), this.constant *= e, this; } negate() { return this.constant *= -1, this.normal.negate(), this; } distanceToPoint(e) { return this.normal.dot(e) + this.constant; } distanceToSphere(e) { return this.distanceToPoint(e.center) - e.radius; } projectPoint(e, t) { return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e); } intersectLine(e, t) { const i = e.delta(ph), r = this.normal.dot(i); if (r === 0) return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null; const s = -(e.start.dot(this.normal) + this.constant) / r; return s < 0 || s > 1 ? null : t.copy(i).multiplyScalar(s).add(e.start); } intersectsLine(e) { const t = this.distanceToPoint(e.start), i = this.distanceToPoint(e.end); return t < 0 && i > 0 || i < 0 && t > 0; } intersectsBox(e) { return e.intersectsPlane(this); } intersectsSphere(e) { return e.intersectsPlane(this); } coplanarPoint(e) { return e.copy(this.normal).multiplyScalar(-this.constant); } applyMatrix4(e, t) { const i = t || _F.getNormalMatrix(e), r = this.coplanarPoint(ph).applyMatrix4(e), s = this.normal.applyMatrix3(i).normalize(); return this.constant = -r.dot(s), this; } translate(e) { return this.constant -= e.dot(this.normal), this; } equals(e) { return e.normal.equals(this.normal) && e.constant === this.constant; } clone() { return new this.constructor().copy(this); } } wi.prototype.isPlane = !0; const io = /* @__PURE__ */ new pr(), Jl = /* @__PURE__ */ new q(); class dl { constructor(e = new wi(), t = new wi(), i = new wi(), r = new wi(), s = new wi(), o = new wi()) { this.planes = [e, t, i, r, s, o]; } set(e, t, i, r, s, o) { const a = this.planes; return a[0].copy(e), a[1].copy(t), a[2].copy(i), a[3].copy(r), a[4].copy(s), a[5].copy(o), this; } copy(e) { const t = this.planes; for (let i = 0; i < 6; i++) t[i].copy(e.planes[i]); return this; } setFromProjectionMatrix(e) { const t = this.planes, i = e.elements, r = i[0], s = i[1], o = i[2], a = i[3], c = i[4], l = i[5], d = i[6], h = i[7], f = i[8], g = i[9], p = i[10], u = i[11], y = i[12], v = i[13], m = i[14], x = i[15]; return t[0].setComponents(a - r, h - c, u - f, x - y).normalize(), t[1].setComponents(a + r, h + c, u + f, x + y).normalize(), t[2].setComponents(a + s, h + l, u + g, x + v).normalize(), t[3].setComponents(a - s, h - l, u - g, x - v).normalize(), t[4].setComponents(a - o, h - d, u - p, x - m).normalize(), t[5].setComponents(a + o, h + d, u + p, x + m).normalize(), this; } intersectsObject(e) { const t = e.geometry; return t.boundingSphere === null && t.computeBoundingSphere(), io.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(io); } intersectsSprite(e) { return io.center.set(0, 0, 0), io.radius = 0.7071067811865476, io.applyMatrix4(e.matrixWorld), this.intersectsSphere(io); } intersectsSphere(e) { const t = this.planes, i = e.center, r = -e.radius; for (let s = 0; s < 6; s++) if (t[s].distanceToPoint(i) < r) return !1; return !0; } intersectsBox(e) { const t = this.planes; for (let i = 0; i < 6; i++) { const r = t[i]; if (Jl.x = r.normal.x > 0 ? e.max.x : e.min.x, Jl.y = r.normal.y > 0 ? e.max.y : e.min.y, Jl.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(Jl) < 0) return !1; } return !0; } containsPoint(e) { const t = this.planes; for (let i = 0; i < 6; i++) if (t[i].distanceToPoint(e) < 0) return !1; return !0; } clone() { return new this.constructor().copy(this); } } function dx() { let n = null, e = !1, t = null, i = null; function r(s, o) { t(s, o), i = n.requestAnimationFrame(r); } return { start: function() { e !== !0 && t !== null && (i = n.requestAnimationFrame(r), e = !0); }, stop: function() { n.cancelAnimationFrame(i), e = !1; }, setAnimationLoop: function(s) { t = s; }, setContext: function(s) { n = s; } }; } function TF(n, e) { const t = e.isWebGL2, i = /* @__PURE__ */ new WeakMap(); function r(l, d) { const h = l.array, f = l.usage, g = n.createBuffer(); n.bindBuffer(d, g), n.bufferData(d, h, f), l.onUploadCallback(); let p = 5126; return h instanceof Float32Array ? p = 5126 : h instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : h instanceof Uint16Array ? l.isFloat16BufferAttribute ? t ? p = 5131 : console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.") : p = 5123 : h instanceof Int16Array ? p = 5122 : h instanceof Uint32Array ? p = 5125 : h instanceof Int32Array ? p = 5124 : h instanceof Int8Array ? p = 5120 : (h instanceof Uint8Array || h instanceof Uint8ClampedArray) && (p = 5121), { buffer: g, type: p, bytesPerElement: h.BYTES_PER_ELEMENT, version: l.version }; } function s(l, d, h) { const f = d.array, g = d.updateRange; n.bindBuffer(h, l), g.count === -1 ? n.bufferSubData(h, 0, f) : (t ? n.bufferSubData( h, g.offset * f.BYTES_PER_ELEMENT, f, g.offset, g.count ) : n.bufferSubData( h, g.offset * f.BYTES_PER_ELEMENT, f.subarray(g.offset, g.offset + g.count) ), g.count = -1); } function o(l) { return l.isInterleavedBufferAttribute && (l = l.data), i.get(l); } function a(l) { l.isInterleavedBufferAttribute && (l = l.data); const d = i.get(l); d && (n.deleteBuffer(d.buffer), i.delete(l)); } function c(l, d) { if (l.isGLBufferAttribute) { const f = i.get(l); (!f || f.version < l.version) && i.set(l, { buffer: l.buffer, type: l.type, bytesPerElement: l.elementSize, version: l.version }); return; } l.isInterleavedBufferAttribute && (l = l.data); const h = i.get(l); h === void 0 ? i.set(l, r(l, d)) : h.version < l.version && (s(h.buffer, l, d), h.version = l.version); } return { get: o, remove: a, update: c }; } class Ls extends Ke { constructor(e = 1, t = 1, i = 1, r = 1) { super(), this.type = "PlaneGeometry", this.parameters = { width: e, height: t, widthSegments: i, heightSegments: r }; const s = e / 2, o = t / 2, a = Math.floor(i), c = Math.floor(r), l = a + 1, d = c + 1, h = e / a, f = t / c, g = [], p = [], u = [], y = []; for (let v = 0; v < d; v++) { const m = v * f - o; for (let x = 0; x < l; x++) { const w = x * h - s; p.push(w, -m, 0), u.push(0, 0, 1), y.push(x / a), y.push(1 - v / c); } } for (let v = 0; v < c; v++) for (let m = 0; m < a; m++) { const x = m + l * v, w = m + l * (v + 1), A = m + 1 + l * (v + 1), M = m + 1 + l * v; g.push(x, w, M), g.push(w, A, M); } this.setIndex(g), this.setAttribute("position", new He(p, 3)), this.setAttribute("normal", new He(u, 3)), this.setAttribute("uv", new He(y, 2)); } static fromJSON(e) { return new Ls(e.width, e.height, e.widthSegments, e.heightSegments); } } var EF = `#ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, vUv ).g; #endif`, CF = `#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`, LF = `#ifdef ALPHATEST if ( diffuseColor.a < ALPHATEST ) discard; #endif`, RF = `#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`, FF = `#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; #endif`, PF = "vec3 transformed = vec3( position );", IF = `vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); #endif`, OF = `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`, DF = `#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`, NF = `#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`, BF = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`, UF = `#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`, zF = `#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`, VF = `#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`, kF = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`, GF = `#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`, HF = `#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`, WF = `#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 ); }`, jF = `#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`, $F = `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`, ZF = `#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`, XF = `#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`, YF = `#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; totalEmissiveRadiance *= emissiveColor.rgb; #endif`, JF = `#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`, KF = "gl_FragColor = linearToOutputTexel( gl_FragColor );", qF = ` 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 ); }`, QF = `#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`, eP = `#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`, tP = `#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`, nP = `#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`, iP = `#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`, rP = `#ifdef USE_FOG fogDepth = - mvPosition.z; #endif`, sP = `#ifdef USE_FOG varying float fogDepth; #endif`, oP = `#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`, aP = `#ifdef USE_FOG uniform vec3 fogColor; varying float fogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`, lP = `#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 }`, cP = `#ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #endif`, uP = `#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`, hP = `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`, dP = `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`, fP = `#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`, pP = `ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`, mP = `varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon #define Material_LightProbeLOD( material ) (0)`, gP = `BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`, vP = `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)`, yP = `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`, bP = `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 ); }`, xP = ` 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`, MP = `#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`, wP = `#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`, AP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`, SP = `#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`, _P = `#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`, TP = `#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`, EP = `#ifdef USE_MAP vec4 texelColor = texture2D( map, vUv ); texelColor = mapTexelToLinear( texelColor ); diffuseColor *= texelColor; #endif`, CP = `#ifdef USE_MAP uniform sampler2D map; #endif`, LP = `#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`, RP = `#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`, FP = `float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`, PP = `#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`, IP = `#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif`, OP = `#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif`, DP = `#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`, NP = `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;`, BP = `#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`, UP = `#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`, zP = `#ifdef CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`, VP = `#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`, kP = `#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`, GP = `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 ); }`, HP = `#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`, WP = `vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`, jP = `#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`, $P = `#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`, ZP = `float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`, XP = `#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`, YP = `#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`, JP = `#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`, KP = `#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`, qP = `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; }`, QP = `#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`, eI = `#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`, tI = `#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`, nI = `#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`, iI = `float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`, rI = `#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`, sI = `#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`, oI = `#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; }`, aI = `#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`, lI = `#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`, cI = `#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`, uI = `#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`, hI = `#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`, dI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`, fI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`, pI = `#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`, mI = `#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`, gI = `uniform sampler2D t2D; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`, vI = `varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`, yI = `#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`, bI = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`, xI = `#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include 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 }`, MI = `#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`, wI = `#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`, AI = `#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`, SI = `uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); vec4 texColor = texture2D( tEquirect, sampleUV ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`, _I = `varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`, TI = `uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`, EI = `uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include }`, CI = `uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include 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 reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, LI = `#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_ENVMAP #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`, RI = `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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include 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 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, FI = `#define LAMBERT varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`, PI = `#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include 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 #include #include #include #include }`, II = `#define MATCAP varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`, OI = `#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, DI = `#define TOON varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`, NI = `#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, BI = `#define PHONG varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`, UI = `#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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`, zI = `#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 #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition; #endif }`, VI = `#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 #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); }`, kI = `#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 #include #include #include #include #include #include void main() { #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`, GI = `uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`, HI = `uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`, WI = `uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`, jI = `#include #include #include void main() { #include #include #include #include #include #include #include #include #include #include }`, $I = `uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include }`, ZI = `uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include 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 #include #include }`; const dt = { alphamap_fragment: EF, alphamap_pars_fragment: CF, alphatest_fragment: LF, aomap_fragment: RF, aomap_pars_fragment: FF, begin_vertex: PF, beginnormal_vertex: IF, bsdfs: OF, bumpmap_pars_fragment: DF, clipping_planes_fragment: NF, clipping_planes_pars_fragment: BF, clipping_planes_pars_vertex: UF, clipping_planes_vertex: zF, color_fragment: VF, color_pars_fragment: kF, color_pars_vertex: GF, color_vertex: HF, common: WF, cube_uv_reflection_fragment: jF, defaultnormal_vertex: $F, displacementmap_pars_vertex: ZF, displacementmap_vertex: XF, emissivemap_fragment: YF, emissivemap_pars_fragment: JF, encodings_fragment: KF, encodings_pars_fragment: qF, envmap_fragment: QF, envmap_common_pars_fragment: eP, envmap_pars_fragment: tP, envmap_pars_vertex: nP, envmap_physical_pars_fragment: fP, envmap_vertex: iP, fog_vertex: rP, fog_pars_vertex: sP, fog_fragment: oP, fog_pars_fragment: aP, gradientmap_pars_fragment: lP, lightmap_fragment: cP, lightmap_pars_fragment: uP, lights_lambert_vertex: hP, lights_pars_begin: dP, lights_toon_fragment: pP, lights_toon_pars_fragment: mP, lights_phong_fragment: gP, lights_phong_pars_fragment: vP, lights_physical_fragment: yP, lights_physical_pars_fragment: bP, lights_fragment_begin: xP, lights_fragment_maps: MP, lights_fragment_end: wP, logdepthbuf_fragment: AP, logdepthbuf_pars_fragment: SP, logdepthbuf_pars_vertex: _P, logdepthbuf_vertex: TP, map_fragment: EP, map_pars_fragment: CP, map_particle_fragment: LP, map_particle_pars_fragment: RP, metalnessmap_fragment: FP, metalnessmap_pars_fragment: PP, morphnormal_vertex: IP, morphtarget_pars_vertex: OP, morphtarget_vertex: DP, normal_fragment_begin: NP, normal_fragment_maps: BP, normalmap_pars_fragment: UP, clearcoat_normal_fragment_begin: zP, clearcoat_normal_fragment_maps: VP, clearcoat_pars_fragment: kP, packing: GP, premultiplied_alpha_fragment: HP, project_vertex: WP, dithering_fragment: jP, dithering_pars_fragment: $P, roughnessmap_fragment: ZP, roughnessmap_pars_fragment: XP, shadowmap_pars_fragment: YP, shadowmap_pars_vertex: JP, shadowmap_vertex: KP, shadowmask_pars_fragment: qP, skinbase_vertex: QP, skinning_pars_vertex: eI, skinning_vertex: tI, skinnormal_vertex: nI, specularmap_fragment: iI, specularmap_pars_fragment: rI, tonemapping_fragment: sI, tonemapping_pars_fragment: oI, transmission_fragment: aI, transmission_pars_fragment: lI, uv_pars_fragment: cI, uv_pars_vertex: uI, uv_vertex: hI, uv2_pars_fragment: dI, uv2_pars_vertex: fI, uv2_vertex: pI, worldpos_vertex: mI, background_frag: gI, background_vert: vI, cube_frag: yI, cube_vert: bI, depth_frag: xI, depth_vert: MI, distanceRGBA_frag: wI, distanceRGBA_vert: AI, equirect_frag: SI, equirect_vert: _I, linedashed_frag: TI, linedashed_vert: EI, meshbasic_frag: CI, meshbasic_vert: LI, meshlambert_frag: RI, meshlambert_vert: FI, meshmatcap_frag: PI, meshmatcap_vert: II, meshtoon_frag: OI, meshtoon_vert: DI, meshphong_frag: NI, meshphong_vert: BI, meshphysical_frag: UI, meshphysical_vert: zI, normal_frag: VI, normal_vert: kI, points_frag: GI, points_vert: HI, shadow_frag: WI, shadow_vert: jI, sprite_frag: $I, sprite_vert: ZI }, ze = { common: { diffuse: { value: new Ue(16777215) }, opacity: { value: 1 }, map: { value: null }, uvTransform: { value: new rn() }, uv2Transform: { value: new rn() }, alphaMap: { value: null } }, specularmap: { specularMap: { value: null } }, envmap: { envMap: { value: null }, flipEnvMap: { value: -1 }, reflectivity: { value: 1 }, refractionRatio: { value: 0.98 }, maxMipLevel: { value: 0 } }, aomap: { aoMap: { value: null }, aoMapIntensity: { value: 1 } }, lightmap: { lightMap: { value: null }, lightMapIntensity: { value: 1 } }, emissivemap: { emissiveMap: { value: null } }, bumpmap: { bumpMap: { value: null }, bumpScale: { value: 1 } }, normalmap: { normalMap: { value: null }, normalScale: { value: new Re(1, 1) } }, displacementmap: { displacementMap: { value: null }, displacementScale: { value: 1 }, displacementBias: { value: 0 } }, roughnessmap: { roughnessMap: { value: null } }, metalnessmap: { metalnessMap: { value: null } }, gradientmap: { gradientMap: { value: null } }, fog: { fogDensity: { value: 25e-5 }, fogNear: { value: 1 }, fogFar: { value: 2e3 }, fogColor: { value: new Ue(16777215) } }, lights: { ambientLightColor: { value: [] }, lightProbe: { value: [] }, directionalLights: { value: [], properties: { direction: {}, color: {} } }, directionalLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, directionalShadowMap: { value: [] }, directionalShadowMatrix: { value: [] }, spotLights: { value: [], properties: { color: {}, position: {}, direction: {}, distance: {}, coneCos: {}, penumbraCos: {}, decay: {} } }, spotLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {} } }, spotShadowMap: { value: [] }, spotShadowMatrix: { value: [] }, pointLights: { value: [], properties: { color: {}, position: {}, decay: {}, distance: {} } }, pointLightShadows: { value: [], properties: { shadowBias: {}, shadowNormalBias: {}, shadowRadius: {}, shadowMapSize: {}, shadowCameraNear: {}, shadowCameraFar: {} } }, pointShadowMap: { value: [] }, pointShadowMatrix: { value: [] }, hemisphereLights: { value: [], properties: { direction: {}, skyColor: {}, groundColor: {} } }, // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src rectAreaLights: { value: [], properties: { color: {}, position: {}, width: {}, height: {} } }, ltc_1: { value: null }, ltc_2: { value: null } }, points: { diffuse: { value: new Ue(16777215) }, opacity: { value: 1 }, size: { value: 1 }, scale: { value: 1 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new rn() } }, sprite: { diffuse: { value: new Ue(16777215) }, opacity: { value: 1 }, center: { value: new Re(0.5, 0.5) }, rotation: { value: 0 }, map: { value: null }, alphaMap: { value: null }, uvTransform: { value: new rn() } } }, ci = { basic: { uniforms: wn([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.fog ]), vertexShader: dt.meshbasic_vert, fragmentShader: dt.meshbasic_frag }, lambert: { uniforms: wn([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.fog, ze.lights, { emissive: { value: new Ue(0) } } ]), vertexShader: dt.meshlambert_vert, fragmentShader: dt.meshlambert_frag }, phong: { uniforms: wn([ ze.common, ze.specularmap, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.fog, ze.lights, { emissive: { value: new Ue(0) }, specular: { value: new Ue(1118481) }, shininess: { value: 30 } } ]), vertexShader: dt.meshphong_vert, fragmentShader: dt.meshphong_frag }, standard: { uniforms: wn([ ze.common, ze.envmap, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.roughnessmap, ze.metalnessmap, ze.fog, ze.lights, { emissive: { value: new Ue(0) }, roughness: { value: 1 }, metalness: { value: 0 }, envMapIntensity: { value: 1 } // temporary } ]), vertexShader: dt.meshphysical_vert, fragmentShader: dt.meshphysical_frag }, toon: { uniforms: wn([ ze.common, ze.aomap, ze.lightmap, ze.emissivemap, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.gradientmap, ze.fog, ze.lights, { emissive: { value: new Ue(0) } } ]), vertexShader: dt.meshtoon_vert, fragmentShader: dt.meshtoon_frag }, matcap: { uniforms: wn([ ze.common, ze.bumpmap, ze.normalmap, ze.displacementmap, ze.fog, { matcap: { value: null } } ]), vertexShader: dt.meshmatcap_vert, fragmentShader: dt.meshmatcap_frag }, points: { uniforms: wn([ ze.points, ze.fog ]), vertexShader: dt.points_vert, fragmentShader: dt.points_frag }, dashed: { uniforms: wn([ ze.common, ze.fog, { scale: { value: 1 }, dashSize: { value: 1 }, totalSize: { value: 2 } } ]), vertexShader: dt.linedashed_vert, fragmentShader: dt.linedashed_frag }, depth: { uniforms: wn([ ze.common, ze.displacementmap ]), vertexShader: dt.depth_vert, fragmentShader: dt.depth_frag }, normal: { uniforms: wn([ ze.common, ze.bumpmap, ze.normalmap, ze.displacementmap, { opacity: { value: 1 } } ]), vertexShader: dt.normal_vert, fragmentShader: dt.normal_frag }, sprite: { uniforms: wn([ ze.sprite, ze.fog ]), vertexShader: dt.sprite_vert, fragmentShader: dt.sprite_frag }, background: { uniforms: { uvTransform: { value: new rn() }, t2D: { value: null } }, vertexShader: dt.background_vert, fragmentShader: dt.background_frag }, /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ cube: { uniforms: wn([ ze.envmap, { opacity: { value: 1 } } ]), vertexShader: dt.cube_vert, fragmentShader: dt.cube_frag }, equirect: { uniforms: { tEquirect: { value: null } }, vertexShader: dt.equirect_vert, fragmentShader: dt.equirect_frag }, distanceRGBA: { uniforms: wn([ ze.common, ze.displacementmap, { referencePosition: { value: new q() }, nearDistance: { value: 1 }, farDistance: { value: 1e3 } } ]), vertexShader: dt.distanceRGBA_vert, fragmentShader: dt.distanceRGBA_frag }, shadow: { uniforms: wn([ ze.lights, ze.fog, { color: { value: new Ue(0) }, opacity: { value: 1 } } ]), vertexShader: dt.shadow_vert, fragmentShader: dt.shadow_frag } }; ci.physical = { uniforms: wn([ ci.standard.uniforms, { clearcoat: { value: 0 }, clearcoatMap: { value: null }, clearcoatRoughness: { value: 0 }, clearcoatRoughnessMap: { value: null }, clearcoatNormalScale: { value: new Re(1, 1) }, clearcoatNormalMap: { value: null }, sheen: { value: new Ue(0) }, transmission: { value: 0 }, transmissionMap: { value: null }, transmissionSamplerSize: { value: new Re() }, transmissionSamplerMap: { value: null }, thickness: { value: 0 }, thicknessMap: { value: null }, attenuationDistance: { value: 0 }, attenuationColor: { value: new Ue(0) } } ]), vertexShader: dt.meshphysical_vert, fragmentShader: dt.meshphysical_frag }; function XI(n, e, t, i, r) { const s = new Ue(0); let o = 0, a, c, l = null, d = 0, h = null; function f(p, u) { let y = !1, v = u.isScene === !0 ? u.background : null; v && v.isTexture && (v = e.get(v)); const m = n.xr, x = m.getSession && m.getSession(); x && x.environmentBlendMode === "additive" && (v = null), v === null ? g(s, o) : v && v.isColor && (g(v, 1), y = !0), (n.autoClear || y) && n.clear(n.autoClearColor, n.autoClearDepth, n.autoClearStencil), v && (v.isCubeTexture || v.mapping === ea) ? (c === void 0 && (c = new Xt( new sr(1, 1, 1), new or({ name: "BackgroundCubeMaterial", uniforms: Po(ci.cube.uniforms), vertexShader: ci.cube.vertexShader, fragmentShader: ci.cube.fragmentShader, side: jt, depthTest: !1, depthWrite: !1, fog: !1 }) ), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(w, A, M) { this.matrixWorld.copyPosition(M.matrixWorld); }, Object.defineProperty(c.material, "envMap", { get: function() { return this.uniforms.envMap.value; } }), i.update(c)), c.material.uniforms.envMap.value = v, c.material.uniforms.flipEnvMap.value = v.isCubeTexture && v._needsFlipEnvMap ? -1 : 1, (l !== v || d !== v.version || h !== n.toneMapping) && (c.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), p.unshift(c, c.geometry, c.material, 0, 0, null)) : v && v.isTexture && (a === void 0 && (a = new Xt( new Ls(2, 2), new or({ name: "BackgroundMaterial", uniforms: Po(ci.background.uniforms), vertexShader: ci.background.vertexShader, fragmentShader: ci.background.fragmentShader, side: Hr, depthTest: !1, depthWrite: !1, fog: !1 }) ), a.geometry.deleteAttribute("normal"), Object.defineProperty(a.material, "map", { get: function() { return this.uniforms.t2D.value; } }), i.update(a)), a.material.uniforms.t2D.value = v, v.matrixAutoUpdate === !0 && v.updateMatrix(), a.material.uniforms.uvTransform.value.copy(v.matrix), (l !== v || d !== v.version || h !== n.toneMapping) && (a.material.needsUpdate = !0, l = v, d = v.version, h = n.toneMapping), p.unshift(a, a.geometry, a.material, 0, 0, null)); } function g(p, u) { t.buffers.color.setClear(p.r, p.g, p.b, u, r); } return { getClearColor: function() { return s; }, setClearColor: function(p, u = 1) { s.set(p), o = u, g(s, o); }, getClearAlpha: function() { return o; }, setClearAlpha: function(p) { o = p, g(s, o); }, render: f }; } function YI(n, e, t, i) { const r = n.getParameter(34921), s = i.isWebGL2 ? null : e.get("OES_vertex_array_object"), o = i.isWebGL2 || s !== null, a = {}, c = u(null); let l = c; function d(E, C, P, b, F) { let D = !1; if (o) { const N = p(b, P, C); l !== N && (l = N, f(l.object)), D = y(b, F), D && v(b, F); } else { const N = C.wireframe === !0; (l.geometry !== b.id || l.program !== P.id || l.wireframe !== N) && (l.geometry = b.id, l.program = P.id, l.wireframe = N, D = !0); } E.isInstancedMesh === !0 && (D = !0), F !== null && t.update(F, 34963), D && (R(E, C, P, b), F !== null && n.bindBuffer(34963, t.get(F).buffer)); } function h() { return i.isWebGL2 ? n.createVertexArray() : s.createVertexArrayOES(); } function f(E) { return i.isWebGL2 ? n.bindVertexArray(E) : s.bindVertexArrayOES(E); } function g(E) { return i.isWebGL2 ? n.deleteVertexArray(E) : s.deleteVertexArrayOES(E); } function p(E, C, P) { const b = P.wireframe === !0; let F = a[E.id]; F === void 0 && (F = {}, a[E.id] = F); let D = F[C.id]; D === void 0 && (D = {}, F[C.id] = D); let N = D[b]; return N === void 0 && (N = u(h()), D[b] = N), N; } function u(E) { const C = [], P = [], b = []; for (let F = 0; F < r; F++) C[F] = 0, P[F] = 0, b[F] = 0; return { // for backward compatibility on non-VAO support browser geometry: null, program: null, wireframe: !1, newAttributes: C, enabledAttributes: P, attributeDivisors: b, object: E, attributes: {}, index: null }; } function y(E, C) { const P = l.attributes, b = E.attributes; let F = 0; for (const D in b) { const N = P[D], B = b[D]; if (N === void 0 || N.attribute !== B || N.data !== B.data) return !0; F++; } return l.attributesNum !== F || l.index !== C; } function v(E, C) { const P = {}, b = E.attributes; let F = 0; for (const D in b) { const N = b[D], B = {}; B.attribute = N, N.data && (B.data = N.data), P[D] = B, F++; } l.attributes = P, l.attributesNum = F, l.index = C; } function m() { const E = l.newAttributes; for (let C = 0, P = E.length; C < P; C++) E[C] = 0; } function x(E) { w(E, 0); } function w(E, C) { const P = l.newAttributes, b = l.enabledAttributes, F = l.attributeDivisors; P[E] = 1, b[E] === 0 && (n.enableVertexAttribArray(E), b[E] = 1), F[E] !== C && ((i.isWebGL2 ? n : e.get("ANGLE_instanced_arrays"))[i.isWebGL2 ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](E, C), F[E] = C); } function A() { const E = l.newAttributes, C = l.enabledAttributes; for (let P = 0, b = C.length; P < b; P++) C[P] !== E[P] && (n.disableVertexAttribArray(P), C[P] = 0); } function M(E, C, P, b, F, D) { i.isWebGL2 === !0 && (P === 5124 || P === 5125) ? n.vertexAttribIPointer(E, C, P, F, D) : n.vertexAttribPointer(E, C, P, b, F, D); } function R(E, C, P, b) { if (i.isWebGL2 === !1 && (E.isInstancedMesh || b.isInstancedBufferGeometry) && e.get("ANGLE_instanced_arrays") === null) return; m(); const F = b.attributes, D = P.getAttributes(), N = C.defaultAttributeValues; for (const B in D) { const U = D[B]; if (U >= 0) { const G = F[B]; if (G !== void 0) { const Y = G.normalized, te = G.itemSize, ae = t.get(G); if (ae === void 0) continue; const ie = ae.buffer, le = ae.type, W = ae.bytesPerElement; if (G.isInterleavedBufferAttribute) { const $ = G.data, j = $.stride, re = G.offset; $ && $.isInstancedInterleavedBuffer ? (w(U, $.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = $.meshPerAttribute * $.count)) : x(U), n.bindBuffer(34962, ie), M(U, te, le, Y, j * W, re * W); } else G.isInstancedBufferAttribute ? (w(U, G.meshPerAttribute), b._maxInstanceCount === void 0 && (b._maxInstanceCount = G.meshPerAttribute * G.count)) : x(U), n.bindBuffer(34962, ie), M(U, te, le, Y, 0, 0); } else if (B === "instanceMatrix") { const Y = t.get(E.instanceMatrix); if (Y === void 0) continue; const te = Y.buffer, ae = Y.type; w(U + 0, 1), w(U + 1, 1), w(U + 2, 1), w(U + 3, 1), n.bindBuffer(34962, te), n.vertexAttribPointer(U + 0, 4, ae, !1, 64, 0), n.vertexAttribPointer(U + 1, 4, ae, !1, 64, 16), n.vertexAttribPointer(U + 2, 4, ae, !1, 64, 32), n.vertexAttribPointer(U + 3, 4, ae, !1, 64, 48); } else if (B === "instanceColor") { const Y = t.get(E.instanceColor); if (Y === void 0) continue; const te = Y.buffer, ae = Y.type; w(U, 1), n.bindBuffer(34962, te), n.vertexAttribPointer(U, 3, ae, !1, 12, 0); } else if (N !== void 0) { const Y = N[B]; if (Y !== void 0) switch (Y.length) { case 2: n.vertexAttrib2fv(U, Y); break; case 3: n.vertexAttrib3fv(U, Y); break; case 4: n.vertexAttrib4fv(U, Y); break; default: n.vertexAttrib1fv(U, Y); } } } } A(); } function L() { T(); for (const E in a) { const C = a[E]; for (const P in C) { const b = C[P]; for (const F in b) g(b[F].object), delete b[F]; delete C[P]; } delete a[E]; } } function S(E) { if (a[E.id] === void 0) return; const C = a[E.id]; for (const P in C) { const b = C[P]; for (const F in b) g(b[F].object), delete b[F]; delete C[P]; } delete a[E.id]; } function I(E) { for (const C in a) { const P = a[C]; if (P[E.id] === void 0) continue; const b = P[E.id]; for (const F in b) g(b[F].object), delete b[F]; delete P[E.id]; } } function T() { _(), l !== c && (l = c, f(l.object)); } function _() { c.geometry = null, c.program = null, c.wireframe = !1; } return { setup: d, reset: T, resetDefaultState: _, dispose: L, releaseStatesOfGeometry: S, releaseStatesOfProgram: I, initAttributes: m, enableAttribute: x, disableUnusedAttributes: A }; } function JI(n, e, t, i) { const r = i.isWebGL2; let s; function o(l) { s = l; } function a(l, d) { n.drawArrays(s, l, d), t.update(d, s, 1); } function c(l, d, h) { if (h === 0) return; let f, g; if (r) f = n, g = "drawArraysInstanced"; else if (f = e.get("ANGLE_instanced_arrays"), g = "drawArraysInstancedANGLE", f === null) { console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } f[g](s, l, d, h), t.update(d, s, h); } this.setMode = o, this.render = a, this.renderInstances = c; } function KI(n, e, t) { let i; function r() { if (i !== void 0) return i; if (e.has("EXT_texture_filter_anisotropic") === !0) { const R = e.get("EXT_texture_filter_anisotropic"); i = n.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else i = 0; return i; } function s(R) { if (R === "highp") { if (n.getShaderPrecisionFormat(35633, 36338).precision > 0 && n.getShaderPrecisionFormat(35632, 36338).precision > 0) return "highp"; R = "mediump"; } return R === "mediump" && n.getShaderPrecisionFormat(35633, 36337).precision > 0 && n.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp"; } const o = typeof WebGL2RenderingContext < "u" && n instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext < "u" && n instanceof WebGL2ComputeRenderingContext; let a = t.precision !== void 0 ? t.precision : "highp"; const c = s(a); c !== a && (console.warn("THREE.WebGLRenderer:", a, "not supported, using", c, "instead."), a = c); const l = o || e.has("WEBGL_draw_buffers"), d = t.logarithmicDepthBuffer === !0, h = n.getParameter(34930), f = n.getParameter(35660), g = n.getParameter(3379), p = n.getParameter(34076), u = n.getParameter(34921), y = n.getParameter(36347), v = n.getParameter(36348), m = n.getParameter(36349), x = f > 0, w = o || e.has("OES_texture_float"), A = x && w, M = o ? n.getParameter(36183) : 0; return { isWebGL2: o, drawBuffers: l, getMaxAnisotropy: r, getMaxPrecision: s, precision: a, logarithmicDepthBuffer: d, maxTextures: h, maxVertexTextures: f, maxTextureSize: g, maxCubemapSize: p, maxAttributes: u, maxVertexUniforms: y, maxVaryings: v, maxFragmentUniforms: m, vertexTextures: x, floatFragmentTextures: w, floatVertexTextures: A, maxSamples: M }; } function qI(n) { const e = this; let t = null, i = 0, r = !1, s = !1; const o = new wi(), a = new rn(), c = { value: null, needsUpdate: !1 }; this.uniform = c, this.numPlanes = 0, this.numIntersection = 0, this.init = function(h, f, g) { const p = h.length !== 0 || f || // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: i !== 0 || r; return r = f, t = d(h, g, 0), i = h.length, p; }, this.beginShadows = function() { s = !0, d(null); }, this.endShadows = function() { s = !1, l(); }, this.setState = function(h, f, g) { const p = h.clippingPlanes, u = h.clipIntersection, y = h.clipShadows, v = n.get(h); if (!r || p === null || p.length === 0 || s && !y) s ? d(null) : l(); else { const m = s ? 0 : i, x = m * 4; let w = v.clippingState || null; c.value = w, w = d(p, f, x, g); for (let A = 0; A !== x; ++A) w[A] = t[A]; v.clippingState = w, this.numIntersection = u ? this.numPlanes : 0, this.numPlanes += m; } }; function l() { c.value !== t && (c.value = t, c.needsUpdate = i > 0), e.numPlanes = i, e.numIntersection = 0; } function d(h, f, g, p) { const u = h !== null ? h.length : 0; let y = null; if (u !== 0) { if (y = c.value, p !== !0 || y === null) { const v = g + u * 4, m = f.matrixWorldInverse; a.getNormalMatrix(m), (y === null || y.length < v) && (y = new Float32Array(v)); for (let x = 0, w = g; x !== u; ++x, w += 4) o.copy(h[x]).applyMatrix4(m, a), o.normal.toArray(y, w), y[w + 3] = o.constant; } c.value = y, c.needsUpdate = !0; } return e.numPlanes = u, e.numIntersection = 0, y; } } function QI(n) { let e = /* @__PURE__ */ new WeakMap(); function t(o, a) { return a === kc ? o.mapping = ll : a === Gc && (o.mapping = cl), o; } function i(o) { if (o && o.isTexture) { const a = o.mapping; if (a === kc || a === Gc) if (e.has(o)) { const c = e.get(o).texture; return t(c, o.mapping); } else { const c = o.image; if (c && c.height > 0) { const l = n.getRenderTarget(), d = new bu(c.height / 2); return d.fromEquirectangularTexture(n, o), e.set(o, d), n.setRenderTarget(l), o.addEventListener("dispose", r), t(d.texture, o.mapping); } else return null; } } return o; } function r(o) { const a = o.target; a.removeEventListener("dispose", r); const c = e.get(a); c !== void 0 && (e.delete(a), c.dispose()); } function s() { e = /* @__PURE__ */ new WeakMap(); } return { get: i, dispose: s }; } function eO(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 tO(n, e, t, i) { const r = {}, s = /* @__PURE__ */ new WeakMap(); function o(h) { const f = h.target; f.index !== null && e.remove(f.index); for (const p in f.attributes) e.remove(f.attributes[p]); f.removeEventListener("dispose", o), delete r[f.id]; const g = s.get(f); g && (e.remove(g), s.delete(f)), i.releaseStatesOfGeometry(f), f.isInstancedBufferGeometry === !0 && delete f._maxInstanceCount, t.memory.geometries--; } function a(h, f) { return r[f.id] === !0 || (f.addEventListener("dispose", o), r[f.id] = !0, t.memory.geometries++), f; } function c(h) { const f = h.attributes; for (const p in f) e.update(f[p], 34962); const g = h.morphAttributes; for (const p in g) { const u = g[p]; for (let y = 0, v = u.length; y < v; y++) e.update(u[y], 34962); } } function l(h) { const f = [], g = h.index, p = h.attributes.position; let u = 0; if (g !== null) { const m = g.array; u = g.version; for (let x = 0, w = m.length; x < w; x += 3) { const A = m[x + 0], M = m[x + 1], R = m[x + 2]; f.push(A, M, M, R, R, A); } } else { const m = p.array; u = p.version; for (let x = 0, w = m.length / 3 - 1; x < w; x += 3) { const A = x + 0, M = x + 1, R = x + 2; f.push(A, M, M, R, R, A); } } const y = new (ux(f) > 65535 ? vu : gu)(f, 1); y.version = u; const v = s.get(h); v && e.remove(v), s.set(h, y); } function d(h) { const f = s.get(h); if (f) { const g = h.index; g !== null && f.version < g.version && l(h); } else l(h); return s.get(h); } return { get: a, update: c, getWireframeAttribute: d }; } function nO(n, e, t, i) { const r = i.isWebGL2; let s; function o(f) { s = f; } let a, c; function l(f) { a = f.type, c = f.bytesPerElement; } function d(f, g) { n.drawElements(s, g, a, f * c), t.update(g, s, 1); } function h(f, g, p) { if (p === 0) return; let u, y; if (r) u = n, y = "drawElementsInstanced"; else if (u = e.get("ANGLE_instanced_arrays"), y = "drawElementsInstancedANGLE", u === null) { console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); return; } u[y](s, g, a, f * c, p), t.update(g, s, p); } this.setMode = o, this.setIndex = l, this.render = d, this.renderInstances = h; } function iO(n) { const e = { geometries: 0, textures: 0 }, t = { frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; function i(s, o, a) { switch (t.calls++, o) { case 4: t.triangles += a * (s / 3); break; case 1: t.lines += a * (s / 2); break; case 3: t.lines += a * (s - 1); break; case 2: t.lines += a * s; break; case 0: t.points += a * s; break; default: console.error("THREE.WebGLInfo: Unknown draw mode:", o); break; } } function r() { t.frame++, t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0; } return { memory: e, render: t, programs: null, autoReset: !0, reset: r, update: i }; } function rO(n, e) { return n[0] - e[0]; } function sO(n, e) { return Math.abs(e[1]) - Math.abs(n[1]); } function oO(n) { const e = {}, t = new Float32Array(8), i = []; for (let s = 0; s < 8; s++) i[s] = [s, 0]; function r(s, o, a, c) { const l = s.morphTargetInfluences, d = l === void 0 ? 0 : l.length; let h = e[o.id]; if (h === void 0 || h.length !== d) { h = []; for (let y = 0; y < d; y++) h[y] = [y, 0]; e[o.id] = h; } for (let y = 0; y < d; y++) { const v = h[y]; v[0] = y, v[1] = l[y]; } h.sort(sO); for (let y = 0; y < 8; y++) y < d && h[y][1] ? (i[y][0] = h[y][0], i[y][1] = h[y][1]) : (i[y][0] = Number.MAX_SAFE_INTEGER, i[y][1] = 0); i.sort(rO); const f = a.morphTargets && o.morphAttributes.position, g = a.morphNormals && o.morphAttributes.normal; let p = 0; for (let y = 0; y < 8; y++) { const v = i[y], m = v[0], x = v[1]; m !== Number.MAX_SAFE_INTEGER && x ? (f && o.getAttribute("morphTarget" + y) !== f[m] && o.setAttribute("morphTarget" + y, f[m]), g && o.getAttribute("morphNormal" + y) !== g[m] && o.setAttribute("morphNormal" + y, g[m]), t[y] = x, p += x) : (f && o.hasAttribute("morphTarget" + y) === !0 && o.deleteAttribute("morphTarget" + y), g && o.hasAttribute("morphNormal" + y) === !0 && o.deleteAttribute("morphNormal" + y), t[y] = 0); } const u = o.morphTargetsRelative ? 1 : 1 - p; c.getUniforms().setValue(n, "morphTargetBaseInfluence", u), c.getUniforms().setValue(n, "morphTargetInfluences", t); } return { update: r }; } function aO(n, e, t, i) { let r = /* @__PURE__ */ new WeakMap(); function s(c) { const l = i.render.frame, d = c.geometry, h = e.get(c, d); return r.get(h) !== l && (e.update(h), r.set(h, l)), c.isInstancedMesh && (c.hasEventListener("dispose", a) === !1 && c.addEventListener("dispose", a), t.update(c.instanceMatrix, 34962), c.instanceColor !== null && t.update(c.instanceColor, 34962)), h; } function o() { r = /* @__PURE__ */ new WeakMap(); } function a(c) { const l = c.target; l.removeEventListener("dispose", a), t.remove(l.instanceMatrix), l.instanceColor !== null && t.remove(l.instanceColor); } return { update: s, dispose: o }; } class Lf extends Yt { constructor(e = null, t = 1, i = 1, r = 1) { super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = $t, this.minFilter = $t, this.wrapR = hn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Lf.prototype.isDataTexture2DArray = !0; class Rf extends Yt { constructor(e = null, t = 1, i = 1, r = 1) { super(null), this.image = { data: e, width: t, height: i, depth: r }, this.magFilter = $t, this.minFilter = $t, this.wrapR = hn, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Rf.prototype.isDataTexture3D = !0; const fx = new Yt(), lO = new Lf(), cO = new Rf(), px = new ta(), ig = [], rg = [], sg = new Float32Array(16), og = new Float32Array(9), ag = new Float32Array(4); function na(n, e, t) { const i = n[0]; if (i <= 0 || i > 0) return n; const r = e * t; let s = ig[r]; if (s === void 0 && (s = new Float32Array(r), ig[r] = s), e !== 0) { i.toArray(s, 0); for (let o = 1, a = 0; o !== e; ++o) a += t, n[o].toArray(s, a); } return s; } function Ln(n, e) { if (n.length !== e.length) return !1; for (let t = 0, i = n.length; t < i; t++) if (n[t] !== e[t]) return !1; return !0; } function _n(n, e) { for (let t = 0, i = e.length; t < i; t++) n[t] = e[t]; } function mx(n, e) { let t = rg[e]; t === void 0 && (t = new Int32Array(e), rg[e] = t); for (let i = 0; i !== e; ++i) t[i] = n.allocateTextureUnit(); return t; } function uO(n, e) { const t = this.cache; t[0] !== e && (n.uniform1f(this.addr, e), t[0] = e); } function hO(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y) && (n.uniform2f(this.addr, e.x, e.y), t[0] = e.x, t[1] = e.y); else { if (Ln(t, e)) return; n.uniform2fv(this.addr, e), _n(t, e); } } function dO(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z) && (n.uniform3f(this.addr, e.x, e.y, e.z), t[0] = e.x, t[1] = e.y, t[2] = e.z); else if (e.r !== void 0) (t[0] !== e.r || t[1] !== e.g || t[2] !== e.b) && (n.uniform3f(this.addr, e.r, e.g, e.b), t[0] = e.r, t[1] = e.g, t[2] = e.b); else { if (Ln(t, e)) return; n.uniform3fv(this.addr, e), _n(t, e); } } function fO(n, e) { const t = this.cache; if (e.x !== void 0) (t[0] !== e.x || t[1] !== e.y || t[2] !== e.z || t[3] !== e.w) && (n.uniform4f(this.addr, e.x, e.y, e.z, e.w), t[0] = e.x, t[1] = e.y, t[2] = e.z, t[3] = e.w); else { if (Ln(t, e)) return; n.uniform4fv(this.addr, e), _n(t, e); } } function pO(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Ln(t, e)) return; n.uniformMatrix2fv(this.addr, !1, e), _n(t, e); } else { if (Ln(t, i)) return; ag.set(i), n.uniformMatrix2fv(this.addr, !1, ag), _n(t, i); } } function mO(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Ln(t, e)) return; n.uniformMatrix3fv(this.addr, !1, e), _n(t, e); } else { if (Ln(t, i)) return; og.set(i), n.uniformMatrix3fv(this.addr, !1, og), _n(t, i); } } function gO(n, e) { const t = this.cache, i = e.elements; if (i === void 0) { if (Ln(t, e)) return; n.uniformMatrix4fv(this.addr, !1, e), _n(t, e); } else { if (Ln(t, i)) return; sg.set(i), n.uniformMatrix4fv(this.addr, !1, sg), _n(t, i); } } function vO(n, e) { const t = this.cache; t[0] !== e && (n.uniform1i(this.addr, e), t[0] = e); } function yO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform2iv(this.addr, e), _n(t, e)); } function bO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform3iv(this.addr, e), _n(t, e)); } function xO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform4iv(this.addr, e), _n(t, e)); } function MO(n, e) { const t = this.cache; t[0] !== e && (n.uniform1ui(this.addr, e), t[0] = e); } function wO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform2uiv(this.addr, e), _n(t, e)); } function AO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform3uiv(this.addr, e), _n(t, e)); } function SO(n, e) { const t = this.cache; Ln(t, e) || (n.uniform4uiv(this.addr, e), _n(t, e)); } function _O(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTexture2D(e || fx, r); } function TO(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture3D(e || cO, r); } function EO(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.safeSetTextureCube(e || px, r); } function CO(n, e, t) { const i = this.cache, r = t.allocateTextureUnit(); i[0] !== r && (n.uniform1i(this.addr, r), i[0] = r), t.setTexture2DArray(e || lO, r); } function LO(n) { switch (n) { case 5126: return uO; case 35664: return hO; case 35665: return dO; case 35666: return fO; case 35674: return pO; case 35675: return mO; case 35676: return gO; case 5124: case 35670: return vO; case 35667: case 35671: return yO; case 35668: case 35672: return bO; case 35669: case 35673: return xO; case 5125: return MO; case 36294: return wO; case 36295: return AO; case 36296: return SO; case 35678: case 36198: case 36298: case 36306: case 35682: return _O; case 35679: case 36299: case 36307: return TO; case 35680: case 36300: case 36308: case 36293: return EO; case 36289: case 36303: case 36311: case 36292: return CO; } } function RO(n, e) { n.uniform1fv(this.addr, e); } function FO(n, e) { const t = na(e, this.size, 2); n.uniform2fv(this.addr, t); } function PO(n, e) { const t = na(e, this.size, 3); n.uniform3fv(this.addr, t); } function IO(n, e) { const t = na(e, this.size, 4); n.uniform4fv(this.addr, t); } function OO(n, e) { const t = na(e, this.size, 4); n.uniformMatrix2fv(this.addr, !1, t); } function DO(n, e) { const t = na(e, this.size, 9); n.uniformMatrix3fv(this.addr, !1, t); } function NO(n, e) { const t = na(e, this.size, 16); n.uniformMatrix4fv(this.addr, !1, t); } function BO(n, e) { n.uniform1iv(this.addr, e); } function UO(n, e) { n.uniform2iv(this.addr, e); } function zO(n, e) { n.uniform3iv(this.addr, e); } function VO(n, e) { n.uniform4iv(this.addr, e); } function kO(n, e) { n.uniform1uiv(this.addr, e); } function GO(n, e) { n.uniform2uiv(this.addr, e); } function HO(n, e) { n.uniform3uiv(this.addr, e); } function WO(n, e) { n.uniform4uiv(this.addr, e); } function jO(n, e, t) { const i = e.length, r = mx(t, i); n.uniform1iv(this.addr, r); for (let s = 0; s !== i; ++s) t.safeSetTexture2D(e[s] || fx, r[s]); } function $O(n, e, t) { const i = e.length, r = mx(t, i); n.uniform1iv(this.addr, r); for (let s = 0; s !== i; ++s) t.safeSetTextureCube(e[s] || px, r[s]); } function ZO(n) { switch (n) { case 5126: return RO; case 35664: return FO; case 35665: return PO; case 35666: return IO; case 35674: return OO; case 35675: return DO; case 35676: return NO; case 5124: case 35670: return BO; case 35667: case 35671: return UO; case 35668: case 35672: return zO; case 35669: case 35673: return VO; case 5125: return kO; case 36294: return GO; case 36295: return HO; case 36296: return WO; case 35678: case 36198: case 36298: case 36306: case 35682: return jO; case 35680: case 36300: case 36308: case 36293: return $O; } } function XO(n, e, t) { this.id = n, this.addr = t, this.cache = [], this.setValue = LO(e.type); } function gx(n, e, t) { this.id = n, this.addr = t, this.cache = [], this.size = e.size, this.setValue = ZO(e.type); } gx.prototype.updateCache = function(n) { const e = this.cache; n instanceof Float32Array && e.length !== n.length && (this.cache = new Float32Array(n.length)), _n(e, n); }; function vx(n) { this.id = n, this.seq = [], this.map = {}; } vx.prototype.setValue = function(n, e, t) { const i = this.seq; for (let r = 0, s = i.length; r !== s; ++r) { const o = i[r]; o.setValue(n, e[o.id], t); } }; const mh = /(\w+)(\])?(\[|\.)?/g; function lg(n, e) { n.seq.push(e), n.map[e.id] = e; } function YO(n, e, t) { const i = n.name, r = i.length; for (mh.lastIndex = 0; ; ) { const s = mh.exec(i), o = mh.lastIndex; let a = s[1]; const c = s[2] === "]", l = s[3]; if (c && (a = a | 0), l === void 0 || l === "[" && o + 2 === r) { lg(t, l === void 0 ? new XO(a, n, e) : new gx(a, n, e)); break; } else { let h = t.map[a]; h === void 0 && (h = new vx(a), lg(t, h)), t = h; } } } function Or(n, e) { this.seq = [], this.map = {}; const t = n.getProgramParameter(e, 35718); for (let i = 0; i < t; ++i) { const r = n.getActiveUniform(e, i), s = n.getUniformLocation(e, r.name); YO(r, s, this); } } Or.prototype.setValue = function(n, e, t, i) { const r = this.map[e]; r !== void 0 && r.setValue(n, t, i); }; Or.prototype.setOptional = function(n, e, t) { const i = e[t]; i !== void 0 && this.setValue(n, t, i); }; Or.upload = function(n, e, t, i) { for (let r = 0, s = e.length; r !== s; ++r) { const o = e[r], a = t[o.id]; a.needsUpdate !== !1 && o.setValue(n, a.value, i); } }; Or.seqWithValue = function(n, e) { const t = []; for (let i = 0, r = n.length; i !== r; ++i) { const s = n[i]; s.id in e && t.push(s); } return t; }; function cg(n, e, t) { const i = n.createShader(e); return n.shaderSource(i, t), n.compileShader(i), i; } let JO = 0; function KO(n) { const e = n.split(` `); for (let t = 0; t < e.length; t++) e[t] = t + 1 + ": " + e[t]; return e.join(` `); } function yx(n) { switch (n) { case Cn: return ["Linear", "( value )"]; case Cs: return ["sRGB", "( value )"]; case mu: return ["RGBE", "( value )"]; case Af: return ["RGBM", "( value, 7.0 )"]; case Sf: return ["RGBM", "( value, 16.0 )"]; case _f: return ["RGBD", "( value, 256.0 )"]; case pu: return ["Gamma", "( value, float( GAMMA_FACTOR ) )"]; case Xb: return ["LogLuv", "( value )"]; default: return console.warn("THREE.WebGLProgram: Unsupported encoding:", n), ["Linear", "( value )"]; } } function ug(n, e, t) { const i = n.getShaderParameter(e, 35713), r = n.getShaderInfoLog(e).trim(); if (i && r === "") return ""; const s = n.getShaderSource(e); return "THREE.WebGLShader: gl.getShaderInfoLog() " + t + ` ` + r + KO(s); } function ma(n, e) { const t = yx(e); return "vec4 " + n + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }"; } function qO(n, e) { const t = yx(e); return "vec4 " + n + "( vec4 value ) { return LinearTo" + t[0] + t[1] + "; }"; } function QO(n, e) { let t; switch (e) { case $y: t = "Linear"; break; case Zy: t = "Reinhard"; break; case Xy: t = "OptimizedCineon"; break; case Yy: t = "ACESFilmic"; break; case Jy: t = "Custom"; break; default: console.warn("THREE.WebGLProgram: Unsupported toneMapping:", e), t = "Linear"; } return "vec3 " + n + "( vec3 color ) { return " + t + "ToneMapping( color ); }"; } function eD(n) { return [ n.extensionDerivatives || n.envMapCubeUV || n.bumpMap || n.tangentSpaceNormalMap || n.clearcoatNormalMap || n.flatShading || n.shaderID === "physical" ? "#extension GL_OES_standard_derivatives : enable" : "", (n.extensionFragDepth || n.logarithmicDepthBuffer) && n.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", n.extensionDrawBuffers && n.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (n.extensionShaderTextureLOD || n.envMap || n.transmission > 0) && n.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : "" ].filter(Ta).join(` `); } function tD(n) { const e = []; for (const t in n) { const i = n[t]; i !== !1 && e.push("#define " + t + " " + i); } return e.join(` `); } function nD(n, e) { const t = {}, i = n.getProgramParameter(e, 35721); for (let r = 0; r < i; r++) { const o = n.getActiveAttrib(e, r).name; t[o] = n.getAttribLocation(e, o); } return t; } function Ta(n) { return n !== ""; } function hg(n, e) { return n.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows); } function dg(n, e) { return n.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection); } const iD = /^[ \t]*#include +<([\w\d./]+)>/gm; function Md(n) { return n.replace(iD, rD); } function rD(n, e) { const t = dt[e]; if (t === void 0) throw new Error("Can not resolve #include <" + e + ">"); return Md(t); } const sD = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, oD = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; function fg(n) { return n.replace(oD, bx).replace(sD, aD); } function aD(n, e, t, i) { return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."), bx(n, e, t, i); } function bx(n, e, t, i) { let r = ""; for (let s = parseInt(e); s < parseInt(t); s++) r += i.replace(/\[\s*i\s*\]/g, "[ " + s + " ]").replace(/UNROLLED_LOOP_INDEX/g, s); return r; } function pg(n) { let e = "precision " + n.precision + ` float; precision ` + n.precision + " int;"; return n.precision === "highp" ? e += ` #define HIGH_PRECISION` : n.precision === "mediump" ? e += ` #define MEDIUM_PRECISION` : n.precision === "lowp" && (e += ` #define LOW_PRECISION`), e; } function lD(n) { let e = "SHADOWMAP_TYPE_BASIC"; return n.shadowMapType === vf ? e = "SHADOWMAP_TYPE_PCF" : n.shadowMapType === Sy ? e = "SHADOWMAP_TYPE_PCF_SOFT" : n.shadowMapType === po && (e = "SHADOWMAP_TYPE_VSM"), e; } function cD(n) { let e = "ENVMAP_TYPE_CUBE"; if (n.envMap) switch (n.envMapMode) { case ll: case cl: e = "ENVMAP_TYPE_CUBE"; break; case ea: case ul: e = "ENVMAP_TYPE_CUBE_UV"; break; } return e; } function uD(n) { let e = "ENVMAP_MODE_REFLECTION"; if (n.envMap) switch (n.envMapMode) { case cl: case ul: e = "ENVMAP_MODE_REFRACTION"; break; } return e; } function hD(n) { let e = "ENVMAP_BLENDING_NONE"; if (n.envMap) switch (n.combine) { case al: e = "ENVMAP_BLENDING_MULTIPLY"; break; case Wy: e = "ENVMAP_BLENDING_MIX"; break; case jy: e = "ENVMAP_BLENDING_ADD"; break; } return e; } function dD(n, e, t, i) { const r = n.getContext(), s = t.defines; let o = t.vertexShader, a = t.fragmentShader; const c = lD(t), l = cD(t), d = uD(t), h = hD(t), f = n.gammaFactor > 0 ? n.gammaFactor : 1, g = t.isWebGL2 ? "" : eD(t), p = tD(s), u = r.createProgram(); let y, v, m = t.glslVersion ? "#version " + t.glslVersion + ` ` : ""; t.isRawShaderMaterial ? (y = [ p ].filter(Ta).join(` `), y.length > 0 && (y += ` `), v = [ g, p ].filter(Ta).join(` `), v.length > 0 && (v += ` `)) : (y = [ pg(t), "#define SHADER_NAME " + t.shaderName, p, t.instancing ? "#define USE_INSTANCING" : "", t.instancingColor ? "#define USE_INSTANCING_COLOR" : "", t.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + f, "#define MAX_BONES " + t.maxBones, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + d : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.displacementMap && t.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.transmission ? "#define USE_TRANSMISSION" : "", t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", t.thicknessMap ? "#define USE_THICKNESSMAP" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors ? "#define USE_COLOR" : "", t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.skinning ? "#define USE_SKINNING" : "", t.useVertexTexture ? "#define BONE_TEXTURE" : "", t.morphTargets ? "#define USE_MORPHTARGETS" : "", t.morphNormals && t.flatShading === !1 ? "#define USE_MORPHNORMALS" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + c : "", t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", " attribute mat4 instanceMatrix;", "#endif", "#ifdef USE_INSTANCING_COLOR", " attribute vec3 instanceColor;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", " attribute vec4 tangent;", "#endif", "#if defined( USE_COLOR_ALPHA )", " attribute vec4 color;", "#elif defined( USE_COLOR )", " attribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", " attribute vec3 morphTarget0;", " attribute vec3 morphTarget1;", " attribute vec3 morphTarget2;", " attribute vec3 morphTarget3;", " #ifdef USE_MORPHNORMALS", " attribute vec3 morphNormal0;", " attribute vec3 morphNormal1;", " attribute vec3 morphNormal2;", " attribute vec3 morphNormal3;", " #else", " attribute vec3 morphTarget4;", " attribute vec3 morphTarget5;", " attribute vec3 morphTarget6;", " attribute vec3 morphTarget7;", " #endif", "#endif", "#ifdef USE_SKINNING", " attribute vec4 skinIndex;", " attribute vec4 skinWeight;", "#endif", ` ` ].filter(Ta).join(` `), v = [ g, pg(t), "#define SHADER_NAME " + t.shaderName, p, t.alphaTest ? "#define ALPHATEST " + t.alphaTest + (t.alphaTest % 1 ? "" : ".0") : "", // add '.0' if integer "#define GAMMA_FACTOR " + f, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.matcap ? "#define USE_MATCAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + l : "", t.envMap ? "#define " + d : "", t.envMap ? "#define " + h : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.sheen ? "#define USE_SHEEN" : "", t.transmission ? "#define USE_TRANSMISSION" : "", t.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", t.thicknessMap ? "#define USE_THICKNESSMAP" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors || t.instancingColor ? "#define USE_COLOR" : "", t.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.gradientMap ? "#define USE_GRADIENTMAP" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + c : "", t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", t.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", (t.extensionShaderTextureLOD || t.envMap) && t.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", t.toneMapping !== Ir ? "#define TONE_MAPPING" : "", t.toneMapping !== Ir ? dt.tonemapping_pars_fragment : "", // this code is required here because it is used by the toneMapping() function defined below t.toneMapping !== Ir ? QO("toneMapping", t.toneMapping) : "", t.dithering ? "#define DITHERING" : "", dt.encodings_pars_fragment, // this code is required here because it is used by the various encoding/decoding function defined below t.map ? ma("mapTexelToLinear", t.mapEncoding) : "", t.matcap ? ma("matcapTexelToLinear", t.matcapEncoding) : "", t.envMap ? ma("envMapTexelToLinear", t.envMapEncoding) : "", t.emissiveMap ? ma("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "", t.lightMap ? ma("lightMapTexelToLinear", t.lightMapEncoding) : "", qO("linearToOutputTexel", t.outputEncoding), t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", ` ` ].filter(Ta).join(` `)), o = Md(o), o = hg(o, t), o = dg(o, t), a = Md(a), a = hg(a, t), a = dg(a, t), o = fg(o), a = fg(a), t.isWebGL2 && t.isRawShaderMaterial !== !0 && (m = `#version 300 es `, y = [ "#define attribute in", "#define varying out", "#define texture2D texture" ].join(` `) + ` ` + y, v = [ "#define varying in", t.glslVersion === yd ? "" : "out highp vec4 pc_fragColor;", t.glslVersion === yd ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad" ].join(` `) + ` ` + v); const x = m + y + o, w = m + v + a, A = cg(r, 35633, x), M = cg(r, 35632, w); if (r.attachShader(u, A), r.attachShader(u, M), t.index0AttributeName !== void 0 ? r.bindAttribLocation(u, 0, t.index0AttributeName) : t.morphTargets === !0 && r.bindAttribLocation(u, 0, "position"), r.linkProgram(u), n.debug.checkShaderErrors) { const S = r.getProgramInfoLog(u).trim(), I = r.getShaderInfoLog(A).trim(), T = r.getShaderInfoLog(M).trim(); let _ = !0, E = !0; if (r.getProgramParameter(u, 35714) === !1) { _ = !1; const C = ug(r, A, "vertex"), P = ug(r, M, "fragment"); console.error("THREE.WebGLProgram: shader error: ", r.getError(), "35715", r.getProgramParameter(u, 35715), "gl.getProgramInfoLog", S, C, P); } else S !== "" ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", S) : (I === "" || T === "") && (E = !1); E && (this.diagnostics = { runnable: _, programLog: S, vertexShader: { log: I, prefix: y }, fragmentShader: { log: T, prefix: v } }); } r.deleteShader(A), r.deleteShader(M); let R; this.getUniforms = function() { return R === void 0 && (R = new Or(r, u)), R; }; let L; return this.getAttributes = function() { return L === void 0 && (L = nD(r, u)), L; }, this.destroy = function() { i.releaseStatesOfProgram(this), r.deleteProgram(u), this.program = void 0; }, this.name = t.shaderName, this.id = JO++, this.cacheKey = e, this.usedTimes = 1, this.program = u, this.vertexShader = A, this.fragmentShader = M, this; } function fD(n, e, t, i, r, s) { const o = [], a = i.isWebGL2, c = i.logarithmicDepthBuffer, l = i.floatVertexTextures, d = i.maxVertexUniforms, h = i.vertexTextures; let f = i.precision; const g = { MeshDepthMaterial: "depth", MeshDistanceMaterial: "distanceRGBA", MeshNormalMaterial: "normal", MeshBasicMaterial: "basic", MeshLambertMaterial: "lambert", MeshPhongMaterial: "phong", MeshToonMaterial: "toon", MeshStandardMaterial: "physical", MeshPhysicalMaterial: "physical", MeshMatcapMaterial: "matcap", LineBasicMaterial: "basic", LineDashedMaterial: "dashed", PointsMaterial: "points", ShadowMaterial: "shadow", SpriteMaterial: "sprite" }, p = [ "precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "instancingColor", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexAlphas", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen", "transmission", "transmissionMap", "thicknessMap" ]; function u(M) { const L = M.skeleton.bones; if (l) return 1024; { const I = Math.floor((d - 20) / 4), T = Math.min(I, L.length); return T < L.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + L.length + " bones. This GPU supports " + T + "."), 0) : T; } } function y(M) { let R; return M && M.isTexture ? R = M.encoding : M && M.isWebGLRenderTarget ? (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), R = M.texture.encoding) : R = Cn, R; } function v(M, R, L, S, I) { const T = S.fog, _ = M.isMeshStandardMaterial ? S.environment : null, E = e.get(M.envMap || _), C = g[M.type], P = I.isSkinnedMesh ? u(I) : 0; M.precision !== null && (f = i.getMaxPrecision(M.precision), f !== M.precision && console.warn("THREE.WebGLProgram.getParameters:", M.precision, "not supported, using", f, "instead.")); let b, F; if (C) { const B = ci[C]; b = B.vertexShader, F = B.fragmentShader; } else b = M.vertexShader, F = M.fragmentShader; const D = n.getRenderTarget(); return { isWebGL2: a, shaderID: C, shaderName: M.type, vertexShader: b, fragmentShader: F, defines: M.defines, isRawShaderMaterial: M.isRawShaderMaterial === !0, glslVersion: M.glslVersion, precision: f, instancing: I.isInstancedMesh === !0, instancingColor: I.isInstancedMesh === !0 && I.instanceColor !== null, supportsVertexTextures: h, outputEncoding: D !== null ? y(D.texture) : n.outputEncoding, map: !!M.map, mapEncoding: y(M.map), matcap: !!M.matcap, matcapEncoding: y(M.matcap), envMap: !!E, envMapMode: E && E.mapping, envMapEncoding: y(E), envMapCubeUV: !!E && (E.mapping === ea || E.mapping === ul), lightMap: !!M.lightMap, lightMapEncoding: y(M.lightMap), aoMap: !!M.aoMap, emissiveMap: !!M.emissiveMap, emissiveMapEncoding: y(M.emissiveMap), bumpMap: !!M.bumpMap, normalMap: !!M.normalMap, objectSpaceNormalMap: M.normalMapType === Kb, tangentSpaceNormalMap: M.normalMapType === Jr, clearcoatMap: !!M.clearcoatMap, clearcoatRoughnessMap: !!M.clearcoatRoughnessMap, clearcoatNormalMap: !!M.clearcoatNormalMap, displacementMap: !!M.displacementMap, roughnessMap: !!M.roughnessMap, metalnessMap: !!M.metalnessMap, specularMap: !!M.specularMap, alphaMap: !!M.alphaMap, gradientMap: !!M.gradientMap, sheen: !!M.sheen, transmission: !!M.transmission, transmissionMap: !!M.transmissionMap, thicknessMap: !!M.thicknessMap, combine: M.combine, vertexTangents: M.normalMap && M.vertexTangents, vertexColors: M.vertexColors, vertexAlphas: M.vertexColors === !0 && I.geometry && I.geometry.attributes.color && I.geometry.attributes.color.itemSize === 4, vertexUvs: !!M.map || !!M.bumpMap || !!M.normalMap || !!M.specularMap || !!M.alphaMap || !!M.emissiveMap || !!M.roughnessMap || !!M.metalnessMap || !!M.clearcoatMap || !!M.clearcoatRoughnessMap || !!M.clearcoatNormalMap || !!M.displacementMap || !!M.transmissionMap || !!M.thicknessMap, uvsVertexOnly: !(M.map || M.bumpMap || M.normalMap || M.specularMap || M.alphaMap || M.emissiveMap || M.roughnessMap || M.metalnessMap || M.clearcoatNormalMap || M.transmission || M.transmissionMap || M.thicknessMap) && !!M.displacementMap, fog: !!T, useFog: M.fog, fogExp2: T && T.isFogExp2, flatShading: !!M.flatShading, sizeAttenuation: M.sizeAttenuation, logarithmicDepthBuffer: c, skinning: I.isSkinnedMesh === !0 && P > 0, maxBones: P, useVertexTexture: l, morphTargets: M.morphTargets, morphNormals: M.morphNormals, numDirLights: R.directional.length, numPointLights: R.point.length, numSpotLights: R.spot.length, numRectAreaLights: R.rectArea.length, numHemiLights: R.hemi.length, numDirLightShadows: R.directionalShadowMap.length, numPointLightShadows: R.pointShadowMap.length, numSpotLightShadows: R.spotShadowMap.length, numClippingPlanes: s.numPlanes, numClipIntersection: s.numIntersection, dithering: M.dithering, shadowMapEnabled: n.shadowMap.enabled && L.length > 0, shadowMapType: n.shadowMap.type, toneMapping: M.toneMapped ? n.toneMapping : Ir, physicallyCorrectLights: n.physicallyCorrectLights, premultipliedAlpha: M.premultipliedAlpha, alphaTest: M.alphaTest, doubleSided: M.side === Wr, flipSided: M.side === jt, depthPacking: M.depthPacking !== void 0 ? M.depthPacking : !1, index0AttributeName: M.index0AttributeName, extensionDerivatives: M.extensions && M.extensions.derivatives, extensionFragDepth: M.extensions && M.extensions.fragDepth, extensionDrawBuffers: M.extensions && M.extensions.drawBuffers, extensionShaderTextureLOD: M.extensions && M.extensions.shaderTextureLOD, rendererExtensionFragDepth: a || t.has("EXT_frag_depth"), rendererExtensionDrawBuffers: a || t.has("WEBGL_draw_buffers"), rendererExtensionShaderTextureLod: a || t.has("EXT_shader_texture_lod"), customProgramCacheKey: M.customProgramCacheKey() }; } function m(M) { const R = []; if (M.shaderID ? R.push(M.shaderID) : (R.push(M.fragmentShader), R.push(M.vertexShader)), M.defines !== void 0) for (const L in M.defines) R.push(L), R.push(M.defines[L]); if (M.isRawShaderMaterial === !1) { for (let L = 0; L < p.length; L++) R.push(M[p[L]]); R.push(n.outputEncoding), R.push(n.gammaFactor); } return R.push(M.customProgramCacheKey), R.join(); } function x(M) { const R = g[M.type]; let L; if (R) { const S = ci[R]; L = hx.clone(S.uniforms); } else L = M.uniforms; return L; } function w(M, R) { let L; for (let S = 0, I = o.length; S < I; S++) { const T = o[S]; if (T.cacheKey === R) { L = T, ++L.usedTimes; break; } } return L === void 0 && (L = new dD(n, R, M, r), o.push(L)), L; } function A(M) { if (--M.usedTimes === 0) { const R = o.indexOf(M); o[R] = o[o.length - 1], o.pop(), M.destroy(); } } return { getParameters: v, getProgramCacheKey: m, getUniforms: x, acquireProgram: w, releaseProgram: A, // Exposed for resource monitoring & error feedback via renderer.info: programs: o }; } function pD() { let n = /* @__PURE__ */ new WeakMap(); function e(s) { let o = n.get(s); return o === void 0 && (o = {}, n.set(s, o)), o; } function t(s) { n.delete(s); } function i(s, o, a) { n.get(s)[o] = a; } function r() { n = /* @__PURE__ */ new WeakMap(); } return { get: e, remove: t, update: i, dispose: r }; } function mD(n, e) { return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.program !== e.program ? n.program.id - e.program.id : n.material.id !== e.material.id ? n.material.id - e.material.id : n.z !== e.z ? n.z - e.z : n.id - e.id; } function mg(n, e) { return n.groupOrder !== e.groupOrder ? n.groupOrder - e.groupOrder : n.renderOrder !== e.renderOrder ? n.renderOrder - e.renderOrder : n.z !== e.z ? e.z - n.z : n.id - e.id; } function gg(n) { const e = []; let t = 0; const i = [], r = [], s = [], o = { id: -1 }; function a() { t = 0, i.length = 0, r.length = 0, s.length = 0; } function c(g, p, u, y, v, m) { let x = e[t]; const w = n.get(u); return x === void 0 ? (x = { id: g.id, object: g, geometry: p, material: u, program: w.program || o, groupOrder: y, renderOrder: g.renderOrder, z: v, group: m }, e[t] = x) : (x.id = g.id, x.object = g, x.geometry = p, x.material = u, x.program = w.program || o, x.groupOrder = y, x.renderOrder = g.renderOrder, x.z = v, x.group = m), t++, x; } function l(g, p, u, y, v, m) { const x = c(g, p, u, y, v, m); u.transmission > 0 ? r.push(x) : u.transparent === !0 ? s.push(x) : i.push(x); } function d(g, p, u, y, v, m) { const x = c(g, p, u, y, v, m); u.transmission > 0 ? r.unshift(x) : u.transparent === !0 ? s.unshift(x) : i.unshift(x); } function h(g, p) { i.length > 1 && i.sort(g || mD), r.length > 1 && r.sort(p || mg), s.length > 1 && s.sort(p || mg); } function f() { for (let g = t, p = e.length; g < p; g++) { const u = e[g]; if (u.id === null) break; u.id = null, u.object = null, u.geometry = null, u.material = null, u.program = null, u.group = null; } } return { opaque: i, transmissive: r, transparent: s, init: a, push: l, unshift: d, finish: f, sort: h }; } function gD(n) { let e = /* @__PURE__ */ new WeakMap(); function t(r, s) { let o; return e.has(r) === !1 ? (o = new gg(n), e.set(r, [o])) : s >= e.get(r).length ? (o = new gg(n), e.get(r).push(o)) : o = e.get(r)[s], o; } function i() { e = /* @__PURE__ */ new WeakMap(); } return { get: t, dispose: i }; } function vD() { const n = {}; return { get: function(e) { if (n[e.id] !== void 0) return n[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { direction: new q(), color: new Ue() }; break; case "SpotLight": t = { position: new q(), direction: new q(), color: new Ue(), distance: 0, coneCos: 0, penumbraCos: 0, decay: 0 }; break; case "PointLight": t = { position: new q(), color: new Ue(), distance: 0, decay: 0 }; break; case "HemisphereLight": t = { direction: new q(), skyColor: new Ue(), groundColor: new Ue() }; break; case "RectAreaLight": t = { color: new Ue(), position: new q(), halfWidth: new q(), halfHeight: new q() }; break; } return n[e.id] = t, t; } }; } function yD() { const n = {}; return { get: function(e) { if (n[e.id] !== void 0) return n[e.id]; let t; switch (e.type) { case "DirectionalLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re() }; break; case "SpotLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re() }; break; case "PointLight": t = { shadowBias: 0, shadowNormalBias: 0, shadowRadius: 1, shadowMapSize: new Re(), shadowCameraNear: 1, shadowCameraFar: 1e3 }; break; } return n[e.id] = t, t; } }; } let bD = 0; function xD(n, e) { return (e.castShadow ? 1 : 0) - (n.castShadow ? 1 : 0); } function MD(n, e) { const t = new vD(), i = yD(), r = { version: 0, hash: { directionalLength: -1, pointLength: -1, spotLength: -1, rectAreaLength: -1, hemiLength: -1, numDirectionalShadows: -1, numPointShadows: -1, numSpotShadows: -1 }, ambient: [0, 0, 0], probe: [], directional: [], directionalShadow: [], directionalShadowMap: [], directionalShadowMatrix: [], spot: [], spotShadow: [], spotShadowMap: [], spotShadowMatrix: [], rectArea: [], rectAreaLTC1: null, rectAreaLTC2: null, point: [], pointShadow: [], pointShadowMap: [], pointShadowMatrix: [], hemi: [] }; for (let d = 0; d < 9; d++) r.probe.push(new q()); const s = new q(), o = new Xe(), a = new Xe(); function c(d) { let h = 0, f = 0, g = 0; for (let R = 0; R < 9; R++) r.probe[R].set(0, 0, 0); let p = 0, u = 0, y = 0, v = 0, m = 0, x = 0, w = 0, A = 0; d.sort(xD); for (let R = 0, L = d.length; R < L; R++) { const S = d[R], I = S.color, T = S.intensity, _ = S.distance, E = S.shadow && S.shadow.map ? S.shadow.map.texture : null; if (S.isAmbientLight) h += I.r * T, f += I.g * T, g += I.b * T; else if (S.isLightProbe) for (let C = 0; C < 9; C++) r.probe[C].addScaledVector(S.sh.coefficients[C], T); else if (S.isDirectionalLight) { const C = t.get(S); if (C.color.copy(S.color).multiplyScalar(S.intensity), S.castShadow) { const P = S.shadow, b = i.get(S); b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, r.directionalShadow[p] = b, r.directionalShadowMap[p] = E, r.directionalShadowMatrix[p] = S.shadow.matrix, x++; } r.directional[p] = C, p++; } else if (S.isSpotLight) { const C = t.get(S); if (C.position.setFromMatrixPosition(S.matrixWorld), C.color.copy(I).multiplyScalar(T), C.distance = _, C.coneCos = Math.cos(S.angle), C.penumbraCos = Math.cos(S.angle * (1 - S.penumbra)), C.decay = S.decay, S.castShadow) { const P = S.shadow, b = i.get(S); b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, r.spotShadow[y] = b, r.spotShadowMap[y] = E, r.spotShadowMatrix[y] = S.shadow.matrix, A++; } r.spot[y] = C, y++; } else if (S.isRectAreaLight) { const C = t.get(S); C.color.copy(I).multiplyScalar(T), C.halfWidth.set(S.width * 0.5, 0, 0), C.halfHeight.set(0, S.height * 0.5, 0), r.rectArea[v] = C, v++; } else if (S.isPointLight) { const C = t.get(S); if (C.color.copy(S.color).multiplyScalar(S.intensity), C.distance = S.distance, C.decay = S.decay, S.castShadow) { const P = S.shadow, b = i.get(S); b.shadowBias = P.bias, b.shadowNormalBias = P.normalBias, b.shadowRadius = P.radius, b.shadowMapSize = P.mapSize, b.shadowCameraNear = P.camera.near, b.shadowCameraFar = P.camera.far, r.pointShadow[u] = b, r.pointShadowMap[u] = E, r.pointShadowMatrix[u] = S.shadow.matrix, w++; } r.point[u] = C, u++; } else if (S.isHemisphereLight) { const C = t.get(S); C.skyColor.copy(S.color).multiplyScalar(T), C.groundColor.copy(S.groundColor).multiplyScalar(T), r.hemi[m] = C, m++; } } v > 0 && (e.isWebGL2 || n.has("OES_texture_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_FLOAT_1, r.rectAreaLTC2 = ze.LTC_FLOAT_2) : n.has("OES_texture_half_float_linear") === !0 ? (r.rectAreaLTC1 = ze.LTC_HALF_1, r.rectAreaLTC2 = ze.LTC_HALF_2) : console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")), r.ambient[0] = h, r.ambient[1] = f, r.ambient[2] = g; const M = r.hash; (M.directionalLength !== p || M.pointLength !== u || M.spotLength !== y || M.rectAreaLength !== v || M.hemiLength !== m || M.numDirectionalShadows !== x || M.numPointShadows !== w || M.numSpotShadows !== A) && (r.directional.length = p, r.spot.length = y, r.rectArea.length = v, r.point.length = u, r.hemi.length = m, r.directionalShadow.length = x, r.directionalShadowMap.length = x, r.pointShadow.length = w, r.pointShadowMap.length = w, r.spotShadow.length = A, r.spotShadowMap.length = A, r.directionalShadowMatrix.length = x, r.pointShadowMatrix.length = w, r.spotShadowMatrix.length = A, M.directionalLength = p, M.pointLength = u, M.spotLength = y, M.rectAreaLength = v, M.hemiLength = m, M.numDirectionalShadows = x, M.numPointShadows = w, M.numSpotShadows = A, r.version = bD++); } function l(d, h) { let f = 0, g = 0, p = 0, u = 0, y = 0; const v = h.matrixWorldInverse; for (let m = 0, x = d.length; m < x; m++) { const w = d[m]; if (w.isDirectionalLight) { const A = r.directional[f]; A.direction.setFromMatrixPosition(w.matrixWorld), s.setFromMatrixPosition(w.target.matrixWorld), A.direction.sub(s), A.direction.transformDirection(v), f++; } else if (w.isSpotLight) { const A = r.spot[p]; A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), A.direction.setFromMatrixPosition(w.matrixWorld), s.setFromMatrixPosition(w.target.matrixWorld), A.direction.sub(s), A.direction.transformDirection(v), p++; } else if (w.isRectAreaLight) { const A = r.rectArea[u]; A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), a.identity(), o.copy(w.matrixWorld), o.premultiply(v), a.extractRotation(o), A.halfWidth.set(w.width * 0.5, 0, 0), A.halfHeight.set(0, w.height * 0.5, 0), A.halfWidth.applyMatrix4(a), A.halfHeight.applyMatrix4(a), u++; } else if (w.isPointLight) { const A = r.point[g]; A.position.setFromMatrixPosition(w.matrixWorld), A.position.applyMatrix4(v), g++; } else if (w.isHemisphereLight) { const A = r.hemi[y]; A.direction.setFromMatrixPosition(w.matrixWorld), A.direction.transformDirection(v), A.direction.normalize(), y++; } } } return { setup: c, setupView: l, state: r }; } function vg(n, e) { const t = new MD(n, e), i = [], r = []; function s() { i.length = 0, r.length = 0; } function o(h) { i.push(h); } function a(h) { r.push(h); } function c() { t.setup(i); } function l(h) { t.setupView(i, h); } return { init: s, state: { lightsArray: i, shadowsArray: r, lights: t }, setupLights: c, setupLightsView: l, pushLight: o, pushShadow: a }; } function wD(n, e) { let t = /* @__PURE__ */ new WeakMap(); function i(s, o = 0) { let a; return t.has(s) === !1 ? (a = new vg(n, e), t.set(s, [a])) : o >= t.get(s).length ? (a = new vg(n, e), t.get(s).push(a)) : a = t.get(s)[o], a; } function r() { t = /* @__PURE__ */ new WeakMap(); } return { get: i, dispose: r }; } class xu extends tn { constructor(e) { super(), this.type = "MeshDepthMaterial", this.depthPacking = Yb, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.setValues(e); } copy(e) { return super.copy(e), this.depthPacking = e.depthPacking, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this; } } xu.prototype.isMeshDepthMaterial = !0; class Mu extends tn { constructor(e) { super(), this.type = "MeshDistanceMaterial", this.referencePosition = new q(), this.nearDistance = 1, this.farDistance = 1e3, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = !1, this.setValues(e); } copy(e) { return super.copy(e), this.referencePosition.copy(e.referencePosition), this.nearDistance = e.nearDistance, this.farDistance = e.farDistance, this.morphTargets = e.morphTargets, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this; } } Mu.prototype.isMeshDistanceMaterial = !0; var AD = `uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include 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 ) ); }`, SD = `void main() { gl_Position = vec4( position, 1.0 ); }`; function xx(n, e, t) { let i = new dl(); const r = new Re(), s = new Re(), o = new xt(), a = [], c = [], l = {}, d = t.maxTextureSize, h = { 0: jt, 1: Hr, 2: Wr }, f = new or({ defines: { SAMPLE_RATE: 2 / 8, HALF_SAMPLE_RATE: 1 / 8 }, uniforms: { shadow_pass: { value: null }, resolution: { value: new Re() }, radius: { value: 4 } }, vertexShader: SD, fragmentShader: AD }), g = f.clone(); g.defines.HORIZONTAL_PASS = 1; const p = new Ke(); p.setAttribute( "position", new ot( new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3 ) ); const u = new Xt(p, f), y = this; this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = vf, this.render = function(M, R, L) { if (y.enabled === !1 || y.autoUpdate === !1 && y.needsUpdate === !1 || M.length === 0) return; const S = n.getRenderTarget(), I = n.getActiveCubeFace(), T = n.getActiveMipmapLevel(), _ = n.state; _.setBlending(tr), _.buffers.color.setClear(1, 1, 1, 1), _.buffers.depth.setTest(!0), _.setScissorTest(!1); for (let E = 0, C = M.length; E < C; E++) { const P = M[E], b = P.shadow; if (b === void 0) { console.warn("THREE.WebGLShadowMap:", P, "has no shadow."); continue; } if (b.autoUpdate === !1 && b.needsUpdate === !1) continue; r.copy(b.mapSize); const F = b.getFrameExtents(); if (r.multiply(F), s.copy(b.mapSize), (r.x > d || r.y > d) && (r.x > d && (s.x = Math.floor(d / F.x), r.x = s.x * F.x, b.mapSize.x = s.x), r.y > d && (s.y = Math.floor(d / F.y), r.y = s.y * F.y, b.mapSize.y = s.y)), b.map === null && !b.isPointLightShadow && this.type === po) { const N = { minFilter: zt, magFilter: zt, format: Gn }; b.map = new fi(r.x, r.y, N), b.map.texture.name = P.name + ".shadowMap", b.mapPass = new fi(r.x, r.y, N), b.camera.updateProjectionMatrix(); } if (b.map === null) { const N = { minFilter: $t, magFilter: $t, format: Gn }; b.map = new fi(r.x, r.y, N), b.map.texture.name = P.name + ".shadowMap", b.camera.updateProjectionMatrix(); } n.setRenderTarget(b.map), n.clear(); const D = b.getViewportCount(); for (let N = 0; N < D; N++) { const B = b.getViewport(N); o.set( s.x * B.x, s.y * B.y, s.x * B.z, s.y * B.w ), _.viewport(o), b.updateMatrices(P, N), i = b.getFrustum(), A(R, L, b.camera, P, this.type); } !b.isPointLightShadow && this.type === po && v(b, L), b.needsUpdate = !1; } y.needsUpdate = !1, n.setRenderTarget(S, I, T); }; function v(M, R) { const L = e.update(u); f.uniforms.shadow_pass.value = M.map.texture, f.uniforms.resolution.value = M.mapSize, f.uniforms.radius.value = M.radius, n.setRenderTarget(M.mapPass), n.clear(), n.renderBufferDirect(R, null, L, f, u, null), g.uniforms.shadow_pass.value = M.mapPass.texture, g.uniforms.resolution.value = M.mapSize, g.uniforms.radius.value = M.radius, n.setRenderTarget(M.map), n.clear(), n.renderBufferDirect(R, null, L, g, u, null); } function m(M) { const R = M << 0; let L = a[R]; return L === void 0 && (L = new xu({ depthPacking: Jb, morphTargets: M }), a[R] = L), L; } function x(M) { const R = M << 0; let L = c[R]; return L === void 0 && (L = new Mu({ morphTargets: M }), c[R] = L), L; } function w(M, R, L, S, I, T, _) { let E = null, C = m, P = M.customDepthMaterial; if (S.isPointLight === !0 && (C = x, P = M.customDistanceMaterial), P === void 0) { let b = !1; L.morphTargets === !0 && (b = R.morphAttributes && R.morphAttributes.position && R.morphAttributes.position.length > 0), E = C(b); } else E = P; if (n.localClippingEnabled && L.clipShadows === !0 && L.clippingPlanes.length !== 0) { const b = E.uuid, F = L.uuid; let D = l[b]; D === void 0 && (D = {}, l[b] = D); let N = D[F]; N === void 0 && (N = E.clone(), D[F] = N), E = N; } return E.visible = L.visible, E.wireframe = L.wireframe, _ === po ? E.side = L.shadowSide !== null ? L.shadowSide : L.side : E.side = L.shadowSide !== null ? L.shadowSide : h[L.side], E.clipShadows = L.clipShadows, E.clippingPlanes = L.clippingPlanes, E.clipIntersection = L.clipIntersection, E.wireframeLinewidth = L.wireframeLinewidth, E.linewidth = L.linewidth, S.isPointLight === !0 && E.isMeshDistanceMaterial === !0 && (E.referencePosition.setFromMatrixPosition(S.matrixWorld), E.nearDistance = I, E.farDistance = T), E; } function A(M, R, L, S, I) { if (M.visible === !1) return; if (M.layers.test(R.layers) && (M.isMesh || M.isLine || M.isPoints) && (M.castShadow || M.receiveShadow && I === po) && (!M.frustumCulled || i.intersectsObject(M))) { M.modelViewMatrix.multiplyMatrices(L.matrixWorldInverse, M.matrixWorld); const E = e.update(M), C = M.material; if (Array.isArray(C)) { const P = E.groups; for (let b = 0, F = P.length; b < F; b++) { const D = P[b], N = C[D.materialIndex]; if (N && N.visible) { const B = w(M, E, N, S, L.near, L.far, I); n.renderBufferDirect(L, null, E, B, M, D); } } } else if (C.visible) { const P = w(M, E, C, S, L.near, L.far, I); n.renderBufferDirect(L, null, E, P, M, null); } } const _ = M.children; for (let E = 0, C = _.length; E < C; E++) A(_[E], R, L, S, I); } } function _D(n, e, t) { const i = t.isWebGL2; function r() { let ne = !1; const me = new xt(); let Me = null; const De = new xt(0, 0, 0, 0); return { setMask: function(Ie) { Me !== Ie && !ne && (n.colorMask(Ie, Ie, Ie, Ie), Me = Ie); }, setLocked: function(Ie) { ne = Ie; }, setClear: function(Ie, $e, lt, qe, Mt) { Mt === !0 && (Ie *= qe, $e *= qe, lt *= qe), me.set(Ie, $e, lt, qe), De.equals(me) === !1 && (n.clearColor(Ie, $e, lt, qe), De.copy(me)); }, reset: function() { ne = !1, Me = null, De.set(-1, 0, 0, 0); } }; } function s() { let ne = !1, me = null, Me = null, De = null; return { setTest: function(Ie) { Ie ? te(2929) : ae(2929); }, setMask: function(Ie) { me !== Ie && !ne && (n.depthMask(Ie), me = Ie); }, setFunc: function(Ie) { if (Me !== Ie) { if (Ie) switch (Ie) { case By: n.depthFunc(512); break; case Uy: n.depthFunc(519); break; case zy: n.depthFunc(513); break; case Vc: n.depthFunc(515); break; case Vy: n.depthFunc(514); break; case ky: n.depthFunc(518); break; case Gy: n.depthFunc(516); break; case Hy: n.depthFunc(517); break; default: n.depthFunc(515); } else n.depthFunc(515); Me = Ie; } }, setLocked: function(Ie) { ne = Ie; }, setClear: function(Ie) { De !== Ie && (n.clearDepth(Ie), De = Ie); }, reset: function() { ne = !1, me = null, Me = null, De = null; } }; } function o() { let ne = !1, me = null, Me = null, De = null, Ie = null, $e = null, lt = null, qe = null, Mt = null; return { setTest: function(Be) { ne || (Be ? te(2960) : ae(2960)); }, setMask: function(Be) { me !== Be && !ne && (n.stencilMask(Be), me = Be); }, setFunc: function(Be, it, tt) { (Me !== Be || De !== it || Ie !== tt) && (n.stencilFunc(Be, it, tt), Me = Be, De = it, Ie = tt); }, setOp: function(Be, it, tt) { ($e !== Be || lt !== it || qe !== tt) && (n.stencilOp(Be, it, tt), $e = Be, lt = it, qe = tt); }, setLocked: function(Be) { ne = Be; }, setClear: function(Be) { Mt !== Be && (n.clearStencil(Be), Mt = Be); }, reset: function() { ne = !1, me = null, Me = null, De = null, Ie = null, $e = null, lt = null, qe = null, Mt = null; } }; } const a = new r(), c = new s(), l = new o(); let d = {}, h = null, f = {}, g = null, p = !1, u = null, y = null, v = null, m = null, x = null, w = null, A = null, M = !1, R = null, L = null, S = null, I = null, T = null; const _ = n.getParameter(35661); let E = !1, C = 0; const P = n.getParameter(7938); P.indexOf("WebGL") !== -1 ? (C = parseFloat(/^WebGL (\d)/.exec(P)[1]), E = C >= 1) : P.indexOf("OpenGL ES") !== -1 && (C = parseFloat(/^OpenGL ES (\d)/.exec(P)[1]), E = C >= 2); let b = null, F = {}; const D = n.getParameter(3088), N = n.getParameter(2978), B = new xt().fromArray(D), U = new xt().fromArray(N); function G(ne, me, Me) { const De = new Uint8Array(4), Ie = n.createTexture(); n.bindTexture(ne, Ie), n.texParameteri(ne, 10241, 9728), n.texParameteri(ne, 10240, 9728); for (let $e = 0; $e < Me; $e++) n.texImage2D(me + $e, 0, 6408, 1, 1, 0, 6408, 5121, De); return Ie; } const Y = {}; Y[3553] = G(3553, 3553, 1), Y[34067] = G(34067, 34069, 6), a.setClear(0, 0, 0, 1), c.setClear(1), l.setClear(0), te(2929), c.setFunc(Vc), H(!1), K(nd), te(2884), re(tr); function te(ne) { d[ne] !== !0 && (n.enable(ne), d[ne] = !0); } function ae(ne) { d[ne] !== !1 && (n.disable(ne), d[ne] = !1); } function ie(ne) { ne !== h && (n.bindFramebuffer(36160, ne), h = ne); } function le(ne, me) { return me === null && h !== null && (me = h), f[ne] !== me ? (n.bindFramebuffer(ne, me), f[ne] = me, i && (ne === 36009 && (f[36160] = me), ne === 36160 && (f[36009] = me)), !0) : !1; } function W(ne) { return g !== ne ? (n.useProgram(ne), g = ne, !0) : !1; } const $ = { [ps]: 32774, [Ty]: 32778, [Ey]: 32779 }; if (i) $[od] = 32775, $[ad] = 32776; else { const ne = e.get("EXT_blend_minmax"); ne !== null && ($[od] = ne.MIN_EXT, $[ad] = ne.MAX_EXT); } const j = { [Cy]: 0, [Ly]: 1, [Ry]: 768, [bf]: 770, [Ny]: 776, [Oy]: 774, [Py]: 772, [Fy]: 769, [xf]: 771, [Dy]: 775, [Iy]: 773 }; function re(ne, me, Me, De, Ie, $e, lt, qe) { if (ne === tr) { p === !0 && (ae(3042), p = !1); return; } if (p === !1 && (te(3042), p = !0), ne !== _y) { if (ne !== u || qe !== M) { if ((y !== ps || x !== ps) && (n.blendEquation(32774), y = ps, x = ps), qe) switch (ne) { case vo: n.blendFuncSeparate(1, 771, 1, 771); break; case id: n.blendFunc(1, 1); break; case rd: n.blendFuncSeparate(0, 0, 769, 771); break; case sd: n.blendFuncSeparate(0, 768, 0, 770); break; default: console.error("THREE.WebGLState: Invalid blending: ", ne); break; } else switch (ne) { case vo: n.blendFuncSeparate(770, 771, 1, 771); break; case id: n.blendFunc(770, 1); break; case rd: n.blendFunc(0, 769); break; case sd: n.blendFunc(0, 768); break; default: console.error("THREE.WebGLState: Invalid blending: ", ne); break; } v = null, m = null, w = null, A = null, u = ne, M = qe; } return; } Ie = Ie || me, $e = $e || Me, lt = lt || De, (me !== y || Ie !== x) && (n.blendEquationSeparate($[me], $[Ie]), y = me, x = Ie), (Me !== v || De !== m || $e !== w || lt !== A) && (n.blendFuncSeparate(j[Me], j[De], j[$e], j[lt]), v = Me, m = De, w = $e, A = lt), u = ne, M = null; } function V(ne, me) { ne.side === Wr ? ae(2884) : te(2884); let Me = ne.side === jt; me && (Me = !Me), H(Me), ne.blending === vo && ne.transparent === !1 ? re(tr) : re(ne.blending, ne.blendEquation, ne.blendSrc, ne.blendDst, ne.blendEquationAlpha, ne.blendSrcAlpha, ne.blendDstAlpha, ne.premultipliedAlpha), c.setFunc(ne.depthFunc), c.setTest(ne.depthTest), c.setMask(ne.depthWrite), a.setMask(ne.colorWrite); const De = ne.stencilWrite; l.setTest(De), De && (l.setMask(ne.stencilWriteMask), l.setFunc(ne.stencilFunc, ne.stencilRef, ne.stencilFuncMask), l.setOp(ne.stencilFail, ne.stencilZFail, ne.stencilZPass)), se(ne.polygonOffset, ne.polygonOffsetFactor, ne.polygonOffsetUnits), ne.alphaToCoverage === !0 ? te(32926) : ae(32926); } function H(ne) { R !== ne && (ne ? n.frontFace(2304) : n.frontFace(2305), R = ne); } function K(ne) { ne !== wy ? (te(2884), ne !== L && (ne === nd ? n.cullFace(1029) : ne === Ay ? n.cullFace(1028) : n.cullFace(1032))) : ae(2884), L = ne; } function ce(ne) { ne !== S && (E && n.lineWidth(ne), S = ne); } function se(ne, me, Me) { ne ? (te(32823), (I !== me || T !== Me) && (n.polygonOffset(me, Me), I = me, T = Me)) : ae(32823); } function k(ne) { ne ? te(3089) : ae(3089); } function O(ne) { ne === void 0 && (ne = 33984 + _ - 1), b !== ne && (n.activeTexture(ne), b = ne); } function Z(ne, me) { b === null && O(); let Me = F[b]; Me === void 0 && (Me = { type: void 0, texture: void 0 }, F[b] = Me), (Me.type !== ne || Me.texture !== me) && (n.bindTexture(ne, me || Y[ne]), Me.type = ne, Me.texture = me); } function X() { const ne = F[b]; ne !== void 0 && ne.type !== void 0 && (n.bindTexture(ne.type, null), ne.type = void 0, ne.texture = void 0); } function ee() { try { n.compressedTexImage2D.apply(n, arguments); } catch (ne) { console.error("THREE.WebGLState:", ne); } } function fe() { try { n.texImage2D.apply(n, arguments); } catch (ne) { console.error("THREE.WebGLState:", ne); } } function be() { try { n.texImage3D.apply(n, arguments); } catch (ne) { console.error("THREE.WebGLState:", ne); } } function Ae(ne) { B.equals(ne) === !1 && (n.scissor(ne.x, ne.y, ne.z, ne.w), B.copy(ne)); } function he(ne) { U.equals(ne) === !1 && (n.viewport(ne.x, ne.y, ne.z, ne.w), U.copy(ne)); } function xe() { n.disable(3042), n.disable(2884), n.disable(2929), n.disable(32823), n.disable(3089), n.disable(2960), n.disable(32926), n.blendEquation(32774), n.blendFunc(1, 0), n.blendFuncSeparate(1, 0, 1, 0), n.colorMask(!0, !0, !0, !0), n.clearColor(0, 0, 0, 0), n.depthMask(!0), n.depthFunc(513), n.clearDepth(1), n.stencilMask(4294967295), n.stencilFunc(519, 0, 4294967295), n.stencilOp(7680, 7680, 7680), n.clearStencil(0), n.cullFace(1029), n.frontFace(2305), n.polygonOffset(0, 0), n.activeTexture(33984), n.bindFramebuffer(36160, null), i === !0 && (n.bindFramebuffer(36009, null), n.bindFramebuffer(36008, null)), n.useProgram(null), n.lineWidth(1), n.scissor(0, 0, n.canvas.width, n.canvas.height), n.viewport(0, 0, n.canvas.width, n.canvas.height), d = {}, b = null, F = {}, h = null, f = {}, g = null, p = !1, u = null, y = null, v = null, m = null, x = null, w = null, A = null, M = !1, R = null, L = null, S = null, I = null, T = null, B.set(0, 0, n.canvas.width, n.canvas.height), U.set(0, 0, n.canvas.width, n.canvas.height), a.reset(), c.reset(), l.reset(); } return { buffers: { color: a, depth: c, stencil: l }, enable: te, disable: ae, bindFramebuffer: le, bindXRFramebuffer: ie, useProgram: W, setBlending: re, setMaterial: V, setFlipSided: H, setCullFace: K, setLineWidth: ce, setPolygonOffset: se, setScissorTest: k, activeTexture: O, bindTexture: Z, unbindTexture: X, compressedTexImage2D: ee, texImage2D: fe, texImage3D: be, scissor: Ae, viewport: he, reset: xe }; } function TD(n, e, t, i, r, s, o) { const a = r.isWebGL2, c = r.maxTextures, l = r.maxCubemapSize, d = r.maxTextureSize, h = r.maxSamples, f = /* @__PURE__ */ new WeakMap(); let g, p = !1; try { p = typeof OffscreenCanvas < "u" && new OffscreenCanvas(1, 1).getContext("2d") !== null; } catch { } function u(k, O) { return p ? new OffscreenCanvas(k, O) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); } function y(k, O, Z, X) { let ee = 1; if ((k.width > X || k.height > X) && (ee = X / Math.max(k.width, k.height)), ee < 1 || O === !0) if (typeof HTMLImageElement < "u" && k instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && k instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && k instanceof ImageBitmap) { const fe = O ? ex : Math.floor, be = fe(ee * k.width), Ae = fe(ee * k.height); g === void 0 && (g = u(be, Ae)); const he = Z ? u(be, Ae) : g; return he.width = be, he.height = Ae, he.getContext("2d").drawImage(k, 0, 0, be, Ae), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + k.width + "x" + k.height + ") to (" + be + "x" + Ae + ")."), he; } else return "data" in k && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + k.width + "x" + k.height + ")."), k; return k; } function v(k) { return bd(k.width) && bd(k.height); } function m(k) { return a ? !1 : k.wrapS !== hn || k.wrapT !== hn || k.minFilter !== $t && k.minFilter !== zt; } function x(k, O) { return k.generateMipmaps && O && k.minFilter !== $t && k.minFilter !== zt; } function w(k, O, Z, X, ee = 1) { n.generateMipmap(k); const fe = i.get(O); fe.__maxMipLevel = Math.log2(Math.max(Z, X, ee)); } function A(k, O, Z) { if (a === !1) return O; if (k !== null) { if (n[k] !== void 0) return n[k]; console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + k + "'"); } let X = O; return O === 6403 && (Z === 5126 && (X = 33326), Z === 5131 && (X = 33325), Z === 5121 && (X = 33321)), O === 6407 && (Z === 5126 && (X = 34837), Z === 5131 && (X = 34843), Z === 5121 && (X = 32849)), O === 6408 && (Z === 5126 && (X = 34836), Z === 5131 && (X = 34842), Z === 5121 && (X = 32856)), (X === 33325 || X === 33326 || X === 34842 || X === 34836) && e.get("EXT_color_buffer_float"), X; } function M(k) { return k === $t || k === ka || k === Ga ? 9728 : 9729; } function R(k) { const O = k.target; O.removeEventListener("dispose", R), S(O), O.isVideoTexture && f.delete(O), o.memory.textures--; } function L(k) { const O = k.target; O.removeEventListener("dispose", L), I(O); } function S(k) { const O = i.get(k); O.__webglInit !== void 0 && (n.deleteTexture(O.__webglTexture), i.remove(k)); } function I(k) { const O = k.texture, Z = i.get(k), X = i.get(O); if (k) { if (X.__webglTexture !== void 0 && (n.deleteTexture(X.__webglTexture), o.memory.textures--), k.depthTexture && k.depthTexture.dispose(), k.isWebGLCubeRenderTarget) for (let ee = 0; ee < 6; ee++) n.deleteFramebuffer(Z.__webglFramebuffer[ee]), Z.__webglDepthbuffer && n.deleteRenderbuffer(Z.__webglDepthbuffer[ee]); else n.deleteFramebuffer(Z.__webglFramebuffer), Z.__webglDepthbuffer && n.deleteRenderbuffer(Z.__webglDepthbuffer), Z.__webglMultisampledFramebuffer && n.deleteFramebuffer(Z.__webglMultisampledFramebuffer), Z.__webglColorRenderbuffer && n.deleteRenderbuffer(Z.__webglColorRenderbuffer), Z.__webglDepthRenderbuffer && n.deleteRenderbuffer(Z.__webglDepthRenderbuffer); if (k.isWebGLMultipleRenderTargets) for (let ee = 0, fe = O.length; ee < fe; ee++) { const be = i.get(O[ee]); be.__webglTexture && (n.deleteTexture(be.__webglTexture), o.memory.textures--), i.remove(O[ee]); } i.remove(O), i.remove(k); } } let T = 0; function _() { T = 0; } function E() { const k = T; return k >= c && console.warn("THREE.WebGLTextures: Trying to use " + k + " texture units while this GPU supports only " + c), T += 1, k; } function C(k, O) { const Z = i.get(k); if (k.isVideoTexture && V(k), k.version > 0 && Z.__version !== k.version) { const X = k.image; if (X === void 0) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined"); else if (X.complete === !1) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete"); else { G(Z, k, O); return; } } t.activeTexture(33984 + O), t.bindTexture(3553, Z.__webglTexture); } function P(k, O) { const Z = i.get(k); if (k.version > 0 && Z.__version !== k.version) { G(Z, k, O); return; } t.activeTexture(33984 + O), t.bindTexture(35866, Z.__webglTexture); } function b(k, O) { const Z = i.get(k); if (k.version > 0 && Z.__version !== k.version) { G(Z, k, O); return; } t.activeTexture(33984 + O), t.bindTexture(32879, Z.__webglTexture); } function F(k, O) { const Z = i.get(k); if (k.version > 0 && Z.__version !== k.version) { Y(Z, k, O); return; } t.activeTexture(33984 + O), t.bindTexture(34067, Z.__webglTexture); } const D = { [jr]: 10497, [hn]: 33071, [Eo]: 33648 }, N = { [$t]: 9728, [ka]: 9984, [Ga]: 9986, [zt]: 9729, [du]: 9985, [fr]: 9987 }; function B(k, O, Z) { if (Z ? (n.texParameteri(k, 10242, D[O.wrapS]), n.texParameteri(k, 10243, D[O.wrapT]), (k === 32879 || k === 35866) && n.texParameteri(k, 32882, D[O.wrapR]), n.texParameteri(k, 10240, N[O.magFilter]), n.texParameteri(k, 10241, N[O.minFilter])) : (n.texParameteri(k, 10242, 33071), n.texParameteri(k, 10243, 33071), (k === 32879 || k === 35866) && n.texParameteri(k, 32882, 33071), (O.wrapS !== hn || O.wrapT !== hn) && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), n.texParameteri(k, 10240, M(O.magFilter)), n.texParameteri(k, 10241, M(O.minFilter)), O.minFilter !== $t && O.minFilter !== zt && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")), e.has("EXT_texture_filter_anisotropic") === !0) { const X = e.get("EXT_texture_filter_anisotropic"); if (O.type === qi && e.has("OES_texture_float_linear") === !1 || a === !1 && O.type === Ms && e.has("OES_texture_half_float_linear") === !1) return; (O.anisotropy > 1 || i.get(O).__currentAnisotropy) && (n.texParameterf(k, X.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(O.anisotropy, r.getMaxAnisotropy())), i.get(O).__currentAnisotropy = O.anisotropy); } } function U(k, O) { k.__webglInit === void 0 && (k.__webglInit = !0, O.addEventListener("dispose", R), k.__webglTexture = n.createTexture(), o.memory.textures++); } function G(k, O, Z) { let X = 3553; O.isDataTexture2DArray && (X = 35866), O.isDataTexture3D && (X = 32879), U(k, O), t.activeTexture(33984 + Z), t.bindTexture(X, k.__webglTexture), n.pixelStorei(37440, O.flipY), n.pixelStorei(37441, O.premultiplyAlpha), n.pixelStorei(3317, O.unpackAlignment), n.pixelStorei(37443, 0); const ee = m(O) && v(O.image) === !1, fe = y(O.image, ee, !1, d), be = v(fe) || a, Ae = s.convert(O.format); let he = s.convert(O.type), xe = A(O.internalFormat, Ae, he); B(X, O, be); let ne; const me = O.mipmaps; if (O.isDepthTexture) xe = 6402, a ? O.type === qi ? xe = 36012 : O.type === Ra ? xe = 33190 : O.type === yo ? xe = 35056 : xe = 33189 : O.type === qi && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."), O.format === ws && xe === 6402 && O.type !== Ha && O.type !== Ra && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), O.type = Ha, he = s.convert(O.type)), O.format === Co && xe === 6402 && (xe = 34041, O.type !== yo && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), O.type = yo, he = s.convert(O.type))), t.texImage2D(3553, 0, xe, fe.width, fe.height, 0, Ae, he, null); else if (O.isDataTexture) if (me.length > 0 && be) { for (let Me = 0, De = me.length; Me < De; Me++) ne = me[Me], t.texImage2D(3553, Me, xe, ne.width, ne.height, 0, Ae, he, ne.data); O.generateMipmaps = !1, k.__maxMipLevel = me.length - 1; } else t.texImage2D(3553, 0, xe, fe.width, fe.height, 0, Ae, he, fe.data), k.__maxMipLevel = 0; else if (O.isCompressedTexture) { for (let Me = 0, De = me.length; Me < De; Me++) ne = me[Me], O.format !== Gn && O.format !== nr ? Ae !== null ? t.compressedTexImage2D(3553, Me, xe, ne.width, ne.height, 0, ne.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, Me, xe, ne.width, ne.height, 0, Ae, he, ne.data); k.__maxMipLevel = me.length - 1; } else if (O.isDataTexture2DArray) t.texImage3D(35866, 0, xe, fe.width, fe.height, fe.depth, 0, Ae, he, fe.data), k.__maxMipLevel = 0; else if (O.isDataTexture3D) t.texImage3D(32879, 0, xe, fe.width, fe.height, fe.depth, 0, Ae, he, fe.data), k.__maxMipLevel = 0; else if (me.length > 0 && be) { for (let Me = 0, De = me.length; Me < De; Me++) ne = me[Me], t.texImage2D(3553, Me, xe, Ae, he, ne); O.generateMipmaps = !1, k.__maxMipLevel = me.length - 1; } else t.texImage2D(3553, 0, xe, Ae, he, fe), k.__maxMipLevel = 0; x(O, be) && w(X, O, fe.width, fe.height), k.__version = O.version, O.onUpdate && O.onUpdate(O); } function Y(k, O, Z) { if (O.image.length !== 6) return; U(k, O), t.activeTexture(33984 + Z), t.bindTexture(34067, k.__webglTexture), n.pixelStorei(37440, O.flipY), n.pixelStorei(37441, O.premultiplyAlpha), n.pixelStorei(3317, O.unpackAlignment), n.pixelStorei(37443, 0); const X = O && (O.isCompressedTexture || O.image[0].isCompressedTexture), ee = O.image[0] && O.image[0].isDataTexture, fe = []; for (let Me = 0; Me < 6; Me++) !X && !ee ? fe[Me] = y(O.image[Me], !1, !0, l) : fe[Me] = ee ? O.image[Me].image : O.image[Me]; const be = fe[0], Ae = v(be) || a, he = s.convert(O.format), xe = s.convert(O.type), ne = A(O.internalFormat, he, xe); B(34067, O, Ae); let me; if (X) { for (let Me = 0; Me < 6; Me++) { me = fe[Me].mipmaps; for (let De = 0; De < me.length; De++) { const Ie = me[De]; O.format !== Gn && O.format !== nr ? he !== null ? t.compressedTexImage2D(34069 + Me, De, ne, Ie.width, Ie.height, 0, Ie.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + Me, De, ne, Ie.width, Ie.height, 0, he, xe, Ie.data); } } k.__maxMipLevel = me.length - 1; } else { me = O.mipmaps; for (let Me = 0; Me < 6; Me++) if (ee) { t.texImage2D(34069 + Me, 0, ne, fe[Me].width, fe[Me].height, 0, he, xe, fe[Me].data); for (let De = 0; De < me.length; De++) { const $e = me[De].image[Me].image; t.texImage2D(34069 + Me, De + 1, ne, $e.width, $e.height, 0, he, xe, $e.data); } } else { t.texImage2D(34069 + Me, 0, ne, he, xe, fe[Me]); for (let De = 0; De < me.length; De++) { const Ie = me[De]; t.texImage2D(34069 + Me, De + 1, ne, he, xe, Ie.image[Me]); } } k.__maxMipLevel = me.length; } x(O, Ae) && w(34067, O, be.width, be.height), k.__version = O.version, O.onUpdate && O.onUpdate(O); } function te(k, O, Z, X, ee) { const fe = s.convert(Z.format), be = s.convert(Z.type), Ae = A(Z.internalFormat, fe, be); ee === 32879 || ee === 35866 ? t.texImage3D(ee, 0, Ae, O.width, O.height, O.depth, 0, fe, be, null) : t.texImage2D(ee, 0, Ae, O.width, O.height, 0, fe, be, null), t.bindFramebuffer(36160, k), n.framebufferTexture2D(36160, X, ee, i.get(Z).__webglTexture, 0), t.bindFramebuffer(36160, null); } function ae(k, O, Z) { if (n.bindRenderbuffer(36161, k), O.depthBuffer && !O.stencilBuffer) { let X = 33189; if (Z) { const ee = O.depthTexture; ee && ee.isDepthTexture && (ee.type === qi ? X = 36012 : ee.type === Ra && (X = 33190)); const fe = re(O); n.renderbufferStorageMultisample(36161, fe, X, O.width, O.height); } else n.renderbufferStorage(36161, X, O.width, O.height); n.framebufferRenderbuffer(36160, 36096, 36161, k); } else if (O.depthBuffer && O.stencilBuffer) { if (Z) { const X = re(O); n.renderbufferStorageMultisample(36161, X, 35056, O.width, O.height); } else n.renderbufferStorage(36161, 34041, O.width, O.height); n.framebufferRenderbuffer(36160, 33306, 36161, k); } else { const X = O.isWebGLMultipleRenderTargets === !0 ? O.texture[0] : O.texture, ee = s.convert(X.format), fe = s.convert(X.type), be = A(X.internalFormat, ee, fe); if (Z) { const Ae = re(O); n.renderbufferStorageMultisample(36161, Ae, be, O.width, O.height); } else n.renderbufferStorage(36161, be, O.width, O.height); } n.bindRenderbuffer(36161, null); } function ie(k, O) { if (O && O.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported"); if (t.bindFramebuffer(36160, k), !(O.depthTexture && O.depthTexture.isDepthTexture)) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); (!i.get(O.depthTexture).__webglTexture || O.depthTexture.image.width !== O.width || O.depthTexture.image.height !== O.height) && (O.depthTexture.image.width = O.width, O.depthTexture.image.height = O.height, O.depthTexture.needsUpdate = !0), C(O.depthTexture, 0); const X = i.get(O.depthTexture).__webglTexture; if (O.depthTexture.format === ws) n.framebufferTexture2D(36160, 36096, 3553, X, 0); else if (O.depthTexture.format === Co) n.framebufferTexture2D(36160, 33306, 3553, X, 0); else throw new Error("Unknown depthTexture format"); } function le(k) { const O = i.get(k), Z = k.isWebGLCubeRenderTarget === !0; if (k.depthTexture) { if (Z) throw new Error("target.depthTexture not supported in Cube render targets"); ie(O.__webglFramebuffer, k); } else if (Z) { O.__webglDepthbuffer = []; for (let X = 0; X < 6; X++) t.bindFramebuffer(36160, O.__webglFramebuffer[X]), O.__webglDepthbuffer[X] = n.createRenderbuffer(), ae(O.__webglDepthbuffer[X], k, !1); } else t.bindFramebuffer(36160, O.__webglFramebuffer), O.__webglDepthbuffer = n.createRenderbuffer(), ae(O.__webglDepthbuffer, k, !1); t.bindFramebuffer(36160, null); } function W(k) { const O = k.texture, Z = i.get(k), X = i.get(O); k.addEventListener("dispose", L), k.isWebGLMultipleRenderTargets !== !0 && (X.__webglTexture = n.createTexture(), X.__version = O.version, o.memory.textures++); const ee = k.isWebGLCubeRenderTarget === !0, fe = k.isWebGLMultipleRenderTargets === !0, be = k.isWebGLMultisampleRenderTarget === !0, Ae = O.isDataTexture3D || O.isDataTexture2DArray, he = v(k) || a; if (a && O.format === nr && (O.type === qi || O.type === Ms) && (O.format = Gn, console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")), ee) { Z.__webglFramebuffer = []; for (let xe = 0; xe < 6; xe++) Z.__webglFramebuffer[xe] = n.createFramebuffer(); } else if (Z.__webglFramebuffer = n.createFramebuffer(), fe) if (r.drawBuffers) { const xe = k.texture; for (let ne = 0, me = xe.length; ne < me; ne++) { const Me = i.get(xe[ne]); Me.__webglTexture === void 0 && (Me.__webglTexture = n.createTexture(), o.memory.textures++); } } else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension."); else if (be) if (a) { Z.__webglMultisampledFramebuffer = n.createFramebuffer(), Z.__webglColorRenderbuffer = n.createRenderbuffer(), n.bindRenderbuffer(36161, Z.__webglColorRenderbuffer); const xe = s.convert(O.format), ne = s.convert(O.type), me = A(O.internalFormat, xe, ne), Me = re(k); n.renderbufferStorageMultisample(36161, Me, me, k.width, k.height), t.bindFramebuffer(36160, Z.__webglMultisampledFramebuffer), n.framebufferRenderbuffer(36160, 36064, 36161, Z.__webglColorRenderbuffer), n.bindRenderbuffer(36161, null), k.depthBuffer && (Z.__webglDepthRenderbuffer = n.createRenderbuffer(), ae(Z.__webglDepthRenderbuffer, k, !0)), t.bindFramebuffer(36160, null); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); if (ee) { t.bindTexture(34067, X.__webglTexture), B(34067, O, he); for (let xe = 0; xe < 6; xe++) te(Z.__webglFramebuffer[xe], k, O, 36064, 34069 + xe); x(O, he) && w(34067, O, k.width, k.height), t.bindTexture(34067, null); } else if (fe) { const xe = k.texture; for (let ne = 0, me = xe.length; ne < me; ne++) { const Me = xe[ne], De = i.get(Me); t.bindTexture(3553, De.__webglTexture), B(3553, Me, he), te(Z.__webglFramebuffer, k, Me, 36064 + ne, 3553), x(Me, he) && w(3553, Me, k.width, k.height); } t.bindTexture(3553, null); } else { let xe = 3553; Ae && (a ? xe = O.isDataTexture3D ? 32879 : 35866 : console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")), t.bindTexture(xe, X.__webglTexture), B(xe, O, he), te(Z.__webglFramebuffer, k, O, 36064, xe), x(O, he) && w(xe, O, k.width, k.height, k.depth), t.bindTexture(xe, null); } k.depthBuffer && le(k); } function $(k) { const O = v(k) || a, Z = k.isWebGLMultipleRenderTargets === !0 ? k.texture : [k.texture]; for (let X = 0, ee = Z.length; X < ee; X++) { const fe = Z[X]; if (x(fe, O)) { const be = k.isWebGLCubeRenderTarget ? 34067 : 3553, Ae = i.get(fe).__webglTexture; t.bindTexture(be, Ae), w(be, fe, k.width, k.height), t.bindTexture(be, null); } } } function j(k) { if (k.isWebGLMultisampleRenderTarget) if (a) { const O = k.width, Z = k.height; let X = 16384; k.depthBuffer && (X |= 256), k.stencilBuffer && (X |= 1024); const ee = i.get(k); t.bindFramebuffer(36008, ee.__webglMultisampledFramebuffer), t.bindFramebuffer(36009, ee.__webglFramebuffer), n.blitFramebuffer(0, 0, O, Z, 0, 0, O, Z, X, 9728), t.bindFramebuffer(36008, null), t.bindFramebuffer(36009, ee.__webglMultisampledFramebuffer); } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); } function re(k) { return a && k.isWebGLMultisampleRenderTarget ? Math.min(h, k.samples) : 0; } function V(k) { const O = o.render.frame; f.get(k) !== O && (f.set(k, O), k.update()); } let H = !1, K = !1; function ce(k, O) { k && k.isWebGLRenderTarget && (H === !1 && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), H = !0), k = k.texture), C(k, O); } function se(k, O) { k && k.isWebGLCubeRenderTarget && (K === !1 && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), K = !0), k = k.texture), F(k, O); } this.allocateTextureUnit = E, this.resetTextureUnits = _, this.setTexture2D = C, this.setTexture2DArray = P, this.setTexture3D = b, this.setTextureCube = F, this.setupRenderTarget = W, this.updateRenderTargetMipmap = $, this.updateMultisampleRenderTarget = j, this.safeSetTexture2D = ce, this.safeSetTextureCube = se; } function Mx(n, e, t) { const i = t.isWebGL2; function r(s) { let o; if (s === Ts) return 5121; if (s === eb) return 32819; if (s === tb) return 32820; if (s === nb) return 33635; if (s === Ky) return 5120; if (s === qy) return 5122; if (s === Ha) return 5123; if (s === Qy) return 5124; if (s === Ra) return 5125; if (s === qi) return 5126; if (s === Ms) return i ? 5131 : (o = e.get("OES_texture_half_float"), o !== null ? o.HALF_FLOAT_OES : null); if (s === ib) return 6406; if (s === nr) return 6407; if (s === Gn) return 6408; if (s === rb) return 6409; if (s === sb) return 6410; if (s === ws) return 6402; if (s === Co) return 34041; if (s === ab) return 6403; if (s === lb) return 36244; if (s === cb) return 33319; if (s === ub) return 33320; if (s === hb) return 36248; if (s === db) return 36249; if (s === ld || s === cd || s === ud || s === hd) if (o = e.get("WEBGL_compressed_texture_s3tc"), o !== null) { if (s === ld) return o.COMPRESSED_RGB_S3TC_DXT1_EXT; if (s === cd) return o.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (s === ud) return o.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (s === hd) return o.COMPRESSED_RGBA_S3TC_DXT5_EXT; } else return null; if (s === dd || s === fd || s === pd || s === md) if (o = e.get("WEBGL_compressed_texture_pvrtc"), o !== null) { if (s === dd) return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (s === fd) return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (s === pd) return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (s === md) return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; } else return null; if (s === fb) return o = e.get("WEBGL_compressed_texture_etc1"), o !== null ? o.COMPRESSED_RGB_ETC1_WEBGL : null; if ((s === gd || s === vd) && (o = e.get("WEBGL_compressed_texture_etc"), o !== null)) { if (s === gd) return o.COMPRESSED_RGB8_ETC2; if (s === vd) return o.COMPRESSED_RGBA8_ETC2_EAC; } if (s === pb || s === mb || s === gb || s === vb || s === yb || s === bb || s === xb || s === Mb || s === wb || s === Ab || s === Sb || s === _b || s === Tb || s === Eb || s === Lb || s === Rb || s === Fb || s === Pb || s === Ib || s === Ob || s === Db || s === Nb || s === Bb || s === Ub || s === zb || s === Vb || s === kb || s === Gb) return o = e.get("WEBGL_compressed_texture_astc"), o !== null ? s : null; if (s === Cb) return o = e.get("EXT_texture_compression_bptc"), o !== null ? s : null; if (s === yo) return i ? 34042 : (o = e.get("WEBGL_depth_texture"), o !== null ? o.UNSIGNED_INT_24_8_WEBGL : null); } return { convert: r }; } class Ff extends nn { constructor(e = []) { super(), this.cameras = e; } } Ff.prototype.isArrayCamera = !0; class _i extends ut { constructor() { super(), this.type = "Group"; } } _i.prototype.isGroup = !0; const ED = { type: "move" }; class gh { constructor() { this._targetRay = null, this._grip = null, this._hand = null; } getHandSpace() { return this._hand === null && (this._hand = new _i(), this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = { pinching: !1 }), this._hand; } getTargetRaySpace() { return this._targetRay === null && (this._targetRay = new _i(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new q(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new q()), this._targetRay; } getGripSpace() { return this._grip === null && (this._grip = new _i(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new q(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new q()), this._grip; } dispatchEvent(e) { return this._targetRay !== null && this._targetRay.dispatchEvent(e), this._grip !== null && this._grip.dispatchEvent(e), this._hand !== null && this._hand.dispatchEvent(e), this; } disconnect(e) { return this.dispatchEvent({ type: "disconnected", data: e }), this._targetRay !== null && (this._targetRay.visible = !1), this._grip !== null && (this._grip.visible = !1), this._hand !== null && (this._hand.visible = !1), this; } update(e, t, i) { let r = null, s = null, o = null; const a = this._targetRay, c = this._grip, l = this._hand; if (e && t.session.visibilityState !== "visible-blurred") if (a !== null && (r = t.getPose(e.targetRaySpace, i), r !== null && (a.matrix.fromArray(r.transform.matrix), a.matrix.decompose(a.position, a.rotation, a.scale), r.linearVelocity ? (a.hasLinearVelocity = !0, a.linearVelocity.copy(r.linearVelocity)) : a.hasLinearVelocity = !1, r.angularVelocity ? (a.hasAngularVelocity = !0, a.angularVelocity.copy(r.angularVelocity)) : a.hasAngularVelocity = !1, this.dispatchEvent(ED))), l && e.hand) { o = !0; for (const u of e.hand.values()) { const y = t.getJointPose(u, i); if (l.joints[u.jointName] === void 0) { const m = new _i(); m.matrixAutoUpdate = !1, m.visible = !1, l.joints[u.jointName] = m, l.add(m); } const v = l.joints[u.jointName]; y !== null && (v.matrix.fromArray(y.transform.matrix), v.matrix.decompose(v.position, v.rotation, v.scale), v.jointRadius = y.radius), v.visible = y !== null; } const d = l.joints["index-finger-tip"], h = l.joints["thumb-tip"], f = d.position.distanceTo(h.position), g = 0.02, p = 5e-3; l.inputState.pinching && f > g + p ? (l.inputState.pinching = !1, this.dispatchEvent({ type: "pinchend", handedness: e.handedness, target: this })) : !l.inputState.pinching && f <= g - p && (l.inputState.pinching = !0, this.dispatchEvent({ type: "pinchstart", handedness: e.handedness, target: this })); } else c !== null && e.gripSpace && (s = t.getPose(e.gripSpace, i), s !== null && (c.matrix.fromArray(s.transform.matrix), c.matrix.decompose(c.position, c.rotation, c.scale), s.linearVelocity ? (c.hasLinearVelocity = !0, c.linearVelocity.copy(s.linearVelocity)) : c.hasLinearVelocity = !1, s.angularVelocity ? (c.hasAngularVelocity = !0, c.angularVelocity.copy(s.angularVelocity)) : c.hasAngularVelocity = !1)); return a !== null && (a.visible = r !== null), c !== null && (c.visible = s !== null), l !== null && (l.visible = o !== null), this; } } class CD extends Kr { constructor(e, t) { super(); const i = this, r = e.state; let s = null, o = 1, a = null, c = "local-floor", l = null, d = null, h = null, f = null; const g = [], p = /* @__PURE__ */ new Map(), u = new nn(); u.layers.enable(1), u.viewport = new xt(); const y = new nn(); y.layers.enable(2), y.viewport = new xt(); const v = [u, y], m = new Ff(); m.layers.enable(1), m.layers.enable(2); let x = null, w = null; this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(P) { let b = g[P]; return b === void 0 && (b = new gh(), g[P] = b), b.getTargetRaySpace(); }, this.getControllerGrip = function(P) { let b = g[P]; return b === void 0 && (b = new gh(), g[P] = b), b.getGripSpace(); }, this.getHand = function(P) { let b = g[P]; return b === void 0 && (b = new gh(), g[P] = b), b.getHandSpace(); }; function A(P) { const b = p.get(P.inputSource); b && b.dispatchEvent({ type: P.type, data: P.inputSource }); } function M() { p.forEach(function(P, b) { P.disconnect(b); }), p.clear(), x = null, w = null, r.bindXRFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), C.stop(), i.isPresenting = !1, i.dispatchEvent({ type: "sessionend" }); } this.setFramebufferScaleFactor = function(P) { o = P, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting."); }, this.setReferenceSpaceType = function(P) { c = P, i.isPresenting === !0 && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting."); }, this.getReferenceSpace = function() { return a; }, this.getSession = function() { return s; }, this.setSession = async function(P) { if (s = P, s !== null) { s.addEventListener("select", A), s.addEventListener("selectstart", A), s.addEventListener("selectend", A), s.addEventListener("squeeze", A), s.addEventListener("squeezestart", A), s.addEventListener("squeezeend", A), s.addEventListener("end", M), s.addEventListener("inputsourceschange", R); const b = t.getContextAttributes(); if (b.xrCompatible !== !0 && await t.makeXRCompatible(), s.renderState.layers === void 0) { const F = { antialias: b.antialias, alpha: b.alpha, depth: b.depth, stencil: b.stencil, framebufferScaleFactor: o }, D = new XRWebGLLayer(s, t, F); s.updateRenderState({ baseLayer: D }); } else { let F = 0; b.depth && (F = b.stencil ? 34041 : 6402); const D = { colorFormat: b.alpha ? 6408 : 6407, depthFormat: F, scaleFactor: o }; d = new XRWebGLBinding(s, t), f = d.createProjectionLayer(D), h = t.createFramebuffer(), s.updateRenderState({ layers: [f] }); } a = await s.requestReferenceSpace(c), C.setContext(s), C.start(), i.isPresenting = !0, i.dispatchEvent({ type: "sessionstart" }); } }; function R(P) { const b = s.inputSources; for (let F = 0; F < g.length; F++) p.set(b[F], g[F]); for (let F = 0; F < P.removed.length; F++) { const D = P.removed[F], N = p.get(D); N && (N.dispatchEvent({ type: "disconnected", data: D }), p.delete(D)); } for (let F = 0; F < P.added.length; F++) { const D = P.added[F], N = p.get(D); N && N.dispatchEvent({ type: "connected", data: D }); } } const L = new q(), S = new q(); function I(P, b, F) { L.setFromMatrixPosition(b.matrixWorld), S.setFromMatrixPosition(F.matrixWorld); const D = L.distanceTo(S), N = b.projectionMatrix.elements, B = F.projectionMatrix.elements, U = N[14] / (N[10] - 1), G = N[14] / (N[10] + 1), Y = (N[9] + 1) / N[5], te = (N[9] - 1) / N[5], ae = (N[8] - 1) / N[0], ie = (B[8] + 1) / B[0], le = U * ae, W = U * ie, $ = D / (-ae + ie), j = $ * -ae; b.matrixWorld.decompose(P.position, P.quaternion, P.scale), P.translateX(j), P.translateZ($), P.matrixWorld.compose(P.position, P.quaternion, P.scale), P.matrixWorldInverse.copy(P.matrixWorld).invert(); const re = U + $, V = G + $, H = le - j, K = W + (D - j), ce = Y * G / V * re, se = te * G / V * re; P.projectionMatrix.makePerspective(H, K, ce, se, re, V); } function T(P, b) { b === null ? P.matrixWorld.copy(P.matrix) : P.matrixWorld.multiplyMatrices(b.matrixWorld, P.matrix), P.matrixWorldInverse.copy(P.matrixWorld).invert(); } this.updateCamera = function(P) { if (s === null) return; m.near = y.near = u.near = P.near, m.far = y.far = u.far = P.far, (x !== m.near || w !== m.far) && (s.updateRenderState({ depthNear: m.near, depthFar: m.far }), x = m.near, w = m.far); const b = P.parent, F = m.cameras; T(m, b); for (let N = 0; N < F.length; N++) T(F[N], b); m.matrixWorld.decompose(m.position, m.quaternion, m.scale), P.position.copy(m.position), P.quaternion.copy(m.quaternion), P.scale.copy(m.scale), P.matrix.copy(m.matrix), P.matrixWorld.copy(m.matrixWorld); const D = P.children; for (let N = 0, B = D.length; N < B; N++) D[N].updateMatrixWorld(!0); F.length === 2 ? I(m, u, y) : m.projectionMatrix.copy(u.projectionMatrix); }, this.getCamera = function() { return m; }; let _ = null; function E(P, b) { if (l = b.getViewerPose(a), l !== null) { const D = l.views, N = s.renderState.baseLayer; s.renderState.layers === void 0 && r.bindXRFramebuffer(N.framebuffer); let B = !1; D.length !== m.cameras.length && (m.cameras.length = 0, B = !0); for (let U = 0; U < D.length; U++) { const G = D[U]; let Y = null; if (s.renderState.layers === void 0) Y = N.getViewport(G); else { const ae = d.getViewSubImage(f, G); r.bindXRFramebuffer(h), t.framebufferTexture2D(36160, 36064, 3553, ae.colorTexture, 0), ae.depthStencilTexture !== void 0 && t.framebufferTexture2D(36160, 36096, 3553, ae.depthStencilTexture, 0), Y = ae.viewport; } const te = v[U]; te.matrix.fromArray(G.transform.matrix), te.projectionMatrix.fromArray(G.projectionMatrix), te.viewport.set(Y.x, Y.y, Y.width, Y.height), U === 0 && m.matrix.copy(te.matrix), B === !0 && m.cameras.push(te); } } const F = s.inputSources; for (let D = 0; D < g.length; D++) { const N = g[D], B = F[D]; N.update(B, b, a); } _ && _(P, b); } const C = new dx(); C.setAnimationLoop(E), this.setAnimationLoop = function(P) { _ = P; }, this.dispose = function() { }; } } function LD(n) { function e(v, m) { v.fogColor.value.copy(m.color), m.isFog ? (v.fogNear.value = m.near, v.fogFar.value = m.far) : m.isFogExp2 && (v.fogDensity.value = m.density); } function t(v, m, x, w, A) { m.isMeshBasicMaterial ? i(v, m) : m.isMeshLambertMaterial ? (i(v, m), c(v, m)) : m.isMeshToonMaterial ? (i(v, m), d(v, m)) : m.isMeshPhongMaterial ? (i(v, m), l(v, m)) : m.isMeshStandardMaterial ? (i(v, m), m.isMeshPhysicalMaterial ? f(v, m, A) : h(v, m)) : m.isMeshMatcapMaterial ? (i(v, m), g(v, m)) : m.isMeshDepthMaterial ? (i(v, m), p(v, m)) : m.isMeshDistanceMaterial ? (i(v, m), u(v, m)) : m.isMeshNormalMaterial ? (i(v, m), y(v, m)) : m.isLineBasicMaterial ? (r(v, m), m.isLineDashedMaterial && s(v, m)) : m.isPointsMaterial ? o(v, m, x, w) : m.isSpriteMaterial ? a(v, m) : m.isShadowMaterial ? (v.color.value.copy(m.color), v.opacity.value = m.opacity) : m.isShaderMaterial && (m.uniformsNeedUpdate = !1); } function i(v, m) { v.opacity.value = m.opacity, m.color && v.diffuse.value.copy(m.color), m.emissive && v.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity), m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap), m.specularMap && (v.specularMap.value = m.specularMap); const x = n.get(m).envMap; if (x) { v.envMap.value = x, v.flipEnvMap.value = x.isCubeTexture && x._needsFlipEnvMap ? -1 : 1, v.reflectivity.value = m.reflectivity, v.refractionRatio.value = m.refractionRatio; const M = n.get(x).__maxMipLevel; M !== void 0 && (v.maxMipLevel.value = M); } m.lightMap && (v.lightMap.value = m.lightMap, v.lightMapIntensity.value = m.lightMapIntensity), m.aoMap && (v.aoMap.value = m.aoMap, v.aoMapIntensity.value = m.aoMapIntensity); let w; m.map ? w = m.map : m.specularMap ? w = m.specularMap : m.displacementMap ? w = m.displacementMap : m.normalMap ? w = m.normalMap : m.bumpMap ? w = m.bumpMap : m.roughnessMap ? w = m.roughnessMap : m.metalnessMap ? w = m.metalnessMap : m.alphaMap ? w = m.alphaMap : m.emissiveMap ? w = m.emissiveMap : m.clearcoatMap ? w = m.clearcoatMap : m.clearcoatNormalMap ? w = m.clearcoatNormalMap : m.clearcoatRoughnessMap && (w = m.clearcoatRoughnessMap), w !== void 0 && (w.isWebGLRenderTarget && (w = w.texture), w.matrixAutoUpdate === !0 && w.updateMatrix(), v.uvTransform.value.copy(w.matrix)); let A; m.aoMap ? A = m.aoMap : m.lightMap && (A = m.lightMap), A !== void 0 && (A.isWebGLRenderTarget && (A = A.texture), A.matrixAutoUpdate === !0 && A.updateMatrix(), v.uv2Transform.value.copy(A.matrix)); } function r(v, m) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity; } function s(v, m) { v.dashSize.value = m.dashSize, v.totalSize.value = m.dashSize + m.gapSize, v.scale.value = m.scale; } function o(v, m, x, w) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.size.value = m.size * x, v.scale.value = w * 0.5, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap); let A; m.map ? A = m.map : m.alphaMap && (A = m.alphaMap), A !== void 0 && (A.matrixAutoUpdate === !0 && A.updateMatrix(), v.uvTransform.value.copy(A.matrix)); } function a(v, m) { v.diffuse.value.copy(m.color), v.opacity.value = m.opacity, v.rotation.value = m.rotation, m.map && (v.map.value = m.map), m.alphaMap && (v.alphaMap.value = m.alphaMap); let x; m.map ? x = m.map : m.alphaMap && (x = m.alphaMap), x !== void 0 && (x.matrixAutoUpdate === !0 && x.updateMatrix(), v.uvTransform.value.copy(x.matrix)); } function c(v, m) { m.emissiveMap && (v.emissiveMap.value = m.emissiveMap); } function l(v, m) { v.specular.value.copy(m.specular), v.shininess.value = Math.max(m.shininess, 1e-4), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function d(v, m) { m.gradientMap && (v.gradientMap.value = m.gradientMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function h(v, m) { v.roughness.value = m.roughness, v.metalness.value = m.metalness, m.roughnessMap && (v.roughnessMap.value = m.roughnessMap), m.metalnessMap && (v.metalnessMap.value = m.metalnessMap), m.emissiveMap && (v.emissiveMap.value = m.emissiveMap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), n.get(m).envMap && (v.envMapIntensity.value = m.envMapIntensity); } function f(v, m, x) { h(v, m), v.reflectivity.value = m.reflectivity, v.clearcoat.value = m.clearcoat, v.clearcoatRoughness.value = m.clearcoatRoughness, m.sheen && v.sheen.value.copy(m.sheen), m.clearcoatMap && (v.clearcoatMap.value = m.clearcoatMap), m.clearcoatRoughnessMap && (v.clearcoatRoughnessMap.value = m.clearcoatRoughnessMap), m.clearcoatNormalMap && (v.clearcoatNormalScale.value.copy(m.clearcoatNormalScale), v.clearcoatNormalMap.value = m.clearcoatNormalMap, m.side === jt && v.clearcoatNormalScale.value.negate()), v.transmission.value = m.transmission, m.transmissionMap && (v.transmissionMap.value = m.transmissionMap), m.transmission > 0 && (v.transmissionSamplerMap.value = x.texture, v.transmissionSamplerSize.value.set(x.width, x.height)), v.thickness.value = m.thickness, m.thicknessMap && (v.thicknessMap.value = m.thicknessMap), v.attenuationDistance.value = m.attenuationDistance, v.attenuationColor.value.copy(m.attenuationColor); } function g(v, m) { m.matcap && (v.matcap.value = m.matcap), m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function p(v, m) { m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } function u(v, m) { m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias), v.referencePosition.value.copy(m.referencePosition), v.nearDistance.value = m.nearDistance, v.farDistance.value = m.farDistance; } function y(v, m) { m.bumpMap && (v.bumpMap.value = m.bumpMap, v.bumpScale.value = m.bumpScale, m.side === jt && (v.bumpScale.value *= -1)), m.normalMap && (v.normalMap.value = m.normalMap, v.normalScale.value.copy(m.normalScale), m.side === jt && v.normalScale.value.negate()), m.displacementMap && (v.displacementMap.value = m.displacementMap, v.displacementScale.value = m.displacementScale, v.displacementBias.value = m.displacementBias); } return { refreshFogUniforms: e, refreshMaterialUniforms: t }; } function RD() { const n = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); return n.style.display = "block", n; } function wt(n = {}) { const e = n.canvas !== void 0 ? n.canvas : RD(), t = n.context !== void 0 ? n.context : null, i = n.alpha !== void 0 ? n.alpha : !1, r = n.depth !== void 0 ? n.depth : !0, s = n.stencil !== void 0 ? n.stencil : !0, o = n.antialias !== void 0 ? n.antialias : !1, a = n.premultipliedAlpha !== void 0 ? n.premultipliedAlpha : !0, c = n.preserveDrawingBuffer !== void 0 ? n.preserveDrawingBuffer : !1, l = n.powerPreference !== void 0 ? n.powerPreference : "default", d = n.failIfMajorPerformanceCaveat !== void 0 ? n.failIfMajorPerformanceCaveat : !1; let h = null, f = null; const g = [], p = []; this.domElement = e, this.debug = { /** * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ checkShaderErrors: !0 }, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.outputEncoding = Cn, this.physicallyCorrectLights = !1, this.toneMapping = Ir, this.toneMappingExposure = 1; const u = this; let y = !1, v = 0, m = 0, x = null, w = -1, A = null; const M = new xt(), R = new xt(); let L = null, S = e.width, I = e.height, T = 1, _ = null, E = null; const C = new xt(0, 0, S, I), P = new xt(0, 0, S, I); let b = !1; const F = [], D = new dl(); let N = !1, B = !1, U = null; const G = new Xe(), Y = new q(), te = { background: null, fog: null, environment: null, overrideMaterial: null, isScene: !0 }; function ae() { return x === null ? T : 1; } let ie = t; function le(J, ye) { for (let pe = 0; pe < J.length; pe++) { const we = J[pe], Ce = e.getContext(we, ye); if (Ce !== null) return Ce; } return null; } try { const J = { alpha: i, depth: r, stencil: s, antialias: o, premultipliedAlpha: a, preserveDrawingBuffer: c, powerPreference: l, failIfMajorPerformanceCaveat: d }; if (e.addEventListener("webglcontextlost", $e, !1), e.addEventListener("webglcontextrestored", lt, !1), ie === null) { const ye = ["webgl2", "webgl", "experimental-webgl"]; if (u.isWebGL1Renderer === !0 && ye.shift(), ie = le(ye, J), ie === null) throw le(ye) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); } ie.getShaderPrecisionFormat === void 0 && (ie.getShaderPrecisionFormat = function() { return { rangeMin: 1, rangeMax: 1, precision: 1 }; }); } catch (J) { throw console.error("THREE.WebGLRenderer: " + J.message), J; } let W, $, j, re, V, H, K, ce, se, k, O, Z, X, ee, fe, be, Ae, he, xe, ne, me, Me; function De() { W = new eO(ie), $ = new KI(ie, W, n), W.init($), me = new Mx(ie, W, $), j = new _D(ie, W, $), F[0] = 1029, re = new iO(), V = new pD(), H = new TD(ie, W, j, V, $, me, re), K = new QI(u), ce = new TF(ie, $), Me = new YI(ie, W, ce, $), se = new tO(ie, ce, re, Me), k = new aO(ie, se, ce, re), he = new oO(ie), fe = new qI(V), O = new fD(u, K, W, $, Me, fe), Z = new LD(V), X = new gD(V), ee = new wD(W, $), Ae = new XI(u, K, j, k, a), be = new xx(u, k, $), xe = new JI(ie, W, re, $), ne = new nO(ie, W, re, $), re.programs = O.programs, u.capabilities = $, u.extensions = W, u.properties = V, u.renderLists = X, u.shadowMap = be, u.state = j, u.info = re; } De(); const Ie = new CD(u, ie); this.xr = Ie, this.getContext = function() { return ie; }, this.getContextAttributes = function() { return ie.getContextAttributes(); }, this.forceContextLoss = function() { const J = W.get("WEBGL_lose_context"); J && J.loseContext(); }, this.forceContextRestore = function() { const J = W.get("WEBGL_lose_context"); J && J.restoreContext(); }, this.getPixelRatio = function() { return T; }, this.setPixelRatio = function(J) { J !== void 0 && (T = J, this.setSize(S, I, !1)); }, this.getSize = function(J) { return J.set(S, I); }, this.setSize = function(J, ye, pe) { if (Ie.isPresenting) { console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."); return; } S = J, I = ye, e.width = Math.floor(J * T), e.height = Math.floor(ye * T), pe !== !1 && (e.style.width = J + "px", e.style.height = ye + "px"), this.setViewport(0, 0, J, ye); }, this.getDrawingBufferSize = function(J) { return J.set(S * T, I * T).floor(); }, this.setDrawingBufferSize = function(J, ye, pe) { S = J, I = ye, T = pe, e.width = Math.floor(J * pe), e.height = Math.floor(ye * pe), this.setViewport(0, 0, J, ye); }, this.getCurrentViewport = function(J) { return J.copy(M); }, this.getViewport = function(J) { return J.copy(C); }, this.setViewport = function(J, ye, pe, we) { J.isVector4 ? C.set(J.x, J.y, J.z, J.w) : C.set(J, ye, pe, we), j.viewport(M.copy(C).multiplyScalar(T).floor()); }, this.getScissor = function(J) { return J.copy(P); }, this.setScissor = function(J, ye, pe, we) { J.isVector4 ? P.set(J.x, J.y, J.z, J.w) : P.set(J, ye, pe, we), j.scissor(R.copy(P).multiplyScalar(T).floor()); }, this.getScissorTest = function() { return b; }, this.setScissorTest = function(J) { j.setScissorTest(b = J); }, this.setOpaqueSort = function(J) { _ = J; }, this.setTransparentSort = function(J) { E = J; }, this.getClearColor = function(J) { return J.copy(Ae.getClearColor()); }, this.setClearColor = function() { Ae.setClearColor.apply(Ae, arguments); }, this.getClearAlpha = function() { return Ae.getClearAlpha(); }, this.setClearAlpha = function() { Ae.setClearAlpha.apply(Ae, arguments); }, this.clear = function(J, ye, pe) { let we = 0; (J === void 0 || J) && (we |= 16384), (ye === void 0 || ye) && (we |= 256), (pe === void 0 || pe) && (we |= 1024), ie.clear(we); }, this.clearColor = function() { this.clear(!0, !1, !1); }, this.clearDepth = function() { this.clear(!1, !0, !1); }, this.clearStencil = function() { this.clear(!1, !1, !0); }, this.dispose = function() { e.removeEventListener("webglcontextlost", $e, !1), e.removeEventListener("webglcontextrestored", lt, !1), X.dispose(), ee.dispose(), V.dispose(), K.dispose(), k.dispose(), Me.dispose(), Ie.dispose(), Ie.removeEventListener("sessionstart", Qt), Ie.removeEventListener("sessionend", Ft), U && (U.dispose(), U = null), Nt.stop(); }; function $e(J) { J.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = !0; } function lt() { console.log("THREE.WebGLRenderer: Context Restored."), y = !1; const J = re.autoReset, ye = be.enabled, pe = be.autoUpdate, we = be.needsUpdate, Ce = be.type; De(), re.autoReset = J, be.enabled = ye, be.autoUpdate = pe, be.needsUpdate = we, be.type = Ce; } function qe(J) { const ye = J.target; ye.removeEventListener("dispose", qe), Mt(ye); } function Mt(J) { Be(J), V.remove(J); } function Be(J) { const ye = V.get(J).programs; ye !== void 0 && ye.forEach(function(pe) { O.releaseProgram(pe); }); } function it(J, ye) { J.render(function(pe) { u.renderBufferImmediate(pe, ye); }); } this.renderBufferImmediate = function(J, ye) { Me.initAttributes(); const pe = V.get(J); J.hasPositions && !pe.position && (pe.position = ie.createBuffer()), J.hasNormals && !pe.normal && (pe.normal = ie.createBuffer()), J.hasUvs && !pe.uv && (pe.uv = ie.createBuffer()), J.hasColors && !pe.color && (pe.color = ie.createBuffer()); const we = ye.getAttributes(); J.hasPositions && (ie.bindBuffer(34962, pe.position), ie.bufferData(34962, J.positionArray, 35048), Me.enableAttribute(we.position), ie.vertexAttribPointer(we.position, 3, 5126, !1, 0, 0)), J.hasNormals && (ie.bindBuffer(34962, pe.normal), ie.bufferData(34962, J.normalArray, 35048), Me.enableAttribute(we.normal), ie.vertexAttribPointer(we.normal, 3, 5126, !1, 0, 0)), J.hasUvs && (ie.bindBuffer(34962, pe.uv), ie.bufferData(34962, J.uvArray, 35048), Me.enableAttribute(we.uv), ie.vertexAttribPointer(we.uv, 2, 5126, !1, 0, 0)), J.hasColors && (ie.bindBuffer(34962, pe.color), ie.bufferData(34962, J.colorArray, 35048), Me.enableAttribute(we.color), ie.vertexAttribPointer(we.color, 3, 5126, !1, 0, 0)), Me.disableUnusedAttributes(), ie.drawArrays(4, 0, J.count), J.count = 0; }, this.renderBufferDirect = function(J, ye, pe, we, Ce, ge) { ye === null && (ye = te); const Se = Ce.isMesh && Ce.matrixWorld.determinant() < 0, Fe = Oe(J, ye, we, Ce); j.setMaterial(we, Se); let Ge = pe.index; const We = pe.attributes.position; if (Ge === null) { if (We === void 0 || We.count === 0) return; } else if (Ge.count === 0) return; let et = 1; we.wireframe === !0 && (Ge = se.getWireframeAttribute(pe), et = 2), (we.morphTargets || we.morphNormals) && he.update(Ce, pe, we, Fe), Me.setup(Ce, we, Fe, pe, Ge); let Ye, ft = xe; Ge !== null && (Ye = ce.get(Ge), ft = ne, ft.setIndex(Ye)); const kt = Ge !== null ? Ge.count : We.count, ln = pe.drawRange.start * et, ns = pe.drawRange.count * et, Tt = ge !== null ? ge.start * et : 0, is = ge !== null ? ge.count * et : 1 / 0, Mn = Math.max(ln, Tt), DM = Math.min(kt, ln + ns, Tt + is) - 1, Sl = Math.max(0, DM - Mn + 1); if (Sl !== 0) { if (Ce.isMesh) we.wireframe === !0 ? (j.setLineWidth(we.wireframeLinewidth * ae()), ft.setMode(1)) : ft.setMode(4); else if (Ce.isLine) { let aa = we.linewidth; aa === void 0 && (aa = 1), j.setLineWidth(aa * ae()), Ce.isLineSegments ? ft.setMode(1) : Ce.isLineLoop ? ft.setMode(2) : ft.setMode(3); } else Ce.isPoints ? ft.setMode(0) : Ce.isSprite && ft.setMode(4); if (Ce.isInstancedMesh) ft.renderInstances(Mn, Sl, Ce.count); else if (pe.isInstancedBufferGeometry) { const aa = Math.min(pe.instanceCount, pe._maxInstanceCount); ft.renderInstances(Mn, Sl, aa); } else ft.render(Mn, Sl); } }, this.compile = function(J, ye) { f = ee.get(J), f.init(), J.traverseVisible(function(pe) { pe.isLight && pe.layers.test(ye.layers) && (f.pushLight(pe), pe.castShadow && f.pushShadow(pe)); }), f.setupLights(), J.traverse(function(pe) { const we = pe.material; if (we) if (Array.isArray(we)) for (let Ce = 0; Ce < we.length; Ce++) { const ge = we[Ce]; Q(ge, J, pe); } else Q(we, J, pe); }); }; let tt = null; function qt(J) { tt && tt(J); } function Qt() { Nt.stop(); } function Ft() { Nt.start(); } const Nt = new dx(); Nt.setAnimationLoop(qt), typeof window < "u" && Nt.setContext(window), this.setAnimationLoop = function(J) { tt = J, Ie.setAnimationLoop(J), J === null ? Nt.stop() : Nt.start(); }, Ie.addEventListener("sessionstart", Qt), Ie.addEventListener("sessionend", Ft), this.render = function(J, ye) { if (ye !== void 0 && ye.isCamera !== !0) { console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); return; } if (y === !0) return; J.autoUpdate === !0 && J.updateMatrixWorld(), ye.parent === null && ye.updateMatrixWorld(), Ie.enabled === !0 && Ie.isPresenting === !0 && (Ie.cameraAutoUpdate === !0 && Ie.updateCamera(ye), ye = Ie.getCamera()), J.isScene === !0 && J.onBeforeRender(u, J, ye, x), f = ee.get(J, p.length), f.init(), p.push(f), G.multiplyMatrices(ye.projectionMatrix, ye.matrixWorldInverse), D.setFromProjectionMatrix(G), B = this.localClippingEnabled, N = fe.init(this.clippingPlanes, B, ye), h = X.get(J, g.length), h.init(), g.push(h), Vi(J, ye, 0, u.sortObjects), h.finish(), u.sortObjects === !0 && h.sort(_, E), N === !0 && fe.beginShadows(); const pe = f.state.shadowsArray; be.render(pe, J, ye), f.setupLights(), f.setupLightsView(ye), N === !0 && fe.endShadows(), this.info.autoReset === !0 && this.info.reset(), Ae.render(h, J); const we = h.opaque, Ce = h.transmissive, ge = h.transparent; we.length > 0 && ni(we, J, ye), Ce.length > 0 && ki(we, Ce, J, ye), ge.length > 0 && ni(ge, J, ye), x !== null && (H.updateMultisampleRenderTarget(x), H.updateRenderTargetMipmap(x)), J.isScene === !0 && J.onAfterRender(u, J, ye), j.buffers.depth.setTest(!0), j.buffers.depth.setMask(!0), j.buffers.color.setMask(!0), j.setPolygonOffset(!1), Me.resetDefaultState(), w = -1, A = null, p.pop(), p.length > 0 ? f = p[p.length - 1] : f = null, g.pop(), g.length > 0 ? h = g[g.length - 1] : h = null; }; function Vi(J, ye, pe, we) { if (J.visible === !1) return; if (J.layers.test(ye.layers)) { if (J.isGroup) pe = J.renderOrder; else if (J.isLOD) J.autoUpdate === !0 && J.update(ye); else if (J.isLight) f.pushLight(J), J.castShadow && f.pushShadow(J); else if (J.isSprite) { if (!J.frustumCulled || D.intersectsSprite(J)) { we && Y.setFromMatrixPosition(J.matrixWorld).applyMatrix4(G); const Se = k.update(J), Fe = J.material; Fe.visible && h.push(J, Se, Fe, pe, Y.z, null); } } else if (J.isImmediateRenderObject) we && Y.setFromMatrixPosition(J.matrixWorld).applyMatrix4(G), h.push(J, null, J.material, pe, Y.z, null); else if ((J.isMesh || J.isLine || J.isPoints) && (J.isSkinnedMesh && J.skeleton.frame !== re.render.frame && (J.skeleton.update(), J.skeleton.frame = re.render.frame), !J.frustumCulled || D.intersectsObject(J))) { we && Y.setFromMatrixPosition(J.matrixWorld).applyMatrix4(G); const Se = k.update(J), Fe = J.material; if (Array.isArray(Fe)) { const Ge = Se.groups; for (let We = 0, et = Ge.length; We < et; We++) { const Ye = Ge[We], ft = Fe[Ye.materialIndex]; ft && ft.visible && h.push(J, Se, ft, pe, Y.z, Ye); } } else Fe.visible && h.push(J, Se, Fe, pe, Y.z, null); } } const ge = J.children; for (let Se = 0, Fe = ge.length; Se < Fe; Se++) Vi(ge[Se], ye, pe, we); } function ki(J, ye, pe, we) { if (U === null) { const Fe = o === !0 && $.isWebGL2 === !0 ? Ef : fi; U = new Fe(1024, 1024, { generateMipmaps: !0, type: me.convert(Ms) !== null ? Ms : Ts, minFilter: fr, magFilter: $t, wrapS: hn, wrapT: hn }); } const Ce = u.getRenderTarget(); u.setRenderTarget(U), u.clear(); const ge = u.toneMapping; u.toneMapping = Ir, ni(J, pe, we), u.toneMapping = ge, H.updateMultisampleRenderTarget(U), H.updateRenderTargetMipmap(U), u.setRenderTarget(Ce), ni(ye, pe, we); } function ni(J, ye, pe) { const we = ye.isScene === !0 ? ye.overrideMaterial : null; for (let Ce = 0, ge = J.length; Ce < ge; Ce++) { const Se = J[Ce], Fe = Se.object, Ge = Se.geometry, We = we === null ? Se.material : we, et = Se.group; if (pe.isArrayCamera) { const Ye = pe.cameras; for (let ft = 0, kt = Ye.length; ft < kt; ft++) { const ln = Ye[ft]; Fe.layers.test(ln.layers) && (j.viewport(M.copy(ln.viewport)), f.setupLightsView(ln), ts(Fe, ye, ln, Ge, We, et)); } } else ts(Fe, ye, pe, Ge, We, et); } } function ts(J, ye, pe, we, Ce, ge) { if (J.onBeforeRender(u, ye, pe, we, Ce, ge), J.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse, J.matrixWorld), J.normalMatrix.getNormalMatrix(J.modelViewMatrix), J.isImmediateRenderObject) { const Se = Oe(pe, ye, Ce, J); j.setMaterial(Ce), Me.reset(), it(J, Se); } else Ce.transparent === !0 && Ce.side === Wr ? (Ce.side = jt, Ce.needsUpdate = !0, u.renderBufferDirect(pe, ye, we, Ce, J, ge), Ce.side = Hr, Ce.needsUpdate = !0, u.renderBufferDirect(pe, ye, we, Ce, J, ge), Ce.side = Wr) : u.renderBufferDirect(pe, ye, we, Ce, J, ge); J.onAfterRender(u, ye, pe, we, Ce, ge); } function Q(J, ye, pe) { ye.isScene !== !0 && (ye = te); const we = V.get(J), Ce = f.state.lights, ge = f.state.shadowsArray, Se = Ce.state.version, Fe = O.getParameters(J, Ce.state, ge, ye, pe), Ge = O.getProgramCacheKey(Fe); let We = we.programs; we.environment = J.isMeshStandardMaterial ? ye.environment : null, we.fog = ye.fog, we.envMap = K.get(J.envMap || we.environment), We === void 0 && (J.addEventListener("dispose", qe), We = /* @__PURE__ */ new Map(), we.programs = We); let et = We.get(Ge); if (et !== void 0) { if (we.currentProgram === et && we.lightsStateVersion === Se) return _e(J, Fe), et; } else Fe.uniforms = O.getUniforms(J), J.onBuild(Fe, u), J.onBeforeCompile(Fe, u), et = O.acquireProgram(Fe, Ge), We.set(Ge, et), we.uniforms = Fe.uniforms; const Ye = we.uniforms; (!J.isShaderMaterial && !J.isRawShaderMaterial || J.clipping === !0) && (Ye.clippingPlanes = fe.uniform), _e(J, Fe), we.needsLights = ht(J), we.lightsStateVersion = Se, we.needsLights && (Ye.ambientLightColor.value = Ce.state.ambient, Ye.lightProbe.value = Ce.state.probe, Ye.directionalLights.value = Ce.state.directional, Ye.directionalLightShadows.value = Ce.state.directionalShadow, Ye.spotLights.value = Ce.state.spot, Ye.spotLightShadows.value = Ce.state.spotShadow, Ye.rectAreaLights.value = Ce.state.rectArea, Ye.ltc_1.value = Ce.state.rectAreaLTC1, Ye.ltc_2.value = Ce.state.rectAreaLTC2, Ye.pointLights.value = Ce.state.point, Ye.pointLightShadows.value = Ce.state.pointShadow, Ye.hemisphereLights.value = Ce.state.hemi, Ye.directionalShadowMap.value = Ce.state.directionalShadowMap, Ye.directionalShadowMatrix.value = Ce.state.directionalShadowMatrix, Ye.spotShadowMap.value = Ce.state.spotShadowMap, Ye.spotShadowMatrix.value = Ce.state.spotShadowMatrix, Ye.pointShadowMap.value = Ce.state.pointShadowMap, Ye.pointShadowMatrix.value = Ce.state.pointShadowMatrix); const ft = et.getUniforms(), kt = Or.seqWithValue(ft.seq, Ye); return we.currentProgram = et, we.uniformsList = kt, et; } function _e(J, ye) { const pe = V.get(J); pe.outputEncoding = ye.outputEncoding, pe.instancing = ye.instancing, pe.skinning = ye.skinning, pe.numClippingPlanes = ye.numClippingPlanes, pe.numIntersection = ye.numClipIntersection, pe.vertexAlphas = ye.vertexAlphas; } function Oe(J, ye, pe, we) { ye.isScene !== !0 && (ye = te), H.resetTextureUnits(); const Ce = ye.fog, ge = pe.isMeshStandardMaterial ? ye.environment : null, Se = x === null ? u.outputEncoding : x.texture.encoding, Fe = K.get(pe.envMap || ge), Ge = pe.vertexColors === !0 && we.geometry && we.geometry.attributes.color && we.geometry.attributes.color.itemSize === 4, We = V.get(pe), et = f.state.lights; if (N === !0 && (B === !0 || J !== A)) { const Mn = J === A && pe.id === w; fe.setState(pe, J, Mn); } let Ye = !1; pe.version === We.__version ? (We.needsLights && We.lightsStateVersion !== et.state.version || We.outputEncoding !== Se || we.isInstancedMesh && We.instancing === !1 || !we.isInstancedMesh && We.instancing === !0 || we.isSkinnedMesh && We.skinning === !1 || !we.isSkinnedMesh && We.skinning === !0 || We.envMap !== Fe || pe.fog && We.fog !== Ce || We.numClippingPlanes !== void 0 && (We.numClippingPlanes !== fe.numPlanes || We.numIntersection !== fe.numIntersection) || We.vertexAlphas !== Ge) && (Ye = !0) : (Ye = !0, We.__version = pe.version); let ft = We.currentProgram; Ye === !0 && (ft = Q(pe, ye, we)); let kt = !1, ln = !1, ns = !1; const Tt = ft.getUniforms(), is = We.uniforms; if (j.useProgram(ft.program) && (kt = !0, ln = !0, ns = !0), pe.id !== w && (w = pe.id, ln = !0), kt || A !== J) { if (Tt.setValue(ie, "projectionMatrix", J.projectionMatrix), $.logarithmicDepthBuffer && Tt.setValue( ie, "logDepthBufFC", 2 / (Math.log(J.far + 1) / Math.LN2) ), A !== J && (A = J, ln = !0, ns = !0), pe.isShaderMaterial || pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshStandardMaterial || pe.envMap) { const Mn = Tt.map.cameraPosition; Mn !== void 0 && Mn.setValue( ie, Y.setFromMatrixPosition(J.matrixWorld) ); } (pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshLambertMaterial || pe.isMeshBasicMaterial || pe.isMeshStandardMaterial || pe.isShaderMaterial) && Tt.setValue(ie, "isOrthographic", J.isOrthographicCamera === !0), (pe.isMeshPhongMaterial || pe.isMeshToonMaterial || pe.isMeshLambertMaterial || pe.isMeshBasicMaterial || pe.isMeshStandardMaterial || pe.isShaderMaterial || pe.isShadowMaterial || we.isSkinnedMesh) && Tt.setValue(ie, "viewMatrix", J.matrixWorldInverse); } if (we.isSkinnedMesh) { Tt.setOptional(ie, we, "bindMatrix"), Tt.setOptional(ie, we, "bindMatrixInverse"); const Mn = we.skeleton; Mn && ($.floatVertexTextures ? (Mn.boneTexture === null && Mn.computeBoneTexture(), Tt.setValue(ie, "boneTexture", Mn.boneTexture, H), Tt.setValue(ie, "boneTextureSize", Mn.boneTextureSize)) : Tt.setOptional(ie, Mn, "boneMatrices")); } return (ln || We.receiveShadow !== we.receiveShadow) && (We.receiveShadow = we.receiveShadow, Tt.setValue(ie, "receiveShadow", we.receiveShadow)), ln && (Tt.setValue(ie, "toneMappingExposure", u.toneMappingExposure), We.needsLights && Ze(is, ns), Ce && pe.fog && Z.refreshFogUniforms(is, Ce), Z.refreshMaterialUniforms(is, pe, T, I, U), Or.upload(ie, We.uniformsList, is, H)), pe.isShaderMaterial && pe.uniformsNeedUpdate === !0 && (Or.upload(ie, We.uniformsList, is, H), pe.uniformsNeedUpdate = !1), pe.isSpriteMaterial && Tt.setValue(ie, "center", we.center), Tt.setValue(ie, "modelViewMatrix", we.modelViewMatrix), Tt.setValue(ie, "normalMatrix", we.normalMatrix), Tt.setValue(ie, "modelMatrix", we.matrixWorld), ft; } function Ze(J, ye) { J.ambientLightColor.needsUpdate = ye, J.lightProbe.needsUpdate = ye, J.directionalLights.needsUpdate = ye, J.directionalLightShadows.needsUpdate = ye, J.pointLights.needsUpdate = ye, J.pointLightShadows.needsUpdate = ye, J.spotLights.needsUpdate = ye, J.spotLightShadows.needsUpdate = ye, J.rectAreaLights.needsUpdate = ye, J.hemisphereLights.needsUpdate = ye; } function ht(J) { return J.isMeshLambertMaterial || J.isMeshToonMaterial || J.isMeshPhongMaterial || J.isMeshStandardMaterial || J.isShadowMaterial || J.isShaderMaterial && J.lights === !0; } this.getActiveCubeFace = function() { return v; }, this.getActiveMipmapLevel = function() { return m; }, this.getRenderTarget = function() { return x; }, this.setRenderTarget = function(J, ye = 0, pe = 0) { x = J, v = ye, m = pe, J && V.get(J).__webglFramebuffer === void 0 && H.setupRenderTarget(J); let we = null, Ce = !1, ge = !1; if (J) { const Fe = J.texture; (Fe.isDataTexture3D || Fe.isDataTexture2DArray) && (ge = !0); const Ge = V.get(J).__webglFramebuffer; J.isWebGLCubeRenderTarget ? (we = Ge[ye], Ce = !0) : J.isWebGLMultisampleRenderTarget ? we = V.get(J).__webglMultisampledFramebuffer : we = Ge, M.copy(J.viewport), R.copy(J.scissor), L = J.scissorTest; } else M.copy(C).multiplyScalar(T).floor(), R.copy(P).multiplyScalar(T).floor(), L = b; if (j.bindFramebuffer(36160, we) && $.drawBuffers) { let Fe = !1; if (J) if (J.isWebGLMultipleRenderTargets) { const Ge = J.texture; if (F.length !== Ge.length || F[0] !== 36064) { for (let We = 0, et = Ge.length; We < et; We++) F[We] = 36064 + We; F.length = Ge.length, Fe = !0; } } else (F.length !== 1 || F[0] !== 36064) && (F[0] = 36064, F.length = 1, Fe = !0); else (F.length !== 1 || F[0] !== 1029) && (F[0] = 1029, F.length = 1, Fe = !0); Fe && ($.isWebGL2 ? ie.drawBuffers(F) : W.get("WEBGL_draw_buffers").drawBuffersWEBGL(F)); } if (j.viewport(M), j.scissor(R), j.setScissorTest(L), Ce) { const Fe = V.get(J.texture); ie.framebufferTexture2D(36160, 36064, 34069 + ye, Fe.__webglTexture, pe); } else if (ge) { const Fe = V.get(J.texture), Ge = ye || 0; ie.framebufferTextureLayer(36160, 36064, Fe.__webglTexture, pe || 0, Ge); } }, this.readRenderTargetPixels = function(J, ye, pe, we, Ce, ge, Se) { if (!(J && J.isWebGLRenderTarget)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); return; } let Fe = V.get(J).__webglFramebuffer; if (J.isWebGLCubeRenderTarget && Se !== void 0 && (Fe = Fe[Se]), Fe) { j.bindFramebuffer(36160, Fe); try { const Ge = J.texture, We = Ge.format, et = Ge.type; if (We !== Gn && me.convert(We) !== ie.getParameter(35739)) { console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); return; } const Ye = et === Ms && (W.has("EXT_color_buffer_half_float") || $.isWebGL2 && W.has("EXT_color_buffer_float")); if (et !== Ts && me.convert(et) !== ie.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513) !(et === qi && ($.isWebGL2 || W.has("OES_texture_float") || W.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; } ie.checkFramebufferStatus(36160) === 36053 ? ye >= 0 && ye <= J.width - we && pe >= 0 && pe <= J.height - Ce && ie.readPixels(ye, pe, we, Ce, me.convert(We), me.convert(et), ge) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."); } finally { const Ge = x !== null ? V.get(x).__webglFramebuffer : null; j.bindFramebuffer(36160, Ge); } } }, this.copyFramebufferToTexture = function(J, ye, pe = 0) { const we = Math.pow(2, -pe), Ce = Math.floor(ye.image.width * we), ge = Math.floor(ye.image.height * we); let Se = me.convert(ye.format); $.isWebGL2 && (Se === 6407 && (Se = 32849), Se === 6408 && (Se = 32856)), H.setTexture2D(ye, 0), ie.copyTexImage2D(3553, pe, Se, J.x, J.y, Ce, ge, 0), j.unbindTexture(); }, this.copyTextureToTexture = function(J, ye, pe, we = 0) { const Ce = ye.image.width, ge = ye.image.height, Se = me.convert(pe.format), Fe = me.convert(pe.type); H.setTexture2D(pe, 0), ie.pixelStorei(37440, pe.flipY), ie.pixelStorei(37441, pe.premultiplyAlpha), ie.pixelStorei(3317, pe.unpackAlignment), ye.isDataTexture ? ie.texSubImage2D(3553, we, J.x, J.y, Ce, ge, Se, Fe, ye.image.data) : ye.isCompressedTexture ? ie.compressedTexSubImage2D(3553, we, J.x, J.y, ye.mipmaps[0].width, ye.mipmaps[0].height, Se, ye.mipmaps[0].data) : ie.texSubImage2D(3553, we, J.x, J.y, Se, Fe, ye.image), we === 0 && pe.generateMipmaps && ie.generateMipmap(3553), j.unbindTexture(); }, this.copyTextureToTexture3D = function(J, ye, pe, we, Ce = 0) { if (u.isWebGL1Renderer) { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2."); return; } const ge = J.max.x - J.min.x + 1, Se = J.max.y - J.min.y + 1, Fe = J.max.z - J.min.z + 1, Ge = me.convert(we.format), We = me.convert(we.type); let et; if (we.isDataTexture3D) H.setTexture3D(we, 0), et = 32879; else if (we.isDataTexture2DArray) H.setTexture2DArray(we, 0), et = 35866; else { console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray."); return; } ie.pixelStorei(37440, we.flipY), ie.pixelStorei(37441, we.premultiplyAlpha), ie.pixelStorei(3317, we.unpackAlignment); const Ye = ie.getParameter(3314), ft = ie.getParameter(32878), kt = ie.getParameter(3316), ln = ie.getParameter(3315), ns = ie.getParameter(32877), Tt = pe.isCompressedTexture ? pe.mipmaps[0] : pe.image; ie.pixelStorei(3314, Tt.width), ie.pixelStorei(32878, Tt.height), ie.pixelStorei(3316, J.min.x), ie.pixelStorei(3315, J.min.y), ie.pixelStorei(32877, J.min.z), pe.isDataTexture || pe.isDataTexture3D ? ie.texSubImage3D(et, Ce, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, We, Tt.data) : pe.isCompressedTexture ? (console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."), ie.compressedTexSubImage3D(et, Ce, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, Tt.data)) : ie.texSubImage3D(et, Ce, ye.x, ye.y, ye.z, ge, Se, Fe, Ge, We, Tt), ie.pixelStorei(3314, Ye), ie.pixelStorei(32878, ft), ie.pixelStorei(3316, kt), ie.pixelStorei(3315, ln), ie.pixelStorei(32877, ns), Ce === 0 && we.generateMipmaps && ie.generateMipmap(et), j.unbindTexture(); }, this.initTexture = function(J) { H.setTexture2D(J, 0), j.unbindTexture(); }, this.resetState = function() { v = 0, m = 0, x = null, j.reset(), Me.reset(); }, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); } class wx extends wt { } wx.prototype.isWebGL1Renderer = !0; class fl { constructor(e, t = 25e-5) { this.name = "", this.color = new Ue(e), this.density = t; } clone() { return new fl(this.color, this.density); } toJSON() { return { type: "FogExp2", color: this.color.getHex(), density: this.density }; } } fl.prototype.isFogExp2 = !0; class pl { constructor(e, t = 1, i = 1e3) { this.name = "", this.color = new Ue(e), this.near = t, this.far = i; } clone() { return new pl(this.color, this.near, this.far); } toJSON() { return { type: "Fog", color: this.color.getHex(), near: this.near, far: this.far }; } } pl.prototype.isFog = !0; class wu extends ut { constructor() { super(), this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = !0, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })); } copy(e, t) { return super.copy(e, t), e.background !== null && (this.background = e.background.clone()), e.environment !== null && (this.environment = e.environment.clone()), e.fog !== null && (this.fog = e.fog.clone()), e.overrideMaterial !== null && (this.overrideMaterial = e.overrideMaterial.clone()), this.autoUpdate = e.autoUpdate, this.matrixAutoUpdate = e.matrixAutoUpdate, this; } toJSON(e) { const t = super.toJSON(e); return this.fog !== null && (t.object.fog = this.fog.toJSON()), t; } } wu.prototype.isScene = !0; class Qr { constructor(e, t) { this.array = e, this.stride = t, this.count = e !== void 0 ? e.length / t : 0, this.usage = Ro, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.uuid = Hn(); } onUploadCallback() { } set needsUpdate(e) { e === !0 && this.version++; } setUsage(e) { return this.usage = e, this; } copy(e) { return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this; } copyAt(e, t, i) { e *= this.stride, i *= t.stride; for (let r = 0, s = this.stride; r < s; r++) this.array[e + r] = t.array[i + r]; return this; } set(e, t = 0) { return this.array.set(e, t), this; } clone(e) { e.arrayBuffers === void 0 && (e.arrayBuffers = {}), this.array.buffer._uuid === void 0 && (this.array.buffer._uuid = Hn()), 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 = Hn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer))), { uuid: this.uuid, buffer: this.array.buffer._uuid, type: this.array.constructor.name, stride: this.stride }; } } Qr.prototype.isInterleavedBuffer = !0; const Gt = /* @__PURE__ */ new q(); class ar { constructor(e, t, i, r = !1) { this.name = "", this.data = e, this.itemSize = t, this.offset = i, this.normalized = r === !0; } get count() { return this.data.count; } get array() { return this.data.array; } set needsUpdate(e) { this.data.needsUpdate = e; } applyMatrix4(e) { for (let t = 0, i = this.data.count; t < i; t++) Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.applyMatrix4(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z); return this; } applyNormalMatrix(e) { for (let t = 0, i = this.count; t < i; t++) Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.applyNormalMatrix(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z); return this; } transformDirection(e) { for (let t = 0, i = this.count; t < i; t++) Gt.x = this.getX(t), Gt.y = this.getY(t), Gt.z = this.getZ(t), Gt.transformDirection(e), this.setXYZ(t, Gt.x, Gt.y, Gt.z); return this; } setX(e, t) { return this.data.array[e * this.data.stride + this.offset] = t, this; } setY(e, t) { return this.data.array[e * this.data.stride + this.offset + 1] = t, this; } setZ(e, t) { return this.data.array[e * this.data.stride + this.offset + 2] = t, this; } setW(e, t) { return this.data.array[e * this.data.stride + this.offset + 3] = t, this; } getX(e) { return this.data.array[e * this.data.stride + this.offset]; } getY(e) { return this.data.array[e * this.data.stride + this.offset + 1]; } getZ(e) { return this.data.array[e * this.data.stride + this.offset + 2]; } getW(e) { return this.data.array[e * this.data.stride + this.offset + 3]; } setXY(e, t, i) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this; } setXYZ(e, t, i, r) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this; } setXYZW(e, t, i, r, s) { return e = e * this.data.stride + this.offset, this.data.array[e + 0] = t, this.data.array[e + 1] = i, this.data.array[e + 2] = r, this.data.array[e + 3] = s, this; } clone(e) { if (e === void 0) { console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data."); const t = []; for (let i = 0; i < this.count; i++) { const r = i * this.data.stride + this.offset; for (let s = 0; s < this.itemSize; s++) t.push(this.data.array[r + s]); } return new ot(new this.array.constructor(t), this.itemSize, this.normalized); } else return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new ar(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } toJSON(e) { if (e === void 0) { console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data."); const t = []; for (let i = 0; i < this.count; i++) { const r = i * this.data.stride + this.offset; for (let s = 0; s < this.itemSize; s++) t.push(this.data.array[r + s]); } return { itemSize: this.itemSize, type: this.array.constructor.name, array: t, normalized: this.normalized }; } else return e.interleavedBuffers === void 0 && (e.interleavedBuffers = {}), e.interleavedBuffers[this.data.uuid] === void 0 && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), { isInterleavedBufferAttribute: !0, itemSize: this.itemSize, data: this.data.uuid, offset: this.offset, normalized: this.normalized }; } } ar.prototype.isInterleavedBufferAttribute = !0; class ml extends tn { constructor(e) { super(), this.type = "SpriteMaterial", this.color = new Ue(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.rotation = e.rotation, this.sizeAttenuation = e.sizeAttenuation, this; } } ml.prototype.isSpriteMaterial = !0; let ro; const ga = /* @__PURE__ */ new q(), so = /* @__PURE__ */ new q(), oo = /* @__PURE__ */ new q(), ao = /* @__PURE__ */ new Re(), va = /* @__PURE__ */ new Re(), Ax = /* @__PURE__ */ new Xe(), Kl = /* @__PURE__ */ new q(), ya = /* @__PURE__ */ new q(), ql = /* @__PURE__ */ new q(), yg = /* @__PURE__ */ new Re(), vh = /* @__PURE__ */ new Re(), bg = /* @__PURE__ */ new Re(); class gl extends ut { constructor(e) { if (super(), this.type = "Sprite", ro === void 0) { ro = new Ke(); const t = new Float32Array([ -0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1 ]), i = new Qr(t, 5); ro.setIndex([0, 1, 2, 0, 2, 3]), ro.setAttribute("position", new ar(i, 3, 0, !1)), ro.setAttribute("uv", new ar(i, 2, 3, !1)); } this.geometry = ro, this.material = e !== void 0 ? e : new ml(), this.center = new Re(0.5, 0.5); } raycast(e, t) { e.camera === null && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'), so.setFromMatrixScale(this.matrixWorld), Ax.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), oo.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && so.multiplyScalar(-oo.z); const i = this.material.rotation; let r, s; i !== 0 && (s = Math.cos(i), r = Math.sin(i)); const o = this.center; Ql(Kl.set(-0.5, -0.5, 0), oo, o, so, r, s), Ql(ya.set(0.5, -0.5, 0), oo, o, so, r, s), Ql(ql.set(0.5, 0.5, 0), oo, o, so, r, s), yg.set(0, 0), vh.set(1, 0), bg.set(1, 1); let a = e.ray.intersectTriangle(Kl, ya, ql, !1, ga); if (a === null && (Ql(ya.set(-0.5, 0.5, 0), oo, o, so, r, s), vh.set(0, 1), a = e.ray.intersectTriangle(Kl, ql, ya, !1, ga), a === null)) return; const c = e.ray.origin.distanceTo(ga); c < e.near || c > e.far || t.push({ distance: c, point: ga.clone(), uv: Zt.getUV(ga, Kl, ya, ql, yg, vh, bg, new Re()), face: null, object: this }); } copy(e) { return super.copy(e), e.center !== void 0 && this.center.copy(e.center), this.material = e.material, this; } } gl.prototype.isSprite = !0; function Ql(n, e, t, i, r, s) { ao.subVectors(n, t).addScalar(0.5).multiply(i), r !== void 0 ? (va.x = s * ao.x - r * ao.y, va.y = r * ao.x + s * ao.y) : va.copy(ao), n.copy(e), n.x += va.x, n.y += va.y, n.applyMatrix4(Ax); } const ec = /* @__PURE__ */ new q(), xg = /* @__PURE__ */ new q(); class Sx extends ut { constructor() { super(), this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { levels: { enumerable: !0, value: [] }, isLOD: { value: !0 } }), this.autoUpdate = !0; } copy(e) { super.copy(e, !1); const t = e.levels; for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; this.addLevel(s.object.clone(), s.distance); } return this.autoUpdate = e.autoUpdate, this; } addLevel(e, t = 0) { t = Math.abs(t); const i = this.levels; let r; for (r = 0; r < i.length && !(t < i[r].distance); r++) ; return i.splice(r, 0, { distance: t, object: e }), this.add(e), this; } getCurrentLevel() { return this._currentLevel; } getObjectForDistance(e) { const t = this.levels; if (t.length > 0) { let i, r; for (i = 1, r = t.length; i < r && !(e < t[i].distance); i++) ; return t[i - 1].object; } return null; } raycast(e, t) { if (this.levels.length > 0) { ec.setFromMatrixPosition(this.matrixWorld); const r = e.ray.origin.distanceTo(ec); this.getObjectForDistance(r).raycast(e, t); } } update(e) { const t = this.levels; if (t.length > 1) { ec.setFromMatrixPosition(e.matrixWorld), xg.setFromMatrixPosition(this.matrixWorld); const i = ec.distanceTo(xg) / e.zoom; t[0].object.visible = !0; let r, s; for (r = 1, s = t.length; r < s && i >= t[r].distance; r++) t[r - 1].object.visible = !1, t[r].object.visible = !0; for (this._currentLevel = r - 1; r < s; r++) t[r].object.visible = !1; } } toJSON(e) { const t = super.toJSON(e); this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = []; const i = this.levels; for (let r = 0, s = i.length; r < s; r++) { const o = i[r]; t.object.levels.push({ object: o.object.uuid, distance: o.distance }); } return t; } } const Mg = /* @__PURE__ */ new q(), wg = /* @__PURE__ */ new xt(), Ag = /* @__PURE__ */ new xt(), FD = /* @__PURE__ */ new q(), Sg = /* @__PURE__ */ new Xe(); class vl extends Xt { constructor(e, t) { super(e, t), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new Xe(), this.bindMatrixInverse = new Xe(); } copy(e) { return super.copy(e), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, this; } bind(e, t) { this.skeleton = e, t === void 0 && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert(); } pose() { this.skeleton.pose(); } normalizeSkinWeights() { const e = new xt(), t = this.geometry.attributes.skinWeight; for (let i = 0, r = t.count; i < r; i++) { e.x = t.getX(i), e.y = t.getY(i), e.z = t.getZ(i), e.w = t.getW(i); const s = 1 / e.manhattanLength(); s !== 1 / 0 ? e.multiplyScalar(s) : e.set(1, 0, 0, 0), t.setXYZW(i, e.x, e.y, e.z, e.w); } } updateMatrixWorld(e) { super.updateMatrixWorld(e), this.bindMode === "attached" ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : this.bindMode === "detached" ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode); } boneTransform(e, t) { const i = this.skeleton, r = this.geometry; wg.fromBufferAttribute(r.attributes.skinIndex, e), Ag.fromBufferAttribute(r.attributes.skinWeight, e), Mg.fromBufferAttribute(r.attributes.position, e).applyMatrix4(this.bindMatrix), t.set(0, 0, 0); for (let s = 0; s < 4; s++) { const o = Ag.getComponent(s); if (o !== 0) { const a = wg.getComponent(s); Sg.multiplyMatrices(i.bones[a].matrixWorld, i.boneInverses[a]), t.addScaledVector(FD.copy(Mg).applyMatrix4(Sg), o); } } return t.applyMatrix4(this.bindMatrixInverse); } } vl.prototype.isSkinnedMesh = !0; class yl extends ut { constructor() { super(), this.type = "Bone"; } } yl.prototype.isBone = !0; class Ss extends Yt { constructor(e = null, t = 1, i = 1, r, s, o, a, c, l = $t, d = $t, h, f) { super(null, o, a, c, l, d, r, s, h, f), this.image = { data: e, width: t, height: i }, this.magFilter = l, this.minFilter = d, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.needsUpdate = !0; } } Ss.prototype.isDataTexture = !0; const _g = /* @__PURE__ */ new Xe(), PD = /* @__PURE__ */ new Xe(); class bl { constructor(e = [], t = []) { this.uuid = Hn(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.boneTextureSize = 0, this.frame = -1, this.init(); } init() { const e = this.bones, t = this.boneInverses; if (this.boneMatrices = new Float32Array(e.length * 16), t.length === 0) this.calculateInverses(); else if (e.length !== t.length) { console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = []; for (let i = 0, r = this.bones.length; i < r; i++) this.boneInverses.push(new Xe()); } } calculateInverses() { this.boneInverses.length = 0; for (let e = 0, t = this.bones.length; e < t; e++) { const i = new Xe(); this.bones[e] && i.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(i); } } pose() { for (let e = 0, t = this.bones.length; e < t; e++) { const i = this.bones[e]; i && i.matrixWorld.copy(this.boneInverses[e]).invert(); } for (let e = 0, t = this.bones.length; e < t; e++) { const i = this.bones[e]; i && (i.parent && i.parent.isBone ? (i.matrix.copy(i.parent.matrixWorld).invert(), i.matrix.multiply(i.matrixWorld)) : i.matrix.copy(i.matrixWorld), i.matrix.decompose(i.position, i.quaternion, i.scale)); } } update() { const e = this.bones, t = this.boneInverses, i = this.boneMatrices, r = this.boneTexture; for (let s = 0, o = e.length; s < o; s++) { const a = e[s] ? e[s].matrixWorld : PD; _g.multiplyMatrices(a, t[s]), _g.toArray(i, s * 16); } r !== null && (r.needsUpdate = !0); } clone() { return new bl(this.bones, this.boneInverses); } computeBoneTexture() { let e = Math.sqrt(this.bones.length * 4); e = Qb(e), e = Math.max(e, 4); const t = new Float32Array(e * e * 4); t.set(this.boneMatrices); const i = new Ss(t, e, e, Gn, qi); return this.boneMatrices = t, this.boneTexture = i, this.boneTextureSize = e, this; } getBoneByName(e) { for (let t = 0, i = this.bones.length; t < i; t++) { const r = this.bones[t]; if (r.name === e) return r; } } dispose() { this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null); } fromJSON(e, t) { this.uuid = e.uuid; for (let i = 0, r = e.bones.length; i < r; i++) { const s = e.bones[i]; let o = t[s]; o === void 0 && (console.warn("THREE.Skeleton: No bone found with UUID:", s), o = new yl()), this.bones.push(o), this.boneInverses.push(new Xe().fromArray(e.boneInverses[i])); } return this.init(), this; } toJSON() { const e = { metadata: { version: 4.5, type: "Skeleton", generator: "Skeleton.toJSON" }, bones: [], boneInverses: [] }; e.uuid = this.uuid; const t = this.bones, i = this.boneInverses; for (let r = 0, s = t.length; r < s; r++) { const o = t[r]; e.bones.push(o.uuid); const a = i[r]; e.boneInverses.push(a.toArray()); } return e; } } const Tg = /* @__PURE__ */ new Xe(), Eg = /* @__PURE__ */ new Xe(), tc = [], ba = /* @__PURE__ */ new Xt(); class Pf extends Xt { constructor(e, t, i) { super(e, t), this.instanceMatrix = new ot(new Float32Array(i * 16), 16), this.instanceColor = null, this.count = i, this.frustumCulled = !1; } copy(e) { return super.copy(e), this.instanceMatrix.copy(e.instanceMatrix), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, this; } getColorAt(e, t) { t.fromArray(this.instanceColor.array, e * 3); } getMatrixAt(e, t) { t.fromArray(this.instanceMatrix.array, e * 16); } raycast(e, t) { const i = this.matrixWorld, r = this.count; if (ba.geometry = this.geometry, ba.material = this.material, ba.material !== void 0) for (let s = 0; s < r; s++) { this.getMatrixAt(s, Tg), Eg.multiplyMatrices(i, Tg), ba.matrixWorld = Eg, ba.raycast(e, tc); for (let o = 0, a = tc.length; o < a; o++) { const c = tc[o]; c.instanceId = s, c.object = this, t.push(c); } tc.length = 0; } } setColorAt(e, t) { this.instanceColor === null && (this.instanceColor = new ot(new Float32Array(this.count * 3), 3)), t.toArray(this.instanceColor.array, e * 3); } setMatrixAt(e, t) { t.toArray(this.instanceMatrix.array, e * 16); } updateMorphTargets() { } dispose() { this.dispatchEvent({ type: "dispose" }); } } Pf.prototype.isInstancedMesh = !0; class an extends tn { constructor(e) { super(), this.type = "LineBasicMaterial", this.color = new Ue(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.morphTargets = e.morphTargets, this; } } an.prototype.isLineBasicMaterial = !0; const Cg = /* @__PURE__ */ new q(), Lg = /* @__PURE__ */ new q(), Rg = /* @__PURE__ */ new Xe(), yh = /* @__PURE__ */ new qr(), nc = /* @__PURE__ */ new pr(); class Oi extends ut { constructor(e = new Ke(), t = new an()) { super(), this.type = "Line", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), this.material = e.material, this.geometry = e.geometry, this; } computeLineDistances() { const e = this.geometry; if (e.isBufferGeometry) if (e.index === null) { const t = e.attributes.position, i = [0]; for (let r = 1, s = t.count; r < s; r++) Cg.fromBufferAttribute(t, r - 1), Lg.fromBufferAttribute(t, r), i[r] = i[r - 1], i[r] += Cg.distanceTo(Lg); e.setAttribute("lineDistance", new He(i, 1)); } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else e.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return this; } raycast(e, t) { const i = this.geometry, r = this.matrixWorld, s = e.params.Line.threshold, o = i.drawRange; if (i.boundingSphere === null && i.computeBoundingSphere(), nc.copy(i.boundingSphere), nc.applyMatrix4(r), nc.radius += s, e.ray.intersectsSphere(nc) === !1) return; Rg.copy(r).invert(), yh.copy(e.ray).applyMatrix4(Rg); const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a, l = new q(), d = new q(), h = new q(), f = new q(), g = this.isLineSegments ? 2 : 1; if (i.isBufferGeometry) { const p = i.index, y = i.attributes.position; if (p !== null) { const v = Math.max(0, o.start), m = Math.min(p.count, o.start + o.count); for (let x = v, w = m - 1; x < w; x += g) { const A = p.getX(x), M = p.getX(x + 1); if (l.fromBufferAttribute(y, A), d.fromBufferAttribute(y, M), yh.distanceSqToSegment(l, d, f, h) > c) continue; f.applyMatrix4(this.matrixWorld); const L = e.ray.origin.distanceTo(f); L < e.near || L > e.far || t.push({ distance: L, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: h.clone().applyMatrix4(this.matrixWorld), index: x, face: null, faceIndex: null, object: this }); } } else { const v = Math.max(0, o.start), m = Math.min(y.count, o.start + o.count); for (let x = v, w = m - 1; x < w; x += g) { if (l.fromBufferAttribute(y, x), d.fromBufferAttribute(y, x + 1), yh.distanceSqToSegment(l, d, f, h) > c) continue; f.applyMatrix4(this.matrixWorld); const M = e.ray.origin.distanceTo(f); M < e.near || M > e.far || t.push({ distance: M, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: h.clone().applyMatrix4(this.matrixWorld), index: x, face: null, faceIndex: null, object: this }); } } } else i.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } Oi.prototype.isLine = !0; const Fg = /* @__PURE__ */ new q(), Pg = /* @__PURE__ */ new q(); class Rn extends Oi { constructor(e, t) { super(e, t), this.type = "LineSegments"; } computeLineDistances() { const e = this.geometry; if (e.isBufferGeometry) if (e.index === null) { const t = e.attributes.position, i = []; for (let r = 0, s = t.count; r < s; r += 2) Fg.fromBufferAttribute(t, r), Pg.fromBufferAttribute(t, r + 1), i[r] = r === 0 ? 0 : i[r - 1], i[r + 1] = i[r] + Fg.distanceTo(Pg); e.setAttribute("lineDistance", new He(i, 1)); } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); else e.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return this; } } Rn.prototype.isLineSegments = !0; class Au extends Oi { constructor(e, t) { super(e, t), this.type = "LineLoop"; } } Au.prototype.isLineLoop = !0; class es extends tn { constructor(e) { super(), this.type = "PointsMaterial", this.color = new Ue(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.morphTargets = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.morphTargets = e.morphTargets, this; } } es.prototype.isPointsMaterial = !0; const Ig = /* @__PURE__ */ new Xe(), wd = /* @__PURE__ */ new qr(), ic = /* @__PURE__ */ new pr(), rc = /* @__PURE__ */ new q(); class ia extends ut { constructor(e = new Ke(), t = new es()) { super(), this.type = "Points", this.geometry = e, this.material = t, this.updateMorphTargets(); } copy(e) { return super.copy(e), this.material = e.material, this.geometry = e.geometry, this; } raycast(e, t) { const i = this.geometry, r = this.matrixWorld, s = e.params.Points.threshold, o = i.drawRange; if (i.boundingSphere === null && i.computeBoundingSphere(), ic.copy(i.boundingSphere), ic.applyMatrix4(r), ic.radius += s, e.ray.intersectsSphere(ic) === !1) return; Ig.copy(r).invert(), wd.copy(e.ray).applyMatrix4(Ig); const a = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), c = a * a; if (i.isBufferGeometry) { const l = i.index, h = i.attributes.position; if (l !== null) { const f = Math.max(0, o.start), g = Math.min(l.count, o.start + o.count); for (let p = f, u = g; p < u; p++) { const y = l.getX(p); rc.fromBufferAttribute(h, y), Og(rc, y, c, r, e, t, this); } } else { const f = Math.max(0, o.start), g = Math.min(h.count, o.start + o.count); for (let p = f, u = g; p < u; p++) rc.fromBufferAttribute(h, p), Og(rc, p, c, r, e, t, this); } } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } updateMorphTargets() { const e = this.geometry; if (e.isBufferGeometry) { const t = e.morphAttributes, i = Object.keys(t); if (i.length > 0) { const r = t[i[0]]; if (r !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (let s = 0, o = r.length; s < o; s++) { const a = r[s].name || String(s); this.morphTargetInfluences.push(0), this.morphTargetDictionary[a] = s; } } } } else { const t = e.morphTargets; t !== void 0 && t.length > 0 && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } ia.prototype.isPoints = !0; function Og(n, e, t, i, r, s, o) { const a = wd.distanceSqToPoint(n); if (a < t) { const c = new q(); wd.closestPointToPoint(n, c), c.applyMatrix4(i); const l = r.ray.origin.distanceTo(c); if (l < r.near || l > r.far) return; s.push({ distance: l, distanceToRay: Math.sqrt(a), point: c, index: e, face: null, object: o }); } } class _x extends Yt { constructor(e, t, i, r, s, o, a, c, l) { super(e, t, i, r, s, o, a, c, l), this.format = a !== void 0 ? a : nr, this.minFilter = o !== void 0 ? o : zt, this.magFilter = s !== void 0 ? s : zt, this.generateMipmaps = !1; const d = this; function h() { d.needsUpdate = !0, e.requestVideoFrameCallback(h); } "requestVideoFrameCallback" in e && e.requestVideoFrameCallback(h); } clone() { return new this.constructor(this.image).copy(this); } update() { const e = this.image; "requestVideoFrameCallback" in e === !1 && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0); } } _x.prototype.isVideoTexture = !0; class If extends Yt { constructor(e, t, i, r, s, o, a, c, l, d, h, f) { super(null, o, a, c, l, d, r, s, h, f), this.image = { width: t, height: i }, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1; } } If.prototype.isCompressedTexture = !0; class Tx extends Yt { constructor(e, t, i, r, s, o, a, c, l) { super(e, t, i, r, s, o, a, c, l), this.needsUpdate = !0; } } Tx.prototype.isCanvasTexture = !0; class Ex extends Yt { constructor(e, t, i, r, s, o, a, c, l, d) { if (d = d !== void 0 ? d : ws, d !== ws && d !== Co) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); i === void 0 && d === ws && (i = Ha), i === void 0 && d === Co && (i = yo), super(null, r, s, o, a, c, d, i, l), this.image = { width: e, height: t }, this.magFilter = a !== void 0 ? a : $t, this.minFilter = c !== void 0 ? c : $t, this.flipY = !1, this.generateMipmaps = !1; } } Ex.prototype.isDepthTexture = !0; class Io extends Ke { constructor(e = 1, t = 8, i = 0, r = Math.PI * 2) { super(), this.type = "CircleGeometry", this.parameters = { radius: e, segments: t, thetaStart: i, thetaLength: r }, t = Math.max(3, t); const s = [], o = [], a = [], c = [], l = new q(), d = new Re(); o.push(0, 0, 0), a.push(0, 0, 1), c.push(0.5, 0.5); for (let h = 0, f = 3; h <= t; h++, f += 3) { const g = i + h / t * r; l.x = e * Math.cos(g), l.y = e * Math.sin(g), o.push(l.x, l.y, l.z), a.push(0, 0, 1), d.x = (o[f] / e + 1) / 2, d.y = (o[f + 1] / e + 1) / 2, c.push(d.x, d.y); } for (let h = 1; h <= t; h++) s.push(h, h + 1, 0); this.setIndex(s), this.setAttribute("position", new He(o, 3)), this.setAttribute("normal", new He(a, 3)), this.setAttribute("uv", new He(c, 2)); } static fromJSON(e) { return new Io(e.radius, e.segments, e.thetaStart, e.thetaLength); } } class $r extends Ke { constructor(e = 1, t = 1, i = 1, r = 8, s = 1, o = !1, a = 0, c = Math.PI * 2) { super(), this.type = "CylinderGeometry", this.parameters = { radiusTop: e, radiusBottom: t, height: i, radialSegments: r, heightSegments: s, openEnded: o, thetaStart: a, thetaLength: c }; const l = this; r = Math.floor(r), s = Math.floor(s); const d = [], h = [], f = [], g = []; let p = 0; const u = [], y = i / 2; let v = 0; m(), o === !1 && (e > 0 && x(!0), t > 0 && x(!1)), this.setIndex(d), this.setAttribute("position", new He(h, 3)), this.setAttribute("normal", new He(f, 3)), this.setAttribute("uv", new He(g, 2)); function m() { const w = new q(), A = new q(); let M = 0; const R = (t - e) / i; for (let L = 0; L <= s; L++) { const S = [], I = L / s, T = I * (t - e) + e; for (let _ = 0; _ <= r; _++) { const E = _ / r, C = E * c + a, P = Math.sin(C), b = Math.cos(C); A.x = T * P, A.y = -I * i + y, A.z = T * b, h.push(A.x, A.y, A.z), w.set(P, R, b).normalize(), f.push(w.x, w.y, w.z), g.push(E, 1 - I), S.push(p++); } u.push(S); } for (let L = 0; L < r; L++) for (let S = 0; S < s; S++) { const I = u[S][L], T = u[S + 1][L], _ = u[S + 1][L + 1], E = u[S][L + 1]; d.push(I, T, E), d.push(T, _, E), M += 6; } l.addGroup(v, M, 0), v += M; } function x(w) { const A = p, M = new Re(), R = new q(); let L = 0; const S = w === !0 ? e : t, I = w === !0 ? 1 : -1; for (let _ = 1; _ <= r; _++) h.push(0, y * I, 0), f.push(0, I, 0), g.push(0.5, 0.5), p++; const T = p; for (let _ = 0; _ <= r; _++) { const C = _ / r * c + a, P = Math.cos(C), b = Math.sin(C); R.x = S * b, R.y = y * I, R.z = S * P, h.push(R.x, R.y, R.z), f.push(0, I, 0), M.x = P * 0.5 + 0.5, M.y = b * 0.5 * I + 0.5, g.push(M.x, M.y), p++; } for (let _ = 0; _ < r; _++) { const E = A + _, C = T + _; w === !0 ? d.push(C, C + 1, E) : d.push(C + 1, C, E), L += 3; } l.addGroup(v, L, w === !0 ? 1 : 2), v += L; } } static fromJSON(e) { return new $r(e.radiusTop, e.radiusBottom, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class Oo extends $r { constructor(e = 1, t = 1, i = 8, r = 1, s = !1, o = 0, a = Math.PI * 2) { super(0, e, t, i, r, s, o, a), this.type = "ConeGeometry", this.parameters = { radius: e, height: t, radialSegments: i, heightSegments: r, openEnded: s, thetaStart: o, thetaLength: a }; } static fromJSON(e) { return new Oo(e.radius, e.height, e.radialSegments, e.heightSegments, e.openEnded, e.thetaStart, e.thetaLength); } } class Di extends Ke { constructor(e, t, i = 1, r = 0) { super(), this.type = "PolyhedronGeometry", this.parameters = { vertices: e, indices: t, radius: i, detail: r }; const s = [], o = []; a(r), l(i), d(), this.setAttribute("position", new He(s, 3)), this.setAttribute("normal", new He(s.slice(), 3)), this.setAttribute("uv", new He(o, 2)), r === 0 ? this.computeVertexNormals() : this.normalizeNormals(); function a(m) { const x = new q(), w = new q(), A = new q(); for (let M = 0; M < t.length; M += 3) g(t[M + 0], x), g(t[M + 1], w), g(t[M + 2], A), c(x, w, A, m); } function c(m, x, w, A) { const M = A + 1, R = []; for (let L = 0; L <= M; L++) { R[L] = []; const S = m.clone().lerp(w, L / M), I = x.clone().lerp(w, L / M), T = M - L; for (let _ = 0; _ <= T; _++) _ === 0 && L === M ? R[L][_] = S : R[L][_] = S.clone().lerp(I, _ / T); } for (let L = 0; L < M; L++) for (let S = 0; S < 2 * (M - L) - 1; S++) { const I = Math.floor(S / 2); S % 2 === 0 ? (f(R[L][I + 1]), f(R[L + 1][I]), f(R[L][I])) : (f(R[L][I + 1]), f(R[L + 1][I + 1]), f(R[L + 1][I])); } } function l(m) { const x = new q(); for (let w = 0; w < s.length; w += 3) x.x = s[w + 0], x.y = s[w + 1], x.z = s[w + 2], x.normalize().multiplyScalar(m), s[w + 0] = x.x, s[w + 1] = x.y, s[w + 2] = x.z; } function d() { const m = new q(); for (let x = 0; x < s.length; x += 3) { m.x = s[x + 0], m.y = s[x + 1], m.z = s[x + 2]; const w = y(m) / 2 / Math.PI + 0.5, A = v(m) / Math.PI + 0.5; o.push(w, 1 - A); } p(), h(); } function h() { for (let m = 0; m < o.length; m += 6) { const x = o[m + 0], w = o[m + 2], A = o[m + 4], M = Math.max(x, w, A), R = Math.min(x, w, A); M > 0.9 && R < 0.1 && (x < 0.2 && (o[m + 0] += 1), w < 0.2 && (o[m + 2] += 1), A < 0.2 && (o[m + 4] += 1)); } } function f(m) { s.push(m.x, m.y, m.z); } function g(m, x) { const w = m * 3; x.x = e[w + 0], x.y = e[w + 1], x.z = e[w + 2]; } function p() { const m = new q(), x = new q(), w = new q(), A = new q(), M = new Re(), R = new Re(), L = new Re(); for (let S = 0, I = 0; S < s.length; S += 9, I += 6) { m.set(s[S + 0], s[S + 1], s[S + 2]), x.set(s[S + 3], s[S + 4], s[S + 5]), w.set(s[S + 6], s[S + 7], s[S + 8]), M.set(o[I + 0], o[I + 1]), R.set(o[I + 2], o[I + 3]), L.set(o[I + 4], o[I + 5]), A.copy(m).add(x).add(w).divideScalar(3); const T = y(A); u(M, I + 0, m, T), u(R, I + 2, x, T), u(L, I + 4, w, T); } } function u(m, x, w, A) { A < 0 && m.x === 1 && (o[x] = m.x - 1), w.x === 0 && w.z === 0 && (o[x] = A / 2 / Math.PI + 0.5); } function y(m) { return Math.atan2(m.z, -m.x); } function v(m) { return Math.atan2(-m.y, Math.sqrt(m.x * m.x + m.z * m.z)); } } static fromJSON(e) { return new Di(e.vertices, e.indices, e.radius, e.details); } } class Do extends Di { constructor(e = 1, t = 0) { const i = (1 + Math.sqrt(5)) / 2, r = 1 / i, s = [ // (±1, ±1, ±1) -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, // (0, ±1/φ, ±φ) 0, -r, -i, 0, -r, i, 0, r, -i, 0, r, i, // (±1/φ, ±φ, 0) -r, -i, 0, -r, i, 0, r, -i, 0, r, i, 0, // (±φ, 0, ±1/φ) -i, 0, -r, i, 0, -r, -i, 0, r, i, 0, r ], o = [ 3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9 ]; super(s, o, e, t), this.type = "DodecahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Do(e.radius, e.detail); } } const sc = new q(), oc = new q(), bh = new q(), ac = new Zt(); class Of extends Ke { constructor(e, t) { if (super(), this.type = "EdgesGeometry", this.parameters = { thresholdAngle: t }, t = t !== void 0 ? t : 1, e.isGeometry === !0) { console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return; } const r = Math.pow(10, 4), s = Math.cos(As * t), o = e.getIndex(), a = e.getAttribute("position"), c = o ? o.count : a.count, l = [0, 0, 0], d = ["a", "b", "c"], h = new Array(3), f = {}, g = []; for (let p = 0; p < c; p += 3) { o ? (l[0] = o.getX(p), l[1] = o.getX(p + 1), l[2] = o.getX(p + 2)) : (l[0] = p, l[1] = p + 1, l[2] = p + 2); const { a: u, b: y, c: v } = ac; if (u.fromBufferAttribute(a, l[0]), y.fromBufferAttribute(a, l[1]), v.fromBufferAttribute(a, l[2]), ac.getNormal(bh), h[0] = `${Math.round(u.x * r)},${Math.round(u.y * r)},${Math.round(u.z * r)}`, h[1] = `${Math.round(y.x * r)},${Math.round(y.y * r)},${Math.round(y.z * r)}`, h[2] = `${Math.round(v.x * r)},${Math.round(v.y * r)},${Math.round(v.z * r)}`, !(h[0] === h[1] || h[1] === h[2] || h[2] === h[0])) for (let m = 0; m < 3; m++) { const x = (m + 1) % 3, w = h[m], A = h[x], M = ac[d[m]], R = ac[d[x]], L = `${w}_${A}`, S = `${A}_${w}`; S in f && f[S] ? (bh.dot(f[S].normal) <= s && (g.push(M.x, M.y, M.z), g.push(R.x, R.y, R.z)), f[S] = null) : L in f || (f[L] = { index0: l[m], index1: l[x], normal: bh.clone() }); } } for (const p in f) if (f[p]) { const { index0: u, index1: y } = f[p]; sc.fromBufferAttribute(a, u), oc.fromBufferAttribute(a, y), g.push(sc.x, sc.y, sc.z), g.push(oc.x, oc.y, oc.z); } this.setAttribute("position", new He(g, 3)); } } class jn { constructor() { this.type = "Curve", this.arcLengthDivisions = 200; } // Virtual base class method to overwrite and implement in subclasses // - t [0 .. 1] getPoint() { return console.warn("THREE.Curve: .getPoint() not implemented."), null; } // Get point at relative position in curve according to arc length // - u [0 .. 1] getPointAt(e, t) { const i = this.getUtoTmapping(e); return this.getPoint(i, t); } // Get sequence of points using getPoint( t ) getPoints(e = 5) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPoint(i / e)); return t; } // Get sequence of points using getPointAt( u ) getSpacedPoints(e = 5) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPointAt(i / e)); return t; } // Get total curve arc length getLength() { const e = this.getLengths(); return e[e.length - 1]; } // Get list of cumulative segment lengths getLengths(e = this.arcLengthDivisions) { if (this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths; this.needsUpdate = !1; const t = []; let i, r = this.getPoint(0), s = 0; t.push(0); for (let o = 1; o <= e; o++) i = this.getPoint(o / e), s += i.distanceTo(r), t.push(s), r = i; return this.cacheArcLengths = t, t; } updateArcLengths() { this.needsUpdate = !0, this.getLengths(); } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant getUtoTmapping(e, t) { const i = this.getLengths(); let r = 0; const s = i.length; let o; t ? o = t : o = e * i[s - 1]; let a = 0, c = s - 1, l; for (; a <= c; ) if (r = Math.floor(a + (c - a) / 2), l = i[r] - o, l < 0) a = r + 1; else if (l > 0) c = r - 1; else { c = r; break; } if (r = c, i[r] === o) return r / (s - 1); const d = i[r], f = i[r + 1] - d, g = (o - d) / f; return (r + g) / (s - 1); } // Returns a unit vector tangent at t // In case any sub curve does not implement its tangent derivation, // 2 points a small delta apart will be used to find its gradient // which seems to give a reasonable approximation getTangent(e, t) { let r = e - 1e-4, s = e + 1e-4; r < 0 && (r = 0), s > 1 && (s = 1); const o = this.getPoint(r), a = this.getPoint(s), c = t || (o.isVector2 ? new Re() : new q()); return c.copy(a).sub(o).normalize(), c; } getTangentAt(e, t) { const i = this.getUtoTmapping(e); return this.getTangent(i, t); } computeFrenetFrames(e, t) { const i = new q(), r = [], s = [], o = [], a = new q(), c = new Xe(); for (let g = 0; g <= e; g++) { const p = g / e; r[g] = this.getTangentAt(p, new q()), r[g].normalize(); } s[0] = new q(), o[0] = new q(); let l = Number.MAX_VALUE; const d = Math.abs(r[0].x), h = Math.abs(r[0].y), f = Math.abs(r[0].z); d <= l && (l = d, i.set(1, 0, 0)), h <= l && (l = h, i.set(0, 1, 0)), f <= l && i.set(0, 0, 1), a.crossVectors(r[0], i).normalize(), s[0].crossVectors(r[0], a), o[0].crossVectors(r[0], s[0]); for (let g = 1; g <= e; g++) { if (s[g] = s[g - 1].clone(), o[g] = o[g - 1].clone(), a.crossVectors(r[g - 1], r[g]), a.length() > Number.EPSILON) { a.normalize(); const p = Math.acos(gn(r[g - 1].dot(r[g]), -1, 1)); s[g].applyMatrix4(c.makeRotationAxis(a, p)); } o[g].crossVectors(r[g], s[g]); } if (t === !0) { let g = Math.acos(gn(s[0].dot(s[e]), -1, 1)); g /= e, r[0].dot(a.crossVectors(s[0], s[e])) > 0 && (g = -g); for (let p = 1; p <= e; p++) s[p].applyMatrix4(c.makeRotationAxis(r[p], g * p)), o[p].crossVectors(r[p], s[p]); } return { tangents: r, normals: s, binormals: o }; } clone() { return new this.constructor().copy(this); } copy(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this; } toJSON() { const e = { metadata: { version: 4.5, type: "Curve", generator: "Curve.toJSON" } }; return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e; } fromJSON(e) { return this.arcLengthDivisions = e.arcLengthDivisions, this; } } class xl extends jn { constructor(e = 0, t = 0, i = 1, r = 1, s = 0, o = Math.PI * 2, a = !1, c = 0) { super(), this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = i, this.yRadius = r, this.aStartAngle = s, this.aEndAngle = o, this.aClockwise = a, this.aRotation = c; } getPoint(e, t) { const i = t || new Re(), r = Math.PI * 2; let s = this.aEndAngle - this.aStartAngle; const o = Math.abs(s) < Number.EPSILON; for (; s < 0; ) s += r; for (; s > r; ) s -= r; s < Number.EPSILON && (o ? s = 0 : s = r), this.aClockwise === !0 && !o && (s === r ? s = -r : s = s - r); const a = this.aStartAngle + e * s; let c = this.aX + this.xRadius * Math.cos(a), l = this.aY + this.yRadius * Math.sin(a); if (this.aRotation !== 0) { const d = Math.cos(this.aRotation), h = Math.sin(this.aRotation), f = c - this.aX, g = l - this.aY; c = f * d - g * h + this.aX, l = f * h + g * d + this.aY; } return i.set(c, l); } copy(e) { return super.copy(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; } toJSON() { const e = super.toJSON(); return e.aX = this.aX, e.aY = this.aY, e.xRadius = this.xRadius, e.yRadius = this.yRadius, e.aStartAngle = this.aStartAngle, e.aEndAngle = this.aEndAngle, e.aClockwise = this.aClockwise, e.aRotation = this.aRotation, e; } fromJSON(e) { return super.fromJSON(e), this.aX = e.aX, this.aY = e.aY, this.xRadius = e.xRadius, this.yRadius = e.yRadius, this.aStartAngle = e.aStartAngle, this.aEndAngle = e.aEndAngle, this.aClockwise = e.aClockwise, this.aRotation = e.aRotation, this; } } xl.prototype.isEllipseCurve = !0; class Df extends xl { constructor(e, t, i, r, s, o) { super(e, t, i, i, r, s, o), this.type = "ArcCurve"; } } Df.prototype.isArcCurve = !0; function Nf() { let n = 0, e = 0, t = 0, i = 0; function r(s, o, a, c) { n = s, e = a, t = -3 * s + 3 * o - 2 * a - c, i = 2 * s - 2 * o + a + c; } return { initCatmullRom: function(s, o, a, c, l) { r(o, a, l * (a - s), l * (c - o)); }, initNonuniformCatmullRom: function(s, o, a, c, l, d, h) { let f = (o - s) / l - (a - s) / (l + d) + (a - o) / d, g = (a - o) / d - (c - o) / (d + h) + (c - a) / h; f *= d, g *= d, r(o, a, f, g); }, calc: function(s) { const o = s * s, a = o * s; return n + e * s + t * o + i * a; } }; } const lc = new q(), xh = new Nf(), Mh = new Nf(), wh = new Nf(); class Bf extends jn { constructor(e = [], t = !1, i = "centripetal", r = 0.5) { super(), this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = i, this.tension = r; } getPoint(e, t = new q()) { const i = t, r = this.points, s = r.length, o = (s - (this.closed ? 0 : 1)) * e; let a = Math.floor(o), c = o - a; this.closed ? a += a > 0 ? 0 : (Math.floor(Math.abs(a) / s) + 1) * s : c === 0 && a === s - 1 && (a = s - 2, c = 1); let l, d; this.closed || a > 0 ? l = r[(a - 1) % s] : (lc.subVectors(r[0], r[1]).add(r[0]), l = lc); const h = r[a % s], f = r[(a + 1) % s]; if (this.closed || a + 2 < s ? d = r[(a + 2) % s] : (lc.subVectors(r[s - 1], r[s - 2]).add(r[s - 1]), d = lc), this.curveType === "centripetal" || this.curveType === "chordal") { const g = this.curveType === "chordal" ? 0.5 : 0.25; let p = Math.pow(l.distanceToSquared(h), g), u = Math.pow(h.distanceToSquared(f), g), y = Math.pow(f.distanceToSquared(d), g); u < 1e-4 && (u = 1), p < 1e-4 && (p = u), y < 1e-4 && (y = u), xh.initNonuniformCatmullRom(l.x, h.x, f.x, d.x, p, u, y), Mh.initNonuniformCatmullRom(l.y, h.y, f.y, d.y, p, u, y), wh.initNonuniformCatmullRom(l.z, h.z, f.z, d.z, p, u, y); } else this.curveType === "catmullrom" && (xh.initCatmullRom(l.x, h.x, f.x, d.x, this.tension), Mh.initCatmullRom(l.y, h.y, f.y, d.y, this.tension), wh.initCatmullRom(l.z, h.z, f.z, d.z, this.tension)); return i.set( xh.calc(c), Mh.calc(c), wh.calc(c) ), i; } copy(e) { super.copy(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(r.clone()); } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; } toJSON() { const e = super.toJSON(); e.points = []; for (let t = 0, i = this.points.length; t < i; t++) { const r = this.points[t]; e.points.push(r.toArray()); } return e.closed = this.closed, e.curveType = this.curveType, e.tension = this.tension, e; } fromJSON(e) { super.fromJSON(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(new q().fromArray(r)); } return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this; } } Bf.prototype.isCatmullRomCurve3 = !0; function Dg(n, e, t, i, r) { const s = (i - e) * 0.5, o = (r - t) * 0.5, a = n * n, c = n * a; return (2 * t - 2 * i + s + o) * c + (-3 * t + 3 * i - 2 * s - o) * a + s * n + t; } function ID(n, e) { const t = 1 - n; return t * t * e; } function OD(n, e) { return 2 * (1 - n) * n * e; } function DD(n, e) { return n * n * e; } function Pa(n, e, t, i) { return ID(n, e) + OD(n, t) + DD(n, i); } function ND(n, e) { const t = 1 - n; return t * t * t * e; } function BD(n, e) { const t = 1 - n; return 3 * t * t * n * e; } function UD(n, e) { return 3 * (1 - n) * n * n * e; } function zD(n, e) { return n * n * n * e; } function Ia(n, e, t, i, r) { return ND(n, e) + BD(n, t) + UD(n, i) + zD(n, r); } class Su extends jn { constructor(e = new Re(), t = new Re(), i = new Re(), r = new Re()) { super(), this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r; } getPoint(e, t = new Re()) { const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3; return i.set( Ia(e, r.x, s.x, o.x, a.x), Ia(e, r.y, s.y, o.y, a.y) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; } } Su.prototype.isCubicBezierCurve = !0; class Uf extends jn { constructor(e = new q(), t = new q(), i = new q(), r = new q()) { super(), this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i, this.v3 = r; } getPoint(e, t = new q()) { const i = t, r = this.v0, s = this.v1, o = this.v2, a = this.v3; return i.set( Ia(e, r.x, s.x, o.x, a.x), Ia(e, r.y, s.y, o.y, a.y), Ia(e, r.z, s.z, o.z, a.z) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this.v3.copy(e.v3), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e.v3 = this.v3.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this.v3.fromArray(e.v3), this; } } Uf.prototype.isCubicBezierCurve3 = !0; class Ml extends jn { constructor(e = new Re(), t = new Re()) { super(), this.type = "LineCurve", this.v1 = e, this.v2 = t; } getPoint(e, t = new Re()) { const i = t; return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i; } // Line curve is linear, so we can overwrite default getPointAt getPointAt(e, t) { return this.getPoint(e, t); } getTangent(e, t) { const i = t || new Re(); return i.copy(this.v2).sub(this.v1).normalize(), i; } copy(e) { return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } Ml.prototype.isLineCurve = !0; class Cx extends jn { constructor(e = new q(), t = new q()) { super(), this.type = "LineCurve3", this.isLineCurve3 = !0, this.v1 = e, this.v2 = t; } getPoint(e, t = new q()) { const i = t; return e === 1 ? i.copy(this.v2) : (i.copy(this.v2).sub(this.v1), i.multiplyScalar(e).add(this.v1)), i; } // Line curve is linear, so we can overwrite default getPointAt getPointAt(e, t) { return this.getPoint(e, t); } copy(e) { return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } class _u extends jn { constructor(e = new Re(), t = new Re(), i = new Re()) { super(), this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = i; } getPoint(e, t = new Re()) { const i = t, r = this.v0, s = this.v1, o = this.v2; return i.set( Pa(e, r.x, s.x, o.x), Pa(e, r.y, s.y, o.y) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } _u.prototype.isQuadraticBezierCurve = !0; class zf extends jn { constructor(e = new q(), t = new q(), i = new q()) { super(), this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = i; } getPoint(e, t = new q()) { const i = t, r = this.v0, s = this.v1, o = this.v2; return i.set( Pa(e, r.x, s.x, o.x), Pa(e, r.y, s.y, o.y), Pa(e, r.z, s.z, o.z) ), i; } copy(e) { return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this; } toJSON() { const e = super.toJSON(); return e.v0 = this.v0.toArray(), e.v1 = this.v1.toArray(), e.v2 = this.v2.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.v0.fromArray(e.v0), this.v1.fromArray(e.v1), this.v2.fromArray(e.v2), this; } } zf.prototype.isQuadraticBezierCurve3 = !0; class Tu extends jn { constructor(e = []) { super(), this.type = "SplineCurve", this.points = e; } getPoint(e, t = new Re()) { const i = t, r = this.points, s = (r.length - 1) * e, o = Math.floor(s), a = s - o, c = r[o === 0 ? o : o - 1], l = r[o], d = r[o > r.length - 2 ? r.length - 1 : o + 1], h = r[o > r.length - 3 ? r.length - 1 : o + 2]; return i.set( Dg(a, c.x, l.x, d.x, h.x), Dg(a, c.y, l.y, d.y, h.y) ), i; } copy(e) { super.copy(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(r.clone()); } return this; } toJSON() { const e = super.toJSON(); e.points = []; for (let t = 0, i = this.points.length; t < i; t++) { const r = this.points[t]; e.points.push(r.toArray()); } return e; } fromJSON(e) { super.fromJSON(e), this.points = []; for (let t = 0, i = e.points.length; t < i; t++) { const r = e.points[t]; this.points.push(new Re().fromArray(r)); } return this; } } Tu.prototype.isSplineCurve = !0; var Vf = /* @__PURE__ */ Object.freeze({ __proto__: null, ArcCurve: Df, CatmullRomCurve3: Bf, CubicBezierCurve: Su, CubicBezierCurve3: Uf, EllipseCurve: xl, LineCurve: Ml, LineCurve3: Cx, QuadraticBezierCurve: _u, QuadraticBezierCurve3: zf, SplineCurve: Tu }); const VD = { triangulate: function(n, e, t = 2) { const i = e && e.length, r = i ? e[0] * t : n.length; let s = Lx(n, 0, r, t, !0); const o = []; if (!s || s.next === s.prev) return o; let a, c, l, d, h, f, g; if (i && (s = jD(n, e, s, t)), n.length > 80 * t) { a = l = n[0], c = d = n[1]; for (let p = t; p < r; p += t) h = n[p], f = n[p + 1], h < a && (a = h), f < c && (c = f), h > l && (l = h), f > d && (d = f); g = Math.max(l - a, d - c), g = g !== 0 ? 1 / g : 0; } return $a(s, o, t, a, c, g), o; } }; function Lx(n, e, t, i, r) { let s, o; if (r === nN(n, e, t, i) > 0) for (s = e; s < t; s += i) o = Ng(s, n[s], n[s + 1], o); else for (s = t - i; s >= e; s -= i) o = Ng(s, n[s], n[s + 1], o); return o && Eu(o, o.next) && (Xa(o), o = o.next), o; } function Zr(n, e) { if (!n) return n; e || (e = n); let t = n, i; do if (i = !1, !t.steiner && (Eu(t, t.next) || Ot(t.prev, t, t.next) === 0)) { if (Xa(t), t = e = t.prev, t === t.next) break; i = !0; } else t = t.next; while (i || t !== e); return e; } function $a(n, e, t, i, r, s, o) { if (!n) return; !o && s && JD(n, i, r, s); let a = n, c, l; for (; n.prev !== n.next; ) { if (c = n.prev, l = n.next, s ? GD(n, i, r, s) : kD(n)) { e.push(c.i / t), e.push(n.i / t), e.push(l.i / t), Xa(n), n = l.next, a = l.next; continue; } if (n = l, n === a) { o ? o === 1 ? (n = HD(Zr(n), e, t), $a(n, e, t, i, r, s, 2)) : o === 2 && WD(n, e, t, i, r, s) : $a(Zr(n), e, t, i, r, s, 1); break; } } } function kD(n) { const e = n.prev, t = n, i = n.next; if (Ot(e, t, i) >= 0) return !1; let r = n.next.next; for (; r !== n.prev; ) { if (go(e.x, e.y, t.x, t.y, i.x, i.y, r.x, r.y) && Ot(r.prev, r, r.next) >= 0) return !1; r = r.next; } return !0; } function GD(n, e, t, i) { const r = n.prev, s = n, o = n.next; if (Ot(r, s, o) >= 0) return !1; const a = r.x < s.x ? r.x < o.x ? r.x : o.x : s.x < o.x ? s.x : o.x, c = r.y < s.y ? r.y < o.y ? r.y : o.y : s.y < o.y ? s.y : o.y, l = r.x > s.x ? r.x > o.x ? r.x : o.x : s.x > o.x ? s.x : o.x, d = r.y > s.y ? r.y > o.y ? r.y : o.y : s.y > o.y ? s.y : o.y, h = Ad(a, c, e, t, i), f = Ad(l, d, e, t, i); let g = n.prevZ, p = n.nextZ; for (; g && g.z >= h && p && p.z <= f; ) { if (g !== n.prev && g !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && Ot(g.prev, g, g.next) >= 0 || (g = g.prevZ, p !== n.prev && p !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && Ot(p.prev, p, p.next) >= 0)) return !1; p = p.nextZ; } for (; g && g.z >= h; ) { if (g !== n.prev && g !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, g.x, g.y) && Ot(g.prev, g, g.next) >= 0) return !1; g = g.prevZ; } for (; p && p.z <= f; ) { if (p !== n.prev && p !== n.next && go(r.x, r.y, s.x, s.y, o.x, o.y, p.x, p.y) && Ot(p.prev, p, p.next) >= 0) return !1; p = p.nextZ; } return !0; } function HD(n, e, t) { let i = n; do { const r = i.prev, s = i.next.next; !Eu(r, s) && Rx(r, i, i.next, s) && Za(r, s) && Za(s, r) && (e.push(r.i / t), e.push(i.i / t), e.push(s.i / t), Xa(i), Xa(i.next), i = n = s), i = i.next; } while (i !== n); return Zr(i); } function WD(n, e, t, i, r, s) { let o = n; do { let a = o.next.next; for (; a !== o.prev; ) { if (o.i !== a.i && QD(o, a)) { let c = Fx(o, a); o = Zr(o, o.next), c = Zr(c, c.next), $a(o, e, t, i, r, s), $a(c, e, t, i, r, s); return; } a = a.next; } o = o.next; } while (o !== n); } function jD(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 = Lx(n, a, c, i, !1), l === l.next && (l.steiner = !0), r.push(qD(l)); for (r.sort($D), s = 0; s < r.length; s++) ZD(r[s], t), t = Zr(t, t.next); return t; } function $D(n, e) { return n.x - e.x; } function ZD(n, e) { if (e = XD(n, e), e) { const t = Fx(e, n); Zr(e, e.next), Zr(t, t.next); } } function XD(n, e) { let t = e; const i = n.x, r = n.y; let s = -1 / 0, o; do { if (r <= t.y && r >= t.next.y && t.next.y !== t.y) { const f = t.x + (r - t.y) * (t.next.x - t.x) / (t.next.y - t.y); if (f <= i && f > s) { if (s = f, f === i) { if (r === t.y) return t; if (r === t.next.y) return t.next; } o = t.x < t.next.x ? t : t.next; } } t = t.next; } while (t !== e); if (!o) return null; if (i === s) return o; const a = o, c = o.x, l = o.y; let d = 1 / 0, h; t = o; do i >= t.x && t.x >= c && i !== t.x && go(r < l ? i : s, r, c, l, r < l ? s : i, r, t.x, t.y) && (h = Math.abs(r - t.y) / (i - t.x), Za(t, n) && (h < d || h === d && (t.x > o.x || t.x === o.x && YD(o, t))) && (o = t, d = h)), t = t.next; while (t !== a); return o; } function YD(n, e) { return Ot(n.prev, n, e.prev) < 0 && Ot(e.next, n, n.next) < 0; } function JD(n, e, t, i) { let r = n; do r.z === null && (r.z = Ad(r.x, r.y, e, t, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; while (r !== n); r.prevZ.nextZ = null, r.prevZ = null, KD(r); } function KD(n) { let e, t, i, r, s, o, a, c, l = 1; do { for (t = n, n = null, s = null, o = 0; t; ) { for (o++, i = t, a = 0, e = 0; e < l && (a++, i = i.nextZ, !!i); e++) ; for (c = l; a > 0 || c > 0 && i; ) a !== 0 && (c === 0 || !i || t.z <= i.z) ? (r = t, t = t.nextZ, a--) : (r = i, i = i.nextZ, c--), s ? s.nextZ = r : n = r, r.prevZ = s, s = r; t = i; } s.nextZ = null, l *= 2; } while (o > 1); return n; } function Ad(n, e, t, i, r) { return n = 32767 * (n - t) * r, e = 32767 * (e - i) * r, n = (n | n << 8) & 16711935, n = (n | n << 4) & 252645135, n = (n | n << 2) & 858993459, n = (n | n << 1) & 1431655765, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, n | e << 1; } function qD(n) { let e = n, t = n; do (e.x < t.x || e.x === t.x && e.y < t.y) && (t = e), e = e.next; while (e !== n); return t; } function go(n, e, t, i, r, s, o, a) { return (r - o) * (e - a) - (n - o) * (s - a) >= 0 && (n - o) * (i - a) - (t - o) * (e - a) >= 0 && (t - o) * (s - a) - (r - o) * (i - a) >= 0; } function QD(n, e) { return n.next.i !== e.i && n.prev.i !== e.i && !eN(n, e) && // dones't intersect other edges (Za(n, e) && Za(e, n) && tN(n, e) && // locally visible (Ot(n.prev, n, e.prev) || Ot(n, e.prev, e)) || // does not create opposite-facing sectors Eu(n, e) && Ot(n.prev, n, n.next) > 0 && Ot(e.prev, e, e.next) > 0); } function Ot(n, e, t) { return (e.y - n.y) * (t.x - e.x) - (e.x - n.x) * (t.y - e.y); } function Eu(n, e) { return n.x === e.x && n.y === e.y; } function Rx(n, e, t, i) { const r = uc(Ot(n, e, t)), s = uc(Ot(n, e, i)), o = uc(Ot(t, i, n)), a = uc(Ot(t, i, e)); return !!(r !== s && o !== a || r === 0 && cc(n, t, e) || s === 0 && cc(n, i, e) || o === 0 && cc(t, n, i) || a === 0 && cc(t, e, i)); } function cc(n, e, t) { return e.x <= Math.max(n.x, t.x) && e.x >= Math.min(n.x, t.x) && e.y <= Math.max(n.y, t.y) && e.y >= Math.min(n.y, t.y); } function uc(n) { return n > 0 ? 1 : n < 0 ? -1 : 0; } function eN(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 && Rx(t, t.next, n, e)) return !0; t = t.next; } while (t !== n); return !1; } function Za(n, e) { return Ot(n.prev, n, n.next) < 0 ? Ot(n, e, n.next) >= 0 && Ot(n, n.prev, e) >= 0 : Ot(n, e, n.prev) < 0 || Ot(n, n.next, e) < 0; } function tN(n, e) { let t = n, i = !1; const r = (n.x + e.x) / 2, s = (n.y + e.y) / 2; do t.y > s != t.next.y > s && t.next.y !== t.y && r < (t.next.x - t.x) * (s - t.y) / (t.next.y - t.y) + t.x && (i = !i), t = t.next; while (t !== n); return i; } function Fx(n, e) { const t = new Sd(n.i, n.x, n.y), i = new Sd(e.i, e.x, e.y), r = n.next, s = e.prev; return n.next = e, e.prev = n, t.next = r, r.prev = t, i.next = t, t.prev = i, s.next = i, i.prev = s, i; } function Ng(n, e, t, i) { const r = new Sd(n, e, t); return i ? (r.next = i.next, r.prev = i, i.next.prev = r, i.next = r) : (r.prev = r, r.next = r), r; } function Xa(n) { n.next.prev = n.prev, n.prev.next = n.next, n.prevZ && (n.prevZ.nextZ = n.nextZ), n.nextZ && (n.nextZ.prevZ = n.prevZ); } function Sd(n, e, t) { this.i = n, this.x = e, this.y = t, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1; } function nN(n, e, t, i) { let r = 0; for (let s = e, o = t - i; s < t; s += i) r += (n[o] - n[s]) * (n[s + 1] + n[o + 1]), o = s; return r; } class Fi { // calculate area of the contour polygon static area(e) { const t = e.length; let i = 0; for (let r = t - 1, s = 0; s < t; r = s++) i += e[r].x * e[s].y - e[s].x * e[r].y; return i * 0.5; } static isClockWise(e) { return Fi.area(e) < 0; } static triangulateShape(e, t) { const i = [], r = [], s = []; Bg(e), Ug(i, e); let o = e.length; t.forEach(Bg); for (let c = 0; c < t.length; c++) r.push(o), o += t[c].length, Ug(i, t[c]); const a = VD.triangulate(i, r); for (let c = 0; c < a.length; c += 3) s.push(a.slice(c, c + 3)); return s; } } function Bg(n) { const e = n.length; e > 2 && n[e - 1].equals(n[0]) && n.pop(); } function Ug(n, e) { for (let t = 0; t < e.length; t++) n.push(e[t].x), n.push(e[t].y); } class mi extends Ke { constructor(e, t) { super(), this.type = "ExtrudeGeometry", this.parameters = { shapes: e, options: t }, e = Array.isArray(e) ? e : [e]; const i = this, r = [], s = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; o(l); } this.setAttribute("position", new He(r, 3)), this.setAttribute("uv", new He(s, 2)), this.computeVertexNormals(); function o(a) { const c = [], l = t.curveSegments !== void 0 ? t.curveSegments : 12, d = t.steps !== void 0 ? t.steps : 1; let h = t.depth !== void 0 ? t.depth : 100, f = t.bevelEnabled !== void 0 ? t.bevelEnabled : !0, g = t.bevelThickness !== void 0 ? t.bevelThickness : 6, p = t.bevelSize !== void 0 ? t.bevelSize : g - 2, u = t.bevelOffset !== void 0 ? t.bevelOffset : 0, y = t.bevelSegments !== void 0 ? t.bevelSegments : 3; const v = t.extrudePath, m = t.UVGenerator !== void 0 ? t.UVGenerator : iN; t.amount !== void 0 && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), h = t.amount); let x, w = !1, A, M, R, L; v && (x = v.getSpacedPoints(d), w = !0, f = !1, A = v.computeFrenetFrames(d, !1), M = new q(), R = new q(), L = new q()), f || (y = 0, g = 0, p = 0, u = 0); const S = a.extractPoints(l); let I = S.shape; const T = S.holes; if (!Fi.isClockWise(I)) { I = I.reverse(); for (let V = 0, H = T.length; V < H; V++) { const K = T[V]; Fi.isClockWise(K) && (T[V] = K.reverse()); } } const E = Fi.triangulateShape(I, T), C = I; for (let V = 0, H = T.length; V < H; V++) { const K = T[V]; I = I.concat(K); } function P(V, H, K) { return H || console.error("THREE.ExtrudeGeometry: vec does not exist"), H.clone().multiplyScalar(K).add(V); } const b = I.length, F = E.length; function D(V, H, K) { let ce, se, k; const O = V.x - H.x, Z = V.y - H.y, X = K.x - V.x, ee = K.y - V.y, fe = O * O + Z * Z, be = O * ee - Z * X; if (Math.abs(be) > Number.EPSILON) { const Ae = Math.sqrt(fe), he = Math.sqrt(X * X + ee * ee), xe = H.x - Z / Ae, ne = H.y + O / Ae, me = K.x - ee / he, Me = K.y + X / he, De = ((me - xe) * ee - (Me - ne) * X) / (O * ee - Z * X); ce = xe + O * De - V.x, se = ne + Z * De - V.y; const Ie = ce * ce + se * se; if (Ie <= 2) return new Re(ce, se); k = Math.sqrt(Ie / 2); } else { let Ae = !1; O > Number.EPSILON ? X > Number.EPSILON && (Ae = !0) : O < -Number.EPSILON ? X < -Number.EPSILON && (Ae = !0) : Math.sign(Z) === Math.sign(ee) && (Ae = !0), Ae ? (ce = -Z, se = O, k = Math.sqrt(fe)) : (ce = O, se = Z, k = Math.sqrt(fe / 2)); } return new Re(ce / k, se / k); } const N = []; for (let V = 0, H = C.length, K = H - 1, ce = V + 1; V < H; V++, K++, ce++) K === H && (K = 0), ce === H && (ce = 0), N[V] = D(C[V], C[K], C[ce]); const B = []; let U, G = N.concat(); for (let V = 0, H = T.length; V < H; V++) { const K = T[V]; U = []; for (let ce = 0, se = K.length, k = se - 1, O = ce + 1; ce < se; ce++, k++, O++) k === se && (k = 0), O === se && (O = 0), U[ce] = D(K[ce], K[k], K[O]); B.push(U), G = G.concat(U); } for (let V = 0; V < y; V++) { const H = V / y, K = g * Math.cos(H * Math.PI / 2), ce = p * Math.sin(H * Math.PI / 2) + u; for (let se = 0, k = C.length; se < k; se++) { const O = P(C[se], N[se], ce); le(O.x, O.y, -K); } for (let se = 0, k = T.length; se < k; se++) { const O = T[se]; U = B[se]; for (let Z = 0, X = O.length; Z < X; Z++) { const ee = P(O[Z], U[Z], ce); le(ee.x, ee.y, -K); } } } const Y = p + u; for (let V = 0; V < b; V++) { const H = f ? P(I[V], G[V], Y) : I[V]; w ? (R.copy(A.normals[0]).multiplyScalar(H.x), M.copy(A.binormals[0]).multiplyScalar(H.y), L.copy(x[0]).add(R).add(M), le(L.x, L.y, L.z)) : le(H.x, H.y, 0); } for (let V = 1; V <= d; V++) for (let H = 0; H < b; H++) { const K = f ? P(I[H], G[H], Y) : I[H]; w ? (R.copy(A.normals[V]).multiplyScalar(K.x), M.copy(A.binormals[V]).multiplyScalar(K.y), L.copy(x[V]).add(R).add(M), le(L.x, L.y, L.z)) : le(K.x, K.y, h / d * V); } for (let V = y - 1; V >= 0; V--) { const H = V / y, K = g * Math.cos(H * Math.PI / 2), ce = p * Math.sin(H * Math.PI / 2) + u; for (let se = 0, k = C.length; se < k; se++) { const O = P(C[se], N[se], ce); le(O.x, O.y, h + K); } for (let se = 0, k = T.length; se < k; se++) { const O = T[se]; U = B[se]; for (let Z = 0, X = O.length; Z < X; Z++) { const ee = P(O[Z], U[Z], ce); w ? le(ee.x, ee.y + x[d - 1].y, x[d - 1].x + K) : le(ee.x, ee.y, h + K); } } } te(), ae(); function te() { const V = r.length / 3; if (f) { let H = 0, K = b * H; for (let ce = 0; ce < F; ce++) { const se = E[ce]; W(se[2] + K, se[1] + K, se[0] + K); } H = d + y * 2, K = b * H; for (let ce = 0; ce < F; ce++) { const se = E[ce]; W(se[0] + K, se[1] + K, se[2] + K); } } else { for (let H = 0; H < F; H++) { const K = E[H]; W(K[2], K[1], K[0]); } for (let H = 0; H < F; H++) { const K = E[H]; W(K[0] + b * d, K[1] + b * d, K[2] + b * d); } } i.addGroup(V, r.length / 3 - V, 0); } function ae() { const V = r.length / 3; let H = 0; ie(C, H), H += C.length; for (let K = 0, ce = T.length; K < ce; K++) { const se = T[K]; ie(se, H), H += se.length; } i.addGroup(V, r.length / 3 - V, 1); } function ie(V, H) { let K = V.length; for (; --K >= 0; ) { const ce = K; let se = K - 1; se < 0 && (se = V.length - 1); for (let k = 0, O = d + y * 2; k < O; k++) { const Z = b * k, X = b * (k + 1), ee = H + ce + Z, fe = H + se + Z, be = H + se + X, Ae = H + ce + X; $(ee, fe, be, Ae); } } } function le(V, H, K) { c.push(V), c.push(H), c.push(K); } function W(V, H, K) { j(V), j(H), j(K); const ce = r.length / 3, se = m.generateTopUV(i, r, ce - 3, ce - 2, ce - 1); re(se[0]), re(se[1]), re(se[2]); } function $(V, H, K, ce) { j(V), j(H), j(ce), j(H), j(K), j(ce); const se = r.length / 3, k = m.generateSideWallUV(i, r, se - 6, se - 3, se - 2, se - 1); re(k[0]), re(k[1]), re(k[3]), re(k[1]), re(k[2]), re(k[3]); } function j(V) { r.push(c[V * 3 + 0]), r.push(c[V * 3 + 1]), r.push(c[V * 3 + 2]); } function re(V) { s.push(V.x), s.push(V.y); } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes, i = this.parameters.options; return rN(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 Vf[r.type]().fromJSON(r)), new mi(i, e.options); } } const iN = { generateTopUV: function(n, e, t, i, r) { const s = e[t * 3], o = e[t * 3 + 1], a = e[i * 3], c = e[i * 3 + 1], l = e[r * 3], d = e[r * 3 + 1]; return [ new Re(s, o), new Re(a, c), new Re(l, d) ]; }, generateSideWallUV: function(n, e, t, i, r, s) { const o = e[t * 3], a = e[t * 3 + 1], c = e[t * 3 + 2], l = e[i * 3], d = e[i * 3 + 1], h = e[i * 3 + 2], f = e[r * 3], g = e[r * 3 + 1], p = e[r * 3 + 2], u = e[s * 3], y = e[s * 3 + 1], v = e[s * 3 + 2]; return Math.abs(a - d) < Math.abs(o - l) ? [ new Re(o, 1 - c), new Re(l, 1 - h), new Re(f, 1 - p), new Re(u, 1 - v) ] : [ new Re(a, 1 - c), new Re(d, 1 - h), new Re(g, 1 - p), new Re(y, 1 - v) ]; } }; function rN(n, e, t) { if (t.shapes = [], Array.isArray(n)) for (let i = 0, r = n.length; i < r; i++) { const s = n[i]; t.shapes.push(s.uuid); } else t.shapes.push(n.uuid); return e.extrudePath !== void 0 && (t.options.extrudePath = e.extrudePath.toJSON()), t; } class No extends Di { constructor(e = 1, t = 0) { const i = (1 + Math.sqrt(5)) / 2, r = [ -1, i, 0, 1, i, 0, -1, -i, 0, 1, -i, 0, 0, -1, i, 0, 1, i, 0, -1, -i, 0, 1, -i, i, 0, -1, i, 0, 1, -i, 0, -1, -i, 0, 1 ], s = [ 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1 ]; super(r, s, e, t), this.type = "IcosahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new No(e.radius, e.detail); } } class Bo extends Ke { constructor(e, t = 12, i = 0, r = Math.PI * 2) { super(), this.type = "LatheGeometry", this.parameters = { points: e, segments: t, phiStart: i, phiLength: r }, t = Math.floor(t), r = gn(r, 0, Math.PI * 2); const s = [], o = [], a = [], c = 1 / t, l = new q(), d = new Re(); for (let h = 0; h <= t; h++) { const f = i + h * c * r, g = Math.sin(f), p = Math.cos(f); for (let u = 0; u <= e.length - 1; u++) l.x = e[u].x * g, l.y = e[u].y, l.z = e[u].x * p, o.push(l.x, l.y, l.z), d.x = h / t, d.y = u / (e.length - 1), a.push(d.x, d.y); } for (let h = 0; h < t; h++) for (let f = 0; f < e.length - 1; f++) { const g = f + h * e.length, p = g, u = g + e.length, y = g + e.length + 1, v = g + 1; s.push(p, u, v), s.push(u, y, v); } if (this.setIndex(s), this.setAttribute("position", new He(o, 3)), this.setAttribute("uv", new He(a, 2)), this.computeVertexNormals(), r === Math.PI * 2) { const h = this.attributes.normal.array, f = new q(), g = new q(), p = new q(), u = t * e.length * 3; for (let y = 0, v = 0; y < e.length; y++, v += 3) f.x = h[v + 0], f.y = h[v + 1], f.z = h[v + 2], g.x = h[u + v + 0], g.y = h[u + v + 1], g.z = h[u + v + 2], p.addVectors(f, g).normalize(), h[v + 0] = h[u + v + 0] = p.x, h[v + 1] = h[u + v + 1] = p.y, h[v + 2] = h[u + v + 2] = p.z; } } static fromJSON(e) { return new Bo(e.points, e.segments, e.phiStart, e.phiLength); } } class Rs extends Di { constructor(e = 1, t = 0) { const i = [ 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1 ], r = [ 0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2 ]; super(i, r, e, t), this.type = "OctahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new Rs(e.radius, e.detail); } } class Hc extends Ke { constructor(e, t, i) { super(), this.type = "ParametricGeometry", this.parameters = { func: e, slices: t, stacks: i }; const r = [], s = [], o = [], a = [], c = 1e-5, l = new q(), d = new q(), h = new q(), f = new q(), g = new q(); e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); const p = t + 1; for (let u = 0; u <= i; u++) { const y = u / i; for (let v = 0; v <= t; v++) { const m = v / t; e(m, y, d), s.push(d.x, d.y, d.z), m - c >= 0 ? (e(m - c, y, h), f.subVectors(d, h)) : (e(m + c, y, h), f.subVectors(h, d)), y - c >= 0 ? (e(m, y - c, h), g.subVectors(d, h)) : (e(m, y + c, h), g.subVectors(h, d)), l.crossVectors(f, g).normalize(), o.push(l.x, l.y, l.z), a.push(m, y); } } for (let u = 0; u < i; u++) for (let y = 0; y < t; y++) { const v = u * p + y, m = u * p + y + 1, x = (u + 1) * p + y + 1, w = (u + 1) * p + y; r.push(v, m, w), r.push(m, x, w); } this.setIndex(r), this.setAttribute("position", new He(s, 3)), this.setAttribute("normal", new He(o, 3)), this.setAttribute("uv", new He(a, 2)); } } class Uo extends Ke { constructor(e = 0.5, t = 1, i = 8, r = 1, s = 0, o = Math.PI * 2) { super(), this.type = "RingGeometry", this.parameters = { innerRadius: e, outerRadius: t, thetaSegments: i, phiSegments: r, thetaStart: s, thetaLength: o }, i = Math.max(3, i), r = Math.max(1, r); const a = [], c = [], l = [], d = []; let h = e; const f = (t - e) / r, g = new q(), p = new Re(); for (let u = 0; u <= r; u++) { for (let y = 0; y <= i; y++) { const v = s + y / i * o; g.x = h * Math.cos(v), g.y = h * Math.sin(v), c.push(g.x, g.y, g.z), l.push(0, 0, 1), p.x = (g.x / t + 1) / 2, p.y = (g.y / t + 1) / 2, d.push(p.x, p.y); } h += f; } for (let u = 0; u < r; u++) { const y = u * (i + 1); for (let v = 0; v < i; v++) { const m = v + y, x = m, w = m + i + 1, A = m + i + 2, M = m + 1; a.push(x, w, M), a.push(w, A, M); } } this.setIndex(a), this.setAttribute("position", new He(c, 3)), this.setAttribute("normal", new He(l, 3)), this.setAttribute("uv", new He(d, 2)); } static fromJSON(e) { return new Uo(e.innerRadius, e.outerRadius, e.thetaSegments, e.phiSegments, e.thetaStart, e.thetaLength); } } class Fs extends Ke { constructor(e, t = 12) { super(), this.type = "ShapeGeometry", this.parameters = { shapes: e, curveSegments: t }; const i = [], r = [], s = [], o = []; let a = 0, c = 0; if (Array.isArray(e) === !1) l(e); else for (let d = 0; d < e.length; d++) l(e[d]), this.addGroup(a, c, d), a += c, c = 0; this.setIndex(i), this.setAttribute("position", new He(r, 3)), this.setAttribute("normal", new He(s, 3)), this.setAttribute("uv", new He(o, 2)); function l(d) { const h = r.length / 3, f = d.extractPoints(t); let g = f.shape; const p = f.holes; Fi.isClockWise(g) === !1 && (g = g.reverse()); for (let y = 0, v = p.length; y < v; y++) { const m = p[y]; Fi.isClockWise(m) === !0 && (p[y] = m.reverse()); } const u = Fi.triangulateShape(g, p); for (let y = 0, v = p.length; y < v; y++) { const m = p[y]; g = g.concat(m); } for (let y = 0, v = g.length; y < v; y++) { const m = g[y]; r.push(m.x, m.y, 0), s.push(0, 0, 1), o.push(m.x, m.y); } for (let y = 0, v = u.length; y < v; y++) { const m = u[y], x = m[0] + h, w = m[1] + h, A = m[2] + h; i.push(x, w, A), c += 3; } } } toJSON() { const e = super.toJSON(), t = this.parameters.shapes; return sN(t, e); } static fromJSON(e, t) { const i = []; for (let r = 0, s = e.shapes.length; r < s; r++) { const o = t[e.shapes[r]]; i.push(o); } return new Fs(i, e.curveSegments); } } function sN(n, e) { if (e.shapes = [], Array.isArray(n)) for (let t = 0, i = n.length; t < i; t++) { const r = n[t]; e.shapes.push(r.uuid); } else e.shapes.push(n.uuid); return e; } class Ps extends Ke { constructor(e = 1, t = 8, i = 6, r = 0, s = Math.PI * 2, o = 0, a = Math.PI) { super(), this.type = "SphereGeometry", this.parameters = { radius: e, widthSegments: t, heightSegments: i, phiStart: r, phiLength: s, thetaStart: o, thetaLength: a }, t = Math.max(3, Math.floor(t)), i = Math.max(2, Math.floor(i)); const c = Math.min(o + a, Math.PI); let l = 0; const d = [], h = new q(), f = new q(), g = [], p = [], u = [], y = []; for (let v = 0; v <= i; v++) { const m = [], x = v / i; let w = 0; v == 0 && o == 0 ? w = 0.5 / t : v == i && c == Math.PI && (w = -0.5 / t); for (let A = 0; A <= t; A++) { const M = A / t; h.x = -e * Math.cos(r + M * s) * Math.sin(o + x * a), h.y = e * Math.cos(o + x * a), h.z = e * Math.sin(r + M * s) * Math.sin(o + x * a), p.push(h.x, h.y, h.z), f.copy(h).normalize(), u.push(f.x, f.y, f.z), y.push(M + w, 1 - x), m.push(l++); } d.push(m); } for (let v = 0; v < i; v++) for (let m = 0; m < t; m++) { const x = d[v][m + 1], w = d[v][m], A = d[v + 1][m], M = d[v + 1][m + 1]; (v !== 0 || o > 0) && g.push(x, w, M), (v !== i - 1 || c < Math.PI) && g.push(w, A, M); } this.setIndex(g), this.setAttribute("position", new He(p, 3)), this.setAttribute("normal", new He(u, 3)), this.setAttribute("uv", new He(y, 2)); } static fromJSON(e) { return new Ps(e.radius, e.widthSegments, e.heightSegments, e.phiStart, e.phiLength, e.thetaStart, e.thetaLength); } } class zo extends Di { constructor(e = 1, t = 0) { const i = [ 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1 ], r = [ 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1 ]; super(i, r, e, t), this.type = "TetrahedronGeometry", this.parameters = { radius: e, detail: t }; } static fromJSON(e) { return new zo(e.radius, e.detail); } } class Wc extends mi { constructor(e, t = {}) { const i = t.font; if (!(i && i.isFont)) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new Ke(); const r = i.generateShapes(e, t.size); t.depth = t.height !== void 0 ? t.height : 50, t.bevelThickness === void 0 && (t.bevelThickness = 10), t.bevelSize === void 0 && (t.bevelSize = 8), t.bevelEnabled === void 0 && (t.bevelEnabled = !1), super(r, t), this.type = "TextGeometry"; } } class Vo extends Ke { constructor(e = 1, t = 0.4, i = 8, r = 6, s = Math.PI * 2) { super(), this.type = "TorusGeometry", this.parameters = { radius: e, tube: t, radialSegments: i, tubularSegments: r, arc: s }, i = Math.floor(i), r = Math.floor(r); const o = [], a = [], c = [], l = [], d = new q(), h = new q(), f = new q(); for (let g = 0; g <= i; g++) for (let p = 0; p <= r; p++) { const u = p / r * s, y = g / i * Math.PI * 2; h.x = (e + t * Math.cos(y)) * Math.cos(u), h.y = (e + t * Math.cos(y)) * Math.sin(u), h.z = t * Math.sin(y), a.push(h.x, h.y, h.z), d.x = e * Math.cos(u), d.y = e * Math.sin(u), f.subVectors(h, d).normalize(), c.push(f.x, f.y, f.z), l.push(p / r), l.push(g / i); } for (let g = 1; g <= i; g++) for (let p = 1; p <= r; p++) { const u = (r + 1) * g + p - 1, y = (r + 1) * (g - 1) + p - 1, v = (r + 1) * (g - 1) + p, m = (r + 1) * g + p; o.push(u, y, m), o.push(y, v, m); } this.setIndex(o), this.setAttribute("position", new He(a, 3)), this.setAttribute("normal", new He(c, 3)), this.setAttribute("uv", new He(l, 2)); } static fromJSON(e) { return new Vo(e.radius, e.tube, e.radialSegments, e.tubularSegments, e.arc); } } class ko extends Ke { constructor(e = 1, t = 0.4, i = 64, r = 8, s = 2, o = 3) { super(), this.type = "TorusKnotGeometry", this.parameters = { radius: e, tube: t, tubularSegments: i, radialSegments: r, p: s, q: o }, i = Math.floor(i), r = Math.floor(r); const a = [], c = [], l = [], d = [], h = new q(), f = new q(), g = new q(), p = new q(), u = new q(), y = new q(), v = new q(); for (let x = 0; x <= i; ++x) { const w = x / i * s * Math.PI * 2; m(w, s, o, e, g), m(w + 0.01, s, o, e, p), y.subVectors(p, g), v.addVectors(p, g), u.crossVectors(y, v), v.crossVectors(u, y), u.normalize(), v.normalize(); for (let A = 0; A <= r; ++A) { const M = A / r * Math.PI * 2, R = -t * Math.cos(M), L = t * Math.sin(M); h.x = g.x + (R * v.x + L * u.x), h.y = g.y + (R * v.y + L * u.y), h.z = g.z + (R * v.z + L * u.z), c.push(h.x, h.y, h.z), f.subVectors(h, g).normalize(), l.push(f.x, f.y, f.z), d.push(x / i), d.push(A / r); } } for (let x = 1; x <= i; x++) for (let w = 1; w <= r; w++) { const A = (r + 1) * (x - 1) + (w - 1), M = (r + 1) * x + (w - 1), R = (r + 1) * x + w, L = (r + 1) * (x - 1) + w; a.push(A, M, L), a.push(M, R, L); } this.setIndex(a), this.setAttribute("position", new He(c, 3)), this.setAttribute("normal", new He(l, 3)), this.setAttribute("uv", new He(d, 2)); function m(x, w, A, M, R) { const L = Math.cos(x), S = Math.sin(x), I = A / w * x, T = Math.cos(I); R.x = M * (2 + T) * 0.5 * L, R.y = M * (2 + T) * S * 0.5, R.z = M * Math.sin(I) * 0.5; } } static fromJSON(e) { return new ko(e.radius, e.tube, e.tubularSegments, e.radialSegments, e.p, e.q); } } class Go extends Ke { constructor(e, t = 64, i = 1, r = 8, s = !1) { super(), this.type = "TubeGeometry", this.parameters = { path: e, tubularSegments: t, radius: i, radialSegments: r, closed: s }; const o = e.computeFrenetFrames(t, s); this.tangents = o.tangents, this.normals = o.normals, this.binormals = o.binormals; const a = new q(), c = new q(), l = new Re(); let d = new q(); const h = [], f = [], g = [], p = []; u(), this.setIndex(p), this.setAttribute("position", new He(h, 3)), this.setAttribute("normal", new He(f, 3)), this.setAttribute("uv", new He(g, 2)); function u() { for (let x = 0; x < t; x++) y(x); y(s === !1 ? t : 0), m(), v(); } function y(x) { d = e.getPointAt(x / t, d); const w = o.normals[x], A = o.binormals[x]; for (let M = 0; M <= r; M++) { const R = M / r * Math.PI * 2, L = Math.sin(R), S = -Math.cos(R); c.x = S * w.x + L * A.x, c.y = S * w.y + L * A.y, c.z = S * w.z + L * A.z, c.normalize(), f.push(c.x, c.y, c.z), a.x = d.x + i * c.x, a.y = d.y + i * c.y, a.z = d.z + i * c.z, h.push(a.x, a.y, a.z); } } function v() { for (let x = 1; x <= t; x++) for (let w = 1; w <= r; w++) { const A = (r + 1) * (x - 1) + (w - 1), M = (r + 1) * x + (w - 1), R = (r + 1) * x + w, L = (r + 1) * (x - 1) + w; p.push(A, M, L), p.push(M, R, L); } } function m() { for (let x = 0; x <= t; x++) for (let w = 0; w <= r; w++) l.x = x / t, l.y = w / r, g.push(l.x, l.y); } } toJSON() { const e = super.toJSON(); return e.path = this.parameters.path.toJSON(), e; } static fromJSON(e) { return new Go( new Vf[e.path.type]().fromJSON(e.path), e.tubularSegments, e.radius, e.radialSegments, e.closed ); } } class kf extends Ke { constructor(e) { if (super(), this.type = "WireframeGeometry", e.isGeometry === !0) { console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); return; } const t = [], i = [0, 0], r = {}, s = new q(); if (e.index !== null) { const o = e.attributes.position, a = e.index; let c = e.groups; c.length === 0 && (c = [{ start: 0, count: a.count, materialIndex: 0 }]); for (let l = 0, d = c.length; l < d; ++l) { const h = c[l], f = h.start, g = h.count; for (let p = f, u = f + g; p < u; p += 3) for (let y = 0; y < 3; y++) { const v = a.getX(p + y), m = a.getX(p + (y + 1) % 3); i[0] = Math.min(v, m), i[1] = Math.max(v, m); const x = i[0] + "," + i[1]; r[x] === void 0 && (r[x] = { index1: i[0], index2: i[1] }); } } for (const l in r) { const d = r[l]; s.fromBufferAttribute(o, d.index1), t.push(s.x, s.y, s.z), s.fromBufferAttribute(o, d.index2), t.push(s.x, s.y, s.z); } } else { const o = e.attributes.position; for (let a = 0, c = o.count / 3; a < c; a++) for (let l = 0; l < 3; l++) { const d = 3 * a + l; s.fromBufferAttribute(o, d), t.push(s.x, s.y, s.z); const h = 3 * a + (l + 1) % 3; s.fromBufferAttribute(o, h), t.push(s.x, s.y, s.z); } } this.setAttribute("position", new He(t, 3)); } } var zg = /* @__PURE__ */ Object.freeze({ __proto__: null, BoxGeometry: sr, BoxBufferGeometry: sr, CircleGeometry: Io, CircleBufferGeometry: Io, ConeGeometry: Oo, ConeBufferGeometry: Oo, CylinderGeometry: $r, CylinderBufferGeometry: $r, DodecahedronGeometry: Do, DodecahedronBufferGeometry: Do, EdgesGeometry: Of, ExtrudeGeometry: mi, ExtrudeBufferGeometry: mi, IcosahedronGeometry: No, IcosahedronBufferGeometry: No, LatheGeometry: Bo, LatheBufferGeometry: Bo, OctahedronGeometry: Rs, OctahedronBufferGeometry: Rs, ParametricGeometry: Hc, ParametricBufferGeometry: Hc, PlaneGeometry: Ls, PlaneBufferGeometry: Ls, PolyhedronGeometry: Di, PolyhedronBufferGeometry: Di, RingGeometry: Uo, RingBufferGeometry: Uo, ShapeGeometry: Fs, ShapeBufferGeometry: Fs, SphereGeometry: Ps, SphereBufferGeometry: Ps, TetrahedronGeometry: zo, TetrahedronBufferGeometry: zo, TextGeometry: Wc, TextBufferGeometry: Wc, TorusGeometry: Vo, TorusBufferGeometry: Vo, TorusKnotGeometry: ko, TorusKnotBufferGeometry: ko, TubeGeometry: Go, TubeBufferGeometry: Go, WireframeGeometry: kf }); class Gf extends tn { constructor(e) { super(), this.type = "ShadowMaterial", this.color = new Ue(0), this.transparent = !0, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this; } } Gf.prototype.isShadowMaterial = !0; class ra extends or { constructor(e) { super(e), this.type = "RawShaderMaterial"; } } ra.prototype.isRawShaderMaterial = !0; class zs extends tn { constructor(e) { super(), this.defines = { STANDARD: "" }, this.type = "MeshStandardMaterial", this.color = new Ue(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapIntensity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.vertexTangents = !1, this.setValues(e); } copy(e) { return super.copy(e), this.defines = { STANDARD: "" }, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapIntensity = e.envMapIntensity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this.vertexTangents = e.vertexTangents, this; } } zs.prototype.isMeshStandardMaterial = !0; class wl extends zs { constructor(e) { super(), this.defines = { STANDARD: "", PHYSICAL: "" }, this.type = "MeshPhysicalMaterial", this.clearcoat = 0, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Re(1, 1), this.clearcoatNormalMap = null, this.reflectivity = 0.5, Object.defineProperty(this, "ior", { get: function() { return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity); }, set: function(t) { this.reflectivity = gn(2.5 * (t - 1) / (t + 1), 0, 1); } }), this.sheen = null, this.transmission = 0, this.transmissionMap = null, this.thickness = 0.01, this.thicknessMap = null, this.attenuationDistance = 0, this.attenuationColor = new Ue(1, 1, 1), this.setValues(e); } copy(e) { return super.copy(e), this.defines = { STANDARD: "", PHYSICAL: "" }, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.reflectivity = e.reflectivity, e.sheen ? this.sheen = (this.sheen || new Ue()).copy(e.sheen) : this.sheen = null, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this; } } wl.prototype.isMeshPhysicalMaterial = !0; class Hf extends tn { constructor(e) { super(), this.type = "MeshPhongMaterial", this.color = new Ue(16777215), this.specular = new Ue(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.specular.copy(e.specular), this.shininess = e.shininess, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } Hf.prototype.isMeshPhongMaterial = !0; class Wf extends tn { constructor(e) { super(), this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new Ue(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.gradientMap = e.gradientMap, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this; } } Wf.prototype.isMeshToonMaterial = !0; class jf extends tn { constructor(e) { super(), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } jf.prototype.isMeshNormalMaterial = !0; class $f extends tn { constructor(e) { super(), this.type = "MeshLambertMaterial", this.color = new Ue(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new Ue(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = al, this.reflectivity = 1, this.refractionRatio = 0.98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.morphTargets = !1, this.morphNormals = !1, this.setValues(e); } copy(e) { return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this; } } $f.prototype.isMeshLambertMaterial = !0; class Zf extends tn { constructor(e) { super(), this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new Ue(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = Jr, this.normalScale = new Re(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.morphTargets = !1, this.morphNormals = !1, this.flatShading = !1, this.setValues(e); } copy(e) { return super.copy(e), this.defines = { MATCAP: "" }, this.color.copy(e.color), this.matcap = e.matcap, this.map = e.map, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.alphaMap = e.alphaMap, this.morphTargets = e.morphTargets, this.morphNormals = e.morphNormals, this.flatShading = e.flatShading, this; } } Zf.prototype.isMeshMatcapMaterial = !0; class Xf extends an { constructor(e) { super(), this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(e); } copy(e) { return super.copy(e), this.scale = e.scale, this.dashSize = e.dashSize, this.gapSize = e.gapSize, this; } } Xf.prototype.isLineDashedMaterial = !0; var oN = /* @__PURE__ */ Object.freeze({ __proto__: null, ShadowMaterial: Gf, SpriteMaterial: ml, RawShaderMaterial: ra, ShaderMaterial: or, PointsMaterial: es, MeshPhysicalMaterial: wl, MeshStandardMaterial: zs, MeshPhongMaterial: Hf, MeshToonMaterial: Wf, MeshNormalMaterial: jf, MeshLambertMaterial: $f, MeshDepthMaterial: xu, MeshDistanceMaterial: Mu, MeshBasicMaterial: In, MeshMatcapMaterial: Zf, LineDashedMaterial: Xf, LineBasicMaterial: an, Material: tn }); const Ct = { // same as Array.prototype.slice, but also works on typed arrays arraySlice: function(n, e, t) { return Ct.isTypedArray(n) ? new n.constructor(n.subarray(e, t !== void 0 ? t : n.length)) : n.slice(e, t); }, // converts an array to a specific type convertArray: function(n, e, t) { return !n || // let 'undefined' and 'null' pass !t && n.constructor === e ? n : typeof e.BYTES_PER_ELEMENT == "number" ? new e(n) : Array.prototype.slice.call(n); }, isTypedArray: function(n) { return ArrayBuffer.isView(n) && !(n instanceof DataView); }, // returns an array by which times and values can be sorted getKeyframeOrder: function(n) { function e(r, s) { return n[r] - n[s]; } const t = n.length, i = new Array(t); for (let r = 0; r !== t; ++r) i[r] = r; return i.sort(e), i; }, // uses the array previously returned by 'getKeyframeOrder' to sort data sortedArray: function(n, e, t) { const i = n.length, r = new n.constructor(i); for (let s = 0, o = 0; o !== i; ++s) { const a = t[s] * e; for (let c = 0; c !== e; ++c) r[o++] = n[a + c]; } return r; }, // function for parsing AOS keyframe formats flattenJSON: function(n, e, t, i) { let r = 1, s = n[0]; for (; s !== void 0 && s[i] === void 0; ) s = n[r++]; if (s === void 0) return; let o = s[i]; if (o !== void 0) if (Array.isArray(o)) do o = s[i], o !== void 0 && (e.push(s.time), t.push.apply(t, o)), s = n[r++]; while (s !== void 0); else if (o.toArray !== void 0) do o = s[i], o !== void 0 && (e.push(s.time), o.toArray(t, t.length)), s = n[r++]; while (s !== void 0); else do o = s[i], o !== void 0 && (e.push(s.time), t.push(o)), s = n[r++]; while (s !== void 0); }, subclip: function(n, e, t, i, r = 30) { const s = n.clone(); s.name = e; const o = []; for (let c = 0; c < s.tracks.length; ++c) { const l = s.tracks[c], d = l.getValueSize(), h = [], f = []; for (let g = 0; g < l.times.length; ++g) { const p = l.times[g] * r; if (!(p < t || p >= i)) { h.push(l.times[g]); for (let u = 0; u < d; ++u) f.push(l.values[g * d + u]); } } h.length !== 0 && (l.times = Ct.convertArray(h, l.times.constructor), l.values = Ct.convertArray(f, l.values.constructor), o.push(l)); } s.tracks = o; let a = 1 / 0; for (let c = 0; c < s.tracks.length; ++c) a > s.tracks[c].times[0] && (a = s.tracks[c].times[0]); for (let c = 0; c < s.tracks.length; ++c) s.tracks[c].shift(-1 * a); return s.resetDuration(), s; }, makeClipAdditive: function(n, e = 0, t = n, i = 30) { i <= 0 && (i = 30); const r = t.tracks.length, s = e / i; for (let o = 0; o < r; ++o) { const a = t.tracks[o], c = a.ValueTypeName; if (c === "bool" || c === "string") continue; const l = n.tracks.find(function(v) { return v.name === a.name && v.ValueTypeName === c; }); if (l === void 0) continue; let d = 0; const h = a.getValueSize(); a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (d = h / 3); let f = 0; const g = l.getValueSize(); l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (f = g / 3); const p = a.times.length - 1; let u; if (s <= a.times[0]) { const v = d, m = h - d; u = Ct.arraySlice(a.values, v, m); } else if (s >= a.times[p]) { const v = p * h + d, m = v + h - d; u = Ct.arraySlice(a.values, v, m); } else { const v = a.createInterpolant(), m = d, x = h - d; v.evaluate(s), u = Ct.arraySlice(v.resultBuffer, m, x); } c === "quaternion" && new bn().fromArray(u).normalize().conjugate().toArray(u); const y = l.times.length; for (let v = 0; v < y; ++v) { const m = v * g + f; if (c === "quaternion") bn.multiplyQuaternionsFlat( l.values, m, u, 0, l.values, m ); else { const x = g - f * 2; for (let w = 0; w < x; ++w) l.values[m + w] -= u[w]; } } } return n.blendMode = Mf, n; } }; class Ni { constructor(e, t, i, r) { this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r !== void 0 ? r : new t.constructor(i), this.sampleValues = t, this.valueSize = i, this.settings = null, this.DefaultSettings_ = {}; } evaluate(e) { const t = this.parameterPositions; let i = this._cachedIndex, r = t[i], s = t[i - 1]; e: { t: { let o; n: { i: if (!(e < r)) { for (let a = i + 2; ; ) { if (r === void 0) { if (e < s) break i; return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, e, s); } if (i === a) break; if (s = r, r = t[++i], e < r) break t; } o = t.length; break n; } if (!(e >= s)) { const a = t[1]; e < a && (i = 2, s = a); for (let c = i - 2; ; ) { if (s === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (i === c) break; if (r = s, s = t[--i - 1], e >= s) break t; } o = i, i = 0; break n; } break e; } for (; i < o; ) { const a = i + o >>> 1; e < t[a] ? o = a : i = a + 1; } if (r = t[i], s = t[i - 1], s === void 0) return this._cachedIndex = 0, this.beforeStart_(0, e, r); if (r === void 0) return i = t.length, this._cachedIndex = i, this.afterEnd_(i - 1, s, e); } this._cachedIndex = i, this.intervalChanged_(i, s, r); } return this.interpolate_(i, s, e, r); } getSettings_() { return this.settings || this.DefaultSettings_; } copySampleValue_(e) { const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r; for (let o = 0; o !== r; ++o) t[o] = i[s + o]; return t; } // Template methods for derived classes: interpolate_() { throw new Error("call to abstract method"); } intervalChanged_() { } } Ni.prototype.beforeStart_ = Ni.prototype.copySampleValue_; Ni.prototype.afterEnd_ = Ni.prototype.copySampleValue_; class Px extends Ni { constructor(e, t, i, r) { super(e, t, i, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = { endingStart: gs, endingEnd: gs }; } intervalChanged_(e, t, i) { const r = this.parameterPositions; let s = e - 2, o = e + 1, a = r[s], c = r[o]; if (a === void 0) switch (this.getSettings_().endingStart) { case vs: s = e, a = 2 * t - i; break; case Wa: s = r.length - 2, a = t + r[s] - r[s + 1]; break; default: s = e, a = i; } if (c === void 0) switch (this.getSettings_().endingEnd) { case vs: o = e, c = 2 * i - t; break; case Wa: o = 1, c = i + r[1] - r[0]; break; default: o = e - 1, c = t; } const l = (i - t) * 0.5, d = this.valueSize; this._weightPrev = l / (t - a), this._weightNext = l / (c - i), this._offsetPrev = s * d, this._offsetNext = o * d; } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = this._offsetPrev, h = this._offsetNext, f = this._weightPrev, g = this._weightNext, p = (i - t) / (r - t), u = p * p, y = u * p, v = -f * y + 2 * f * u - f * p, m = (1 + f) * y + (-1.5 - 2 * f) * u + (-0.5 + f) * p + 1, x = (-1 - g) * y + (1.5 + g) * u + 0.5 * p, w = g * y - g * u; for (let A = 0; A !== a; ++A) s[A] = v * o[d + A] + m * o[l + A] + x * o[c + A] + w * o[h + A]; return s; } } class Yf extends Ni { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = e * a, l = c - a, d = (i - t) / (r - t), h = 1 - d; for (let f = 0; f !== a; ++f) s[f] = o[l + f] * h + o[c + f] * d; return s; } } class Ix extends Ni { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e) { return this.copySampleValue_(e - 1); } } class xi { constructor(e, t, i, r) { if (e === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined"); if (t === void 0 || t.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e); this.name = e, this.times = Ct.convertArray(t, this.TimeBufferType), this.values = Ct.convertArray(i, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation); } // Serialization (in static context, because of constructor invocation // and automatic invocation of .toJSON): static toJSON(e) { const t = e.constructor; let i; if (t.toJSON !== this.toJSON) i = t.toJSON(e); else { i = { name: e.name, times: Ct.convertArray(e.times, Array), values: Ct.convertArray(e.values, Array) }; const r = e.getInterpolation(); r !== e.DefaultInterpolation && (i.interpolation = r); } return i.type = e.ValueTypeName, i; } InterpolantFactoryMethodDiscrete(e) { return new Ix(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodLinear(e) { return new Yf(this.times, this.values, this.getValueSize(), e); } InterpolantFactoryMethodSmooth(e) { return new Px(this.times, this.values, this.getValueSize(), e); } setInterpolation(e) { let t; switch (e) { case Lo: t = this.InterpolantFactoryMethodDiscrete; break; case Es: t = this.InterpolantFactoryMethodLinear; break; case Cc: t = this.InterpolantFactoryMethodSmooth; break; } if (t === void 0) { const i = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; if (this.createInterpolant === void 0) if (e !== this.DefaultInterpolation) this.setInterpolation(this.DefaultInterpolation); else throw new Error(i); return console.warn("THREE.KeyframeTrack:", i), this; } return this.createInterpolant = t, this; } getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return Lo; case this.InterpolantFactoryMethodLinear: return Es; case this.InterpolantFactoryMethodSmooth: return Cc; } } getValueSize() { return this.values.length / this.times.length; } // move all keyframes either forwards or backwards in time shift(e) { if (e !== 0) { const t = this.times; for (let i = 0, r = t.length; i !== r; ++i) t[i] += e; } return this; } // scale all keyframe times by a factor (useful for frame <-> seconds conversions) scale(e) { if (e !== 1) { const t = this.times; for (let i = 0, r = t.length; i !== r; ++i) t[i] *= e; } return this; } // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values trim(e, t) { const i = this.times, r = i.length; let s = 0, o = r - 1; for (; s !== r && i[s] < e; ) ++s; for (; o !== -1 && i[o] > t; ) --o; if (++o, s !== 0 || o !== r) { s >= o && (o = Math.max(o, 1), s = o - 1); const a = this.getValueSize(); this.times = Ct.arraySlice(i, s, o), this.values = Ct.arraySlice(this.values, s * a, o * a); } return this; } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate() { let e = !0; const t = this.getValueSize(); t - Math.floor(t) !== 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1); const i = this.times, r = this.values, s = i.length; s === 0 && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1); let o = null; for (let a = 0; a !== s; a++) { const c = i[a]; if (typeof c == "number" && isNaN(c)) { console.error("THREE.KeyframeTrack: Time is not a valid number.", this, a, c), e = !1; break; } if (o !== null && o > c) { console.error("THREE.KeyframeTrack: Out of order keys.", this, a, c, o), e = !1; break; } o = c; } if (r !== void 0 && Ct.isTypedArray(r)) for (let a = 0, c = r.length; a !== c; ++a) { const l = r[a]; if (isNaN(l)) { console.error("THREE.KeyframeTrack: Value is not a valid number.", this, a, l), e = !1; break; } } return e; } // removes equivalent sequential keys as common in morph target sequences // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) optimize() { const e = Ct.arraySlice(this.times), t = Ct.arraySlice(this.values), i = this.getValueSize(), r = this.getInterpolation() === Cc, s = e.length - 1; let o = 1; for (let a = 1; a < s; ++a) { let c = !1; const l = e[a], d = e[a + 1]; if (l !== d && (a !== 1 || l !== e[0])) if (r) c = !0; else { const h = a * i, f = h - i, g = h + i; for (let p = 0; p !== i; ++p) { const u = t[h + p]; if (u !== t[f + p] || u !== t[g + p]) { c = !0; break; } } } if (c) { if (a !== o) { e[o] = e[a]; const h = a * i, f = o * i; for (let g = 0; g !== i; ++g) t[f + g] = t[h + g]; } ++o; } } if (s > 0) { e[o] = e[s]; for (let a = s * i, c = o * i, l = 0; l !== i; ++l) t[c + l] = t[a + l]; ++o; } return o !== e.length ? (this.times = Ct.arraySlice(e, 0, o), this.values = Ct.arraySlice(t, 0, o * i)) : (this.times = e, this.values = t), this; } clone() { const e = Ct.arraySlice(this.times, 0), t = Ct.arraySlice(this.values, 0), i = this.constructor, r = new i(this.name, e, t); return r.createInterpolant = this.createInterpolant, r; } } xi.prototype.TimeBufferType = Float32Array; xi.prototype.ValueBufferType = Float32Array; xi.prototype.DefaultInterpolation = Es; class Vs extends xi { } Vs.prototype.ValueTypeName = "bool"; Vs.prototype.ValueBufferType = Array; Vs.prototype.DefaultInterpolation = Lo; Vs.prototype.InterpolantFactoryMethodLinear = void 0; Vs.prototype.InterpolantFactoryMethodSmooth = void 0; class Jf extends xi { } Jf.prototype.ValueTypeName = "color"; class Ho extends xi { } Ho.prototype.ValueTypeName = "number"; class Ox extends Ni { constructor(e, t, i, r) { super(e, t, i, r); } interpolate_(e, t, i, r) { const s = this.resultBuffer, o = this.sampleValues, a = this.valueSize, c = (i - t) / (r - t); let l = e * a; for (let d = l + a; l !== d; l += 4) bn.slerpFlat(s, 0, o, l - a, o, l, c); return s; } } class ks extends xi { InterpolantFactoryMethodLinear(e) { return new Ox(this.times, this.values, this.getValueSize(), e); } } ks.prototype.ValueTypeName = "quaternion"; ks.prototype.DefaultInterpolation = Es; ks.prototype.InterpolantFactoryMethodSmooth = void 0; class Gs extends xi { } Gs.prototype.ValueTypeName = "string"; Gs.prototype.ValueBufferType = Array; Gs.prototype.DefaultInterpolation = Lo; Gs.prototype.InterpolantFactoryMethodLinear = void 0; Gs.prototype.InterpolantFactoryMethodSmooth = void 0; class Wo extends xi { } Wo.prototype.ValueTypeName = "vector"; class jo { constructor(e, t = -1, i, r = fu) { this.name = e, this.tracks = i, this.duration = t, this.blendMode = r, this.uuid = Hn(), 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(lN(i[o]).scale(r)); const s = new this(e.name, e.duration, t, e.blendMode); return s.uuid = e.uuid, s; } static toJSON(e) { const t = [], i = e.tracks, r = { name: e.name, duration: e.duration, tracks: t, uuid: e.uuid, blendMode: e.blendMode }; for (let s = 0, o = i.length; s !== o; ++s) t.push(xi.toJSON(i[s])); return r; } static CreateFromMorphTargetSequence(e, t, i, r) { const s = t.length, o = []; for (let a = 0; a < s; a++) { let c = [], l = []; c.push( (a + s - 1) % s, a, (a + 1) % s ), l.push(0, 1, 0); const d = Ct.getKeyframeOrder(c); c = Ct.sortedArray(c, 1, d), l = Ct.sortedArray(l, 1, d), !r && c[0] === 0 && (c.push(s), l.push(l[0])), o.push( new Ho( ".morphTargetInfluences[" + t[a].name + "]", c, l ).scale(1 / i) ); } return new this(e, -1, o); } static findByName(e, t) { let i = e; if (!Array.isArray(e)) { const r = e; i = r.geometry && r.geometry.animations || r.animations; } for (let r = 0; r < i.length; r++) if (i[r].name === t) return i[r]; return null; } static CreateClipsFromMorphTargetSequences(e, t, i) { const r = {}, s = /^([\w-]*?)([\d]+)$/; for (let a = 0, c = e.length; a < c; a++) { const l = e[a], d = l.name.match(s); if (d && d.length > 1) { const h = d[1]; let f = r[h]; f || (r[h] = f = []), f.push(l); } } const o = []; for (const a in r) o.push(this.CreateFromMorphTargetSequence(a, r[a], t, i)); return o; } // parse the animation.hierarchy format static parseAnimation(e, t) { if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; const i = function(h, f, g, p, u) { if (g.length !== 0) { const y = [], v = []; Ct.flattenJSON(g, y, v, p), y.length !== 0 && u.push(new h(f, y, v)); } }, r = [], s = e.name || "default", o = e.fps || 30, a = e.blendMode; let c = e.length || -1; const l = e.hierarchy || []; for (let h = 0; h < l.length; h++) { const f = l[h].keys; if (!(!f || f.length === 0)) if (f[0].morphTargets) { const g = {}; let p; for (p = 0; p < f.length; p++) if (f[p].morphTargets) for (let u = 0; u < f[p].morphTargets.length; u++) g[f[p].morphTargets[u]] = -1; for (const u in g) { const y = [], v = []; for (let m = 0; m !== f[p].morphTargets.length; ++m) { const x = f[p]; y.push(x.time), v.push(x.morphTarget === u ? 1 : 0); } r.push(new Ho(".morphTargetInfluence[" + u + "]", y, v)); } c = g.length * (o || 1); } else { const g = ".bones[" + t[h].name + "]"; i( Wo, g + ".position", f, "pos", r ), i( ks, g + ".quaternion", f, "rot", r ), i( Wo, g + ".scale", f, "scl", r ); } } return r.length === 0 ? null : new this(s, c, r, a); } resetDuration() { const e = this.tracks; let t = 0; for (let i = 0, r = e.length; i !== r; ++i) { const s = this.tracks[i]; t = Math.max(t, s.times[s.times.length - 1]); } return this.duration = t, this; } trim() { for (let e = 0; e < this.tracks.length; e++) this.tracks[e].trim(0, this.duration); return this; } validate() { let e = !0; for (let t = 0; t < this.tracks.length; t++) e = e && this.tracks[t].validate(); return e; } optimize() { for (let e = 0; e < this.tracks.length; e++) this.tracks[e].optimize(); return this; } clone() { const e = []; for (let t = 0; t < this.tracks.length; t++) e.push(this.tracks[t].clone()); return new this.constructor(this.name, this.duration, e, this.blendMode); } toJSON() { return this.constructor.toJSON(this); } } function aN(n) { switch (n.toLowerCase()) { case "scalar": case "double": case "float": case "number": case "integer": return Ho; case "vector": case "vector2": case "vector3": case "vector4": return Wo; case "color": return Jf; case "quaternion": return ks; case "bool": case "boolean": return Vs; case "string": return Gs; } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + n); } function lN(n) { if (n.type === void 0) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); const e = aN(n.type); if (n.times === void 0) { const t = [], i = []; Ct.flattenJSON(n.keys, t, i, "value"), n.times = t, n.values = i; } return e.parse !== void 0 ? e.parse(n) : new e(n.name, n.times, n.values, n.interpolation); } const Is = { enabled: !1, files: {}, add: function(n, e) { this.enabled !== !1 && (this.files[n] = e); }, get: function(n) { if (this.enabled !== !1) return this.files[n]; }, remove: function(n) { delete this.files[n]; }, clear: function() { this.files = {}; } }; class Kf { constructor(e, t, i) { const r = this; let s = !1, o = 0, a = 0, c; const l = []; this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = i, this.itemStart = function(d) { a++, s === !1 && r.onStart !== void 0 && r.onStart(d, o, a), s = !0; }, this.itemEnd = function(d) { o++, r.onProgress !== void 0 && r.onProgress(d, o, a), o === a && (s = !1, r.onLoad !== void 0 && r.onLoad()); }, this.itemError = function(d) { r.onError !== void 0 && r.onError(d); }, this.resolveURL = function(d) { return c ? c(d) : d; }, this.setURLModifier = function(d) { return c = d, this; }, this.addHandler = function(d, h) { return l.push(d, h), this; }, this.removeHandler = function(d) { const h = l.indexOf(d); return h !== -1 && l.splice(h, 2), this; }, this.getHandler = function(d) { for (let h = 0, f = l.length; h < f; h += 2) { const g = l[h], p = l[h + 1]; if (g.global && (g.lastIndex = 0), g.test(d)) return p; } return null; }; } } const Dx = new Kf(); class xn { constructor(e) { this.manager = e !== void 0 ? e : Dx, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}; } load() { } loadAsync(e, t) { const i = this; return new Promise(function(r, s) { i.load(e, r, t, s); }); } parse() { } setCrossOrigin(e) { return this.crossOrigin = e, this; } setWithCredentials(e) { return this.withCredentials = e, this; } setPath(e) { return this.path = e, this; } setResourcePath(e) { return this.resourcePath = e, this; } setRequestHeader(e) { return this.requestHeader = e, this; } } const ai = {}; class $n extends xn { constructor(e) { super(e); } load(e, t, i, r) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = Is.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; if (ai[e] !== void 0) { ai[e].push({ onLoad: t, onProgress: i, onError: r }); return; } const a = /^data:(.*?)(;base64)?,(.*)$/, c = e.match(a); let l; if (c) { const d = c[1], h = !!c[2]; let f = c[3]; f = decodeURIComponent(f), h && (f = atob(f)); try { let g; const p = (this.responseType || "").toLowerCase(); switch (p) { case "arraybuffer": case "blob": const u = new Uint8Array(f.length); for (let v = 0; v < f.length; v++) u[v] = f.charCodeAt(v); p === "blob" ? g = new Blob([u.buffer], { type: d }) : g = u.buffer; break; case "document": g = new DOMParser().parseFromString(f, d); break; case "json": g = JSON.parse(f); break; default: g = f; break; } setTimeout(function() { t && t(g), s.manager.itemEnd(e); }, 0); } catch (g) { setTimeout(function() { r && r(g), s.manager.itemError(e), s.manager.itemEnd(e); }, 0); } } else { ai[e] = [], ai[e].push({ onLoad: t, onProgress: i, onError: r }), l = new XMLHttpRequest(), l.open("GET", e, !0), l.addEventListener("load", function(d) { const h = this.response, f = ai[e]; if (delete ai[e], this.status === 200 || this.status === 0) { this.status === 0 && console.warn("THREE.FileLoader: HTTP Status 0 received."), Is.add(e, h); for (let g = 0, p = f.length; g < p; g++) { const u = f[g]; u.onLoad && u.onLoad(h); } s.manager.itemEnd(e); } else { for (let g = 0, p = f.length; g < p; g++) { const u = f[g]; u.onError && u.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); } }, !1), l.addEventListener("progress", function(d) { const h = ai[e]; for (let f = 0, g = h.length; f < g; f++) { const p = h[f]; p.onProgress && p.onProgress(d); } }, !1), l.addEventListener("error", function(d) { const h = ai[e]; delete ai[e]; for (let f = 0, g = h.length; f < g; f++) { const p = h[f]; p.onError && p.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); }, !1), l.addEventListener("abort", function(d) { const h = ai[e]; delete ai[e]; for (let f = 0, g = h.length; f < g; f++) { const p = h[f]; p.onError && p.onError(d); } s.manager.itemError(e), s.manager.itemEnd(e); }, !1), this.responseType !== void 0 && (l.responseType = this.responseType), this.withCredentials !== void 0 && (l.withCredentials = this.withCredentials), l.overrideMimeType && l.overrideMimeType(this.mimeType !== void 0 ? this.mimeType : "text/plain"); for (const d in this.requestHeader) l.setRequestHeader(d, this.requestHeader[d]); l.send(null); } return s.manager.itemStart(e), l; } setResponseType(e) { return this.responseType = e, this; } setMimeType(e) { return this.mimeType = e, this; } } class cN extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new $n(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) { try { t(s.parse(JSON.parse(a))); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } parse(e) { const t = []; for (let i = 0; i < e.length; i++) { const r = jo.parse(e[i]); t.push(r); } return t; } } class uN extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = [], a = new If(), c = new $n(this.manager); c.setPath(this.path), c.setResponseType("arraybuffer"), c.setRequestHeader(this.requestHeader), c.setWithCredentials(s.withCredentials); let l = 0; function d(h) { c.load(e[h], function(f) { const g = s.parse(f, !0); o[h] = { width: g.width, height: g.height, format: g.format, mipmaps: g.mipmaps }, l += 1, l === 6 && (g.mipmapCount === 1 && (a.minFilter = zt), a.image = o, a.format = g.format, a.needsUpdate = !0, t && t(a)); }, i, r); } if (Array.isArray(e)) for (let h = 0, f = e.length; h < f; ++h) d(h); else c.load(e, function(h) { const f = s.parse(h, !0); if (f.isCubemap) { const g = f.mipmaps.length / f.mipmapCount; for (let p = 0; p < g; p++) { o[p] = { mipmaps: [] }; for (let u = 0; u < f.mipmapCount; u++) o[p].mipmaps.push(f.mipmaps[p * f.mipmapCount + u]), o[p].format = f.format, o[p].width = f.width, o[p].height = f.height; } a.image = o; } else a.image.width = f.width, a.image.height = f.height, a.mipmaps = f.mipmaps; f.mipmapCount === 1 && (a.minFilter = zt), a.format = f.format, a.needsUpdate = !0, t && t(a); }, i, r); return a; } } class Ya extends xn { constructor(e) { super(e); } load(e, t, i, r) { this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = Is.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; const a = document.createElementNS("http://www.w3.org/1999/xhtml", "img"); function c() { a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), Is.add(e, this), t && t(this), s.manager.itemEnd(e); } function l(d) { a.removeEventListener("load", c, !1), a.removeEventListener("error", l, !1), r && r(d), s.manager.itemError(e), s.manager.itemEnd(e); } return a.addEventListener("load", c, !1), a.addEventListener("error", l, !1), e.substr(0, 5) !== "data:" && this.crossOrigin !== void 0 && (a.crossOrigin = this.crossOrigin), s.manager.itemStart(e), a.src = e, a; } } class Nx extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = new ta(), o = new Ya(this.manager); o.setCrossOrigin(this.crossOrigin), o.setPath(this.path); let a = 0; function c(l) { o.load(e[l], function(d) { s.images[l] = d, a++, a === 6 && (s.needsUpdate = !0, t && t(s)); }, void 0, r); } for (let l = 0; l < e.length; ++l) c(l); return s; } } class Bx extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new Ss(), a = new $n(this.manager); return a.setResponseType("arraybuffer"), a.setRequestHeader(this.requestHeader), a.setPath(this.path), a.setWithCredentials(s.withCredentials), a.load(e, function(c) { const l = s.parse(c); l && (l.image !== void 0 ? o.image = l.image : l.data !== void 0 && (o.image.width = l.width, o.image.height = l.height, o.image.data = l.data), o.wrapS = l.wrapS !== void 0 ? l.wrapS : hn, o.wrapT = l.wrapT !== void 0 ? l.wrapT : hn, o.magFilter = l.magFilter !== void 0 ? l.magFilter : zt, o.minFilter = l.minFilter !== void 0 ? l.minFilter : zt, o.anisotropy = l.anisotropy !== void 0 ? l.anisotropy : 1, l.encoding !== void 0 && (o.encoding = l.encoding), l.flipY !== void 0 && (o.flipY = l.flipY), l.format !== void 0 && (o.format = l.format), l.type !== void 0 && (o.type = l.type), l.mipmaps !== void 0 && (o.mipmaps = l.mipmaps, o.minFilter = fr), l.mipmapCount === 1 && (o.minFilter = zt), l.generateMipmaps !== void 0 && (o.generateMipmaps = l.generateMipmaps), o.needsUpdate = !0, t && t(o, l)); }, i, r), o; } } class qf extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = new Yt(), o = new Ya(this.manager); return o.setCrossOrigin(this.crossOrigin), o.setPath(this.path), o.load(e, function(a) { s.image = a; const c = e.search(/\.jpe?g($|\?)/i) > 0 || e.search(/^data\:image\/jpeg/) === 0; s.format = c ? nr : Gn, s.needsUpdate = !0, t !== void 0 && t(s); }, i, r), s; } } class Ux extends jn { constructor() { super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1; } add(e) { this.curves.push(e); } closePath() { const e = this.curves[0].getPoint(0), t = this.curves[this.curves.length - 1].getPoint(1); e.equals(t) || this.curves.push(new Ml(t, e)); } // To get accurate point with reference to // entire path distance at time t, // following has to be done: // 1. Length of each sub path have to be known // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') getPoint(e) { const t = e * this.getLength(), i = this.getCurveLengths(); let r = 0; for (; r < i.length; ) { if (i[r] >= t) { const s = i[r] - t, o = this.curves[r], a = o.getLength(), c = a === 0 ? 0 : 1 - s / a; return o.getPointAt(c); } r++; } return null; } // We cannot use the default THREE.Curve getPoint() with getLength() because in // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath // getPoint() depends on getLength getLength() { const e = this.getCurveLengths(); return e[e.length - 1]; } // cacheLengths must be recalculated. updateArcLengths() { this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths(); } // Compute lengths and cache them // We cannot overwrite getLengths() because UtoT mapping uses it. getCurveLengths() { if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; const e = []; let t = 0; for (let i = 0, r = this.curves.length; i < r; i++) t += this.curves[i].getLength(), e.push(t); return this.cacheLengths = e, e; } getSpacedPoints(e = 40) { const t = []; for (let i = 0; i <= e; i++) t.push(this.getPoint(i / e)); return this.autoClose && t.push(t[0]), t; } getPoints(e = 12) { const t = []; let i; for (let r = 0, s = this.curves; r < s.length; r++) { const o = s[r], a = o && o.isEllipseCurve ? e * 2 : o && (o.isLineCurve || o.isLineCurve3) ? 1 : o && o.isSplineCurve ? e * o.points.length : e, c = o.getPoints(a); for (let l = 0; l < c.length; l++) { const d = c[l]; i && i.equals(d) || (t.push(d), i = d); } } return this.autoClose && t.length > 1 && !t[t.length - 1].equals(t[0]) && t.push(t[0]), t; } copy(e) { super.copy(e), this.curves = []; for (let t = 0, i = e.curves.length; t < i; t++) { const r = e.curves[t]; this.curves.push(r.clone()); } return this.autoClose = e.autoClose, this; } toJSON() { const e = super.toJSON(); e.autoClose = this.autoClose, e.curves = []; for (let t = 0, i = this.curves.length; t < i; t++) { const r = this.curves[t]; e.curves.push(r.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.autoClose = e.autoClose, this.curves = []; for (let t = 0, i = e.curves.length; t < i; t++) { const r = e.curves[t]; this.curves.push(new Vf[r.type]().fromJSON(r)); } return this; } } class Ja extends Ux { constructor(e) { super(), this.type = "Path", this.currentPoint = new Re(), e && this.setFromPoints(e); } setFromPoints(e) { this.moveTo(e[0].x, e[0].y); for (let t = 1, i = e.length; t < i; t++) this.lineTo(e[t].x, e[t].y); return this; } moveTo(e, t) { return this.currentPoint.set(e, t), this; } lineTo(e, t) { const i = new Ml(this.currentPoint.clone(), new Re(e, t)); return this.curves.push(i), this.currentPoint.set(e, t), this; } quadraticCurveTo(e, t, i, r) { const s = new _u( this.currentPoint.clone(), new Re(e, t), new Re(i, r) ); return this.curves.push(s), this.currentPoint.set(i, r), this; } bezierCurveTo(e, t, i, r, s, o) { const a = new Su( this.currentPoint.clone(), new Re(e, t), new Re(i, r), new Re(s, o) ); return this.curves.push(a), this.currentPoint.set(s, o), this; } splineThru(e) { const t = [this.currentPoint.clone()].concat(e), i = new Tu(t); return this.curves.push(i), this.currentPoint.copy(e[e.length - 1]), this; } arc(e, t, i, r, s, o) { const a = this.currentPoint.x, c = this.currentPoint.y; return this.absarc( e + a, t + c, i, r, s, o ), this; } absarc(e, t, i, r, s, o) { return this.absellipse(e, t, i, i, r, s, o), this; } ellipse(e, t, i, r, s, o, a, c) { const l = this.currentPoint.x, d = this.currentPoint.y; return this.absellipse(e + l, t + d, i, r, s, o, a, c), this; } absellipse(e, t, i, r, s, o, a, c) { const l = new xl(e, t, i, r, s, o, a, c); if (this.curves.length > 0) { const h = l.getPoint(0); h.equals(this.currentPoint) || this.lineTo(h.x, h.y); } this.curves.push(l); const d = l.getPoint(1); return this.currentPoint.copy(d), this; } copy(e) { return super.copy(e), this.currentPoint.copy(e.currentPoint), this; } toJSON() { const e = super.toJSON(); return e.currentPoint = this.currentPoint.toArray(), e; } fromJSON(e) { return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this; } } class Dr extends Ja { constructor(e) { super(e), this.uuid = Hn(), this.type = "Shape", this.holes = []; } getPointsHoles(e) { const t = []; for (let i = 0, r = this.holes.length; i < r; i++) t[i] = this.holes[i].getPoints(e); return t; } // get points of shape and holes (keypoints based on segments parameter) extractPoints(e) { return { shape: this.getPoints(e), holes: this.getPointsHoles(e) }; } copy(e) { super.copy(e), this.holes = []; for (let t = 0, i = e.holes.length; t < i; t++) { const r = e.holes[t]; this.holes.push(r.clone()); } return this; } toJSON() { const e = super.toJSON(); e.uuid = this.uuid, e.holes = []; for (let t = 0, i = this.holes.length; t < i; t++) { const r = this.holes[t]; e.holes.push(r.toJSON()); } return e; } fromJSON(e) { super.fromJSON(e), this.uuid = e.uuid, this.holes = []; for (let t = 0, i = e.holes.length; t < i; t++) { const r = e.holes[t]; this.holes.push(new Ja().fromJSON(r)); } return this; } } class gi extends ut { constructor(e, t = 1) { super(), this.type = "Light", this.color = new Ue(e), this.intensity = t; } dispose() { } copy(e) { return super.copy(e), this.color.copy(e.color), this.intensity = e.intensity, this; } toJSON(e) { const t = super.toJSON(e); return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, this.groundColor !== void 0 && (t.object.groundColor = this.groundColor.getHex()), this.distance !== void 0 && (t.object.distance = this.distance), this.angle !== void 0 && (t.object.angle = this.angle), this.decay !== void 0 && (t.object.decay = this.decay), this.penumbra !== void 0 && (t.object.penumbra = this.penumbra), this.shadow !== void 0 && (t.object.shadow = this.shadow.toJSON()), t; } } gi.prototype.isLight = !0; class Qf extends gi { constructor(e, t, i) { super(e, i), this.type = "HemisphereLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.groundColor = new Ue(t); } copy(e) { return gi.prototype.copy.call(this, e), this.groundColor.copy(e.groundColor), this; } } Qf.prototype.isHemisphereLight = !0; const Vg = /* @__PURE__ */ new Xe(), kg = /* @__PURE__ */ new q(), Gg = /* @__PURE__ */ new q(); class ep { constructor(e) { this.camera = e, this.bias = 0, this.normalBias = 0, this.radius = 1, this.mapSize = new Re(512, 512), this.map = null, this.mapPass = null, this.matrix = new Xe(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new dl(), this._frameExtents = new Re(1, 1), this._viewportCount = 1, this._viewports = [ new xt(0, 0, 1, 1) ]; } getViewportCount() { return this._viewportCount; } getFrustum() { return this._frustum; } updateMatrices(e) { const t = this.camera, i = this.matrix; kg.setFromMatrixPosition(e.matrixWorld), t.position.copy(kg), Gg.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(Gg), t.updateMatrixWorld(), Vg.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(Vg), i.set( 0.5, 0, 0, 0.5, 0, 0.5, 0, 0.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1 ), i.multiply(t.projectionMatrix), i.multiply(t.matrixWorldInverse); } getViewport(e) { return this._viewports[e]; } getFrameExtents() { return this._frameExtents; } dispose() { this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose(); } copy(e) { return this.camera = e.camera.clone(), this.bias = e.bias, this.radius = e.radius, this.mapSize.copy(e.mapSize), this; } clone() { return new this.constructor().copy(this); } toJSON() { const e = {}; return this.bias !== 0 && (e.bias = this.bias), this.normalBias !== 0 && (e.normalBias = this.normalBias), this.radius !== 1 && (e.radius = this.radius), (this.mapSize.x !== 512 || this.mapSize.y !== 512) && (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e; } } class zx extends ep { constructor() { super(new nn(50, 1, 0.5, 500)), this.focus = 1; } updateMatrices(e) { const t = this.camera, i = ja * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height, s = e.distance || t.far; (i !== t.fov || r !== t.aspect || s !== t.far) && (t.fov = i, t.aspect = r, t.far = s, t.updateProjectionMatrix()), super.updateMatrices(e); } copy(e) { return super.copy(e), this.focus = e.focus, this; } } zx.prototype.isSpotLightShadow = !0; class Cu extends gi { constructor(e, t, i = 0, r = Math.PI / 3, s = 0, o = 1) { super(e, t), this.type = "SpotLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.target = new ut(), this.distance = i, this.angle = r, this.penumbra = s, this.decay = o, this.shadow = new zx(); } get power() { return this.intensity * Math.PI; } set power(e) { this.intensity = e / Math.PI; } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; } } Cu.prototype.isSpotLight = !0; const Hg = /* @__PURE__ */ new Xe(), xa = /* @__PURE__ */ new q(), Ah = /* @__PURE__ */ new q(); class Vx extends ep { constructor() { super(new nn(90, 1, 0.5, 500)), this._frameExtents = new Re(4, 2), this._viewportCount = 6, this._viewports = [ // These viewports map a cube-map onto a 2D texture with the // following orientation: // // xzXZ // y Y // // X - Positive x direction // x - Negative x direction // Y - Positive y direction // y - Negative y direction // Z - Positive z direction // z - Negative z direction // positive X new xt(2, 1, 1, 1), // negative X new xt(0, 1, 1, 1), // positive Z new xt(3, 1, 1, 1), // negative Z new xt(1, 1, 1, 1), // positive Y new xt(3, 0, 1, 1), // negative Y new xt(1, 0, 1, 1) ], this._cubeDirections = [ new q(1, 0, 0), new q(-1, 0, 0), new q(0, 0, 1), new q(0, 0, -1), new q(0, 1, 0), new q(0, -1, 0) ], this._cubeUps = [ new q(0, 1, 0), new q(0, 1, 0), new q(0, 1, 0), new q(0, 1, 0), new q(0, 0, 1), new q(0, 0, -1) ]; } updateMatrices(e, t = 0) { const i = this.camera, r = this.matrix, s = e.distance || i.far; s !== i.far && (i.far = s, i.updateProjectionMatrix()), xa.setFromMatrixPosition(e.matrixWorld), i.position.copy(xa), Ah.copy(i.position), Ah.add(this._cubeDirections[t]), i.up.copy(this._cubeUps[t]), i.lookAt(Ah), i.updateMatrixWorld(), r.makeTranslation(-xa.x, -xa.y, -xa.z), Hg.multiplyMatrices(i.projectionMatrix, i.matrixWorldInverse), this._frustum.setFromProjectionMatrix(Hg); } } Vx.prototype.isPointLightShadow = !0; class Lu extends gi { constructor(e, t, i = 0, r = 1) { super(e, t), this.type = "PointLight", this.distance = i, this.decay = r, this.shadow = new Vx(); } get power() { return this.intensity * 4 * Math.PI; } set power(e) { this.intensity = e / (4 * Math.PI); } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this; } } Lu.prototype.isPointLight = !0; class sa extends hl { constructor(e = -1, t = 1, i = 1, r = -1, s = 0.1, o = 2e3) { super(), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = i, this.bottom = r, this.near = s, this.far = o, this.updateProjectionMatrix(); } copy(e, t) { return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = e.view === null ? null : Object.assign({}, e.view), this; } setViewOffset(e, t, i, r, s, o) { this.view === null && (this.view = { enabled: !0, fullWidth: 1, fullHeight: 1, offsetX: 0, offsetY: 0, width: 1, height: 1 }), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = i, this.view.offsetY = r, this.view.width = s, this.view.height = o, this.updateProjectionMatrix(); } clearViewOffset() { this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix(); } updateProjectionMatrix() { const e = (this.right - this.left) / (2 * this.zoom), t = (this.top - this.bottom) / (2 * this.zoom), i = (this.right + this.left) / 2, r = (this.top + this.bottom) / 2; let s = i - e, o = i + e, a = r + t, c = r - t; if (this.view !== null && this.view.enabled) { const l = (this.right - this.left) / this.view.fullWidth / this.zoom, d = (this.top - this.bottom) / this.view.fullHeight / this.zoom; s += l * this.view.offsetX, o = s + l * this.view.width, a -= d * this.view.offsetY, c = a - d * this.view.height; } this.projectionMatrix.makeOrthographic(s, o, a, c, this.near, this.far), this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } toJSON(e) { const t = super.toJSON(e); return t.object.zoom = this.zoom, t.object.left = this.left, t.object.right = this.right, t.object.top = this.top, t.object.bottom = this.bottom, t.object.near = this.near, t.object.far = this.far, this.view !== null && (t.object.view = Object.assign({}, this.view)), t; } } sa.prototype.isOrthographicCamera = !0; class kx extends ep { constructor() { super(new sa(-5, 5, 5, -5, 0.5, 500)); } } kx.prototype.isDirectionalLightShadow = !0; class Ru extends gi { constructor(e, t) { super(e, t), this.type = "DirectionalLight", this.position.copy(ut.DefaultUp), this.updateMatrix(), this.target = new ut(), this.shadow = new kx(); } dispose() { this.shadow.dispose(); } copy(e) { return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this; } } Ru.prototype.isDirectionalLight = !0; class tp extends gi { constructor(e, t) { super(e, t), this.type = "AmbientLight"; } } tp.prototype.isAmbientLight = !0; class np extends gi { constructor(e, t, i = 10, r = 10) { super(e, t), this.type = "RectAreaLight", this.width = i, this.height = r; } copy(e) { return super.copy(e), this.width = e.width, this.height = e.height, this; } toJSON(e) { const t = super.toJSON(e); return t.object.width = this.width, t.object.height = this.height, t; } } np.prototype.isRectAreaLight = !0; class ip { constructor() { this.coefficients = []; for (let e = 0; e < 9; e++) this.coefficients.push(new q()); } set(e) { for (let t = 0; t < 9; t++) this.coefficients[t].copy(e[t]); return this; } zero() { for (let e = 0; e < 9; e++) this.coefficients[e].set(0, 0, 0); return this; } // get the radiance in the direction of the normal // target is a Vector3 getAt(e, t) { const i = e.x, r = e.y, s = e.z, o = this.coefficients; return t.copy(o[0]).multiplyScalar(0.282095), t.addScaledVector(o[1], 0.488603 * r), t.addScaledVector(o[2], 0.488603 * s), t.addScaledVector(o[3], 0.488603 * i), t.addScaledVector(o[4], 1.092548 * (i * r)), t.addScaledVector(o[5], 1.092548 * (r * s)), t.addScaledVector(o[6], 0.315392 * (3 * s * s - 1)), t.addScaledVector(o[7], 1.092548 * (i * s)), t.addScaledVector(o[8], 0.546274 * (i * i - r * r)), t; } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal // target is a Vector3 // https://graphics.stanford.edu/papers/envmap/envmap.pdf getIrradianceAt(e, t) { const i = e.x, r = e.y, s = e.z, o = this.coefficients; return t.copy(o[0]).multiplyScalar(0.886227), t.addScaledVector(o[1], 2 * 0.511664 * r), t.addScaledVector(o[2], 2 * 0.511664 * s), t.addScaledVector(o[3], 2 * 0.511664 * i), t.addScaledVector(o[4], 2 * 0.429043 * i * r), t.addScaledVector(o[5], 2 * 0.429043 * r * s), t.addScaledVector(o[6], 0.743125 * s * s - 0.247708), t.addScaledVector(o[7], 2 * 0.429043 * i * s), t.addScaledVector(o[8], 0.429043 * (i * i - r * r)), t; } add(e) { for (let t = 0; t < 9; t++) this.coefficients[t].add(e.coefficients[t]); return this; } addScaledSH(e, t) { for (let i = 0; i < 9; i++) this.coefficients[i].addScaledVector(e.coefficients[i], t); return this; } scale(e) { for (let t = 0; t < 9; t++) this.coefficients[t].multiplyScalar(e); return this; } lerp(e, t) { for (let i = 0; i < 9; i++) this.coefficients[i].lerp(e.coefficients[i], t); return this; } equals(e) { for (let t = 0; t < 9; t++) if (!this.coefficients[t].equals(e.coefficients[t])) return !1; return !0; } copy(e) { return this.set(e.coefficients); } clone() { return new this.constructor().copy(this); } fromArray(e, t = 0) { const i = this.coefficients; for (let r = 0; r < 9; r++) i[r].fromArray(e, t + r * 3); return this; } toArray(e = [], t = 0) { const i = this.coefficients; for (let r = 0; r < 9; r++) i[r].toArray(e, t + r * 3); return e; } // evaluate the basis functions // shBasis is an Array[ 9 ] static getBasisAt(e, t) { const i = e.x, r = e.y, s = e.z; t[0] = 0.282095, t[1] = 0.488603 * r, t[2] = 0.488603 * s, t[3] = 0.488603 * i, t[4] = 1.092548 * i * r, t[5] = 1.092548 * r * s, t[6] = 0.315392 * (3 * s * s - 1), t[7] = 1.092548 * i * s, t[8] = 0.546274 * (i * i - r * r); } } ip.prototype.isSphericalHarmonics3 = !0; class Al extends gi { constructor(e = new ip(), t = 1) { super(void 0, t), this.sh = e; } copy(e) { return super.copy(e), this.sh.copy(e.sh), this; } fromJSON(e) { return this.intensity = e.intensity, this.sh.fromArray(e.sh), this; } toJSON(e) { const t = super.toJSON(e); return t.object.sh = this.sh.toArray(), t; } } Al.prototype.isLightProbe = !0; class Gx extends xn { constructor(e) { super(e), this.textures = {}; } load(e, t, i, r) { const s = this, o = new $n(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 oN[e.type](); if (e.uuid !== void 0 && (r.uuid = e.uuid), e.name !== void 0 && (r.name = e.name), e.color !== void 0 && r.color !== void 0 && r.color.setHex(e.color), e.roughness !== void 0 && (r.roughness = e.roughness), e.metalness !== void 0 && (r.metalness = e.metalness), e.sheen !== void 0 && (r.sheen = new Ue().setHex(e.sheen)), e.emissive !== void 0 && r.emissive !== void 0 && r.emissive.setHex(e.emissive), e.specular !== void 0 && r.specular !== void 0 && r.specular.setHex(e.specular), e.shininess !== void 0 && (r.shininess = e.shininess), e.clearcoat !== void 0 && (r.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (r.clearcoatRoughness = e.clearcoatRoughness), e.transmission !== void 0 && (r.transmission = e.transmission), e.thickness !== void 0 && (r.thickness = e.thickness), e.attenuationDistance !== void 0 && (r.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && r.attenuationColor !== void 0 && r.attenuationColor.setHex(e.attenuationColor), e.fog !== void 0 && (r.fog = e.fog), e.flatShading !== void 0 && (r.flatShading = e.flatShading), e.blending !== void 0 && (r.blending = e.blending), e.combine !== void 0 && (r.combine = e.combine), e.side !== void 0 && (r.side = e.side), e.shadowSide !== void 0 && (r.shadowSide = e.shadowSide), e.opacity !== void 0 && (r.opacity = e.opacity), e.transparent !== void 0 && (r.transparent = e.transparent), e.alphaTest !== void 0 && (r.alphaTest = e.alphaTest), e.depthTest !== void 0 && (r.depthTest = e.depthTest), e.depthWrite !== void 0 && (r.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (r.colorWrite = e.colorWrite), e.stencilWrite !== void 0 && (r.stencilWrite = e.stencilWrite), e.stencilWriteMask !== void 0 && (r.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (r.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (r.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (r.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (r.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (r.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (r.stencilZPass = e.stencilZPass), e.wireframe !== void 0 && (r.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (r.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (r.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (r.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (r.rotation = e.rotation), e.linewidth !== 1 && (r.linewidth = e.linewidth), e.dashSize !== void 0 && (r.dashSize = e.dashSize), e.gapSize !== void 0 && (r.gapSize = e.gapSize), e.scale !== void 0 && (r.scale = e.scale), e.polygonOffset !== void 0 && (r.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (r.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (r.polygonOffsetUnits = e.polygonOffsetUnits), e.morphTargets !== void 0 && (r.morphTargets = e.morphTargets), e.morphNormals !== void 0 && (r.morphNormals = e.morphNormals), e.dithering !== void 0 && (r.dithering = e.dithering), e.alphaToCoverage !== void 0 && (r.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (r.premultipliedAlpha = e.premultipliedAlpha), e.vertexTangents !== void 0 && (r.vertexTangents = e.vertexTangents), e.visible !== void 0 && (r.visible = e.visible), e.toneMapped !== void 0 && (r.toneMapped = e.toneMapped), e.userData !== void 0 && (r.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? r.vertexColors = e.vertexColors > 0 : r.vertexColors = e.vertexColors), e.uniforms !== void 0) for (const s in e.uniforms) { const o = e.uniforms[s]; switch (r.uniforms[s] = {}, o.type) { case "t": r.uniforms[s].value = i(o.value); break; case "c": r.uniforms[s].value = new Ue().setHex(o.value); break; case "v2": r.uniforms[s].value = new Re().fromArray(o.value); break; case "v3": r.uniforms[s].value = new q().fromArray(o.value); break; case "v4": r.uniforms[s].value = new xt().fromArray(o.value); break; case "m3": r.uniforms[s].value = new rn().fromArray(o.value); break; case "m4": r.uniforms[s].value = new Xe().fromArray(o.value); break; default: r.uniforms[s].value = o.value; } } if (e.defines !== void 0 && (r.defines = e.defines), e.vertexShader !== void 0 && (r.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (r.fragmentShader = e.fragmentShader), e.extensions !== void 0) for (const s in e.extensions) r.extensions[s] = e.extensions[s]; if (e.shading !== void 0 && (r.flatShading = e.shading === 1), e.size !== void 0 && (r.size = e.size), e.sizeAttenuation !== void 0 && (r.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (r.map = i(e.map)), e.matcap !== void 0 && (r.matcap = i(e.matcap)), e.alphaMap !== void 0 && (r.alphaMap = i(e.alphaMap)), e.bumpMap !== void 0 && (r.bumpMap = i(e.bumpMap)), e.bumpScale !== void 0 && (r.bumpScale = e.bumpScale), e.normalMap !== void 0 && (r.normalMap = i(e.normalMap)), e.normalMapType !== void 0 && (r.normalMapType = e.normalMapType), e.normalScale !== void 0) { let s = e.normalScale; Array.isArray(s) === !1 && (s = [s, s]), r.normalScale = new Re().fromArray(s); } return e.displacementMap !== void 0 && (r.displacementMap = i(e.displacementMap)), e.displacementScale !== void 0 && (r.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (r.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (r.roughnessMap = i(e.roughnessMap)), e.metalnessMap !== void 0 && (r.metalnessMap = i(e.metalnessMap)), e.emissiveMap !== void 0 && (r.emissiveMap = i(e.emissiveMap)), e.emissiveIntensity !== void 0 && (r.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (r.specularMap = i(e.specularMap)), e.envMap !== void 0 && (r.envMap = i(e.envMap)), e.envMapIntensity !== void 0 && (r.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (r.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (r.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (r.lightMap = i(e.lightMap)), e.lightMapIntensity !== void 0 && (r.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (r.aoMap = i(e.aoMap)), e.aoMapIntensity !== void 0 && (r.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (r.gradientMap = i(e.gradientMap)), e.clearcoatMap !== void 0 && (r.clearcoatMap = i(e.clearcoatMap)), e.clearcoatRoughnessMap !== void 0 && (r.clearcoatRoughnessMap = i(e.clearcoatRoughnessMap)), e.clearcoatNormalMap !== void 0 && (r.clearcoatNormalMap = i(e.clearcoatNormalMap)), e.clearcoatNormalScale !== void 0 && (r.clearcoatNormalScale = new Re().fromArray(e.clearcoatNormalScale)), e.transmissionMap !== void 0 && (r.transmissionMap = i(e.transmissionMap)), e.thicknessMap !== void 0 && (r.thicknessMap = i(e.thicknessMap)), r; } setTextures(e) { return this.textures = e, this; } } class ir { static decodeText(e) { if (typeof TextDecoder < "u") return new TextDecoder().decode(e); let t = ""; for (let i = 0, r = e.length; i < r; i++) t += String.fromCharCode(e[i]); try { return decodeURIComponent(escape(t)); } catch { return t; } } static extractUrlBase(e) { const t = e.lastIndexOf("/"); return t === -1 ? "./" : e.substr(0, t + 1); } } class rp extends Ke { constructor() { super(), this.type = "InstancedBufferGeometry", this.instanceCount = 1 / 0; } copy(e) { return super.copy(e), this.instanceCount = e.instanceCount, this; } clone() { return new this.constructor().copy(this); } toJSON() { const e = super.toJSON(this); return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e; } } rp.prototype.isInstancedBufferGeometry = !0; class sp extends ot { constructor(e, t, i, r = 1) { typeof i == "number" && (r = i, i = !1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), super(e, t, i), this.meshPerAttribute = r; } copy(e) { return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; } toJSON() { const e = super.toJSON(); return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e; } } sp.prototype.isInstancedBufferAttribute = !0; class Hx extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new $n(s.manager); o.setPath(s.path), o.setRequestHeader(s.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) { try { t(s.parse(JSON.parse(a))); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } parse(e) { const t = {}, i = {}; function r(g, p) { if (t[p] !== void 0) return t[p]; const y = g.interleavedBuffers[p], v = s(g, y.buffer), m = mo(y.type, v), x = new Qr(m, y.stride); return x.uuid = y.uuid, t[p] = x, x; } function s(g, p) { if (i[p] !== void 0) return i[p]; const y = g.arrayBuffers[p], v = new Uint32Array(y).buffer; return i[p] = v, v; } const o = e.isInstancedBufferGeometry ? new rp() : new Ke(), a = e.data.index; if (a !== void 0) { const g = mo(a.type, a.array); o.setIndex(new ot(g, 1)); } const c = e.data.attributes; for (const g in c) { const p = c[g]; let u; if (p.isInterleavedBufferAttribute) { const y = r(e.data, p.data); u = new ar(y, p.itemSize, p.offset, p.normalized); } else { const y = mo(p.type, p.array), v = p.isInstancedBufferAttribute ? sp : ot; u = new v(y, p.itemSize, p.normalized); } p.name !== void 0 && (u.name = p.name), p.usage !== void 0 && u.setUsage(p.usage), p.updateRange !== void 0 && (u.updateRange.offset = p.updateRange.offset, u.updateRange.count = p.updateRange.count), o.setAttribute(g, u); } const l = e.data.morphAttributes; if (l) for (const g in l) { const p = l[g], u = []; for (let y = 0, v = p.length; y < v; y++) { const m = p[y]; let x; if (m.isInterleavedBufferAttribute) { const w = r(e.data, m.data); x = new ar(w, m.itemSize, m.offset, m.normalized); } else { const w = mo(m.type, m.array); x = new ot(w, m.itemSize, m.normalized); } m.name !== void 0 && (x.name = m.name), u.push(x); } o.morphAttributes[g] = u; } e.data.morphTargetsRelative && (o.morphTargetsRelative = !0); const h = e.data.groups || e.data.drawcalls || e.data.offsets; if (h !== void 0) for (let g = 0, p = h.length; g !== p; ++g) { const u = h[g]; o.addGroup(u.start, u.count, u.materialIndex); } const f = e.data.boundingSphere; if (f !== void 0) { const g = new q(); f.center !== void 0 && g.fromArray(f.center), o.boundingSphere = new pr(g, f.radius); } return e.name && (o.name = e.name), e.userData && (o.userData = e.userData), o; } } class hN extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = this.path === "" ? ir.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || o; const a = new $n(this.manager); a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(c) { let l = null; try { l = JSON.parse(c); } catch (h) { r !== void 0 && r(h), console.error("THREE:ObjectLoader: Can't parse " + e + ".", h.message); return; } const d = l.metadata; if (d === void 0 || d.type === void 0 || d.type.toLowerCase() === "geometry") { console.error("THREE.ObjectLoader: Can't load " + e); return; } s.parse(l, t); }, i, r); } async loadAsync(e, t) { const i = this, r = this.path === "" ? ir.extractUrlBase(e) : this.path; this.resourcePath = this.resourcePath || r; const s = new $n(this.manager); s.setPath(this.path), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials); const o = await s.loadAsync(e, t), a = JSON.parse(o), c = a.metadata; if (c === void 0 || c.type === void 0 || c.type.toLowerCase() === "geometry") throw new Error("THREE.ObjectLoader: Can't load " + e); return await i.parseAsync(a); } parse(e, t) { const i = this.parseAnimations(e.animations), r = this.parseShapes(e.shapes), s = this.parseGeometries(e.geometries, r), o = this.parseImages(e.images, function() { t !== void 0 && t(l); }), a = this.parseTextures(e.textures, o), c = this.parseMaterials(e.materials, a), l = this.parseObject(e.object, s, c, a, i), d = this.parseSkeletons(e.skeletons, l); if (this.bindSkeletons(l, d), t !== void 0) { let h = !1; for (const f in o) if (o[f] instanceof HTMLImageElement) { h = !0; break; } h === !1 && t(l); } return l; } async parseAsync(e) { const t = this.parseAnimations(e.animations), i = this.parseShapes(e.shapes), r = this.parseGeometries(e.geometries, i), s = await this.parseImagesAsync(e.images), o = this.parseTextures(e.textures, s), a = this.parseMaterials(e.materials, o), c = this.parseObject(e.object, r, a, o, t), l = this.parseSkeletons(e.skeletons, c); return this.bindSkeletons(c, l), c; } parseShapes(e) { const t = {}; if (e !== void 0) for (let i = 0, r = e.length; i < r; i++) { const s = new Dr().fromJSON(e[i]); t[s.uuid] = s; } return t; } parseSkeletons(e, t) { const i = {}, r = {}; if (t.traverse(function(s) { s.isBone && (r[s.uuid] = s); }), e !== void 0) for (let s = 0, o = e.length; s < o; s++) { const a = new bl().fromJSON(e[s], r); i[a.uuid] = a; } return i; } parseGeometries(e, t) { const i = {}; if (e !== void 0) { const r = new Hx(); for (let s = 0, o = e.length; s < o; s++) { let a; const c = e[s]; switch (c.type) { case "BufferGeometry": case "InstancedBufferGeometry": a = r.parse(c); break; case "Geometry": console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported."); break; default: c.type in zg ? a = zg[c.type].fromJSON(c, t) : console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`); } a.uuid = c.uuid, c.name !== void 0 && (a.name = c.name), a.isBufferGeometry === !0 && c.userData !== void 0 && (a.userData = c.userData), i[c.uuid] = a; } } return i; } parseMaterials(e, t) { const i = {}, r = {}; if (e !== void 0) { const s = new Gx(); s.setTextures(t); for (let o = 0, a = e.length; o < a; o++) { const c = e[o]; if (c.type === "MultiMaterial") { const l = []; for (let d = 0; d < c.materials.length; d++) { const h = c.materials[d]; i[h.uuid] === void 0 && (i[h.uuid] = s.parse(h)), l.push(i[h.uuid]); } r[c.uuid] = l; } else i[c.uuid] === void 0 && (i[c.uuid] = s.parse(c)), r[c.uuid] = i[c.uuid]; } } return r; } parseAnimations(e) { const t = {}; if (e !== void 0) for (let i = 0; i < e.length; i++) { const r = e[i], s = jo.parse(r); t[s.uuid] = s; } return t; } parseImages(e, t) { const i = this, r = {}; let s; function o(c) { return i.manager.itemStart(c), s.load(c, function() { i.manager.itemEnd(c); }, void 0, function() { i.manager.itemError(c), i.manager.itemEnd(c); }); } function a(c) { if (typeof c == "string") { const l = c, d = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(l) ? l : i.resourcePath + l; return o(d); } else return c.data ? { data: mo(c.type, c.data), width: c.width, height: c.height } : null; } if (e !== void 0 && e.length > 0) { const c = new Kf(t); s = new Ya(c), s.setCrossOrigin(this.crossOrigin); for (let l = 0, d = e.length; l < d; l++) { const h = e[l], f = h.url; if (Array.isArray(f)) { r[h.uuid] = []; for (let g = 0, p = f.length; g < p; g++) { const u = f[g], y = a(u); y !== null && (y instanceof HTMLImageElement ? r[h.uuid].push(y) : r[h.uuid].push(new Ss(y.data, y.width, y.height))); } } else { const g = a(h.url); g !== null && (r[h.uuid] = g); } } } return r; } async parseImagesAsync(e) { const t = this, i = {}; let r; async function s(o) { if (typeof o == "string") { const a = o, c = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(a) ? a : t.resourcePath + a; return await r.loadAsync(c); } else return o.data ? { data: mo(o.type, o.data), width: o.width, height: o.height } : null; } if (e !== void 0 && e.length > 0) { r = new Ya(this.manager), r.setCrossOrigin(this.crossOrigin); for (let o = 0, a = e.length; o < a; o++) { const c = e[o], l = c.url; if (Array.isArray(l)) { i[c.uuid] = []; for (let d = 0, h = l.length; d < h; d++) { const f = l[d], g = await s(f); g !== null && (g instanceof HTMLImageElement ? i[c.uuid].push(g) : i[c.uuid].push(new Ss(g.data, g.width, g.height))); } } else { const d = await s(c.url); d !== null && (i[c.uuid] = d); } } } return i; } parseTextures(e, t) { function i(s, o) { return typeof s == "number" ? s : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", s), o[s]); } const r = {}; if (e !== void 0) for (let s = 0, o = e.length; s < o; s++) { const a = e[s]; a.image === void 0 && console.warn('THREE.ObjectLoader: No "image" specified for', a.uuid), t[a.image] === void 0 && console.warn("THREE.ObjectLoader: Undefined image", a.image); let c; const l = t[a.image]; Array.isArray(l) ? (c = new ta(l), l.length === 6 && (c.needsUpdate = !0)) : (l && l.data ? c = new Ss(l.data, l.width, l.height) : c = new Yt(l), l && (c.needsUpdate = !0)), c.uuid = a.uuid, a.name !== void 0 && (c.name = a.name), a.mapping !== void 0 && (c.mapping = i(a.mapping, dN)), a.offset !== void 0 && c.offset.fromArray(a.offset), a.repeat !== void 0 && c.repeat.fromArray(a.repeat), a.center !== void 0 && c.center.fromArray(a.center), a.rotation !== void 0 && (c.rotation = a.rotation), a.wrap !== void 0 && (c.wrapS = i(a.wrap[0], Wg), c.wrapT = i(a.wrap[1], Wg)), a.format !== void 0 && (c.format = a.format), a.type !== void 0 && (c.type = a.type), a.encoding !== void 0 && (c.encoding = a.encoding), a.minFilter !== void 0 && (c.minFilter = i(a.minFilter, jg)), a.magFilter !== void 0 && (c.magFilter = i(a.magFilter, jg)), a.anisotropy !== void 0 && (c.anisotropy = a.anisotropy), a.flipY !== void 0 && (c.flipY = a.flipY), a.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = a.premultiplyAlpha), a.unpackAlignment !== void 0 && (c.unpackAlignment = a.unpackAlignment), r[a.uuid] = c; } return r; } parseObject(e, t, i, r, s) { let o; function a(f) { return t[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined geometry", f), t[f]; } function c(f) { if (f !== void 0) { if (Array.isArray(f)) { const g = []; for (let p = 0, u = f.length; p < u; p++) { const y = f[p]; i[y] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", y), g.push(i[y]); } return g; } return i[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined material", f), i[f]; } } function l(f) { return r[f] === void 0 && console.warn("THREE.ObjectLoader: Undefined texture", f), r[f]; } let d, h; switch (e.type) { case "Scene": o = new wu(), e.background !== void 0 && (Number.isInteger(e.background) ? o.background = new Ue(e.background) : o.background = l(e.background)), e.environment !== void 0 && (o.environment = l(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? o.fog = new pl(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (o.fog = new fl(e.fog.color, e.fog.density))); break; case "PerspectiveCamera": o = new nn(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (o.focus = e.focus), e.zoom !== void 0 && (o.zoom = e.zoom), e.filmGauge !== void 0 && (o.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (o.filmOffset = e.filmOffset), e.view !== void 0 && (o.view = Object.assign({}, e.view)); break; case "OrthographicCamera": o = new sa(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (o.zoom = e.zoom), e.view !== void 0 && (o.view = Object.assign({}, e.view)); break; case "AmbientLight": o = new tp(e.color, e.intensity); break; case "DirectionalLight": o = new Ru(e.color, e.intensity); break; case "PointLight": o = new Lu(e.color, e.intensity, e.distance, e.decay); break; case "RectAreaLight": o = new np(e.color, e.intensity, e.width, e.height); break; case "SpotLight": o = new Cu(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay); break; case "HemisphereLight": o = new Qf(e.color, e.groundColor, e.intensity); break; case "LightProbe": o = new Al().fromJSON(e); break; case "SkinnedMesh": d = a(e.geometry), h = c(e.material), o = new vl(d, h), e.bindMode !== void 0 && (o.bindMode = e.bindMode), e.bindMatrix !== void 0 && o.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (o.skeleton = e.skeleton); break; case "Mesh": d = a(e.geometry), h = c(e.material), o = new Xt(d, h); break; case "InstancedMesh": d = a(e.geometry), h = c(e.material); const f = e.count, g = e.instanceMatrix, p = e.instanceColor; o = new Pf(d, h, f), o.instanceMatrix = new ot(new Float32Array(g.array), 16), p !== void 0 && (o.instanceColor = new ot(new Float32Array(p.array), p.itemSize)); break; case "LOD": o = new Sx(); break; case "Line": o = new Oi(a(e.geometry), c(e.material)); break; case "LineLoop": o = new Au(a(e.geometry), c(e.material)); break; case "LineSegments": o = new Rn(a(e.geometry), c(e.material)); break; case "PointCloud": case "Points": o = new ia(a(e.geometry), c(e.material)); break; case "Sprite": o = new gl(c(e.material)); break; case "Group": o = new _i(); break; case "Bone": o = new yl(); break; default: o = new ut(); } if (o.uuid = e.uuid, e.name !== void 0 && (o.name = e.name), e.matrix !== void 0 ? (o.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (o.matrixAutoUpdate = e.matrixAutoUpdate), o.matrixAutoUpdate && o.matrix.decompose(o.position, o.quaternion, o.scale)) : (e.position !== void 0 && o.position.fromArray(e.position), e.rotation !== void 0 && o.rotation.fromArray(e.rotation), e.quaternion !== void 0 && o.quaternion.fromArray(e.quaternion), e.scale !== void 0 && o.scale.fromArray(e.scale)), e.castShadow !== void 0 && (o.castShadow = e.castShadow), e.receiveShadow !== void 0 && (o.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.bias !== void 0 && (o.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (o.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (o.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && o.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (o.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (o.visible = e.visible), e.frustumCulled !== void 0 && (o.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (o.renderOrder = e.renderOrder), e.userData !== void 0 && (o.userData = e.userData), e.layers !== void 0 && (o.layers.mask = e.layers), e.children !== void 0) { const f = e.children; for (let g = 0; g < f.length; g++) o.add(this.parseObject(f[g], t, i, r, s)); } if (e.animations !== void 0) { const f = e.animations; for (let g = 0; g < f.length; g++) { const p = f[g]; o.animations.push(s[p]); } } if (e.type === "LOD") { e.autoUpdate !== void 0 && (o.autoUpdate = e.autoUpdate); const f = e.levels; for (let g = 0; g < f.length; g++) { const p = f[g], u = o.getObjectByProperty("uuid", p.object); u !== void 0 && o.addLevel(u, p.distance); } } return o; } bindSkeletons(e, t) { Object.keys(t).length !== 0 && e.traverse(function(i) { if (i.isSkinnedMesh === !0 && i.skeleton !== void 0) { const r = t[i.skeleton]; r === void 0 ? console.warn("THREE.ObjectLoader: No skeleton found with UUID:", i.skeleton) : i.bind(r, i.bindMatrix); } }); } /* DEPRECATED */ setTexturePath(e) { return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."), this.setResourcePath(e); } } const dN = { UVMapping: hu, CubeReflectionMapping: ll, CubeRefractionMapping: cl, EquirectangularReflectionMapping: kc, EquirectangularRefractionMapping: Gc, CubeUVReflectionMapping: ea, CubeUVRefractionMapping: ul }, Wg = { RepeatWrapping: jr, ClampToEdgeWrapping: hn, MirroredRepeatWrapping: Eo }, jg = { NearestFilter: $t, NearestMipmapNearestFilter: ka, NearestMipmapLinearFilter: Ga, LinearFilter: zt, LinearMipmapNearestFilter: du, LinearMipmapLinearFilter: fr }; class op extends xn { constructor(e) { super(e), typeof createImageBitmap > "u" && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" }; } setOptions(e) { return this.options = e, this; } load(e, t, i, r) { e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e); const s = this, o = Is.get(e); if (o !== void 0) return s.manager.itemStart(e), setTimeout(function() { t && t(o), s.manager.itemEnd(e); }, 0), o; const a = {}; a.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", a.headers = this.requestHeader, fetch(e, a).then(function(c) { return c.blob(); }).then(function(c) { return createImageBitmap(c, Object.assign(s.options, { colorSpaceConversion: "none" })); }).then(function(c) { Is.add(e, c), t && t(c), s.manager.itemEnd(e); }).catch(function(c) { r && r(c), s.manager.itemError(e), s.manager.itemEnd(e); }), s.manager.itemStart(e); } } op.prototype.isImageBitmapLoader = !0; class Wx { constructor() { this.type = "ShapePath", this.color = new Ue(), this.subPaths = [], this.currentPath = null; } moveTo(e, t) { return this.currentPath = new Ja(), this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this; } lineTo(e, t) { return this.currentPath.lineTo(e, t), this; } quadraticCurveTo(e, t, i, r) { return this.currentPath.quadraticCurveTo(e, t, i, r), this; } bezierCurveTo(e, t, i, r, s, o) { return this.currentPath.bezierCurveTo(e, t, i, r, s, o), this; } splineThru(e) { return this.currentPath.splineThru(e), this; } toShapes(e, t) { function i(m) { const x = []; for (let w = 0, A = m.length; w < A; w++) { const M = m[w], R = new Dr(); R.curves = M.curves, x.push(R); } return x; } function r(m, x) { const w = x.length; let A = !1; for (let M = w - 1, R = 0; R < w; M = R++) { let L = x[M], S = x[R], I = S.x - L.x, T = S.y - L.y; if (Math.abs(T) > Number.EPSILON) { if (T < 0 && (L = x[R], I = -I, S = x[M], T = -T), m.y < L.y || m.y > S.y) continue; if (m.y === L.y) { if (m.x === L.x) return !0; } else { const _ = T * (m.x - L.x) - I * (m.y - L.y); if (_ === 0) return !0; if (_ < 0) continue; A = !A; } } else { if (m.y !== L.y) continue; if (S.x <= m.x && m.x <= L.x || L.x <= m.x && m.x <= S.x) return !0; } } return A; } const s = Fi.isClockWise, o = this.subPaths; if (o.length === 0) return []; if (t === !0) return i(o); let a, c, l; const d = []; if (o.length === 1) return c = o[0], l = new Dr(), l.curves = c.curves, d.push(l), d; let h = !s(o[0].getPoints()); h = e ? !h : h; const f = [], g = []; let p = [], u = 0, y; g[u] = void 0, p[u] = []; for (let m = 0, x = o.length; m < x; m++) c = o[m], y = c.getPoints(), a = s(y), a = e ? !a : a, a ? (!h && g[u] && u++, g[u] = { s: new Dr(), p: y }, g[u].s.curves = c.curves, h && u++, p[u] = []) : p[u].push({ h: c, p: y[0] }); if (!g[0]) return i(o); if (g.length > 1) { let m = !1; const x = []; for (let w = 0, A = g.length; w < A; w++) f[w] = []; for (let w = 0, A = g.length; w < A; w++) { const M = p[w]; for (let R = 0; R < M.length; R++) { const L = M[R]; let S = !0; for (let I = 0; I < g.length; I++) r(L.p, g[I].p) && (w !== I && x.push({ froms: w, tos: I, hole: R }), S ? (S = !1, f[I].push(L)) : m = !0); S && f[w].push(L); } } x.length > 0 && (m || (p = f)); } let v; for (let m = 0, x = g.length; m < x; m++) { l = g[m].s, d.push(l), v = p[m]; for (let w = 0, A = v.length; w < A; w++) l.holes.push(v[w].h); } return d; } } class ap { constructor(e) { this.type = "Font", this.data = e; } generateShapes(e, t = 100) { const i = [], r = fN(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 fN(n, e, t) { const i = Array.from(n), r = e / t.resolution, s = (t.boundingBox.yMax - t.boundingBox.yMin + t.underlineThickness) * r, o = []; let a = 0, c = 0; for (let l = 0; l < i.length; l++) { const d = i[l]; if (d === ` `) a = 0, c -= s; else { const h = pN(d, r, a, c, t); a += h.offsetX, o.push(h.path); } } return o; } function pN(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 Wx(); let a, c, l, d, h, f, g, p; if (s.o) { const u = s._cachedOutline || (s._cachedOutline = s.o.split(" ")); for (let y = 0, v = u.length; y < v; ) switch (u[y++]) { case "m": a = u[y++] * e + t, c = u[y++] * e + i, o.moveTo(a, c); break; case "l": a = u[y++] * e + t, c = u[y++] * e + i, o.lineTo(a, c); break; case "q": l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, f = u[y++] * e + i, o.quadraticCurveTo(h, f, l, d); break; case "b": l = u[y++] * e + t, d = u[y++] * e + i, h = u[y++] * e + t, f = u[y++] * e + i, g = u[y++] * e + t, p = u[y++] * e + i, o.bezierCurveTo(h, f, g, p, l, d); break; } } return { offsetX: s.ha * e, path: o }; } ap.prototype.isFont = !0; class mN extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new $n(this.manager); o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(s.withCredentials), o.load(e, function(a) { let c; try { c = JSON.parse(a); } catch { console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), c = JSON.parse(a.substring(65, a.length - 2)); } const l = s.parse(c); t && t(l); }, i, r); } parse(e) { return new ap(e); } } let hc; const lp = { getContext: function() { return hc === void 0 && (hc = new (window.AudioContext || window.webkitAudioContext)()), hc; }, setContext: function(n) { hc = n; } }; class jx extends xn { constructor(e) { super(e); } load(e, t, i, r) { const s = this, o = new $n(this.manager); o.setResponseType("arraybuffer"), o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(a) { try { const c = a.slice(0); lp.getContext().decodeAudioData(c, function(d) { t(d); }); } catch (c) { r ? r(c) : console.error(c), s.manager.itemError(e); } }, i, r); } } class $x extends Al { constructor(e, t, i = 1) { super(void 0, i); const r = new Ue().set(e), s = new Ue().set(t), o = new q(r.r, r.g, r.b), a = new q(s.r, s.g, s.b), c = Math.sqrt(Math.PI), l = c * Math.sqrt(0.75); this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c), this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l); } } $x.prototype.isHemisphereLightProbe = !0; class Zx extends Al { constructor(e, t = 1) { super(void 0, t); const i = new Ue().set(e); this.sh.coefficients[0].set(i.r, i.g, i.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } } Zx.prototype.isAmbientLightProbe = !0; const $g = /* @__PURE__ */ new Xe(), Zg = /* @__PURE__ */ new Xe(); class gN { constructor() { this.type = "StereoCamera", this.aspect = 1, this.eyeSep = 0.064, this.cameraL = new nn(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new nn(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = { focus: null, fov: null, aspect: null, near: null, far: null, zoom: null, eyeSep: null }; } update(e) { const t = this._cache; if (t.focus !== e.focus || t.fov !== e.fov || t.aspect !== e.aspect * this.aspect || t.near !== e.near || t.far !== e.far || t.zoom !== e.zoom || t.eyeSep !== this.eyeSep) { t.focus = e.focus, t.fov = e.fov, t.aspect = e.aspect * this.aspect, t.near = e.near, t.far = e.far, t.zoom = e.zoom, t.eyeSep = this.eyeSep; const r = e.projectionMatrix.clone(), s = t.eyeSep / 2, o = s * t.near / t.focus, a = t.near * Math.tan(As * t.fov * 0.5) / t.zoom; let c, l; Zg.elements[12] = -s, $g.elements[12] = s, c = -a * t.aspect + o, l = a * t.aspect + o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraL.projectionMatrix.copy(r), c = -a * t.aspect - o, l = a * t.aspect - o, r.elements[0] = 2 * t.near / (l - c), r.elements[8] = (l + c) / (l - c), this.cameraR.projectionMatrix.copy(r); } this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Zg), this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($g); } } class Xx { constructor(e = !0) { this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1; } start() { this.startTime = Xg(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0; } stop() { this.getElapsedTime(), this.running = !1, this.autoStart = !1; } getElapsedTime() { return this.getDelta(), this.elapsedTime; } getDelta() { let e = 0; if (this.autoStart && !this.running) return this.start(), 0; if (this.running) { const t = Xg(); e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e; } return e; } } function Xg() { return (typeof performance > "u" ? Date : performance).now(); } const as = /* @__PURE__ */ new q(), Yg = /* @__PURE__ */ new bn(), vN = /* @__PURE__ */ new q(), ls = /* @__PURE__ */ new q(); class yN extends ut { constructor() { super(), this.type = "AudioListener", this.context = lp.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new Xx(); } getInput() { return this.gain; } removeFilter() { return this.filter !== null && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null), this; } getFilter() { return this.filter; } setFilter(e) { return this.filter !== null ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = e, this.gain.connect(this.filter), this.filter.connect(this.context.destination), this; } getMasterVolume() { return this.gain.gain.value; } setMasterVolume(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this; } updateMatrixWorld(e) { super.updateMatrixWorld(e); const t = this.context.listener, i = this.up; if (this.timeDelta = this._clock.getDelta(), this.matrixWorld.decompose(as, Yg, vN), ls.set(0, 0, -1).applyQuaternion(Yg), t.positionX) { const r = this.context.currentTime + this.timeDelta; t.positionX.linearRampToValueAtTime(as.x, r), t.positionY.linearRampToValueAtTime(as.y, r), t.positionZ.linearRampToValueAtTime(as.z, r), t.forwardX.linearRampToValueAtTime(ls.x, r), t.forwardY.linearRampToValueAtTime(ls.y, r), t.forwardZ.linearRampToValueAtTime(ls.z, r), t.upX.linearRampToValueAtTime(i.x, r), t.upY.linearRampToValueAtTime(i.y, r), t.upZ.linearRampToValueAtTime(i.z, r); } else t.setPosition(as.x, as.y, as.z), t.setOrientation(ls.x, ls.y, ls.z, i.x, i.y, i.z); } } class cp extends ut { constructor(e) { super(), this.type = "Audio", this.listener = e, this.context = e.context, this.gain = this.context.createGain(), this.gain.connect(e.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.source = null, this.sourceType = "empty", this._startedAt = 0, this._progress = 0, this._connected = !1, this.filters = []; } getOutput() { return this.gain; } setNodeSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = e, this.connect(), this; } setMediaElementSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaNode", this.source = this.context.createMediaElementSource(e), this.connect(), this; } setMediaStreamSource(e) { return this.hasPlaybackControl = !1, this.sourceType = "mediaStreamNode", this.source = this.context.createMediaStreamSource(e), this.connect(), this; } setBuffer(e) { return this.buffer = e, this.sourceType = "buffer", this.autoplay && this.play(), this; } play(e = 0) { if (this.isPlaying === !0) { console.warn("THREE.Audio: Audio is already playing."); return; } if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } this._startedAt = this.context.currentTime + e; const t = this.context.createBufferSource(); return t.buffer = this.buffer, t.loop = this.loop, t.loopStart = this.loopStart, t.loopEnd = this.loopEnd, t.onended = this.onEnded.bind(this), t.start(this._startedAt, this._progress + this.offset, this.duration), this.isPlaying = !0, this.source = t, this.setDetune(this.detune), this.setPlaybackRate(this.playbackRate), this.connect(); } pause() { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.isPlaying === !0 && (this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate, this.loop === !0 && (this._progress = this._progress % (this.duration || this.buffer.duration)), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this; } stop() { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this._progress = 0, this.source.stop(), this.source.onended = null, this.isPlaying = !1, this; } connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); for (let e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].connect(this.filters[e]); this.filters[this.filters.length - 1].connect(this.getOutput()); } else this.source.connect(this.getOutput()); return this._connected = !0, this; } disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); for (let e = 1, t = this.filters.length; e < t; e++) this.filters[e - 1].disconnect(this.filters[e]); this.filters[this.filters.length - 1].disconnect(this.getOutput()); } else this.source.disconnect(this.getOutput()); return this._connected = !1, this; } getFilters() { return this.filters; } setFilters(e) { return e || (e = []), this._connected === !0 ? (this.disconnect(), this.filters = e.slice(), this.connect()) : this.filters = e.slice(), this; } setDetune(e) { if (this.detune = e, this.source.detune !== void 0) return this.isPlaying === !0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01), this; } getDetune() { return this.detune; } getFilter() { return this.getFilters()[0]; } setFilter(e) { return this.setFilters(e ? [e] : []); } setPlaybackRate(e) { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.playbackRate = e, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01), this; } getPlaybackRate() { return this.playbackRate; } onEnded() { this.isPlaying = !1; } getLoop() { return this.hasPlaybackControl === !1 ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop; } setLoop(e) { if (this.hasPlaybackControl === !1) { console.warn("THREE.Audio: this Audio has no playback control."); return; } return this.loop = e, this.isPlaying === !0 && (this.source.loop = this.loop), this; } setLoopStart(e) { return this.loopStart = e, this; } setLoopEnd(e) { return this.loopEnd = e, this; } getVolume() { return this.gain.gain.value; } setVolume(e) { return this.gain.gain.setTargetAtTime(e, this.context.currentTime, 0.01), this; } } const cs = /* @__PURE__ */ new q(), Jg = /* @__PURE__ */ new bn(), bN = /* @__PURE__ */ new q(), us = /* @__PURE__ */ new q(); class xN extends cp { constructor(e) { super(e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain); } getOutput() { return this.panner; } getRefDistance() { return this.panner.refDistance; } setRefDistance(e) { return this.panner.refDistance = e, this; } getRolloffFactor() { return this.panner.rolloffFactor; } setRolloffFactor(e) { return this.panner.rolloffFactor = e, this; } getDistanceModel() { return this.panner.distanceModel; } setDistanceModel(e) { return this.panner.distanceModel = e, this; } getMaxDistance() { return this.panner.maxDistance; } setMaxDistance(e) { return this.panner.maxDistance = e, this; } setDirectionalCone(e, t, i) { return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = i, this; } updateMatrixWorld(e) { if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return; this.matrixWorld.decompose(cs, Jg, bN), us.set(0, 0, 1).applyQuaternion(Jg); const t = this.panner; if (t.positionX) { const i = this.context.currentTime + this.listener.timeDelta; t.positionX.linearRampToValueAtTime(cs.x, i), t.positionY.linearRampToValueAtTime(cs.y, i), t.positionZ.linearRampToValueAtTime(cs.z, i), t.orientationX.linearRampToValueAtTime(us.x, i), t.orientationY.linearRampToValueAtTime(us.y, i), t.orientationZ.linearRampToValueAtTime(us.z, i); } else t.setPosition(cs.x, cs.y, cs.z), t.setOrientation(us.x, us.y, us.z); } } class Yx { constructor(e, t = 2048) { this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser); } getFrequencyData() { return this.analyser.getByteFrequencyData(this.data), this.data; } getAverageFrequency() { let e = 0; const t = this.getFrequencyData(); for (let i = 0; i < t.length; i++) e += t[i]; return e / t.length; } } class Jx { 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' 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' to the binding when accus differ apply(e) { const t = this.valueSize, i = this.buffer, r = e * t + t, s = this.cumulativeWeight, o = this.cumulativeWeightAdditive, a = this.binding; if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, s < 1) { const c = t * this._origIndex; this._mixBufferRegion( i, r, c, 1 - s, t ); } o > 0 && this._mixBufferRegionAdditive(i, r, this._addIndex * t, 1, t); for (let c = t, l = t + t; c !== l; ++c) if (i[c] !== i[c + t]) { a.setValue(i, r); break; } } // remember the state of the bound property and copy it to both accus saveOriginalState() { const e = this.binding, t = this.buffer, i = this.valueSize, r = i * this._origIndex; e.getValue(t, r); for (let s = i, o = r; s !== o; ++s) t[s] = t[r + s % i]; this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0; } // apply the state previously taken via 'saveOriginalState' to the binding restoreOriginalState() { const e = this.valueSize * 3; this.binding.setValue(this.buffer, e); } _setAdditiveIdentityNumeric() { const e = this._addIndex * this.valueSize, t = e + this.valueSize; for (let i = e; i < t; i++) this.buffer[i] = 0; } _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1; } _setAdditiveIdentityOther() { const e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize; for (let i = 0; i < this.valueSize; i++) this.buffer[t + i] = this.buffer[e + i]; } // mix functions _select(e, t, i, r, s) { if (r >= 0.5) for (let o = 0; o !== s; ++o) e[t + o] = e[i + o]; } _slerp(e, t, i, r) { bn.slerpFlat(e, t, e, t, e, i, r); } _slerpAdditive(e, t, i, r, s) { const o = this._workIndex * s; bn.multiplyQuaternionsFlat(e, o, e, t, e, i), bn.slerpFlat(e, t, e, t, e, o, r); } _lerp(e, t, i, r, s) { const o = 1 - r; for (let a = 0; a !== s; ++a) { const c = t + a; e[c] = e[c] * o + e[i + a] * r; } } _lerpAdditive(e, t, i, r, s) { for (let o = 0; o !== s; ++o) { const a = t + o; e[a] = e[a] + e[i + o] * r; } } } const up = "\\[\\]\\.:\\/", MN = new RegExp("[" + up + "]", "g"), hp = "[^" + up + "]", wN = "[^" + up.replace("\\.", "") + "]", AN = /((?:WC+[\/:])*)/.source.replace("WC", hp), SN = /(WCOD+)?/.source.replace("WCOD", wN), _N = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", hp), TN = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", hp), EN = new RegExp( "^" + AN + SN + _N + TN + "$" ), CN = ["material", "materials", "bones"]; class LN { constructor(e, t, i) { const r = i || mt.parseTrackName(t); this._targetGroup = e, this._bindings = e.subscribe_(t, r); } getValue(e, t) { this.bind(); const i = this._targetGroup.nCachedObjects_, r = this._bindings[i]; r !== void 0 && r.getValue(e, t); } setValue(e, t) { const i = this._bindings; for (let r = this._targetGroup.nCachedObjects_, s = i.length; r !== s; ++r) i[r].setValue(e, t); } bind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t) e[t].bind(); } unbind() { const e = this._bindings; for (let t = this._targetGroup.nCachedObjects_, i = e.length; t !== i; ++t) e[t].unbind(); } } class mt { constructor(e, t, i) { this.path = t, this.parsedPath = i || mt.parseTrackName(t), this.node = mt.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } static create(e, t, i) { return e && e.isAnimationObjectGroup ? new mt.Composite(e, t, i) : new mt(e, t, i); } /** * Replaces spaces with underscores and removes unsupported characters from * node names, to ensure compatibility with parseTrackName(). * * @param {string} name Node name to be sanitized. * @return {string} */ static sanitizeNodeName(e) { return e.replace(/\s/g, "_").replace(MN, ""); } static parseTrackName(e) { const t = EN.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); CN.indexOf(s) !== -1 && (i.nodeName = i.nodeName.substring(0, r), i.objectName = s); } if (i.propertyName === null || i.propertyName.length === 0) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e); return i; } static findNode(e, t) { if (!t || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e; if (e.skeleton) { const i = e.skeleton.getBoneByName(t); if (i !== void 0) return i; } if (e.children) { const i = function(s) { for (let o = 0; o < s.length; o++) { const a = s[o]; if (a.name === t || a.uuid === t) return a; const c = i(a.children); if (c) return c; } return null; }, r = i(e.children); if (r) return r; } return null; } // these are used to "bind" a nonexistent property _getValue_unavailable() { } _setValue_unavailable() { } // Getters _getValue_direct(e, t) { e[t] = this.node[this.propertyName]; } _getValue_array(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) e[t++] = i[r]; } _getValue_arrayElement(e, t) { e[t] = this.resolvedProperty[this.propertyIndex]; } _getValue_toArray(e, t) { this.resolvedProperty.toArray(e, t); } // Direct _setValue_direct(e, t) { this.targetObject[this.propertyName] = e[t]; } _setValue_direct_setNeedsUpdate(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0; } _setValue_direct_setMatrixWorldNeedsUpdate(e, t) { this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; } // EntireArray _setValue_array(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; } _setValue_array_setNeedsUpdate(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; this.targetObject.needsUpdate = !0; } _setValue_array_setMatrixWorldNeedsUpdate(e, t) { const i = this.resolvedProperty; for (let r = 0, s = i.length; r !== s; ++r) i[r] = e[t++]; this.targetObject.matrixWorldNeedsUpdate = !0; } // ArrayElement _setValue_arrayElement(e, t) { this.resolvedProperty[this.propertyIndex] = e[t]; } _setValue_arrayElement_setNeedsUpdate(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0; } _setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) { this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0; } // HasToFromArray _setValue_fromArray(e, t) { this.resolvedProperty.fromArray(e, t); } _setValue_fromArray_setNeedsUpdate(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0; } _setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) { this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0; } _getValue_unbound(e, t) { this.bind(), this.getValue(e, t); } _setValue_unbound(e, t) { this.bind(), this.setValue(e, t); } // create getter / setter pair for a property in the scene graph bind() { let e = this.node; const t = this.parsedPath, i = t.objectName, r = t.propertyName; let s = t.propertyIndex; if (e || (e = mt.findNode(this.rootNode, t.nodeName) || this.rootNode, this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) { console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found."); return; } if (i) { let l = t.objectIndex; switch (i) { case "materials": if (!e.material) { console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); return; } if (!e.material.materials) { console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); return; } e = e.material.materials; break; case "bones": if (!e.skeleton) { console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); return; } e = e.skeleton.bones; for (let d = 0; d < e.length; d++) if (e[d].name === l) { l = d; break; } break; default: if (e[i] === void 0) { console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); return; } e = e[i]; } if (l !== void 0) { if (e[l] === void 0) { console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e); return; } e = e[l]; } } const o = e[r]; if (o === void 0) { const l = t.nodeName; console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + r + " but it wasn't found.", e); return; } let a = this.Versioning.None; this.targetObject = e, e.needsUpdate !== void 0 ? a = this.Versioning.NeedsUpdate : e.matrixWorldNeedsUpdate !== void 0 && (a = this.Versioning.MatrixWorldNeedsUpdate); let c = this.BindingType.Direct; if (s !== void 0) { if (r === "morphTargetInfluences") { if (!e.geometry) { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); return; } if (e.geometry.isBufferGeometry) { if (!e.geometry.morphAttributes) { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); return; } e.morphTargetDictionary[s] !== void 0 && (s = e.morphTargetDictionary[s]); } else { console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.", this); return; } } c = this.BindingType.ArrayElement, this.resolvedProperty = o, this.propertyIndex = s; } else o.fromArray !== void 0 && o.toArray !== void 0 ? (c = this.BindingType.HasFromToArray, this.resolvedProperty = o) : Array.isArray(o) ? (c = this.BindingType.EntireArray, this.resolvedProperty = o) : this.propertyName = r; this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][a]; } unbind() { this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound; } } mt.Composite = LN; mt.prototype.BindingType = { Direct: 0, EntireArray: 1, ArrayElement: 2, HasFromToArray: 3 }; mt.prototype.Versioning = { None: 0, NeedsUpdate: 1, MatrixWorldNeedsUpdate: 2 }; mt.prototype.GetterByBindingType = [ mt.prototype._getValue_direct, mt.prototype._getValue_array, mt.prototype._getValue_arrayElement, mt.prototype._getValue_toArray ]; mt.prototype.SetterByBindingTypeAndVersioning = [ [ // Direct mt.prototype._setValue_direct, mt.prototype._setValue_direct_setNeedsUpdate, mt.prototype._setValue_direct_setMatrixWorldNeedsUpdate ], [ // EntireArray mt.prototype._setValue_array, mt.prototype._setValue_array_setNeedsUpdate, mt.prototype._setValue_array_setMatrixWorldNeedsUpdate ], [ // ArrayElement mt.prototype._setValue_arrayElement, mt.prototype._setValue_arrayElement_setNeedsUpdate, mt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate ], [ // HasToFromArray mt.prototype._setValue_fromArray, mt.prototype._setValue_fromArray_setNeedsUpdate, mt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate ] ]; class Kx { constructor() { this.uuid = Hn(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; const e = {}; this._indicesByUUID = e; for (let i = 0, r = arguments.length; i !== r; ++i) e[arguments[i].uuid] = i; this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; const t = this; this.stats = { objects: { get total() { return t._objects.length; }, get inUse() { return this.total - t.nCachedObjects_; } }, get bindingsPerObject() { return t._bindings.length; } }; } add() { const e = this._objects, t = this._indicesByUUID, i = this._paths, r = this._parsedPaths, s = this._bindings, o = s.length; let a, c = e.length, l = this.nCachedObjects_; for (let d = 0, h = arguments.length; d !== h; ++d) { const f = arguments[d], g = f.uuid; let p = t[g]; if (p === void 0) { p = c++, t[g] = p, e.push(f); for (let u = 0, y = o; u !== y; ++u) s[u].push(new mt(f, i[u], r[u])); } else if (p < l) { a = e[p]; const u = --l, y = e[u]; t[y.uuid] = p, e[p] = y, t[g] = u, e[u] = f; for (let v = 0, m = o; v !== m; ++v) { const x = s[v], w = x[u]; let A = x[p]; x[p] = w, A === void 0 && (A = new mt(f, i[v], r[v])), x[u] = A; } } else e[p] !== a && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes."); } this.nCachedObjects_ = l; } remove() { const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length; let s = this.nCachedObjects_; for (let o = 0, a = arguments.length; o !== a; ++o) { const c = arguments[o], l = c.uuid, d = t[l]; if (d !== void 0 && d >= s) { const h = s++, f = e[h]; t[f.uuid] = d, e[d] = f, t[l] = h, e[h] = c; for (let g = 0, p = r; g !== p; ++g) { const u = i[g], y = u[h], v = u[d]; u[d] = y, u[h] = v; } } } this.nCachedObjects_ = s; } // remove & forget uncache() { const e = this._objects, t = this._indicesByUUID, i = this._bindings, r = i.length; let s = this.nCachedObjects_, o = e.length; for (let a = 0, c = arguments.length; a !== c; ++a) { const l = arguments[a], d = l.uuid, h = t[d]; if (h !== void 0) if (delete t[d], h < s) { const f = --s, g = e[f], p = --o, u = e[p]; t[g.uuid] = h, e[h] = g, t[u.uuid] = f, e[f] = u, e.pop(); for (let y = 0, v = r; y !== v; ++y) { const m = i[y], x = m[f], w = m[p]; m[h] = x, m[f] = w, m.pop(); } } else { const f = --o, g = e[f]; f > 0 && (t[g.uuid] = h), e[h] = g, e.pop(); for (let p = 0, u = r; p !== u; ++p) { const y = i[p]; y[h] = y[f], y.pop(); } } } this.nCachedObjects_ = s; } // Internal interface used by befriended PropertyBinding.Composite: subscribe_(e, t) { const i = this._bindingsIndicesByPath; let r = i[e]; const s = this._bindings; if (r !== void 0) return s[r]; const o = this._paths, a = this._parsedPaths, c = this._objects, l = c.length, d = this.nCachedObjects_, h = new Array(l); r = s.length, i[e] = r, o.push(e), a.push(t), s.push(h); for (let f = d, g = c.length; f !== g; ++f) { const p = c[f]; h[f] = new mt(p, e, t); } return h; } unsubscribe_(e) { const t = this._bindingsIndicesByPath, i = t[e]; if (i !== void 0) { const r = this._paths, s = this._parsedPaths, o = this._bindings, a = o.length - 1, c = o[a], l = e[a]; t[l] = i, o[i] = c, o.pop(), s[i] = s[a], s.pop(), r[i] = r[a], r.pop(); } } } Kx.prototype.isAnimationObjectGroup = !0; class RN { constructor(e, t, i = null, r = t.blendMode) { this._mixer = e, this._clip = t, this._localRoot = i, this.blendMode = r; const s = t.tracks, o = s.length, a = new Array(o), c = { endingStart: gs, endingEnd: gs }; for (let l = 0; l !== o; ++l) { const d = s[l].createInterpolant(null); a[l] = d, d.settings = c; } this._interpolantSettings = c, this._interpolants = a, this._propertyBindings = new Array(o), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = Wb, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0; } // State & Scheduling play() { return this._mixer._activateAction(this), this; } stop() { return this._mixer._deactivateAction(this), this.reset(); } reset() { return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping(); } isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); } // return true when play has been called isScheduled() { return this._mixer._isActiveAction(this); } startAt(e) { return this._startTime = e, this; } setLoop(e, t) { return this.loop = e, this.repetitions = t, this; } // Weight // set the weight stopping any scheduled fading // although .enabled = false yields an effective weight of zero, this // method does *not* change .enabled, because it would be confusing setEffectiveWeight(e) { return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading(); } // return the weight considering fading and .enabled getEffectiveWeight() { return this._effectiveWeight; } fadeIn(e) { return this._scheduleFading(e, 0, 1); } fadeOut(e) { return this._scheduleFading(e, 1, 0); } crossFadeFrom(e, t, i) { if (e.fadeOut(t), this.fadeIn(t), i) { const r = this._clip.duration, s = e._clip.duration, o = s / r, a = r / s; e.warp(1, o, t), this.warp(a, 1, t); } return this; } crossFadeTo(e, t, i) { return e.crossFadeFrom(this, t, i); } stopFading() { const e = this._weightInterpolant; return e !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; } // Time Scale Control // set the time scale stopping any scheduled warping // although .paused = true yields an effective time scale of zero, this // method does *not* change .paused, because it would be confusing setEffectiveTimeScale(e) { return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping(); } // return the time scale considering warping and .paused getEffectiveTimeScale() { return this._effectiveTimeScale; } setDuration(e) { return this.timeScale = this._clip.duration / e, this.stopWarping(); } syncWith(e) { return this.time = e.time, this.timeScale = e.timeScale, this.stopWarping(); } halt(e) { return this.warp(this._effectiveTimeScale, 0, e); } warp(e, t, i) { const r = this._mixer, s = r.time, o = this.timeScale; let a = this._timeScaleInterpolant; a === null && (a = r._lendControlInterpolant(), this._timeScaleInterpolant = a); const c = a.parameterPositions, l = a.sampleValues; return c[0] = s, c[1] = s + i, l[0] = e / o, l[1] = t / o, this; } stopWarping() { const e = this._timeScaleInterpolant; return e !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this; } // Object Accessors getMixer() { return this._mixer; } getClip() { return this._clip; } getRoot() { return this._localRoot || this._mixer._root; } // Interna _update(e, t, i, r) { if (!this.enabled) { this._updateWeight(e); return; } const s = this._startTime; if (s !== null) { const c = (e - s) * i; if (c < 0 || i === 0) return; this._startTime = null, t = i * c; } t *= this._updateTimeScale(e); const o = this._updateTime(t), a = this._updateWeight(e); if (a > 0) { const c = this._interpolants, l = this._propertyBindings; switch (this.blendMode) { case Mf: for (let d = 0, h = c.length; d !== h; ++d) c[d].evaluate(o), l[d].accumulateAdditive(a); break; case fu: default: for (let d = 0, h = c.length; d !== h; ++d) c[d].evaluate(o), l[d].accumulate(r, a); } } } _updateWeight(e) { let t = 0; if (this.enabled) { t = this.weight; const i = this._weightInterpolant; if (i !== null) { const r = i.evaluate(e)[0]; t *= r, e > i.parameterPositions[1] && (this.stopFading(), r === 0 && (this.enabled = !1)); } } return this._effectiveWeight = t, t; } _updateTimeScale(e) { let t = 0; if (!this.paused) { t = this.timeScale; const i = this._timeScaleInterpolant; if (i !== null) { const r = i.evaluate(e)[0]; t *= r, e > i.parameterPositions[1] && (this.stopWarping(), t === 0 ? this.paused = !0 : this.timeScale = t); } } return this._effectiveTimeScale = t, t; } _updateTime(e) { const t = this._clip.duration, i = this.loop; let r = this.time + e, s = this._loopCount; const o = i === jb; if (e === 0) return s === -1 ? r : o && (s & 1) === 1 ? t - r : r; if (i === Hb) { s === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1)); e: { if (r >= t) r = t; else if (r < 0) r = 0; else { this.time = r; break e; } this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this.time = r, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e < 0 ? -1 : 1 }); } } else { if (s === -1 && (e >= 0 ? (s = 0, this._setEndings(!0, this.repetitions === 0, o)) : this._setEndings(this.repetitions === 0, !0, o)), r >= t || r < 0) { const a = Math.floor(r / t); r -= t * a, s += Math.abs(a); const c = this.repetitions - s; if (c <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, r = e > 0 ? t : 0, this.time = r, this._mixer.dispatchEvent({ type: "finished", action: this, direction: e > 0 ? 1 : -1 }); else { if (c === 1) { const l = e < 0; this._setEndings(l, !l, o); } else this._setEndings(!1, !1, o); this._loopCount = s, this.time = r, this._mixer.dispatchEvent({ type: "loop", action: this, loopDelta: a }); } } else this.time = r; if (o && (s & 1) === 1) return t - r; } return r; } _setEndings(e, t, i) { const r = this._interpolantSettings; i ? (r.endingStart = vs, r.endingEnd = vs) : (e ? r.endingStart = this.zeroSlopeAtStart ? vs : gs : r.endingStart = Wa, t ? r.endingEnd = this.zeroSlopeAtEnd ? vs : gs : r.endingEnd = Wa); } _scheduleFading(e, t, i) { const r = this._mixer, s = r.time; let o = this._weightInterpolant; o === null && (o = r._lendControlInterpolant(), this._weightInterpolant = o); const a = o.parameterPositions, c = o.sampleValues; return a[0] = s, c[0] = t, a[1] = s + e, c[1] = i, this; } } class qx extends Kr { constructor(e) { super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1; } _bindAction(e, t) { const i = e._localRoot || this._root, r = e._clip.tracks, s = r.length, o = e._propertyBindings, a = e._interpolants, c = i.uuid, l = this._bindingsByRootAndName; let d = l[c]; d === void 0 && (d = {}, l[c] = d); for (let h = 0; h !== s; ++h) { const f = r[h], g = f.name; let p = d[g]; if (p !== void 0) o[h] = p; else { if (p = o[h], p !== void 0) { p._cacheIndex === null && (++p.referenceCount, this._addInactiveBinding(p, c, g)); continue; } const u = t && t._propertyBindings[h].binding.parsedPath; p = new Jx( mt.create(i, g, u), f.ValueTypeName, f.getValueSize() ), ++p.referenceCount, this._addInactiveBinding(p, c, g), o[h] = p; } a[h].resultBuffer = p.buffer; } } _activateAction(e) { if (!this._isActiveAction(e)) { if (e._cacheIndex === null) { const i = (e._localRoot || this._root).uuid, r = e._clip.uuid, s = this._actionsByClip[r]; this._bindAction( e, s && s.knownActions[0] ), this._addInactiveAction(e, r, i); } const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; s.useCount++ === 0 && (this._lendBinding(s), s.saveOriginalState()); } this._lendAction(e); } } _deactivateAction(e) { if (this._isActiveAction(e)) { const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; --s.useCount === 0 && (s.restoreOriginalState(), this._takeBackBinding(s)); } this._takeBackAction(e); } } // Memory manager _initMemoryManager() { this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; const e = this; this.stats = { actions: { get total() { return e._actions.length; }, get inUse() { return e._nActiveActions; } }, bindings: { get total() { return e._bindings.length; }, get inUse() { return e._nActiveBindings; } }, controlInterpolants: { get total() { return e._controlInterpolants.length; }, get inUse() { return e._nActiveControlInterpolants; } } }; } // Memory management for AnimationAction objects _isActiveAction(e) { const t = e._cacheIndex; return t !== null && t < this._nActiveActions; } _addInactiveAction(e, t, i) { const r = this._actions, s = this._actionsByClip; let o = s[t]; if (o === void 0) o = { knownActions: [e], actionByRoot: {} }, e._byClipCacheIndex = 0, s[t] = o; else { const a = o.knownActions; e._byClipCacheIndex = a.length, a.push(e); } e._cacheIndex = r.length, r.push(e), o.actionByRoot[i] = e; } _removeInactiveAction(e) { const t = this._actions, i = t[t.length - 1], r = e._cacheIndex; i._cacheIndex = r, t[r] = i, t.pop(), e._cacheIndex = null; const s = e._clip.uuid, o = this._actionsByClip, a = o[s], c = a.knownActions, l = c[c.length - 1], d = e._byClipCacheIndex; l._byClipCacheIndex = d, c[d] = l, c.pop(), e._byClipCacheIndex = null; const h = a.actionByRoot, f = (e._localRoot || this._root).uuid; delete h[f], c.length === 0 && delete o[s], this._removeInactiveBindingsForAction(e); } _removeInactiveBindingsForAction(e) { const t = e._propertyBindings; for (let i = 0, r = t.length; i !== r; ++i) { const s = t[i]; --s.referenceCount === 0 && this._removeInactiveBinding(s); } } _lendAction(e) { const t = this._actions, i = e._cacheIndex, r = this._nActiveActions++, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } _takeBackAction(e) { const t = this._actions, i = e._cacheIndex, r = --this._nActiveActions, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } // Memory management for PropertyMixer objects _addInactiveBinding(e, t, i) { const r = this._bindingsByRootAndName, s = this._bindings; let o = r[t]; o === void 0 && (o = {}, r[t] = o), o[i] = e, e._cacheIndex = s.length, s.push(e); } _removeInactiveBinding(e) { const t = this._bindings, i = e.binding, r = i.rootNode.uuid, s = i.path, o = this._bindingsByRootAndName, a = o[r], c = t[t.length - 1], l = e._cacheIndex; c._cacheIndex = l, t[l] = c, t.pop(), delete a[s], Object.keys(a).length === 0 && delete o[r]; } _lendBinding(e) { const t = this._bindings, i = e._cacheIndex, r = this._nActiveBindings++, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } _takeBackBinding(e) { const t = this._bindings, i = e._cacheIndex, r = --this._nActiveBindings, s = t[r]; e._cacheIndex = r, t[r] = e, s._cacheIndex = i, t[i] = s; } // Memory management of Interpolants for weight and time scale _lendControlInterpolant() { const e = this._controlInterpolants, t = this._nActiveControlInterpolants++; let i = e[t]; return i === void 0 && (i = new Yf( new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer ), i.__cacheIndex = t, e[t] = i), i; } _takeBackControlInterpolant(e) { const t = this._controlInterpolants, i = e.__cacheIndex, r = --this._nActiveControlInterpolants, s = t[r]; e.__cacheIndex = r, t[r] = e, s.__cacheIndex = i, t[i] = s; } // return an action for a clip optionally using a custom root target // object (this method allocates a lot of dynamic memory in case a // previously unknown clip/root combination is specified) clipAction(e, t, i) { const r = t || this._root, s = r.uuid; let o = typeof e == "string" ? jo.findByName(r, e) : e; const a = o !== null ? o.uuid : e, c = this._actionsByClip[a]; let l = null; if (i === void 0 && (o !== null ? i = o.blendMode : i = fu), c !== void 0) { const h = c.actionByRoot[s]; if (h !== void 0 && h.blendMode === i) return h; l = c.knownActions[0], o === null && (o = l._clip); } if (o === null) return null; const d = new RN(this, o, t, i); return this._bindAction(d, l), this._addInactiveAction(d, a, s), d; } // get an existing action existingAction(e, t) { const i = t || this._root, r = i.uuid, s = typeof e == "string" ? jo.findByName(i, e) : e, o = s ? s.uuid : e, a = this._actionsByClip[o]; return a !== void 0 && a.actionByRoot[r] || null; } // deactivates all previously scheduled actions stopAllAction() { const e = this._actions, t = this._nActiveActions; for (let i = t - 1; i >= 0; --i) e[i].stop(); return this; } // advance the time and update apply the animation update(e) { e *= this.timeScale; const t = this._actions, i = this._nActiveActions, r = this.time += e, s = Math.sign(e), o = this._accuIndex ^= 1; for (let l = 0; l !== i; ++l) t[l]._update(r, e, s, o); const a = this._bindings, c = this._nActiveBindings; for (let l = 0; l !== c; ++l) a[l].apply(o); return this; } // Allows you to seek to a specific time in an animation. setTime(e) { this.time = 0; for (let t = 0; t < this._actions.length; t++) this._actions[t].time = 0; return this.update(e); } // return this mixer's root target object getRoot() { return this._root; } // free all resources specific to a particular clip uncacheClip(e) { const t = this._actions, i = e.uuid, r = this._actionsByClip, s = r[i]; if (s !== void 0) { const o = s.knownActions; for (let a = 0, c = o.length; a !== c; ++a) { const l = o[a]; this._deactivateAction(l); const d = l._cacheIndex, h = t[t.length - 1]; l._cacheIndex = null, l._byClipCacheIndex = null, h._cacheIndex = d, t[d] = h, t.pop(), this._removeInactiveBindingsForAction(l); } delete r[i]; } } // free all resources specific to a particular root target object uncacheRoot(e) { const t = e.uuid, i = this._actionsByClip; for (const o in i) { const a = i[o].actionByRoot, c = a[t]; c !== void 0 && (this._deactivateAction(c), this._removeInactiveAction(c)); } const r = this._bindingsByRootAndName, s = r[t]; if (s !== void 0) for (const o in s) { const a = s[o]; a.restoreOriginalState(), this._removeInactiveBinding(a); } } // remove a targeted clip from the cache uncacheAction(e, t) { const i = this.existingAction(e, t); i !== null && (this._deactivateAction(i), this._removeInactiveAction(i)); } } qx.prototype._controlInterpolantsResultBuffer = new Float32Array(1); class Fu { constructor(e) { typeof e == "string" && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e; } clone() { return new Fu(this.value.clone === void 0 ? this.value : this.value.clone()); } } class Qx extends Qr { constructor(e, t, i = 1) { super(e, t), this.meshPerAttribute = i; } copy(e) { return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this; } clone(e) { const t = super.clone(e); return t.meshPerAttribute = this.meshPerAttribute, t; } toJSON(e) { const t = super.toJSON(e); return t.isInstancedInterleavedBuffer = !0, t.meshPerAttribute = this.meshPerAttribute, t; } } Qx.prototype.isInstancedInterleavedBuffer = !0; class eM { constructor(e, t, i, r, s) { this.buffer = e, this.type = t, this.itemSize = i, this.elementSize = r, this.count = s, this.version = 0; } set needsUpdate(e) { e === !0 && this.version++; } setBuffer(e) { return this.buffer = e, this; } setType(e, t) { return this.type = e, this.elementSize = t, this; } setItemSize(e) { return this.itemSize = e, this; } setCount(e) { return this.count = e, this; } } eM.prototype.isGLBufferAttribute = !0; class FN { constructor(e, t, i = 0, r = 1 / 0) { this.ray = new qr(e, t), this.near = i, this.far = r, this.camera = null, this.layers = new Cf(), this.params = { Mesh: {}, Line: { threshold: 1 }, LOD: {}, Points: { threshold: 1 }, Sprite: {} }; } set(e, t) { this.ray.set(e, t); } setFromCamera(e, t) { t && t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, 0.5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t && t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type); } intersectObject(e, t = !1, i = []) { return _d(e, this, i, t), i.sort(Kg), i; } intersectObjects(e, t = !1, i = []) { for (let r = 0, s = e.length; r < s; r++) _d(e[r], this, i, t); return i.sort(Kg), i; } } function Kg(n, e) { return n.distance - e.distance; } function _d(n, e, t, i) { if (n.layers.test(e.layers) && n.raycast(e, t), i === !0) { const r = n.children; for (let s = 0, o = r.length; s < o; s++) _d(r[s], e, t, !0); } } class PN { constructor(e = 1, t = 0, i = 0) { return this.radius = e, this.phi = t, this.theta = i, this; } set(e, t, i) { return this.radius = e, this.phi = t, this.theta = i, this; } copy(e) { return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this; } // restrict phi to be betwee EPS and PI-EPS makeSafe() { return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)), this; } setFromVector3(e) { return this.setFromCartesianCoords(e.x, e.y, e.z); } setFromCartesianCoords(e, t, i) { return this.radius = Math.sqrt(e * e + t * t + i * i), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, i), this.phi = Math.acos(gn(t / this.radius, -1, 1))), this; } clone() { return new this.constructor().copy(this); } } class IN { constructor(e = 1, t = 0, i = 0) { return this.radius = e, this.theta = t, this.y = i, this; } set(e, t, i) { return this.radius = e, this.theta = t, this.y = i, this; } copy(e) { return this.radius = e.radius, this.theta = e.theta, this.y = e.y, this; } setFromVector3(e) { return this.setFromCartesianCoords(e.x, e.y, e.z); } setFromCartesianCoords(e, t, i) { return this.radius = Math.sqrt(e * e + i * i), this.theta = Math.atan2(e, i), this.y = t, this; } clone() { return new this.constructor().copy(this); } } const qg = /* @__PURE__ */ new Re(); class oa { constructor(e = new Re(1 / 0, 1 / 0), t = new Re(-1 / 0, -1 / 0)) { this.min = e, this.max = t; } set(e, t) { return this.min.copy(e), this.max.copy(t), this; } setFromPoints(e) { this.makeEmpty(); for (let t = 0, i = e.length; t < i; t++) this.expandByPoint(e[t]); return this; } setFromCenterAndSize(e, t) { const i = qg.copy(t).multiplyScalar(0.5); return this.min.copy(e).sub(i), this.max.copy(e).add(i), this; } clone() { return new this.constructor().copy(this); } copy(e) { return this.min.copy(e.min), this.max.copy(e.max), this; } makeEmpty() { return this.min.x = this.min.y = 1 / 0, this.max.x = this.max.y = -1 / 0, this; } isEmpty() { return this.max.x < this.min.x || this.max.y < this.min.y; } getCenter(e) { return this.isEmpty() ? e.set(0, 0) : e.addVectors(this.min, this.max).multiplyScalar(0.5); } getSize(e) { return this.isEmpty() ? e.set(0, 0) : e.subVectors(this.max, this.min); } expandByPoint(e) { return this.min.min(e), this.max.max(e), this; } expandByVector(e) { return this.min.sub(e), this.max.add(e), this; } expandByScalar(e) { return this.min.addScalar(-e), this.max.addScalar(e), this; } containsPoint(e) { return !(e.x < this.min.x || e.x > this.max.x || e.y < this.min.y || e.y > this.max.y); } containsBox(e) { return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y; } getParameter(e, t) { return t.set( (e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y) ); } intersectsBox(e) { return !(e.max.x < this.min.x || e.min.x > this.max.x || e.max.y < this.min.y || e.min.y > this.max.y); } clampPoint(e, t) { return t.copy(e).clamp(this.min, this.max); } distanceToPoint(e) { return qg.copy(e).clamp(this.min, this.max).sub(e).length(); } intersect(e) { return this.min.max(e.min), this.max.min(e.max), this; } union(e) { return this.min.min(e.min), this.max.max(e.max), this; } translate(e) { return this.min.add(e), this.max.add(e), this; } equals(e) { return e.min.equals(this.min) && e.max.equals(this.max); } } oa.prototype.isBox2 = !0; const Qg = /* @__PURE__ */ new q(), dc = /* @__PURE__ */ new q(); class tM { constructor(e = new q(), t = new q()) { this.start = e, this.end = t; } set(e, t) { return this.start.copy(e), this.end.copy(t), this; } copy(e) { return this.start.copy(e.start), this.end.copy(e.end), this; } getCenter(e) { return e.addVectors(this.start, this.end).multiplyScalar(0.5); } delta(e) { return e.subVectors(this.end, this.start); } distanceSq() { return this.start.distanceToSquared(this.end); } distance() { return this.start.distanceTo(this.end); } at(e, t) { return this.delta(t).multiplyScalar(e).add(this.start); } closestPointToPointParameter(e, t) { Qg.subVectors(e, this.start), dc.subVectors(this.end, this.start); const i = dc.dot(dc); let s = dc.dot(Qg) / i; return t && (s = gn(s, 0, 1)), s; } closestPointToPoint(e, t, i) { const r = this.closestPointToPointParameter(e, t); return this.delta(i).multiplyScalar(r).add(this.start); } applyMatrix4(e) { return this.start.applyMatrix4(e), this.end.applyMatrix4(e), this; } equals(e) { return e.start.equals(this.start) && e.end.equals(this.end); } clone() { return new this.constructor().copy(this); } } class nM extends ut { constructor(e) { super(), this.material = e, this.render = function() { }, this.hasPositions = !1, this.hasNormals = !1, this.hasColors = !1, this.hasUvs = !1, this.positionArray = null, this.normalArray = null, this.colorArray = null, this.uvArray = null, this.count = 0; } } nM.prototype.isImmediateRenderObject = !0; const ev = /* @__PURE__ */ new q(); class ON extends ut { constructor(e, t) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t; const i = new Ke(), r = [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1 ]; for (let o = 0, a = 1, c = 32; o < c; o++, a++) { const l = o / c * Math.PI * 2, d = a / c * Math.PI * 2; r.push( Math.cos(l), Math.sin(l), 1, Math.cos(d), Math.sin(d), 1 ); } i.setAttribute("position", new He(r, 3)); const s = new an({ fog: !1, toneMapped: !1 }); this.cone = new Rn(i, s), this.add(this.cone), this.update(); } dispose() { this.cone.geometry.dispose(), this.cone.material.dispose(); } update() { this.light.updateMatrixWorld(); const e = this.light.distance ? this.light.distance : 1e3, t = e * Math.tan(this.light.angle); this.cone.scale.set(t, t, e), ev.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(ev), this.color !== void 0 ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color); } } const Sr = /* @__PURE__ */ new q(), fc = /* @__PURE__ */ new Xe(), Sh = /* @__PURE__ */ new Xe(); class iM extends Rn { constructor(e) { const t = rM(e), i = new Ke(), r = [], s = [], o = new Ue(0, 0, 1), a = new Ue(0, 1, 0); for (let l = 0; l < t.length; l++) { const d = t[l]; d.parent && d.parent.isBone && (r.push(0, 0, 0), r.push(0, 0, 0), s.push(o.r, o.g, o.b), s.push(a.r, a.g, a.b)); } i.setAttribute("position", new He(r, 3)), i.setAttribute("color", new He(s, 3)); const c = new an({ vertexColors: !0, depthTest: !1, depthWrite: !1, toneMapped: !1, transparent: !0 }); super(i, c), this.type = "SkeletonHelper", this.isSkeletonHelper = !0, this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1; } updateMatrixWorld(e) { const t = this.bones, i = this.geometry, r = i.getAttribute("position"); Sh.copy(this.root.matrixWorld).invert(); for (let s = 0, o = 0; s < t.length; s++) { const a = t[s]; a.parent && a.parent.isBone && (fc.multiplyMatrices(Sh, a.matrixWorld), Sr.setFromMatrixPosition(fc), r.setXYZ(o, Sr.x, Sr.y, Sr.z), fc.multiplyMatrices(Sh, a.parent.matrixWorld), Sr.setFromMatrixPosition(fc), r.setXYZ(o + 1, Sr.x, Sr.y, Sr.z), o += 2); } i.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e); } } function rM(n) { const e = []; n && n.isBone && e.push(n); for (let t = 0; t < n.children.length; t++) e.push.apply(e, rM(n.children[t])); return e; } class DN extends Xt { constructor(e, t, i) { const r = new Ps(t, 4, 2), s = new In({ wireframe: !0, fog: !1, toneMapped: !1 }); super(r, s), this.light = e, this.light.updateMatrixWorld(), this.color = i, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update(); } dispose() { this.geometry.dispose(), this.material.dispose(); } update() { this.color !== void 0 ? this.material.color.set(this.color) : this.material.color.copy(this.light.color); } } const NN = /* @__PURE__ */ new q(), tv = /* @__PURE__ */ new Ue(), nv = /* @__PURE__ */ new Ue(); class BN extends ut { constructor(e, t, i) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i; const r = new Rs(t); r.rotateY(Math.PI * 0.5), this.material = new In({ wireframe: !0, fog: !1, toneMapped: !1 }), this.color === void 0 && (this.material.vertexColors = !0); const s = r.getAttribute("position"), o = new Float32Array(s.count * 3); r.setAttribute("color", new ot(o, 3)), this.add(new Xt(r, this.material)), this.update(); } dispose() { this.children[0].geometry.dispose(), this.children[0].material.dispose(); } update() { const e = this.children[0]; if (this.color !== void 0) this.material.color.set(this.color); else { const t = e.geometry.getAttribute("color"); tv.copy(this.light.color), nv.copy(this.light.groundColor); for (let i = 0, r = t.count; i < r; i++) { const s = i < r / 2 ? tv : nv; t.setXYZ(i, s.r, s.g, s.b); } t.needsUpdate = !0; } e.lookAt(NN.setFromMatrixPosition(this.light.matrixWorld).negate()); } } class sM extends Rn { constructor(e = 10, t = 10, i = 4473924, r = 8947848) { i = new Ue(i), r = new Ue(r); const s = t / 2, o = e / t, a = e / 2, c = [], l = []; for (let f = 0, g = 0, p = -a; f <= t; f++, p += o) { c.push(-a, 0, p, a, 0, p), c.push(p, 0, -a, p, 0, a); const u = f === s ? i : r; u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3, u.toArray(l, g), g += 3; } const d = new Ke(); d.setAttribute("position", new He(c, 3)), d.setAttribute("color", new He(l, 3)); const h = new an({ vertexColors: !0, toneMapped: !1 }); super(d, h), this.type = "GridHelper"; } } class UN extends Rn { constructor(e = 10, t = 16, i = 8, r = 64, s = 4473924, o = 8947848) { s = new Ue(s), o = new Ue(o); const a = [], c = []; for (let h = 0; h <= t; h++) { const f = h / t * (Math.PI * 2), g = Math.sin(f) * e, p = Math.cos(f) * e; a.push(0, 0, 0), a.push(g, 0, p); const u = h & 1 ? s : o; c.push(u.r, u.g, u.b), c.push(u.r, u.g, u.b); } for (let h = 0; h <= i; h++) { const f = h & 1 ? s : o, g = e - e / i * h; for (let p = 0; p < r; p++) { let u = p / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g; a.push(y, 0, v), c.push(f.r, f.g, f.b), u = (p + 1) / r * (Math.PI * 2), y = Math.sin(u) * g, v = Math.cos(u) * g, a.push(y, 0, v), c.push(f.r, f.g, f.b); } } const l = new Ke(); l.setAttribute("position", new He(a, 3)), l.setAttribute("color", new He(c, 3)); const d = new an({ vertexColors: !0, toneMapped: !1 }); super(l, d), this.type = "PolarGridHelper"; } } const iv = /* @__PURE__ */ new q(), pc = /* @__PURE__ */ new q(), rv = /* @__PURE__ */ new q(); class zN extends ut { constructor(e, t, i) { super(), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = i, t === void 0 && (t = 1); let r = new Ke(); r.setAttribute("position", new He([ -t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0 ], 3)); const s = new an({ fog: !1, toneMapped: !1 }); this.lightPlane = new Oi(r, s), this.add(this.lightPlane), r = new Ke(), r.setAttribute("position", new He([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Oi(r, s), this.add(this.targetLine), this.update(); } dispose() { this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose(); } update() { iv.setFromMatrixPosition(this.light.matrixWorld), pc.setFromMatrixPosition(this.light.target.matrixWorld), rv.subVectors(pc, iv), this.lightPlane.lookAt(pc), this.color !== void 0 ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(pc), this.targetLine.scale.z = rv.length(); } } const mc = /* @__PURE__ */ new q(), Bt = /* @__PURE__ */ new hl(); class VN extends Rn { constructor(e) { const t = new Ke(), i = new an({ color: 16777215, vertexColors: !0, toneMapped: !1 }), r = [], s = [], o = {}, a = new Ue(16755200), c = new Ue(16711680), l = new Ue(43775), d = new Ue(16777215), h = new Ue(3355443); f("n1", "n2", a), f("n2", "n4", a), f("n4", "n3", a), f("n3", "n1", a), f("f1", "f2", a), f("f2", "f4", a), f("f4", "f3", a), f("f3", "f1", a), f("n1", "f1", a), f("n2", "f2", a), f("n3", "f3", a), f("n4", "f4", a), f("p", "n1", c), f("p", "n2", c), f("p", "n3", c), f("p", "n4", c), f("u1", "u2", l), f("u2", "u3", l), f("u3", "u1", l), f("c", "t", d), f("p", "c", h), f("cn1", "cn2", h), f("cn3", "cn4", h), f("cf1", "cf2", h), f("cf3", "cf4", h); function f(p, u, y) { g(p, y), g(u, y); } function g(p, u) { r.push(0, 0, 0), s.push(u.r, u.g, u.b), o[p] === void 0 && (o[p] = []), o[p].push(r.length / 3 - 1); } t.setAttribute("position", new He(r, 3)), t.setAttribute("color", new He(s, 3)), super(t, i), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = o, this.update(); } update() { const e = this.geometry, t = this.pointMap, i = 1, r = 1; Bt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), Ht("c", t, e, Bt, 0, 0, -1), Ht("t", t, e, Bt, 0, 0, 1), Ht("n1", t, e, Bt, -i, -r, -1), Ht("n2", t, e, Bt, i, -r, -1), Ht("n3", t, e, Bt, -i, r, -1), Ht("n4", t, e, Bt, i, r, -1), Ht("f1", t, e, Bt, -i, -r, 1), Ht("f2", t, e, Bt, i, -r, 1), Ht("f3", t, e, Bt, -i, r, 1), Ht("f4", t, e, Bt, i, r, 1), Ht("u1", t, e, Bt, i * 0.7, r * 1.1, -1), Ht("u2", t, e, Bt, -i * 0.7, r * 1.1, -1), Ht("u3", t, e, Bt, 0, r * 2, -1), Ht("cf1", t, e, Bt, -i, 0, 1), Ht("cf2", t, e, Bt, i, 0, 1), Ht("cf3", t, e, Bt, 0, -r, 1), Ht("cf4", t, e, Bt, 0, r, 1), Ht("cn1", t, e, Bt, -i, 0, -1), Ht("cn2", t, e, Bt, i, 0, -1), Ht("cn3", t, e, Bt, 0, -r, -1), Ht("cn4", t, e, Bt, 0, r, -1), e.getAttribute("position").needsUpdate = !0; } dispose() { this.geometry.dispose(), this.material.dispose(); } } function Ht(n, e, t, i, r, s, o) { mc.set(r, s, o).unproject(i); const a = e[n]; if (a !== void 0) { const c = t.getAttribute("position"); for (let l = 0, d = a.length; l < d; l++) c.setXYZ(a[l], mc.x, mc.y, mc.z); } } const gc = /* @__PURE__ */ new Nn(); class oM extends Rn { constructor(e, t = 16776960) { const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = new Float32Array(8 * 3), s = new Ke(); s.setIndex(new ot(i, 1)), s.setAttribute("position", new ot(r, 3)), super(s, new an({ color: t, toneMapped: !1 })), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update(); } update(e) { if (e !== void 0 && console.warn("THREE.BoxHelper: .update() has no longer arguments."), this.object !== void 0 && gc.setFromObject(this.object), gc.isEmpty()) return; const t = gc.min, i = gc.max, r = this.geometry.attributes.position, s = r.array; s[0] = i.x, s[1] = i.y, s[2] = i.z, s[3] = t.x, s[4] = i.y, s[5] = i.z, s[6] = t.x, s[7] = t.y, s[8] = i.z, s[9] = i.x, s[10] = t.y, s[11] = i.z, s[12] = i.x, s[13] = i.y, s[14] = t.z, s[15] = t.x, s[16] = i.y, s[17] = t.z, s[18] = t.x, s[19] = t.y, s[20] = t.z, s[21] = i.x, s[22] = t.y, s[23] = t.z, r.needsUpdate = !0, this.geometry.computeBoundingSphere(); } setFromObject(e) { return this.object = e, this.update(), this; } copy(e) { return Rn.prototype.copy.call(this, e), this.object = e.object, this; } } class kN extends Rn { constructor(e, t = 16776960) { const i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), r = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1], s = new Ke(); s.setIndex(new ot(i, 1)), s.setAttribute("position", new He(r, 3)), super(s, new an({ color: t, toneMapped: !1 })), this.box = e, this.type = "Box3Helper", this.geometry.computeBoundingSphere(); } updateMatrixWorld(e) { const t = this.box; t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(0.5), super.updateMatrixWorld(e)); } } class GN extends Oi { constructor(e, t = 1, i = 16776960) { const r = i, s = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0], o = new Ke(); o.setAttribute("position", new He(s, 3)), o.computeBoundingSphere(), super(o, new an({ color: r, toneMapped: !1 })), this.type = "PlaneHelper", this.plane = e, this.size = t; const a = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1], c = new Ke(); c.setAttribute("position", new He(a, 3)), c.computeBoundingSphere(), this.add(new Xt(c, new In({ color: r, opacity: 0.2, transparent: !0, depthWrite: !1, toneMapped: !1 }))); } updateMatrixWorld(e) { let t = -this.plane.constant; Math.abs(t) < 1e-8 && (t = 1e-8), this.scale.set(0.5 * this.size, 0.5 * this.size, t), this.children[0].material.side = t < 0 ? jt : Hr, this.lookAt(this.plane.normal), super.updateMatrixWorld(e); } } const sv = /* @__PURE__ */ new q(); let vc, _h; class HN extends ut { // dir is assumed to be normalized constructor(e = new q(0, 0, 1), t = new q(0, 0, 0), i = 1, r = 16776960, s = i * 0.2, o = s * 0.2) { super(), this.type = "ArrowHelper", vc === void 0 && (vc = new Ke(), vc.setAttribute("position", new He([0, 0, 0, 0, 1, 0], 3)), _h = new $r(0, 0.5, 1, 5, 1), _h.translate(0, -0.5, 0)), this.position.copy(t), this.line = new Oi(vc, new an({ color: r, toneMapped: !1 })), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new Xt(_h, new In({ color: r, toneMapped: !1 })), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(i, s, o); } setDirection(e) { if (e.y > 0.99999) this.quaternion.set(0, 0, 0, 1); else if (e.y < -0.99999) this.quaternion.set(1, 0, 0, 0); else { sv.set(e.z, 0, -e.x).normalize(); const t = Math.acos(e.y); this.quaternion.setFromAxisAngle(sv, t); } } setLength(e, t = e * 0.2, i = t * 0.2) { this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(i, t, i), this.cone.position.y = e, this.cone.updateMatrix(); } setColor(e) { this.line.material.color.set(e), this.cone.material.color.set(e); } copy(e) { return super.copy(e, !1), this.line.copy(e.line), this.cone.copy(e.cone), this; } } class aM extends Rn { constructor(e = 1) { const t = [ 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e ], i = [ 1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1 ], r = new Ke(); r.setAttribute("position", new He(t, 3)), r.setAttribute("color", new He(i, 3)); const s = new an({ vertexColors: !0, toneMapped: !1 }); super(r, s), this.type = "AxesHelper"; } setColors(e, t, i) { const r = new Ue(), s = this.geometry.attributes.color.array; return r.set(e), r.toArray(s, 0), r.toArray(s, 3), r.set(t), r.toArray(s, 6), r.toArray(s, 9), r.set(i), r.toArray(s, 12), r.toArray(s, 15), this.geometry.attributes.color.needsUpdate = !0, this; } dispose() { this.geometry.dispose(), this.material.dispose(); } } const lM = new Float32Array(1), WN = new Int32Array(lM.buffer); class jN { // Converts float32 to float16 (stored as uint16 value). static toHalfFloat(e) { lM[0] = e; const t = WN[0]; let i = t >> 16 & 32768, r = t >> 12 & 2047; const s = t >> 23 & 255; return s < 103 ? i : s > 142 ? (i |= 31744, i |= (s == 255 ? 0 : 1) && t & 8388607, i) : s < 113 ? (r |= 2048, i |= (r >> 114 - s) + (r >> 113 - s & 1), i) : (i |= s - 112 << 10 | r >> 1, i += r & 1, i); } } const bo = 4, Nr = 8, Mi = Math.pow(2, Nr), cM = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582], uM = Nr - bo + 1 + cM.length, lo = 20, Ti = { [Cn]: 0, [Cs]: 1, [mu]: 2, [Af]: 3, [Sf]: 4, [_f]: 5, [pu]: 6 }, hs = new In({ side: jt, depthWrite: !1, depthTest: !1 }), $N = new Xt(new sr(), hs), Th = /* @__PURE__ */ new sa(), { _lodPlanes: Ma, _sizeLods: ov, _sigmas: yc } = /* @__PURE__ */ YN(), av = /* @__PURE__ */ new Ue(); let Eh = null; const ds = (1 + Math.sqrt(5)) / 2, co = 1 / ds, lv = [ /* @__PURE__ */ new q(1, 1, 1), /* @__PURE__ */ new q(-1, 1, 1), /* @__PURE__ */ new q(1, 1, -1), /* @__PURE__ */ new q(-1, 1, -1), /* @__PURE__ */ new q(0, ds, co), /* @__PURE__ */ new q(0, ds, -co), /* @__PURE__ */ new q(co, 0, ds), /* @__PURE__ */ new q(-co, 0, ds), /* @__PURE__ */ new q(ds, co, 0), /* @__PURE__ */ new q(-ds, co, 0) ]; function cv(n) { const e = Math.max(n.r, n.g, n.b), t = Math.min(Math.max(Math.ceil(Math.log2(e)), -128), 127); return n.multiplyScalar(Math.pow(2, -t)), (t + 128) / 255; } class ZN { constructor(e) { this._renderer = e, this._pingPongRenderTarget = null, this._blurMaterial = JN(lo), this._equirectShader = null, this._cubemapShader = null, this._compileMaterial(this._blurMaterial); } /** * Generates a PMREM from a supplied Scene, which can be faster than using an * image if networking bandwidth is low. Optional sigma specifies a blur radius * in radians to be applied to the scene before PMREM generation. Optional near * and far planes ensure the scene is rendered in its entirety (the cubeCamera * is placed at the origin). */ fromScene(e, t = 0, i = 0.1, r = 100) { Eh = this._renderer.getRenderTarget(); const s = this._allocateTargets(); return this._sceneToCubeUV(e, i, r, s), t > 0 && this._blur(s, 0, 0, t), this._applyPMREM(s), this._cleanup(s), s; } /** * Generates a PMREM from an equirectangular texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), * as this matches best with the 256 x 256 cubemap output. */ fromEquirectangular(e) { return this._fromTexture(e); } /** * Generates a PMREM from an cubemap texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, * as this matches best with the 256 x 256 cubemap output. */ fromCubemap(e) { return this._fromTexture(e); } /** * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ compileCubemapShader() { this._cubemapShader === null && (this._cubemapShader = dv(), this._compileMaterial(this._cubemapShader)); } /** * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ compileEquirectangularShader() { this._equirectShader === null && (this._equirectShader = hv(), this._compileMaterial(this._equirectShader)); } /** * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on * one of them will cause any others to also become unusable. */ dispose() { this._blurMaterial.dispose(), this._cubemapShader !== null && this._cubemapShader.dispose(), this._equirectShader !== null && this._equirectShader.dispose(); for (let e = 0; e < Ma.length; e++) Ma[e].dispose(); } // private interface _cleanup(e) { this._pingPongRenderTarget.dispose(), this._renderer.setRenderTarget(Eh), e.scissorTest = !1, bc(e, 0, 0, e.width, e.height); } _fromTexture(e) { Eh = this._renderer.getRenderTarget(); const t = this._allocateTargets(e); return this._textureToCubeUV(e, t), this._applyPMREM(t), this._cleanup(t), t; } _allocateTargets(e) { const t = { magFilter: $t, minFilter: $t, generateMipmaps: !1, type: Ts, format: ob, encoding: XN(e) ? e.encoding : mu, depthBuffer: !1 }, i = uv(t); return i.depthBuffer = !e, this._pingPongRenderTarget = uv(t), i; } _compileMaterial(e) { const t = new Xt(Ma[0], e); this._renderer.compile(t, Th); } _sceneToCubeUV(e, t, i, r) { const a = new nn(90, 1, t, i), c = [1, -1, 1, 1, 1, 1], l = [1, 1, 1, -1, -1, -1], d = this._renderer, h = d.autoClear, f = d.outputEncoding, g = d.toneMapping; d.getClearColor(av), d.toneMapping = Ir, d.outputEncoding = Cn, d.autoClear = !1; let p = !1; const u = e.background; if (u) { if (u.isColor) { hs.color.copy(u).convertSRGBToLinear(), e.background = null; const y = cv(hs.color); hs.opacity = y, p = !0; } } else { hs.color.copy(av).convertSRGBToLinear(); const y = cv(hs.color); hs.opacity = y, p = !0; } for (let y = 0; y < 6; y++) { const v = y % 3; v == 0 ? (a.up.set(0, c[y], 0), a.lookAt(l[y], 0, 0)) : v == 1 ? (a.up.set(0, 0, c[y]), a.lookAt(0, l[y], 0)) : (a.up.set(0, c[y], 0), a.lookAt(0, 0, l[y])), bc( r, v * Mi, y > 2 ? Mi : 0, Mi, Mi ), d.setRenderTarget(r), p && d.render($N, a), d.render(e, a); } d.toneMapping = g, d.outputEncoding = f, d.autoClear = h; } _textureToCubeUV(e, t) { const i = this._renderer; e.isCubeTexture ? this._cubemapShader == null && (this._cubemapShader = dv()) : this._equirectShader == null && (this._equirectShader = hv()); const r = e.isCubeTexture ? this._cubemapShader : this._equirectShader, s = new Xt(Ma[0], r), o = r.uniforms; o.envMap.value = e, e.isCubeTexture || o.texelSize.value.set(1 / e.image.width, 1 / e.image.height), o.inputEncoding.value = Ti[e.encoding], o.outputEncoding.value = Ti[t.texture.encoding], bc(t, 0, 0, 3 * Mi, 2 * Mi), i.setRenderTarget(t), i.render(s, Th); } _applyPMREM(e) { const t = this._renderer, i = t.autoClear; t.autoClear = !1; for (let r = 1; r < uM; r++) { const s = Math.sqrt(yc[r] * yc[r] - yc[r - 1] * yc[r - 1]), o = lv[(r - 1) % lv.length]; this._blur(e, r - 1, r, s, o); } t.autoClear = i; } /** * This is a two-pass Gaussian blur for a cubemap. Normally this is done * vertically and horizontally, but this breaks down on a cube. Here we apply * the blur latitudinally (around the poles), and then longitudinally (towards * the poles) to approximate the orthogonally-separable blur. It is least * accurate at the poles, but still does a decent job. */ _blur(e, t, i, r, s) { const o = this._pingPongRenderTarget; this._halfBlur( e, o, t, i, r, "latitudinal", s ), this._halfBlur( o, e, i, i, r, "longitudinal", s ); } _halfBlur(e, t, i, r, s, o, a) { const c = this._renderer, l = this._blurMaterial; o !== "latitudinal" && o !== "longitudinal" && console.error( "blur direction must be either latitudinal or longitudinal!" ); const d = 3, h = new Xt(Ma[r], l), f = l.uniforms, g = ov[i] - 1, p = isFinite(s) ? Math.PI / (2 * g) : 2 * Math.PI / (2 * lo - 1), u = s / p, y = isFinite(s) ? 1 + Math.floor(d * u) : lo; y > lo && console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${lo}`); const v = []; let m = 0; for (let M = 0; M < lo; ++M) { const R = M / u, L = Math.exp(-R * R / 2); v.push(L), M == 0 ? m += L : M < y && (m += 2 * L); } for (let M = 0; M < v.length; M++) v[M] = v[M] / m; f.envMap.value = e.texture, f.samples.value = y, f.weights.value = v, f.latitudinal.value = o === "latitudinal", a && (f.poleAxis.value = a), f.dTheta.value = p, f.mipInt.value = Nr - i, f.inputEncoding.value = Ti[e.texture.encoding], f.outputEncoding.value = Ti[e.texture.encoding]; const x = ov[r], w = 3 * Math.max(0, Mi - 2 * x), A = (r === 0 ? 0 : 2 * Mi) + 2 * x * (r > Nr - bo ? r - Nr + bo : 0); bc(t, w, A, 3 * x, 2 * x), c.setRenderTarget(t), c.render(h, Th); } } function XN(n) { return n === void 0 || n.type !== Ts ? !1 : n.encoding === Cn || n.encoding === Cs || n.encoding === pu; } function YN() { const n = [], e = [], t = []; let i = Nr; for (let r = 0; r < uM; r++) { const s = Math.pow(2, i); e.push(s); let o = 1 / s; r > Nr - bo ? o = cM[r - Nr + bo - 1] : r == 0 && (o = 0), t.push(o); const a = 1 / (s - 1), c = -a / 2, l = 1 + a / 2, d = [c, c, l, c, l, l, c, c, l, l, c, l], h = 6, f = 6, g = 3, p = 2, u = 1, y = new Float32Array(g * f * h), v = new Float32Array(p * f * h), m = new Float32Array(u * f * h); for (let w = 0; w < h; w++) { const A = w % 3 * 2 / 3 - 1, M = w > 2 ? 0 : -1, R = [ A, M, 0, A + 2 / 3, M, 0, A + 2 / 3, M + 1, 0, A, M, 0, A + 2 / 3, M + 1, 0, A, M + 1, 0 ]; y.set(R, g * f * w), v.set(d, p * f * w); const L = [w, w, w, w, w, w]; m.set(L, u * f * w); } const x = new Ke(); x.setAttribute("position", new ot(y, g)), x.setAttribute("uv", new ot(v, p)), x.setAttribute("faceIndex", new ot(m, u)), n.push(x), i > bo && i--; } return { _lodPlanes: n, _sizeLods: e, _sigmas: t }; } function uv(n) { const e = new fi(3 * Mi, 3 * Mi, n); return e.texture.mapping = ea, e.texture.name = "PMREM.cubeUv", e.scissorTest = !0, e; } function bc(n, e, t, i, r) { n.viewport.set(e, t, i, r), n.scissor.set(e, t, i, r); } function JN(n) { const e = new Float32Array(n), t = new q(0, 1, 0); return new ra({ name: "SphericalGaussianBlur", defines: { n }, uniforms: { envMap: { value: null }, samples: { value: 1 }, weights: { value: e }, latitudinal: { value: !1 }, dTheta: { value: 0 }, mipInt: { value: 0 }, poleAxis: { value: t }, inputEncoding: { value: Ti[Cn] }, outputEncoding: { value: Ti[Cn] } }, vertexShader: dp(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; ${fp()} #define ENVMAP_TYPE_CUBE_UV #include 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: tr, depthTest: !1, depthWrite: !1 }); } function hv() { const n = new Re(1, 1); return new ra({ name: "EquirectangularToCubeUV", uniforms: { envMap: { value: null }, texelSize: { value: n }, inputEncoding: { value: Ti[Cn] }, outputEncoding: { value: Ti[Cn] } }, vertexShader: dp(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform vec2 texelSize; ${fp()} #include 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: tr, depthTest: !1, depthWrite: !1 }); } function dv() { return new ra({ name: "CubemapToCubeUV", uniforms: { envMap: { value: null }, inputEncoding: { value: Ti[Cn] }, outputEncoding: { value: Ti[Cn] } }, vertexShader: dp(), fragmentShader: ( /* glsl */ ` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform samplerCube envMap; ${fp()} void main() { gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb; gl_FragColor = linearToOutputTexel( gl_FragColor ); } ` ), blending: tr, depthTest: !1, depthWrite: !1 }); } function dp() { return ( /* glsl */ ` precision mediump float; precision mediump int; attribute vec3 position; attribute vec2 uv; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } ` ); } function fp() { return ( /* glsl */ ` uniform int inputEncoding; uniform int outputEncoding; #include vec4 inputTexelToLinear( vec4 value ) { if ( inputEncoding == 0 ) { return value; } else if ( inputEncoding == 1 ) { return sRGBToLinear( value ); } else if ( inputEncoding == 2 ) { return RGBEToLinear( value ); } else if ( inputEncoding == 3 ) { return RGBMToLinear( value, 7.0 ); } else if ( inputEncoding == 4 ) { return RGBMToLinear( value, 16.0 ); } else if ( inputEncoding == 5 ) { return RGBDToLinear( value, 256.0 ); } else { return GammaToLinear( value, 2.2 ); } } vec4 linearToOutputTexel( vec4 value ) { if ( outputEncoding == 0 ) { return value; } else if ( outputEncoding == 1 ) { return LinearTosRGB( value ); } else if ( outputEncoding == 2 ) { return LinearToRGBE( value ); } else if ( outputEncoding == 3 ) { return LinearToRGBM( value, 7.0 ); } else if ( outputEncoding == 4 ) { return LinearToRGBM( value, 16.0 ); } else if ( outputEncoding == 5 ) { return LinearToRGBD( value, 256.0 ); } else { return LinearToGamma( value, 2.2 ); } } vec4 envMapTexelToLinear( vec4 color ) { return inputTexelToLinear( color ); } ` ); } const KN = 0, qN = 1, QN = 0, eB = 1, tB = 2; function nB(n) { return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), n; } function iB(n = []) { return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), n.isMultiMaterial = !0, n.materials = n, n.clone = function() { return n.slice(); }, n; } function rB(n, e) { return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new ia(n, e); } function sB(n) { return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new gl(n); } function oB(n, e) { return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new ia(n, e); } function aB(n) { return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new es(n); } function lB(n) { return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new es(n); } function cB(n) { return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new es(n); } function uB(n, e, t) { return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new q(n, e, t); } function hB(n, e) { return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."), new ot(n, e).setUsage(Fo); } function dB(n, e) { return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new ix(n, e); } function fB(n, e) { return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new rx(n, e); } function pB(n, e) { return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new sx(n, e); } function mB(n, e) { return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new ox(n, e); } function gB(n, e) { return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new gu(n, e); } function vB(n, e) { return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new ax(n, e); } function yB(n, e) { return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new vu(n, e); } function bB(n, e) { return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new He(n, e); } function xB(n, e) { return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new cx(n, e); } jn.create = function(n, e) { return console.log("THREE.Curve.create() has been deprecated"), n.prototype = Object.create(jn.prototype), n.prototype.constructor = n, n.prototype.getPoint = e, n; }; Ja.prototype.fromPoints = function(n) { return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(n); }; function MB(n) { return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new aM(n); } function wB(n, e) { return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new oM(n, e); } function AB(n, e) { return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new Rn(new Of(n.geometry), new an({ color: e !== void 0 ? e : 16777215 })); } sM.prototype.setColors = function() { console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead."); }; iM.prototype.update = function() { console.error("THREE.SkeletonHelper: update() no longer needs to be called."); }; function SB(n, e) { return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new Rn(new kf(n.geometry), new an({ color: e !== void 0 ? e : 16777215 })); } xn.prototype.extractUrlBase = function(n) { return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), ir.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 _B(n) { return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new $n(n); } function TB(n) { return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new Bx(n); } oa.prototype.center = function(n) { return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(n); }; oa.prototype.empty = function() { return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; oa.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; oa.prototype.size = function(n) { return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(n); }; Nn.prototype.center = function(n) { return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(n); }; Nn.prototype.empty = function() { return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; Nn.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; Nn.prototype.isIntersectionSphere = function(n) { return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n); }; Nn.prototype.size = function(n) { return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(n); }; pr.prototype.empty = function() { return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."), this.isEmpty(); }; dl.prototype.setFromMatrix = function(n) { return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."), this.setFromProjectionMatrix(n); }; tM.prototype.center = function(n) { return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(n); }; rn.prototype.flattenToArrayOffset = function(n, e) { return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e); }; rn.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), n.applyMatrix3(this); }; rn.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix3: .multiplyVector3Array() has been removed."); }; rn.prototype.applyToBufferAttribute = function(n) { return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."), n.applyMatrix3(this); }; rn.prototype.applyToVector3Array = function() { console.error("THREE.Matrix3: .applyToVector3Array() has been removed."); }; rn.prototype.getInverse = function(n) { return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert(); }; Xe.prototype.extractPosition = function(n) { return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(n); }; Xe.prototype.flattenToArrayOffset = function(n, e) { return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(n, e); }; Xe.prototype.getPosition = function() { return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), new q().setFromMatrixColumn(this, 3); }; Xe.prototype.setRotationFromQuaternion = function(n) { return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(n); }; Xe.prototype.multiplyToArray = function() { console.warn("THREE.Matrix4: .multiplyToArray() has been removed."); }; Xe.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; Xe.prototype.multiplyVector4 = function(n) { return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; Xe.prototype.multiplyVector3Array = function() { console.error("THREE.Matrix4: .multiplyVector3Array() has been removed."); }; Xe.prototype.rotateAxis = function(n) { console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), n.transformDirection(this); }; Xe.prototype.crossVector = function(n) { return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; Xe.prototype.translate = function() { console.error("THREE.Matrix4: .translate() has been removed."); }; Xe.prototype.rotateX = function() { console.error("THREE.Matrix4: .rotateX() has been removed."); }; Xe.prototype.rotateY = function() { console.error("THREE.Matrix4: .rotateY() has been removed."); }; Xe.prototype.rotateZ = function() { console.error("THREE.Matrix4: .rotateZ() has been removed."); }; Xe.prototype.rotateByAxis = function() { console.error("THREE.Matrix4: .rotateByAxis() has been removed."); }; Xe.prototype.applyToBufferAttribute = function(n) { return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."), n.applyMatrix4(this); }; Xe.prototype.applyToVector3Array = function() { console.error("THREE.Matrix4: .applyToVector3Array() has been removed."); }; Xe.prototype.makeFrustum = function(n, e, t, i, r, s) { return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(n, e, i, t, r, s); }; Xe.prototype.getInverse = function(n) { return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."), this.copy(n).invert(); }; wi.prototype.isIntersectionLine = function(n) { return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(n); }; bn.prototype.multiplyVector3 = function(n) { return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), n.applyQuaternion(this); }; bn.prototype.inverse = function() { return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."), this.invert(); }; qr.prototype.isIntersectionBox = function(n) { return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(n); }; qr.prototype.isIntersectionPlane = function(n) { return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(n); }; qr.prototype.isIntersectionSphere = function(n) { return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(n); }; Zt.prototype.area = function() { return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea(); }; Zt.prototype.barycoordFromPoint = function(n, e) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(n, e); }; Zt.prototype.midpoint = function(n) { return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(n); }; Zt.prototypenormal = function(n) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(n); }; Zt.prototype.plane = function(n) { return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(n); }; Zt.barycoordFromPoint = function(n, e, t, i, r) { return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), Zt.getBarycoord(n, e, t, i, r); }; Zt.normal = function(n, e, t, i) { return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), Zt.getNormal(n, e, t, i); }; Dr.prototype.extractAllPoints = function(n) { return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(n); }; Dr.prototype.extrude = function(n) { return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new mi(this, n); }; Dr.prototype.makeGeometry = function(n) { return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new Fs(this, n); }; Re.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; Re.prototype.distanceToManhattan = function(n) { return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n); }; Re.prototype.lengthManhattan = function() { return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; q.prototype.setEulerFromRotationMatrix = function() { console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead."); }; q.prototype.setEulerFromQuaternion = function() { console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead."); }; q.prototype.getPositionFromMatrix = function(n) { return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(n); }; q.prototype.getScaleFromMatrix = function(n) { return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(n); }; q.prototype.getColumnFromMatrix = function(n, e) { return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(e, n); }; q.prototype.applyProjection = function(n) { return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(n); }; q.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; q.prototype.distanceToManhattan = function(n) { return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(n); }; q.prototype.lengthManhattan = function() { return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; xt.prototype.fromAttribute = function(n, e, t) { return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(n, e, t); }; xt.prototype.lengthManhattan = function() { return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength(); }; ut.prototype.getChildByName = function(n) { return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(n); }; ut.prototype.renderDepth = function() { console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead."); }; ut.prototype.translate = function(n, e) { return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, n); }; ut.prototype.getWorldRotation = function() { console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead."); }; ut.prototype.applyMatrix = function(n) { return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n); }; Object.defineProperties(ut.prototype, { eulerOrder: { get: function() { return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order; }, set: function(n) { console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = n; } }, useQuaternion: { get: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default."); }, set: function() { console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default."); } } }); Xt.prototype.setDrawMode = function() { console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary."); }; Object.defineProperties(Xt.prototype, { drawMode: { get: function() { return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."), $b; }, set: function() { console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary."); } } }); vl.prototype.initBones = function() { console.error("THREE.SkinnedMesh: initBones() has been removed."); }; nn.prototype.setLens = function(n, e) { console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), e !== void 0 && (this.filmGauge = e), this.setFocalLength(n); }; Object.defineProperties(gi.prototype, { onlyShadow: { set: function() { console.warn("THREE.Light: .onlyShadow has been removed."); } }, shadowCameraFov: { set: function(n) { console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = n; } }, shadowCameraLeft: { set: function(n) { console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = n; } }, shadowCameraRight: { set: function(n) { console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = n; } }, shadowCameraTop: { set: function(n) { console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = n; } }, shadowCameraBottom: { set: function(n) { console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = n; } }, shadowCameraNear: { set: function(n) { console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = n; } }, shadowCameraFar: { set: function(n) { console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = n; } }, shadowCameraVisible: { set: function() { console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead."); } }, shadowBias: { set: function(n) { console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = n; } }, shadowDarkness: { set: function() { console.warn("THREE.Light: .shadowDarkness has been removed."); } }, shadowMapWidth: { set: function(n) { console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = n; } }, shadowMapHeight: { set: function(n) { console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = n; } } }); Object.defineProperties(ot.prototype, { length: { get: function() { return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."), this.array.length; } }, dynamic: { get: function() { return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.usage === Fo; }, set: function() { console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."), this.setUsage(Fo); } } }); ot.prototype.setDynamic = function(n) { return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Fo : Ro), this; }; ot.prototype.copyIndicesArray = function() { console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed."); }, ot.prototype.setArray = function() { console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; Ke.prototype.addIndex = function(n) { console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(n); }; Ke.prototype.addAttribute = function(n, e) { return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."), !(e && e.isBufferAttribute) && !(e && e.isInterleavedBufferAttribute) ? (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."), this.setAttribute(n, new ot(arguments[1], arguments[2]))) : n === "index" ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), this.setIndex(e), this) : this.setAttribute(n, e); }; Ke.prototype.addDrawCall = function(n, e, t) { t !== void 0 && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(n, e); }; Ke.prototype.clearDrawCalls = function() { console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups(); }; Ke.prototype.computeOffsets = function() { console.warn("THREE.BufferGeometry: .computeOffsets() has been removed."); }; Ke.prototype.removeAttribute = function(n) { return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."), this.deleteAttribute(n); }; Ke.prototype.applyMatrix = function(n) { return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(n); }; Object.defineProperties(Ke.prototype, { drawcalls: { get: function() { return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."), this.groups; } }, offsets: { get: function() { return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."), this.groups; } } }); Qr.prototype.setDynamic = function(n) { return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."), this.setUsage(n === !0 ? Fo : Ro), this; }; Qr.prototype.setArray = function() { console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers"); }; mi.prototype.getArrays = function() { console.error("THREE.ExtrudeGeometry: .getArrays() has been removed."); }; mi.prototype.addShapeList = function() { console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed."); }; mi.prototype.addShape = function() { console.error("THREE.ExtrudeGeometry: .addShape() has been removed."); }; wu.prototype.dispose = function() { console.error("THREE.Scene: .dispose() has been removed."); }; Fu.prototype.onUpdate = function() { return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this; }; Object.defineProperties(tn.prototype, { wrapAround: { get: function() { console.warn("THREE.Material: .wrapAround has been removed."); }, set: function() { console.warn("THREE.Material: .wrapAround has been removed."); } }, overdraw: { get: function() { console.warn("THREE.Material: .overdraw has been removed."); }, set: function() { console.warn("THREE.Material: .overdraw has been removed."); } }, wrapRGB: { get: function() { return console.warn("THREE.Material: .wrapRGB has been removed."), new Ue(); } }, shading: { get: function() { console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."); }, set: function(n) { console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = n === yf; } }, stencilMask: { get: function() { return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask; }, set: function(n) { console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."), this.stencilFuncMask = n; } } }); Object.defineProperties(or.prototype, { derivatives: { get: function() { return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives; }, set: function(n) { console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = n; } } }); wt.prototype.clearTarget = function(n, e, t, i) { console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."), this.setRenderTarget(n), this.clear(e, t, i); }; wt.prototype.animate = function(n) { console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."), this.setAnimationLoop(n); }; wt.prototype.getCurrentRenderTarget = function() { return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget(); }; wt.prototype.getMaxAnisotropy = function() { return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy(); }; wt.prototype.getPrecision = function() { return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision; }; wt.prototype.resetGLState = function() { return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset(); }; wt.prototype.supportsFloatTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float"); }; wt.prototype.supportsHalfFloatTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float"); }; wt.prototype.supportsStandardDerivatives = function() { return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives"); }; wt.prototype.supportsCompressedTextureS3TC = function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc"); }; wt.prototype.supportsCompressedTexturePVRTC = function() { return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc"); }; wt.prototype.supportsBlendMinMax = function() { return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax"); }; wt.prototype.supportsVertexTextures = function() { return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures; }; wt.prototype.supportsInstancedArrays = function() { return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays"); }; wt.prototype.enableScissorTest = function(n) { console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(n); }; wt.prototype.initMaterial = function() { console.warn("THREE.WebGLRenderer: .initMaterial() has been removed."); }; wt.prototype.addPrePlugin = function() { console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed."); }; wt.prototype.addPostPlugin = function() { console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed."); }; wt.prototype.updateShadowMap = function() { console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed."); }; wt.prototype.setFaceCulling = function() { console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed."); }; wt.prototype.allocTextureUnit = function() { console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed."); }; wt.prototype.setTexture = function() { console.warn("THREE.WebGLRenderer: .setTexture() has been removed."); }; wt.prototype.setTexture2D = function() { console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed."); }; wt.prototype.setTextureCube = function() { console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed."); }; wt.prototype.getActiveMipMapLevel = function() { return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."), this.getActiveMipmapLevel(); }; Object.defineProperties(wt.prototype, { shadowMapEnabled: { get: function() { return this.shadowMap.enabled; }, set: function(n) { console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = n; } }, shadowMapType: { get: function() { return this.shadowMap.type; }, set: function(n) { console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = n; } }, shadowMapCullFace: { get: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead."); }, set: function() { console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead."); } }, context: { get: function() { return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."), this.getContext(); } }, vr: { get: function() { return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"), this.xr; } }, gammaInput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."), !1; }, set: function() { console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."); } }, gammaOutput: { get: function() { return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), !1; }, set: function(n) { console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."), this.outputEncoding = n === !0 ? Cs : Cn; } }, toneMappingWhitePoint: { get: function() { return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."), 1; }, set: function() { console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."); } } }); Object.defineProperties(xx.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 EB(n, e, t) { return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."), new bu(n, t); } Object.defineProperties(fi.prototype, { wrapS: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = n; } }, wrapT: { get: function() { return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = n; } }, magFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = n; } }, minFilter: { get: function() { return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = n; } }, anisotropy: { get: function() { return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = n; } }, offset: { get: function() { return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = n; } }, repeat: { get: function() { return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = n; } }, format: { get: function() { return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = n; } }, type: { get: function() { return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = n; } }, generateMipmaps: { get: function() { return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps; }, set: function(n) { console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = n; } } }); cp.prototype.load = function(n) { console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead."); const e = this; return new jx().load(n, function(i) { e.setBuffer(i); }), this; }; Yx.prototype.getData = function() { return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData(); }; yu.prototype.updateCubeMap = function(n, e) { return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(n, e); }; yu.prototype.clear = function(n, e, t, i) { return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."), this.renderTarget.clear(n, e, t, i); }; Bs.crossOrigin = void 0; Bs.loadTexture = function(n, e, t, i) { console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead."); const r = new qf(); r.setCrossOrigin(this.crossOrigin); const s = r.load(n, t, void 0, i); return e && (s.mapping = e), s; }; Bs.loadTextureCube = function(n, e, t, i) { console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead."); const r = new Nx(); r.setCrossOrigin(this.crossOrigin); const s = r.load(n, t, void 0, i); return e && (s.mapping = e), s; }; Bs.loadCompressedTexture = function() { console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead."); }; Bs.loadCompressedTextureCube = function() { console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead."); }; function CB() { console.error("THREE.CanvasRenderer has been removed"); } function LB() { console.error("THREE.JSONLoader has been removed."); } const RB = { 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 FB() { console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js"); } typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: gf } })); typeof window < "u" && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = gf); const PB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, ACESFilmicToneMapping: Yy, AddEquation: ps, AddOperation: jy, AdditiveAnimationBlendMode: Mf, AdditiveBlending: id, AlphaFormat: ib, AlwaysDepth: Uy, AlwaysStencilFunc: qb, AmbientLight: tp, AmbientLightProbe: Zx, AnimationClip: jo, AnimationLoader: cN, AnimationMixer: qx, AnimationObjectGroup: Kx, AnimationUtils: Ct, ArcCurve: Df, ArrayCamera: Ff, ArrowHelper: HN, Audio: cp, AudioAnalyser: Yx, AudioContext: lp, AudioListener: yN, AudioLoader: jx, AxesHelper: aM, AxisHelper: MB, BackSide: jt, BasicDepthPacking: Yb, BasicShadowMap: A3, BinaryTextureLoader: TB, Bone: yl, BooleanKeyframeTrack: Vs, BoundingBoxHelper: wB, Box2: oa, Box3: Nn, Box3Helper: kN, BoxBufferGeometry: sr, BoxGeometry: sr, BoxHelper: oM, BufferAttribute: ot, BufferGeometry: Ke, BufferGeometryLoader: Hx, ByteType: Ky, Cache: Is, Camera: hl, CameraHelper: VN, CanvasRenderer: CB, CanvasTexture: Tx, CatmullRomCurve3: Bf, CineonToneMapping: Xy, CircleBufferGeometry: Io, CircleGeometry: Io, ClampToEdgeWrapping: hn, Clock: Xx, Color: Ue, ColorKeyframeTrack: Jf, CompressedTexture: If, CompressedTextureLoader: uN, ConeBufferGeometry: Oo, ConeGeometry: Oo, CubeCamera: yu, CubeReflectionMapping: ll, CubeRefractionMapping: cl, CubeTexture: ta, CubeTextureLoader: Nx, CubeUVReflectionMapping: ea, CubeUVRefractionMapping: ul, CubicBezierCurve: Su, CubicBezierCurve3: Uf, CubicInterpolant: Px, CullFaceBack: nd, CullFaceFront: Ay, CullFaceFrontBack: w3, CullFaceNone: wy, Curve: jn, CurvePath: Ux, CustomBlending: _y, CustomToneMapping: Jy, CylinderBufferGeometry: $r, CylinderGeometry: $r, Cylindrical: IN, DataTexture: Ss, DataTexture2DArray: Lf, DataTexture3D: Rf, DataTextureLoader: Bx, DataUtils: jN, DecrementStencilOp: P3, DecrementWrapStencilOp: O3, DefaultLoadingManager: Dx, DepthFormat: ws, DepthStencilFormat: Co, DepthTexture: Ex, DirectionalLight: Ru, DirectionalLightHelper: zN, DiscreteInterpolant: Ix, DodecahedronBufferGeometry: Do, DodecahedronGeometry: Do, DoubleSide: Wr, DstAlphaFactor: Py, DstColorFactor: Oy, DynamicBufferAttribute: hB, DynamicCopyUsage: X3, DynamicDrawUsage: Fo, DynamicReadUsage: j3, EdgesGeometry: Of, EdgesHelper: AB, EllipseCurve: xl, EqualDepth: Vy, EqualStencilFunc: U3, EquirectangularReflectionMapping: kc, EquirectangularRefractionMapping: Gc, Euler: Us, EventDispatcher: Kr, ExtrudeBufferGeometry: mi, ExtrudeGeometry: mi, FaceColors: eB, FileLoader: $n, FlatShading: yf, Float16BufferAttribute: lx, Float32Attribute: bB, Float32BufferAttribute: He, Float64Attribute: xB, Float64BufferAttribute: cx, FloatType: qi, Fog: pl, FogExp2: fl, Font: ap, FontLoader: mN, FrontSide: Hr, Frustum: dl, GLBufferAttribute: eM, GLSL1: J3, GLSL3: yd, GammaEncoding: pu, GreaterDepth: Gy, GreaterEqualDepth: ky, GreaterEqualStencilFunc: G3, GreaterStencilFunc: V3, GridHelper: sM, Group: _i, HalfFloatType: Ms, HemisphereLight: Qf, HemisphereLightHelper: BN, HemisphereLightProbe: $x, IcosahedronBufferGeometry: No, IcosahedronGeometry: No, ImageBitmapLoader: op, ImageLoader: Ya, ImageUtils: Bs, ImmediateRenderObject: nM, IncrementStencilOp: F3, IncrementWrapStencilOp: I3, InstancedBufferAttribute: sp, InstancedBufferGeometry: rp, InstancedInterleavedBuffer: Qx, InstancedMesh: Pf, Int16Attribute: mB, Int16BufferAttribute: ox, Int32Attribute: vB, Int32BufferAttribute: ax, Int8Attribute: dB, Int8BufferAttribute: ix, IntType: Qy, InterleavedBuffer: Qr, InterleavedBufferAttribute: ar, Interpolant: Ni, InterpolateDiscrete: Lo, InterpolateLinear: Es, InterpolateSmooth: Cc, InvertStencilOp: D3, JSONLoader: LB, KeepStencilOp: Lc, KeyframeTrack: xi, LOD: Sx, LatheBufferGeometry: Bo, LatheGeometry: Bo, Layers: Cf, LensFlare: FB, LessDepth: zy, LessEqualDepth: Vc, LessEqualStencilFunc: z3, LessStencilFunc: B3, Light: gi, LightProbe: Al, Line: Oi, Line3: tM, LineBasicMaterial: an, LineCurve: Ml, LineCurve3: Cx, LineDashedMaterial: Xf, LineLoop: Au, LinePieces: qN, LineSegments: Rn, LineStrip: KN, LinearEncoding: Cn, LinearFilter: zt, LinearInterpolant: Yf, LinearMipMapLinearFilter: C3, LinearMipMapNearestFilter: E3, LinearMipmapLinearFilter: fr, LinearMipmapNearestFilter: du, LinearToneMapping: $y, Loader: xn, LoaderUtils: ir, LoadingManager: Kf, LogLuvEncoding: Xb, LoopOnce: Hb, LoopPingPong: jb, LoopRepeat: Wb, LuminanceAlphaFormat: sb, LuminanceFormat: rb, MOUSE: x3, Material: tn, MaterialLoader: Gx, Math: xd, MathUtils: xd, Matrix3: rn, Matrix4: Xe, MaxEquation: ad, Mesh: Xt, MeshBasicMaterial: In, MeshDepthMaterial: xu, MeshDistanceMaterial: Mu, MeshFaceMaterial: nB, MeshLambertMaterial: $f, MeshMatcapMaterial: Zf, MeshNormalMaterial: jf, MeshPhongMaterial: Hf, MeshPhysicalMaterial: wl, MeshStandardMaterial: zs, MeshToonMaterial: Wf, MinEquation: od, MirroredRepeatWrapping: Eo, MixOperation: Wy, MultiMaterial: iB, MultiplyBlending: sd, MultiplyOperation: al, NearestFilter: $t, NearestMipMapLinearFilter: T3, NearestMipMapNearestFilter: _3, NearestMipmapLinearFilter: Ga, NearestMipmapNearestFilter: ka, NeverDepth: By, NeverStencilFunc: N3, NoBlending: tr, NoColors: QN, NoToneMapping: Ir, NormalAnimationBlendMode: fu, NormalBlending: vo, NotEqualDepth: Hy, NotEqualStencilFunc: k3, NumberKeyframeTrack: Ho, Object3D: ut, ObjectLoader: hN, ObjectSpaceNormalMap: Kb, OctahedronBufferGeometry: Rs, OctahedronGeometry: Rs, OneFactor: Ly, OneMinusDstAlphaFactor: Iy, OneMinusDstColorFactor: Dy, OneMinusSrcAlphaFactor: xf, OneMinusSrcColorFactor: Fy, OrthographicCamera: sa, PCFShadowMap: vf, PCFSoftShadowMap: Sy, PMREMGenerator: ZN, ParametricBufferGeometry: Hc, ParametricGeometry: Hc, Particle: sB, ParticleBasicMaterial: lB, ParticleSystem: oB, ParticleSystemMaterial: cB, Path: Ja, PerspectiveCamera: nn, Plane: wi, PlaneBufferGeometry: Ls, PlaneGeometry: Ls, PlaneHelper: GN, PointCloud: rB, PointCloudMaterial: aB, PointLight: Lu, PointLightHelper: DN, Points: ia, PointsMaterial: es, PolarGridHelper: UN, PolyhedronBufferGeometry: Di, PolyhedronGeometry: Di, PositionalAudio: xN, PropertyBinding: mt, PropertyMixer: Jx, QuadraticBezierCurve: _u, QuadraticBezierCurve3: zf, Quaternion: bn, QuaternionKeyframeTrack: ks, QuaternionLinearInterpolant: Ox, REVISION: gf, RGBADepthPacking: Jb, RGBAFormat: Gn, RGBAIntegerFormat: db, RGBA_ASTC_10x10_Format: _b, RGBA_ASTC_10x5_Format: wb, RGBA_ASTC_10x6_Format: Ab, RGBA_ASTC_10x8_Format: Sb, RGBA_ASTC_12x10_Format: Tb, RGBA_ASTC_12x12_Format: Eb, RGBA_ASTC_4x4_Format: pb, RGBA_ASTC_5x4_Format: mb, RGBA_ASTC_5x5_Format: gb, RGBA_ASTC_6x5_Format: vb, RGBA_ASTC_6x6_Format: yb, RGBA_ASTC_8x5_Format: bb, RGBA_ASTC_8x6_Format: xb, RGBA_ASTC_8x8_Format: Mb, RGBA_BPTC_Format: Cb, RGBA_ETC2_EAC_Format: vd, RGBA_PVRTC_2BPPV1_Format: md, RGBA_PVRTC_4BPPV1_Format: pd, RGBA_S3TC_DXT1_Format: cd, RGBA_S3TC_DXT3_Format: ud, RGBA_S3TC_DXT5_Format: hd, RGBDEncoding: _f, RGBEEncoding: mu, RGBEFormat: ob, RGBFormat: nr, RGBIntegerFormat: hb, RGBM16Encoding: Sf, RGBM7Encoding: Af, RGB_ETC1_Format: fb, RGB_ETC2_Format: gd, RGB_PVRTC_2BPPV1_Format: fd, RGB_PVRTC_4BPPV1_Format: dd, RGB_S3TC_DXT1_Format: ld, RGFormat: cb, RGIntegerFormat: ub, RawShaderMaterial: ra, Ray: qr, Raycaster: FN, RectAreaLight: np, RedFormat: ab, RedIntegerFormat: lb, ReinhardToneMapping: Zy, RepeatWrapping: jr, ReplaceStencilOp: R3, ReverseSubtractEquation: Ey, RingBufferGeometry: Uo, RingGeometry: Uo, SRGB8_ALPHA8_ASTC_10x10_Format: Vb, SRGB8_ALPHA8_ASTC_10x5_Format: Bb, SRGB8_ALPHA8_ASTC_10x6_Format: Ub, SRGB8_ALPHA8_ASTC_10x8_Format: zb, SRGB8_ALPHA8_ASTC_12x10_Format: kb, SRGB8_ALPHA8_ASTC_12x12_Format: Gb, SRGB8_ALPHA8_ASTC_4x4_Format: Lb, SRGB8_ALPHA8_ASTC_5x4_Format: Rb, SRGB8_ALPHA8_ASTC_5x5_Format: Fb, SRGB8_ALPHA8_ASTC_6x5_Format: Pb, SRGB8_ALPHA8_ASTC_6x6_Format: Ib, SRGB8_ALPHA8_ASTC_8x5_Format: Ob, SRGB8_ALPHA8_ASTC_8x6_Format: Db, SRGB8_ALPHA8_ASTC_8x8_Format: Nb, Scene: wu, SceneUtils: RB, ShaderChunk: dt, ShaderLib: ci, ShaderMaterial: or, ShadowMaterial: Gf, Shape: Dr, ShapeBufferGeometry: Fs, ShapeGeometry: Fs, ShapePath: Wx, ShapeUtils: Fi, ShortType: qy, Skeleton: bl, SkeletonHelper: iM, SkinnedMesh: vl, SmoothShading: S3, Sphere: pr, SphereBufferGeometry: Ps, SphereGeometry: Ps, Spherical: PN, SphericalHarmonics3: ip, SplineCurve: Tu, SpotLight: Cu, SpotLightHelper: ON, Sprite: gl, SpriteMaterial: ml, SrcAlphaFactor: bf, SrcAlphaSaturateFactor: Ny, SrcColorFactor: Ry, StaticCopyUsage: Z3, StaticDrawUsage: Ro, StaticReadUsage: W3, StereoCamera: gN, StreamCopyUsage: Y3, StreamDrawUsage: H3, StreamReadUsage: $3, StringKeyframeTrack: Gs, SubtractEquation: Ty, SubtractiveBlending: rd, TOUCH: M3, TangentSpaceNormalMap: Jr, TetrahedronBufferGeometry: zo, TetrahedronGeometry: zo, TextBufferGeometry: Wc, TextGeometry: Wc, Texture: Yt, TextureLoader: qf, TorusBufferGeometry: Vo, TorusGeometry: Vo, TorusKnotBufferGeometry: ko, TorusKnotGeometry: ko, Triangle: Zt, TriangleFanDrawMode: wf, TriangleStripDrawMode: Zb, TrianglesDrawMode: $b, TubeBufferGeometry: Go, TubeGeometry: Go, UVMapping: hu, Uint16Attribute: gB, Uint16BufferAttribute: gu, Uint32Attribute: yB, Uint32BufferAttribute: vu, Uint8Attribute: fB, Uint8BufferAttribute: rx, Uint8ClampedAttribute: pB, Uint8ClampedBufferAttribute: sx, Uniform: Fu, UniformsLib: ze, UniformsUtils: hx, UnsignedByteType: Ts, UnsignedInt248Type: yo, UnsignedIntType: Ra, UnsignedShort4444Type: eb, UnsignedShort5551Type: tb, UnsignedShort565Type: nb, UnsignedShortType: Ha, VSMShadowMap: po, Vector2: Re, Vector3: q, Vector4: xt, VectorKeyframeTrack: Wo, Vertex: uB, VertexColors: tB, VideoTexture: _x, WebGL1Renderer: wx, WebGLCubeRenderTarget: bu, WebGLMultipleRenderTargets: tx, WebGLMultisampleRenderTarget: Ef, WebGLRenderTarget: fi, WebGLRenderTargetCube: EB, WebGLRenderer: wt, WebGLUtils: Mx, WireframeGeometry: kf, WireframeHelper: SB, WrapAroundEnding: Wa, XHRLoader: _B, ZeroCurvatureEnding: gs, ZeroFactor: Cy, ZeroSlopeEnding: vs, ZeroStencilOp: L3, sRGBEncoding: Cs }, Symbol.toStringTag, { value: "Module" })), IB = /* @__PURE__ */ au(PB); function OB(n, e) { if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function"); } function DB(n, e) { for (var t = 0; t < e.length; t++) { var i = e[t]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, i.key, i); } } function NB(n, e, t) { return e && DB(n.prototype, e), n; } function BB(n, e) { if (typeof e != "function" && e !== null) throw new TypeError("Super expression must either be null or a function"); n.prototype = Object.create(e && e.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), e && Td(n, e); } function jc(n) { return jc = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) { return t.__proto__ || Object.getPrototypeOf(t); }, jc(n); } function Td(n, e) { return Td = Object.setPrototypeOf || function(i, r) { return i.__proto__ = r, i; }, Td(n, e); } function UB() { if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), !0; } catch { return !1; } } function zB(n) { if (n === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return n; } function VB(n, e) { return e && (typeof e == "object" || typeof e == "function") ? e : zB(n); } function kB(n) { var e = UB(); return function() { var i = jc(n), r; if (e) { var s = jc(this).constructor; r = Reflect.construct(i, arguments, s); } else r = i.apply(this, arguments); return VB(this, r); }; } function fv(n, e) { return HB(n) || jB(n, e) || hM(n, e) || ZB(); } function xc(n) { return GB(n) || WB(n) || hM(n) || $B(); } function GB(n) { if (Array.isArray(n)) return Ed(n); } function HB(n) { if (Array.isArray(n)) return n; } function WB(n) { if (typeof Symbol < "u" && n[Symbol.iterator] != null || n["@@iterator"] != null) return Array.from(n); } function jB(n, e) { var t = n && (typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"]); if (t != null) { var i = [], r = !0, s = !1, o, a; try { for (t = t.call(n); !(r = (o = t.next()).done) && (i.push(o.value), !(e && i.length === e)); r = !0) ; } catch (c) { s = !0, a = c; } finally { try { !r && t.return != null && t.return(); } finally { if (s) throw a; } } return i; } } function hM(n, e) { if (n) { if (typeof n == "string") return Ed(n, e); var t = Object.prototype.toString.call(n).slice(8, -1); if (t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set") return Array.from(n); if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Ed(n, e); } } function Ed(n, e) { (e == null || e > n.length) && (e = n.length); for (var t = 0, i = new Array(e); t < e; t++) i[t] = n[t]; return i; } function $B() { 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 ZB() { throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } var wa = typeof window < "u" && window.THREE ? window.THREE : { LinearFilter: zt, Sprite: gl, SpriteMaterial: ml, Texture: Yt }, XB = /* @__PURE__ */ function(n) { BB(t, n); var e = kB(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 OB(this, t), i = e.call(this, new wa.SpriteMaterial({ map: new wa.Texture() })), i._text = "".concat(r), i._textHeight = s, i._color = o, i._backgroundColor = !1, i._padding = 0, i._borderWidth = 0, i._borderRadius = 0, i._borderColor = "white", i._strokeWidth = 0, i._strokeColor = "white", i._fontFace = "Arial", i._fontSize = 90, i._fontWeight = "normal", i._canvas = document.createElement("canvas"), i._texture = i.material.map, i._texture.minFilter = wa.LinearFilter, i._genCanvas(), i; } return NB(t, [{ key: "text", get: function() { return this._text; }, set: function(r) { this._text = r, this._genCanvas(); } }, { key: "textHeight", get: function() { return this._textHeight; }, set: function(r) { this._textHeight = r, this._genCanvas(); } }, { key: "color", get: function() { return this._color; }, set: function(r) { this._color = r, this._genCanvas(); } }, { key: "backgroundColor", get: function() { return this._backgroundColor; }, set: function(r) { this._backgroundColor = r, this._genCanvas(); } }, { key: "padding", get: function() { return this._padding; }, set: function(r) { this._padding = r, this._genCanvas(); } }, { key: "borderWidth", get: function() { return this._borderWidth; }, set: function(r) { this._borderWidth = r, this._genCanvas(); } }, { key: "borderRadius", get: function() { return this._borderRadius; }, set: function(r) { this._borderRadius = r, this._genCanvas(); } }, { key: "borderColor", get: function() { return this._borderColor; }, set: function(r) { this._borderColor = r, this._genCanvas(); } }, { key: "fontFace", get: function() { return this._fontFace; }, set: function(r) { this._fontFace = r, this._genCanvas(); } }, { key: "fontSize", get: function() { return this._fontSize; }, set: function(r) { this._fontSize = r, this._genCanvas(); } }, { key: "fontWeight", get: function() { return this._fontWeight; }, set: function(r) { this._fontWeight = r, this._genCanvas(); } }, { key: "strokeWidth", get: function() { return this._strokeWidth; }, set: function(r) { this._strokeWidth = r, this._genCanvas(); } }, { key: "strokeColor", get: function() { return this._strokeColor; }, set: function(r) { this._strokeColor = r, this._genCanvas(); } }, { key: "_genCanvas", value: function() { var r = this, s = this._canvas, o = s.getContext("2d"), a = Array.isArray(this.borderWidth) ? this.borderWidth : [this.borderWidth, this.borderWidth], c = a.map(function(R) { return R * r.fontSize * 0.1; }), l = Array.isArray(this.borderRadius) ? this.borderRadius : [this.borderRadius, this.borderRadius, this.borderRadius, this.borderRadius], d = l.map(function(R) { return R * r.fontSize * 0.1; }), h = Array.isArray(this.padding) ? this.padding : [this.padding, this.padding], f = h.map(function(R) { return R * r.fontSize * 0.1; }), g = this.text.split(` `), p = "".concat(this.fontWeight, " ").concat(this.fontSize, "px ").concat(this.fontFace); o.font = p; var u = Math.max.apply(Math, xc(g.map(function(R) { return o.measureText(R).width; }))), y = this.fontSize * g.length; if (s.width = u + c[0] * 2 + f[0] * 2, s.height = y + c[1] * 2 + f[1] * 2, this.borderWidth) { if (o.strokeStyle = this.borderColor, c[0]) { var v = c[0] / 2; o.lineWidth = c[0], o.beginPath(), o.moveTo(v, d[0]), o.lineTo(v, s.height - d[3]), o.moveTo(s.width - v, d[1]), o.lineTo(s.width - v, s.height - d[2]), o.stroke(); } if (c[1]) { var m = c[1] / 2; o.lineWidth = c[1], o.beginPath(), o.moveTo(Math.max(c[0], d[0]), m), o.lineTo(s.width - Math.max(c[0], d[1]), m), o.moveTo(Math.max(c[0], d[3]), s.height - m), o.lineTo(s.width - Math.max(c[0], d[2]), s.height - m), o.stroke(); } if (this.borderRadius) { var x = Math.max.apply(Math, xc(c)), w = x / 2; o.lineWidth = x, o.beginPath(), [!!d[0] && [d[0], w, w, d[0]], !!d[1] && [s.width - d[1], s.width - w, w, d[1]], !!d[2] && [s.width - d[2], s.width - w, s.height - w, s.height - d[2]], !!d[3] && [d[3], w, s.height - w, s.height - d[3]]].filter(function(R) { return R; }).forEach(function(R) { var L = fv(R, 4), S = L[0], I = L[1], T = L[2], _ = L[3]; o.moveTo(S, T), o.quadraticCurveTo(I, T, I, _); }), o.stroke(); } } this.backgroundColor && (o.fillStyle = this.backgroundColor, this.borderRadius ? (o.beginPath(), o.moveTo(c[0], d[0]), [ [c[0], d[0], s.width - d[1], c[1], c[1], c[1]], // t [s.width - c[0], s.width - c[0], s.width - c[0], c[1], d[1], s.height - d[2]], // r [s.width - c[0], s.width - d[2], d[3], s.height - c[1], s.height - c[1], s.height - c[1]], // b [c[0], c[0], c[0], s.height - c[1], s.height - d[3], d[0]] // t ].forEach(function(R) { var L = fv(R, 6), S = L[0], I = L[1], T = L[2], _ = L[3], E = L[4], C = L[5]; o.quadraticCurveTo(S, _, I, E), o.lineTo(T, C); }), o.closePath(), o.fill()) : o.fillRect(c[0], c[1], s.width - c[0] * 2, s.height - c[1] * 2)), o.translate.apply(o, xc(c)), o.translate.apply(o, xc(f)), o.font = p, o.fillStyle = this.color, o.textBaseline = "bottom"; var A = this.strokeWidth > 0; A && (o.lineWidth = this.strokeWidth * this.fontSize / 10, o.strokeStyle = this.strokeColor), g.forEach(function(R, L) { var S = (u - o.measureText(R).width) / 2, I = (L + 1) * r.fontSize; A && o.strokeText(R, S, I), o.fillText(R, S, I); }), this._texture.image = s, this._texture.needsUpdate = !0; var M = this.textHeight * g.length + a[1] * 2 + h[1] * 2; this.scale.set(M * s.width / s.height, M, 0); } }, { key: "clone", value: function() { return new this.constructor(this.text, this.textHeight, this.color).copy(this); } }, { key: "copy", value: function(r) { return wa.Sprite.prototype.copy.call(this, r), this.color = r.color, this.backgroundColor = r.backgroundColor, this.padding = r.padding, this.borderWidth = r.borderWidth, this.borderColor = r.borderColor, this.fontFace = r.fontFace, this.fontSize = r.fontSize, this.fontWeight = r.fontWeight, this.strokeWidth = r.strokeWidth, this.strokeColor = r.strokeColor, this; } }]), t; }(wa.Sprite); const YB = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: XB }, Symbol.toStringTag, { value: "Module" })), JB = /* @__PURE__ */ au(YB); var Ch = { exports: {} }, pv; function KB() { return pv || (pv = 1, function(n, e) { (function(t, i) { n.exports = i(); })(typeof window < "u" ? window : Lr, function() { if (typeof window > "u") return null; var t = typeof window < "u" && window.Math == Math ? window : typeof self < "u" && self.Math == Math ? self : Function("return this")(), i = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || function(d) { return t.setTimeout(d, 20); }, r = t.cancelAnimationFrame || t.mozCancelAnimationFrame || t.webkitCancelAnimationFrame || function(d) { t.clearTimeout(d); }; function s(d, h) { var f = Object.prototype.toString.call(d), g = f === "[object Array]" || f === "[object NodeList]" || f === "[object HTMLCollection]" || f === "[object Object]" || typeof jQuery < "u" && d instanceof jQuery || typeof Elements < "u" && d instanceof Elements, p = 0, u = d.length; if (g) for (; p < u; p++) h(d[p]); else h(d); } function o(d) { if (!d.getBoundingClientRect) return { width: d.offsetWidth, height: d.offsetHeight }; var h = d.getBoundingClientRect(); return { width: Math.round(h.width), height: Math.round(h.height) }; } function a(d, h) { Object.keys(h).forEach(function(f) { d.style[f] = h[f]; }); } var c = function(d, h) { var f = 0; function g() { var u = []; this.add = function(m) { u.push(m); }; var y, v; this.call = function(m) { for (y = 0, v = u.length; y < v; y++) u[y].call(this, m); }, this.remove = function(m) { var x = []; for (y = 0, v = u.length; y < v; y++) u[y] !== m && x.push(u[y]); u = x; }, this.length = function() { return u.length; }; } function p(u, y) { if (u) { if (u.resizedAttached) { u.resizedAttached.add(y); return; } u.resizedAttached = new g(), u.resizedAttached.add(y), u.resizeSensor = document.createElement("div"), u.resizeSensor.dir = "ltr", u.resizeSensor.className = "resize-sensor"; var v = { pointerEvents: "none", position: "absolute", left: "0px", top: "0px", right: "0px", bottom: "0px", overflow: "hidden", zIndex: "-1", visibility: "hidden", maxWidth: "100%" }, m = { position: "absolute", left: "0px", top: "0px", transition: "0s" }; a(u.resizeSensor, v); var x = document.createElement("div"); x.className = "resize-sensor-expand", a(x, v); var w = document.createElement("div"); a(w, m), x.appendChild(w); var A = document.createElement("div"); A.className = "resize-sensor-shrink", a(A, v); var M = document.createElement("div"); a(M, m), a(M, { width: "200%", height: "200%" }), A.appendChild(M), u.resizeSensor.appendChild(x), u.resizeSensor.appendChild(A), u.appendChild(u.resizeSensor); var R = window.getComputedStyle(u), L = R ? R.getPropertyValue("position") : null; L !== "absolute" && L !== "relative" && L !== "fixed" && L !== "sticky" && (u.style.position = "relative"); var S = !1, I = 0, T = o(u), _ = 0, E = 0, C = !0; f = 0; var P = function() { var B = u.offsetWidth, U = u.offsetHeight; w.style.width = B + 10 + "px", w.style.height = U + 10 + "px", x.scrollLeft = B + 10, x.scrollTop = U + 10, A.scrollLeft = B + 10, A.scrollTop = U + 10; }, b = function() { if (C) { var B = u.offsetWidth === 0 && u.offsetHeight === 0; if (B) { f || (f = i(function() { f = 0, b(); })); return; } else C = !1; } P(); }; u.resizeSensor.resetSensor = b; var F = function() { I = 0, S && (_ = T.width, E = T.height, u.resizedAttached && u.resizedAttached.call(T)); }, D = function() { T = o(u), S = T.width !== _ || T.height !== E, S && !I && (I = i(F)), b(); }, N = function(B, U, G) { B.attachEvent ? B.attachEvent("on" + U, G) : B.addEventListener(U, G); }; N(x, "scroll", D), N(A, "scroll", D), f = i(function() { f = 0, b(); }); } } s(d, function(u) { p(u, h); }), this.detach = function(u) { f || (r(f), f = 0), c.detach(d, u); }, this.reset = function() { d.resizeSensor.resetSensor(); }; }; if (c.reset = function(d) { s(d, function(h) { h.resizeSensor.resetSensor(); }); }, c.detach = function(d, h) { s(d, function(f) { f && (f.resizedAttached && typeof h == "function" && (f.resizedAttached.remove(h), f.resizedAttached.length()) || f.resizeSensor && (f.contains(f.resizeSensor) && f.removeChild(f.resizeSensor), delete f.resizeSensor, delete f.resizedAttached)); }); }, typeof MutationObserver < "u") { var l = new MutationObserver(function(d) { for (var h in d) if (d.hasOwnProperty(h)) for (var f = d[h].addedNodes, g = 0; g < f.length; g++) f[g].resizeSensor && c.reset(f[g]); }); document.addEventListener("DOMContentLoaded", function(d) { l.observe(document.body, { childList: !0, subtree: !0 }); }); } return c; }); }(Ch)), Ch.exports; } class qB extends xn { constructor(e) { super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(t) { return new n4(t); }), this.register(function(t) { return new r4(t); }), this.register(function(t) { return new s4(t); }), this.register(function(t) { return new i4(t); }), this.register(function(t) { return new e4(t); }), this.register(function(t) { return new o4(t); }); } load(e, t, i, r) { const s = this; let o; this.resourcePath !== "" ? o = this.resourcePath : this.path !== "" ? o = this.path : o = ir.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 $n(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 (ir.decodeText(new Uint8Array(e, 0, 4)) === dM) { try { o[gt.KHR_BINARY_GLTF] = new a4(e); } catch (h) { r && r(h); return; } s = o[gt.KHR_BINARY_GLTF].content; } else s = ir.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 v4(c, { path: t || this.resourcePath || "", crossOrigin: this.crossOrigin, requestHeader: this.requestHeader, manager: this.manager, ktx2Loader: this.ktx2Loader, meshoptDecoder: this.meshoptDecoder }); l.fileLoader.setRequestHeader(this.requestHeader); for (let d = 0; d < this.pluginCallbacks.length; d++) { const h = this.pluginCallbacks[d](l); a[h.name] = h, o[h.name] = !0; } if (c.extensionsUsed) for (let d = 0; d < c.extensionsUsed.length; ++d) { const h = c.extensionsUsed[d], f = c.extensionsRequired || []; switch (h) { case gt.KHR_MATERIALS_UNLIT: o[h] = new t4(); break; case gt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: o[h] = new u4(); break; case gt.KHR_DRACO_MESH_COMPRESSION: o[h] = new l4(c, this.dracoLoader); break; case gt.KHR_TEXTURE_TRANSFORM: o[h] = new c4(); break; case gt.KHR_MESH_QUANTIZATION: o[h] = new h4(); break; default: f.indexOf(h) >= 0 && a[h] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + h + '".'); } } l.setExtensions(o), l.setPlugins(a), l.parse(i, r); } } function QB() { let n = {}; return { get: function(e) { return n[e]; }, add: function(e, t) { n[e] = t; }, remove: function(e) { delete n[e]; }, removeAll: function() { n = {}; } }; } const gt = { KHR_BINARY_GLTF: "KHR_binary_glTF", KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression", KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual", KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat", KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness", KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission", KHR_MATERIALS_UNLIT: "KHR_materials_unlit", KHR_TEXTURE_BASISU: "KHR_texture_basisu", KHR_TEXTURE_TRANSFORM: "KHR_texture_transform", KHR_MESH_QUANTIZATION: "KHR_mesh_quantization", EXT_TEXTURE_WEBP: "EXT_texture_webp", EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression" }; class e4 { constructor(e) { this.parser = e, this.name = gt.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} }; } _markDefs() { const e = this.parser, t = this.parser.json.nodes || []; for (let i = 0, r = t.length; i < r; i++) { const s = t[i]; s.extensions && s.extensions[this.name] && s.extensions[this.name].light !== void 0 && e._addNodeRef(this.cache, s.extensions[this.name].light); } } _loadLight(e) { const t = this.parser, i = "light:" + e; let r = t.cache.get(i); if (r) return r; const s = t.json, c = ((s.extensions && s.extensions[this.name] || {}).lights || [])[e]; let l; const d = new Ue(16777215); c.color !== void 0 && d.fromArray(c.color); const h = c.range !== void 0 ? c.range : 0; switch (c.type) { case "directional": l = new Ru(d), l.target.position.set(0, 0, -1), l.add(l.target); break; case "point": l = new Lu(d), l.distance = h; break; case "spot": l = new Cu(d), l.distance = h, c.spot = c.spot || {}, c.spot.innerConeAngle = c.spot.innerConeAngle !== void 0 ? c.spot.innerConeAngle : 0, c.spot.outerConeAngle = c.spot.outerConeAngle !== void 0 ? c.spot.outerConeAngle : Math.PI / 4, l.angle = c.spot.outerConeAngle, l.penumbra = 1 - c.spot.innerConeAngle / c.spot.outerConeAngle, l.target.position.set(0, 0, -1), l.add(l.target); break; default: throw new Error("THREE.GLTFLoader: Unexpected light type: " + c.type); } return l.position.set(0, 0, 0), l.decay = 2, c.intensity !== void 0 && (l.intensity = c.intensity), l.name = t.createUniqueName(c.name || "light_" + e), r = Promise.resolve(l), t.cache.add(i, r), r; } createNodeAttachment(e) { const t = this, i = this.parser, s = i.json.nodes[e], a = (s.extensions && s.extensions[this.name] || {}).light; return a === void 0 ? null : this._loadLight(a).then(function(c) { return i._getNodeRef(t.cache, a, c); }); } } class t4 { constructor() { this.name = gt.KHR_MATERIALS_UNLIT; } getMaterialType() { return In; } extendParams(e, t, i) { const r = []; e.color = new Ue(1, 1, 1), e.opacity = 1; const s = t.pbrMetallicRoughness; if (s) { if (Array.isArray(s.baseColorFactor)) { const o = s.baseColorFactor; e.color.fromArray(o), e.opacity = o[3]; } s.baseColorTexture !== void 0 && r.push(i.assignTexture(e, "map", s.baseColorTexture)); } return Promise.all(r); } } class n4 { constructor(e) { this.parser = e, this.name = gt.KHR_MATERIALS_CLEARCOAT; } getMaterialType(e) { const i = this.parser.json.materials[e]; return !i.extensions || !i.extensions[this.name] ? null : wl; } extendMaterialParams(e, t) { const i = this.parser, r = i.json.materials[e]; if (!r.extensions || !r.extensions[this.name]) return Promise.resolve(); const s = [], o = r.extensions[this.name]; if (o.clearcoatFactor !== void 0 && (t.clearcoat = o.clearcoatFactor), o.clearcoatTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatMap", o.clearcoatTexture)), o.clearcoatRoughnessFactor !== void 0 && (t.clearcoatRoughness = o.clearcoatRoughnessFactor), o.clearcoatRoughnessTexture !== void 0 && s.push(i.assignTexture(t, "clearcoatRoughnessMap", o.clearcoatRoughnessTexture)), o.clearcoatNormalTexture !== void 0 && (s.push(i.assignTexture(t, "clearcoatNormalMap", o.clearcoatNormalTexture)), o.clearcoatNormalTexture.scale !== void 0)) { const a = o.clearcoatNormalTexture.scale; t.clearcoatNormalScale = new Re(a, -a); } return Promise.all(s); } } class i4 { constructor(e) { this.parser = e, this.name = gt.KHR_MATERIALS_TRANSMISSION; } getMaterialType(e) { const i = this.parser.json.materials[e]; return !i.extensions || !i.extensions[this.name] ? null : wl; } extendMaterialParams(e, t) { const i = this.parser, r = i.json.materials[e]; if (!r.extensions || !r.extensions[this.name]) return Promise.resolve(); const s = [], o = r.extensions[this.name]; return o.transmissionFactor !== void 0 && (t.transmission = o.transmissionFactor), o.transmissionTexture !== void 0 && s.push(i.assignTexture(t, "transmissionMap", o.transmissionTexture)), Promise.all(s); } } class r4 { constructor(e) { this.parser = e, this.name = gt.KHR_TEXTURE_BASISU; } loadTexture(e) { const t = this.parser, i = t.json, r = i.textures[e]; if (!r.extensions || !r.extensions[this.name]) return null; const s = r.extensions[this.name], o = i.images[s.source], a = t.options.ktx2Loader; if (!a) { if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures"); return null; } return t.loadTextureImage(e, o, a); } } class s4 { constructor(e) { this.parser = e, this.name = gt.EXT_TEXTURE_WEBP, this.isSupported = null; } loadTexture(e) { const t = this.name, i = this.parser, r = i.json, s = r.textures[e]; if (!s.extensions || !s.extensions[t]) return null; const o = s.extensions[t], a = r.images[o.source]; let c = i.textureLoader; if (a.uri) { const l = i.options.manager.getHandler(a.uri); l !== null && (c = l); } return this.detectSupport().then(function(l) { if (l) return i.loadTextureImage(e, a, c); if (r.extensionsRequired && r.extensionsRequired.indexOf(t) >= 0) throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported."); return i.loadTexture(e); }); } detectSupport() { return this.isSupported || (this.isSupported = new Promise(function(e) { const t = new Image(); t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() { e(t.height === 1); }; })), this.isSupported; } } class o4 { constructor(e) { this.name = gt.EXT_MESHOPT_COMPRESSION, this.parser = e; } loadBufferView(e) { const t = this.parser.json, i = t.bufferViews[e]; if (i.extensions && i.extensions[this.name]) { const r = i.extensions[this.name], s = this.parser.getDependency("buffer", r.buffer), o = this.parser.options.meshoptDecoder; if (!o || !o.supported) { if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files"); return null; } return Promise.all([s, o.ready]).then(function(a) { const c = r.byteOffset || 0, l = r.byteLength || 0, d = r.count, h = r.byteStride, f = new ArrayBuffer(d * h), g = new Uint8Array(a[0], c, l); return o.decodeGltfBuffer(new Uint8Array(f), d, h, g, r.mode, r.filter), f; }); } else return null; } } const dM = "glTF", Aa = 12, mv = { JSON: 1313821514, BIN: 5130562 }; class a4 { constructor(e) { this.name = gt.KHR_BINARY_GLTF, this.content = null, this.body = null; const t = new DataView(e, 0, Aa); if (this.header = { magic: ir.decodeText(new Uint8Array(e.slice(0, 4))), version: t.getUint32(4, !0), length: t.getUint32(8, !0) }, this.header.magic !== dM) throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header."); if (this.header.version < 2) throw new Error("THREE.GLTFLoader: Legacy binary file detected."); const i = this.header.length - Aa, r = new DataView(e, Aa); let s = 0; for (; s < i; ) { const o = r.getUint32(s, !0); s += 4; const a = r.getUint32(s, !0); if (s += 4, a === mv.JSON) { const c = new Uint8Array(e, Aa + s, o); this.content = ir.decodeText(c); } else if (a === mv.BIN) { const c = Aa + s; this.body = e.slice(c, c + o); } s += o; } if (this.content === null) throw new Error("THREE.GLTFLoader: JSON content not found."); } } class l4 { constructor(e, t) { if (!t) throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided."); this.name = gt.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload(); } decodePrimitive(e, t) { const i = this.json, r = this.dracoLoader, s = e.extensions[this.name].bufferView, o = e.extensions[this.name].attributes, a = {}, c = {}, l = {}; for (const d in o) { const h = Ld[d] || d.toLowerCase(); a[h] = o[d]; } for (const d in e.attributes) { const h = Ld[d] || d.toLowerCase(); if (o[d] !== void 0) { const f = i.accessors[e.attributes[d]], g = Ka[f.componentType]; l[h] = g, c[h] = f.normalized === !0; } } return t.getDependency("bufferView", s).then(function(d) { return new Promise(function(h) { r.decodeDracoFile(d, function(f) { for (const g in f.attributes) { const p = f.attributes[g], u = c[g]; u !== void 0 && (p.normalized = u); } h(f); }, a, l); }); }); } } class c4 { constructor() { this.name = gt.KHR_TEXTURE_TRANSFORM; } extendTexture(e, t) { return t.texCoord !== void 0 && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'), t.offset === void 0 && t.rotation === void 0 && t.scale === void 0 || (e = e.clone(), t.offset !== void 0 && e.offset.fromArray(t.offset), t.rotation !== void 0 && (e.rotation = t.rotation), t.scale !== void 0 && e.repeat.fromArray(t.scale), e.needsUpdate = !0), e; } } class Cd extends zs { constructor(e) { super(), this.isGLTFSpecularGlossinessMaterial = !0; const t = [ "#ifdef USE_SPECULARMAP", " uniform sampler2D specularMap;", "#endif" ].join(` `), i = [ "#ifdef USE_GLOSSINESSMAP", " uniform sampler2D glossinessMap;", "#endif" ].join(` `), r = [ "vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", " vec4 texelSpecular = texture2D( specularMap, vUv );", " texelSpecular = sRGBToLinear( texelSpecular );", " // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", " specularFactor *= texelSpecular.rgb;", "#endif" ].join(` `), s = [ "float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", " vec4 texelGlossiness = texture2D( glossinessMap, vUv );", " // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", " glossinessFactor *= texelGlossiness.a;", "#endif" ].join(` `), o = [ "PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.", "material.specularRoughness += geometryRoughness;", "material.specularRoughness = min( material.specularRoughness, 1.0 );", "material.specularColor = specularFactor;" ].join(` `), a = { specular: { value: new Ue().setHex(16777215) }, glossiness: { value: 1 }, specularMap: { value: null }, glossinessMap: { value: null } }; this._extraUniforms = a, this.onBeforeCompile = function(c) { for (const l in a) c.uniforms[l] = a[l]; c.fragmentShader = c.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;").replace("uniform float metalness;", "uniform float glossiness;").replace("#include ", t).replace("#include ", i).replace("#include ", r).replace("#include ", s).replace("#include ", o); }, Object.defineProperties(this, { specular: { get: function() { return a.specular.value; }, set: function(c) { a.specular.value = c; } }, specularMap: { get: function() { return a.specularMap.value; }, set: function(c) { a.specularMap.value = c, c ? this.defines.USE_SPECULARMAP = "" : delete this.defines.USE_SPECULARMAP; } }, glossiness: { get: function() { return a.glossiness.value; }, set: function(c) { a.glossiness.value = c; } }, glossinessMap: { get: function() { return a.glossinessMap.value; }, set: function(c) { a.glossinessMap.value = c, c ? (this.defines.USE_GLOSSINESSMAP = "", this.defines.USE_UV = "") : (delete this.defines.USE_GLOSSINESSMAP, delete this.defines.USE_UV); } } }), delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this.setValues(e); } copy(e) { return super.copy(e), this.specularMap = e.specularMap, this.specular.copy(e.specular), this.glossinessMap = e.glossinessMap, this.glossiness = e.glossiness, delete this.metalness, delete this.roughness, delete this.metalnessMap, delete this.roughnessMap, this; } } class u4 { constructor() { this.name = gt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, this.specularGlossinessParams = [ "color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio" ]; } getMaterialType() { return Cd; } extendParams(e, t, i) { const r = t.extensions[this.name]; e.color = new Ue(1, 1, 1), e.opacity = 1; const s = []; if (Array.isArray(r.diffuseFactor)) { const o = r.diffuseFactor; e.color.fromArray(o), e.opacity = o[3]; } if (r.diffuseTexture !== void 0 && s.push(i.assignTexture(e, "map", r.diffuseTexture)), e.emissive = new Ue(0, 0, 0), e.glossiness = r.glossinessFactor !== void 0 ? r.glossinessFactor : 1, e.specular = new Ue(1, 1, 1), Array.isArray(r.specularFactor) && e.specular.fromArray(r.specularFactor), r.specularGlossinessTexture !== void 0) { const o = r.specularGlossinessTexture; s.push(i.assignTexture(e, "glossinessMap", o)), s.push(i.assignTexture(e, "specularMap", o)); } return Promise.all(s); } createMaterial(e) { const t = new Cd(e); return t.fog = !0, t.color = e.color, t.map = e.map === void 0 ? null : e.map, t.lightMap = null, t.lightMapIntensity = 1, t.aoMap = e.aoMap === void 0 ? null : e.aoMap, t.aoMapIntensity = 1, t.emissive = e.emissive, t.emissiveIntensity = 1, t.emissiveMap = e.emissiveMap === void 0 ? null : e.emissiveMap, t.bumpMap = e.bumpMap === void 0 ? null : e.bumpMap, t.bumpScale = 1, t.normalMap = e.normalMap === void 0 ? null : e.normalMap, t.normalMapType = Jr, e.normalScale && (t.normalScale = e.normalScale), t.displacementMap = null, t.displacementScale = 1, t.displacementBias = 0, t.specularMap = e.specularMap === void 0 ? null : e.specularMap, t.specular = e.specular, t.glossinessMap = e.glossinessMap === void 0 ? null : e.glossinessMap, t.glossiness = e.glossiness, t.alphaMap = null, t.envMap = e.envMap === void 0 ? null : e.envMap, t.envMapIntensity = 1, t.refractionRatio = 0.98, t; } } class h4 { constructor() { this.name = gt.KHR_MESH_QUANTIZATION; } } class $o extends Ni { constructor(e, t, i, r) { super(e, t, i, r); } copySampleValue_(e) { const t = this.resultBuffer, i = this.sampleValues, r = this.valueSize, s = e * r * 3 + r; for (let o = 0; o !== r; o++) t[o] = i[s + o]; return t; } } $o.prototype.beforeStart_ = $o.prototype.copySampleValue_; $o.prototype.afterEnd_ = $o.prototype.copySampleValue_; $o.prototype.interpolate_ = function(n, e, t, i) { const r = this.resultBuffer, s = this.sampleValues, o = this.valueSize, a = o * 2, c = o * 3, l = i - e, d = (t - e) / l, h = d * d, f = h * d, g = n * c, p = g - c, u = -2 * f + 3 * h, y = f - h, v = 1 - u, m = y - h + d; for (let x = 0; x !== o; x++) { const w = s[p + x + o], A = s[p + x + a] * l, M = s[g + x + o], R = s[g + x] * l; r[x] = v * w + m * A + u * M + y * R; } return r; }; const Xi = { FLOAT: 5126, //FLOAT_MAT2: 35674, FLOAT_MAT3: 35675, FLOAT_MAT4: 35676, FLOAT_VEC2: 35664, FLOAT_VEC3: 35665, FLOAT_VEC4: 35666, LINEAR: 9729, REPEAT: 10497, SAMPLER_2D: 35678, POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123 }, Ka = { 5120: Int8Array, 5121: Uint8Array, 5122: Int16Array, 5123: Uint16Array, 5125: Uint32Array, 5126: Float32Array }, gv = { 9728: $t, 9729: zt, 9984: ka, 9985: du, 9986: Ga, 9987: fr }, vv = { 33071: hn, 33648: Eo, 10497: jr }, yv = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4, MAT2: 4, MAT3: 9, MAT4: 16 }, Ld = { POSITION: "position", NORMAL: "normal", TANGENT: "tangent", TEXCOORD_0: "uv", TEXCOORD_1: "uv2", COLOR_0: "color", WEIGHTS_0: "skinWeight", JOINTS_0: "skinIndex" }, _r = { scale: "scale", translation: "position", rotation: "quaternion", weights: "morphTargetInfluences" }, d4 = { CUBICSPLINE: void 0, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each // keyframe track will be initialized with a default interpolation type, then modified. LINEAR: Es, STEP: Lo }, Lh = { OPAQUE: "OPAQUE", MASK: "MASK", BLEND: "BLEND" }; function bv(n, e) { return typeof n != "string" || n === "" ? "" : (/^https?:\/\//i.test(e) && /^\//.test(n) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(n) || /^data:.*,.*$/i.test(n) || /^blob:.*$/i.test(n) ? n : e + n); } function f4(n) { return n.DefaultMaterial === void 0 && (n.DefaultMaterial = new zs({ color: 16777215, emissive: 0, metalness: 1, roughness: 1, transparent: !1, depthTest: !0, side: Hr })), n.DefaultMaterial; } function Sa(n, e, t) { for (const i in t.extensions) n[i] === void 0 && (e.userData.gltfExtensions = e.userData.gltfExtensions || {}, e.userData.gltfExtensions[i] = t.extensions[i]); } function fs(n, e) { e.extras !== void 0 && (typeof e.extras == "object" ? Object.assign(n.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras)); } function p4(n, e, t) { let i = !1, r = !1; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; if (l.POSITION !== void 0 && (i = !0), l.NORMAL !== void 0 && (r = !0), i && r) break; } if (!i && !r) return Promise.resolve(n); const s = [], o = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a]; if (i) { const d = l.POSITION !== void 0 ? t.getDependency("accessor", l.POSITION) : n.attributes.position; s.push(d); } if (r) { const d = l.NORMAL !== void 0 ? t.getDependency("accessor", l.NORMAL) : n.attributes.normal; o.push(d); } } return Promise.all([ Promise.all(s), Promise.all(o) ]).then(function(a) { const c = a[0], l = a[1]; return i && (n.morphAttributes.position = c), r && (n.morphAttributes.normal = l), n.morphTargetsRelative = !0, n; }); } function m4(n, e) { if (n.updateMorphTargets(), e.weights !== void 0) for (let t = 0, i = e.weights.length; t < i; t++) n.morphTargetInfluences[t] = e.weights[t]; if (e.extras && Array.isArray(e.extras.targetNames)) { const t = e.extras.targetNames; if (n.morphTargetInfluences.length === t.length) { n.morphTargetDictionary = {}; for (let i = 0, r = t.length; i < r; i++) n.morphTargetDictionary[t[i]] = i; } else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names."); } } function g4(n) { const e = n.extensions && n.extensions[gt.KHR_DRACO_MESH_COMPRESSION]; let t; return e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + xv(e.attributes) : t = n.indices + ":" + xv(n.attributes) + ":" + n.mode, t; } function xv(n) { let e = ""; const t = Object.keys(n).sort(); for (let i = 0, r = t.length; i < r; i++) e += t[i] + ":" + n[t[i]] + ";"; return e; } function Rd(n) { switch (n) { case Int8Array: return 1 / 127; case Uint8Array: return 1 / 255; case Int16Array: return 1 / 32767; case Uint16Array: return 1 / 65535; default: throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type."); } } class v4 { constructor(e = {}, t = {}) { this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new QB(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.textureCache = {}, this.nodeNamesUsed = {}, typeof createImageBitmap < "u" && /Firefox/.test(navigator.userAgent) === !1 ? this.textureLoader = new op(this.options.manager) : this.textureLoader = new qf(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new $n(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0); } setExtensions(e) { this.extensions = e; } setPlugins(e) { this.plugins = e; } parse(e, t) { const i = this, r = this.json, s = this.extensions; this.cache.removeAll(), this._invokeAll(function(o) { return o._markDefs && o._markDefs(); }), Promise.all(this._invokeAll(function(o) { return o.beforeRoot && o.beforeRoot(); })).then(function() { return Promise.all([ i.getDependencies("scene"), i.getDependencies("animation"), i.getDependencies("camera") ]); }).then(function(o) { const a = { scene: o[0][r.scene || 0], scenes: o[0], animations: o[1], cameras: o[2], asset: r.asset, parser: i, userData: {} }; Sa(s, a, r), fs(a, r), Promise.all(i._invokeAll(function(c) { return c.afterRoot && c.afterRoot(a); })).then(function() { e(a); }); }).catch(t); } /** * Marks the special nodes/meshes in json for efficient parse. */ _markDefs() { const e = this.json.nodes || [], t = this.json.skins || [], i = this.json.meshes || []; for (let r = 0, s = t.length; r < s; r++) { const o = t[r].joints; for (let a = 0, c = o.length; a < c; a++) e[o[a]].isBone = !0; } for (let r = 0, s = e.length; r < s; r++) { const o = e[r]; o.mesh !== void 0 && (this._addNodeRef(this.meshCache, o.mesh), o.skin !== void 0 && (i[o.mesh].isSkinnedMesh = !0)), o.camera !== void 0 && this._addNodeRef(this.cameraCache, o.camera); } } /** * Counts references to shared node / Object3D resources. These resources * can be reused, or "instantiated", at multiple nodes in the scene * hierarchy. Mesh, Camera, and Light instances are instantiated and must * be marked. Non-scenegraph resources (like Materials, Geometries, and * Textures) can be reused directly and are not marked here. * * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. */ _addNodeRef(e, t) { t !== void 0 && (e.refs[t] === void 0 && (e.refs[t] = e.uses[t] = 0), e.refs[t]++); } /** Returns a reference to a shared resource, cloning it if necessary. */ _getNodeRef(e, t, i) { if (e.refs[t] <= 1) return i; const r = i.clone(); return r.name += "_instance_" + e.uses[t]++, r; } _invokeOne(e) { const t = Object.values(this.plugins); t.push(this); for (let i = 0; i < t.length; i++) { const r = e(t[i]); if (r) return r; } return null; } _invokeAll(e) { const t = Object.values(this.plugins); t.unshift(this); const i = []; for (let r = 0; r < t.length; r++) { const s = e(t[r]); s && i.push(s); } return i; } /** * Requests the specified dependency asynchronously, with caching. * @param {string} type * @param {number} index * @return {Promise} */ 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>} */ 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} */ 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[gt.KHR_BINARY_GLTF].body); const r = this.options; return new Promise(function(s, o) { i.load(bv(t.uri, r.path), s, void 0, function() { o(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".')); }); }); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views * @param {number} bufferViewIndex * @return {Promise} */ 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} */ loadAccessor(e) { const t = this, i = this.json, r = this.json.accessors[e]; if (r.bufferView === void 0 && r.sparse === void 0) return Promise.resolve(null); const s = []; return r.bufferView !== void 0 ? s.push(this.getDependency("bufferView", r.bufferView)) : s.push(null), r.sparse !== void 0 && (s.push(this.getDependency("bufferView", r.sparse.indices.bufferView)), s.push(this.getDependency("bufferView", r.sparse.values.bufferView))), Promise.all(s).then(function(o) { const a = o[0], c = yv[r.type], l = Ka[r.componentType], d = l.BYTES_PER_ELEMENT, h = d * c, f = r.byteOffset || 0, g = r.bufferView !== void 0 ? i.bufferViews[r.bufferView].byteStride : void 0, p = r.normalized === !0; let u, y; if (g && g !== h) { const v = Math.floor(f / g), m = "InterleavedBuffer:" + r.bufferView + ":" + r.componentType + ":" + v + ":" + r.count; let x = t.cache.get(m); x || (u = new l(a, v * g, r.count * g / d), x = new Qr(u, g / d), t.cache.add(m, x)), y = new ar(x, c, f % g / d, p); } else a === null ? u = new l(r.count * c) : u = new l(a, f, r.count * c), y = new ot(u, c, p); if (r.sparse !== void 0) { const v = yv.SCALAR, m = Ka[r.sparse.indices.componentType], x = r.sparse.indices.byteOffset || 0, w = r.sparse.values.byteOffset || 0, A = new m(o[1], x, r.sparse.count * v), M = new l(o[2], w, r.sparse.count * c); a !== null && (y = new ot(y.array.slice(), y.itemSize, y.normalized)); for (let R = 0, L = A.length; R < L; R++) { const S = A[R]; if (y.setX(S, M[R * c]), c >= 2 && y.setY(S, M[R * c + 1]), c >= 3 && y.setZ(S, M[R * c + 2]), c >= 4 && y.setW(S, M[R * c + 3]), c >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute."); } } return y; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures * @param {number} textureIndex * @return {Promise} */ loadTexture(e) { const t = this.json, i = this.options, r = t.textures[e], s = t.images[r.source]; let o = this.textureLoader; if (s.uri) { const a = i.manager.getHandler(s.uri); a !== null && (o = a); } return this.loadTextureImage(e, s, o); } loadTextureImage(e, t, i) { const r = this, s = this.json, o = this.options, a = s.textures[e], c = (t.uri || t.bufferView) + ":" + a.sampler; if (this.textureCache[c]) return this.textureCache[c]; const l = self.URL || self.webkitURL; let d = t.uri || "", h = !1, f = !0; const g = d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0; if ((t.mimeType === "image/jpeg" || g) && (f = !1), t.bufferView !== void 0) d = r.getDependency("bufferView", t.bufferView).then(function(u) { if (t.mimeType === "image/png") { const v = new DataView(u, 25, 1).getUint8(0, !1); f = v === 6 || v === 4 || v === 3; } h = !0; const y = new Blob([u], { type: t.mimeType }); return d = l.createObjectURL(y), d; }); else if (t.uri === void 0) throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView"); const p = Promise.resolve(d).then(function(u) { return new Promise(function(y, v) { let m = y; i.isImageBitmapLoader === !0 && (m = function(x) { const w = new Yt(x); w.needsUpdate = !0, y(w); }), i.load(bv(u, o.path), m, void 0, v); }); }).then(function(u) { h === !0 && l.revokeObjectURL(d), u.flipY = !1, a.name && (u.name = a.name), f || (u.format = nr); const v = (s.samplers || {})[a.sampler] || {}; return u.magFilter = gv[v.magFilter] || zt, u.minFilter = gv[v.minFilter] || fr, u.wrapS = vv[v.wrapS] || jr, u.wrapT = vv[v.wrapT] || jr, r.associations.set(u, { type: "textures", index: e }), u; }).catch(function() { return console.error("THREE.GLTFLoader: Couldn't load texture", d), null; }); return this.textureCache[c] = p, p; } /** * Asynchronously assigns a texture to the given material parameters. * @param {Object} materialParams * @param {string} mapName * @param {Object} mapDef * @return {Promise} */ assignTexture(e, t, i) { const r = this; return this.getDependency("texture", i.index).then(function(s) { if (i.texCoord !== void 0 && i.texCoord != 0 && !(t === "aoMap" && i.texCoord == 1) && console.warn("THREE.GLTFLoader: Custom UV set " + i.texCoord + " for texture " + t + " not yet supported."), r.extensions[gt.KHR_TEXTURE_TRANSFORM]) { const o = i.extensions !== void 0 ? i.extensions[gt.KHR_TEXTURE_TRANSFORM] : void 0; if (o) { const a = r.associations.get(s); s = r.extensions[gt.KHR_TEXTURE_TRANSFORM].extendTexture(s, o), r.associations.set(s, a); } } e[t] = s; }); } /** * Assigns final material to a Mesh, Line, or Points instance. The instance * already has a material (generated from the glTF material options alone) * but reuse of the same glTF material may require multiple threejs materials * to accommodate different primitive types, defines, etc. New materials will * be created if necessary, and reused from a cache. * @param {Object3D} mesh Mesh, Line, or Points instance. */ assignFinalMaterial(e) { const t = e.geometry; let i = e.material; const r = t.attributes.tangent !== void 0, s = t.attributes.color !== void 0, o = t.attributes.normal === void 0, a = Object.keys(t.morphAttributes).length > 0, c = a && t.morphAttributes.normal !== void 0; if (e.isPoints) { const l = "PointsMaterial:" + i.uuid; let d = this.cache.get(l); d || (d = new es(), tn.prototype.copy.call(d, i), d.color.copy(i.color), d.map = i.map, d.sizeAttenuation = !1, this.cache.add(l, d)), i = d; } else if (e.isLine) { const l = "LineBasicMaterial:" + i.uuid; let d = this.cache.get(l); d || (d = new an(), tn.prototype.copy.call(d, i), d.color.copy(i.color), this.cache.add(l, d)), i = d; } if (r || s || o || a) { let l = "ClonedMaterial:" + i.uuid + ":"; i.isGLTFSpecularGlossinessMaterial && (l += "specular-glossiness:"), r && (l += "vertex-tangents:"), s && (l += "vertex-colors:"), o && (l += "flat-shading:"), a && (l += "morph-targets:"), c && (l += "morph-normals:"); let d = this.cache.get(l); d || (d = i.clone(), s && (d.vertexColors = !0), o && (d.flatShading = !0), a && (d.morphTargets = !0), c && (d.morphNormals = !0), r && (d.vertexTangents = !0, d.normalScale && (d.normalScale.y *= -1), d.clearcoatNormalScale && (d.clearcoatNormalScale.y *= -1)), this.cache.add(l, d), this.associations.set(d, this.associations.get(i))), i = d; } i.aoMap && t.attributes.uv2 === void 0 && t.attributes.uv !== void 0 && t.setAttribute("uv2", t.attributes.uv), e.material = i; } getMaterialType() { return zs; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials * @param {number} materialIndex * @return {Promise} */ 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[gt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) { const h = r[gt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]; o = h.getMaterialType(), l.push(h.extendParams(a, s, t)); } else if (c[gt.KHR_MATERIALS_UNLIT]) { const h = r[gt.KHR_MATERIALS_UNLIT]; o = h.getMaterialType(), l.push(h.extendParams(a, s, t)); } else { const h = s.pbrMetallicRoughness || {}; if (a.color = new Ue(1, 1, 1), a.opacity = 1, Array.isArray(h.baseColorFactor)) { const f = h.baseColorFactor; a.color.fromArray(f), a.opacity = f[3]; } h.baseColorTexture !== void 0 && l.push(t.assignTexture(a, "map", h.baseColorTexture)), a.metalness = h.metallicFactor !== void 0 ? h.metallicFactor : 1, a.roughness = h.roughnessFactor !== void 0 ? h.roughnessFactor : 1, h.metallicRoughnessTexture !== void 0 && (l.push(t.assignTexture(a, "metalnessMap", h.metallicRoughnessTexture)), l.push(t.assignTexture(a, "roughnessMap", h.metallicRoughnessTexture))), o = this._invokeOne(function(f) { return f.getMaterialType && f.getMaterialType(e); }), l.push(Promise.all(this._invokeAll(function(f) { return f.extendMaterialParams && f.extendMaterialParams(e, a); }))); } s.doubleSided === !0 && (a.side = Wr); const d = s.alphaMode || Lh.OPAQUE; return d === Lh.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, d === Lh.MASK && (a.alphaTest = s.alphaCutoff !== void 0 ? s.alphaCutoff : 0.5)), s.normalTexture !== void 0 && o !== In && (l.push(t.assignTexture(a, "normalMap", s.normalTexture)), a.normalScale = new Re(1, -1), s.normalTexture.scale !== void 0 && a.normalScale.set(s.normalTexture.scale, -s.normalTexture.scale)), s.occlusionTexture !== void 0 && o !== In && (l.push(t.assignTexture(a, "aoMap", s.occlusionTexture)), s.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = s.occlusionTexture.strength)), s.emissiveFactor !== void 0 && o !== In && (a.emissive = new Ue().fromArray(s.emissiveFactor)), s.emissiveTexture !== void 0 && o !== In && l.push(t.assignTexture(a, "emissiveMap", s.emissiveTexture)), Promise.all(l).then(function() { let h; return o === Cd ? h = r[gt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a) : h = new o(a), s.name && (h.name = s.name), h.map && (h.map.encoding = Cs), h.emissiveMap && (h.emissiveMap.encoding = Cs), fs(h, s), t.associations.set(h, { type: "materials", index: e }), s.extensions && Sa(r, h, s), h; }); } /** When Object3D instances are targeted by animation, they need unique names. */ createUniqueName(e) { const t = mt.sanitizeNodeName(e || ""); let i = t; for (let r = 1; this.nodeNamesUsed[i]; ++r) i = t + "_" + r; return this.nodeNamesUsed[i] = !0, i; } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry * * Creates BufferGeometries from primitives. * * @param {Array} primitives * @return {Promise>} */ loadGeometries(e) { const t = this, i = this.extensions, r = this.primitiveCache; function s(a) { return i[gt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, t).then(function(c) { return Mv(c, a, t); }); } const o = []; for (let a = 0, c = e.length; a < c; a++) { const l = e[a], d = g4(l), h = r[d]; if (h) o.push(h.promise); else { let f; l.extensions && l.extensions[gt.KHR_DRACO_MESH_COMPRESSION] ? f = s(l) : f = Mv(new Ke(), l, t), r[d] = { primitive: l, promise: f }, o.push(f); } } return Promise.all(o); } /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes * @param {number} meshIndex * @return {Promise} */ 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 ? f4(this.cache) : this.getDependency("material", o[c].material); a.push(d); } return a.push(t.loadGeometries(o)), Promise.all(a).then(function(c) { const l = c.slice(0, c.length - 1), d = c[c.length - 1], h = []; for (let g = 0, p = d.length; g < p; g++) { const u = d[g], y = o[g]; let v; const m = l[g]; if (y.mode === Xi.TRIANGLES || y.mode === Xi.TRIANGLE_STRIP || y.mode === Xi.TRIANGLE_FAN || y.mode === void 0) v = s.isSkinnedMesh === !0 ? new vl(u, m) : new Xt(u, m), v.isSkinnedMesh === !0 && !v.geometry.attributes.skinWeight.normalized && v.normalizeSkinWeights(), y.mode === Xi.TRIANGLE_STRIP ? v.geometry = wv(v.geometry, Zb) : y.mode === Xi.TRIANGLE_FAN && (v.geometry = wv(v.geometry, wf)); else if (y.mode === Xi.LINES) v = new Rn(u, m); else if (y.mode === Xi.LINE_STRIP) v = new Oi(u, m); else if (y.mode === Xi.LINE_LOOP) v = new Au(u, m); else if (y.mode === Xi.POINTS) v = new ia(u, m); else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + y.mode); Object.keys(v.geometry.morphAttributes).length > 0 && m4(v, s), v.name = t.createUniqueName(s.name || "mesh_" + e), fs(v, s), y.extensions && Sa(r, v, y), t.assignFinalMaterial(v), h.push(v); } if (h.length === 1) return h[0]; const f = new _i(); for (let g = 0, p = h.length; g < p; g++) f.add(h[g]); return f; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras * @param {number} cameraIndex * @return {Promise} */ loadCamera(e) { let t; const i = this.json.cameras[e], r = i[i.type]; if (!r) { console.warn("THREE.GLTFLoader: Missing camera parameters."); return; } return i.type === "perspective" ? t = new nn(xd.radToDeg(r.yfov), r.aspectRatio || 1, r.znear || 1, r.zfar || 2e6) : i.type === "orthographic" && (t = new sa(-r.xmag, r.xmag, r.ymag, -r.ymag, r.znear, r.zfar)), i.name && (t.name = this.createUniqueName(i.name)), fs(t, i), Promise.resolve(t); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins * @param {number} skinIndex * @return {Promise} */ 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} */ loadAnimation(e) { const i = this.json.animations[e], r = [], s = [], o = [], a = [], c = []; for (let l = 0, d = i.channels.length; l < d; l++) { const h = i.channels[l], f = i.samplers[h.sampler], g = h.target, p = g.node !== void 0 ? g.node : g.id, u = i.parameters !== void 0 ? i.parameters[f.input] : f.input, y = i.parameters !== void 0 ? i.parameters[f.output] : f.output; r.push(this.getDependency("node", p)), s.push(this.getDependency("accessor", u)), o.push(this.getDependency("accessor", y)), a.push(f), c.push(g); } return Promise.all([ Promise.all(r), Promise.all(s), Promise.all(o), Promise.all(a), Promise.all(c) ]).then(function(l) { const d = l[0], h = l[1], f = l[2], g = l[3], p = l[4], u = []; for (let v = 0, m = d.length; v < m; v++) { const x = d[v], w = h[v], A = f[v], M = g[v], R = p[v]; if (x === void 0) continue; x.updateMatrix(), x.matrixAutoUpdate = !0; let L; switch (_r[R.path]) { case _r.weights: L = Ho; break; case _r.rotation: L = ks; break; case _r.position: case _r.scale: default: L = Wo; break; } const S = x.name ? x.name : x.uuid, I = M.interpolation !== void 0 ? d4[M.interpolation] : Es, T = []; _r[R.path] === _r.weights ? x.traverse(function(E) { E.isMesh === !0 && E.morphTargetInfluences && T.push(E.name ? E.name : E.uuid); }) : T.push(S); let _ = A.array; if (A.normalized) { const E = Rd(_.constructor), C = new Float32Array(_.length); for (let P = 0, b = _.length; P < b; P++) C[P] = _[P] * E; _ = C; } for (let E = 0, C = T.length; E < C; E++) { const P = new L( T[E] + "." + _r[R.path], w.array, _, I ); M.interpolation === "CUBICSPLINE" && (P.createInterpolant = function(F) { return new $o(this.times, this.values, this.getValueSize() / 3, F); }, P.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0), u.push(P); } } const y = i.name ? i.name : "animation_" + e; return new jo(y, void 0, u); }); } createNodeMesh(e) { const t = this.json, i = this, r = t.nodes[e]; return r.mesh === void 0 ? null : i.getDependency("mesh", r.mesh).then(function(s) { const o = i._getNodeRef(i.meshCache, r.mesh, s); return r.weights !== void 0 && o.traverse(function(a) { if (a.isMesh) for (let c = 0, l = r.weights.length; c < l; c++) a.morphTargetInfluences[c] = r.weights[c]; }), o; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy * @param {number} nodeIndex * @return {Promise} */ loadNode(e) { const t = this.json, i = this.extensions, r = this, s = t.nodes[e], o = s.name ? r.createUniqueName(s.name) : ""; return function() { const a = [], c = r._invokeOne(function(l) { return l.createNodeMesh && l.createNodeMesh(e); }); return c && a.push(c), s.camera !== void 0 && a.push(r.getDependency("camera", s.camera).then(function(l) { return r._getNodeRef(r.cameraCache, s.camera, l); })), r._invokeAll(function(l) { return l.createNodeAttachment && l.createNodeAttachment(e); }).forEach(function(l) { a.push(l); }), Promise.all(a); }().then(function(a) { let c; if (s.isBone === !0 ? c = new yl() : a.length > 1 ? c = new _i() : a.length === 1 ? c = a[0] : c = new ut(), c !== a[0]) for (let l = 0, d = a.length; l < d; l++) c.add(a[l]); if (s.name && (c.userData.name = s.name, c.name = o), fs(c, s), s.extensions && Sa(i, c, s), s.matrix !== void 0) { const l = new Xe(); l.fromArray(s.matrix), c.applyMatrix4(l); } else s.translation !== void 0 && c.position.fromArray(s.translation), s.rotation !== void 0 && c.quaternion.fromArray(s.rotation), s.scale !== void 0 && c.scale.fromArray(s.scale); return r.associations.set(c, { type: "nodes", index: e }), c; }); } /** * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes * @param {number} sceneIndex * @return {Promise} */ loadScene(e) { const t = this.json, i = this.extensions, r = this.json.scenes[e], s = this, o = new _i(); r.name && (o.name = s.createUniqueName(r.name)), fs(o, r), r.extensions && Sa(i, o, r); const a = r.nodes || [], c = []; for (let l = 0, d = a.length; l < d; l++) c.push(fM(a[l], o, t, s)); return Promise.all(c).then(function() { return o; }); } } function fM(n, e, t, i) { const r = t.nodes[n]; return i.getDependency("node", n).then(function(s) { if (r.skin === void 0) return s; let o; return i.getDependency("skin", r.skin).then(function(a) { o = a; const c = []; for (let l = 0, d = o.joints.length; l < d; l++) c.push(i.getDependency("node", o.joints[l])); return Promise.all(c); }).then(function(a) { return s.traverse(function(c) { if (!c.isMesh) return; const l = [], d = []; for (let h = 0, f = a.length; h < f; h++) { const g = a[h]; if (g) { l.push(g); const p = new Xe(); o.inverseBindMatrices !== void 0 && p.fromArray(o.inverseBindMatrices.array, h * 16), d.push(p); } else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', o.joints[h]); } c.bind(new bl(l, d), c.matrixWorld); }), s; }); }).then(function(s) { e.add(s); const o = []; if (r.children) { const a = r.children; for (let c = 0, l = a.length; c < l; c++) { const d = a[c]; o.push(fM(d, s, t, i)); } } return Promise.all(o); }); } function y4(n, e, t) { const i = e.attributes, r = new Nn(); if (i.POSITION !== void 0) { const a = t.json.accessors[i.POSITION], c = a.min, l = a.max; if (c !== void 0 && l !== void 0) { if (r.set( new q(c[0], c[1], c[2]), new q(l[0], l[1], l[2]) ), a.normalized) { const d = Rd(Ka[a.componentType]); r.min.multiplyScalar(d), r.max.multiplyScalar(d); } } else { console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); return; } } else return; const s = e.targets; if (s !== void 0) { const a = new q(), c = new q(); for (let l = 0, d = s.length; l < d; l++) { const h = s[l]; if (h.POSITION !== void 0) { const f = t.json.accessors[h.POSITION], g = f.min, p = f.max; if (g !== void 0 && p !== void 0) { if (c.setX(Math.max(Math.abs(g[0]), Math.abs(p[0]))), c.setY(Math.max(Math.abs(g[1]), Math.abs(p[1]))), c.setZ(Math.max(Math.abs(g[2]), Math.abs(p[2]))), f.normalized) { const u = Rd(Ka[f.componentType]); c.multiplyScalar(u); } a.max(c); } else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."); } } r.expandByVector(a); } n.boundingBox = r; const o = new pr(); r.getCenter(o.center), o.radius = r.min.distanceTo(r.max) / 2, n.boundingSphere = o; } function Mv(n, e, t) { const i = e.attributes, r = []; function s(o, a) { return t.getDependency("accessor", o).then(function(c) { n.setAttribute(a, c); }); } for (const o in i) { const a = Ld[o] || o.toLowerCase(); a in n.attributes || r.push(s(i[o], a)); } if (e.indices !== void 0 && !n.index) { const o = t.getDependency("accessor", e.indices).then(function(a) { n.setIndex(a); }); r.push(o); } return fs(n, e), y4(n, e, t), Promise.all(r).then(function() { return e.targets !== void 0 ? p4(n, e.targets, t) : n; }); } function wv(n, e) { let t = n.getIndex(); if (t === null) { const o = [], a = n.getAttribute("position"); if (a !== void 0) { for (let c = 0; c < a.count; c++) o.push(c); n.setIndex(o), t = n.getIndex(); } else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), n; } const i = t.count - 2, r = []; if (e === wf) for (let o = 1; o <= i; o++) r.push(t.getX(0)), r.push(t.getX(o)), r.push(t.getX(o + 1)); else for (let o = 0; o < i; o++) o % 2 === 0 ? (r.push(t.getX(o)), r.push(t.getX(o + 1)), r.push(t.getX(o + 2))) : (r.push(t.getX(o + 2)), r.push(t.getX(o + 1)), r.push(t.getX(o))); r.length / 3 !== i && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."); const s = n.clone(); return s.setIndex(r), s; } const b4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, GLTFLoader: qB }, Symbol.toStringTag, { value: "Module" })), x4 = /* @__PURE__ */ au(b4); var Rh = { exports: {} }, Av; function M4() { return Av || (Av = 1, function(n) { function e(l) { var d = {}; function h(g) { if (d[g]) return d[g].exports; var p = d[g] = { /******/ i: g, /******/ l: !1, /******/ exports: {} /******/ }; return l[g].call(p.exports, p, p.exports, h), p.l = !0, p.exports; } h.m = l, h.c = d, h.i = function(g) { return g; }, h.d = function(g, p, u) { h.o(g, p) || Object.defineProperty(g, p, { /******/ configurable: !1, /******/ enumerable: !0, /******/ get: u /******/ }); }, h.r = function(g) { Object.defineProperty(g, "__esModule", { value: !0 }); }, h.n = function(g) { var p = g && g.__esModule ? ( /******/ function() { return g.default; } ) : ( /******/ function() { return g; } ); return h.d(p, "a", p), p; }, h.o = function(g, p) { return Object.prototype.hasOwnProperty.call(g, p); }, h.p = "/", h.oe = function(g) { throw console.error(g), g; }; var f = h(h.s = ENTRY_MODULE); return f.default || f; } var t = "[\\.|\\-|\\+|\\w|/|@]+", i = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + t + ").*?\\)"; function r(l) { return (l + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); } function s(l) { return !isNaN(1 * l); } function o(l, d, h) { var f = {}; f[h] = []; var g = d.toString(), p = g.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/); if (!p) return f; for (var u = p[1], y = new RegExp("(\\\\n|\\W)" + r(u) + i, "g"), v; v = y.exec(g); ) v[3] !== "dll-reference" && f[h].push(v[3]); for (y = new RegExp("\\(" + r(u) + '\\("(dll-reference\\s(' + t + '))"\\)\\)' + i, "g"); v = y.exec(g); ) l[v[2]] || (f[h].push(v[1]), l[v[2]] = __webpack_require__(v[1]).m), f[v[2]] = f[v[2]] || [], f[v[2]].push(v[4]); for (var m = Object.keys(f), x = 0; x < m.length; x++) for (var w = 0; w < f[m[x]].length; w++) s(f[m[x]][w]) && (f[m[x]][w] = 1 * f[m[x]][w]); return f; } function a(l) { var d = Object.keys(l); return d.reduce(function(h, f) { return h || l[f].length > 0; }, !1); } function c(l, d) { for (var h = { main: [d] }, f = { main: [] }, g = { main: {} }; a(h); ) for (var p = Object.keys(h), u = 0; u < p.length; u++) { var y = p[u], v = h[y], m = v.pop(); if (g[y] = g[y] || {}, !(g[y][m] || !l[y][m])) { g[y][m] = !0, f[y] = f[y] || [], f[y].push(m); for (var x = o(l, l[y][m], y), w = Object.keys(x), A = 0; A < w.length; A++) h[w[A]] = h[w[A]] || [], h[w[A]] = h[w[A]].concat(x[w[A]]); } } return f; } n.exports = function(l, d) { d = d || {}; var h = { main: __webpack_modules__ }, f = d.all ? { main: Object.keys(h.main) } : c(h, l), g = ""; Object.keys(f).filter(function(m) { return m !== "main"; }).forEach(function(m) { for (var x = 0; f[m][x]; ) x++; f[m].push(x), h[m][x] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", g = g + "var " + m + " = (" + e.toString().replace("ENTRY_MODULE", JSON.stringify(x)) + ")({" + f[m].map(function(w) { return "" + JSON.stringify(w) + ": " + h[m][w].toString(); }).join(",") + `}); `; }), g = g + "new ((" + e.toString().replace("ENTRY_MODULE", JSON.stringify(l)) + ")({" + f.main.map(function(m) { return "" + JSON.stringify(m) + ": " + h.main[m].toString(); }).join(",") + "}))(self);"; var p = new window.Blob([g], { type: "text/javascript" }); if (d.bare) return p; var u = window.URL || window.webkitURL || window.mozURL || window.msURL, y = u.createObjectURL(p), v = new window.Worker(y); return v.objectURL = y, v; }; }(Rh)), Rh.exports; } function w4(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 A4(n) { var e = this; return new e(function(t, i) { if (!(n && typeof n.length < "u")) return i( new TypeError( typeof n + " " + n + " is not iterable(cannot read property Symbol(Symbol.iterator))" ) ); var r = Array.prototype.slice.call(n); if (r.length === 0) return t([]); var s = r.length; function o(c, l) { if (l && (typeof l == "object" || typeof l == "function")) { var d = l.then; if (typeof d == "function") { d.call( l, function(h) { o(c, h); }, function(h) { r[c] = { status: "rejected", reason: h }, --s === 0 && t(r); } ); return; } } r[c] = { status: "fulfilled", value: l }, --s === 0 && t(r); } for (var a = 0; a < r.length; a++) o(a, r[a]); }); } function pM(n, e) { this.name = "AggregateError", this.errors = n, this.message = e || ""; } pM.prototype = Error.prototype; function S4(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 pM( s, "All promises were rejected" ) ); }); } catch (a) { i(a); } }); } var _4 = setTimeout; function mM(n) { return !!(n && typeof n.length < "u"); } function T4() { } function E4(n, e) { return function() { n.apply(e, arguments); }; } function Dt(n) { if (!(this instanceof Dt)) throw new TypeError("Promises must be constructed via new"); if (typeof n != "function") throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], vM(n, this); } function gM(n, e) { for (; n._state === 3; ) n = n._value; if (n._state === 0) { n._deferreds.push(e); return; } n._handled = !0, Dt._immediateFn(function() { var t = n._state === 1 ? e.onFulfilled : e.onRejected; if (t === null) { (n._state === 1 ? Fd : qa)(e.promise, n._value); return; } var i; try { i = t(n._value); } catch (r) { qa(e.promise, r); return; } Fd(e.promise, i); }); } function Fd(n, e) { try { if (e === n) throw new TypeError("A promise cannot be resolved with itself."); if (e && (typeof e == "object" || typeof e == "function")) { var t = e.then; if (e instanceof Dt) { n._state = 3, n._value = e, Pd(n); return; } else if (typeof t == "function") { vM(E4(t, e), n); return; } } n._state = 1, n._value = e, Pd(n); } catch (i) { qa(n, i); } } function qa(n, e) { n._state = 2, n._value = e, Pd(n); } function Pd(n) { n._state === 2 && n._deferreds.length === 0 && Dt._immediateFn(function() { n._handled || Dt._unhandledRejectionFn(n._value); }); for (var e = 0, t = n._deferreds.length; e < t; e++) gM(n, n._deferreds[e]); n._deferreds = null; } function C4(n, e, t) { this.onFulfilled = typeof n == "function" ? n : null, this.onRejected = typeof e == "function" ? e : null, this.promise = t; } function vM(n, e) { var t = !1; try { n( function(i) { t || (t = !0, Fd(e, i)); }, function(i) { t || (t = !0, qa(e, i)); } ); } catch (i) { if (t) return; t = !0, qa(e, i); } } Dt.prototype.catch = function(n) { return this.then(null, n); }; Dt.prototype.then = function(n, e) { var t = new this.constructor(T4); return gM(this, new C4(n, e, t)), t; }; Dt.prototype.finally = w4; Dt.all = function(n) { return new Dt(function(e, t) { if (!mM(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 = S4; Dt.allSettled = A4; 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 (!mM(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) { _4(n, 0); }; Dt._unhandledRejectionFn = function(e) { typeof console < "u" && console && console.warn("Possible Unhandled Promise Rejection:", e); }; const L4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Dt }, Symbol.toStringTag, { value: "Module" })), R4 = /* @__PURE__ */ au(L4); (function(n, e) { (function(i, r) { n.exports = r(); })(Lr, () => ( /******/ (() => { var t = [ /* 0 */ /***/ (o, a, c) => { c(1); var l = c(2), d = l.version, h = function() { this.Revision = d, this.defaultMaterialColor = 16777215, this.defaultOpacity = 1, this.modelPrefix = void 0, this.Geometry = c(3).Geometry, this.Glyph = c(16).Glyph, this.Glyphset = c(18).Glyphset, this.Pointset = c(22).Pointset, this.Label = c(17).Label, this.Lines = c(24).Lines, this.TextureArray = c(25).TextureArray, this.TextureSlides = c(27).TextureSlides, this.Renderer = c(30).Renderer, this.Scene = c(32).Scene, this.GeometryCSG = c(51).GeometryCSG, this.GlyphsetCSG = c(57).GlyphsetCSG, this.Viewport = c(44).Viewport, this.CameraControls = c(44).CameraControls, this.SmoothCameraTransition = c(44).SmoothCameraTransition, this.RayCaster = c(44).RayCaster, this.CameraAutoTumble = c(44).CameraAutoTumble, this.StereoEffect = c(44).StereoEffect, this.loadExternalFile = c(5).loadExternalFile, this.loadExternalFiles = c(5).loadExternalFiles, this.THREE = c(4); }; o.exports = new h(); }, /* 1 */ /***/ (o) => { o.exports = b3(); }, /* 2 */ /***/ (o) => { o.exports = /* @__PURE__ */ JSON.parse('{"name":"zincjs","version":"1.15.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 ","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}'); }, /* 3 */ /***/ function(o, a, c) { var l = c(4), d = c(5).toBufferGeometry, h = (g, p, u) => { var y = d(g, u), v = !1; 1 > u.opacity && (v = !0); var m; if (y._video === void 0) { var x = u.localTimeEnabled || u.localMorphColour; p ? (m = p, m.morphTargets = x, m.morphNormals = u.localTimeEnabled) : y instanceof l.BufferGeometry && y.attributes.color === void 0 ? m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: x, morphNormals: u.localTimeEnabled, transparent: v, opacity: u.opacity, side: l.DoubleSide }) : m = new l.MeshPhongMaterial({ color: u.colour, morphTargets: x, morphNormals: u.localTimeEnabled, vertexColors: l.VertexColors, transparent: v, opacity: u.opacity, side: l.DoubleSide }), u.localMorphColour && y.morphAttributes.color && (m.onBeforeCompile = c(9).augmentMorphColor()); } else { var w = y._video.createCanvasVideoTexture(); m = new l.MeshBasicMaterial({ morphTargets: u.localTimeEnabled, color: new l.Color(1, 1, 1), transparent: v, opacity: u.opacity, map: w, side: l.DoubleSide }), this.videoHandler = y._video; } return new l.Mesh(y, m); }, f = function() { c(10).ZincObject.call(this), this.videoHandler = void 0, this.isGeometry = !0, this.createMesh = (g, p, u) => { if (!(this.morph && this.morph.geometry && g != null)) { var y = h(g, p, u); this.setMesh(y, u.localTimeEnabled, u.localMorphColour); } }, this.calculateUVs = () => { this.geometry.computeBoundingBox(); var g = this.geometry.boundingBox.max, p = this.geometry.boundingBox.min, u = new l.Vector2(0 - p.x, 0 - p.y), y = new l.Vector2(g.x - p.x, g.y - p.y); this.geometry.faceVertexUvs[0] = []; for (var v = 0; v < this.geometry.faces.length; v++) { var m = this.geometry.vertices[this.geometry.faces[v].a], x = this.geometry.vertices[this.geometry.faces[v].b], w = this.geometry.vertices[this.geometry.faces[v].c]; geometry.faceVertexUvs[0].push([new l.Vector2((m.x + u.x) / y.x, (m.y + u.y) / y.y), new l.Vector2((x.x + u.x) / y.x, (x.y + u.y) / y.y), new l.Vector2((w.x + u.x) / y.x, (w.y + u.y) / y.y)]); } geometry.uvsNeedUpdate = !0; }, this.checkTransparentMesh = function() { this._lod.checkTransparentMesh(); }, this.setWireframe = (g) => { this.morph.material.wireframe = g; }, this.editVertices = function(g, p) { if (g && g.length) { var u = this.getMorph(), y = u.geometry.getAttribute("position"); if (!u || 0 > p) return; var v = 3 * p; g.forEach((m) => { y.array[v++] = m[0], y.array[v++] = m[1], y.array[v++] = m[2]; }), y.needsUpdate = !0, u.geometry.computeBoundingBox(), u.geometry.computeBoundingSphere(), this.boundingBoxUpdateRequired = !0; } }; }; f.prototype = Object.create(c(10).ZincObject.prototype), a.Geometry = f; }, /* 4 */ /***/ (o) => { o.exports = IB; }, /* 5 */ /***/ (o, a, c) => { function l(S) { throw new TypeError('"' + S + '" is read-only'); } var d = c(4), h = c(6).Geometry, f = c(7).default; function g(S) { var I = S, T = c(0).modelPrefix; return T && (T[T.length - 1] != "/" && l("prefix"), /^(?:[a-z]+:)?\/\//i.test(S) || (I = T + S)), I; } function p(S, I) { var T = (E, C) => { try { var P = new URL(E, C).href; if (E && 2 > E.split("?").length) { var b = C.split("?"); b.length === 2 && (P = P + "?" + b[1]); } return P; } catch { console.error("There is an issue creating the url link with: ".concat(E, ".")); } }; if (!Array.isArray(S)) return T(S, I); var _ = []; return S.forEach((E) => { _.push(T(E, I)); }), _; } function u(S, I, T, _, E) { var C = S.morphTargetInfluences, P = void 0; S.geometry && (P = S.geometry.morphAttributes); var b = !1; if (C && P && P.position) { _.set(0, 0, 0), E.set(0, 0, 0); for (var F = 0; F < C.length; F++) 0 < C[F] && (b = !0, T.setFromArray(P.position[F].array), _.add(T.min.multiplyScalar(C[F])), E.add(T.max.multiplyScalar(C[F]))); b && I.set(_, E); } b || I.setFromBufferAttribute(S.geometry.attributes.position), S.updateWorldMatrix(!0, !0), I.applyMatrix4(S.matrixWorld); } function y(S, I, T, _) { var E = new XMLHttpRequest(); E.open("GET", g(S), !0), E.onreadystatechange = () => { E.readyState == 4 && (E.status == 200 ? T(E.responseText, I) : _(S)); }, E.send(null); } function v(S, I, T) { function _(F, D) { P[D] = F, C++, C == E && I(P); } for (var E = S.length, C = 0, P = [], b = 0; b < E; b++) y(S[b], b, _, T); } a.getColorsRGB = (S, I) => { var T = Math.floor(I / 3), _ = I % 3, E = 0; _ == 0 ? E = S[T].r : _ == 1 ? E = S[T].g : _ == 2 && (E = S[T].b); var C = new d.Color(E); return [C.r, C.g, C.b]; }, a.updateMorphColorAttribute = function(S, I) { if (I && S && S.morphAttributes && S.morphAttributes.color) { var T = S.morphAttributes.color, _ = I.morphTargetInfluences, E = _.length; S.deleteAttribute("morphColor0"), S.deleteAttribute("morphColor1"); for (var C = 0, P = [], b = 0; 1 > C || b < E; b++) 0 < _[b] && (C++, P.push([b, _[b]])); P.length == 2 ? (S.setAttribute("morphColor0", T[P[0][0]]), S.setAttribute("morphColor1", T[P[1][0]])) : P.length == 1 && (S.setAttribute("morphColor0", T[P[0][0]]), S.setAttribute("morphColor1", T[P[0][0]])); } }, a.toBufferGeometry = (S, I) => { var T; return S instanceof h ? (I.localTimeEnabled && !S.morphNormalsReady && (S.morphNormals == null || S.morphNormals.length == 0) && S.computeMorphNormals(), T = S.toIndexedBufferGeometry(), I.localMorphColour && m(S, T)) : S instanceof d.BufferGeometry && (T = S.clone()), T.colorsNeedUpdate = !0, T.computeBoundingBox(), T.computeBoundingSphere(), S._video && (T._video = S._video), T; }, a.copyMorphColorsToBufferGeometry = (S, I) => { if (S && S.morphColors && 0 < S.morphColors.length) { for (var T = [], _ = S.morphColors, E = c(5).getColorsRGB, C = 0, P = _.length; C < P; C++) { for (var b = _[C], F = [], D = 0; D < S.faces.length; D++) { var N = S.faces[D], B = E(b.colors, N.a); F.push(B[0], B[1], B[2]), B = E(b.colors, N.b), F.push(B[0], B[1], B[2]), B = E(b.colors, N.c), F.push(B[0], B[1], B[2]); } var U = new d.Float32BufferAttribute(3 * (3 * S.faces.length), 3); U.name = b.name, T.push(U.copyArray(F)); } I.morphAttributes.color = T; } }; var m = (S, I) => { if (S && S.morphColors && 0 < S.morphColors.length) { for (var T = [], _ = S.morphColors, E = c(5).getColorsRGB, C = 0, P = _.length; C < P; C++) { for (var b, F = _[C], D = [], N = 0; N < 3 * F.colors.length; N++) b = E(F.colors, N), D.push(b[0], b[1], b[2]); var B = new d.Float32BufferAttribute(D, 3); B.name = F.name, T.push(B); } I.morphAttributes.color = T; } }; function x(S) { for (var I, T, _, E, C = -1, P = 0, b = 0; b < S.length; ++b) { if (E = S[b], I === void 0 && (I = E.array.constructor), I !== E.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null; if (T === void 0 && (T = E.itemSize), T !== E.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null; if (_ === void 0 && (_ = E.normalized), _ !== E.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null; if (C === -1 && (C = E.gpuType), C !== E.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null; P += E.count * T; } for (var F, D = new I(P), N = new d.BufferAttribute(D, T, _), B = 0, U = 0; U < S.length; ++U) { if (F = S[U], F.isInterleavedBufferAttribute) for (var G = B / T, Y = 0, te = F.count; Y < te; Y++) for (var ae, ie = 0; ie < T; ie++) ae = F.getComponent(Y, ie), N.setComponent(Y + G, ie, ae); else D.set(F.array, B); B += F.count * T; } return C !== void 0 && (N.gpuType = C), N; } a.mergeGeometries = function(S) { for (var I = 1 < arguments.length && arguments[1] !== void 0 && arguments[1], T = S[0].index !== null, _ = new Set(Object.keys(S[0].attributes)), E = new Set(Object.keys(S[0].morphAttributes)), C = {}, P = {}, b = S[0].morphTargetsRelative, F = new d.BufferGeometry(), D = 0, N = 0; N < S.length; ++N) { var B = S[N], U = 0; if (T !== (B.index !== null)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null; for (var G in B.attributes) { if (!_.has(G)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + '. All geometries must have compatible attributes; make sure "' + G + '" attribute exists among all geometries, or in none of them.'), null; C[G] === void 0 && (C[G] = []), C[G].push(B.attributes[G]), U++; } if (U !== _.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". Make sure all geometries have the same number of attributes."), null; if (b !== B.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". .morphTargetsRelative must be consistent throughout all geometries."), null; for (var Y in B.morphAttributes) { if (!E.has(Y)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". .morphAttributes must be consistent throughout all geometries."), null; P[Y] === void 0 && (P[Y] = []), P[Y].push(B.morphAttributes[Y]); } if (I) { var te = void 0; if (T) te = B.index.count; else if (B.attributes.position !== void 0) te = B.attributes.position.count; else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + N + ". The geometry must have either an index or a position attribute"), null; F.addGroup(D, te, N), D += te; } } if (T) { for (var ae, ie = 0, le = [], W = 0; W < S.length; ++W) { ae = S[W].index; for (var $ = 0; $ < ae.count; ++$) le.push(ae.getX($) + ie); ie += S[W].attributes.position.count; } F.setIndex(le); } for (var j in C) { var re = x(C[j]); if (!re) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + j + " attribute."), null; F.setAttribute(j, re); } for (var V in P) { var H = P[V][0].length; if (H === 0) break; F.morphAttributes = F.morphAttributes || {}, F.morphAttributes[V] = []; for (var K, ce = 0; ce < H; ++ce) { K = []; for (var se = 0; se < P[V].length; ++se) K.push(P[V][se][ce]); var k = x(K); if (!k) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + V + " morphAttribute."), null; F.morphAttributes[V].push(k); } } return F; }, a.mergeVertices = function(S) { var I = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 1e-4; I = Math.max(I, Number.EPSILON); for (var T, _ = {}, E = S.getIndex(), C = S.getAttribute("position"), P = E ? E.count : C.count, b = 0, F = Object.keys(S.attributes), D = {}, N = {}, be = [], B = ["getX", "getY", "getZ", "getW"], U = 0, G = F.length; U < G; U++) { T = F[U], D[T] = []; var Y = S.morphAttributes[T]; Y && (N[T] = Array(Y.length).fill().map(() => [])); } for (var te = Math.log10(1 / I), ae = Math.pow(10, te), U = 0; U < P; U++) { for (var ie = E ? E.getX(U) : U, le = "", W = 0, G = F.length; W < G; W++) for (var T = F[W], $ = S.getAttribute(T), j = $.itemSize, re = 0; re < j; re++) le += "".concat(~~($[B[re]](ie) * ae), ","); if (le in _) be.push(_[le]); else { for (var W = 0, G = F.length; W < G; W++) for (var V, T = F[W], $ = S.getAttribute(T), Y = S.morphAttributes[T], j = $.itemSize, H = D[T], K = N[T], re = 0; re < j; re++) if (V = B[re], H.push($[V](ie)), Y) for (var ce = 0, se = Y.length; ce < se; ce++) K[ce].push(Y[ce][V](ie)); _[le] = b, be.push(b), b++; } } for (var k = S.clone(), U = 0, G = F.length; U < G; U++) { var $, T = F[U], O = S.getAttribute(T), Z = new O.array.constructor(D[T]); if (O.isInterleavedBufferAttribute ? $ = new d.BufferAttribute(Z, O.itemSize, O.itemSize) : ($ = S.getAttribute(T).clone(), $.setArray(Z)), k.setAttribute(T, $), T in N) for (var X, W = 0; W < N[T].length; W++) X = S.morphAttributes[T][W].clone(), X.setArray(new X.array.constructor(N[T][W])), k.morphAttributes[T][W] = X; } var ee = Uint8Array; be.length >= Math.pow(2, 8) && (ee = Uint16Array), be.length >= Math.pow(2, 16) && (ee = Uint32Array); var fe = new ee(be), be = null; return E === null ? be = new d.BufferAttribute(fe, 1) : (be = S.getIndex().clone(), be.setArray(fe)), k.setIndex(be), k; }; function w(S) { if (S.isMeshPhongMaterial) { var I = new d.MeshToonMaterial({ color: S.color.clone(), morphTargets: S.morphTargets, morphNormals: S.morphNormals, vertexColors: S.vertexColors, transparent: S.transparent, opacity: S.opacity, side: S.side }); return S.map && (I.map = S.map), I; } return S; } function A(S, I) { if (I && S >= I.length) { var T = new d.BufferGeometry(), _ = new Float32Array(3 * S), E = 0; return I.forEach((C) => { _[E++] = C[0], _[E++] = C[1], _[E++] = C[2]; }), T.setAttribute("position", new d.BufferAttribute(_, 3)), T.setDrawRange(0, I.length), T; } } function M() { var S = new Image(); S.src = c(8); var I = new d.Texture(); return I.image = S, I.needsUpdate = !0, I; } function R(S, I, T, _, E, C) { var P = new f(S, I, T, _, E, C); return P.fontFace = _, P.fontSize = E, P.fontWeight = C, P.material.map.generateMipmaps = !1, P.material.map.anisotropy = 4, P.material.sizeAttenuation = !1, P.material.alphaTest = 0.5, P.material.transparent = !0, P.material.depthWrite = !1, P.material.depthTest = !1, P.center.set(0.5, -1.2), P.renderOrder = 1e4, P; } function L(S, I, T) { if (T) { var _ = S || "", E = I || "", C = T.lastIndexOf("/"); if (-1 < C) { var P = void 0, b = void 0; if (P = T.substring(0, C), b = T.substring(C + 1), (P === "*" || P === "**" || P.toLowerCase() === _.toLowerCase()) && (b === "*" || b === "**" || b.toLowerCase() === E.toLowerCase())) return !0; } else if (_.toLowerCase() === T.toLowerCase() || E.toLowerCase() === T.toLowerCase()) return !0; } return !1; } a.getBoundingBox = u, a.createNewURL = p, a.createBufferGeometry = A, a.getCircularTexture = M, a.resolveURL = g, a.loadExternalFile = y, a.loadExternalFiles = v, a.PhongToToon = w, a.createNewSpriteText = R, a.isRegionGroup = L; }, /* 6 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Face3: () => ( /* binding */ y ), /* harmony export */ Geometry: () => ( /* binding */ p ) /* harmony export */ }); var l = c(4), d = new l.Matrix4(), h = new l.Object3D(), f = new l.Vector3(), g = new l.Vector3(); function p() { this.uuid = l.MathUtils.generateUUID(), this.name = "", this.type = "Geometry", this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.normals = [], this.uvs = [], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.elementsNeedUpdate = !1, this.verticesNeedUpdate = !1, this.uvsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.lineDistancesNeedUpdate = !1, this.groupsNeedUpdate = !1, this.morphNormalsReady = !1; } p.prototype = Object.assign(Object.create(l.EventDispatcher.prototype), { constructor: p, isGeometry: !0, applyMatrix4: function(m) { for (var x, w = new l.Matrix3().getNormalMatrix(m), A = 0, M = this.vertices.length; A < M; A++) x = this.vertices[A], x.applyMatrix4(m); for (var R, L = 0, S = this.faces.length; L < S; L++) { R = this.faces[L], R.normal.applyMatrix3(w).normalize(); for (var I = 0, T = R.vertexNormals.length; I < T; I++) R.vertexNormals[I].applyMatrix3(w).normalize(); } return this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this; }, rotateX: function(m) { return d.makeRotationX(m), this.applyMatrix4(d), this; }, rotateY: function(m) { return d.makeRotationY(m), this.applyMatrix4(d), this; }, rotateZ: function(m) { return d.makeRotationZ(m), this.applyMatrix4(d), this; }, translate: function(m, x, w) { return d.makeTranslation(m, x, w), this.applyMatrix4(d), this; }, scale: function(m, x, w) { return d.makeScale(m, x, w), this.applyMatrix4(d), this; }, lookAt: function(m) { return h.lookAt(m), h.updateMatrix(), this.applyMatrix4(h.matrix), this; }, fromBufferGeometry: function(m) { function x(G, Y, te, ae) { var ie = S === void 0 ? [] : [w.colors[G].clone(), w.colors[Y].clone(), w.colors[te].clone()], le = L === void 0 ? [] : [new l.Vector3().fromBufferAttribute(L, G), new l.Vector3().fromBufferAttribute(L, Y), new l.Vector3().fromBufferAttribute(L, te)], W = new y(G, Y, te, le, ie, ae); w.faces.push(W), I !== void 0 && w.faceVertexUvs[0].push([new l.Vector2().fromBufferAttribute(I, G), new l.Vector2().fromBufferAttribute(I, Y), new l.Vector2().fromBufferAttribute(I, te)]), T !== void 0 && w.faceVertexUvs[1].push([new l.Vector2().fromBufferAttribute(T, G), new l.Vector2().fromBufferAttribute(T, Y), new l.Vector2().fromBufferAttribute(T, te)]); } var w = this, A = m.index === null ? void 0 : m.index, M = m.attributes; if (M.position === void 0) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this; var R = M.position, L = M.normal, S = M.color, I = M.uv, T = M.uv2; T !== void 0 && (this.faceVertexUvs[1] = []); for (var _ = 0; _ < R.count; _++) w.vertices.push(new l.Vector3().fromBufferAttribute(R, _)), S !== void 0 && w.colors.push(new l.Color().fromBufferAttribute(S, _)); var E = m.groups; if (0 < E.length) for (var C = 0; C < E.length; C++) for (var P = E[C], b = P.start, F = P.count, D = b, N = b + F; D < N; D += 3) A === void 0 ? x(D, D + 1, D + 2, P.materialIndex) : x(A.getX(D), A.getX(D + 1), A.getX(D + 2), P.materialIndex); else if (A !== void 0) for (var B = 0; B < A.count; B += 3) x(A.getX(B), A.getX(B + 1), A.getX(B + 2)); else for (var U = 0; U < R.count; U += 3) x(U, U + 1, U + 2); return this.computeFaceNormals(), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), this; }, center: function() { return this.computeBoundingBox(), this.boundingBox.getCenter(f).negate(), this.translate(f.x, f.y, f.z), this; }, normalize: function() { this.computeBoundingSphere(); var m = this.boundingSphere.center, x = this.boundingSphere.radius, w = x === 0 ? 1 : 1 / x, A = new l.Matrix4(); return A.set(w, 0, 0, -w * m.x, 0, w, 0, -w * m.y, 0, 0, w, -w * m.z, 0, 0, 0, 1), this.applyMatrix4(A), this; }, computeFaceNormals: function() { for (var m = new l.Vector3(), x = new l.Vector3(), w = 0, A = this.faces.length; w < A; w++) { var M = this.faces[w], R = this.vertices[M.a], L = this.vertices[M.b], S = this.vertices[M.c]; m.subVectors(S, L), x.subVectors(R, L), m.cross(x), m.normalize(), M.normal.copy(m); } }, computeVertexNormals: function() { for (var m = !(0 < arguments.length && arguments[0] !== void 0) || arguments[0], x = Array(this.vertices.length), w = 0, A = this.vertices.length; w < A; w++) x[w] = new l.Vector3(); if (m) for (var M = new l.Vector3(), R = new l.Vector3(), L = 0, S = this.faces.length; L < S; L++) { var I = this.faces[L], T = this.vertices[I.a], _ = this.vertices[I.b], E = this.vertices[I.c]; M.subVectors(E, _), R.subVectors(T, _), M.cross(R), x[I.a].add(M), x[I.b].add(M), x[I.c].add(M); } else { this.computeFaceNormals(); for (var C, P = 0, b = this.faces.length; P < b; P++) C = this.faces[P], x[C.a].add(C.normal), x[C.b].add(C.normal), x[C.c].add(C.normal); } for (var F = 0, D = this.vertices.length; F < D; F++) x[F].normalize(); for (var N = 0, B = this.faces.length; N < B; N++) { var U = this.faces[N], G = U.vertexNormals; G.length === 3 ? (G[0].copy(x[U.a]), G[1].copy(x[U.b]), G[2].copy(x[U.c])) : (G[0] = x[U.a].clone(), G[1] = x[U.b].clone(), G[2] = x[U.c].clone()); } return 0 < this.faces.length && (this.normalsNeedUpdate = !0), x; }, computeFlatVertexNormals: function() { this.computeFaceNormals(); for (var m = 0, x = this.faces.length; m < x; m++) { var w = this.faces[m], A = w.vertexNormals; A.length === 3 ? (A[0].copy(w.normal), A[1].copy(w.normal), A[2].copy(w.normal)) : (A[0] = w.normal.clone(), A[1] = w.normal.clone(), A[2] = w.normal.clone()); } 0 < this.faces.length && (this.normalsNeedUpdate = !0); }, computeMorphNormals: function() { for (var m, x = 0, w = this.faces.length; x < w; x++) { m = this.faces[x], m.__originalFaceNormal ? m.__originalFaceNormal.copy(m.normal) : m.__originalFaceNormal = m.normal.clone(), m.__originalVertexNormals || (m.__originalVertexNormals = []); for (var A = 0, M = m.vertexNormals.length; A < M; A++) m.__originalVertexNormals[A] ? m.__originalVertexNormals[A].copy(m.vertexNormals[A]) : m.__originalVertexNormals[A] = m.vertexNormals[A].clone(); } var R = new p(); R.faces = this.faces; for (var L = 0, S = this.morphTargets.length; L < S; L++) { if (!this.morphNormals[L]) { this.morphNormals[L] = {}, this.morphNormals[L].faceNormals = [], this.morphNormals[L].vertexNormals = []; for (var I = this.morphNormals[L].faceNormals, T = this.morphNormals[L].vertexNormals, _ = 0, E = this.faces.length; _ < E; _++) { var C = new l.Vector3(), P = { a: new l.Vector3(), b: new l.Vector3(), c: new l.Vector3() }; I.push(C), T.push(P); } } var b = this.morphNormals[L]; R.vertices = this.morphTargets[L].vertices, R.computeFaceNormals(); var F = R.computeVertexNormals(); if (F && 0 < F.length) { this.morphTargets[L].normals = Array(this.vertices.length); for (var D = 0; D < F.length; D++) this.morphTargets[L].normals[D] = F[D].clone(); } for (var N = 0, B = this.faces.length; N < B; N++) { var U = this.faces[N], G = b.faceNormals[N], Y = b.vertexNormals[N]; G.copy(U.normal), Y.a.copy(U.vertexNormals[0]), Y.b.copy(U.vertexNormals[1]), Y.c.copy(U.vertexNormals[2]); } } for (var te, ae = 0, ie = this.faces.length; ae < ie; ae++) te = this.faces[ae], te.normal = te.__originalFaceNormal, te.vertexNormals = te.__originalVertexNormals; this.morphNormalsReady = !0; }, computeBoundingBox: function() { this.boundingBox === null && (this.boundingBox = new l.Box3()), this.boundingBox.setFromPoints(this.vertices); }, computeBoundingSphere: function() { this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingSphere.setFromPoints(this.vertices); }, mergeMorph: function(m, x) { var w = this.morphTargets.length, A = this.morphTargets, M = m.morphTargets, R = this.morphColors.length, L = this.morphColors, S = m.morphColors; if (0 < w && w == M.length) for (var I = 0, T = A.length; I < T; I++) { for (var _ = A[I], E = M[I], C = 0, P = E.vertices.length; C < P; C++) { var b = E.vertices[C], F = b.clone(); x !== void 0 && F.applyMatrix4(x), _.vertices.push(F); } if (_.normals && E.normals) for (var D = 0; D < E.normals.length; D += 3) g.set(E.normals2[D], E.normals2[D + 1], E.normals2[D + 2]), x !== void 0 && g.applyMatrix4(x), _.normals.push(g.x, g.y, g.z); } if (0 < R && R == S.length) for (var N = 0, B = L.length; N < B; N++) for (var U = L[N], G = S[N], Y = 0, te = G.colors; Y < te; Y++) U.colors.push(G.colors[Y].clone()); }, merge: function(m, x) { var w = 2 < arguments.length && arguments[2] !== void 0 ? arguments[2] : 0; if (!(m && m.isGeometry)) return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", m); var A, M = this.vertices.length, R = this.vertices, L = m.vertices, S = m.normals, I = this.faces, T = m.faces, _ = this.colors, E = m.colors; x !== void 0 && (A = new l.Matrix3().getNormalMatrix(x)); for (var C = 0, P = L.length; C < P; C++) { var b = L[C], F = b.clone(); x !== void 0 && F.applyMatrix4(x), R.push(F); } for (var D = 0; D < S.length; D += 3) g.set(S[D], S[D + 1], S[D + 2]), x !== void 0 && g.applyMatrix4(x), this.normals.push(g.x, g.y, g.z); for (var N = 0, B = E.length; N < B; N++) typeof E[N] == "number" ? _.push(E[N]) : _.push(E[N].clone()); for (var U = 0, G = T.length; U < G; U++) { var Y = T[U], te = void 0, ae = void 0, ie = Y.vertexNormals, le = Y.vertexColors, W = new y(Y.a + M, Y.b + M, Y.c + M); W.normal.copy(Y.normal), A !== void 0 && W.normal.applyMatrix3(A).normalize(); for (var $ = 0, j = ie.length; $ < j; $++) te = ie[$].clone(), A !== void 0 && te.applyMatrix3(A).normalize(), W.vertexNormals.push(te); W.color.copy(Y.color); for (var re = 0, V = le.length; re < V; re++) ae = le[re], W.vertexColors.push(ae.clone()); W.materialIndex = Y.materialIndex + w, I.push(W); } for (var H, K = 0, ce = m.faceVertexUvs.length; K < ce; K++) { H = m.faceVertexUvs[K], this.faceVertexUvs[K] === void 0 && (this.faceVertexUvs[K] = []); for (var se = 0, k = H.length; se < k; se++) { for (var O = H[se], Z = [], X = 0, ee = O.length; X < ee; X++) Z.push(O[X].clone()); this.faceVertexUvs[K].push(Z); } } this.mergeMorph(m, x); }, mergeMesh: function(m) { return m && m.isMesh ? (m.matrixAutoUpdate && m.updateMatrix(), void this.merge(m.geometry, m.matrix)) : void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", m); }, /* * Checks for duplicate vertices with hashmap. * Duplicated vertices are removed * and faces' vertices are updated. */ mergeVertices: function() { for (var m = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : 4, x = {}, w = [], A = [], M = Math.pow(10, m), R = 0, L = this.vertices.length; R < L; R++) { var S = this.vertices[R], I = Math.round(S.x * M) + "_" + Math.round(S.y * M) + "_" + Math.round(S.z * M); x[I] === void 0 ? (x[I] = R, w.push(this.vertices[R]), A[R] = w.length - 1) : A[R] = A[x[I]]; } for (var T, _ = [], E = 0, C = this.faces.length; E < C; E++) { T = this.faces[E], T.a = A[T.a], T.b = A[T.b], T.c = A[T.c]; for (var P = [T.a, T.b, T.c], b = 0; 3 > b; b++) if (P[b] === P[(b + 1) % 3]) { _.push(E); break; } } for (var F, D = _.length - 1; 0 <= D; D--) { F = _[D], this.faces.splice(F, 1); for (var N = 0, B = this.faceVertexUvs.length; N < B; N++) this.faceVertexUvs[N].splice(F, 1); } var U = this.vertices.length - w.length; return this.vertices = w, U; }, setFromPoints: function(m) { this.vertices = []; for (var x, w = 0, A = m.length; w < A; w++) x = m[w], this.vertices.push(new l.Vector3(x.x, x.y, x.z || 0)); return this; }, sortFacesByMaterialIndex: function() { for (var m = this.faces, x = m.length, w = 0; w < x; w++) m[w]._id = w; m.sort(function(T, _) { return T.materialIndex - _.materialIndex; }); var A, M, R = this.faceVertexUvs[0], L = this.faceVertexUvs[1]; R && R.length === x && (A = []), L && L.length === x && (M = []); for (var S, I = 0; I < x; I++) S = m[I]._id, A && A.push(R[S]), M && M.push(L[S]); A && (this.faceVertexUvs[0] = A), M && (this.faceVertexUvs[1] = M); }, toJSON: function() { function m(V, H, K) { return K ? V | 1 << H : V & ~(1 << H); } function x(V) { var H = V.x.toString() + V.y.toString() + V.z.toString(); return C[H] === void 0 && (C[H] = E.length / 3, E.push(V.x, V.y, V.z)), C[H]; } function w(V) { var H = V.r.toString() + V.g.toString() + V.b.toString(); return b[H] === void 0 && (b[H] = P.length, P.push(V.getHex())), b[H]; } function A(V) { var H = V.x.toString() + V.y.toString(); return D[H] === void 0 && (D[H] = F.length / 2, F.push(V.x, V.y)), D[H]; } var M = { metadata: { version: 4.5, type: "Geometry", generator: "Geometry.toJSON" } }; if (M.uuid = this.uuid, M.type = this.type, this.name !== "" && (M.name = this.name), this.parameters !== void 0) { var R = this.parameters; for (var L in R) R[L] !== void 0 && (M[L] = R[L]); return M; } for (var S, I = [], T = 0; T < this.vertices.length; T++) S = this.vertices[T], I.push(S.x, S.y, S.z); for (var _ = [], E = [], C = {}, P = [], b = {}, F = [], D = {}, N = 0; N < this.faces.length; N++) { var B = this.faces[N], U = !0, G = !1, Y = this.faceVertexUvs[0][N] !== void 0, te = 0 < B.normal.length(), ae = 0 < B.vertexNormals.length, ie = B.color.r !== 1 || B.color.g !== 1 || B.color.b !== 1, le = 0 < B.vertexColors.length, W = 0; if (W = m(W, 0, 0), W = m(W, 1, U), W = m(W, 2, G), W = m(W, 3, Y), W = m(W, 4, te), W = m(W, 5, ae), W = m(W, 6, ie), W = m(W, 7, le), _.push(W), _.push(B.a, B.b, B.c), _.push(B.materialIndex), Y) { var $ = this.faceVertexUvs[0][N]; _.push(A($[0]), A($[1]), A($[2])); } if (te && _.push(x(B.normal)), ae) { var j = B.vertexNormals; _.push(x(j[0]), x(j[1]), x(j[2])); } if (ie && _.push(w(B.color)), le) { var re = B.vertexColors; _.push(w(re[0]), w(re[1]), w(re[2])); } } return M.data = {}, M.data.vertices = I, M.data.normals = E, 0 < P.length && (M.data.colors = P), 0 < F.length && (M.data.uvs = [F]), M.data.faces = _, M; }, clone: function() { return new p().copy(this); }, copy: function(m) { this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [[]], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.name = m.name; for (var x = m.vertices, w = 0, A = x.length; w < A; w++) this.vertices.push(x[w].clone()); for (var M = m.colors, R = 0, L = M.length; R < L; R++) this.colors.push(M[R].clone()); for (var S = m.faces, I = 0, T = S.length; I < T; I++) this.faces.push(S[I].clone()); for (var _, E = 0, C = m.faceVertexUvs.length; E < C; E++) { _ = m.faceVertexUvs[E], this.faceVertexUvs[E] === void 0 && (this.faceVertexUvs[E] = []); for (var P = 0, b = _.length; P < b; P++) { for (var F, D = _[P], N = [], B = 0, U = D.length; B < U; B++) F = D[B], N.push(F.clone()); this.faceVertexUvs[E].push(N); } } for (var G, Y = m.morphTargets, te = 0, ae = Y.length; te < ae; te++) { if (G = {}, G.name = Y[te].name, Y[te].vertices !== void 0) { G.vertices = []; for (var ie = 0, le = Y[te].vertices.length; ie < le; ie++) G.vertices.push(Y[te].vertices[ie].clone()); } if (Y[te].normals !== void 0) { G.normals = []; for (var W = 0, $ = Y[te].normals.length; W < $; W++) G.normals.push(Y[te].normals[W].clone()); } this.morphTargets.push(G); } for (var j, re = m.morphNormals, V = 0, H = re.length; V < H; V++) { if (j = {}, re[V].vertexNormals !== void 0) { j.vertexNormals = []; for (var K = 0, ce = re[V].vertexNormals.length; K < ce; K++) { var se = re[V].vertexNormals[K], k = {}; k.a = se.a.clone(), k.b = se.b.clone(), k.c = se.c.clone(), j.vertexNormals.push(k); } } if (re[V].faceNormals !== void 0) { j.faceNormals = []; for (var O = 0, Z = re[V].faceNormals.length; O < Z; O++) j.faceNormals.push(re[V].faceNormals[O].clone()); } this.morphNormals.push(j); } for (var X = m.skinWeights, ee = 0, fe = X.length; ee < fe; ee++) this.skinWeights.push(X[ee].clone()); for (var be = m.skinIndices, Ae = 0, he = be.length; Ae < he; Ae++) this.skinIndices.push(be[Ae].clone()); for (var xe = m.lineDistances, ne = 0, me = xe.length; ne < me; ne++) this.lineDistances.push(xe[ne]); var Me = m.boundingBox; Me !== null && (this.boundingBox = Me.clone()); var De = m.boundingSphere; return De !== null && (this.boundingSphere = De.clone()), this.elementsNeedUpdate = m.elementsNeedUpdate, this.verticesNeedUpdate = m.verticesNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.lineDistancesNeedUpdate = m.lineDistancesNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, this; }, computeGroups() { var v, m, x = [], w = void 0, A = this.faces; for (m = 0; m < A.length; m++) { var M = A[m]; M.materialIndex !== w && (w = M.materialIndex, v !== void 0 && (v.count = 3 * m - v.start, x.push(v)), v = { start: 3 * m, materialIndex: w }); } return v !== void 0 && (v.count = 3 * m - v.start, x.push(v)), x; }, toBufferGeometry: function() { var m = new u().fromGeometry(this), x = new l.BufferGeometry(), w = new Float32Array(3 * m.vertices.length); if (x.setAttribute("position", new l.BufferAttribute(w, 3).copyVector3sArray(m.vertices)), 0 < m.normals.length) { var A = new Float32Array(3 * m.normals.length); x.setAttribute("normal", new l.BufferAttribute(A, 3).copyVector3sArray(m.normals)); } if (0 < m.colors.length) { var M = new Float32Array(3 * m.colors.length); x.setAttribute("color", new l.BufferAttribute(M, 3).copyColorsArray(m.colors)); } if (0 < m.uvs.length) { var R = new Float32Array(2 * m.uvs.length); x.setAttribute("uv", new l.BufferAttribute(R, 2).copyVector2sArray(m.uvs)); } if (0 < m.uvs2.length) { var L = new Float32Array(2 * m.uvs2.length); x.setAttribute("uv2", new l.BufferAttribute(L, 2).copyVector2sArray(m.uvs2)); } for (var S in x.groups = m.groups, m.morphTargets) { for (var I = [], T = m.morphTargets[S], _ = 0, E = T.length; _ < E; _++) { var C = T[_], P = new l.Float32BufferAttribute(3 * C.data.length, 3); P.name = C.name, I.push(P.copyVector3sArray(C.data)); } x.morphAttributes[S] = I; } 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 F = new l.Float32BufferAttribute(4 * m.skinWeights.length, 4); x.setAttribute("skinWeight", F.copyVector4sArray(m.skinWeights)); } return m.boundingSphere !== null && (x.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (x.boundingBox = m.boundingBox.clone()), x; }, toIndexedBufferGeometry: function() { var m = new l.BufferGeometry(), x = new Float32Array(3 * this.vertices.length); if (m.setAttribute("position", new l.BufferAttribute(x, 3).copyVector3sArray(this.vertices)), 0 < this.normals.length) { var w = new Float32Array(this.normals.length), A = new l.BufferAttribute(w, 3).copyArray(this.normals); m.setAttribute("normal", A); } if (0 < this.uvs.length && 0 < this.uvs[0].length) { var M = new Float32Array(2 * this.uvs[0].length); m.setAttribute("uv", new l.BufferAttribute(M, 2).copyArray(this.uvs[0])); } if (1 < this.uvs.length && 0 < this.uvs[1].length) { var R = new Float32Array(2 * this.uvs[1].length); m.setAttribute("uv2", new l.BufferAttribute(R, 2).copyArray(this.uvs[1])); } if (0 < this.colors.length) { for (var L = [], S = 0; S < this.colors.length; S++) L.push(new l.Color(this.colors[S])); var I = new Float32Array(3 * L.length); m.setAttribute("color", new l.BufferAttribute(I, 3).copyColorsArray(L)); } else { for (var T = new Float32Array(3 * this.vertices.length), _ = 0; _ < 3 * this.vertices.length; _++) T[_] = 1; m.setAttribute("color", new l.BufferAttribute(T, 3)); } if (0 < this.faces.length) { for (var E = [], C = [], P = 0; P < this.faces.length; P++) { C.push(this.faces[P].a, this.faces[P].b, this.faces[P].c); var b = this.faces[P].vertexColors; if (b.length === 3) E.push(b[0], b[1], b[2]); else { var F = this.faces[P].color; E.push(F, F, F); } } m.setIndex(C), m.groups = this.computeGroups(); } if (0 < this.morphTargets.length) { for (var D = [], N = [], B = 0, U = this.morphTargets.length; B < U; B++) { var G = this.morphTargets[B], Y = new l.Float32BufferAttribute(3 * G.vertices.length, 3); if (Y.name = G.name, D.push(Y.copyVector3sArray(G.vertices)), G.normals) { var te = new l.Float32BufferAttribute(3 * G.normals.length, 3); te.name = G.name, N.push(te.copyVector3sArray(G.normals)); } } m.morphAttributes.position = D, m.morphAttributes.normal = N; } 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 ie = new l.Float32BufferAttribute(4 * this.skinWeights.length, 4); m.setAttribute("skinWeight", ie.copyVector4sArray(this.skinWeights)); } return this.boundingSphere !== null && (m.boundingSphere = this.boundingSphere.clone()), this.boundingBox !== null && (m.boundingBox = this.boundingBox.clone()), m; }, computeTangents: function() { console.error("THREE.Geometry: .computeTangents() has been removed."); }, computeLineDistances: function() { console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead."); }, applyMatrix: function(m) { return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."), this.applyMatrix4(m); }, dispose: function() { this.dispatchEvent({ type: "dispose" }); } }), p.createBufferGeometryFromObject = function(v) { var m = new l.BufferGeometry(), x = v.geometry; if (v.isPoints || v.isLine) { var w = new l.Float32BufferAttribute(3 * x.vertices.length, 3), A = new l.Float32BufferAttribute(3 * x.colors.length, 3); if (m.setAttribute("position", w.copyVector3sArray(x.vertices)), m.setAttribute("color", A.copyColorsArray(x.colors)), x.lineDistances && x.lineDistances.length === x.vertices.length) { var M = new l.Float32BufferAttribute(x.lineDistances.length, 1); m.setAttribute("lineDistance", M.copyArray(x.lineDistances)); } x.boundingSphere !== null && (m.boundingSphere = x.boundingSphere.clone()), x.boundingBox !== null && (m.boundingBox = x.boundingBox.clone()); } else v.isMesh && (m = x.toBufferGeometry()); return m; }; class u { constructor() { this.vertices = [], this.normals = [], this.colors = [], this.uvs = [], this.uvs2 = [], this.groups = [], this.morphTargets = {}, this.skinWeights = [], this.skinIndices = [], this.boundingBox = null, this.boundingSphere = null, this.verticesNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.uvsNeedUpdate = !1, this.groupsNeedUpdate = !1; } computeGroups(m) { var x, w, A = [], M = void 0, R = m.faces; for (w = 0; w < R.length; w++) { var L = R[w]; L.materialIndex !== M && (M = L.materialIndex, x !== void 0 && (x.count = 3 * w - x.start, A.push(x)), x = { start: 3 * w, materialIndex: M }); } x !== void 0 && (x.count = 3 * w - x.start, A.push(x)), this.groups = A; } fromGeometry(m) { var x, w = m.faces, A = m.vertices, M = m.faceVertexUvs, R = M[0] && 0 < M[0].length, L = M[1] && 0 < M[1].length, S = m.morphTargets, I = S.length; if (0 < I) { x = []; for (var T = 0; T < I; T++) x[T] = { name: S[T].name, data: [] }; this.morphTargets.position = x; } var _, E = m.morphNormals, C = E.length; if (0 < C) { _ = []; for (var P = 0; P < C; P++) _[P] = { name: E[P].name, data: [] }; this.morphTargets.normal = _; } var b = m.skinIndices, F = m.skinWeights, D = b.length === A.length, N = F.length === A.length; 0 < A.length && w.length === 0 && console.error("THREE.DirectGeometry: Faceless geometries are not supported."); for (var B, U = 0; U < w.length; U++) { B = w[U], this.vertices.push(A[B.a], A[B.b], A[B.c]); var G = B.vertexNormals; if (G.length === 3) this.normals.push(G[0], G[1], G[2]); else { var Y = B.normal; this.normals.push(Y, Y, Y); } var te = B.vertexColors; if (te.length === 3) this.colors.push(te[0], te[1], te[2]); else { var ae = B.color; this.colors.push(ae, ae, ae); } if (R === !0) { var ie = M[0][U]; ie === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", U), this.uvs.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs.push(ie[0], ie[1], ie[2]); } if (L === !0) { var le = M[1][U]; le === void 0 ? (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", U), this.uvs2.push(new l.Vector2(), new l.Vector2(), new l.Vector2())) : this.uvs2.push(le[0], le[1], le[2]); } for (var W, $ = 0; $ < I; $++) W = S[$].vertices, x[$].data.push(W[B.a], W[B.b], W[B.c]); for (var j, re = 0; re < C; re++) j = E[re].vertexNormals[U], _[re].data.push(j.a, j.b, j.c); D && this.skinIndices.push(b[B.a], b[B.b], b[B.c]), N && this.skinWeights.push(F[B.a], F[B.b], F[B.c]); } return this.computeGroups(m), this.verticesNeedUpdate = m.verticesNeedUpdate, this.normalsNeedUpdate = m.normalsNeedUpdate, this.colorsNeedUpdate = m.colorsNeedUpdate, this.uvsNeedUpdate = m.uvsNeedUpdate, this.groupsNeedUpdate = m.groupsNeedUpdate, m.boundingSphere !== null && (this.boundingSphere = m.boundingSphere.clone()), m.boundingBox !== null && (this.boundingBox = m.boundingBox.clone()), this; } } class y { constructor(m, x, w, A, M) { var R = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : 0; this.a = m, this.b = x, this.c = w, this.normal = A && A.isVector3 ? A : new l.Vector3(), this.vertexNormals = Array.isArray(A) ? A : [], this.color = M && M.isColor ? M : new l.Color(), this.vertexColors = Array.isArray(M) ? M : [], this.materialIndex = R; } clone() { return new this.constructor().copy(this); } copy(m) { this.a = m.a, this.b = m.b, this.c = m.c, this.normal.copy(m.normal), this.color.copy(m.color), this.materialIndex = m.materialIndex; for (var x = 0, w = m.vertexNormals.length; x < w; x++) this.vertexNormals[x] = m.vertexNormals[x].clone(); for (var A = 0, M = m.vertexColors.length; A < M; A++) this.vertexColors[A] = m.vertexColors[A].clone(); return this; } } }, /* 7 */ /***/ (o) => { o.exports = JB; }, /* 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 ", ["varying vec3 vColor;", "attribute vec3 morphColor0;", "attribute vec3 morphColor1;"].join(` `)), c.vertexShader = c.vertexShader.replace("#include ", ["vColor.xyz = color.xyz;", "#ifdef USE_MORPHTARGETS", "vColor = morphColor0 * morphTargetInfluences[ 0 ];", "vColor += morphColor1 * morphTargetInfluences[ 1 ];", "#endif"].join(` `)); }; }; }, /* 10 */ /***/ (o, a, c) => { var l = c(4), d = c(5).createBufferGeometry, h = c(5).resolveURL, f = 0, g = function() { return "pr" + f++; }, p = function() { this.isZincObject = !0, this.geometry = void 0, this.morph = void 0, this.group = new l.Group(), this._lod = new (c(11)).LOD(this), this.groupName = void 0, this.timeEnabled = !1, this.morphColour = !1, this.inbuildTime = 0, this.mixer = void 0, this.animationGroup = void 0, this.duration = 6e3, this.clipAction = void 0, this.userData = {}, this.videoHandler = void 0, this.marker = void 0, this.markerNumber = void 0, this.markerUpdateRequired = !0, this.closestVertexIndex = -1, this.boundingBoxUpdateRequired = !0, this.cachedBoundingBox = new l.Box3(), this.anatomicalId = void 0, this.region = void 0, this.animationClip = void 0, this.markerMode = "inherited", this.uuid = g(), this._v1 = new l.Vector3(), this._v2 = new l.Vector3(), this._b1 = new l.Box3(), this.center = new l.Vector3(), this.radius = 0, this.visible = !0, this.drawRange = -1, this.origColour = void 0, this.origVertexColors = !1, this.isPickable = !0; }; p.prototype.setDuration = function(u) { this.duration = u, this.clipAction && this.clipAction.setDuration(this.duration); }, p.prototype.getDuration = function() { return this.duration; }, p.prototype.setRegion = function(u) { this.region = u; }, p.prototype.getRegion = function() { return this.region; }, p.prototype.getMorph = function() { var u = this._lod.getCurrentMorph(); return u || this.morph; }, p.prototype.getGroup = function() { return this.group; }, p.prototype.setMorph = function(u) { this.morph = u, this.group.add(this.morph); var y = this._lod.calculateDistance("far"); this._lod.addLevel(u, y), this._lod.setMaterial(u.material); }, p.prototype.checkTransparentMesh = function() { }, p.prototype.setMesh = function(u, y, v) { this.animationGroup = new l.AnimationObjectGroup(u), this.mixer = new l.AnimationMixer(this.animationGroup); var m = u.geometry; if (this.geometry = u.geometry, this.clipAction = void 0, m && m.morphAttributes) { var x = m.morphAttributes.position; x || (x = m.morphAttributes.color ? m.morphAttributes.color : m.morphAttributes.normal), x && (this.animationClip = l.AnimationClip.CreateClipsFromMorphTargetSequences(x, 10, !0), this.animationClip && this.animationClip[0] != null && (this.clipAction = this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration), this.clipAction.loop = l.loopOnce, this.clipAction.clampWhenFinished = !0, this.clipAction.play())); } this.timeEnabled = y, this.morphColour = v, u.userData = this, u.matrixAutoUpdate = !1, this.setMorph(u), this.checkTransparentMesh(), this.timeEnabled ? this.setFrustumCulled(!1) : this.morphColour && (m.setAttribute("morphTarget0", m.getAttribute("position")), m.setAttribute("morphTarget1", m.getAttribute("position"))), this.boundingBoxUpdateRequired = !0; }, p.prototype.setIsPickable = function(u) { this.isPickable !== u && (this.isPickable = u, this.region && (this.region.pickableUpdateRequired = !0)); }, p.prototype.setAnatomicalId = function(u) { this.anatomicalId = u; }, p.prototype.setName = function(u) { this.groupName = u, this._lod.setName(u); }, p.prototype.getCurrentTime = function() { if (this.clipAction) { var u = this.clipAction.time / this.clipAction._clip.duration; return this.duration * u; } return this.inbuildTime; }, p.prototype.setMorphTime = function(u) { var y = !1; if (this.clipAction) { var v = u / this.duration, m = this.clipAction._clip.duration, x = v * m; x != this.clipAction.time && (this.clipAction.time = x, y = !0), y && this.isTimeVarying() && this.mixer.update(0); } else { var w = u; w = u > this.duration ? this.duration : 0 > u ? 0 : u, w != this.inbuildTime && (this.inbuildTime = w, y = !0); } y && (this.boundingBoxUpdateRequired = !0, this._lod.updateMorphColorAttribute(!0), this.timeEnabled && (this.markerUpdateRequired = !0)); }, p.prototype.isTimeVarying = function() { return !!(this.timeEnabled || this.morphColour); }, p.prototype.getVisibility = function() { return this.visible; }, p.prototype.setVisibility = function(u) { u !== this.visible && (this.visible = u, this.group.visible = u, this.region && (this.region.pickableUpdateRequired = !0)); }, p.prototype.setAlpha = function(u) { var y = this._lod._material, v = !1; 1 > u && (v = !0), y.opacity = u, y.transparent = v, this.checkTransparentMesh(); }, p.prototype.setFrustumCulled = function(u) { this._lod.setFrustumCulled(u); }, p.prototype.setVertexColors = function(u) { this._lod.setVertexColors(u); }, p.prototype.getColour = function() { return this._lod._material ? this._lod._material.color : void 0; }, p.prototype.setColour = function(u) { this._lod.setColour(u); }, p.prototype.setGreyScale = function(u) { if (u) { if (!this.origColour && this._lod._material) return this.origColour = this._lod._material.color, this.origVertexColors = this._lod._material.vertexColors, this._lod.setVertexColors(!1), this._lod.setColour(new l.Color().setHex(12303291)), !0; } else if (this.origColour) return this._lod.setColour(this.origColour), this._lod.setVertexColors(this.origVertexColors), this.origColour = void 0, !0; return !1; }, p.prototype.getColourHex = function() { return !this.morphColour && this._lod._material && this._lod._material.color ? this._lod._material.color.getHexString() : void 0; }, p.prototype.setColourHex = function(u) { this._lod._material.color.setHex(u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.color.setHex(u); }, p.prototype.setEmissiveRGB = function(u) { this._lod._material && this._lod._material.emissive && this._lod._material.emissive.setRGB(...u), this._lod._secondaryMaterial && this._lod._secondaryMaterial.emissive.setRGB(...u); }, p.prototype.setMaterial = function(u) { this._lod.setMaterial(u); }, p.prototype.getClosestVertexIndex = function() { var u = -1, y = this.getMorph(); if (y && y.geoemtry) { var v = y.geometry.attributes.position; if (this._b1.setFromBufferAttribute(v), this._b1.getCenter(this._v1), v) for (var m = -1, x = 0, w = 0; w < v.count; w++) this._v2.fromArray(v.array, 3 * w), x = this._v2.distanceTo(this._v1), m == -1 ? m = x : m > x && (m = x, u = w); } return u; }, p.prototype.getClosestVertex = function(u) { var y = new l.Vector3(); this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()); var v = this.getMorph(); if (v && v.geometry && 0 <= this.closestVertexIndex) { var m = v.morphTargetInfluences, x = v.geometry.morphAttributes; if (m && x && x.position) { for (var w = !1, A = 0; A < m.length; A++) 0 < m[A] && (w = !0, this._v1.fromArray(x.position[A].array, 3 * this.closestVertexIndex), y.add(this._v1.multiplyScalar(m[A]))); if (w) return u ? y.applyMatrix4(v.matrixWorld) : y; } else return y.fromArray(v.geometry.attributes.position.array, 3 * this.closestVertexIndex), u ? y.applyMatrix4(v.matrixWorld) : y; } return this.getBoundingBox(), y.copy(this.center), u ? y.applyMatrix4(this.morph.matrixWorld) : y; }, p.prototype.getBoundingBox = function() { if (this.visible) { var u = this._lod.getCurrentMorph(); if (u && u.visible) return this.boundingBoxUpdateRequired && (c(5).getBoundingBox(u, this.cachedBoundingBox, this._b1, this._v1, this._v2), this.cachedBoundingBox.getCenter(this.center), this.radius = this.center.distanceTo(this.cachedBoundingBox.max), this.boundingBoxUpdateRequired = !1), this.cachedBoundingBox; } }, p.prototype.dispose = function() { this._lod.dispose(), this.animationGroup = void 0, this.mixer = void 0, this.morph = void 0, this.group = void 0, this.clipAction = void 0, this.groupName = void 0; }, p.prototype.markerIsRequired = function(u) { return !!(this.visible && (this.markerMode === "on" || u && u.displayMarkers && this.markerMode === "inherited")); }, p.prototype.updateMarker = function(u, y) { if (u == !1 && this.markerIsRequired(y)) { var v = y.ndcToBeUpdated; if (this.groupName) { if (this.marker || (this.marker = new (c(14)).Marker(this), this.markerUpdateRequired = !0), this.markerUpdateRequired) { var m = this.getClosestVertex(!1); m && (this.marker.setPosition(m.x, m.y, m.z), this.markerUpdateRequired = !1); } this.marker.isEnabled() || (y.markersList && !(this.marker.uuid in y.markersList) && (v = !0, y.markersList[this.marker.uuid] = this.marker), this.marker.enable(), this.group.add(this.marker.morph)), this.marker.setNumber(this.markerNumber), this.markerImgURL ? this.marker.loadUserSprite(this.markerImgURL) : this.marker.setDefaultSprite(), y && y.camera && (v || y.markerCluster.markerUpdateRequired) && (this.marker.updateNDC(y.camera.cameraObject), y.markerCluster.markerUpdateRequired = !0); } } else this.marker && this.marker.isEnabled() && (this.marker.disable(), this.group.remove(this.marker.morph), y.markersList && this.marker.uuid in y.markersList && (y.markerCluster.markerUpdateRequired = !0, delete y.markersList[this.marker.uuid])), this.markerUpdateRequired = !0; }, p.prototype.processMarkerVisual = function(u, y) { this.marker && this.marker.isEnabled() && this.marker.updateVisual(u, y); }, p.prototype.initiateMorphColor = function() { this.morphColour == 1 && this._lod.updateMorphColorAttribute(!1); }, p.prototype.setRenderOrder = function(u) { this._lod.setRenderOrder(u); }, p.prototype.getClosestVertexDOMElementCoords = function(u) { if (u && u.camera) { var y = !0, v = this.getClosestVertex(!0); return v.project(u.camera), v.z = Math.min(Math.max(v.z, 0), 1), (1 < v.x || -1 > v.x || 1 < v.y || -1 > v.y) && (y = !1), u.getZincCameraControls().getRelativeCoordsFromNDC(v.x, v.y, v), { position: v, inView: y }; } }, p.prototype.setMarkerMode = function(u, y) { u !== this.markerMode && (this.markerMode = u === "on" || u === "off" ? u : "inherited", this.region && (this.region.pickableUpdateRequired = !0)), y && (this.markerNumber = y.number, this.markerImgURL = y.imgURL); }, p.prototype.render = function(u, y, v, m) { if (this.visible && !(this.timeEnabled && y) && this._lod.update(v, this.center), y == !0) { if (this.clipAction && this.isTimeVarying()) this.mixer.update(u); else { var x = this.inbuildTime + u; x > this.duration && (x -= this.duration), this.inbuildTime = x; } this.visible && u != 0 && (this.boundingBoxUpdateRequired = !0, this.morphColour == 1 && this._lod.updateMorphColorAttribute(!0)); } this.updateMarker(y, m); }, p.prototype.addLOD = function(u, y, v, m, x) { this._lod.addLevelFromURL(u, y, v, m, x); }, p.prototype.addVertices = function(u) { var y = this.getMorph(), v = void 0; if (!y) v = d(500, u), this.drawRange = u.length; else if (-1 < this.drawRange) { var m = y.geometry.getAttribute("position"); u.forEach((x) => { m.setXYZ(this.drawRange, x[0], x[1], x[2]), ++this.drawRange; }), m.needsUpdate = !0, y.geometry.setDrawRange(0, this.drawRange), y.geometry.computeBoundingBox(), y.geometry.computeBoundingSphere(), v = y.geoemtry, this.boundingBoxUpdateRequired = !0; } return v; }, p.prototype.setPosition = function(u, y, v) { var m = this.getGroup(); m && (m.position.set(u, y, v), m.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, p.prototype.loadAdditionalSources = function(u) { u.load(h(filename), meshloader(region, colour, opacity, localTimeEnabled, localMorphColour, void 0, void 0, void 0, void 0, finishCallback), this.onProgress(filename), this.onError(finishCallback)); }, p.prototype.setScaleAll = function(u) { var y = this.getGroup(); y && (y.scale.set(u, u, u), y.updateMatrix(), this.boundingBoxUpdateRequired = !0); }, a.ZincObject = p; }, /* 11 */ /***/ (o, a, c) => { var l = c(4), d = c(5).updateMorphColorAttribute, h = c(5).toBufferGeometry, f = function(g) { this.levels = [], this._currentLevel = 0, this._renderOrder = 1, this._material = void 0, this._secondaryMaterial = void 0, this._loader = void 0, this._parent = g, this.addLevel = (u, y) => { if (u) { var v, m = Math.abs(y); for (v = 0; v < this.levels.length && !(m < this.levels[v].distance); v++) ; this.levels.splice(v, 0, { distance: m, morph: u, loaded: !0, loading: !1, url: "" }), u.renderOrder = this._renderOrder; } }, this.levelLoaded = (u, y) => { if (u) { for (var v = Math.abs(y), m = 0; m < this.levels.length; m++) if (v === this.levels[m].distance) { this._parent.group.add(u), this.levels[m].morph = u, this.levels[m].loaded = !0, this.levels[m].loading = !1; break; } this.checkTransparentMesh(); } }, this.addLevelFromURL = (u, y, v, m, x) => { this._loader = u; var w, A = this.calculateDistance(y); for (w = 0; w < this.levels.length && !(A < this.levels[w].distance); w++) ; this.levels.splice(w, 0, { distance: A, morph: void 0, loaded: !1, loading: !1, url: v, index: m }), x && this.loadLevel(w); }, this.loadLevel = (u) => { var y = this.levels[u]; return y.morph || y.loaded || y.loading || (y.loading = !0, this._loader.load(y.url, this.lodLoader(y.distance), void 0, void 0, { index: y.index })), y.morph === void 0; }, this.calculateDistance = function(u) { this._parent.getBoundingBox(); var y = this._parent.radius, v = 0; return u === "far" ? v = 4.5 * y : u === "medium" ? v = 2.5 * y : u == "close" && (v = 0), v; }, this.containsLevels = () => !!(this.levels && 1 < this.levels.length), this.checkTransparentMesh = () => { var u = this.levels[this._currentLevel]; this._material && (this._material.transparent ? (!this._secondaryMaterial && (this._secondaryMaterial = this._material.clone(), this._secondaryMaterial.side = l.FrontSide), this._secondaryMaterial.opacity = this._material.opacity, this._secondaryMaterial.emissive && this._secondaryMaterial.emissive.copy(this._material.emissive), this._secondaryMaterial.needsUpdate = !0, !u.secondaryMesh && (u.secondaryMesh = new l.Mesh(u.morph.geometry, this._secondaryMaterial), u.secondaryMesh.renderOrder = u.morph.renderOrder + 1, u.secondaryMesh.userData = u.morph.userData, u.secondaryMesh.name = u.morph.name), this._material.side = l.BackSide, this._material.needsUpdate = !0, !u.secondaryMesh.parent && (u.morph.add(u.secondaryMesh), this._parent.animationGroup && this._parent.animationGroup.add(u.secondaryMesh))) : (u.secondaryMesh && (u.morph.remove(u.secondaryMesh), this._parent.animationGroup && (this._parent.animationGroup.uncache(u.secondaryMesh), this._parent.animationGroup.remove(u.secondaryMesh))), this._material.side = l.DoubleSide, this._material.needsUpdate = !0)); }, this.dispose = () => { this.levels.forEach((u) => { u.morph && u.morph.geometry && u.morph.geometry.dispose(); }), this._material && this._material.dispose(), this._secondaryMaterial && this._secondaryMaterial.dispose(); }, this.getCurrentLevel = () => this._currentLevel, this.getCurrentMorph = () => { var u = this.levels[this._currentLevel]; return u && u.morph ? u.morph : this._parent.morph; }, this.lodLoader = function(u) { return (y) => { var v = this._material, m = { localTimeEnabled: this._parent.timeEnabled, localMorphColour: this._parent.morphColour }, x = h(y, m), w = void 0; this._parent.isGeometry ? w = new l.Mesh(x, v) : this._parent.isLines && (w = new (c(12)).LineSegments(x, v)), w.userData = this._parent, w.renderOrder = this._renderOrder, y.dispose(), this.levelLoaded(w, u); }; }, this.updateMorphColorAttribute = (u) => { if (this._material && (this._material.vertexColors == l.VertexColors || this._material.vertexColors == !0)) if (u) { var y = this.getCurrentMorph(); d(y.geometry, y); } else this.levels.forEach((v) => { v.morph && v.morph.geometry && d(v.morph.geometry, v.morph); }); }, this.setColour = (u) => { this._material.color = u, this._secondaryMaterial && (this._secondaryMaterial.color = u), p(); }, this.setFrustumCulled = (u) => { this.levels.forEach((y) => { y.morph && (y.morph.frustumCulled = u), y.secondaryMesh && (y.secondaryMesh.frustumCulled = u); }); }, this.setMaterial = (u) => { u && (!this._material || this._material.id !== u.id) && (this._material = u, this._secondaryMaterial && this._secondaryMaterial.dispose(), this._secondaryMaterial = u.clone(), this._secondaryMaterial.side = l.FrontSide, this._secondaryMaterial.transparent = !0, this.levels.forEach((y) => { y.morph && (y.morph.material = this._material, y.morph.geometry && (y.morph.geometry.colorsNeedUpdate = !0)), y.secondaryMesh && (y.secondaryMesh.material = this._secondaryMaterial); })); }, this.setName = (u) => { this.levels.forEach((y) => { y.morph && (y.morph.name = u), y.secondaryMesh && (y.secondaryMesh.name = u); }); }, this.setRenderOrder = (u) => { this._renderOrder = u, this.levels.forEach((y) => { y.morph && (y.morph.renderOrder = u), y.secondaryMesh && (y.secondaryMesh.renderOrder = u); }); }, this.setVertexColors = (u) => { this._material.vertexColors = u, p(), this._secondaryMaterial && (this._secondaryMaterial.vertexColors = u); }, this.update = (u, y) => { var v = this.levels; if (1 < v.length) { var m, x, w = u.cameraObject.position.distanceTo(y), A = -1, M = -1; for (m = 0, x = v.length; m < x && w >= v[m].distance; m++) v[m].morph ? (-1 < A && v[A].morph && (v[A].morph.visible = !1), A = m, v[m].morph.visible = !0, M = -1) : M = m; for (-1 < M && this.loadLevel(M); m < x; m++) v[m].morph && (-1 < A ? v[m].morph.visible = !1 : (v[m].morph.visible = !0, A = m)); this._currentLevel != A && (this._currentLevel = A, this.checkTransparentMesh()); } }, this.toggleMarker = (u, y) => { this.levels.forEach((v) => { v.morph && (y ? v.morph.add(u) : v.morph.remove(u)); }); }; var p = () => { this.levels.forEach((u) => { u.morph && u.morph.geometry && (u.morph.geometry.colorsNeedUpdate = !0); }); }; }; a.LOD = f; }, /* 12 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegments: () => ( /* binding */ g ) /* harmony export */ }); var l = c(13), d = c(4), h = /* @__PURE__ */ new d.Vector3(), f = /* @__PURE__ */ new d.Vector3(); class g extends l.Line { constructor(u, y) { super(u, y), this.type = "LineSegments"; } computeLineDistances() { var u = this.geometry; if (!u.isBufferGeometry) u.isGeometry && console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (u.index === null) { for (var y = u.attributes.position, v = [], m = 0, x = y.count; m < x; m += 2) h.fromBufferAttribute(y, m), f.fromBufferAttribute(y, m + 1), v[m] = m == 0 ? 0 : v[m - 1], v[m + 1] = v[m] + h.distanceTo(f); u.setAttribute("lineDistance", new d.Float32BufferAttribute(v, 1)); } else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } } g.prototype.isLineSegments = !0; }, /* 13 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Line: () => ( /* binding */ x ) /* harmony export */ }); var l = c(4), d = /* @__PURE__ */ new l.Vector3(), h = /* @__PURE__ */ new l.Vector3(), f = /* @__PURE__ */ new l.Matrix4(), g = /* @__PURE__ */ new l.Ray(), p = /* @__PURE__ */ new l.Sphere(), u = /* @__PURE__ */ new l.Vector3(), y = /* @__PURE__ */ new l.Vector3(), v = /* @__PURE__ */ new l.Vector3(), m = /* @__PURE__ */ new l.Vector3(); class x extends l.Object3D { constructor() { var M = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), R = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.LineBasicMaterial(); super(), this.type = "Line", this.geometry = M, this.material = R, this.updateMorphTargets(); } copy(M) { return super.copy(M), this.material = M.material, this.geometry = M.geometry, this; } computeLineDistances() { var M = this.geometry; if (!M.isBufferGeometry) M.isGeometry && console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); else if (M.index === null) { for (var R = M.attributes.position, L = [0], S = 1, I = R.count; S < I; S++) d.fromBufferAttribute(R, S - 1), h.fromBufferAttribute(R, S), L[S] = L[S - 1], L[S] += d.distanceTo(h); M.setAttribute("lineDistance", new l.Float32BufferAttribute(L, 1)); } else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); return this; } raycast(M, R) { var L = this.geometry, S = this.matrixWorld, I = M.params.Line.threshold, T = L.drawRange, _ = L.morphAttributes.position; if (L.boundingSphere === null && L.computeBoundingSphere(), p.copy(L.boundingSphere), p.applyMatrix4(S), p.radius += I, M.ray.intersectsSphere(p) !== !1) { f.copy(S).invert(), g.copy(M.ray).applyMatrix4(f); var E = I / ((this.scale.x + this.scale.y + this.scale.z) / 3), C = E * E, P = new l.Vector3(), b = new l.Vector3(), F = new l.Vector3(), D = new l.Vector3(), N = this.isLineSegments ? 2 : 1; if (L.isBufferGeometry) { var B = L.index, U = L.attributes, G = U.position; if (B !== null) for (var Y = Math.max(0, T.start), te = Math.min(B.count, T.start + T.count), ae = Y; ae < te - 1; ae += N) { var ie = B.getX(ae), le = B.getX(ae + 1); w(P, b, this, G, _, ie, le); var W = g.distanceSqToSegment(P, b, D, F); if (!(W > C)) { D.applyMatrix4(this.matrixWorld); var $ = M.ray.origin.distanceTo(D); $ < M.near || $ > M.far || R.push({ distance: $, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: F.clone().applyMatrix4(this.matrixWorld), index: ae, face: null, faceIndex: null, object: this }); } } else for (var j = Math.max(0, T.start), re = Math.min(G.count, T.start + T.count), V = j; V < re - 1; V += N) { w(P, b, this, G, _, V, V + 1); var H = g.distanceSqToSegment(P, b, D, F); if (!(H > C)) { D.applyMatrix4(this.matrixWorld); var K = M.ray.origin.distanceTo(D); K < M.near || K > M.far || R.push({ distance: K, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: F.clone().applyMatrix4(this.matrixWorld), index: V, face: null, faceIndex: null, object: this }); } } } else L.isGeometry && console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var M = this.geometry; if (M.isBufferGeometry) { var R = M.morphAttributes, L = Object.keys(R); if (0 < L.length) { var S = R[L[0]]; if (S !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var I, T = 0, _ = S.length; T < _; T++) I = S[T].name || T + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[I] = T; } } } else { var E = M.morphTargets; E !== void 0 && 0 < E.length && console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } function w(A, M, R, L, S, I, T) { A.fromBufferAttribute(L, I), M.fromBufferAttribute(L, T); var _ = R.morphTargetInfluences; if (R.material.morphTargets && S && _) { u.set(0, 0, 0), y.set(0, 0, 0); for (var E = 0, C = S.length; E < C; E++) { var P = _[E], b = S[E]; P !== 0 && (v.fromBufferAttribute(b, I), m.fromBufferAttribute(b, T), u.addScaledVector(v.sub(A), P), y.addScaledVector(m.sub(M), P)); } A.add(u), M.add(y); } } x.prototype.isLine = !0; }, /* 14 */ /***/ (o, a, c) => { var l = c(4), d = new Image(128, 128); d.src = c(15); var h = new l.Texture(); h.image = d, h.needsUpdate = !0; var f = [0.02, 0.03, 1], g = new l.SpriteMaterial({ map: h, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), p = c(5).createNewSpriteText, u = function(y) { c(10).ZincObject.call(this), this.texture = h; var v = void 0, m = void 0, x = void 0, w = void 0, A = void 0, M = !0; this.morph = new l.Group(), this.group = this.morph, this.parent = y, this.isMarker = !0; var R = !1; this.ndc = new l.Vector3(); var L = void 0, S = void 0, I = () => { 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 = (T, _) => { var E = 1, C = 0; T !== _ && (C = 1 - (this.ndc.z - T) / (_ - T), E = 0.6 + 0.4 * C), this.setSpriteSize(E); }, this.updateNDC = (T) => (this.ndc.copy(this.morph.position), this.ndc.project(T), this.ndc.z = Math.min(Math.max(this.ndc.z, 0), 1), this.ndc), this.setPosition = (T, _, E) => { this.morph.position.set(T, _, E); }, this.setSpriteSize = (T) => { v.scale.set(0.015, 0.02, 1), v.scale.multiplyScalar(T); }, this.setUserSprite = () => { w && (this.morph.add(w), M && (this.morph.remove(v), S && this.morph.remove(S), M = !1)); }, this.setImageForUserSprite = (T, _) => { w && (this.morph.remove(w), w = void 0), m && m.dispose(), x && x.dispose(), m = new l.Texture(), m.image = T, m.needsUpdate = !0, x = new l.SpriteMaterial({ map: m, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), _ || (_ = [0.05, 0.05, 1]), w = new l.Sprite(x), w.center.set(0.5, 0), w.scale.set(_[0], _[1], _[2]), w.userData = this, this.setUserSprite(); }, this.setDefaultSprite = () => { M || (M = !0, this.morph.add(v), w && this.morph.remove(w), S && this.morph.add(S)); }, this.loadUserSprite = (T, _) => { if (T) if (T !== A) { A = T; var E = new Image(128, 128); E.crossOrigin = "anonymous", E.onload = () => { this.setImageForUserSprite(E, _); }, E.src = T; } else this.setUserSprite(); }, this.dispose = () => { this.morph && this.morph.clear(), v && (v.clear(), v = void 0), S && (S.material.map.dispose(), S.material.dispose(), S = void 0); }, this.isEnabled = () => R, this.setNumber = (T) => { (!T || L != T) && S && (this.morph.remove(S), S.material.map.dispose(), S.material.dispose(), S = void 0), !S && T && (S = p(T, 0.012, "black", "Asap", 120, 700), this.morph.add(S)), L = T; }, this.getNumber = () => L || 1, this.setVisibility = function(T) { T !== this.visible && (this.visible = T, this.group.visible = T, this.parent.region && (this.parent.region.pickableUpdateRequired = !0)); }, this.enable = () => { R = !0, this.morph.visible = !0, this.visible = !0; }, this.disable = () => { R = !1, this.morph.visible = !1, this.visible = !1; }, I(); }; u.prototype = Object.create(c(10).ZincObject.prototype), a.Marker = u; }, /* 15 */ /***/ (o) => { o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="; }, /* 16 */ /***/ (o, a, c) => { var l = c(4), d = function(h, f, g, p) { c(10).ZincObject.call(this); var u; f && (u = f.clone(), u.vertexColors = l.FaceColors), this.id = g; var y = void 0, v = void 0; this.isGlyph = !0; var m = [0, 0, 0]; this.fromMesh = (x) => !!(x && x.isMesh) && (this.morph = x.clone(), this.morph.userData = this, this.group.add(this.morph), !0), h && u && this.fromMesh(new l.Mesh(h, u)), this.getGlyphset = function() { return p; }, this.setLabel = (x) => { x && (typeof x == "string" || x instanceof String) && (v = x, this.morph && (this.morph.name = x)); }, this.showLabel = (x) => { y && (m = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0), v && (typeof v == "string" || v instanceof String) && (y = new (c(17)).Label(v, x), y.setPosition(m[0], m[1], m[2]), this.group.add(y.getSprite())); }, this.hideLabel = () => { y && (m = y.getPosition(), this.group.remove(y.getSprite()), y.dispose(), y = void 0); }, this.getLabel = () => v, this.getMesh = () => this.morph, this.setTransformation = (x, w, A, M) => { this.morph && (this.morph.matrix.elements[0] = w[0], this.morph.matrix.elements[1] = w[1], this.morph.matrix.elements[2] = w[2], this.morph.matrix.elements[3] = 0, this.morph.matrix.elements[4] = A[0], this.morph.matrix.elements[5] = A[1], this.morph.matrix.elements[6] = A[2], this.morph.matrix.elements[7] = 0, this.morph.matrix.elements[8] = M[0], this.morph.matrix.elements[9] = M[1], this.morph.matrix.elements[10] = M[2], this.morph.matrix.elements[11] = 0, this.morph.matrix.elements[12] = x[0], this.morph.matrix.elements[13] = x[1], this.morph.matrix.elements[14] = x[2], this.morph.matrix.elements[15] = 1, this.morph.matrixAutoUpdate = !1), m = [...x], y && y.setPosition(x[0], x[1], x[2]); }, this.setColour = (x) => { y && y.setColour(x), this.secondaryMesh && this.secondaryMesh.material && (this.secondaryMesh.material.color = colour), this.geometry && (this.geometry.colorsNeedUpdate = !0); }, this.dispose = () => { this.material && this.material.dispose(), this.morph = void 0; }; }; d.prototype = Object.create(c(10).ZincObject.prototype), a.Glyph = d; }, /* 17 */ /***/ (o, a, c) => { var l = c(7).default; a.Label = function(d, h) { var f = d, g = void 0; g = h ? new l(f, 0.015, h.getStyle()) : new l(f, 0.015), g.fontFace = "Asap", g.fontWeight = 700, g.material.map.generateMipmaps = !1, g.material.sizeAttenuation = !1, g.center.x = -0.05, g.center.y = 0, this.getPosition = () => g ? [g.position.x, g.position.y, g.position.z] : [0, 0, 0], this.setPosition = (p, u, y) => { g && g.position.set(p, u, y); }, this.setColour = (p) => { g.color = p.getStyle(); }, this.setScale = (p) => { g && 0 < p && g.scale.set(p, p, 1); }, this.dispose = () => { }, this.getSprite = () => g, this.getString = () => f; }; }, /* 18 */ /***/ (o, a, c) => { var l = c(4), d = c(19).JSONLoader, h = function() { c(10).ZincObject.call(this); var f = [], g = void 0, p = void 0, u = void 0, y = void 0, v = void 0, m = void 0, x = void 0, w = 0, A = 0, M = [0, 0, 0], R = [0, 0, 0], L = [0, 0, 0], S = "NONE"; this.ready = !1; var I = !1, T = !1; this.isGlyphset = !0; var _ = new l.Matrix4(), E = new l.Color(), C = new l.Color(), P = new l.Box3(), b = new l.Box3(), F = new l.Box3(), D = [], N = [], B = [], U = [], G = [], Y = [], te = []; this.globalScale = 1; for (var ae = 0; 8 > ae; ae++) new l.Vector3(); this.load = (V, H, K, ce, se) => { g = V.axis1, p = V.axis2, u = V.axis3, y = V.positions, v = V.scale, m = V.colors, x = V.label, I = V.metadata.MorphColours, T = V.metadata.MorphVertices, w = V.metadata.number_of_time_steps, S = V.metadata.repeat_mode, A = V.metadata.number_of_vertices, S == "AXES_2D" || S == "MIRROR" ? A *= 2 : S == "AXES_3D" && (A *= 3), M = V.metadata.base_size, R = V.metadata.offset, L = V.metadata.scale_factors; var k = new d(); this.geometry = new l.BufferGeometry(); var O = new l.InstancedMesh(this.geometry, void 0, A); if (this.setMorph(O), ce) { var Z = k.parse(H); re(K, se)(Z.geometry, Z.materials), Z.geometry.dispose(); } else k.crossOrigin = "Anonymous", k.load(H, re(K, se)); }; var ie = (V, H, K, ce, se, k) => { if (S == "NONE" || S == "MIRROR") { for (var O, Z = [0, 0, 0], X = [0, 0, 0], ee = [0, 0, 0], fe = [0, 0, 0], be = [0, 0, 0], Ae = [0, 0, 0], he = [0, 0, 0], xe = [0, 0, 0], ne = [0, 0, 0], me = 0; 3 > me; me++) O = 0 > se[me] ? -1 : 1, Z[me] = (O * M[me] + se[me] * L[me]) * this.globalScale; for (var me = 0; 3 > me; me++) X[me] = H[me] * Z[0], ee[me] = K[me] * Z[1], fe[me] = ce[me] * Z[2], be[me] = V[me] + R[0] * X[me] + R[1] * ee[me] + R[2] * fe[me], S == "MIRROR" && (Ae[me] = -X[me], he[me] = -ee[me], xe[me] = -fe[me], ne[me] = be[me], 0 > se[0] && (be[me] -= X[me], ne[me] -= Ae[me])); 0 > fe[0] * (X[1] * ee[2] - X[2] * ee[1]) + fe[1] * (X[2] * ee[0] - X[0] * ee[2]) + fe[2] * (X[0] * ee[1] - X[1] * ee[0]) && (fe[0] = -fe[0], fe[1] = -fe[1], fe[2] = -fe[2]), k[0] = [be, X, ee, fe], S == "MIRROR" && (0 > xe[0] * (Ae[1] * he[2] - Ae[2] * he[1]) + xe[1] * (Ae[2] * he[0] - Ae[0] * he[2]) + xe[2] * (Ae[0] * he[1] - Ae[1] * he[0]) && (xe[0] = -xe[0], xe[1] = -xe[1], xe[2] = -xe[2]), k[1] = [ne, Ae, he, xe]); } else if (S == "AXES_2D" || S == "AXES_3D") { for (var O, Me = [0, 0, 0], De = [0, 0, 0], me = 0; 3 > me; me++) O = 0 > se[me] ? -1 : 1, Me[me] = (O * M[0] + se[me] * L[0]) * this.globalScale; for (var me = 0; 3 > me; me++) De[me] = V[me] + R[0] * Me[0] * H[me] + R[1] * Me[1] * K[me] + R[2] * Me[2] * ce[me]; for (var Ie = glyph_repeat_mode == "AXES_2D" ? 2 : 3, $e = 0; $e < Ie; $e++) { var lt = void 0, qe = void 0, Mt = se[$e], Be = [0, 0, 0], it = [0, 0, 0], tt = [0, 0, 0]; $e == 0 ? (lt = H, qe = K) : $e == 1 ? (lt = K, qe = glyph_repeat_mode == "AXES_2D" ? H : ce) : (lt = ce, qe = H); var qt = (M[0] + Mt * L[0]) * this.globalScale; Be[0] = lt[0] * qt, Be[1] = lt[1] * qt, Be[2] = lt[2] * qt, tt[0] = Be[1] * qe[2] - qe[1] * Be[2], tt[1] = Be[2] * qe[0] - qe[2] * Be[0], tt[2] = Be[0] * qe[1] - Be[1] * qe[0]; var Qt = Math.sqrt(tt[0] * tt[0] + tt[1] * tt[1] + tt[2] * tt[2]); if (0 < Qt) { var Ft = (M[2] + Mt * L[2]) * this.globalScale / Qt; S == "AXES_2D" && 0 < $e && (Ft *= -1), tt[0] *= Ft, tt[1] *= Ft, tt[2] *= Ft; } if (it[0] = tt[1] * Be[2] - Be[1] * tt[2], it[1] = tt[2] * Be[0] - Be[2] * tt[0], it[2] = tt[0] * Be[1] - tt[1] * Be[0], Qt = Math.sqrt(it[0] * it[0] + it[1] * it[1] + it[2] * it[2]), 0 < Qt) { var Nt = (M[1] + Mt * L[1]) * this.globalScale / Qt; it[0] *= Nt, it[1] *= Nt, it[2] *= Nt; } k[$e] = [De, Be, it, tt]; } } return k; }, le = (V, H, K, ce, se) => { var k = 1; S == "AXES_2D" || S == "MIRROR" ? k = 2 : S == "AXES_3D" && (k = 3); var O = V.length / 3, Z = 0; te.length = k; for (var X = 0; X < O; X++) { var ee = 3 * X, fe = [V[ee], V[ee + 1], V[ee + 2]], be = [H[ee], H[ee + 1], H[ee + 2]], Ae = [K[ee], K[ee + 1], K[ee + 2]], he = [ce[ee], ce[ee + 1], ce[ee + 2]], xe = [se[ee], se[ee + 1], se[ee + 2]], ne = ie(fe, be, Ae, he, xe, te); if (ne.length == k) for (var me = 0; me < k; me++) { _.elements[0] = ne[me][1][0], _.elements[1] = ne[me][1][1], _.elements[2] = ne[me][1][2], _.elements[3] = 0, _.elements[4] = ne[me][2][0], _.elements[5] = ne[me][2][1], _.elements[6] = ne[me][2][2], _.elements[7] = 0, _.elements[8] = ne[me][3][0], _.elements[9] = ne[me][3][1], _.elements[10] = ne[me][3][2], _.elements[11] = 0, _.elements[12] = ne[me][0][0], _.elements[13] = ne[me][0][1], _.elements[14] = ne[me][0][2], _.elements[15] = 1, this.morph.setMatrixAt(Z, _); var Me = f[Z]; Me && Me.setTransformation(ne[me][0], ne[me][1], ne[me][2], ne[me][3]), Z++; } } this.morph.instanceMatrix.needsUpdate = !0; }, W = (V) => { var H = 1; S == "AXES_2D" || S == "MIRROR" ? H = 2 : S == "AXES_3D" && (H = 3); for (var K, ce = V.length, se = 0, k = 0; k < ce; k++) { K = V[k]; for (var O = 0; O < H; O++) { E.setHex(K), this.morph.setColorAt(se, E); var Z = f[se]; Z && Z.setColour(E), se++; } } this.morph.instanceColor.needsUpdate = !0; }, $ = () => { var V = D, H = N, K = B, ce = U, se = G, k = Y, O = this.inbuildTime / this.duration * (w - 1), Z = Math.floor(O), X = 1 - (O - Z), ee = Math.ceil(O); if (T) { var fe = y[Z.toString()], be = y[ee.toString()], Ae = g[Z.toString()], he = g[ee.toString()], xe = p[Z.toString()], ne = p[ee.toString()], me = u[Z.toString()], Me = u[ee.toString()], De = v[Z.toString()], Ie = v[ee.toString()]; D.length = fe.length, N.length = fe.length, B.length = fe.length, U.length = fe.length, G.length = fe.length; for (var $e = 0; $e < fe.length; $e++) V[$e] = X * fe[$e] + (1 - X) * be[$e], H[$e] = X * Ae[$e] + (1 - X) * he[$e], K[$e] = X * xe[$e] + (1 - X) * ne[$e], ce[$e] = X * me[$e] + (1 - X) * Me[$e], se[$e] = X * De[$e] + (1 - X) * Ie[$e]; } else V = y[0], H = g[0], K = p[0], ce = u[0], se = v[0]; if (le(V, H, K, ce, se), this.boundingBoxUpdateRequired = !0, m != null) { if (I) { var lt = m[Z.toString()], qe = m[ee.toString()]; k.length = lt.length; for (var Mt = 0; Mt < lt.length; Mt++) E.setHex(lt[Mt]), C.setHex(qe[Mt]), E.setRGB(E.r * X + C.r * (1 - X), E.g * X + C.g * (1 - X), E.b * X + C.b * (1 - X)), k[Mt] = E.getHex(); } else k = m[0]; W(k); } }; this.showLabel = () => { for (var V = 0; V < f.length; V++) f[V].showLabel(this.morph.material ? this.morph.material.color : void 0); }, this.hideLabel = () => { for (var V = 0; V < f.length; V++) f[V].hideLabel(); }; var j = (V) => { for (var H = 0; H < A; H++) { var K = new (c(16)).Glyph(void 0, void 0, H, this), ce = x ? x[H] : void 0; ce = ce || this.groupName, ce && K.setLabel(ce), 0 < w && K.setFrustumCulled(!1), f[H] = K, this.morph.add(K.getGroup()); } V && this.showLabel(), le(y[0], g[0], p[0], u[0], v[0]), m != null && W(m[0]), this.ready = !0, this.boundingBoxUpdateRequired = !0; }; this.addCustomGlyph = (V) => { V.isGlyph && f.push(V), this.ready = !0, this.boundingBoxUpdateRequired = !0; }, this.addMeshAsGlyph = (V, H) => { if (V.isMesh) { var K = new (c(16)).Glyph(void 0, void 0, H, this); return K.fromMesh(V), f.push(K), this.morph.add(K.getGroup()), this.ready = !0, this.boundingBoxUpdateRequired = !0, K; } }, this.forEachGlyph = (V) => { for (var H = 0; H < f.length; H++) V(f[H]); }; var re = (V, H) => (K, ce) => { var se = K.toBufferGeometry(); this.geometry.copy(se), this.geometry.computeBoundingSphere(), this.geometry.computeBoundingBox(), se.dispose(), ce && ce[0] && (this.morph.material = ce[0]), j(H), this.morph.name = this.groupName, this.morph.userData = this, this.setMorph(this.morph), K.dispose(), V != null && typeof V == "function" && V(this); }; this.getClosestVertexIndex = function() { var V = -1; if (this.morph && this.ready) { this.getBoundingBox().getCenter(this._v1); for (var H, K = y[0], ce = K.length / 3, se = -1, k = 0, O = 0; O < ce; O++) H = 3 * O, this._v2.set(K[H], K[H + 1], K[H + 2]), k = this._v1.distanceTo(this._v2), (se == -1 || se > k) && (se = k, V = O); } return V; }, this.getClosestVertex = function() { if (this.closestVertexIndex == -1 && (this.closestVertexIndex = this.getClosestVertexIndex()), 0 <= this.closestVertexIndex && this.morph) { var V = new l.Vector3(); return this.morph.getMatrixAt(this.closestVertexIndex, _), V.setFromMatrixPosition(_), V; } }, this.getBoundingBox = () => { if (this.morph && this.ready && this.morph.visible) { if (this.boundingBoxUpdateRequired) { P.setFromBufferAttribute(this.morph.geometry.attributes.position); for (var V = 0; V < A; V++) this.morph.getMatrixAt(V, _), b.copy(P).applyMatrix4(_), V == 0 ? F.copy(b) : F.union(b); if (F) this.cachedBoundingBox.copy(F), this.morph.updateWorldMatrix(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1; else return; } return this.cachedBoundingBox; } }, this.setMorphTime = (V) => { this.inbuildTime = V > this.duration ? this.duration : 0 > V ? 0 : V, (I || T) && ($(), T && (this.markerUpdateRequired = !0)); }, this.isTimeVarying = () => !!((this.ready === !1 || 0 < w) && (I || T)), this.getCurrentTime = () => this.inbuildTime, this.setScaleAll = function(V) { this.globalScale = V, $(); }, this.dispose = () => { for (var V = f.length - 1; 0 <= V; V--) f[V].dispose(); this.geometry && this.geometry.dispose(), this.morph && this.morph.material.dispose(), g = void 0, p = void 0, u = void 0, y = void 0, v = void 0, m = void 0, this.ready = !1, this.groupName = void 0; }, this.render = (V, H, K) => { if (H == !0) { var ce = this.inbuildTime + V; ce > this.duration && (ce -= this.duration), this.inbuildTime = ce, (I || T) && $(); } this.updateMarker(H, K); }; }; h.prototype = Object.create(c(10).ZincObject.prototype), a.Glyphset = h; }, /* 19 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ JSONLoader: () => ( /* binding */ M ) /* harmony export */ }); var l = c(4), d = c(20).Loader, h = l.LoaderUtils, f = l.AnimationClip, g = l.Vector3, p = l.Vector4, u = l.Color, y = l.Vector2, v = c(6).Face3, m = c(6).Geometry, x = l.FileLoader, w = l.DefaultLoadingManager, A = c(21).VideoHandler; function M(R) { typeof R == "boolean" && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), R = void 0), this.manager = R === void 0 ? w : R, this.withCredentials = !1, this.paramsString = ""; } Object.assign(M.prototype, { load: function(L, S, I, T) { var _ = this, E = this.texturePath && typeof this.texturePath == "string" ? this.texturePath : h.extractUrlBase(L), C = new x(this.manager); L.split("?"), this.paramsString = L.length === 2 ? paramsStrings[1] : "", C.setWithCredentials(this.withCredentials), C.load(L, function(P) { var b; try { b = JSON.parse(P); } catch { if (console.error("The loader has encountered an error while parsing the content of a resource."), T) return void T({ responseURL: L }); } var F = b.metadata; if (F !== void 0) { var D = F.type; if (D !== void 0 && D.toLowerCase() === "object") return void console.error("THREE.JSONLoader: " + L + " should be loaded with THREE.ObjectLoader instead."); } if (_ && _.parse) try { var N = _.parse(b, E); S(N.geometry, N.materials); } catch (B) { if (console.error("The loader has encountered aon loading the geometry"), console.error(B), T) return void T({ responseURL: L }); } }, I, T); }, setTexturePath: function(L) { this.texturePath = L; }, parse: /* @__PURE__ */ function() { function R(T, _) { function E(me, Me) { return me & 1 << Me; } var C, P, b, F, D, N, B, U, G, Y, te, ae, ie, le, W, $, j, re, V, H, K, ce, se, k, O, Z, X, ee = T.faces, fe = T.vertices, be = T.normals, Ae = T.colors, he = T.scale, xe = 0; if (T.uvs !== void 0) { for (C = 0; C < T.uvs.length; C++) T.uvs[C].length && xe++; for (C = 0; C < xe; C++) _.faceVertexUvs[C] = []; } for (F = 0, D = fe.length; F < D; ) re = new g(), re.x = fe[F++] * he, re.y = fe[F++] * he, re.z = fe[F++] * he, _.vertices.push(re); if (F = 0, D = ee.length, T.uvs) for (C = 0; C < T.uvs.length; C++) { _.uvs[C] = []; for (var ne = 0; ne < T.uvs[C].length; ne++) _.uvs[C][ne] = T.uvs[C][ne]; } if (be) for (C = 0; C < be.length; C++) _.normals[C] = be[C]; if (Ae) for (C = 0; C < Ae.length; C++) _.colors[C] = Ae[C]; for (; F < D; ) if (Y = ee[F++], te = E(Y, 0), ae = E(Y, 1), ie = E(Y, 3), le = E(Y, 4), W = E(Y, 5), $ = E(Y, 6), j = E(Y, 7), te) { if (H = new v(), H.a = ee[F], H.b = ee[F + 1], H.c = ee[F + 3], K = new v(), K.a = ee[F + 1], K.b = ee[F + 2], K.c = ee[F + 3], F += 4, ae && (G = ee[F++], H.materialIndex = G, K.materialIndex = G), b = _.faces.length, ie) for (C = 0; C < xe; C++) for (k = T.uvs[C], _.faceVertexUvs[C][b] = [], _.faceVertexUvs[C][b + 1] = [], P = 0; 4 > P; P++) U = ee[F++], Z = k[2 * U], X = k[2 * U + 1], O = new y(Z, X), P !== 2 && _.faceVertexUvs[C][b].push(O), P !== 0 && _.faceVertexUvs[C][b + 1].push(O); if (le && (B = 3 * ee[F++], H.normal.set(be[B++], be[B++], be[B]), K.normal.copy(H.normal)), W) for (C = 0; 4 > C; C++) B = 3 * ee[F++], se = new g(be[B++], be[B++], be[B]), C !== 2 && H.vertexNormals.push(se), C !== 0 && K.vertexNormals.push(se); if ($ && (N = ee[F++], ce = Ae[N], H.color.setHex(ce), K.color.setHex(ce)), j) for (C = 0; 4 > C; C++) N = ee[F++], ce = Ae[N], C !== 2 && H.vertexColors.push(new u(ce)), C !== 0 && K.vertexColors.push(new u(ce)); _.faces.push(H), _.faces.push(K); } else { if (V = new v(), V.a = ee[F++], V.b = ee[F++], V.c = ee[F++], ae && (G = ee[F++], V.materialIndex = G), b = _.faces.length, ie) for (C = 0; C < xe; C++) for (k = T.uvs[C], _.faceVertexUvs[C][b] = [], P = 0; 3 > P; P++) U = ee[F++], Z = k[2 * U], X = k[2 * U + 1], O = new y(Z, X), _.faceVertexUvs[C][b].push(O); if (le && (B = 3 * ee[F++], V.normal.set(be[B++], be[B++], be[B])), W) for (C = 0; 3 > C; C++) B = 3 * ee[F++], se = new g(be[B++], be[B++], be[B]), V.vertexNormals.push(se); if ($ && (N = ee[F++], V.color.setHex(Ae[N])), j) for (C = 0; 3 > C; C++) N = ee[F++], V.vertexColors.push(new u(Ae[N])); _.faces.push(V); } } function L(T, _) { var E = T.influencesPerVertex === void 0 ? 2 : T.influencesPerVertex; if (T.skinWeights) for (var C = 0, P = T.skinWeights.length; C < P; C += E) { var b = T.skinWeights[C], F = 1 < E ? T.skinWeights[C + 1] : 0, D = 2 < E ? T.skinWeights[C + 2] : 0, N = 3 < E ? T.skinWeights[C + 3] : 0; _.skinWeights.push(new p(b, F, D, N)); } if (T.skinIndices) for (var C = 0, P = T.skinIndices.length; C < P; C += E) { var B = T.skinIndices[C], U = 1 < E ? T.skinIndices[C + 1] : 0, G = 2 < E ? T.skinIndices[C + 2] : 0, Y = 3 < E ? T.skinIndices[C + 3] : 0; _.skinIndices.push(new p(B, U, G, Y)); } _.bones = T.bones, _.bones && 0 < _.bones.length && (_.skinWeights.length !== _.skinIndices.length || _.skinIndices.length !== _.vertices.length) && console.warn("When skinning, number of vertices (" + _.vertices.length + "), skinIndices (" + _.skinIndices.length + "), and skinWeights (" + _.skinWeights.length + ") should match."); } function S(T, _) { var E = T.scale; if (T.morphTargets !== void 0) for (var C = 0, P = T.morphTargets.length; C < P; C++) { _.morphTargets[C] = {}, _.morphTargets[C].name = T.morphTargets[C].name, _.morphTargets[C].vertices = []; for (var b, F = _.morphTargets[C].vertices, D = T.morphTargets[C].vertices, N = 0, B = D.length; N < B; N += 3) b = new g(), b.x = D[N] * E, b.y = D[N + 1] * E, b.z = D[N + 2] * E, F.push(b); } if (T.morphNormals !== void 0) { for (var C = 0, P = T.morphNormals.length; C < P; C++) if (_.morphTargets[C]) { _.morphTargets[C].normals = []; for (var U, G = _.morphTargets[C].normals, Y = T.morphNormals[C].normals, N = 0, B = Y.length; N < B; N += 3) U = new g(), U.x = Y[N], U.y = Y[N + 1], U.z = Y[N + 2], G.push(U); _.morphNormalsReady = !0; } } if (T.morphColors !== void 0) { var C, P, te, ae, ie, le, W; for (C = 0, P = T.morphColors.length; C < P; C++) for (_.morphColors[C] = {}, _.morphColors[C].name = T.morphColors[C].name, _.morphColors[C].colors = [], ie = _.morphColors[C].colors, le = T.morphColors[C].colors, te = 0, ae = le.length; te < ae; te += 3) W = new l.Color(16755200), W.setRGB(le[te], le[te + 1], le[te + 2]), ie.push(W); } } function I(T, _) { var E = [], C = []; T.animation !== void 0 && C.push(T.animation), T.animations !== void 0 && (T.animations.length ? C = C.concat(T.animations) : C.push(T.animations)); for (var P, b = 0; b < C.length; b++) P = f.parseAnimation(C[b], _.bones), P && E.push(P); if (_.morphTargets) { var F = f.CreateClipsFromMorphTargetSequences(_.morphTargets, 10); E = E.concat(F); } 0 < E.length && (_.animations = E); } return function(T, _) { T.data !== void 0 && (T = T.data), T.scale = T.scale === void 0 ? 1 : 1 / T.scale; var E = new m(); if (E.morphColors = [], R(T, E), L(T, E), S(T, E), I(T, E), E.computeFaceNormals(), E.computeBoundingSphere(), T.materials === void 0 || T.materials.length === 0) return { geometry: E }; var C = d.prototype.initMaterials(T.materials, _, "Anonymous"); if (T.materials[0].video) { var P = _ + T.materials[0].video; this.paramsString && (P += "?".concat(this.paramsString)); var b = new A(P); E._video = b; } return C && 0 < C.length && (C[0].side = T.materials[0].singleSided ? l.FrontSide : T.materials[0].flipSided ? l.BackSide : l.DoubleSide, T.materials[0].specularCoef && (C[0].shininess = Math.floor(T.materials[0].specularCoef / 3))), { geometry: E, materials: C }; }; }() }); }, /* 20 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Loader: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); c(4); function d() { } d.Handlers = { handlers: [], add: function(f, g) { this.handlers.push(f, g); }, get: function(f) { for (var g = this.handlers, p = 0, u = g.length; p < u; p += 2) { var y = g[p], v = g[p + 1]; if (y.test(f)) return v; } return null; } }, Object.assign(d.prototype, { crossOrigin: "anonymous", onLoadStart: function() { }, onLoadProgress: function() { }, onLoadComplete: function() { }, initMaterials: function(f, g, p) { for (var u = [], y = 0; y < f.length; ++y) u[y] = this.createMaterial(f[y], g, p); return u; }, createMaterial: function() { var h = { NoBlending: l.NoBlending, NormalBlending: l.NormalBlending, AdditiveBlending: l.AdditiveBlending, SubtractiveBlending: l.SubtractiveBlending, MultiplyBlending: l.MultiplyBlending, CustomBlending: l.CustomBlending }, f = new l.Color(), g = new l.TextureLoader(), p = new l.MaterialLoader(); return function(u, y, v) { function m(R, L, S, I, T) { var _, E = y + R, C = d.Handlers.get(E); C === null ? (g.setCrossOrigin(v), _ = g.load(E)) : _ = C.load(E), L !== void 0 && (_.repeat.fromArray(L), L[0] !== 1 && (_.wrapS = l.RepeatWrapping), L[1] !== 1 && (_.wrapT = l.RepeatWrapping)), S !== void 0 && _.offset.fromArray(S), I !== void 0 && (I[0] === "repeat" && (_.wrapS = l.RepeatWrapping), I[0] === "mirror" && (_.wrapS = l.MirroredRepeatWrapping), I[1] === "repeat" && (_.wrapT = l.RepeatWrapping), I[1] === "mirror" && (_.wrapT = l.MirroredRepeatWrapping)), T !== void 0 && (_.anisotropy = T); var P = l.MathUtils.generateUUID(); return x[P] = _, P; } var x = {}, w = { uuid: l.MathUtils.generateUUID(), type: "MeshLambertMaterial" }; for (var A in u) { var M = u[A]; switch (A) { case "DbgColor": case "DbgIndex": case "opticalDensity": case "illumination": break; case "DbgName": w.name = M; break; case "blending": w.blending = h[M]; break; case "colorAmbient": case "mapAmbient": console.warn("THREE.Loader.createMaterial:", A, "is no longer supported."); break; case "colorDiffuse": w.color = f.fromArray(M).getHex(); break; case "colorSpecular": w.specular = f.fromArray(M).getHex(); break; case "colorEmissive": w.emissive = f.fromArray(M).getHex(); break; case "specularCoef": w.shininess = M; break; case "shading": M.toLowerCase() === "basic" && (w.type = "MeshBasicMaterial"), M.toLowerCase() === "phong" && (w.type = "MeshPhongMaterial"), M.toLowerCase() === "standard" && (w.type = "MeshStandardMaterial"); break; case "mapDiffuse": w.map = m(M, u.mapDiffuseRepeat, u.mapDiffuseOffset, u.mapDiffuseWrap, u.mapDiffuseAnisotropy); break; case "mapDiffuseRepeat": case "mapDiffuseOffset": case "mapDiffuseWrap": case "mapDiffuseAnisotropy": break; case "mapEmissive": w.emissiveMap = m(M, u.mapEmissiveRepeat, u.mapEmissiveOffset, u.mapEmissiveWrap, u.mapEmissiveAnisotropy); break; case "mapEmissiveRepeat": case "mapEmissiveOffset": case "mapEmissiveWrap": case "mapEmissiveAnisotropy": break; case "mapLight": w.lightMap = m(M, u.mapLightRepeat, u.mapLightOffset, u.mapLightWrap, u.mapLightAnisotropy); break; case "mapLightRepeat": case "mapLightOffset": case "mapLightWrap": case "mapLightAnisotropy": break; case "mapAO": w.aoMap = m(M, u.mapAORepeat, u.mapAOOffset, u.mapAOWrap, u.mapAOAnisotropy); break; case "mapAORepeat": case "mapAOOffset": case "mapAOWrap": case "mapAOAnisotropy": break; case "mapBump": w.bumpMap = m(M, u.mapBumpRepeat, u.mapBumpOffset, u.mapBumpWrap, u.mapBumpAnisotropy); break; case "mapBumpScale": w.bumpScale = M; break; case "mapBumpRepeat": case "mapBumpOffset": case "mapBumpWrap": case "mapBumpAnisotropy": break; case "mapNormal": w.normalMap = m(M, u.mapNormalRepeat, u.mapNormalOffset, u.mapNormalWrap, u.mapNormalAnisotropy); break; case "mapNormalFactor": w.normalScale = M; break; case "mapNormalRepeat": case "mapNormalOffset": case "mapNormalWrap": case "mapNormalAnisotropy": break; case "mapSpecular": w.specularMap = m(M, u.mapSpecularRepeat, u.mapSpecularOffset, u.mapSpecularWrap, u.mapSpecularAnisotropy); break; case "mapSpecularRepeat": case "mapSpecularOffset": case "mapSpecularWrap": case "mapSpecularAnisotropy": break; case "mapMetalness": w.metalnessMap = m(M, u.mapMetalnessRepeat, u.mapMetalnessOffset, u.mapMetalnessWrap, u.mapMetalnessAnisotropy); break; case "mapMetalnessRepeat": case "mapMetalnessOffset": case "mapMetalnessWrap": case "mapMetalnessAnisotropy": break; case "mapRoughness": w.roughnessMap = m(M, u.mapRoughnessRepeat, u.mapRoughnessOffset, u.mapRoughnessWrap, u.mapRoughnessAnisotropy); break; case "mapRoughnessRepeat": case "mapRoughnessOffset": case "mapRoughnessWrap": case "mapRoughnessAnisotropy": break; case "mapAlpha": w.alphaMap = m(M, u.mapAlphaRepeat, u.mapAlphaOffset, u.mapAlphaWrap, u.mapAlphaAnisotropy); break; case "mapAlphaRepeat": case "mapAlphaOffset": case "mapAlphaWrap": case "mapAlphaAnisotropy": break; case "flipSided": w.side = l.BackSide; break; case "doubleSided": w.side = l.DoubleSide; break; case "transparency": console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), w.opacity = M; break; case "depthTest": case "depthWrite": case "colorWrite": case "opacity": case "reflectivity": case "transparent": case "visible": case "wireframe": w[A] = M; break; case "vertexColors": M === !0 && (w.vertexColors = l.VertexColors), M === "face" && (w.vertexColors = l.FaceColors); break; default: console.error("THREE.Loader.createMaterial: Unsupported", A, M); } } return w.type === "MeshBasicMaterial" && delete w.emissive, w.type !== "MeshPhongMaterial" && delete w.specular, 1 > w.opacity && (w.transparent = !0), p.setTextures(x), p.parse(w); }; }() }); }, /* 21 */ /***/ (o, a, c) => { var l = c(4); a.VideoHandler = function(d) { var h = this; this.video = void 0, this.videoTexture = void 0, this.setMorphTime = function(f, g) { var p = f / g * h.video.duration; h.video.currentTime = p; }, this.getVideoDuration = function() { return h.video.duration; }, this.createCanvasVideoTexture = function() { return h.videoTexture = new l.VideoTexture(h.video), h.videoTexture.minFilter = l.LinearFilter, h.videoTexture.magFilter = l.LinearFilter, h.videoTexture.format = l.RGBFormat, h.video.currentTime = 0, h.videoTexture; }, this.getCurrentTime = function(f) { return h.video ? f * (h.video.currentTime / h.video.duration) : 0; }, this.isReadyToPlay = function() { return !!(h.video && 3 <= h.video.readyState); }, function() { document && (h.video = document.createElement("video"), h.video.crossOrigin = "anonymous", h.video.src = d, h.video.load(), h.video.loop = !0); }(); }; }, /* 22 */ /***/ (o, a, c) => { var l = c(4), d = c(23).Points, h = c(5).toBufferGeometry, f = c(5).getCircularTexture, g = c(17).Label, p = function() { c(10).ZincObject.call(this), this.isPointset = !0; var u = []; this.createMesh = (v, m, x) => { if (v && m) { var w = h(v, x), A = f(); m.map = A; var M = new d(w, m); this.setMesh(M, x.localTimeEnabled, x.localMorphColour); } }; var y = (v, m, x, w) => { if (x) { var A = new l.Color(w), M = new g(x, A); M.setPosition(m[0], m[1], m[2]); var R = M.getSprite(); R.material.sizeAttenuation = !1, R.material.alphaTest = 0.5, R.material.transparent = !0, R.material.depthWrite = !1, R.material.depthTest = !1, this.group.add(R), u[v] = M; } }; this.addPoints = (v, m, x) => { if (v && 0 < v.length) { var w = this.drawRange - 1, A = this.addVertices(v), M = this.getMorph(); if (!M) { var R = new l.PointsMaterial({ alphaTest: 0.5, size: 10, color: x, sizeAttenuation: !1 }); A.colorsNeedUpdate = !0, this.createMesh(A, R, { localTimeEnabled: !1, localMorphColour: !1 }); } var L = w + v.length, S = 0; if (Array.isArray(m) && m.length === v.length || typeof m == "string") for (w; w + S < L; ) { var I = typeof m == "string" ? m : m[S]; y(S, v[S], I, x), S++; } this.region && (this.region.pickableUpdateRequired = !0); } }, this.setSize = (v) => { this.morph && this.morph.material && (this.morph.material.size = v, this.morph.material.needsUpdate = !0); }, this.setSizeAttenuation = (v) => { this.morph && this.morph.material && (this.morph.material.sizeAttenuation = v, this.morph.material.needsUpdate = !0); }, this.getVerticesByIndex = function(v) { if (0 <= v && this.drawRange > v) { var m = this.getMorph().geometry.getAttribute("position"); return [m.getX(v), m.getY(v), m.getZ(v)]; } }, this.editVertices = function(v, m) { if (v && v.length) { var x = this.getMorph(), w = m + v.length - 1; if (!x || 0 > m || w >= this.drawRange) return; var A = x.geometry.getAttribute("position"), M = m; v.forEach((R) => { var L = u[M]; L && L.setPosition(R[0], R[1], R[2]), A.setXYZ(M++, R[0], R[1], R[2]); }), A.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; } }, this.render = (v, m, x, w) => { this.morph && x && (this.morph.sizePerPixel = x.pixelHeight), p.prototype.render.call(this, v, m, x, w); }; }; p.prototype = Object.create(c(10).ZincObject.prototype), a.Pointset = p; }, /* 23 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ Points: () => ( /* binding */ y ) /* harmony export */ }); var l = c(4), d = /* @__PURE__ */ new l.Matrix4(), h = /* @__PURE__ */ new l.Ray(), f = /* @__PURE__ */ new l.Sphere(), g = /* @__PURE__ */ new l.Vector3(), p = /* @__PURE__ */ new l.Vector3(), u = /* @__PURE__ */ new l.Vector3(); class y extends l.Object3D { constructor() { var w = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new l.BufferGeometry(), A = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new l.PointsMaterial(); super(), this.type = "Points", this.geometry = w, this.material = A, this.sizePerPixel = 1, this.updateMorphTargets(); } copy(w) { return super.copy(w), this.material = w.material, this.geometry = w.geometry, this; } raycast(w, A) { var M = this.geometry, R = this.matrixWorld, L = w.params.Points.threshold, S = M.drawRange; if (M.boundingSphere === null && M.computeBoundingSphere(), f.copy(M.boundingSphere), f.applyMatrix4(R), f.radius += L, w.ray.intersectsSphere(f) !== !1) { d.copy(R).invert(), h.copy(w.ray).applyMatrix4(d); var I = L / ((this.scale.x + this.scale.y + this.scale.z) / 3) * this.material.size * this.sizePerPixel, T = I * I; if (M.isBufferGeometry) { var _ = M.index, E = M.attributes, C = E.position, P = M.morphAttributes.position; if (_ !== null) for (var b, F = Math.max(0, S.start), D = Math.min(_.count, S.start + S.count), N = F; N < D; N++) b = _.getX(N), m(this, C, P, b), v(g, b, T, R, w, A, this); else for (var B = Math.max(0, S.start), U = Math.min(C.count, S.start + S.count), G = B; G < U; G++) m(this, C, P, G), v(g, G, T, R, w, A, this); } else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."); } } updateMorphTargets() { var w = this.geometry; if (w.isBufferGeometry) { var A = w.morphAttributes, M = Object.keys(A); if (0 < M.length) { var R = A[M[0]]; if (R !== void 0) { this.morphTargetInfluences = [], this.morphTargetDictionary = {}; for (var L, S = 0, I = R.length; S < I; S++) L = R[S].name || S + "", this.morphTargetInfluences.push(0), this.morphTargetDictionary[L] = S; } } } else { var T = w.morphTargets; T !== void 0 && 0 < T.length && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead."); } } } y.prototype.isPoints = !0; function v(x, w, A, M, R, L, S) { var I = h.distanceSqToPoint(x); if (I < A) { var T = new l.Vector3(); h.closestPointToPoint(x, T), T.applyMatrix4(M); var _ = R.ray.origin.distanceTo(T); if (_ < R.near || _ > R.far) return; L.push({ distance: _, distanceToRay: Math.sqrt(I), point: T, index: w, face: null, object: S }); } } function m(x, w, A, M) { g.fromBufferAttribute(w, M); var R = x.morphTargetInfluences; if (x.material.morphTargets && A && R) { p.set(0, 0, 0); for (var L = 0, S = A.length; L < S; L++) { var I = R[L], T = A[L]; I !== 0 && (u.fromBufferAttribute(T, M), p.addScaledVector(u.sub(g), I)); } g.add(p); } } }, /* 24 */ /***/ (o, a, c) => { var l = c(4), d = c(5).toBufferGeometry, h = function() { c(10).ZincObject.call(this), this.isLines = !0, this.createLineSegment = (f, g, p) => { if (f && g) { var u = d(f, p); p.localMorphColour && u.morphAttributes.color && (g.onBeforeCompile = c(9).augmentMorphColor()); var y = new (c(12)).LineSegments(u, g); this.setMesh(y, p.localTimeEnabled, p.localMorphColour); } }, this.setWidth = (f) => { this.morph && this.morph.material && (this.morph.material.linewidth = f, this.morph.material.needsUpdate = !0); }, this.addLines = (f, g) => { if (f && 0 < f.length) { var p = this.addVertices(f), u = this.getMorph(); if (!u) { var y = new l.LineBasicMaterial({ color: g }); p.colorsNeedUpdate = !0, this.createLineSegment(p, y, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }; }; h.prototype = Object.create(c(10).ZincObject.prototype), a.Lines = h; }, /* 25 */ /***/ (o, a, c) => { function l(g, p, u, y, v, m, x) { try { var w = g[m](x), A = w.value; } catch (M) { return void u(M); } w.done ? p(A) : Promise.resolve(A).then(y, v); } function d(g) { return function() { var p = this, u = arguments; return new Promise(function(y, v) { function m(A) { l(w, y, v, m, x, "next", A); } function x(A) { l(w, y, v, m, x, "throw", A); } var w = g.apply(p, u); m(void 0); }); }; } var h = c(4), f = function() { var g = this; c(26).Texture.call(this), this.isTextureArray = !0, this.loadFromImages = /* @__PURE__ */ function() { var p = d(function* (u) { var y = 1, v = 1, m = 0; if (u && u.length) { g.isLoading = !0; var x = new Image(); x.crossOrigin = "Anonymous"; for (var w, A = document.createElement("canvas"), M = 0, R = Array(u.length), L = 0; L < u.length; L++) w = yield g.imageToUint8Array(g, x, u[L], A), w && w.array && (y = w.width, v = w.height, R[m] = w.array, M += R[m].length, m++); var S = new Uint8Array(M); M = 0, R.forEach((I) => { S.set(I, M), M += I.length; }), g.impl = new h.DataTexture2DArray(S, y, v, m), g.size = { width: y, height: v, depth: m }, g.isLoading = !1, g.impl.needsUpdate = !0; } }); return function() { return p.apply(this, arguments); }; }(), this.getMaterial = (p) => { if (this.impl) { var u; if (!p) u = new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide }); else if (p.vs && p.fs) { var y = !0; "transparent" in p && (y = p.transparent); var v = h.FrontSide; p.side && (v = p.side), u = new h.ShaderMaterial({ transparent: y, uniforms: p.uniforms, vertexShader: p.vs, fragmentShader: p.fs, side: v }), p.glslVersion && (u.glslVersion = p.glslVersion); } if (u) return u.needsUpdate = !0, u; } }; }; f.prototype = Object.create(c(26).Texture.prototype), a.TextureArray = f; }, /* 26 */ /***/ (o, a, c) => { function l(g, p, u, y, v, m, x) { try { var w = g[m](x), A = w.value; } catch (M) { return void u(M); } w.done ? p(A) : Promise.resolve(A).then(y, v); } function d(g) { return function() { var p = this, u = arguments; return new Promise(function(y, v) { function m(A) { l(w, y, v, m, x, "next", A); } function x(A) { l(w, y, v, m, x, "throw", A); } var w = g.apply(p, u); m(void 0); }); }; } var h = c(4), f = function() { this.isTexture = !0, this.impl = void 0, this.isLoading = !1, this.size = { width: 1, height: 1, depth: 0 }; }; f.prototype.loadImage = function(g, p) { return new Promise((u, y) => { g.onload = () => u(g), g.onerror = y, g.src = p; }); }, f.prototype.imageToUint8Array = /* @__PURE__ */ function() { var g = d(function* (p, u, y, v) { yield p.loadImage(u, y), v.width = u.width, v.height = u.height; var m = v.getContext("2d"); return m.drawImage(u, 0, 0), { array: new Uint8Array(m.getImageData(0, 0, v.width, v.height).data.buffer), width: v.width, height: v.height }; }); return function() { return g.apply(this, arguments); }; }(), f.prototype.loadFromImages = /* @__PURE__ */ function() { var g = d(function* () { }); return function() { return g.apply(this, arguments); }; }(), f.prototype.isReady = function() { return !(!this.impl || this.isLoading); }, f.prototype.getMaterial = function() { if (this.impl) return new h.MeshBasicMaterial({ color: new h.Color(1, 1, 1), transparent: !1, opacity: 1, map: this.impl, side: h.DoubleSide }); }, a.Texture = f; }, /* 27 */ /***/ (o, a, c) => { function l(v, m) { var x = Object.keys(v); if (Object.getOwnPropertySymbols) { var w = Object.getOwnPropertySymbols(v); m && (w = w.filter(function(A) { return Object.getOwnPropertyDescriptor(v, A).enumerable; })), x.push.apply(x, w); } return x; } function d(v) { for (var m, x = 1; x < arguments.length; x++) m = arguments[x] == null ? {} : arguments[x], x % 2 ? l(Object(m), !0).forEach(function(w) { h(v, w, m[w]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(v, Object.getOwnPropertyDescriptors(m)) : l(Object(m)).forEach(function(w) { Object.defineProperty(v, w, Object.getOwnPropertyDescriptor(m, w)); }); return v; } function h(v, m, x) { return (m = f(m)) in v ? Object.defineProperty(v, m, { value: x, enumerable: !0, configurable: !0, writable: !0 }) : v[m] = x, v; } function f(v) { var m = g(v, "string"); return typeof m == "symbol" ? m : m + ""; } function g(v, m) { if (typeof v != "object" || !v) return v; var x = v[Symbol.toPrimitive]; if (x !== void 0) { var w = x.call(v, m || "default"); if (typeof w != "object") return w; throw new TypeError("@@toPrimitive must return a primitive value."); } return (m === "string" ? String : Number)(v); } var p = c(4), u = c(28), y = function(v) { c(29).TexturePrimitive.call(this, v), this.isTextureSlides = !0; var m = [], x = {}; this.morph = new p.Group(), this.group = this.morph, this.morph.userData = this; var w = void 0, A = !0; this.createSlides = (L) => { L.forEach((S) => this.createSlide(S)); }; var M = (L, S) => { var I = L.material, T = I.uniforms; switch (L.rotation.x = 0, L.rotation.y = 0, L.rotation.z = 0, L.position.x = 0, L.position.y = 0, L.position.z = 0, S.direction) { case "x": var _ = -Math.PI / 2; L.rotation.y = _, T.direction.value = 1, T.slide.value.set(S.value, 0, 0), L.position.x = S.value; break; case "y": L.rotation.x = Math.PI / 2, T.direction.value = 2, T.slide.value.set(0, S.value, 0), L.position.y = S.value; break; case "z": T.direction.value = 3, T.slide.value.set(0, 0, S.value), L.position.z = S.value; break; } I.needsUpdate = !0, this.boundingBoxUpdateRequired = !0; }; this.modifySlideSettings = (L) => { L && L.id && L.id in x && x[L.id] && M(x[L.id], L); }, this.createSlide = (L) => { if (this.texture && this.texture.isTextureArray && this.texture.isReady() && L && L.direction && L.value !== void 0) { var S = new p.PlaneGeometry(1, 1); S.translate(0.5, 0.5, 0); var I = u.getUniforms(); I.diffuse.value = this.texture.impl, I.depth.value = this.texture.size.depth, I.flipY.value = A; var T = { fs: u.fs, vs: u.vs, uniforms: I, glslVersion: u.glslVersion, side: p.DoubleSide, transparent: !1 }, _ = this.texture.getMaterial(T); _.needsUpdate = !0; var E = new p.Mesh(S, _); E.name = this.groupName, E.userData = this; var C = { value: L.value, direction: L.direction, id: E.id }; return m.push(C), M(E, C), x[E.id] = E, this.morph.add(E), this.boundingBoxUpdateRequired = !0, C; } }, this.getTextureSettings = () => [...m], this.getTextureSettingsWithId = (L) => { for (var S = 0; S < m.length; S++) if (L === m[S].id) return d({}, m[S]); }, this.getSlides = () => this.morph ? [...this.morph.children] : [], this.removeSlide = (L) => { L && this.removeSlideWithId(L.id); }, this.removeSlideWithId = (L) => { if (this.morph && L in x && x[L]) { if (this.morph.getObjectById(L)) { var S = x[L]; this.morph.remove(S), S.clear(), S.geometry && S.geometry.dispose(), S.material && S.material.dispose(), this.boundingBoxUpdateRequired = !0; } var I = m.findIndex((T) => T.id === L); -1 < I && m.splice(I, 1); } }, this.dispose = () => { this.morph.children.forEach((L) => { L.geometry && L.geometry.dispose(), L.material && L.material.dispose(); }), c(29).TexturePrimitive.prototype.dispose.call(this), this.boundingBoxUpdateRequired = !0; }; var R = (L, S, I) => { if (S) switch (S.direction.value) { case 1: I.copy(S.slide.value), L.expandByPoint(I), I.setY(1), I.setZ(1), L.expandByPoint(I); break; case 2: I.copy(S.slide.value), L.expandByPoint(I), I.setX(1), I.setZ(1), L.expandByPoint(I); break; case 3: I.copy(S.slide.value), L.expandByPoint(I), I.setX(1), I.setY(1), L.expandByPoint(I); break; } }; this.getBoundingBox = () => { if (this.morph && this.morph.children && this.morph.visible && this.boundingBoxUpdateRequired) { this.cachedBoundingBox.makeEmpty(); var L = new p.Vector3(0, 0, 0); this.morph.children.forEach((S) => { R(this.cachedBoundingBox, S.material.uniforms, L); }), this.morph.updateMatrixWorld(!0, !0), this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld), this.boundingBoxUpdateRequired = !1; } return this.cachedBoundingBox; }, this.applyTransformation = (L, S, I) => { var T = new p.Matrix4(); T.set(L[0], L[1], L[2], 0, L[3], L[4], L[5], 0, L[6], L[7], L[8], 0, 0, 0, 0, 0); var _ = new p.Quaternion().setFromRotationMatrix(T); this.morph.position.set(...S), this.morph.quaternion.copy(_), this.morph.scale.set(...I), this.morph.updateMatrix(), this.boundingBoxUpdateRequired = !0; }, this.setRenderOrder = (L) => { this.morph.renderOrder = L; }, this.initialise = (L, S) => { if (L) { var I = L.locations; I && 0 < I.length && (this.applyTransformation(I[0].orientation, I[0].position, I[0].scale), "flipY" in I[0] && (A = I[0].flipY)), this.createSlides(L.settings.slides), S != null && typeof S == "function" && S(this); } }, this.showEdges = (L) => { if (w) w.material.color = L; else { var S = new p.BoxGeometry(1, 1, 1); S.translate(0.5, 0.5, 0.5); var I = new p.EdgesGeometry(S); w = new p.LineSegments(I, new p.LineBasicMaterial({ color: L })), this.group.add(w); } w.visible = !0; }, this.hideEdges = () => { w && (w.visible = !1); }; }; y.prototype = Object.create(c(29).TexturePrimitive.prototype), y.prototype.constructor = y, a.TextureSlides = y; }, /* 28 */ /***/ (o, a, c) => { var l = c(4), d = l.GLSL3, h = ` precision highp float; precision highp int; precision highp sampler2DArray; uniform sampler2DArray diffuse; uniform bool discardAlpha; in vec3 vUw; out vec4 outColor; void main() { vec4 color = texture( diffuse, vUw ); // lighten a bit if (discardAlpha && color.a == 0.0) discard; outColor = vec4( color.rgba ); } `, f = ` out vec3 vUw; uniform float depth; uniform vec3 slide; uniform int direction; uniform bool flipY; void main() { vec3 slidePos = position.xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 ); if (direction == 1) slidePos = vec3(slide.x, position.y, position.x); if (direction == 2) slidePos = vec3(position.x, slide.y, position.y); if (direction == 3) slidePos = vec3(position.x, position.y, slide.z); if (flipY) slidePos.y = 1.0 - slidePos.y; vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth); } `, g = function() { return { diffuse: { value: void 0 }, depth: { value: 1 }, slide: { value: new l.Vector3(0, 0, 1) }, direction: { value: 1 }, flipY: { value: !0 }, discardAlpha: { value: !0 } }; }; a.fs = h, a.vs = f, a.glslVersion = d, a.getUniforms = g; }, /* 29 */ /***/ (o, a, c) => { c(4); var l = c(5).resolveURL, d = function(h) { c(10).ZincObject.call(this), this.isTexturePrimitive = !0, this.texture = h, this.load = (f, g) => { if (f && f.images && f.images.source) { var p = new (c(25)).TextureArray(), u = []; f.images.source.forEach((v) => { u.push(l(v)); }); var y = this; p.loadFromImages(u).then(() => { y.texture = p, y.initialise(f, g); }); } }, this.initialise = (f, g) => { g != null && typeof g == "function" && g(this); }; }; d.prototype = Object.create(c(10).ZincObject.prototype), d.prototype.constructor = d, a.TexturePrimitive = d; }, /* 30 */ /***/ (o, a, c) => { var l = c(4), d = c(31); a.Renderer = function(h) { var f = h, g = void 0, p = void 0, u = new l.Clock(!1); this.playAnimation = !0; var y = 1e3, v = [], m = 0, x = [], w = 0, A = void 0, M = void 0, R = void 0, L = void 0, S = [], I = [], T = new l.Group(), _ = void 0, E = void 0, C = !1; this.getDrawingWidth = () => f ? f.clientWidth : _ ? typeof _.clientWidth > "u" ? Math.round(_.width) : Math.round(_.clientWidth) : 0, this.getDrawingHeight = () => f ? f.clientHeight : _ ? typeof _.clientHeight > "u" ? Math.round(_.height) : Math.round(_.clientHeight) : 0, this.onWindowResize = () => { p.onWindowResize(); var F = this.getDrawingWidth(), D = this.getDrawingHeight(); if (g != null) { var N; f ? (N = f.getBoundingClientRect(), g.setSize(F, D)) : _ && (typeof _.getBoundingClientRect > "u" || (N = _.getBoundingClientRect(), _.width = F, _.height = D), g.setSize(F, D, !1)), N && (N.left, N.top); var B = new l.Vector2(); g.getSize(B), B.x, B.y; } }, this.initialiseVisualisation = (F) => { if (F = F || {}, F.antialias === void 0) { var D = !1; try { /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && (D = !0); } catch { D = !1; } F.antialias = !D; } F.canvas && (f = void 0, _ = F.canvas), g = new l.WebGLRenderer(F), f !== void 0 && f.appendChild(g.domElement), g.setClearColor(16777215, 1), _ && _.style && (_.style.height = "100%", _.style.width = "100%"), g.autoClear = !1; var N = this.createScene("default"); this.setCurrentScene(N); }, this.getCurrentScene = () => p, this.setCurrentScene = (F) => { if (F) { this.removeActiveScene(F); var D = p; p = F, D && D.setInteractiveControlEnable(!1), p.setInteractiveControlEnable(!0), p.setAdditionalScenesGroup(T), this.onWindowResize(); } }, this.getSceneByName = (F) => S[F], this.createScene = (F) => { if (S[F] == null) { var D; return D = _ ? new (c(32)).Scene(_, g) : new (c(32)).Scene(f, g), S[F] = D, D.sceneName = F, D; } }, this.resetView = () => { p.resetView(); }, this.viewAll = () => { if (p) { var F = p.getBoundingBox(); if (F) { for (var D, N = 0; N < I.length; N++) D = I[N].getBoundingBox(), D && F.union(D); p.viewAllWithBoundingBox(F); } } }, this.loadModelsURL = (F, D, N, B, U, G) => { p.loadModelsURL(F, D, N, B, U, G); }, this.loadViewURL = (F) => { p.loadViewURL(F); }, this.loadFromViewURL = (F, D) => { p.loadFromViewURL(F, D); }, this.updateDirectionalLight = () => { p.updateDirectionalLight(); }; var P = () => { C ? (A = requestAnimationFrame(P), this.render()) : (cancelAnimationFrame(A), A = void 0); }; this.stopAnimate = () => { C && (u.stop(), C = !1); }, this.animate = () => { C || (u.start(), C = !0, P()); }, this.addPreRenderCallbackFunction = (F) => (++m, v[m] = F, m), this.removePreRenderCallbackFunction = (F) => { F in v && delete v[F]; }, this.addPostRenderCallbackFunction = (F) => (++w, x[w] = F, w), this.removePostRenderCallbackFunction = (F) => { F in x && delete x[F]; }, this.getPlayRate = () => y, this.setPlayRate = (F) => { y = F; }, this.getCurrentTime = () => p.getCurrentTime(), this.setMorphsTime = (F) => { p.setMorphsTime(F); }, this.getZincGeometryByID = (F) => p.getZincGeometryByID(F), this.addToScene = (F) => { p.addObject(F); }, this.addToOrthoScene = (F) => { if (R == null && (R = new l.Scene()), M == null) { var D = this.getDrawingWidth(), N = this.getDrawingHeight(); M = new l.OrthographicCamera(-D / 2, D / 2, N / 2, -N / 2, 1, 10), M.position.z = 10; } R.add(F); }; var b = (F) => (D) => { D.needsUpdate = !0; var N = new l.SpriteMaterial({ map: D }), B = N.map.image.width, U = N.map.image.height; F.material = N, F.scale.set(B, U, 1); var G = this.getDrawingWidth(), Y = this.getDrawingHeight(); F.position.set((G - B) / 2, (-Y + U) / 2, 1), this.addToOrthoScene(F); }; this.addLogo = () => { L = new l.Sprite(), l.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png", void 0, b(L)); }, this.render = () => { E || (f ? 0 < f.clientWidth && 0 < f.clientHeight && (E = new d(f, this.onWindowResize)) : _ && 0 < _.width && 0 < _.height && (E = new d(_, this.onWindowResize))); var F = u.getDelta(); p.renderGeometries(y, F, this.playAnimation); for (var D, N = 0; N < I.length; N++) D = I[N], D.renderGeometries(y, F, this.playAnimation); for (var B in M != null && R != null && (g.clearDepth(), g.render(R, M)), v) v.hasOwnProperty(B) && v[B].call(); for (var U in p.render(g), x) x.hasOwnProperty(U) && x[U].call(); }, this.getThreeJSRenderer = () => g, this.isSceneActive = (F) => { if (p === F) return !0; for (var D, N = 0; N < I.length; N++) if (D = I[N], D === F) return !0; return !1; }, this.addActiveScene = (F) => { this.isSceneActive(F) || (I.push(F), T.add(F.getThreeJSScene())); }, this.removeActiveScene = (F) => { for (var D, N = 0; N < I.length; N++) if (D = I[N], D === F) return I.splice(N, 1), void T.remove(F.getThreeJSScene()); }, this.clearAllActiveScene = () => { for (var F = 0; F < I.length; F++) T.remove(I[F].getThreeJSScene()); I.splice(0, I.length); }, this.dispose = () => { for (var F in C && cancelAnimationFrame(A), S) S.hasOwnProperty(F) && S[F].clearAll(); S = [], I = [], T = new l.Group(), this.stopAnimate(), v = [], m = 0, M = void 0, R = void 0, L = void 0; var D = this.createScene("default"); this.setCurrentScene(D), E = void 0; }, this.transitionScene = (F, D) => { if (p) { var N = p.getZincCameraControls(), B = F.getBoundingBox(); if (B) { var U = B.min.distanceTo(B.max) / 2, G = (B.min.x + B.max.x) / 2, Y = (B.min.y + B.max.y) / 2, te = (B.min.z + B.max.z) / 2, ae = N.getViewportFromCentreAndRadius(G, Y, te, U, 40, U * 4), ie = N.getCurrentViewport(); N.cameraTransition(ie, ae, D), N.enableCameraTransition(); } } }, this.isWebGL2 = () => !!g && g.capabilities.isWebGL2; }; }, /* 31 */ /***/ (o) => { o.exports = KB(); }, /* 32 */ /***/ (o, a, c) => { var l = c(4), d = c(33).MarkerCluster, h = c(35).SceneLoader, f = c(42).SceneExporter, g = c(44).Viewport, p = c(5).createBufferGeometry, u = c(5).getCircularTexture, y = c(5).createNewSpriteText, v = 0, m = function() { return "sc" + v++; }, x = function() { return { Duration: "6 secs", OriginalDuration: "-", TimeStamps: {} }; }, w = 6e3; a.Scene = function(A, M) { var R = this, L = A, S = void 0, I = new h(this), T = void 0, _ = {}, E = 0, C = {}, P = 0, b = new l.Scene(), F = new l.Scene(), D = new (c(45)).Region(void 0, this); b.add(D.getGroup()); var N = new l.Group(); b.add(N), this.directionalLight = void 0, this.ambient = void 0, this.camera = void 0; var B = 6e3, U = void 0; this.sceneName = void 0; var G = !1, Y = void 0; this.autoClearFlag = !0, this.displayMarkers = !1, this.displayMinimap = !1, this.displayMiniAxes = !1, this.minimapScissor = { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-right", updateRequired: !0 }; var te = { x: 0, y: 0 }, ae = x(), ie = new l.Vector2(), le = []; this.forcePickableObjectsUpdate = !1, this.uuid = m(); var W = new d(this); W.disable(), b.add(W.group); var $ = { main: [], mini: [] }, j = new l.Vector3(0, 0, 0), re = () => L ? typeof L.clientWidth > "u" ? L.width : L.clientWidth : 0, V = () => L ? typeof L.clientHeight > "u" ? L.height : L.clientHeight : 0; this.getDownloadProgress = () => I.getDownloadProgress(), this.onWindowResize = () => { var O = V(); this.camera.aspect = re() / O, this.camera.updateProjectionMatrix(), this.minimapScissor.updateRequired = !0, U.onResize(), U.calculateHeightPerPixelAtZeroDepth(O); }, this.resetView = () => { this.onWindowResize(), U.resetView(); }, this.changeZoomByScrollRateUnit = (O) => { U.changeZoomByScrollRateUnit(O); }; var H = () => { this.camera = new l.PerspectiveCamera(40, re() / V(), 0, 10), this.ambient = new l.AmbientLight(16777215, 0.2), b.add(this.ambient), this.directionalLight = new l.DirectionalLight(16777215, 0.8), b.add(this.directionalLight), U = new (c(44)).CameraControls(this.camera, M.domElement, M, this), U.setDirectionalLight(this.directionalLight), U.resetView(), T = new (c(50)).Minimap(this); }; H(), this.loadView = (O) => { var Z = new g(); return Z.setFromObject(O), U.setCurrentCameraSettings(Z), !0; }, this.setupMultipleViews = (O, Z) => { for (var [X, ee] of Object.entries(Z)) { var fe = new g(); fe.setFromObject(ee), U.addViewport(X, fe); } U.setDefaultViewport(O); }, this.getBoundingBox = () => D.getBoundingBox(!0), this.viewAllWithBoundingBox = (O) => { if (O) { var Z = U.getViewportFromBoundingBox(O, 1); U.setCurrentCameraSettings(Z), U.calculateHeightPerPixelAtZeroDepth(V()), W.markerUpdateRequired = !0; } }, this.viewAll = () => { var O = this.getBoundingBox(); this.viewAllWithBoundingBox(O), W.markerUpdateRequired = !0; }, this.forEachGeometry = (O) => { D.forEachGeometry(O, !0); }, this.forEachGlyphset = (O) => { D.forEachGlyphset(O, !0); }, this.forEachPointset = (O) => { D.forEachPointset(O, !0); }, this.forEachLine = (O) => { D.forEachLine(O, !0); }, this.findGeometriesWithGroupName = (O) => D.findGeometriesWithGroupName(O, !0), this.findPointsetsWithGroupName = (O) => D.findPointsetsWithGroupName(O, !0), this.findGlyphsetsWithGroupName = (O) => D.findGlyphsetsWithGroupName(O, !0), this.findLinesWithGroupName = (O) => D.findLinesWithGroupName(O, !0), this.findObjectsWithGroupName = (O) => D.findObjectsWithGroupName(O, !0), this.findObjectsWithAnatomicalId = (O) => D.findObjectsWithAnatomicalId(O, !0), this.getBoundingBoxOfZincObjects = (O) => { for (var Z, X = void 0, ee = 0; ee < O.length; ee++) Z = O[ee].getBoundingBox(), Z && (X ? X.union(Z) : X = Z); return X; }, this.vectorToScreenXY = (O) => { O.project(this.camera); var Z = re(), X = V(), ee = Z / 2, fe = X / 2; return O.x = O.x * ee + ee, O.y = -(O.y * fe) + fe, O; }, this.getObjectsScreenXY = (O) => { if (O && 0 < O.length) { var Z = this.getBoundingBoxOfZincObjects(O), X = new l.Vector3(); return Z.getCenter(X), this.vectorToScreenXY(X); } }, this.getNamedObjectsScreenXY = (O) => { var Z = this.findObjectsWithGroupName(O); return this.getObjectsScreenXY(Z); }, this.addZincObject = (O) => { O && (D.addZincObject(O), U && U.calculateMaxAllowedDistance(this)); }, this.loadGlyphsetURL = (O, Z, X, ee) => { I.loadGlyphsetURL(D, O, Z, X, ee); }, this.loadPointsetURL = (O, Z, X, ee, fe) => { I.loadPointsetURL(D, O, Z, X, ee, fe); }, this.loadLinesURL = (O, Z, X, ee, fe) => { I.loadLinesURL(D, O, Z, X, ee, fe); }, this.loadSTL = (O, Z, X) => { I.loadSTL(D, O, Z, X); }, this.loadOBJ = (O, Z, X) => { I.loadOBJ(D, O, Z, X); }, this.loadMetadataURL = (O, Z, X, ee) => { I.loadMetadataURL(D, O, Z, X, ee); }, this.loadModelsURL = (O, Z, X, ee, fe, be) => { I.loadModelsURL(D.urls, Z, X, ee, fe, be); }, this.loadViewURL = (O) => { I.loadViewURL(O); }, this.loadFromViewURL = (O, Z) => { I.loadFromViewURL(O, Z); }, this.loadGLTF = (O, Z, X, ee) => { I.loadGLTF(D, O, Z, X, ee); }, this.updateDirectionalLight = () => { U.updateDirectionalLight(); }, this.addObject = (O) => { b.add(O); }, this.removeObject = (O) => { b.remove(O); }, this.getCurrentTime = () => { if (S != null) return S.getCurrentTime(B); var O = D.getCurrentTime(); return O === -1 ? 0 : O; }, this.setMorphsTime = (O) => { S != null && S.setMorphTime(O, B), D.setMorphTime(O, !0); }, this.isTimeVarying = () => !!(S && S.video && !S.video.error) || D.isTimeVarying(), this.renderGeometries = (O, Z, X) => { var ee = {}; if (ee.camera = U, ee.displayMarkers = this.displayMarkers, ee.markerCluster = W, ee.markersList = W.markers, ee.ndcToBeUpdated = !1, X && (ee.markerCluster.markerUpdateRequired = !0), !S) I.toBeDownloaded == 0 ? (ee.ndcToBeUpdated = U.update(Z), ee.ndcToBeUpdated && U.calculateHeightPerPixelAtZeroDepth(V()), D.renderGeometries(O, Z, X, U, ee, !0)) : U.update(0); else if (S.isReadyToPlay()) { X ? S.video.play() : S.video.pause(); var fe = S.video.currentTime / S.getVideoDuration() * B; I.toBeDownloaded == 0 ? (U.setTime(fe), ee.ndcToBeUpdated = U.update(0), ee.ndcToBeUpdated && U.calculateHeightPerPixelAtZeroDepth(V()), D.setMorphTime(fe, !0), D.renderGeometries(0, 0, X, U, ee, !0)) : U.update(0); } else myPlayRate = 0; }, this.getThreeJSScene = () => b, this.setVideoHandler = (O) => { S || (S = O); }, this.setAdditionalScenesGroup = (O) => { b.add(O); }; var K = (O, Z, X, ee, fe, be, Ae) => { var he = 0, xe = 0; return xe = O.includes("top") ? Ae - fe - X : O.includes("bottom") ? X : Math.floor((Ae - fe) / 2), he = O.includes("left") ? Z : O.includes("right") ? be - Z - ee : Math.floor((be - ee) / 2), { x: he, y: xe }; }, ce = (O) => { (this.displayMinimap || this.displayMiniAxes) && (O.setScissorTest(!0), O.getSize(ie), this.minimapScissor.updateRequired && (te = K(this.minimapScissor.align, this.minimapScissor.x_offset, this.minimapScissor.y_offset, this.minimapScissor.width, this.minimapScissor.height, ie.x, ie.y), this.minimapScissor.updateRequired = !1), O.setScissor(te.x, te.y, this.minimapScissor.width, this.minimapScissor.height), O.setViewport(te.x, te.y, this.minimapScissor.width, this.minimapScissor.height), T.updateCamera(), this.displayMiniAxes ? O.render(F, T.camera) : (b.add(T.mask), O.render(b, T.camera), b.remove(T.mask)), O.setScissorTest(!1), O.setViewport(0, 0, ie.x, ie.y)); }; this.render = (O) => { this.autoClearFlag && O.clear(), G && Y ? Y.render(b, this.camera) : (O.render(b, this.camera), ce(O)); }, this.setInteractiveControlEnable = (O) => { O == !0 ? U.enable() : U.disable(); }, this.getZincCameraControls = () => U, this.getThreeJSScene = () => b, this.setDuration = (O) => { D.setDuration(O), B = O, U.setPathDuration(O), I.duration = O; }, this.getDuration = () => B, this.setStereoEffectEnable = (O) => { O != !0 || Y || (Y = new c(44).StereoEffect(M)), M.setSize(re(), V()), this.camera.updateProjectionMatrix(), G = O; }, this.objectIsInScene = (O) => D.objectIsInRegion(O, !0), this.alignBoundingBoxToCameraView = (O, Z) => { if (O) { O.getCenter(j); var X = this.getZincCameraControls().getCurrentViewport(), ee = new l.Vector3(X.targetPosition[0], X.targetPosition[1], X.targetPosition[2]), fe = new l.Vector3(X.eyePosition[0], X.eyePosition[1], X.eyePosition[2]), be = new l.Vector3(), Ae = new l.Vector3(); be.subVectors(ee, fe).normalize(), Ae.subVectors(ee, j).normalize(); var he = new l.Vector3(); he.crossVectors(be, Ae); var xe = be.angleTo(Ae); 0 < Z ? (this.getZincCameraControls().rotateCameraTransition(he, xe, Z), this.getZincCameraControls().enableCameraTransition()) : this.getZincCameraControls().rotateAboutLookAtpoint(he, xe), W.markerUpdateRequired = !0; } }, this.translateBoundingBoxToCameraView = (O, Z, X) => { if (O) { var ee = this.getZincCameraControls().getCurrentViewport(), fe = this.getZincCameraControls().getViewportFromBoundingBox(O, Z); 0 < X && (this.getZincCameraControls().cameraTransition(ee, fe, X), this.getZincCameraControls().enableCameraTransition()), W.markerUpdateRequired = !0; } }, this.alignObjectToCameraView = (O, Z) => { if (this.objectIsInScene(O)) { var X = O.getBoundingBox(); this.alignBoundingBoxToCameraView(X, Z); } }, this.setCameraTargetToObject = (O) => { if (this.objectIsInScene(O)) { var Z = O.getBoundingBox(), X = this.getZincCameraControls().getCurrentViewport(); Z.getCenter(j); var ee = new l.Vector3(X.targetPosition[0], X.targetPosition[1], X.targetPosition[2]), fe = new l.Vector3(X.eyePosition[0], X.eyePosition[1], X.eyePosition[2]), be = new l.Vector3(), Ae = new l.Vector3(); be.subVectors(fe, ee), Ae.addVectors(j, be), X.eyePosition[0] = Ae.x, X.eyePosition[1] = Ae.y, X.eyePosition[2] = Ae.z, X.targetPosition[0] = j.x, X.targetPosition[1] = j.y, X.targetPosition[2] = j.z, this.getZincCameraControls().setCurrentCameraSettings(X), W.markerUpdateRequired = !0; } }, this.isStereoEffectEnable = () => G, this.removeZincObject = (O) => { D.removeZincObject(O), U && U.calculateMaxAllowedDistance(this), W.markerUpdateRequired = !0; }, this.updatePickableThreeJSObjects = () => { le.length = 0, W.isEnabled && le.push(W.group), D.getPickableThreeJSObjects(le, !0), this.forcePickableObjectsUpdate = !1; }, this.getPickableThreeJSObjects = () => ((this.forcePickableObjectsUpdate || D.checkPickableUpdateRequred(!0)) && this.updatePickableThreeJSObjects(), le), this.getNormalisedMinimapCoordinates = (O, Z) => { if (this.displayMinimap) { var X = new l.Vector2(); O.getSize(X); var ee = X.y - Z.clientY; if (te.x + this.minimapScissor.width > Z.clientX && Z.clientX > te.x && te.y + this.minimapScissor.height > ee && ee > te.y) { var fe = 2 * ((Z.clientX - te.x) / this.minimapScissor.width) - 1, be = 2 * ((ee - te.y) / this.minimapScissor.height) - 1; return { x: fe, y: be }; } } }, this.getMinimapDiffFromNormalised = (O, Z) => T ? T.getDiffFromNormalised(O, Z) : void 0, this.isWebGL2 = () => M.isWebGL2(), this.clearAll = () => { W.clear(), D.clear(!0), this.clearZincObjectAddedCallbacks(), this.clearZincObjectRemovedCallbacks(), I.toBeDwonloaded = 0, U && U.calculateMaxAllowedDistance(this), W.markerUpdateRequired = !0; }, this.addMetadataTimeStamp = (O, Z) => { ae.TimeStamps[O] = k(Z); }, this.getMetadataTag = (O) => ae[O], this.getMetadata = () => ae, this.setMetadataTag = (O, Z) => { ae[O] = Z; }, this.removeMetadataTag = (O) => { delete ae[O]; }, this.resetMetadata = () => { ae = x(); }, this.resetDuration = () => { this.setDuration(w); }; var se = (O) => [...O.years ? ["".concat(O.years, "years")] : [], ...O.months ? ["".concat(O.months, "months")] : [], ...O.weeks ? ["".concat(O.weeks, "weeks")] : [], ...O.days ? ["".concat(O.days, "days")] : [], ...O.hours ? ["".concat(O.hours, "hours")] : [], ...O.mins ? ["".concat(O.mins, "mins")] : [], ...O.secs ? ["".concat(O.secs, "secs")] : []].join(" "), k = (O) => O.years ? 31536e6 * O.years : 0 + O.months ? 2592e6 * O.months : 0 + O.weeks ? 6048e5 * O.weeks : 0 + O.days ? 864e5 * O.days : 0 + O.hours ? 36e5 * O.hours : 0 + O.mins ? 6e4 * O.mins : 0 + O.secs ? 1e3 * O.secs : 0; this.setDurationFromObject = (O) => { var Z = se(O), X = k(O); this.setMetadataTag("Duration", Z), this.setDuration(X); }, this.setOriginalDurationFromObject = (O) => { var Z = se(O); this.setMetadataTag("OriginalDuration", Z); }, this.exportGLTF = (O) => { var Z = new f(this); return Z.exportGLTF(O); }, this.getRootRegion = () => D, this.createLines = (O, Z, X, ee) => { var fe = D.findChildFromPath(O); return fe === void 0 && (fe = D.createChildFromPath(O)), fe.createLines(Z, X, ee); }, this.createPoints = (O, Z, X, ee, fe) => { var be = D.findChildFromPath(O); return be === void 0 && (be = D.createChildFromPath(O)), be.createPoints(Z, X, ee, fe); }, this.addZincObjectAddedCallbacks = (O) => (++E, _[E] = O, E), this.addZincObjectRemovedCallbacks = (O) => (++P, C[P] = O, P), this.removeZincObjectAddedCallbacks = (O) => { O in E && delete _[O]; }, this.removeZincObjectRemovedCallbacks = (O) => { O in P && delete C[O]; }, this.clearZincObjectAddedCallbacks = () => { _ = {}, E = 0; }, this.clearZincObjectRemovedCallbacks = () => { C = {}, P = 0; }, this.triggerObjectAddedCallback = (O) => { for (var Z in _) _.hasOwnProperty(Z) && _[Z](O); }, this.triggerObjectRemovedCallback = (O) => { for (var Z in C) C.hasOwnProperty(Z) && C[Z](O); }, this.addTemporaryPoints = (O, Z) => { var X = p(O.length, O), ee = new l.PointsMaterial({ alphaTest: 0.5, size: 15, color: Z, sizeAttenuation: !1 }), fe = u(); ee.map = fe; var be = new (c(23)).Points(X, ee); return N.add(be), be; }, this.addTemporaryLines = (O, Z) => { var X = p(O.length, O), ee = new l.LineBasicMaterial({ color: Z }), fe = new (c(12)).LineSegments(X, ee); return N.add(fe), fe; }, this.removeTemporaryPrimitive = (O) => { N.remove(O), O.geometry.dispose(), O.material.dispose(); }, this.clearTemporaryPrimitives = () => { var O = 0, Z = N.children; return Z.forEach((X) => { X.geometry.dispose(), X.material.dispose(), O++; }), N.clear(), O; }, this.addBoundingBoxPrimitive = function(O, Z, X, ee, fe) { var be = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0, Ae = D.findChildFromPath(O); Ae === void 0 && (Ae = D.createChildFromPath(O)); var he = be || R.getBoundingBox(); j.set(0, 0, 0); var xe = j.subVectors(he.max, he.min), ne = new l.BoxGeometry(xe.x, xe.y, xe.z), me = Ae.createGeometryFromThreeJSGeometry(Z, ne, X, ee, fe, 1e4); return xe.addVectors(he.min, he.max).multiplyScalar(0.5), me.setPosition(xe.x, xe.y, xe.z), me; }, this.addSlicesPrimitive = function(O, Z, X, ee, fe) { var be = 5 < arguments.length && arguments[5] !== void 0 ? arguments[5] : void 0; if (Z && 3 <= Z.length && X && 3 <= X.length) { var Ae = D.findChildFromPath(O); Ae === void 0 && (Ae = D.createChildFromPath(O)); var he = be || R.getBoundingBox(); j.set(0, 0, 0); var xe = j.subVectors(he.max, he.min), ne = [], me = 0; return ["x", "y", "z"].forEach((Me) => { var De; switch (Me) { case "x": De = new l.PlaneGeometry(xe.z, xe.y), De.rotateY(Math.PI / 2); break; case "y": De = new l.PlaneGeometry(xe.x, xe.z), De.rotateX(Math.PI / 2); break; case "z": De = new l.PlaneGeometry(xe.x, xe.y); break; } var Ie = Ae.createGeometryFromThreeJSGeometry(Z[me], De, X[me], ee, fe, 10001); ne.push(Ie), me++; }), xe.addVectors(he.min, he.max).multiplyScalar(0.5), ne.forEach((Me) => { Me.setPosition(xe.x, xe.y, xe.z); }), ne; } }, this.enableMarkerCluster = (O) => { O ? (W.markerUpdateRequired = !0, W.enable()) : (W.markerUpdateRequired = !1, W.disable()), this.forcePickableObjectsUpdate = !0; }, this.destroyAxisDisplay = () => { this.displayMiniAxes = !1, $.main && (this.enableAxisDisplay(!1, !1), $.main.forEach((O) => { O.dispose && O.dispose(); })), $.mini && (this.enableAxisDisplay(!1, !0), $.mini.forEach((O) => { O.dispose && O.dispose(); })), $ = { main: [], mini: [] }; }, this.createAxisDisplay = function() { var O = 0 < arguments.length && arguments[0] !== void 0 && arguments[0]; R.destroyAxisDisplay(); var Z = [{ name: "x", dir: new l.Vector3(1, 0, 0), colour: "red", hex: 16733525 }, { name: "y", dir: new l.Vector3(0, 1, 0), colour: "green", hex: 5635925 }, { name: "z", dir: new l.Vector3(0, 0, 1), colour: "blue", hex: 5592575 }], X = R.getBoundingBox(), ee = X.min.distanceTo(X.max), fe = new l.Vector3(0, 0, 0); O && fe.copy(X.min), Z.forEach((be) => { var Ae = new l.ArrowHelper(be.dir, fe, ee, be.hex); $.main.push(Ae); var he = new l.ArrowHelper(be.dir, X.getCenter(j), ee / 2, be.hex); $.mini.push(he); var xe = y(be.name, 0.036, be.colour, "Asap", 120, 700), ne = be.dir.clone().multiplyScalar(ee).add(fe); xe.position.set(ne.x, ne.y, ne.z), $.main.push(xe); }); }, this.enableAxisDisplay = function(O) { var Z, X = 1 < arguments.length && arguments[1] !== void 0 && arguments[1]; X && (Z = $) !== null && Z !== void 0 && (Z = Z.mini) !== null && Z !== void 0 && Z.length ? (R.displayMiniAxes = O, $.mini.forEach((ee) => { O ? F.add(ee) : F.remove(ee); })) : !X && $.main && $.main.forEach((ee) => { O ? b.add(ee) : b.remove(ee); }); }; }; }, /* 33 */ /***/ (o, a, c) => { function l(A, M) { var R = Object.keys(A); if (Object.getOwnPropertySymbols) { var L = Object.getOwnPropertySymbols(A); M && (L = L.filter(function(S) { return Object.getOwnPropertyDescriptor(A, S).enumerable; })), R.push.apply(R, L); } return R; } function d(A) { for (var M, R = 1; R < arguments.length; R++) M = arguments[R] == null ? {} : arguments[R], R % 2 ? l(Object(M), !0).forEach(function(L) { h(A, L, M[L]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(A, Object.getOwnPropertyDescriptors(M)) : l(Object(M)).forEach(function(L) { Object.defineProperty(A, L, Object.getOwnPropertyDescriptor(M, L)); }); return A; } function h(A, M, R) { return (M = f(M)) in A ? Object.defineProperty(A, M, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : A[M] = R, A; } function f(A) { var M = g(A, "string"); return typeof M == "symbol" ? M : M + ""; } function g(A, M) { if (typeof A != "object" || !A) return A; var R = A[Symbol.toPrimitive]; if (R !== void 0) { var L = R.call(A, M || "default"); if (typeof L != "object") return L; throw new TypeError("@@toPrimitive must return a primitive value."); } return (M === "string" ? String : Number)(A); } var p = c(4), u = new Image(128, 128); u.src = c(34); var y = new p.Texture(); y.image = u, y.needsUpdate = !0; var v = [0.02, 0.03, 1], m = new p.SpriteMaterial({ map: y, alphaTest: 0.5, transparent: !0, depthTest: !1, depthWrite: !1, sizeAttenuation: !1 }), x = c(5).createNewSpriteText, w = function(A) { c(10).ZincObject.call(this), this.texture = y; var M = void 0; this.morph = new p.Group(), this.group = this.morph, this.isMarkerCluster = !0; var R = !0, L = []; this.markers = {}; var S = new p.Vector2(), I = new p.Vector2(), T = Date.now(); this.setSpriteSize = (b) => { M.scale.set(0.015, 0.02, 1), M.scale.multiplyScalar(b); }, this.clear = () => { this.group.clear(), this.markers = {}; }, this.dispose = () => { this.clear(), this.morph && this.morph.clear(); }; var _ = (b) => { var F = new p.Group(), D = new p.Sprite(m); return D.clusterIndex = b, D.center.set(0.5, 0), D.position.set(0, 0, 0), D.renderOrder = 1e4, D.scale.set(v[0], v[1], v[2]), D.userData = this, F.add(D), this.group.add(F), { group: F, marker: D, label: void 0, number: 0, min: [0, 0, 0], max: [1, 1, 1] }; }, E = (b, F, D) => { b.group.visible = !0, b.group.position.set(F.coords[0], F.coords[1], F.coords[2]), (b.label === void 0 || D !== b.number) && (b.label && (b.group.remove(b.label), b.label.material.map.dispose(), b.label.material.dispose()), b.label = x(D, 0.012, "black", "Asap", 120, 700), b.number = D, b.group.add(b.label)), b.min = F.min, b.max = F.max; }, C = (b) => { var F = 0; for (b.forEach((D) => { var N = D.members.length, B = 0; N === 1 ? D.members[0].setVisibility(!0) : (D.members.forEach((U) => { B += U.getNumber(), U.setVisibility(!1); }), !L[F] && L.push(_(F)), E(L[F], D, B), F++); }), F; F < L.length; F++) L[F].group.visible = !1; }, P = (b, F) => { var D = !0, N = { members: [], coords: [0, 0, 0], min: [0, 0, 0], max: [1, 1, 1] }, B = 0; for (var U in b) D ? (S.set(b[U].ndc.x, b[U].ndc.y), this._b1.setFromPoints([b[U].morph.position]), D = !1, N.members.push(b[U]), N.coords = [b[U].morph.position.x, b[U].morph.position.y, b[U].morph.position.z], F.push(N), delete b[U]) : (I.set(b[U].ndc.x, b[U].ndc.y), B = S.distanceTo(I), 0.1 > B && (N.members.push(b[U]), this._b1.expandByPoint(b[U].morph.position), delete b[U])); N.min = [this._b1.min.x, this._b1.min.y, this._b1.min.z], N.max = [this._b1.max.x, this._b1.max.y, this._b1.max.z], D != !0 && P(b, F); }; this.calculate = () => { if (R) { var b = Date.now(); if (500 < b - T) { var F = []; P(d({}, this.markers), F), C(F), T = Date.now(), this.markerUpdateRequired = !1; } } }, this.isEnabled = () => R, this.enable = () => { R = !0, this.morph.visible = !0; }, this.disable = () => { for (var b in R = !1, this.morph.visible = !1, this.markers) { var F; (F = this.markers[b]) !== null && F !== void 0 && F.isMarker && this.markers[b].isEnabled() && this.markers[b].setVisibility(!0); } }, this.zoomToCluster = (b) => !!(b !== void 0 && -1 < b && (this._v1.set(...L[b].min), this._v2.set(...L[b].max), Math.abs(0 < this._v1.distanceTo(this._v2)))) && (this._b1.set(this._v1, this._v2), A.translateBoundingBoxToCameraView(this._b1, 3, 300), this.markerUpdateRequired = !0, !0), this.clusterIsVisible = (b) => { if (b !== void 0 && -1 < b && L[b]) { var F; return (F = L[b].group) === null || F === void 0 ? void 0 : F.visible; } return !1; }; }; w.prototype = Object.create(c(10).ZincObject.prototype), a.MarkerCluster = w; }, /* 34 */ /***/ (o) => { o.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"; }, /* 35 */ /***/ (o, a, c) => { var l = c(4), d = c(5).resolveURL, h = c(5).createNewURL, f = c(5).isRegionGroup, g = c(36).STLLoader, p = c(37).OBJLoader, u = c(38).PrimitivesLoader; a.SceneLoader = function(y) { var v = y; this.toBeDownloaded = 0, this.progressMap = {}; var m = !1, x = !1, w = new u(); this.getDownloadProgress = () => { var W = 0, $ = 0, j = !1; for (var re in this.progressMap) { var V = this.progressMap[re]; W += V[1], $ += V[0], V[1] == 0 && (j = !0); } return j && (W = 0), [W, $, x]; }, this.onProgress = (W) => ($) => { this.progressMap[W] = [$.loaded, $.total]; }, this.onError = (W) => ($) => { --this.toBeDownloaded, x = !0, console.error("There is an issue with external resource ".concat($ != null && $.responseURL ? ": " + ($ == null ? void 0 : $.responseURL) : "", ".")), W && W({ type: "Error", xhr: $ }); }; var A = (W, $) => { var j = $.Default; if ($.Inline) v.setupMultipleViews(j, $.Entries); else { var re = [], V = function(se) { W && (newURL = h(K, W), re.push(new Promise((k, O) => { fetch(newURL).then((Z) => Z.json()).then((Z) => k({ key: se, data: Z })).catch((Z) => O(Z)); }))); }; for (var [H, K] of Object.entries($.Entries)) V(H); Promise.all(re).then((ce) => { var se = {}; ce.forEach((O) => { se[O.key] = O.data; }), v.setupMultipleViews(j, se); var k = v.getZincCameraControls(); k && k.setCurrentViewport(j), m = !0; }); } }; this.loadViewURL = (W, $) => { this.toBeDownloaded += 1; var j = new XMLHttpRequest(); j.onreadystatechange = () => { if (j.readyState == 4) if (j.status == 200) { var V = JSON.parse(j.responseText); v.setupMultipleViews("default", { default: V }), v.resetView(), m = !0, --this.toBeDownloaded, $ != null && typeof $ == "function" && $(); } else this.onError($)({ responseURL: W }); }; var re = d(W); j.open("GET", re, !0), j.send(); }, this.loadModelsURL = (W, $, j, re, V, H, K) => { var ce = $.length; this.toBeDownloaded += ce; for (var se = 0; se < ce; se++) { var k = $[se], O = c(0).defaultMaterialColor, Z = c(0).defaultOpacity; j != null && j[se] != null && (O = !!j[se]), re != null && re[se] != null && (Z = re[se]); var X = 0; V != null && V[se] != null && (X = !!V[se]); var ee = 0; H != null && H[se] != null && (ee = !!H[se]), w.load(d(k), P(W, O, Z, X, ee, void 0, void 0, void 0, void 0, K), this.onProgress(k), this.onError(K)); } }, this.loadFromViewURL = (W, $, j) => { var re = new XMLHttpRequest(); re.onreadystatechange = () => { if (re.readyState == 4 && re.status == 200) { var H = JSON.parse(re.responseText); v.loadView(H); for (var K, ce = [], se = $ + "_", k = 0; k < H.numberOfResources; k++) K = se + (k + 1) + ".json", ce.push(K); this.loadModelsURL(W, ce, H.colour, H.opacity, H.timeEnabled, H.morphColour, j); } }; var V = d($ + "_view.json"); re.open("GET", V, !0), re.send(); }; var M = (W, $, j, re, V, H, K, ce, se) => (k, O) => { var Z = ce ? new (c(39)).TubeLines() : new (c(24)).Lines(), X = void 0; O && O[0] && (X = new l.LineBasicMaterial({ color: O[0].color.clone() }), 1 > O[0].opacity && (X.transparent = !0), X.opacity = O[0].opacity, X.morphTargets = $, X.vertexColors = O[0].vertexColors); var ee = { localTimeEnabled: $, localMorphColour: j }; if (Z && (Z.createLineSegment(k, X, ee), Z.setName(re), Z.setAnatomicalId(V), Z.setRenderOrder(H), W.addZincObject(Z), Z.setDuration(v.getDuration()), K && K.levels)) for (var [fe, be] of Object.entries(K.levels)) Z.addLOD(w, fe, be.URL, be.Index, K.preload); --this.toBeDownloaded, k.dispose(), se != null && typeof se == "function" && se(Z); }; this.loadLinesURL = (W, $, j, re, V, H, K) => { var ce = 0; this.toBeDownloaded += 1; var se = !!(K != null && K.isInline) && K.isInline, k = K != null && K.anatomicalId ? K.anatomicalId : void 0, O = K != null && K.renderOrder ? K.renderOrder : void 0; j != null && (ce = !!j); var Z = 0; re != null && (Z = !!re); var X = K.tubeLines && !ce && !Z; if (se) { var ee = w.parse($); M(W, ce, Z, V, k, O, K.lod, X, H)(ee.geometry, ee.materials); } else w.load($, M(W, ce, Z, V, k, O, K.lod, X, H), this.onProgress($), this.onError(H), K.loaderOptions); }; var R = (W, $, j, re, V, H) => { var K = H && H.isInline ? H.isInline : void 0, ce = H && H.anatomicalId ? H.anatomicalId : void 0, se = H && H.displayLabels ? H.displayLabels : void 0, k = H && H.renderOrder ? H.renderOrder : void 0, O = new (c(18)).Glyphset(); O.setDuration(v.getDuration()), O.groupName = re; var Z = () => { --this.toBeDownloaded, V != null && typeof V == "function" && V(O); }; ++this.toBeDownloaded, K ? O.load($, j, Z, K, se) : O.load($, d(j), Z, K, se), O.setAnatomicalId(ce), O.setRenderOrder(k), W.addZincObject(O); }, L = (W, $, j, re, V, H) => () => { if ($.readyState == 4 && $.status == 200) { var K = JSON.parse($.responseText); R(W, K, j, re, V, H); } }, S = (W, $, j, re, V, H, K) => (ce, se) => { var k = new (c(22)).Pointset(), O = new l.PointsMaterial({ alphaTest: 0.5, size: 10, sizeAttenuation: !1 }); se && se[0] && (1 > se[0].opacity && (O.transparent = !0), O.opacity = se[0].opacity, O.color = se[0].color, O.morphTargets = $, O.vertexColors = se[0].vertexColors); var Z = {}; Z.localTimeEnabled = $, Z.localMorphColour = j, k && (k.createMesh(ce, O, Z), k.setName(re), k.setAnatomicalId(V), W.addZincObject(k), k.setDuration(v.getDuration()), k.setRenderOrder(H)), ce.dispose(), --this.toBeDownloaded, K != null && typeof K == "function" && K(k); }; this.loadSTL = (W, $, j, re) => { this.toBeDownloaded += 1; var V = c(0).defaultMaterialColor, H = c(0).defaultOpacity, K = new g(); K.crossOrigin = "Anonymous", K.load(d($), P(W, V, H, !1, !1, j, void 0, void 0, void 0, re)); }, this.loadOBJ = (W, $, j, re) => { this.toBeDownloaded += 1; var V = c(0).defaultMaterialColor, H = c(0).defaultOpacity, K = new p(); K.crossOrigin = "Anonymous", K.load(d($), P(W, V, H, !1, !1, j, void 0, void 0, void 0, re)); }; var I = (W, $, j, re, V, H, K) => { this.toBeDownloaded += 1; var ce = c(0).defaultMaterialColor, se = c(0).defaultOpacity, k = 0, O = !!(K && K.isInline) && K.isInline, Z = K && K.fileFormat ? K.fileFormat : void 0, X = K && K.anatomicalId ? K.anatomicalId : void 0, ee = K && K.renderOrder ? K.renderOrder : void 0; j != null && (k = !!j); var fe = 0; re != null && (fe = !!re); var be = w; if (Z !== void 0) { if (Z == "STL") be = new g(); else if (Z == "OBJ") return be = new p(), be.crossOrigin = "Anonymous", void be.load($, objloader(W, ce, se, k, fe, V, X, H), this.onProgress($), this.onError, K.loaderOptions); } if (O) { var Ae = w.parse($); P(W, ce, se, k, fe, V, X, ee, K, H)(Ae.geometry, Ae.materials); } else be.crossOrigin = "Anonymous", w.load($, P(W, ce, se, k, fe, V, X, ee, K, H), this.onProgress($), this.onError(H), K.loaderOptions); }, T = function($, j, re) { var V = 0; return (H) => { if (++V, H && j != null && typeof j == "function" && j(H), V == $ && (m == !1 && v.viewAll(), re != null && typeof re == "function")) { re(); var K = v.getZincCameraControls(); K && K.calculateMaxAllowedDistance(v); } }; }; this.loadPointsetURL = (W, $, j, re, V, H, K) => { var ce = 0; this.toBeDownloaded += 1, j != null && (ce = !!j); var se = 0; re != null && (se = !!re); var k = !!(K && K.isInline) && K.isInline, O = K && K.anatomicalId ? K.anatomicalId : void 0, Z = K && K.renderOrder ? K.renderOrder : void 0; if (k) { var X = w.parse($); S(W, ce, se, V, O, Z, H)(X.geometry, X.materials); } else w.load($, S(W, ce, se, V, O, Z, H), this.onProgress($), this.onError(H), K.loaderOptions); }; var _ = (W, $, j, re, V, H) => { var K = H && H.isInline ? H.isInline : void 0, ce = H && H.anatomicalId ? H.anatomicalId : void 0, se = H && H.renderOrder ? H.renderOrder : void 0, k = void 0; if (j) { if ($ && j.images && j.images.source) for (var O, Z = j.images.source, X = 0; X < Z.length; X++) O = h(Z[X], $), j.images.source[X] = O; if (j.type === "slides" && (k = new (c(27)).TextureSlides()), k) { k.groupName = re; var ee = () => { --this.toBeDownloaded, V != null && typeof V == "function" && V(k); }; ++this.toBeDownloaded, k.load(j, ee, K), k.setAnatomicalId(ce), k.setRenderOrder(se), W.addZincObject(k); } } }, E = (W, $, j, re, V) => () => { if ($.readyState == 4 && $.status == 200) { var H = JSON.parse($.responseText); _(W, $.responseURL, H, j, re, V); } }; this.loadTextureURL = (W, $, j, re, V) => { var H = !!(V && V.isInline) && V.isInline; if (H) _(W, void 0, $, j, re, V); else { var K = new XMLHttpRequest(); K.onreadystatechange = E(W, K, j, re, V), K.open("GET", d($), !0), K.send(); } }, this.loadGlyphsetURL = (W, $, j, re, V, H) => { var K = !!(H && H.isInline) && H.isInline; if (K) R(W, $, j, re, V, H); else { var ce = new XMLHttpRequest(); ce.onreadystatechange = L(W, ce, j, re, V, H), ce.open("GET", d($), !0), ce.send(); } }; var C = (W, $, j, re, V, H, K, ce, se, k, O) => { var Z = { colour: j, opacity: re, localTimeEnabled: V, localMorphColour: H }, X = new (c(3)).Geometry(); return X.createMesh($, ce, Z), X.getMorph() ? (X.setName(se), X.setRenderOrder(k), X.setAnatomicalId(O), W && W.addZincObject(X), X.setDuration(v.getDuration()), X.videoHandler && v.setVideoHandler(X.videoHandler), X) : void 0; }, P = (W, $, j, re, V, H, K, ce, se, k) => (O, Z) => { var X; Z && Z[0] && (X = Z[0]); var ee = C(W, O, $, j, re, V, void 0, X, H, ce, K); if (se.lod && se.lod.levels) for (var [fe, be] of Object.entries(se.lod.levels)) ee.addLOD(w, fe, be.URL, be.Index, se.lod.preload); --this.toBeDownloaded, O.dispose(), k != null && typeof k == "function" && k(ee); }, b = (W) => { var $ = /P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/, [, j, re, V, H, K, ce, se] = W.match($); return { years: j, months: re, weeks: V, days: H, hours: K, mins: ce, secs: se }; }; this.loadSettings = (W) => { if (W) { if (W.Duration) { var $ = b(W.Duration); v.setDurationFromObject($); } if (W.OriginalDuration) { var j = b(W.OriginalDuration); v.setOriginalDurationFromObject(j); } if (W.TimeStamps) for (var re in W.TimeStamps) { var V = b(W.TimeStamps[re]); v.addMetadataTimeStamp(re, V); } } }; var F = (W, $, j, re, V) => { if (j) { var H = void 0, K = !1; j.URL ? (H = j.URL, $ && (H = h(H, $))) : j.Inline && (H = j.Inline.URL, K = !0); var ce = {}; if (j.LOD && j.LOD.Levels) { ce.preload = !!j.LOD.Preload, ce.levels = {}; for (var [se, k] of Object.entries(j.LOD.Levels)) ce.levels[se] = {}, ce.levels[se].URL = h(k.URL, $), ce.levels[se].Index = k.Index; } var O = j.GroupName; (O === void 0 || O === "") && (O = "_Unnamed"); var Z = { loaderOptions: { index: j.Index }, isInline: K, fileFormat: j.FileFormat, anatomicalId: j.AnatomicalId, compression: j.compression, tubeLines: j.tubeLines, lod: ce, renderOrder: re }; switch (j.Type) { case "Surfaces": I(W, H, j.MorphVertices, j.MorphColours, O, V, Z); break; case "Glyph": var X; K ? X = j.Inline.GlyphGeometriesURL : (X = j.GlyphGeometriesURL, X = h(j.GlyphGeometriesURL, $)), j.DisplayLabels && (Z.displayLabels = !0), this.loadGlyphsetURL(W, H, X, O, V, Z); break; case "Points": this.loadPointsetURL(W, H, j.MorphVertices, j.MorphColours, O, V, Z); break; case "Lines": this.loadLinesURL(W, H, j.MorphVertices, j.MorphColours, O, V, Z); break; case "Texture": this.loadTextureURL(W, H, O, V, Z); break; } } }, D = (W, $, j) => { if ($) { var re = void 0, V = !1; switch ($.URL ? (re = $.URL, W && (re = h($.URL, W))) : $.Inline && (re = $.Inline.URL, V = !0), $.Type) { case "View": V ? (v.setupMultipleViews("default", { default: re }), m = !0, j != null && typeof j == "function" && j()) : this.loadViewURL(re, j); break; case "Settings": this.loadSettings($); break; } } }; this.loadGLTF = (W, $, j, re, V) => { var H = new (c(40)).GLTFToZincJSLoader(); H.load(v, W, $, j, re, V); }; var N = (W, $, j, re) => { if (j.Primitives && j.Primitives.forEach((ce) => { var se = 1; ce.Order && (se = ce.Order), F(W, $, ce, se, re); }), j.Transformation && W.setTransformation(j.Transformation), j.Children) for (var [V, H] of Object.entries(j.Children)) { var K = W.findOrCreateChildFromPath(V); K && N(K, $, H, re); } }, B = (W, $) => { var j, re, V = W, H = $ == null || (j = $.enabled) === null || j === void 0 ? void 0 : j.include, K = $ == null || (re = $.enabled) === null || re === void 0 ? void 0 : re.exclude, ce = $ == null ? void 0 : $.tubeLines; return (H != null && H.length || K != null && K.length) && (H && (V = W.filter((se) => { if (se.Type === "View") return !0; for (var k = 0; k < H.length; k++) if (f(se.RegionPath, se.GroupName, H[k])) return !0; return !1; })), K && (V = V.filter((se) => { if (se.Type === "View") return !0; for (var k = 0; k < K.length; k++) if (f(se.RegionPath, se.GroupName, K[k])) return !1; return !0; }))), ce && V.forEach((se) => { se.Type === "Lines" && (se.tubeLines = !0); }), V; }, U = (W, $) => Array.isArray(W) ? B(W, $) : W, G = (W, $) => { if (Array.isArray(W)) { for (var j = 0, re = 0; re < W.length; re++) W[re].Type && ($ && W[re].Type === "View" || W[re].Type === "Surfaces" || W[re].Type === "Glyph" || W[re].Type === "Points" || W[re].Type === "Lines" || W[re].Type === "Texture") && j++; return j; } return 0; }, Y = (W) => { var $ = W.Primitives ? G(W.Primitives, !1) : 0; return W.Children && Object.values(W.Children).forEach((j) => { $ += Y(j); }), $; }, te = (W) => Array.isArray(W) ? G(W, !0) : typeof W == "object" && W !== null && W.Version === "2.0" ? Y(W.Regions) : void 0, ae = (W, $, j, re, V) => { var H = W; j.RegionPath && j.RegionPath !== "" && (H = W.findOrCreateChildFromPath(j.RegionPath)), F(H, $, j, 2 * re, V); }, ie = (W, $, j, re, V, H) => { for (var K = U($, H), ce = te(K), se = new T(ce, re, V), k = 0; k < $.length; k++) D(j, K[k], se); for (var O = 0; O < $.length; O++) ae(W, j, K[O], O, se); }, le = (W, $, j, re, V) => { var H = te($), K = new T(H, re, V); $.Settings && this.loadSettings($.Settings), $.Views && A(j, $.Views), $.Regions && N(W, j, $.Regions, K); }; this.loadMetadataURL = (W, $, j, re, V) => { var H = new XMLHttpRequest(), K = d($); H.onreadystatechange = () => { if (H.readyState == 4 && H.status == 200) { v.resetMetadata(), v.resetDuration(), m = !1; var ce = H.responseURL; ce === void 0 && (ce = new URL(K).href); var se = JSON.parse(H.responseText); Array.isArray(se) ? ie(W, se, ce, j, re, V) : typeof se == "object" && se !== null && se.Version == "2.0" && le(W, se, ce, j, re); } }, H.open("GET", K, !0), H.send(); }; }; }, /* 36 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ STLLoader: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); class d extends l.Loader { constructor(f) { super(f); } load(f, g, p, u) { var y = this, v = new l.FileLoader(this.manager); v.setPath(this.path), v.setResponseType("arraybuffer"), v.setRequestHeader(this.requestHeader), v.setWithCredentials(this.withCredentials), v.load(f, function(m) { try { g(y.parse(m)); } catch (x) { u ? u(x) : console.error(x), y.manager.itemError(f); } }, p, u); } parse(f) { function g(u, y, v) { for (var m = 0, x = u.length; m < x; m++) if (u[m] !== y.getUint8(v + m, !1)) return !1; return !0; } var p = function(u) { if (typeof u == "string") { for (var y = new Uint8Array(u.length), v = 0; v < u.length; v++) y[v] = 255 & u.charCodeAt(v); return y.buffer || y; } return u; }(f); return function(u) { var y = new DataView(u), v = y.getUint32(80, !0); if (84 + v * 50 === y.byteLength) return !0; for (var m = [115, 111, 108, 105, 100], x = 0; 5 > x; x++) if (g(m, y, x)) return !1; return !0; }(p) ? function(u) { for (var y, v, m, x, w, A, M, R, L = new DataView(u), S = L.getUint32(80, !0), I = !1, T = 0; T < 70; T++) L.getUint32(T, !1) == 1129270351 && L.getUint8(T + 4) == 82 && L.getUint8(T + 5) == 61 && (I = !0, x = new Float32Array(3 * (3 * S)), w = L.getUint8(T + 6) / 255, A = L.getUint8(T + 7) / 255, M = L.getUint8(T + 8) / 255, R = L.getUint8(T + 9) / 255); for (var _ = new l.BufferGeometry(), E = new Float32Array(3 * (3 * S)), C = new Float32Array(3 * (3 * S)), P = 0; P < S; P++) { var b = 84 + P * 50, F = L.getFloat32(b, !0), D = L.getFloat32(b + 4, !0), N = L.getFloat32(b + 8, !0); if (I) { var B = L.getUint16(b + 48, !0); 32768 & B ? (y = w, v = A, m = M) : (y = (31 & B) / 31, v = (31 & B >> 5) / 31, m = (31 & B >> 10) / 31); } for (var U = 1; 3 >= U; U++) { var G = b + 12 * U, Y = 3 * (3 * P) + 3 * (U - 1); E[Y] = L.getFloat32(G, !0), E[Y + 1] = L.getFloat32(G + 4, !0), E[Y + 2] = L.getFloat32(G + 8, !0), C[Y] = F, C[Y + 1] = D, C[Y + 2] = N, I && (x[Y] = y, x[Y + 1] = v, x[Y + 2] = m); } } return _.setAttribute("position", new l.BufferAttribute(E, 3)), _.setAttribute("normal", new l.BufferAttribute(C, 3)), I && (_.setAttribute("color", new l.BufferAttribute(x, 3)), _.hasColors = !0, _.alpha = R), _; }(p) : function(u) { for (var y, v = new l.BufferGeometry(), m = /solid([\s\S]*?)endsolid/g, x = /facet([\s\S]*?)endfacet/g, w = 0, A = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source, M = new RegExp("vertex" + A + A + A, "g"), R = new RegExp("normal" + A + A + A, "g"), L = [], S = [], I = new l.Vector3(), T = 0, _ = 0, E = 0; (y = m.exec(u)) !== null; ) { _ = E; for (var C = y[0]; (y = x.exec(C)) !== null; ) { for (var P = 0, b = 0, F = y[0]; (y = R.exec(F)) !== null; ) I.x = parseFloat(y[1]), I.y = parseFloat(y[2]), I.z = parseFloat(y[3]), b++; for (; (y = M.exec(F)) !== null; ) L.push(parseFloat(y[1]), parseFloat(y[2]), parseFloat(y[3])), S.push(I.x, I.y, I.z), P++, E++; b !== 1 && console.error("THREE.STLLoader: Something isn't right with the normal of face number " + w), P !== 3 && console.error("THREE.STLLoader: Something isn't right with the vertices of face number " + w), w++; } var D = _, N = E - _; v.addGroup(D, N, T), T++; } return v.setAttribute("position", new l.Float32BufferAttribute(L, 3)), v.setAttribute("normal", new l.Float32BufferAttribute(S, 3)), v; }(function(u) { return typeof u == "string" ? u : l.LoaderUtils.decodeText(new Uint8Array(u)); }(f)); } } }, /* 37 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ OBJLoader: () => ( /* binding */ w ) /* harmony export */ }); var l = c(4), d = /^[og]\s*(.+)?/, h = /^mtllib /, f = /^usemtl /, g = /^usemap /, p = new l.Vector3(), u = new l.Vector3(), y = new l.Vector3(), v = new l.Vector3(), m = new l.Vector3(); function x() { var A = { objects: [], object: {}, vertices: [], normals: [], colors: [], uvs: [], materials: {}, materialLibraries: [], startObject: function(R, L) { if (this.object && this.object.fromDeclaration === !1) return this.object.name = R, void (this.object.fromDeclaration = L !== !1); var S = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0; if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = { name: R || "", fromDeclaration: L !== !1, geometry: { vertices: [], normals: [], colors: [], uvs: [], hasUVIndices: !1 }, materials: [], smooth: !0, startMaterial: function(_, E) { var C = this._finalize(!1); C && (C.inherited || 0 >= C.groupCount) && this.materials.splice(C.index, 1); var P = { index: this.materials.length, name: _ || "", mtllib: Array.isArray(E) && 0 < E.length ? E[E.length - 1] : "", smooth: C === void 0 ? this.smooth : C.smooth, groupStart: C === void 0 ? 0 : C.groupEnd, groupEnd: -1, groupCount: -1, inherited: !1, clone: function(F) { var D = { index: typeof F == "number" ? F : this.index, name: this.name, mtllib: this.mtllib, smooth: this.smooth, groupStart: 0, groupEnd: -1, groupCount: -1, inherited: !1 }; return D.clone = this.clone.bind(D), D; } }; return this.materials.push(P), P; }, currentMaterial: function() { return 0 < this.materials.length ? this.materials[this.materials.length - 1] : void 0; }, _finalize: function(_) { var E = this.currentMaterial(); if (E && E.groupEnd === -1 && (E.groupEnd = this.geometry.vertices.length / 3, E.groupCount = E.groupEnd - E.groupStart, E.inherited = !1), _ && 1 < this.materials.length) for (var C = this.materials.length - 1; 0 <= C; C--) 0 >= this.materials[C].groupCount && this.materials.splice(C, 1); return _ && this.materials.length === 0 && this.materials.push({ name: "", smooth: this.smooth }), E; } }, S && S.name && typeof S.clone == "function") { var I = S.clone(0); I.inherited = !0, this.object.materials.push(I); } this.objects.push(this.object); }, finalize: function() { this.object && typeof this.object._finalize == "function" && this.object._finalize(!0); }, parseVertexIndex: function(R, L) { var S = parseInt(R, 10); return 3 * (0 <= S ? S - 1 : S + L / 3); }, parseNormalIndex: function(R, L) { var S = parseInt(R, 10); return 3 * (0 <= S ? S - 1 : S + L / 3); }, parseUVIndex: function(R, L) { var S = parseInt(R, 10); return 2 * (0 <= S ? S - 1 : S + L / 2); }, addVertex: function(R, L, S) { var I = this.vertices, T = this.object.geometry.vertices; T.push(I[R + 0], I[R + 1], I[R + 2]), T.push(I[L + 0], I[L + 1], I[L + 2]), T.push(I[S + 0], I[S + 1], I[S + 2]); }, addVertexPoint: function(R) { var L = this.vertices, S = this.object.geometry.vertices; S.push(L[R + 0], L[R + 1], L[R + 2]); }, addVertexLine: function(R) { var L = this.vertices, S = this.object.geometry.vertices; S.push(L[R + 0], L[R + 1], L[R + 2]); }, addNormal: function(R, L, S) { var I = this.normals, T = this.object.geometry.normals; T.push(I[R + 0], I[R + 1], I[R + 2]), T.push(I[L + 0], I[L + 1], I[L + 2]), T.push(I[S + 0], I[S + 1], I[S + 2]); }, addFaceNormal: function(R, L, S) { var I = this.vertices, T = this.object.geometry.normals; p.fromArray(I, R), u.fromArray(I, L), y.fromArray(I, S), m.subVectors(y, u), v.subVectors(p, u), m.cross(v), m.normalize(), T.push(m.x, m.y, m.z), T.push(m.x, m.y, m.z), T.push(m.x, m.y, m.z); }, addColor: function(R, L, S) { var I = this.colors, T = this.object.geometry.colors; I[R] !== void 0 && T.push(I[R + 0], I[R + 1], I[R + 2]), I[L] !== void 0 && T.push(I[L + 0], I[L + 1], I[L + 2]), I[S] !== void 0 && T.push(I[S + 0], I[S + 1], I[S + 2]); }, addUV: function(R, L, S) { var I = this.uvs, T = this.object.geometry.uvs; T.push(I[R + 0], I[R + 1]), T.push(I[L + 0], I[L + 1]), T.push(I[S + 0], I[S + 1]); }, addDefaultUV: function() { var R = this.object.geometry.uvs; R.push(0, 0), R.push(0, 0), R.push(0, 0); }, addUVLine: function(R) { var L = this.uvs, S = this.object.geometry.uvs; S.push(L[R + 0], L[R + 1]); }, addFace: function(R, L, S, I, T, _, E, C, P) { var b = this.vertices.length, F = this.parseVertexIndex(R, b), D = this.parseVertexIndex(L, b), N = this.parseVertexIndex(S, b); if (this.addVertex(F, D, N), this.addColor(F, D, N), E !== void 0 && E !== "") { var B = this.normals.length; F = this.parseNormalIndex(E, B), D = this.parseNormalIndex(C, B), N = this.parseNormalIndex(P, B), this.addNormal(F, D, N); } else this.addFaceNormal(F, D, N); if (I !== void 0 && I !== "") { var U = this.uvs.length; F = this.parseUVIndex(I, U), D = this.parseUVIndex(T, U), N = this.parseUVIndex(_, U), this.addUV(F, D, N), this.object.geometry.hasUVIndices = !0; } else this.addDefaultUV(); }, addPointGeometry: function(R) { this.object.geometry.type = "Points"; for (var L, S = this.vertices.length, I = 0, T = R.length; I < T; I++) L = this.parseVertexIndex(R[I], S), this.addVertexPoint(L), this.addColor(L); }, addLineGeometry: function(R, L) { this.object.geometry.type = "Line"; for (var S = this.vertices.length, I = this.uvs.length, T = 0, _ = R.length; T < _; T++) this.addVertexLine(this.parseVertexIndex(R[T], S)); for (var E = 0, C = L.length; E < C; E++) this.addUVLine(this.parseUVIndex(L[E], I)); } }; return A.startObject("", !1), A; } class w extends l.Loader { constructor(M) { super(M), this.materials = null; } load(M, R, L, S) { var I = this, T = new l.FileLoader(this.manager); T.setPath(this.path), T.setRequestHeader(this.requestHeader), T.setWithCredentials(this.withCredentials), T.load(M, function(_) { try { R(I.parse(_)); } catch (E) { S ? S(E) : console.error(E), I.manager.itemError(M); } }, L, S); } setMaterials(M) { return this.materials = M, this; } parse(M) { var R = new x(); M.indexOf(`\r `) !== -1 && (M = M.replace(/\r\n/g, ` `)), M.indexOf(`\\ `) !== -1 && (M = M.replace(/\\\n/g, "")); for (var L = M.split(` `), S = "", I = "", T = 0, _ = [], E = typeof "".trimLeft == "function", C = 0, P = L.length; C < P; C++) if (S = L[C], S = E ? S.trimLeft() : S.trim(), T = S.length, T !== 0 && (I = S.charAt(0), I !== "#")) if (I === "v") { var b = S.split(/\s+/); switch (b[0]) { case "v": R.vertices.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])), 7 <= b.length ? R.colors.push(parseFloat(b[4]), parseFloat(b[5]), parseFloat(b[6])) : R.colors.push(void 0, void 0, void 0); break; case "vn": R.normals.push(parseFloat(b[1]), parseFloat(b[2]), parseFloat(b[3])); break; case "vt": R.uvs.push(parseFloat(b[1]), parseFloat(b[2])); } } else if (I === "f") { for (var F, D = S.substr(1).trim(), N = D.split(/\s+/), B = [], U = 0, G = N.length; U < G; U++) if (F = N[U], 0 < F.length) { var Y = F.split("/"); B.push(Y); } for (var te = B[0], ae = 1, ie = B.length - 1; ae < ie; ae++) { var le = B[ae], W = B[ae + 1]; R.addFace(te[0], le[0], W[0], te[1], le[1], W[1], te[2], le[2], W[2]); } } else if (I === "l") { var $ = S.substring(1).trim().split(" "), j = [], re = []; if (S.indexOf("/") === -1) j = $; else for (var V, H = 0, K = $.length; H < K; H++) V = $[H].split("/"), V[0] !== "" && j.push(V[0]), V[1] !== "" && re.push(V[1]); R.addLineGeometry(j, re); } else if (I === "p") { var ce = S.substr(1).trim(), se = ce.split(" "); R.addPointGeometry(se); } else if ((_ = d.exec(S)) !== null) { var k = (" " + _[0].substr(1).trim()).substr(1); R.startObject(k); } else if (f.test(S)) R.object.startMaterial(S.substring(7).trim(), R.materialLibraries); else if (h.test(S)) R.materialLibraries.push(S.substring(7).trim()); else if (g.test(S)) console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'); else if (I === "s") { if (_ = S.split(" "), 1 < _.length) { var O = _[1].trim().toLowerCase(); R.object.smooth = O !== "0" && O !== "off"; } else R.object.smooth = !0; var Z = R.object.currentMaterial(); Z && (Z.smooth = R.object.smooth); } else { if (S === "\0") continue; console.warn('THREE.OBJLoader: Unexpected line: "' + S + '"'); } R.finalize(); var X = new l.Group(); X.materialLibraries = [].concat(R.materialLibraries); var ee = R.objects.length !== 1 || R.objects[0].geometry.vertices.length !== 0; if (ee == !0) for (var fe = 0, be = R.objects.length; fe < be; fe++) { var Ae = R.objects[fe], he = Ae.geometry, xe = Ae.materials, ne = he.type === "Line", me = he.type === "Points", Me = !1; if (he.vertices.length !== 0) { var De = new l.BufferGeometry(); De.setAttribute("position", new l.Float32BufferAttribute(he.vertices, 3)), 0 < he.normals.length && De.setAttribute("normal", new l.Float32BufferAttribute(he.normals, 3)), 0 < he.colors.length && (Me = !0, De.setAttribute("color", new l.Float32BufferAttribute(he.colors, 3))), he.hasUVIndices === !0 && De.setAttribute("uv", new l.Float32BufferAttribute(he.uvs, 2)); for (var Ie = [], $e = 0, lt = xe.length; $e < lt; $e++) { var qe = xe[$e], Mt = qe.name + "_" + qe.smooth + "_" + Me, Be = R.materials[Mt]; if (this.materials !== null) { if (Be = this.materials.create(qe.name), ne && Be && !(Be instanceof l.LineBasicMaterial)) { var it = new l.LineBasicMaterial(); l.Material.prototype.copy.call(it, Be), it.color.copy(Be.color), Be = it; } else if (me && Be && !(Be instanceof l.PointsMaterial)) { var tt = new l.PointsMaterial({ size: 10, sizeAttenuation: !1 }); l.Material.prototype.copy.call(tt, Be), tt.color.copy(Be.color), tt.map = Be.map, Be = tt; } } Be === void 0 && (Be = ne ? new l.LineBasicMaterial() : me ? new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }) : new l.MeshPhongMaterial(), Be.name = qe.name, Be.flatShading = !qe.smooth, Be.vertexColors = Me, R.materials[Mt] = Be), Ie.push(Be); } var qt = void 0; if (1 < Ie.length) { for (var Qt, Ft = 0, Nt = xe.length; Ft < Nt; Ft++) Qt = xe[Ft], De.addGroup(Qt.groupStart, Qt.groupCount, Ft); qt = ne ? new l.LineSegments(De, Ie) : me ? new l.Points(De, Ie) : new l.Mesh(De, Ie); } else qt = ne ? new l.LineSegments(De, Ie[0]) : me ? new l.Points(De, Ie[0]) : new l.Mesh(De, Ie[0]); qt.name = Ae.name, X.add(qt); } } else if (0 < R.vertices.length) { var Vi = new l.PointsMaterial({ size: 1, sizeAttenuation: !1 }), ki = new l.BufferGeometry(); ki.setAttribute("position", new l.Float32BufferAttribute(R.vertices, 3)), 0 < R.colors.length && R.colors[0] !== void 0 && (ki.setAttribute("color", new l.Float32BufferAttribute(R.colors, 3)), Vi.vertexColors = !0); var ni = new l.Points(ki, Vi); X.add(ni); } return X; } } }, /* 38 */ /***/ (o, a, c) => { function l(w, A) { var M = Object.keys(w); if (Object.getOwnPropertySymbols) { var R = Object.getOwnPropertySymbols(w); A && (R = R.filter(function(L) { return Object.getOwnPropertyDescriptor(w, L).enumerable; })), M.push.apply(M, R); } return M; } function d(w) { for (var A, M = 1; M < arguments.length; M++) A = arguments[M] == null ? {} : arguments[M], M % 2 ? l(Object(A), !0).forEach(function(R) { h(w, R, A[R]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(w, Object.getOwnPropertyDescriptors(A)) : l(Object(A)).forEach(function(R) { Object.defineProperty(w, R, Object.getOwnPropertyDescriptor(A, R)); }); return w; } function h(w, A, M) { return (A = f(A)) in w ? Object.defineProperty(w, A, { value: M, enumerable: !0, configurable: !0, writable: !0 }) : w[A] = M, w; } function f(w) { var A = g(w, "string"); return typeof A == "symbol" ? A : A + ""; } function g(w, A) { if (typeof w != "object" || !w) return w; var M = w[Symbol.toPrimitive]; if (M !== void 0) { var R = M.call(w, A || "default"); if (typeof R != "object") return R; throw new TypeError("@@toPrimitive must return a primitive value."); } return (A === "string" ? String : Number)(w); } var p = c(19).JSONLoader, u = c(4), y = u.FileLoader, v = (w) => { var A = (R, L) => { R.merge(L); }; if (w && 0 < w.length) { for (; 1 < w.length; ) { var M = w.splice(1, 1); A(w[0], M[0]); } return w[0]; } }, m = function(A, M, R) { var L = new y(), S = new p(); L.crossOrigin = M; var I = A, T = R, _ = void 0, E = !1, C = !1, P = void 0, b = [], F = (U) => { var G = _[U.index]; if (G) { var Y = S.parse(G); U.onLoad(Y.geometry, Y.materials); } else D(U); }, D = (U) => { U.onError && (!P && (P = { responseURL: I }), U.onError(P)); }; this.downloadCompleted = (U) => { try { _ = JSON.parse(U[0]), E = !1, C = !0, Array.isArray(_) ? b.forEach((G) => F(G)) : b.forEach((G) => D(G)); } catch { b.forEach((Y) => D(Y)); } }; var N = () => (U) => { P = U, C = !0, E = !1, b.forEach((G) => { D(G); }); }, B = () => (U) => { b.forEach((G) => { G.onProgress && G.onProgress(U); }); }; this.load = (U, G, Y, te) => { var ae = { index: U, onLoad: G, onProgress: Y, onError: te }; C ? _ ? F(ae) : D(P) : E ? b.push(ae) : (b.push(ae), E = !0, L.load(I, T, B, N)); }; }, x = function(A, M) { var R = [], L = A, S = M, I = 0; this.itemDownloaded = (T, _) => { if (R[T] = _, I++, I == L) { for (var E = R[0][1], C = R.map((F) => F[0]), P = v(C), b = 1; b < L; b++) R[T][0].dispose(), R[T][1].forEach((F) => F.dispose()); S(P, E); } }; }; a.PrimitivesLoader = function() { var w = 0, A = 20; this.crossOrigin = "Anonymous"; var M = new p(), R = [], L = {}, S = (E, C, P, b, F) => { var D = E.length, N = new x(D, C), B = 0; E.forEach((U) => { var G = F ? d({}, F) : {}; G.msHandler = N, G.order = B, B++, T(U, C, P, b, G); }); }, I = (E, C, P, b, F) => { var D = F ? d({}, F) : {}, N = L[E]; if (!N) if (A > w) { var B = new _(void 0, this, D); ++w, N = new m(E, this.crossOrigin, B), L[E] = N; } else R.push({ url: E, onLoad: C, onProgress: P, onError: b, options: F }); N && (D.isHandler = N, N.load(F.index, C, P, b)); }, T = (E, C, P, b, F) => { if (F && F.index !== void 0) I(E, C, P, b, F); else if (A > w) { ++w; var D = new _(C, this, F), N = new _(b, this, F); M.crossOrigin = this.crossOrigin, M.load(E, D, P, N); } else R.push({ url: E, onLoad: C, onProgress: P, onError: b, options: F }); }; this.load = (E, C, P, b, F) => { Array.isArray(E) ? S(E, C, P, b, F) : T(E, C, P, b, F); }, this.loadFromWaitingList = () => { for (; A > w; ) { var E = R.shift(); if (E) this.load(E.url, E.onLoad, E.onProgress, E.onError, E.options); else return; } }, this.itemRemainingCheck = () => { if (R.length === 0 && w == 0) for (var E in L) L.hasOwnProperty(E) && delete L[E]; }; var _ = function(C, P, b) { return function() { --w; for (var F = arguments.length, D = Array(F), N = 0; N < F; N++) D[N] = arguments[N]; b != null && b.msHandler ? b.msHandler.itemDownloaded(b.order, D) : b != null && b.isHandler ? b.isHandler.downloadCompleted(D) : C && C(...D), P.loadFromWaitingList(), P.itemRemainingCheck(); }; }; this.parse = (E) => M.parse(E); }; }, /* 39 */ /***/ (o, a, c) => { var l = c(4), d = c(5).mergeGeometries, h = function() { c(10).ZincObject.call(this), this.isTubeLines = !0; var f = {}, g = { radius: 1, radialSegments: 8, smooth: !1 }; this.createLineSegment = (u, y, v) => { if (u && y) { f = { geometryIn: u, materialIn: y, options: v }; var m = p(u.vertices), x = new l.MeshStandardMaterial({ color: y.color }), w = new l.Mesh(m, x); this.setMesh(w, v.localTimeEnabled, v.localMorphColour); } }, this.setWidth = (u) => { this.morph && this.morph.material && (this.morph.material.linewidth = u, this.morph.material.needsUpdate = !0); }, this.setAlpha = function(u) { var y = this.getMorph(); y.material.opacity = u, y.material.transparent = 1 > u, y.material.depthWrite = 0.5 < u; }, this.setWireframe = (u) => { var y = this.getMorph(); y.material.wireframe = u; }, this.setTubeLines = (u, y) => { if (u && y) { var { geometryIn: v } = f, m = this.getMorph(); m.geometry.dispose(), g = Object.assign(g, { radius: u, radialSegments: y }), m.geometry = p(v.vertices); } }; var p = (u) => { var y, { radius: v, radialSegments: m, smooth: x } = g; if (x) { var w = new l.CatmullRomCurve3(u); y = new l.TubeGeometry(w, u.length, v, m, !1); } else { for (var A = [], M = 0; M + 1 < u.length; M += 2) { var R = new l.LineCurve3(u[M], u[M + 1]), L = new l.TubeGeometry(R, 1, v, m, !1); A.push(L); } y = d(A, !0), A.forEach((S) => S.dispose()); } return y; }; }; h.prototype = Object.create(c(10).ZincObject.prototype), a.TubeLines = h; }, /* 40 */ /***/ (o, a, c) => { c(4); var l = c(41).GLTFLoader, d = function() { var h = this; this.parseGLTFObjects = (f, g, p, u) => { var y = g; if (p !== 0) { if (f.type !== "Object3D") { var v; if (f.type === "Mesh" ? v = new (c(3)).Geometry() : f.type === "LineSegments" ? v = new (c(24)).Lines() : f.type === "Points" && (v = new (c(22)).Pointset()), v) { var m = !1, x = !1; f.geometry && f.geometry.morphAttributes && (m = !!f.geometry.morphAttributes.position, x = !!f.geometry.morphAttributes.color), v.setMesh(f.clone(), m, x); var w = v.getMorph(); v.groupName = w.name, w.matrixAutoUpdate = !0, g.addZincObject(v), u != null && typeof u == "function" && u(v); } } else if (f.name !== "" && (g && (y = g.findOrCreateChildFromPath(f.name)), y)) { var A = y.getGroup(); A.position.copy(f.position), A.rotation.copy(f.rotation), A.quaternion.copy(f.quaternion), A.matrixAutoUpdate = !0; } } p++, f.children.forEach((M) => { h.parseGLTFObjects(M, y, p, u); }); }, this.setCamera = (f) => { f.viewAll(); var g = f.getZincCameraControls(), p = g.getCurrentViewport(); g.addViewport("default", p), g.setDefaultViewport("default"); }, this.load = (f, g, p, u, y) => { var v = p.substring(0, p.lastIndexOf("/") + 1), m = p.substring(p.lastIndexOf("/") + 1, p.length), x = new l().setPath(v); x.load(m, function(w) { console.log(w), h.parseGLTFObjects(w.scene, g, 0, u), h.setCamera(f), y != null && typeof y == "function" && y(); }); }; }; a.GLTFToZincJSLoader = d; }, /* 41 */ /***/ (o) => { o.exports = x4; }, /* 42 */ /***/ (o, a, c) => { var l = c(43).GLTFExporter, d = function(h) { var f = h; this.exportGLTF = (g) => { var p = f.getRootRegion(), u = p.getAllObjects(!0), y = []; u.forEach((x) => { x.animationClip && y.push({ clip: x.animationClip[0], mesh: x.getMorph() }); }); var v = new l(), m = { binary: g, animations: y }; return new Promise((x) => { v.parse(f.getThreeJSScene(), function(w) { x(w); }, m); }); }; }; a.SceneExporter = d; }, /* 43 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ GLTFExporter: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); class d { constructor() { this.pluginCallbacks = [], this.register(function(b) { return new _(b); }), this.register(function(b) { return new E(b); }), this.register(function(b) { return new C(b); }); } register(b) { return this.pluginCallbacks.indexOf(b) === -1 && this.pluginCallbacks.push(b), this; } unregister(b) { return this.pluginCallbacks.indexOf(b) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(b), 1), this; } /** * Parse scenes and generate GLTF output * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes * @param {Function} onDone Callback on completed * @param {Object} options options */ parse(b, F, D) { for (var N = new T(), B = [], U = 0, G = this.pluginCallbacks.length; U < G; U++) B.push(this.pluginCallbacks[U](N)); N.setPlugins(B), N.write(b, F, D); } } var h = { POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123, FLOAT: 5126, UNSIGNED_INT: 5125, ARRAY_BUFFER: 34962, ELEMENT_ARRAY_BUFFER: 34963, NEAREST: 9728, LINEAR: 9729, NEAREST_MIPMAP_NEAREST: 9984, LINEAR_MIPMAP_NEAREST: 9985, NEAREST_MIPMAP_LINEAR: 9986, LINEAR_MIPMAP_LINEAR: 9987, CLAMP_TO_EDGE: 33071, MIRRORED_REPEAT: 33648, REPEAT: 10497 }, f = {}; f[l.NearestFilter] = h.NEAREST, f[l.NearestMipmapNearestFilter] = h.NEAREST_MIPMAP_NEAREST, f[l.NearestMipmapLinearFilter] = h.NEAREST_MIPMAP_LINEAR, f[l.LinearFilter] = h.LINEAR, f[l.LinearMipmapNearestFilter] = h.LINEAR_MIPMAP_NEAREST, f[l.LinearMipmapLinearFilter] = h.LINEAR_MIPMAP_LINEAR, f[l.ClampToEdgeWrapping] = h.CLAMP_TO_EDGE, f[l.RepeatWrapping] = h.REPEAT, f[l.MirroredRepeatWrapping] = h.MIRRORED_REPEAT; var g = { scale: "scale", position: "translation", quaternion: "rotation", morphTargetInfluences: "weights" }, p = 12, u = 1179937895, y = 2, v = 8, m = 1313821514, x = 5130562; function w(P, b) { return P.length === b.length && P.every(function(F, D) { return F === b[D]; }); } function A(P) { if (window.TextEncoder !== void 0) return new TextEncoder().encode(P).buffer; for (var b, F = new Uint8Array(new ArrayBuffer(P.length)), D = 0, N = P.length; D < N; D++) b = P.charCodeAt(D), F[D] = 255 < b ? 32 : b; return F.buffer; } function M(P) { return w(P.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); } function R(P, b, F) { for (var D = { min: Array(P.itemSize).fill(Number.POSITIVE_INFINITY), max: Array(P.itemSize).fill(Number.NEGATIVE_INFINITY) }, N = b; N < b + F; N++) for (var B, U = 0; U < P.itemSize; U++) B = void 0, 4 < P.itemSize ? B = P.array[N * P.itemSize + U] : U === 0 ? B = P.getX(N) : U === 1 ? B = P.getY(N) : U === 2 ? B = P.getZ(N) : U == 3 && (B = P.getW(N)), D.min[U] = Math.min(D.min[U], B), D.max[U] = Math.max(D.max[U], B); return D; } function L(P) { return 4 * Math.ceil(P / 4); } function S(P) { var b = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : 0, F = L(P.byteLength); if (F !== P.byteLength) { var D = new Uint8Array(F); if (D.set(new Uint8Array(P)), b !== 0) for (var N = P.byteLength; N < F; N++) D[N] = b; return D.buffer; } return P; } var I = null; class T { 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, F, D) { this.options = Object.assign({}, { // default options binary: !1, trs: !1, onlyVisible: !0, truncateDrawRange: !0, embedImages: !0, maxTextureSize: 1 / 0, animations: [], includeCustomExtensions: !1 }, D), 0 < this.options.animations.length && (this.options.trs = !0), this.processInput(b); var N = this; Promise.all(this.pending).then(function() { var B = N.buffers, U = N.json, G = N.options, Y = N.extensionsUsed, te = new Blob(B, { type: "application/octet-stream" }), ae = Object.keys(Y); if (0 < ae.length && (U.extensionsUsed = ae), U.buffers && 0 < U.buffers.length && (U.buffers[0].byteLength = te.size), G.binary === !0) { var ie = new window.FileReader(); ie.readAsArrayBuffer(te), ie.onloadend = function() { var W = S(ie.result), $ = new DataView(new ArrayBuffer(v)); $.setUint32(0, W.byteLength, !0), $.setUint32(4, x, !0); var j = S(A(JSON.stringify(U)), 32), re = new DataView(new ArrayBuffer(v)); re.setUint32(0, j.byteLength, !0), re.setUint32(4, m, !0); var V = new ArrayBuffer(p), H = new DataView(V); H.setUint32(0, u, !0), H.setUint32(4, y, !0); var K = p + re.byteLength + j.byteLength + $.byteLength + W.byteLength; H.setUint32(8, K, !0); var ce = new Blob([V, re, j, $, W], { type: "application/octet-stream" }), se = new window.FileReader(); se.readAsArrayBuffer(ce), se.onloadend = function() { F(se.result); }; }; } else if (U.buffers && 0 < U.buffers.length) { var le = new window.FileReader(); le.readAsDataURL(te), le.onloadend = function() { var W = le.result; U.buffers[0].uri = W, F(U); }; } else F(U); }); } /** * Serializes a userData. * * @param {THREE.Object3D|THREE.Material} object * @param {Object} objectDef */ serializeUserData(b, F) { if (!(b.userData && b.userData.isZincObject) && Object.keys(b.userData).length !== 0) { var D = this.options, N = this.extensionsUsed; try { var B = JSON.parse(JSON.stringify(b.userData)); if (D.includeCustomExtensions && B.gltfExtensions) { for (var U in F.extensions === void 0 && (F.extensions = {}), B.gltfExtensions) F.extensions[U] = B.gltfExtensions[U], N[U] = !0; delete B.gltfExtensions; } 0 < Object.keys(B).length && (F.extras = B); } catch (G) { console.warn("THREE.GLTFExporter: userData of '" + b.name + "' won't be serialized because of JSON.stringify error - " + G.message); } } } /** * Assign and return a temporal unique id for an object * especially which doesn't have .uuid * @param {Object} object * @return {Integer} */ getUID(b) { return this.uids.has(b) || this.uids.set(b, this.uid++), this.uids.get(b); } /** * Checks if normal attribute values are normalized. * * @param {BufferAttribute} normal * @returns {Boolean} */ isNormalizedNormalAttribute(b) { var F = this.cache; if (F.attributesNormalized.has(b)) return !1; for (var D = new l.Vector3(), N = 0, B = b.count; N < B; N++) if (5e-4 < Math.abs(D.fromBufferAttribute(b, N).length() - 1)) return !1; return !0; } /** * Creates normalized normal buffer attribute. * * @param {BufferAttribute} normal * @returns {BufferAttribute} * */ createNormalizedNormalAttribute(b) { var F = this.cache; if (F.attributesNormalized.has(b)) return F.attributesNormalized.get(b); for (var D = b.clone(), N = new l.Vector3(), B = 0, U = D.count; B < U; B++) N.fromBufferAttribute(D, B), N.x === 0 && N.y === 0 && N.z === 0 ? N.setX(1) : N.normalize(), D.setXYZ(B, N.x, N.y, N.z); return F.attributesNormalized.set(b, D), D; } /** * Applies a texture transform, if present, to the map definition. Requires * the KHR_texture_transform extension. * * @param {Object} mapDef * @param {THREE.Texture} texture */ applyTextureTransform(b, F) { var D = !1, N = {}; (F.offset.x !== 0 || F.offset.y !== 0) && (N.offset = F.offset.toArray(), D = !0), F.rotation !== 0 && (N.rotation = F.rotation, D = !0), (F.repeat.x !== 1 || F.repeat.y !== 1) && (N.scale = F.repeat.toArray(), D = !0), D && (b.extensions = b.extensions || {}, b.extensions.KHR_texture_transform = N, this.extensionsUsed.KHR_texture_transform = !0); } /** * Process a buffer to append to the default one. * @param {ArrayBuffer} buffer * @return {Integer} */ processBuffer(b) { var F = this.json, D = this.buffers; return F.buffers || (F.buffers = [{ byteLength: 0 }]), D.push(b), 0; } /** * Process and generate a BufferView * @param {BufferAttribute} attribute * @param {number} componentType * @param {number} start * @param {number} count * @param {number} target (Optional) Target usage of the BufferView * @return {Object} */ processBufferView(b, F, D, N, B) { var U = this.json; U.bufferViews || (U.bufferViews = []); for (var G = F === h.UNSIGNED_BYTE ? 1 : F === h.UNSIGNED_SHORT ? 2 : 4, Y = L(N * b.itemSize * G), te = new DataView(new ArrayBuffer(Y)), ae = 0, ie = D; ie < D + N; ie++) for (var le, W = 0; W < b.itemSize; W++) le = void 0, 4 < b.itemSize ? le = b.array[ie * b.itemSize + W] : W === 0 ? le = b.getX(ie) : W === 1 ? le = b.getY(ie) : W === 2 ? le = b.getZ(ie) : W == 3 && (le = b.getW(ie)), F === h.FLOAT ? te.setFloat32(ae, le, !0) : F === h.UNSIGNED_INT ? te.setUint32(ae, le, !0) : F === h.UNSIGNED_SHORT ? te.setUint16(ae, le, !0) : F === h.UNSIGNED_BYTE && te.setUint8(ae, le), ae += G; var $ = { buffer: this.processBuffer(te.buffer), byteOffset: this.byteOffset, byteLength: Y }; B !== void 0 && ($.target = B), B === h.ARRAY_BUFFER && ($.byteStride = b.itemSize * G), this.byteOffset += Y, U.bufferViews.push($); var j = { id: U.bufferViews.length - 1, byteLength: 0 }; return j; } /** * Process and generate a BufferView from an image Blob. * @param {Blob} blob * @return {Promise} */ processBufferViewImage(b) { var F = this, D = F.json; return D.bufferViews || (D.bufferViews = []), new Promise(function(N) { var B = new window.FileReader(); B.readAsArrayBuffer(b), B.onloadend = function() { var U = S(B.result), G = { buffer: F.processBuffer(U), byteOffset: F.byteOffset, byteLength: U.byteLength }; F.byteOffset += U.byteLength, N(D.bufferViews.push(G) - 1); }; }); } /** * Process attribute to generate an accessor * @param {BufferAttribute} attribute Attribute to process * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range * @param {Integer} start (Optional) * @param {Integer} count (Optional) * @return {Integer|null} Index of the processed accessor on the "accessors" array */ processAccessor(b, F, D, N) { var B, U = this.options, G = this.json; if (b.array.constructor === Float32Array) B = h.FLOAT; else if (b.array.constructor === Uint32Array) B = h.UNSIGNED_INT; else if (b.array.constructor === Uint16Array) B = h.UNSIGNED_SHORT; else if (b.array.constructor === Uint8Array) B = h.UNSIGNED_BYTE; else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type."); if (D === void 0 && (D = 0), N === void 0 && (N = b.count), U.truncateDrawRange && F !== void 0 && F.index === null) { var Y = D + N, te = F.drawRange.count === 1 / 0 ? b.count : F.drawRange.start + F.drawRange.count; D = Math.max(D, F.drawRange.start), N = Math.min(Y, te) - D, 0 > N && (N = 0); } if (N === 0) return null; var ae, ie = R(b, D, N); F !== void 0 && (ae = b === F.index ? h.ELEMENT_ARRAY_BUFFER : h.ARRAY_BUFFER); var le = this.processBufferView(b, B, D, N, ae), W = { bufferView: le.id, byteOffset: le.byteOffset, componentType: B, count: N, max: ie.max, min: ie.min, type: { 1: "SCALAR", 2: "VEC2", 3: "VEC3", 4: "VEC4", 16: "MAT4" }[b.itemSize] }; return b.normalized === !0 && (W.normalized = !0), G.accessors || (G.accessors = []), G.accessors.push(W) - 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, F, D) { var N = this, B = N.cache, U = N.json, G = N.options, Y = N.pending; B.images.has(b) || B.images.set(b, {}); var te = B.images.get(b), ae = F === l.RGBAFormat ? "image/png" : "image/jpeg", ie = ae + ":flipY/" + D.toString(); if (te[ie] !== void 0) return te[ie]; U.images || (U.images = []); var le = { mimeType: ae }; if (G.embedImages) { var W = I = I || document.createElement("canvas"); W.width = Math.min(b.width, G.maxTextureSize), W.height = Math.min(b.height, G.maxTextureSize); var $ = W.getContext("2d"); if (D === !0 && ($.translate(0, W.height), $.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) $.drawImage(b, 0, 0, W.width, W.height); else { F !== l.RGBAFormat && F !== l.RGBFormat && console.error("GLTFExporter: Only RGB and RGBA formats are supported."), (b.width > G.maxTextureSize || b.height > G.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", b); var j = new Uint8ClampedArray(4 * (b.height * b.width)); if (F === l.RGBAFormat) for (var re = 0; re < j.length; re += 4) j[re + 0] = b.data[re + 0], j[re + 1] = b.data[re + 1], j[re + 2] = b.data[re + 2], j[re + 3] = b.data[re + 3]; else for (var V = 0, H = 0; V < j.length; V += 4, H += 3) j[V + 0] = b.data[H + 0], j[V + 1] = b.data[H + 1], j[V + 2] = b.data[H + 2], j[V + 3] = 255; $.putImageData(new ImageData(j, b.width, b.height), 0, 0); } G.binary === !0 ? Y.push(new Promise(function(ce) { W.toBlob(function(se) { N.processBufferViewImage(se).then(function(k) { le.bufferView = k, ce(); }); }, ae); })) : le.uri = W.toDataURL(ae); } else le.uri = b.src; var K = U.images.push(le) - 1; return te[ie] = K, K; } /** * Process sampler * @param {Texture} map Texture to process * @return {Integer} Index of the processed texture in the "samplers" array */ processSampler(b) { var F = this.json; F.samplers || (F.samplers = []); var D = { magFilter: f[b.magFilter], minFilter: f[b.minFilter], wrapS: f[b.wrapS], wrapT: f[b.wrapT] }; return F.samplers.push(D) - 1; } /** * Process texture * @param {Texture} map Map to process * @return {Integer} Index of the processed texture in the "textures" array */ processTexture(b) { var F = this.cache, D = this.json; if (F.textures.has(b)) return F.textures.get(b); D.textures || (D.textures = []); var N = { sampler: this.processSampler(b), source: this.processImage(b.image, b.format, b.flipY) }; b.name && (N.name = b.name), this._invokeAll(function(U) { U.writeTexture && U.writeTexture(b, N); }); var B = D.textures.push(N) - 1; return F.textures.set(b, B), B; } /** * Process material * @param {THREE.Material} material Material to process * @return {Integer|null} Index of the processed material in the "materials" array */ processMaterial(b) { var F = this.cache, D = this.json; if (F.materials.has(b)) return F.materials.get(b); if (b.isShaderMaterial) return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."), null; D.materials || (D.materials = []); var N = { pbrMetallicRoughness: {} }; b.isMeshStandardMaterial !== !0 && b.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."); var B = b.color.toArray().concat([b.opacity]); if (w(B, [1, 1, 1, 1]) || (N.pbrMetallicRoughness.baseColorFactor = B), b.isMeshStandardMaterial ? (N.pbrMetallicRoughness.metallicFactor = b.metalness, N.pbrMetallicRoughness.roughnessFactor = b.roughness) : (N.pbrMetallicRoughness.metallicFactor = 0.5, N.pbrMetallicRoughness.roughnessFactor = 0.5), b.metalnessMap || b.roughnessMap) if (b.metalnessMap === b.roughnessMap) { var U = { index: this.processTexture(b.metalnessMap) }; this.applyTextureTransform(U, b.metalnessMap), N.pbrMetallicRoughness.metallicRoughnessTexture = U; } else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture."); if (b.map) { var G = { index: this.processTexture(b.map) }; this.applyTextureTransform(G, b.map), N.pbrMetallicRoughness.baseColorTexture = G; } if (b.emissive) { var Y = b.emissive.clone().multiplyScalar(b.emissiveIntensity), te = Math.max(Y.r, Y.g, Y.b); if (1 < te && (Y.multiplyScalar(1 / te), console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")), 0 < te && (N.emissiveFactor = Y.toArray()), b.emissiveMap) { var ae = { index: this.processTexture(b.emissiveMap) }; this.applyTextureTransform(ae, b.emissiveMap), N.emissiveTexture = ae; } } if (b.normalMap) { var ie = { 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."), ie.scale = b.normalScale.x), this.applyTextureTransform(ie, b.normalMap), N.normalTexture = ie; } if (b.aoMap) { var le = { index: this.processTexture(b.aoMap), texCoord: 1 }; b.aoMapIntensity !== 1 && (le.strength = b.aoMapIntensity), this.applyTextureTransform(le, b.aoMap), N.occlusionTexture = le; } b.transparent ? N.alphaMode = "BLEND" : 0 < b.alphaTest && (N.alphaMode = "MASK", N.alphaCutoff = b.alphaTest), b.side === l.DoubleSide && (N.doubleSided = !0), b.name !== "" && (N.name = b.name), this.serializeUserData(b, N), this._invokeAll(function($) { $.writeMaterial && $.writeMaterial(b, N); }); var W = D.materials.push(N) - 1; return F.materials.set(b, W), W; } /** * Process mesh * @param {THREE.Mesh} mesh Mesh to process * @return {Integer|null} Index of the processed mesh in the "meshes" array */ processMesh(b) { var F = this.cache, D = this.json, N = [b.geometry.uuid]; if (Array.isArray(b.material)) for (var B = 0, U = b.material.length; B < U; B++) N.push(b.material[B].uuid); else N.push(b.material.uuid); var G = N.join(":"); if (F.meshes.has(G)) return F.meshes.get(G); var Y, te = b.geometry; if (Y = b.isLineSegments ? h.LINES : b.isLineLoop ? h.LINE_LOOP : b.isLine ? h.LINE_STRIP : b.isPoints ? h.POINTS : b.material.wireframe ? h.LINES : h.TRIANGLES, te.isBufferGeometry !== !0) throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry."); var ae = {}, ie = {}, le = [], W = [], $ = { uv: "TEXCOORD_0", uv2: "TEXCOORD_1", color: "COLOR_0", skinWeight: "WEIGHTS_0", skinIndex: "JOINTS_0" }, j = te.getAttribute("normal"); j === void 0 || this.isNormalizedNormalAttribute(j) || (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), te.setAttribute("normal", this.createNormalizedNormalAttribute(j))); var re = null; for (var V in te.attributes) if (V.substr(0, 5) !== "morph") { var H = te.attributes[V]; V = $[V] || V.toUpperCase(); var K = /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/; if (K.test(V) || (V = "_" + V), F.attributes.has(this.getUID(H))) { ie[V] = F.attributes.get(this.getUID(H)); continue; } re = null; var ce = H.array; V !== "JOINTS_0" || ce instanceof Uint16Array || ce instanceof Uint8Array || (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), re = new l.BufferAttribute(new Uint16Array(ce), H.itemSize, H.normalized)); var se = this.processAccessor(re || H, te); se !== null && (ie[V] = se, F.attributes.set(this.getUID(H), se)); } if (j !== void 0 && te.setAttribute("normal", j), Object.keys(ie).length === 0) return null; if (b.morphTargetInfluences !== void 0 && 0 < b.morphTargetInfluences.length) { var k = [], O = [], Z = {}; if (b.morphTargetDictionary !== void 0) for (var X in b.morphTargetDictionary) Z[b.morphTargetDictionary[X]] = X; for (var ee = 0; ee < b.morphTargetInfluences.length; ++ee) { var fe = {}, be = !1; for (var Ae in te.morphAttributes) { if (Ae != "position" && Ae !== "normal" && Ae !== "color") { be || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), be = !0); continue; } var he = te.morphAttributes[Ae][ee], xe = Ae.toUpperCase(); $[Ae] && (xe = $[Ae]); var ne = te.attributes[Ae]; if (F.attributes.has(this.getUID(he))) { fe[xe] = F.attributes.get(this.getUID(he)); continue; } var me = ne.clone(); if (!te.morphTargetsRelative) if (ne) for (var Me = 0, De = he.count; Me < De; Me++) ne.count > Me && me.setXYZ(Me, he.getX(Me) - ne.getX(Me), he.getY(Me) - ne.getY(Me), he.getZ(Me) - ne.getZ(Me)); else for (var Ie = 0, $e = he.count; Ie < $e; Ie++) me.setXYZ(Ie, 0, 0, 0); fe[xe] = this.processAccessor(me, te), F.attributes.set(this.getUID(ne), fe[xe]); } W.push(fe), k.push(b.morphTargetInfluences[ee]), b.morphTargetDictionary !== void 0 && O.push(Z[ee]); } ae.weights = k, 0 < O.length && (ae.extras = {}, ae.extras.targetNames = O); } var lt = Array.isArray(b.material); if (lt && te.groups.length === 0) return null; for (var qe, Mt = lt ? b.material : [b.material], Be = lt ? te.groups : [{ materialIndex: 0, start: void 0, count: void 0 }], it = 0, tt = Be.length; it < tt; it++) { if (qe = { mode: Y, attributes: ie }, this.serializeUserData(te, qe), 0 < W.length && (qe.targets = W), te.index !== null) { var qt = this.getUID(te.index); (Be[it].start !== void 0 || Be[it].count !== void 0) && (qt += ":" + Be[it].start + ":" + Be[it].count), F.attributes.has(qt) ? qe.indices = F.attributes.get(qt) : (qe.indices = this.processAccessor(te.index, te, Be[it].start, Be[it].count), F.attributes.set(qt, qe.indices)), qe.indices === null && delete qe.indices; } var Qt = this.processMaterial(Mt[Be[it].materialIndex]); Qt !== null && (qe.material = Qt), le.push(qe); } ae.primitives = le, D.meshes || (D.meshes = []), this._invokeAll(function(Nt) { Nt.writeMesh && Nt.writeMesh(b, ae); }); var Ft = D.meshes.push(ae) - 1; return F.meshes.set(G, Ft), Ft; } /** * Process camera * @param {THREE.Camera} camera Camera to process * @return {Integer} Index of the processed mesh in the "camera" array */ processCamera(b) { var F = this.json; F.cameras || (F.cameras = []); var D = b.isOrthographicCamera, N = { type: D ? "orthographic" : "perspective" }; return D ? N.orthographic = { xmag: 2 * b.right, ymag: 2 * b.top, zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near } : N.perspective = { aspectRatio: b.aspect, yfov: l.MathUtils.degToRad(b.fov), zfar: 0 >= b.far ? 1e-3 : b.far, znear: 0 > b.near ? 0 : b.near }, b.name !== "" && (N.name = b.type), F.cameras.push(N) - 1; } /** * Creates glTF animation entry from AnimationClip object. * * Status: * - Only properties listed in PATH_PROPERTIES may be animated. * * @param {THREE.AnimationClip} clip * @param {THREE.Object3D} root * @return {number|null} */ processAnimation(b, F) { var D = this.json, N = this.nodeMap; D.animations || (D.animations = []), b = d.Utils.mergeMorphTargetTracks(b.clone(), F); for (var B = b.tracks, U = [], G = [], Y = 0; Y < B.length; ++Y) { var te = B[Y], ae = l.PropertyBinding.parseTrackName(te.name), ie = l.PropertyBinding.findNode(F, ae.nodeName), le = g[ae.propertyName]; if (ae.objectName === "bones" && (ie.isSkinnedMesh === !0 ? ie = ie.skeleton.getBoneByName(ae.objectIndex) : ie = void 0), !ie || !le) return console.warn('THREE.GLTFExporter: Could not export animation track "%s".', te.name), null; var W = 1, $ = te.values.length / te.times.length; le === g.morphTargetInfluences && ($ /= ie.morphTargetInfluences.length); var j = void 0; te.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (j = "CUBICSPLINE", $ /= 3) : te.getInterpolation() === l.InterpolateDiscrete ? j = "STEP" : j = "LINEAR", G.push({ input: this.processAccessor(new l.BufferAttribute(te.times, W)), output: this.processAccessor(new l.BufferAttribute(te.values, $)), interpolation: j }), U.push({ sampler: G.length - 1, target: { node: N.get(ie), path: le } }); } return D.animations.push({ name: b.name || "clip_" + D.animations.length, samplers: G, channels: U }), D.animations.length - 1; } /** * @param {THREE.Object3D} object * @return {number|null} */ processSkin(b) { var F = this.json, D = this.nodeMap, N = F.nodes[D.get(b)], B = b.skeleton; if (B === void 0) return null; var U = b.skeleton.bones[0]; if (U === void 0) return null; for (var G = [], Y = new Float32Array(16 * B.bones.length), te = new l.Matrix4(), ae = 0; ae < B.bones.length; ++ae) G.push(D.get(B.bones[ae])), te.copy(B.boneInverses[ae]), te.multiply(b.bindMatrix).toArray(Y, 16 * ae); F.skins === void 0 && (F.skins = []), F.skins.push({ inverseBindMatrices: this.processAccessor(new l.BufferAttribute(Y, 16)), joints: G, skeleton: D.get(U) }); var ie = N.skin = F.skins.length - 1; return ie; } /** * Process Object3D node * @param {THREE.Object3D} node Object3D to processNode * @return {Integer} Index of the node in the nodes list */ processNode(b) { var F = this.json, D = this.options, N = this.nodeMap; F.nodes || (F.nodes = []); var B = {}; if (D.trs) { var U = b.quaternion.toArray(), G = b.position.toArray(), Y = b.scale.toArray(); w(U, [0, 0, 0, 1]) || (B.rotation = U), w(G, [0, 0, 0]) || (B.translation = G), w(Y, [1, 1, 1]) || (B.scale = Y); } else b.matrixAutoUpdate && b.updateMatrix(), M(b.matrix) === !1 && (B.matrix = b.matrix.elements); if (b.name !== "" && (B.name = b.name + ""), this.serializeUserData(b, B), b.isMesh || b.isLine || b.isPoints) { var te = this.processMesh(b); te !== null && (B.mesh = te); } else b.isCamera && (B.camera = this.processCamera(b)); if (b.isSkinnedMesh && this.skins.push(b), 0 < b.children.length) { for (var ae, ie = [], le = 0, W = b.children.length; le < W; le++) if (ae = b.children[le], ae.visible || D.onlyVisible === !1) { var $ = this.processNode(ae); $ !== null && ie.push($); } 0 < ie.length && (B.children = ie); } this._invokeAll(function(re) { re.writeNode && re.writeNode(b, B); }); var j = F.nodes.push(B) - 1; return N.set(b, j), j; } /** * Process Scene * @param {Scene} node Scene to process */ processScene(b) { var F = this.json, D = this.options; F.scenes || (F.scenes = [], F.scene = 0); var N = {}; b.name !== "" && (N.name = b.name), F.scenes.push(N); for (var B, U = [], G = 0, Y = b.children.length; G < Y; G++) if (B = b.children[G], B.visible || D.onlyVisible === !1) { var te = this.processNode(B); te !== null && U.push(te); } 0 < U.length && (N.nodes = U), this.serializeUserData(b, N); } /** * Creates a Scene to hold a list of objects and parse it * @param {Array} objects List of objects to process */ processObjects(b) { var F = new l.Scene(); F.name = "AuxScene"; for (var D = 0; D < b.length; D++) F.children.push(b[D]); this.processScene(F); } /** * @param {THREE.Object3D|Array} input */ processInput(b) { var F = this.options; b = b instanceof Array ? b : [b], this._invokeAll(function(G) { G.beforeParse && G.beforeParse(b); }); for (var D = [], N = 0; N < b.length; N++) b[N] instanceof l.Scene ? this.processScene(b[N]) : D.push(b[N]); 0 < D.length && this.processObjects(D); for (var B = 0; B < this.skins.length; ++B) this.processSkin(this.skins[B]); for (var U = 0; U < F.animations.length; ++U) this.processAnimation(F.animations[U].clip, F.animations[U].mesh); this._invokeAll(function(G) { G.afterParse && G.afterParse(b); }); } _invokeAll(b) { for (var F = 0, D = this.plugins.length; F < D; F++) b(this.plugins[F]); } } class _ { constructor(b) { this.writer = b, this.name = "KHR_lights_punctual"; } writeNode(b, F) { if (b.isLight) { if (!b.isDirectionalLight && !b.isPointLight && !b.isSpotLight) return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.", b); var D = this.writer, N = D.json, B = D.extensionsUsed, U = {}; b.name && (U.name = b.name), U.color = b.color.toArray(), U.intensity = b.intensity, b.isDirectionalLight ? U.type = "directional" : b.isPointLight ? (U.type = "point", 0 < b.distance && (U.range = b.distance)) : b.isSpotLight && (U.type = "spot", 0 < b.distance && (U.range = b.distance), U.spot = {}, U.spot.innerConeAngle = -1 * ((b.penumbra - 1) * b.angle), U.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."), B[this.name] || (N.extensions = N.extensions || {}, N.extensions[this.name] = { lights: [] }, B[this.name] = !0); var G = N.extensions[this.name].lights; G.push(U), F.extensions = F.extensions || {}, F.extensions[this.name] = { light: G.length - 1 }; } } } class E { constructor(b) { this.writer = b, this.name = "KHR_materials_unlit"; } writeMaterial(b, F) { if (b.isMeshBasicMaterial) { var D = this.writer, N = D.extensionsUsed; F.extensions = F.extensions || {}, F.extensions[this.name] = {}, N[this.name] = !0, F.pbrMetallicRoughness.metallicFactor = 0, F.pbrMetallicRoughness.roughnessFactor = 0.9; } } } class C { constructor(b) { this.writer = b, this.name = "KHR_materials_pbrSpecularGlossiness"; } writeMaterial(b, F) { if (b.isGLTFSpecularGlossinessMaterial) { var D = this.writer, N = D.extensionsUsed, B = {}; F.pbrMetallicRoughness.baseColorFactor && (B.diffuseFactor = F.pbrMetallicRoughness.baseColorFactor); var U = [1, 1, 1]; if (b.specular.toArray(U, 0), B.specularFactor = U, B.glossinessFactor = b.glossiness, F.pbrMetallicRoughness.baseColorTexture && (B.diffuseTexture = F.pbrMetallicRoughness.baseColorTexture), b.specularMap) { var G = { index: D.processTexture(b.specularMap) }; D.applyTextureTransform(G, b.specularMap), B.specularGlossinessTexture = G; } F.extensions = F.extensions || {}, F.extensions[this.name] = B, N[this.name] = !0; } } } d.Utils = { insertKeyframe: function(b, F) { var D, N = 1e-3, B = b.getValueSize(), U = new b.TimeBufferType(b.times.length + 1), G = new b.ValueBufferType(b.values.length + B), Y = b.createInterpolant(new b.ValueBufferType(B)); if (b.times.length === 0) { U[0] = F; for (var te = 0; te < B; te++) G[te] = 0; D = 0; } else if (F < b.times[0]) { if (Math.abs(b.times[0] - F) < N) return 0; U[0] = F, U.set(b.times, 1), G.set(Y.evaluate(F), 0), G.set(b.values, B), D = 0; } else if (F > b.times[b.times.length - 1]) { if (Math.abs(b.times[b.times.length - 1] - F) < N) return b.times.length - 1; U[U.length - 1] = F, U.set(b.times, 0), G.set(b.values, 0), G.set(Y.evaluate(F), b.values.length), D = U.length - 1; } else for (var ae = 0; ae < b.times.length; ae++) { if (Math.abs(b.times[ae] - F) < N) return ae; if (b.times[ae] < F && b.times[ae + 1] > F) { U.set(b.times.slice(0, ae + 1), 0), U[ae + 1] = F, U.set(b.times.slice(ae + 1), ae + 2), G.set(b.values.slice(0, (ae + 1) * B), 0), G.set(Y.evaluate(F), (ae + 1) * B), G.set(b.values.slice((ae + 1) * B), (ae + 2) * B), D = ae + 1; break; } } return b.times = U, b.values = G, D; }, mergeMorphTargetTracks: function(b, F) { for (var D = [], N = {}, B = b.tracks, U = 0; U < B.length; ++U) { var G = B[U], Y = l.PropertyBinding.parseTrackName(G.name), te = l.PropertyBinding.findNode(F, Y.nodeName); if (Y.propertyName !== "morphTargetInfluences" || Y.propertyIndex === void 0) { D.push(G); continue; } if (G.createInterpolant !== G.InterpolantFactoryMethodDiscrete && G.createInterpolant !== G.InterpolantFactoryMethodLinear) { if (G.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation."); console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), G = G.clone(), G.setInterpolation(l.InterpolateLinear); } var ae = te.morphTargetInfluences.length, ie = te.morphTargetDictionary[Y.propertyIndex]; if (ie === void 0) throw new Error("THREE.GLTFExporter: Morph target name not found: " + Y.propertyIndex); var le = void 0; if (N[te.uuid] === void 0) { le = G.clone(); for (var W = new le.ValueBufferType(ae * le.times.length), $ = 0; $ < le.times.length; $++) W[$ * ae + ie] = le.values[$]; le.name = (Y.nodeName || "") + ".morphTargetInfluences", le.values = W, N[te.uuid] = le, D.push(le); continue; } var j = G.createInterpolant(new G.ValueBufferType(1)); le = N[te.uuid]; for (var re = 0; re < le.times.length; re++) le.values[re * ae + ie] = j.evaluate(le.times[re]); for (var V, H = 0; H < G.times.length; H++) V = this.insertKeyframe(le, G.times[H]), le.values[V * ae + ie] = G.values[H]; } return b.tracks = D, b; } }; }, /* 44 */ /***/ (o, a, c) => { var l = c(4), d = c(5).resolveURL, h = function() { this.nearPlane = 0.168248, this.farPlane = 6.82906, this.eyePosition = [0.5, -2.86496, 0.5], this.targetPosition = [0.5, 0.5, 0.5], this.upVector = [0, 0, 1]; var A = this; this.setFromObject = (M) => { var { nearPlane: R, farPlane: L, eyePosition: S, targetPosition: I, upVector: T } = M; A.nearPlane = R, A.farPlane = L, A.eyePosition = S, A.targetPosition = I, A.upVector = T; }; }, f = function(A, M, R, L) { var S = { NONE: -1, DEFAULT: 0, PATH: 1, SMOOTH_CAMERA_TRANSITION: 2, AUTO_TUMBLE: 3, ROTATE_TRANSITION: 4, MINIMAP: 5, SYNC_CONTROL: 6 }, I = { 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 }, T = { NONE: -1, FREE: 1, HORIZONTAL: 2, VERTICAL: 3 }, _ = { ARROWLEFT: 37, ARROWUP: 38, ARROWRIGHT: 39, ARROWDOWN: 40, NUMPADADD: 107, NUMPADSUBTRACT: 109, EQUAL: 187, MINUS: 189 }, E = {}; E.MAIN = I.ROTATE, E.AUXILIARY = I.ZOOM, E.SECONDARY = I.PAN, this.cameraObject = A, this.domElement = M === void 0 ? document : M, this.renderer = R, this.scene = L, this.tumble_rate = 1.5, this.pointer_x = 0, this.pointer_y = 0, this.pointer_x_start = 0, this.pointer_y_start = 0, this.previous_pointer_x = 0, this.previous_pointer_y = 0, this.near_plane_fly_debt = 0, this.touchZoomDistanceStart = 0, this.touchZoomDistanceEnd = 0, this.directionalLight = 0, this.zoomRate = 50, this.rotateRate = 50, this.panRate = 100, this.pixelHeight = 1; var C = 6e3, P = !0, b = 0, F = void 0, D = void 0, N = !1, B = 500, U = void 0, G = "default", Y = S.DEFAULT, te = void 0, ae = void 0, ie = void 0, le = 0, W = T.FREE; this._state = I.NONE; var $; this.targetTouchId = -1; var j = void 0, re = new l.Vector3(), V = new l.Vector3(), H = new l.Vector3(), K = new l.Vector3(), ce = new l.Vector3(), se = new l.Vector3(), k = new l.Vector3(), O = new l.Vector3(), Z = new l.Sphere(), X = new l.Vector3(), ee = !1, fe = void 0, be = 0, Ae = { default: new h() }; Ae.default.nearPlane = 0.1, Ae.default.farPlane = 2e3, Ae.default.eyePosition = [0, 0, 0], Ae.default.targetPosition = [0, 0, -1], Ae.default.upVector = [0, 1, 0], this.cameraObject.target === void 0 && (this.cameraObject.target = new l.Vector3(...Ae.default.targetPosition)), this.calculateMaxAllowedDistance = (Q) => { var _e = Q.getBoundingBox(); if (_e) { _e.getBoundingSphere(Z), be = 6 * Z.radius; var Oe = 0; this.cameraObject && (Oe = this.cameraObject.position.distanceTo(Z.center)), be = Oe > be ? 1.5 * Oe : be; } else be = 0; }, this.addViewport = (Q, _e) => { Q && _e && (Ae[Q] = _e); }, this.setDefaultViewport = (Q) => !!(Q && Q in Ae) && (G = Q, !0), this.getDefaultViewport = () => G, this.getViewportOfName = (Q) => Ae[Q], this.setCurrentViewport = (Q) => Q in Ae && (this.setCurrentCameraSettings(Ae[Q]), !0), this.setRotationMode = (Q) => { switch (Q) { case "none": W = T.NONE; break; case "horizontal": W = T.HORIZONTAL; break; case "vertical": W = T.VERTICAL; break; case "free": default: W = T.FREE; } }, this.onResize = () => { j && (j = void 0), fe && fe.setCurrentCameraSettings(this.cameraObject, Ae[G]); }, this.getVisibleHeightAtZDepth = (Q) => { var _e = this.cameraObject.position.distanceTo(this.cameraObject.target); Q < _e ? Q -= _e : Q += _e; var Oe = this.cameraObject.fov * Math.PI / 180; return 2 * Math.tan(Oe / 2) * Math.abs(Q); }, this.calculateHeightPerPixelAtZeroDepth = (Q) => { var _e = this.getVisibleHeightAtZDepth(0); return this.pixelHeight = _e / Q, this.pixelHeight; }, this.getNDCFromDocumentCoords = (Q, _e, Oe) => { Be(!1); var Ze = Oe || new l.Vector2(), ht = 2 * ((Q - j.left) / j.width) - 1, J = 2 * -((_e - j.top) / j.height) + 1; return Ze.set(ht, J); }, this.getRelativeCoordsFromNDC = (Q, _e, Oe) => { Be(!1); var Ze = Oe || new l.Vector2(); return Ze.x = (Q + 1) * j.width / 2, Ze.y = (1 - _e) * j.height / 2, Ze; }, this.setMouseButtonAction = (Q, _e) => { E[Q] = I[_e]; }; var he = (Q, _e) => { Q instanceof HTMLCanvasElement && (Q.tabIndex = _e); }, xe = () => { if (0 < be) { var Q = X.distanceTo(Z.center); return be > Q || this.cameraObject.position.distanceTo(Z.center) > Q; } return !0; }, ne = (Q) => { X.copy(this.cameraObject.position).add(Q), xe() && (this.cameraObject.target.add(Q), this.cameraObject.position.add(Q), this.updateDirectionalLight()); }, me = (Q) => { Be(!1); var _e; if (Y === S.DEFAULT && (_e = this.scene.getNormalisedMinimapCoordinates(this.renderer, Q)), !_e) Q.button == 0 ? Q.ctrlKey ? this._state = E.AUXILIARY : Q.shiftKey ? this._state = E.SECONDARY : this._state = E.MAIN : Q.button == 1 ? (Q.preventDefault(), this._state = E.AUXILIARY) : Q.button == 2 && (this._state = E.SECONDARY), this.pointer_x = Q.clientX - j.left, this.pointer_y = Q.clientY - j.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 = S.MINIMAP; var Oe = this.scene.getMinimapDiffFromNormalised(_e.x, _e.y); ne(Oe); } }, Me = (Q) => { if (Be(!1), j) if (this.pointer_x = Q.clientX - j.left, this.pointer_y = Q.clientY - j.top, Y === S.MINIMAP) { var _e = this.scene.getNormalisedMinimapCoordinates(this.renderer, Q); if (_e) { var Oe = this.scene.getMinimapDiffFromNormalised(_e.x, _e.y); ne(Oe); } } else this._state === I.NONE && $ !== void 0 && $.move(this, Q.clientX, Q.clientY, this.renderer); }, De = (Q) => { this._state = I.NONE, Y == S.MINIMAP && (Y = S.DEFAULT), $ !== void 0 && this.pointer_x_start == Q.clientX - j.left && this.pointer_y_start == Q.clientY - j.top && $.pick(this, Q.clientX, Q.clientY, this.renderer); }, Ie = (Q) => { this._state = I.NONE; }, $e = (Q) => { Be(!1); var _e = Q.touches.length; if (_e == 1) { var Oe, Ze; this._state = I.TOUCH_ROTATE, this.pointer_x = Q.touches[0].clientX - ((Oe = j) === null || Oe === void 0 ? void 0 : Oe.left), this.pointer_y = Q.touches[0].clientY - ((Ze = j) === null || Ze === void 0 ? void 0 : Ze.top), this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; } else if (_e == 2) { this._state = I.TOUCH_ZOOM; var ht = Q.touches[0].clientX - Q.touches[1].clientX, J = Q.touches[0].clientY - Q.touches[1].clientY; this.touchZoomDistanceEnd = this.touchZoomDistanceStart = Math.sqrt(ht * ht + J * J); } else if (_e == 3) { var ye, pe; this._state = I.TOUCH_PAN, this.targetTouchId = Q.touches[0].identifier, this.pointer_x = Q.touches[0].clientX - ((ye = j) === null || ye === void 0 ? void 0 : ye.left), this.pointer_y = Q.touches[0].clientY - ((pe = j) === null || pe === void 0 ? void 0 : pe.top), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; } }, lt = (Q) => { Q.preventDefault(), Q.stopPropagation(); var _e = Q.touches.length; if (_e == 1) this.pointer_x = Q.touches[0].clientX - j.left, this.pointer_y = Q.touches[0].clientY - j.top; else if (_e == 2) { if (this._state === I.TOUCH_ZOOM) { var Oe = Q.touches[0].clientX - Q.touches[1].clientX, Ze = Q.touches[0].clientY - Q.touches[1].clientY; this.touchZoomDistanceEnd = Math.sqrt(Oe * Oe + Ze * Ze); } } else if (_e == 3 && this._state === I.TOUCH_PAN) for (var ht = 0; 3 > ht; ht++) Q.touches[ht].identifier == this.targetTouchId && (this.pointer_x = Q.touches[0].clientX - j.left, this.pointer_y = Q.touches[0].clientY - j.top); }, qe = (Q) => { var _e = Q.touches.length; this.touchZoomDistanceStart = this.touchZoomDistanceEnd = 0, this.targetTouchId = -1, this._state = I.NONE, _e == 1 && $ !== void 0 && this.pointer_x_start == Q.touches[0].clientX - j.left && this.pointer_y_start == Q.touches[0].clientY - j.top && $.pick(this.cameraObject, Q.touches[0].clientX, Q.touches[0].clientY, this.renderer); }, Mt = () => { Be(!0); }, Be = (Q) => { if (Q || j === void 0) { var _e = new IntersectionObserver((Oe) => { for (var Ze of Oe) j = Ze.boundingClientRect; _e.disconnect(); }); _e.observe(this.domElement); } }, it = (Q) => { Be(!1), this._state = I.SCROLL; var _e = 0; 0 < Q.deltaY ? _e = this.zoomRate : 0 > Q.deltaY && (_e = -1 * this.zoomRate), le += _e, Q.preventDefault(), Q.stopImmediatePropagation(); }, tt = (Q) => { Be(!1); var _e = 0; if (Q.keyCode === _.EQUAL || Q.keyCode === _.MINUS || Q.keyCode === _.NUMPADADD || Q.keyCode === _.NUMPADSUBTRACT) { this._state = I.KEYBOARD_ZOOM; var Oe = 1; Q.shiftKey && (Oe *= 2), Q.keyCode === _.EQUAL || Q.keyCode === _.NUMPADADD ? _e = -1 * (this.zoomRate * Oe) : (Q.keyCode === _.MINUS || Q.keyCode === _.NUMPADSUBTRACT) && (_e = this.zoomRate * Oe), le += _e; } else (Q.keyCode === _.ARROWLEFT || Q.keyCode === _.ARROWUP || Q.keyCode === _.ARROWRIGHT || Q.keyCode === _.ARROWDOWN) && (Q.shiftKey ? (this._state = I.KEYBOARD_ROTATE, this.pointer_x_start = this.pointer_x, this.pointer_y_start = this.pointer_y, _e = this.rotateRate) : (this._state = I.KEYBOARD_PAN, _e = this.panRate), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, Q.keyCode === _.ARROWLEFT ? this.pointer_x -= _e : Q.keyCode === _.ARROWUP ? this.pointer_y -= _e : Q.keyCode === _.ARROWRIGHT ? this.pointer_x += _e : Q.keyCode === _.ARROWDOWN && (this.pointer_y += _e)); Object.values(_).includes(Q.keyCode) && Q.preventDefault(); }, qt = (Q) => { this._state = I.NONE; }, Qt = () => { if (typeof this.cameraObject < "u") { var Q = j.height, _e = this.cameraObject.position.distanceTo(this.cameraObject.target), Oe = 0; this.cameraObject.far > this.cameraObject.near && _e >= this.cameraObject.near && _e <= this.cameraObject.far && (Oe = (_e - this.cameraObject.near) / (this.cameraObject.far - this.cameraObject.near)), V.set(this.previous_pointer_x, Q - this.previous_pointer_y, 0), H.set(this.previous_pointer_x, Q - this.previous_pointer_y, 1), K.set(this.pointer_x, Q - this.pointer_y, 0), ce.set(this.pointer_x, Q - this.pointer_y, 1), V.unproject(this.cameraObject), H.unproject(this.cameraObject), K.unproject(this.cameraObject), ce.unproject(this.cameraObject); var Ze = -2e-3; K.sub(V).multiplyScalar(1 - Oe), ce.sub(H).multiplyScalar(Oe), K.add(ce).multiplyScalar(Ze), ne(K); } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }; this.getVectorsFromRotateAboutLookAtPoints = (Q, _e) => { Q.normalize(), k.copy(this.cameraObject.position).sub(this.cameraObject.target), O.copy(k), k.normalize(), 0.8 < Math.abs(k.dot(Q)) && k.copy(this.cameraObject.up), V.crossVectors(Q, k).normalize(), H.crossVectors(Q, V); var Oe = Q.dot(O), Ze = V.dot(O), ht = H.dot(O), J = Q.dot(this.cameraObject.up), ye = V.dot(this.cameraObject.up), pe = H.dot(this.cameraObject.up), we = Math.cos(_e), Ce = Math.sin(_e); return K.set(we * V.x + Ce * H.x, we * V.y + Ce * H.y, we * V.z + Ce * H.z), ce.set(we * H.x - Ce * V.x, we * H.y - Ce * V.y, we * H.z - Ce * V.z), k.copy(this.cameraObject.target), k.x = k.x + Q.x * Oe + K.x * Ze + ce.x * ht, k.y = k.y + Q.y * Oe + K.y * Ze + ce.y * ht, k.z = k.z + Q.z * Oe + K.z * Ze + ce.z * ht, re.set(Q.x * J + K.x * ye + ce.x * pe, Q.y * J + K.y * ye + ce.y * pe, Q.z * J + K.z * ye + ce.z * pe), { position: k, up: re }; }, this.rotateAboutLookAtpoint = (Q, _e) => { var Oe = this.getVectorsFromRotateAboutLookAtPoints(Q, _e); this.cameraObject.position.copy(Oe.position), this.updateDirectionalLight(), this.cameraObject.up.copy(Oe.up); }; var Ft = () => { if (typeof this.cameraObject < "u") { var Q, _e, Oe = (Q = j) === null || Q === void 0 ? void 0 : Q.width, Ze = (_e = j) === null || _e === void 0 ? void 0 : _e.height; if (0 < Oe && 0 < Ze) { var ht = 0.25 * (Oe + Ze), J = 0, ye = 0; (W === T.FREE || W === T.HORIZONTAL) && (J = this.pointer_x - this.previous_pointer_x), (W === T.FREE || W === T.VERTICAL) && (ye = this.previous_pointer_y - this.pointer_y); var pe = Math.sqrt(J * J + ye * ye); if (0 < pe) { var we = 1 * -ye / pe, Ce = 1 * J / pe, ge = 0; W === T.FREE && we * (this.pointer_x - 0.5 * (Oe - 1)) + Ce * (0.5 * (Ze - 1) - this.pointer_y); var Se = Math.acos(ge / ht) - 0.5 * Math.PI, Fe = this.tumble_rate * pe / ht; re.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(), V.copy(this.cameraObject.up).normalize(), H.copy(V).cross(re).normalize().multiplyScalar(we), V.multiplyScalar(Ce), se.addVectors(H, V).multiplyScalar(Math.cos(Se)), re.multiplyScalar(Math.sin(Se)), se.add(re), this.rotateAboutLookAtpoint(se, -Fe); } } } this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y; }, Nt = () => { var Q = 0; return this._state === I.ZOOM ? Q = this.previous_pointer_y - this.pointer_y : this._state === I.SCROLL || this._state === I.KEYBOARD_ZOOM ? Q = le : (Q = -1 * (this.touchZoomDistanceEnd - this.touchZoomDistanceStart), this.touchZoomDistanceStart = this.touchZoomDistanceEnd), Q; }; this.changeZoomByScrollRateUnit = (Q) => { var _e = Q * this.zoomRate; this.changeZoomByValue(_e); }, this.changeZoomByValue = (Q) => { if (typeof this.cameraObject < "u") { var _e = j.height, Oe = this.cameraObject.position.clone(); Oe.sub(this.cameraObject.target); var Ze = Oe.length(), ht = 1.5 * Q / _e; if (0.01 < Ze + ht * Ze && (Oe.normalize(), X.copy(this.cameraObject.position), X.x += Oe.x * ht * Ze, X.y += Oe.y * ht * Ze, X.z += Oe.z * ht * Ze, xe())) { this.cameraObject.position.copy(X), this.updateDirectionalLight(); var J = 1e-5; if (J * this.cameraObject.far < this.cameraObject.near + ht * Ze + this.near_plane_fly_debt) this.near_plane_fly_debt != 0 && (this.near_plane_fly_debt += ht * Ze, 0 < this.near_plane_fly_debt ? (this.cameraObject.near += this.near_plane_fly_debt, this.cameraObject.far += this.near_plane_fly_debt, this.near_plane_fly_debt = 0) : (this.cameraObject.near += ht * Ze, this.cameraObject.far += ht * Ze)); else { if (this.near_plane_fly_debt == 0) { var ye = this.cameraObject.near - J * this.cameraObject.far; this.cameraObject.near = J * this.cameraObject.far, this.cameraObject.far -= ye, this.near_plane_fly_debt -= J * this.cameraObject.far; } this.near_plane_fly_debt += ht * Ze; } ee = !0; } } }; var Vi = () => { var Q = Nt(); this.changeZoomByValue(Q), this._state === I.ZOOM && (this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y), (this._state === I.SCROLL || this._state === I.KEYBOARD_ZOOM) && (le = 0, this._state = I.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() { P = !0, this.domElement && this.domElement.addEventListener && (he(this.domElement, 0), this.domElement.addEventListener("mousedown", me, !1), this.domElement.addEventListener("mousemove", Me, !1), this.domElement.addEventListener("mouseup", De, !1), this.domElement.addEventListener("mouseleave", Ie, !1), this.domElement.addEventListener("touchstart", $e, !1), this.domElement.addEventListener("touchmove", lt, !1), this.domElement.addEventListener("touchend", qe, !1), this.domElement.addEventListener("wheel", it, !1), this.domElement.addEventListener("mouseenter", Mt, !1), this.domElement.addEventListener("contextmenu", (Q) => { Q.preventDefault(); }, !1), this.domElement.addEventListener("keydown", tt, !1), this.domElement.addEventListener("keyup", qt, !1)); }, this.disable = function() { P = !1, this.domElement && this.domElement.removeEventListener && (this.domElement.removeEventListener("mousedown", me, !1), this.domElement.removeEventListener("mousemove", Me, !1), this.domElement.removeEventListener("mouseup", De, !1), this.domElement.removeEventListener("mouseleave", Ie, !1), this.domElement.removeEventListener("touchstart", $e, !1), this.domElement.removeEventListener("touchmove", lt, !1), this.domElement.removeEventListener("touchend", qe, !1), this.domElement.removeEventListener("wheel", it, !1), this.domElement.removeEventListener("mouseenter", Mt, !1), this.domElement.removeEventListener("contextmenu", (Q) => { Q.preventDefault(); }, !1), this.domElement.removeEventListener("keydown", tt, !1), this.domElement.removeEventListener("keyup", qt, !1), he(this.domElement, -1)); }, this.loadPath = (Q) => { F = Q.CameraPath, D = Q.NumberOfPoints; }, this.loadPathURL = (Q, _e) => { var Oe = new XMLHttpRequest(); Oe.onreadystatechange = () => { if (Oe.readyState == 4 && Oe.status == 200) { var ht = JSON.parse(Oe.responseText); this.loadPath(ht), _e != null && typeof _e == "function" && _e(); } }; var Ze = d(Q); Oe.open("GET", Ze, !0), Oe.send(); }, this.setPathDuration = (Q) => { C = Q, te && te.setDuration(C), ae && ae.setDuration(C); }, this.getPlayRate = () => B, this.setPlayRate = (Q) => { B = Q; }; var ki = (Q) => { var _e = b + Q; _e > C && (_e -= C), b = _e; }; this.getTime = () => b, this.setTime = (Q) => { b = Q > C ? C : 0 > Q ? 0 : Q; }, this.getNumberOfTimeFrame = () => D, this.getCurrentTimeFrame = () => { if (2 < D) { var Q = b / C * (D - 1), _e = Math.floor(Q), Oe = 1 - (Q - _e), Ze = Math.ceil(Q); return _e == Ze ? _e == D - 1 ? [_e - 1, Ze, 0] : [_e, Ze + 1, 1] : [_e, Ze, Oe]; } return D == 1 ? [0, 0, 0] : void 0; }, this.setCurrentTimeFrame = (Q) => { 2 < D && (b = C * Q / (D - 1), 0 > b && (b = 0), b > C && (b = C)); }; var ni = (Q) => { if (Y === S.PATH && (ki(Q), F)) { for (var _e = this.getCurrentTimeFrame(), Oe = _e[0], Ze = _e[1], ht = _e[2], J = [F[3 * Oe], F[3 * Oe + 1], F[3 * Oe + 2]], ye = [F[3 * Ze], F[3 * Ze + 1], F[3 * Ze + 2]], pe = [], we = 0; we < J.length; we++) pe.push(ht * J[we] + (1 - ht) * ye[we]); this.cameraObject.position.set(pe[0], pe[1], pe[2]), this.cameraObject.target.set(ye[0], ye[1], ye[2]), U && this.cameraObject.lookAt(this.cameraObject.target), N && (this.directionalLight.position.set(pe[0], pe[1], pe[2]), this.directionalLight.target.position.set(ye[0], ye[1], ye[2])); } }; this.calculatePathNow = () => { ni(0); }; var ts = () => { this._state === I.ROTATE || this._state === I.TOUCH_ROTATE || this._state === I.KEYBOARD_ROTATE ? Ft() : this._state === I.PAN || this._state === I.TOUCH_PAN || this._state === I.KEYBOARD_PAN ? (Qt(), fe.triggerCallback()) : (this._state === I.ZOOM || this._state === I.TOUCH_ZOOM || this._state === I.SCROLL || this._state === I.KEYBOARD_ZOOM) && (fe.zoom(Nt()), this.previous_pointer_x = this.pointer_x, this.previous_pointer_y = this.pointer_y, (this._state === I.SCROLL || this._state === I.KEYBOARD_ZOOM) && (this._state = I.NONE), le = 0, fe.triggerCallback()); }; this.update = (Q) => { var _e = Q * B, Oe = P, Ze = !0; return Y === S.PATH ? ni(_e) : Y === S.SMOOTH_CAMERA_TRANSITION && te ? (te.update(_e), te.isTransitionCompleted() && (Y = S.DEFAULT), Oe = !1) : Y === S.ROTATE_CAMERA_TRANSITION && ae ? (ae.update(_e), ae.isTransitionCompleted() && (Y = S.DEFAULT), Oe = !1) : Y === S.AUTO_TUMBLE && ie ? ie.update(_e) : Y === S.SYNC_CONTROL && fe ? (ts(), Oe = !1) : Ze = !1, Oe && (this._state !== I.NONE && (Ze = !0), this._state === I.ROTATE || this._state === I.TOUCH_ROTATE || this._state === I.KEYBOARD_ROTATE ? Ft() : this._state === I.PAN || this._state === I.TOUCH_PAN || this._state === I.KEYBOARD_PAN ? Qt() : (this._state === I.ZOOM || this._state === I.TOUCH_ZOOM || this._state === I.SCROLL || this._state === I.KEYBOARD_ZOOM) && Vi(), this._state !== I.NONE && Y === S.AUTO_TUMBLE && ie && ie.stopOnCameraInput, this._state === I.SCROLL && (this._state = I.NONE)), U ? (Ze = !0, U.update()) : this.cameraObject.lookAt(this.cameraObject.target), Ze = Ze || ee, ee = !1, Ze; }, this.playPath = () => { Y = S.PATH; }, this.stopPath = () => { Y = S.DEFAULT; }, this.isPlayingPath = () => Y === S.PATH, this.enableDirectionalLightUpdateWithPath = (Q) => { N = Q; }, this.enableDeviceOrientation = () => { U || (U = new x(this.cameraObject)); }, this.disableDeviceOrientation = () => { U && (U.dispose(), U = void 0); }, this.isDeviceOrientationEnabled = () => !!U, this.resetView = () => { var Q = Ae[G]; 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(), ee = !0; }, this.getViewportFromCentreAndRadius = (Q, _e, Oe, Ze, ht, J) => { var ye = this.cameraObject.position.x - this.cameraObject.target.x, pe = this.cameraObject.position.y - this.cameraObject.target.y, we = this.cameraObject.position.z - this.cameraObject.target.z, Ce = 1 / Math.sqrt(ye * ye + pe * pe + we * we); ye *= Ce, pe *= Ce, we *= Ce; var ge = [Q, _e, Oe], Se = Ze / Math.tan(ht * Math.PI / 360), Fe = [Q + ye * Se, _e + pe * Se, Oe + we * Se], Ge = Se + J, We = 0, et = 0.95; We = J > et * Se ? (1 - et) * Se : Se - J; var Ye = new h(); return Ye.nearPlane = We, Ye.farPlane = Ge, Ye.eyePosition = Fe, Ye.targetPosition = ge, Ye.upVector = [this.cameraObject.up.x, this.cameraObject.up.y, this.cameraObject.up.z], Ye; }, this.getViewportFromBoundingBox = (Q, _e) => { var Oe = Q.min.distanceTo(Q.max) / 2 * _e, Ze = (Q.min.x + Q.max.x) / 2, ht = (Q.min.y + Q.max.y) / 2, J = (Q.min.z + Q.max.z) / 2, ye = 4, pe = this.getViewportFromCentreAndRadius(Ze, ht, J, Oe, 40, Oe * ye); return pe; }, this.getCurrentViewport = () => { var Q = new h(); 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, _e, Oe) => { ae == null && (te = new g(Q, _e, this, Oe)); }, this.rotateCameraTransition = (Q, _e, Oe) => { te == null && (ae = new p(Q, _e, this, Oe)); }, this.enableCameraTransition = () => { te && (Y = S.SMOOTH_CAMERA_TRANSITION), ae && (Y = S.ROTATE_CAMERA_TRANSITION); }, this.pauseCameraTransition = () => { Y = S.DEFAULT; }, this.stopCameraTransition = () => { Y = S.DEFAULT, te = void 0, ae = void 0; }, this.isTransitioningCamera = () => Y === S.SMOOTH_CAMERA_TRANSITION || Y === S.ROTATE_CAMERA_TRANSITION, this.autoTumble = (Q, _e, Oe) => { ie = new y(Q, _e, Oe, this); }, this.enableAutoTumble = () => { Y = S.AUTO_TUMBLE; }, this.stopAutoTumble = () => { Y = S.DEFAULT, ie = void 0; }, this.updateAutoTumble = () => { ie && (ie.requireUpdate = !0); }, this.isAutoTumble = () => Y === S.AUTO_TUMBLE, this.enableRaycaster = (Q, _e, Oe) => { $ == null && ($ = new u(Q, this.scene, _e, Oe, this.renderer)); }, this.disableRaycaster = () => { $.disable(), $ = void 0; }, this.isSyncControl = () => currentMpde === S.SYNC_CONTROL, this.enableSyncControl = () => (Y = S.SYNC_CONTROL, fe || (fe = new w()), fe.setCurrentCameraSettings(this.cameraObject, Ae[G]), fe), this.disableSyncControl = () => { Y = S.DEFAULT, this.cameraObject.zoom = 1, this.cameraObject.updateProjectionMatrix(); }, this.enable(); }, g = function(M, R, L, S) { var I = M.eyePosition, T = M.targetPosition, _ = M.upVector, E = R.eyePosition, C = R.targetPosition, P = R.upVector, b = L, F = S, D = 0, N = !1; b.near = Math.min(M.nearPlane, R.nearPlane), b.far = Math.max(M.farPlane, R.farPlane), b.cameraObject.up.set(R.upVector[0], R.upVector[1], R.upVector[2]), this.setDuration = (G) => { F = G; }; var B = (G) => { var Y = D + G; Y > F && (Y = F), D = Y; }, U = () => { var G = D / F, Y = [I[0] * (1 - G) + E[0] * G, I[1] * (1 - G) + E[1] * G, I[2] * (1 - G) + E[2] * G], te = [T[0] * (1 - G) + C[0] * G, T[1] * (1 - G) + C[1] * G, T[2] * (1 - G) + C[2] * G]; _[0] * (1 - G) + P[0] * G, _[1] * (1 - G) + P[1] * G, _[2] * (1 - G) + P[2] * G, b.cameraObject.position.set(Y[0], Y[1], Y[2]), b.cameraObject.target.set(te[0], te[1], te[2]); }; this.update = (G) => { this.enabled === !1 || (B(G), U(), D == F && (N = !0)); }, this.isTransitionCompleted = () => N; }, p = function(M, R, L, S) { var I = M, T = R, _ = L, E = S, C = 0, P = !1; this.setDuration = (F) => { E = F; }; var b = (F) => { var D = C, N = C + F; N > E && (N = E), C = N; var B = C - D, U = B / E, G = U * T; _.rotateAboutLookAtpoint(I, G); }; this.update = (F) => { this.enabled === !1 || (b(F), C == E && (P = !0)); }, this.isTransitionCompleted = () => P; }, u = function(M, R, L, S, I) { var T = M, _ = R, E = I, C = L, P = S, b = new l.Raycaster(); b.params.Line.threshold = 0.1, b.params.Points.threshold = 1; var F = new l.Vector2(), D = !1, N = /* @__PURE__ */ new Date(), B = !1, U = 0, G = [], Y = { zincCamera: void 0, x: -1, y: -1 }, te = void 0; this.enable = () => { enable = !0; }, this.disable = () => { enable = !1; }, this.getIntersectsObject = (le) => { if (_ !== T) { var W = T.getThreeJSScene(); E.render(W, le.cameraObject); } var $ = te || T.getPickableThreeJSObjects(); return G.length = 0, b.intersectObjects($, !0, G); }, this.setPickableObjects = (le) => { le === void 0 ? te = void 0 : (te = [], le.forEach((W) => { W.getGroup() && W.getGroup().visible && te.push(W.getGroup()); })); }, this.getIntersectsObjectWithOrigin = (le, W, $) => (b.set(W, $), this.getIntersectsObject(le)), this.getIntersectsObjectWithCamera = (le, W, $) => (le.getNDCFromDocumentCoords(W, $, F), b.setFromCamera(F, le.cameraObject), this.getIntersectsObject(le)), this.pick = (le, W, $) => { if (E && T && le && C) { this.getIntersectsObjectWithCamera(le, W, $); for (var j, re = G.length, V = 0; V < re; V++) if (j = G[V].object ? G[V].object.userData : void 0, j && j.isMarkerCluster && j.visible && j.clusterIsVisible(G[V].object.clusterIndex) && j.zoomToCluster(G[V].object.clusterIndex)) return; C(G, W, $); } }; var ae = (le, W, $) => { if (E && T && le && P) { if (this.getIntersectsObjectWithCamera(le, W, $), N.setTime(Date.now()), G.length === 0) { if (B) return; B = !0; } else B = !1; P(G, W, $); } }; this.move = (le, W, $) => { E && T && le && P && (T.displayMarkers ? ae(le, W, $) : (Y.zincCamera = le, Y.x = W, Y.y = $, !D && (U = N ? Date.now() - N.getTime() : 250, 250 <= U ? ae(le, W, $) : (D = !0, setTimeout(ie(Y), U))))); }; var ie = (le) => function() { D = !1, ae(le.zincCamera, le.x, le.y); }; }, y = function(M, R, L, S) { var I = new l.Vector3(), T = -R, _ = S, E = M; this.stopOnCameraInput = L, this.requireUpdate = !0; var C = new l.Vector3(), P = new l.Vector3(), b = (F) => { var D = Math.sqrt(F[0] * F[0] + F[1] * F[1]), N = 4 * Math.abs(F[0]), B = 4 * Math.abs(F[1]), U = 0.25 * (N + B), G = -F[1] / D, Y = F[0] / D, te = G * F[0] + Y * -F[1]; te > U ? te = U : te < -U && (te = -U); var ae = Math.acos(te / U) - 0.5 * Math.PI; I.copy(_.cameraObject.position).sub(_.cameraObject.target).normalize(), C.copy(_.cameraObject.up).normalize(), P.crossVectors(C, I).normalize().multiplyScalar(G), C.multiplyScalar(Y), C.add(P).multiplyScalar(Math.cos(ae)), I.multiplyScalar(Math.sin(ae)).add(C); }; this.update = (F) => { this.enabled === !1 || (this.requireUpdate && (b(E), this.requireUpdate = !1), _.rotateAboutLookAtpoint(I, T * F / 1e3)); }; }, v = function() { this.type = "StereoCamera", this.aspect = 1, this.cameraL = new l.PerspectiveCamera(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new l.PerspectiveCamera(), this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1; }; Object.assign(v.prototype, { update: (() => { var A, M, R, L, S, I, T = new l.Matrix4(), _ = new l.Matrix4(); return function(C) { var P = A !== C.focus || M !== C.fov || R !== C.aspect * this.aspect || L !== C.near || S !== C.far || I !== C.zoom; if (P) { A = C.focus, M = C.fov, R = C.aspect * this.aspect, L = C.near, S = C.far, I = C.zoom; var b, F, D = C.projectionMatrix.clone(), N = 0.064 / 2, B = N * L / A, U = L * Math.tan(0.5 * (l.Math.DEG2RAD * M)) / C.zoom; _.elements[12] = -N, T.elements[12] = N, b = -U * R + B, F = U * R + B, D.elements[0] = 2 * L / (F - b), D.elements[8] = (F + b) / (F - b), this.cameraL.projectionMatrix.copy(D), b = -U * R - B, F = U * R - B, D.elements[0] = 2 * L / (F - b), D.elements[8] = (F + b) / (F - b), this.cameraR.projectionMatrix.copy(D); } this.cameraL.matrixWorld.copy(C.matrixWorld).multiply(_), this.cameraR.matrixWorld.copy(C.matrixWorld).multiply(T); }; })() }); var m = function(M) { var R = new v(); R.aspect = 0.5, this.setSize = (L, S) => { M.setSize(L, S); }, this.render = (L, S) => { L.updateMatrixWorld(), S.parent === null && S.updateMatrixWorld(), R.update(S); var I = M.getSize(); M.setScissorTest(!0), M.clear(), M.setScissor(0, 0, I.width / 2, I.height), M.setViewport(0, 0, I.width / 2, I.height), M.render(L, R.cameraL), M.setScissor(I.width / 2, 0, I.width / 2, I.height), M.setViewport(I.width / 2, 0, I.width / 2, I.height), M.render(L, R.cameraR), M.setScissorTest(!1); }; }, x = function(M) { var R = this; this.object = M, this.object.rotation.reorder("YXZ"), this.enabled = !0, this.deviceOrientation = {}, this.screenOrientation = 0; var L = (T) => { R.deviceOrientation = T; }, S = () => { typeof window < "u" && (R.screenOrientation = window.orientation || 0); }, I = (() => { var T = new l.Vector3(0, 0, 1), _ = new l.Euler(), E = new l.Quaternion(), C = new l.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); return (P, b, F, D, N) => { var B = new l.Vector3(0, 0, 1); B.subVectors(P.target, P.position), _.set(F, b, -D, "YXZ"); var U = new l.Quaternion(); U.setFromEuler(_), U.multiply(C), U.multiply(E.setFromAxisAngle(T, -N)), B.applyQuaternion(U), B.addVectors(P.position, B), P.lookAt(B); }; })(); this.connect = () => { S(), typeof window < "u" && (window.addEventListener("orientationchange", S, !1), window.addEventListener("deviceorientation", L, !1)), R.enabled = !0; }, this.disconnect = () => { typeof window < "u" && (window.removeEventListener("orientationchange", S, !1), window.removeEventListener("deviceorientation", L, !1)), R.enabled = !1; }, this.update = () => { if (R.enabled !== !1) { var T = R.deviceOrientation.alpha ? l.Math.degToRad(R.deviceOrientation.alpha) : 0, _ = R.deviceOrientation.beta ? l.Math.degToRad(R.deviceOrientation.beta) : 0, E = R.deviceOrientation.gamma ? l.Math.degToRad(R.deviceOrientation.gamma) : 0, C = R.screenOrientation ? l.Math.degToRad(R.screenOrientation) : 0; I(R.object, T, _, E, C); } }, this.dispose = function() { this.disconnect(); }, this.connect(); }, w = function() { var M = void 0, R = void 0, L = void 0, S = new l.Vector3(), I = new l.Vector3(), T = new l.Vector3(), _ = new l.Vector3(), E = void 0; this.setCurrentCameraSettings = (C, P) => { M = C.clone(), R = C, L = P, M.near = L.nearPlane, L.farPlane && (M.far = L.farPlane), L.eyePosition && M.position.set(L.eyePosition[0], L.eyePosition[1], L.eyePosition[2]), L.upVector && M.up.set(L.upVector[0], L.upVector[1], L.upVector[2]), L.targetPosition && (M.target = new l.Vector3(L.targetPosition[0], L.targetPosition[1], L.targetPosition[2]), M.lookAt(M.target)), M.updateProjectionMatrix(), S.copy(M.position).project(M), I.copy(M.target).project(M); }, this.getCurrentPosition = () => (I.copy(R.target).project(M), [I.x, I.y]), this.zoom = (C) => { var P = 2e-3 * C, b = Math.max(R.zoom - P, 1); R.zoom = b, R.updateProjectionMatrix(); }, this.zoomToBox = (C, P) => { C.getCenter(T), T.project(M), this.setCenterZoom([T.x, T.y], P); }, this.getPanZoom = () => ({ target: this.getCurrentPosition(), zoom: R.zoom }), this.setCenterZoom = (C, P) => { T.set(C[0], C[1], I.z).unproject(M), _.copy(T).sub(R.target), R.target.copy(T), R.lookAt(R.target), R.position.add(_), R.zoom = P, R.updateProjectionMatrix(); }, this.setEventCallback = (C) => { (C === void 0 || typeof C == "function") && (E = C); }, this.triggerCallback = () => { E !== void 0 && typeof E == "function" && E(); }; }; a.Viewport = h, a.CameraControls = f, a.SmoothCameraTransition = g, a.RotateCameraTransition = p, a.RayCaster = u, a.CameraAutoTumble = y, a.StereoEffect = m, a.NDCCameraControl = w; }, /* 45 */ /***/ (o, a, c) => { var { Group: l, Matrix4: d } = c(4), h = c(22).Pointset; c(24).Lines; var f = c(46).Lines2, g = c(3).Geometry, p = c(4), u = 0, y = function() { return "re" + u++; }, v = function(m, x) { var w = m, A = new l(); A.matrixAutoUpdate = !1, A.userData = this; var M = [], R = "", L = [], S = x, I = new d(), T = 3e3; I.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this.pickableUpdateRequired = !0, this.isRegion = !0, this.uuid = y(), this.hideAllPrimitives = () => { M.forEach((_) => _.hideAllPrimitives()), L.forEach((_) => _.setVisibility(!1)); }, this.showAllPrimitives = () => { M.forEach((_) => _.showAllPrimitives()), L.forEach((_) => _.setVisibility(!0)); }, this.setVisibility = (_) => { _ != A.visible && (A.visible = _, this.pickableUpdateRequired = !0); }, this.getVisibility = () => A.visible, this.getGroup = () => A, this.setTransformation = (_) => { I.set(..._), A.matrix.copy(I), A.updateMatrixWorld(); }, this.setName = (_) => { _ && _ !== "" && (R = _); }, this.getName = () => R, this.getParent = () => w, this.getFullSeparatedPath = () => { var _ = []; if (R !== "") { _.push(R); for (var E, C = w; C !== void 0; ) E = C.getName(), E !== "" && _.unshift(E), C = C.getParent(); } return _; }, this.getFullPath = () => { var _ = this.getFullSeparatedPath(); if (0 < _.length) { var E = _.shift(); return _.forEach((C) => { E = E.concat("/", C); }), E; } return ""; }, this.createChild = (_) => { var E = new v(this, S); return E.setName(_), M.push(E), A.add(E.getGroup()), E; }, this.getChildWithName = (_) => { if (_) { for (var E = _.toLowerCase(), C = 0; C < M.length; C++) if (M[C].getName().toLowerCase() === E) return M[C]; } }, this.findChildFromSeparatedPath = (_) => { if (_ && 0 < _.length && _[0] === "" && _.shift(), _ && 0 < _.length) { var E = this.getChildWithName(_[0]); return E ? (_.shift(), E.findChildFromSeparatedPath(_)) : void 0; } return this; }, this.findChildFromPath = (_) => { var E = _.split("/"); return this.findChildFromSeparatedPath(E); }, this.createChildFromSeparatedPath = (_) => { if (0 < _.length && _[0] === "" && _.shift(), 0 < _.length) { var E = this.getChildWithName(_[0]); return E || (E = this.createChild(_[0])), _.shift(), E.createChildFromSeparatedPath(_); } return this; }, this.createChildFromPath = (_) => { var E = _.split("/"); return this.createChildFromSeparatedPath(E); }, this.findOrCreateChildFromPath = (_) => { var E = this.findChildFromPath(_); return E || (E = this.createChildFromPath(_)), E; }, this.addZincObject = (_) => { _ && (_.setRegion(this), A.add(_.getGroup()), L.push(_), this.pickableUpdateRequired = !0, S && S.triggerObjectAddedCallback(_)); }, this.removeZincObject = (_) => { for (var E = 0; E < L.length; E++) if (_ === L[E]) return A.remove(_.getGroup()), L.splice(E, 1), S && S.triggerObjectRemovedCallback(_), _.dispose(), void (this.pickableUpdateRequired = !0); }, this.checkPickableUpdateRequred = (_) => { if (this.pickableUpdateRequired) return !0; if (_) { for (var E = !1, C = 0; C < M.length; C++) if (E = M[C].checkPickableUpdateRequred(_), E) return !0; } return !1; }, this.getPickableThreeJSObjects = (_, E) => (A.visible && (L.forEach((C) => { if (C.isPickable && C.getGroup() && C.getGroup().visible) { var P = C.marker; P && P.isEnabled() && _.push(P.getMorph()), _.push(C.getGroup()); } }), E && M.forEach((C) => { C.getPickableThreeJSObjects(_, E); }), this.pickableUpdateRequired = !1), _), this.setDuration = (_) => { T = _, L.forEach((E) => E.setDuration(_)), M.forEach((E) => E.setDuration(_)); }, this.getDuration = () => T, this.getBoundingBox = (_) => { var E, C; return L.forEach((P) => { C = P.getBoundingBox(), C && (E == null ? E = C.clone() : E.union(C)); }), _ && M.forEach((P) => { C = P.getBoundingBox(_), C && (E == null ? E = C.clone() : E.union(C)); }), E; }, this.clear = (_) => { _ && M.forEach((E) => E.clear(_)), L.forEach((E) => { A.remove(E.getGroup()), E.dispose(); }), M = [], L = []; }, this.objectIsInRegion = (_, E) => { for (var C = 0; C < L.length; C++) if (_ === L[C]) return !0; if (E) { for (var P = 0; P < M.length; P++) if (M[P].objectIsInRegion(_, E)) return !0; } return !1; }, this.forEachGeometry = (_, E) => { L.forEach((C) => { C.isGeometry && _(C); }), E && M.forEach((C) => C.forEachGeometry(_, E)); }, this.forEachGlyphset = (_, E) => { L.forEach((C) => { C.isGlyphset && _(C); }), E && M.forEach((C) => C.forEachGlyphset(_, E)); }, this.forEachPointset = (_, E) => { L.forEach((C) => { C.isPointset && _(C); }), E && M.forEach((C) => C.forEachPointset(_, E)); }, this.forEachLine = (_, E) => { L.forEach((C) => { C.isLines && _(C); }), E && M.forEach((C) => C.forEachLine(_, E)); }, this.findObjectsWithAnatomicalId = (_, E) => { var C = []; return L.forEach((P) => { P.anatomicalId === _ && C.push(P); }), E && M.forEach((P) => { var b = P.findObjectsWithAnatomicalId(_, E); C.push(...b); }), C; }, this.findObjectsWithGroupName = (_, E) => { var C = []; return L.forEach((P) => { var b = P.groupName ? P.groupName.toLowerCase() : P.groupName, F = _ && _.toLowerCase(); b === F && C.push(P); }), E && M.forEach((P) => { var b = P.findObjectsWithGroupName(_, E); C.push(...b); }), C; }, this.findGeometriesWithGroupName = (_, E) => { var C = this.findObjectsWithGroupName(_, E), P = C.filter((b) => b.isGeometry); return P; }, this.findPointsetsWithGroupName = (_, E) => { var C = this.findObjectsWithGroupName(_, E), P = C.filter((b) => b.isPointset); return P; }, this.findGlyphsetsWithGroupName = (_, E) => { var C = this.findObjectsWithGroupName(_, E), P = C.filter((b) => b.isGlyphset); return P; }, this.findLinesWithGroupName = (_, E) => { var C = this.findObjectsWithGroupName(_, E), P = C.filter((b) => b.isLines); return P; }, this.getAllObjects = (_) => { var E = [...L]; return _ && M.forEach((C) => { var P = C.getAllObjects(_); E.push(...P); }), E; }, this.getChildRegions = (_) => { var E = [...M]; return _ && M.forEach((C) => { var P = C.getChildRegions(_); E.push(...P); }), E; }, this.getCurrentTime = () => { if (L[0] != null) return L[0].getCurrentTime(); for (var _, E = 0; E < M.length; E++) if (_ = M[E].getCurrentTime(), _ !== -1) return _; return -1; }, this.setMorphTime = (_, E) => { L.forEach((C) => { C.setMorphTime(_); }), E && M.forEach((C) => { C.setMorphTime(_); }); }, this.isTimeVarying = () => { for (var _ = 0; _ < L.length; _++) if (L[_].isTimeVarying()) return !0; for (var E = 0; E < M.length; E++) if (M[E].isTimeVarying()) return !0; return !1; }, this.renderGeometries = (_, E, C, P, b, F) => { var D, N = this.getAllObjects(F); N.forEach((B) => { B.render(_ * E, C, P, b); }), b && C === !1 && (D = b.markerCluster) !== null && D !== void 0 && D.markerUpdateRequired && b.markerCluster.calculate(); }, this.createPoints = (_, E, C, P) => { var b = !1, F = this.findObjectsWithGroupName(_, !1), D = F.findIndex((B) => B.isPointset), N = -1 < D ? F[D] : new h(); return N.addPoints(E, C, P), D === -1 ? (N.setName(_), this.addZincObject(N), b = !0) : this.pickableUpdateRequired = !0, { zincObject: N, isNew: b }; }, this.createLines = (_, E, C) => { var P = !1, b = this.findObjectsWithGroupName(_, !1), F = b.findIndex((N) => N.isLines), D = -1 < F ? b[F] : new f(); return D.addLines(E, C), F === -1 ? (D.setName(_), this.addZincObject(D), P = !0) : this.pickableUpdateRequired = !0, { zincObject: D, isNew: P }; }, this.createGeometryFromThreeJSGeometry = (_, E, C, P, b, F) => { var D = new g(), N = new p.MeshPhongMaterial({ color: C, morphTargets: !1, morphNormals: !1, transparent: !0, opacity: P, side: p.DoubleSide }); return D.createMesh(E, N, { localTimeEnabled: !1, localMorphColour: !1 }), D.getMorph() ? (D.setVisibility(!1), D.setName(_), D.setRenderOrder(F), this.addZincObject(D), D) : void 0; }; }; a.Region = v; }, /* 46 */ /***/ (o, a, c) => { c(4), c(5).toBufferGeometry; var l = c(47).LineSegments2, d = c(49).LineMaterial, h = c(48).LineSegmentsGeometry, f = function() { c(24).Lines.call(this), this.isLines2 = !0; var g = Array(300); this.createLineSegment = (p, u, y) => { if (p && u) { var v = new h(); v.setPositions(p), v.colorsNeedUpdate = !0; var m = new l(v, u); m.scale.set(1, 1, 1), m.computeLineDistances(), this.setMesh(m, y.localTimeEnabled, y.localMorphColour); } }, this.setWidth = (p) => { this.morph && this.morph.material && (this.morph.material.linewidth = p, this.morph.material.needsUpdate = !0); }, this.addVertices = function(p) { if (p && p.length) { var u = this.getMorph(); u || (this.drawRange = 0); var y = 3 * this.drawRange; if (p.forEach((v) => { g[y++] = v[0], g[y++] = v[1], g[y++] = v[2], this.drawRange++; }), !u) for (; 300 > y; ) g[y++] = p[0][0], g[y++] = p[0][1], g[y++] = p[0][2]; u && (u.geometry.setPositions(g), u.computeLineDistances(), this.boundingBoxUpdateRequired = !0); } return g; }, this.getVerticesByFaceIndex = function(p) { var u = 3 * (2 * p), y = this.getMorph(); if (y && 3 * this.drawRange > u) { var v = y.geometry.getAttribute("instanceStart"); return [[v.data.array[u], v.data.array[++u], v.data.array[++u]], [v.data.array[++u], v.data.array[++u], v.data.array[++u]]]; } return []; }, this.editVertices = function(p, u) { if (p && p.length) { var y = this.getMorph(), v = u + p.length - 1; if (!y || 0 > u || v >= this.drawRange) return; var m = 3 * u; for (p.forEach((x) => { g[m++] = x[0], g[m++] = x[1], g[m++] = x[2]; }), m = 3 * this.drawRange; 300 > m; ) g[m++] = p[0][0], g[m++] = p[0][1], g[m++] = p[0][2]; y.geometry.setPositions(g), y.computeLineDistances(), this.boundingBoxUpdateRequired = !0; } return g; }, this.addLines = (p, u) => { if (p && 0 < p.length) { this.addVertices(p); var y = this.getMorph(); if (!y) { var v = new d({ color: u, linewidth: 1, vertexColors: !1, worldUnits: !1 }); v.resolution.set(window.innerWidth, window.innerHeight), this.createLineSegment(g, v, { localTimeEnabled: !1, localMorphColour: !1 }); } this.region && (this.region.pickableUpdateRequired = !0); } }, this.render = () => { var p = this.getMorph().material; p.resolution.set(window.innerWidth, window.innerHeight); }; }; f.prototype = Object.create(c(24).Lines.prototype), f.prototype.constructor = f, a.Lines2 = f; }, /* 47 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegments2: () => ( /* binding */ L ) /* harmony export */ }); var l = c(4), d = c(48), h = c(49), f = new l.Vector3(), g = new l.Vector3(), p = new l.Vector4(), u = new l.Vector4(), y = new l.Vector4(), v = new l.Vector3(), m = new l.Matrix4(), x = new l.Line3(), w = new l.Vector3(), A = new l.Box3(), M = new l.Sphere(), R = new l.Vector4(); class L extends l.Mesh { constructor() { var I = 0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : new d.LineSegmentsGeometry(), T = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : new h.LineMaterial({ color: 16777215 * Math.random() }); super(I, T), this.type = "LineSegments2"; } // for backwards-compatability, but could be a method of LineSegmentsGeometry... computeLineDistances() { for (var I = this.geometry, T = I.attributes.instanceStart, _ = I.attributes.instanceEnd, E = new Float32Array(2 * T.count), C = 0, P = 0, b = T.count; C < b; C++, P += 2) f.fromBufferAttribute(T, C), g.fromBufferAttribute(_, C), E[P] = P == 0 ? 0 : E[P - 1], E[P + 1] = E[P] + f.distanceTo(g); var F = new l.InstancedInterleavedBuffer(E, 2, 1); return I.setAttribute("instanceDistanceStart", new l.InterleavedBufferAttribute(F, 1, 0)), I.setAttribute("instanceDistanceEnd", new l.InterleavedBufferAttribute(F, 1, 1)), this; } raycast(I, T) { I.camera === null && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.'); var _ = I.params.Line2 === void 0 ? 0 : I.params.Line2.threshold || 0, E = I.ray, C = I.camera, P = C.projectionMatrix, b = this.matrixWorld, F = this.geometry, D = this.material, N = D.resolution, B = D.linewidth + _, U = F.attributes.instanceStart, G = F.attributes.instanceEnd, Y = -C.near, te = 2 * Math.max(B / N.width, B / N.height); F.boundingSphere === null && F.computeBoundingSphere(), M.copy(F.boundingSphere).applyMatrix4(b); var ae = Math.max(C.near, M.distanceToPoint(E.origin)); R.set(0, 0, -ae, 1).applyMatrix4(C.projectionMatrix), R.multiplyScalar(1 / R.w), R.applyMatrix4(C.projectionMatrixInverse); var ie = 0.5 * Math.abs(te / R.w); if (M.radius += ie, I.ray.intersectsSphere(M) !== !1) { F.boundingBox === null && F.computeBoundingBox(), A.copy(F.boundingBox).applyMatrix4(b); var le = Math.max(C.near, A.distanceToPoint(E.origin)); R.set(0, 0, -le, 1).applyMatrix4(C.projectionMatrix), R.multiplyScalar(1 / R.w), R.applyMatrix4(C.projectionMatrixInverse); var W = 0.5 * Math.abs(te / R.w); if (A.max.x += W, A.max.y += W, A.max.z += W, A.min.x -= W, A.min.y -= W, A.min.z -= W, I.ray.intersectsBox(A) !== !1) { E.at(1, y), y.w = 1, y.applyMatrix4(C.matrixWorldInverse), y.applyMatrix4(P), y.multiplyScalar(1 / y.w), y.x *= N.x / 2, y.y *= N.y / 2, y.z = 0, v.copy(y), m.multiplyMatrices(C.matrixWorldInverse, b); for (var $ = 0, j = U.count; $ < j; $++) { p.fromBufferAttribute(U, $), u.fromBufferAttribute(G, $), p.w = 1, u.w = 1, p.applyMatrix4(m), u.applyMatrix4(m); var re = p.z > Y && u.z > Y; if (!re) { if (p.z > Y) { var V = p.z - u.z, H = (p.z - Y) / V; p.lerp(u, H); } else if (u.z > Y) { var K = u.z - p.z, ce = (u.z - Y) / K; u.lerp(p, ce); } p.applyMatrix4(P), u.applyMatrix4(P), p.multiplyScalar(1 / p.w), u.multiplyScalar(1 / u.w), p.x *= N.x / 2, p.y *= N.y / 2, u.x *= N.x / 2, u.y *= N.y / 2, x.start.copy(p), x.start.z = 0, x.end.copy(u), x.end.z = 0; var se = x.closestPointToPointParameter(v, !0); x.at(se, w); var k = l.MathUtils.lerp(p.z, u.z, se), O = -1 <= k && 1 >= k, Z = v.distanceTo(w) < 0.5 * B; if (O && Z) { x.start.fromBufferAttribute(U, $), x.end.fromBufferAttribute(G, $), x.start.applyMatrix4(b), x.end.applyMatrix4(b); var X = new l.Vector3(), ee = new l.Vector3(); E.distanceSqToSegment(x.start, x.end, ee, X), T.push({ point: ee, pointOnLine: X, distance: E.origin.distanceTo(ee), object: this, face: null, faceIndex: $, uv: null, uv2: null }); } } } } } } } L.prototype.LineSegments2 = !0; }, /* 48 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineSegmentsGeometry: () => ( /* binding */ f ) /* harmony export */ }); var l = c(4), d = new l.Box3(), h = new l.Vector3(); class f extends l.InstancedBufferGeometry { constructor() { super(), this.type = "LineSegmentsGeometry", this.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]), this.setAttribute("position", new l.Float32BufferAttribute([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0], 3)), this.setAttribute("uv", new l.Float32BufferAttribute([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2], 2)); } applyMatrix4(p) { var u = this.attributes.instanceStart, y = this.attributes.instanceEnd; return u !== void 0 && (u.applyMatrix4(p), y.applyMatrix4(p), u.needsUpdate = !0), this.boundingBox !== null && this.computeBoundingBox(), this.boundingSphere !== null && this.computeBoundingSphere(), this; } setPositions(p) { var u; p instanceof Float32Array ? u = p : Array.isArray(p) && (u = new Float32Array(p)); var y = new l.InstancedInterleavedBuffer(u, 6, 1); return this.setAttribute("instanceStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this.computeBoundingBox(), this.computeBoundingSphere(), this; } setColors(p) { var u; p instanceof Float32Array ? u = p : Array.isArray(p) && (u = new Float32Array(p)); var y = new l.InstancedInterleavedBuffer(u, 6, 1); return this.setAttribute("instanceColorStart", new l.InterleavedBufferAttribute(y, 3, 0)), this.setAttribute("instanceColorEnd", new l.InterleavedBufferAttribute(y, 3, 3)), this; } fromWireframeGeometry(p) { return this.setPositions(p.attributes.position.array), this; } fromEdgesGeometry(p) { return this.setPositions(p.attributes.position.array), this; } fromMesh(p) { return this.fromWireframeGeometry(new l.WireframeGeometry(p.geometry)), this; } fromLineSegments(p) { var u = p.geometry; return u.isGeometry ? void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.") : (u.isBufferGeometry && this.setPositions(u.attributes.position.array), this); } computeBoundingBox() { this.boundingBox === null && (this.boundingBox = new l.Box3()); var p = this.attributes.instanceStart, u = this.attributes.instanceEnd; p !== void 0 && u !== void 0 && (this.boundingBox.setFromBufferAttribute(p), d.setFromBufferAttribute(u), this.boundingBox.union(d)); } computeBoundingSphere() { this.boundingSphere === null && (this.boundingSphere = new l.Sphere()), this.boundingBox === null && this.computeBoundingBox(); var p = this.attributes.instanceStart, u = this.attributes.instanceEnd; if (p !== void 0 && u !== void 0) { var y = this.boundingSphere.center; this.boundingBox.getCenter(y); for (var v = 0, m = 0, x = p.count; m < x; m++) h.fromBufferAttribute(p, m), v = Math.max(v, y.distanceToSquared(h)), h.fromBufferAttribute(u, m), v = Math.max(v, y.distanceToSquared(h)); this.boundingSphere.radius = Math.sqrt(v), isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this); } } toJSON() { } applyMatrix(p) { return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."), this.applyMatrix4(p); } } f.prototype.isLineSegmentsGeometry = !0; }, /* 49 */ /***/ (o, a, c) => { c.r(a), c.d(a, { /* harmony export */ LineMaterial: () => ( /* binding */ d ) /* harmony export */ }); var l = c(4); l.UniformsLib.line = { linewidth: { value: 1 }, resolution: { value: new l.Vector2(1, 1) }, dashScale: { value: 1 }, dashSize: { value: 1 }, dashOffset: { value: 0 }, gapSize: { value: 1 }, // todo FIX - maybe change to totalSize opacity: { value: 1 } }, l.ShaderLib.line = { uniforms: l.UniformsUtils.merge([l.UniformsLib.common, l.UniformsLib.fog, l.UniformsLib.line]), vertexShader: ( /* glsl */ ` #include #include #include #include #include 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 #include #include }` ), 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 #include #include #include #include varying vec2 vUv; void main() { #include #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 #include gl_FragColor = vec4( diffuseColor.rgb, alpha ); #include #include #include #include }` ) }; class d extends l.ShaderMaterial { constructor(f) { super({ type: "LineMaterial", uniforms: l.UniformsUtils.clone(l.ShaderLib.line.uniforms), vertexShader: l.ShaderLib.line.vertexShader, fragmentShader: l.ShaderLib.line.fragmentShader, clipping: !0 // required for clipping support }), Object.defineProperties(this, { color: { enumerable: !0, get: function() { return this.uniforms.diffuse.value; }, set: function(p) { this.uniforms.diffuse.value = p; } }, linewidth: { enumerable: !0, get: function() { return this.uniforms.linewidth.value; }, set: function(p) { this.uniforms.linewidth.value = p; } }, dashed: { enumerable: !0, get: function() { return "USE_DASH" in this.defines; }, set(g) { !!g != "USE_DASH" in this.defines && (this.needsUpdate = !0), g === !0 ? this.defines.USE_DASH = "" : delete this.defines.USE_DASH; } }, dashScale: { enumerable: !0, get: function() { return this.uniforms.dashScale.value; }, set: function(p) { this.uniforms.dashScale.value = p; } }, dashSize: { enumerable: !0, get: function() { return this.uniforms.dashSize.value; }, set: function(p) { this.uniforms.dashSize.value = p; } }, dashOffset: { enumerable: !0, get: function() { return this.uniforms.dashOffset.value; }, set: function(p) { this.uniforms.dashOffset.value = p; } }, gapSize: { enumerable: !0, get: function() { return this.uniforms.gapSize.value; }, set: function(p) { this.uniforms.gapSize.value = p; } }, opacity: { enumerable: !0, get: function() { return this.uniforms.opacity.value; }, set: function(p) { this.uniforms.opacity.value = p; } }, resolution: { enumerable: !0, get: function() { return this.uniforms.resolution.value; }, set: function(p) { this.uniforms.resolution.value.copy(p); } }, alphaToCoverage: { enumerable: !0, get: function() { return "ALPHA_TO_COVERAGE" in this.defines; }, set: function(p) { !!p != "ALPHA_TO_COVERAGE" in this.defines && (this.needsUpdate = !0), p === !0 ? (this.defines.ALPHA_TO_COVERAGE = "", this.extensions.derivatives = !0) : (delete this.defines.ALPHA_TO_COVERAGE, this.extensions.derivatives = !1); } } }), this.setValues(f); } } d.prototype.isLineMaterial = !0; }, /* 50 */ /***/ (o, a, c) => { var l = c(4); a.Minimap = function(d) { var h = d; this.camera = new l.OrthographicCamera(-0.5, 0.5, 0.5, -0.5, 0.01, 10), this.helper = void 0; var f = new l.BufferGeometry(), g = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1]), p = new l.BufferAttribute(g, 3); f.setAttribute("position", p); var u = new l.MeshBasicMaterial({ color: 3355443, depthTest: !1, depthWrite: !1, opacity: 0.5, transparent: !0 }); this.mask = new l.Mesh(f, u); var y = new l.Box3(), v = new l.Vector3(); this.getDiffFromNormalised = (x, w) => { y.setFromBufferAttribute(p).getCenter(v); var A = v.clone().project(this.camera), M = new l.Vector3(x, w, A.z).unproject(this.camera); return M.sub(v); }; var m = (x, w) => { h.camera.near && (this.camera.near = h.camera.near), w.farPlane && (this.camera.far = w.farPlane), w.eyePosition && this.camera.position.set(w.eyePosition[0], w.eyePosition[1], w.eyePosition[2]), w.upVector && this.camera.up.set(w.upVector[0], w.upVector[1], w.upVector[2]), w.targetPosition && this.camera.lookAt(new l.Vector3(w.targetPosition[0], w.targetPosition[1], w.targetPosition[2])), this.camera.zoom = 1 / x, this.camera.updateProjectionMatrix(); }; this.getBoundary = () => { var x = new l.Vector3().copy(h.camera.target).project(h.camera), w = new l.Vector3(-1, -1, x.z).unproject(h.camera), A = new l.Vector3(1, -1, x.z).unproject(h.camera), M = new l.Vector3(1, 1, x.z).unproject(h.camera), R = new l.Vector3(-1, 1, x.z).unproject(h.camera); p.copyVector3sArray([w, A, M, M, R, w]), p.needsUpdate = !0; }, this.updateCamera = () => { this.getBoundary(); var x = h.getZincCameraControls(), w = h.getBoundingBox(); if (w) { var A = w.min.distanceTo(w.max), M = A / 2, R = (w.min.x + w.max.x) / 2, L = (w.min.y + w.max.y) / 2, S = (w.min.z + w.max.z) / 2, I = x.getViewportFromCentreAndRadius(R, L, S, M, 40, M * 4); m(A, I); } }; }; }, /* 51 */ /***/ (o, a, c) => { var l = c(4), d = c(52)(l), h = c(3).Geometry, f = c(53), g = c(54).default, p = l.BufferGeometryLoader, u = function(y) { var v; y && y.isGeometry && (v = y); var m = void 0, x = void 0, w = !1, A = void 0, M = (T) => { var _ = v.getMorph().material.clone(); _.morphTargets = !1; var E = new h(), C = new p(), P = C.parse(T), b = new l.Mesh(P.geometry, _); return E.geometry = b.geometry, b.userData = E, E.setMorph(b), E; }, R = (T) => { switch (T.data.action) { case "message": console.log(T.data.message); break; case "result": var _ = new u(M(T.data.object)); A && A(_), A = void 0, w = !1; break; default: throw "Cannot handle specified action."; } }, L = (T) => { if (f !== void 0 && (x = f( /*require.resolve*/ 55 )), !x) m = new (c(56)).GeometryCSGInternal(T); else if (T && T.isGeometry) { var _ = T.getMorph(), E = _.geometry.clone().applyMatrix(_.matrix).toJSON(); x.addEventListener("message", function(C) { R(C); }), x.postMessage({ action: "initialise", object: E }); } }; this.getHostGeometry = () => { var T = new d(v.getMorph()); return new S(T); }, this.getGeometry = () => v; var S = (T) => { var _ = v.getMorph().material.clone(); _.morphTargets = !1; var E = T.toMesh(_), C = new h(); return C.geometry = E.geometry, E.userData = C, C.setMorph(E), C; }; this.setCSG = (T) => { m.setCSG(T); }; var I = (T, _, E, C) => { if (w) C("On progress"); else { var P = T.getMorph(), b = P.geometry.clone().applyMatrix(P.matrix).toJSON(); A = E, w = !0, x.postMessage({ action: _, object: b }); } }; this.intersect = (T) => new g((_, E) => { if (x) I(T, "intersect", _, E); else { var C = m.intersect(T), P = new u(S(C)); P.setCSG(C), _(P); } }), this.subtract = (T) => new g((_, E) => { if (x) I(T, "intersect", _, E); else { var C = m.subtract(T), P = new u(S(C)); P.setCSG(C), _(P); } }), this.union = (T) => new g((_, E) => { if (x) I(T, "intersect", _, E); else { var C = m.union(T), P = new u(S(C)); P.setCSG(C), _(P); } }), this.terminateWorker = () => { x && x.terminate(); }, L(y); }; a.GeometryCSG = u; }, /* 52 */ /***/ (o) => { var a = 1e-5, c = 0, l = 1, d = 2, h = 3; o.exports = function(f) { var g = function(p) { var u, y, v, m, x, w, A, M = []; if (p.isBufferGeometry && (p = new f.Geometry().fromBufferGeometry(p)), p instanceof f.Geometry) this.matrix = new f.Matrix4(); else if (p.isMesh) p.updateMatrix(), this.matrix = p.matrix.clone(), p = p.geometry, p.isBufferGeometry && (p = new f.Geometry().fromBufferGeometry(p)), p.mergeVertices(), p.computeVertexNormals(!1); else { if (p instanceof g.Node) return this.tree = p, this.matrix = new f.Matrix4(), this; throw "ThreeBSP: Given geometry is unsupported"; } for (u = 0, y = p.faces.length; u < y; u++) v = p.faces[u], x = p.faceVertexUvs[0][u], A = new g.Polygon(), v instanceof f.Face3 ? (m = p.vertices[v.a], w = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.b], w = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.c], w = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m)) : (f.Face4, m = p.vertices[v.a], w = x ? new f.Vector2(x[0].x, x[0].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[0], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.b], w = x ? new f.Vector2(x[1].x, x[1].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[1], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.c], w = x ? new f.Vector2(x[2].x, x[2].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[2], w), m.applyMatrix4(this.matrix), A.vertices.push(m), m = p.vertices[v.d], w = x ? new f.Vector2(x[3].x, x[3].y) : null, m = new g.Vertex(m.x, m.y, m.z, v.vertexNormals[3], w), m.applyMatrix4(this.matrix), A.vertices.push(m)), A.calculateProperties(), M.push(A); this.tree = new g.Node(M); }; return g.prototype.subtract = function(p) { var u = this.tree.clone(), y = p.tree.clone(); return u.invert(), u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.union = function(p) { var u = this.tree.clone(), y = p.tree.clone(); return u.clipTo(y), y.clipTo(u), y.invert(), y.clipTo(u), y.invert(), u.build(y.allPolygons()), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.intersect = function(p) { var u = this.tree.clone(), y = p.tree.clone(); return u.invert(), y.clipTo(u), y.invert(), u.clipTo(y), y.clipTo(u), u.build(y.allPolygons()), u.invert(), u = new g(u), u.matrix = this.matrix, u; }, g.prototype.toGeometry = function() { var p, u, y, v, m, x, w, A, M, R, L = new f.Matrix4().getInverse(this.matrix), S = new f.Geometry(), I = this.tree.allPolygons(), T = I.length, _ = {}; for (p = 0; p < T; p++) for (y = I[p], v = y.vertices.length, u = 2; u < v; u++) R = [], A = y.vertices[0], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof _[A.x + "," + A.y + "," + A.z] > "u" ? (S.vertices.push(A), m = _[A.x + "," + A.y + "," + A.z] = S.vertices.length - 1) : m = _[A.x + "," + A.y + "," + A.z], A = y.vertices[u - 1], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof _[A.x + "," + A.y + "," + A.z] > "u" ? (S.vertices.push(A), x = _[A.x + "," + A.y + "," + A.z] = S.vertices.length - 1) : x = _[A.x + "," + A.y + "," + A.z], A = y.vertices[u], R.push(new f.Vector2(A.uv.x, A.uv.y)), A = new f.Vector3(A.x, A.y, A.z), A.applyMatrix4(L), typeof _[A.x + "," + A.y + "," + A.z] > "u" ? (S.vertices.push(A), w = _[A.x + "," + A.y + "," + A.z] = S.vertices.length - 1) : w = _[A.x + "," + A.y + "," + A.z], M = new f.Face3(m, x, w, new f.Vector3(y.normal.x, y.normal.y, y.normal.z)), S.faces.push(M), S.faceVertexUvs[0].push(R); return S; }, g.prototype.toBufferGeometry = function() { var p = this.toGeometry(), u = new f.BufferGeometry().fromGeometry(p); return u; }, g.prototype.toMesh = function(p) { var u = this.toBufferGeometry(), y = new f.Mesh(u, p); return y.position.setFromMatrixPosition(this.matrix), y.rotation.setFromRotationMatrix(this.matrix), y; }, g.Polygon = function(p) { p instanceof Array || (p = []), this.vertices = p, 0 < p.length ? this.calculateProperties() : this.normal = this.w = void 0; }, g.Polygon.prototype.calculateProperties = function() { var p = this.vertices[0], u = this.vertices[1], y = this.vertices[2]; return this.normal = u.clone().subtract(p).cross(y.clone().subtract(p)).normalize(), this.w = this.normal.clone().dot(p), this; }, g.Polygon.prototype.clone = function() { var p, u, y = new g.Polygon(); for (p = 0, u = this.vertices.length; p < u; p++) y.vertices.push(this.vertices[p].clone()); return y.calculateProperties(), y; }, g.Polygon.prototype.flip = function() { var p, u = []; for (this.normal.multiplyScalar(-1), this.w *= -1, p = this.vertices.length - 1; 0 <= p; p--) u.push(this.vertices[p]); return this.vertices = u, this; }, g.Polygon.prototype.classifyVertex = function(p) { var u = this.normal.dot(p) - this.w; return u < -a ? d : u > a ? l : c; }, g.Polygon.prototype.classifySide = function(p) { var u, y, v, m = 0, x = 0, w = p.vertices.length; for (u = 0; u < w; u++) y = p.vertices[u], v = this.classifyVertex(y), v === l ? m++ : v === d && x++; return 0 < m && x === 0 ? l : m === 0 && 0 < x ? d : m === 0 && x === 0 ? c : h; }, g.Polygon.prototype.splitPolygon = function(p, u, y, v, m) { var x = this.classifySide(p); if (x === c) (0 < this.normal.dot(p.normal) ? u : y).push(p); else if (x === l) v.push(p); else if (x === d) m.push(p); else { var w, A, M, R, L, S, I, T, _, E = [], C = []; for (A = 0, w = p.vertices.length; A < w; A++) M = (A + 1) % w, S = p.vertices[A], I = p.vertices[M], R = this.classifyVertex(S), L = this.classifyVertex(I), R != d && E.push(S), R != l && C.push(S), (R | L) == h && (T = (this.w - this.normal.dot(S)) / this.normal.dot(I.clone().subtract(S)), _ = S.interpolate(I, T), E.push(_), C.push(_)); 3 <= E.length && v.push(new g.Polygon(E).calculateProperties()), 3 <= C.length && m.push(new g.Polygon(C).calculateProperties()); } }, g.Vertex = function(p, u, y, v, m) { this.x = p, this.y = u, this.z = y, this.normal = v || new f.Vector3(), this.uv = m || new f.Vector2(); }, g.Vertex.prototype.clone = function() { return new g.Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone()); }, g.Vertex.prototype.add = function(p) { return this.x += p.x, this.y += p.y, this.z += p.z, this; }, g.Vertex.prototype.subtract = function(p) { return this.x -= p.x, this.y -= p.y, this.z -= p.z, this; }, g.Vertex.prototype.multiplyScalar = function(p) { return this.x *= p, this.y *= p, this.z *= p, this; }, g.Vertex.prototype.cross = function(p) { var u = this.x, y = this.y, v = this.z; return this.x = y * p.z - v * p.y, this.y = v * p.x - u * p.z, this.z = u * p.y - y * p.x, this; }, g.Vertex.prototype.normalize = function() { var p = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); return this.x /= p, this.y /= p, this.z /= p, this; }, g.Vertex.prototype.dot = function(p) { return this.x * p.x + this.y * p.y + this.z * p.z; }, g.Vertex.prototype.lerp = function(p, u) { return this.add(p.clone().subtract(this).multiplyScalar(u)), this.normal.add(p.normal.clone().sub(this.normal).multiplyScalar(u)), this.uv.add(p.uv.clone().sub(this.uv).multiplyScalar(u)), this; }, g.Vertex.prototype.interpolate = function(p, u) { return this.clone().lerp(p, u); }, g.Vertex.prototype.applyMatrix4 = function(p) { var u = this.x, y = this.y, v = this.z, m = p.elements; return this.x = m[0] * u + m[4] * y + m[8] * v + m[12], this.y = m[1] * u + m[5] * y + m[9] * v + m[13], this.z = m[2] * u + m[6] * y + m[10] * v + m[14], this; }, g.Node = function(p) { var u, y, v = [], m = []; if (this.polygons = [], this.front = this.back = void 0, p instanceof Array && p.length !== 0) { for (this.divider = p[0].clone(), u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], this.polygons, this.polygons, v, m); 0 < v.length && (this.front = new g.Node(v)), 0 < m.length && (this.back = new g.Node(m)); } }, g.Node.isConvex = function(p) { var u, y; for (u = 0; u < p.length; u++) for (y = 0; y < p.length; y++) if (u !== y && p[u].classifySide(p[y]) !== d) return !1; return !0; }, g.Node.prototype.build = function(p) { var u, y, v = [], m = []; for (this.divider || (this.divider = p[0].clone()), u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], this.polygons, this.polygons, v, m); 0 < v.length && (!this.front && (this.front = new g.Node()), this.front.build(v)), 0 < m.length && (!this.back && (this.back = new g.Node()), this.back.build(m)); }, g.Node.prototype.allPolygons = function() { var p = this.polygons.slice(); return this.front && (p = p.concat(this.front.allPolygons())), this.back && (p = p.concat(this.back.allPolygons())), p; }, g.Node.prototype.clone = function() { var p = new g.Node(); return p.divider = this.divider.clone(), p.polygons = this.polygons.map(function(u) { return u.clone(); }), p.front = this.front && this.front.clone(), p.back = this.back && this.back.clone(), p; }, g.Node.prototype.invert = function() { var p, u, y; for (p = 0, u = this.polygons.length; p < u; p++) this.polygons[p].flip(); return this.divider.flip(), this.front && this.front.invert(), this.back && this.back.invert(), y = this.front, this.front = this.back, this.back = y, this; }, g.Node.prototype.clipPolygons = function(p) { var u, y, v, m; if (!this.divider) return p.slice(); for (v = [], m = [], u = 0, y = p.length; u < y; u++) this.divider.splitPolygon(p[u], v, m, v, m); return this.front && (v = this.front.clipPolygons(v)), m = this.back ? this.back.clipPolygons(m) : [], v.concat(m); }, g.Node.prototype.clipTo = function(p) { this.polygons = p.clipPolygons(this.polygons), this.front && this.front.clipTo(p), this.back && this.back.clipTo(p); }, g; }; }, /* 53 */ /***/ (o) => { o.exports = M4(); }, /* 54 */ /***/ (o) => { o.exports = R4; }, /* 55 */ /***/ (o, a, c) => { var l = c(3).Geometry, d = c(4), h = d.BufferGeometryLoader; o.exports = function(f) { var g = void 0, p = function(w) { var A = new h(), M = A.parse(w), R = new d.MeshPhongMaterial(), L = new d.Mesh(M.geometry, R), S = new l(); return S.setMorph(L), S; }, u = function(w) { var A = p(w); g = new (c(56)).GeometryCSGInternal(A), f.postMessage({ action: "message", message: "Initialised" }); }, y = function(w) { if (g) { var A = p(w), M = g.intersect(A), R = M.toBufferGeometry().toJSON(); f.postMessage({ action: "result", object: R }); } }, v = function(w) { if (g) { var A = p(w), M = g.subtract(A), R = M.toBufferGeometry().toJSON(); f.postMessage({ action: "result", object: R }); } }, m = function(w) { if (g) { var A = p(w), M = g.union(A), R = M.toBufferGeometry().toJSON(); f.postMessage({ action: "result", object: R }); } }; f.addEventListener("message", function(x) { switch (x.data.action) { case "initialise": u(x.data.object); break; case "intersect": y(x.data.object); break; case "subtract": v(x.data.object); break; case "union": m(x.data.object); break; default: throw "Cannot handle specified action."; } }); }; }, /* 56 */ /***/ (o, a, c) => { var l = c(4), d = c(52)(l); c(3).Geometry, c(51).GeometryCSG; var h = function(f) { var g; f && f.isGeometry && (g = f); var p; this.setGeometry = (y) => { y && y.isGeometry && (g = y), p = void 0; }, this.setCSG = (y) => { p = y; }; var u = (y) => { if (g && g.morph && y && y.morph) { p === void 0 && (p = new d(g.morph)); var v = new d(y.morph); return v; } }; this.intersect = (y) => { var v = u(y); return p && v ? p.intersect(v) : void 0; }, this.subtract = (y) => { var v = u(y); return p && v ? p.subtract(v) : void 0; }, this.union = (y) => { var v = u(y); return p && v ? p.union(v) : void 0; }; }; a.GeometryCSGInternal = h; }, /* 57 */ /***/ (o, a, c) => { var l = c(4), d = c(52)(l); c(18).Glyphset; var h = function(f) { var g; f && f.isGlyphset && (g = f); var p = []; this.setGlyphset = (v) => { v && v.isGlyphset && (g = v), hostCSG = void 0; }, this.getGlyphset = () => g; var u = () => (v) => { var m = v.getMesh(), x = v.getLabel(); if (m) { var w = new d(m.geometry.clone().applyMatrix(m.matrix)), A = []; A.csg = w, A.label = x, m.material && (A.material = m.material.clone()), p.push(A); } }, y = (v) => { if (g && v && v.getMorph()) { p.length == 0 && g.forEachGlyph(u()); var m = new d(v.getMorph()); return m; } }; this.intersect = (v) => { var m = y(v); if (0 < p.length && m) { for (var x = new (c(18)).Glyphset(), w = 0; w < p.length; w++) { var A = p[w], M = A.csg.intersect(m), R = M.toMesh(); if (R && R.geometry && 0 < R.geometry.vertices.length) { A.material && (R.material = A.material, R.material.side = l.DoubleSide, R.material.clippingPlanes = null); var L = x.addMeshAsGlyph(R, w + 1); L.setLabel(A.label); } } var S = new h(x); return S; } }; }; a.GlyphsetCSG = h; } /******/ ], i = {}; function r(o) { var a = i[o]; if (a !== void 0) return a.exports; var c = i[o] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; return t[o].call(c.exports, c, c.exports, r), c.exports; } r.n = (o) => { var a = o && o.__esModule ? ( /******/ () => o.default ) : ( /******/ () => o ); return r.d(a, { a }), a; }, r.d = (o, a) => { for (var c in a) r.o(a, c) && !r.o(o, c) && Object.defineProperty(o, c, { enumerable: !0, get: a[c] }); }, r.o = (o, a) => Object.prototype.hasOwnProperty.call(o, a), r.r = (o) => { typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(o, "__esModule", { value: !0 }); }; var s = r(0); return s; })() )); })(My); var Pr = My.exports; const Rc = /* @__PURE__ */ GC(Pr), Ai = { SELECTED_COLOUR: "#00ff00", HIGHLIGHTED_COLOUR: "#ff0000", DEFAULT_RADIUS: 1, DEFAULT_RADIAL_SEGMENTS: 8, ZOOM_RADIUS: 5, ZOOM_RADIAL_SEGMENTS: 12 }, Sv = (n, e) => { if (n) { let t = ""; n.forEach((i) => { t = i.uuid, i.region && (t = i.region.uuid + "/" + t), i && i.getVisibility() && e.push(t); }); } return e; }, Id = (n, e) => { const t = n[0] - e[0], i = n[1] - e[1], r = n[2] - e[2]; return Math.sqrt(t * t + i * i + r * r); }, F4 = (n) => { const e = n.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable && t.isLines2) { const i = n.identifiers[0].extraData.intersected; if (i && i.faceIndex > -1) { const r = t.getVerticesByFaceIndex(i.faceIndex), s = n.identifiers[0].extraData.intersected.pointOnLine; if (r.length > 1) { const o = Id(r[0], [s.x, s.y, s.z]), a = Id(r[1], [s.x, s.y, s.z]); return o > a ? { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2 + 1, point: r[0] } : { zincObject: t, faceIndex: i.faceIndex, vertexIndex: i.faceIndex * 2, point: r[1] }; } } } } }, P4 = (n) => { const e = n.zincObjects; if (e.length > 0 && e[0]) return e[0]; }, I4 = (n) => { const e = n.zincObjects; if (e.length > 0 && e[0]) { const t = e[0]; if (t.isEditable) return t; } }, O4 = (n, e, t) => { if (n != null && n.isEditable && (n != null && n.isPointset)) { let i = !1; for (let r = 0; r < 3 && !i; r++) t[r] !== 0 && (i = !0); if (i && e > -1) { const r = n.getVerticesByIndex(e); return r && (r[0] = r[0] + t[0], r[1] = r[1] + t[1], r[2] = r[2] + t[2]), n.editVertices([r], e), n.boundingBoxUpdateRequired = !0, !0; } } return !1; }, Mc = (n, e) => { if (n != null && n.isEditable && (n != null && n.isLines2) && e > -1) { const t = n.getVerticesByFaceIndex(e); if (t && t.length > 1) return Id(t[1], t[0]); } return 0; }, Fh = (n, e, t, i) => { if (n && t !== 0 && n.isEditable && n.isLines2 && e > -1) { const r = n.getVerticesByFaceIndex(e); let s = [r[1][0] - r[0][0], r[1][1] - r[0][1], r[1][2] - r[0][2]]; const o = Math.sqrt(s[0] * s[0] + s[1] * s[1] + s[2] * s[2]); for (let a = 0; a < 3; a++) s[a] = s[a] / o * t, i ? r[1][a] = r[0][a] + s[a] : (r[0][a] = r[0][a] + s[a], r[1][a] = r[1][a] + s[a]); return n.editVertices(r, e * 2), n.boundingBoxUpdateRequired = !0, !0; } return !1; }, D4 = (n, e) => { const t = e.getBoundingBox(), i = new Pr.THREE.Vector3().subVectors(t.max, t.min), r = new Pr.THREE.BoxGeometry(i.x, i.y, i.z); i.addVectors(t.min, t.max).multiplyScalar(0.5); const s = r.getAttribute("position"), o = s.count, a = []; for (let c = 0; c < o; c++) a[c] = [ s.array[c * 3], s.array[c * 3 + 1], s.array[c * 3 + 2] ]; n.editVertices(a, 0), n.setPosition(i.x, i.y, i.z), r.dispose(); }, yM = (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) => yM(i, e)); }, xo = (n, e, t, i) => { let r = n; const s = []; if (t && (r = n.findChildFromPath(t)), r) { const o = Array.isArray(e); let a = e; o || (a = [a]), a.forEach((c) => { const l = r.findObjectsWithGroupName(c, i); s.push(...l); }); } return s; }, Od = (n, e, t) => { const i = n.findIndex((s) => s.uuid === e); let r; return i > -1 && (r = n[i], t && n.splice(i, 1)), r; }, N4 = (n, e) => { const t = []; if (n && e && e.length > 0) { const i = {}, r = {}, s = [n, ...n.getChildRegions(!0)]; let o, a, c; e.forEach((l) => { const d = l.split("/"); c = d[0], o = Od(s, c, !1), o && (r[c] || (r[c] = o.getFullPath()), d[1] ? (i[c] || (i[c] = o.getAllObjects(!1)), a = Od(i[c], d[1], !0), a && t.push(`${r[c]}/${a.groupName}`)) : t.push(`__r/${r[c]}`)); }); } return t; }, B4 = (n) => { if (n) { const e = []; return n.forEach((i) => { i.isZincObject ? e.push(i) : i.isRegion && e.push(...i.getAllObjects(!0)); }), Object.values( e.reduce((i, r) => ({ ...i, [r.uuid]: r }), {}) ); } return []; }, _v = (n, e) => { const t = { label: "Multiple selections", regionPath: "", objects: [] }; if (e && n) { const i = {}, r = n.getRootRegion(); e.length > 0 && (t.regionPath = e[0].data.region, t.label = e[0].data.group), e.forEach((s) => { s.data.region.includes(t.regionPath) || (t.regionPath = ""), t.label !== s.data.group && (t.label = "Multiple selections"); const o = r.findChildFromPath(s.data.region); i[o.uuid] || (i[o.uuid] = o.getAllObjects(!1)); const a = Od(i[o.uuid], s.data.uuid); a && t.objects.push(a); }); } return t; }, U4 = (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; }, bM = (n, e, t, i, r) => { let s; n.isPointset ? s = "MultiPoint" : n.isLines2 ? s = "MultiLineString" : s = "Feature"; const o = s !== "Feature", a = s === "Feature" ? "Feature annotation" : "Drawn annotation"; if (s) { const c = U4(n); let l = e.slice(-1) === "/" ? e : e + "/"; l = l + t; const d = l, h = { resource: i, item: { id: d }, body: { evidence: [], comment: r }, feature: { id: d, properties: { drawn: o, label: a }, geometry: { coordinates: c, type: s } } }; return r === "Deleted" && (h.feature = void 0), h; } }, Tv = (n, e, t, i, r, s, o) => { const a = bM(t, i, r, s, o); if (a) return n && n.currentUser && (a.creator = { ...n.currentUser }, a.creator.orcid || (a.creator.orcid = "0000-0000-0000-0000"), n.addAnnotation(e, a).then((c) => { c.annotationId || console.log("There is a problem with the submission, please try again later"); }).catch(() => { console.log("There is a problem with the submission, please try again later"); })), a; }, Ev = async (n, e, t) => { const i = t; return await n.drawnFeatures(e, i); }, Cv = (n, e) => { n && e.forEach((t) => { const i = t.geometry, r = decodeURIComponent(t.id), s = r.lastIndexOf("/"), o = r.substring(0, s), a = r.substring(s + 1); let c; i.type === "MultiPoint" ? c = n.createPoints( o, a, i.coordinates, a, 8942 ) : i.type === "MultiLineString" && (c = n.createLines( o, a, i.coordinates, 60962 )), c && (c.zincObject.isEditable = !0); }); }, pp = function(n) { const e = []; for (let t = 0; t < n.length; t++) { let i = n[t].userData; if (i) if (i.isGlyph || i.isGlyphset) { let r = i; i.isGlyph && (r = i.getGlyphset()), e.push(r); } else e.push(i); } return e; }, mr = (n, e) => { const t = n.__vccOpts || n; for (const [i, r] of e) t[i] = r; return t; }, z4 = { name: "LinesControls", components: { Button: Ko, Col: bi, Container: zi, InputNumber: dr, Main: hr, Slider: ti, ElIconArrowLeft: zr, ElIconArrowRight: Vr }, props: { createData: { type: Object }, usageConfig: { type: Object } }, data: function() { return { adjust: 0, pAdjust: 0, lengthScale: 0, distance: 0, newDistance: 0, width: 1, radius: Ai.DEFAULT_RADIUS, radialSegments: Ai.DEFAULT_RADIAL_SEGMENTS, currentIndex: 0, ElIconArrowLeft: En(zr), ElIconArrowRight: En(Vr), edited: !1, zincObject: void 0, isTubeLines: !1 }; }, computed: { showTubeLinesControls() { return this.usageConfig.showTubeLinesControls; } }, watch: { "createData.faceIndex": { handler: function(n) { var e; (e = this.zincObject) != null && e.isLines2 && (this.currentIndex = n, this.distance = Mc(this.zincObject, this.currentIndex)); }, immediate: !0 } }, methods: { changeIndex: function(n) { n ? Mc(this.zincObject, this.currentIndex + 1) > 0 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset()); }, onLengthInput: function() { this.newDistance !== 0 ? (this.distance = this.newDistance, this.edited = Fh( this.zincObject, this.currentIndex, this.newDistance, !0 ) || this.edited) : this.newDistance = this.distance; }, onLengthSliding: function() { this.newDistance = Math.pow(10, this.lengthScale) * this.distance, this.edited = Fh( this.zincObject, this.currentIndex, this.newDistance, !0 ) || this.edited; }, onMoveSliding: function() { const n = (this.adjust - this.pAdjust) * this.distance; this.edited = Fh( this.zincObject, this.currentIndex, n, !1 ) || this.edited, this.pAdjust = this.adjust; }, reset: function() { this.adjust = 0, this.pAdjust = 0, this.lengthScale = 0, this.distance = Mc(this.zincObject, this.currentIndex), this.newDistance = this.distance, this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1); }, setObject: function(n) { var e; this.currentIndex = -1, this.distance = 0, n.isLines2 || n.isTubeLines ? (this.zincObject = An(n), this.width = this.zincObject.getMorph().material.linewidth, this.isTubeLines = n.isTubeLines, n.isEditable ? (this.currentIndex = 0, this.distance = Mc(n, this.currentIndex)) : (e = n.userData) != null && e.isNerves && (this.radius = Ai.ZOOM_RADIUS, this.radialSegments = Ai.ZOOM_RADIAL_SEGMENTS)) : (this.zincObject = void 0, this.width = 10); }, modifyWidth: function() { this.zincObject.setWidth(this.width); }, modifyTubeLines: function() { this.zincObject.setTubeLines(this.radius, this.radius * this.radialSegments); } } }; function V4(n, e, t, i, r, s) { const o = bi, a = ti, c = dr, l = Ui, d = Ko, h = hr, f = zi; return ve(), ke(f, { class: "lines-container" }, { default: de(() => [ oe(h, { class: "slides-block" }, { default: de(() => [ n.isTubeLines && s.showTubeLinesControls ? (ve(), Le(Pt, { key: 0 }, [ oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[15] || (e[15] = [ rt(" Radius: ") ])), _: 1 }), oe(o, { offset: 0, span: 12 }, { default: de(() => [ oe(a, { modelValue: n.radius, "onUpdate:modelValue": e[0] || (e[0] = (g) => n.radius = g), class: "my-slider", step: 1, min: 1, max: 32, "show-tooltip": !1, onInput: s.modifyTubeLines }, null, 8, ["modelValue", "onInput"]) ]), _: 1 }), oe(o, { offset: 0, span: 4 }, { default: de(() => [ oe(c, { modelValue: n.radius, "onUpdate:modelValue": e[1] || (e[1] = (g) => n.radius = g), step: 1, min: 1, max: 32, controls: !1, onChange: s.modifyTubeLines, class: "input-box number-input" }, null, 8, ["modelValue", "onChange"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[16] || (e[16] = [ rt(" Radial Segments: ") ])), _: 1 }), oe(o, { offset: 0, span: 12 }, { default: de(() => [ oe(a, { modelValue: n.radialSegments, "onUpdate:modelValue": e[2] || (e[2] = (g) => n.radialSegments = g), class: "my-slider", step: 1, min: 8, max: 32, "show-tooltip": !1, onInput: s.modifyTubeLines }, null, 8, ["modelValue", "onInput"]) ]), _: 1 }), oe(o, { offset: 0, span: 4 }, { default: de(() => [ oe(c, { modelValue: n.radialSegments, "onUpdate:modelValue": e[3] || (e[3] = (g) => n.radialSegments = g), step: 1, min: 8, max: 32, controls: !1, onChange: s.modifyTubeLines, class: "input-box number-input" }, null, 8, ["modelValue", "onChange"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : n.isTubeLines ? Ve("", !0) : (ve(), ke(l, { key: 1 }, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[17] || (e[17] = [ rt(" Width: ") ])), _: 1 }), oe(o, { offset: 0, span: 12 }, { default: de(() => [ oe(a, { modelValue: n.width, "onUpdate:modelValue": e[4] || (e[4] = (g) => n.width = g), class: "my-slider", step: 1, min: 1, max: 100, "show-tooltip": !1, onInput: s.modifyWidth }, null, 8, ["modelValue", "onInput"]) ]), _: 1 }), oe(o, { offset: 0, span: 4 }, { default: de(() => [ oe(c, { modelValue: n.width, "onUpdate:modelValue": e[5] || (e[5] = (g) => n.width = g), step: 1, min: 1, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 })), n.currentIndex > -1 && n.distance > 0 ? (ve(), Le(Pt, { key: 2 }, [ oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 4 }, { default: de(() => [ oe(d, { size: "small", disabled: n.currentIndex === 0, icon: n.ElIconArrowLeft, onClick: e[6] || (e[6] = (g) => s.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), oe(o, { offset: 4, span: 9 }, { default: de(() => [ rt(" Editing Line " + vt(n.currentIndex + 1), 1) ]), _: 1 }), oe(o, { offset: 2, span: 2 }, { default: de(() => [ oe(d, { size: "small", icon: n.ElIconArrowRight, onClick: e[7] || (e[7] = (g) => s.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[18] || (e[18] = [ rt(" Move: ") ])), _: 1 }), oe(o, { offset: 0, span: 16 }, { default: de(() => [ oe(a, { modelValue: n.adjust, "onUpdate:modelValue": e[8] || (e[8] = (g) => n.adjust = g), step: 0.01, min: -3, max: 3, "show-tooltip": !1, onInput: e[9] || (e[9] = (g) => s.onMoveSliding()), onChange: e[10] || (e[10] = (g) => s.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[19] || (e[19] = [ rt(" Length: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.lengthScale, "onUpdate:modelValue": e[11] || (e[11] = (g) => n.lengthScale = g), step: 0.01, min: -1, max: 1, "show-tooltip": !1, onInput: e[12] || (e[12] = (g) => s.onLengthSliding()), onChange: e[13] || (e[13] = (g) => s.reset()) }, null, 8, ["modelValue"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.newDistance, "onUpdate:modelValue": e[14] || (e[14] = (g) => n.newDistance = g), controls: !1, class: "input-box number-input", onChange: s.onLengthInput }, null, 8, ["modelValue", "onChange"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ve("", !0) ]), _: 1 }) ]), _: 1 }); } const xM = /* @__PURE__ */ mr(z4, [["render", V4], ["__scopeId", "data-v-0deb177d"]]), k4 = { name: "PointsControls", components: { Col: bi, Container: zi, InputNumber: dr, Main: hr, Select: qo, Slider: ti, Row: Ui, Option: Qo, ElIconArrowLeft: zr, ElIconArrowRight: Vr }, inject: ["boundingDims"], data: function() { return { attenuation: !1, size: 10, choices: [ { value: !0, label: "On" }, { value: !1, label: "off" } ], min: [0, 0, 0], max: [1, 1, 1], translation: [0, 0, 0], pTranslation: [0, 0, 0], currentIndex: -1, ElIconArrowLeft: En(zr), ElIconArrowRight: En(Vr), edited: !1, zincObject: void 0 }; }, watch: { boundingDims: { handler: function(n) { const e = n.size; this.min = [ -e[0] / 2, -e[1] / 2, -e[2] / 2 ], this.max = [ e[0] / 2, e[1] / 2, e[2] / 2 ]; }, immediate: !0, deep: !0 } }, methods: { changeIndex: function(n) { n ? this.zincObject.drawRange > this.currentIndex + 1 && (this.currentIndex++, this.reset()) : (this.currentIndex--, this.reset()); }, onMoveSliding: function() { const n = [ this.translation[0] - this.pTranslation[0], this.translation[1] - this.pTranslation[1], this.translation[2] - this.pTranslation[2] ]; this.edited = O4(this.zincObject, this.currentIndex, n) || this.edited; for (let e = 0; e < 3; e++) this.pTranslation[e] = this.translation[e]; }, reset: function() { this.translation = [0, 0, 0], this.pTranslation = [0, 0, 0], this.edited && (this.$emit("primitivesUpdated", this.zincObject), this.edited = !1); }, setObject: function(n) { this.currentIndex = -1, n.isPointset ? (this.zincObject = An(n), this.size = this.zincObject.morph.material.size, this.attenuation = this.zincObject.morph.material.sizeAttenuation, n.isEditable && this.zincObject.drawRange > 0 && (this.currentIndex = 0)) : (this.zincObject = void 0, this.size = 10, this.attenuation = !1); }, modifyAttenuation: function(n) { this.attenuation = n, this.zincObject.setSizeAttenuation(n); }, modifySize: function() { this.zincObject.setSize(this.size); } } }; function G4(n, e, t, i, r, s) { const o = bi, a = ti, c = dr, l = Ui, d = Qo, h = qo, f = Ko, g = hr, p = zi; return ve(), ke(p, { class: "pointset-container" }, { default: de(() => [ oe(g, { class: "slides-block" }, { default: de(() => [ oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[15] || (e[15] = [ rt(" Size: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.size, "onUpdate:modelValue": e[0] || (e[0] = (u) => n.size = u), class: "my-slider", step: 1, min: 0, max: 100, "show-tooltip": !1, onInput: e[1] || (e[1] = (u) => s.modifySize()) }, null, 8, ["modelValue"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.size, "onUpdate:modelValue": e[2] || (e[2] = (u) => n.size = u), step: 1, min: 0, max: 100, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 16 }, { default: de(() => e[16] || (e[16] = [ rt(" Size attenuation: ") ])), _: 1 }), oe(o, { offset: 0, span: 5 }, { default: de(() => [ oe(h, { teleported: !1, "model-value": n.attenuation, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: e[3] || (e[3] = (u) => s.modifyAttenuation(u, n.slide)) }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(n.choices, (u) => (ve(), ke(d, { key: u.value, label: u.label, value: u.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]), _: 1 }) ]), _: 1 }), n.currentIndex > -1 ? (ve(), Le(Pt, { key: 0 }, [ oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 4 }, { default: de(() => [ oe(f, { size: "small", disabled: n.currentIndex === 0, icon: n.ElIconArrowLeft, onClick: e[4] || (e[4] = (u) => s.changeIndex(!1)) }, null, 8, ["disabled", "icon"]) ]), _: 1 }), oe(o, { offset: 4, span: 9 }, { default: de(() => [ rt(" Editing Point " + vt(n.currentIndex + 1), 1) ]), _: 1 }), oe(o, { offset: 2, span: 2 }, { default: de(() => [ oe(f, { size: "small", icon: n.ElIconArrowRight, onClick: e[5] || (e[5] = (u) => s.changeIndex(!0)) }, null, 8, ["icon"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[17] || (e[17] = [ rt(" x: ") ])), _: 1 }), oe(o, { offset: 0, span: 16 }, { default: de(() => [ oe(a, { modelValue: n.translation[0], "onUpdate:modelValue": e[6] || (e[6] = (u) => n.translation[0] = u), step: 0.01, min: n.min[0], max: n.max[0], "show-tooltip": !1, onInput: e[7] || (e[7] = (u) => s.onMoveSliding()), onChange: e[8] || (e[8] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[18] || (e[18] = [ rt(" y: ") ])), _: 1 }), oe(o, { offset: 0, span: 16 }, { default: de(() => [ oe(a, { modelValue: n.translation[1], "onUpdate:modelValue": e[9] || (e[9] = (u) => n.translation[1] = u), step: 0.01, min: n.min[1], max: n.max[1], "show-tooltip": !1, onInput: e[10] || (e[10] = (u) => s.onMoveSliding()), onChange: e[11] || (e[11] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), oe(l, null, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[19] || (e[19] = [ rt(" z: ") ])), _: 1 }), oe(o, { offset: 0, span: 16 }, { default: de(() => [ oe(a, { modelValue: n.translation[2], "onUpdate:modelValue": e[12] || (e[12] = (u) => n.translation[2] = u), step: 0.01, min: n.min[2], max: n.max[2], "show-tooltip": !1, onInput: e[13] || (e[13] = (u) => s.onMoveSliding()), onChange: e[14] || (e[14] = (u) => s.reset()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }) ], 64)) : Ve("", !0) ]), _: 1 }) ]), _: 1 }); } const MM = /* @__PURE__ */ mr(k4, [["render", G4], ["__scopeId", "data-v-d1de9c65"]]), H4 = { name: "TextureSlidesControls", components: { Col: bi, Container: zi, Footer: dy, Icon: It, InputNumber: dr, Main: hr, Row: Ui, Select: qo, Slider: ti, Option: Qo, ElIconDelete: Nc, ElIconPlus: tu }, data: function() { return { settings: [], directions: [ { value: "x", label: "x" }, { value: "y", label: "y" }, { value: "z", label: "z" } ], zincObject: void 0 }; }, methods: { setObject: function(n) { n.isTextureSlides ? (this.zincObject = An(n), this.settings = this.zincObject.getTextureSettings()) : (this.zincObject = void 0, this.settings = []); }, addNewSlide: function() { const n = { direction: "x", value: 0 }, e = this.zincObject.createSlide(n); this.settings.push(e); }, modifyDirection: function(n, e) { e && (e.direction = n, this.zincObject.modifySlideSettings(e)); }, modifySlide: function(n) { n && this.zincObject.modifySlideSettings(n); }, removeSlide: function(n, e) { this.zincObject.removeSlideWithId(e.id), this.settings.splice(n, 1); } } }; function W4(n, e, t, i, r, s) { const o = Qo, a = qo, c = bi, l = ti, d = dr, h = Nc, f = It, g = Ui, p = hr, u = tu, y = dy, v = zi; return ve(), ke(v, { class: "t-slides-container" }, { default: de(() => [ oe(p, { class: "slides-block" }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(n.settings, (m, x) => (ve(), ke(g, { key: m.id, class: "slide-row" }, { default: de(() => [ oe(c, { offset: 0, span: 6 }, { default: de(() => [ oe(a, { teleported: !1, "model-value": m.direction, placeholder: "Select", class: "input-box", "popper-class": "viewer_dropdown", onChange: (w) => s.modifyDirection(w, m) }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(n.directions, (w) => (ve(), ke(o, { key: w.value, label: w.label, value: w.value }, null, 8, ["label", "value"]))), 128)) ]), _: 2 }, 1032, ["model-value", "onChange"]) ]), _: 2 }, 1024), oe(c, { offset: 0, span: 10 }, { default: de(() => [ oe(l, { modelValue: m.value, "onUpdate:modelValue": (w) => m.value = w, class: "my-slider", step: 0.01, min: 0, max: 1, "show-tooltip": !1, onInput: (w) => s.modifySlide(m) }, null, 8, ["modelValue", "onUpdate:modelValue", "onInput"]) ]), _: 2 }, 1024), oe(c, { offset: 0, span: 6 }, { default: de(() => [ oe(d, { modelValue: m.value, "onUpdate:modelValue": (w) => m.value = w, step: 0.01, min: 0, max: 1, controls: !1, class: "input-box number-input" }, null, 8, ["modelValue", "onUpdate:modelValue"]) ]), _: 2 }, 1024), oe(c, { offset: 0, span: 2 }, { default: de(() => [ oe(f, { class: "delete-icon", onClick: (w) => s.removeSlide(x, m) }, { default: de(() => [ oe(h) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024) ]), _: 2 }, 1024))), 128)) ]), _: 1 }), oe(y, { height: "30px", class: "add-slides-text", onClick: s.addNewSlide }, { default: de(() => [ oe(g, null, { default: de(() => [ oe(c, { span: 2 }, { default: de(() => [ oe(f, null, { default: de(() => [ oe(u) ]), _: 1 }) ]), _: 1 }), oe(c, { span: 20 }, { default: de(() => e[0] || (e[0] = [ rt(" Add a new slide ") ])), _: 1 }) ]), _: 1 }) ]), _: 1 }, 8, ["onClick"]) ]), _: 1 }); } const wM = /* @__PURE__ */ mr(H4, [["render", W4], ["__scopeId", "data-v-12185b7f"]]), j4 = { name: "TransformationControls", components: { Col: bi, Container: zi, InputNumber: dr, Main: hr, Slider: ti }, inject: ["boundingDims"], data: function() { return { x: 0, y: 0, z: 0, scale: 1, min: [0, 0, 0], max: [1, 1, 1], zincObject: void 0, enableScaling: !0 }; }, watch: { boundingDims: { handler: function(n) { const e = n.centre, t = n.size; this.min = [ e[0] - t[0], e[1] - t[1], e[2] - t[2] ], this.max = [ e[0] + t[0], e[1] + t[1], e[2] + t[2] ]; }, immediate: !0, deep: !0 } }, methods: { setObject: function(n) { if (n.isZincObject) { this.zincObject = An(n); const e = this.zincObject.getGroup(), t = this.zincObject.userData.originalPos; e && e.position && (this.x = e.position.x, this.y = e.position.y, this.z = e.position.z, this.zincObject.isGlyphset ? this.scale = this.zincObject.globalScale : this.scale = e.scale.x, this.enableScaling = !this.zincObject.isTextureSlides, t && this.boundingDims && (this.min = [ t[0] - this.boundingDims.size[0], t[1] - this.boundingDims.size[1], t[2] - this.boundingDims.size[2] ], this.max = [ t[0] + this.boundingDims.size[0], t[1] + this.boundingDims.size[1], t[2] + this.boundingDims.size[2] ])); } else this.zincObject = void 0, this.x = 0, this.y = 0, this.z = 0, this.scale = 1; }, modifyPosition: function() { this.zincObject && this.zincObject.setPosition(this.x, this.y, this.z); }, modifyScale: function() { this.zincObject.setScaleAll(this.scale); } } }; function $4(n, e, t, i, r, s) { const o = bi, a = ti, c = dr, l = Ui, d = hr, h = zi; return ve(), ke(h, { class: "transformation-container" }, { default: de(() => [ oe(d, { class: "slides-block" }, { default: de(() => [ oe(l, { class: "tool-row" }, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[16] || (e[16] = [ rt(" x: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.x, "onUpdate:modelValue": e[0] || (e[0] = (f) => n.x = f), step: 0.01, min: n.min[0], max: n.max[0], "show-tooltip": !1, onInput: e[1] || (e[1] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.x, "onUpdate:modelValue": e[2] || (e[2] = (f) => n.x = f), step: 0.01, min: n.min[0], max: n.max[0], controls: !1, class: "input-box number-input", onChange: e[3] || (e[3] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), oe(l, { class: "tool-row" }, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[17] || (e[17] = [ rt(" y: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.y, "onUpdate:modelValue": e[4] || (e[4] = (f) => n.y = f), step: 0.01, min: n.min[1], max: n.max[1], "show-tooltip": !1, onInput: e[5] || (e[5] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.y, "onUpdate:modelValue": e[6] || (e[6] = (f) => n.y = f), step: 0.01, min: n.min[1], max: n.max[1], controls: !1, class: "input-box number-input", onChange: e[7] || (e[7] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), oe(l, { class: "tool-row" }, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[18] || (e[18] = [ rt(" z: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.z, "onUpdate:modelValue": e[8] || (e[8] = (f) => n.z = f), step: 0.01, min: n.min[2], max: n.max[2], "show-tooltip": !1, onInput: e[9] || (e[9] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.z, "onUpdate:modelValue": e[10] || (e[10] = (f) => n.z = f), step: 0.01, min: n.min[2], max: n.max[2], controls: !1, class: "input-box number-input", onChange: e[11] || (e[11] = (f) => s.modifyPosition()) }, null, 8, ["modelValue", "min", "max"]) ]), _: 1 }) ]), _: 1 }), n.enableScaling ? (ve(), ke(l, { key: 0, class: "tool-row" }, { default: de(() => [ oe(o, { offset: 0, span: 6 }, { default: de(() => e[19] || (e[19] = [ rt(" Scale: ") ])), _: 1 }), oe(o, { offset: 0, span: 10 }, { default: de(() => [ oe(a, { modelValue: n.scale, "onUpdate:modelValue": e[12] || (e[12] = (f) => n.scale = f), step: 0.01, min: 0, max: 5, "show-tooltip": !1, onInput: e[13] || (e[13] = (f) => s.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }), oe(o, { offset: 0, span: 6 }, { default: de(() => [ oe(c, { modelValue: n.scale, "onUpdate:modelValue": e[14] || (e[14] = (f) => n.scale = f), step: 0.01, min: 0, max: 5, controls: !1, class: "input-box number-input", onChange: e[15] || (e[15] = (f) => s.modifyScale()) }, null, 8, ["modelValue"]) ]), _: 1 }) ]), _: 1 })) : Ve("", !0) ]), _: 1 }) ]), _: 1 }); } const AM = /* @__PURE__ */ mr(j4, [["render", $4], ["__scopeId", "data-v-cd88ead8"]]), Z4 = { name: "OpacityControls", components: { Container: zi, Header: jL, Main: hr, Slider: ti }, props: { material: void 0, zincObject: void 0 }, data: function() { return { displayString: "100%" }; }, watch: { "material.opacity": function() { this.material && this.zincObject && this.zincObject.setAlpha(this.material.opacity); } }, methods: { formatTooltip(n) { return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString; } } }, X4 = { class: "block" }, Y4 = { class: "display" }; function J4(n, e, t, i, r, s) { const o = ti, a = zi; return t.material ? (ve(), ke(a, { key: 0, class: "opacity-container" }, { default: de(() => [ Ne("div", X4, [ Ne("span", Y4, vt(n.displayString), 1), oe(o, { modelValue: t.material.opacity, "onUpdate:modelValue": e[0] || (e[0] = (c) => t.material.opacity = c), class: "my-slider", step: 0.01, min: 0, max: 1, "format-tooltip": s.formatTooltip, "show-tooltip": !1 }, null, 8, ["modelValue", "format-tooltip"]) ]) ]), _: 1 })) : Ve("", !0); } const SM = /* @__PURE__ */ mr(Z4, [["render", J4], ["__scopeId", "data-v-cbfc46a5"]]), K4 = { name: "PrimitiveControls", components: { Collapse: oy, CollapseItem: ay, LinesControls: xM, OpacityControls: SM, PointsControls: MM, TextureSlidesControls: wM, TransformationControls: AM, ElIconArrowRight: Vr }, props: { createData: { type: Object }, viewingMode: { type: String, default: "Exploration" }, usageConfig: { type: Object } }, data: function() { return { activeName: "oControls", material: void 0, isTextureSlides: !1, isPointset: !1, isLines: !1, drawerOpen: !0, zincObject: void 0, isEditable: !1, displayString: "100%" }; }, computed: { hasValidPrimitive: function() { return this.viewingMode === "Exploration" || this.viewingMode === "Annotation" ? this.material !== void 0 || this.isTextureSlides === !0 : !1; } }, methods: { formatTooltip: function(n) { return this.displayString = Math.floor(100 * n + 0.5) + "%", this.displayString; }, toggleDrawer: function() { this.drawerOpen = !this.drawerOpen; }, setObject: function(n) { var e, t; n ? this.zincObject = An(n) : this.zincObject = void 0, this.isEditable = !!((e = this.zincObject) != null && e.isEditable), this.isPointset = !1, this.isTextureSlides = !1, this.isLines = !1, this.activeName = "trControls", n && (n.isTextureSlides ? (this.isTextureSlides = !0, this.$refs.tSlidesControls.setObject(n), this.activeName = "tsControls") : n.isPointset ? (this.isPointset = !0, this.$refs.pointsetControls.setObject(n), this.activeName = "pControls") : (n.isLines2 || n.isTubeLines && ((t = this.usageConfig) != null && t.showTubeLinesControls)) && (this.isLines = !0, this.$refs.linesControls.setObject(n), this.activeName = "lControls"), this.$refs.transformationControls.setObject(n)), n && n.getMorph() ? this.material = n.getMorph().material : this.material = void 0; } } }; function q4(n, e, t, i, r, s) { const o = SM, a = ay, c = AM, l = wM, d = MM, h = xM, f = oy, g = Vr, p = It; return Lt((ve(), Le("div", { class: Ee(["primitive-controls", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ Ne("div", { class: Ee(["my-drawer", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ oe(f, { class: "collapse", modelValue: n.activeName, "onUpdate:modelValue": e[2] || (e[2] = (u) => n.activeName = u), accordion: "" }, { default: de(() => [ Lt(oe(a, { title: "Opacity", name: "oControls" }, { default: de(() => [ oe(o, { material: n.material, zincObject: n.zincObject, ref: "opacityControls" }, null, 8, ["material", "zincObject"]) ]), _: 1 }, 512), [ [mn, !n.isTextureSlides] ]), Lt(oe(a, { title: "Transformation", name: "trControls" }, { default: de(() => [ oe(c, { class: "transformation-controls", ref: "transformationControls" }, null, 512) ]), _: 1 }, 512), [ [mn, !n.isEditable] ]), Lt(oe(a, { title: "Texture Slides", name: "tsControls" }, { default: de(() => [ oe(l, { class: "texture-controls", ref: "tSlidesControls" }, null, 512) ]), _: 1 }, 512), [ [mn, n.isTextureSlides] ]), Lt(oe(a, { title: "Points", name: "pControls" }, { default: de(() => [ oe(d, { class: "pointset-controls", ref: "pointsetControls", onPrimitivesUpdated: e[0] || (e[0] = (u) => n.$emit("primitivesUpdated", u)) }, null, 512) ]), _: 1 }, 512), [ [mn, n.isPointset] ]), Lt(oe(a, { title: "Lines", name: "lControls" }, { default: de(() => [ oe(h, { class: "lines-controls", ref: "linesControls", createData: t.createData, usageConfig: t.usageConfig, onPrimitivesUpdated: e[1] || (e[1] = (u) => n.$emit("primitivesUpdated", u)) }, null, 8, ["createData", "usageConfig"]) ]), _: 1 }, 512), [ [mn, n.isLines] ]) ]), _: 1 }, 8, ["modelValue"]) ], 2), Ne("div", { class: Ee(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]), onClick: e[3] || (e[3] = (...u) => s.toggleDrawer && s.toggleDrawer(...u)) }, [ oe(p, null, { default: de(() => [ oe(g) ]), _: 1 }) ], 2) ], 2)), [ [mn, s.hasValidPrimitive] ]); } const _M = /* @__PURE__ */ mr(K4, [["render", q4], ["__scopeId", "data-v-83d11562"]]), Q4 = (n, e) => { const t = n.label.toUpperCase(), i = e.label.toUpperCase(); return t < i ? -1 : t > i ? 1 : 0; }, e5 = { name: "ScaffoldTreeControls", components: { ElIconArrowLeft: zr, TreeControls: qM }, props: { /** * Enable/disable colour picker */ showColourPicker: Boolean, isReady: Boolean }, data: function() { return { treeData: [ { label: "Root", regionPath: "", id: void 0, children: [] } ], active: [], hover: [], drawerOpen: !0, nodeNumbers: 0, module: void 0 //checkedRegions: [], }; }, computed: { treeDataEntry: function() { return this.treeData[0].children; } }, watch: { treeDataEntry: { deep: !0, handler: function(n) { this.isReady && this.setColourField(n); } } /* checkedRegions: { deep: true, handler: function (data) { if (this.isReady) { this.$emit('checked-regions', data); } }, }, */ }, methods: { addTreeItem: function(n, e, t) { n.some((i) => i.label === e.label) || (Object.assign(e, { activeColour: this.getColour(e) }), n.push(e), n.sort((i, r) => Q4(i, r)), this.nodeNumbers++, this.$nextTick(() => { !this.$refs.treeControls.$refs.regionTree.getCheckedKeys().includes(e.id) && t.getVisibility() && this.$refs.treeControls.$refs.regionTree.setChecked(e.id, !0); })); }, // find or create new region, region id is always prefixed with // '__r/' findOrCreateRegion: function(n, e, t) { if (this.module && this.module.scene && (this.treeData[0].id = this.module.scene.getRootRegion().uuid, this.treeData[0].isRegion = !0), e.length > 0) { const i = [...e]; let r = n.children.find( (a) => a.label == i[0] ); const s = t + "/" + e[0], o = this.module.scene.getRootRegion().findChildFromPath(s); return r || (r = { label: i[0], id: o.uuid, children: [], regionPath: s, isRegion: !0 }, this.addTreeItem(n.children, r, o), s === "/_helper" && this.$nextTick(() => { this.$refs.treeControls.$refs.regionTree.setChecked(r.id, !1); })), i.shift(), this.findOrCreateRegion(r, i, s); } else return n; }, removeRegion: function(n) { if (this.treeData[0].children) { for (let e = 0; e < this.treeData[0].children.length; e++) if (this.treeData[0].children[e].label === n) { this.treeData[0].children.splice(e, 1), this.nodeNumbers--; return; } } }, /** * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(n) { const e = n.region; if (e) { const t = e.getFullSeparatedPath(), i = this.findOrCreateRegion(this.treeData[0], t, ""); if (n.groupName && i) { i.children || (i.children = []); const r = { disabled: !1, label: n.groupName, id: e.uuid + "/" + n.uuid, isPrimitives: !0, regionPath: n.region.getFullPath(), isTextureSlides: !!n.isTextureSlides }; this.addTreeItem(i.children, r, n); } } }, zincObjectRemoved: function(n) { const e = n.groupName; if (n.region.findObjectsWithGroupName(e, !1).length === 0) { const i = n.region.getFullSeparatedPath(), r = this.findOrCreateRegion(this.treeData[0], i, ""); if (r.children) { for (let s = 0; s < r.children.length; s++) if (r.children[s].label === e) { r.children.splice(s, 1), this.nodeNumbers--; return; } } } }, checkChanged: function(n, e) { const t = n.isRegion, i = n.isPrimitives, r = e.checkedKeys.includes(n.id), s = this.module.scene.getRootRegion().findChildFromPath(n.regionPath); t && (r ? s.showAllPrimitives() : s.hideAllPrimitives()), i && s.findObjectsWithGroupName(n.label).forEach((a) => { const c = r && !n.disabled; a.setVisibility(c); }); }, updateActiveUI: function(n) { this.active.length = 0, Sv(n, this.active); }, changeActiveByPrimitives: function(n, e) { n && n.length > 0 ? (this.updateActiveUI(n), this.$emit("object-selected", n, e)) : this.removeActive(e), this.removeHover(e); }, updateHoverUI: function(n) { this.hover.length = 0, Sv(n, this.hover); }, changeHoverByPrimitives: function(n, e) { n && n.length > 0 ? (this.updateHoverUI(n), this.$emit("object-hovered", n, e)) : this.removeHover(e); }, /** * Select a region by its name. */ changeActiveByNames: function(n, e, t) { const i = this.module.scene.getRootRegion(), r = xo( i, n, e, !0 ); this.changeActiveByPrimitives(r, t); }, /** * Hover a region by its name. */ changeHoverByNames: function(n, e, t) { const i = this.module.scene.getRootRegion(), r = xo( i, n, e, !0 ); this.changeHoverByPrimitives(r, t); }, changeActiveByNode: function(n, e) { if (n.isPrimitives || n.isRegion) { const t = !!n.isRegion, i = this.getZincObjectsFromNode(n, t); this.changeActiveByPrimitives(i, e); } }, changeHoverByNode: function(n, e) { if (n.isPrimitives) { const t = this.getZincObjectsFromNode(n, !1); this.changeHoverByPrimitives(t, e); } }, /** * Unselect the current selected region. */ removeActive: function(n) { this.active = [], this.$emit("object-selected", [], n); }, /** * Unselect the current hover region. */ removeHover: function(n) { this.hover = [], this.$emit("object-hovered", [], n); }, /** * Reset the controls. */ clear: function() { this.active.length = 0, this.hover.length = 0, this.nodeNumbers = 0, this.$refs.treeControls.$refs.regionTree.updateKeyChildren( this.treeData[0].id, [] ), this.treeData[0].children.length = 0, this.treeData[0].id = void 0, this.$emit("object-selected", []); }, forEachChildInNode: function(n, e, t, i, r) { if (n.isRegion) { if (n.children) { const s = t === "" || e.includes(n.id); n.children.forEach( (o) => this.forEachChildInNode( o, e, n.regionPath, i && s, r ) ); } } else n.isPrimitives && r(n, t, i); }, getColour: function(n) { if (n) { let t = this.getZincObjectsFromNode(n, !1)[0]; if (t) { let i = t.getColourHex(); if (i) return "#" + i; } } return "#FFFFFF"; }, getNodeDataByRegionAndGroup: function(n, e) { for (const t of this.treeDataEntry) if (t.isRegion && t.label === n) { const i = t.children; for (const r of i) if (r.isPrimitives && r.label === e) return r; } }, getZincObjectsFromNode: function(n, e) { const t = this.module.scene.getRootRegion(); if (n.isPrimitives) return xo( t, n.label, n.regionPath, e ); if (n.isRegion && n.regionPath) { let i = t.findChildFromPath(n.regionPath); if (i) return i.getAllObjects(e); } return []; }, //Set this right at the beginning. setModule: function(n) { this.module = An(n), this.nodeNumbers = 0, this.module.scene.getRootRegion().getAllObjects(!0).forEach((t) => { this.zincObjectAdded(t); }), this.module.addOrganPartAddedCallback(this.zincObjectAdded), this.module.addOrganPartRemovedCallback(this.zincObjectRemoved); }, setColourField: function(n, e = void 0) { n.filter((t) => e && !t.children ? t.id === e.id : !0).map((t) => { if (t.children) this.setColourField(t.children, e); else { const i = this.getColour(t); t.defaultColour || (t.defaultColour = i), t.activeColour = i; } }); }, setColour: function(n, e) { n && n.isPrimitives && this.getZincObjectsFromNode(n, !1).forEach((i) => { let s = (e || n.defaultColour).replace("#", "0x"); i.setColourHex(s), this.setColourField(this.treeData[0].children, n); }); }, updateAllNodeColours: function() { const n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys(); this.forEachChildInNode( this.treeData[0], n, "", !0, (e, t, i) => { e.isPrimitives && (e.activeColour = this.getColour(e)); } ); }, setOutlines: function(n) { const e = this.$refs.treeControls.$refs.regionTree.getCheckedKeys(); this.forEachChildInNode( this.treeData[0], e, "", !0, (t, i, r) => { const o = this.module.scene.getRootRegion().findChildFromPath(i).findObjectsWithGroupName(t.label); n ? o.forEach((a) => { a.isLines && (e.includes(t.id) && r && a.setVisibility(!0), t.disabled = !1); }) : t.isPrimitives && o.forEach((a) => { a.isLines && (a.setVisibility(!1), t.disabled = !0); }); } ); }, visibilityToggle: function(n, e) { this.module.changeOrganPartsVisibility(n, e), e == !1 && (this.activeRegion === n && this.removeActive(!0), this.hoverRegion === n && this.removeHover(!0)); }, toggleDrawer: function() { this.drawerOpen = !this.drawerOpen, this.$emit("drawer-toggled", this.drawerOpen); }, //Set visibility using full paths and add found id to the ids list //and remove item from list if remove is set to true. setTreeVisibilityWithFullPaths: function(n, e, t, i) { let r = !1, s = ""; n.isRegion && (s = `__r${n.regionPath}`), n.isPrimitives && (s = `${n.regionPath}/${n.label}`); const o = e.indexOf(s); o > -1 && (r = !0, e.splice(o, 1), t.push(n.id)); const a = this.module.scene.getRootRegion().findChildFromPath(n.regionPath); s && s !== "__r" && n.isPrimitives && a.findObjectsWithGroupName(n.label).forEach((l) => l.setVisibility(r)), n.children && n.children.forEach((c) => { this.setTreeVisibilityWithFullPaths(c, e, t, !0); }); }, setCheckedKeys: function(n, e) { this.$nextTick(() => { e && this.$refs.treeControls.$refs.regionTree.setCheckedKeys([]), n.forEach((t) => { this.$refs.treeControls.$refs.regionTree.setChecked(t, !0, !0); }); }); }, checkAllKeys: function(n = []) { const e = [], t = []; yM(this.treeData[0], e); const i = e.filter((r) => !n.some((s) => r.includes(s))); this.setTreeVisibilityWithFullPaths( this.treeData[0], i, t, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t); }, getState: function() { let n = this.$refs.treeControls.$refs.regionTree.getCheckedKeys(); return n.length === this.nodeNumbers ? { checkAll: !0, version: "2.0" } : { checkedItems: N4( this.module.scene.getRootRegion(), n ), version: "2.0" }; }, setState: function(n) { if (n) { if (n.checkAll) this.checkAllKeys(); else if (n.checkedItems) { let e = []; n.version !== "2.0" ? (e = n.checkedItems.map((i) => "/" + i), e.shift("__r/")) : e.push(...n.checkedItems); const t = []; this.setTreeVisibilityWithFullPaths( this.treeData[0], e, t, !0 ), this.$refs.treeControls.$refs.regionTree.setCheckedKeys(t); } } } } }, t5 = { class: "traditional-container" }; function n5(n, e, t, i, r, s) { const o = kn("TreeControls"), a = zr, c = It; return ve(), Le("div", { class: Ee(["tree-controls", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ Ne("div", t5, [ oe(o, { mapType: "scaffold", title: "Regions", isReady: t.isReady, treeData: s.treeDataEntry, active: n.active, hover: n.hover, showColourPicker: t.showColourPicker, onSetColour: s.setColour, onCheckChanged: s.checkChanged, onChangeActive: s.changeActiveByNode, onChangeHover: s.changeHoverByNode, ref: "treeControls", onMouseleave: e[0] || (e[0] = (l) => s.removeHover(!0)) }, null, 8, ["isReady", "treeData", "active", "hover", "showColourPicker", "onSetColour", "onCheckChanged", "onChangeActive", "onChangeHover"]) ]), Ne("div", { class: Ee(["drawer-button", { open: n.drawerOpen, close: !n.drawerOpen }]), onClick: e[1] || (e[1] = (...l) => s.toggleDrawer && s.toggleDrawer(...l)) }, [ oe(c, null, { default: de(() => [ oe(a) ]), _: 1 }) ], 2) ], 2); } const TM = /* @__PURE__ */ mr(e5, [["render", n5], ["__scopeId", "data-v-5394b615"]]), Dd = nw("main", { state: () => ({ userProfile: { token: "" } }), getters: { userToken(n) { return n.userProfile.token; } }, actions: { setUserToken(n) { this.userProfile.token = n; } } }), i5 = { name: "ScaffoldTooltip", components: { Col: bi, CreateTooltipContent: QM, ElIconDelete: Nc, Icon: It, Popover: cu, Row: Ui, Tooltip: ew }, props: { createData: { type: Object, default: { toBeConfirmed: !1, points: [], shape: "", x: 0, y: 0 } }, label: { type: String, default: "" }, annotationDisplay: { type: Boolean, default: !1 }, annotationFeature: { type: Object, default: {} }, offlineAnnotationEnabled: { type: Boolean, default: !1 }, region: { type: String, default: "" }, visible: { type: Boolean, default: !1 }, x: { type: Number, default: 200 }, y: { type: Number, default: 200 } }, inject: ["scaffoldUrl"], provide() { return { userApiKey: this.userToken }; }, data: function() { return { display: !1, annotationEntry: [], ElIconDelete: En(Nc) }; }, computed: { ...Gv(Dd, ["userToken"]), position: function() { let n = 40; return this.region && (n = 55), { left: this.x - 40 + "px", top: this.y - n + "px" }; } }, methods: { checkForDisplay: function() { if (this.visible && this.label && this.label !== "") { if (this.display = !0, this.annotationDisplay) { const n = this.region ? this.region + "/" : ""; this.annotationEntry = [{ featureId: n + this.label, resourceId: this.scaffoldUrl, resource: this.scaffoldUrl, feature: this.annotationFeature, offline: this.offlineAnnotationEnabled }]; } } else this.display = !1, this.annotationEntry = []; }, hideTriggered: function() { this.$emit("tooltip-hide"); } }, watch: { label: { handler: function() { this.checkForDisplay(); }, immediate: !0 }, visible: { handler: function() { this.checkForDisplay(); }, immediate: !0 }, annotationDisplay: { handler: function() { this.checkForDisplay(); }, immediate: !0 } } }, r5 = { class: "tooltip-text" }, s5 = { key: 0, class: "tooltip-text" }, o5 = { key: 1, class: "delete-container" }; function a5(n, e, t, i, r, s) { const o = kn("CreateTooltipContent"), a = kn("Tooltip"), c = bi, l = Ko, d = Ui, h = cu; return ve(), Le("div", { style: Rt(s.position), class: "region-tooltip" }, [ oe(h, { ref: "tooltip", visible: t.visible, placement: "top", "show-arrow": !1, teleported: !1, trigger: "manual", "popper-class": "tooltip-popper non-selectable", "virtual-triggering": "", onHide: s.hideTriggered }, { default: de(() => [ Ne("div", r5, vt(t.label), 1), t.region ? (ve(), Le("div", s5, "Region: " + vt(t.region), 1)) : Ve("", !0), Lt(oe(o, { createData: t.createData, onConfirmCreate: e[0] || (e[0] = (f) => n.$emit("confirm-create", f)), onCancelCreate: e[1] || (e[1] = (f) => n.$emit("cancel-create")) }, null, 8, ["createData"]), [ [mn, t.createData.toBeConfirmed] ]), Lt(oe(a, { class: "p-tooltip", ref: "annotationTooltip", annotationDisplay: !0, annotationEntry: n.annotationEntry, onAnnotation: e[2] || (e[2] = (f) => n.$emit("confirm-comment", f)) }, null, 8, ["annotationEntry"]), [ [mn, t.annotationDisplay && !t.createData.toBeConfirmed] ]), t.createData.toBeDeleted ? (ve(), Le("div", o5, [ oe(d, null, { default: de(() => [ oe(c, { span: 10 }, { default: de(() => e[5] || (e[5] = [ rt("Delete this feature?") ])), _: 1 }), oe(c, { span: 7 }, { default: de(() => [ oe(l, { class: "delete-button", icon: n.ElIconDelete, onClick: e[3] || (e[3] = (f) => n.$emit("confirm-delete")) }, { default: de(() => e[6] || (e[6] = [ rt(" Delete ") ])), _: 1 }, 8, ["icon"]) ]), _: 1 }), oe(c, { span: 6 }, { default: de(() => [ oe(l, { class: "delete-button", onClick: e[4] || (e[4] = (f) => n.$emit("cancel-create")) }, { default: de(() => e[7] || (e[7] = [ rt(" Dismiss ") ])), _: 1 }) ]), _: 1 }) ]), _: 1 }) ])) : Ve("", !0) ]), _: 1 }, 8, ["visible", "onHide"]) ], 4); } const EM = /* @__PURE__ */ mr(i5, [["render", a5], ["__scopeId", "data-v-d3f76b72"]]), Qa = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 }, l5 = function(n, e, t) { this.eventType = n, this.identifiers = e, this.zincObjects = t; }, c5 = function(n, e, t) { this.targetedID = []; const i = n, r = e; this.targetEventType = t; const s = this; t === void 0 && (this.targetEventType = Qa.ALL), this.getEventType = function() { return t; }, this.notify = function(o, a, c, l) { if (o !== i && (s.targetEventType === Qa.ALL || s.targetEventType === a)) { const d = new l5(a, c, l); r(d); } }; }, u5 = 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 c5(e, t, i); return n.push(r), r; } }, this.unsubscribe = function(e) { for (let t = 0; t < n.length; t++) if (e === n[t]) { n.splice(t, 1); return; } }; }, Lv = { isWebGLAvailable: function() { try { var n = document.createElement("canvas"); return !!(window.WebGLRenderingContext && (n.getContext("webgl") || n.getContext("experimental-webgl"))); } catch { return !1; } }, isWebGL2Available: function() { try { var n = document.createElement("canvas"); return !!(window.WebGL2RenderingContext && n.getContext("webgl2")); } catch { return !1; } }, getWebGLErrorMessage: function() { return this.getErrorMessage(1); }, getWebGL2ErrorMessage: function() { return this.getErrorMessage(2); }, getErrorMessage: function(n) { var e = { 1: "WebGL", 2: "WebGL 2" }, t = { 1: window.WebGLRenderingContext, 2: window.WebGL2RenderingContext }, i = 'This module requires $1 support but your $0 does not seem to support it.', r = document.createElement("div"); return r.id = "webglmessage", r.style.fontFamily = "monospace", r.style.fontSize = "20px", r.style.fontWeight = "normal", r.style.textAlign = "center", r.style.background = "#fff", r.style.color = "#000", r.style.padding = "1.5em", r.style.width = "400px", r.style.margin = "5em auto 0", t[n] ? i = i.replace("$0", "graphics card") : i = i.replace("$0", "browser"), i = i.replace("$1", e[n]), r.innerHTML = i, r; } }, mp = { ALL: 0, DESTROYED: 1, NAME_CHANGED: 2, SETTINGS_CHANGED: 3 }, Zn = function() { this.typeName = "Base Module", this.instanceName = "default", this.onChangedCallbacks = [], this.eventNotifiers = []; }; Zn.prototype.setName = function(n) { if (n && this.instanceName !== n) { this.instanceName = n; const e = this.onChangedCallbacks.slice(); for (let t = 0; t < e.length; t++) e[t](this, mp.NAME_CHANGED); } }; Zn.prototype.settingsChanged = function() { const n = this.onChangedCallbacks.slice(); for (let e = 0; e < n.length; e++) n[e](this, mp.SETTINGS_CHANGED); }; Zn.prototype.exportSettings = function() { const n = {}; return n.dialog = this.typeName, n.name = this.instanceName, n; }; Zn.prototype.importSettings = function(n) { return n.dialog == this.typeName ? (this.setName(n.name), !0) : !1; }; Zn.prototype.publishChanges = function(n, e, t) { for (let i = 0; i < this.eventNotifiers.length; i++) this.eventNotifiers[i].publish(this, e, n, t); }; Zn.prototype.getName = function() { return this.instanceName; }; Zn.prototype.destroy = function() { const n = this.onChangedCallbacks.slice(); for (let e = 0; e < n.length; e++) n[e](this, mp.DESTROYED); delete this; }; Zn.prototype.addChangedCallback = function(n) { this.onChangedCallbacks.includes(n) == !1 && this.onChangedCallbacks.push(n); }; Zn.prototype.removeChangedCallback = function(n) { const e = this.onChangedCallbacks.indexOf(n); e > -1 && this.onChangedCallbacks.splice(e, 1); }; Zn.prototype.addNotifier = function(n) { this.eventNotifiers.push(n); }; const wc = (n, e, t) => { for (let i = 0; i < n.length; i++) if (n[i] && n[i].material && n[i].material.emissive) { let r = n[i].userData; r && r.isZincObject ? r.setEmissiveRGB(e) : n[i].material && n[i].material.emissive && n[i].material.emissive.setRGB(...e), t && n[i].material.depthFunc && (n[i].material.depthFunc = Pr.THREE.LessEqualDepth), n[i].children.forEach((s) => { const o = s.userData; o && o.isZincObject && s.material && s.material.emissive && s.material.emissive.setRGB(...e); }); } }, h5 = function() { let n = [], e = []; this.highlightColour = [1, 0, 0], this.selectColour = [0, 1, 0], this.originalColour = [0, 0, 0]; const t = [], i = [], r = this, s = function(c, l) { if (c.length == 0 && l.length == 0) return !1; for (let d = 0; d < c.length; d++) { let h = !1; for (let f = 0; f < l.length; f++) c[d] === l[f] && (h = !0); if (!h) return !0; } for (let d = 0; d < l.length; d++) { let h = !1; for (let f = 0; f < c.length; f++) l[d] === c[f] && (h = !0); if (!h) return !0; } return !1; }, o = function(c, l) { if (t.length = 0, l.length == 0) return c; for (let d = 0; d < c.length; d++) { let h = !1; for (let f = 0; f < l.length; f++) c[d] === l[f] && (h = !0); h || t.push(c[d]); } return t; }; this.setHighlighted = function(c) { const l = [...n]; this.setNervesStyle(l), r.resetHighlighted(); const d = o(c, e), h = a(d); return this.setNervesStyle(d, Ai.HIGHLIGHTED_COLOUR), wc(h, r.highlightColour, !1), n = d, s(n, l); }, this.setSelected = function(c) { const l = [...e]; this.setNervesStyle(l), r.resetHighlighted(), r.resetSelected(); const d = a(c); return this.setNervesStyle(c, Ai.SELECTED_COLOUR), wc(d, r.selectColour, !1), e = c, s(e, l); }; const a = function(c) { i.length = 0; for (let l = 0; l < c.length; l++) c[l].material && i.push(c[l]); return i; }; this.setNervesStyle = function(c, l) { const d = pp(c); if (d && d.length) { const h = l ? Ai.ZOOM_RADIUS : Ai.DEFAULT_RADIUS, f = l ? Ai.ZOOM_RADIAL_SEGMENTS : Ai.DEFAULT_RADIAL_SEGMENTS; d.forEach((g) => { var p, u, y; if (g.isTubeLines && ((p = g.userData) != null && p.isNerves) && !((u = g.userData) != null && u.isGreyScale)) { g.setTubeLines(h, f); let v = l || ((y = g.userData) == null ? void 0 : y.defaultColour); v = v.replace("#", "0x"), g.setColourHex(v); } }); } }, this.resetHighlighted = function() { const c = a(n); this.setNervesStyle(n), wc(c, r.originalColour, !0), n = []; }, this.resetSelected = function() { const c = a(e); this.setNervesStyle(n), wc(c, r.originalColour, !0), e = []; }, this.getSelected = function() { return e; }, this.reset = function() { r.resetSelected(), r.resetHighlighted(); }; }, gp = Rc.THREE, d5 = function() { const n = document.createElement("div"); let e; if (n.style.height = "100%", Lv.isWebGLAvailable()) e = new Rc.Renderer(n, window), Rc.defaultMaterialColor = 16777116, e.initialiseVisualisation(), e.playAnimation = !1; else { const t = Lv.getWebGLErrorMessage(); n.appendChild(t); } return { Zinc: Rc, renderer: e, container: n }; }, Kt = function() { Zn.call(this), this.scene = void 0, this.rendererContainer = void 0, this.displayArea = void 0, this.graphicsHighlight = new h5(), this.selectObjectOnPick = !0, this.zincRenderer = null, this.selectedScreenCoordinates = new gp.Vector3(), this.selectedCenter = void 0, this.liveUpdatesObjects = void 0, this.ignorePreviousSelected = !1; }; Kt.prototype = Object.create(Zn.prototype); Kt.prototype.getIntersectedObject = function(n) { if (n) { const e = n.map((i) => { if (i && i.object && i.object.userData) { if (i.object.userData.isMarker) return 1; if (i.object.name && i.object.userData.isZincObject) return i.object.name === "_Unnamed" ? 3 : 2; } return 0; }); let t = e.indexOf(1); return t > -1 || (t = e.indexOf(2), t = t > -1 ? t : e.indexOf(3)), n[t]; } }; Kt.prototype.getAnnotationsFromObjects = function(n) { const e = []; for (var t = 0; t < n.length; t++) { const i = n[t].userData; let r; if (i) { if (i.isGlyph || i.isGlyphset) { let s = i; i.isGlyph && (s = i.getGlyphset()), r = s.userData ? s.userData.annotation : void 0, r && r.data && (n[t].name && n[t].name != "" ? r.data.id = n[t].name : r.data.id = s.groupName); } else r = i.userData ? i.userData.annotation : void 0, r && r.data && (r.data.id = n[t].name); r && (r.data.anatomicalId = i.anatomicalId, r.data.isNerves = i.userData.isNerves, r.data.zincObject = i); } r && e.push(r); } return e; }; Kt.prototype.setHighlightedByObjects = function(n, e, t, i) { const r = pp(n), s = this.graphicsHighlight.setHighlighted(n); if (i) { let o = Qa.MOVE; s && (o = Qa.HIGHLIGHTED); const a = this.getAnnotationsFromObjects(n); a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, r); } return s; }; Kt.prototype.setHighlightedByZincObjects = function(n, e, t, i) { let r = []; return n && n.forEach((s) => { s && s.getMorph() && r.push(s.getMorph()); }), this.setHighlightedByObjects(r, e, t, i); }; Kt.prototype.setupLiveCoordinates = function(n) { if (this.liveUpdatesObjects = n, n && n.length > 0) { const e = this.scene.getBoundingBoxOfZincObjects(n); let t = new gp.Vector3(); e ? (e.getCenter(t), this.selectedCenter == null ? this.selectedCenter = t : this.selectedCenter.copy(t)) : this.selectedCenter = void 0; } else this.selectedCenter = void 0; }; Kt.prototype.setSelectedByObjects = function(n, e, t, i) { let r = !1; if (this.selectObjectOnPick ? r = this.graphicsHighlight.setSelected(n) : r = !0, r || this.ignorePreviousSelected) { const s = pp(n); if (this.selectObjectOnPick && this.setupLiveCoordinates(s), i) { const o = Qa.SELECTED, a = this.getAnnotationsFromObjects(n); a.length > 0 && (a[0].coords = e, a[0].extraData = t), this.publishChanges(a, o, s); } } return r; }; Kt.prototype.setSelectedByZincObjects = function(n, e, t, i) { let r = []; return n && n.forEach((s) => { if (s) { const o = s.getMorph(); o && r.push(o); } }), this.setSelectedByObjects(r, e, t, i); }; Kt.prototype.findObjectsByGroupName = function(n) { return this.scene.findObjectsWithGroupName(n); }; Kt.prototype.setHighlightedByGroupName = function(n, e) { const t = this.findObjectsByGroupName(n); return this.setHighlightedByObjects(t, void 0, {}, e); }; Kt.prototype.setSelectedByGroupName = function(n, e) { const t = this.findObjectsByGroupName(n); return this.setSelectedByObjects(t, void 0, {}, e); }; Kt.prototype.changeBackgroundColour = function(n) { const e = new gp.Color(n); this.zincRenderer && this.zincRenderer.getThreeJSRenderer().setClearColor(e, 1); }; Kt.prototype.resetView = function() { this.zincRenderer && this.zincRenderer.resetView(); }; Kt.prototype.viewAll = function() { this.zincRenderer && this.zincRenderer.viewAll(); }; Kt.prototype.playAnimation = function(n) { this.zincRenderer && (this.zincRenderer.playAnimation = n); }; Kt.prototype.setPlayRate = function(n) { this.zincRenderer && this.zincRenderer.setPlayRate(n); }; Kt.prototype.getPlayRate = function(n) { return this.zincRenderer ? this.zincRenderer.getPlayRate() : 0; }; Kt.prototype.initialiseRenderer = function(n) { if (this.zincRenderer === void 0 || this.rendererContainer === void 0) { let e = d5(); this.Zinc = e.Zinc, this.zincRenderer = e.renderer, this.rendererContainer = e.container; } n && (this.displayArea = n, this.displayArea.appendChild(this.rendererContainer), this.zincRenderer && this.zincRenderer.animate()); }; Kt.prototype.destroy = function() { this.zincRenderer && (this.zincRenderer.dispose(), this.zincRenderer.getThreeJSRenderer().dispose(), this.zincRenderer = void 0), Zn.prototype.destroy.call(this); }; const f5 = function() { this.type = "anatomical", this.data = void 0, this.isAnnotation = !0; }, p5 = function() { this.currentName = "", this.currentSystem = "", this.currentPart = "", this.currentSpecies = "", this.metaURL = "", this.viewURL = "", this.timeVarying = !1, this.currentTime = 0; }, CM = function(n) { Kt.call(this); const e = this; let t; this.sceneData = new p5(); const i = new Array(), r = new Array(), s = new Array(), o = new Array(); let a, c; const l = n; this.NDCCameraControl = void 0, e.typeName = "Organ Viewer"; let d = !1; this.isIgnorePicking = function() { return d; }, this.setIgnorePicking = function(T) { d = T; }, this.getSceneData = function() { return e.sceneData; }, this.updateTime = function(T) { let _ = 6e3; e.scene && (_ = e.scene.getDuration()); const E = T / 100 * _; e.sceneData.nerveMapIsActive || e.scene && e.scene.setMorphsTime(E), e.sceneData.currentTime = T; }; const h = function() { let T = 3e3; e.scene && (T = e.scene.getDuration()); const _ = e.zincRenderer.getCurrentTime(); for (let E = 0; E < i.length; E++) i[E](_); !e.sceneData.nerveMapIsActive && t && t.setMorphsTime(_), e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setTime(_ / T), e.sceneData.currentTime = _ / T * 100; }; this.getCurrentTime = function() { return e.sceneData.currentTime; }, this.toggleSyncControl = (T, _) => { let E = this.scene.getZincCameraControls(); T ? (E.resetView(), this.NDCCameraControl = E.enableSyncControl(), E.setRotationMode(_)) : (E.disableSyncControl(), this.NDCCameraControl = void 0, E.setRotationMode("free")); }, this.isSyncControl = () => this.NDCCameraControl !== void 0, this.setSyncControlZoomToBox = (T) => { this.NDCCameraControl && this.NDCCameraControl.zoomToBox(T, 2); }, this.setSyncControlCallback = (T) => { this.NDCCameraControl && this.NDCCameraControl.setEventCallback(T); }, this.setSyncControlCenterZoom = (T, _) => { this.NDCCameraControl && this.NDCCameraControl.setCenterZoom(T, _); }; const f = function() { if (e.zincRenderer.playAnimation && e.liveUpdatesObjects && e.setupLiveCoordinates(e.liveUpdatesObjects), e.selectedCenter) { const T = new Pr.THREE.Vector3(); T.copy(e.selectedCenter); const _ = e.scene.vectorToScreenXY(T); e.selectedScreenCoordinates.x = _.x, e.selectedScreenCoordinates.y = _.y; } }, g = function() { return function() { h(); }; }, p = function() { return function() { f(); }; }; this.addTimeChangedCallback = function(T) { i.push(T); }, this.setTexturePos = function(T) { e.sceneData.nerveMap && e.sceneData.nerveMap.additionalReader && e.sceneData.nerveMap.additionalReader.setSliderPos(T); }, this.addSceneChangedCallback = function(T) { r.push(T); }, this.addOrganPartAddedCallback = function(T) { s.push(T); }, this.addOrganPartRemovedCallback = function(T) { o.push(T); }, this.setFinishDownloadCallback = function(T) { a = T; }, this.unsetFinishDownloadCallback = function() { a = void 0; }, this.setDownloadErrorCallback = function(T) { c = T; }, this.unsetDownloadErrorCallback = function() { c = void 0; }, this.getNamedObjectsToScreenCoordinates = function(T, _) { const E = new Pr.THREE.Vector3(); E.setFromMatrixPosition(obj.matrixWorld); const C = width / 2, P = height / 2; return E.project(_), E.x = E.x * C + C, E.y = -(E.y * P) + P, E; }; const u = function(T) { let _, E; if (T !== void 0) { let C = !1; T.object.userData && T.object.userData.isMarker ? (C = !0, E = T.object.userData.parent.getMorph()) : E = T.object; try { E.userData.userData.annotation.data.lastActionOnMarker = C; } finally { } if (E) if (E.name) _ = E.name; else { const P = e.getAnnotationsFromObjects( [E] ); P && P[0] && (_ = P[0].data.group); } } return { id: _, object: E }; }, y = function() { return function(T, _, E) { var D; const C = e.getIntersectedObject(T), P = u(C), b = { worldCoords: [ C ? C.point.x : 0, C ? C.point.y : 0, C ? C.point.z : 0 ], intersected: C, intersects: T }, F = { x: _, y: E }; if (P.id) { b.threeID = (D = P.object) == null ? void 0 : D.id, P.object.userData.isGlyph ? P.object.name ? e.setSelectedByObjects( [P.object], F, b, !0 ) : e.setSelectedByZincObjects( P.object.userData.getGlyphset(), F, b, !0 ) : e.setSelectedByObjects([P.object], F, b, !0); return; } else { if (d) return; e.setSelectedByObjects([], F, b, !0); } }; }, v = function() { return function(T, _, E) { var D; const C = e.getIntersectedObject(T), P = u(C), b = { worldCoords: [ C ? C.point.x : 0, C ? C.point.y : 0, C ? C.point.z : 0 ] }, F = { x: _, y: E }; if (P.id) { b.threeID = (D = P.object) == null ? void 0 : D.id, e.displayArea.style.cursor = "pointer", e.setHighlightedByObjects([P.object], F, b, !0); return; } else e.displayArea.style.cursor = "auto", e.setHighlightedByObjects([], F, b, !0); }; }, m = function(T, _, E, C) { if (C == "all" || C == "geometries") { const P = T.findGeometriesWithGroupName(_); for (let b = 0; b < P.length; b++) P[b].setVisibility(E); } if (C == "all" || C == "glyphsets") { const P = T.findGlyphsetsWithGroupName(_); for (let b = 0; b < P.length; b++) P[b].setVisibility(E); } if (C == "all" || C == "pointsets") { const P = T.findPointsetsWithGroupName(_); for (let b = 0; b < P.length; b++) P[b].setVisibility(E); } if (C == "all" || C == "lines") { const P = T.findLinesWithGroupName(_); for (let b = 0; b < P.length; b++) P[b].setVisibility(E); } }; this.changeGeometriesVisibility = function(T, _) { m(e.scene, T, _, "geometries"); }, this.changeGlyphsetsVisibility = function(T, _) { m(e.scene, T, _, "glyphsets"); }, this.changeLinesVisibility = function(T, _) { m(e.scene, T, _, "lines"); }, this.changePointsetsVisibility = function(T, _) { m(e.scene, T, _, "pointsets"); }, this.changeOrganPartsVisibility = function(T, _, E) { let C = "all"; E !== void 0 && (C = E), m(e.scene, T, _, C); }, this.changeOrganPartsVisibilityCallback = function(T) { return function(_) { e.changeOrganPartsVisibility(T, _); }; }, this.changeBackgroundColour = function(T) { const _ = new Pr.THREE.Color(T); e.zincRenderer && e.zincRenderer.getThreeJSRenderer().setClearColor(_, 1); }; const x = function(T, _, E, C) { for (let F = 0; F < s.length; F++) s[F](C, e.scene.isTimeVarying()); const P = new f5(), b = C.region.getFullPath(); P.data = { species: e.sceneData.currentSpecies, system: T, part: _, group: C.groupName, region: b, uuid: C.uuid, lastActionOnMarker: !1 }, C.userData.annotation = P; }, w = function(T, _, E, C) { for (let P = 0; P < o.length; P++) o[P](C); }, A = function(T, _, E) { return function(C) { x(T, _, E, C); }; }, M = function(T, _, E) { return function(C) { w(T, _, E, C); }; }, R = function() { return function() { e.settingsChanged(), e.sceneData.timeVarying = e.scene.isTimeVarying(), a && a(); }; }, L = function() { return function(T) { if ((T == null ? void 0 : T.type) === "Error" && c) { const _ = { xhr: T.xhr, type: "download-error" }; c(_); } }; }; this.updateFieldvisibility = function(T, _) { for (let E = 0; E < T.length; E++) if (_ != E) { const C = T[E].PartName; e.changeOrganPartsVisibility(C, !1); } if (_ > -1) { const E = T[_].PartName; if (e.scene.findGeometriesWithGroupName(E).length > 0 || e.scene.findGlyphsetsWithGroupName(E).length > 0) e.changeOrganPartsVisibility(E, !0); else { const C = getOrganDetails(T[_].SystemName, E); C != null && e.scene.loadMetadataURL(l.getOrgansDirectoryPrefix() + "/" + C.meta); } } }, this.getAvailableSpecies = function(T, _, E) { const C = new Array(); C.push("none"); const P = Object.keys(organsFileMap); for (index in P) { const b = P[index]; b != T && organsFileMap[b].hasOwnProperty(_) && organsFileMap[b][_].hasOwnProperty(E) && C.push(b); } return C; }, this.getCentreAndSize = function() { const T = new Pr.THREE.Vector3(), _ = this.scene.getBoundingBox(); _.getCenter(T); const E = [T.x, T.y, T.z]; _.getSize(T); const C = [T.x, T.y, T.z]; return { centre: E, size: C }; }; const S = function(T, _, E, C) { e.sceneData.nerveMapIsActive = !1, e.sceneData.nerveMap = void 0, e.sceneData.metaURL = "", e.sceneData.viewURL = "", e.sceneData.currentSpecies = T, e.sceneData.currentSystem = _, e.sceneData.currentPart = E, e.sceneData.currentTime = 0, e.sceneData.timeVarying = !1; let P = ""; T && (P = T + "/"), _ && (P = _ + "/"), E && (P = E), e.sceneData.currentName = P; }; this.loadOrgansFromURL = function(T, _, E, C, P, b, F) { if (e.zincRenderer && C && e.sceneData.metaURL !== T) { S(_, E, C); const D = e.sceneData.currentName; let N = e.zincRenderer.getSceneByName(D); N ? b && N.clearAll() : N = e.zincRenderer.createScene(D), e.selectObjectOnPick = !0; for (let U = 0; U < r.length; U++) r[U](e.sceneData); P && P != "" ? (e.sceneData.viewURL = P, N.loadViewURL(e.sceneData.viewURL)) : e.sceneData.viewURL = void 0, e.sceneData.metaURL = T, N.addZincObjectAddedCallbacks(A(E, C, !1)), N.addZincObjectRemovedCallbacks(M(void 0, C, !1)), N.loadMetadataURL(T, L(), R(), F), e.scene = N, e.zincRenderer.setCurrentScene(N), e.graphicsHighlight.reset(); const B = N.getZincCameraControls(); B.enableRaycaster(N, y(), v()), B.setMouseButtonAction("AUXILIARY", "ZOOM"), B.setMouseButtonAction("SECONDARY", "PAN"); } }, this.loadGLTFFromURL = function(T, _, E) { if (e.zincRenderer && _ && e.sceneData.metaURL !== T) { S(void 0, void 0, _); const C = e.sceneData.currentName; let P = e.zincRenderer.getSceneByName(C); P ? E && P.clearAll() : P = e.zincRenderer.createScene(C); for (let F = 0; F < r.length; F++) r[F](e.sceneData); e.sceneData.viewURL = void 0, e.sceneData.metaURL = T, P.addZincObjectAddedCallbacks(A(void 0, _, !1)), P.addZincObjectRemovedCallbacks(M(void 0, _, !1)), P.loadGLTF(T, void 0, R()), e.scene = P, e.zincRenderer.setCurrentScene(P), e.graphicsHighlight.reset(); const b = P.getZincCameraControls(); b.enableRaycaster(P, y(), v()), b.setMouseButtonAction("AUXILIARY", "ZOOM"), b.setMouseButtonAction("SECONDARY", "PAN"); } }, this.alignCameraWithSelectedObject = function(T) { const _ = e.graphicsHighlight.getSelected(); _ && _[0] && _[0].userData && e.scene.alignObjectToCameraView(_[0].userData, T); }, this.exportSettings = function() { const T = {}; return T.name = e.instanceName, e.sceneData.currentSystem && (T.system = e.sceneData.currentSystem), e.sceneData.currentSpecies && (T.species = e.sceneData.currentSpecies), e.sceneData.currentPart && (T.part = e.sceneData.currentPart), T.metaURL = e.sceneData.metaURL, e.sceneData.viewURL && (T.viewURL = e.sceneData.viewURL), T.dialog = "Organ Viewer", T; }, this.importSettings = function(T) { return T && T.dialog == this.typeName ? (e.setName(T.name), T.metaURL !== void 0 && T.metaURL != "" ? e.loadOrgansFromURL( T.metaURL, T.species, T.system, T.part, T.viewURL, !0 ) : e.loadOrgans(T.species, T.system, T.part), !0) : !1; }, function() { e.initialiseRenderer(void 0), e.zincRenderer && (e.zincRenderer.addPreRenderCallbackFunction(g()), e.zincRenderer.addPostRenderCallbackFunction(p())); }(); }; CM.prototype = Object.create(Kt.prototype); var _t = function() { return _t = Object.assign || function(e) { for (var t, i = 1, r = arguments.length; i < r; i++) { t = arguments[i]; for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]); } return e; }, _t.apply(this, arguments); }; function m5(n, e, t, i) { function r(s) { return s instanceof t ? s : new t(function(o) { o(s); }); } return new (t || (t = Promise))(function(s, o) { function a(d) { try { l(i.next(d)); } catch (h) { o(h); } } function c(d) { try { l(i.throw(d)); } catch (h) { o(h); } } function l(d) { d.done ? s(d.value) : r(d.value).then(a, c); } l((i = i.apply(n, [])).next()); }); } function g5(n, e) { var t = { label: 0, sent: function() { if (s[0] & 1) throw s[1]; return s[1]; }, trys: [], ops: [] }, i, r, s, o; return o = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (o[Symbol.iterator] = function() { return this; }), o; function a(l) { return function(d) { return c([l, d]); }; } function c(l) { if (i) throw new TypeError("Generator is already executing."); for (; o && (o = 0, l[0] && (t = 0)), t; ) try { if (i = 1, r && (s = l[0] & 2 ? r.return : l[0] ? r.throw || ((s = r.return) && s.call(r), 0) : r.next) && !(s = s.call(r, l[1])).done) return s; switch (r = 0, s && (l = [l[0] & 2, s.value]), l[0]) { case 0: case 1: s = l; break; case 4: return t.label++, { value: l[1], done: !1 }; case 5: t.label++, r = l[1], l = [0]; continue; case 7: l = t.ops.pop(), t.trys.pop(); continue; default: if (s = t.trys, !(s = s.length > 0 && s[s.length - 1]) && (l[0] === 6 || l[0] === 2)) { t = 0; continue; } if (l[0] === 3 && (!s || l[1] > s[0] && l[1] < s[3])) { t.label = l[1]; break; } if (l[0] === 6 && t.label < s[1]) { t.label = s[1], s = l; break; } if (s && t.label < s[2]) { t.label = s[2], t.ops.push(l); break; } s[2] && t.ops.pop(), t.trys.pop(); continue; } l = e.call(n, t); } catch (d) { l = [6, d], r = 0; } finally { i = s = 0; } if (l[0] & 5) throw l[1]; return { value: l[0] ? l[1] : void 0, done: !0 }; } } function ct(n) { var e = typeof Symbol == "function" && Symbol.iterator, t = e && n[e], i = 0; if (t) return t.call(n); if (n && typeof n.length == "number") return { next: function() { return n && i >= n.length && (n = void 0), { value: n && n[i++], done: !n }; } }; throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined."); } function Wt(n, e) { var t = typeof Symbol == "function" && n[Symbol.iterator]; if (!t) return n; var i = t.call(n), r, s = [], o; try { for (; (e === void 0 || e-- > 0) && !(r = i.next()).done; ) s.push(r.value); } catch (a) { o = { error: a }; } finally { try { r && !r.done && (t = i.return) && t.call(i); } finally { if (o) throw o.error; } } return s; } var v5 = "ENTRIES", LM = "KEYS", RM = "VALUES", pn = "", Ph = ( /** @class */ function() { function n(e, t) { var i = e._tree, r = Array.from(i.keys()); this.set = e, this._type = t, this._path = r.length > 0 ? [{ node: i, keys: r }] : []; } return n.prototype.next = function() { var e = this.dive(); return this.backtrack(), e; }, n.prototype.dive = function() { if (this._path.length === 0) return { done: !0, value: void 0 }; var e = uo(this._path), t = e.node, i = e.keys; if (uo(i) === pn) return { done: !1, value: this.result() }; var r = t.get(uo(i)); return this._path.push({ node: r, keys: Array.from(r.keys()) }), this.dive(); }, n.prototype.backtrack = function() { if (this._path.length !== 0) { var e = uo(this._path).keys; e.pop(), !(e.length > 0) && (this._path.pop(), this.backtrack()); } }, n.prototype.key = function() { return this.set._prefix + this._path.map(function(e) { var t = e.keys; return uo(t); }).filter(function(e) { return e !== pn; }).join(""); }, n.prototype.value = function() { return uo(this._path).node.get(pn); }, n.prototype.result = function() { switch (this._type) { case RM: return this.value(); case LM: return this.key(); default: return [this.key(), this.value()]; } }, n.prototype[Symbol.iterator] = function() { return this; }, n; }() ), uo = function(n) { return n[n.length - 1]; }, y5 = 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 FM(n, e, t, i, o, 1, r, ""), i; }, FM = function(n, e, t, i, r, s, o, a) { var c, l, d = s * o; try { e: for (var h = ct(n.keys()), f = h.next(); !f.done; f = h.next()) { var g = f.value; if (g === pn) { var p = r[d - 1]; p <= t && i.set(a, [n.get(g), p]); } else { for (var u = s, y = 0; y < g.length; ++y, ++u) { for (var v = g[y], m = o * u, x = m - o, w = r[m], A = Math.max(0, u - t - 1), M = Math.min(o - 1, u + t), R = A; R < M; ++R) { var L = v !== e[R], S = r[x + R] + +L, I = r[x + R + 1] + 1, T = r[m + R] + 1, _ = r[m + R + 1] = Math.min(S, I, T); _ < w && (w = _); } if (w > t) continue e; } FM(n.get(g), e, t, i, r, u, o, a + g); } } } catch (E) { c = { error: E }; } finally { try { f && !f.done && (l = h.return) && l.call(h); } finally { if (c) throw c.error; } } }, Ih = ( /** @class */ function() { function n(e, t) { e === void 0 && (e = /* @__PURE__ */ new Map()), t === void 0 && (t = ""), this._size = void 0, this._tree = e, this._prefix = t; } return n.prototype.atPrefix = function(e) { var t, i; if (!e.startsWith(this._prefix)) throw new Error("Mismatched prefix"); var r = Wt($c(this._tree, e.slice(this._prefix.length)), 2), s = r[0], o = r[1]; if (s === void 0) { var a = Wt(vp(o), 2), c = a[0], l = a[1]; try { for (var d = ct(c.keys()), h = d.next(); !h.done; h = d.next()) { var f = h.value; if (f !== pn && f.startsWith(l)) { var g = /* @__PURE__ */ new Map(); return g.set(f.slice(l.length), c.get(f)), new n(g, e); } } } catch (p) { t = { error: p }; } finally { try { h && !h.done && (i = d.return) && i.call(d); } finally { if (t) throw t.error; } } } return new n(s, e); }, n.prototype.clear = function() { this._size = void 0, this._tree.clear(); }, n.prototype.delete = function(e) { return this._size = void 0, b5(this._tree, e); }, n.prototype.entries = function() { return new Ph(this, v5); }, n.prototype.forEach = function(e) { var t, i; try { for (var r = ct(this), s = r.next(); !s.done; s = r.next()) { var o = Wt(s.value, 2), a = o[0], c = o[1]; e(a, c, this); } } catch (l) { t = { error: l }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, n.prototype.fuzzyGet = function(e, t) { return y5(this._tree, e, t); }, n.prototype.get = function(e) { var t = Nd(this._tree, e); return t !== void 0 ? t.get(pn) : void 0; }, n.prototype.has = function(e) { var t = Nd(this._tree, e); return t !== void 0 && t.has(pn); }, n.prototype.keys = function() { return new Ph(this, LM); }, n.prototype.set = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Oh(this._tree, e); return i.set(pn, t), this; }, Object.defineProperty(n.prototype, "size", { /** * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size */ get: function() { if (this._size) return this._size; this._size = 0; for (var e = this.entries(); !e.next().done; ) this._size += 1; return this._size; }, enumerable: !1, configurable: !0 }), n.prototype.update = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Oh(this._tree, e); return i.set(pn, t(i.get(pn))), this; }, n.prototype.fetch = function(e, t) { if (typeof e != "string") throw new Error("key must be a string"); this._size = void 0; var i = Oh(this._tree, e), r = i.get(pn); return r === void 0 && i.set(pn, r = t()), r; }, n.prototype.values = function() { return new Ph(this, RM); }, n.prototype[Symbol.iterator] = function() { return this.entries(); }, n.from = function(e) { var t, i, r = new n(); try { for (var s = ct(e), o = s.next(); !o.done; o = s.next()) { var a = Wt(o.value, 2), c = a[0], l = a[1]; r.set(c, l); } } catch (d) { t = { error: d }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } return r; }, n.fromObject = function(e) { return n.from(Object.entries(e)); }, n; }() ), $c = function(n, e, t) { var i, r; if (t === void 0 && (t = []), e.length === 0 || n == null) return [n, t]; try { for (var s = ct(n.keys()), o = s.next(); !o.done; o = s.next()) { var a = o.value; if (a !== pn && e.startsWith(a)) return t.push([n, a]), $c(n.get(a), e.slice(a.length), t); } } catch (c) { i = { error: c }; } finally { try { o && !o.done && (r = s.return) && r.call(s); } finally { if (i) throw i.error; } } return t.push([n, e]), $c(void 0, "", t); }, Nd = function(n, e) { var t, i; if (e.length === 0 || n == null) return n; try { for (var r = ct(n.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value; if (o !== pn && e.startsWith(o)) return Nd(n.get(o), e.slice(o.length)); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, Oh = function(n, e) { var t, i, r = e.length; e: for (var s = 0; n && s < r; ) { try { for (var o = (t = void 0, ct(n.keys())), a = o.next(); !a.done; a = o.next()) { var c = a.value; if (c !== pn && e[s] === c[0]) { for (var l = Math.min(r - s, c.length), d = 1; d < l && e[s + d] === c[d]; ) ++d; var h = n.get(c); if (d === c.length) n = h; else { var f = /* @__PURE__ */ new Map(); f.set(c.slice(d), h), n.set(e.slice(s, s + d), f), n.delete(c), n = f; } s += d; continue e; } } } catch (p) { t = { error: p }; } finally { try { a && !a.done && (i = o.return) && i.call(o); } finally { if (t) throw t.error; } } var g = /* @__PURE__ */ new Map(); return n.set(e.slice(s), g), g; } return n; }, b5 = function(n, e) { var t = Wt($c(n, e), 2), i = t[0], r = t[1]; if (i !== void 0) { if (i.delete(pn), i.size === 0) PM(r); else if (i.size === 1) { var s = Wt(i.entries().next().value, 2), o = s[0], a = s[1]; IM(r, o, a); } } }, PM = function(n) { if (n.length !== 0) { var e = Wt(vp(n), 2), t = e[0], i = e[1]; if (t.delete(i), t.size === 0) PM(n.slice(0, -1)); else if (t.size === 1) { var r = Wt(t.entries().next().value, 2), s = r[0], o = r[1]; s !== pn && IM(n.slice(0, -1), s, o); } } }, IM = function(n, e, t) { if (n.length !== 0) { var i = Wt(vp(n), 2), r = i[0], s = i[1]; r.set(s + e, t), r.delete(s); } }, vp = function(n) { return n[n.length - 1]; }, _a, yp = "or", OM = "and", x5 = "and_not", M5 = ( /** @class */ function() { function n(e) { if ((e == null ? void 0 : e.fields) == null) throw new Error('MiniSearch: option "fields" must be provided'); var t = e.autoVacuum == null || e.autoVacuum === !0 ? Bh : e.autoVacuum; this._options = _t(_t(_t({}, Nh), e), { autoVacuum: t, searchOptions: _t(_t({}, Rv), e.searchOptions || {}), autoSuggestOptions: _t(_t({}, T5), e.autoSuggestOptions || {}) }), this._index = new Ih(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldIds = {}, this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._nextId = 0, this._storedFields = /* @__PURE__ */ new Map(), this._dirtCount = 0, this._currentVacuum = null, this._enqueuedVacuum = null, this._enqueuedVacuumConditions = Ud, this.addFields(this._options.fields); } return n.prototype.add = function(e) { var t, i, r, s, o, a, c = this._options, l = c.extractField, d = c.tokenize, h = c.processTerm, f = c.fields, g = c.idField, p = l(e, g); if (p == null) throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"')); if (this._idToShortId.has(p)) throw new Error("MiniSearch: duplicate ID ".concat(p)); var u = this.addDocumentId(p); this.saveStoredFields(u, e); try { for (var y = ct(f), v = y.next(); !v.done; v = y.next()) { var m = v.value, x = l(e, m); if (x != null) { var w = d(x.toString(), m), A = this._fieldIds[m], M = new Set(w).size; this.addFieldLength(u, A, this._documentCount - 1, M); try { for (var R = (r = void 0, ct(w)), L = R.next(); !L.done; L = R.next()) { var S = L.value, I = h(S, m); if (Array.isArray(I)) try { for (var T = (o = void 0, ct(I)), _ = T.next(); !_.done; _ = T.next()) { var E = _.value; this.addTerm(A, u, E); } } catch (C) { o = { error: C }; } finally { try { _ && !_.done && (a = T.return) && a.call(T); } finally { if (o) throw o.error; } } else I && this.addTerm(A, u, I); } } catch (C) { r = { error: C }; } finally { try { L && !L.done && (s = R.return) && s.call(R); } finally { if (r) throw r.error; } } } } } catch (C) { t = { error: C }; } finally { try { v && !v.done && (i = y.return) && i.call(y); } finally { if (t) throw t.error; } } }, n.prototype.addAll = function(e) { var t, i; try { for (var r = ct(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; this.add(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, n.prototype.addAllAsync = function(e, t) { var i = this; t === void 0 && (t = {}); var r = t.chunkSize, s = r === void 0 ? 10 : r, o = { chunk: [], promise: Promise.resolve() }, a = e.reduce(function(d, h, f) { var g = d.chunk, p = d.promise; return g.push(h), (f + 1) % s === 0 ? { chunk: [], promise: p.then(function() { return new Promise(function(u) { return setTimeout(u, 0); }); }).then(function() { return i.addAll(g); }) } : { chunk: g, promise: p }; }, o), c = a.chunk, l = a.promise; return l.then(function() { return i.addAll(c); }); }, n.prototype.remove = function(e) { var t, i, r, s, o, a, c = this._options, l = c.tokenize, d = c.processTerm, h = c.extractField, f = c.fields, g = c.idField, p = h(e, g); if (p == null) throw new Error('MiniSearch: document does not have ID field "'.concat(g, '"')); var u = this._idToShortId.get(p); if (u == null) throw new Error("MiniSearch: cannot remove document with ID ".concat(p, ": it is not in the index")); try { for (var y = ct(f), v = y.next(); !v.done; v = y.next()) { var m = v.value, x = h(e, m); if (x != null) { var w = l(x.toString(), m), A = this._fieldIds[m], M = new Set(w).size; this.removeFieldLength(u, A, this._documentCount, M); try { for (var R = (r = void 0, ct(w)), L = R.next(); !L.done; L = R.next()) { var S = L.value, I = d(S, m); if (Array.isArray(I)) try { for (var T = (o = void 0, ct(I)), _ = T.next(); !_.done; _ = T.next()) { var E = _.value; this.removeTerm(A, u, E); } } catch (C) { o = { error: C }; } finally { try { _ && !_.done && (a = T.return) && a.call(T); } finally { if (o) throw o.error; } } else I && this.removeTerm(A, u, I); } } catch (C) { r = { error: C }; } finally { try { L && !L.done && (s = R.return) && s.call(R); } finally { if (r) throw r.error; } } } } } catch (C) { t = { error: C }; } finally { try { v && !v.done && (i = y.return) && i.call(y); } finally { if (t) throw t.error; } } this._storedFields.delete(u), this._documentIds.delete(u), this._idToShortId.delete(p), this._fieldLength.delete(u), this._documentCount -= 1; }, n.prototype.removeAll = function(e) { var t, i; if (e) try { for (var r = ct(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; this.remove(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } else { if (arguments.length > 0) throw new Error("Expected documents to be present. Omit the argument to remove all documents."); this._index = new Ih(), this._documentCount = 0, this._documentIds = /* @__PURE__ */ new Map(), this._idToShortId = /* @__PURE__ */ new Map(), this._fieldLength = /* @__PURE__ */ new Map(), this._avgFieldLength = [], this._storedFields = /* @__PURE__ */ new Map(), this._nextId = 0; } }, n.prototype.discard = function(e) { var t = this, i = this._idToShortId.get(e); if (i == null) throw new Error("MiniSearch: cannot discard document with ID ".concat(e, ": it is not in the index")); this._idToShortId.delete(e), this._documentIds.delete(i), this._storedFields.delete(i), (this._fieldLength.get(i) || []).forEach(function(r, s) { t.removeFieldLength(i, s, t._documentCount, r); }), this._fieldLength.delete(i), this._documentCount -= 1, this._dirtCount += 1, this.maybeAutoVacuum(); }, n.prototype.maybeAutoVacuum = function() { if (this._options.autoVacuum !== !1) { var e = this._options.autoVacuum, t = e.minDirtFactor, i = e.minDirtCount, r = e.batchSize, s = e.batchWait; this.conditionalVacuum({ batchSize: r, batchWait: s }, { minDirtCount: i, minDirtFactor: t }); } }, n.prototype.discardAll = function(e) { var t, i, r = this._options.autoVacuum; try { this._options.autoVacuum = !1; try { for (var s = ct(e), o = s.next(); !o.done; o = s.next()) { var a = o.value; this.discard(a); } } catch (c) { t = { error: c }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } } finally { this._options.autoVacuum = r; } this.maybeAutoVacuum(); }, n.prototype.replace = function(e) { var t = this._options, i = t.idField, r = t.extractField, s = r(e, i); this.discard(s), this.add(e); }, n.prototype.vacuum = function(e) { return e === void 0 && (e = {}), this.conditionalVacuum(e); }, n.prototype.conditionalVacuum = function(e, t) { var i = this; return this._currentVacuum ? (this._enqueuedVacuumConditions = this._enqueuedVacuumConditions && t, this._enqueuedVacuum != null ? this._enqueuedVacuum : (this._enqueuedVacuum = this._currentVacuum.then(function() { var r = i._enqueuedVacuumConditions; return i._enqueuedVacuumConditions = Ud, i.performVacuuming(e, r); }), this._enqueuedVacuum)) : this.vacuumConditionsMet(t) === !1 ? Promise.resolve() : (this._currentVacuum = this.performVacuuming(e), this._currentVacuum); }, n.prototype.performVacuuming = function(e, t) { return m5(this, void 0, void 0, function() { var i, r, s, o, a, c, l, d, h, f, g, p, u, y, v, m, x, w, A, M, R, L, S, I, T; return g5(this, function(_) { switch (_.label) { case 0: if (i = this._dirtCount, !this.vacuumConditionsMet(t)) return [3, 10]; r = e.batchSize || Bd.batchSize, s = e.batchWait || Bd.batchWait, o = 1, _.label = 1; case 1: _.trys.push([1, 7, 8, 9]), a = ct(this._index), c = a.next(), _.label = 2; case 2: if (c.done) return [3, 6]; l = Wt(c.value, 2), d = l[0], h = l[1]; try { for (f = (L = void 0, ct(h)), g = f.next(); !g.done; g = f.next()) { p = Wt(g.value, 2), u = p[0], y = p[1]; try { for (v = (I = void 0, ct(y)), m = v.next(); !m.done; m = v.next()) x = Wt(m.value, 1), w = x[0], !this._documentIds.has(w) && (y.size <= 1 ? h.delete(u) : y.delete(w)); } catch (E) { I = { error: E }; } finally { try { m && !m.done && (T = v.return) && T.call(v); } finally { if (I) throw I.error; } } } } catch (E) { L = { error: E }; } finally { try { g && !g.done && (S = f.return) && S.call(f); } finally { if (L) throw L.error; } } return this._index.get(d).size === 0 && this._index.delete(d), o % r !== 0 ? [3, 4] : [4, new Promise(function(E) { return setTimeout(E, s); })]; case 3: _.sent(), _.label = 4; case 4: o += 1, _.label = 5; case 5: return c = a.next(), [3, 2]; case 6: return [3, 9]; case 7: return A = _.sent(), M = { error: A }, [3, 9]; case 8: try { c && !c.done && (R = a.return) && R.call(a); } finally { if (M) throw M.error; } return [ 7 /*endfinally*/ ]; case 9: this._dirtCount -= i, _.label = 10; case 10: return [4, null]; case 11: return _.sent(), this._currentVacuum = this._enqueuedVacuum, this._enqueuedVacuum = null, [ 2 /*return*/ ]; } }); }); }, n.prototype.vacuumConditionsMet = function(e) { if (e == null) return !0; var t = e.minDirtCount, i = e.minDirtFactor; return t = t || Bh.minDirtCount, i = i || Bh.minDirtFactor, this.dirtCount >= t && this.dirtFactor >= i; }, Object.defineProperty(n.prototype, "isVacuuming", { /** * Is `true` if a vacuuming operation is ongoing, `false` otherwise */ get: function() { return this._currentVacuum != null; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "dirtCount", { /** * The number of documents discarded since the most recent vacuuming */ get: function() { return this._dirtCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "dirtFactor", { /** * A number between 0 and 1 giving an indication about the proportion of * documents that are discarded, and can therefore be cleaned up by vacuuming. * A value close to 0 means that the index is relatively clean, while a higher * value means that the index is relatively dirty, and vacuuming could release * memory. */ get: function() { return this._dirtCount / (1 + this._documentCount + this._dirtCount); }, enumerable: !1, configurable: !0 }), n.prototype.has = function(e) { return this._idToShortId.has(e); }, n.prototype.getStoredFields = function(e) { var t = this._idToShortId.get(e); if (t != null) return this._storedFields.get(t); }, n.prototype.search = function(e, t) { var i, r; t === void 0 && (t = {}); var s = this.executeQuery(e, t), o = []; try { for (var a = ct(s), c = a.next(); !c.done; c = a.next()) { var l = Wt(c.value, 2), d = l[0], h = l[1], f = h.score, g = h.terms, p = h.match, u = g.length || 1, y = { id: this._documentIds.get(d), score: f * u, terms: Object.keys(p), queryTerms: g, match: p }; Object.assign(y, this._storedFields.get(d)), (t.filter == null || t.filter(y)) && o.push(y); } } catch (v) { i = { error: v }; } finally { try { c && !c.done && (r = a.return) && r.call(a); } finally { if (i) throw i.error; } } return e === n.wildcard && t.boostDocument == null && this._options.searchOptions.boostDocument == null || o.sort(Pv), o; }, n.prototype.autoSuggest = function(e, t) { var i, r, s, o; t === void 0 && (t = {}), t = _t(_t({}, this._options.autoSuggestOptions), t); var a = /* @__PURE__ */ new Map(); try { for (var c = ct(this.search(e, t)), l = c.next(); !l.done; l = c.next()) { var d = l.value, h = d.score, f = d.terms, g = f.join(" "), p = a.get(g); p != null ? (p.score += h, p.count += 1) : a.set(g, { score: h, terms: f, count: 1 }); } } catch (A) { i = { error: A }; } finally { try { l && !l.done && (r = c.return) && r.call(c); } finally { if (i) throw i.error; } } var u = []; try { for (var y = ct(a), v = y.next(); !v.done; v = y.next()) { var m = Wt(v.value, 2), p = m[0], x = m[1], h = x.score, f = x.terms, w = x.count; u.push({ suggestion: p, terms: f, score: h / w }); } } catch (A) { s = { error: A }; } finally { try { v && !v.done && (o = y.return) && o.call(y); } finally { if (s) throw s.error; } } return u.sort(Pv), u; }, Object.defineProperty(n.prototype, "documentCount", { /** * Total number of documents available to search */ get: function() { return this._documentCount; }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "termCount", { /** * Number of terms in the index */ get: function() { return this._index.size; }, enumerable: !1, configurable: !0 }), n.loadJSON = function(e, t) { if (t == null) throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index"); return this.loadJS(JSON.parse(e), t); }, n.getDefault = function(e) { if (Nh.hasOwnProperty(e)) return Dh(Nh, e); throw new Error('MiniSearch: unknown option "'.concat(e, '"')); }, n.loadJS = function(e, t) { var i, r, s, o, a, c, l = e.index, d = e.documentCount, h = e.nextId, f = e.documentIds, g = e.fieldIds, p = e.fieldLength, u = e.averageFieldLength, y = e.storedFields, v = e.dirtCount, m = e.serializationVersion; if (m !== 1 && m !== 2) throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version"); var x = new n(t); x._documentCount = d, x._nextId = h, x._documentIds = Ac(f), x._idToShortId = /* @__PURE__ */ new Map(), x._fieldIds = g, x._fieldLength = Ac(p), x._avgFieldLength = u, x._storedFields = Ac(y), x._dirtCount = v || 0, x._index = new Ih(); try { for (var w = ct(x._documentIds), A = w.next(); !A.done; A = w.next()) { var M = Wt(A.value, 2), R = M[0], L = M[1]; x._idToShortId.set(L, R); } } catch (N) { i = { error: N }; } finally { try { A && !A.done && (r = w.return) && r.call(w); } finally { if (i) throw i.error; } } try { for (var S = ct(l), I = S.next(); !I.done; I = S.next()) { var T = Wt(I.value, 2), _ = T[0], E = T[1], C = /* @__PURE__ */ new Map(); try { for (var P = (a = void 0, ct(Object.keys(E))), b = P.next(); !b.done; b = P.next()) { var F = b.value, D = E[F]; m === 1 && (D = D.ds), C.set(parseInt(F, 10), Ac(D)); } } catch (N) { a = { error: N }; } finally { try { b && !b.done && (c = P.return) && c.call(P); } finally { if (a) throw a.error; } } x._index.set(_, C); } } catch (N) { s = { error: N }; } finally { try { I && !I.done && (o = S.return) && o.call(S); } finally { if (s) throw s.error; } } return x; }, n.prototype.executeQuery = function(e, t) { var i = this; if (t === void 0 && (t = {}), e === n.wildcard) return this.executeWildcardQuery(t); if (typeof e != "string") { var r = _t(_t(_t({}, t), e), { queries: void 0 }), s = e.queries.map(function(y) { return i.executeQuery(y, r); }); return this.combineResults(s, r.combineWith); } var o = this._options, a = o.tokenize, c = o.processTerm, l = o.searchOptions, d = _t(_t({ tokenize: a, processTerm: c }, l), t), h = d.tokenize, f = d.processTerm, g = h(e).flatMap(function(y) { return f(y); }).filter(function(y) { return !!y; }), p = g.map(_5(d)), u = p.map(function(y) { return i.executeQuerySpec(y, d); }); return this.combineResults(u, d.combineWith); }, n.prototype.executeQuerySpec = function(e, t) { var i, r, s, o, a = _t(_t({}, this._options.searchOptions), t), c = (a.fields || this._options.fields).reduce(function(F, D) { var N; return _t(_t({}, F), (N = {}, N[D] = Dh(a.boost, D) || 1, N)); }, {}), l = a.boostDocument, d = a.weights, h = a.maxFuzzy, f = a.bm25, g = _t(_t({}, Rv.weights), d), p = g.fuzzy, u = g.prefix, y = this._index.get(e.term), v = this.termResults(e.term, e.term, 1, y, c, l, f), m, x; if (e.prefix && (m = this._index.atPrefix(e.term)), e.fuzzy) { var w = e.fuzzy === !0 ? 0.2 : e.fuzzy, A = w < 1 ? Math.min(h, Math.round(e.term.length * w)) : w; A && (x = this._index.fuzzyGet(e.term, A)); } if (m) try { for (var M = ct(m), R = M.next(); !R.done; R = M.next()) { var L = Wt(R.value, 2), S = L[0], I = L[1], T = S.length - e.term.length; if (T) { x == null || x.delete(S); var _ = u * S.length / (S.length + 0.3 * T); this.termResults(e.term, S, _, I, c, l, f, v); } } } catch (F) { i = { error: F }; } finally { try { R && !R.done && (r = M.return) && r.call(M); } finally { if (i) throw i.error; } } if (x) try { for (var E = ct(x.keys()), C = E.next(); !C.done; C = E.next()) { var S = C.value, P = Wt(x.get(S), 2), b = P[0], T = P[1]; if (T) { var _ = p * S.length / (S.length + T); this.termResults(e.term, S, _, b, c, l, f, v); } } } catch (F) { s = { error: F }; } finally { try { C && !C.done && (o = E.return) && o.call(E); } finally { if (s) throw s.error; } } return v; }, n.prototype.executeWildcardQuery = function(e) { var t, i, r = /* @__PURE__ */ new Map(), s = _t(_t({}, this._options.searchOptions), e); try { for (var o = ct(this._documentIds), a = o.next(); !a.done; a = o.next()) { var c = Wt(a.value, 2), l = c[0], d = c[1], h = s.boostDocument ? s.boostDocument(d, "", this._storedFields.get(l)) : 1; r.set(l, { score: h, terms: [], match: {} }); } } catch (f) { t = { error: f }; } finally { try { a && !a.done && (i = o.return) && i.call(o); } finally { if (t) throw t.error; } } return r; }, n.prototype.combineResults = function(e, t) { if (t === void 0 && (t = yp), e.length === 0) return /* @__PURE__ */ new Map(); var i = t.toLowerCase(); return e.reduce(w5[i]) || /* @__PURE__ */ new Map(); }, n.prototype.toJSON = function() { var e, t, i, r, s = []; try { for (var o = ct(this._index), a = o.next(); !a.done; a = o.next()) { var c = Wt(a.value, 2), l = c[0], d = c[1], h = {}; try { for (var f = (i = void 0, ct(d)), g = f.next(); !g.done; g = f.next()) { var p = Wt(g.value, 2), u = p[0], y = p[1]; h[u] = Object.fromEntries(y); } } catch (v) { i = { error: v }; } finally { try { g && !g.done && (r = f.return) && r.call(f); } finally { if (i) throw i.error; } } s.push([l, h]); } } catch (v) { e = { error: v }; } finally { try { a && !a.done && (t = o.return) && t.call(o); } finally { if (e) throw e.error; } } return { documentCount: this._documentCount, nextId: this._nextId, documentIds: Object.fromEntries(this._documentIds), fieldIds: this._fieldIds, fieldLength: Object.fromEntries(this._fieldLength), averageFieldLength: this._avgFieldLength, storedFields: Object.fromEntries(this._storedFields), dirtCount: this._dirtCount, index: s, serializationVersion: 2 }; }, n.prototype.termResults = function(e, t, i, r, s, o, a, c) { var l, d, h, f, g; if (c === void 0 && (c = /* @__PURE__ */ new Map()), r == null) return c; try { for (var p = ct(Object.keys(s)), u = p.next(); !u.done; u = p.next()) { var y = u.value, v = s[y], m = this._fieldIds[y], x = r.get(m); if (x != null) { var w = x.size, A = this._avgFieldLength[m]; try { for (var M = (h = void 0, ct(x.keys())), R = M.next(); !R.done; R = M.next()) { var L = R.value; if (!this._documentIds.has(L)) { this.removeTerm(m, L, t), w -= 1; continue; } var S = o ? o(this._documentIds.get(L), t, this._storedFields.get(L)) : 1; if (S) { var I = x.get(L), T = this._fieldLength.get(L)[m], _ = S5(I, w, this._documentCount, T, A, a), E = i * v * S * _, C = c.get(L); if (C) { C.score += E, E5(C.terms, e); var P = Dh(C.match, t); P ? P.push(y) : C.match[t] = [y]; } else c.set(L, { score: E, terms: [e], match: (g = {}, g[t] = [y], g) }); } } } catch (b) { h = { error: b }; } finally { try { R && !R.done && (f = M.return) && f.call(M); } finally { if (h) throw h.error; } } } } } catch (b) { l = { error: b }; } finally { try { u && !u.done && (d = p.return) && d.call(p); } finally { if (l) throw l.error; } } return c; }, n.prototype.addTerm = function(e, t, i) { var r = this._index.fetch(i, Iv), s = r.get(e); if (s == null) s = /* @__PURE__ */ new Map(), s.set(t, 1), r.set(e, s); else { var o = s.get(t); s.set(t, (o || 0) + 1); } }, n.prototype.removeTerm = function(e, t, i) { if (!this._index.has(i)) { this.warnDocumentChanged(t, e, i); return; } var r = this._index.fetch(i, Iv), s = r.get(e); s == null || s.get(t) == null ? this.warnDocumentChanged(t, e, i) : s.get(t) <= 1 ? s.size <= 1 ? r.delete(e) : s.delete(t) : s.set(t, s.get(t) - 1), this._index.get(i).size === 0 && this._index.delete(i); }, n.prototype.warnDocumentChanged = function(e, t, i) { var r, s; try { for (var o = ct(Object.keys(this._fieldIds)), a = o.next(); !a.done; a = o.next()) { var c = a.value; if (this._fieldIds[c] === t) { this._options.logger("warn", "MiniSearch: document with ID ".concat(this._documentIds.get(e), ' has changed before removal: term "').concat(i, '" was not present in field "').concat(c, '". Removing a document after it has changed can corrupt the index!'), "version_conflict"); return; } } } catch (l) { r = { error: l }; } finally { try { a && !a.done && (s = o.return) && s.call(o); } finally { if (r) throw r.error; } } }, n.prototype.addDocumentId = function(e) { var t = this._nextId; return this._idToShortId.set(e, t), this._documentIds.set(t, e), this._documentCount += 1, this._nextId += 1, t; }, n.prototype.addFields = function(e) { for (var t = 0; t < e.length; t++) this._fieldIds[e[t]] = t; }, n.prototype.addFieldLength = function(e, t, i, r) { var s = this._fieldLength.get(e); s == null && this._fieldLength.set(e, s = []), s[t] = r; var o = this._avgFieldLength[t] || 0, a = o * i + r; this._avgFieldLength[t] = a / (i + 1); }, n.prototype.removeFieldLength = function(e, t, i, r) { if (i === 1) { this._avgFieldLength[t] = 0; return; } var s = this._avgFieldLength[t] * i - r; this._avgFieldLength[t] = s / (i - 1); }, n.prototype.saveStoredFields = function(e, t) { var i, r, s = this._options, o = s.storeFields, a = s.extractField; if (!(o == null || o.length === 0)) { var c = this._storedFields.get(e); c == null && this._storedFields.set(e, c = {}); try { for (var l = ct(o), d = l.next(); !d.done; d = l.next()) { var h = d.value, f = a(t, h); f !== void 0 && (c[h] = f); } } catch (g) { i = { error: g }; } finally { try { d && !d.done && (r = l.return) && r.call(l); } finally { if (i) throw i.error; } } } }, n.wildcard = Symbol("*"), n; }() ), Dh = function(n, e) { return Object.prototype.hasOwnProperty.call(n, e) ? n[e] : void 0; }, w5 = (_a = {}, _a[yp] = function(n, e) { var t, i; try { for (var r = ct(e.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value, a = n.get(o); if (a == null) n.set(o, e.get(o)); else { var c = e.get(o), l = c.score, d = c.terms, h = c.match; a.score = a.score + l, a.match = Object.assign(a.match, h), Fv(a.terms, d); } } } catch (f) { t = { error: f }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } return n; }, _a[OM] = function(n, e) { var t, i, r = /* @__PURE__ */ new Map(); try { for (var s = ct(e.keys()), o = s.next(); !o.done; o = s.next()) { var a = o.value, c = n.get(a); if (c != null) { var l = e.get(a), d = l.score, h = l.terms, f = l.match; Fv(c.terms, h), r.set(a, { score: c.score + d, terms: c.terms, match: Object.assign(c.match, f) }); } } } catch (g) { t = { error: g }; } finally { try { o && !o.done && (i = s.return) && i.call(s); } finally { if (t) throw t.error; } } return r; }, _a[x5] = function(n, e) { var t, i; try { for (var r = ct(e.keys()), s = r.next(); !s.done; s = r.next()) { var o = s.value; n.delete(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } return n; }, _a), A5 = { k: 1.2, b: 0.7, d: 0.5 }, S5 = 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))); }, _5 = function(n) { return function(e, t, i) { var r = typeof n.fuzzy == "function" ? n.fuzzy(e, t, i) : n.fuzzy || !1, s = typeof n.prefix == "function" ? n.prefix(e, t, i) : n.prefix === !0; return { term: e, fuzzy: r, prefix: s }; }; }, Nh = { idField: "id", extractField: function(n, e) { return n[e]; }, tokenize: function(n) { return n.split(C5); }, processTerm: function(n) { return n.toLowerCase(); }, fields: void 0, searchOptions: void 0, storeFields: [], logger: function(n, e) { typeof (console == null ? void 0 : console[n]) == "function" && console[n](e); }, autoVacuum: !0 }, Rv = { combineWith: yp, prefix: !1, fuzzy: !1, maxFuzzy: 6, boost: {}, weights: { fuzzy: 0.45, prefix: 0.375 }, bm25: A5 }, T5 = { combineWith: OM, prefix: function(n, e, t) { return e === t.length - 1; } }, Bd = { batchSize: 1e3, batchWait: 10 }, Ud = { minDirtFactor: 0.1, minDirtCount: 20 }, Bh = _t(_t({}, Bd), Ud), E5 = function(n, e) { n.includes(e) || n.push(e); }, Fv = function(n, e) { var t, i; try { for (var r = ct(e), s = r.next(); !s.done; s = r.next()) { var o = s.value; n.includes(o) || n.push(o); } } catch (a) { t = { error: a }; } finally { try { s && !s.done && (i = r.return) && i.call(r); } finally { if (t) throw t.error; } } }, Pv = function(n, e) { var t = n.score, i = e.score; return i - t; }, Iv = function() { return /* @__PURE__ */ new Map(); }, Ac = function(n) { var e, t, i = /* @__PURE__ */ new Map(); try { for (var r = ct(Object.keys(n)), s = r.next(); !s.done; s = r.next()) { var o = s.value; i.set(parseInt(o, 10), n[o]); } } catch (a) { e = { error: a }; } finally { try { s && !s.done && (t = r.return) && t.call(r); } finally { if (e) throw e.error; } } return i; }, C5 = /[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u; class L5 { constructor() { this._searchEngine = new M5({ fields: ["path", "name"], storeFields: ["path"], tokenize: (e, t) => e.split(/[\s/]+/) // indexing tokenizer }), this.idMaps = {}; } addZincObject(e, t) { const i = e.getRegion().getFullPath(); let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName; r = r.replaceAll('"', ""), s = s.replaceAll('"', ""); const o = { path: s, name: r, id: t }; this._searchEngine.add(o), this.idMaps[t] = { path: s, zincObject: e }; } removeZincObject(e, t) { const i = e.getRegion().getFullPath(); let r = e.groupName, s = i ? `${i}/${e.groupName}` : e.groupName; r = r.replaceAll('"', ""), s = s.replaceAll('"', ""); const o = { path: s, name: r, id: t }; this._searchEngine.remove(o), delete this.idMaps[t]; } addRegion(e, t) { let i = e.getFullPath(), r = e.getName(); i = i.replaceAll('"', ""), r = r.replaceAll('"', ""); const s = { path: i, name: r, id: t }; this._searchEngine.add(s), this.idMaps[t] = { path: i, zincObject: e }; } clearResults() { this._; } removeAll() { this._searchEngine.removeAll(), this.idMaps = {}; } auto_suggest(e) { let t = []; e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 })); const i = []; t.forEach((o) => { o.id in this.idMaps && i.push(this.idMaps[o.id].path); }); const r = [...new Set(i)], s = []; return r.forEach((o) => s.push({ suggestion: '"' + o + '"' })), s; } processResults(e, t) { const i = { regionPath: void 0, label: 'Search Results for "' }; return Array.isArray(t) ? i.label += ",".join(t) : i.label += t, i.label += '"', e.length === 1 && (e[0].isRegion ? i.regionPath = e[0].getFullPath() : e[0].isZincObject && (i.regionPath = e[0].getRegion().getFullPath(), i.label = e[0].groupName)), i.zincObjects = B4(e), i; } search(e) { let t; e.length > 2 && ["'", '"'].includes(e.slice(0, 1)) ? (e = e.replaceAll(e.slice(0, 1), ""), t = this._searchEngine.search(e, { prefix: !0, combineWith: "AND" })) : e.length > 1 && (t = this._searchEngine.search(e, { prefix: !0 })); const i = []; return t.forEach((r) => { r.id in this.idMaps && i.push(this.idMaps[r.id].zincObject); }), i; } searchTerms(e) { let t = []; return e.forEach((i) => { const r = this.search(i); t.push(...r); }), t; } searchAndProcessResult(e) { let t = []; return Array.isArray(e) ? t = this.searchTerms(e) : t = this.search(e), this.processResults(t, e); } } const R5 = [ { id: 0, nerve_id: "ILX:0793723", label: "Auriculotemporal nerve", "FMA subclasses (in human nerves)": ["FMA:53002", "FMA:53001"], "subclass labels": ["Left auriculotemporal nerve", "Right auriculotemporal nerve"] }, { id: 1, nerve_id: "ILX:0792409", label: "gray communicating ramus of tenth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6895", "FMA:6894"], "subclass labels": ["Left T10 grey ramus communicans", "Right T10 grey ramus communicans"] }, { id: 2, nerve_id: "UBERON:0011326", label: "superior laryngeal nerve", "FMA subclasses (in human nerves)": ["FMA:53530", "FMA:53536"], "subclass labels": ["Right superior laryngeal nerve", "Left superior laryngeal nerve"] }, { id: 3, nerve_id: "ILX:0793220", label: "white communicating ramus of first lumbar spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 4, nerve_id: "ILX:0787082", label: "gray communicating ramus of the first thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6082", "FMA:6084"], "subclass labels": ["Right T1 grey ramus communicans", "Left T1 grey ramus communicans"] }, { id: 5, nerve_id: "ILX:0793809", label: "Clitoral cavernous nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 6, nerve_id: "UBERON:0011096", label: "lacrimal nerve", "FMA subclasses (in human nerves)": ["FMA:52630", "FMA:52629"], "subclass labels": ["Left lacrimal nerve", "Right lacrimal nerve"] }, { id: 7, nerve_id: "ILX:0793215", label: "white communicating ramus of ninth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 8, nerve_id: "ILX:0795005", label: "Posterior cutaneous nerve of arm", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 9, nerve_id: "UBERON:0001649", label: "glossopharyngeal nerve", "FMA subclasses (in human nerves)": ["FMA:50894", "FMA:50892"], "subclass labels": [] }, { id: 10, nerve_id: "UBERON:0022302", label: "short ciliary nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 11, nerve_id: "ILX:0785932", label: "gray communicating ramus of third lumbar nerve", "FMA subclasses (in human nerves)": ["FMA:65920", "FMA:65919"], "subclass labels": ["Left L3 grey ramus communicans", "Right L3 grey ramus communicans"] }, { id: 12, nerve_id: "ILX:0738293", label: "Ganglioglomerular nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 13, nerve_id: "ILX:0739298", label: "gray communicating ramus of twelfth thoracic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 14, nerve_id: "UBERON:0001492", label: "radial nerve", "FMA subclasses (in human nerves)": ["FMA:37070", "FMA:37071"], "subclass labels": ["Right radial nerve", "Left radial nerve"] }, { id: 15, nerve_id: "ILX:0793214", label: "white communicating ramus of eighth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 16, nerve_id: "UBERON:0018681", label: "lesser splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6957", "FMA:6958"], "subclass labels": ["Right lesser splanchnic nerve", "Left lesser splanchnic nerve"] }, { id: 17, nerve_id: "ILX:0794476", label: "abdominal branch of vagus nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 18, nerve_id: "ILX:0791105", label: "gray communicating ramus of the second thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6122", "FMA:6757"], "subclass labels": ["Right T2 grey ramus communicans", "Left T2 grey ramus communicans"] }, { id: 19, nerve_id: "ILX:0794853", label: "esophageal vagus trunk", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 20, nerve_id: "ILX:0793210", label: "white communicating ramus of fourth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 21, nerve_id: "UBERON:0001759", label: "vagus nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 22, nerve_id: "UBERON:0009675", label: "chorda tympani branch of facial nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 23, nerve_id: "ILX:0794949", label: "recurrent branch of the median nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 24, nerve_id: "ILX:0789339", label: "Pharyngeal branch of glossopharyngeal nerve", "FMA subclasses (in human nerves)": ["FMA:53495", "FMA:53494"], "subclass labels": ["Pharyngeal branch of left glossopharyngeal nerve", "Pharyngeal branch of right glossopharyngeal nerve"] }, { id: 25, nerve_id: "ILX:0793712", label: "Zygomatic nerve", "FMA subclasses (in human nerves)": ["FMA:52968", "FMA:52969"], "subclass labels": ["Right zygomatic nerve", "Left zygomatic nerve"] }, { id: 26, nerve_id: "ILX:0788536", label: "gray communicating ramus of fourth lumbar nerve", "FMA subclasses (in human nerves)": ["FMA:65917", "FMA:65918"], "subclass labels": ["Right L4 grey ramus communicans", "Left L4 grey ramus communicans"] }, { id: 27, nerve_id: "UBERON:0018680", label: "greater splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6956", "FMA:6955"], "subclass labels": ["Right greater splanchnic nerve", "Left greater splanchnic nerve"] }, { id: 28, nerve_id: "UBERON:0001322", label: "sciatic nerve", "FMA subclasses (in human nerves)": ["FMA:22111", "FMA:22112"], "subclass labels": ["Right sciatic nerve", "Left sciatic nerve"] }, { id: 29, nerve_id: "ILX:0793209", label: "white communicating ramus of third thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 30, nerve_id: "UBERON:0011391", label: "perineal nerve", "FMA subclasses (in human nerves)": ["FMA:21874", "FMA:21873"], "subclass labels": ["Left perineal nerve", "Right perineal nerve"] }, { id: 31, nerve_id: "ILX:0788945", label: "gray communicating ramus of the fourth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6759", "FMA:6758"], "subclass labels": ["Right T4 grey ramus communicans", "Left T4 grey ramus communicans"] }, { id: 32, nerve_id: "ILX:0790497", label: "Gray communicating ramus of cervicothoracic ganglion to first thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 33, nerve_id: "UBERON:0001323", label: "tibial nerve", "FMA subclasses (in human nerves)": ["FMA:22109", "FMA:22110"], "subclass labels": ["Right tibial nerve", "Left tibial nerve"] }, { id: 34, nerve_id: "ILX:0794969", label: "deep branch of ulnar nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 35, nerve_id: "ILX:0793227", label: "gray communicating ramus of thirteenth thoracic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 36, nerve_id: "ILX:0793228", label: "gray communicating ramus of first sacral nerve", "FMA subclasses (in human nerves)": ["FMA:65992", "FMA:65991"], "subclass labels": ["Left S1 grey ramus communicans", "Right S1 grey ramus communicans"] }, { id: 37, nerve_id: "UBERON:0035111", label: "medial plantar nerve", "FMA subclasses (in human nerves)": ["FMA:45435", "FMA:45434"], "subclass labels": ["Left medial plantar nerve", "Right medial plantar nerve"] }, { id: 38, nerve_id: "UBERON:0001780", label: "spinal nerve", "FMA subclasses (in human nerves)": ["FMA:6117", "FMA:6435", "FMA:6295", "FMA:6422", "FMA:6417", "FMA:6421", "FMA:6038", "FMA:6292", "FMA:6439", "FMA:6313", "FMA:6410", "FMA:6412", "FMA:6088", "FMA:6298", "FMA:6433", "FMA:6411", "FMA:6438", "FMA:6314", "FMA:6291", "FMA:6420", "FMA:6116", "FMA:6413", "FMA:6310", "FMA:6432", "FMA:6305", "FMA:6182", "FMA:6297", "FMA:6436", "FMA:6418", "FMA:6039", "FMA:6089", "FMA:6301", "FMA:6294", "FMA:6303", "FMA:6183", "FMA:6434", "FMA:6429", "FMA:6308", "FMA:6300", "FMA:6430", "FMA:6428", "FMA:6419", "FMA:6437", "FMA:6307", "FMA:6311", "FMA:6431"], "subclass labels": ["Left T3 spinal nerve", "Left S4 spinal nerve", "Left T5 spinal nerve", "Left L5 spinal nerve", "Right L3 spinal nerve", "Right L5 spinal nerve", "Right T1 spinal nerve", "Left T4 spinal nerve", "Left coccygeal spinal nerve", "Right T11 spinal nerve", "Right L1 spinal nerve", "Right L2 spinal nerve", "Right T2 spinal nerve", "Left T6 spinal nerve", "Left S3 spinal nerve", "Left L1 spinal nerve", "Right coccygeal spinal nerve", "Left T11 spinal nerve", "Right T4 spinal nerve", "Left L4 spinal nerve", "Right T3 spinal nerve", "Left L2 spinal nerve", "Right T10 spinal nerve", "Right S3 spinal nerve", "Left T8 spinal nerve", "Right T12 spinal nerve", "Right T6 spinal nerve", "Right S5 spinal nerve", "Left L3 spinal nerve", "Left T1 spinal nerve", "Left T2 spinal nerve", "Left T7 spinal nerve", "Right T5 spinal nerve", "Right T8 spinal nerve", "Left T12 spinal nerve", "Right S4 spinal nerve", "Left S1 spinal nerve", "Left T9 spinal nerve", "Right T7 spinal nerve", "Right S2 spinal nerve", "Right S1 spinal nerve", "Right L4 spinal nerve", "Left S5 spinal nerve", "Right T9 spinal nerve", "Left T10 spinal nerve", "Left S2 spinal nerve"] }, { id: 39, nerve_id: "UBERON:0018683", label: "lumbar splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6924", "FMA:6928", "FMA:6929", "FMA:6931", "FMA:6925", "FMA:6930", "FMA:6927", "FMA:6926"], "subclass labels": ["Right first lumbar splanchnic nerve", "Right third lumbar splanchnic nerve", "Left third lumbar splanchnic nerve", "Left fourth lumbar splanchnic nerve", "Left first lumbar splanchnic nerve", "Right fourth lumbar splanchnic nerve", "Left second lumbar splanchnic nerve", "Right second lumbar splanchnic nerve"] }, { id: 40, nerve_id: "UBERON:0001643", label: "oculomotor nerve", "FMA subclasses (in human nerves)": ["FMA:50880", "FMA:50879"], "subclass labels": ["Left oculomotor nerve", "Right oculomotor nerve"] }, { id: 41, nerve_id: "ILX:0793212", label: "white communicating ramus of sixth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 42, nerve_id: "UBERON:0003724", label: "musculocutaneous nerve", "FMA subclasses (in human nerves)": ["FMA:37066", "FMA:37065"], "subclass labels": ["Left musculocutaneous nerve", "Right musculocutaneous nerve"] }, { id: 43, nerve_id: "ILX:0738372", label: "white communicating ramus of first thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 44, nerve_id: "ILX:0793563", label: "splenic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 45, nerve_id: "UBERON:0035526", label: "superficial fibular nerve", "FMA subclasses (in human nerves)": ["FMA:45363", "FMA:45364"], "subclass labels": ["Right superficial fibular nerve", "Left superficial fibular nerve"] }, { id: 46, nerve_id: "ILX:0791560", label: "gray communicating ramus of eighth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6891", "FMA:6890"], "subclass labels": ["Left T8 grey ramus communicans", "Right T8 grey ramus communicans"] }, { id: 47, nerve_id: "ILX:0793827", label: "posterior abdominal vagal trunk", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 48, nerve_id: "ILX:0794141", label: "right cervical vagus nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 49, nerve_id: "ILX:0793714", label: "Mesenteric nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 50, nerve_id: "UBERON:0001964", label: "least splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6960", "FMA:6959"], "subclass labels": ["Left least splanchnic nerve", "Right least splanchnic nerve"] }, { id: 51, nerve_id: "UBERON:0001267", label: "femoral nerve", "FMA subclasses (in human nerves)": ["FMA:16499", "FMA:16500"], "subclass labels": ["Right femoral nerve", "Left femoral nerve"] }, { id: 52, nerve_id: "UBERON:0034984", label: "nerve to quadratus femoris", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 53, nerve_id: "UBERON:0003721", label: "lingual nerve", "FMA subclasses (in human nerves)": ["FMA:53219", "FMA:53220"], "subclass labels": ["Right lingual nerve", "Left lingual nerve"] }, { id: 54, nerve_id: "UBERON:0036216", label: "tympanic nerve", "FMA subclasses (in human nerves)": ["FMA:53481", "FMA:53482"], "subclass labels": ["Right tympanic nerve", "Left tympanic nerve"] }, { id: 55, nerve_id: "ILX:0793216", label: "white communicating ramus of tenth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 56, nerve_id: "ILX:0793362", label: "White communicating ramus of fourth lumbar anterior ramus", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 57, nerve_id: "ILX:0793561", label: "Internal branch of superior laryngeal nerve", "FMA subclasses (in human nerves)": ["FMA:53539", "FMA:53540"], "subclass labels": ["Right internal laryngeal nerve", "Left internal laryngeal nerve"] }, { id: 58, nerve_id: "ILX:0738312", label: "Aortic arch depressor nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 59, nerve_id: "ILX:0793218", label: "white communicating ramus of twelfth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 60, nerve_id: "ILX:0738308", label: "External branch of inferior laryngeal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 61, nerve_id: "ILX:0739299", label: "gray communicating ramus of sixth lumbar nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 62, nerve_id: "ILX:0793559", label: "bladder nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 63, nerve_id: "ILX:0793822", label: "Superior ovarian nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 64, nerve_id: "ILX:0793807", label: "Penile cavernous nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 65, nerve_id: "UBERON:0011390", label: "pudendal nerve", "FMA subclasses (in human nerves)": ["FMA:21863", "FMA:21864"], "subclass labels": ["Right pudendal nerve", "Left pudendal nerve"] }, { id: 66, nerve_id: "UBERON:0008810", label: "nasopalatine nerve", "FMA subclasses (in human nerves)": ["FMA:52799", "FMA:52798"], "subclass labels": ["Left nasopalatine nerve", "Right nasopalatine nerve"] }, { id: 67, nerve_id: "ILX:0793219", label: "white communicating ramus of thirteenth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 68, nerve_id: "ILX:0793632", label: "lumbar colonic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 69, nerve_id: "ILX:0784439", label: "gray communicating ramus of the fifth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6760", "FMA:6761"], "subclass labels": ["Left T5 grey ramus communicans", "Right T5 grey ramus communicans"] }, { id: 70, nerve_id: "ILX:0794977", label: "deep branch of radial nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 71, nerve_id: "UBERON:0001884", label: "phrenic nerve", "FMA subclasses (in human nerves)": ["FMA:6193", "FMA:6192"], "subclass labels": ["Left phrenic nerve", "Right phrenic nerve"] }, { id: 72, nerve_id: "UBERON:0035110", label: "lateral plantar nerve", "FMA subclasses (in human nerves)": ["FMA:45450", "FMA:45451"], "subclass labels": ["Right lateral plantar nerve", "Left lateral plantar nerve"] }, { id: 73, nerve_id: "ILX:0793711", label: "Communicating branch of zygomatic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 74, nerve_id: "ILX:0793560", label: "External branch of superior laryngeal nerve", "FMA subclasses (in human nerves)": ["FMA:53537", "FMA:53538"], "subclass labels": ["Right external laryngeal nerve", "Left external laryngeal nerve"] }, { id: 75, nerve_id: "ILX:0738309", label: "Internal branch of inferior laryngeal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 76, nerve_id: "UBERON:0001021", label: "nerve", "FMA subclasses (in human nerves)": ["FMA:6775", "FMA:6894", "FMA:6784", "FMA:6728", "FMA:65325", "FMA:21873", "FMA:45429", "FMA:6844", "FMA:53609", "FMA:7116", "FMA:44770", "FMA:8916", "FMA:52995", "FMA:6071", "FMA:45309", "FMA:6122", "FMA:6892", "FMA:6767", "FMA:16405", "FMA:53560", "FMA:6092", "FMA:65343", "FMA:37066", "FMA:8894", "FMA:8868", "FMA:65341", "FMA:53559", "FMA:8897", "FMA:82956", "FMA:20633", "FMA:6763", "FMA:65339", "FMA:8829", "FMA:16493", "FMA:8817", "FMA:8821", "FMA:11757", "FMA:45456", "FMA:45422", "FMA:11261", "FMA:65388", "FMA:6192", "FMA:65347", "FMA:37068", "FMA:65995", "FMA:6764", "FMA:39081", "FMA:45338", "FMA:53402", "FMA:11210", "FMA:52644", "FMA:37067", "FMA:65313", "FMA:11153", "FMA:6155", "FMA:8797", "FMA:53302", "FMA:8883", "FMA:53067", "FMA:52939", "FMA:53301", "FMA:292889", "FMA:45423", "FMA:8791", "FMA:45380", "FMA:11759", "FMA:7305", "FMA:8830", "FMA:78650", "FMA:65389", "FMA:45387", "FMA:8827", "FMA:8912", "FMA:52941", "FMA:6743", "FMA:7126", "FMA:53485", "FMA:16492", "FMA:53399", "FMA:65337", "FMA:11209", "FMA:6772", "FMA:52726", "FMA:6121", "FMA:52627", "FMA:52974", "FMA:53571", "FMA:6729", "FMA:8729", "FMA:53606", "FMA:80025", "FMA:53481", "FMA:53575", "FMA:45451", "FMA:11218", "FMA:22109", "FMA:6852", "FMA:8909", "FMA:11751", "FMA:65991", "FMA:8836", "FMA:65350", "FMA:53423", "FMA:65569", "FMA:65314", "FMA:82957", "FMA:65438", "FMA:39146", "FMA:8911", "FMA:22111", "FMA:65916", "FMA:65739", "FMA:65917", "FMA:6779", "FMA:8889", "FMA:65924", "FMA:65316", "FMA:53002", "FMA:16887", "FMA:53366", "FMA:6890", "FMA:8790", "FMA:6730", "FMA:45358", "FMA:52716", "FMA:53494", "FMA:7115", "FMA:53561", "FMA:78655", "FMA:45366", "FMA:11219", "FMA:11555", "FMA:7092", "FMA:53220", "FMA:45428", "FMA:6193", "FMA:20604", "FMA:45433", "FMA:21874", "FMA:21875", "FMA:53244", "FMA:45432", "FMA:6770", "FMA:52640", "FMA:11249", "FMA:20630", "FMA:53308", "FMA:11216", "FMA:65399", "FMA:78649", "FMA:11084", "FMA:6897", "FMA:53633", "FMA:6085", "FMA:6851", "FMA:45457", "FMA:6757", "FMA:8732", "FMA:8824", "FMA:20632", "FMA:6137", "FMA:52730", "FMA:7301", "FMA:52699", "FMA:53607", "FMA:7300", "FMA:53576", "FMA:44904", "FMA:65342", "FMA:7127", "FMA:6737", "FMA:52669", "FMA:21876", "FMA:45425", "FMA:65999", "FMA:8728", "FMA:21871", "FMA:55172", "FMA:6149", "FMA:45453", "FMA:44932", "FMA:292832", "FMA:6744", "FMA:6781", "FMA:44769", "FMA:45326", "FMA:6760", "FMA:53634", "FMA:53605", "FMA:53530", "FMA:6821", "FMA:52968", "FMA:53001", "FMA:11552", "FMA:45264", "FMA:8835", "FMA:6888", "FMA:55160", "FMA:44899", "FMA:52979", "FMA:45333", "FMA:45310", "FMA:6084", "FMA:11781", "FMA:82962", "FMA:53280", "FMA:52715", "FMA:53311", "FMA:16491", "FMA:21880", "FMA:44952", "FMA:11687", "FMA:11212", "FMA:65335", "FMA:52940", "FMA:6774", "FMA:8823", "FMA:45388", "FMA:6666", "FMA:6072", "FMA:16886", "FMA:53312", "FMA:65915", "FMA:45357", "FMA:11262", "FMA:65921", "FMA:0328826", "FMA:81290", "FMA:53279", "FMA:11551", "FMA:7293", "FMA:6677", "FMA:11756", "FMA:53598", "FMA:52732", "FMA:44902", "FMA:53545", "FMA:6740", "FMA:53502", "FMA:53562", "FMA:52700", "FMA:7122", "FMA:6118", "FMA:65918", "FMA:8814", "FMA:16403", "FMA:65346", "FMA:6667", "FMA:52630", "FMA:52629", "FMA:8871", "FMA:16500", "FMA:52725", "FMA:6108", "FMA:45363", "FMA:65340", "FMA:8872", "FMA:11760", "FMA:53604", "FMA:11214", "FMA:52777", "FMA:21864", "FMA:53503", "FMA:6738", "FMA:66000", "FMA:6776", "FMA:6777", "FMA:6765", "FMA:6111", "FMA:8890", "FMA:20607", "FMA:52643", "FMA:8908", "FMA:65437", "FMA:6762", "FMA:11154", "FMA:65344", "FMA:52937", "FMA:8919", "FMA:45354", "FMA:6766", "FMA:53424", "FMA:6145", "FMA:65568", "FMA:20634", "FMA:6732", "FMA:8893", "FMA:11758", "FMA:6889", "FMA:11554", "FMA:65922", "FMA:7118", "FMA:16884", "FMA:45308", "FMA:7290", "FMA:6758", "FMA:65743", "FMA:11063", "FMA:16885", "FMA:8882", "FMA:65286", "FMA:291238", "FMA:53482", "FMA:52976", "FMA:11308", "FMA:53432", "FMA:53540", "FMA:45379", "FMA:44871", "FMA:6714", "FMA:82955", "FMA:65993", "FMA:45452", "FMA:52626", "FMA:6083", "FMA:53582", "FMA:65919", "FMA:52936", "FMA:53506", "FMA:8918", "FMA:44901", "FMA:6073", "FMA:65315", "FMA:53219", "FMA:11194", "FMA:6792", "FMA:7119", "FMA:52785", "FMA:7296", "FMA:53068", "FMA:6845", "FMA:52677", "FMA:53504", "FMA:53548", "FMA:52698", "FMA:53570", "FMA:6771", "FMA:7078", "FMA:65997", "FMA:65338", "FMA:52969", "FMA:16401", "FMA:65416", "FMA:6835", "FMA:39082", "FMA:8726", "FMA:45254", "FMA:8879", "FMA:11250", "FMA:53049", "FMA:45382", "FMA:8795", "FMA:53495", "FMA:45434", "FMA:82963", "FMA:0328827", "FMA:52656", "FMA:82961", "FMA:11753", "FMA:39147", "FMA:45339", "FMA:20605", "FMA:20631", "FMA:8898", "FMA:6070", "FMA:44892", "FMA:16404", "FMA:52942", "FMA:6082", "FMA:8861", "FMA:82953", "FMA:8808", "FMA:8805", "FMA:52994", "FMA:65348", "FMA:55173", "FMA:7129", "FMA:52674", "FMA:44894", "FMA:55159", "FMA:65327", "FMA:37320", "FMA:6761", "FMA:65349", "FMA:11253", "FMA:53507", "FMA:11213", "FMA:7307", "FMA:6769", "FMA:6759", "FMA:55155", "FMA:53675", "FMA:53599", "FMA:65282", "FMA:53251", "FMA:6731", "FMA:11111", "FMA:16497", "FMA:8878", "FMA:11211", "FMA:65740", "FMA:45367", "FMA:53588", "FMA:45365", "UBERON:0011766", "FMA:16502", "FMA:6891", "FMA:6091", "FMA:11018", "FMA:6090", "FMA:292887", "FMA:65401", "FMA:65326", "FMA:11215", "FMA:44735", "FMA:8735", "FMA:53538", "FMA:6849", "FMA:53608", "FMA:11217", "FMA:8860", "FMA:6134", "FMA:6893", "FMA:53534", "FMA:45361", "FMA:37321", "FMA:82734", "FMA:22112", "FMA:7294", "FMA:52987", "FMA:65247", "FMA:53535", "FMA:6895", "FMA:52787", "FMA:53635", "FMA:65920", "FMA:55156", "FMA:16498", "FMA:53569", "FMA:6739", "FMA:8807", "FMA:22110", "FMA:81294", "FMA:45450", "FMA:8922", "FMA:8725", "FMA:20608", "FMA:7308", "FMA:65281", "FMA:39084", "FMA:78656", "FMA:6133", "FMA:53581", "FMA:16494", "FMA:53252", "FMA:11789", "FMA:45364", "FMA:65345", "FMA:44870", "FMA:39083", "FMA:45355", "FMA:11193", "FMA:16400", "FMA:81287", "FMA:52776", "FMA:65747", "FMA:8900", "UBERON:0011767", "FMA:45424", "FMA:292830", "FMA:44734", "FMA:45381", "FMA:82960", "FMA:0328831", "FMA:6689", "FMA:7077", "FMA:291236", "FMA:8886", "FMA:276381", "FMA:6124", "FMA:65336", "FMA:65328", "FMA:52670", "FMA:53537", "FMA:53636", "FMA:6896", "FMA:21879", "FMA:8798", "FMA:81288", "FMA:53542", "FMA:45368", "FMA:53547", "FMA:55157", "FMA:65415", "FMA:53309", "FMA:65744", "FMA:53367", "FMA:53590", "FMA:65923", "FMA:53048", "FMA:16499", "FMA:53610", "FMA:44951", "FMA:44953", "FMA:8832", "FMA:45426", "FMA:6114", "FMA:52799", "FMA:11039", "FMA:53546", "FMA:53589", "FMA:8901", "FMA:11681", "FMA:52639", "FMA:8905", "FMA:52733", "FMA:65992", "FMA:52807", "FMA:45435", "FMA:53484", "FMA:52975", "FMA:7289", "FMA:44905", "FMA:37071", "FMA:7130", "FMA:65996", "FMA:6132", "FMA:8826", "FMA:6741", "FMA:11252", "FMA:8917", "FMA:82954", "FMA:6832", "FMA:37073", "FMA:37074", "FMA:44893", "FMA:82959", "FMA:20635", "FMA:6093", "FMA:65248", "FMA:45362", "FMA:52622", "FMA:53508", "FMA:11755", "FMA:82958", "FMA:52997", "FMA:16501", "FMA:65402", "FMA:45427", "FMA:52803", "FMA:16402", "FMA:8734", "FMA:52784", "FMA:45454", "FMA:6736", "FMA:7304", "FMA:6742", "FMA:52998", "FMA:52804", "FMA:11788", "FMA:6713", "FMA:52623", "FMA:53536", "FMA:11780", "FMA:45334", "FMA:52701", "FMA:65998", "FMA:11092", "FMA:6684", "FMA:52779", "FMA:52778", "FMA:78652", "FMA:0328830", "FMA:6733", "FMA:44950", "FMA:78653", "FMA:45455", "FMA:8864", "FMA:8833", "FMA:8876", "FMA:8867", "FMA:11752", "FMA:53541", "FMA:53611", "FMA:8904", "FMA:6745", "FMA:21863", "FMA:7297", "FMA:52676", "FMA:52798", "FMA:8818", "FMA:82735", "FMA:52657", "FMA:52786", "FMA:6773", "FMA:45253", "FMA:6127", "FMA:45263", "FMA:8875", "FMA:81295", "FMA:11754", "FMA:8812", "FMA:45311", "FMA:53568", "FMA:276379", "FMA:6842", "FMA:8794", "FMA:8820", "FMA:53572", "FMA:53409", "FMA:37070", "FMA:6119", "FMA:53433", "FMA:7123", "FMA:8811", "FMA:65444", "FMA:52806", "FMA:53245", "FMA:65285", "FMA:6768", "FMA:8731", "FMA:11220", "FMA:6778", "FMA:53509", "FMA:55158", "FMA:53567", "FMA:65994", "FMA:53539", "FMA:45327", "FMA:8865", "FMA:44898", "FMA:52673", "FMA:80026", "FMA:52980", "FMA:53505", "FMA:82952", "FMA:21872", "FMA:37065", "FMA:52988", "FMA:8815", "FMA:53398", "FMA:52729", "FMA:81289", "FMA:65398", "FMA:52977", "FMA:8887"], "subclass labels": ["Left T9 white ramus communicans", "Right T10 grey ramus communicans", "Right T4 spinal nerve posterior ramus", "Right fourth intercostal nerve", "Right anterior interosseous nerve", "Right perineal nerve", "Left lateral calcaneal branch A of left sural nerve", "Right C3 spinal nerve posterior ramus medial branch", "Oesophageal branch of left recurrent laryngeal nerve", "Anterior branch of lateral cutaneous branch of left third intercostal nerve", "Left common plantar digital nerve F", "Anterior cutaneous branch of right subcostal nerve", "Left superior labial branch of infraorbital nerve", "Left T1 spinal nerve posterior ramus", "Anterior branch of left obturator nerve", "Right T2 grey ramus communicans", "Right T9 grey ramus communicans", "Left T5 white ramus communicans", "Left L3 spinal nerve posterior ramus lateral branch", "Communicating branch of left vagus nerve with left glossopharyngeal nerve", "Right second intercostal nerve", "Right proper palmar digital nerve G", "Left musculocutaneous nerve", "Anterior cutaneous branch of left ninth intercostal nerve", "Posterior branch of lateral cutaneous branch of left sixth intercostal nerve", "Right proper palmar digital nerve H", "Communicating branch of right vagus nerve with right glossopharyngeal nerve", "Anterior branch of lateral cutaneous branch of right ninth intercostal nerve", "Right proper plantar digital nerve C", "Left genital branch of genitofemoral nerve", "Left T6 grey ramus communicans", "Right proper palmar digital nerve I", "Right T12 spinal nerve posterior ramus", "Right ilioinguinal nerve", "Right T8 spinal nerve posterior ramus", "Left T9 spinal nerve posterior ramus", "Right T11 spinal nerve posterior ramus lateral branch", "Right proper plantar digital nerve J", "Right medial sural cutaneous nerve", "Right T6 spinal nerve posterior ramus medial branch", "Right lesser occipital nerve", "Right phrenic nerve", "Right proper palmar digital nerve E", "Left median nerve", "Right S3 grey ramus communicans", "Right T4 white ramus communicans", "Right medial cutaneous nerve of forearm", "Right posterior femoral cutaneous nerve", "Right vestibular nerve", "Lateral cutaneous branch of left sixth intercostal nerve", "Left supratrochlear nerve", "Right median nerve", "Anterior branch of right medial cutaneous nerve of forearm", "Right T5 spinal nerve posterior ramus medial branch", "Anterior cutaneous branch of right third intercostal nerve", "Right C6 spinal nerve posterior ramus", "Temporal branch of left facial nerve", "Anterior cutaneous branch of left eighth intercostal nerve", "Right buccal nerve", "Right middle superior alveolar nerve", "Temporal branch of right facial nerve", "Left superficial branch of radial nerve", "Left medial sural cutaneous nerve", "Left C4 spinal nerve posterior ramus", "Left lateral dorsal digital nerve of the third toe", "Right T12 spinal nerve posterior ramus lateral branch", "Anterior branch of lateral cutaneous branch of left eleventh intercostal nerve", "Left T12 spinal nerve posterior ramus", "Left anterior supraclavicular nerve", "Left lesser occipital nerve", "Right deep fibular nerve", "Left T11 spinal nerve posterior ramus", "Posterior branch of lateral cutaneous branch of left tenth intercostal nerve", "Right anterior superior alveolar nerve", "Left tenth intercostal nerve", "Anterior branch of lateral cutaneous branch of right fourth intercostal nerve", "Communicating branch of left glossopharyngeal nerve with auricular branch of left vagus nerve", "Left iliohypogastric nerve", "Cervical branch of left facial nerve", "Right proper palmar digital nerve J", "Lateral cutaneous branch of right sixth intercostal nerve", "Right T8 white ramus communicans", "Left maxillary nerve", "Left intercostobrachial nerve", "Left tentorial nerve", "Right zygomaticotemporal nerve", "Communicating branch of right internal laryngeal nerve with right recurrent laryngeal nerve", "Left fourth intercostal nerve", "Brachial plexus left C7 root", "Vagal branch to right carotid body", "Right proper plantar digital nerve G", "Right tympanic nerve", "Left lateral plantar nerve", "Lateral cutaneous branch of left tenth intercostal nerve", "Right tibial nerve", "Left third occipital nerve", "Anterior branch of lateral cutaneous branch of left tenth intercostal nerve", "Right T8 spinal nerve posterior ramus lateral branch", "Right S1 grey ramus communicans", "Left L3 spinal nerve posterior ramus", "Palmar cutaneous branch of left ulnar nerve", "Right greater petrosal nerve", "Left subcostal nerve", "Anterior branch of left medial cutaneous nerve of forearm", "Left proper plantar digital nerve C", "Left C3 spinal nerve branch to left supraclavicular nerve", "Right posterior cutaneous nerve of forearm", "Posterior branch of lateral cutaneous branch of right tenth intercostal nerve", "Right sciatic nerve", "Left L5 grey ramus communicans", "Right C4 spinal nerve posterior ramus medial branch", "Right L4 grey ramus communicans", "Left T11 white ramus communicans", "Posterior branch of lateral cutaneous branch of right eighth intercostal nerve", "Left L1 grey ramus communicans", "Posterior branch of left medial cutaneous nerve of forearm", "Left auriculotemporal nerve", "Left L2 white ramus communicans", "Marginal mandibular branch of right facial nerve", "Right T8 grey ramus communicans", "Right C4 spinal nerve posterior ramus", "Right fifth intercostal nerve", "Left common fibular nerve", "Left posterior ethmoidal nerve", "Pharyngeal branch of right glossopharyngeal nerve", "Anterior branch of lateral cutaneous branch of right third intercostal nerve", "Communicating branch of right external laryngeal nerve with right superior cardiac nerve", "Right posterior supraclavicular nerve", "Left medial dorsal cutaneous nerve", "Lateral cutaneous branch of right eleventh intercostal nerve", "Posterior branch of lateral cutaneous branch of left subcostal nerve", "Anterior cutaneous branch of left second intercostal nerve", "Left lingual nerve", "Right lateral calcaneal branch A of right sural nerve", "Left phrenic nerve", "Right hypogastric nerve", "Medial calcaneal branch A of left tibial nerve", "Left perineal nerve", "Right posterior scrotal nerve", "Right inferior alveolar nerve", "Medial calcaneal branch A of right tibial nerve", "Right T7 white ramus communicans", "Left frontal nerve", "Right T1 spinal nerve posterior ramus medial branch", "Right genitofemoral nerve", "Zygomatic branch of right facial nerve", "Lateral cutaneous branch of left ninth intercostal nerve", "Left C2 spinal nerve branch to left great auricular nerve", "Right anterior supraclavicular nerve", "Lateral cutaneous branch of right fourth intercostal nerve", "Left T11 grey ramus communicans", "Lingual branch of right vagus nerve", "Left T1 white ramus communicans", "Left C3 spinal nerve posterior ramus medial branch", "Left proper plantar digital nerve J", "Left T2 grey ramus communicans", "Brachial plexus left C6 root", "Left T10 spinal nerve posterior ramus", "Right genital branch of genitofemoral nerve", "Anterior cutaneous branch of right first intercostal nerve", "Left middle meningeal nerve", "Anterior cutaneous branch of left eleventh intercostal nerve", "Left infratrochlear nerve", "Vagal branch to left carotid body", "Anterior cutaneous branch of right eleventh intercostal nerve", "Right proper palmar digital nerve B", "Left proper palmar digital nerve H", "Anterior branch of lateral cutaneous branch of left fourth intercostal nerve", "Left seventh intercostal nerve", "Right nasociliary nerve", "Left posterior scrotal nerve", "Left sural nerve", "Right S5 grey ramus communicans", "Brachial plexus right C7 root", "Right inferior rectal nerve", "Right transverse cervical nerve", "Anterior cutaneous branch of left third intercostal nerve", "Left proper plantar digital nerve H", "Superficial branch of left ulnar nerve", "Dorsal branch of left ulnar nerve", "Right eleventh intercostal nerve", "Right T2 white ramus communicans", "Right common plantar digital nerve F", "Infrapatellar branch of right saphenous nerve", "Left T5 grey ramus communicans", "Lingual branch of left vagus nerve", "Thoracic cardiac branch of left vagus nerve", "Right superior laryngeal nerve", "Right C2 spinal nerve posterior ramus", "Right zygomatic nerve", "Right auriculotemporal nerve", "Anterior branch of lateral cutaneous branch of left subcostal nerve", "Left saphenous nerve", "Right L3 spinal nerve posterior ramus", "Right T7 grey ramus communicans", "Left great auricular nerve posterior branch", "Left proper palmar digital nerve A", "Right infraorbital nerve", "Cutaneous branch of right obturator nerve", "Posterior branch of right obturator nerve", "Left T1 grey ramus communicans", "Right T12 white ramus communicans", "Right proper plantar digital nerve F", "Left posterior auricular nerve", "Right posterior ethmoidal nerve", "Buccal branch of right facial nerve", "Right iliohypogastric nerve", "Left dorsal nerve of penis", "Right inferior lateral cutaneous nerve of arm", "Left T7 spinal nerve posterior ramus lateral branch", "Lateral cutaneous branch of left seventh intercostal nerve", "Right posterior interosseous nerve", "Left middle superior alveolar nerve", "Right T9 white ramus communicans", "Right T10 spinal nerve posterior ramus", "Left deep fibular nerve", "Hepatic branch of anterior vagal trunk", "Left first intercostal nerve", "Right L2 white ramus communicans", "Buccal branch of left facial nerve", "Right L5 grey ramus communicans", "Right common fibular nerve", "Left T6 spinal nerve posterior ramus medial branch", "Right L2 grey ramus communicans", "Right deep petrosal nerve", "Left axillary nerve posterior branch", "Right posterior auricular nerve", "Anterior branch of lateral cutaneous branch of right subcostal nerve", "Anterior branch of lateral cutaneous branch of right fifth intercostal nerve", "Pyloric branch of greater posterior gastric nerve", "Left T10 spinal nerve posterior ramus lateral branch", "Superior cervical cardiac branch of right vagus nerve", "Ganglionic branch of right maxillary nerve to pterygopalatine ganglion", "Left proper palmar digital nerve C", "Right superior cervical cardiac nerve", "Right ninth intercostal nerve", "Right lesser petrosal nerve", "Communicating branch of left external laryngeal nerve with left superior cardiac nerve", "Right long ciliary nerve B", "Anterior cutaneous branch of right fourth intercostal nerve", "Right third intercostal nerve", "Left L4 grey ramus communicans", "Right T7 spinal nerve posterior ramus", "Left L2 spinal nerve posterior ramus lateral branch", "Left proper palmar digital nerve F", "Coeliac branch of posterior vagal trunk", "Left lacrimal nerve", "Right lacrimal nerve", "Anterior cutaneous branch of right seventh intercostal nerve", "Left femoral nerve", "Right maxillary nerve", "Lateral cutaneous branch of right third intercostal nerve", "Right superficial fibular nerve", "Left proper palmar digital nerve I", "Anterior cutaneous branch of left seventh intercostal nerve", "Left T12 spinal nerve posterior ramus lateral branch", "Thoracic cardiac branch of right vagus nerve", "Lateral cutaneous branch of left eighth intercostal nerve", "Orbital branch of left maxillary nerve to left ethmoidal sinus", "Left pudendal nerve", "Left lesser petrosal nerve", "Right eighth intercostal nerve", "Left S5 grey ramus communicans", "Right T10 white ramus communicans", "Left T10 white ramus communicans", "Left T4 white ramus communicans", "Lateral cutaneous branch of left third intercostal nerve", "Posterior branch of lateral cutaneous branch of left eighth intercostal nerve", "Lateral cutaneous branch of right iliohypogastric nerve", "Right supratrochlear nerve", "Anterior branch of lateral cutaneous branch of right tenth intercostal nerve", "Right C3 spinal nerve branch to right supraclavicular nerve", "Right T6 grey ramus communicans", "Left T5 spinal nerve posterior ramus medial branch", "Left proper palmar digital nerve G", "Left posterior superior alveolar nerve", "Lateral cutaneous branch of left subcostal nerve", "Gluteal branch A of right posterior femoral cutaneous nerve", "Right T5 white ramus communicans", "Left greater petrosal nerve", "Left T3 spinal nerve posterior ramus", "Right subcostal nerve", "Right femoral branch of genitofemoral nerve", "Right sixth intercostal nerve", "Anterior cutaneous branch of right ninth intercostal nerve", "Left T11 spinal nerve posterior ramus lateral branch", "Left T7 grey ramus communicans", "Posterior branch of lateral cutaneous branch of right subcostal nerve", "Left L2 grey ramus communicans", "Posterior branch of lateral cutaneous branch of right third intercostal nerve", "Right L1 white ramus communicans", "Anterior branch of right obturator nerve", "Anterior cutaneous branch of left fifth intercostal nerve", "Left T4 grey ramus communicans", "Right C5 spinal nerve posterior ramus medial branch", "Right T4 spinal nerve posterior ramus medial branch", "Left L1 white ramus communicans", "Anterior cutaneous branch of right eighth intercostal nerve", "Left subclavian nerve", "Pericardial branch of left phrenic nerve", "Left tympanic nerve", "Right zygomaticofacial nerve", "Right intercostobrachial nerve", "Right cochlear nerve", "Left internal laryngeal nerve", "Right lateral dorsal digital nerve of the third toe", "Left proper palmar digital nerve D", "Inferior cervical cardiac branch of left vagus nerve", "Left proper plantar digital nerve B", "Right S2 grey ramus communicans", "Right proper plantar digital nerve H", "Right tentorial nerve", "Right T1 white ramus communicans", "Inferior ramus of left internal laryngeal nerve", "Right L3 grey ramus communicans", "Right posterior superior alveolar nerve", "Tonsillar branch of right glossopharyngeal nerve", "Lateral cutaneous branch of right subcostal nerve", "Right proper palmar digital nerve C", "Right first intercostal nerve", "Posterior branch of right medial cutaneous nerve of forearm", "Right lingual nerve", "Lateral cutaneous branch of right fifth intercostal nerve", "Left T4 spinal nerve posterior ramus", "Posterior branch of lateral cutaneous branch of left third intercostal nerve", "Right posterior superior lateral nasal branch of maxillary nerve", "Posterior branch of lateral cutaneous branch of right fifth intercostal nerve", "Left buccal nerve", "Right third occipital nerve", "Left anterior ethmoidal nerve", "Right lingual branch of glossopharyngeal nerve", "Left laryngopharyngeal branch of superior cervical ganglion", "Right infratrochlear nerve", "Left external laryngeal nerve branch to pharyngeal plexus", "Left T7 white ramus communicans", "Left L1 spinal nerve posterior ramus", "Right S4 grey ramus communicans", "Left proper palmar digital nerve J", "Left zygomatic nerve", "Left L1 spinal nerve posterior ramus lateral branch", "Left greater occipital nerve", "Left medial cutaneous nerve of forearm", "Brachial plexus left C8 root", "Left anterior femoral cutaneous branch A", "Posterior branch of lateral cutaneous branch of left seventh intercostal nerve", "Left T1 spinal nerve posterior ramus medial branch", "Left meningeal branch of mandibular nerve", "Left medial dorsal digital nerve of the fourth toe", "Left C5 spinal nerve posterior ramus", "Pharyngeal branch of left glossopharyngeal nerve", "Right medial plantar nerve", "Left proper plantar digital nerve F", "Left deep petrosal nerve", "Right supraorbital nerve", "Left proper plantar digital nerve E", "Right T9 spinal nerve posterior ramus lateral branch", "Left posterior cutaneous nerve of forearm", "Left posterior femoral cutaneous nerve", "Left hypogastric nerve", "Left genitofemoral nerve", "Anterior branch of lateral cutaneous branch of left ninth intercostal nerve", "Right T1 spinal nerve posterior ramus", "Right common palmar digital nerve A", "Right L3 spinal nerve posterior ramus lateral branch", "Left anterior superior alveolar nerve", "Right T1 grey ramus communicans", "Anterior cutaneous branch of left sixth intercostal nerve", "Left proper plantar digital nerve A", "Left T5 spinal nerve posterior ramus", "Right T3 spinal nerve posterior ramus", "Right superior labial branch of infraorbital nerve", "Left proper palmar digital nerve E", "Left transverse cervical nerve", "Posterior branch of lateral cutaneous branch of right fourth intercostal nerve", "Left communicating branch of nasociliary nerve with ciliary ganglion", "Superficial branch of right ulnar nerve", "Right great auricular nerve posterior branch", "Palmar branch of right median nerve", "Right ulnar nerve", "Right T5 grey ramus communicans", "Palmar cutaneous branch of right ulnar nerve", "Left T2 spinal nerve posterior ramus medial branch", "Tonsillar branch of left glossopharyngeal nerve", "Lateral cutaneous branch of right eighth intercostal nerve", "Posterior branch of lateral cutaneous branch of right eleventh intercostal nerve", "Left T6 white ramus communicans", "Right T4 grey ramus communicans", "Branch of right vagus nerve to oesophageal nerve plexus", "Superior cervical cardiac branch of left vagus nerve", "Left long thoracic nerve", "Right mental nerve", "Left fifth intercostal nerve", "Lateral cutaneous branch of left fourth intercostal nerve", "Right lateral femoral cutaneous nerve", "Posterior branch of lateral cutaneous branch of right seventh intercostal nerve", "Lateral cutaneous branch of right seventh intercostal nerve", "Left C4 spinal nerve posterior ramus medial branch", "Right intermediate dorsal cutaneous nerve", "Right medial dorsal cutaneous nerve", "Left recurrent laryngeal nerve", "Left obturator nerve", "Left T8 grey ramus communicans", "Right T2 spinal nerve posterior ramus", "Right T3 spinal nerve posterior ramus medial branch", "Left T2 spinal nerve posterior ramus", "Right superficial branch of radial nerve", "Right C3 spinal nerve branch to right great auricular nerve", "Left anterior interosseous nerve", "Lateral cutaneous branch of right ninth intercostal nerve", "Left common plantar digital nerve E", "Brachial plexus left C5 root", "Left external laryngeal nerve", "Left C3 spinal nerve posterior ramus", "Oesophageal branch of right recurrent laryngeal nerve", "Lateral cutaneous branch of right tenth intercostal nerve", "Anterior cutaneous branch of right sixth intercostal nerve", "Right T3 white ramus communicans", "Left T9 grey ramus communicans", "Auricular branch of right vagus nerve", "Right lateral sural cutaneous nerve", "Left ulnar nerve", "Right long ciliary nerve A", "Left sciatic nerve", "Anterior branch of lateral cutaneous branch of left fifth intercostal nerve", "Right inferior palpebral branch of infraorbital nerve", "Right medial cutaneous nerve of arm", "Auricular branch of left vagus nerve", "Left T10 grey ramus communicans", "Left medial posterior superior nasal nerve", "Pharyngeal branch of right vagus nerve to pharyngeal nerve plexus", "Left L3 grey ramus communicans", "Left lateral femoral cutaneous nerve", "Right external laryngeal nerve branch to pharyngeal plexus", "Left eighth intercostal nerve", "Right T5 spinal nerve posterior ramus", "Left tibial nerve", "Right superior lateral cutaneous nerve of arm", "Right lateral plantar nerve", "Anterior cutaneous branch of left first intercostal nerve", "Brachial plexus right C8 root", "Lateral cutaneous branch of left iliohypogastric nerve", "Posterior branch of lateral cutaneous branch of left eleventh intercostal nerve", "Right long thoracic nerve", "Left lateral cutaneous nerve of forearm", "Left posterior supraclavicular nerve", "Left T3 grey ramus communicans", "Left ilioinguinal nerve", "Left mental nerve", "Left T12 white ramus communicans", "Left superficial fibular nerve", "Right proper palmar digital nerve F", "Right proper palmar digital nerve D", "Right lateral cutaneous nerve of forearm", "Gluteal branch A of left posterior femoral cutaneous nerve", "Lateral cutaneous branch of left fifth intercostal nerve", "Right L1 spinal nerve posterior ramus lateral branch", "Right axillary nerve anterior branch", "Orbital branch of right maxillary nerve to right ethmoidal sinus", "Right C6 spinal nerve posterior ramus medial branch", "Posterior branch of lateral cutaneous branch of right ninth intercostal nerve", "Right recurrent laryngeal nerve", "Right sural nerve", "Dorsal branch of right ulnar nerve", "Right common plantar digital nerve E", "Right medial dorsal digital nerve of the fourth toe", "Right proper plantar digital nerve E", "Left caroticotympanic nerve", "Greater posterior gastric nerve", "Right L1 spinal nerve posterior ramus", "Pericardial branch of right phrenic nerve", "Anterior branch of lateral cutaneous branch of right eighth intercostal nerve", "Left incisive branch of inferior alveolar nerve", "Right T3 grey ramus communicans", "Left posterior interosseous nerve", "Palmar branch of left median nerve", "Left nasociliary nerve", "Right external laryngeal nerve", "Pharyngeal branch of left vagus nerve to pharyngeal nerve plexus", "Right T11 grey ramus communicans", "Right dorsal nerve of penis", "Left C6 spinal nerve posterior ramus", "Left axillary nerve anterior branch", "Meningeal branch of left vagus nerve", "Left intermediate dorsal cutaneous nerve", "Right laryngopharyngeal branch of superior cervical ganglion", "Right great auricular nerve anterior branch", "Zygomatic branch of left facial nerve", "Left C5 spinal nerve posterior ramus medial branch", "Marginal mandibular branch of left facial nerve", "Right L1 grey ramus communicans", "Right meningeal branch of mandibular nerve", "Right femoral nerve", "Tracheal branch of right recurrent laryngeal nerve", "Left posterior cutaneous nerve of arm", "Left inferior lateral cutaneous nerve of arm", "Right L2 spinal nerve posterior ramus", "Right lateral dorsal cutaneous nerve", "Anterior cutaneous branch of right second intercostal nerve", "Left nasopalatine nerve", "Left T3 spinal nerve posterior ramus medial branch", "Left superior cervical cardiac nerve", "Posterior branch of lateral cutaneous branch of left ninth intercostal nerve", "Right T7 spinal nerve posterior ramus lateral branch", "Right frontal nerve", "Anterior cutaneous branch of left tenth intercostal nerve", "Ganglionic branch of left maxillary nerve to pterygopalatine ganglion", "Left S1 grey ramus communicans", "Left lesser palatine nerve", "Left medial plantar nerve", "Communicating branch of right glossopharyngeal nerve with auricular branch of right vagus nerve", "Left zygomaticotemporal nerve", "Anterior cutaneous branch of right fifth intercostal nerve", "Left proper palmar digital nerve B", "Left radial nerve", "Posterior branch of lateral cutaneous branch of left fourth intercostal nerve", "Left S3 grey ramus communicans", "Left T3 white ramus communicans", "Right T11 spinal nerve posterior ramus", "Left ninth intercostal nerve", "Right T2 spinal nerve posterior ramus medial branch", "Anterior cutaneous branch of left subcostal nerve", "Right proper plantar digital nerve B", "Left C2 spinal nerve posterior ramus", "Right axillary nerve", "Left axillary nerve", "Left common palmar digital nerve A", "Left proper plantar digital nerve D", "Left femoral branch of genitofemoral nerve", "Left second intercostal nerve", "Left medial cutaneous nerve of arm", "Left lateral sural cutaneous nerve", "Right ophthalmic nerve", "Right carotid sinus nerve", "Right T10 spinal nerve posterior ramus lateral branch", "Right proper plantar digital nerve D", "Right mandibular nerve", "Right obturator nerve", "Left C3 spinal nerve branch to left great auricular nerve", "Left lateral dorsal cutaneous nerve", "Right greater palatine nerve", "Right L2 spinal nerve posterior ramus lateral branch", "Brachial plexus right C5 root", "Left posterior superior lateral nasal branch of maxillary nerve", "Right proper plantar digital nerve I", "Right seventh intercostal nerve", "Anterior branch of lateral cutaneous branch of right eleventh intercostal nerve", "Right tenth intercostal nerve", "Left mandibular nerve", "Left greater palatine nerve", "Left T12 grey ramus communicans", "Inferior cervical cardiac branch of right vagus nerve", "Left ophthalmic nerve", "Left superior laryngeal nerve", "Right T12 grey ramus communicans", "Cutaneous branch of left obturator nerve", "Left long ciliary nerve B", "Left S4 grey ramus communicans", "Left T4 spinal nerve posterior ramus medial branch", "Greater anterior gastric nerve", "Orbital branch of left maxillary nerve to left sphenoidal sinus", "Orbital branch of right maxillary nerve to right sphenoidal sinus", "Right middle supraclavicular nerve", "Right caroticotympanic nerve", "Left sixth intercostal nerve", "Right posterior cutaneous nerve of arm", "Left middle supraclavicular nerve", "Left proper plantar digital nerve I", "Anterior branch of lateral cutaneous branch of right sixth intercostal nerve", "Left L2 spinal nerve posterior ramus", "Anterior branch of lateral cutaneous branch of left seventh intercostal nerve", "Posterior branch of lateral cutaneous branch of right sixth intercostal nerve", "Left T8 spinal nerve posterior ramus lateral branch", "Meningeal branch of right vagus nerve", "Tracheal branch of left recurrent laryngeal nerve", "Anterior cutaneous branch of right tenth intercostal nerve", "Left eleventh intercostal nerve", "Right pudendal nerve", "Posterior branch of lateral cutaneous branch of left fifth intercostal nerve", "Right anterior ethmoidal nerve", "Right nasopalatine nerve", "Left T8 spinal nerve posterior ramus", "Left long ciliary nerve A", "Left supraorbital nerve", "Right medial posterior superior nasal nerve", "Left T8 white ramus communicans", "Right anterior femoral cutaneous branch A", "Left T2 white ramus communicans", "Right saphenous nerve", "Anterior branch of lateral cutaneous branch of right seventh intercostal nerve", "Left superior lateral cutaneous nerve of arm", "Left T9 spinal nerve posterior ramus lateral branch", "Left T6 spinal nerve posterior ramus", "Posterior branch of left obturator nerve", "Left external laryngeal nerve branch to inferior pharyngeal constrictor", "Right incisive branch of inferior alveolar nerve", "Right C3 spinal nerve posterior ramus", "Right C5 spinal nerve posterior ramus", "Right T9 spinal nerve posterior ramus", "Communicating branch of left internal laryngeal nerve with left recurrent laryngeal nerve", "Left vestibular nerve", "Right radial nerve", "Left third intercostal nerve", "Left cochlear nerve", "Anterior cutaneous branch of left fourth intercostal nerve", "Right T6 spinal nerve posterior ramus", "Right greater occipital nerve", "Right lesser palatine nerve", "Left inferior alveolar nerve", "Right subclavian nerve", "Right T6 white ramus communicans", "Brachial plexus right C6 root", "Lateral cutaneous branch of left eleventh intercostal nerve", "Right T11 white ramus communicans", "Left carotid sinus nerve", "Left great auricular nerve anterior branch", "Right external laryngeal nerve branch to inferior pharyngeal constrictor", "Left S2 grey ramus communicans", "Right internal laryngeal nerve", "Infrapatellar branch of left saphenous nerve", "Anterior branch of lateral cutaneous branch of left sixth intercostal nerve", "Right proper palmar digital nerve A", "Right communicating branch of nasociliary nerve with ciliary ganglion", "Left proper plantar digital nerve G", "Left infraorbital nerve", "Left lingual branch of glossopharyngeal nerve", "Right proper plantar digital nerve A", "Left inferior rectal nerve", "Right musculocutaneous nerve", "Left inferior palpebral branch of infraorbital nerve", "Left T7 spinal nerve posterior ramus", "Cervical branch of right facial nerve", "Right middle meningeal nerve", "Right axillary nerve posterior branch", "Right C2 spinal nerve branch to right great auricular nerve", "Left zygomaticofacial nerve", "Anterior branch of lateral cutaneous branch of left eighth intercostal nerve"] }, { id: 77, nerve_id: "UBERON:0001647", label: "facial nerve", "FMA subclasses (in human nerves)": ["FMA:50888", "FMA:50889"], "subclass labels": ["Right facial nerve", "Left facial nerve"] }, { id: 78, nerve_id: "UBERON:0001148", label: "median nerve", "FMA subclasses (in human nerves)": ["FMA:37067", "FMA:37068"], "subclass labels": ["Right median nerve", "Left median nerve"] }, { id: 79, nerve_id: "UBERON:0009009", label: "carotid sinus nerve", "FMA subclasses (in human nerves)": ["FMA:53508", "FMA:53509"], "subclass labels": ["Right carotid sinus nerve", "Left carotid sinus nerve"] }, { id: 80, nerve_id: "UBERON:0003715", label: "splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6924", "FMA:6928", "FMA:6929", "FMA:6931", "FMA:6930", "FMA:6960", "FMA:6958", "FMA:6959", "FMA:6925", "FMA:6956", "FMA:6927", "FMA:6955", "FMA:6926", "FMA:6957"], "subclass labels": ["Right first lumbar splanchnic nerve", "Right third lumbar splanchnic nerve", "Left third lumbar splanchnic nerve", "Left fourth lumbar splanchnic nerve", "Right fourth lumbar splanchnic nerve", "Left least splanchnic nerve", "Left lesser splanchnic nerve", "Right least splanchnic nerve", "Left first lumbar splanchnic nerve", "Right greater splanchnic nerve", "Left second lumbar splanchnic nerve", "Left greater splanchnic nerve", "Right second lumbar splanchnic nerve", "Right lesser splanchnic nerve"] }, { id: 81, nerve_id: "ILX:0793826", label: "anterior abdominal vagal trunk", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 82, nerve_id: "UBERON:0001650", label: "hypoglossal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 83, nerve_id: "ILX:0794967", label: "posterior interosseous nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 84, nerve_id: "ILX:0793713", label: "Deep petrosal nerve", "FMA subclasses (in human nerves)": ["FMA:0328827", "FMA:0328826"], "subclass labels": ["Left deep petrosal nerve", "Right deep petrosal nerve"] }, { id: 85, nerve_id: "ILX:0793361", label: "white communicating ramus of third lumbar spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 86, nerve_id: "ILX:0787562", label: "gray communicating ramus of the third thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6133", "FMA:6124"], "subclass labels": ["Left T3 grey ramus communicans", "Right T3 grey ramus communicans"] }, { id: 87, nerve_id: "ILX:0793211", label: "white communicating ramus of fifth thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 88, nerve_id: "UBERON:0018679", label: "thoracic splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6958", "FMA:6960", "FMA:6955", "FMA:6959", "FMA:6957", "FMA:6956"], "subclass labels": ["Left lesser splanchnic nerve", "Left least splanchnic nerve", "Left greater splanchnic nerve", "Right least splanchnic nerve", "Right lesser splanchnic nerve", "Right greater splanchnic nerve"] }, { id: 89, nerve_id: "ILX:0731969", label: "least splanchnic nerve", "FMA subclasses (in human nerves)": ["FMA:6960", "FMA:6959"], "subclass labels": ["Left least splanchnic nerve", "Right least splanchnic nerve"] }, { id: 90, nerve_id: "ILX:0788771", label: "gray communicating ramus of seventh thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6888", "FMA:6889"], "subclass labels": ["Right T7 grey ramus communicans", "Left T7 grey ramus communicans"] }, { id: 91, nerve_id: "UBERON:0022301", label: "long ciliary nerve", "FMA subclasses (in human nerves)": ["FMA:52701", "FMA:52700", "FMA:82734", "FMA:82735"], "subclass labels": ["Left long ciliary nerve B", "Right long ciliary nerve B", "Right long ciliary nerve A", "Left long ciliary nerve A"] }, { id: 92, nerve_id: "ILX:0793221", label: "white communicating ramus of second lumbar spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 93, nerve_id: "ILX:0785825", label: "gray communicating ramus of first lumbar nerve", "FMA subclasses (in human nerves)": ["FMA:65924", "FMA:65923"], "subclass labels": ["Left L1 grey ramus communicans", "Right L1 grey ramus communicans"] }, { id: 94, nerve_id: "ILX:0793208", label: "white communicating ramus of second thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 95, nerve_id: "UBERON:0018412", label: "vidian nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 96, nerve_id: "ILX:0739303", label: "gray communicating ramus of second thoracic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 97, nerve_id: "ILX:0795006", label: "Suboccipital nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 98, nerve_id: "ILX:0785733", label: "gray communicating ramus of second lumbar nerve", "FMA subclasses (in human nerves)": ["FMA:65921", "FMA:65922"], "subclass labels": ["Right L2 grey ramus communicans", "Left L2 grey ramus communicans"] }, { id: 99, nerve_id: "UBERON:0035207", label: "deep fibular nerve", "FMA subclasses (in human nerves)": ["FMA:45387", "FMA:45388"], "subclass labels": ["Right deep fibular nerve", "Left deep fibular nerve"] }, { id: 100, nerve_id: "ILX:0739304", label: "gray communicating ramus of third thoracic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 101, nerve_id: "UBERON:0002019", label: "accessory XI nerve", "FMA subclasses (in human nerves)": ["FMA:50899", "FMA:50897"], "subclass labels": ["Left accessory nerve", "Right accessory nerve"] }, { id: 102, nerve_id: "ILX:0793217", label: "white communicating ramus of eleventh thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 103, nerve_id: "ILX:0793722", label: "Lesser petrosal nerve", "FMA subclasses (in human nerves)": ["FMA:53503", "FMA:53502"], "subclass labels": ["Left lesser petrosal nerve", "Right lesser petrosal nerve"] }, { id: 104, nerve_id: "UBERON:0018675", label: "pelvic splanchnic nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 105, nerve_id: "ILX:0793702", label: "Greater petrosal nerve", "FMA subclasses (in human nerves)": ["FMA:53423", "FMA:53424"], "subclass labels": ["Right greater petrosal nerve", "Left greater petrosal nerve"] }, { id: 106, nerve_id: "ILX:0794916", label: "white ramus communicans", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 107, nerve_id: "UBERON:0003716", label: "Recurrent Laryngeal Nerve", "FMA subclasses (in human nerves)": ["UBERON:0011766", "UBERON:0011767"], "subclass labels": ["Left recurrent laryngeal nerve", "Right recurrent laryngeal nerve"] }, { id: 108, nerve_id: "UBERON:0005465", label: "obturator nerve", "FMA subclasses (in human nerves)": ["FMA:16501", "FMA:16502"], "subclass labels": ["Right obturator nerve", "Left obturator nerve"] }, { id: 109, nerve_id: "ILX:0793213", label: "white communicating ramus of seventh thoracic spinal nerve", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 110, nerve_id: "ILX:0785067", label: "gray communicating ramus of eleventh thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6897", "FMA:6896"], "subclass labels": ["Left T11 grey ramus communicans", "Right T11 grey ramus communicans"] }, { id: 111, nerve_id: "UBERON:0001494", label: "ulnar nerve", "FMA subclasses (in human nerves)": ["FMA:37320", "FMA:37321"], "subclass labels": ["Right ulnar nerve", "Left ulnar nerve"] }, { id: 112, nerve_id: "ILX:0794959", label: "posterior rami lower cervical nerves", "FMA subclasses (in human nerves)": [], "subclass labels": [] }, { id: 113, nerve_id: "UBERON:0001493", label: "axillary nerve", "FMA subclasses (in human nerves)": ["FMA:37074", "FMA:37073"], "subclass labels": ["Left axillary nerve", "Right axillary nerve"] }, { id: 114, nerve_id: "ILX:0787946", label: "gray communicating ramus of sixth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6762", "FMA:6763"], "subclass labels": ["Right T6 grey ramus communicans", "Left T6 grey ramus communicans"] }, { id: 115, nerve_id: "ILX:0785542", label: "gray communicating ramus of ninth thoracic nerve", "FMA subclasses (in human nerves)": ["FMA:6892", "FMA:6893"], "subclass labels": ["Right T9 grey ramus communicans", "Left T9 grey ramus communicans"] } ], F5 = () => { const n = {}; return R5.forEach((e) => { e.nerve_id && e.label !== "nerve" && e["subclass labels"].forEach((t) => { t in n || (n[t.toLowerCase()] = e.nerve_id); }); }), n; }, P5 = [ { label: "urinary bladder", anatomicalId: "UBERON:0001255" }, { label: "brainstem", anatomicalId: "UBERON:0002298" }, { label: "caecum", anatomicalId: "UBERON:0001153" }, { label: "colon", anatomicalId: "UBERON:0001155" }, { label: "esophagus", anatomicalId: "UBERON:0001043" }, { label: "small intestine", anatomicalId: "UBERON:0002108" }, { label: "stomach", anatomicalId: "UBERON:0000945" }, { label: "heart", anatomicalId: "UBERON:0000948" }, { label: "lung", anatomicalId: "UBERON:0002048" } ], I5 = () => { const n = {}; return P5.forEach((e) => { const t = e.label.toLowerCase(); t in n || (n[t.toLowerCase()] = e.anatomicalId); }), n; }, Ov = F5(), Dv = I5(), O5 = { name: "ScaffoldVuer", components: { Button: Ko, Col: bi, Loading: y3, Option: Qo, Popover: cu, Radio: ty, RadioGroup: ny, Row: Ui, Select: qo, Slider: ti, TabPane: xy, Tabs: by, MapSvgIcon: rw, MapSvgSpriteColor: sw, PrimitiveControls: _M, ScaffoldTooltip: EM, ElIconWarningFilled: u0, ElIconArrowDown: Xd, ElIconArrowLeft: zr, DrawToolbar: tw, ScaffoldTreeControls: TM }, setup(n) { let e = pt("$annotator"); return e || (e = An(new ow(`${n.flatmapAPI}annotator`)), sn("$annotator", e)), { annotator: e }; }, props: { /** * The option to show annotation information in sidebar */ annotationSidebar: { type: Boolean, default: !1 }, /** * URL of the zincjs metadata. This value will be ignored if a valid * state prop is also provided. * If the url needs to be updated with state present, please use * the setURL method. */ url: { type: String, default: "" }, /** * Show the colour control of set to true. */ showColourPicker: { type: Boolean, default: !1 }, /** * Flag to show/hide the UI. */ displayUI: { type: Boolean, default: !0 }, /** * Display all graphics at start. * * This setting only works when traditional is set to false. */ displayAtStartUp: { type: Boolean, default: !0 }, /** * Use for toggling the help tooltips. */ helpMode: { type: Boolean, default: !1 }, /** * The active item index of help mode. */ helpModeActiveItem: { type: Number, default: 0 }, /** * The option to use helpModeDialog. * On default, `false`, clicking help will show all tooltips. * If `true`, clicking help will show the help-mode-dialog. */ helpModeDialog: { type: Boolean, default: !1 }, /** * The last item of help mode. */ helpModeLastItem: { type: Boolean, default: !1 }, /** * The initial index number for help mode tooltips. * Set negative (e.g. -1) if there are other tooltips outside of `hoverVisibilities`. */ helpModeInitialIndex: { type: Number, default: 0 }, /** * Use for show/display beta warning icon. */ displayWarning: { type: Boolean, default: !0 }, /** * Warning message for the hovered over text * on the warning icon. */ warningMessage: { type: String, default: "Beta feature - under active development" }, displayLatestChanges: { type: Boolean, default: !1 }, latestChangesMessage: { type: String, default: "New feature - Local search is now available" }, /** * Show/hide pickable markers for regions. */ displayMarkers: { type: Boolean, default: !1 }, /** * Display adjacent markers with a cluster marker. */ markerCluster: { type: Boolean, default: !1 }, /** * GroupName to value pair. * The value can be a single number or and object in the following * form: * * { * number: Number, * imgURL: String * } * * When imgURL is specified, scaffoldvuer will attempt to render * the image in imgURL as marker instead. * */ markerLabels: { type: Object, default: function() { return {}; } }, /** * Show/hide minimap. */ displayMinimap: { type: Boolean, default: !1 }, /** * Format of the input URL */ format: { type: String, default: "metadata" }, /** * Settings for minimap position, size and alignment. */ minimapSettings: { type: Object, default: function() { return { x_offset: 16, y_offset: 16, width: 128, height: 128, align: "top-right" }; } }, /** * Flag to determine rather the open map UI icon and popup * should be shown or not. */ enableOpenMapUI: { type: Boolean, default: !1 }, /** * Define what is considered as nerves. */ isNerves: { type: Object, default: function() { return { regions: ["nerves"] }; } }, /** * This array populate the the openMapOptions popup. * Each entry contains a pair of display and key. */ openMapOptions: { type: Array, default: function() { return [ { display: "Open AC Map", key: "AC" }, { display: "Open FC Map", key: "FC" }, { display: "Open 3D Human Map", key: "3D" } ]; } }, /** * State containing state of the scaffold. */ state: { type: Object, default: void 0 }, /** * Optional prop for the name of the region to focus on, * this option is ignored if state or viewURL is also provided. */ region: { type: String, default: "" }, /** * Optional prop for an URL of containing information of a viewport. * This option is ignored if state is also provided. * It will use the provided URL as base if a relative parth is provided. */ viewURL: { type: String, default: "" }, /** * Settings for turning on/off rendering */ render: { type: Boolean, default: !0 }, /** * Specify the endpoint of the flatmap server. * This is used by annotation service included in * third party flatmapvuer library. */ flatmapAPI: { type: String, default: "https://mapcore-demo.org/current/flatmap/v3/" }, /** * The option to show local settings UI * (background colour, viewing mode, etc.) */ showLocalSettings: { type: Boolean, default: !0 }, /** * The option to show open new map button */ showOpenMapButton: { type: Boolean, default: !0 }, /** * Manage the settings when used in standalone or as child component. */ usageConfig: { type: Object, default: function() { return { showTubeLinesControls: !0, tubeLines: !1 }; } } }, provide() { return { flatmapAPI: this.flatmapAPI, scaffoldUrl: this.url, boundingDims: this.boundingDims }; }, data: function() { return { annotator: void 0, colourRadio: !0, createData: { drawingBox: !1, toBeConfirmed: !1, points: [], shape: "", x: 0, y: 0, editingIndex: -1, faceIndex: -1, toBeDeleted: !1 }, currentTime: 0, timeVarying: !1, isPlaying: !1, isReady: !1, /** * This is set when scene is transitioning. */ isTransitioning: !1, tooltipAppendToBody: !1, hoverVisibilities: [ { value: !1, ref: "zoomInPopover" }, // 0 { value: !1, ref: "zoomOutPopover" }, // 1 { value: !1, ref: "zoomFitPopover" }, // 2 { value: !1, ref: "openMapPopover" }, // 3 { value: !1, ref: "settingsPopover" }, // 4 { value: !1, ref: "sliderPopover" }, // 5 { value: !1, ref: "regionVisibilityPopover" }, // 6 { value: !1, ref: "warningPopover" }, // 7 { value: !1, ref: "whatsNewPopover" }, // 8 { value: !1, refs: "toolbarPopover", ref: "editPopover" }, // 9 { value: !1, refs: "toolbarPopover", ref: "pointPopover" }, // 10 { value: !1, refs: "toolbarPopover", ref: "lineStringPopover" }, // 11 { value: !1, refs: "toolbarPopover", ref: "deletePopover" } // 11 ], inHelp: !1, helpModeActiveIndex: this.helpModeInitialIndex, loading: !1, duration: 3e3, drawerOpen: !0, currentBackground: "white", availableBackground: ["white", "lightskyblue", "black"], minimisedSlider: !1, sliderPosition: "", timeMax: 100, orginalDuration: "", animateDuration: "6secs", playSpeed: [ { value: 0.1, label: "0.1x" }, { value: 0.5, label: "0.5x" }, { value: 1, label: "1x" }, { value: 2, label: "2x" }, { value: 5, label: "5x" }, { value: 10, label: "10x" } ], currentSpeed: 1, timeStamps: {}, defaultCheckedKeys: [], outlinesRadio: !0, tData: { label: "", region: "", visible: !1, x: 200, y: 200, active: !1 }, fileFormat: "metadata", previousMarkerLabels: An({}), viewingMode: "Exploration", viewingModes: { Exploration: "View and explore detailed visualization of 3D scaffolds", "Neuron Connection": "Discover nerve connections by selecting a nerve and viewing its associated connections", Annotation: ["View feature annotations", "Add, comment on and view feature annotations"] }, openMapRef: void 0, backgroundIconRef: void 0, annotationFeature: {}, offlineAnnotationEnabled: !1, offlineAnnotations: An([]), authorisedUser: void 0, toolbarOptions: [ "Delete", "Edit", "Point", "LineString" ], existDrawnFeatures: An([]), // Store all exist drawn features activeDrawTool: void 0, activeDrawMode: void 0, boundingDims: { centre: [0, 0, 0], size: [1, 1, 1] }, lastSelected: An({ region: "", group: "", isSearch: !1 }) //checkedRegions: [] }; }, watch: { format: { handler: function(n) { this.fileFormat = n; }, immediate: !0 }, url: { handler: function(n) { (this.state === void 0 || this.state.url === void 0) && this.setURL(n); }, immediate: !0 }, region: { handler: function(n) { this.state || this.viewURL || this.setFocusedRegion(n); }, immediate: !0 }, state: { handler: function(n) { this.setState(n); }, immediate: !0, deep: !0 }, viewURL: { handler: function(n) { this.updateViewURL(n); }, immediate: !0 }, helpMode: function(n, e) { n !== e && this.setHelpMode(n); }, helpModeActiveItem: function() { this.helpMode && (this.helpModeActiveIndex += 1, this.setHelpMode(this.helpMode)); }, displayMarkers: function(n) { this.$module.scene.displayMarkers = n, this.$module.scene.forcePickableObjectsUpdate = !0; }, displayMinimap: function(n) { this.$module.scene.displayMinimap = n; }, currentTime: { handler: function() { this.$emit("timeChanged", this.currentTime); } }, duration: function() { this.$module.scene.setDuration(this.duration); }, minimapSettings: { deep: !0, handler: "updateMinimapScissor" }, render: function(n) { this.toggleRendering(n); }, markerCluster: { handler: function(n) { this.$module.scene.enableMarkerCluster(n); }, immediate: !0 }, markerLabels: function(n) { for (const [e, t] of Object.entries(this.previousMarkerLabels)) this.setMarkerModeForObjectsWithName(e, t, "off"); for (const [e, t] of Object.entries(n)) this.setMarkerModeForObjectsWithName(e, t, "on"); this.previousMarkerLabels = An({ ...n }); } }, beforeCreate: function() { this.$module = new CM(), this.selectedObjects = [], this.hoveredObjects = [], this.currentBackground = "white", this._currentURL = void 0, this.availableBackground = ["white", "black", "lightskyblue"], this.$_searchIndex = new L5(); }, mounted: function() { this.openMapRef = En(this.$refs.openMapRef), this.backgroundIconRef = En(this.$refs.backgroundIconRef), this.$refs.scaffoldTreeControls.setModule(this.$module); let n = new u5(); 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: { ...iw(Dd), ...Gv(Dd, ["userToken"]), annotationDisplay: function() { return this.viewingMode === "Annotation" && this.tData.active === !0 && this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString"; }, enableColourPicker: function() { return this.showColourPicker && this.colourRadio; }, modeDescription: function() { let n = this.viewingModes[this.viewingMode]; return this.viewingMode === "Annotation" ? this.authorisedUser ? n[1] : n[0] : n; } }, methods: { /* setCheckedRegions: function (data) { this.checkedRegions = data; }, */ /** * * @param nerves array of nerve names, show all nerves if empty * @param processed boolean, whether unselect all checkboxes */ zoomToNerves: function(n, e = !1) { if (this.$module.scene) { this.$module.setIgnorePicking(e); const t = []; this.$module.scene.getRootRegion().getChildRegions().forEach((r) => { r.getName() === "Nerves" && e && n.forEach((o) => { const a = this.findObjectsWithGroupName(o); t.push(...a); }); }), this.$module.setSelectedByZincObjects(t, void 0, {}, !0), this.$module.scene.viewAll(); } }, enableAxisDisplay: function(n, e) { this.$module.scene && this.$module.scene.enableAxisDisplay(n, e); }, createAxisDisplay: function(n) { this.$module.scene && this.$module.scene.createAxisDisplay(n); }, /** * @public * Call this to manually add a zinc object into the current scene. * This will subsequently trigger a zincObjectAdded * @arg {Object} "ZincObject object to be added" */ addZincObject: function(n) { this.$module.scene && this.$module.scene.addZincObject(n); }, /** * Internal only. * This is called when a new zinc object is read into the scene. */ zincObjectAdded: function(n) { var r; this.loading = !1, this.$_searchIndex.addZincObject(n, n.uuid), this.timeVarying === !1 && n.isTimeVarying() && (this.timeVarying = !0); const e = n.groupName.toLowerCase(); e in Dv && n.setAnatomicalId(Dv[e]); const t = n.getGroup(); t && t.position ? n.userData.originalPos = [ t.position.x, t.position.y, t.position.z ] : n.userData.originalPos = [0, 0, 0]; const i = (r = this.isNerves) == null ? void 0 : r.regions; if (i) { const s = n.getRegion().getFullPath().toLowerCase(); for (let o = 0; o < i.length; o++) s.includes(i[o].toLowerCase()) ? (n.userData.isNerves = !0, n.userData.defaultColour = `#${n.getColourHex()}`, n.userData.isGreyScale = !1, e in Ov && n.setAnatomicalId(Ov[e])) : n.userData.isNerves = !1; } this.$emit("zinc-object-added", n); }, /** * Internal only. * Remove an entry matching region and group from * local annotation list. */ removeFromOfflineAnnotation: function(n, e) { for (let t = 0; t < this.offlineAnnotations.length; t++) { const i = this.offlineAnnotations[t]; if (i.region === n && i.group === e) { this.offlineAnnotations.splice(t, 1); return; } } }, /** * Internal only. * This is called when a zinc object is removed. */ zincObjectRemoved: function(n) { if (this.$module.scene) { const e = n.groupName; n.region.findObjectsWithGroupName(e, !1).length === 0 && this.$_searchIndex.removeZincObject(n, n.uuid); } }, /** * Internal only. * Add regions to search index. */ addRegionsToSearchIndex: function() { this.$module.scene.getRootRegion().getChildRegions(!0).forEach((t) => { this.$_searchIndex.addRegion(t, t.uuid); }); }, /** * Internal only. * This is called when Change backgspeedround colour button * is pressed an causes the backgrouColornd colour to be changed * to one of the three preset colour: white, black and * lightskyblue. */ backgroundChangeCallback: function(n) { this.currentBackground = n, this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground, 1); }, /** * Internal only. * This is called by captueeScreenshot and after the last render * loop, it download a screenshot of the current scene with no UI. */ captureScreenshotCallback: function() { this.$module.zincRenderer.removePostRenderCallbackFunction( this.captureID ); let n = this.$module.zincRenderer.getThreeJSRenderer().domElement.toDataURL("image/png"), e = document.createElement("a"); document.body.append(e), this.captureFilename ? e.download = this.captureFilename : e.download = "screenshot.png", e.href = n, e.click(), e.remove(); }, /** * @public * Function for capturing a screenshot of the current rendering. * * @arg {String} "filename given to the screenshot." */ captureScreenshot: function(n) { this.captureFilename = n, this.captureID = this.$module.zincRenderer.addPostRenderCallbackFunction( this.captureScreenshotCallback ); }, /** * @public * Function to clear current scene, the tree controls and the search index. */ clearScene: function() { this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.$_searchIndex && this.$_searchIndex.removeAll(), this.$module.scene && this.$module.scene.clearAll(); }, /** * @public * Add and edit local annotations * @arg `region`, * @arg `group`, * @arg `zincObject`, * @arg `comment` */ addAndEditAnnotations: function(n, e, t, i) { const r = Tv( this.annotator, this.userToken, t, n, e, this.url, i ); if (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((s) => s.id !== r.item.id)), this.existDrawnFeatures.push(r.feature), this.offlineAnnotationEnabled) { r.group = e; let s = n; s.slice(-1) === "/" && (s = s.slice(0, -1)), r.region = s, this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations.push(r), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations)); } this.$emit("userPrimitivesUpdated", { region: n, group: e, zincObject: t }); }, /** * @public * Callback for when primitives have been update using primitive controls. * This is only called from callback. * @arg `object` */ primitivesUpdated: function(n) { if (n.isZincObject && n.isEditable) { const e = n.groupName, t = n.region.getFullPath(); this.addAndEditAnnotations(t, e, n, "Position Updated"); } }, /** * @public * Confirm creation of new primitive. This is only called from callback. * @arg `payload` */ confirmCreate: function(n) { if (n) { let e; if (n.shape === "Point") e = this.$module.scene.createPoints( n.region, n.group, this.createData.points, n.group, 8942 ); else if (n.shape === "LineString") e = this.$module.scene.createLines( n.region, n.group, [this.createData.points[0], this.createData.points[1]], 60962 ); else if (n.editingIndex > -1 && this._editingZincObject) { this._editingZincObject.editVertices( [this.createData.points[1]], n.editingIndex ); const t = this._editingZincObject.region.getFullPath() + "/", i = this._editingZincObject.groupName; this.addAndEditAnnotations(t, i, this._editingZincObject, "Position Updated"); } e && (this.addAndEditAnnotations(n.region, n.group, e.zincObject, "Create"), e.zincObject.isEditable = !0, this.tData.region = n.region, this.tData.label = n.group, this.changeActiveByName([n.group], n.region, !1)); } this.cancelCreate(); }, /** * Internal only. * Cancel create workflows. Reset all relevant UIs and data. */ cancelCreate: function() { this.createData.points.length = 0, this.createData.toBeConfirmed = !1, this._editingZincObject = void 0, this.createData.editingIndex = -1, this.createData.faceIndex = -1, this.tData.visible = !1, this.createData.toBeDeleted = !1, this._tempLine && (this.$module.scene.removeTemporaryPrimitive(this._tempLine), this._tempLine = void 0), this._tempPoint && (this.$module.scene.removeTemporaryPrimitive(this._tempPoint), this._tempPoint = void 0), this.annotationSidebar && this.$emit("annotation-close"); }, /** * Internal only. * Confirm delete of user created primitive. * This is only called from callback. */ confirmComment: function(n) { if (this._editingZincObject) { let e = n; this._editingZincObject.isEditable && (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((t) => t.id !== e.item.id)), this.existDrawnFeatures.push(n.feature)), this.offlineAnnotationEnabled && (e.group = this._editingZincObject.groupName, e.region = this._editingZincObject.region.getFullPath(), this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations.push(e), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations))); } }, /** * Internal only. * Confirm delete of user created primitive. * This is only called from callback. */ confirmDelete: function() { var n; if ((n = this._editingZincObject) != null && n.isEditable) { const e = this._editingZincObject.region.getFullPath() + "/", t = this._editingZincObject.groupName, i = Tv( this.annotator, this.userToken, this._editingZincObject, e, t, this.url, "Deleted" ); i && (this.existDrawnFeatures = An(this.existDrawnFeatures.filter((s) => s.id !== i.item.id)), this.$module.scene.getRootRegion().findChildFromPath(e).removeZincObject(this._editingZincObject), this.offlineAnnotationEnabled && (this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], this.offlineAnnotations = this.offlineAnnotations.filter((s) => s.item.id !== i.item.id), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations)))); } this.cancelCreate(); }, /** * Internal only. * This is triggered when tooltip is hidden */ onTooltipHide: function() { this.createData.toBeConfirmed && !this.annotationSidebar && this.cancelCreate(); }, formatTooltip(n) { if (this.timeMax >= 1e3 && n) { let e = (n % 6e4 / 1e3).toFixed(2) + "s"; return (n > 6e4 ? (n / 6e4).toFixed(0) + "m " : "") + e; } return n ? n.toFixed(2) + " ms" : "0 ms"; }, /** * @public * Function to reset the view to default. * Also called when the associated button is pressed. */ fitWindow: function() { if (this.$module.scene) { let n = !1; this._boundingBoxGeo && (n = this._boundingBoxGeo.getVisibility(), this._boundingBoxGeo.setVisibility(!1)), this.$module.scene.viewAll(), this._boundingBoxGeo && (D4(this._boundingBoxGeo, this.$module.scene), this._boundingBoxGeo.setVisibility(n)); } }, /** * @public * Function to zoom in. * Also called when the associated button is pressed. */ zoomIn: function() { this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(-1); }, /** * Function to zoom out. * Also called when the associated button is pressed. * * @public */ zoomOut: function() { this.$module.scene && this.$module.scene.changeZoomByScrollRateUnit(1); }, /** * Function to change the current play speed. * * @public * @arg `speed` */ speedChanged: function(n) { this.currentSpeed = n, this.$module.setPlayRate(this.defaultRate * this.currentSpeed); }, /** * Function used to stop the free spin * * @public */ stopFreeSpin: function() { this.$module.scene.getZincCameraControls().stopAutoTumble(), this.isTransitioning = !1; }, /** * Return a list of obejcts with the provided name. * @arg "Group name to search." * * @public */ findObjectsWithGroupName: function(n) { let e = []; return n && n != "" && this.$module.scene && (e = this.$module.scene.findObjectsWithGroupName(n)), e; }, /** * @public * Switch active drawing type * @arg {String} `type` * @arg {String} `icon` */ toggleDrawing: function(n, e) { this.createData.toBeDeleted = !1, n === "mode" ? (this.cancelCreate(), this.activeDrawMode = e, this.createData.shape = "", this.$module.selectObjectOnPick = !0) : n === "tool" && (this.activeDrawTool = e, this.createData.shape = this.activeDrawTool ? this.activeDrawTool : "", this.$module.selectObjectOnPick = !1); }, /** * Toggle the drawing box which aid the drawing * * @public */ toggleDrawingBox: function() { this.createData.drawingBox = !this.createData.drawingBox; }, /** * Find and and zoom into objects with the provided list of names. * @arg "List of names" * * @public */ viewRegion: function(n) { const e = this.$module.scene.getRootRegion(), t = Array.isArray(n) ? n : [n], i = xo(e, t, "", !0); let r = this.$module.scene.getBoundingBoxOfZincObjects(i); if (r) { if (this.$module.isSyncControl()) this.$module.setSyncControlZoomToBox(r); else { const s = this.$module.scene.camera.far - this.$module.scene.camera.near; this.$module.scene.viewAllWithBoundingBox(r), this.$module.scene.camera.far = this.$module.scene.camera.near + s, this.$module.scene.camera.updateProjectionMatrix(); } return !0; } return !1; }, setFocusedRegion: function(n) { n && (this.isReady ? this.viewRegion(n) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ region: n }) )); }, updateViewURL: function(n) { if (n) if (this.isReady) { const e = new URL(n, this.url); this.$module.scene.loadViewURL(e); } else this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ viewURL: n }) ); }, createEditTemporaryLines: function(n) { const e = n[0].extraData.worldCoords; if (e && (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.createData.points.length === 1) if (this.showRegionTooltipWithAnnotations(n, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempLine) { const t = this._tempLine.geometry.getAttribute("position"); t.setXYZ(1, e[0], e[1], e[2]), t.needsUpdate = !0; } else this._tempLine = this.$module.scene.addTemporaryLines( [this.createData.points[0], e], 65535 ); }, draw: function(n) { n && n.length > 0 && n[0].data.group && n[0].extraData.worldCoords && (this.createData.shape === "Point" ? this.drawPoint(n[0].extraData.worldCoords, n) : (this.createData.shape === "LineString" || this.createData.editingIndex > -1) && this.drawLine(n[0].extraData.worldCoords, n)); }, drawPoint: function(n, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length = 0, this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200, this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960)); }, drawLine: function(n, e) { this.createData.toBeConfirmed === !1 && (this.createData.points.length === 1 ? (this.createData.points.push(n), this.createData.toBeConfirmed = !0, this.showRegionTooltipWithAnnotations(e, !0, !1), this.tData.x = 50, this.tData.y = 200) : (this._tempPoint = this.$module.scene.addTemporaryPoints([n], 16776960), this.createData.points.push(n))); }, /** * Return renderer information * * @public */ getRendererInfo: function() { if (this.$module.zincRenderer) return this.$module.zincRenderer.getThreeJSRenderer().info; }, /** * Function used to rotate the scene. * Also called when the associated button is pressed. * * @public */ freeSpin: function() { if (this.$module.scene) { let n = this.$module.scene.getZincCameraControls(); this.isTransitioning = !0, n.enableAutoTumble(), n.autoTumble([1, 0], Math.PI, !0), setTimeout(this.stopFreeSpin, 4e3); } }, activateAnnotationMode: function(n, e) { if (this.authorisedUser || this.offlineAnnotationEnabled) if (this.createData.toBeDeleted = !1, this.createData.shape !== "" || this.createData.editingIndex > -1) n.length > 0 && e.identifiers[0].coords && (this.createData.x = e.identifiers[0].coords.x, this.createData.y = e.identifiers[0].coords.y, this.draw(e.identifiers)); else { if (this.activeDrawMode === "Edit") { const t = F4(e); t && this.activateEditingMode( t.zincObject, t.faceIndex, t.vertexIndex, t.point ); } else if (this.activeDrawMode === "Delete") { const t = I4(e); t && (this.createData.toBeDeleted = !0, this._editingZincObject = t); } this.activeDrawMode !== "Point" && this.activeDrawMode !== "LineString" ? this.showRegionTooltipWithAnnotations(e.identifiers, !0, !1) : this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0); } else this.showRegionTooltipWithAnnotations(e.identifiers, !0, !0); }, activateEditingMode: function(n, e, t, i) { this._editingZincObject = n, this.createData.faceIndex = e, this.createData.editingIndex = t, this.drawLine(i, void 0); }, /** * Callback when a region is selected/highlighted. * It will also update other controls. * */ eventNotifierCallback: function(n) { if (!(this.createData.toBeConfirmed || this.createData.toBeDeleted)) { const e = []; let t = []; (n.eventType == 1 || n.eventType == 2) && (n.identifiers.forEach((s) => { if (s) { let o = s.data.id ? s.data.id : s.data.group; e.push(o); } }), t = n.zincObjects); let i, r; if (n.identifiers.length > 0 && n.identifiers[0] && (i = n.identifiers[0].data.id ? n.identifiers[0].data.id : n.identifiers[0].data.group, n.identifiers[0].data.region && (r = n.identifiers[0].data.region)), n.eventType == 1) if (this.viewingMode === "Annotation") { this.tData.label = i, this.tData.region = r; const s = P4(n); if (this._editingZincObject = s, s) { const o = this._editingZincObject.region.getFullPath() + "/", a = this._editingZincObject.groupName; this.annotationFeature = bM( this._editingZincObject, o, a, this.url, "" ).feature; } this.activateAnnotationMode(e, n); } else this.$refs.scaffoldTreeControls && (e.length > 0 ? (this.$refs.scaffoldTreeControls.updateActiveUI(t), this.updatePrimitiveControls(t)) : (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls.removeActive(!1))), n.identifiers.length === 1 ? this.lastSelected = { isSearch: !1, region: r, group: n.identifiers[0].data.group } : n.identifiers.length === 0 && (this.lastSelected = { isSearch: !1, region: "", group: "" }), this.$emit("scaffold-selected", n.identifiers); else if (n.eventType == 2) this.selectedObjects.length === 0 && (this.hideRegionTooltip(), this.$refs.scaffoldTreeControls && (e.length > 0 ? this.$refs.scaffoldTreeControls.updateHoverUI(t) : this.$refs.scaffoldTreeControls.removeHover(!0)), n.identifiers.length > 0 && n.identifiers[0] && n.identifiers[0].coords && (this.tData.active = !1, (this.viewingMode !== "Annotation" || !this.annotationSidebar) && (this.tData.visible = !0), this.tData.label = i, this.tData.region = r, this.tData.x = n.identifiers[0].coords.x, this.tData.y = n.identifiers[0].coords.y, this.createEditTemporaryLines(n.identifiers)), this.$emit("scaffold-highlighted", n.identifiers)); else if (n.eventType == 3 && n.identifiers.length > 0 && n.identifiers[0]) { if (n.identifiers[0].coords) { const s = this.$refs.scaffoldContainer.getBoundingClientRect(); this.tData.x = n.identifiers[0].coords.x - s.left, this.tData.y = n.identifiers[0].coords.y - s.top; } this.createEditTemporaryLines(n.identifiers); } } }, /** * Get the coordinates of the current selected region. * * @public */ getCoordinatesOfSelected: function() { if (this.selectedObjects && this.selectedObjects.length > 0) return this.$module.scene.getObjectsScreenXY(this.selectedObjects); }, /** * Return an object containing the window coordinates of the * current selected region which will be updated after each render * loop. * * @public */ getDynamicSelectedCoordinates: function() { return this.$module.selectedScreenCoordinates; }, /** * Callback when time is changed through the UI. */ timeChange: function(n) { let e = n / this.timeMax * 100; e != this.currentTime && this.$module.updateTime(e); }, /** * Update primitive controls UI with the specified objects * * @arg objects objects to be set for the selected */ updatePrimitiveControls: function(n) { (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") && (this.selectedObjects = n, this.selectedObjects && this.selectedObjects.length > 0 ? this.$refs.primitiveControls.setObject(this.selectedObjects[0]) : this.$refs.primitiveControls.setObject(void 0)); }, /** * A callback used by children components. Set the selected zinc object * * @arg Selected zinc objects * @arg Flag to determine if callback should be triggered when new selection * is made */ objectSelected: function(n, e) { this.$module.isIgnorePicking() || (this.updatePrimitiveControls(n), this.$module.setSelectedByZincObjects(n, void 0, {}, e)); }, /** * A callback used by children components. Set the highlighted zinc object * * @arg Hovered zinc objects * @arg Flag to determine if callback should be triggered when new selection * is made */ objectHovered: function(n, e) { this.hoveredObjects = n, this.$module.setHighlightedByZincObjects(n, void 0, {}, e); }, /** * Set the selected by name. * * @param {} name Name of the group */ changeActiveByName: function(n, e, t) { const i = Array.isArray(n); if (n === void 0 || i && n.length === 0) this.$refs.scaffoldTreeControls.removeActive(t); else { let r = n; i || (r = [r]), this.$refs.scaffoldTreeControls.changeActiveByNames(r, e, t); } }, /** * Set the highlighted by name. * * @param {name} name Name of the group */ changeHighlightedByName: function(n, e, t) { const i = Array.isArray(n); if (n === void 0 || i && n.length === 0) this.$refs.scaffoldTreeControls.removeHover(t); else { let r = n; i || (r = [r]), this.$refs.scaffoldTreeControls.changeHoverByNames(r, e, t); } }, /** * @public * Start the animation. * * @arg "flag to turn the animation on/off" */ play: function(n) { this.$module.playAnimation(n), this.isPlaying = n; }, /** * @public * Function to toggle on/off overlay help. */ setHelpMode: function(n) { const e = this.hoverVisibilities.length, t = e - 1, i = this.hoverVisibilities[this.helpModeActiveIndex]; if (i) { const r = i == null ? void 0 : i.refs, s = i == null ? void 0 : i.ref; this.$refs[r || s] || (this.helpModeActiveIndex += 1); } n || (this.helpModeActiveIndex = this.helpModeInitialIndex), n && this.helpModeActiveIndex >= t && this.$emit("help-mode-last-item", !0), n && !this.helpModeDialog ? (this.inHelp = !0, this.hoverVisibilities.forEach((r) => { r.value = !0; })) : n && this.helpModeDialog && e > this.helpModeActiveIndex ? this.helpModeActiveIndex > -1 && setTimeout(() => { this.inHelp = !1, this.hoverVisibilities.forEach((r) => { r.value = !1; }), this.showHelpText(this.helpModeActiveIndex, 200); }, 300) : (this.inHelp = !1, this.hoverVisibilities.forEach((r) => { r.value = !1; })); }, /** * Callback function used by showRegionTooltip in the case when the tooltip * is out of view. */ displayTooltipOfObjectsCallback: function(n, e, t, i, r) { const s = this; return function() { s.$module.zincRenderer.removePostRenderCallbackFunction( s.$_regionTooltipCallback ), s.$_regionTooltipCallback = void 0, s.displayTooltipOfObjects(n, e, t, i, r); }; }, liveUpdateTooltipPosition: function() { this.$module.selectedCenter && (this.tData.x = this.$module.selectedScreenCoordinates.x, this.tData.y = this.$module.selectedScreenCoordinates.y); }, displayTooltipOfObjects: function(n, e, t, i, r) { if (e.length > 0) { let s = e[0].getClosestVertexDOMElementCoords( this.$module.scene ); if (s) return s.inView ? (n.includes("Search Results for") ? this.tData.active = !1 : this.tData.active = !0, this.tData.visible = !0, this.tData.label = n, this.tData.x = s.position.x, this.tData.y = s.position.y, this.tData.region = t, this.$_liveCoordinatesUpdated && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_liveCoordinatesUpdated ), r && (this.$module.setupLiveCoordinates(e), this.$_liveCoordinatesUpdated = this.$module.zincRenderer.addPostRenderCallbackFunction( this.liveUpdateTooltipPosition ))) : (this.hideRegionTooltip(), i && (this.$module.scene.viewAll(), this.$_regionTooltipCallback && this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_regionTooltipCallback ), this.$_regionTooltipCallback = this.$module.zincRenderer.addPostRenderCallbackFunction( this.displayTooltipOfObjectsCallback( n, e, t, i, r ) ))), !0; } return this.hideRegionTooltip(), !1; }, /** * Display the tooltip used for displaying search result. * When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltipWithObjects: function(n, e, t, i, r) { return n && e && e.length > 0 && this.$module.scene ? this.displayTooltipOfObjects( n, e, t, i, r ) : (this.hideRegionTooltip(), !1); }, /** * Display the tooltip. When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltip: function(n, e, t) { if (n && this.$module.scene) { const i = this.$module.scene.getRootRegion(), s = xo(i, [n], "", !0); let o; return s && s.length > 0 && (o = s[0].getRegion().getFullPath()), this.showRegionTooltipWithObjects( n, s, o, e, t ); } return this.hideRegionTooltip(), !1; }, /** * Display the tooltip using the list of annotations. * When resetView is set to true, it will * reset view if the tooltip is not in view. * Setting liveUpdates to true will update the tooltip location * at every rendering loop. */ showRegionTooltipWithAnnotations: function(n, e, t) { if (this.$module.scene) { const i = _v(this.$module.scene, n); if (i && i.objects.length > 0) if (this.annotationSidebar) { const s = [{ featureId: (this.tData.region ? this.tData.region + "/" : "") + this.tData.label, resourceId: this.url, resource: this.url, feature: this.annotationFeature, offline: this.offlineAnnotationEnabled }]; this.$emit("annotation-open", { annotationEntry: s, createData: this.createData, confirmCreate: this.confirmCreate, cancelCreate: this.cancelCreate, confirmDelete: this.confirmDelete, confirmComment: this.confirmComment }); return; } else return this.showRegionTooltipWithObjects( i.label, i.objects, i.regionPath, e, t ); } return this.hideRegionTooltip(), !1; }, clearAnnotationFeature: function() { const n = this.getOfflineAnnotations(); this.existDrawnFeatures.map((t) => decodeURIComponent(t.id).split("/").pop()).forEach((t) => { const i = this.$module.scene.findObjectsWithGroupName(t, !1); if (i && i.length) { const r = i[0].region.getFullPath() + "/"; this.$module.scene.getRootRegion().findChildFromPath(r).removeZincObject(i[0]); } }), this.$refs.scaffoldTreeControls.removeRegion("__annotation"), this.offlineAnnotations = n; }, addAnnotationFeature: async function() { let n; if (this.offlineAnnotationEnabled) this.offlineAnnotations = JSON.parse(sessionStorage.getItem("anonymous-annotation")) || [], n = this.offlineAnnotations.filter((e) => e.resource === this.url && e.feature.properties.drawn).map((e) => e.feature); else { n = []; const e = await Ev(this.annotator, this.userToken, this.url); e && e.features && (n = [...e.features]); const t = await Ev(this.annotator, this.userToken, encodeURIComponent(this.url)); t && t.features && (n = [...n, ...t.features]); } this.existDrawnFeatures = An(n), Cv(this.$module.scene, n); }, /** * Callback on viewing mode change * Optional, can be used to update the view mode. */ changeViewingMode: function(n) { let e = !0; this.$module && (n && (this.viewingMode = n), this.clearAnnotationFeature(), this.viewingMode === "Annotation" ? (this.loading = !0, this.annotator.authenticate(this.userToken).then((t) => { t.name && t.email && t.canUpdate ? (this.authorisedUser = t, this.offlineAnnotationEnabled = !1) : (this.authorisedUser = void 0, this.offlineAnnotationEnabled = !0), this.emitOfflineAnnotationUpdate(), this.addAnnotationFeature(), this.loading = !1; })) : this.viewingMode === "Exploration" ? (this.activeDrawTool = void 0, this.activeDrawMode = void 0, this.createData.shape = "") : this.viewingMode === "Neuron Connection" && (e = !1), this.viewingMode === "Exploration" || this.viewingMode === "Neuron Connection" || this.viewingMode === "Annotation" && this.createData.shape === "" ? this.$module.selectObjectOnPick = !0 : this.$module.selectObjectOnPick = !1, this.cancelCreate(), n && this.setObjectIsPickable(e)); }, /** * Function to emit offline annotation enabled status */ emitOfflineAnnotationUpdate: function() { this.$emit("update-offline-annotation-enabled", this.offlineAnnotationEnabled); }, /** * @public * Hide the tooltip */ hideRegionTooltip: function() { this.$_liveCoordinatesUpdated && (this.$module.zincRenderer.removePostRenderCallbackFunction( this.$_liveCoordinatesUpdated ), this.$module.setupLiveCoordinates(void 0)), this.tData.active = !1, this.tData.visible = !1, this.tData.region = void 0; }, /** * Currently will apply to non-nerve object and object without anatomical id * @param flag boolean to control whether objects pickable */ setObjectIsPickable: function(n) { this.$module.scene.getRootRegion().getAllObjects(!0).forEach((t) => { var i; !((i = t.userData) != null && i.isNerves) && !t.anatomicalId && t.setIsPickable(n); }); }, /** * Update objects to greyscale or colour. * This will update all objects except those with the provided nerves labels. * @param flag boolean * @param labels array of nerve names that exclude from greyscale */ setGreyScale: function(n, e = []) { this.$module.scene.getRootRegion().getAllObjects(!0).forEach((i) => { var a; const r = i.groupName.toLowerCase(), s = (a = i.userData) == null ? void 0 : a.isNerves; (e.length > 0 && s && !e.includes(r) || e.length === 0 && !s) && (i.setGreyScale(n), i.userData.isGreyScale = n); }), this.$refs.scaffoldTreeControls.updateAllNodeColours(); }, /** * @public * Function to toggle colour/greyscale of primitives. * The parameter ``flag`` is a boolean, ``true`` (colour) and ``false`` (greyscale). * @arg {Boolean} `flag` */ setColour: function(n, e = !1) { this.isReady && this.$module.scene && typeof n == "boolean" && (e || n !== this.colourRadio) && (this.loading = !0, setTimeout(() => { this.setGreyScale(!n), this.loading = !1, this.colourRadio = n; }, 100)); }, /** * @public * Function to toggle lines graphics. * The parameter ``flag`` is a boolean, ``true`` to show lines, ``false`` to hide them. * @arg {Boolean} `flag` */ setOutlines: function(n, e = !1) { this.isReady && this.$module.scene && typeof n == "boolean" && (e || n !== this.outlinesRadio) && (this.outlinesRadio = n, this.$nextTick(() => this.$refs.scaffoldTreeControls.setOutlines(n))); }, /** * Set the marker modes for objects with the provided name, mode can * be "on", "off" or "inherited". * Value can either be number or an object containing number and * imgURL. */ setMarkerModeForObjectsWithName: function(n, e, t) { if (n && this.$module.scene) { let i = e; typeof e == "number" && (i = { number: e, imgURL: void 0 }); const r = this.$module.scene.getRootRegion(); xo(r, [n], "", !0).forEach((a) => a.setMarkerMode(t, i)); } }, /** * @public * Set the marker modes for objects specified by the list of annotations * @arg `annotations` * @arg `mode` */ setMarkerModeWithAnnotations: function(n, e) { if (this.$module.scene) { const t = _v(this.$module.scene, n); t && t.objects.length > 0 && t.objects.forEach((i) => i.setMarkerMode(e)); } }, /** * This is called when mouse cursor enters supported elements * with help tootltips. */ showHelpText: function(n, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => { this.hoverVisibilities[n].value = !0, this.$emit("shown-tooltip"); }, e)); }, /** * This is called when mouse cursor exits supported element.. */ hideHelpText: function(n, e = 500) { this.inHelp || (clearTimeout(this.helpTextWait[n]), this.helpTextWait[n] = setTimeout(() => { this.hoverVisibilities[n].value = !1; }, e)); }, /** * @public * * Search a object and display the tooltip * @arg "text to search across" * @arg "toggle the tooltip if this is set" */ search: function(n, e) { if (this.$_searchIndex) { if (n === void 0 || n === "" || Array.isArray(n) && n.length === 0) return this.lastSelected = { region: "", group: "", isSearch: !0 }, this.objectSelected([], !0), !1; { this.lastSelected = { region: "", group: n, isSearch: !0 }; const t = this.$_searchIndex.searchAndProcessResult(n), i = t.zincObjects; if (i.length > 0) { if (this.objectSelected(i, !0), e) for (let r = 0; r < i.length; r++) i[r] && i[r].groupName && this.showRegionTooltipWithObjects( t.label, i, t.regionPath, !0, !0 ); return !0; } else this.objectSelected([], !0); } } return !1; }, /** * @public * * Get the list of suggested terms based on the provided term. * This can be used for autocomplete. * @arg `term` */ fetchSuggestions: function(n) { return this.$_searchIndex === void 0 ? [] : this.$_searchIndex.auto_suggest(n); }, /** * Called when minimap settings has changed. Pass the * parameters to ZincJS and marked it for update. */ updateMinimapScissor: function() { Object.keys(this.minimapSettings).forEach((n) => { this.$module.scene.minimapScissor[n] = this.minimapSettings[n]; }), this.$module.scene.minimapScissor.updateRequired = !0; }, updateSettingsfromScene: function() { this.currentSpeed = 1, this.$module.setPlayRate(this.defaultRate), this.orginalDuration = this.$module.scene.getMetadataTag("OriginalDuration"), this.animateDuration = this.$module.scene.getMetadataTag("Duration"); let n = this.$module.scene.getMetadataTag("TimeStamps"); this.timeStamps = {}; for (const e in n) this.timeStamps[n[e]] = e; this.timeMax = this.$module.scene.getDuration(); }, restoreSettings: function(n) { if (n) { if (n.viewport) this.$module.scene.getZincCameraControls().setCurrentCameraSettings(n.viewport); else if (n.viewURL && n.viewURL !== "") { const t = new URL(n.viewURL, this.url); this.$module.scene.loadViewURL(t); } else n.region && n.region !== "" && this.viewRegion(n.region); n.visibility && this.$nextTick(() => { this.$refs.scaffoldTreeControls.setState(n.visibility); }), n.background && this.backgroundChangeCallback(n.background), "colour" in n && this.setColour(n.colour), n.offlineAnnotations && sessionStorage.setItem("anonymous-annotation", n.offlineAnnotations), "outlines" in n && this.setOutlines(n.outlines), n.viewingMode && this.changeViewingMode(n.viewingMode); const e = n.search; e && e.group && (e.isSearch ? this.search(e.group, !0) : this.changeActiveByName(e.group, e.region, !0)); } }, downloadErrorCallback: function() { return (n) => { this.$emit("on-error", n); }; }, setURLFinishCallback: function(n) { return () => { this.offlineAnnotations.length = 0, this.updateSettingsfromScene(), this.$module.updateTime(0.01), this.$module.updateTime(0), this.$module.unsetFinishDownloadCallback(), this.addRegionsToSearchIndex(), this.setMarkers(), this._boundingBoxGeo = this.$module.scene.addBoundingBoxPrimitive( "_helper", "boundingBox", 4251856, 0.15 ), this._slides = this.$module.scene.addSlicesPrimitive( "_helper", ["x-plane", "y-plane", "z-plane"], [16733525, 5635925, 5592575], 0.5 ); const { centre: e, size: t } = this.$module.getCentreAndSize(); this.boundingDims.centre = e, this.boundingDims.size = t, this.isReady = !0, this.$nextTick(() => { this.restoreSettings(n), this.$emit("on-ready"); }); }; }, /** * Function used for getting the current states of the scene. This exported states * can be imported using the importStates method. * * @public */ getState: function() { let n = { format: this.fileFormat, url: this._currentURL, viewport: void 0, visibility: void 0, background: this.currentBackground, colour: this.colourRadio, outlines: this.outlinesRadio, viewingMode: this.viewingMode, usageConfig: this.usageConfig }; if (this.$refs.scaffoldTreeControls && (n.visibility = this.$refs.scaffoldTreeControls.getState()), this.$module.scene) { let e = this.$module.scene.getZincCameraControls(); n.viewport = e.getCurrentViewport(); } return this.lastSelected && this.lastSelected.group && (n.search = { ...this.lastSelected }), this.offlineAnnotationEnabled && (n.offlineAnnotations = sessionStorage.getItem("anonymous-annotation")), n; }, /** * Function used for importing the states of the scene. This exported states * can be imported using the read states method. * * @public * @arg `state` */ setState: function(n) { n && (n.url && n.url !== this._currentURL ? this.setURLAndState(n.url, { fileFormat: n.fileFormat, viewport: n.viewport, visibility: n.visibility, background: n.background, colour: n.colour, outlines: n.outlines, viewingMode: n.viewingMode, search: n.search, offlineAnnotations: n.offlineAnnotations }) : (n.background || n.colour || n.search || n.outlines || n.viewport || n.viewingMode || n.visibility) && (this.isReady && this.$module.scene ? this.restoreSettings(n) : this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ background: n.background, colour: n.colour, search: n.search, offlineAnnotations: n.offlineAnnotations, outlines: n.outlines, viewingMode: n.viewingMode, viewport: n.viewport, visibility: n.visibility }) ))); }, /** * export current scene in GLTF. * @arg "Return in binary form when set to true" * * @public */ exportGLTF: function(n) { return this.$module.scene.exportGLTF(n); }, /** * Return a copy of the local annotations list. * This list is used for storing user created annotation * when offlineAnnotationEnabled is set to true. * * @public */ getOfflineAnnotations: function() { return [...this.offlineAnnotations]; }, /** * Import local annotations. The annotations will only * be imported when offlineAnnotationEnabled is set to * true; * * @public * @arg {Array} `annotationsList` */ importOfflineAnnotations: function(n) { if (this.offlineAnnotationEnabled) { n.forEach((t) => { const i = t.group, r = t.region; let s = r.slice(-1) === "/" ? r : r + "/"; const o = s.slice(0, -1); t.region = o, s = s + i; const a = s; t.item.id = a, t.feature.id = a; }); const e = n.map((t) => t.feature); Cv(this.$module.scene, e), n.forEach((t) => { this.offlineAnnotations.push({ ...t }); }), sessionStorage.setItem("anonymous-annotation", JSON.stringify(this.offlineAnnotations)); } }, /** * Function used for reading in new scaffold metadata and a custom * viewport. This function will ignore the state prop and * read in the new url. * * @public * @arg `newValue` * @arg `state` */ setURLAndState: function(n, e) { var t, i; if (n != this._currentURL) { const r = {}; e != null && e.format && (this.fileFormat = e.format), this._currentURL = n, this.$refs.scaffoldTreeControls && this.$refs.scaffoldTreeControls.clear(), this.loading = !0, this.timeVarying = !1, this.isReady = !1, this.$_searchIndex.removeAll(), this.hideRegionTooltip(), this.$module.setDownloadErrorCallback( this.downloadErrorCallback() ), this.$module.setFinishDownloadCallback( this.setURLFinishCallback({ background: e == null ? void 0 : e.background, colour: e == null ? void 0 : e.colour, outlines: e == null ? void 0 : e.outlines, region: this.region, search: e == null ? void 0 : e.search, viewingMode: e == null ? void 0 : e.viewingMode, viewURL: this.viewURL, viewport: e == null ? void 0 : e.viewport, visibility: e == null ? void 0 : e.visibility, offlineAnnotations: e == null ? void 0 : e.offlineAnnotations }) ), this.fileFormat === "gltf" ? this.$module.loadGLTFFromURL(n, "scene", !0) : (((t = this == null ? void 0 : this.usageConfig) != null && t.tubeLines || (i = e == null ? void 0 : e.usageConfig) != null && i.tubeLines) && (r.tubeLines = !0), this.$module.loadOrgansFromURL( n, void 0, void 0, "scene", void 0, !0, r )), this.$module && this.$module.scene && (this.$module.scene.displayMarkers = this.displayMarkers, this.$module.scene.forcePickableObjectsUpdate = !0, this.$module.scene.displayMinimap = this.displayMinimap, this.updateMinimapScissor()); } }, /** * Function used for reading in new scaffold metadata. This function will ignore * the state prop and read in the new url. * * @public * @arg `newValue` */ setURL: function(n) { this.setURLAndState(n, void 0); }, /** * Callback when drawer is toggled. */ drawerToggled: function(n) { this.drawerOpen = n, this.adjustLayout(); }, /** * Callback using ResizeObserver. */ adjustLayout: function() { 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, !0, !0), this.$emit("scaffold-navigated", n); }, /** * Rotate mode - "none", "horizontal", "vertical", "free" but * it will be ignored if flag is set to false. */ toggleSyncControl: function(n, e) { this.$module.toggleSyncControl(n, e), this.$module.setSyncControlCallback(this.syncControlCallback); }, /** * Set the markers for the scene. */ setMarkers: function() { for (const [n, e] of Object.entries(this.markerLabels)) this.setMarkerModeForObjectsWithName(n, e, "on"); } } }, D5 = { ref: "scaffoldContainer", class: "scaffold-container", "element-loading-text": "Loading...", "element-loading-background": "rgba(0, 0, 0, 0.3)" }, N5 = { class: "primitive-controls-box" }, B5 = { class: "animation-data" }, U5 = { class: "purple" }, z5 = { class: "animation-data" }, V5 = { class: "purple" }, k5 = { class: "animation-data" }, G5 = { class: "bottom-right-control" }, H5 = { style: { "margin-bottom": "2px" } }, W5 = { key: 0, class: "viewing-mode-title" }, j5 = ["onClick"], $5 = ["onClick"]; function Z5(n, e, t, i, r, s) { const o = kn("map-svg-sprite-color"), a = EM, c = kn("DrawToolbar"), l = u0, d = It, h = cu, f = TM, g = _M, p = kn("map-svg-icon"), u = ti, y = Ui, v = xy, m = Qo, x = qo, w = by, A = Ko, M = ty, R = ny, L = td; return Lt((ve(), Le("div", D5, [ oe(o), oe(a, { createData: n.createData, label: n.tData.label, region: n.tData.region, visible: n.tData.visible, x: n.tData.x, y: n.tData.y, annotationDisplay: s.annotationDisplay, annotationFeature: n.annotationFeature, offlineAnnotationEnabled: n.offlineAnnotationEnabled, onConfirmCreate: e[0] || (e[0] = (S) => s.confirmCreate(S)), onCancelCreate: e[1] || (e[1] = (S) => s.cancelCreate()), onConfirmComment: e[2] || (e[2] = (S) => s.confirmComment(S)), onConfirmDelete: e[3] || (e[3] = (S) => s.confirmDelete()), onTooltipHide: e[4] || (e[4] = (S) => s.onTooltipHide()) }, null, 8, ["createData", "label", "region", "visible", "x", "y", "annotationDisplay", "annotationFeature", "offlineAnnotationEnabled"]), Ne("div", { id: "organsDisplayArea", ref: "display", tabindex: "-1", style: { height: "100%", width: "100%" }, onKeydown: e[5] || (e[5] = ui((...S) => s.backgroundChangeCallback && s.backgroundChangeCallback(...S), ["66"])) }, null, 544), Lt(Ne("div", null, [ n.viewingMode === "Annotation" && (n.authorisedUser || n.offlineAnnotationEnabled) ? (ve(), ke(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"])) : Ve("", !0), t.displayWarning ? (ve(), ke(h, { key: 1, ref: "warningPopover", visible: n.hoverVisibilities[7].value, content: t.warningMessage, placement: "right", width: "max-content", teleported: !1, "popper-class": "scaffold-popper message-popper right-popper non-selectable" }, { reference: de(() => [ t.displayWarning ? (ve(), Le("div", { key: 0, class: "message-icon warning-icon", onMouseover: e[6] || (e[6] = (S) => s.showHelpText(7)), onMouseout: e[7] || (e[7] = (S) => s.hideHelpText(7)) }, [ oe(d, null, { default: de(() => [ oe(l) ]), _: 1 }), e[31] || (e[31] = Ne("span", { class: "message-text" }, "Beta", -1)) ], 32)) : Ve("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ve("", !0), t.displayLatestChanges ? (ve(), ke(h, { key: 2, visible: n.hoverVisibilities[8].value, content: t.latestChangesMessage, placement: "right", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper message-popper right-popper non-selectable", ref: "whatsNewPopover" }, { reference: de(() => [ t.displayLatestChanges && t.latestChangesMessage ? (ve(), Le("div", { key: 0, class: "el-icon-warning message-icon latest-changesicon", onMouseover: e[8] || (e[8] = (S) => s.showHelpText(8)), onMouseout: e[9] || (e[9] = (S) => s.hideHelpText(8)) }, [ oe(d, null, { default: de(() => [ oe(l) ]), _: 1 }), e[32] || (e[32] = Ne("span", { class: "message-text" }, "What's new?", -1)) ], 32)) : Ve("", !0) ]), _: 1 }, 8, ["visible", "content"])) : Ve("", !0), oe(h, { visible: n.hoverVisibilities[6].value, content: "Change region visibility", placement: "right", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper right-popper non-selectable", ref: "regionVisibilityPopover" }, { reference: de(() => [ oe(f, { ref: "scaffoldTreeControls", isReady: n.isReady, "show-colour-picker": s.enableColourPicker, onObjectSelected: s.objectSelected, onObjectHovered: s.objectHovered, onDrawerToggled: s.drawerToggled }, null, 8, ["isReady", "show-colour-picker", "onObjectSelected", "onObjectHovered", "onDrawerToggled"]) ]), _: 1 }, 8, ["visible"]), Ne("div", N5, [ oe(g, { ref: "primitiveControls", createData: n.createData, viewingMode: n.viewingMode, usageConfig: t.usageConfig, onPrimitivesUpdated: s.primitivesUpdated }, null, 8, ["createData", "viewingMode", "usageConfig", "onPrimitivesUpdated"]) ]), n.timeVarying ? (ve(), ke(h, { key: 3, ref: "sliderPopover", width: "max-content", visible: n.hoverVisibilities[5].value, content: "Move the slider to animate the region", placement: "top", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper top-popper non-selectable" }, { reference: de(() => [ n.timeVarying ? (ve(), Le("div", { key: 0, class: Ee(["time-slider-container", [n.minimisedSlider ? "minimised" : "", n.sliderPosition]]) }, [ oe(w, { type: "card" }, { default: de(() => [ oe(v, { label: "Animate scaffold" }, { default: de(() => [ oe(y, { class: "tab-content" }, { default: de(() => [ n.isPlaying ? (ve(), ke(p, { key: 0, icon: "pause", class: "icon-button video-button", onClick: e[10] || (e[10] = (S) => s.play(!1)) })) : (ve(), ke(p, { key: 1, icon: "play", class: "video-button icon-button", onClick: e[11] || (e[11] = (S) => s.play(!0)) })), oe(u, { min: 0, max: n.timeMax, "model-value": n.currentTime / 100 * n.timeMax, step: 0.1, "tooltip-class": "time-slider-tooltip", class: "slider", "format-tooltip": s.formatTooltip, marks: n.timeStamps, onInput: e[12] || (e[12] = (S) => s.timeChange(S)) }, null, 8, ["max", "model-value", "format-tooltip", "marks"]) ]), _: 1 }) ]), _: 1 }), oe(v, { label: "Animation data" }, { default: de(() => [ oe(y, { class: "tab-content" }, { default: de(() => [ Ne("div", B5, [ e[33] || (e[33] = rt(" Original duration: ")), Ne("div", U5, vt(n.orginalDuration), 1) ]), Ne("div", z5, [ e[34] || (e[34] = rt(" Animation duration: ")), Ne("div", V5, vt(n.animateDuration), 1) ]), Ne("div", k5, [ e[35] || (e[35] = rt(" Playback speed ")), oe(x, { teleported: !0, "model-value": n.currentSpeed, placeholder: "Select", class: "scaffold-select-box speed", "popper-class": "scaffold_viewer_dropdown", onChange: e[13] || (e[13] = (S) => s.speedChanged(S)) }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(n.playSpeed, (S) => (ve(), ke(m, { key: S.value, label: S.label, value: S.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["model-value"]) ]) ]), _: 1 }) ]), _: 1 }) ]), _: 1 }) ], 2)) : Ve("", !0) ]), _: 1 }, 8, ["visible"])) : Ve("", !0), Ne("div", G5, [ oe(h, { visible: n.hoverVisibilities[0].value, content: "Zoom in", width: "max-content", placement: "left", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper left-popper non-selectable", ref: "zoomInPopover" }, { reference: de(() => [ oe(p, { icon: "zoomIn", class: "icon-button zoomIn", onClick: e[14] || (e[14] = (S) => s.zoomIn()), onMouseover: e[15] || (e[15] = (S) => s.showHelpText(0)), onMouseout: e[16] || (e[16] = (S) => s.hideHelpText(0)) }) ]), _: 1 }, 8, ["visible"]), oe(h, { visible: n.hoverVisibilities[1].value, content: "Zoom out", placement: "top-end", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper popper-zoomout non-selectable", ref: "zoomOutPopover" }, { reference: de(() => [ oe(p, { icon: "zoomOut", class: "icon-button zoomOut", onClick: e[17] || (e[17] = (S) => s.zoomOut()), onMouseover: e[18] || (e[18] = (S) => s.showHelpText(1)), onMouseout: e[19] || (e[19] = (S) => s.hideHelpText(1)) }) ]), _: 1 }, 8, ["visible"]), oe(h, { visible: n.hoverVisibilities[2].value, placement: "top", teleported: !1, trigger: "manual", width: "max-content", "popper-class": "scaffold-popper non-selectable", ref: "zoomFitPopover" }, { reference: de(() => [ oe(p, { icon: "fitWindow", class: "icon-button fitWindow", onClick: e[20] || (e[20] = (S) => s.fitWindow()), onMouseover: e[21] || (e[21] = (S) => s.showHelpText(2)), onMouseout: e[22] || (e[22] = (S) => s.hideHelpText(2)) }) ]), default: de(() => [ e[36] || (e[36] = Ne("div", null, [ rt(" Fit to "), Ne("br"), rt(" window ") ], -1)) ]), _: 1 }, 8, ["visible"]) ]), n.openMapRef ? (ve(), ke(h, { key: 4, ref: "open-map-popover", "virtual-ref": n.openMapRef, placement: "top-start", width: "128", teleported: !1, trigger: "click", "popper-class": "open-map-popper", "virtual-triggering": "" }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(t.openMapOptions, (S) => (ve(), ke(y, { key: S.key }, { default: de(() => [ oe(A, { type: "primary", plain: "", onClick: (I) => n.$emit("open-map", S.key) }, { default: de(() => [ rt(vt(S.display), 1) ]), _: 2 }, 1032, ["onClick"]) ]), _: 2 }, 1024))), 128)) ]), _: 1 }, 8, ["virtual-ref"])) : Ve("", !0), oe(h, { ref: "backgroundPopover", "virtual-ref": n.backgroundIconRef, placement: "top-start", width: "320", teleported: !1, trigger: "click", "popper-class": "background-popper non-selectable h-auto", "virtual-triggering": "" }, { default: de(() => [ Ne("div", null, [ oe(y, { class: "backgroundText" }, { default: de(() => e[37] || (e[37] = [ rt("Viewing Mode") ])), _: 1 }), oe(y, { class: "backgroundControl" }, { default: de(() => [ Ne("div", H5, [ (ve(!0), Le(Pt, null, Jn(n.viewingModes, (S, I, T) => (ve(), Le(Pt, { key: I }, [ I === n.viewingMode ? (ve(), Le("span", W5, [ Ne("b", null, vt(I), 1) ])) : (ve(), Le("span", { key: 1, class: "viewing-mode-unselected", onClick: (_) => s.changeViewingMode(I) }, vt(I), 9, j5)) ], 64))), 128)) ]), oe(y, { class: "viewing-mode-description" }, { default: de(() => [ rt(vt(s.modeDescription), 1) ]), _: 1 }), n.viewingMode === "Annotation" && n.offlineAnnotationEnabled ? (ve(), ke(y, { key: 0, class: "viewing-mode-description" }, { default: de(() => e[38] || (e[38] = [ rt(" (Anonymous annotate) ") ])), _: 1 })) : Ve("", !0) ]), _: 1 }), oe(y, { class: "backgroundSpacer" }), oe(y, { class: "backgroundText" }, { default: de(() => e[39] || (e[39] = [ rt("Organs display") ])), _: 1 }), oe(y, { class: "backgroundControl" }, { default: de(() => [ oe(R, { modelValue: n.colourRadio, "onUpdate:modelValue": e[23] || (e[23] = (S) => n.colourRadio = S), class: "scaffold-radio", onChange: e[24] || (e[24] = (S) => s.setColour(n.colourRadio, !0)) }, { default: de(() => [ oe(M, { value: !0 }, { default: de(() => e[40] || (e[40] = [ rt("Colour") ])), _: 1 }), oe(M, { value: !1 }, { default: de(() => e[41] || (e[41] = [ rt("Greyscale") ])), _: 1 }) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), oe(y, { class: "backgroundSpacer" }), oe(y, { class: "backgroundText" }, { default: de(() => e[42] || (e[42] = [ rt("Outlines display") ])), _: 1 }), oe(y, { class: "backgroundControl" }, { default: de(() => [ oe(R, { modelValue: n.outlinesRadio, "onUpdate:modelValue": e[25] || (e[25] = (S) => n.outlinesRadio = S), class: "scaffold-radio", onChange: e[26] || (e[26] = (S) => s.setOutlines(n.outlinesRadio, !0)) }, { default: de(() => [ oe(M, { value: !0 }, { default: de(() => e[43] || (e[43] = [ rt("Show") ])), _: 1 }), oe(M, { value: !1 }, { default: de(() => e[44] || (e[44] = [ rt("Hide") ])), _: 1 }) ]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }), oe(y, { class: "backgroundSpacer" }), oe(y, { class: "backgroundText" }, { default: de(() => e[45] || (e[45] = [ rt(" Change background ") ])), _: 1 }), oe(y, { class: "backgroundChooser" }, { default: de(() => [ (ve(!0), Le(Pt, null, Jn(n.availableBackground, (S) => (ve(), Le("div", { key: S, class: Ee([ "backgroundChoice", S, S == n.currentBackground ? "active" : "" ]), onClick: (I) => s.backgroundChangeCallback(S) }, null, 10, $5))), 128)) ]), _: 1 }) ]) ]), _: 1 }, 8, ["virtual-ref"]), Ne("div", { class: Ee(["settings-group", { open: n.drawerOpen, close: !n.drawerOpen }]) }, [ t.showOpenMapButton ? (ve(), ke(y, { key: 0 }, { default: de(() => [ oe(h, { visible: n.hoverVisibilities[3].value, content: "Open new map", placement: "right", teleported: !1, trigger: "manual", width: "max-content", "popper-class": "scaffold-popper right-popper non-selectable", ref: "openMapPopover" }, { reference: de(() => [ t.enableOpenMapUI && t.openMapOptions.length > 0 ? (ve(), ke(p, { key: 0, ref: "openMapRef", icon: "openMap", class: "icon-button open-map-button", onMouseover: e[27] || (e[27] = (S) => s.showHelpText(3)), onMouseout: e[28] || (e[28] = (S) => s.hideHelpText(3)) }, null, 512)) : Ve("", !0) ]), _: 1 }, 8, ["visible"]) ]), _: 1 })) : Ve("", !0), t.showLocalSettings ? (ve(), ke(y, { key: 1 }, { default: de(() => [ oe(h, { visible: n.hoverVisibilities[4].value, content: "Change background color", placement: "right", width: "max-content", teleported: !1, trigger: "manual", "popper-class": "scaffold-popper right-popper non-selectable", ref: "settingsPopover" }, { reference: de(() => [ oe(p, { ref: "backgroundIconRef", icon: "changeBckgd", class: "icon-button", onMouseover: e[29] || (e[29] = (S) => s.showHelpText(4)), onMouseout: e[30] || (e[30] = (S) => s.hideHelpText(4)) }, null, 512) ]), _: 1 }, 8, ["visible"]) ]), _: 1 })) : Ve("", !0) ], 2) ], 512), [ [mn, t.displayUI && !n.isTransitioning] ]) ])), [ [L, n.loading] ]); } const Q5 = /* @__PURE__ */ mr(O5, [["render", Z5], ["__scopeId", "data-v-b5c791a7"]]); export { Q5 as ScaffoldVuer };