@expofp/floorplan
Version:
Interactive floor plan library for expos and events
11,634 lines • 472 kB
JavaScript
//#region ../../node_modules/.pnpm/three@0.185.1/node_modules/three/build/three.core.js
(function() {
try {
var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
e.SENTRY_RELEASE = { id: "3.47.0" };
var t = new e.Error().stack;
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "12f972d0-9d52-45d6-94ec-e58395a64a1e", e._sentryDebugIdIdentifier = "sentry-dbid-12f972d0-9d52-45d6-94ec-e58395a64a1e");
} catch {}
})();
var e, t, n, r, i, a, o, s, c, l = {
LEFT: 0,
MIDDLE: 1,
RIGHT: 2,
ROTATE: 0,
DOLLY: 1,
PAN: 2
}, u = {
ROTATE: 0,
PAN: 1,
DOLLY_PAN: 2,
DOLLY_ROTATE: 3
}, d = "attached", f = "detached", p = 1e3, m = 1001, h = 1002, g = 1003, _ = 1004, v = 1004, y = 1005, b = 1005, x = 1006, S = 1007, C = 1007, w = 1008, T = 1008, E = 1009, D = 1010, O = 1011, k = 1012, A = 1013, ee = 1014, te = 1015, ne = 1016, re = 1017, ie = 1018, ae = 1020, oe = 35902, se = 35899, ce = 1021, le = 1022, ue = 1023, de = 1026, fe = 1027, pe = 1028, me = 1029, he = 1030, ge = 1031, _e = 1032, ve = 1033, ye = 33776, be = 33777, xe = 33778, Se = 33779, Ce = 35840, we = 35841, Te = 35842, Ee = 35843, De = 36196, Oe = 37492, ke = 37496, Ae = 37488, je = 37489, Me = 37490, Ne = 37491, Pe = 37808, Fe = 37809, Ie = 37810, Le = 37811, Re = 37812, ze = 37813, Be = 37814, Ve = 37815, He = 37816, Ue = 37817, We = 37818, Ge = 37819, Ke = 37820, qe = 37821, Je = 36492, Ye = 36494, Xe = 36495, Ze = 36283, Qe = 36284, $e = 36285, et = 36286, tt = 2200, nt = 2201, rt = 2202, it = 2300, at = 2301, ot = 2302, st = 2303, ct = 2400, lt = 2401, ut = 2402, dt = 2500, ft = 2501, pt = 3200, mt = 3201, ht = 3202, gt = 3203, _t = "srgb", vt = "srgb-linear", yt = "linear", bt = "srgb", xt = 7680, St = 7681, Ct = 7682, wt = 7683, Tt = 34055, Et = 34056, Dt = 5386, Ot = 35044, kt = 35048, At = 35040, jt = 35045, Mt = 35049, Nt = 35041, Pt = 35046, Ft = 35050, It = 35042, Lt = "300 es", Rt = 2e3, zt = 2001, Bt = {
COMPUTE: "compute",
RENDER: "render"
}, Vt = {
PERSPECTIVE: "perspective",
LINEAR: "linear",
FLAT: "flat"
}, Ht = {
NORMAL: "normal",
CENTROID: "centroid",
SAMPLE: "sample",
FIRST: "first",
EITHER: "either"
}, Ut = { TEXTURE_COMPARE: "depthTextureCompare" };
function Wt(e) {
for (let t = e.length - 1; t >= 0; --t) if (e[t] >= 65535) return !0;
return !1;
}
var Gt = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array
};
function Kt(e, t) {
return new Gt[e](t);
}
function qt(e) {
return ArrayBuffer.isView(e) && !(e instanceof DataView);
}
function Jt(e) {
return document.createElementNS("http://www.w3.org/1999/xhtml", e);
}
function Yt() {
let e = Jt("canvas");
return e.style.display = "block", e;
}
var Xt = {}, Zt = null;
function Qt(e) {
Zt = e;
}
function $t() {
return Zt;
}
function en(...e) {
let t = "THREE." + e.shift();
Zt ? Zt("log", t, ...e) : console.log(t, ...e);
}
function tn(e) {
let t = e[0];
if (typeof t == "string" && t.startsWith("TSL:")) {
let t = e[1];
t && t.isStackTrace ? e[0] += " " + t.getLocation() : e[1] = "Stack trace not available. Enable \"THREE.Node.captureStackTrace\" to capture stack traces.";
}
return e;
}
function j(...e) {
e = tn(e);
let t = "THREE." + e.shift();
if (Zt) Zt("warn", t, ...e);
else {
let n = e[0];
n && n.isStackTrace ? console.warn(n.getError(t)) : console.warn(t, ...e);
}
}
function M(...e) {
e = tn(e);
let t = "THREE." + e.shift();
if (Zt) Zt("error", t, ...e);
else {
let n = e[0];
n && n.isStackTrace ? console.error(n.getError(t)) : console.error(t, ...e);
}
}
function nn(...e) {
let t = e.join(" ");
t in Xt || (Xt[t] = !0, j(...e));
}
function rn(e, t, n) {
return new Promise(function(r, i) {
function a() {
switch (e.clientWaitSync(t, e.SYNC_FLUSH_COMMANDS_BIT, 0)) {
case e.WAIT_FAILED:
i();
break;
case e.TIMEOUT_EXPIRED:
setTimeout(a, n);
break;
default: r();
}
}
setTimeout(a, n);
});
}
var an = {
0: 1,
2: 6,
4: 7,
3: 5,
1: 0,
6: 2,
7: 4,
5: 3
}, on = class {
addEventListener(e, t) {
this._listeners === void 0 && (this._listeners = {});
let n = this._listeners;
n[e] === void 0 && (n[e] = []), n[e].indexOf(t) === -1 && n[e].push(t);
}
hasEventListener(e, t) {
let n = this._listeners;
return n !== void 0 && n[e] !== void 0 && n[e].indexOf(t) !== -1;
}
removeEventListener(e, t) {
let n = this._listeners;
if (n === void 0) return;
let r = n[e];
if (r !== void 0) {
let e = r.indexOf(t);
e !== -1 && r.splice(e, 1);
}
}
dispatchEvent(e) {
let t = this._listeners;
if (t === void 0) return;
let n = t[e.type];
if (n !== void 0) {
e.target = this;
let t = n.slice(0);
for (let n = 0, r = t.length; n < r; n++) t[n].call(this, e);
e.target = null;
}
}
}, sn = /* @__PURE__ */ "00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff".split("."), cn = 1234567, ln = Math.PI / 180, un = 180 / Math.PI;
function dn() {
let e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, r = Math.random() * 4294967295 | 0;
return (sn[e & 255] + sn[e >> 8 & 255] + sn[e >> 16 & 255] + sn[e >> 24 & 255] + "-" + sn[t & 255] + sn[t >> 8 & 255] + "-" + sn[t >> 16 & 15 | 64] + sn[t >> 24 & 255] + "-" + sn[n & 63 | 128] + sn[n >> 8 & 255] + "-" + sn[n >> 16 & 255] + sn[n >> 24 & 255] + sn[r & 255] + sn[r >> 8 & 255] + sn[r >> 16 & 255] + sn[r >> 24 & 255]).toLowerCase();
}
function N(e, t, n) {
return Math.max(t, Math.min(n, e));
}
function fn(e, t) {
return (e % t + t) % t;
}
function pn(e, t, n, r, i) {
return r + (e - t) * (i - r) / (n - t);
}
function mn(e, t, n) {
return e === t ? 0 : (n - e) / (t - e);
}
function hn(e, t, n) {
return (1 - n) * e + n * t;
}
function gn(e, t, n, r) {
return hn(e, t, 1 - Math.exp(-n * r));
}
function _n(e, t = 1) {
return t - Math.abs(fn(e, t * 2) - t);
}
function vn(e, t, n) {
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t), e * e * (3 - 2 * e));
}
function yn(e, t, n) {
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t), e * e * e * (e * (e * 6 - 15) + 10));
}
function bn(e, t) {
return e + Math.floor(Math.random() * (t - e + 1));
}
function xn(e, t) {
return e + Math.random() * (t - e);
}
function Sn(e) {
return e * (.5 - Math.random());
}
function Cn(e) {
e !== void 0 && (cn = e);
let t = cn += 1831565813;
return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
}
function wn(e) {
return e * ln;
}
function Tn(e) {
return e * un;
}
function En(e) {
return (e & e - 1) == 0 && e !== 0;
}
function Dn(e) {
return 2 ** Math.ceil(Math.log(e) / Math.LN2);
}
function On(e) {
return 2 ** Math.floor(Math.log(e) / Math.LN2);
}
function kn(e, t, n, r, i) {
let a = Math.cos, o = Math.sin, s = a(n / 2), c = o(n / 2), l = a((t + r) / 2), u = o((t + r) / 2), d = a((t - r) / 2), f = o((t - r) / 2), p = a((r - t) / 2), m = o((r - t) / 2);
switch (i) {
case "XYX":
e.set(s * u, c * d, c * f, s * l);
break;
case "YZY":
e.set(c * f, s * u, c * d, s * l);
break;
case "ZXZ":
e.set(c * d, c * f, s * u, s * l);
break;
case "XZX":
e.set(s * u, c * m, c * p, s * l);
break;
case "YXY":
e.set(c * p, s * u, c * m, s * l);
break;
case "ZYZ":
e.set(c * m, c * p, s * u, s * l);
break;
default: j("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i);
}
}
function An(e, t) {
switch (t.constructor) {
case Float32Array: return e;
case Uint32Array: return e / 4294967295;
case Uint16Array: return e / 65535;
case Uint8Array: return e / 255;
case Int32Array: return Math.max(e / 2147483647, -1);
case Int16Array: return Math.max(e / 32767, -1);
case Int8Array: return Math.max(e / 127, -1);
default: throw Error("THREE.MathUtils: Invalid component type.");
}
}
function P(e, t) {
switch (t.constructor) {
case Float32Array: return e;
case Uint32Array: return Math.round(e * 4294967295);
case Uint16Array: return Math.round(e * 65535);
case Uint8Array: return Math.round(e * 255);
case Int32Array: return Math.round(e * 2147483647);
case Int16Array: return Math.round(e * 32767);
case Int8Array: return Math.round(e * 127);
default: throw Error("THREE.MathUtils: Invalid component type.");
}
}
var jn = {
DEG2RAD: ln,
RAD2DEG: un,
generateUUID: dn,
clamp: N,
euclideanModulo: fn,
mapLinear: pn,
inverseLerp: mn,
lerp: hn,
damp: gn,
pingpong: _n,
smoothstep: vn,
smootherstep: yn,
randInt: bn,
randFloat: xn,
randFloatSpread: Sn,
seededRandom: Cn,
degToRad: wn,
radToDeg: Tn,
isPowerOfTwo: En,
ceilPowerOfTwo: Dn,
floorPowerOfTwo: On,
setQuaternionFromProperEuler: kn,
normalize: P,
denormalize: An
};
o = Symbol.iterator;
var F = class {
constructor(e = 0, t = 0) {
this.x = e, this.y = t;
}
get width() {
return this.x;
}
set width(e) {
this.x = e;
}
get height() {
return this.y;
}
set height(e) {
this.y = e;
}
set(e, t) {
return this.x = e, this.y = t, this;
}
setScalar(e) {
return this.x = e, this.y = e, this;
}
setX(e) {
return this.x = e, this;
}
setY(e) {
return this.y = e, this;
}
setComponent(e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
default: throw Error("THREE.Vector2: index is out of range: " + e);
}
return this;
}
getComponent(e) {
switch (e) {
case 0: return this.x;
case 1: return this.y;
default: throw Error("THREE.Vector2: 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) {
return 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) {
return 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) {
let t = this.x, n = this.y, r = e.elements;
return this.x = r[0] * t + r[3] * n + r[6], this.y = r[1] * t + r[4] * n + 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 = N(this.x, e.x, t.x), this.y = N(this.y, e.y, t.y), this;
}
clampScalar(e, t) {
return this.x = N(this.x, e, t), this.y = N(this.y, e, t), this;
}
clampLength(e, t) {
let n = this.length();
return this.divideScalar(n || 1).multiplyScalar(N(n, e, t));
}
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 = Math.trunc(this.x), this.y = Math.trunc(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;
}
angleTo(e) {
let t = Math.sqrt(this.lengthSq() * e.lengthSq());
if (t === 0) return Math.PI / 2;
let n = this.dot(e) / t;
return Math.acos(N(n, -1, 1));
}
distanceTo(e) {
return Math.sqrt(this.distanceToSquared(e));
}
distanceToSquared(e) {
let t = this.x - e.x, n = this.y - e.y;
return t * t + n * n;
}
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, n) {
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, 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) {
return this.x = e.getX(t), this.y = e.getY(t), this;
}
rotateAround(e, t) {
let n = Math.cos(t), r = Math.sin(t), i = this.x - e.x, a = this.y - e.y;
return this.x = i * n - a * r + e.x, this.y = i * r + a * n + e.y, this;
}
random() {
return this.x = Math.random(), this.y = Math.random(), this;
}
*[o]() {
yield this.x, yield this.y;
}
};
e = F, e.prototype.isVector2 = !0;
var Mn = class {
constructor(e = 0, t = 0, n = 0, r = 1) {
this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = r;
}
static slerpFlat(e, t, n, r, i, a, o) {
let s = n[r + 0], c = n[r + 1], l = n[r + 2], u = n[r + 3], d = i[a + 0], f = i[a + 1], p = i[a + 2], m = i[a + 3];
if (u !== m || s !== d || c !== f || l !== p) {
let e = s * d + c * f + l * p + u * m;
e < 0 && (d = -d, f = -f, p = -p, m = -m, e = -e);
let t = 1 - o;
if (e < .9995) {
let n = Math.acos(e), r = Math.sin(n);
t = Math.sin(t * n) / r, o = Math.sin(o * n) / r, s = s * t + d * o, c = c * t + f * o, l = l * t + p * o, u = u * t + m * o;
} else {
s = s * t + d * o, c = c * t + f * o, l = l * t + p * o, u = u * t + m * o;
let e = 1 / Math.sqrt(s * s + c * c + l * l + u * u);
s *= e, c *= e, l *= e, u *= e;
}
}
e[t] = s, e[t + 1] = c, e[t + 2] = l, e[t + 3] = u;
}
static multiplyQuaternionsFlat(e, t, n, r, i, a) {
let o = n[r], s = n[r + 1], c = n[r + 2], l = n[r + 3], u = i[a], d = i[a + 1], f = i[a + 2], p = i[a + 3];
return e[t] = o * p + l * u + s * f - c * d, e[t + 1] = s * p + l * d + c * u - o * f, e[t + 2] = c * p + l * f + o * d - s * u, e[t + 3] = l * p - o * u - s * d - c * f, 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, n, r) {
return this._x = e, this._y = t, this._z = n, 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 = !0) {
let n = e._x, r = e._y, i = e._z, a = e._order, o = Math.cos, s = Math.sin, c = o(n / 2), l = o(r / 2), u = o(i / 2), d = s(n / 2), f = s(r / 2), p = s(i / 2);
switch (a) {
case "XYZ":
this._x = d * l * u + c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u - d * f * p;
break;
case "YXZ":
this._x = d * l * u + c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u + d * f * p;
break;
case "ZXY":
this._x = d * l * u - c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u - d * f * p;
break;
case "ZYX":
this._x = d * l * u - c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u + d * f * p;
break;
case "YZX":
this._x = d * l * u + c * f * p, this._y = c * f * u + d * l * p, this._z = c * l * p - d * f * u, this._w = c * l * u - d * f * p;
break;
case "XZY":
this._x = d * l * u - c * f * p, this._y = c * f * u - d * l * p, this._z = c * l * p + d * f * u, this._w = c * l * u + d * f * p;
break;
default: j("Quaternion: .setFromEuler() encountered an unknown order: " + a);
}
return t === !0 && this._onChangeCallback(), this;
}
setFromAxisAngle(e, t) {
let n = t / 2, r = Math.sin(n);
return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(n), this._onChangeCallback(), this;
}
setFromRotationMatrix(e) {
let t = e.elements, n = t[0], r = t[4], i = t[8], a = t[1], o = t[5], s = t[9], c = t[2], l = t[6], u = t[10], d = n + o + u;
if (d > 0) {
let e = .5 / Math.sqrt(d + 1);
this._w = .25 / e, this._x = (l - s) * e, this._y = (i - c) * e, this._z = (a - r) * e;
} else if (n > o && n > u) {
let e = 2 * Math.sqrt(1 + n - o - u);
this._w = (l - s) / e, this._x = .25 * e, this._y = (r + a) / e, this._z = (i + c) / e;
} else if (o > u) {
let e = 2 * Math.sqrt(1 + o - n - u);
this._w = (i - c) / e, this._x = (r + a) / e, this._y = .25 * e, this._z = (s + l) / e;
} else {
let e = 2 * Math.sqrt(1 + u - n - o);
this._w = (a - r) / e, this._x = (i + c) / e, this._y = (s + l) / e, this._z = .25 * e;
}
return this._onChangeCallback(), this;
}
setFromUnitVectors(e, t) {
let n = e.dot(t) + 1;
return n < 1e-8 ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (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 = n), this.normalize();
}
angleTo(e) {
return 2 * Math.acos(Math.abs(N(this.dot(e), -1, 1)));
}
rotateTowards(e, t) {
let n = this.angleTo(e);
if (n === 0) return this;
let r = Math.min(1, t / n);
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 *= e, this._y *= e, this._z *= e, this._w *= e), this._onChangeCallback(), this;
}
multiply(e) {
return this.multiplyQuaternions(this, e);
}
premultiply(e) {
return this.multiplyQuaternions(e, this);
}
multiplyQuaternions(e, t) {
let n = e._x, r = e._y, i = e._z, a = e._w, o = t._x, s = t._y, c = t._z, l = t._w;
return this._x = n * l + a * o + r * c - i * s, this._y = r * l + a * s + i * o - n * c, this._z = i * l + a * c + n * s - r * o, this._w = a * l - n * o - r * s - i * c, this._onChangeCallback(), this;
}
slerp(e, t) {
let n = e._x, r = e._y, i = e._z, a = e._w, o = this.dot(e);
o < 0 && (n = -n, r = -r, i = -i, a = -a, o = -o);
let s = 1 - t;
if (o < .9995) {
let e = Math.acos(o), c = Math.sin(e);
s = Math.sin(s * e) / c, t = Math.sin(t * e) / c, this._x = this._x * s + n * t, this._y = this._y * s + r * t, this._z = this._z * s + i * t, this._w = this._w * s + a * t, this._onChangeCallback();
} else this._x = this._x * s + n * t, this._y = this._y * s + r * t, this._z = this._z * s + i * t, this._w = this._w * s + a * t, this.normalize();
return this;
}
slerpQuaternions(e, t, n) {
return this.copy(e).slerp(t, n);
}
random() {
let e = 2 * Math.PI * Math.random(), t = 2 * Math.PI * Math.random(), n = Math.random(), r = Math.sqrt(1 - n), i = Math.sqrt(n);
return this.set(r * Math.sin(e), r * Math.cos(e), i * Math.sin(t), i * Math.cos(t));
}
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._onChangeCallback(), this;
}
toJSON() {
return this.toArray();
}
_onChange(e) {
return this._onChangeCallback = e, this;
}
_onChangeCallback() {}
*[Symbol.iterator]() {
yield this._x, yield this._y, yield this._z, yield this._w;
}
};
s = Symbol.iterator;
var I = class {
constructor(e = 0, t = 0, n = 0) {
this.x = e, this.y = t, this.z = n;
}
set(e, t, n) {
return n === void 0 && (n = this.z), this.x = e, this.y = t, this.z = n, 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 Error("THREE.Vector3: 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 Error("THREE.Vector3: 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) {
return 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) {
return 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) {
return 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 this.applyQuaternion(Pn.setFromEuler(e));
}
applyAxisAngle(e, t) {
return this.applyQuaternion(Pn.setFromAxisAngle(e, t));
}
applyMatrix3(e) {
let t = this.x, n = this.y, r = this.z, i = e.elements;
return this.x = i[0] * t + i[3] * n + i[6] * r, this.y = i[1] * t + i[4] * n + i[7] * r, this.z = i[2] * t + i[5] * n + i[8] * r, this;
}
applyNormalMatrix(e) {
return this.applyMatrix3(e).normalize();
}
applyMatrix4(e) {
let t = this.x, n = this.y, r = this.z, i = e.elements, a = 1 / (i[3] * t + i[7] * n + i[11] * r + i[15]);
return this.x = (i[0] * t + i[4] * n + i[8] * r + i[12]) * a, this.y = (i[1] * t + i[5] * n + i[9] * r + i[13]) * a, this.z = (i[2] * t + i[6] * n + i[10] * r + i[14]) * a, this;
}
applyQuaternion(e) {
let t = this.x, n = this.y, r = this.z, i = e.x, a = e.y, o = e.z, s = e.w, c = 2 * (a * r - o * n), l = 2 * (o * t - i * r), u = 2 * (i * n - a * t);
return this.x = t + s * c + a * u - o * l, this.y = n + s * l + o * c - i * u, this.z = r + s * u + i * l - a * c, this;
}
project(e) {
return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix);
}
unproject(e) {
return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld);
}
transformDirection(e) {
let t = this.x, n = this.y, r = this.z, i = e.elements;
return this.x = i[0] * t + i[4] * n + i[8] * r, this.y = i[1] * t + i[5] * n + i[9] * r, this.z = i[2] * t + i[6] * n + i[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 = N(this.x, e.x, t.x), this.y = N(this.y, e.y, t.y), this.z = N(this.z, e.z, t.z), this;
}
clampScalar(e, t) {
return this.x = N(this.x, e, t), this.y = N(this.y, e, t), this.z = N(this.z, e, t), this;
}
clampLength(e, t) {
let n = this.length();
return this.divideScalar(n || 1).multiplyScalar(N(n, e, t));
}
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 = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(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;
}
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, n) {
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this;
}
cross(e) {
return this.crossVectors(this, e);
}
crossVectors(e, t) {
let n = e.x, r = e.y, i = e.z, a = t.x, o = t.y, s = t.z;
return this.x = r * s - i * o, this.y = i * a - n * s, this.z = n * o - r * a, this;
}
projectOnVector(e) {
let t = e.lengthSq();
if (t === 0) return this.set(0, 0, 0);
let n = e.dot(this) / t;
return this.copy(e).multiplyScalar(n);
}
projectOnPlane(e) {
return Nn.copy(this).projectOnVector(e), this.sub(Nn);
}
reflect(e) {
return this.sub(Nn.copy(e).multiplyScalar(2 * this.dot(e)));
}
angleTo(e) {
let t = Math.sqrt(this.lengthSq() * e.lengthSq());
if (t === 0) return Math.PI / 2;
let n = this.dot(e) / t;
return Math.acos(N(n, -1, 1));
}
distanceTo(e) {
return Math.sqrt(this.distanceToSquared(e));
}
distanceToSquared(e) {
let t = this.x - e.x, n = this.y - e.y, r = this.z - e.z;
return t * t + n * n + 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, n) {
let r = Math.sin(t) * e;
return this.x = r * Math.sin(n), this.y = Math.cos(t) * e, this.z = r * Math.cos(n), this;
}
setFromCylindrical(e) {
return this.setFromCylindricalCoords(e.radius, e.theta, e.y);
}
setFromCylindricalCoords(e, t, n) {
return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this;
}
setFromMatrixPosition(e) {
let t = e.elements;
return this.x = t[12], this.y = t[13], this.z = t[14], this;
}
setFromMatrixScale(e) {
let t = this.setFromMatrixColumn(e, 0).length(), n = this.setFromMatrixColumn(e, 1).length(), r = this.setFromMatrixColumn(e, 2).length();
return this.x = t, this.y = n, this.z = r, this;
}
setFromMatrixColumn(e, t) {
return this.fromArray(e.elements, t * 4);
}
setFromMatrix3Column(e, t) {
return this.fromArray(e.elements, t * 3);
}
setFromEuler(e) {
return this.x = e._x, this.y = e._y, this.z = e._z, this;
}
setFromColor(e) {
return this.x = e.r, this.y = e.g, this.z = e.b, this;
}
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) {
return 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;
}
randomDirection() {
let e = Math.random() * Math.PI * 2, t = Math.random() * 2 - 1, n = Math.sqrt(1 - t * t);
return this.x = n * Math.cos(e), this.y = t, this.z = n * Math.sin(e), this;
}
*[s]() {
yield this.x, yield this.y, yield this.z;
}
};
t = I, t.prototype.isVector3 = !0;
var Nn = /*@__PURE__*/ new I(), Pn = /*@__PURE__*/ new Mn(), Fn = class {
constructor(e, t, n, r, i, a, o, s, c) {
this.elements = [
1,
0,
0,
0,
1,
0,
0,
0,
1
], e !== void 0 && this.set(e, t, n, r, i, a, o, s, c);
}
set(e, t, n, r, i, a, o, s, c) {
let l = this.elements;
return l[0] = e, l[1] = r, l[2] = o, l[3] = t, l[4] = i, l[5] = s, l[6] = n, l[7] = a, l[8] = c, this;
}
identity() {
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this;
}
copy(e) {
let t = this.elements, n = e.elements;
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], this;
}
extractBasis(e, t, n) {
return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this;
}
setFromMatrix4(e) {
let 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) {
let n = e.elements, r = t.elements, i = this.elements, a = n[0], o = n[3], s = n[6], c = n[1], l = n[4], u = n[7], d = n[2], f = n[5], p = n[8], m = r[0], h = r[3], g = r[6], _ = r[1], v = r[4], y = r[7], b = r[2], x = r[5], S = r[8];
return i[0] = a * m + o * _ + s * b, i[3] = a * h + o * v + s * x, i[6] = a * g + o * y + s * S, i[1] = c * m + l * _ + u * b, i[4] = c * h + l * v + u * x, i[7] = c * g + l * y + u * S, i[2] = d * m + f * _ + p * b, i[5] = d * h + f * v + p * x, i[8] = d * g + f * y + p * S, this;
}
multiplyScalar(e) {
let 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() {
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8];
return t * a * l - t * o * c - n * i * l + n * o * s + r * i * c - r * a * s;
}
invert() {
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8], u = l * a - o * c, d = o * s - l * i, f = c * i - a * s, p = t * u + n * d + r * f;
if (p === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
let m = 1 / p;
return e[0] = u * m, e[1] = (r * c - l * n) * m, e[2] = (o * n - r * a) * m, e[3] = d * m, e[4] = (l * t - r * s) * m, e[5] = (r * i - o * t) * m, e[6] = f * m, e[7] = (n * s - c * t) * m, e[8] = (a * t - n * i) * m, this;
}
transpose() {
let e, 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) {
let 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, n, r, i, a, o) {
let s = Math.cos(i), c = Math.sin(i);
return this.set(n * s, n * c, -n * (s * a + c * o) + a + e, -r * c, r * s, -r * (-c * a + s * o) + o + t, 0, 0, 1), this;
}
scale(e, t) {
return nn("Matrix3: .scale() is deprecated. Use .makeScale() instead."), this.premultiply(In.makeScale(e, t)), this;
}
rotate(e) {
return nn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."), this.premultiply(In.makeRotation(-e)), this;
}
translate(e, t) {
return nn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."), this.premultiply(In.makeTranslation(e, t)), this;
}
makeTranslation(e, t) {
return e.isVector2 ? this.set(1, 0, e.x, 0, 1, e.y, 0, 0, 1) : this.set(1, 0, e, 0, 1, t, 0, 0, 1), this;
}
makeRotation(e) {
let t = Math.cos(e), n = Math.sin(e);
return this.set(t, -n, 0, n, t, 0, 0, 0, 1), this;
}
makeScale(e, t) {
return this.set(e, 0, 0, 0, t, 0, 0, 0, 1), this;
}
equals(e) {
let t = this.elements, n = e.elements;
for (let e = 0; e < 9; e++) if (t[e] !== n[e]) return !1;
return !0;
}
fromArray(e, t = 0) {
for (let n = 0; n < 9; n++) this.elements[n] = e[n + t];
return this;
}
toArray(e = [], t = 0) {
let n = this.elements;
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e;
}
clone() {
return new this.constructor().fromArray(this.elements);
}
};
n = Fn, n.prototype.isMatrix3 = !0;
var In = /*@__PURE__*/ new Fn(), Ln = /*@__PURE__*/ new Fn().set(.4123908, .3575843, .1804808, .212639, .7151687, .0721923, .0193308, .1191948, .9505322), Rn = /*@__PURE__*/ new Fn().set(3.2409699, -1.5373832, -.4986108, -.9692436, 1.8759675, .0415551, .0556301, -.203977, 1.0569715);
function zn() {
let e = {
enabled: !0,
workingColorSpace: vt,
spaces: {},
convert: function(e, t, n) {
return this.enabled === !1 || t === n || !t || !n ? e : (this.spaces[t].transfer === "srgb" && (e.r = Vn(e.r), e.g = Vn(e.g), e.b = Vn(e.b)), this.spaces[t].primaries !== this.spaces[n].primaries && (e.applyMatrix3(this.spaces[t].toXYZ), e.applyMatrix3(this.spaces[n].fromXYZ)), this.spaces[n].transfer === "srgb" && (e.r = Hn(e.r), e.g = Hn(e.g), e.b = Hn(e.b)), e);
},
workingToColorSpace: function(e, t) {
return this.convert(e, this.workingColorSpace, t);
},
colorSpaceToWorking: function(e, t) {
return this.convert(e, t, this.workingColorSpace);
},
getPrimaries: function(e) {
return this.spaces[e].primaries;
},
getTransfer: function(e) {
return e === "" ? yt : this.spaces[e].transfer;
},
getToneMappingMode: function(e) {
return this.spaces[e].outputColorSpaceConfig.toneMappingMode || "standard";
},
getLuminanceCoefficients: function(e, t = this.workingColorSpace) {
return e.fromArray(this.spaces[t].luminanceCoefficients);
},
define: function(e) {
Object.assign(this.spaces, e);
},
_getMatrix: function(e, t, n) {
return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ);
},
_getDrawingBufferColorSpace: function(e) {
return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace;
},
_getUnpackColorSpace: function(e = this.workingColorSpace) {
return this.spaces[e].workingColorSpaceConfig.unpackColorSpace;
},
fromWorkingColorSpace: function(t, n) {
return nn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."), e.workingToColorSpace(t, n);
},
toWorkingColorSpace: function(t, n) {
return nn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."), e.colorSpaceToWorking(t, n);
}
}, t = [
.64,
.33,
.3,
.6,
.15,
.06
], n = [
.2126,
.7152,
.0722
], r = [.3127, .329];
return e.define({
[vt]: {
primaries: t,
whitePoint: r,
transfer: yt,
toXYZ: Ln,
fromXYZ: Rn,
luminanceCoefficients: n,
workingColorSpaceConfig: { unpackColorSpace: _t },
outputColorSpaceConfig: { drawingBufferColorSpace: _t }
},
[_t]: {
primaries: t,
whitePoint: r,
transfer: bt,
toXYZ: Ln,
fromXYZ: Rn,
luminanceCoefficients: n,
outputColorSpaceConfig: { drawingBufferColorSpace: _t }
}
}), e;
}
var Bn = /*@__PURE__*/ zn();
function Vn(e) {
return e < .04045 ? e * .0773993808 : (e * .9478672986 + .0521327014) ** 2.4;
}
function Hn(e) {
return e < .0031308 ? e * 12.92 : 1.055 * e ** .41666 - .055;
}
var Un, Wn = class {
static getDataURL(e, t = "image/png") {
if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src;
let n;
if (e instanceof HTMLCanvasElement) n = e;
else {
Un === void 0 && (Un = Jt("canvas")), Un.width = e.width, Un.height = e.height;
let t = Un.getContext("2d");
e instanceof ImageData ? t.putImageData(e, 0, 0) : t.drawImage(e, 0, 0, e.width, e.height), n = Un;
}
return n.toDataURL(t);
}
static sRGBToLinear(e) {
if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) {
let t = Jt("canvas");
t.width = e.width, t.height = e.height;
let n = t.getContext("2d");
n.drawImage(e, 0, 0, e.width, e.height);
let r = n.getImageData(0, 0, e.width, e.height), i = r.data;
for (let e = 0; e < i.length; e++) i[e] = Vn(i[e] / 255) * 255;
return n.putImageData(r, 0, 0), t;
} else if (e.data) {
let t = e.data.slice(0);
for (let e = 0; e < t.length; e++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[e] = Math.floor(Vn(t[e] / 255) * 255) : t[e] = Vn(t[e]);
return {
data: t,
width: e.width,
height: e.height
};
} else return j("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e;
}
}, Gn = 0, Kn = class {
constructor(e = null) {
this.isSource = !0, Object.defineProperty(this, "id", { value: Gn++ }), this.uuid = dn(), this.data = e, this.dataReady = !0, this.version = 0;
}
getSize(e) {
let t = this.data;
return typeof HTMLVideoElement < "u" && t instanceof HTMLVideoElement ? e.set(t.videoWidth, t.videoHeight, 0) : typeof VideoFrame < "u" && t instanceof VideoFrame ? e.set(t.displayWidth, t.displayHeight, 0) : t === null ? e.set(0, 0, 0) : e.set(t.width, t.height, t.depth || 0), e;
}
set needsUpdate(e) {
e === !0 && this.version++;
}
toJSON(e) {
let t = e === void 0 || typeof e == "string";
if (!t && e.images[this.uuid] !== void 0) return e.images[this.uuid];
let n = {
uuid: this.uuid,
url: ""
}, r = this.data;
if (r !== null) {
let e;
if (Array.isArray(r)) {
e = [];
for (let t = 0, n = r.length; t < n; t++) r[t].isDataTexture ? e.push(qn(r[t].image)) : e.push(qn(r[t]));
} else e = qn(r);
n.url = e;
}
return t || (e.images[this.uuid] = n), n;
}
};
function qn(e) {
return typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap ? Wn.getDataURL(e) : e.data ? {
data: Array.from(e.data),
width: e.width,
height: e.height,
type: e.data.constructor.name
} : (j("Texture: Unable to serialize Texture."), {});
}
var Jn = 0, Yn = /*@__PURE__*/ new I(), L = class e extends on {
constructor(t = e.DEFAULT_IMAGE, n = e.DEFAULT_MAPPING, r = m, i = m, a = x, o = w, s = ue, c = E, l = e.DEFAULT_ANISOTROPY, u = "") {
super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: Jn++ }), this.uuid = dn(), this.name = "", this.source = new Kn(t), this.mipmaps = [], this.mapping = n, this.channel = 0, this.wrapS = r, this.wrapT = i, this.magFilter = a, this.minFilter = o, this.anisotropy = l, this.format = s, this.internalFormat = null, this.type = c, this.offset = new F(0, 0), this.repeat = new F(1, 1), this.center = new F(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Fn(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = u, this.userData = {}, this.updateRanges = [], this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.isArrayTexture = !!(t && t.depth && t.depth > 1), this.pmremVersion = 0, this.normalized = !1;
}
get width() {
return this.source.getSize(Yn).x;
}
get height() {
return this.source.getSize(Yn).y;
}
get depth() {
return this.source.getSize(Yn).z;
}
get image() {
return this.source.data;
}
set image(e) {
this.source.data = e;
}
updateMatrix() {
this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);
}
addUpdateRange(e, t) {
this.updateRanges.push({
start: e,
count: t
});
}
clearUpdateRanges() {
this.updateRanges.length = 0;
}
clone() {
return new this.constructor().copy(this);
}
copy(e) {
return this.name = e.name, this.source = e.source, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.channel = e.channel, 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.normalized = e.normalized, 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.colorSpace = e.colorSpace, this.renderTarget = e.renderTarget, this.isRenderTargetTexture = e.isRenderTargetTexture, this.isArrayTexture = e.isArrayTexture, this.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this;
}
setValues(e) {
for (let t in e) {
let n = e[t];
if (n === void 0) {
j(`Texture.setValues(): parameter '${t}' has value of undefined.`);
continue;
}
let r = this[t];
if (r === void 0) {
j(`Texture.setValues(): property '${t}' does not exist.`);
continue;
}
r && n && r.isVector2 && n.isVector2 || r && n && r.isVector3 && n.isVector3 || r && n && r.isMatrix3 && n.isMatrix3 ? r.copy(n) : this[t] = n;
}
}
toJSON(e) {
let t = e === void 0 || typeof e == "string";
if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid];
let n = {
metadata: {
version: 4.7,
type: "Texture",
generator: "Texture.toJSON"
},
uuid: this.uuid,
name: this.name,
image: this.source.toJSON(e).uuid,
mapping: this.mapping,
channel: this.channel,
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,
internalFormat: this.internalFormat,
type: this.type,
normalized: this.normalized,
colorSpace: this.colorSpace,
minFilter: this.minFilter,
magFilter: this.magFilter,
anisotropy: this.anisotropy,
flipY: this.flipY,
generateMipmaps: this.generateMipmaps,
premultiplyAlpha: this.premultiplyAlpha,
unpackAlignment: this.unpackAlignment
};
return Object.keys(this.userData).length > 0 && (n.userData = this.userData), t || (e.textures[this.uuid] = n), n;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
transformUv(e) {
if (this.mapping !== 300) return e;
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) {
case p:
e.x -= Math.floor(e.x);
break;
case m:
e.x = e.x < 0 ? 0 : 1;
break;
case h:
Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x -= Math.floor(e.x);
break;
}
if (e.y < 0 || e.y > 1) switch (this.wrapT) {
case p:
e.y -= Math.floor(e.y);
break;
case m:
e.y = e.y < 0 ? 0 : 1;
break;
case h:
Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(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++, this.source.needsUpdate = !0);
}
set needsPMREMUpdate(e) {
e === !0 && this.pmremVersion++;
}
};
L.DEFAULT_IMAGE = null, L.DEFAULT_MAPPING = 300, L.DEFAULT_ANISOTROPY = 1, c = Symbol.iterator;
var Xn = class {
constructor(e = 0, t = 0, n = 0, r = 1) {
this.x = e, this.y = t, this.z = n, 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, n, r) {
return this.x = e, this.y = t, this.z = n, 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 Error("THREE.Vector4: 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 Error("THREE.Vector4: 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 ? 1 : e.w, this;
}
add(e) {
return 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) {
return 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) {
let t = this.x, n = this.y, r = this.z, i = this.w, a = e.elements;
return this.x = a[0] * t + a[4] * n + a[8] * r + a[12] * i, this.y = a[1] * t + a[5] * n + a[9] * r + a[13] * i, this.z = a[2] * t + a[6] * n + a[10] * r + a[14] * i, this.w = a[3] * t + a[7] * n + a[11] * r + a[15] * i, this;
}
divide(e) {
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this.w /= e.w, this;
}
divideScalar(e) {
return this.multiplyScalar(1 / e);
}
setAxisAngleFromQuaternion(e) {
this.w = 2 * Math.acos(e.w);
let 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, n, r, i, a = .01, o = .1, s = e.elements, c = s[0], l = s[4], u = s[8], d = s[1], f = s[5], p = s[9], m = s[2], h = s[6], g = s[10];
if (Math.abs(l - d) < a && Math.abs(u - m) < a && Math.abs(p - h) < a) {
if (Math.abs(l + d) < o && Math.abs(u + m) < o && Math.abs(p + h) < o && Math.abs(c + f + g - 3) < o) return this.set(1, 0, 0, 0), this;
t = Math.PI;
let e = (c + 1) / 2, s = (f + 1) / 2, _ = (g + 1) / 2, v = (l + d) / 4, y = (u + m) / 4, b = (p + h) / 4;
return e > s && e > _ ? e < a ? (n = 0, r = .707106781, i = .707106781) : (n = Math.sqrt(e), r = v / n, i = y / n) : s > _ ? s < a ? (n = .707106781, r = 0, i = .707106781) : (r = Math.sqrt(s), n = v / r, i = b / r) : _ < a ? (n = .707106781, r = .707106781, i = 0) : (i = Math.sqrt(_), n = y / i, r = b / i), this.set(n, r, i, t), this;
}
let _ = Math.sqrt((h - p) * (h - p) + (u - m) * (u - m) + (d - l) * (d - l));
return Math.abs(_) < .001 && (_ = 1), this.x = (h - p) / _, this.y = (u - m) / _, this.z = (d - l) / _, this.w = Math.acos((c + f + g - 1) / 2), this;
}
setFromMatrixPosition(e) {
let t = e.elements;
return this.x = t[12], this.y = t[13], this.z = t[14], this.w = t[15], 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 = N(this.x, e.x, t.x), this.y = N(this.y, e.y, t.y), this.z = N(this.z, e.z, t.z), this.w = N(this.w, e.w, t.w), this;
}
clampScalar(e, t) {
return this.x = N(this.x, e, t), this.y = N(this.y, e, t), this.z = N(this.z, e, t), this.w = N(this.w, e, t), this;
}
clampLength(e, t) {
let n = this.length();
return this.divideScalar(n || 1).multiplyScalar(N(n, e, t));
}
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 = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this.w = Math.trunc(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, n) {
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this.w = e.w + (t.w - e.w) * n, 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) {
return 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;
}
*[c]() {
yield this.x, yield this.y, yield this.z, yield this.w;
}
};
r = Xn, r.prototype.isVector4 = !0;
var Zn = class extends on {
constructor(e = 1, t = 1, n = {}) {
super(), n = Object.assign({
generateMipmaps: !1,
internalFormat: null,
minFilter: x,
depthBuffer: !0,
stencilBuffer: !1,
resolveDepthBuffer: !0,
resolveStencilBuffer: !0,
depthTexture: null,
samples: 0,
count: 1,
depth: 1,
multiview: !1,
useArrayDepthTexture: !1
}, n), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = n.depth, this.scissor = new Xn(0, 0, e, t), this.scissorTest = !1, this.viewport = new Xn(0, 0, e, t), this.textures = [];
let r = new L({
width: e,
height: t,
depth: n.depth
}), i = n.count;
for (let e = 0; e < i; e++) this.textures[e] = r.clone(), this.textures[e].isRenderTargetTexture = !0, this.textures[e].renderTarget = this;
this._setTextureOptions(n), this.depthBuffer = n.depthBuffer, this.stencilBuffer = n.stencilBuffer, this.resolveDepthBuffer = n.resolveDepthBuffer, this.resolveStencilBuffer = n.resolveStencilBuffer, this._depthTexture = null, this.depthTexture = n.depthTexture, this.samples = n.samples, this.multiview = n.multiview, this.useArrayDepthTexture = n.useArrayDepthTexture;
}
_setTextureOptions(e = {}) {
let t = {
minFilter: x,
generateMipmaps: !1,
flipY: !1,
internalFormat: null
};
e.mapping !== void 0 && (t.mapping = e.mapping), e.wrapS !== void 0 && (t.wrapS = e.wrapS), e.wrapT !== void 0 && (t.wrapT = e.wrapT), e.wrapR !== void 0 && (t.wrapR = e.wrapR), e.magFilter !== void 0 && (t.magFilter = e.magFilter), e.minFilter !== void 0 && (t.minFilter = e.minFilter), e.format !== void 0 && (t.format = e.format), e.type !== void 0 && (t.type = e.type), e.anisotropy !== void 0 && (t.anisotropy = e.anisotropy), e.colorSpace !== void 0 && (t.colorSpace = e.colorSpace), e.flipY !== void 0 && (t.flipY = e.flipY), e.generateMipmaps !== void 0 && (t.generateMipmaps = e.generateMipmaps), e.internalFormat !== void 0 && (t.internalFormat = e.internalFormat);
for (let e = 0; e < this.textures.length; e++) this.textures[e].setValues(t);
}
get texture() {
return this.textures[0];
}
set texture(e) {
this.textures[0] = e;
}
set depthTexture(e) {
this._depthTexture !== null && (this._depthTexture.renderTarget = null), e !== null && (e.renderTarget = this), this._depthTexture = e;
}
get depthTexture() {
return this._depthTexture;
}
setSize(e, t, n = 1) {
if (this.width !== e || this.height !== t || this.depth !== n) {
this.width = e, this.height = t, this.depth = n;
for (let r = 0, i = this.textures.length; r < i; r++) this.textures[r].image.width = e, this.textures[r].image.height = t, this.textures[r].image.depth = n, this.textures[r].isData3DTexture !== !0 && (this.textures[r].isArrayTexture = this.textures[r].image.depth > 1);
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) {
this.width = e.width, this.height = e.height, this.depth = e.depth, this.scissor.copy(e.scissor), this.scissorTest = e.scissorTest, this.viewport.copy(e.viewport), this.textures.length = 0;
for (let t = 0, n = e.textures.length; t < n; t++) {
this.textures[t] = e.textures[t].clone(), this.textures[t].isRenderTargetTexture = !0, this.textures[t].renderTarget = this;
let n = Object.assign({}, e.textures[t].image);
this.textures[t].source = new Kn(n);
}
return this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.resolveDepthBuffer = e.resolveDepthBuffer, this.resolveStencilBuffer = e.resolveStencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this.multiview = e.multiview, this.useArrayDepthTexture = e.useArrayDepthTexture, this;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
}, Qn = class extends Zn {
constructor(e = 1, t = 1, n = {}) {
super(e, t, n), this.isWebGLRenderTarget = !0;
}
}, $n = class extends L {
constructor(e = null, t = 1, n = 1, r = 1) {
super(null), this.isDataArrayTexture = !0, this.image = {
data: e,
width: t,
height: n,
depth: r
}, this.magFilter = g, this.minFilter = g, this.wrapR = m, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set();
}
addLayerUpdate(e) {
this.layerUpdates.add(e);
}
clearLayerUpdates() {
this.layerUpdates.clear();
}
}, er = class extends Qn {
constructor(e = 1, t = 1, n = 1, r = {}) {
super(e, t, r), this.isWebGLArrayRenderTarget = !0, this.depth = n, this.texture = new $n(null, e, t, n), this._setTextureOptions(r), this.texture.isRenderTargetTexture = !0;
}
}, tr = class extends L {
constructor(e = null, t = 1, n = 1, r = 1) {
super(null), this.isData3DTexture = !0, this.image = {
data: e,
width: t,
height: n,
depth: r
}, this.magFilter = g, this.minFilter = g, this.wrapR = m, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}, nr = class extends Qn {
constructor(e = 1, t = 1, n = 1, r = {}) {
super(e, t, r), this.isWebGL3DRenderTarget = !0, this.depth = n, this.texture = new tr(null, e, t, n), this._setTextureOptions(r), this.texture.isRenderTargetTexture = !0;
}
}, R = class e {
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
this.elements = [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1
], e !== void 0 && this.set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h);
}
set(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
let g = this.elements;
return g[0] = e, g[4] = t, g[8] = n, g[12] = r, g[1] = i, g[5] = a, g[9] = o, g[13] = s, g[2] = c, g[6] = l, g[10] = u, g[14] = d, g[3] = f, g[7] = p, g[11] = m, g[15] = h, 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 e().fromArray(this.elements);
}
copy(e) {
let t = this.elements, n = e.elements;
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], t[9] = n[9], t[10] = n[10], t[11] = n[11], t[12] = n[12], t[13] = n[13], t[14] = n[14], t[15] = n[15], this;
}
copyPosition(e) {
let t = this.elements, n = e.elements;
return t[12] = n[12], t[13] = n[13], t[14] = n[14], this;
}
setFromMatrix3(e) {
let 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, n) {
return this.determinantAffine() === 0 ? (e.set(1, 0, 0), t.set(0, 1, 0), n.set(0, 0, 1), this) : (e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this);
}
makeBasis(e, t, n) {
return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1), this;
}
extractRotation(e) {
if (e.determinantAffine() === 0) return this.identity();
let t = this.elements, n = e.elements, r = 1 / rr.setFromMatrixColumn(e, 0).length(), i = 1 / rr.setFromMatrixColumn(e, 1).length(), a = 1 / rr.setFromMatrixColumn(e, 2).length();
return t[0] = n[0] * r, t[1] = n[1] * r, t[2] = n[2] * r, t[3] = 0, t[4] = n[4] * i, t[5] = n[5] * i, t[6] = n[6] * i, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this;
}
makeRotationFromEuler(e) {
let t = this.elements, n = e.x, r = e.y, i = e.z, a = Math.cos(n), o = Math.sin(n), s = Math.cos(r), c = Math.sin(r), l = Math.cos(i), u = Math.sin(i);
if (e.order === "XYZ") {
let e = a * l, n = a * u, r = o * l, i = o * u;
t[0] = s * l, t[4] = -s * u, t[8] = c, t[1] = n + r * c, t[5] = e - i * c, t[9] = -o * s, t[2] = i - e * c, t[6] = r + n * c, t[10] = a * s;
} else if (e.order === "YXZ") {
let e = s * l, n = s * u, r = c * l, i = c * u;
t[0] = e + i * o, t[4] = r * o - n, t[8] = a * c, t[1] = a * u, t[5] = a * l, t[9] = -o, t[2] = n * o - r, t[6] = i + e * o, t[10] = a * s;
} else if (e.order === "ZXY") {
let e = s * l, n = s * u, r = c * l, i = c * u;
t[0] = e - i * o, t[4] = -a * u, t[8] = r + n * o, t[1] = n + r * o, t[5] = a * l, t[9] = i - e * o, t[2] = -a * c, t[6] = o, t[10] = a * s;
} else if (e.order === "ZYX") {
let e = a * l, n = a * u, r = o * l, i = o * u;
t[0] = s * l, t[4] = r * c - n, t[8] = e * c + i, t[1] = s * u, t[5] = i * c + e, t[9] = n * c - r, t[2] = -c, t[6] = o * s, t[10] = a * s;
} else if (e.order === "YZX") {
let e = a * s, n = a * c, r = o * s, i = o * c;
t[0] = s * l, t[4] = i - e * u, t[8] = r * u + n, t[1] = u, t[5] = a * l, t[9] = -o * l, t[2] = -c * l, t[6] = n * u + r, t[10] = e - i * u;
} else if (e.order === "XZY") {
let e = a * s, n = a * c, r = o * s, i = o * c;
t[0] = s * l, t[4] = -u, t[8] = c * l, t[1] = e * u + i, t[5] = a * l, t[9] = n * u - r, t[2] = r * u - n, t[6] = o * l, t[10] = i * u + e;
}
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(ar, e, or);
}
lookAt(e, t, n) {
let r = this.elements;
return lr.subVectors(e, t), lr.lengthSq() === 0 && (lr.z = 1), lr.normalize(), sr.crossVectors(n, lr), sr.lengthSq() === 0 && (Math.abs(n.z) === 1 ? lr.x += 1e-4 : lr.z += 1e-4, lr.normalize(), sr.crossVectors(n, lr)), sr.normalize(), cr.crossVectors(lr, sr), r[0] = sr.x, r[4] = cr.x, r[8] = lr.x, r[1] = sr.y, r[5] = cr.y, r[9] = lr.y, r[2] = sr.z, r[6] = cr.z, r[10] = lr.z, this;
}
multiply(e) {
return this.multiplyMatrices(this, e);
}
premultiply(e) {
return this.multiplyMatrices(e, this);
}
multiplyMatrices(e, t) {
let n = e.elements, r = t.elements, i = this.elements, a = n[0], o = n[4], s = n[8], c = n[12], l = n[1], u = n[5], d = n[9], f = n[13], p = n[2], m = n[6], h = n[10], g = n[14], _ = n[3], v = n[7], y = n[11], b = n[15], x = r[0], S = r[4], C = r[8], w = r[12], T = r[1], E = r[5], D = r[9], O = r[13], k = r[2], A = r[6], ee = r[10], te = r[14], ne = r[3], re = r[7], ie = r[11], ae = r[15];
return i[0] = a * x + o * T + s * k + c * ne, i[4] = a * S + o * E + s * A + c * re, i[8] = a * C + o * D + s * ee + c * ie, i[12] = a * w + o * O + s * te + c * ae, i[1] = l * x + u * T + d * k + f * ne, i[5] = l * S + u * E + d * A + f * re, i[9] = l * C + u * D + d * ee + f * ie, i[13] = l * w + u * O + d * te + f * ae, i[2] = p * x + m * T + h * k + g * ne, i[6] = p * S + m * E + h * A + g * re, i[10] = p * C + m * D + h * ee + g * ie, i[14] = p * w + m * O + h * te + g * ae, i[3] = _ * x + v * T + y * k + b * ne, i[7] = _ * S + v * E + y * A + b * re, i[11] = _ * C + v * D + y * ee + b * ie, i[15] = _ * w + v * O + y * te + b * ae, this;
}
multiplyScalar(e) {
let 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() {
let e = this.elements, t = e[0], n = e[4], r = e[8], i = e[12], a = e[1], o = e[5], s = e[9], c = e[13], l = e[2], u = e[6], d = e[10], f = e[14], p = e[3], m = e[7], h = e[11], g = e[15], _ = s * f - c * d, v = o * f - c * u, y = o * d - s * u, b = a * f - c * l, x = a * d - s * l, S = a * u - o * l;
return t * (m * _ - h * v + g * y) - n * (p * _ - h * b + g * x) + r * (p * v - m * b + g * S) - i * (p * y - m * x + h * S);
}
determinantAffine() {
let e = this.elements, t = e[0], n = e[4], r = e[8], i = e[1], a = e[5], o = e[9], s = e[2], c = e[6], l = e[10];
return t * (a * l - o * c) - n * (i * l - o * s) + r * (i * c - a * s);
}
transpose() {
let e = this.elements, 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, n) {
let 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] = n), this;
}
invert() {
let e = this.elements, t = e[0], n = e[1], r = e[2], i = e[3], a = e[4], o = e[5], s = e[6], c = e[7], l = e[8], u = e[9], d = e[10], f = e[11], p = e[12], m = e[13], h = e[14], g = e[15], _ = t * o - n * a, v = t * s - r * a, y = t * c - i * a, b = n * s - r * o, x = n * c - i * o, S = r * c - i * s, C = l * m - u * p, w = l * h - d * p, T = l * g - f * p, E = u * h - d * m, D = u * g - f * m, O = d * g - f * h, k = _ * O - v * D + y * E + b * T - x * w + S * C;
if (k === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
let A = 1 / k;
return e[0] = (o * O - s * D + c * E) * A, e[1] = (r * D - n * O - i * E) * A, e[2] = (m * S - h * x + g * b) * A, e[3] = (d * x - u * S - f * b) * A, e[4] = (s * T - a * O - c * w) * A, e[5] = (t * O - r * T + i * w) * A, e[6] = (h * y - p * S - g * v) * A, e[7] = (l * S - d * y + f * v) * A, e[8] = (a * D - o * T + c * C) * A, e[9] = (n * T - t * D - i * C) * A, e[10] = (p * x - m * y + g * _) * A, e[11] = (u * y - l * x - f * _) * A, e[12] = (o * w - a * E - s * C) * A, e[13] = (t * E - n * w + r * C) * A, e[14] = (m * v - p * b - h * _) * A, e[15] = (l * b - u * v + d * _) * A, this;
}
scale(e) {
let t = this.elements, n = e.x, r = e.y, i = e.z;
return t[0] *= n, t[4] *= r, t[8] *= i, t[1] *= n, t[5] *= r, t[9] *= i, t[2] *= n, t[6] *= r, t[10] *= i, t[3] *= n, t[7] *= r, t[11] *= i, this;
}
getMaxScaleOnAxis() {
let e = this.elements, t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2], n = 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, n, r));
}
makeTranslation(e, t, n) {
return e.isVector3 ? this.set(1, 0, 0, e.x, 0, 1, 0, e.y, 0, 0, 1, e.z, 0, 0, 0, 1) : this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this;
}
makeRotationX(e) {
let t = Math.cos(e), n = Math.sin(e);
return this.set(1, 0, 0, 0, 0, t, -n, 0, 0, n, t, 0, 0, 0, 0, 1), this;
}
makeRotationY(e) {
let t = Math.cos(e), n = Math.sin(e);
return this.set(t, 0, n, 0, 0, 1, 0, 0, -n, 0, t, 0, 0, 0, 0, 1), this;
}
makeRotationZ(e) {
let t = Math.cos(e), n = Math.sin(e);
return this.set(t, -n, 0, 0, n, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this;
}
makeRotationAxis(e, t) {
let n = Math.cos(t), r = Math.sin(t), i = 1 - n, a = e.x, o = e.y, s = e.z, c = i * a, l = i * o;
return this.set(c * a + n, c * o - r * s, c * s + r * o, 0, c * o + r * s, l * o + n, l * s - r * a, 0, c * s - r * o, l * s + r * a, i * s * s + n, 0, 0, 0, 0, 1), this;
}
makeScale(e, t, n) {
return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this;
}
makeShear(e, t, n, r, i, a) {
return this.set(1, n, i, 0, e, 1, a, 0, t, r, 1, 0, 0, 0, 0, 1), this;
}
compose(e, t, n) {
let r = this.elements, i = t._x, a = t._y, o = t._z, s = t._w, c = i + i, l = a + a, u = o + o, d = i * c, f = i * l, p = i * u, m = a * l, h = a * u, g = o * u, _ = s * c, v = s * l, y = s * u, b = n.x, x = n.y, S = n.z;
return r[0] = (1 - (m + g)) * b, r[1] = (f + y) * b, r[2] = (p - v) * b, r[3] = 0, r[4] = (f - y) * x, r[5] = (1 - (d + g)) * x, r[6] = (h + _) * x, r[7] = 0, r[8] = (p + v) * S, r[9] = (h - _) * S, r[10] = (1 - (d + m)) * S, r[11] = 0, r[12] = e.x, r[13] = e.y, r[14] = e.z, r[15] = 1, this;
}
decompose(e, t, n) {
let r = this.elements;
e.x = r[12], e.y = r[13], e.z = r[14];
let i = this.determinantAffine();
if (i === 0) return n.set(1, 1, 1), t.identity(), this;
let a = rr.set(r[0], r[1], r[2]).length(), o = rr.set(r[4], r[5], r[6]).length(), s = rr.set(r[8], r[9], r[10]).length();
i < 0 && (a = -a), ir.copy(this);
let c = 1 / a, l = 1 / o, u = 1 / s;
return ir.elements[0] *= c, ir.elements[1] *= c, ir.elements[2] *= c, ir.elements[4] *= l, ir.elements[5] *= l, ir.elements[6] *= l, ir.elements[8] *= u, ir.elements[9] *= u, ir.elements[10] *= u, t.setFromRotationMatrix(ir), n.x = a, n.y = o, n.z = s, this;
}
makePerspective(e, t, n, r, i, a, o = Rt, s = !1) {
let c = this.elements, l = 2 * i / (t - e), u = 2 * i / (n - r), d = (t + e) / (t - e), f = (n + r) / (n - r), p, m;
if (s) p = i / (a - i), m = a * i / (a - i);
else if (o === 2e3) p = -(a + i) / (a - i), m = -2 * a * i / (a - i);
else if (o === 2001) p = -a / (a - i), m = -a * i / (a - i);
else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + o);
return c[0] = l, c[4] = 0, c[8] = d, c[12] = 0, c[1] = 0, c[5] = u, c[9] = f, c[13] = 0, c[2] = 0, c[6] = 0, c[10] = p, c[14] = m, c[3] = 0, c[7] = 0, c[11] = -1, c[15] = 0, this;
}
makeOrthographic(e, t, n, r, i, a, o = Rt, s = !1) {
let c = this.elements, l = 2 / (t - e), u = 2 / (n - r), d = -(t + e) / (t - e), f = -(n + r) / (n - r), p, m;
if (s) p = 1 / (a - i), m = a / (a - i);
else if (o === 2e3) p = -2 / (a - i), m = -(a + i) / (a - i);
else if (o === 2001) p = -1 / (a - i), m = -i / (a - i);
else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + o);
return c[0] = l, c[4] = 0, c[8] = 0, c[12] = d, c[1] = 0, c[5] = u, c[9] = 0, c[13] = f, c[2] = 0, c[6] = 0, c[10] = p, c[14] = m, c[3] = 0, c[7] = 0, c[11] = 0, c[15] = 1, this;
}
equals(e) {
let t = this.elements, n = e.elements;
for (let e = 0; e < 16; e++) if (t[e] !== n[e]) return !1;
return !0;
}
fromArray(e, t = 0) {
for (let n = 0; n < 16; n++) this.elements[n] = e[n + t];
return this;
}
toArray(e = [], t = 0) {
let n = this.elements;
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e;
}
};
i = R, i.prototype.isMatrix4 = !0;
var rr = /*@__PURE__*/ new I(), ir = /*@__PURE__*/ new R(), ar = /*@__PURE__*/ new I(0, 0, 0), or = /*@__PURE__*/ new I(1, 1, 1), sr = /*@__PURE__*/ new I(), cr = /*@__PURE__*/ new I(), lr = /*@__PURE__*/ new I(), ur = /*@__PURE__*/ new R(), dr = /*@__PURE__*/ new Mn(), fr = class e {
constructor(t = 0, n = 0, r = 0, i = e.DEFAULT_ORDER) {
this.isEuler = !0, this._x = t, this._y = n, this._z = r, this._order = i;
}
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, n, r = this._order) {
return this._x = e, this._y = t, this._z = n, 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, n = !0) {
let r = e.elements, i = r[0], a = r[4], o = r[8], s = r[1], c = r[5], l = r[9], u = r[2], d = r[6], f = r[10];
switch (t) {
case "XYZ":
this._y = Math.asin(N(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-l, f), this._z = Math.atan2(-a, i)) : (this._x = Math.atan2(d, c), this._z = 0);
break;
case "YXZ":
this._x = Math.asin(-N(l, -1, 1)), Math.abs(l) < .9999999 ? (this._y = Math.atan2(o, f), this._z = Math.atan2(s, c)) : (this._y = Math.atan2(-u, i), this._z = 0);
break;
case "ZXY":
this._x = Math.asin(N(d, -1, 1)), Math.abs(d) < .9999999 ? (this._y = Math.atan2(-u, f), this._z = Math.atan2(-a, c)) : (this._y = 0, this._z = Math.atan2(s, i));
break;
case "ZYX":
this._y = Math.asin(-N(u, -1, 1)), Math.abs(u) < .9999999 ? (this._x = Math.atan2(d, f), this._z = Math.atan2(s, i)) : (this._x = 0, this._z = Math.atan2(-a, c));
break;
case "YZX":
this._z = Math.asin(N(s, -1, 1)), Math.abs(s) < .9999999 ? (this._x = Math.atan2(-l, c), this._y = Math.atan2(-u, i)) : (this._x = 0, this._y = Math.atan2(o, f));
break;
case "XZY":
this._z = Math.asin(-N(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(d, c), this._y = Math.atan2(o, i)) : (this._x = Math.atan2(-l, f), this._y = 0);
break;
default: j("Euler: .setFromRotationMatrix() encountered an unknown order: " + t);
}
return this._order = t, n === !0 && this._onChangeCallback(), this;
}
setFromQuaternion(e, t, n) {
return ur.makeRotationFromQuaternion(e), this.setFromRotationMatrix(ur, t, n);
}
setFromVector3(e, t = this._order) {
return this.set(e.x, e.y, e.z, t);
}
reorder(e) {
return dr.setFromEuler(this), this.setFromQuaternion(dr, 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;
}
_onChange(e) {
return this._onChangeCallback = e, this;
}
_onChangeCallback() {}
*[Symbol.iterator]() {
yield this._x, yield this._y, yield this._z, yield this._order;
}
};
fr.DEFAULT_ORDER = "XYZ";
var pr = class {
constructor() {
this.mask = 1;
}
set(e) {
this.mask = (1 << e | 0) >>> 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;
}
isEnabled(e) {
return (this.mask & (1 << e | 0)) != 0;
}
}, mr = 0, hr = /*@__PURE__*/ new I(), gr = /*@__PURE__*/ new Mn(), _r = /*@__PURE__*/ new R(), vr = /*@__PURE__*/ new I(), yr = /*@__PURE__*/ new I(), br = /*@__PURE__*/ new I(), xr = /*@__PURE__*/ new Mn(), Sr = /*@__PURE__*/ new I(1, 0, 0), Cr = /*@__PURE__*/ new I(0, 1, 0), wr = /*@__PURE__*/ new I(0, 0, 1), Tr = { type: "added" }, Er = { type: "removed" }, Dr = {
type: "childadded",
child: null
}, Or = {
type: "childremoved",
child: null
}, z = class e extends on {
constructor() {
super(), this.isObject3D = !0, Object.defineProperty(this, "id", { value: mr++ }), this.uuid = dn(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = e.DEFAULT_UP.clone();
let t = new I(), n = new fr(), r = new Mn(), i = new I(1, 1, 1);
function a() {
r.setFromEuler(n, !1);
}
function o() {
n.setFromQuaternion(r, void 0, !1);
}
n._onChange(a), r._onChange(o), Object.defineProperties(this, {
position: {
configurable: !0,
enumerable: !0,
value: t
},
rotation: {
configurable: !0,
enumerable: !0,
value: n
},
quaternion: {
configurable: !0,
enumerable: !0,
value: r
},
scale: {
configurable: !0,
enumerable: !0,
value: i
},
modelViewMatrix: { value: new R() },
normalMatrix: { value: new Fn() }
}), this.matrix = new R(), this.matrixWorld = new R(), this.matrixAutoUpdate = e.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new pr(), this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.customDepthMaterial = void 0, this.customDistanceMaterial = void 0, this.static = !1, this.userData = {}, this.pivot = null;
}
onBeforeShadow() {}
onAfterShadow() {}
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 gr.setFromAxisAngle(e, t), this.quaternion.multiply(gr), this;
}
rotateOnWorldAxis(e, t) {
return gr.setFromAxisAngle(e, t), this.quaternion.premultiply(gr), this;
}
rotateX(e) {
return this.rotateOnAxis(Sr, e);
}
rotateY(e) {
return this.rotateOnAxis(Cr, e);
}
rotateZ(e) {
return this.rotateOnAxis(wr, e);
}
translateOnAxis(e, t) {
return hr.copy(e).applyQuaternion(this.quaternion), this.position.add(hr.multiplyScalar(t)), this;
}
translateX(e) {
return this.translateOnAxis(Sr, e);
}
translateY(e) {
return this.translateOnAxis(Cr, e);
}
translateZ(e) {
return this.translateOnAxis(wr, e);
}
localToWorld(e) {
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld);
}
worldToLocal(e) {
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(_r.copy(this.matrixWorld).invert());
}
lookAt(e, t, n) {
e.isVector3 ? vr.copy(e) : vr.set(e, t, n);
let r = this.parent;
this.updateWorldMatrix(!0, !1), yr.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? _r.lookAt(yr, vr, this.up) : _r.lookAt(vr, yr, this.up), this.quaternion.setFromRotationMatrix(_r), r && (_r.extractRotation(r.matrixWorld), gr.setFromRotationMatrix(_r), this.quaternion.premultiply(gr.invert()));
}
add(e) {
if (arguments.length > 1) {
for (let e = 0; e < arguments.length; e++) this.add(arguments[e]);
return this;
}
return e === this ? (M("Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(Tr), Dr.child = e, this.dispatchEvent(Dr), Dr.child = null) : M("Object3D.add: object not an instance of THREE.Object3D.", e), this);
}
remove(e) {
if (arguments.length > 1) {
for (let e = 0; e < arguments.length; e++) this.remove(arguments[e]);
return this;
}
let t = this.children.indexOf(e);
return t !== -1 && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(Er), Or.child = e, this.dispatchEvent(Or), Or.child = null), this;
}
removeFromParent() {
let e = this.parent;
return e !== null && e.remove(this), this;
}
clear() {
return this.remove(...this.children);
}
attach(e) {
return this.updateWorldMatrix(!0, !1), _r.copy(this.matrixWorld).invert(), e.parent !== null && (e.parent.updateWorldMatrix(!0, !1), _r.multiply(e.parent.matrixWorld)), e.applyMatrix4(_r), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(Tr), Dr.child = e, this.dispatchEvent(Dr), Dr.child = null, 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 n = 0, r = this.children.length; n < r; n++) {
let r = this.children[n].getObjectByProperty(e, t);
if (r !== void 0) return r;
}
}
getObjectsByProperty(e, t, n = []) {
this[e] === t && n.push(this);
let r = this.children;
for (let i = 0, a = r.length; i < a; i++) r[i].getObjectsByProperty(e, t, n);
return n;
}
getWorldPosition(e) {
return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld);
}
getWorldQuaternion(e) {
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(yr, e, br), e;
}
getWorldScale(e) {
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(yr, xr, e), e;
}
getWorldDirection(e) {
this.updateWorldMatrix(!0, !1);
let t = this.matrixWorld.elements;
return e.set(t[8], t[9], t[10]).normalize();
}
raycast() {}
traverse(e) {
e(this);
let t = this.children;
for (let n = 0, r = t.length; n < r; n++) t[n].traverse(e);
}
traverseVisible(e) {
if (this.visible === !1) return;
e(this);
let t = this.children;
for (let n = 0, r = t.length; n < r; n++) t[n].traverseVisible(e);
}
traverseAncestors(e) {
let t = this.parent;
t !== null && (e(t), t.traverseAncestors(e));
}
updateMatrix() {
this.matrix.compose(this.position, this.quaternion, this.scale);
let e = this.pivot;
if (e !== null) {
let t = e.x, n = e.y, r = e.z, i = this.matrix.elements;
i[12] += t - i[0] * t - i[4] * n - i[8] * r, i[13] += n - i[1] * t - i[5] * n - i[9] * r, i[14] += r - i[2] * t - i[6] * n - i[10] * r;
}
this.matrixWorldNeedsUpdate = !0;
}
updateMatrixWorld(e) {
this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, e = !0);
let t = this.children;
for (let n = 0, r = t.length; n < r; n++) t[n].updateMatrixWorld(e);
}
updateWorldMatrix(e, t, n = !1) {
let r = this.parent;
if (e === !0 && r !== null && r.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || n) && (this.matrixWorldAutoUpdate === !0 && (this.parent === null ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, n = !0), t === !0) {
let e = this.children;
for (let t = 0, r = e.length; t < r; t++) e[t].updateWorldMatrix(!1, !0, n);
}
}
toJSON(e) {
let t = e === void 0 || typeof e == "string", n = {};
t && (e = {
geometries: {},
materials: {},
textures: {},
images: {},
shapes: {},
skeletons: {},
animations: {},
nodes: {}
}, n.metadata = {
version: 4.7,
type: "Object",
generator: "Object3D.toJSON"
});
let 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), this.static !== !1 && (r.static = this.static), Object.keys(this.userData).length > 0 && (r.userData = this.userData), r.layers = this.layers.mask, r.matrix = this.matrix.toArray(), r.up = this.up.toArray(), this.pivot !== null && (r.pivot = this.pivot.toArray()), this.matrixAutoUpdate === !1 && (r.matrixAutoUpdate = !1), this.morphTargetDictionary !== void 0 && (r.morphTargetDictionary = Object.assign({}, this.morphTargetDictionary)), this.morphTargetInfluences !== void 0 && (r.morphTargetInfluences = this.morphTargetInfluences.slice()), this.isInstancedMesh && (r.type = "InstancedMesh", r.count = this.count, r.instanceMatrix = this.instanceMatrix.toJSON(), this.instanceColor !== null && (r.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (r.type = "BatchedMesh", r.perObjectFrustumCulled = this.perObjectFrustumCulled, r.sortObjects = this.sortObjects, r.drawRanges = this._drawRanges, r.reservedRanges = this._reservedRanges, r.geometryInfo = this._geometryInfo.map((e) => ({
...e,
boundingBox: e.boundingBox ? e.boundingBox.toJSON() : void 0,
boundingSphere: e.boundingSphere ? e.boundingSphere.toJSON() : void 0
})), r.instanceInfo = this._instanceInfo.map((e) => ({ ...e })), r.availableInstanceIds = this._availableInstanceIds.slice(), r.availableGeometryIds = this._availableGeometryIds.slice(), r.nextIndexStart = this._nextIndexStart, r.nextVertexStart = this._nextVertexStart, r.geometryCount = this._geometryCount, r.maxInstanceCount = this._maxInstanceCount, r.maxVertexCount = this._maxVertexCount, r.maxIndexCount = this._maxIndexCount, r.geometryInitialized = this._geometryInitialized, r.matricesTexture = this._matricesTexture.toJSON(e), r.indirectTexture = this._indirectTexture.toJSON(e), this._colorsTexture !== null && (r.colorsTexture = this._colorsTexture.toJSON(e)), this.boundingSphere !== null && (r.boundingSphere = this.boundingSphere.toJSON()), this.boundingBox !== null && (r.boundingBox = this.boundingBox.toJSON()));
function i(t, n) {
return t[n.uuid] === void 0 && (t[n.uuid] = n.toJSON(e)), n.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 && this.environment.isRenderTargetTexture !== !0 && (r.environment = this.environment.toJSON(e).uuid);
else if (this.isMesh || this.isLine || this.isPoints) {
r.geometry = i(e.geometries, this.geometry);
let t = this.geometry.parameters;
if (t !== void 0 && t.shapes !== void 0) {
let n = t.shapes;
if (Array.isArray(n)) for (let t = 0, r = n.length; t < r; t++) {
let r = n[t];
i(e.shapes, r);
}
else i(e.shapes, n);
}
}
if (this.isSkinnedMesh && (r.bindMode = this.bindMode, r.bindMatrix = this.bindMatrix.toArray(), this.skeleton !== void 0 && (i(e.skeletons, this.skeleton), r.skeleton = this.skeleton.uuid)), this.material !== void 0) if (Array.isArray(this.material)) {
let t = [];
for (let n = 0, r = this.material.length; n < r; n++) t.push(i(e.materials, this.material[n]));
r.material = t;
} else r.material = i(e.materials, this.material);
if (this.children.length > 0) {
r.children = [];
for (let t = 0; t < this.children.length; t++) r.children.push(this.children[t].toJSON(e).object);
}
if (this.animations.length > 0) {
r.animations = [];
for (let t = 0; t < this.animations.length; t++) {
let n = this.animations[t];
r.animations.push(i(e.animations, n));
}
}
if (t) {
let t = a(e.geometries), r = a(e.materials), i = a(e.textures), o = a(e.images), s = a(e.shapes), c = a(e.skeletons), l = a(e.animations), u = a(e.nodes);
t.length > 0 && (n.geometries = t), r.length > 0 && (n.materials = r), i.length > 0 && (n.textures = i), o.length > 0 && (n.images = o), s.length > 0 && (n.shapes = s), c.length > 0 && (n.skeletons = c), l.length > 0 && (n.animations = l), u.length > 0 && (n.nodes = u);
}
return n.object = r, n;
function a(e) {
let t = [];
for (let n in e) {
let r = e[n];
delete r.metadata, t.push(r);
}
return t;
}
}
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.pivot = e.pivot === null ? null : e.pivot.clone(), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldAutoUpdate = e.matrixWorldAutoUpdate, 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.static = e.static, this.animations = e.animations.slice(), this.userData = JSON.parse(JSON.stringify(e.userData)), t === !0) for (let t = 0; t < e.children.length; t++) {
let n = e.children[t];
this.add(n.clone());
}
return this;
}
};
z.DEFAULT_UP = /*@__PURE__*/ new I(0, 1, 0), z.DEFAULT_MATRIX_AUTO_UPDATE = !0, z.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
var kr = class extends z {
constructor() {
super(), this.isGroup = !0, this.type = "Group";
}
}, Ar = { type: "move" }, jr = class {
constructor() {
this._targetRay = null, this._grip = null, this._hand = null;
}
getHandSpace() {
return this._hand === null && (this._hand = new kr(), 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 kr(), this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new I(), this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new I()), this._targetRay;
}
getGripSpace() {
return this._grip === null && (this._grip = new kr(), this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new I(), this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new I(), this._grip.eventsEnabled = !1), 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;
}
connect(e) {
if (e && e.hand) {
let t = this._hand;
if (t) for (let n of e.hand.values()) this._getHandJoint(t, n);
}
return this.dispatchEvent({
type: "connected",
data: 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, n) {
let r = null, i = null, a = null, o = this._targetRay, s = this._grip, c = this._hand;
if (e && t.session.visibilityState !== "visible-blurred") {
if (c && e.hand) {
a = !0;
for (let r of e.hand.values()) {
let e = t.getJointPose(r, n), i = this._getHandJoint(c, r);
e !== null && (i.matrix.fromArray(e.transform.matrix), i.matrix.decompose(i.position, i.rotation, i.scale), i.matrixWorldNeedsUpdate = !0, i.jointRadius = e.radius), i.visible = e !== null;
}
let r = c.joints["index-finger-tip"], i = c.joints["thumb-tip"], o = r.position.distanceTo(i.position);
c.inputState.pinching && o > .025 ? (c.inputState.pinching = !1, this.dispatchEvent({
type: "pinchend",
handedness: e.handedness,
target: this
})) : !c.inputState.pinching && o <= .015 && (c.inputState.pinching = !0, this.dispatchEvent({
type: "pinchstart",
handedness: e.handedness,
target: this
}));
} else s !== null && e.gripSpace && (i = t.getPose(e.gripSpace, n), i !== null && (s.matrix.fromArray(i.transform.matrix), s.matrix.decompose(s.position, s.rotation, s.scale), s.matrixWorldNeedsUpdate = !0, i.linearVelocity ? (s.hasLinearVelocity = !0, s.linearVelocity.copy(i.linearVelocity)) : s.hasLinearVelocity = !1, i.angularVelocity ? (s.hasAngularVelocity = !0, s.angularVelocity.copy(i.angularVelocity)) : s.hasAngularVelocity = !1, s.eventsEnabled && s.dispatchEvent({
type: "gripUpdated",
data: e,
target: this
})));
o !== null && (r = t.getPose(e.targetRaySpace, n), r === null && i !== null && (r = i), r !== null && (o.matrix.fromArray(r.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(r.linearVelocity)) : o.hasLinearVelocity = !1, r.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(r.angularVelocity)) : o.hasAngularVelocity = !1, this.dispatchEvent(Ar)));
}
return o !== null && (o.visible = r !== null), s !== null && (s.visible = i !== null), c !== null && (c.visible = a !== null), this;
}
_getHandJoint(e, t) {
if (e.joints[t.jointName] === void 0) {
let n = new kr();
n.matrixAutoUpdate = !1, n.visible = !1, e.joints[t.jointName] = n, e.add(n);
}
return e.joints[t.jointName];
}
}, Mr = {
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
}, Nr = {
h: 0,
s: 0,
l: 0
}, Pr = {
h: 0,
s: 0,
l: 0
};
function Fr(e, t, n) {
return n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * 6 * (2 / 3 - n) : e;
}
var B = class {
constructor(e, t, n) {
return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, t, n);
}
set(e, t, n) {
if (t === void 0 && n === void 0) {
let t = e;
t && t.isColor ? this.copy(t) : typeof t == "number" ? this.setHex(t) : typeof t == "string" && this.setStyle(t);
} else this.setRGB(e, t, n);
return this;
}
setScalar(e) {
return this.r = e, this.g = e, this.b = e, this;
}
setHex(e, t = _t) {
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (e & 255) / 255, Bn.colorSpaceToWorking(this, t), this;
}
setRGB(e, t, n, r = Bn.workingColorSpace) {
return this.r = e, this.g = t, this.b = n, Bn.colorSpaceToWorking(this, r), this;
}
setHSL(e, t, n, r = Bn.workingColorSpace) {
if (e = fn(e, 1), t = N(t, 0, 1), n = N(n, 0, 1), t === 0) this.r = this.g = this.b = n;
else {
let r = n <= .5 ? n * (1 + t) : n + t - n * t, i = 2 * n - r;
this.r = Fr(i, r, e + 1 / 3), this.g = Fr(i, r, e), this.b = Fr(i, r, e - 1 / 3);
}
return Bn.colorSpaceToWorking(this, r), this;
}
setStyle(e, t = _t) {
function n(t) {
t !== void 0 && parseFloat(t) < 1 && j("Color: Alpha component of " + e + " will be ignored.");
}
let r;
if (r = /^(\w+)\(([^\)]*)\)/.exec(e)) {
let i, a = r[1], o = r[2];
switch (a) {
case "rgb":
case "rgba":
if (i = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setRGB(Math.min(255, parseInt(i[1], 10)) / 255, Math.min(255, parseInt(i[2], 10)) / 255, Math.min(255, parseInt(i[3], 10)) / 255, t);
if (i = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setRGB(Math.min(100, parseInt(i[1], 10)) / 100, Math.min(100, parseInt(i[2], 10)) / 100, Math.min(100, parseInt(i[3], 10)) / 100, t);
break;
case "hsl":
case "hsla":
if (i = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)) return n(i[4]), this.setHSL(parseFloat(i[1]) / 360, parseFloat(i[2]) / 100, parseFloat(i[3]) / 100, t);
break;
default: j("Color: Unknown color model " + e);
}
} else if (r = /^\#([A-Fa-f\d]+)$/.exec(e)) {
let n = r[1], i = n.length;
if (i === 3) return this.setRGB(parseInt(n.charAt(0), 16) / 15, parseInt(n.charAt(1), 16) / 15, parseInt(n.charAt(2), 16) / 15, t);
if (i === 6) return this.setHex(parseInt(n, 16), t);
j("Color: Invalid hex color " + e);
} else if (e && e.length > 0) return this.setColorName(e, t);
return this;
}
setColorName(e, t = _t) {
let n = Mr[e.toLowerCase()];
return n === void 0 ? j("Color: Unknown color " + e) : this.setHex(n, t), 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;
}
copySRGBToLinear(e) {
return this.r = Vn(e.r), this.g = Vn(e.g), this.b = Vn(e.b), this;
}
copyLinearToSRGB(e) {
return this.r = Hn(e.r), this.g = Hn(e.g), this.b = Hn(e.b), this;
}
convertSRGBToLinear() {
return this.copySRGBToLinear(this), this;
}
convertLinearToSRGB() {
return this.copyLinearToSRGB(this), this;
}
getHex(e = _t) {
return Bn.workingToColorSpace(V.copy(this), e), Math.round(N(V.r * 255, 0, 255)) * 65536 + Math.round(N(V.g * 255, 0, 255)) * 256 + Math.round(N(V.b * 255, 0, 255));
}
getHexString(e = _t) {
return ("000000" + this.getHex(e).toString(16)).slice(-6);
}
getHSL(e, t = Bn.workingColorSpace) {
Bn.workingToColorSpace(V.copy(this), t);
let n = V.r, r = V.g, i = V.b, a = Math.max(n, r, i), o = Math.min(n, r, i), s, c, l = (o + a) / 2;
if (o === a) s = 0, c = 0;
else {
let e = a - o;
switch (c = l <= .5 ? e / (a + o) : e / (2 - a - o), a) {
case n:
s = (r - i) / e + (r < i ? 6 : 0);
break;
case r:
s = (i - n) / e + 2;
break;
case i:
s = (n - r) / e + 4;
break;
}
s /= 6;
}
return e.h = s, e.s = c, e.l = l, e;
}
getRGB(e, t = Bn.workingColorSpace) {
return Bn.workingToColorSpace(V.copy(this), t), e.r = V.r, e.g = V.g, e.b = V.b, e;
}
getStyle(e = _t) {
Bn.workingToColorSpace(V.copy(this), e);
let t = V.r, n = V.g, r = V.b;
return e === "srgb" ? `rgb(${Math.round(t * 255)},${Math.round(n * 255)},${Math.round(r * 255)})` : `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`;
}
offsetHSL(e, t, n) {
return this.getHSL(Nr), this.setHSL(Nr.h + e, Nr.s + t, Nr.l + n);
}
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, n) {
return this.r = e.r + (t.r - e.r) * n, this.g = e.g + (t.g - e.g) * n, this.b = e.b + (t.b - e.b) * n, this;
}
lerpHSL(e, t) {
this.getHSL(Nr), e.getHSL(Pr);
let n = hn(Nr.h, Pr.h, t), r = hn(Nr.s, Pr.s, t), i = hn(Nr.l, Pr.l, t);
return this.setHSL(n, r, i), this;
}
setFromVector3(e) {
return this.r = e.x, this.g = e.y, this.b = e.z, this;
}
applyMatrix3(e) {
let t = this.r, n = this.g, r = this.b, i = e.elements;
return this.r = i[0] * t + i[3] * n + i[6] * r, this.g = i[1] * t + i[4] * n + i[7] * r, this.b = i[2] * t + i[5] * n + i[8] * r, 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), this;
}
toJSON() {
return this.getHex();
}
*[Symbol.iterator]() {
yield this.r, yield this.g, yield this.b;
}
}, V = /*@__PURE__*/ new B();
B.NAMES = Mr;
var Ir = class e {
constructor(e, t = 25e-5) {
this.isFogExp2 = !0, this.name = "", this.color = new B(e), this.density = t;
}
clone() {
return new e(this.color, this.density);
}
toJSON() {
return {
type: "FogExp2",
name: this.name,
color: this.color.getHex(),
density: this.density
};
}
}, Lr = class e {
constructor(e, t = 1, n = 1e3) {
this.isFog = !0, this.name = "", this.color = new B(e), this.near = t, this.far = n;
}
clone() {
return new e(this.color, this.near, this.far);
}
toJSON() {
return {
type: "Fog",
name: this.name,
color: this.color.getHex(),
near: this.near,
far: this.far
};
}
}, Rr = class extends z {
constructor() {
super(), this.isScene = !0, this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.backgroundBlurriness = 0, this.backgroundIntensity = 1, this.backgroundRotation = new fr(), this.environmentIntensity = 1, this.environmentRotation = new fr(), this.overrideMaterial = null, 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()), this.backgroundBlurriness = e.backgroundBlurriness, this.backgroundIntensity = e.backgroundIntensity, this.backgroundRotation.copy(e.backgroundRotation), this.environmentIntensity = e.environmentIntensity, this.environmentRotation.copy(e.environmentRotation), e.overrideMaterial !== null && (this.overrideMaterial = e.overrideMaterial.clone()), this.matrixAutoUpdate = e.matrixAutoUpdate, this;
}
toJSON(e) {
let t = super.toJSON(e);
return this.fog !== null && (t.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (t.object.backgroundBlurriness = this.backgroundBlurriness), this.backgroundIntensity !== 1 && (t.object.backgroundIntensity = this.backgroundIntensity), t.object.backgroundRotation = this.backgroundRotation.toArray(), this.environmentIntensity !== 1 && (t.object.environmentIntensity = this.environmentIntensity), t.object.environmentRotation = this.environmentRotation.toArray(), t;
}
}, zr = /*@__PURE__*/ new I(), Br = /*@__PURE__*/ new I(), Vr = /*@__PURE__*/ new I(), Hr = /*@__PURE__*/ new I(), Ur = /*@__PURE__*/ new I(), Wr = /*@__PURE__*/ new I(), Gr = /*@__PURE__*/ new I(), Kr = /*@__PURE__*/ new I(), qr = /*@__PURE__*/ new I(), Jr = /*@__PURE__*/ new I(), Yr = /*@__PURE__*/ new Xn(), Xr = /*@__PURE__*/ new Xn(), Zr = /*@__PURE__*/ new Xn(), Qr = class e {
constructor(e = new I(), t = new I(), n = new I()) {
this.a = e, this.b = t, this.c = n;
}
static getNormal(e, t, n, r) {
r.subVectors(n, t), zr.subVectors(e, t), r.cross(zr);
let i = r.lengthSq();
return i > 0 ? r.multiplyScalar(1 / Math.sqrt(i)) : r.set(0, 0, 0);
}
static getBarycoord(e, t, n, r, i) {
zr.subVectors(r, t), Br.subVectors(n, t), Vr.subVectors(e, t);
let a = zr.dot(zr), o = zr.dot(Br), s = zr.dot(Vr), c = Br.dot(Br), l = Br.dot(Vr), u = a * c - o * o;
if (u === 0) return i.set(0, 0, 0), null;
let d = 1 / u, f = (c * s - o * l) * d, p = (a * l - o * s) * d;
return i.set(1 - f - p, p, f);
}
static containsPoint(e, t, n, r) {
return this.getBarycoord(e, t, n, r, Hr) !== null && Hr.x >= 0 && Hr.y >= 0 && Hr.x + Hr.y <= 1;
}
static getInterpolation(e, t, n, r, i, a, o, s) {
return this.getBarycoord(e, t, n, r, Hr) === null ? (s.x = 0, s.y = 0, "z" in s && (s.z = 0), "w" in s && (s.w = 0), null) : (s.setScalar(0), s.addScaledVector(i, Hr.x), s.addScaledVector(a, Hr.y), s.addScaledVector(o, Hr.z), s);
}
static getInterpolatedAttribute(e, t, n, r, i, a) {
return Yr.setScalar(0), Xr.setScalar(0), Zr.setScalar(0), Yr.fromBufferAttribute(e, t), Xr.fromBufferAttribute(e, n), Zr.fromBufferAttribute(e, r), a.setScalar(0), a.addScaledVector(Yr, i.x), a.addScaledVector(Xr, i.y), a.addScaledVector(Zr, i.z), a;
}
static isFrontFacing(e, t, n, r) {
return zr.subVectors(n, t), Br.subVectors(e, t), zr.cross(Br).dot(r) < 0;
}
set(e, t, n) {
return this.a.copy(e), this.b.copy(t), this.c.copy(n), this;
}
setFromPointsAndIndices(e, t, n, r) {
return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[r]), this;
}
setFromAttributeAndIndices(e, t, n, r) {
return this.a.fromBufferAttribute(e, t), this.b.fromBufferAttribute(e, n), this.c.fromBufferAttribute(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 zr.subVectors(this.c, this.b), Br.subVectors(this.a, this.b), zr.cross(Br).length() * .5;
}
getMidpoint(e) {
return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
}
getNormal(t) {
return e.getNormal(this.a, this.b, this.c, t);
}
getPlane(e) {
return e.setFromCoplanarPoints(this.a, this.b, this.c);
}
getBarycoord(t, n) {
return e.getBarycoord(t, this.a, this.b, this.c, n);
}
getInterpolation(t, n, r, i, a) {
return e.getInterpolation(t, this.a, this.b, this.c, n, r, i, a);
}
containsPoint(t) {
return e.containsPoint(t, this.a, this.b, this.c);
}
isFrontFacing(t) {
return e.isFrontFacing(this.a, this.b, this.c, t);
}
intersectsBox(e) {
return e.intersectsTriangle(this);
}
closestPointToPoint(e, t) {
let n = this.a, r = this.b, i = this.c, a, o;
Ur.subVectors(r, n), Wr.subVectors(i, n), Kr.subVectors(e, n);
let s = Ur.dot(Kr), c = Wr.dot(Kr);
if (s <= 0 && c <= 0) return t.copy(n);
qr.subVectors(e, r);
let l = Ur.dot(qr), u = Wr.dot(qr);
if (l >= 0 && u <= l) return t.copy(r);
let d = s * u - l * c;
if (d <= 0 && s >= 0 && l <= 0) return a = s / (s - l), t.copy(n).addScaledVector(Ur, a);
Jr.subVectors(e, i);
let f = Ur.dot(Jr), p = Wr.dot(Jr);
if (p >= 0 && f <= p) return t.copy(i);
let m = f * c - s * p;
if (m <= 0 && c >= 0 && p <= 0) return o = c / (c - p), t.copy(n).addScaledVector(Wr, o);
let h = l * p - f * u;
if (h <= 0 && u - l >= 0 && f - p >= 0) return Gr.subVectors(i, r), o = (u - l) / (u - l + (f - p)), t.copy(r).addScaledVector(Gr, o);
let g = 1 / (h + m + d);
return a = m * g, o = d * g, t.copy(n).addScaledVector(Ur, a).addScaledVector(Wr, o);
}
equals(e) {
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c);
}
}, H = class {
constructor(e = new I(Infinity, Infinity, Infinity), t = new I(-Infinity, -Infinity, -Infinity)) {
this.isBox3 = !0, this.min = e, this.max = t;
}
set(e, t) {
return this.min.copy(e), this.max.copy(t), this;
}
setFromArray(e) {
this.makeEmpty();
for (let t = 0, n = e.length; t < n; t += 3) this.expandByPoint(ei.fromArray(e, t));
return this;
}
setFromBufferAttribute(e) {
this.makeEmpty();
for (let t = 0, n = e.count; t < n; t++) this.expandByPoint(ei.fromBufferAttribute(e, t));
return this;
}
setFromPoints(e) {
this.makeEmpty();
for (let t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]);
return this;
}
setFromCenterAndSize(e, t) {
let n = ei.copy(t).multiplyScalar(.5);
return this.min.copy(e).sub(n), this.max.copy(e).add(n), this;
}
setFromObject(e, t = !1) {
return this.makeEmpty(), this.expandByObject(e, t);
}
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 = Infinity, this.max.x = this.max.y = this.max.z = -Infinity, 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(.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, t = !1) {
e.updateWorldMatrix(!1, !1);
let n = e.geometry;
if (n !== void 0) {
let r = n.getAttribute("position");
if (t === !0 && r !== void 0 && e.isInstancedMesh !== !0) for (let t = 0, n = r.count; t < n; t++) e.isMesh === !0 ? e.getVertexPosition(t, ei) : ei.fromBufferAttribute(r, t), ei.applyMatrix4(e.matrixWorld), this.expandByPoint(ei);
else e.boundingBox === void 0 ? (n.boundingBox === null && n.computeBoundingBox(), ti.copy(n.boundingBox)) : (e.boundingBox === null && e.computeBoundingBox(), ti.copy(e.boundingBox)), ti.applyMatrix4(e.matrixWorld), this.union(ti);
}
let r = e.children;
for (let e = 0, n = r.length; e < n; e++) this.expandByObject(r[e], t);
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, ei), ei.distanceToSquared(e.center) <= e.radius * e.radius;
}
intersectsPlane(e) {
let t, n;
return e.normal.x > 0 ? (t = e.normal.x * this.min.x, n = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, n = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n >= -e.constant;
}
intersectsTriangle(e) {
if (this.isEmpty()) return !1;
this.getCenter(ci), li.subVectors(this.max, ci), ni.subVectors(e.a, ci), ri.subVectors(e.b, ci), ii.subVectors(e.c, ci), ai.subVectors(ri, ni), oi.subVectors(ii, ri), si.subVectors(ni, ii);
let t = [
0,
-ai.z,
ai.y,
0,
-oi.z,
oi.y,
0,
-si.z,
si.y,
ai.z,
0,
-ai.x,
oi.z,
0,
-oi.x,
si.z,
0,
-si.x,
-ai.y,
ai.x,
0,
-oi.y,
oi.x,
0,
-si.y,
si.x,
0
];
return !fi(t, ni, ri, ii, li) || (t = [
1,
0,
0,
0,
1,
0,
0,
0,
1
], !fi(t, ni, ri, ii, li)) ? !1 : (ui.crossVectors(ai, oi), t = [
ui.x,
ui.y,
ui.z
], fi(t, ni, ri, ii, li));
}
clampPoint(e, t) {
return t.copy(e).clamp(this.min, this.max);
}
distanceToPoint(e) {
return this.clampPoint(e, ei).distanceTo(e);
}
getBoundingSphere(e) {
return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = this.getSize(ei).length() * .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 : ($r[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), $r[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), $r[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), $r[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), $r[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), $r[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), $r[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), $r[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints($r), 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);
}
toJSON() {
return {
min: this.min.toArray(),
max: this.max.toArray()
};
}
fromJSON(e) {
return this.min.fromArray(e.min), this.max.fromArray(e.max), this;
}
}, $r = [
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I(),
/*@__PURE__*/ new I()
], ei = /*@__PURE__*/ new I(), ti = /*@__PURE__*/ new H(), ni = /*@__PURE__*/ new I(), ri = /*@__PURE__*/ new I(), ii = /*@__PURE__*/ new I(), ai = /*@__PURE__*/ new I(), oi = /*@__PURE__*/ new I(), si = /*@__PURE__*/ new I(), ci = /*@__PURE__*/ new I(), li = /*@__PURE__*/ new I(), ui = /*@__PURE__*/ new I(), di = /*@__PURE__*/ new I();
function fi(e, t, n, r, i) {
for (let a = 0, o = e.length - 3; a <= o; a += 3) {
di.fromArray(e, a);
let o = i.x * Math.abs(di.x) + i.y * Math.abs(di.y) + i.z * Math.abs(di.z), s = t.dot(di), c = n.dot(di), l = r.dot(di);
if (Math.max(-Math.max(s, c, l), Math.min(s, c, l)) > o) return !1;
}
return !0;
}
var pi = /*@__PURE__*/ mi();
function mi() {
let e = /* @__PURE__ */ new ArrayBuffer(4), t = new Float32Array(e), n = new Uint32Array(e), r = /* @__PURE__ */ new Uint32Array(512), i = /* @__PURE__ */ new Uint32Array(512);
for (let e = 0; e < 256; ++e) {
let t = e - 127;
t < -27 ? (r[e] = 0, r[e | 256] = 32768, i[e] = 24, i[e | 256] = 24) : t < -14 ? (r[e] = 1024 >> -t - 14, r[e | 256] = 1024 >> -t - 14 | 32768, i[e] = -t - 1, i[e | 256] = -t - 1) : t <= 15 ? (r[e] = t + 15 << 10, r[e | 256] = t + 15 << 10 | 32768, i[e] = 13, i[e | 256] = 13) : t < 128 ? (r[e] = 31744, r[e | 256] = 64512, i[e] = 24, i[e | 256] = 24) : (r[e] = 31744, r[e | 256] = 64512, i[e] = 13, i[e | 256] = 13);
}
let a = /* @__PURE__ */ new Uint32Array(2048), o = /* @__PURE__ */ new Uint32Array(64), s = /* @__PURE__ */ new Uint32Array(64);
for (let e = 1; e < 1024; ++e) {
let t = e << 13, n = 0;
for (; !(t & 8388608);) t <<= 1, n -= 8388608;
t &= -8388609, n += 947912704, a[e] = t | n;
}
for (let e = 1024; e < 2048; ++e) a[e] = 939524096 + (e - 1024 << 13);
for (let e = 1; e < 31; ++e) o[e] = e << 23;
o[31] = 1199570944, o[32] = 2147483648;
for (let e = 33; e < 63; ++e) o[e] = 2147483648 + (e - 32 << 23);
o[63] = 3347054592;
for (let e = 1; e < 64; ++e) e !== 32 && (s[e] = 1024);
return {
floatView: t,
uint32View: n,
baseTable: r,
shiftTable: i,
mantissaTable: a,
exponentTable: o,
offsetTable: s
};
}
function hi(e) {
Math.abs(e) > 65504 && j("DataUtils.toHalfFloat(): Value out of range."), e = N(e, -65504, 65504), pi.floatView[0] = e;
let t = pi.uint32View[0], n = t >> 23 & 511;
return pi.baseTable[n] + ((t & 8388607) >> pi.shiftTable[n]);
}
function gi(e) {
let t = e >> 10;
return pi.uint32View[0] = pi.mantissaTable[pi.offsetTable[t] + (e & 1023)] + pi.exponentTable[t], pi.floatView[0];
}
var _i = class {
static toHalfFloat(e) {
return hi(e);
}
static fromHalfFloat(e) {
return gi(e);
}
}, U = /*@__PURE__*/ new I(), vi = /*@__PURE__*/ new F(), yi = 0, W = class extends on {
constructor(e, t, n = !1) {
if (super(), Array.isArray(e)) throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");
this.isBufferAttribute = !0, Object.defineProperty(this, "id", { value: yi++ }), this.name = "", this.array = e, this.itemSize = t, this.count = e === void 0 ? 0 : e.length / t, this.normalized = n, this.usage = Ot, this.updateRanges = [], this.gpuType = te, this.version = 0;
}
onUploadCallback() {}
set needsUpdate(e) {
e === !0 && this.version++;
}
setUsage(e) {
return this.usage = e, this;
}
addUpdateRange(e, t) {
this.updateRanges.push({
start: e,
count: t
});
}
clearUpdateRanges() {
this.updateRanges.length = 0;
}
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.gpuType = e.gpuType, this;
}
copyAt(e, t, n) {
e *= this.itemSize, n *= t.itemSize;
for (let r = 0, i = this.itemSize; r < i; r++) this.array[e + r] = t.array[n + r];
return this;
}
copyArray(e) {
return this.array.set(e), this;
}
applyMatrix3(e) {
if (this.itemSize === 2) for (let t = 0, n = this.count; t < n; t++) vi.fromBufferAttribute(this, t), vi.applyMatrix3(e), this.setXY(t, vi.x, vi.y);
else if (this.itemSize === 3) for (let t = 0, n = this.count; t < n; t++) U.fromBufferAttribute(this, t), U.applyMatrix3(e), this.setXYZ(t, U.x, U.y, U.z);
return this;
}
applyMatrix4(e) {
for (let t = 0, n = this.count; t < n; t++) U.fromBufferAttribute(this, t), U.applyMatrix4(e), this.setXYZ(t, U.x, U.y, U.z);
return this;
}
applyNormalMatrix(e) {
for (let t = 0, n = this.count; t < n; t++) U.fromBufferAttribute(this, t), U.applyNormalMatrix(e), this.setXYZ(t, U.x, U.y, U.z);
return this;
}
transformDirection(e) {
for (let t = 0, n = this.count; t < n; t++) U.fromBufferAttribute(this, t), U.transformDirection(e), this.setXYZ(t, U.x, U.y, U.z);
return this;
}
set(e, t = 0) {
return this.array.set(e, t), this;
}
getComponent(e, t) {
let n = this.array[e * this.itemSize + t];
return this.normalized && (n = An(n, this.array)), n;
}
setComponent(e, t, n) {
return this.normalized && (n = P(n, this.array)), this.array[e * this.itemSize + t] = n, this;
}
getX(e) {
let t = this.array[e * this.itemSize];
return this.normalized && (t = An(t, this.array)), t;
}
setX(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize] = t, this;
}
getY(e) {
let t = this.array[e * this.itemSize + 1];
return this.normalized && (t = An(t, this.array)), t;
}
setY(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 1] = t, this;
}
getZ(e) {
let t = this.array[e * this.itemSize + 2];
return this.normalized && (t = An(t, this.array)), t;
}
setZ(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 2] = t, this;
}
getW(e) {
let t = this.array[e * this.itemSize + 3];
return this.normalized && (t = An(t, this.array)), t;
}
setW(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 3] = t, this;
}
setXY(e, t, n) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this;
}
setXYZ(e, t, n, r) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this;
}
setXYZW(e, t, n, r, i) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array), i = P(i, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = r, this.array[e + 3] = i, this;
}
onUpload(e) {
return this.onUploadCallback = e, this;
}
clone() {
return new this.constructor(this.array, this.itemSize).copy(this);
}
toJSON() {
let e = {
itemSize: this.itemSize,
type: this.array.constructor.name,
array: Array.from(this.array),
normalized: this.normalized
};
return this.name !== "" && (e.name = this.name), this.usage !== 35044 && (e.usage = this.usage), e;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
}, bi = class extends W {
constructor(e, t, n) {
super(new Int8Array(e), t, n);
}
}, xi = class extends W {
constructor(e, t, n) {
super(new Uint8Array(e), t, n);
}
}, Si = class extends W {
constructor(e, t, n) {
super(new Uint8ClampedArray(e), t, n);
}
}, Ci = class extends W {
constructor(e, t, n) {
super(new Int16Array(e), t, n);
}
}, wi = class extends W {
constructor(e, t, n) {
super(new Uint16Array(e), t, n);
}
}, Ti = class extends W {
constructor(e, t, n) {
super(new Int32Array(e), t, n);
}
}, Ei = class extends W {
constructor(e, t, n) {
super(new Uint32Array(e), t, n);
}
}, Di = class extends W {
constructor(e, t, n) {
super(new Uint16Array(e), t, n), this.isFloat16BufferAttribute = !0;
}
getX(e) {
let t = gi(this.array[e * this.itemSize]);
return this.normalized && (t = An(t, this.array)), t;
}
setX(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize] = hi(t), this;
}
getY(e) {
let t = gi(this.array[e * this.itemSize + 1]);
return this.normalized && (t = An(t, this.array)), t;
}
setY(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 1] = hi(t), this;
}
getZ(e) {
let t = gi(this.array[e * this.itemSize + 2]);
return this.normalized && (t = An(t, this.array)), t;
}
setZ(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 2] = hi(t), this;
}
getW(e) {
let t = gi(this.array[e * this.itemSize + 3]);
return this.normalized && (t = An(t, this.array)), t;
}
setW(e, t) {
return this.normalized && (t = P(t, this.array)), this.array[e * this.itemSize + 3] = hi(t), this;
}
setXY(e, t, n) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array)), this.array[e + 0] = hi(t), this.array[e + 1] = hi(n), this;
}
setXYZ(e, t, n, r) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array)), this.array[e + 0] = hi(t), this.array[e + 1] = hi(n), this.array[e + 2] = hi(r), this;
}
setXYZW(e, t, n, r, i) {
return e *= this.itemSize, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array), i = P(i, this.array)), this.array[e + 0] = hi(t), this.array[e + 1] = hi(n), this.array[e + 2] = hi(r), this.array[e + 3] = hi(i), this;
}
}, G = class extends W {
constructor(e, t, n) {
super(new Float32Array(e), t, n);
}
}, Oi = /*@__PURE__*/ new H(), ki = /*@__PURE__*/ new I(), Ai = /*@__PURE__*/ new I(), K = class {
constructor(e = new I(), t = -1) {
this.isSphere = !0, this.center = e, this.radius = t;
}
set(e, t) {
return this.center.copy(e), this.radius = t, this;
}
setFromPoints(e, t) {
let n = this.center;
t === void 0 ? Oi.setFromPoints(e).getCenter(n) : n.copy(t);
let r = 0;
for (let t = 0, i = e.length; t < i; t++) r = Math.max(r, n.distanceToSquared(e[t]));
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) {
let 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) {
let n = this.center.distanceToSquared(e);
return t.copy(e), n > 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 *= e.getMaxScaleOnAxis(), this;
}
translate(e) {
return this.center.add(e), this;
}
expandByPoint(e) {
if (this.isEmpty()) return this.center.copy(e), this.radius = 0, this;
ki.subVectors(e, this.center);
let t = ki.lengthSq();
if (t > this.radius * this.radius) {
let e = Math.sqrt(t), n = (e - this.radius) * .5;
this.center.addScaledVector(ki, n / e), this.radius += n;
}
return this;
}
union(e) {
return e.isEmpty() ? this : this.isEmpty() ? (this.copy(e), this) : (this.center.equals(e.center) === !0 ? this.radius = Math.max(this.radius, e.radius) : (Ai.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(ki.copy(e.center).add(Ai)), this.expandByPoint(ki.copy(e.center).sub(Ai))), this);
}
equals(e) {
return e.center.equals(this.center) && e.radius === this.radius;
}
clone() {
return new this.constructor().copy(this);
}
toJSON() {
return {
radius: this.radius,
center: this.center.toArray()
};
}
fromJSON(e) {
return this.radius = e.radius, this.center.fromArray(e.center), this;
}
}, ji = 0, Mi = /*@__PURE__*/ new R(), Ni = /*@__PURE__*/ new z(), Pi = /*@__PURE__*/ new I(), Fi = /*@__PURE__*/ new H(), Ii = /*@__PURE__*/ new H(), q = /*@__PURE__*/ new I(), J = class e extends on {
constructor() {
super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", { value: ji++ }), this.uuid = dn(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.indirectOffset = 0, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = {
start: 0,
count: Infinity
}, this.userData = {}, this._transformed = !1;
}
getIndex() {
return this.index;
}
setIndex(e) {
return Array.isArray(e) ? this.index = new (Wt(e) ? Ei : wi)(e, 1) : this.index = e, this;
}
setIndirect(e, t = 0) {
return this.indirect = e, this.indirectOffset = t, this;
}
getIndirect() {
return this.indirect;
}
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, n = 0) {
this.groups.push({
start: e,
count: t,
materialIndex: n
});
}
clearGroups() {
this.groups = [];
}
setDrawRange(e, t) {
this.drawRange.start = e, this.drawRange.count = t;
}
applyMatrix4(e) {
let t = this.attributes.position;
t !== void 0 && (t.applyMatrix4(e), t.needsUpdate = !0);
let n = this.attributes.normal;
if (n !== void 0) {
let t = new Fn().getNormalMatrix(e);
n.applyNormalMatrix(t), n.needsUpdate = !0;
}
let 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._transformed = !0, this;
}
applyQuaternion(e) {
return Mi.makeRotationFromQuaternion(e), this.applyMatrix4(Mi), this;
}
rotateX(e) {
return Mi.makeRotationX(e), this.applyMatrix4(Mi), this;
}
rotateY(e) {
return Mi.makeRotationY(e), this.applyMatrix4(Mi), this;
}
rotateZ(e) {
return Mi.makeRotationZ(e), this.applyMatrix4(Mi), this;
}
translate(e, t, n) {
return Mi.makeTranslation(e, t, n), this.applyMatrix4(Mi), this;
}
scale(e, t, n) {
return Mi.makeScale(e, t, n), this.applyMatrix4(Mi), this;
}
lookAt(e) {
return Ni.lookAt(e), Ni.updateMatrix(), this.applyMatrix4(Ni.matrix), this;
}
center() {
return this.computeBoundingBox(), this.boundingBox.getCenter(Pi).negate(), this.translate(Pi.x, Pi.y, Pi.z), this;
}
setFromPoints(e) {
let t = this.getAttribute("position");
if (t === void 0) {
let t = [];
for (let n = 0, r = e.length; n < r; n++) {
let r = e[n];
t.push(r.x, r.y, r.z || 0);
}
this.setAttribute("position", new G(t, 3));
} else {
let n = Math.min(e.length, t.count);
for (let r = 0; r < n; r++) {
let n = e[r];
t.setXYZ(r, n.x, n.y, n.z || 0);
}
e.length > t.count && j("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."), t.needsUpdate = !0;
}
return this;
}
computeBoundingBox() {
this.boundingBox === null && (this.boundingBox = new H());
let e = this.attributes.position, t = this.morphAttributes.position;
if (e && e.isGLBufferAttribute) {
M("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.", this), this.boundingBox.set(new I(-Infinity, -Infinity, -Infinity), new I(Infinity, Infinity, Infinity));
return;
}
if (e !== void 0) {
if (this.boundingBox.setFromBufferAttribute(e), t) for (let e = 0, n = t.length; e < n; e++) {
let n = t[e];
Fi.setFromBufferAttribute(n), this.morphTargetsRelative ? (q.addVectors(this.boundingBox.min, Fi.min), this.boundingBox.expandByPoint(q), q.addVectors(this.boundingBox.max, Fi.max), this.boundingBox.expandByPoint(q)) : (this.boundingBox.expandByPoint(Fi.min), this.boundingBox.expandByPoint(Fi.max));
}
} else this.boundingBox.makeEmpty();
(isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && M("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 K());
let e = this.attributes.position, t = this.morphAttributes.position;
if (e && e.isGLBufferAttribute) {
M("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this), this.boundingSphere.set(new I(), Infinity);
return;
}
if (e) {
let n = this.boundingSphere.center;
if (Fi.setFromBufferAttribute(e), t) for (let e = 0, n = t.length; e < n; e++) {
let n = t[e];
Ii.setFromBufferAttribute(n), this.morphTargetsRelative ? (q.addVectors(Fi.min, Ii.min), Fi.expandByPoint(q), q.addVectors(Fi.max, Ii.max), Fi.expandByPoint(q)) : (Fi.expandByPoint(Ii.min), Fi.expandByPoint(Ii.max));
}
Fi.getCenter(n);
let r = 0;
for (let t = 0, i = e.count; t < i; t++) q.fromBufferAttribute(e, t), r = Math.max(r, n.distanceToSquared(q));
if (t) for (let i = 0, a = t.length; i < a; i++) {
let a = t[i], o = this.morphTargetsRelative;
for (let t = 0, i = a.count; t < i; t++) q.fromBufferAttribute(a, t), o && (Pi.fromBufferAttribute(e, t), q.add(Pi)), r = Math.max(r, n.distanceToSquared(q));
}
this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && M("BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.", this);
}
}
computeTangents() {
let e = this.index, t = this.attributes;
if (e === null || t.position === void 0 || t.normal === void 0 || t.uv === void 0) {
M("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");
return;
}
let n = t.position, r = t.normal, i = t.uv, a = this.getAttribute("tangent");
(a === void 0 || a.count !== n.count) && (a = new W(new Float32Array(4 * n.count), 4), this.setAttribute("tangent", a));
let o = [], s = [];
for (let e = 0; e < n.count; e++) o[e] = new I(), s[e] = new I();
let c = new I(), l = new I(), u = new I(), d = new F(), f = new F(), p = new F(), m = new I(), h = new I();
function g(e, t, r) {
c.fromBufferAttribute(n, e), l.fromBufferAttribute(n, t), u.fromBufferAttribute(n, r), d.fromBufferAttribute(i, e), f.fromBufferAttribute(i, t), p.fromBufferAttribute(i, r), l.sub(c), u.sub(c), f.sub(d), p.sub(d);
let a = 1 / (f.x * p.y - p.x * f.y);
isFinite(a) && (m.copy(l).multiplyScalar(p.y).addScaledVector(u, -f.y).multiplyScalar(a), h.copy(u).multiplyScalar(f.x).addScaledVector(l, -p.x).multiplyScalar(a), o[e].add(m), o[t].add(m), o[r].add(m), s[e].add(h), s[t].add(h), s[r].add(h));
}
let _ = this.groups;
_.length === 0 && (_ = [{
start: 0,
count: e.count
}]);
for (let t = 0, n = _.length; t < n; ++t) {
let n = _[t], r = n.start, i = n.count;
for (let t = r, n = r + i; t < n; t += 3) g(e.getX(t + 0), e.getX(t + 1), e.getX(t + 2));
}
let v = new I(), y = new I(), b = new I(), x = new I();
function S(e) {
b.fromBufferAttribute(r, e), x.copy(b);
let t = o[e];
v.copy(t), v.sub(b.multiplyScalar(b.dot(t))).normalize(), y.crossVectors(x, t);
let n = y.dot(s[e]) < 0 ? -1 : 1;
a.setXYZW(e, v.x, v.y, v.z, n);
}
for (let t = 0, n = _.length; t < n; ++t) {
let n = _[t], r = n.start, i = n.count;
for (let t = r, n = r + i; t < n; t += 3) S(e.getX(t + 0)), S(e.getX(t + 1)), S(e.getX(t + 2));
}
this._transformed = !0;
}
computeVertexNormals() {
let e = this.index, t = this.getAttribute("position");
if (t !== void 0) {
let n = this.getAttribute("normal");
if (n === void 0 || n.count !== t.count) n = new W(new Float32Array(t.count * 3), 3), this.setAttribute("normal", n);
else for (let e = 0, t = n.count; e < t; e++) n.setXYZ(e, 0, 0, 0);
let r = new I(), i = new I(), a = new I(), o = new I(), s = new I(), c = new I(), l = new I(), u = new I();
if (e) for (let d = 0, f = e.count; d < f; d += 3) {
let f = e.getX(d + 0), p = e.getX(d + 1), m = e.getX(d + 2);
r.fromBufferAttribute(t, f), i.fromBufferAttribute(t, p), a.fromBufferAttribute(t, m), l.subVectors(a, i), u.subVectors(r, i), l.cross(u), o.fromBufferAttribute(n, f), s.fromBufferAttribute(n, p), c.fromBufferAttribute(n, m), o.add(l), s.add(l), c.add(l), n.setXYZ(f, o.x, o.y, o.z), n.setXYZ(p, s.x, s.y, s.z), n.setXYZ(m, c.x, c.y, c.z);
}
else for (let e = 0, o = t.count; e < o; e += 3) r.fromBufferAttribute(t, e + 0), i.fromBufferAttribute(t, e + 1), a.fromBufferAttribute(t, e + 2), l.subVectors(a, i), u.subVectors(r, i), l.cross(u), n.setXYZ(e + 0, l.x, l.y, l.z), n.setXYZ(e + 1, l.x, l.y, l.z), n.setXYZ(e + 2, l.x, l.y, l.z);
this.normalizeNormals(), n.needsUpdate = !0;
}
}
normalizeNormals() {
let e = this.attributes.normal;
for (let t = 0, n = e.count; t < n; t++) q.fromBufferAttribute(e, t), q.normalize(), e.setXYZ(t, q.x, q.y, q.z);
}
toNonIndexed() {
function t(e, t) {
let n = e.array, r = e.itemSize, i = e.normalized, a = new n.constructor(t.length * r), o = 0, s = 0;
for (let i = 0, c = t.length; i < c; i++) {
o = e.isInterleavedBufferAttribute ? t[i] * e.data.stride + e.offset : t[i] * r;
for (let e = 0; e < r; e++) a[s++] = n[o++];
}
return new W(a, r, i);
}
if (this.index === null) return j("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
let n = new e(), r = this.index.array, i = this.attributes;
for (let e in i) {
let a = i[e], o = t(a, r);
n.setAttribute(e, o);
}
let a = this.morphAttributes;
for (let e in a) {
let i = [], o = a[e];
for (let e = 0, n = o.length; e < n; e++) {
let n = o[e], a = t(n, r);
i.push(a);
}
n.morphAttributes[e] = i;
}
n.morphTargetsRelative = this.morphTargetsRelative;
let o = this.groups;
for (let e = 0, t = o.length; e < t; e++) {
let t = o[e];
n.addGroup(t.start, t.count, t.materialIndex);
}
return n;
}
toJSON() {
let e = { metadata: {
version: 4.7,
type: "BufferGeometry",
generator: "BufferGeometry.toJSON"
} };
if (e.uuid = this.uuid, e.type = this.parameters !== void 0 && this._transformed === !0 ? "BufferGeometry" : this.type, this.name !== "" && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), this.parameters !== void 0 && this._transformed !== !0) {
let t = this.parameters;
for (let n in t) t[n] !== void 0 && (e[n] = t[n]);
return e;
}
e.data = { attributes: {} };
let t = this.index;
t !== null && (e.data.index = {
type: t.array.constructor.name,
array: Array.prototype.slice.call(t.array)
});
let n = this.attributes;
for (let t in n) {
let r = n[t];
e.data.attributes[t] = r.toJSON(e.data);
}
let r = {}, i = !1;
for (let t in this.morphAttributes) {
let n = this.morphAttributes[t], a = [];
for (let t = 0, r = n.length; t < r; t++) {
let r = n[t];
a.push(r.toJSON(e.data));
}
a.length > 0 && (r[t] = a, i = !0);
}
i && (e.data.morphAttributes = r, e.data.morphTargetsRelative = this.morphTargetsRelative);
let a = this.groups;
a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a)));
let o = this.boundingSphere;
return o !== null && (e.data.boundingSphere = o.toJSON()), e;
}
clone() {
return new this.constructor().copy(this);
}
copy(e) {
this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null;
let t = {};
this.name = e.name;
let n = e.index;
n !== null && this.setIndex(n.clone());
let r = e.attributes;
for (let e in r) {
let n = r[e];
this.setAttribute(e, n.clone(t));
}
let i = e.morphAttributes;
for (let e in i) {
let n = [], r = i[e];
for (let e = 0, i = r.length; e < i; e++) n.push(r[e].clone(t));
this.morphAttributes[e] = n;
}
this.morphTargetsRelative = e.morphTargetsRelative;
let a = e.groups;
for (let e = 0, t = a.length; e < t; e++) {
let t = a[e];
this.addGroup(t.start, t.count, t.materialIndex);
}
let o = e.boundingBox;
o !== null && (this.boundingBox = o.clone());
let s = e.boundingSphere;
return s !== null && (this.boundingSphere = s.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this._transformed = e._transformed, this;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
}, Li = class {
constructor(e, t) {
this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = e === void 0 ? 0 : e.length / t, this.usage = Ot, this.updateRanges = [], this.version = 0, this.uuid = dn();
}
onUploadCallback() {}
set needsUpdate(e) {
e === !0 && this.version++;
}
setUsage(e) {
return this.usage = e, this;
}
addUpdateRange(e, t) {
this.updateRanges.push({
start: e,
count: t
});
}
clearUpdateRanges() {
this.updateRanges.length = 0;
}
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, n) {
e *= this.stride, n *= t.stride;
for (let r = 0, i = this.stride; r < i; r++) this.array[e + r] = t.array[n + 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 = dn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
let t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]), n = new this.constructor(t, this.stride);
return n.setUsage(this.usage), n;
}
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 = dn()), e.arrayBuffers[this.array.buffer._uuid] === void 0 && (e.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer))), {
uuid: this.uuid,
buffer: this.array.buffer._uuid,
type: this.array.constructor.name,
stride: this.stride
};
}
}, Ri = /*@__PURE__*/ new I(), zi = class e {
constructor(e, t, n, r = !1) {
this.isInterleavedBufferAttribute = !0, this.name = "", this.data = e, this.itemSize = t, this.offset = n, this.normalized = r;
}
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, n = this.data.count; t < n; t++) Ri.fromBufferAttribute(this, t), Ri.applyMatrix4(e), this.setXYZ(t, Ri.x, Ri.y, Ri.z);
return this;
}
applyNormalMatrix(e) {
for (let t = 0, n = this.count; t < n; t++) Ri.fromBufferAttribute(this, t), Ri.applyNormalMatrix(e), this.setXYZ(t, Ri.x, Ri.y, Ri.z);
return this;
}
transformDirection(e) {
for (let t = 0, n = this.count; t < n; t++) Ri.fromBufferAttribute(this, t), Ri.transformDirection(e), this.setXYZ(t, Ri.x, Ri.y, Ri.z);
return this;
}
getComponent(e, t) {
let n = this.array[e * this.data.stride + this.offset + t];
return this.normalized && (n = An(n, this.array)), n;
}
setComponent(e, t, n) {
return this.normalized && (n = P(n, this.array)), this.data.array[e * this.data.stride + this.offset + t] = n, this;
}
setX(e, t) {
return this.normalized && (t = P(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this;
}
setY(e, t) {
return this.normalized && (t = P(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this;
}
setZ(e, t) {
return this.normalized && (t = P(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this;
}
setW(e, t) {
return this.normalized && (t = P(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this;
}
getX(e) {
let t = this.data.array[e * this.data.stride + this.offset];
return this.normalized && (t = An(t, this.array)), t;
}
getY(e) {
let t = this.data.array[e * this.data.stride + this.offset + 1];
return this.normalized && (t = An(t, this.array)), t;
}
getZ(e) {
let t = this.data.array[e * this.data.stride + this.offset + 2];
return this.normalized && (t = An(t, this.array)), t;
}
getW(e) {
let t = this.data.array[e * this.data.stride + this.offset + 3];
return this.normalized && (t = An(t, this.array)), t;
}
setXY(e, t, n) {
return e = e * this.data.stride + this.offset, this.normalized && (t = P(t, this.array), n = P(n, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this;
}
setXYZ(e, t, n, r) {
return e = e * this.data.stride + this.offset, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = r, this;
}
setXYZW(e, t, n, r, i) {
return e = e * this.data.stride + this.offset, this.normalized && (t = P(t, this.array), n = P(n, this.array), r = P(r, this.array), i = P(i, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = r, this.data.array[e + 3] = i, this;
}
clone(t) {
if (t === void 0) {
en("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");
let e = [];
for (let t = 0; t < this.count; t++) {
let n = t * this.data.stride + this.offset;
for (let t = 0; t < this.itemSize; t++) e.push(this.data.array[n + t]);
}
return new W(new this.array.constructor(e), this.itemSize, this.normalized);
} else return t.interleavedBuffers === void 0 && (t.interleavedBuffers = {}), t.interleavedBuffers[this.data.uuid] === void 0 && (t.interleavedBuffers[this.data.uuid] = this.data.clone(t)), new e(t.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
}
toJSON(e) {
if (e === void 0) {
en("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");
let e = [];
for (let t = 0; t < this.count; t++) {
let n = t * this.data.stride + this.offset;
for (let t = 0; t < this.itemSize; t++) e.push(this.data.array[n + t]);
}
return {
itemSize: this.itemSize,
type: this.array.constructor.name,
array: e,
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
};
}
}, Bi = 0, Y = class extends on {
constructor() {
super(), this.isMaterial = !0, Object.defineProperty(this, "id", { value: Bi++ }), this.uuid = dn(), this.name = "", this.type = "Material", this.blending = 1, this.side = 0, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = 204, this.blendDst = 205, this.blendEquation = 100, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new B(0, 0, 0), this.blendAlpha = 0, this.depthFunc = 3, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = 519, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = xt, this.stencilZFail = xt, this.stencilZPass = xt, 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.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.forceSinglePass = !1, this.allowOverride = !0, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0, this._alphaTest = 0;
}
get alphaTest() {
return this._alphaTest;
}
set alphaTest(e) {
this._alphaTest > 0 != e > 0 && this.version++, this._alphaTest = e;
}
onBeforeRender() {}
onBeforeCompile() {}
customProgramCacheKey() {
return this.onBeforeCompile.toString();
}
setValues(e) {
if (e !== void 0) for (let t in e) {
let n = e[t];
if (n === void 0) {
j(`Material: parameter '${t}' has value of undefined.`);
continue;
}
let r = this[t];
if (r === void 0) {
j(`Material: '${t}' is not a property of THREE.${this.type}.`);
continue;
}
r && r.isColor ? r.set(n) : r && r.isVector2 && n && n.isVector2 || r && r.isEuler && n && n.isEuler || r && r.isVector3 && n && n.isVector3 ? r.copy(n) : this[t] = n;
}
}
toJSON(e) {
let t = e === void 0 || typeof e == "string";
t && (e = {
textures: {},
images: {}
});
let n = { metadata: {
version: 4.7,
type: "Material",
generator: "Material.toJSON"
} };
n.uuid = this.uuid, n.type = this.type, this.name !== "" && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), this.roughness !== void 0 && (n.roughness = this.roughness), this.metalness !== void 0 && (n.metalness = this.metalness), this.sheen !== void 0 && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), this.sheenRoughness !== void 0 && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), this.emissiveIntensity !== void 0 && this.emissiveIntensity !== 1 && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), this.specularIntensity !== void 0 && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), this.shininess !== void 0 && (n.shininess = this.shininess), this.clearcoat !== void 0 && (n.clearcoat = this.clearcoat), this.clearcoatRoughness !== void 0 && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), this.sheenColorMap && this.sheenColorMap.isTexture && (n.sheenColorMap = this.sheenColorMap.toJSON(e).uuid), this.sheenRoughnessMap && this.sheenRoughnessMap.isTexture && (n.sheenRoughnessMap = this.sheenRoughnessMap.toJSON(e).uuid), this.dispersion !== void 0 && (n.dispersion = this.dispersion), this.iridescence !== void 0 && (n.iridescence = this.iridescence), this.iridescenceIOR !== void 0 && (n.iridescenceIOR = this.iridescenceIOR), this.iridescenceThicknessRange !== void 0 && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), this.anisotropy !== void 0 && (n.anisotropy = this.anisotropy), this.anisotropyRotation !== void 0 && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, this.combine !== void 0 && (n.combine = this.combine)), this.envMapRotation !== void 0 && (n.envMapRotation = this.envMapRotation.toArray()), this.envMapIntensity !== void 0 && (n.envMapIntensity = this.envMapIntensity), this.reflectivity !== void 0 && (n.reflectivity = this.reflectivity), this.refractionRatio !== void 0 && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), this.transmission !== void 0 && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), this.thickness !== void 0 && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), this.attenuationDistance !== void 0 && this.attenuationDistance !== Infinity && (n.attenuationDistance = this.attenuationDistance), this.attenuationColor !== void 0 && (n.attenuationColor = this.attenuationColor.getHex()), this.size !== void 0 && (n.size = this.size), this.shadowSide !== null && (n.shadowSide = this.shadowSide), this.sizeAttenuation !== void 0 && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== 1 && (n.blending = this.blending), this.side !== 0 && (n.side = this.side), this.vertexColors === !0 && (n.vertexColors = !0), this.opacity < 1 && (n.opacity = this.opacity), this.transparent === !0 && (n.transparent = !0), this.blendSrc !== 204 && (n.blendSrc = this.blendSrc), this.blendDst !== 205 && (n.blendDst = this.blendDst), this.blendEquation !== 100 && (n.blendEquation = this.blendEquation), this.blendSrcAlpha !== null && (n.blendSrcAlpha = this.blendSrcAlpha), this.blendDstAlpha !== null && (n.blendDstAlpha = this.blendDstAlpha), this.blendEquationAlpha !== null && (n.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (n.blendColor = this.blendColor.getHex()), this.blendAlpha !== 0 && (n.blendAlpha = this.blendAlpha), this.depthFunc !== 3 && (n.depthFunc = this.depthFunc), this.depthTest === !1 && (n.depthTest = this.depthTest), this.depthWrite === !1 && (n.depthWrite = this.depthWrite), this.colorWrite === !1 && (n.colorWrite = this.colorWrite), this.stencilWriteMask !== 255 && (n.stencilWriteMask = this.stencilWriteMask), this.stencilFunc !== 519 && (n.stencilFunc = this.stencilFunc), this.stencilRef !== 0 && (n.stencilRef = this.stencilRef), this.stencilFuncMask !== 255 && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== 7680 && (n.stencilFail = this.stencilFail), this.stencilZFail !== 7680 && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== 7680 && (n.stencilZPass = this.stencilZPass), this.stencilWrite === !0 && (n.stencilWrite = this.stencilWrite), this.rotation !== void 0 && this.rotation !== 0 && (n.rotation = this.rotation), this.polygonOffset === !0 && (n.polygonOffset = !0), this.polygonOffsetFactor !== 0 && (n.polygonOffsetFactor = this.polygonOffsetFactor), this.polygonOffsetUnits !== 0 && (n.polygonOffsetUnits = this.polygonOffsetUnits), this.linewidth !== void 0 && this.linewidth !== 1 && (n.linewidth = this.linewidth), this.dashSize !== void 0 && (n.dashSize = this.dashSize), this.gapSize !== void 0 && (n.gapSize = this.gapSize), this.scale !== void 0 && (n.scale = this.scale), this.dithering === !0 && (n.dithering = !0), this.alphaTest > 0 && (n.alphaTest = this.alphaTest), this.alphaHash === !0 && (n.alphaHash = !0), this.alphaToCoverage === !0 && (n.alphaToCoverage = !0), this.premultipliedAlpha === !0 && (n.premultipliedAlpha = !0), this.forceSinglePass === !0 && (n.forceSinglePass = !0), this.allowOverride === !1 && (n.allowOverride = !1), this.wireframe === !0 && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), this.wireframeLinecap !== "round" && (n.wireframeLinecap = this.wireframeLinecap), this.wireframeLinejoin !== "round" && (n.wireframeLinejoin = this.wireframeLinejoin), this.flatShading === !0 && (n.flatShading = !0), this.visible === !1 && (n.visible = !1), this.toneMapped === !1 && (n.toneMapped = !1), this.fog === !1 && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData);
function r(e) {
let t = [];
for (let n in e) {
let r = e[n];
delete r.metadata, t.push(r);
}
return t;
}
if (t) {
let t = r(e.textures), i = r(e.images);
t.length > 0 && (n.textures = t), i.length > 0 && (n.images = i);
}
return n;
}
fromJSON(e, t) {
if (e.uuid !== void 0 && (this.uuid = e.uuid), e.name !== void 0 && (this.name = e.name), e.color !== void 0 && this.color !== void 0 && this.color.setHex(e.color), e.roughness !== void 0 && (this.roughness = e.roughness), e.metalness !== void 0 && (this.metalness = e.metalness), e.sheen !== void 0 && (this.sheen = e.sheen), e.sheenColor !== void 0 && (this.sheenColor = new B().setHex(e.sheenColor)), e.sheenRoughness !== void 0 && (this.sheenRoughness = e.sheenRoughness), e.emissive !== void 0 && this.emissive !== void 0 && this.emissive.setHex(e.emissive), e.specular !== void 0 && this.specular !== void 0 && this.specular.setHex(e.specular), e.specularIntensity !== void 0 && (this.specularIntensity = e.specularIntensity), e.specularColor !== void 0 && this.specularColor !== void 0 && this.specularColor.setHex(e.specularColor), e.shininess !== void 0 && (this.shininess = e.shininess), e.clearcoat !== void 0 && (this.clearcoat = e.clearcoat), e.clearcoatRoughness !== void 0 && (this.clearcoatRoughness = e.clearcoatRoughness), e.dispersion !== void 0 && (this.dispersion = e.dispersion), e.iridescence !== void 0 && (this.iridescence = e.iridescence), e.iridescenceIOR !== void 0 && (this.iridescenceIOR = e.iridescenceIOR), e.iridescenceThicknessRange !== void 0 && (this.iridescenceThicknessRange = e.iridescenceThicknessRange), e.transmission !== void 0 && (this.transmission = e.transmission), e.thickness !== void 0 && (this.thickness = e.thickness), e.attenuationDistance !== void 0 && (this.attenuationDistance = e.attenuationDistance), e.attenuationColor !== void 0 && this.attenuationColor !== void 0 && this.attenuationColor.setHex(e.attenuationColor), e.anisotropy !== void 0 && (this.anisotropy = e.anisotropy), e.anisotropyRotation !== void 0 && (this.anisotropyRotation = e.anisotropyRotation), e.fog !== void 0 && (this.fog = e.fog), e.flatShading !== void 0 && (this.flatShading = e.flatShading), e.blending !== void 0 && (this.blending = e.blending), e.combine !== void 0 && (this.combine = e.combine), e.side !== void 0 && (this.side = e.side), e.shadowSide !== void 0 && (this.shadowSide = e.shadowSide), e.opacity !== void 0 && (this.opacity = e.opacity), e.transparent !== void 0 && (this.transparent = e.transparent), e.alphaTest !== void 0 && (this.alphaTest = e.alphaTest), e.alphaHash !== void 0 && (this.alphaHash = e.alphaHash), e.depthFunc !== void 0 && (this.depthFunc = e.depthFunc), e.depthTest !== void 0 && (this.depthTest = e.depthTest), e.depthWrite !== void 0 && (this.depthWrite = e.depthWrite), e.colorWrite !== void 0 && (this.colorWrite = e.colorWrite), e.blendSrc !== void 0 && (this.blendSrc = e.blendSrc), e.blendDst !== void 0 && (this.blendDst = e.blendDst), e.blendEquation !== void 0 && (this.blendEquation = e.blendEquation), e.blendSrcAlpha !== void 0 && (this.blendSrcAlpha = e.blendSrcAlpha), e.blendDstAlpha !== void 0 && (this.blendDstAlpha = e.blendDstAlpha), e.blendEquationAlpha !== void 0 && (this.blendEquationAlpha = e.blendEquationAlpha), e.blendColor !== void 0 && this.blendColor !== void 0 && this.blendColor.setHex(e.blendColor), e.blendAlpha !== void 0 && (this.blendAlpha = e.blendAlpha), e.stencilWriteMask !== void 0 && (this.stencilWriteMask = e.stencilWriteMask), e.stencilFunc !== void 0 && (this.stencilFunc = e.stencilFunc), e.stencilRef !== void 0 && (this.stencilRef = e.stencilRef), e.stencilFuncMask !== void 0 && (this.stencilFuncMask = e.stencilFuncMask), e.stencilFail !== void 0 && (this.stencilFail = e.stencilFail), e.stencilZFail !== void 0 && (this.stencilZFail = e.stencilZFail), e.stencilZPass !== void 0 && (this.stencilZPass = e.stencilZPass), e.stencilWrite !== void 0 && (this.stencilWrite = e.stencilWrite), e.wireframe !== void 0 && (this.wireframe = e.wireframe), e.wireframeLinewidth !== void 0 && (this.wireframeLinewidth = e.wireframeLinewidth), e.wireframeLinecap !== void 0 && (this.wireframeLinecap = e.wireframeLinecap), e.wireframeLinejoin !== void 0 && (this.wireframeLinejoin = e.wireframeLinejoin), e.rotation !== void 0 && (this.rotation = e.rotation), e.linewidth !== void 0 && (this.linewidth = e.linewidth), e.dashSize !== void 0 && (this.dashSize = e.dashSize), e.gapSize !== void 0 && (this.gapSize = e.gapSize), e.scale !== void 0 && (this.scale = e.scale), e.polygonOffset !== void 0 && (this.polygonOffset = e.polygonOffset), e.polygonOffsetFactor !== void 0 && (this.polygonOffsetFactor = e.polygonOffsetFactor), e.polygonOffsetUnits !== void 0 && (this.polygonOffsetUnits = e.polygonOffsetUnits), e.dithering !== void 0 && (this.dithering = e.dithering), e.alphaToCoverage !== void 0 && (this.alphaToCoverage = e.alphaToCoverage), e.premultipliedAlpha !== void 0 && (this.premultipliedAlpha = e.premultipliedAlpha), e.forceSinglePass !== void 0 && (this.forceSinglePass = e.forceSinglePass), e.allowOverride !== void 0 && (this.allowOverride = e.allowOverride), e.visible !== void 0 && (this.visible = e.visible), e.toneMapped !== void 0 && (this.toneMapped = e.toneMapped), e.userData !== void 0 && (this.userData = e.userData), e.vertexColors !== void 0 && (typeof e.vertexColors == "number" ? this.vertexColors = e.vertexColors > 0 : this.vertexColors = e.vertexColors), e.size !== void 0 && (this.size = e.size), e.sizeAttenuation !== void 0 && (this.sizeAttenuation = e.sizeAttenuation), e.map !== void 0 && (this.map = t[e.map] || null), e.matcap !== void 0 && (this.matcap = t[e.matcap] || null), e.alphaMap !== void 0 && (this.alphaMap = t[e.alphaMap] || null), e.bumpMap !== void 0 && (this.bumpMap = t[e.bumpMap] || null), e.bumpScale !== void 0 && (this.bumpScale = e.bumpScale), e.normalMap !== void 0 && (this.normalMap = t[e.normalMap] || null), e.normalMapType !== void 0 && (this.normalMapType = e.normalMapType), e.normalScale !== void 0) {
let t = e.normalScale;
Array.isArray(t) === !1 && (t = [t, t]), this.normalScale = new F().fromArray(t);
}
return e.displacementMap !== void 0 && (this.displacementMap = t[e.displacementMap] || null), e.displacementScale !== void 0 && (this.displacementScale = e.displacementScale), e.displacementBias !== void 0 && (this.displacementBias = e.displacementBias), e.roughnessMap !== void 0 && (this.roughnessMap = t[e.roughnessMap] || null), e.metalnessMap !== void 0 && (this.metalnessMap = t[e.metalnessMap] || null), e.emissiveMap !== void 0 && (this.emissiveMap = t[e.emissiveMap] || null), e.emissiveIntensity !== void 0 && (this.emissiveIntensity = e.emissiveIntensity), e.specularMap !== void 0 && (this.specularMap = t[e.specularMap] || null), e.specularIntensityMap !== void 0 && (this.specularIntensityMap = t[e.specularIntensityMap] || null), e.specularColorMap !== void 0 && (this.specularColorMap = t[e.specularColorMap] || null), e.envMap !== void 0 && (this.envMap = t[e.envMap] || null), e.envMapRotation !== void 0 && this.envMapRotation.fromArray(e.envMapRotation), e.envMapIntensity !== void 0 && (this.envMapIntensity = e.envMapIntensity), e.reflectivity !== void 0 && (this.reflectivity = e.reflectivity), e.refractionRatio !== void 0 && (this.refractionRatio = e.refractionRatio), e.lightMap !== void 0 && (this.lightMap = t[e.lightMap] || null), e.lightMapIntensity !== void 0 && (this.lightMapIntensity = e.lightMapIntensity), e.aoMap !== void 0 && (this.aoMap = t[e.aoMap] || null), e.aoMapIntensity !== void 0 && (this.aoMapIntensity = e.aoMapIntensity), e.gradientMap !== void 0 && (this.gradientMap = t[e.gradientMap] || null), e.clearcoatMap !== void 0 && (this.clearcoatMap = t[e.clearcoatMap] || null), e.clearcoatRoughnessMap !== void 0 && (this.clearcoatRoughnessMap = t[e.clearcoatRoughnessMap] || null), e.clearcoatNormalMap !== void 0 && (this.clearcoatNormalMap = t[e.clearcoatNormalMap] || null), e.clearcoatNormalScale !== void 0 && (this.clearcoatNormalScale = new F().fromArray(e.clearcoatNormalScale)), e.iridescenceMap !== void 0 && (this.iridescenceMap = t[e.iridescenceMap] || null), e.iridescenceThicknessMap !== void 0 && (this.iridescenceThicknessMap = t[e.iridescenceThicknessMap] || null), e.transmissionMap !== void 0 && (this.transmissionMap = t[e.transmissionMap] || null), e.thicknessMap !== void 0 && (this.thicknessMap = t[e.thicknessMap] || null), e.anisotropyMap !== void 0 && (this.anisotropyMap = t[e.anisotropyMap] || null), e.sheenColorMap !== void 0 && (this.sheenColorMap = t[e.sheenColorMap] || null), e.sheenRoughnessMap !== void 0 && (this.sheenRoughnessMap = t[e.sheenRoughnessMap] || null), this;
}
clone() {
return new this.constructor().copy(this);
}
copy(e) {
this.name = e.name, 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.blendColor.copy(e.blendColor), this.blendAlpha = e.blendAlpha, 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;
let t = e.clippingPlanes, n = null;
if (t !== null) {
let e = t.length;
n = Array(e);
for (let r = 0; r !== e; ++r) n[r] = t[r].clone();
}
return this.clippingPlanes = n, 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.alphaHash = e.alphaHash, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.forceSinglePass = e.forceSinglePass, this.allowOverride = e.allowOverride, 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++;
}
}, Vi = class extends Y {
constructor(e) {
super(), this.isSpriteMaterial = !0, this.type = "SpriteMaterial", this.color = new B(16777215), this.map = null, this.alphaMap = null, this.rotation = 0, this.sizeAttenuation = !0, this.transparent = !0, this.fog = !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.fog = e.fog, this;
}
}, Hi, Ui = /*@__PURE__*/ new I(), Wi = /*@__PURE__*/ new I(), Gi = /*@__PURE__*/ new I(), Ki = /*@__PURE__*/ new F(), qi = /*@__PURE__*/ new F(), Ji = /*@__PURE__*/ new R(), Yi = /*@__PURE__*/ new I(), Xi = /*@__PURE__*/ new I(), Zi = /*@__PURE__*/ new I(), Qi = /*@__PURE__*/ new F(), $i = /*@__PURE__*/ new F(), ea = /*@__PURE__*/ new F(), ta = class extends z {
constructor(e = new Vi()) {
if (super(), this.isSprite = !0, this.type = "Sprite", Hi === void 0) {
Hi = new J();
let e = new Li(new Float32Array([
-.5,
-.5,
0,
0,
0,
.5,
-.5,
0,
1,
0,
.5,
.5,
0,
1,
1,
-.5,
.5,
0,
0,
1
]), 5);
Hi.setIndex([
0,
1,
2,
0,
2,
3
]), Hi.setAttribute("position", new zi(e, 3, 0, !1)), Hi.setAttribute("uv", new zi(e, 2, 3, !1));
}
this.geometry = Hi, this.material = e, this.center = new F(.5, .5), this.count = 1;
}
raycast(e, t) {
e.camera === null && M("Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites."), Wi.setFromMatrixScale(this.matrixWorld), Ji.copy(e.camera.matrixWorld), this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse, this.matrixWorld), Gi.setFromMatrixPosition(this.modelViewMatrix), e.camera.isPerspectiveCamera && this.material.sizeAttenuation === !1 && Wi.multiplyScalar(-Gi.z);
let n = this.material.rotation, r, i;
n !== 0 && (i = Math.cos(n), r = Math.sin(n));
let a = this.center;
na(Yi.set(-.5, -.5, 0), Gi, a, Wi, r, i), na(Xi.set(.5, -.5, 0), Gi, a, Wi, r, i), na(Zi.set(.5, .5, 0), Gi, a, Wi, r, i), Qi.set(0, 0), $i.set(1, 0), ea.set(1, 1);
let o = e.ray.intersectTriangle(Yi, Xi, Zi, !1, Ui);
if (o === null && (na(Xi.set(-.5, .5, 0), Gi, a, Wi, r, i), $i.set(0, 1), o = e.ray.intersectTriangle(Yi, Zi, Xi, !1, Ui), o === null)) return;
let s = e.ray.origin.distanceTo(Ui);
s < e.near || s > e.far || t.push({
distance: s,
point: Ui.clone(),
uv: Qr.getInterpolation(Ui, Yi, Xi, Zi, Qi, $i, ea, new F()),
face: null,
object: this
});
}
copy(e, t) {
return super.copy(e, t), e.center !== void 0 && this.center.copy(e.center), this.material = e.material, this;
}
};
function na(e, t, n, r, i, a) {
Ki.subVectors(e, n).addScalar(.5).multiply(r), i === void 0 ? qi.copy(Ki) : (qi.x = a * Ki.x - i * Ki.y, qi.y = i * Ki.x + a * Ki.y), e.copy(t), e.x += qi.x, e.y += qi.y, e.applyMatrix4(Ji);
}
var ra = /*@__PURE__*/ new I(), ia = /*@__PURE__*/ new I(), aa = class extends z {
constructor() {
super(), this.isLOD = !0, this._currentLevel = 0, this.type = "LOD", Object.defineProperties(this, { levels: {
enumerable: !0,
value: []
} }), this.autoUpdate = !0;
}
copy(e) {
super.copy(e, !1);
let t = e.levels;
for (let e = 0, n = t.length; e < n; e++) {
let n = t[e];
this.addLevel(n.object.clone(), n.distance, n.hysteresis);
}
return this.autoUpdate = e.autoUpdate, this;
}
addLevel(e, t = 0, n = 0) {
t = Math.abs(t);
let r = this.levels, i;
for (i = 0; i < r.length && !(t < r[i].distance); i++);
return r.splice(i, 0, {
distance: t,
hysteresis: n,
object: e
}), this.add(e), this;
}
removeLevel(e) {
let t = this.levels;
for (let n = 0; n < t.length; n++) if (t[n].distance === e) {
let e = t.splice(n, 1);
return this.remove(e[0].object), !0;
}
return !1;
}
getCurrentLevel() {
return this._currentLevel;
}
getObjectForDistance(e) {
let t = this.levels;
if (t.length > 0) {
let n, r;
for (n = 1, r = t.length; n < r; n++) {
let r = t[n].distance;
if (t[n].object.visible && (r -= r * t[n].hysteresis), e < r) break;
}
return t[n - 1].object;
}
return null;
}
raycast(e, t) {
if (this.levels.length > 0) {
ra.setFromMatrixPosition(this.matrixWorld);
let n = e.ray.origin.distanceTo(ra);
this.getObjectForDistance(n).raycast(e, t);
}
}
update(e) {
let t = this.levels;
if (t.length > 1) {
ra.setFromMatrixPosition(e.matrixWorld), ia.setFromMatrixPosition(this.matrixWorld);
let n = ra.distanceTo(ia) / e.zoom;
t[0].object.visible = !0;
let r, i;
for (r = 1, i = t.length; r < i; r++) {
let e = t[r].distance;
if (t[r].object.visible && (e -= e * t[r].hysteresis), n >= e) t[r - 1].object.visible = !1, t[r].object.visible = !0;
else break;
}
for (this._currentLevel = r - 1; r < i; r++) t[r].object.visible = !1;
}
}
toJSON(e) {
let t = super.toJSON(e);
this.autoUpdate === !1 && (t.object.autoUpdate = !1), t.object.levels = [];
let n = this.levels;
for (let e = 0, r = n.length; e < r; e++) {
let r = n[e];
t.object.levels.push({
object: r.object.uuid,
distance: r.distance,
hysteresis: r.hysteresis
});
}
return t;
}
}, oa = /*@__PURE__*/ new I(), sa = /*@__PURE__*/ new I(), ca = /*@__PURE__*/ new I(), la = /*@__PURE__*/ new I(), ua = /*@__PURE__*/ new I(), da = /*@__PURE__*/ new I(), fa = /*@__PURE__*/ new I(), pa = class {
constructor(e = new I(), t = new I(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.origin).addScaledVector(this.direction, e);
}
lookAt(e) {
return this.direction.copy(e).sub(this.origin).normalize(), this;
}
recast(e) {
return this.origin.copy(this.at(e, oa)), this;
}
closestPointToPoint(e, t) {
t.subVectors(e, this.origin);
let n = t.dot(this.direction);
return n < 0 ? t.copy(this.origin) : t.copy(this.origin).addScaledVector(this.direction, n);
}
distanceToPoint(e) {
return Math.sqrt(this.distanceSqToPoint(e));
}
distanceSqToPoint(e) {
let t = oa.subVectors(e, this.origin).dot(this.direction);
return t < 0 ? this.origin.distanceToSquared(e) : (oa.copy(this.origin).addScaledVector(this.direction, t), oa.distanceToSquared(e));
}
distanceSqToSegment(e, t, n, r) {
sa.copy(e).add(t).multiplyScalar(.5), ca.copy(t).sub(e).normalize(), la.copy(this.origin).sub(sa);
let i = e.distanceTo(t) * .5, a = -this.direction.dot(ca), o = la.dot(this.direction), s = -la.dot(ca), c = la.lengthSq(), l = Math.abs(1 - a * a), u, d, f, p;
if (l > 0) if (u = a * s - o, d = a * o - s, p = i * l, u >= 0) if (d >= -p) if (d <= p) {
let e = 1 / l;
u *= e, d *= e, f = u * (u + a * d + 2 * o) + d * (a * u + d + 2 * s) + c;
} else d = i, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * s) + c;
else d = -i, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * s) + c;
else d <= -p ? (u = Math.max(0, -(-a * i + o)), d = u > 0 ? -i : Math.min(Math.max(-i, -s), i), f = -u * u + d * (d + 2 * s) + c) : d <= p ? (u = 0, d = Math.min(Math.max(-i, -s), i), f = d * (d + 2 * s) + c) : (u = Math.max(0, -(a * i + o)), d = u > 0 ? i : Math.min(Math.max(-i, -s), i), f = -u * u + d * (d + 2 * s) + c);
else d = a > 0 ? -i : i, u = Math.max(0, -(a * d + o)), f = -u * u + d * (d + 2 * s) + c;
return n && n.copy(this.origin).addScaledVector(this.direction, u), r && r.copy(sa).addScaledVector(ca, d), f;
}
intersectSphere(e, t) {
oa.subVectors(e.center, this.origin);
let n = oa.dot(this.direction), r = oa.dot(oa) - n * n, i = e.radius * e.radius;
if (r > i) return null;
let a = Math.sqrt(i - r), o = n - a, s = n + a;
return s < 0 ? null : o < 0 ? this.at(s, t) : this.at(o, t);
}
intersectsSphere(e) {
return e.radius < 0 ? !1 : this.distanceSqToPoint(e.center) <= e.radius * e.radius;
}
distanceToPlane(e) {
let t = e.normal.dot(this.direction);
if (t === 0) return e.distanceToPoint(this.origin) === 0 ? 0 : null;
let n = -(this.origin.dot(e.normal) + e.constant) / t;
return n >= 0 ? n : null;
}
intersectPlane(e, t) {
let n = this.distanceToPlane(e);
return n === null ? null : this.at(n, t);
}
intersectsPlane(e) {
let t = e.distanceToPoint(this.origin);
return t === 0 || e.normal.dot(this.direction) * t < 0;
}
intersectBox(e, t) {
let n, r, i, a, o, s, c = 1 / this.direction.x, l = 1 / this.direction.y, u = 1 / this.direction.z, d = this.origin;
return c >= 0 ? (n = (e.min.x - d.x) * c, r = (e.max.x - d.x) * c) : (n = (e.max.x - d.x) * c, r = (e.min.x - d.x) * c), l >= 0 ? (i = (e.min.y - d.y) * l, a = (e.max.y - d.y) * l) : (i = (e.max.y - d.y) * l, a = (e.min.y - d.y) * l), n > a || i > r || ((i > n || isNaN(n)) && (n = i), (a < r || isNaN(r)) && (r = a), u >= 0 ? (o = (e.min.z - d.z) * u, s = (e.max.z - d.z) * u) : (o = (e.max.z - d.z) * u, s = (e.min.z - d.z) * u), n > s || o > r) || ((o > n || n !== n) && (n = o), (s < r || r !== r) && (r = s), r < 0) ? null : this.at(n >= 0 ? n : r, t);
}
intersectsBox(e) {
return this.intersectBox(e, oa) !== null;
}
intersectTriangle(e, t, n, r, i) {
ua.subVectors(t, e), da.subVectors(n, e), fa.crossVectors(ua, da);
let a = this.direction.dot(fa), o;
if (a > 0) {
if (r) return null;
o = 1;
} else if (a < 0) o = -1, a = -a;
else return null;
la.subVectors(this.origin, e);
let s = o * this.direction.dot(da.crossVectors(la, da));
if (s < 0) return null;
let c = o * this.direction.dot(ua.cross(la));
if (c < 0 || s + c > a) return null;
let l = -o * la.dot(fa);
return l < 0 ? null : this.at(l / a, i);
}
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);
}
}, ma = class extends Y {
constructor(e) {
super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new B(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.envMapRotation = new fr(), this.combine = 0, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, 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.envMapRotation.copy(e.envMapRotation), 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.fog = e.fog, this;
}
}, ha = /*@__PURE__*/ new R(), ga = /*@__PURE__*/ new pa(), _a = /*@__PURE__*/ new K(), va = /*@__PURE__*/ new I(), ya = /*@__PURE__*/ new I(), ba = /*@__PURE__*/ new I(), xa = /*@__PURE__*/ new I(), Sa = /*@__PURE__*/ new I(), Ca = /*@__PURE__*/ new I(), wa = /*@__PURE__*/ new I(), Ta = /*@__PURE__*/ new I(), Ea = class extends z {
constructor(e = new J(), t = new ma()) {
super(), this.isMesh = !0, this.type = "Mesh", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.count = 1, this.updateMorphTargets();
}
copy(e, t) {
return super.copy(e, t), e.morphTargetInfluences !== void 0 && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), e.morphTargetDictionary !== void 0 && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;
}
updateMorphTargets() {
let e = this.geometry.morphAttributes, t = Object.keys(e);
if (t.length > 0) {
let n = e[t[0]];
if (n !== void 0) {
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
for (let e = 0, t = n.length; e < t; e++) {
let t = n[e].name || String(e);
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e;
}
}
}
}
getVertexPosition(e, t) {
let n = this.geometry, r = n.attributes.position, i = n.morphAttributes.position, a = n.morphTargetsRelative;
t.fromBufferAttribute(r, e);
let o = this.morphTargetInfluences;
if (i && o) {
Ca.set(0, 0, 0);
for (let n = 0, r = i.length; n < r; n++) {
let r = o[n], s = i[n];
r !== 0 && (Sa.fromBufferAttribute(s, e), a ? Ca.addScaledVector(Sa, r) : Ca.addScaledVector(Sa.sub(t), r));
}
t.add(Ca);
}
return t;
}
raycast(e, t) {
let n = this.geometry, r = this.material, i = this.matrixWorld;
r !== void 0 && (n.boundingSphere === null && n.computeBoundingSphere(), _a.copy(n.boundingSphere), _a.applyMatrix4(i), ga.copy(e.ray).recast(e.near), !(_a.containsPoint(ga.origin) === !1 && (ga.intersectSphere(_a, va) === null || ga.origin.distanceToSquared(va) > (e.far - e.near) ** 2)) && (ha.copy(i).invert(), ga.copy(e.ray).applyMatrix4(ha), !(n.boundingBox !== null && ga.intersectsBox(n.boundingBox) === !1) && this._computeIntersections(e, t, ga)));
}
_computeIntersections(e, t, n) {
let r, i = this.geometry, a = this.material, o = i.index, s = i.attributes.position, c = i.attributes.uv, l = i.attributes.uv1, u = i.attributes.normal, d = i.groups, f = i.drawRange;
if (o !== null) if (Array.isArray(a)) for (let i = 0, s = d.length; i < s; i++) {
let s = d[i], p = a[s.materialIndex], m = Math.max(s.start, f.start), h = Math.min(o.count, Math.min(s.start + s.count, f.start + f.count));
for (let i = m, a = h; i < a; i += 3) {
let a = o.getX(i), d = o.getX(i + 1), f = o.getX(i + 2);
r = Oa(this, p, e, n, c, l, u, a, d, f), r && (r.faceIndex = Math.floor(i / 3), r.face.materialIndex = s.materialIndex, t.push(r));
}
}
else {
let i = Math.max(0, f.start), s = Math.min(o.count, f.start + f.count);
for (let d = i, f = s; d < f; d += 3) {
let i = o.getX(d), s = o.getX(d + 1), f = o.getX(d + 2);
r = Oa(this, a, e, n, c, l, u, i, s, f), r && (r.faceIndex = Math.floor(d / 3), t.push(r));
}
}
else if (s !== void 0) if (Array.isArray(a)) for (let i = 0, o = d.length; i < o; i++) {
let o = d[i], p = a[o.materialIndex], m = Math.max(o.start, f.start), h = Math.min(s.count, Math.min(o.start + o.count, f.start + f.count));
for (let i = m, a = h; i < a; i += 3) {
let a = i, s = i + 1, d = i + 2;
r = Oa(this, p, e, n, c, l, u, a, s, d), r && (r.faceIndex = Math.floor(i / 3), r.face.materialIndex = o.materialIndex, t.push(r));
}
}
else {
let i = Math.max(0, f.start), o = Math.min(s.count, f.start + f.count);
for (let s = i, d = o; s < d; s += 3) {
let i = s, o = s + 1, d = s + 2;
r = Oa(this, a, e, n, c, l, u, i, o, d), r && (r.faceIndex = Math.floor(s / 3), t.push(r));
}
}
}
};
function Da(e, t, n, r, i, a, o, s) {
let c;
if (c = t.side === 1 ? r.intersectTriangle(o, a, i, !0, s) : r.intersectTriangle(i, a, o, t.side === 0, s), c === null) return null;
Ta.copy(s), Ta.applyMatrix4(e.matrixWorld);
let l = n.ray.origin.distanceTo(Ta);
return l < n.near || l > n.far ? null : {
distance: l,
point: Ta.clone(),
object: e
};
}
function Oa(e, t, n, r, i, a, o, s, c, l) {
e.getVertexPosition(s, ya), e.getVertexPosition(c, ba), e.getVertexPosition(l, xa);
let u = Da(e, t, n, r, ya, ba, xa, wa);
if (u) {
let e = new I();
Qr.getBarycoord(wa, ya, ba, xa, e), i && (u.uv = Qr.getInterpolatedAttribute(i, s, c, l, e, new F())), a && (u.uv1 = Qr.getInterpolatedAttribute(a, s, c, l, e, new F())), o && (u.normal = Qr.getInterpolatedAttribute(o, s, c, l, e, new I()), u.normal.dot(r.direction) > 0 && u.normal.multiplyScalar(-1));
let t = {
a: s,
b: c,
c: l,
normal: new I(),
materialIndex: 0
};
Qr.getNormal(ya, ba, xa, t.normal), u.face = t, u.barycoord = e;
}
return u;
}
var ka = /*@__PURE__*/ new Xn(), Aa = /*@__PURE__*/ new Xn(), ja = /*@__PURE__*/ new Xn(), Ma = /*@__PURE__*/ new Xn(), Na = /*@__PURE__*/ new R(), Pa = /*@__PURE__*/ new I(), Fa = /*@__PURE__*/ new K(), Ia = /*@__PURE__*/ new R(), La = /*@__PURE__*/ new pa(), Ra = class extends Ea {
constructor(e, t) {
super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = d, this.bindMatrix = new R(), this.bindMatrixInverse = new R(), this.boundingBox = null, this.boundingSphere = null;
}
computeBoundingBox() {
let e = this.geometry;
this.boundingBox === null && (this.boundingBox = new H()), this.boundingBox.makeEmpty();
let t = e.getAttribute("position");
for (let e = 0; e < t.count; e++) this.getVertexPosition(e, Pa), this.boundingBox.expandByPoint(Pa);
}
computeBoundingSphere() {
let e = this.geometry;
this.boundingSphere === null && (this.boundingSphere = new K()), this.boundingSphere.makeEmpty();
let t = e.getAttribute("position");
for (let e = 0; e < t.count; e++) this.getVertexPosition(e, Pa), this.boundingSphere.expandByPoint(Pa);
}
copy(e, t) {
return super.copy(e, t), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this;
}
raycast(e, t) {
let n = this.material, r = this.matrixWorld;
n !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), Fa.copy(this.boundingSphere), Fa.applyMatrix4(r), e.ray.intersectsSphere(Fa) !== !1 && (Ia.copy(r).invert(), La.copy(e.ray).applyMatrix4(Ia), !(this.boundingBox !== null && La.intersectsBox(this.boundingBox) === !1) && this._computeIntersections(e, t, La)));
}
getVertexPosition(e, t) {
return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t;
}
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() {
let e = new Xn(), t = this.geometry.attributes.skinWeight;
for (let n = 0, r = t.count; n < r; n++) {
e.fromBufferAttribute(t, n);
let r = 1 / e.manhattanLength();
r === Infinity ? e.set(1, 0, 0, 0) : e.multiplyScalar(r), t.setXYZW(n, 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() : j("SkinnedMesh: Unrecognized bindMode: " + this.bindMode);
}
applyBoneTransform(e, t) {
let n = this.skeleton, r = this.geometry;
Aa.fromBufferAttribute(r.attributes.skinIndex, e), ja.fromBufferAttribute(r.attributes.skinWeight, e), t.isVector4 ? (ka.copy(t), t.set(0, 0, 0, 0)) : (ka.set(...t, 1), t.set(0, 0, 0)), ka.applyMatrix4(this.bindMatrix);
for (let e = 0; e < 4; e++) {
let r = ja.getComponent(e);
if (r !== 0) {
let i = Aa.getComponent(e);
Na.multiplyMatrices(n.bones[i].matrixWorld, n.boneInverses[i]), t.addScaledVector(Ma.copy(ka).applyMatrix4(Na), r);
}
}
return t.isVector4 && (t.w = ka.w), t.applyMatrix4(this.bindMatrixInverse);
}
}, za = class extends z {
constructor() {
super(), this.isBone = !0, this.type = "Bone";
}
}, Ba = class extends L {
constructor(e = null, t = 1, n = 1, r, i, a, o, s, c = g, l = g, u, d) {
super(null, a, o, s, c, l, r, i, u, d), this.isDataTexture = !0, this.image = {
data: e,
width: t,
height: n
}, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1;
}
}, Va = /*@__PURE__*/ new R(), Ha = /*@__PURE__*/ new R(), Ua = class e {
constructor(e = [], t = []) {
this.uuid = dn(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init();
}
init() {
let 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) {
j("Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = [];
for (let e = 0, t = this.bones.length; e < t; e++) this.boneInverses.push(new R());
}
}
calculateInverses() {
this.boneInverses.length = 0;
for (let e = 0, t = this.bones.length; e < t; e++) {
let t = new R();
this.bones[e] && t.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(t);
}
}
pose() {
for (let e = 0, t = this.bones.length; e < t; e++) {
let t = this.bones[e];
t && t.matrixWorld.copy(this.boneInverses[e]).invert();
}
for (let e = 0, t = this.bones.length; e < t; e++) {
let t = this.bones[e];
t && (t.parent && t.parent.isBone ? (t.matrix.copy(t.parent.matrixWorld).invert(), t.matrix.multiply(t.matrixWorld)) : t.matrix.copy(t.matrixWorld), t.matrix.decompose(t.position, t.quaternion, t.scale));
}
}
update() {
let e = this.bones, t = this.boneInverses, n = this.boneMatrices, r = this.boneTexture;
for (let r = 0, i = e.length; r < i; r++) {
let i = e[r] ? e[r].matrixWorld : Ha;
Va.multiplyMatrices(i, t[r]), Va.toArray(n, r * 16);
}
r !== null && (r.needsUpdate = !0);
}
clone() {
return new e(this.bones, this.boneInverses);
}
computeBoneTexture() {
let e = Math.sqrt(this.bones.length * 4);
e = Math.ceil(e / 4) * 4, e = Math.max(e, 4);
let t = new Float32Array(e * e * 4);
t.set(this.boneMatrices);
let n = new Ba(t, e, e, ue, te);
return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this;
}
getBoneByName(e) {
for (let t = 0, n = this.bones.length; t < n; t++) {
let n = this.bones[t];
if (n.name === e) return n;
}
}
dispose() {
this.boneTexture !== null && (this.boneTexture.dispose(), this.boneTexture = null);
}
fromJSON(e, t) {
this.uuid = e.uuid;
for (let n = 0, r = e.bones.length; n < r; n++) {
let r = e.bones[n], i = t[r];
i === void 0 && (j("Skeleton: No bone found with UUID:", r), i = new za()), this.bones.push(i), this.boneInverses.push(new R().fromArray(e.boneInverses[n]));
}
return this.init(), this;
}
toJSON() {
let e = {
metadata: {
version: 4.7,
type: "Skeleton",
generator: "Skeleton.toJSON"
},
bones: [],
boneInverses: []
};
e.uuid = this.uuid;
let t = this.bones, n = this.boneInverses;
for (let r = 0, i = t.length; r < i; r++) {
let i = t[r];
e.bones.push(i.uuid);
let a = n[r];
e.boneInverses.push(a.toArray());
}
return e;
}
}, Wa = class extends W {
constructor(e, t, n, r = 1) {
super(e, t, n), this.isInstancedBufferAttribute = !0, this.meshPerAttribute = r;
}
copy(e) {
return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this;
}
toJSON() {
let e = super.toJSON();
return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e;
}
}, Ga = /*@__PURE__*/ new R(), Ka = /*@__PURE__*/ new R(), qa = [], Ja = /*@__PURE__*/ new H(), Ya = /*@__PURE__*/ new R(), Xa = /*@__PURE__*/ new Ea(), Za = /*@__PURE__*/ new K(), Qa = class extends Ea {
constructor(e, t, n) {
super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new Wa(new Float32Array(n * 16), 16), this.instanceColor = null, this.morphTexture = null, this.count = n, this.boundingBox = null, this.boundingSphere = null;
for (let e = 0; e < n; e++) this.setMatrixAt(e, Ya);
}
computeBoundingBox() {
let e = this.geometry, t = this.count;
this.boundingBox === null && (this.boundingBox = new H()), e.boundingBox === null && e.computeBoundingBox(), this.boundingBox.makeEmpty();
for (let n = 0; n < t; n++) this.getMatrixAt(n, Ga), Ja.copy(e.boundingBox).applyMatrix4(Ga), this.boundingBox.union(Ja);
}
computeBoundingSphere() {
let e = this.geometry, t = this.count;
this.boundingSphere === null && (this.boundingSphere = new K()), e.boundingSphere === null && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
for (let n = 0; n < t; n++) this.getMatrixAt(n, Ga), Za.copy(e.boundingSphere).applyMatrix4(Ga), this.boundingSphere.union(Za);
}
copy(e, t) {
return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), e.morphTexture !== null && (this.morphTexture = e.morphTexture.clone()), e.instanceColor !== null && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, e.boundingBox !== null && (this.boundingBox = e.boundingBox.clone()), e.boundingSphere !== null && (this.boundingSphere = e.boundingSphere.clone()), this;
}
getColorAt(e, t) {
return this.instanceColor === null ? t.setRGB(1, 1, 1) : t.fromArray(this.instanceColor.array, e * 3);
}
getMatrixAt(e, t) {
return t.fromArray(this.instanceMatrix.array, e * 16);
}
getMorphAt(e, t) {
let n = t.morphTargetInfluences, r = this.morphTexture.source.data.data, i = e * (n.length + 1) + 1;
for (let e = 0; e < n.length; e++) n[e] = r[i + e];
}
raycast(e, t) {
let n = this.matrixWorld, r = this.count;
if (Xa.geometry = this.geometry, Xa.material = this.material, Xa.material !== void 0 && (this.boundingSphere === null && this.computeBoundingSphere(), Za.copy(this.boundingSphere), Za.applyMatrix4(n), e.ray.intersectsSphere(Za) !== !1)) for (let i = 0; i < r; i++) {
this.getMatrixAt(i, Ga), Ka.multiplyMatrices(n, Ga), Xa.matrixWorld = Ka, Xa.raycast(e, qa);
for (let e = 0, n = qa.length; e < n; e++) {
let n = qa[e];
n.instanceId = i, n.object = this, t.push(n);
}
qa.length = 0;
}
}
setColorAt(e, t) {
return this.instanceColor === null && (this.instanceColor = new Wa(new Float32Array(this.instanceMatrix.count * 3).fill(1), 3)), t.toArray(this.instanceColor.array, e * 3), this;
}
setMatrixAt(e, t) {
return t.toArray(this.instanceMatrix.array, e * 16), this;
}
setMorphAt(e, t) {
let n = t.morphTargetInfluences, r = n.length + 1;
this.morphTexture === null && (this.morphTexture = new Ba(new Float32Array(r * this.count), r, this.count, pe, te));
let i = this.morphTexture.source.data.data, a = 0;
for (let e = 0; e < n.length; e++) a += n[e];
let o = this.geometry.morphTargetsRelative ? 1 : 1 - a, s = r * e;
return i[s] = o, i.set(n, s + 1), this;
}
updateMorphTargets() {}
dispose() {
this.dispatchEvent({ type: "dispose" }), this.morphTexture !== null && (this.morphTexture.dispose(), this.morphTexture = null);
}
}, $a = /*@__PURE__*/ new I(), eo = /*@__PURE__*/ new I(), to = /*@__PURE__*/ new Fn(), no = class {
constructor(e = new I(1, 0, 0), t = 0) {
this.isPlane = !0, this.normal = e, this.constant = t;
}
set(e, t) {
return this.normal.copy(e), this.constant = t, this;
}
setComponents(e, t, n, r) {
return this.normal.set(e, t, n), this.constant = r, this;
}
setFromNormalAndCoplanarPoint(e, t) {
return this.normal.copy(e), this.constant = -t.dot(this.normal), this;
}
setFromCoplanarPoints(e, t, n) {
let r = $a.subVectors(n, t).cross(eo.subVectors(e, t)).normalize();
return this.setFromNormalAndCoplanarPoint(r, e), this;
}
copy(e) {
return this.normal.copy(e.normal), this.constant = e.constant, this;
}
normalize() {
let 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(e).addScaledVector(this.normal, -this.distanceToPoint(e));
}
intersectLine(e, t, n = !0) {
let r = e.delta($a), i = this.normal.dot(r);
if (i === 0) return this.distanceToPoint(e.start) === 0 ? t.copy(e.start) : null;
let a = -(e.start.dot(this.normal) + this.constant) / i;
return n === !0 && (a < 0 || a > 1) ? null : t.copy(e.start).addScaledVector(r, a);
}
intersectsLine(e) {
let t = this.distanceToPoint(e.start), n = this.distanceToPoint(e.end);
return t < 0 && n > 0 || n < 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) {
let n = t || to.getNormalMatrix(e), r = this.coplanarPoint($a).applyMatrix4(e), i = this.normal.applyMatrix3(n).normalize();
return this.constant = -r.dot(i), 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);
}
}, ro = /*@__PURE__*/ new K(), io = /*@__PURE__*/ new F(.5, .5), ao = /*@__PURE__*/ new I(), oo = class {
constructor(e = new no(), t = new no(), n = new no(), r = new no(), i = new no(), a = new no()) {
this.planes = [
e,
t,
n,
r,
i,
a
];
}
set(e, t, n, r, i, a) {
let o = this.planes;
return o[0].copy(e), o[1].copy(t), o[2].copy(n), o[3].copy(r), o[4].copy(i), o[5].copy(a), this;
}
copy(e) {
let t = this.planes;
for (let n = 0; n < 6; n++) t[n].copy(e.planes[n]);
return this;
}
setFromProjectionMatrix(e, t = Rt, n = !1) {
let r = this.planes, i = e.elements, a = i[0], o = i[1], s = i[2], c = i[3], l = i[4], u = i[5], d = i[6], f = i[7], p = i[8], m = i[9], h = i[10], g = i[11], _ = i[12], v = i[13], y = i[14], b = i[15];
if (r[0].setComponents(c - a, f - l, g - p, b - _).normalize(), r[1].setComponents(c + a, f + l, g + p, b + _).normalize(), r[2].setComponents(c + o, f + u, g + m, b + v).normalize(), r[3].setComponents(c - o, f - u, g - m, b - v).normalize(), n) r[4].setComponents(s, d, h, y).normalize(), r[5].setComponents(c - s, f - d, g - h, b - y).normalize();
else if (r[4].setComponents(c - s, f - d, g - h, b - y).normalize(), t === 2e3) r[5].setComponents(c + s, f + d, g + h, b + y).normalize();
else if (t === 2001) r[5].setComponents(s, d, h, y).normalize();
else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t);
return this;
}
intersectsObject(e) {
if (e.boundingSphere !== void 0) e.boundingSphere === null && e.computeBoundingSphere(), ro.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);
else {
let t = e.geometry;
t.boundingSphere === null && t.computeBoundingSphere(), ro.copy(t.boundingSphere).applyMatrix4(e.matrixWorld);
}
return this.intersectsSphere(ro);
}
intersectsSprite(e) {
return ro.center.set(0, 0, 0), ro.radius = .7071067811865476 + io.distanceTo(e.center), ro.applyMatrix4(e.matrixWorld), this.intersectsSphere(ro);
}
intersectsSphere(e) {
let t = this.planes, n = e.center, r = -e.radius;
for (let e = 0; e < 6; e++) if (t[e].distanceToPoint(n) < r) return !1;
return !0;
}
intersectsBox(e) {
let t = this.planes;
for (let n = 0; n < 6; n++) {
let r = t[n];
if (ao.x = r.normal.x > 0 ? e.max.x : e.min.x, ao.y = r.normal.y > 0 ? e.max.y : e.min.y, ao.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(ao) < 0) return !1;
}
return !0;
}
containsPoint(e) {
let t = this.planes;
for (let n = 0; n < 6; n++) if (t[n].distanceToPoint(e) < 0) return !1;
return !0;
}
clone() {
return new this.constructor().copy(this);
}
}, so = /*@__PURE__*/ new R(), co = class e {
constructor() {
this.coordinateSystem = Rt, this._frustums = [], this._count = 0;
}
setFromArrayCamera(e) {
let t = e.cameras, n = this._frustums;
for (let e = 0; e < t.length; e++) {
let r = t[e];
so.multiplyMatrices(r.projectionMatrix, r.matrixWorldInverse), n[e] === void 0 && (n[e] = new oo()), n[e].setFromProjectionMatrix(so, r.coordinateSystem, r.reversedDepth);
}
return this._count = t.length, this;
}
intersectsObject(e) {
let t = this._frustums;
for (let n = 0; n < this._count; n++) if (t[n].intersectsObject(e)) return !0;
return !1;
}
intersectsSprite(e) {
let t = this._frustums;
for (let n = 0; n < this._count; n++) if (t[n].intersectsSprite(e)) return !0;
return !1;
}
intersectsSphere(e) {
let t = this._frustums;
for (let n = 0; n < this._count; n++) if (t[n].intersectsSphere(e)) return !0;
return !1;
}
intersectsBox(e) {
let t = this._frustums;
for (let n = 0; n < this._count; n++) if (t[n].intersectsBox(e)) return !0;
return !1;
}
containsPoint(e) {
let t = this._frustums;
for (let n = 0; n < this._count; n++) if (t[n].containsPoint(e)) return !0;
return !1;
}
copy(e) {
this.coordinateSystem = e.coordinateSystem;
let t = this._frustums, n = e._frustums;
for (let r = 0; r < e._count; r++) t[r] === void 0 && (t[r] = new oo()), t[r].copy(n[r]);
return this._count = e._count, this;
}
clone() {
return new e().copy(this);
}
};
function lo(e, t) {
return e - t;
}
function uo(e, t) {
return e.z - t.z;
}
function fo(e, t) {
return t.z - e.z;
}
var po = class {
constructor() {
this.index = 0, this.pool = [], this.list = [];
}
push(e, t, n, r) {
let i = this.pool, a = this.list;
this.index >= i.length && i.push({
start: -1,
count: -1,
z: -1,
index: -1
});
let o = i[this.index];
a.push(o), this.index++, o.start = e, o.count = t, o.z = n, o.index = r;
}
reset() {
this.list.length = 0, this.index = 0;
}
}, mo = /*@__PURE__*/ new R(), ho = /*@__PURE__*/ new B(1, 1, 1), go = /*@__PURE__*/ new oo(), _o = /*@__PURE__*/ new co(), vo = /*@__PURE__*/ new H(), yo = /*@__PURE__*/ new K(), bo = /*@__PURE__*/ new I(), xo = /*@__PURE__*/ new I(), So = /*@__PURE__*/ new I(), Co = /*@__PURE__*/ new po(), wo = /*@__PURE__*/ new Ea(), To = [];
function Eo(e, t, n = 0) {
let r = t.itemSize;
if (e.isInterleavedBufferAttribute || e.array.constructor !== t.array.constructor) {
let i = e.count;
for (let a = 0; a < i; a++) for (let i = 0; i < r; i++) t.setComponent(a + n, i, e.getComponent(a, i));
} else t.array.set(e.array, n * r);
t.needsUpdate = !0;
}
function Do(e, t) {
if (e.constructor !== t.constructor) {
let n = Math.min(e.length, t.length);
for (let r = 0; r < n; r++) t[r] = e[r];
} else {
let n = Math.min(e.length, t.length);
t.set(new e.constructor(e.buffer, 0, n));
}
}
var Oo = class extends Ea {
constructor(e, t, n = t * 2, r) {
super(new J(), r), this.isBatchedMesh = !0, this.perObjectFrustumCulled = !0, this.sortObjects = !0, this.boundingBox = null, this.boundingSphere = null, this.customSort = null, this._instanceInfo = [], this._geometryInfo = [], this._availableInstanceIds = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._visibilityChanged = !0, this._geometryInitialized = !1, this._maxInstanceCount = e, this._maxVertexCount = t, this._maxIndexCount = n, this._multiDrawCounts = new Int32Array(e), this._multiDrawStarts = new Int32Array(e), this._multiDrawCount = 0, this._matricesTexture = null, this._indirectTexture = null, this._colorsTexture = null, this._initMatricesTexture(), this._initIndirectTexture();
}
get maxInstanceCount() {
return this._maxInstanceCount;
}
get instanceCount() {
return this._instanceInfo.length - this._availableInstanceIds.length;
}
get unusedVertexCount() {
return this._maxVertexCount - this._nextVertexStart;
}
get unusedIndexCount() {
return this._maxIndexCount - this._nextIndexStart;
}
_initMatricesTexture() {
let e = Math.sqrt(this._maxInstanceCount * 4);
e = Math.ceil(e / 4) * 4, e = Math.max(e, 4);
let t = new Ba(new Float32Array(e * e * 4), e, e, ue, te);
this._matricesTexture = t;
}
_initIndirectTexture() {
let e = Math.sqrt(this._maxInstanceCount);
e = Math.ceil(e);
let t = new Ba(new Uint32Array(e * e), e, e, me, ee);
this._indirectTexture = t;
}
_initColorsTexture() {
let e = Math.sqrt(this._maxInstanceCount);
e = Math.ceil(e);
let t = new Ba(new Float32Array(e * e * 4).fill(1), e, e, ue, te);
t.colorSpace = Bn.workingColorSpace, this._colorsTexture = t;
}
_initializeGeometry(e) {
let t = this.geometry, n = this._maxVertexCount, r = this._maxIndexCount;
if (this._geometryInitialized === !1) {
for (let r in e.attributes) {
let { array: i, itemSize: a, normalized: o } = e.getAttribute(r), s = new W(new i.constructor(n * a), a, o);
t.setAttribute(r, s);
}
if (e.getIndex() !== null) {
let e = n > 65535 ? new Uint32Array(r) : new Uint16Array(r);
t.setIndex(new W(e, 1));
}
this._geometryInitialized = !0;
}
}
_validateGeometry(e) {
let t = this.geometry;
if (!!e.getIndex() != !!t.getIndex()) throw Error("THREE.BatchedMesh: All geometries must consistently have \"index\".");
for (let n in t.attributes) {
if (!e.hasAttribute(n)) throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);
let r = e.getAttribute(n), i = t.getAttribute(n);
if (r.itemSize !== i.itemSize || r.normalized !== i.normalized) throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.");
}
}
validateInstanceId(e) {
let t = this._instanceInfo;
if (e < 0 || e >= t.length || t[e].active === !1) throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`);
}
validateGeometryId(e) {
let t = this._geometryInfo;
if (e < 0 || e >= t.length || t[e].active === !1) throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`);
}
setCustomSort(e) {
return this.customSort = e, this;
}
computeBoundingBox() {
this.boundingBox === null && (this.boundingBox = new H());
let e = this.boundingBox, t = this._instanceInfo;
e.makeEmpty();
for (let n = 0, r = t.length; n < r; n++) {
if (t[n].active === !1) continue;
let r = t[n].geometryIndex;
this.getMatrixAt(n, mo), this.getBoundingBoxAt(r, vo).applyMatrix4(mo), e.union(vo);
}
}
computeBoundingSphere() {
this.boundingSphere === null && (this.boundingSphere = new K());
let e = this.boundingSphere, t = this._instanceInfo;
e.makeEmpty();
for (let n = 0, r = t.length; n < r; n++) {
if (t[n].active === !1) continue;
let r = t[n].geometryIndex;
this.getMatrixAt(n, mo), this.getBoundingSphereAt(r, yo).applyMatrix4(mo), e.union(yo);
}
}
addInstance(e) {
if (this._instanceInfo.length >= this.maxInstanceCount && this._availableInstanceIds.length === 0) throw Error("THREE.BatchedMesh: Maximum item count reached.");
let t = {
visible: !0,
active: !0,
geometryIndex: e
}, n = null;
this._availableInstanceIds.length > 0 ? (this._availableInstanceIds.sort(lo), n = this._availableInstanceIds.shift(), this._instanceInfo[n] = t) : (n = this._instanceInfo.length, this._instanceInfo.push(t));
let r = this._matricesTexture;
mo.identity().toArray(r.image.data, n * 16), r.needsUpdate = !0;
let i = this._colorsTexture;
return i && (ho.toArray(i.image.data, n * 4), i.needsUpdate = !0), this._visibilityChanged = !0, n;
}
addGeometry(e, t = -1, n = -1) {
this._initializeGeometry(e), this._validateGeometry(e);
let r = {
vertexStart: -1,
vertexCount: -1,
reservedVertexCount: -1,
indexStart: -1,
indexCount: -1,
reservedIndexCount: -1,
start: -1,
count: -1,
boundingBox: null,
boundingSphere: null,
active: !0
}, i = this._geometryInfo;
r.vertexStart = this._nextVertexStart, r.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
let a = e.getIndex();
if (a !== null && (r.indexStart = this._nextIndexStart, r.reservedIndexCount = n === -1 ? a.count : n), r.indexStart !== -1 && r.indexStart + r.reservedIndexCount > this._maxIndexCount || r.vertexStart + r.reservedVertexCount > this._maxVertexCount) throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");
let o;
return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(lo), o = this._availableGeometryIds.shift(), i[o] = r) : (o = this._geometryCount, this._geometryCount++, i.push(r)), this.setGeometryAt(o, e), this._nextIndexStart = r.indexStart + r.reservedIndexCount, this._nextVertexStart = r.vertexStart + r.reservedVertexCount, o;
}
setGeometryAt(e, t) {
if (e >= this._geometryCount) throw Error("THREE.BatchedMesh: Maximum geometry count reached.");
this._validateGeometry(t);
let n = this.geometry, r = n.getIndex() !== null, i = n.getIndex(), a = t.getIndex(), o = this._geometryInfo[e];
if (r && a.count > o.reservedIndexCount || t.attributes.position.count > o.reservedVertexCount) throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");
let s = o.vertexStart, c = o.reservedVertexCount;
o.vertexCount = t.getAttribute("position").count;
for (let e in n.attributes) {
let r = t.getAttribute(e), i = n.getAttribute(e);
Eo(r, i, s);
let a = r.itemSize;
for (let e = r.count, t = c; e < t; e++) {
let t = s + e;
for (let e = 0; e < a; e++) i.setComponent(t, e, 0);
}
i.needsUpdate = !0, i.addUpdateRange(s * a, c * a);
}
if (r) {
let e = o.indexStart, n = o.reservedIndexCount;
o.indexCount = t.getIndex().count;
for (let t = 0; t < a.count; t++) i.setX(e + t, s + a.getX(t));
for (let t = a.count, r = n; t < r; t++) i.setX(e + t, s);
i.needsUpdate = !0, i.addUpdateRange(e, o.reservedIndexCount);
}
return o.start = r ? o.indexStart : o.vertexStart, o.count = r ? o.indexCount : o.vertexCount, o.boundingBox = null, t.boundingBox !== null && (o.boundingBox = t.boundingBox.clone()), o.boundingSphere = null, t.boundingSphere !== null && (o.boundingSphere = t.boundingSphere.clone()), this._visibilityChanged = !0, e;
}
deleteGeometry(e) {
let t = this._geometryInfo;
if (e >= t.length || t[e].active === !1) return this;
let n = this._instanceInfo;
for (let t = 0, r = n.length; t < r; t++) n[t].active && n[t].geometryIndex === e && this.deleteInstance(t);
return t[e].active = !1, this._availableGeometryIds.push(e), this._visibilityChanged = !0, this;
}
deleteInstance(e) {
return this.validateInstanceId(e), this._instanceInfo[e].active = !1, this._availableInstanceIds.push(e), this._visibilityChanged = !0, this;
}
optimize() {
let e = 0, t = 0, n = this._geometryInfo, r = n.map((e, t) => t).sort((e, t) => n[e].vertexStart - n[t].vertexStart), i = this.geometry;
for (let a = 0, o = n.length; a < o; a++) {
let o = n[r[a]];
if (o.active !== !1) {
if (i.index !== null) {
if (o.indexStart !== t) {
let { indexStart: n, vertexStart: r, reservedIndexCount: a } = o, s = i.index, c = s.array, l = e - r;
for (let e = n; e < n + a; e++) c[e] = c[e] + l;
s.array.copyWithin(t, n, n + a), s.addUpdateRange(t, a), s.needsUpdate = !0, o.indexStart = t;
}
t += o.reservedIndexCount;
}
if (o.vertexStart !== e) {
let { vertexStart: t, reservedVertexCount: n } = o, r = i.attributes;
for (let i in r) {
let a = r[i], { array: o, itemSize: s } = a;
o.copyWithin(e * s, t * s, (t + n) * s), a.addUpdateRange(e * s, n * s), a.needsUpdate = !0;
}
o.vertexStart = e;
}
e += o.reservedVertexCount, o.start = i.index ? o.indexStart : o.vertexStart;
}
}
return this._nextIndexStart = t, this._nextVertexStart = e, this._visibilityChanged = !0, this;
}
getBoundingBoxAt(e, t) {
if (e >= this._geometryCount) return null;
let n = this.geometry, r = this._geometryInfo[e];
if (r.boundingBox === null) {
let e = new H(), t = n.index, i = n.attributes.position;
for (let n = r.start, a = r.start + r.count; n < a; n++) {
let r = n;
t && (r = t.getX(r)), e.expandByPoint(bo.fromBufferAttribute(i, r));
}
r.boundingBox = e;
}
return t.copy(r.boundingBox), t;
}
getBoundingSphereAt(e, t) {
if (e >= this._geometryCount) return null;
let n = this.geometry, r = this._geometryInfo[e];
if (r.boundingSphere === null) {
let t = new K();
this.getBoundingBoxAt(e, vo), vo.getCenter(t.center);
let i = n.index, a = n.attributes.position, o = 0;
for (let e = r.start, n = r.start + r.count; e < n; e++) {
let n = e;
i && (n = i.getX(n)), bo.fromBufferAttribute(a, n), o = Math.max(o, t.center.distanceToSquared(bo));
}
t.radius = Math.sqrt(o), r.boundingSphere = t;
}
return t.copy(r.boundingSphere), t;
}
setMatrixAt(e, t) {
this.validateInstanceId(e);
let n = this._matricesTexture, r = this._matricesTexture.image.data;
return t.toArray(r, e * 16), n.needsUpdate = !0, this;
}
getMatrixAt(e, t) {
return this.validateInstanceId(e), t.fromArray(this._matricesTexture.image.data, e * 16);
}
setColorAt(e, t) {
return this.validateInstanceId(e), this._colorsTexture === null && this._initColorsTexture(), t.toArray(this._colorsTexture.image.data, e * 4), this._colorsTexture.needsUpdate = !0, this;
}
getColorAt(e, t) {
return this.validateInstanceId(e), this._colorsTexture === null ? t.isVector4 ? t.set(1, 1, 1, 1) : t.setRGB(1, 1, 1) : t.fromArray(this._colorsTexture.image.data, e * 4);
}
setVisibleAt(e, t) {
return this.validateInstanceId(e), this._instanceInfo[e].visible === t ? this : (this._instanceInfo[e].visible = t, this._visibilityChanged = !0, this);
}
getVisibleAt(e) {
return this.validateInstanceId(e), this._instanceInfo[e].visible;
}
setGeometryIdAt(e, t) {
return this.validateInstanceId(e), this.validateGeometryId(t), this._instanceInfo[e].geometryIndex = t, this;
}
getGeometryIdAt(e) {
return this.validateInstanceId(e), this._instanceInfo[e].geometryIndex;
}
getGeometryRangeAt(e, t = {}) {
this.validateGeometryId(e);
let n = this._geometryInfo[e];
return t.vertexStart = n.vertexStart, t.vertexCount = n.vertexCount, t.reservedVertexCount = n.reservedVertexCount, t.indexStart = n.indexStart, t.indexCount = n.indexCount, t.reservedIndexCount = n.reservedIndexCount, t.start = n.start, t.count = n.count, t;
}
setInstanceCount(e) {
let t = this._availableInstanceIds, n = this._instanceInfo;
for (t.sort(lo); t[t.length - 1] === n.length - 1;) n.pop(), t.pop();
if (e < n.length) throw Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);
let r = new Int32Array(e), i = new Int32Array(e);
Do(this._multiDrawCounts, r), Do(this._multiDrawStarts, i), this._multiDrawCounts = r, this._multiDrawStarts = i, this._maxInstanceCount = e;
let a = this._indirectTexture, o = this._matricesTexture, s = this._colorsTexture;
a.dispose(), this._initIndirectTexture(), Do(a.image.data, this._indirectTexture.image.data), o.dispose(), this._initMatricesTexture(), Do(o.image.data, this._matricesTexture.image.data), s && (s.dispose(), this._initColorsTexture(), Do(s.image.data, this._colorsTexture.image.data));
}
setGeometrySize(e, t) {
let n = [...this._geometryInfo].filter((e) => e.active);
if (Math.max(...n.map((e) => e.vertexStart + e.reservedVertexCount)) > e) throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);
if (this.geometry.index && Math.max(...n.map((e) => e.indexStart + e.reservedIndexCount)) > t) throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);
let r = this.geometry;
r.dispose(), this._maxVertexCount = e, this._maxIndexCount = t, this._geometryInitialized && (this._geometryInitialized = !1, this.geometry = new J(), this._initializeGeometry(r));
let i = this.geometry;
r.index && Do(r.index.array, i.index.array);
for (let e in r.attributes) Do(r.attributes[e].array, i.attributes[e].array);
}
raycast(e, t) {
let n = this._instanceInfo, r = this._geometryInfo, i = this.matrixWorld, a = this.geometry;
wo.material = this.material, wo.geometry.index = a.index, wo.geometry.attributes = a.attributes, wo.geometry.boundingBox === null && (wo.geometry.boundingBox = new H()), wo.geometry.boundingSphere === null && (wo.geometry.boundingSphere = new K());
for (let a = 0, o = n.length; a < o; a++) {
if (!n[a].visible || !n[a].active) continue;
let o = n[a].geometryIndex, s = r[o];
wo.geometry.setDrawRange(s.start, s.count), this.getMatrixAt(a, wo.matrixWorld).premultiply(i), this.getBoundingBoxAt(o, wo.geometry.boundingBox), this.getBoundingSphereAt(o, wo.geometry.boundingSphere), wo.raycast(e, To);
for (let e = 0, n = To.length; e < n; e++) {
let n = To[e];
n.object = this, n.batchId = a, t.push(n);
}
To.length = 0;
}
wo.material = null, wo.geometry.index = null, wo.geometry.attributes = {}, wo.geometry.setDrawRange(0, Infinity);
}
copy(e) {
return super.copy(e), this.geometry = e.geometry.clone(), this.perObjectFrustumCulled = e.perObjectFrustumCulled, this.sortObjects = e.sortObjects, this.boundingBox = e.boundingBox === null ? null : e.boundingBox.clone(), this.boundingSphere = e.boundingSphere === null ? null : e.boundingSphere.clone(), this._geometryInfo = e._geometryInfo.map((e) => ({
...e,
boundingBox: e.boundingBox === null ? null : e.boundingBox.clone(),
boundingSphere: e.boundingSphere === null ? null : e.boundingSphere.clone()
})), this._instanceInfo = e._instanceInfo.map((e) => ({ ...e })), this._availableInstanceIds = e._availableInstanceIds.slice(), this._availableGeometryIds = e._availableGeometryIds.slice(), this._nextIndexStart = e._nextIndexStart, this._nextVertexStart = e._nextVertexStart, this._geometryCount = e._geometryCount, this._maxInstanceCount = e._maxInstanceCount, this._maxVertexCount = e._maxVertexCount, this._maxIndexCount = e._maxIndexCount, this._geometryInitialized = e._geometryInitialized, this._multiDrawCounts = e._multiDrawCounts.slice(), this._multiDrawStarts = e._multiDrawStarts.slice(), this._indirectTexture = e._indirectTexture.clone(), this._indirectTexture.image.data = this._indirectTexture.image.data.slice(), this._matricesTexture = e._matricesTexture.clone(), this._matricesTexture.image.data = this._matricesTexture.image.data.slice(), this._colorsTexture !== null && (this._colorsTexture = e._colorsTexture.clone(), this._colorsTexture.image.data = this._colorsTexture.image.data.slice()), this;
}
dispose() {
this.geometry.dispose(), this._matricesTexture.dispose(), this._matricesTexture = null, this._indirectTexture.dispose(), this._indirectTexture = null, this._colorsTexture !== null && (this._colorsTexture.dispose(), this._colorsTexture = null);
}
onBeforeRender(e, t, n, r, i) {
if (!this._visibilityChanged && !this.perObjectFrustumCulled && !this.sortObjects) return;
let a = r.getIndex(), o = a === null ? 1 : a.array.BYTES_PER_ELEMENT, s = 1;
i.wireframe && (s = 2, o = r.attributes.position.count > 65535 ? 4 : 2);
let c = this._instanceInfo, l = this._multiDrawStarts, u = this._multiDrawCounts, d = this._geometryInfo, f = this.perObjectFrustumCulled, p = this._indirectTexture, m = p.image.data, h = n.isArrayCamera ? _o : go;
f && (n.isArrayCamera ? h.setFromArrayCamera(n) : (mo.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse).multiply(this.matrixWorld), h.setFromProjectionMatrix(mo, n.coordinateSystem, n.reversedDepth)));
let g = 0;
if (this.sortObjects) {
mo.copy(this.matrixWorld).invert(), bo.setFromMatrixPosition(n.matrixWorld).applyMatrix4(mo), xo.set(0, 0, -1).transformDirection(n.matrixWorld).transformDirection(mo);
for (let e = 0, t = c.length; e < t; e++) if (c[e].visible && c[e].active) {
let t = c[e].geometryIndex;
this.getMatrixAt(e, mo), this.getBoundingSphereAt(t, yo).applyMatrix4(mo);
let n = !1;
if (f && (n = !h.intersectsSphere(yo)), !n) {
let n = d[t], r = So.subVectors(yo.center, bo).dot(xo);
Co.push(n.start, n.count, r, e);
}
}
let e = Co.list, t = this.customSort;
t === null ? e.sort(i.transparent ? fo : uo) : t.call(this, e, n);
for (let t = 0, n = e.length; t < n; t++) {
let n = e[t];
l[g] = n.start * o * s, u[g] = n.count * s, m[g] = n.index, g++;
}
Co.reset();
} else for (let e = 0, t = c.length; e < t; e++) if (c[e].visible && c[e].active) {
let t = c[e].geometryIndex, n = !1;
if (f && (this.getMatrixAt(e, mo), this.getBoundingSphereAt(t, yo).applyMatrix4(mo), n = !h.intersectsSphere(yo)), !n) {
let n = d[t];
l[g] = n.start * o * s, u[g] = n.count * s, m[g] = e, g++;
}
}
p.needsUpdate = !0, this._multiDrawCount = g, this._visibilityChanged = !1;
}
onBeforeShadow(e, t, n, r, i, a) {
this.onBeforeRender(e, null, r, i, a);
}
}, ko = class extends Y {
constructor(e) {
super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new B(16777215), this.map = null, this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.fog = e.fog, this;
}
}, Ao = /*@__PURE__*/ new I(), jo = /*@__PURE__*/ new I(), Mo = /*@__PURE__*/ new R(), No = /*@__PURE__*/ new pa(), Po = /*@__PURE__*/ new K(), Fo = /*@__PURE__*/ new I(), Io = /*@__PURE__*/ new I(), Lo = class extends z {
constructor(e = new J(), t = new ko()) {
super(), this.isLine = !0, this.type = "Line", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets();
}
copy(e, t) {
return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;
}
computeLineDistances() {
let e = this.geometry;
if (e.index === null) {
let t = e.attributes.position, n = [0];
for (let e = 1, r = t.count; e < r; e++) Ao.fromBufferAttribute(t, e - 1), jo.fromBufferAttribute(t, e), n[e] = n[e - 1], n[e] += Ao.distanceTo(jo);
e.setAttribute("lineDistance", new G(n, 1));
} else j("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
raycast(e, t) {
let n = this.geometry, r = this.matrixWorld, i = e.params.Line.threshold, a = n.drawRange;
if (n.boundingSphere === null && n.computeBoundingSphere(), Po.copy(n.boundingSphere), Po.applyMatrix4(r), Po.radius += i, e.ray.intersectsSphere(Po) === !1) return;
Mo.copy(r).invert(), No.copy(e.ray).applyMatrix4(Mo);
let o = i / ((this.scale.x + this.scale.y + this.scale.z) / 3), s = o * o, c = this.isLineSegments ? 2 : 1, l = n.index, u = n.attributes.position;
if (l !== null) {
let n = Math.max(0, a.start), r = Math.min(l.count, a.start + a.count);
for (let i = n, a = r - 1; i < a; i += c) {
let n = l.getX(i), r = l.getX(i + 1), a = Ro(this, e, No, s, n, r, i);
a && t.push(a);
}
if (this.isLineLoop) {
let i = l.getX(r - 1), a = l.getX(n), o = Ro(this, e, No, s, i, a, r - 1);
o && t.push(o);
}
} else {
let n = Math.max(0, a.start), r = Math.min(u.count, a.start + a.count);
for (let i = n, a = r - 1; i < a; i += c) {
let n = Ro(this, e, No, s, i, i + 1, i);
n && t.push(n);
}
if (this.isLineLoop) {
let i = Ro(this, e, No, s, r - 1, n, r - 1);
i && t.push(i);
}
}
}
updateMorphTargets() {
let e = this.geometry.morphAttributes, t = Object.keys(e);
if (t.length > 0) {
let n = e[t[0]];
if (n !== void 0) {
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
for (let e = 0, t = n.length; e < t; e++) {
let t = n[e].name || String(e);
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e;
}
}
}
}
};
function Ro(e, t, n, r, i, a, o) {
let s = e.geometry.attributes.position;
if (Ao.fromBufferAttribute(s, i), jo.fromBufferAttribute(s, a), n.distanceSqToSegment(Ao, jo, Fo, Io) > r) return;
Fo.applyMatrix4(e.matrixWorld);
let c = t.ray.origin.distanceTo(Fo);
if (!(c < t.near || c > t.far)) return {
distance: c,
point: Io.clone().applyMatrix4(e.matrixWorld),
index: o,
face: null,
faceIndex: null,
barycoord: null,
object: e
};
}
var zo = /*@__PURE__*/ new I(), Bo = /*@__PURE__*/ new I(), Vo = class extends Lo {
constructor(e, t) {
super(e, t), this.isLineSegments = !0, this.type = "LineSegments";
}
computeLineDistances() {
let e = this.geometry;
if (e.index === null) {
let t = e.attributes.position, n = [];
for (let e = 0, r = t.count; e < r; e += 2) zo.fromBufferAttribute(t, e), Bo.fromBufferAttribute(t, e + 1), n[e] = e === 0 ? 0 : n[e - 1], n[e + 1] = n[e] + zo.distanceTo(Bo);
e.setAttribute("lineDistance", new G(n, 1));
} else j("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
return this;
}
}, Ho = class extends Lo {
constructor(e, t) {
super(e, t), this.isLineLoop = !0, this.type = "LineLoop";
}
}, Uo = class extends Y {
constructor(e) {
super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new B(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.fog = !0, 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.fog = e.fog, this;
}
}, Wo = /*@__PURE__*/ new R(), Go = /*@__PURE__*/ new pa(), Ko = /*@__PURE__*/ new K(), qo = /*@__PURE__*/ new I(), Jo = class extends z {
constructor(e = new J(), t = new Uo()) {
super(), this.isPoints = !0, this.type = "Points", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets();
}
copy(e, t) {
return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this;
}
raycast(e, t) {
let n = this.geometry, r = this.matrixWorld, i = e.params.Points.threshold, a = n.drawRange;
if (n.boundingSphere === null && n.computeBoundingSphere(), Ko.copy(n.boundingSphere), Ko.applyMatrix4(r), Ko.radius += i, e.ray.intersectsSphere(Ko) === !1) return;
Wo.copy(r).invert(), Go.copy(e.ray).applyMatrix4(Wo);
let o = i / ((this.scale.x + this.scale.y + this.scale.z) / 3), s = o * o, c = n.index, l = n.attributes.position;
if (c !== null) {
let n = Math.max(0, a.start), i = Math.min(c.count, a.start + a.count);
for (let a = n, o = i; a < o; a++) {
let n = c.getX(a);
qo.fromBufferAttribute(l, n), Yo(qo, n, s, r, e, t, this);
}
} else {
let n = Math.max(0, a.start), i = Math.min(l.count, a.start + a.count);
for (let a = n, o = i; a < o; a++) qo.fromBufferAttribute(l, a), Yo(qo, a, s, r, e, t, this);
}
}
updateMorphTargets() {
let e = this.geometry.morphAttributes, t = Object.keys(e);
if (t.length > 0) {
let n = e[t[0]];
if (n !== void 0) {
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
for (let e = 0, t = n.length; e < t; e++) {
let t = n[e].name || String(e);
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e;
}
}
}
}
};
function Yo(e, t, n, r, i, a, o) {
let s = Go.distanceSqToPoint(e);
if (s < n) {
let n = new I();
Go.closestPointToPoint(e, n), n.applyMatrix4(r);
let c = i.ray.origin.distanceTo(n);
if (c < i.near || c > i.far) return;
a.push({
distance: c,
distanceToRay: Math.sqrt(s),
point: n,
index: t,
face: null,
faceIndex: null,
barycoord: null,
object: o
});
}
}
var Xo = class extends L {
constructor(e, t, n, r, i = x, a = x, o, s, c) {
super(e, t, n, r, i, a, o, s, c), this.isVideoTexture = !0, this.generateMipmaps = !1, this._requestVideoFrameCallbackId = 0;
let l = this;
function u() {
l.needsUpdate = !0, l._requestVideoFrameCallbackId = e.requestVideoFrameCallback(u);
}
"requestVideoFrameCallback" in e && (this._requestVideoFrameCallbackId = e.requestVideoFrameCallback(u));
}
clone() {
return new this.constructor(this.image).copy(this);
}
update() {
let e = this.image;
!("requestVideoFrameCallback" in e) && e.readyState >= e.HAVE_CURRENT_DATA && (this.needsUpdate = !0);
}
dispose() {
this._requestVideoFrameCallbackId !== 0 && (this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId), this._requestVideoFrameCallbackId = 0), super.dispose();
}
}, Zo = class extends Xo {
constructor(e, t, n, r, i, a, o, s) {
super({}, e, t, n, r, i, a, o, s), this.isVideoFrameTexture = !0;
}
update() {}
clone() {
return new this.constructor().copy(this);
}
setFrame(e) {
this.image = e, this.needsUpdate = !0;
}
}, Qo = class extends L {
constructor(e, t) {
super({
width: e,
height: t
}), this.isFramebufferTexture = !0, this.magFilter = g, this.minFilter = g, this.generateMipmaps = !1, this.needsUpdate = !0;
}
}, $o = class extends L {
constructor(e, t, n, r, i, a, o, s, c, l, u, d) {
super(null, a, o, s, c, l, r, i, u, d), this.isCompressedTexture = !0, this.image = {
width: t,
height: n
}, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1;
}
}, es = class extends $o {
constructor(e, t, n, r, i, a) {
super(e, t, n, i, a), this.isCompressedArrayTexture = !0, this.image.depth = r, this.wrapR = m, this.layerUpdates = /* @__PURE__ */ new Set();
}
addLayerUpdate(e) {
this.layerUpdates.add(e);
}
clearLayerUpdates() {
this.layerUpdates.clear();
}
}, ts = class extends $o {
constructor(e, t, n) {
super(void 0, e[0].width, e[0].height, t, n, 301), this.isCompressedCubeTexture = !0, this.isCubeTexture = !0, this.image = e;
}
}, ns = class extends L {
constructor(e = [], t = 301, n, r, i, a, o, s, c, l) {
super(e, t, n, r, i, a, o, s, c, l), this.isCubeTexture = !0, this.flipY = !1;
}
get images() {
return this.image;
}
set images(e) {
this.image = e;
}
}, rs = class extends L {
constructor(e, t, n, r, i, a, o, s, c) {
super(e, t, n, r, i, a, o, s, c), this.isCanvasTexture = !0, this.needsUpdate = !0;
}
}, is = class extends L {
constructor(e, t, n, r, i, a, o, s, c) {
super(e, t, n, r, i, a, o, s, c), this.isHTMLTexture = !0, this.generateMipmaps = !1, this.needsUpdate = !0;
let l = e ? e.parentNode : null;
l !== null && "requestPaint" in l && (l.onpaint = () => {
this.needsUpdate = !0;
}, l.requestPaint());
}
dispose() {
let e = this.image ? this.image.parentNode : null;
e !== null && "onpaint" in e && (e.onpaint = null), super.dispose();
}
}, as = class extends L {
constructor(e, t, n = ee, r, i, a, o = g, s = g, c, l = de, u = 1) {
if (l !== 1026 && l !== 1027) throw Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
super({
width: e,
height: t,
depth: u
}, r, i, a, o, s, l, n, c), this.isDepthTexture = !0, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null;
}
copy(e) {
return super.copy(e), this.source = new Kn(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this;
}
toJSON(e) {
let t = super.toJSON(e);
return this.compareFunction !== null && (t.compareFunction = this.compareFunction), t;
}
}, os = class extends as {
constructor(e, t = ee, n = 301, r, i, a = g, o = g, s, c = de) {
let l = {
width: e,
height: e,
depth: 1
}, u = [
l,
l,
l,
l,
l,
l
];
super(e, e, t, n, r, i, a, o, s, c), this.image = u, this.isCubeDepthTexture = !0, this.isCubeTexture = !0;
}
get images() {
return this.image;
}
set images(e) {
this.image = e;
}
}, ss = class extends L {
constructor(e = null) {
super(), this.sourceTexture = e, this.isExternalTexture = !0;
}
copy(e) {
return super.copy(e), this.sourceTexture = e.sourceTexture, this;
}
}, cs = class e extends J {
constructor(e = 1, t = 1, n = 1, r = 1, i = 1, a = 1) {
super(), this.type = "BoxGeometry", this.parameters = {
width: e,
height: t,
depth: n,
widthSegments: r,
heightSegments: i,
depthSegments: a
};
let o = this;
r = Math.floor(r), i = Math.floor(i), a = Math.floor(a);
let s = [], c = [], l = [], u = [], d = 0, f = 0;
p("z", "y", "x", -1, -1, n, t, e, a, i, 0), p("z", "y", "x", 1, -1, n, t, -e, a, i, 1), p("x", "z", "y", 1, 1, e, n, t, r, a, 2), p("x", "z", "y", 1, -1, e, n, -t, r, a, 3), p("x", "y", "z", 1, -1, e, t, n, r, i, 4), p("x", "y", "z", -1, -1, e, t, -n, r, i, 5), this.setIndex(s), this.setAttribute("position", new G(c, 3)), this.setAttribute("normal", new G(l, 3)), this.setAttribute("uv", new G(u, 2));
function p(e, t, n, r, i, a, p, m, h, g, _) {
let v = a / h, y = p / g, b = a / 2, x = p / 2, S = m / 2, C = h + 1, w = g + 1, T = 0, E = 0, D = new I();
for (let a = 0; a < w; a++) {
let o = a * y - x;
for (let s = 0; s < C; s++) D[e] = (s * v - b) * r, D[t] = o * i, D[n] = S, c.push(D.x, D.y, D.z), D[e] = 0, D[t] = 0, D[n] = m > 0 ? 1 : -1, l.push(D.x, D.y, D.z), u.push(s / h), u.push(1 - a / g), T += 1;
}
for (let e = 0; e < g; e++) for (let t = 0; t < h; t++) {
let n = d + t + C * e, r = d + t + C * (e + 1), i = d + (t + 1) + C * (e + 1), a = d + (t + 1) + C * e;
s.push(n, r, a), s.push(r, i, a), E += 6;
}
o.addGroup(f, E, _), f += E, d += T;
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.width, t.height, t.depth, t.widthSegments, t.heightSegments, t.depthSegments);
}
}, ls = class e extends J {
constructor(e = 1, t = 1, n = 4, r = 8, i = 1) {
super(), this.type = "CapsuleGeometry", this.parameters = {
radius: e,
height: t,
capSegments: n,
radialSegments: r,
heightSegments: i
}, t = Math.max(0, t), n = Math.max(1, Math.floor(n)), r = Math.max(3, Math.floor(r)), i = Math.max(1, Math.floor(i));
let a = [], o = [], s = [], c = [], l = t / 2, u = Math.PI / 2 * e, d = t, f = 2 * u + d, p = n * 2 + i, m = r + 1, h = new I(), g = new I();
for (let _ = 0; _ <= p; _++) {
let v = 0, y = 0, b = 0, x = 0;
if (_ <= n) {
let t = _ / n, r = t * Math.PI / 2;
y = -l - e * Math.cos(r), b = e * Math.sin(r), x = -e * Math.cos(r), v = t * u;
} else if (_ <= n + i) {
let r = (_ - n) / i;
y = -l + r * t, b = e, x = 0, v = u + r * d;
} else {
let t = (_ - n - i) / n, r = t * Math.PI / 2;
y = l + e * Math.sin(r), b = e * Math.cos(r), x = e * Math.sin(r), v = u + d + t * u;
}
let S = Math.max(0, Math.min(1, v / f)), C = 0;
_ === 0 ? C = .5 / r : _ === p && (C = -.5 / r);
for (let e = 0; e <= r; e++) {
let t = e / r, n = t * Math.PI * 2, i = Math.sin(n), a = Math.cos(n);
g.x = -b * a, g.y = y, g.z = b * i, o.push(g.x, g.y, g.z), h.set(-b * a, x, b * i), h.normalize(), s.push(h.x, h.y, h.z), c.push(t + C, S);
}
if (_ > 0) {
let e = (_ - 1) * m;
for (let t = 0; t < r; t++) {
let n = e + t, r = e + t + 1, i = _ * m + t, o = _ * m + t + 1;
a.push(n, r, i), a.push(r, o, i);
}
}
}
this.setIndex(a), this.setAttribute("position", new G(o, 3)), this.setAttribute("normal", new G(s, 3)), this.setAttribute("uv", new G(c, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radius, t.height, t.capSegments, t.radialSegments, t.heightSegments);
}
}, us = class e extends J {
constructor(e = 1, t = 32, n = 0, r = Math.PI * 2) {
super(), this.type = "CircleGeometry", this.parameters = {
radius: e,
segments: t,
thetaStart: n,
thetaLength: r
}, t = Math.max(3, t);
let i = [], a = [], o = [], s = [], c = new I(), l = new F();
a.push(0, 0, 0), o.push(0, 0, 1), s.push(.5, .5);
for (let i = 0, u = 3; i <= t; i++, u += 3) {
let d = n + i / t * r;
c.x = e * Math.cos(d), c.y = e * Math.sin(d), a.push(c.x, c.y, c.z), o.push(0, 0, 1), l.x = (a[u] / e + 1) / 2, l.y = (a[u + 1] / e + 1) / 2, s.push(l.x, l.y);
}
for (let e = 1; e <= t; e++) i.push(e, e + 1, 0);
this.setIndex(i), this.setAttribute("position", new G(a, 3)), this.setAttribute("normal", new G(o, 3)), this.setAttribute("uv", new G(s, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radius, t.segments, t.thetaStart, t.thetaLength);
}
}, ds = class e extends J {
constructor(e = 1, t = 1, n = 1, r = 32, i = 1, a = !1, o = 0, s = Math.PI * 2) {
super(), this.type = "CylinderGeometry", this.parameters = {
radiusTop: e,
radiusBottom: t,
height: n,
radialSegments: r,
heightSegments: i,
openEnded: a,
thetaStart: o,
thetaLength: s
};
let c = this;
r = Math.floor(r), i = Math.floor(i);
let l = [], u = [], d = [], f = [], p = 0, m = [], h = n / 2, g = 0;
_(), a === !1 && (e > 0 && v(!0), t > 0 && v(!1)), this.setIndex(l), this.setAttribute("position", new G(u, 3)), this.setAttribute("normal", new G(d, 3)), this.setAttribute("uv", new G(f, 2));
function _() {
let a = new I(), _ = new I(), v = 0, y = (t - e) / n;
for (let c = 0; c <= i; c++) {
let l = [], g = c / i, v = g * (t - e) + e;
for (let e = 0; e <= r; e++) {
let t = e / r, i = t * s + o, c = Math.sin(i), m = Math.cos(i);
_.x = v * c, _.y = -g * n + h, _.z = v * m, u.push(_.x, _.y, _.z), a.set(c, y, m).normalize(), d.push(a.x, a.y, a.z), f.push(t, 1 - g), l.push(p++);
}
m.push(l);
}
for (let n = 0; n < r; n++) for (let r = 0; r < i; r++) {
let a = m[r][n], o = m[r + 1][n], s = m[r + 1][n + 1], c = m[r][n + 1];
(e > 0 || r !== 0) && (l.push(a, o, c), v += 3), (t > 0 || r !== i - 1) && (l.push(o, s, c), v += 3);
}
c.addGroup(g, v, 0), g += v;
}
function v(n) {
let i = p, a = new F(), m = new I(), _ = 0, v = n === !0 ? e : t, y = n === !0 ? 1 : -1;
for (let e = 1; e <= r; e++) u.push(0, h * y, 0), d.push(0, y, 0), f.push(.5, .5), p++;
let b = p;
for (let e = 0; e <= r; e++) {
let t = e / r * s + o, n = Math.cos(t), i = Math.sin(t);
m.x = v * i, m.y = h * y, m.z = v * n, u.push(m.x, m.y, m.z), d.push(0, y, 0), a.x = n * .5 + .5, a.y = i * .5 * y + .5, f.push(a.x, a.y), p++;
}
for (let e = 0; e < r; e++) {
let t = i + e, r = b + e;
n === !0 ? l.push(r, r + 1, t) : l.push(r + 1, r, t), _ += 3;
}
c.addGroup(g, _, n === !0 ? 1 : 2), g += _;
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radiusTop, t.radiusBottom, t.height, t.radialSegments, t.heightSegments, t.openEnded, t.thetaStart, t.thetaLength);
}
}, fs = class e extends ds {
constructor(e = 1, t = 1, n = 32, r = 1, i = !1, a = 0, o = Math.PI * 2) {
super(0, e, t, n, r, i, a, o), this.type = "ConeGeometry", this.parameters = {
radius: e,
height: t,
radialSegments: n,
heightSegments: r,
openEnded: i,
thetaStart: a,
thetaLength: o
};
}
static fromJSON(t) {
return new e(t.radius, t.height, t.radialSegments, t.heightSegments, t.openEnded, t.thetaStart, t.thetaLength);
}
}, ps = class e extends J {
constructor(e = [], t = [], n = 1, r = 0) {
super(), this.type = "PolyhedronGeometry", this.parameters = {
vertices: e,
indices: t,
radius: n,
detail: r
};
let i = [], a = [];
o(r), c(n), l(), this.setAttribute("position", new G(i, 3)), this.setAttribute("normal", new G(i.slice(), 3)), this.setAttribute("uv", new G(a, 2)), r === 0 ? this.computeVertexNormals() : this.normalizeNormals();
function o(e) {
let n = new I(), r = new I(), i = new I();
for (let a = 0; a < t.length; a += 3) f(t[a + 0], n), f(t[a + 1], r), f(t[a + 2], i), s(n, r, i, e);
}
function s(e, t, n, r) {
let i = r + 1, a = [];
for (let r = 0; r <= i; r++) {
a[r] = [];
let o = e.clone().lerp(n, r / i), s = t.clone().lerp(n, r / i), c = i - r;
for (let e = 0; e <= c; e++) e === 0 && r === i ? a[r][e] = o : a[r][e] = o.clone().lerp(s, e / c);
}
for (let e = 0; e < i; e++) for (let t = 0; t < 2 * (i - e) - 1; t++) {
let n = Math.floor(t / 2);
t % 2 == 0 ? (d(a[e][n + 1]), d(a[e + 1][n]), d(a[e][n])) : (d(a[e][n + 1]), d(a[e + 1][n + 1]), d(a[e + 1][n]));
}
}
function c(e) {
let t = new I();
for (let n = 0; n < i.length; n += 3) t.x = i[n + 0], t.y = i[n + 1], t.z = i[n + 2], t.normalize().multiplyScalar(e), i[n + 0] = t.x, i[n + 1] = t.y, i[n + 2] = t.z;
}
function l() {
let e = new I();
for (let t = 0; t < i.length; t += 3) {
e.x = i[t + 0], e.y = i[t + 1], e.z = i[t + 2];
let n = h(e) / 2 / Math.PI + .5, r = g(e) / Math.PI + .5;
a.push(n, 1 - r);
}
p(), u();
}
function u() {
for (let e = 0; e < a.length; e += 6) {
let t = a[e + 0], n = a[e + 2], r = a[e + 4];
Math.max(t, n, r) > .9 && Math.min(t, n, r) < .1 && (t < .2 && (a[e + 0] += 1), n < .2 && (a[e + 2] += 1), r < .2 && (a[e + 4] += 1));
}
}
function d(e) {
i.push(e.x, e.y, e.z);
}
function f(t, n) {
let r = t * 3;
n.x = e[r + 0], n.y = e[r + 1], n.z = e[r + 2];
}
function p() {
let e = new I(), t = new I(), n = new I(), r = new I(), o = new F(), s = new F(), c = new F();
for (let l = 0, u = 0; l < i.length; l += 9, u += 6) {
e.set(i[l + 0], i[l + 1], i[l + 2]), t.set(i[l + 3], i[l + 4], i[l + 5]), n.set(i[l + 6], i[l + 7], i[l + 8]), o.set(a[u + 0], a[u + 1]), s.set(a[u + 2], a[u + 3]), c.set(a[u + 4], a[u + 5]), r.copy(e).add(t).add(n).divideScalar(3);
let d = h(r);
m(o, u + 0, e, d), m(s, u + 2, t, d), m(c, u + 4, n, d);
}
}
function m(e, t, n, r) {
r < 0 && e.x === 1 && (a[t] = e.x - 1), n.x === 0 && n.z === 0 && (a[t] = r / 2 / Math.PI + .5);
}
function h(e) {
return Math.atan2(e.z, -e.x);
}
function g(e) {
return Math.atan2(-e.y, Math.sqrt(e.x * e.x + e.z * e.z));
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.vertices, t.indices, t.radius, t.detail);
}
}, ms = class e extends ps {
constructor(e = 1, t = 0) {
let n = (1 + Math.sqrt(5)) / 2, r = 1 / n, i = [
-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,
-r,
-n,
0,
-r,
n,
0,
r,
-n,
0,
r,
n,
-r,
-n,
0,
-r,
n,
0,
r,
-n,
0,
r,
n,
0,
-n,
0,
-r,
n,
0,
-r,
-n,
0,
r,
n,
0,
r
];
super(i, [
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
], e, t), this.type = "DodecahedronGeometry", this.parameters = {
radius: e,
detail: t
};
}
static fromJSON(t) {
return new e(t.radius, t.detail);
}
}, hs = /*@__PURE__*/ new I(), gs = /*@__PURE__*/ new I(), _s = /*@__PURE__*/ new I(), vs = /*@__PURE__*/ new Qr(), ys = class extends J {
constructor(e = null, t = 1) {
if (super(), this.type = "EdgesGeometry", this.parameters = {
geometry: e,
thresholdAngle: t
}, e !== null) {
let n = 10 ** 4, r = Math.cos(ln * t), i = e.getIndex(), a = e.getAttribute("position"), o = i ? i.count : a.count, s = [
0,
0,
0
], c = [
"a",
"b",
"c"
], l = [
,
,
,
], u = {}, d = [];
for (let e = 0; e < o; e += 3) {
i ? (s[0] = i.getX(e), s[1] = i.getX(e + 1), s[2] = i.getX(e + 2)) : (s[0] = e, s[1] = e + 1, s[2] = e + 2);
let { a: t, b: o, c: f } = vs;
if (t.fromBufferAttribute(a, s[0]), o.fromBufferAttribute(a, s[1]), f.fromBufferAttribute(a, s[2]), vs.getNormal(_s), l[0] = `${Math.round(t.x * n)},${Math.round(t.y * n)},${Math.round(t.z * n)}`, l[1] = `${Math.round(o.x * n)},${Math.round(o.y * n)},${Math.round(o.z * n)}`, l[2] = `${Math.round(f.x * n)},${Math.round(f.y * n)},${Math.round(f.z * n)}`, !(l[0] === l[1] || l[1] === l[2] || l[2] === l[0])) for (let e = 0; e < 3; e++) {
let t = (e + 1) % 3, n = l[e], i = l[t], a = vs[c[e]], o = vs[c[t]], f = `${n}_${i}`, p = `${i}_${n}`;
p in u && u[p] ? (_s.dot(u[p].normal) <= r && (d.push(a.x, a.y, a.z), d.push(o.x, o.y, o.z)), u[p] = null) : f in u || (u[f] = {
index0: s[e],
index1: s[t],
normal: _s.clone()
});
}
}
for (let e in u) if (u[e]) {
let { index0: t, index1: n } = u[e];
hs.fromBufferAttribute(a, t), gs.fromBufferAttribute(a, n), d.push(hs.x, hs.y, hs.z), d.push(gs.x, gs.y, gs.z);
}
this.setAttribute("position", new G(d, 3));
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
}, bs = class {
constructor() {
this.type = "Curve", this.arcLengthDivisions = 200, this.needsUpdate = !1, this.cacheArcLengths = null;
}
getPoint() {
j("Curve: .getPoint() not implemented.");
}
getPointAt(e, t) {
let n = this.getUtoTmapping(e);
return this.getPoint(n, t);
}
getPoints(e = 5) {
let t = [];
for (let n = 0; n <= e; n++) t.push(this.getPoint(n / e));
return t;
}
getSpacedPoints(e = 5) {
let t = [];
for (let n = 0; n <= e; n++) t.push(this.getPointAt(n / e));
return t;
}
getLength() {
let e = this.getLengths();
return e[e.length - 1];
}
getLengths(e = this.arcLengthDivisions) {
if (this.cacheArcLengths && this.cacheArcLengths.length === e + 1 && !this.needsUpdate) return this.cacheArcLengths;
this.needsUpdate = !1;
let t = [], n, r = this.getPoint(0), i = 0;
t.push(0);
for (let a = 1; a <= e; a++) n = this.getPoint(a / e), i += n.distanceTo(r), t.push(i), r = n;
return this.cacheArcLengths = t, t;
}
updateArcLengths() {
this.needsUpdate = !0, this.getLengths();
}
getUtoTmapping(e, t = null) {
let n = this.getLengths(), r = 0, i = n.length, a;
a = t || e * n[i - 1];
let o = 0, s = i - 1, c;
for (; o <= s;) if (r = Math.floor(o + (s - o) / 2), c = n[r] - a, c < 0) o = r + 1;
else if (c > 0) s = r - 1;
else {
s = r;
break;
}
if (r = s, n[r] === a) return r / (i - 1);
let l = n[r], u = n[r + 1] - l, d = (a - l) / u;
return (r + d) / (i - 1);
}
getTangent(e, t) {
let n = 1e-4, r = e - n, i = e + n;
r < 0 && (r = 0), i > 1 && (i = 1);
let a = this.getPoint(r), o = this.getPoint(i), s = t || (a.isVector2 ? new F() : new I());
return s.copy(o).sub(a).normalize(), s;
}
getTangentAt(e, t) {
let n = this.getUtoTmapping(e);
return this.getTangent(n, t);
}
computeFrenetFrames(e, t = !1) {
let n = new I(), r = [], i = [], a = [], o = new I(), s = new R();
for (let t = 0; t <= e; t++) {
let n = t / e;
r[t] = this.getTangentAt(n, new I());
}
i[0] = new I(), a[0] = new I();
let c = Number.MAX_VALUE, l = Math.abs(r[0].x), u = Math.abs(r[0].y), d = Math.abs(r[0].z);
l <= c && (c = l, n.set(1, 0, 0)), u <= c && (c = u, n.set(0, 1, 0)), d <= c && n.set(0, 0, 1), o.crossVectors(r[0], n).normalize(), i[0].crossVectors(r[0], o), a[0].crossVectors(r[0], i[0]);
for (let t = 1; t <= e; t++) {
if (i[t] = i[t - 1].clone(), a[t] = a[t - 1].clone(), o.crossVectors(r[t - 1], r[t]), o.length() > 2 ** -52) {
o.normalize();
let e = Math.acos(N(r[t - 1].dot(r[t]), -1, 1));
i[t].applyMatrix4(s.makeRotationAxis(o, e));
}
a[t].crossVectors(r[t], i[t]);
}
if (t === !0) {
let t = Math.acos(N(i[0].dot(i[e]), -1, 1));
t /= e, r[0].dot(o.crossVectors(i[0], i[e])) > 0 && (t = -t);
for (let n = 1; n <= e; n++) i[n].applyMatrix4(s.makeRotationAxis(r[n], t * n)), a[n].crossVectors(r[n], i[n]);
}
return {
tangents: r,
normals: i,
binormals: a
};
}
clone() {
return new this.constructor().copy(this);
}
copy(e) {
return this.arcLengthDivisions = e.arcLengthDivisions, this;
}
toJSON() {
let e = { metadata: {
version: 4.7,
type: "Curve",
generator: "Curve.toJSON"
} };
return e.arcLengthDivisions = this.arcLengthDivisions, e.type = this.type, e;
}
fromJSON(e) {
return this.arcLengthDivisions = e.arcLengthDivisions, this;
}
}, xs = class extends bs {
constructor(e = 0, t = 0, n = 1, r = 1, i = 0, a = Math.PI * 2, o = !1, s = 0) {
super(), this.isEllipseCurve = !0, this.type = "EllipseCurve", this.aX = e, this.aY = t, this.xRadius = n, this.yRadius = r, this.aStartAngle = i, this.aEndAngle = a, this.aClockwise = o, this.aRotation = s;
}
getPoint(e, t = new F()) {
let n = t, r = Math.PI * 2, i = this.aEndAngle - this.aStartAngle, a = Math.abs(i) < 2 ** -52;
for (; i < 0;) i += r;
for (; i > r;) i -= r;
i < 2 ** -52 && (i = a ? 0 : r), this.aClockwise === !0 && !a && (i === r ? i = -r : i -= r);
let o = this.aStartAngle + e * i, s = this.aX + this.xRadius * Math.cos(o), c = this.aY + this.yRadius * Math.sin(o);
if (this.aRotation !== 0) {
let e = Math.cos(this.aRotation), t = Math.sin(this.aRotation), n = s - this.aX, r = c - this.aY;
s = n * e - r * t + this.aX, c = n * t + r * e + this.aY;
}
return n.set(s, c);
}
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() {
let 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;
}
}, Ss = class extends xs {
constructor(e, t, n, r, i, a) {
super(e, t, n, n, r, i, a), this.isArcCurve = !0, this.type = "ArcCurve";
}
};
function Cs() {
let e = 0, t = 0, n = 0, r = 0;
function i(i, a, o, s) {
e = i, t = o, n = -3 * i + 3 * a - 2 * o - s, r = 2 * i - 2 * a + o + s;
}
return {
initCatmullRom: function(e, t, n, r, a) {
i(t, n, a * (n - e), a * (r - t));
},
initNonuniformCatmullRom: function(e, t, n, r, a, o, s) {
let c = (t - e) / a - (n - e) / (a + o) + (n - t) / o, l = (n - t) / o - (r - t) / (o + s) + (r - n) / s;
c *= o, l *= o, i(t, n, c, l);
},
calc: function(i) {
let a = i * i, o = a * i;
return e + t * i + n * a + r * o;
}
};
}
var ws = /*@__PURE__*/ new I(), Ts = /*@__PURE__*/ new I(), Es = /*@__PURE__*/ new Cs(), Ds = /*@__PURE__*/ new Cs(), Os = /*@__PURE__*/ new Cs(), ks = class extends bs {
constructor(e = [], t = !1, n = "centripetal", r = .5) {
super(), this.isCatmullRomCurve3 = !0, this.type = "CatmullRomCurve3", this.points = e, this.closed = t, this.curveType = n, this.tension = r;
}
getPoint(e, t = new I()) {
let n = t, r = this.points, i = r.length, a = (i - +!this.closed) * e, o = Math.floor(a), s = a - o;
this.closed ? o += o > 0 ? 0 : (Math.floor(Math.abs(o) / i) + 1) * i : s === 0 && o === i - 1 && (o = i - 2, s = 1);
let c, l;
this.closed || o > 0 ? c = r[(o - 1) % i] : (Ts.subVectors(r[0], r[1]).add(r[0]), c = Ts);
let u = r[o % i], d = r[(o + 1) % i];
if (this.closed || o + 2 < i ? l = r[(o + 2) % i] : (ws.subVectors(r[i - 1], r[i - 2]).add(r[i - 1]), l = ws), this.curveType === "centripetal" || this.curveType === "chordal") {
let e = this.curveType === "chordal" ? .5 : .25, t = c.distanceToSquared(u) ** +e, n = u.distanceToSquared(d) ** +e, r = d.distanceToSquared(l) ** +e;
n < 1e-4 && (n = 1), t < 1e-4 && (t = n), r < 1e-4 && (r = n), Es.initNonuniformCatmullRom(c.x, u.x, d.x, l.x, t, n, r), Ds.initNonuniformCatmullRom(c.y, u.y, d.y, l.y, t, n, r), Os.initNonuniformCatmullRom(c.z, u.z, d.z, l.z, t, n, r);
} else this.curveType === "catmullrom" && (Es.initCatmullRom(c.x, u.x, d.x, l.x, this.tension), Ds.initCatmullRom(c.y, u.y, d.y, l.y, this.tension), Os.initCatmullRom(c.z, u.z, d.z, l.z, this.tension));
return n.set(Es.calc(s), Ds.calc(s), Os.calc(s)), n;
}
copy(e) {
super.copy(e), this.points = [];
for (let t = 0, n = e.points.length; t < n; t++) {
let n = e.points[t];
this.points.push(n.clone());
}
return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this;
}
toJSON() {
let e = super.toJSON();
e.points = [];
for (let t = 0, n = this.points.length; t < n; t++) {
let n = this.points[t];
e.points.push(n.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, n = e.points.length; t < n; t++) {
let n = e.points[t];
this.points.push(new I().fromArray(n));
}
return this.closed = e.closed, this.curveType = e.curveType, this.tension = e.tension, this;
}
};
function As(e, t, n, r, i) {
let a = (r - t) * .5, o = (i - n) * .5, s = e * e, c = e * s;
return (2 * n - 2 * r + a + o) * c + (-3 * n + 3 * r - 2 * a - o) * s + a * e + n;
}
function js(e, t) {
let n = 1 - e;
return n * n * t;
}
function Ms(e, t) {
return 2 * (1 - e) * e * t;
}
function Ns(e, t) {
return e * e * t;
}
function Ps(e, t, n, r) {
return js(e, t) + Ms(e, n) + Ns(e, r);
}
function Fs(e, t) {
let n = 1 - e;
return n * n * n * t;
}
function Is(e, t) {
let n = 1 - e;
return 3 * n * n * e * t;
}
function Ls(e, t) {
return 3 * (1 - e) * e * e * t;
}
function Rs(e, t) {
return e * e * e * t;
}
function zs(e, t, n, r, i) {
return Fs(e, t) + Is(e, n) + Ls(e, r) + Rs(e, i);
}
var Bs = class extends bs {
constructor(e = new F(), t = new F(), n = new F(), r = new F()) {
super(), this.isCubicBezierCurve = !0, this.type = "CubicBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = r;
}
getPoint(e, t = new F()) {
let n = t, r = this.v0, i = this.v1, a = this.v2, o = this.v3;
return n.set(zs(e, r.x, i.x, a.x, o.x), zs(e, r.y, i.y, a.y, o.y)), n;
}
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() {
let 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;
}
}, Vs = class extends bs {
constructor(e = new I(), t = new I(), n = new I(), r = new I()) {
super(), this.isCubicBezierCurve3 = !0, this.type = "CubicBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n, this.v3 = r;
}
getPoint(e, t = new I()) {
let n = t, r = this.v0, i = this.v1, a = this.v2, o = this.v3;
return n.set(zs(e, r.x, i.x, a.x, o.x), zs(e, r.y, i.y, a.y, o.y), zs(e, r.z, i.z, a.z, o.z)), n;
}
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() {
let 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;
}
}, Hs = class extends bs {
constructor(e = new F(), t = new F()) {
super(), this.isLineCurve = !0, this.type = "LineCurve", this.v1 = e, this.v2 = t;
}
getPoint(e, t = new F()) {
let n = t;
return e === 1 ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(e).add(this.v1)), n;
}
getPointAt(e, t) {
return this.getPoint(e, t);
}
getTangent(e, t = new F()) {
return t.subVectors(this.v2, this.v1).normalize();
}
getTangentAt(e, t) {
return this.getTangent(e, t);
}
copy(e) {
return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
}
toJSON() {
let 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;
}
}, Us = class extends bs {
constructor(e = new I(), t = new I()) {
super(), this.isLineCurve3 = !0, this.type = "LineCurve3", this.v1 = e, this.v2 = t;
}
getPoint(e, t = new I()) {
let n = t;
return e === 1 ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(e).add(this.v1)), n;
}
getPointAt(e, t) {
return this.getPoint(e, t);
}
getTangent(e, t = new I()) {
return t.subVectors(this.v2, this.v1).normalize();
}
getTangentAt(e, t) {
return this.getTangent(e, t);
}
copy(e) {
return super.copy(e), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
}
toJSON() {
let 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;
}
}, Ws = class extends bs {
constructor(e = new F(), t = new F(), n = new F()) {
super(), this.isQuadraticBezierCurve = !0, this.type = "QuadraticBezierCurve", this.v0 = e, this.v1 = t, this.v2 = n;
}
getPoint(e, t = new F()) {
let n = t, r = this.v0, i = this.v1, a = this.v2;
return n.set(Ps(e, r.x, i.x, a.x), Ps(e, r.y, i.y, a.y)), n;
}
copy(e) {
return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
}
toJSON() {
let 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;
}
}, Gs = class extends bs {
constructor(e = new I(), t = new I(), n = new I()) {
super(), this.isQuadraticBezierCurve3 = !0, this.type = "QuadraticBezierCurve3", this.v0 = e, this.v1 = t, this.v2 = n;
}
getPoint(e, t = new I()) {
let n = t, r = this.v0, i = this.v1, a = this.v2;
return n.set(Ps(e, r.x, i.x, a.x), Ps(e, r.y, i.y, a.y), Ps(e, r.z, i.z, a.z)), n;
}
copy(e) {
return super.copy(e), this.v0.copy(e.v0), this.v1.copy(e.v1), this.v2.copy(e.v2), this;
}
toJSON() {
let 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;
}
}, Ks = class extends bs {
constructor(e = []) {
super(), this.isSplineCurve = !0, this.type = "SplineCurve", this.points = e;
}
getPoint(e, t = new F()) {
let n = t, r = this.points, i = (r.length - 1) * e, a = Math.floor(i), o = i - a, s = r[a === 0 ? a : a - 1], c = r[a], l = r[a > r.length - 2 ? r.length - 1 : a + 1], u = r[a > r.length - 3 ? r.length - 1 : a + 2];
return n.set(As(o, s.x, c.x, l.x, u.x), As(o, s.y, c.y, l.y, u.y)), n;
}
copy(e) {
super.copy(e), this.points = [];
for (let t = 0, n = e.points.length; t < n; t++) {
let n = e.points[t];
this.points.push(n.clone());
}
return this;
}
toJSON() {
let e = super.toJSON();
e.points = [];
for (let t = 0, n = this.points.length; t < n; t++) {
let n = this.points[t];
e.points.push(n.toArray());
}
return e;
}
fromJSON(e) {
super.fromJSON(e), this.points = [];
for (let t = 0, n = e.points.length; t < n; t++) {
let n = e.points[t];
this.points.push(new F().fromArray(n));
}
return this;
}
}, qs = /*#__PURE__*/ Object.freeze({
__proto__: null,
ArcCurve: Ss,
CatmullRomCurve3: ks,
CubicBezierCurve: Bs,
CubicBezierCurve3: Vs,
EllipseCurve: xs,
LineCurve: Hs,
LineCurve3: Us,
QuadraticBezierCurve: Ws,
QuadraticBezierCurve3: Gs,
SplineCurve: Ks
}), Js = class extends bs {
constructor() {
super(), this.type = "CurvePath", this.curves = [], this.autoClose = !1;
}
add(e) {
this.curves.push(e);
}
closePath() {
let e = this.curves[0].getPoint(0), t = this.curves[this.curves.length - 1].getPoint(1);
if (!e.equals(t)) {
let n = e.isVector2 === !0 ? "LineCurve" : "LineCurve3";
this.curves.push(new qs[n](t, e));
}
return this;
}
getPoint(e, t) {
let n = e * this.getLength(), r = this.getCurveLengths(), i = 0;
for (; i < r.length;) {
if (r[i] >= n) {
let e = r[i] - n, a = this.curves[i], o = a.getLength(), s = o === 0 ? 0 : 1 - e / o;
return a.getPointAt(s, t);
}
i++;
}
return null;
}
getLength() {
let e = this.getCurveLengths();
return e[e.length - 1];
}
updateArcLengths() {
this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths();
}
getCurveLengths() {
if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths;
let e = [], t = 0;
for (let n = 0, r = this.curves.length; n < r; n++) t += this.curves[n].getLength(), e.push(t);
return this.cacheLengths = e, e;
}
getSpacedPoints(e = 40) {
let t = [];
for (let n = 0; n <= e; n++) t.push(this.getPoint(n / e));
return this.autoClose && t.push(t[0]), t;
}
getPoints(e = 12) {
let t = [], n;
for (let r = 0, i = this.curves; r < i.length; r++) {
let a = i[r], o = a.isEllipseCurve ? e * 2 : a.isLineCurve || a.isLineCurve3 ? 1 : a.isSplineCurve ? e * a.points.length : e, s = a.getPoints(o);
for (let e = 0; e < s.length; e++) {
let r = s[e];
n && n.equals(r) || (t.push(r), n = r);
}
}
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, n = e.curves.length; t < n; t++) {
let n = e.curves[t];
this.curves.push(n.clone());
}
return this.autoClose = e.autoClose, this;
}
toJSON() {
let e = super.toJSON();
e.autoClose = this.autoClose, e.curves = [];
for (let t = 0, n = this.curves.length; t < n; t++) {
let n = this.curves[t];
e.curves.push(n.toJSON());
}
return e;
}
fromJSON(e) {
super.fromJSON(e), this.autoClose = e.autoClose, this.curves = [];
for (let t = 0, n = e.curves.length; t < n; t++) {
let n = e.curves[t];
this.curves.push(new qs[n.type]().fromJSON(n));
}
return this;
}
}, Ys = class extends Js {
constructor(e) {
super(), this.type = "Path", this.currentPoint = new F(), e && this.setFromPoints(e);
}
setFromPoints(e) {
this.moveTo(e[0].x, e[0].y);
for (let t = 1, n = e.length; t < n; t++) this.lineTo(e[t].x, e[t].y);
return this;
}
moveTo(e, t) {
return this.currentPoint.set(e, t), this;
}
lineTo(e, t) {
let n = new Hs(this.currentPoint.clone(), new F(e, t));
return this.curves.push(n), this.currentPoint.set(e, t), this;
}
quadraticCurveTo(e, t, n, r) {
let i = new Ws(this.currentPoint.clone(), new F(e, t), new F(n, r));
return this.curves.push(i), this.currentPoint.set(n, r), this;
}
bezierCurveTo(e, t, n, r, i, a) {
let o = new Bs(this.currentPoint.clone(), new F(e, t), new F(n, r), new F(i, a));
return this.curves.push(o), this.currentPoint.set(i, a), this;
}
splineThru(e) {
let t = new Ks([this.currentPoint.clone()].concat(e));
return this.curves.push(t), this.currentPoint.copy(e[e.length - 1]), this;
}
arc(e, t, n, r, i, a) {
let o = this.currentPoint.x, s = this.currentPoint.y;
return this.absarc(e + o, t + s, n, r, i, a), this;
}
absarc(e, t, n, r, i, a) {
return this.absellipse(e, t, n, n, r, i, a), this;
}
ellipse(e, t, n, r, i, a, o, s) {
let c = this.currentPoint.x, l = this.currentPoint.y;
return this.absellipse(e + c, t + l, n, r, i, a, o, s), this;
}
absellipse(e, t, n, r, i, a, o, s) {
let c = new xs(e, t, n, r, i, a, o, s);
if (this.curves.length > 0) {
let e = c.getPoint(0);
e.equals(this.currentPoint) || this.lineTo(e.x, e.y);
}
this.curves.push(c);
let l = c.getPoint(1);
return this.currentPoint.copy(l), this;
}
copy(e) {
return super.copy(e), this.currentPoint.copy(e.currentPoint), this;
}
toJSON() {
let e = super.toJSON();
return e.currentPoint = this.currentPoint.toArray(), e;
}
fromJSON(e) {
return super.fromJSON(e), this.currentPoint.fromArray(e.currentPoint), this;
}
}, Xs = class extends Ys {
constructor(e) {
super(e), this.uuid = dn(), this.type = "Shape", this.holes = [];
}
getPointsHoles(e) {
let t = [];
for (let n = 0, r = this.holes.length; n < r; n++) t[n] = this.holes[n].getPoints(e);
return t;
}
extractPoints(e) {
return {
shape: this.getPoints(e),
holes: this.getPointsHoles(e)
};
}
copy(e) {
super.copy(e), this.holes = [];
for (let t = 0, n = e.holes.length; t < n; t++) {
let n = e.holes[t];
this.holes.push(n.clone());
}
return this;
}
toJSON() {
let e = super.toJSON();
e.uuid = this.uuid, e.holes = [];
for (let t = 0, n = this.holes.length; t < n; t++) {
let n = this.holes[t];
e.holes.push(n.toJSON());
}
return e;
}
fromJSON(e) {
super.fromJSON(e), this.uuid = e.uuid, this.holes = [];
for (let t = 0, n = e.holes.length; t < n; t++) {
let n = e.holes[t];
this.holes.push(new Ys().fromJSON(n));
}
return this;
}
};
function Zs(e, t, n = 2) {
let r = t && t.length, i = r ? t[0] * n : e.length, a = Qs(e, 0, i, n, !0), o = [];
if (!a || a.next === a.prev) return o;
let s, c, l;
if (r && (a = ac(e, t, a, n)), e.length > 80 * n) {
s = e[0], c = e[1];
let t = s, r = c;
for (let a = n; a < i; a += n) {
let n = e[a], i = e[a + 1];
n < s && (s = n), i < c && (c = i), n > t && (t = n), i > r && (r = i);
}
l = Math.max(t - s, r - c), l = l === 0 ? 0 : 32767 / l;
}
return ec(a, o, n, s, c, l, 0), o;
}
function Qs(e, t, n, r, i) {
let a;
if (i === Oc(e, t, n, r) > 0) for (let i = t; i < n; i += r) a = Tc(i / r | 0, e[i], e[i + 1], a);
else for (let i = n - r; i >= t; i -= r) a = Tc(i / r | 0, e[i], e[i + 1], a);
return a && _c(a, a.next) && (Ec(a), a = a.next), a;
}
function $s(e, t) {
if (!e) return e;
t || (t = e);
let n = e, r;
do
if (r = !1, !n.steiner && (_c(n, n.next) || X(n.prev, n, n.next) === 0)) {
if (Ec(n), n = t = n.prev, n === n.next) break;
r = !0;
} else n = n.next;
while (r || n !== t);
return t;
}
function ec(e, t, n, r, i, a, o) {
if (!e) return;
!o && a && uc(e, r, i, a);
let s = e;
for (; e.prev !== e.next;) {
let c = e.prev, l = e.next;
if (a ? nc(e, r, i, a) : tc(e)) {
t.push(c.i, e.i, l.i), Ec(e), e = l.next, s = l.next;
continue;
}
if (e = l, e === s) {
o ? o === 1 ? (e = rc($s(e), t), ec(e, t, n, r, i, a, 2)) : o === 2 && ic(e, t, n, r, i, a) : ec($s(e), t, n, r, i, a, 1);
break;
}
}
}
function tc(e) {
let t = e.prev, n = e, r = e.next;
if (X(t, n, r) >= 0) return !1;
let i = t.x, a = n.x, o = r.x, s = t.y, c = n.y, l = r.y, u = Math.min(i, a, o), d = Math.min(s, c, l), f = Math.max(i, a, o), p = Math.max(s, c, l), m = r.next;
for (; m !== t;) {
if (m.x >= u && m.x <= f && m.y >= d && m.y <= p && hc(i, s, a, c, o, l, m.x, m.y) && X(m.prev, m, m.next) >= 0) return !1;
m = m.next;
}
return !0;
}
function nc(e, t, n, r) {
let i = e.prev, a = e, o = e.next;
if (X(i, a, o) >= 0) return !1;
let s = i.x, c = a.x, l = o.x, u = i.y, d = a.y, f = o.y, p = Math.min(s, c, l), m = Math.min(u, d, f), h = Math.max(s, c, l), g = Math.max(u, d, f), _ = fc(p, m, t, n, r), v = fc(h, g, t, n, r), y = e.prevZ, b = e.nextZ;
for (; y && y.z >= _ && b && b.z <= v;) {
if (y.x >= p && y.x <= h && y.y >= m && y.y <= g && y !== i && y !== o && hc(s, u, c, d, l, f, y.x, y.y) && X(y.prev, y, y.next) >= 0 || (y = y.prevZ, b.x >= p && b.x <= h && b.y >= m && b.y <= g && b !== i && b !== o && hc(s, u, c, d, l, f, b.x, b.y) && X(b.prev, b, b.next) >= 0)) return !1;
b = b.nextZ;
}
for (; y && y.z >= _;) {
if (y.x >= p && y.x <= h && y.y >= m && y.y <= g && y !== i && y !== o && hc(s, u, c, d, l, f, y.x, y.y) && X(y.prev, y, y.next) >= 0) return !1;
y = y.prevZ;
}
for (; b && b.z <= v;) {
if (b.x >= p && b.x <= h && b.y >= m && b.y <= g && b !== i && b !== o && hc(s, u, c, d, l, f, b.x, b.y) && X(b.prev, b, b.next) >= 0) return !1;
b = b.nextZ;
}
return !0;
}
function rc(e, t) {
let n = e;
do {
let r = n.prev, i = n.next.next;
!_c(r, i) && vc(r, n, n.next, i) && Sc(r, i) && Sc(i, r) && (t.push(r.i, n.i, i.i), Ec(n), Ec(n.next), n = e = i), n = n.next;
} while (n !== e);
return $s(n);
}
function ic(e, t, n, r, i, a) {
let o = e;
do {
let e = o.next.next;
for (; e !== o.prev;) {
if (o.i !== e.i && gc(o, e)) {
let s = wc(o, e);
o = $s(o, o.next), s = $s(s, s.next), ec(o, t, n, r, i, a, 0), ec(s, t, n, r, i, a, 0);
return;
}
e = e.next;
}
o = o.next;
} while (o !== e);
}
function ac(e, t, n, r) {
let i = [];
for (let n = 0, a = t.length; n < a; n++) {
let o = Qs(e, t[n] * r, n < a - 1 ? t[n + 1] * r : e.length, r, !1);
o === o.next && (o.steiner = !0), i.push(pc(o));
}
i.sort(oc);
for (let e = 0; e < i.length; e++) n = sc(i[e], n);
return n;
}
function oc(e, t) {
let n = e.x - t.x;
return n === 0 && (n = e.y - t.y, n === 0 && (n = (e.next.y - e.y) / (e.next.x - e.x) - (t.next.y - t.y) / (t.next.x - t.x))), n;
}
function sc(e, t) {
let n = cc(e, t);
if (!n) return t;
let r = wc(n, e);
return $s(r, r.next), $s(n, n.next);
}
function cc(e, t) {
let n = t, r = e.x, i = e.y, a = -Infinity, o;
if (_c(e, n)) return n;
do {
if (_c(e, n.next)) return n.next;
if (i <= n.y && i >= n.next.y && n.next.y !== n.y) {
let e = n.x + (i - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
if (e <= r && e > a && (a = e, o = n.x < n.next.x ? n : n.next, e === r)) return o;
}
n = n.next;
} while (n !== t);
if (!o) return null;
let s = o, c = o.x, l = o.y, u = Infinity;
n = o;
do {
if (r >= n.x && n.x >= c && r !== n.x && mc(i < l ? r : a, i, c, l, i < l ? a : r, i, n.x, n.y)) {
let t = Math.abs(i - n.y) / (r - n.x);
Sc(n, e) && (t < u || t === u && (n.x > o.x || n.x === o.x && lc(o, n))) && (o = n, u = t);
}
n = n.next;
} while (n !== s);
return o;
}
function lc(e, t) {
return X(e.prev, e, t.prev) < 0 && X(t.next, e, e.next) < 0;
}
function uc(e, t, n, r) {
let i = e;
do
i.z === 0 && (i.z = fc(i.x, i.y, t, n, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next;
while (i !== e);
i.prevZ.nextZ = null, i.prevZ = null, dc(i);
}
function dc(e) {
let t, n = 1;
do {
let r = e, i;
e = null;
let a = null;
for (t = 0; r;) {
t++;
let o = r, s = 0;
for (let e = 0; e < n && (s++, o = o.nextZ, o); e++);
let c = n;
for (; s > 0 || c > 0 && o;) s !== 0 && (c === 0 || !o || r.z <= o.z) ? (i = r, r = r.nextZ, s--) : (i = o, o = o.nextZ, c--), a ? a.nextZ = i : e = i, i.prevZ = a, a = i;
r = o;
}
a.nextZ = null, n *= 2;
} while (t > 1);
return e;
}
function fc(e, t, n, r, i) {
return e = (e - n) * i | 0, t = (t - r) * i | 0, e = (e | e << 8) & 16711935, e = (e | e << 4) & 252645135, e = (e | e << 2) & 858993459, e = (e | e << 1) & 1431655765, t = (t | t << 8) & 16711935, t = (t | t << 4) & 252645135, t = (t | t << 2) & 858993459, t = (t | t << 1) & 1431655765, e | t << 1;
}
function pc(e) {
let t = e, n = e;
do
(t.x < n.x || t.x === n.x && t.y < n.y) && (n = t), t = t.next;
while (t !== e);
return n;
}
function mc(e, t, n, r, i, a, o, s) {
return (i - o) * (t - s) >= (e - o) * (a - s) && (e - o) * (r - s) >= (n - o) * (t - s) && (n - o) * (a - s) >= (i - o) * (r - s);
}
function hc(e, t, n, r, i, a, o, s) {
return !(e === o && t === s) && mc(e, t, n, r, i, a, o, s);
}
function gc(e, t) {
return e.next.i !== t.i && e.prev.i !== t.i && !xc(e, t) && (Sc(e, t) && Sc(t, e) && Cc(e, t) && (X(e.prev, e, t.prev) || X(e, t.prev, t)) || _c(e, t) && X(e.prev, e, e.next) > 0 && X(t.prev, t, t.next) > 0);
}
function X(e, t, n) {
return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y);
}
function _c(e, t) {
return e.x === t.x && e.y === t.y;
}
function vc(e, t, n, r) {
let i = bc(X(e, t, n)), a = bc(X(e, t, r)), o = bc(X(n, r, e)), s = bc(X(n, r, t));
return !!(i !== a && o !== s || i === 0 && yc(e, n, t) || a === 0 && yc(e, r, t) || o === 0 && yc(n, e, r) || s === 0 && yc(n, t, r));
}
function yc(e, t, n) {
return t.x <= Math.max(e.x, n.x) && t.x >= Math.min(e.x, n.x) && t.y <= Math.max(e.y, n.y) && t.y >= Math.min(e.y, n.y);
}
function bc(e) {
return e > 0 ? 1 : e < 0 ? -1 : 0;
}
function xc(e, t) {
let n = e;
do {
if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && vc(n, n.next, e, t)) return !0;
n = n.next;
} while (n !== e);
return !1;
}
function Sc(e, t) {
return X(e.prev, e, e.next) < 0 ? X(e, t, e.next) >= 0 && X(e, e.prev, t) >= 0 : X(e, t, e.prev) < 0 || X(e, e.next, t) < 0;
}
function Cc(e, t) {
let n = e, r = !1, i = (e.x + t.x) / 2, a = (e.y + t.y) / 2;
do
n.y > a != n.next.y > a && n.next.y !== n.y && i < (n.next.x - n.x) * (a - n.y) / (n.next.y - n.y) + n.x && (r = !r), n = n.next;
while (n !== e);
return r;
}
function wc(e, t) {
let n = Dc(e.i, e.x, e.y), r = Dc(t.i, t.x, t.y), i = e.next, a = t.prev;
return e.next = t, t.prev = e, n.next = i, i.prev = n, r.next = n, n.prev = r, a.next = r, r.prev = a, r;
}
function Tc(e, t, n, r) {
let i = Dc(e, t, n);
return r ? (i.next = r.next, i.prev = r, r.next.prev = i, r.next = i) : (i.prev = i, i.next = i), i;
}
function Ec(e) {
e.next.prev = e.prev, e.prev.next = e.next, e.prevZ && (e.prevZ.nextZ = e.nextZ), e.nextZ && (e.nextZ.prevZ = e.prevZ);
}
function Dc(e, t, n) {
return {
i: e,
x: t,
y: n,
prev: null,
next: null,
z: 0,
prevZ: null,
nextZ: null,
steiner: !1
};
}
function Oc(e, t, n, r) {
let i = 0;
for (let a = t, o = n - r; a < n; a += r) i += (e[o] - e[a]) * (e[a + 1] + e[o + 1]), o = a;
return i;
}
var kc = class {
static triangulate(e, t, n = 2) {
return Zs(e, t, n);
}
}, Ac = class e {
static area(e) {
let t = e.length, n = 0;
for (let r = t - 1, i = 0; i < t; r = i++) n += e[r].x * e[i].y - e[i].x * e[r].y;
return n * .5;
}
static isClockWise(t) {
return e.area(t) < 0;
}
static triangulateShape(e, t) {
let n = [], r = [], i = [];
jc(e), Mc(n, e);
let a = e.length;
t.forEach(jc);
for (let e = 0; e < t.length; e++) r.push(a), a += t[e].length, Mc(n, t[e]);
let o = kc.triangulate(n, r);
for (let e = 0; e < o.length; e += 3) i.push(o.slice(e, e + 3));
return i;
}
};
function jc(e) {
let t = e.length;
t > 2 && e[t - 1].equals(e[0]) && e.pop();
}
function Mc(e, t) {
for (let n = 0; n < t.length; n++) e.push(t[n].x), e.push(t[n].y);
}
var Nc = class e extends J {
constructor(e = new Xs([
new F(.5, .5),
new F(-.5, .5),
new F(-.5, -.5),
new F(.5, -.5)
]), t = {}) {
super(), this.type = "ExtrudeGeometry", this.parameters = {
shapes: e,
options: t
}, e = Array.isArray(e) ? e : [e];
let n = this, r = [], i = [];
for (let t = 0, n = e.length; t < n; t++) {
let n = e[t];
a(n);
}
this.setAttribute("position", new G(r, 3)), this.setAttribute("uv", new G(i, 2)), this.computeVertexNormals();
function a(e) {
let a = [], o = t.curveSegments === void 0 ? 12 : t.curveSegments, s = t.steps === void 0 ? 1 : t.steps, c = t.depth === void 0 ? 1 : t.depth, l = t.bevelEnabled === void 0 || t.bevelEnabled, u = t.bevelThickness === void 0 ? .2 : t.bevelThickness, d = t.bevelSize === void 0 ? u - .1 : t.bevelSize, f = t.bevelOffset === void 0 ? 0 : t.bevelOffset, p = t.bevelSegments === void 0 ? 3 : t.bevelSegments, m = t.extrudePath, h = t.UVGenerator === void 0 ? Pc : t.UVGenerator, g, _ = !1, v, y, b, x;
if (m) {
g = m.getSpacedPoints(s), _ = !0, l = !1;
let e = m.isCatmullRomCurve3 ? m.closed : !1;
v = m.computeFrenetFrames(s, e), y = new I(), b = new I(), x = new I();
}
l || (p = 0, u = 0, d = 0, f = 0);
let S = e.extractPoints(o), C = S.shape, w = S.holes;
if (!Ac.isClockWise(C)) {
C = C.reverse();
for (let e = 0, t = w.length; e < t; e++) {
let t = w[e];
Ac.isClockWise(t) && (w[e] = t.reverse());
}
}
function T(e) {
let t = e[0];
for (let n = 1; n <= e.length; n++) {
let r = n % e.length, i = e[r], a = i.x - t.x, o = i.y - t.y, s = a * a + o * o, c = Math.max(Math.abs(i.x), Math.abs(i.y), Math.abs(t.x), Math.abs(t.y));
if (s <= 10000000000000001e-36 * c * c) {
e.splice(r, 1), n--;
continue;
}
t = i;
}
}
T(C), w.forEach(T);
let E = w.length, D = C;
for (let e = 0; e < E; e++) {
let t = w[e];
C = C.concat(t);
}
function O(e, t, n) {
return t || M("ExtrudeGeometry: vec does not exist"), e.clone().addScaledVector(t, n);
}
let k = C.length;
function A(e, t, n) {
let r, i, a, o = e.x - t.x, s = e.y - t.y, c = n.x - e.x, l = n.y - e.y, u = o * o + s * s, d = o * l - s * c;
if (Math.abs(d) > 2 ** -52) {
let d = Math.sqrt(u), f = Math.sqrt(c * c + l * l), p = t.x - s / d, m = t.y + o / d, h = n.x - l / f, g = n.y + c / f, _ = ((h - p) * l - (g - m) * c) / (o * l - s * c);
r = p + o * _ - e.x, i = m + s * _ - e.y;
let v = r * r + i * i;
if (v <= 2) return new F(r, i);
a = Math.sqrt(v / 2);
} else {
let e = !1;
o > 2 ** -52 ? c > 2 ** -52 && (e = !0) : o < -(2 ** -52) ? c < -(2 ** -52) && (e = !0) : Math.sign(s) === Math.sign(l) && (e = !0), e ? (r = -s, i = o, a = Math.sqrt(u)) : (r = o, i = s, a = Math.sqrt(u / 2));
}
return new F(r / a, i / a);
}
let ee = [];
for (let e = 0, t = D.length, n = t - 1, r = e + 1; e < t; e++, n++, r++) n === t && (n = 0), r === t && (r = 0), ee[e] = A(D[e], D[n], D[r]);
let te = [], ne, re = ee.concat();
for (let e = 0, t = E; e < t; e++) {
let t = w[e];
ne = [];
for (let e = 0, n = t.length, r = n - 1, i = e + 1; e < n; e++, r++, i++) r === n && (r = 0), i === n && (i = 0), ne[e] = A(t[e], t[r], t[i]);
te.push(ne), re = re.concat(ne);
}
let ie;
if (p === 0) ie = Ac.triangulateShape(D, w);
else {
let e = [], t = [];
for (let n = 0; n < p; n++) {
let r = n / p, i = u * Math.cos(r * Math.PI / 2), a = d * Math.sin(r * Math.PI / 2) + f;
for (let t = 0, n = D.length; t < n; t++) {
let n = O(D[t], ee[t], a);
ue(n.x, n.y, -i), r === 0 && e.push(n);
}
for (let e = 0, n = E; e < n; e++) {
let n = w[e];
ne = te[e];
let o = [];
for (let e = 0, t = n.length; e < t; e++) {
let t = O(n[e], ne[e], a);
ue(t.x, t.y, -i), r === 0 && o.push(t);
}
r === 0 && t.push(o);
}
}
ie = Ac.triangulateShape(e, t);
}
let ae = ie.length, oe = d + f;
for (let e = 0; e < k; e++) {
let t = l ? O(C[e], re[e], oe) : C[e];
_ ? (b.copy(v.normals[0]).multiplyScalar(t.x), y.copy(v.binormals[0]).multiplyScalar(t.y), x.copy(g[0]).add(b).add(y), ue(x.x, x.y, x.z)) : ue(t.x, t.y, 0);
}
for (let e = 1; e <= s; e++) for (let t = 0; t < k; t++) {
let n = l ? O(C[t], re[t], oe) : C[t];
_ ? (b.copy(v.normals[e]).multiplyScalar(n.x), y.copy(v.binormals[e]).multiplyScalar(n.y), x.copy(g[e]).add(b).add(y), ue(x.x, x.y, x.z)) : ue(n.x, n.y, c / s * e);
}
for (let e = p - 1; e >= 0; e--) {
let t = e / p, n = u * Math.cos(t * Math.PI / 2), r = d * Math.sin(t * Math.PI / 2) + f;
for (let e = 0, t = D.length; e < t; e++) {
let t = O(D[e], ee[e], r);
ue(t.x, t.y, c + n);
}
for (let e = 0, t = w.length; e < t; e++) {
let t = w[e];
ne = te[e];
for (let e = 0, i = t.length; e < i; e++) {
let i = O(t[e], ne[e], r);
_ ? ue(i.x, i.y + g[s - 1].y, g[s - 1].x + n) : ue(i.x, i.y, c + n);
}
}
}
se(), ce();
function se() {
let e = r.length / 3;
if (l) {
let e = 0, t = k * e;
for (let e = 0; e < ae; e++) {
let n = ie[e];
de(n[2] + t, n[1] + t, n[0] + t);
}
e = s + p * 2, t = k * e;
for (let e = 0; e < ae; e++) {
let n = ie[e];
de(n[0] + t, n[1] + t, n[2] + t);
}
} else {
for (let e = 0; e < ae; e++) {
let t = ie[e];
de(t[2], t[1], t[0]);
}
for (let e = 0; e < ae; e++) {
let t = ie[e];
de(t[0] + k * s, t[1] + k * s, t[2] + k * s);
}
}
n.addGroup(e, r.length / 3 - e, 0);
}
function ce() {
let e = r.length / 3, t = 0;
le(D, t), t += D.length;
for (let e = 0, n = w.length; e < n; e++) {
let n = w[e];
le(n, t), t += n.length;
}
n.addGroup(e, r.length / 3 - e, 1);
}
function le(e, t) {
let n = e.length;
for (; --n >= 0;) {
let r = n, i = n - 1;
i < 0 && (i = e.length - 1);
for (let e = 0, n = s + p * 2; e < n; e++) {
let n = k * e, a = k * (e + 1);
fe(t + r + n, t + i + n, t + i + a, t + r + a);
}
}
}
function ue(e, t, n) {
a.push(e), a.push(t), a.push(n);
}
function de(e, t, i) {
pe(e), pe(t), pe(i);
let a = r.length / 3, o = h.generateTopUV(n, r, a - 3, a - 2, a - 1);
me(o[0]), me(o[1]), me(o[2]);
}
function fe(e, t, i, a) {
pe(e), pe(t), pe(a), pe(t), pe(i), pe(a);
let o = r.length / 3, s = h.generateSideWallUV(n, r, o - 6, o - 3, o - 2, o - 1);
me(s[0]), me(s[1]), me(s[3]), me(s[1]), me(s[2]), me(s[3]);
}
function pe(e) {
r.push(a[e * 3 + 0]), r.push(a[e * 3 + 1]), r.push(a[e * 3 + 2]);
}
function me(e) {
i.push(e.x), i.push(e.y);
}
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
toJSON() {
let e = super.toJSON(), t = this.parameters.shapes, n = this.parameters.options;
return Fc(t, n, e);
}
static fromJSON(t, n) {
let r = [];
for (let e = 0, i = t.shapes.length; e < i; e++) {
let i = n[t.shapes[e]];
r.push(i);
}
let i = t.options.extrudePath;
return i !== void 0 && (t.options.extrudePath = new qs[i.type]().fromJSON(i)), new e(r, t.options);
}
}, Pc = {
generateTopUV: function(e, t, n, r, i) {
let a = t[n * 3], o = t[n * 3 + 1], s = t[r * 3], c = t[r * 3 + 1], l = t[i * 3], u = t[i * 3 + 1];
return [
new F(a, o),
new F(s, c),
new F(l, u)
];
},
generateSideWallUV: function(e, t, n, r, i, a) {
let o = t[n * 3], s = t[n * 3 + 1], c = t[n * 3 + 2], l = t[r * 3], u = t[r * 3 + 1], d = t[r * 3 + 2], f = t[i * 3], p = t[i * 3 + 1], m = t[i * 3 + 2], h = t[a * 3], g = t[a * 3 + 1], _ = t[a * 3 + 2];
return Math.abs(s - u) < Math.abs(o - l) ? [
new F(o, 1 - c),
new F(l, 1 - d),
new F(f, 1 - m),
new F(h, 1 - _)
] : [
new F(s, 1 - c),
new F(u, 1 - d),
new F(p, 1 - m),
new F(g, 1 - _)
];
}
};
function Fc(e, t, n) {
if (n.shapes = [], Array.isArray(e)) for (let t = 0, r = e.length; t < r; t++) {
let r = e[t];
n.shapes.push(r.uuid);
}
else n.shapes.push(e.uuid);
return n.options = Object.assign({}, t), t.extrudePath !== void 0 && (n.options.extrudePath = t.extrudePath.toJSON()), n;
}
var Ic = class e extends ps {
constructor(e = 1, t = 0) {
let n = (1 + Math.sqrt(5)) / 2, r = [
-1,
n,
0,
1,
n,
0,
-1,
-n,
0,
1,
-n,
0,
0,
-1,
n,
0,
1,
n,
0,
-1,
-n,
0,
1,
-n,
n,
0,
-1,
n,
0,
1,
-n,
0,
-1,
-n,
0,
1
];
super(r, [
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
], e, t), this.type = "IcosahedronGeometry", this.parameters = {
radius: e,
detail: t
};
}
static fromJSON(t) {
return new e(t.radius, t.detail);
}
}, Lc = class e extends J {
constructor(e = [
new F(0, -.5),
new F(.5, 0),
new F(0, .5)
], t = 12, n = 0, r = Math.PI * 2) {
super(), this.type = "LatheGeometry", this.parameters = {
points: e,
segments: t,
phiStart: n,
phiLength: r
}, t = Math.floor(t), r = N(r, 0, Math.PI * 2);
let i = [], a = [], o = [], s = [], c = [], l = 1 / t, u = new I(), d = new F(), f = new I(), p = new I(), m = new I(), h = 0, g = 0;
for (let t = 0; t <= e.length - 1; t++) switch (t) {
case 0:
h = e[t + 1].x - e[t].x, g = e[t + 1].y - e[t].y, f.x = g * 1, f.y = -h, f.z = g * 0, m.copy(f), f.normalize(), s.push(f.x, f.y, f.z);
break;
case e.length - 1:
s.push(m.x, m.y, m.z);
break;
default: h = e[t + 1].x - e[t].x, g = e[t + 1].y - e[t].y, f.x = g * 1, f.y = -h, f.z = g * 0, p.copy(f), f.x += m.x, f.y += m.y, f.z += m.z, f.normalize(), s.push(f.x, f.y, f.z), m.copy(p);
}
for (let i = 0; i <= t; i++) {
let f = n + i * l * r, p = Math.sin(f), m = Math.cos(f);
for (let n = 0; n <= e.length - 1; n++) {
u.x = e[n].x * p, u.y = e[n].y, u.z = e[n].x * m, a.push(u.x, u.y, u.z), d.x = i / t, d.y = n / (e.length - 1), o.push(d.x, d.y);
let r = s[3 * n + 0] * p, l = s[3 * n + 1], f = s[3 * n + 0] * m;
c.push(r, l, f);
}
}
for (let n = 0; n < t; n++) for (let t = 0; t < e.length - 1; t++) {
let r = t + n * e.length, a = r, o = r + e.length, s = r + e.length + 1, c = r + 1;
i.push(a, o, c), i.push(s, c, o);
}
this.setIndex(i), this.setAttribute("position", new G(a, 3)), this.setAttribute("uv", new G(o, 2)), this.setAttribute("normal", new G(c, 3));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.points, t.segments, t.phiStart, t.phiLength);
}
}, Rc = class e extends ps {
constructor(e = 1, t = 0) {
super([
1,
0,
0,
-1,
0,
0,
0,
1,
0,
0,
-1,
0,
0,
0,
1,
0,
0,
-1
], [
0,
2,
4,
0,
4,
3,
0,
3,
5,
0,
5,
2,
1,
2,
5,
1,
5,
3,
1,
3,
4,
1,
4,
2
], e, t), this.type = "OctahedronGeometry", this.parameters = {
radius: e,
detail: t
};
}
static fromJSON(t) {
return new e(t.radius, t.detail);
}
}, zc = class e extends J {
constructor(e = 1, t = 1, n = 1, r = 1) {
super(), this.type = "PlaneGeometry", this.parameters = {
width: e,
height: t,
widthSegments: n,
heightSegments: r
};
let i = e / 2, a = t / 2, o = Math.floor(n), s = Math.floor(r), c = o + 1, l = s + 1, u = e / o, d = t / s, f = [], p = [], m = [], h = [];
for (let e = 0; e < l; e++) {
let t = e * d - a;
for (let n = 0; n < c; n++) {
let r = n * u - i;
p.push(r, -t, 0), m.push(0, 0, 1), h.push(n / o), h.push(1 - e / s);
}
}
for (let e = 0; e < s; e++) for (let t = 0; t < o; t++) {
let n = t + c * e, r = t + c * (e + 1), i = t + 1 + c * (e + 1), a = t + 1 + c * e;
f.push(n, r, a), f.push(r, i, a);
}
this.setIndex(f), this.setAttribute("position", new G(p, 3)), this.setAttribute("normal", new G(m, 3)), this.setAttribute("uv", new G(h, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.width, t.height, t.widthSegments, t.heightSegments);
}
}, Bc = class e extends J {
constructor(e = .5, t = 1, n = 32, r = 1, i = 0, a = Math.PI * 2) {
super(), this.type = "RingGeometry", this.parameters = {
innerRadius: e,
outerRadius: t,
thetaSegments: n,
phiSegments: r,
thetaStart: i,
thetaLength: a
}, n = Math.max(3, n), r = Math.max(1, r);
let o = [], s = [], c = [], l = [], u = e, d = (t - e) / r, f = new I(), p = new F();
for (let e = 0; e <= r; e++) {
for (let e = 0; e <= n; e++) {
let r = i + e / n * a;
f.x = u * Math.cos(r), f.y = u * Math.sin(r), s.push(f.x, f.y, f.z), c.push(0, 0, 1), p.x = (f.x / t + 1) / 2, p.y = (f.y / t + 1) / 2, l.push(p.x, p.y);
}
u += d;
}
for (let e = 0; e < r; e++) {
let t = e * (n + 1);
for (let e = 0; e < n; e++) {
let r = e + t, i = r, a = r + n + 1, s = r + n + 2, c = r + 1;
o.push(i, a, c), o.push(a, s, c);
}
}
this.setIndex(o), this.setAttribute("position", new G(s, 3)), this.setAttribute("normal", new G(c, 3)), this.setAttribute("uv", new G(l, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.innerRadius, t.outerRadius, t.thetaSegments, t.phiSegments, t.thetaStart, t.thetaLength);
}
}, Vc = class e extends J {
constructor(e = new Xs([
new F(0, .5),
new F(-.5, -.5),
new F(.5, -.5)
]), t = 12) {
super(), this.type = "ShapeGeometry", this.parameters = {
shapes: e,
curveSegments: t
};
let n = [], r = [], i = [], a = [], o = 0, s = 0;
if (Array.isArray(e) === !1) c(e);
else for (let t = 0; t < e.length; t++) c(e[t]), this.addGroup(o, s, t), o += s, s = 0;
this.setIndex(n), this.setAttribute("position", new G(r, 3)), this.setAttribute("normal", new G(i, 3)), this.setAttribute("uv", new G(a, 2));
function c(e) {
let o = r.length / 3, c = e.extractPoints(t), l = c.shape, u = c.holes;
Ac.isClockWise(l) === !1 && (l = l.reverse());
for (let e = 0, t = u.length; e < t; e++) {
let t = u[e];
Ac.isClockWise(t) === !0 && (u[e] = t.reverse());
}
let d = Ac.triangulateShape(l, u);
for (let e = 0, t = u.length; e < t; e++) {
let t = u[e];
l = l.concat(t);
}
for (let e = 0, t = l.length; e < t; e++) {
let t = l[e];
r.push(t.x, t.y, 0), i.push(0, 0, 1), a.push(t.x, t.y);
}
for (let e = 0, t = d.length; e < t; e++) {
let t = d[e], r = t[0] + o, i = t[1] + o, a = t[2] + o;
n.push(r, i, a), s += 3;
}
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
toJSON() {
let e = super.toJSON(), t = this.parameters.shapes;
return Hc(t, e);
}
static fromJSON(t, n) {
let r = [];
for (let e = 0, i = t.shapes.length; e < i; e++) {
let i = n[t.shapes[e]];
r.push(i);
}
return new e(r, t.curveSegments);
}
};
function Hc(e, t) {
if (t.shapes = [], Array.isArray(e)) for (let n = 0, r = e.length; n < r; n++) {
let r = e[n];
t.shapes.push(r.uuid);
}
else t.shapes.push(e.uuid);
return t;
}
var Uc = class e extends J {
constructor(e = 1, t = 32, n = 16, r = 0, i = Math.PI * 2, a = 0, o = Math.PI) {
super(), this.type = "SphereGeometry", this.parameters = {
radius: e,
widthSegments: t,
heightSegments: n,
phiStart: r,
phiLength: i,
thetaStart: a,
thetaLength: o
}, t = Math.max(3, Math.floor(t)), n = Math.max(2, Math.floor(n));
let s = Math.min(a + o, Math.PI), c = 0, l = [], u = new I(), d = new I(), f = [], p = [], m = [], h = [];
for (let f = 0; f <= n; f++) {
let g = [], _ = f / n, v = a + _ * o, y = e * Math.cos(v), b = Math.sqrt(e * e - y * y), x = 0;
f === 0 && a === 0 ? x = .5 / t : f === n && s === Math.PI && (x = -.5 / t);
for (let e = 0; e <= t; e++) {
let n = e / t, a = r + n * i;
u.x = -b * Math.cos(a), u.y = y, u.z = b * Math.sin(a), p.push(u.x, u.y, u.z), d.copy(u).normalize(), m.push(d.x, d.y, d.z), h.push(n + x, 1 - _), g.push(c++);
}
l.push(g);
}
for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
let t = l[e][r + 1], i = l[e][r], o = l[e + 1][r], c = l[e + 1][r + 1];
(e !== 0 || a > 0) && f.push(t, i, c), (e !== n - 1 || s < Math.PI) && f.push(i, o, c);
}
this.setIndex(f), this.setAttribute("position", new G(p, 3)), this.setAttribute("normal", new G(m, 3)), this.setAttribute("uv", new G(h, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radius, t.widthSegments, t.heightSegments, t.phiStart, t.phiLength, t.thetaStart, t.thetaLength);
}
}, Wc = class e extends ps {
constructor(e = 1, t = 0) {
super([
1,
1,
1,
-1,
-1,
1,
-1,
1,
-1,
1,
-1,
-1
], [
2,
1,
0,
0,
3,
2,
1,
3,
0,
2,
3,
1
], e, t), this.type = "TetrahedronGeometry", this.parameters = {
radius: e,
detail: t
};
}
static fromJSON(t) {
return new e(t.radius, t.detail);
}
}, Gc = class e extends J {
constructor(e = 1, t = .4, n = 12, r = 48, i = Math.PI * 2, a = 0, o = Math.PI * 2) {
super(), this.type = "TorusGeometry", this.parameters = {
radius: e,
tube: t,
radialSegments: n,
tubularSegments: r,
arc: i,
thetaStart: a,
thetaLength: o
}, n = Math.floor(n), r = Math.floor(r);
let s = [], c = [], l = [], u = [], d = new I(), f = new I(), p = new I();
for (let s = 0; s <= n; s++) {
let m = a + s / n * o;
for (let a = 0; a <= r; a++) {
let o = a / r * i;
f.x = (e + t * Math.cos(m)) * Math.cos(o), f.y = (e + t * Math.cos(m)) * Math.sin(o), f.z = t * Math.sin(m), c.push(f.x, f.y, f.z), d.x = e * Math.cos(o), d.y = e * Math.sin(o), p.subVectors(f, d).normalize(), l.push(p.x, p.y, p.z), u.push(a / r), u.push(s / n);
}
}
for (let e = 1; e <= n; e++) for (let t = 1; t <= r; t++) {
let n = (r + 1) * e + t - 1, i = (r + 1) * (e - 1) + t - 1, a = (r + 1) * (e - 1) + t, o = (r + 1) * e + t;
s.push(n, i, o), s.push(i, a, o);
}
this.setIndex(s), this.setAttribute("position", new G(c, 3)), this.setAttribute("normal", new G(l, 3)), this.setAttribute("uv", new G(u, 2));
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radius, t.tube, t.radialSegments, t.tubularSegments, t.arc);
}
}, Kc = class e extends J {
constructor(e = 1, t = .4, n = 64, r = 8, i = 2, a = 3) {
super(), this.type = "TorusKnotGeometry", this.parameters = {
radius: e,
tube: t,
tubularSegments: n,
radialSegments: r,
p: i,
q: a
}, n = Math.floor(n), r = Math.floor(r);
let o = [], s = [], c = [], l = [], u = new I(), d = new I(), f = new I(), p = new I(), m = new I(), h = new I(), g = new I();
for (let o = 0; o <= n; ++o) {
let v = o / n * i * Math.PI * 2;
_(v, i, a, e, f), _(v + .01, i, a, e, p), h.subVectors(p, f), g.addVectors(p, f), m.crossVectors(h, g), g.crossVectors(m, h), m.normalize(), g.normalize();
for (let e = 0; e <= r; ++e) {
let i = e / r * Math.PI * 2, a = -t * Math.cos(i), p = t * Math.sin(i);
u.x = f.x + (a * g.x + p * m.x), u.y = f.y + (a * g.y + p * m.y), u.z = f.z + (a * g.z + p * m.z), s.push(u.x, u.y, u.z), d.subVectors(u, f).normalize(), c.push(d.x, d.y, d.z), l.push(o / n), l.push(e / r);
}
}
for (let e = 1; e <= n; e++) for (let t = 1; t <= r; t++) {
let n = (r + 1) * (e - 1) + (t - 1), i = (r + 1) * e + (t - 1), a = (r + 1) * e + t, s = (r + 1) * (e - 1) + t;
o.push(n, i, s), o.push(i, a, s);
}
this.setIndex(o), this.setAttribute("position", new G(s, 3)), this.setAttribute("normal", new G(c, 3)), this.setAttribute("uv", new G(l, 2));
function _(e, t, n, r, i) {
let a = Math.cos(e), o = Math.sin(e), s = n / t * e, c = Math.cos(s);
i.x = r * (2 + c) * .5 * a, i.y = r * (2 + c) * o * .5, i.z = r * Math.sin(s) * .5;
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
static fromJSON(t) {
return new e(t.radius, t.tube, t.tubularSegments, t.radialSegments, t.p, t.q);
}
}, qc = class e extends J {
constructor(e = new Gs(new I(-1, -1, 0), new I(-1, 1, 0), new I(1, 1, 0)), t = 64, n = 1, r = 8, i = !1) {
super(), this.type = "TubeGeometry", this.parameters = {
path: e,
tubularSegments: t,
radius: n,
radialSegments: r,
closed: i
};
let a = e.computeFrenetFrames(t, i);
this.tangents = a.tangents, this.normals = a.normals, this.binormals = a.binormals;
let o = new I(), s = new I(), c = new F(), l = new I(), u = [], d = [], f = [], p = [];
m(), this.setIndex(p), this.setAttribute("position", new G(u, 3)), this.setAttribute("normal", new G(d, 3)), this.setAttribute("uv", new G(f, 2));
function m() {
for (let e = 0; e < t; e++) h(e);
h(i === !1 ? t : 0), _(), g();
}
function h(i) {
l = e.getPointAt(i / t, l);
let c = a.normals[i], f = a.binormals[i];
for (let e = 0; e <= r; e++) {
let t = e / r * Math.PI * 2, i = Math.sin(t), a = -Math.cos(t);
s.x = a * c.x + i * f.x, s.y = a * c.y + i * f.y, s.z = a * c.z + i * f.z, s.normalize(), d.push(s.x, s.y, s.z), o.x = l.x + n * s.x, o.y = l.y + n * s.y, o.z = l.z + n * s.z, u.push(o.x, o.y, o.z);
}
}
function g() {
for (let e = 1; e <= t; e++) for (let t = 1; t <= r; t++) {
let n = (r + 1) * (e - 1) + (t - 1), i = (r + 1) * e + (t - 1), a = (r + 1) * e + t, o = (r + 1) * (e - 1) + t;
p.push(n, i, o), p.push(i, a, o);
}
}
function _() {
for (let e = 0; e <= t; e++) for (let n = 0; n <= r; n++) c.x = e / t, c.y = n / r, f.push(c.x, c.y);
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
toJSON() {
let e = super.toJSON();
return e.path = this.parameters.path.toJSON(), e;
}
static fromJSON(t) {
return new e(new qs[t.path.type]().fromJSON(t.path), t.tubularSegments, t.radius, t.radialSegments, t.closed);
}
}, Jc = class extends J {
constructor(e = null) {
if (super(), this.type = "WireframeGeometry", this.parameters = { geometry: e }, e !== null) {
let t = [], n = /* @__PURE__ */ new Set(), r = new I(), i = new I();
if (e.index !== null) {
let a = e.attributes.position, o = e.index, s = e.groups;
s.length === 0 && (s = [{
start: 0,
count: o.count,
materialIndex: 0
}]);
for (let e = 0, c = s.length; e < c; ++e) {
let c = s[e], l = c.start, u = c.count;
for (let e = l, s = l + u; e < s; e += 3) for (let s = 0; s < 3; s++) {
let c = o.getX(e + s), l = o.getX(e + (s + 1) % 3);
r.fromBufferAttribute(a, c), i.fromBufferAttribute(a, l), Yc(r, i, n) === !0 && (t.push(r.x, r.y, r.z), t.push(i.x, i.y, i.z));
}
}
} else {
let a = e.attributes.position;
for (let e = 0, o = a.count / 3; e < o; e++) for (let o = 0; o < 3; o++) {
let s = 3 * e + o, c = 3 * e + (o + 1) % 3;
r.fromBufferAttribute(a, s), i.fromBufferAttribute(a, c), Yc(r, i, n) === !0 && (t.push(r.x, r.y, r.z), t.push(i.x, i.y, i.z));
}
}
this.setAttribute("position", new G(t, 3));
}
}
copy(e) {
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this;
}
};
function Yc(e, t, n) {
let r = `${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`, i = `${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;
return n.has(r) === !0 || n.has(i) === !0 ? !1 : (n.add(r), n.add(i), !0);
}
var Xc = /*#__PURE__*/ Object.freeze({
__proto__: null,
BoxGeometry: cs,
CapsuleGeometry: ls,
CircleGeometry: us,
ConeGeometry: fs,
CylinderGeometry: ds,
DodecahedronGeometry: ms,
EdgesGeometry: ys,
ExtrudeGeometry: Nc,
IcosahedronGeometry: Ic,
LatheGeometry: Lc,
OctahedronGeometry: Rc,
PlaneGeometry: zc,
PolyhedronGeometry: ps,
RingGeometry: Bc,
ShapeGeometry: Vc,
SphereGeometry: Uc,
TetrahedronGeometry: Wc,
TorusGeometry: Gc,
TorusKnotGeometry: Kc,
TubeGeometry: qc,
WireframeGeometry: Jc
}), Zc = class extends Y {
constructor(e) {
super(), this.isShadowMaterial = !0, this.type = "ShadowMaterial", this.color = new B(0), this.transparent = !0, this.fog = !0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.color.copy(e.color), this.fog = e.fog, this;
}
};
function Qc(e) {
let t = {};
for (let n in e) {
t[n] = {};
for (let r in e[n]) {
let i = e[n][r];
if (el(i)) i.isRenderTargetTexture ? (j("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."), t[n][r] = null) : t[n][r] = i.clone();
else if (Array.isArray(i)) if (el(i[0])) {
let e = [];
for (let t = 0, n = i.length; t < n; t++) e[t] = i[t].clone();
t[n][r] = e;
} else t[n][r] = i.slice();
else t[n][r] = i;
}
}
return t;
}
function $c(e) {
let t = {};
for (let n = 0; n < e.length; n++) {
let r = Qc(e[n]);
for (let e in r) t[e] = r[e];
}
return t;
}
function el(e) {
return e && (e.isColor || e.isMatrix3 || e.isMatrix4 || e.isVector2 || e.isVector3 || e.isVector4 || e.isTexture || e.isQuaternion);
}
function tl(e) {
let t = [];
for (let n = 0; n < e.length; n++) t.push(e[n].clone());
return t;
}
function nl(e) {
let t = e.getRenderTarget();
return t === null ? e.outputColorSpace : t.isXRRenderTarget === !0 ? t.texture.colorSpace : Bn.workingColorSpace;
}
var rl = {
clone: Qc,
merge: $c
}, il = "void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}", al = "void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}", ol = class extends Y {
constructor(e) {
super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = il, this.fragmentShader = al, this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.forceSinglePass = !0, this.extensions = {
clipCullDistance: !1,
multiDraw: !1
}, this.defaultAttributeValues = {
color: [
1,
1,
1
],
uv: [0, 0],
uv1: [0, 0]
}, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, e !== void 0 && this.setValues(e);
}
copy(e) {
return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = Qc(e.uniforms), this.uniformsGroups = tl(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this.defaultAttributeValues = Object.assign({}, e.defaultAttributeValues), this.index0AttributeName = e.index0AttributeName, this.uniformsNeedUpdate = e.uniformsNeedUpdate, this;
}
toJSON(e) {
let t = super.toJSON(e);
t.glslVersion = this.glslVersion, t.uniforms = {};
for (let n in this.uniforms) {
let r = this.uniforms[n].value;
r && r.isTexture ? t.uniforms[n] = {
type: "t",
value: r.toJSON(e).uuid
} : r && r.isColor ? t.uniforms[n] = {
type: "c",
value: r.getHex()
} : r && r.isVector2 ? t.uniforms[n] = {
type: "v2",
value: r.toArray()
} : r && r.isVector3 ? t.uniforms[n] = {
type: "v3",
value: r.toArray()
} : r && r.isVector4 ? t.uniforms[n] = {
type: "v4",
value: r.toArray()
} : r && r.isMatrix3 ? t.uniforms[n] = {
type: "m3",
value: r.toArray()
} : r && r.isMatrix4 ? t.uniforms[n] = {
type: "m4",
value: r.toArray()
} : t.uniforms[n] = { value: r };
}
Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader, t.lights = this.lights, t.clipping = this.clipping;
let n = {};
for (let e in this.extensions) this.extensions[e] === !0 && (n[e] = !0);
return Object.keys(n).length > 0 && (t.extensions = n), t;
}
fromJSON(e, t) {
if (super.fromJSON(e, t), e.uniforms !== void 0) for (let n in e.uniforms) {
let r = e.uniforms[n];
switch (this.uniforms[n] = {}, r.type) {
case "t":
this.uniforms[n].value = t[r.value] || null;
break;
case "c":
this.uniforms[n].value = new B().setHex(r.value);
break;
case "v2":
this.uniforms[n].value = new F().fromArray(r.value);
break;
case "v3":
this.uniforms[n].value = new I().fromArray(r.value);
break;
case "v4":
this.uniforms[n].value = new Xn().fromArray(r.value);
break;
case "m3":
this.uniforms[n].value = new Fn().fromArray(r.value);
break;
case "m4":
this.uniforms[n].value = new R().fromArray(r.value);
break;
default: this.uniforms[n].value = r.value;
}
}
if (e.defines !== void 0 && (this.defines = e.defines), e.vertexShader !== void 0 && (this.vertexShader = e.vertexShader), e.fragmentShader !== void 0 && (this.fragmentShader = e.fragmentShader), e.glslVersion !== void 0 && (this.glslVersion = e.glslVersion), e.extensions !== void 0) for (let t in e.extensions) this.extensions[t] = e.extensions[t];
return e.lights !== void 0 && (this.lights = e.lights), e.clipping !== void 0 && (this.clipping = e.clipping), this;
}
}, sl = class extends ol {
constructor(e) {
super(e), this.isRawShaderMaterial = !0, this.type = "RawShaderMaterial";
}
}, cl = class extends Y {
constructor(e) {
super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = { STANDARD: "" }, this.color = new B(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 B(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new fr(), this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, 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.envMapRotation.copy(e.envMapRotation), this.envMapIntensity = e.envMapIntensity, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}, ll = class extends cl {
constructor(e) {
super(), this.isMeshPhysicalMaterial = !0, this.defines = {
STANDARD: "",
PHYSICAL: ""
}, this.type = "MeshPhysicalMaterial", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new F(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, "reflectivity", {
get: function() {
return N(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);
},
set: function(e) {
this.ior = (1 + .4 * e) / (1 - .4 * e);
}
}), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [100, 400], this.iridescenceThicknessMap = null, this.sheenColor = new B(0), this.sheenColorMap = null, this.sheenRoughness = 1, this.sheenRoughnessMap = null, this.transmissionMap = null, this.thickness = 0, this.thicknessMap = null, this.attenuationDistance = Infinity, this.attenuationColor = new B(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new B(1, 1, 1), this.specularColorMap = null, this._anisotropy = 0, this._clearcoat = 0, this._dispersion = 0, this._iridescence = 0, this._sheen = 0, this._transmission = 0, this.setValues(e);
}
get anisotropy() {
return this._anisotropy;
}
set anisotropy(e) {
this._anisotropy > 0 != e > 0 && this.version++, this._anisotropy = e;
}
get clearcoat() {
return this._clearcoat;
}
set clearcoat(e) {
this._clearcoat > 0 != e > 0 && this.version++, this._clearcoat = e;
}
get iridescence() {
return this._iridescence;
}
set iridescence(e) {
this._iridescence > 0 != e > 0 && this.version++, this._iridescence = e;
}
get dispersion() {
return this._dispersion;
}
set dispersion(e) {
this._dispersion > 0 != e > 0 && this.version++, this._dispersion = e;
}
get sheen() {
return this._sheen;
}
set sheen(e) {
this._sheen > 0 != e > 0 && this.version++, this._sheen = e;
}
get transmission() {
return this._transmission;
}
set transmission(e) {
this._transmission > 0 != e > 0 && this.version++, this._transmission = e;
}
copy(e) {
return super.copy(e), this.defines = {
STANDARD: "",
PHYSICAL: ""
}, this.anisotropy = e.anisotropy, this.anisotropyRotation = e.anisotropyRotation, this.anisotropyMap = e.anisotropyMap, 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.dispersion = e.dispersion, this.ior = e.ior, this.iridescence = e.iridescence, this.iridescenceMap = e.iridescenceMap, this.iridescenceIOR = e.iridescenceIOR, this.iridescenceThicknessRange = [...e.iridescenceThicknessRange], this.iridescenceThicknessMap = e.iridescenceThicknessMap, this.sheen = e.sheen, this.sheenColor.copy(e.sheenColor), this.sheenColorMap = e.sheenColorMap, this.sheenRoughness = e.sheenRoughness, this.sheenRoughnessMap = e.sheenRoughnessMap, 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.specularIntensity = e.specularIntensity, this.specularIntensityMap = e.specularIntensityMap, this.specularColor.copy(e.specularColor), this.specularColorMap = e.specularColorMap, this;
}
}, ul = class extends Y {
constructor(e) {
super(), this.isMeshPhongMaterial = !0, this.type = "MeshPhongMaterial", this.color = new B(16777215), this.specular = new B(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new B(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new fr(), this.combine = 0, this.reflectivity = 1, this.envMapIntensity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, 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.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, 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.flatShading = e.flatShading, this.fog = e.fog, this;
}
}, dl = class extends Y {
constructor(e) {
super(), this.isMeshToonMaterial = !0, this.defines = { TOON: "" }, this.type = "MeshToonMaterial", this.color = new B(16777215), this.map = null, this.gradientMap = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new B(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(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.fog = !0, 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.fog = e.fog, this;
}
}, fl = class extends Y {
constructor(e) {
super(), this.isMeshNormalMaterial = !0, this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 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.flatShading = e.flatShading, this;
}
}, pl = class extends Y {
constructor(e) {
super(), this.isMeshLambertMaterial = !0, this.type = "MeshLambertMaterial", this.color = new B(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new B(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new fr(), this.combine = 0, this.reflectivity = 1, this.envMapIntensity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, 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.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.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, 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.flatShading = e.flatShading, this.fog = e.fog, this;
}
}, ml = class extends Y {
constructor(e) {
super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = pt, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e);
}
copy(e) {
return super.copy(e), this.depthPacking = e.depthPacking, 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;
}
}, hl = class extends Y {
constructor(e) {
super(), this.isMeshDistanceMaterial = !0, this.type = "MeshDistanceMaterial", this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.setValues(e);
}
copy(e) {
return super.copy(e), this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this;
}
}, gl = class extends Y {
constructor(e) {
super(), this.isMeshMatcapMaterial = !0, this.defines = { MATCAP: "" }, this.type = "MeshMatcapMaterial", this.color = new B(16777215), this.matcap = null, this.map = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new F(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.alphaMap = null, this.wireframe = !1, this.wireframeLinewidth = 1, this.flatShading = !1, this.fog = !0, 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.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.flatShading = e.flatShading, this.fog = e.fog, this;
}
}, _l = class extends ko {
constructor(e) {
super(), this.isLineDashedMaterial = !0, 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;
}
};
function vl(e, t) {
return !e || e.constructor === t ? e : typeof t.BYTES_PER_ELEMENT == "number" ? new t(e) : Array.prototype.slice.call(e);
}
function yl(e) {
function t(t, n) {
return e[t] - e[n];
}
let n = e.length, r = Array(n);
for (let e = 0; e !== n; ++e) r[e] = e;
return r.sort(t), r;
}
function bl(e, t, n) {
let r = e.length, i = new e.constructor(r);
for (let a = 0, o = 0; o !== r; ++a) {
let r = n[a] * t;
for (let n = 0; n !== t; ++n) i[o++] = e[r + n];
}
return i;
}
function xl(e, t, n, r) {
let i = 1, a = e[0];
for (; a !== void 0 && a[r] === void 0;) a = e[i++];
if (a === void 0) return;
let o = a[r];
if (o !== void 0) if (Array.isArray(o)) do
o = a[r], o !== void 0 && (t.push(a.time), n.push(...o)), a = e[i++];
while (a !== void 0);
else if (o.toArray !== void 0) do
o = a[r], o !== void 0 && (t.push(a.time), o.toArray(n, n.length)), a = e[i++];
while (a !== void 0);
else do
o = a[r], o !== void 0 && (t.push(a.time), n.push(o)), a = e[i++];
while (a !== void 0);
}
function Sl(e, t, n, r, i = 30) {
let a = e.clone();
a.name = t;
let o = [];
for (let e = 0; e < a.tracks.length; ++e) {
let t = a.tracks[e], s = t.getValueSize(), c = [], l = [];
for (let e = 0; e < t.times.length; ++e) {
let a = t.times[e] * i;
if (!(a < n || a >= r)) {
c.push(t.times[e]);
for (let n = 0; n < s; ++n) l.push(t.values[e * s + n]);
}
}
c.length !== 0 && (t.times = vl(c, t.times.constructor), t.values = vl(l, t.values.constructor), o.push(t));
}
a.tracks = o;
let s = Infinity;
for (let e = 0; e < a.tracks.length; ++e) s > a.tracks[e].times[0] && (s = a.tracks[e].times[0]);
for (let e = 0; e < a.tracks.length; ++e) a.tracks[e].shift(-1 * s);
return a.resetDuration(), a;
}
function Cl(e, t = 0, n = e, r = 30) {
r <= 0 && (r = 30);
let i = n.tracks.length, a = t / r;
for (let t = 0; t < i; ++t) {
let r = n.tracks[t], i = r.ValueTypeName;
if (i === "bool" || i === "string") continue;
let o = e.tracks.find(function(e) {
return e.name === r.name && e.ValueTypeName === i;
});
if (o === void 0) continue;
let s = 0, c = r.getValueSize();
r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (s = c / 3);
let l = 0, u = o.getValueSize();
o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline && (l = u / 3);
let d = r.times.length - 1, f;
if (a <= r.times[0]) {
let e = s, t = c - s;
f = r.values.slice(e, t);
} else if (a >= r.times[d]) {
let e = d * c + s, t = e + c - s;
f = r.values.slice(e, t);
} else {
let e = r.createInterpolant(), t = s, n = c - s;
e.evaluate(a), f = e.resultBuffer.slice(t, n);
}
i === "quaternion" && new Mn().fromArray(f).normalize().conjugate().toArray(f);
let p = o.times.length;
for (let e = 0; e < p; ++e) {
let t = e * u + l;
if (i === "quaternion") Mn.multiplyQuaternionsFlat(o.values, t, f, 0, o.values, t);
else {
let e = u - l * 2;
for (let n = 0; n < e; ++n) o.values[t + n] -= f[n];
}
}
}
return e.blendMode = ft, e;
}
var wl = class {
static convertArray(e, t) {
return vl(e, t);
}
static isTypedArray(e) {
return qt(e);
}
static getKeyframeOrder(e) {
return yl(e);
}
static sortedArray(e, t, n) {
return bl(e, t, n);
}
static flattenJSON(e, t, n, r) {
xl(e, t, n, r);
}
static subclip(e, t, n, r, i = 30) {
return Sl(e, t, n, r, i);
}
static makeClipAdditive(e, t = 0, n = e, r = 30) {
return Cl(e, t, n, r);
}
}, Tl = class {
constructor(e, t, n, r) {
this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = r === void 0 ? new t.constructor(n) : r, this.sampleValues = t, this.valueSize = n, this.settings = null, this.DefaultSettings_ = {};
}
evaluate(e) {
let t = this.parameterPositions, n = this._cachedIndex, r = t[n], i = t[n - 1];
validate_interval: {
seek: {
let a;
linear_scan: {
forward_scan: if (!(e < r)) {
for (let a = n + 2;;) {
if (r === void 0) {
if (e < i) break forward_scan;
return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);
}
if (n === a) break;
if (i = r, r = t[++n], e < r) break seek;
}
a = t.length;
break linear_scan;
}
if (!(e >= i)) {
let o = t[1];
e < o && (n = 2, i = o);
for (let a = n - 2;;) {
if (i === void 0) return this._cachedIndex = 0, this.copySampleValue_(0);
if (n === a) break;
if (r = i, i = t[--n - 1], e >= i) break seek;
}
a = n, n = 0;
break linear_scan;
}
break validate_interval;
}
for (; n < a;) {
let r = n + a >>> 1;
e < t[r] ? a = r : n = r + 1;
}
if (r = t[n], i = t[n - 1], i === void 0) return this._cachedIndex = 0, this.copySampleValue_(0);
if (r === void 0) return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1);
}
this._cachedIndex = n, this.intervalChanged_(n, i, r);
}
return this.interpolate_(n, i, e, r);
}
getSettings_() {
return this.settings || this.DefaultSettings_;
}
copySampleValue_(e) {
let t = this.resultBuffer, n = this.sampleValues, r = this.valueSize, i = e * r;
for (let e = 0; e !== r; ++e) t[e] = n[i + e];
return t;
}
interpolate_() {
throw Error("THREE.Interpolant: Call to abstract method.");
}
intervalChanged_() {}
}, El = class extends Tl {
constructor(e, t, n, r) {
super(e, t, n, r), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
endingStart: ct,
endingEnd: ct
};
}
intervalChanged_(e, t, n) {
let r = this.parameterPositions, i = e - 2, a = e + 1, o = r[i], s = r[a];
if (o === void 0) switch (this.getSettings_().endingStart) {
case lt:
i = e, o = 2 * t - n;
break;
case ut:
i = r.length - 2, o = t + r[i] - r[i + 1];
break;
default: i = e, o = n;
}
if (s === void 0) switch (this.getSettings_().endingEnd) {
case lt:
a = e, s = 2 * n - t;
break;
case ut:
a = 1, s = n + r[1] - r[0];
break;
default: a = e - 1, s = t;
}
let c = (n - t) * .5, l = this.valueSize;
this._weightPrev = c / (t - o), this._weightNext = c / (s - n), this._offsetPrev = i * l, this._offsetNext = a * l;
}
interpolate_(e, t, n, r) {
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = this._offsetPrev, u = this._offsetNext, d = this._weightPrev, f = this._weightNext, p = (n - t) / (r - t), m = p * p, h = m * p, g = -d * h + 2 * d * m - d * p, _ = (1 + d) * h + (-1.5 - 2 * d) * m + (-.5 + d) * p + 1, v = (-1 - f) * h + (1.5 + f) * m + .5 * p, y = f * h - f * m;
for (let e = 0; e !== o; ++e) i[e] = g * a[l + e] + _ * a[c + e] + v * a[s + e] + y * a[u + e];
return i;
}
}, Dl = class extends Tl {
constructor(e, t, n, r) {
super(e, t, n, r);
}
interpolate_(e, t, n, r) {
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = (n - t) / (r - t), u = 1 - l;
for (let e = 0; e !== o; ++e) i[e] = a[c + e] * u + a[s + e] * l;
return i;
}
}, Ol = class extends Tl {
constructor(e, t, n, r) {
super(e, t, n, r);
}
interpolate_(e) {
return this.copySampleValue_(e - 1);
}
}, kl = class extends Tl {
interpolate_(e, t, n, r) {
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = e * o, c = s - o, l = this.inTangents, u = this.outTangents;
if (!l || !u) {
let e = (n - t) / (r - t), l = 1 - e;
for (let t = 0; t !== o; ++t) i[t] = a[c + t] * l + a[s + t] * e;
return i;
}
let d = o * 2, f = e - 1;
for (let p = 0; p !== o; ++p) {
let o = a[c + p], m = a[s + p], h = f * d + p * 2, g = u[h], _ = u[h + 1], v = e * d + p * 2, y = l[v], b = l[v + 1], x = (n - t) / (r - t), S, C, w, T, E;
for (let e = 0; e < 8; e++) {
S = x * x, C = S * x, w = 1 - x, T = w * w, E = T * w;
let e = E * t + 3 * T * x * g + 3 * w * S * y + C * r - n;
if (Math.abs(e) < 1e-10) break;
let i = 3 * T * (g - t) + 6 * w * x * (y - g) + 3 * S * (r - y);
if (Math.abs(i) < 1e-10) break;
x -= e / i, x = Math.max(0, Math.min(1, x));
}
i[p] = E * o + 3 * T * x * _ + 3 * w * S * b + C * m;
}
return i;
}
}, Al = class {
constructor(e, t, n, r) {
if (e === void 0) throw Error("THREE.KeyframeTrack: track name is undefined");
if (t === void 0 || t.length === 0) throw Error("THREE.KeyframeTrack: no keyframes in track named " + e);
this.name = e, this.times = vl(t, this.TimeBufferType), this.values = vl(n, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation);
}
static toJSON(e) {
let t = e.constructor, n;
if (t.toJSON !== this.toJSON) n = t.toJSON(e);
else {
n = {
name: e.name,
times: vl(e.times, Array),
values: vl(e.values, Array)
};
let t = e.getInterpolation();
t !== e.DefaultInterpolation && (n.interpolation = t);
}
return n.type = e.ValueTypeName, n;
}
InterpolantFactoryMethodDiscrete(e) {
return new Ol(this.times, this.values, this.getValueSize(), e);
}
InterpolantFactoryMethodLinear(e) {
return new Dl(this.times, this.values, this.getValueSize(), e);
}
InterpolantFactoryMethodSmooth(e) {
return new El(this.times, this.values, this.getValueSize(), e);
}
InterpolantFactoryMethodBezier(e) {
let t = new kl(this.times, this.values, this.getValueSize(), e);
return this.settings && (t.inTangents = this.settings.inTangents, t.outTangents = this.settings.outTangents), t;
}
setInterpolation(e) {
let t;
switch (e) {
case it:
t = this.InterpolantFactoryMethodDiscrete;
break;
case at:
t = this.InterpolantFactoryMethodLinear;
break;
case ot:
t = this.InterpolantFactoryMethodSmooth;
break;
case st:
t = this.InterpolantFactoryMethodBezier;
break;
}
if (t === void 0) {
let t = "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 Error(t);
return j("KeyframeTrack:", t), this;
}
return this.createInterpolant = t, this;
}
getInterpolation() {
switch (this.createInterpolant) {
case this.InterpolantFactoryMethodDiscrete: return it;
case this.InterpolantFactoryMethodLinear: return at;
case this.InterpolantFactoryMethodSmooth: return ot;
case this.InterpolantFactoryMethodBezier: return st;
}
}
getValueSize() {
return this.values.length / this.times.length;
}
shift(e) {
if (e !== 0) {
let t = this.times;
for (let n = 0, r = t.length; n !== r; ++n) t[n] += e;
}
return this;
}
scale(e) {
if (e !== 1) {
let t = this.times;
for (let n = 0, r = t.length; n !== r; ++n) t[n] *= e;
}
return this;
}
trim(e, t) {
let n = this.times, r = n.length, i = 0, a = r - 1;
for (; i !== r && n[i] < e;) ++i;
for (; a !== -1 && n[a] > t;) --a;
if (++a, i !== 0 || a !== r) {
i >= a && (a = Math.max(a, 1), i = a - 1);
let e = this.getValueSize();
this.times = n.slice(i, a), this.values = this.values.slice(i * e, a * e);
}
return this;
}
validate() {
let e = !0, t = this.getValueSize();
t - Math.floor(t) !== 0 && (M("KeyframeTrack: Invalid value size in track.", this), e = !1);
let n = this.times, r = this.values, i = n.length;
i === 0 && (M("KeyframeTrack: Track is empty.", this), e = !1);
let a = null;
for (let t = 0; t !== i; t++) {
let r = n[t];
if (typeof r == "number" && isNaN(r)) {
M("KeyframeTrack: Time is not a valid number.", this, t, r), e = !1;
break;
}
if (a !== null && a > r) {
M("KeyframeTrack: Out of order keys.", this, t, r, a), e = !1;
break;
}
a = r;
}
if (r !== void 0 && qt(r)) for (let t = 0, n = r.length; t !== n; ++t) {
let n = r[t];
if (isNaN(n)) {
M("KeyframeTrack: Value is not a valid number.", this, t, n), e = !1;
break;
}
}
return e;
}
optimize() {
let e = this.times.slice(), t = this.values.slice(), n = this.getValueSize(), r = this.getInterpolation() === ot, i = e.length - 1, a = 1;
for (let o = 1; o < i; ++o) {
let i = !1, s = e[o];
if (s !== e[o + 1] && (o !== 1 || s !== e[0])) if (r) i = !0;
else {
let e = o * n, r = e - n, a = e + n;
for (let o = 0; o !== n; ++o) {
let n = t[e + o];
if (n !== t[r + o] || n !== t[a + o]) {
i = !0;
break;
}
}
}
if (i) {
if (o !== a) {
e[a] = e[o];
let r = o * n, i = a * n;
for (let e = 0; e !== n; ++e) t[i + e] = t[r + e];
}
++a;
}
}
if (i > 0) {
e[a] = e[i];
for (let e = i * n, r = a * n, o = 0; o !== n; ++o) t[r + o] = t[e + o];
++a;
}
return a === e.length ? (this.times = e, this.values = t) : (this.times = e.slice(0, a), this.values = t.slice(0, a * n)), this;
}
clone() {
let e = this.times.slice(), t = this.values.slice(), n = this.constructor, r = new n(this.name, e, t);
return r.createInterpolant = this.createInterpolant, r;
}
};
Al.prototype.ValueTypeName = "", Al.prototype.TimeBufferType = Float32Array, Al.prototype.ValueBufferType = Float32Array, Al.prototype.DefaultInterpolation = at;
var jl = class extends Al {
constructor(e, t, n) {
super(e, t, n);
}
};
jl.prototype.ValueTypeName = "bool", jl.prototype.ValueBufferType = Array, jl.prototype.DefaultInterpolation = it, jl.prototype.InterpolantFactoryMethodLinear = void 0, jl.prototype.InterpolantFactoryMethodSmooth = void 0;
var Ml = class extends Al {
constructor(e, t, n, r) {
super(e, t, n, r);
}
};
Ml.prototype.ValueTypeName = "color";
var Nl = class extends Al {
constructor(e, t, n, r) {
super(e, t, n, r);
}
};
Nl.prototype.ValueTypeName = "number";
var Pl = class extends Tl {
constructor(e, t, n, r) {
super(e, t, n, r);
}
interpolate_(e, t, n, r) {
let i = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = (n - t) / (r - t), c = e * o;
for (let e = c + o; c !== e; c += 4) Mn.slerpFlat(i, 0, a, c - o, a, c, s);
return i;
}
}, Fl = class extends Al {
constructor(e, t, n, r) {
super(e, t, n, r);
}
InterpolantFactoryMethodLinear(e) {
return new Pl(this.times, this.values, this.getValueSize(), e);
}
};
Fl.prototype.ValueTypeName = "quaternion", Fl.prototype.InterpolantFactoryMethodSmooth = void 0;
var Il = class extends Al {
constructor(e, t, n) {
super(e, t, n);
}
};
Il.prototype.ValueTypeName = "string", Il.prototype.ValueBufferType = Array, Il.prototype.DefaultInterpolation = it, Il.prototype.InterpolantFactoryMethodLinear = void 0, Il.prototype.InterpolantFactoryMethodSmooth = void 0;
var Ll = class extends Al {
constructor(e, t, n, r) {
super(e, t, n, r);
}
};
Ll.prototype.ValueTypeName = "vector";
var Rl = class {
constructor(e = "", t = -1, n = [], r = dt) {
this.name = e, this.tracks = n, this.duration = t, this.blendMode = r, this.uuid = dn(), this.userData = {}, this.duration < 0 && this.resetDuration();
}
static parse(e) {
let t = [], n = e.tracks, r = 1 / (e.fps || 1);
for (let e = 0, i = n.length; e !== i; ++e) t.push(Bl(n[e]).scale(r));
let i = new this(e.name, e.duration, t, e.blendMode);
return i.uuid = e.uuid, i.userData = JSON.parse(e.userData || "{}"), i;
}
static toJSON(e) {
let t = [], n = e.tracks, r = {
name: e.name,
duration: e.duration,
tracks: t,
uuid: e.uuid,
blendMode: e.blendMode,
userData: JSON.stringify(e.userData)
};
for (let e = 0, r = n.length; e !== r; ++e) t.push(Al.toJSON(n[e]));
return r;
}
static CreateFromMorphTargetSequence(e, t, n, r) {
let i = t.length, a = [];
for (let e = 0; e < i; e++) {
let o = [], s = [];
o.push((e + i - 1) % i, e, (e + 1) % i), s.push(0, 1, 0);
let c = yl(o);
o = bl(o, 1, c), s = bl(s, 1, c), !r && o[0] === 0 && (o.push(i), s.push(s[0])), a.push(new Nl(".morphTargetInfluences[" + t[e].name + "]", o, s).scale(1 / n));
}
return new this(e, -1, a);
}
static findByName(e, t) {
let n = e;
if (!Array.isArray(e)) {
let t = e;
n = t.geometry && t.geometry.animations || t.animations;
}
for (let e = 0; e < n.length; e++) if (n[e].name === t) return n[e];
return null;
}
static CreateClipsFromMorphTargetSequences(e, t, n) {
let r = {}, i = /^([\w-]*?)([\d]+)$/;
for (let t = 0, n = e.length; t < n; t++) {
let n = e[t], a = n.name.match(i);
if (a && a.length > 1) {
let e = a[1], t = r[e];
t || (r[e] = t = []), t.push(n);
}
}
let a = [];
for (let e in r) a.push(this.CreateFromMorphTargetSequence(e, r[e], t, n));
return a;
}
resetDuration() {
let e = this.tracks, t = 0;
for (let n = 0, r = e.length; n !== r; ++n) {
let e = this.tracks[n];
t = Math.max(t, e.times[e.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() {
let e = [];
for (let t = 0; t < this.tracks.length; t++) e.push(this.tracks[t].clone());
let t = new this.constructor(this.name, this.duration, e, this.blendMode);
return t.userData = JSON.parse(JSON.stringify(this.userData)), t;
}
toJSON() {
return this.constructor.toJSON(this);
}
};
function zl(e) {
switch (e.toLowerCase()) {
case "scalar":
case "double":
case "float":
case "number":
case "integer": return Nl;
case "vector":
case "vector2":
case "vector3":
case "vector4": return Ll;
case "color": return Ml;
case "quaternion": return Fl;
case "bool":
case "boolean": return jl;
case "string": return Il;
}
throw Error("THREE.KeyframeTrack: Unsupported typeName: " + e);
}
function Bl(e) {
if (e.type === void 0) throw Error("THREE.KeyframeTrack: track type undefined, can not parse");
let t = zl(e.type);
if (e.times === void 0) {
let t = [], n = [];
xl(e.keys, t, n, "value"), e.times = t, e.values = n;
}
return t.parse === void 0 ? new t(e.name, e.times, e.values, e.interpolation) : t.parse(e);
}
var Vl = {
enabled: !1,
files: {},
add: function(e, t) {
this.enabled !== !1 && (Hl(e) || (this.files[e] = t));
},
get: function(e) {
if (this.enabled !== !1 && !Hl(e)) return this.files[e];
},
remove: function(e) {
delete this.files[e];
},
clear: function() {
this.files = {};
}
};
function Hl(e) {
try {
let t = e.slice(e.indexOf(":") + 1);
return new URL(t).protocol === "blob:";
} catch {
return !1;
}
}
var Ul = class {
constructor(e, t, n) {
let r = this, i = !1, a = 0, o = 0, s, c = [];
this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this._abortController = null, this.itemStart = function(e) {
o++, i === !1 && r.onStart !== void 0 && r.onStart(e, a, o), i = !0;
}, this.itemEnd = function(e) {
a++, r.onProgress !== void 0 && r.onProgress(e, a, o), a === o && (i = !1, r.onLoad !== void 0 && r.onLoad());
}, this.itemError = function(e) {
r.onError !== void 0 && r.onError(e);
}, this.resolveURL = function(e) {
return e = e.normalize("NFC"), s ? s(e) : e;
}, this.setURLModifier = function(e) {
return s = e, this;
}, this.addHandler = function(e, t) {
return c.push(e, t), this;
}, this.removeHandler = function(e) {
let t = c.indexOf(e);
return t !== -1 && c.splice(t, 2), this;
}, this.getHandler = function(e) {
for (let t = 0, n = c.length; t < n; t += 2) {
let n = c[t], r = c[t + 1];
if (n.global && (n.lastIndex = 0), n.test(e)) return r;
}
return null;
}, this.abort = function() {
return this.abortController.abort(), this._abortController = null, this;
};
}
get abortController() {
return this._abortController || (this._abortController = new AbortController()), this._abortController;
}
}, Wl = /*@__PURE__*/ new Ul(), Gl = class {
constructor(e) {
this.manager = e === void 0 ? Wl : e, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
load() {}
loadAsync(e, t) {
let n = this;
return new Promise(function(r, i) {
n.load(e, r, t, i);
});
}
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;
}
abort() {
return this;
}
};
Gl.DEFAULT_MATERIAL_NAME = "__DEFAULT";
var Kl = {}, ql = class extends Error {
constructor(e, t) {
super(e), this.response = t;
}
}, Jl = class extends Gl {
constructor(e) {
super(e), this.mimeType = "", this.responseType = "", this._abortController = new AbortController();
}
load(e, t, n, r) {
e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
let i = Vl.get(`file:${e}`);
if (i !== void 0) {
this.manager.itemStart(e), setTimeout(() => {
t && t(i), this.manager.itemEnd(e);
}, 0);
return;
}
if (Kl[e] !== void 0) {
Kl[e].push({
onLoad: t,
onProgress: n,
onError: r
});
return;
}
Kl[e] = [], Kl[e].push({
onLoad: t,
onProgress: n,
onError: r
});
let a = new Request(e, {
headers: new Headers(this.requestHeader),
credentials: this.withCredentials ? "include" : "same-origin",
signal: typeof AbortSignal.any == "function" ? AbortSignal.any([this._abortController.signal, this.manager.abortController.signal]) : this._abortController.signal
}), o = this.mimeType, s = this.responseType;
fetch(a).then((t) => {
if (t.status === 200 || t.status === 0) {
if (t.status === 0 && j("FileLoader: HTTP Status 0 received."), typeof ReadableStream > "u" || t.body === void 0 || t.body.getReader === void 0) return t;
let n = Kl[e], r = t.body.getReader(), i = t.headers.get("X-File-Size") || t.headers.get("Content-Length"), a = i ? parseInt(i) : 0, o = a !== 0, s = 0, c = new ReadableStream({ start(e) {
t();
function t() {
r.read().then(({ done: r, value: i }) => {
if (r) e.close();
else {
s += i.byteLength;
let r = new ProgressEvent("progress", {
lengthComputable: o,
loaded: s,
total: a
});
for (let e = 0, t = n.length; e < t; e++) {
let t = n[e];
t.onProgress && t.onProgress(r);
}
e.enqueue(i), t();
}
}, (t) => {
e.error(t);
});
}
} });
return new Response(c);
} else throw new ql(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`, t);
}).then((e) => {
switch (s) {
case "arraybuffer": return e.arrayBuffer();
case "blob": return e.blob();
case "document": return e.text().then((e) => new DOMParser().parseFromString(e, o));
case "json": return e.json();
default:
if (o === "") return e.text();
{
let t = /charset="?([^;"\s]*)"?/i.exec(o), n = t && t[1] ? t[1].toLowerCase() : void 0, r = new TextDecoder(n);
return e.arrayBuffer().then((e) => r.decode(e));
}
}
}).then((t) => {
Vl.add(`file:${e}`, t);
let n = Kl[e];
delete Kl[e];
for (let e = 0, r = n.length; e < r; e++) {
let r = n[e];
r.onLoad && r.onLoad(t);
}
}).catch((t) => {
let n = Kl[e];
if (n === void 0) throw this.manager.itemError(e), t;
delete Kl[e];
for (let e = 0, r = n.length; e < r; e++) {
let r = n[e];
r.onError && r.onError(t);
}
this.manager.itemError(e);
}).finally(() => {
this.manager.itemEnd(e);
}), this.manager.itemStart(e);
}
setResponseType(e) {
return this.responseType = e, this;
}
setMimeType(e) {
return this.mimeType = e, this;
}
abort() {
return this._abortController.abort(), this._abortController = new AbortController(), this;
}
}, Yl = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = new Jl(this.manager);
a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(n) {
try {
t(i.parse(JSON.parse(n)));
} catch (t) {
r ? r(t) : M(t), i.manager.itemError(e);
}
}, n, r);
}
parse(e) {
let t = [];
for (let n = 0; n < e.length; n++) {
let r = Rl.parse(e[n]);
t.push(r);
}
return t;
}
}, Xl = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = [], o = new $o(), s = new Jl(this.manager);
s.setPath(this.path), s.setResponseType("arraybuffer"), s.setRequestHeader(this.requestHeader), s.setWithCredentials(i.withCredentials);
let c = 0;
function l(l) {
s.load(e[l], function(e) {
let n = i.parse(e, !0);
a[l] = {
width: n.width,
height: n.height,
format: n.format,
mipmaps: n.mipmaps
}, c += 1, c === 6 && (n.mipmapCount === 1 && (o.minFilter = x), o.image = a, o.format = n.format, o.needsUpdate = !0, t && t(o));
}, n, r);
}
if (Array.isArray(e)) for (let t = 0, n = e.length; t < n; ++t) l(t);
else s.load(e, function(e) {
let n = i.parse(e, !0);
if (n.isCubemap) {
let e = n.mipmaps.length / n.mipmapCount;
for (let t = 0; t < e; t++) {
a[t] = { mipmaps: [] };
for (let e = 0; e < n.mipmapCount; e++) a[t].mipmaps.push(n.mipmaps[t * n.mipmapCount + e]), a[t].format = n.format, a[t].width = n.width, a[t].height = n.height;
}
o.image = a;
} else o.image.width = n.width, o.image.height = n.height, o.mipmaps = n.mipmaps;
n.mipmapCount === 1 && (o.minFilter = x), o.format = n.format, o.needsUpdate = !0, t && t(o);
}, n, r);
return o;
}
}, Zl = /* @__PURE__ */ new WeakMap(), Ql = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
let i = this, a = Vl.get(`image:${e}`);
if (a !== void 0) {
if (a.complete === !0) i.manager.itemStart(e), setTimeout(function() {
t && t(a), i.manager.itemEnd(e);
}, 0);
else {
let e = Zl.get(a);
e === void 0 && (e = [], Zl.set(a, e)), e.push({
onLoad: t,
onError: r
});
}
return a;
}
let o = Jt("img");
function s() {
l(), t && t(this);
let n = Zl.get(this) || [];
for (let e = 0; e < n.length; e++) {
let t = n[e];
t.onLoad && t.onLoad(this);
}
Zl.delete(this), i.manager.itemEnd(e);
}
function c(t) {
l(), r && r(t), Vl.remove(`image:${e}`);
let n = Zl.get(this) || [];
for (let e = 0; e < n.length; e++) {
let r = n[e];
r.onError && r.onError(t);
}
Zl.delete(this), i.manager.itemError(e), i.manager.itemEnd(e);
}
function l() {
o.removeEventListener("load", s, !1), o.removeEventListener("error", c, !1);
}
return o.addEventListener("load", s, !1), o.addEventListener("error", c, !1), e.slice(0, 5) !== "data:" && this.crossOrigin !== void 0 && (o.crossOrigin = this.crossOrigin), Vl.add(`image:${e}`, o), i.manager.itemStart(e), o.src = e, o;
}
}, $l = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = new ns();
i.colorSpace = _t;
let a = new Ql(this.manager);
a.setCrossOrigin(this.crossOrigin), a.setPath(this.path);
let o = 0;
function s(n) {
a.load(e[n], function(e) {
i.images[n] = e, o++, o === 6 && (i.needsUpdate = !0, t && t(i));
}, void 0, r);
}
for (let t = 0; t < e.length; ++t) s(t);
return i;
}
}, eu = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = new Ba(), o = new Jl(this.manager);
return o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setPath(this.path), o.setWithCredentials(i.withCredentials), o.load(e, function(e) {
let n;
try {
n = i.parse(e);
} catch (e) {
r === void 0 ? M(e) : r(e);
return;
}
i._applyTexData(a, n), t && t(a, n);
}, n, r), a;
}
createDataTexture(e) {
let t = new Ba();
return this._applyTexData(t, this.parse(e)), t;
}
_applyTexData(e, t) {
t.image === void 0 ? t.data !== void 0 && (e.image.width = t.width, e.image.height = t.height, e.image.data = t.data) : e.image = t.image, e.wrapS = t.wrapS === void 0 ? m : t.wrapS, e.wrapT = t.wrapT === void 0 ? m : t.wrapT, e.magFilter = t.magFilter === void 0 ? x : t.magFilter, e.minFilter = t.minFilter === void 0 ? x : t.minFilter, e.anisotropy = t.anisotropy === void 0 ? 1 : t.anisotropy, t.colorSpace !== void 0 && (e.colorSpace = t.colorSpace), t.flipY !== void 0 && (e.flipY = t.flipY), t.format !== void 0 && (e.format = t.format), t.type !== void 0 && (e.type = t.type), t.mipmaps !== void 0 && (e.mipmaps = t.mipmaps, e.minFilter = w), t.mipmapCount === 1 && (e.minFilter = x), t.generateMipmaps !== void 0 && (e.generateMipmaps = t.generateMipmaps), e.needsUpdate = !0;
}
}, tu = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = new L(), a = new Ql(this.manager);
return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(e, function(e) {
i.image = e, i.needsUpdate = !0, t !== void 0 && t(i);
}, n, r), i;
}
}, nu = class extends z {
constructor(e, t = 1) {
super(), this.isLight = !0, this.type = "Light", this.color = new B(e), this.intensity = t;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
copy(e, t) {
return super.copy(e, t), this.color.copy(e.color), this.intensity = e.intensity, this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, t;
}
}, ru = class extends nu {
constructor(e, t, n) {
super(e, n), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(z.DEFAULT_UP), this.updateMatrix(), this.groundColor = new B(t);
}
copy(e, t) {
return super.copy(e, t), this.groundColor.copy(e.groundColor), this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.groundColor = this.groundColor.getHex(), t;
}
}, iu = /*@__PURE__*/ new R(), au = /*@__PURE__*/ new I(), ou = /*@__PURE__*/ new I(), su = class {
constructor(e) {
this.camera = e, this.intensity = 1, this.bias = 0, this.biasNode = null, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new F(512, 512), this.mapType = E, this.map = null, this.mapPass = null, this.matrix = new R(), this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new oo(), this._frameExtents = new F(1, 1), this._viewportCount = 1, this._viewports = [new Xn(0, 0, 1, 1)];
}
getViewportCount() {
return this._viewportCount;
}
getFrustum() {
return this._frustum;
}
updateMatrices(e) {
let t = this.camera, n = this.matrix;
au.setFromMatrixPosition(e.matrixWorld), t.position.copy(au), ou.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(ou), t.updateMatrixWorld(), iu.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(iu, t.coordinateSystem, t.reversedDepth), t.coordinateSystem === 2001 || t.reversedDepth ? n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, 1, 0, 0, 0, 0, 1) : n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), n.multiply(iu);
}
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.intensity = e.intensity, this.bias = e.bias, this.radius = e.radius, this.autoUpdate = e.autoUpdate, this.needsUpdate = e.needsUpdate, this.normalBias = e.normalBias, this.blurSamples = e.blurSamples, this.mapSize.copy(e.mapSize), this.biasNode = e.biasNode, this;
}
clone() {
return new this.constructor().copy(this);
}
toJSON() {
let e = {};
return this.intensity !== 1 && (e.intensity = this.intensity), 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;
}
}, cu = /*@__PURE__*/ new I(), lu = /*@__PURE__*/ new Mn(), uu = /*@__PURE__*/ new I(), du = class extends z {
constructor() {
super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new R(), this.projectionMatrix = new R(), this.projectionMatrixInverse = new R(), this.coordinateSystem = Rt, this._reversedDepth = !1;
}
get reversedDepth() {
return this._reversedDepth;
}
copy(e, t) {
return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this.coordinateSystem = e.coordinateSystem, this;
}
getWorldDirection(e) {
return super.getWorldDirection(e).negate();
}
updateMatrixWorld(e) {
super.updateMatrixWorld(e), this.matrixWorld.decompose(cu, lu, uu), uu.x === 1 && uu.y === 1 && uu.z === 1 ? this.matrixWorldInverse.copy(this.matrixWorld).invert() : this.matrixWorldInverse.compose(cu, lu, uu.set(1, 1, 1)).invert();
}
updateWorldMatrix(e, t, n = !1) {
super.updateWorldMatrix(e, t, n), this.matrixWorld.decompose(cu, lu, uu), uu.x === 1 && uu.y === 1 && uu.z === 1 ? this.matrixWorldInverse.copy(this.matrixWorld).invert() : this.matrixWorldInverse.compose(cu, lu, uu.set(1, 1, 1)).invert();
}
clone() {
return new this.constructor().copy(this);
}
}, fu = /*@__PURE__*/ new I(), pu = /*@__PURE__*/ new F(), mu = /*@__PURE__*/ new F(), hu = class extends du {
constructor(e = 50, t = 1, n = .1, r = 2e3) {
super(), this.isPerspectiveCamera = !0, this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = n, 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;
}
setFocalLength(e) {
let t = .5 * this.getFilmHeight() / e;
this.fov = un * 2 * Math.atan(t), this.updateProjectionMatrix();
}
getFocalLength() {
let e = Math.tan(ln * .5 * this.fov);
return .5 * this.getFilmHeight() / e;
}
getEffectiveFOV() {
return un * 2 * Math.atan(Math.tan(ln * .5 * this.fov) / this.zoom);
}
getFilmWidth() {
return this.filmGauge * Math.min(this.aspect, 1);
}
getFilmHeight() {
return this.filmGauge / Math.max(this.aspect, 1);
}
getViewBounds(e, t, n) {
fu.set(-1, -1, .5).applyMatrix4(this.projectionMatrixInverse), t.set(fu.x, fu.y).multiplyScalar(-e / fu.z), fu.set(1, 1, .5).applyMatrix4(this.projectionMatrixInverse), n.set(fu.x, fu.y).multiplyScalar(-e / fu.z);
}
getViewSize(e, t) {
return this.getViewBounds(e, pu, mu), t.subVectors(mu, pu);
}
setViewOffset(e, t, n, r, i, a) {
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 = n, this.view.offsetY = r, this.view.width = i, this.view.height = a, this.updateProjectionMatrix();
}
clearViewOffset() {
this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();
}
updateProjectionMatrix() {
let e = this.near, t = e * Math.tan(ln * .5 * this.fov) / this.zoom, n = 2 * t, r = this.aspect * n, i = -.5 * r, a = this.view;
if (this.view !== null && this.view.enabled) {
let e = a.fullWidth, o = a.fullHeight;
i += a.offsetX * r / e, t -= a.offsetY * n / o, r *= a.width / e, n *= a.height / o;
}
let o = this.filmOffset;
o !== 0 && (i += e * o / this.getFilmWidth()), this.projectionMatrix.makePerspective(i, i + r, t, t - n, e, this.far, this.coordinateSystem, this.reversedDepth), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
}
toJSON(e) {
let 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;
}
}, gu = class extends su {
constructor() {
super(new hu(50, 1, .5, 500)), this.isSpotLightShadow = !0, this.focus = 1, this.aspect = 1;
}
updateMatrices(e) {
let t = this.camera, n = un * 2 * e.angle * this.focus, r = this.mapSize.width / this.mapSize.height * this.aspect, i = e.distance || t.far;
(n !== t.fov || r !== t.aspect || i !== t.far) && (t.fov = n, t.aspect = r, t.far = i, t.updateProjectionMatrix()), super.updateMatrices(e);
}
copy(e) {
return super.copy(e), this.focus = e.focus, this;
}
}, _u = class extends nu {
constructor(e, t, n = 0, r = Math.PI / 3, i = 0, a = 2) {
super(e, t), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(z.DEFAULT_UP), this.updateMatrix(), this.target = new z(), this.distance = n, this.angle = r, this.penumbra = i, this.decay = a, this.map = null, this.shadow = new gu();
}
get power() {
return this.intensity * Math.PI;
}
set power(e) {
this.intensity = e / Math.PI;
}
dispose() {
super.dispose(), this.shadow.dispose();
}
copy(e, t) {
return super.copy(e, t), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.map = e.map, this.shadow = e.shadow.clone(), this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.distance = this.distance, t.object.angle = this.angle, t.object.decay = this.decay, t.object.penumbra = this.penumbra, t.object.target = this.target.uuid, this.map && this.map.isTexture && (t.object.map = this.map.toJSON(e).uuid), t.object.shadow = this.shadow.toJSON(), t;
}
}, vu = class extends su {
constructor() {
super(new hu(90, 1, .5, 500)), this.isPointLightShadow = !0;
}
}, yu = class extends nu {
constructor(e, t, n = 0, r = 2) {
super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = r, this.shadow = new vu();
}
get power() {
return this.intensity * 4 * Math.PI;
}
set power(e) {
this.intensity = e / (4 * Math.PI);
}
dispose() {
super.dispose(), this.shadow.dispose();
}
copy(e, t) {
return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.distance = this.distance, t.object.decay = this.decay, t.object.shadow = this.shadow.toJSON(), t;
}
}, bu = class extends du {
constructor(e = -1, t = 1, n = 1, r = -1, i = .1, a = 2e3) {
super(), this.isOrthographicCamera = !0, this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = n, this.bottom = r, this.near = i, this.far = a, 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, n, r, i, a) {
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 = n, this.view.offsetY = r, this.view.width = i, this.view.height = a, this.updateProjectionMatrix();
}
clearViewOffset() {
this.view !== null && (this.view.enabled = !1), this.updateProjectionMatrix();
}
updateProjectionMatrix() {
let e = (this.right - this.left) / (2 * this.zoom), t = (this.top - this.bottom) / (2 * this.zoom), n = (this.right + this.left) / 2, r = (this.top + this.bottom) / 2, i = n - e, a = n + e, o = r + t, s = r - t;
if (this.view !== null && this.view.enabled) {
let e = (this.right - this.left) / this.view.fullWidth / this.zoom, t = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
i += e * this.view.offsetX, a = i + e * this.view.width, o -= t * this.view.offsetY, s = o - t * this.view.height;
}
this.projectionMatrix.makeOrthographic(i, a, o, s, this.near, this.far, this.coordinateSystem, this.reversedDepth), this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
}
toJSON(e) {
let 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;
}
}, xu = class extends su {
constructor() {
super(new bu(-5, 5, 5, -5, .5, 500)), this.isDirectionalLightShadow = !0;
}
}, Su = class extends nu {
constructor(e, t) {
super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(z.DEFAULT_UP), this.updateMatrix(), this.target = new z(), this.shadow = new xu();
}
dispose() {
super.dispose(), this.shadow.dispose();
}
copy(e) {
return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.shadow = this.shadow.toJSON(), t.object.target = this.target.uuid, t;
}
}, Cu = class extends nu {
constructor(e, t) {
super(e, t), this.isAmbientLight = !0, this.type = "AmbientLight";
}
}, wu = class extends nu {
constructor(e, t, n = 10, r = 10) {
super(e, t), this.isRectAreaLight = !0, this.type = "RectAreaLight", this.width = n, this.height = r;
}
get power() {
return this.intensity * this.width * this.height * Math.PI;
}
set power(e) {
this.intensity = e / (this.width * this.height * Math.PI);
}
copy(e) {
return super.copy(e), this.width = e.width, this.height = e.height, this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.width = this.width, t.object.height = this.height, t;
}
}, Tu = class {
constructor() {
this.isSphericalHarmonics3 = !0, this.coefficients = [];
for (let e = 0; e < 9; e++) this.coefficients.push(new I());
}
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;
}
getAt(e, t) {
let n = e.x, r = e.y, i = e.z, a = this.coefficients;
return t.copy(a[0]).multiplyScalar(.282095), t.addScaledVector(a[1], .488603 * r), t.addScaledVector(a[2], .488603 * i), t.addScaledVector(a[3], .488603 * n), t.addScaledVector(a[4], n * r * 1.092548), t.addScaledVector(a[5], r * i * 1.092548), t.addScaledVector(a[6], .315392 * (3 * i * i - 1)), t.addScaledVector(a[7], n * i * 1.092548), t.addScaledVector(a[8], .546274 * (n * n - r * r)), t;
}
getIrradianceAt(e, t) {
let n = e.x, r = e.y, i = e.z, a = this.coefficients;
return t.copy(a[0]).multiplyScalar(.886227), t.addScaledVector(a[1], 2 * .511664 * r), t.addScaledVector(a[2], 2 * .511664 * i), t.addScaledVector(a[3], 2 * .511664 * n), t.addScaledVector(a[4], 2 * .429043 * n * r), t.addScaledVector(a[5], 2 * .429043 * r * i), t.addScaledVector(a[6], .743125 * i * i - .247708), t.addScaledVector(a[7], 2 * .429043 * n * i), t.addScaledVector(a[8], .429043 * (n * n - 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 n = 0; n < 9; n++) this.coefficients[n].addScaledVector(e.coefficients[n], t);
return this;
}
scale(e) {
for (let t = 0; t < 9; t++) this.coefficients[t].multiplyScalar(e);
return this;
}
lerp(e, t) {
for (let n = 0; n < 9; n++) this.coefficients[n].lerp(e.coefficients[n], 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) {
let n = this.coefficients;
for (let r = 0; r < 9; r++) n[r].fromArray(e, t + r * 3);
return this;
}
toArray(e = [], t = 0) {
let n = this.coefficients;
for (let r = 0; r < 9; r++) n[r].toArray(e, t + r * 3);
return e;
}
static getBasisAt(e, t) {
let n = e.x, r = e.y, i = e.z;
t[0] = .282095, t[1] = .488603 * r, t[2] = .488603 * i, t[3] = .488603 * n, t[4] = 1.092548 * n * r, t[5] = 1.092548 * r * i, t[6] = .315392 * (3 * i * i - 1), t[7] = 1.092548 * n * i, t[8] = .546274 * (n * n - r * r);
}
}, Eu = class extends nu {
constructor(e = new Tu(), t = 1) {
super(void 0, t), this.isLightProbe = !0, this.sh = e;
}
copy(e) {
return super.copy(e), this.sh.copy(e.sh), this;
}
toJSON(e) {
let t = super.toJSON(e);
return t.object.sh = this.sh.toArray(), t;
}
}, Du = {}, Ou = class e extends Gl {
constructor(e) {
super(e), this.textures = {};
}
load(e, t, n, r) {
let i = this, a = new Jl(i.manager);
a.setPath(i.path), a.setRequestHeader(i.requestHeader), a.setWithCredentials(i.withCredentials), a.load(e, function(n) {
try {
t(i.parse(JSON.parse(n)));
} catch (t) {
r ? r(t) : M(t), i.manager.itemError(e);
}
}, n, r);
}
parse(e) {
let t = this.createMaterialFromType(e.type);
return t.fromJSON(e, this.textures), t;
}
setTextures(e) {
return this.textures = e, this;
}
createMaterialFromType(t) {
return e.createMaterialFromType(t);
}
static createMaterialFromType(e) {
let t = {
ShadowMaterial: Zc,
SpriteMaterial: Vi,
RawShaderMaterial: sl,
ShaderMaterial: ol,
PointsMaterial: Uo,
MeshPhysicalMaterial: ll,
MeshStandardMaterial: cl,
MeshPhongMaterial: ul,
MeshToonMaterial: dl,
MeshNormalMaterial: fl,
MeshLambertMaterial: pl,
MeshDepthMaterial: ml,
MeshDistanceMaterial: hl,
MeshBasicMaterial: ma,
MeshMatcapMaterial: gl,
LineDashedMaterial: _l,
LineBasicMaterial: ko,
Material: Y,
...Du
}[e], n;
return t === void 0 ? (nn(`MaterialLoader: Unknown material type "${e}". Use .registerMaterial() before starting the deserialization process.`), n = new Y()) : n = new t(), n;
}
static registerMaterial(e, t) {
Du[e] = t;
}
}, ku = class {
static extractUrlBase(e) {
let t = e.lastIndexOf("/");
return t === -1 ? "./" : e.slice(0, t + 1);
}
static resolveURL(e, t) {
return typeof e != "string" || e === "" ? "" : (/^https?:\/\//i.test(t) && /^\//.test(e) && (t = t.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(e) || /^data:.*,.*$/i.test(e) || /^blob:.*$/i.test(e) ? e : t + e);
}
}, Au = class extends J {
constructor() {
super(), this.isInstancedBufferGeometry = !0, this.type = "InstancedBufferGeometry", this.instanceCount = Infinity;
}
copy(e) {
return super.copy(e), this.instanceCount = e.instanceCount, this;
}
toJSON() {
let e = super.toJSON();
return e.instanceCount = this.instanceCount, e.isInstancedBufferGeometry = !0, e;
}
}, ju = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = new Jl(i.manager);
a.setPath(i.path), a.setRequestHeader(i.requestHeader), a.setWithCredentials(i.withCredentials), a.load(e, function(n) {
try {
t(i.parse(JSON.parse(n)));
} catch (t) {
r ? r(t) : M(t), i.manager.itemError(e);
}
}, n, r);
}
parse(e) {
let t = {}, n = {};
function r(e, n) {
if (t[n] !== void 0) return t[n];
let r = e.interleavedBuffers[n], a = i(e, r.buffer), o = new Li(Kt(r.type, a), r.stride);
return o.uuid = r.uuid, t[n] = o, o;
}
function i(e, t) {
if (n[t] !== void 0) return n[t];
let r = e.arrayBuffers[t], i = new Uint32Array(r).buffer;
return n[t] = i, i;
}
let a = e.isInstancedBufferGeometry ? new Au() : new J(), o = e.data.index;
if (o !== void 0) {
let e = Kt(o.type, o.array);
a.setIndex(new W(e, 1));
}
let s = e.data.attributes;
for (let t in s) {
let n = s[t], i;
if (n.isInterleavedBufferAttribute) i = new zi(r(e.data, n.data), n.itemSize, n.offset, n.normalized);
else {
let e = Kt(n.type, n.array);
i = new (n.isInstancedBufferAttribute ? Wa : W)(e, n.itemSize, n.normalized);
}
n.name !== void 0 && (i.name = n.name), n.usage !== void 0 && i.setUsage(n.usage), a.setAttribute(t, i);
}
let c = e.data.morphAttributes;
if (c) for (let t in c) {
let n = c[t], i = [];
for (let t = 0, a = n.length; t < a; t++) {
let a = n[t], o;
o = a.isInterleavedBufferAttribute ? new zi(r(e.data, a.data), a.itemSize, a.offset, a.normalized) : new W(Kt(a.type, a.array), a.itemSize, a.normalized), a.name !== void 0 && (o.name = a.name), i.push(o);
}
a.morphAttributes[t] = i;
}
e.data.morphTargetsRelative && (a.morphTargetsRelative = !0);
let l = e.data.groups || e.data.drawcalls || e.data.offsets;
if (l !== void 0) for (let e = 0, t = l.length; e !== t; ++e) {
let t = l[e];
a.addGroup(t.start, t.count, t.materialIndex);
}
let u = e.data.boundingSphere;
return u !== void 0 && (a.boundingSphere = new K().fromJSON(u)), e.name && (a.name = e.name), e.userData && (a.userData = e.userData), a;
}
}, Mu = {}, Nu = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = this.path === "" ? ku.extractUrlBase(e) : this.path;
this.resourcePath = this.resourcePath || a;
let o = new Jl(this.manager);
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(n) {
let a = null;
try {
a = JSON.parse(n);
} catch (t) {
r !== void 0 && r(t), M("ObjectLoader: Can't parse " + e + ".", t.message);
return;
}
let o = a.metadata;
if (o === void 0 || o.type === void 0 || o.type.toLowerCase() === "geometry") {
r !== void 0 && r(/* @__PURE__ */ Error("THREE.ObjectLoader: Can't load " + e)), M("ObjectLoader: Can't load " + e);
return;
}
i.parse(a, t);
}, n, r);
}
async loadAsync(e, t) {
let n = this, r = this.path === "" ? ku.extractUrlBase(e) : this.path;
this.resourcePath = this.resourcePath || r;
let i = new Jl(this.manager);
i.setPath(this.path), i.setRequestHeader(this.requestHeader), i.setWithCredentials(this.withCredentials);
let a = await i.loadAsync(e, t), o;
try {
o = JSON.parse(a);
} catch (t) {
throw Error("THREE.ObjectLoader: Can't parse " + e + ". " + t.message);
}
let s = o.metadata;
if (s === void 0 || s.type === void 0 || s.type.toLowerCase() === "geometry") throw Error("THREE.ObjectLoader: Can't load " + e);
return await n.parseAsync(o);
}
parse(e, t) {
let n = this.parseAnimations(e.animations), r = this.parseShapes(e.shapes), i = this.parseGeometries(e.geometries, r), a = this.parseImages(e.images, function() {
t !== void 0 && t(c);
}), o = this.parseTextures(e.textures, a), s = this.parseMaterials(e.materials, o), c = this.parseObject(e.object, i, s, o, n), l = this.parseSkeletons(e.skeletons, c);
if (this.bindSkeletons(c, l), this.bindLightTargets(c), t !== void 0) {
let e = !1;
for (let t in a) if (a[t].data instanceof HTMLImageElement) {
e = !0;
break;
}
e === !1 && t(c);
}
return c;
}
async parseAsync(e) {
let t = this.parseAnimations(e.animations), n = this.parseShapes(e.shapes), r = this.parseGeometries(e.geometries, n), i = await this.parseImagesAsync(e.images), a = this.parseTextures(e.textures, i), o = this.parseMaterials(e.materials, a), s = this.parseObject(e.object, r, o, a, t), c = this.parseSkeletons(e.skeletons, s);
return this.bindSkeletons(s, c), this.bindLightTargets(s), s;
}
static registerGeometry(e, t) {
Mu[e] = t;
}
parseShapes(e) {
let t = {};
if (e !== void 0) for (let n = 0, r = e.length; n < r; n++) {
let r = new Xs().fromJSON(e[n]);
t[r.uuid] = r;
}
return t;
}
parseSkeletons(e, t) {
let n = {}, r = {};
if (t.traverse(function(e) {
e.isBone && (r[e.uuid] = e);
}), e !== void 0) for (let t = 0, i = e.length; t < i; t++) {
let i = new Ua().fromJSON(e[t], r);
n[i.uuid] = i;
}
return n;
}
parseGeometries(e, t) {
let n = {};
if (e !== void 0) {
let r = new ju();
for (let i = 0, a = e.length; i < a; i++) {
let a, o = e[i];
switch (o.type) {
case "BufferGeometry":
case "InstancedBufferGeometry":
a = r.parse(o);
break;
default: o.type in Xc ? a = Xc[o.type].fromJSON(o, t) : o.type in Mu ? a = Mu[o.type].fromJSON(o, t) : j(`ObjectLoader: Unknown geometry type "${o.type}". Use .registerGeometry() before starting the deserialization process.`);
}
a.uuid = o.uuid, o.name !== void 0 && (a.name = o.name), o.userData !== void 0 && (a.userData = o.userData), n[o.uuid] = a;
}
}
return n;
}
parseMaterials(e, t) {
let n = {}, r = {};
if (e !== void 0) {
let i = new Ou();
i.setTextures(t);
for (let t = 0, a = e.length; t < a; t++) {
let a = e[t];
n[a.uuid] === void 0 && (n[a.uuid] = i.parse(a)), r[a.uuid] = n[a.uuid];
}
}
return r;
}
parseAnimations(e) {
let t = {};
if (e !== void 0) for (let n = 0; n < e.length; n++) {
let r = e[n], i = Rl.parse(r);
t[i.uuid] = i;
}
return t;
}
parseImages(e, t) {
let n = this, r = {}, i;
function a(e) {
return e = n.manager.resolveURL(e), n.manager.itemStart(e), i.load(e, function() {
n.manager.itemEnd(e);
}, void 0, function() {
n.manager.itemError(e), n.manager.itemEnd(e);
});
}
function o(e) {
if (typeof e == "string") {
let t = e;
return a(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t) ? t : n.resourcePath + t);
} else if (e.data) return {
data: Kt(e.type, e.data),
width: e.width,
height: e.height
};
else return null;
}
if (e !== void 0 && e.length > 0) {
i = new Ql(new Ul(t)), i.setCrossOrigin(this.crossOrigin);
for (let t = 0, n = e.length; t < n; t++) {
let n = e[t], i = n.url;
if (Array.isArray(i)) {
let e = [];
for (let t = 0, n = i.length; t < n; t++) {
let n = i[t], r = o(n);
r !== null && (r instanceof HTMLImageElement ? e.push(r) : e.push(new Ba(r.data, r.width, r.height)));
}
r[n.uuid] = new Kn(e);
} else {
let e = o(n.url);
r[n.uuid] = new Kn(e);
}
}
}
return r;
}
async parseImagesAsync(e) {
let t = this, n = {}, r;
async function i(e) {
if (typeof e == "string") {
let n = e, i = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(n) ? n : t.resourcePath + n;
return await r.loadAsync(i);
} else if (e.data) return {
data: Kt(e.type, e.data),
width: e.width,
height: e.height
};
else return null;
}
if (e !== void 0 && e.length > 0) {
r = new Ql(this.manager), r.setCrossOrigin(this.crossOrigin);
for (let t = 0, r = e.length; t < r; t++) {
let r = e[t], a = r.url;
if (Array.isArray(a)) {
let e = [];
for (let t = 0, n = a.length; t < n; t++) {
let n = a[t], r = await i(n);
r !== null && (r instanceof HTMLImageElement ? e.push(r) : e.push(new Ba(r.data, r.width, r.height)));
}
n[r.uuid] = new Kn(e);
} else {
let e = await i(r.url);
n[r.uuid] = new Kn(e);
}
}
}
return n;
}
parseTextures(e, t) {
function n(e, t) {
return typeof e == "number" ? e : (j("ObjectLoader.parseTexture: Constant should be in numeric form.", e), t[e]);
}
let r = {};
if (e !== void 0) for (let i = 0, a = e.length; i < a; i++) {
let a = e[i];
a.image === void 0 && j("ObjectLoader: No \"image\" specified for", a.uuid), t[a.image] === void 0 && j("ObjectLoader: Undefined image", a.image);
let o = t[a.image], s = o.data, c;
Array.isArray(s) ? (c = new ns(), s.length === 6 && (c.needsUpdate = !0)) : (c = s && s.data ? new Ba() : new L(), s && (c.needsUpdate = !0)), c.source = o, c.uuid = a.uuid, a.name !== void 0 && (c.name = a.name), a.mapping !== void 0 && (c.mapping = n(a.mapping, Pu)), a.channel !== void 0 && (c.channel = a.channel), 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 = n(a.wrap[0], Fu), c.wrapT = n(a.wrap[1], Fu)), a.format !== void 0 && (c.format = a.format), a.internalFormat !== void 0 && (c.internalFormat = a.internalFormat), a.type !== void 0 && (c.type = a.type), a.colorSpace !== void 0 && (c.colorSpace = a.colorSpace), a.minFilter !== void 0 && (c.minFilter = n(a.minFilter, Iu)), a.magFilter !== void 0 && (c.magFilter = n(a.magFilter, Iu)), a.anisotropy !== void 0 && (c.anisotropy = a.anisotropy), a.flipY !== void 0 && (c.flipY = a.flipY), a.generateMipmaps !== void 0 && (c.generateMipmaps = a.generateMipmaps), a.premultiplyAlpha !== void 0 && (c.premultiplyAlpha = a.premultiplyAlpha), a.unpackAlignment !== void 0 && (c.unpackAlignment = a.unpackAlignment), a.compareFunction !== void 0 && (c.compareFunction = a.compareFunction), a.normalized !== void 0 && (c.normalized = a.normalized), a.userData !== void 0 && (c.userData = a.userData), r[a.uuid] = c;
}
return r;
}
parseObject(e, t, n, r, i) {
let a;
function o(e) {
return t[e] === void 0 && j("ObjectLoader: Undefined geometry", e), t[e];
}
function s(e) {
if (e !== void 0) {
if (Array.isArray(e)) {
let t = [];
for (let r = 0, i = e.length; r < i; r++) {
let i = e[r];
n[i] === void 0 && j("ObjectLoader: Undefined material", i), t.push(n[i]);
}
return t;
}
return n[e] === void 0 && j("ObjectLoader: Undefined material", e), n[e];
}
}
function c(e) {
return r[e] === void 0 && j("ObjectLoader: Undefined texture", e), r[e];
}
let l, u;
switch (e.type) {
case "Scene":
a = new Rr(), e.background !== void 0 && (Number.isInteger(e.background) ? a.background = new B(e.background) : a.background = c(e.background)), e.environment !== void 0 && (a.environment = c(e.environment)), e.fog !== void 0 && (e.fog.type === "Fog" ? a.fog = new Lr(e.fog.color, e.fog.near, e.fog.far) : e.fog.type === "FogExp2" && (a.fog = new Ir(e.fog.color, e.fog.density)), e.fog.name !== "" && (a.fog.name = e.fog.name)), e.backgroundBlurriness !== void 0 && (a.backgroundBlurriness = e.backgroundBlurriness), e.backgroundIntensity !== void 0 && (a.backgroundIntensity = e.backgroundIntensity), e.backgroundRotation !== void 0 && a.backgroundRotation.fromArray(e.backgroundRotation), e.environmentIntensity !== void 0 && (a.environmentIntensity = e.environmentIntensity), e.environmentRotation !== void 0 && a.environmentRotation.fromArray(e.environmentRotation);
break;
case "PerspectiveCamera":
a = new hu(e.fov, e.aspect, e.near, e.far), e.focus !== void 0 && (a.focus = e.focus), e.zoom !== void 0 && (a.zoom = e.zoom), e.filmGauge !== void 0 && (a.filmGauge = e.filmGauge), e.filmOffset !== void 0 && (a.filmOffset = e.filmOffset), e.view !== void 0 && (a.view = Object.assign({}, e.view));
break;
case "OrthographicCamera":
a = new bu(e.left, e.right, e.top, e.bottom, e.near, e.far), e.zoom !== void 0 && (a.zoom = e.zoom), e.view !== void 0 && (a.view = Object.assign({}, e.view));
break;
case "AmbientLight":
a = new Cu(e.color, e.intensity);
break;
case "DirectionalLight":
a = new Su(e.color, e.intensity), a.target = e.target || "";
break;
case "PointLight":
a = new yu(e.color, e.intensity, e.distance, e.decay);
break;
case "RectAreaLight":
a = new wu(e.color, e.intensity, e.width, e.height);
break;
case "SpotLight":
a = new _u(e.color, e.intensity, e.distance, e.angle, e.penumbra, e.decay), a.target = e.target || "";
break;
case "HemisphereLight":
a = new ru(e.color, e.groundColor, e.intensity);
break;
case "LightProbe":
a = new Eu(new Tu().fromArray(e.sh), e.intensity);
break;
case "SkinnedMesh":
l = o(e.geometry), u = s(e.material), a = new Ra(l, u), e.bindMode !== void 0 && (a.bindMode = e.bindMode), e.bindMatrix !== void 0 && a.bindMatrix.fromArray(e.bindMatrix), e.skeleton !== void 0 && (a.skeleton = e.skeleton);
break;
case "Mesh":
l = o(e.geometry), u = s(e.material), a = new Ea(l, u);
break;
case "InstancedMesh":
l = o(e.geometry), u = s(e.material);
let t = e.count, n = e.instanceMatrix, r = e.instanceColor;
a = new Qa(l, u, t), a.instanceMatrix = new Wa(new Float32Array(n.array), 16), r !== void 0 && (a.instanceColor = new Wa(new Float32Array(r.array), r.itemSize));
break;
case "BatchedMesh":
l = o(e.geometry), u = s(e.material), a = new Oo(e.maxInstanceCount, e.maxVertexCount, e.maxIndexCount, u), a.geometry = l, a.perObjectFrustumCulled = e.perObjectFrustumCulled, a.sortObjects = e.sortObjects, a._drawRanges = e.drawRanges, a._reservedRanges = e.reservedRanges, a._geometryInfo = e.geometryInfo.map((e) => {
let t = null, n = null;
return e.boundingBox !== void 0 && (t = new H().fromJSON(e.boundingBox)), e.boundingSphere !== void 0 && (n = new K().fromJSON(e.boundingSphere)), {
...e,
boundingBox: t,
boundingSphere: n
};
}), a._instanceInfo = e.instanceInfo, a._availableInstanceIds = e._availableInstanceIds, a._availableGeometryIds = e._availableGeometryIds, a._nextIndexStart = e.nextIndexStart, a._nextVertexStart = e.nextVertexStart, a._geometryCount = e.geometryCount, a._maxInstanceCount = e.maxInstanceCount, a._maxVertexCount = e.maxVertexCount, a._maxIndexCount = e.maxIndexCount, a._geometryInitialized = e.geometryInitialized, a._matricesTexture = c(e.matricesTexture.uuid), a._indirectTexture = c(e.indirectTexture.uuid), e.colorsTexture !== void 0 && (a._colorsTexture = c(e.colorsTexture.uuid)), e.boundingSphere !== void 0 && (a.boundingSphere = new K().fromJSON(e.boundingSphere)), e.boundingBox !== void 0 && (a.boundingBox = new H().fromJSON(e.boundingBox));
break;
case "LOD":
a = new aa();
break;
case "Line":
a = new Lo(o(e.geometry), s(e.material));
break;
case "LineLoop":
a = new Ho(o(e.geometry), s(e.material));
break;
case "LineSegments":
a = new Vo(o(e.geometry), s(e.material));
break;
case "PointCloud":
case "Points":
a = new Jo(o(e.geometry), s(e.material));
break;
case "Sprite":
a = new ta(s(e.material));
break;
case "Group":
a = new kr();
break;
case "Bone":
a = new za();
break;
default: a = new z();
}
if (a.uuid = e.uuid, e.name !== void 0 && (a.name = e.name), e.matrix === void 0 ? (e.position !== void 0 && a.position.fromArray(e.position), e.rotation !== void 0 && a.rotation.fromArray(e.rotation), e.quaternion !== void 0 && a.quaternion.fromArray(e.quaternion), e.scale !== void 0 && a.scale.fromArray(e.scale)) : (a.matrix.fromArray(e.matrix), e.matrixAutoUpdate !== void 0 && (a.matrixAutoUpdate = e.matrixAutoUpdate), a.matrixAutoUpdate && a.matrix.decompose(a.position, a.quaternion, a.scale)), e.up !== void 0 && a.up.fromArray(e.up), e.pivot !== void 0 && (a.pivot = new I().fromArray(e.pivot)), e.morphTargetDictionary !== void 0 && (a.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), e.morphTargetInfluences !== void 0 && (a.morphTargetInfluences = e.morphTargetInfluences.slice()), e.castShadow !== void 0 && (a.castShadow = e.castShadow), e.receiveShadow !== void 0 && (a.receiveShadow = e.receiveShadow), e.shadow && (e.shadow.intensity !== void 0 && (a.shadow.intensity = e.shadow.intensity), e.shadow.bias !== void 0 && (a.shadow.bias = e.shadow.bias), e.shadow.normalBias !== void 0 && (a.shadow.normalBias = e.shadow.normalBias), e.shadow.radius !== void 0 && (a.shadow.radius = e.shadow.radius), e.shadow.mapSize !== void 0 && a.shadow.mapSize.fromArray(e.shadow.mapSize), e.shadow.camera !== void 0 && (a.shadow.camera = this.parseObject(e.shadow.camera))), e.visible !== void 0 && (a.visible = e.visible), e.frustumCulled !== void 0 && (a.frustumCulled = e.frustumCulled), e.renderOrder !== void 0 && (a.renderOrder = e.renderOrder), e.static !== void 0 && (a.static = e.static), e.userData !== void 0 && (a.userData = e.userData), e.layers !== void 0 && (a.layers.mask = e.layers), e.children !== void 0) {
let o = e.children;
for (let e = 0; e < o.length; e++) a.add(this.parseObject(o[e], t, n, r, i));
}
if (e.animations !== void 0) {
let t = e.animations;
for (let e = 0; e < t.length; e++) {
let n = t[e];
a.animations.push(i[n]);
}
}
if (e.type === "LOD") {
e.autoUpdate !== void 0 && (a.autoUpdate = e.autoUpdate);
let t = e.levels;
for (let e = 0; e < t.length; e++) {
let n = t[e], r = a.getObjectByProperty("uuid", n.object);
r !== void 0 && a.addLevel(r, n.distance, n.hysteresis);
}
}
return a;
}
bindSkeletons(e, t) {
Object.keys(t).length !== 0 && e.traverse(function(e) {
if (e.isSkinnedMesh === !0 && e.skeleton !== void 0) {
let n = t[e.skeleton];
n === void 0 ? j("ObjectLoader: No skeleton found with UUID:", e.skeleton) : e.bind(n, e.bindMatrix);
}
});
}
bindLightTargets(e) {
e.traverse(function(t) {
if (t.isDirectionalLight || t.isSpotLight) {
let n = t.target, r = e.getObjectByProperty("uuid", n);
r === void 0 ? t.target = new z() : t.target = r;
}
});
}
}, Pu = {
UVMapping: 300,
CubeReflectionMapping: 301,
CubeRefractionMapping: 302,
EquirectangularReflectionMapping: 303,
EquirectangularRefractionMapping: 304,
CubeUVReflectionMapping: 306
}, Fu = {
RepeatWrapping: p,
ClampToEdgeWrapping: m,
MirroredRepeatWrapping: h
}, Iu = {
NearestFilter: g,
NearestMipmapNearestFilter: _,
NearestMipmapLinearFilter: y,
LinearFilter: x,
LinearMipmapNearestFilter: S,
LinearMipmapLinearFilter: w
}, Lu = /* @__PURE__ */ new WeakMap(), Ru = class extends Gl {
constructor(e) {
super(e), this.isImageBitmapLoader = !0, typeof createImageBitmap > "u" && j("ImageBitmapLoader: createImageBitmap() not supported."), typeof fetch > "u" && j("ImageBitmapLoader: fetch() not supported."), this.options = { premultiplyAlpha: "none" }, this._abortController = new AbortController();
}
setOptions(e) {
return this.options = e, this;
}
load(e, t, n, r) {
e === void 0 && (e = ""), this.path !== void 0 && (e = this.path + e), e = this.manager.resolveURL(e);
let i = this, a = Vl.get(`image-bitmap:${e}`);
if (a !== void 0) {
if (i.manager.itemStart(e), a.then) {
a.then((n) => {
Lu.has(a) === !0 ? (r && r(Lu.get(a)), i.manager.itemError(e), i.manager.itemEnd(e)) : (t && t(n), i.manager.itemEnd(e));
});
return;
}
setTimeout(function() {
t && t(a), i.manager.itemEnd(e);
}, 0);
return;
}
let o = {};
o.credentials = this.crossOrigin === "anonymous" ? "same-origin" : "include", o.headers = this.requestHeader, o.signal = typeof AbortSignal.any == "function" ? AbortSignal.any([this._abortController.signal, this.manager.abortController.signal]) : this._abortController.signal;
let s = fetch(e, o).then(function(e) {
return e.blob();
}).then(function(e) {
return createImageBitmap(e, Object.assign(i.options, { colorSpaceConversion: "none" }));
}).then(function(n) {
Vl.add(`image-bitmap:${e}`, n), t && t(n), i.manager.itemEnd(e);
}).catch(function(t) {
r && r(t), Lu.set(s, t), Vl.remove(`image-bitmap:${e}`), i.manager.itemError(e), i.manager.itemEnd(e);
});
Vl.add(`image-bitmap:${e}`, s), i.manager.itemStart(e);
}
abort() {
return this._abortController.abort(), this._abortController = new AbortController(), this;
}
}, zu, Bu = class {
static getContext() {
return zu === void 0 && (zu = new (window.AudioContext || window.webkitAudioContext)()), zu;
}
static setContext(e) {
zu = e;
}
}, Vu = class extends Gl {
constructor(e) {
super(e);
}
load(e, t, n, r) {
let i = this, a = new Jl(this.manager);
a.setResponseType("arraybuffer"), a.setPath(this.path), a.setRequestHeader(this.requestHeader), a.setWithCredentials(this.withCredentials), a.load(e, function(n) {
try {
let r = n.slice(0), a = Bu.getContext(), s = e + "#decode";
i.manager.itemStart(s), a.decodeAudioData(r, function(e) {
t(e), i.manager.itemEnd(s);
}).catch(function(e) {
o(e), i.manager.itemEnd(s);
});
} catch (e) {
o(e);
}
}, n, r);
function o(t) {
r ? r(t) : M(t), i.manager.itemError(e);
}
}
}, Hu = /*@__PURE__*/ new R(), Uu = /*@__PURE__*/ new R(), Wu = /*@__PURE__*/ new R(), Gu = class {
constructor() {
this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new hu(), this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new hu(), 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) {
let 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, Wu.copy(e.projectionMatrix);
let n = t.eyeSep / 2, r = n * t.near / t.focus, i = t.near * Math.tan(ln * t.fov * .5) / t.zoom, a, o;
Uu.elements[12] = -n, Hu.elements[12] = n, a = -i * t.aspect + r, o = i * t.aspect + r, Wu.elements[0] = 2 * t.near / (o - a), Wu.elements[8] = (o + a) / (o - a), this.cameraL.projectionMatrix.copy(Wu), a = -i * t.aspect - r, o = i * t.aspect - r, Wu.elements[0] = 2 * t.near / (o - a), Wu.elements[8] = (o + a) / (o - a), this.cameraR.projectionMatrix.copy(Wu);
}
this.cameraL.matrix.copy(e.matrixWorld).multiply(Uu), this.cameraL.matrixWorldNeedsUpdate = !0, this.cameraR.matrix.copy(e.matrixWorld).multiply(Hu), this.cameraR.matrixWorldNeedsUpdate = !0;
}
}, Ku = -90, qu = 1, Ju = class extends z {
constructor(e, t, n) {
super(), this.type = "CubeCamera", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0;
let r = new hu(Ku, qu, e, t);
r.layers = this.layers, this.add(r);
let i = new hu(Ku, qu, e, t);
i.layers = this.layers, this.add(i);
let a = new hu(Ku, qu, e, t);
a.layers = this.layers, this.add(a);
let o = new hu(Ku, qu, e, t);
o.layers = this.layers, this.add(o);
let s = new hu(Ku, qu, e, t);
s.layers = this.layers, this.add(s);
let c = new hu(Ku, qu, e, t);
c.layers = this.layers, this.add(c);
}
updateCoordinateSystem() {
let e = this.coordinateSystem, t = this.children.concat(), [n, r, i, a, o, s] = t;
for (let e of t) this.remove(e);
if (e === 2e3) n.up.set(0, 1, 0), n.lookAt(1, 0, 0), r.up.set(0, 1, 0), r.lookAt(-1, 0, 0), i.up.set(0, 0, -1), i.lookAt(0, 1, 0), a.up.set(0, 0, 1), a.lookAt(0, -1, 0), o.up.set(0, 1, 0), o.lookAt(0, 0, 1), s.up.set(0, 1, 0), s.lookAt(0, 0, -1);
else if (e === 2001) n.up.set(0, -1, 0), n.lookAt(-1, 0, 0), r.up.set(0, -1, 0), r.lookAt(1, 0, 0), i.up.set(0, 0, 1), i.lookAt(0, 1, 0), a.up.set(0, 0, -1), a.lookAt(0, -1, 0), o.up.set(0, -1, 0), o.lookAt(0, 0, 1), s.up.set(0, -1, 0), s.lookAt(0, 0, -1);
else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + e);
for (let e of t) this.add(e), e.updateMatrixWorld();
}
update(e, t) {
this.parent === null && this.updateMatrixWorld();
let { renderTarget: n, activeMipmapLevel: r } = this;
this.coordinateSystem !== e.coordinateSystem && (this.coordinateSystem = e.coordinateSystem, this.updateCoordinateSystem());
let [i, a, o, s, c, l] = this.children, u = e.getRenderTarget(), d = e.getActiveCubeFace(), f = e.getActiveMipmapLevel(), p = e.xr.enabled;
e.xr.enabled = !1;
let m = n.texture.generateMipmaps;
n.texture.generateMipmaps = !1;
let h = !1;
h = e.isWebGLRenderer === !0 ? e.state.buffers.depth.getReversed() : e.reversedDepthBuffer, e.setRenderTarget(n, 0, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, i), e.setRenderTarget(n, 1, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, a), e.setRenderTarget(n, 2, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, o), e.setRenderTarget(n, 3, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, s), e.setRenderTarget(n, 4, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, c), n.texture.generateMipmaps = m, e.setRenderTarget(n, 5, r), h && e.autoClear === !1 && e.clearDepth(), e.render(t, l), e.setRenderTarget(u, d, f), e.xr.enabled = p, n.texture.needsPMREMUpdate = !0;
}
}, Yu = class extends hu {
constructor(e = []) {
super(), this.isArrayCamera = !0, this.isMultiViewCamera = !1, this.cameras = e;
}
}, Xu = class {
constructor() {
this._previousTime = 0, this._currentTime = 0, this._startTime = performance.now(), this._delta = 0, this._elapsed = 0, this._timescale = 1, this._document = null, this._pageVisibilityHandler = null;
}
connect(e) {
this._document = e, e.hidden !== void 0 && (this._pageVisibilityHandler = Zu.bind(this), e.addEventListener("visibilitychange", this._pageVisibilityHandler, !1));
}
disconnect() {
this._pageVisibilityHandler !== null && (this._document.removeEventListener("visibilitychange", this._pageVisibilityHandler), this._pageVisibilityHandler = null), this._document = null;
}
getDelta() {
return this._delta / 1e3;
}
getElapsed() {
return this._elapsed / 1e3;
}
getTimescale() {
return this._timescale;
}
setTimescale(e) {
return this._timescale = e, this;
}
reset() {
return this._currentTime = performance.now() - this._startTime, this;
}
dispose() {
this.disconnect();
}
update(e) {
return this._pageVisibilityHandler !== null && this._document.hidden === !0 ? this._delta = 0 : (this._previousTime = this._currentTime, this._currentTime = (e === void 0 ? performance.now() : e) - this._startTime, this._delta = (this._currentTime - this._previousTime) * this._timescale, this._elapsed += this._delta), this;
}
};
function Zu() {
this._document.hidden === !1 && this.reset();
}
var Qu = /*@__PURE__*/ new I(), $u = /*@__PURE__*/ new Mn(), ed = /*@__PURE__*/ new I(), td = /*@__PURE__*/ new I(), nd = /*@__PURE__*/ new I(), rd = class extends z {
constructor() {
super(), this.type = "AudioListener", this.context = Bu.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._timer = new Xu();
}
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.context.destination) : (this.gain.disconnect(this.filter), this.filter.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, .01), this;
}
updateMatrixWorld(e) {
super.updateMatrixWorld(e), this._timer.update();
let t = this.context.listener;
if (this.timeDelta = this._timer.getDelta(), this.matrixWorld.decompose(Qu, $u, ed), td.set(0, 0, -1).applyQuaternion($u), nd.set(0, 1, 0).applyQuaternion($u), t.positionX) {
let e = this.context.currentTime + this.timeDelta;
t.positionX.linearRampToValueAtTime(Qu.x, e), t.positionY.linearRampToValueAtTime(Qu.y, e), t.positionZ.linearRampToValueAtTime(Qu.z, e), t.forwardX.linearRampToValueAtTime(td.x, e), t.forwardY.linearRampToValueAtTime(td.y, e), t.forwardZ.linearRampToValueAtTime(td.z, e), t.upX.linearRampToValueAtTime(nd.x, e), t.upY.linearRampToValueAtTime(nd.y, e), t.upZ.linearRampToValueAtTime(nd.z, e);
} else t.setPosition(Qu.x, Qu.y, Qu.z), t.setOrientation(td.x, td.y, td.z, nd.x, nd.y, nd.z);
}
}, id = class extends z {
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) {
j("Audio: Audio is already playing.");
return;
}
if (this.hasPlaybackControl === !1) {
j("Audio: this Audio has no playback control.");
return;
}
this._startedAt = this.context.currentTime + e;
let 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) {
j("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.duration || this.buffer.duration), this.source.stop(), this.source.onended = null, this.isPlaying = !1), this;
}
stop(e = 0) {
if (this.hasPlaybackControl === !1) {
j("Audio: this Audio has no playback control.");
return;
}
return this._progress = 0, this.source !== null && (this.source.stop(this.context.currentTime + e), 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._connected !== !1) {
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) {
return this.detune = e, this.isPlaying === !0 && this.source.detune !== void 0 && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01), this;
}
getDetune() {
return this.detune;
}
getFilter() {
return this.getFilters()[0];
}
setFilter(e) {
return this.setFilters(e ? [e] : []);
}
setPlaybackRate(e) {
if (this.hasPlaybackControl === !1) {
j("Audio: this Audio has no playback control.");
return;
}
return this.playbackRate = e, this.isPlaying === !0 && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01), this;
}
getPlaybackRate() {
return this.playbackRate;
}
onEnded() {
this.isPlaying = !1, this._progress = 0;
}
getLoop() {
return this.hasPlaybackControl === !1 ? (j("Audio: this Audio has no playback control."), !1) : this.loop;
}
setLoop(e) {
if (this.hasPlaybackControl === !1) {
j("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, .01), this;
}
copy(e, t) {
return super.copy(e, t), e.sourceType === "buffer" ? (this.autoplay = e.autoplay, this.buffer = e.buffer, this.detune = e.detune, this.loop = e.loop, this.loopStart = e.loopStart, this.loopEnd = e.loopEnd, this.offset = e.offset, this.duration = e.duration, this.playbackRate = e.playbackRate, this.hasPlaybackControl = e.hasPlaybackControl, this.sourceType = e.sourceType, this.filters = e.filters.slice(), this) : (j("Audio: Audio source type cannot be copied."), this);
}
clone(e) {
return new this.constructor(this.listener).copy(this, e);
}
}, ad = /*@__PURE__*/ new I(), od = /*@__PURE__*/ new Mn(), sd = /*@__PURE__*/ new I(), cd = /*@__PURE__*/ new I(), ld = class extends id {
constructor(e) {
super(e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain);
}
connect() {
return super.connect(), this.panner.connect(this.gain), this;
}
disconnect() {
return super.disconnect(), this.panner.disconnect(this.gain), this;
}
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, n) {
return this.panner.coneInnerAngle = e, this.panner.coneOuterAngle = t, this.panner.coneOuterGain = n, this;
}
updateMatrixWorld(e) {
if (super.updateMatrixWorld(e), this.hasPlaybackControl === !0 && this.isPlaying === !1) return;
this.matrixWorld.decompose(ad, od, sd), cd.set(0, 0, 1).applyQuaternion(od);
let t = this.panner;
if (t.positionX) {
let e = this.context.currentTime + this.listener.timeDelta;
t.positionX.linearRampToValueAtTime(ad.x, e), t.positionY.linearRampToValueAtTime(ad.y, e), t.positionZ.linearRampToValueAtTime(ad.z, e), t.orientationX.linearRampToValueAtTime(cd.x, e), t.orientationY.linearRampToValueAtTime(cd.y, e), t.orientationZ.linearRampToValueAtTime(cd.z, e);
} else t.setPosition(ad.x, ad.y, ad.z), t.setOrientation(cd.x, cd.y, cd.z);
}
}, ud = class {
constructor(e, t = 2048) {
this.analyser = e.context.createAnalyser(), this.analyser.fftSize = t, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser);
}
getFrequencyData() {
return this.analyser.getByteFrequencyData(this.data), this.data;
}
getAverageFrequency() {
let e = 0, t = this.getFrequencyData();
for (let n = 0; n < t.length; n++) e += t[n];
return e / t.length;
}
}, dd = class {
constructor(e, t, n) {
this.binding = e, this.valueSize = n;
let r, i, a;
switch (t) {
case "quaternion":
r = this._slerp, i = this._slerpAdditive, a = this._setAdditiveIdentityQuaternion, this.buffer = new Float64Array(n * 6), this._workIndex = 5;
break;
case "string":
case "bool":
r = this._select, i = this._select, a = this._setAdditiveIdentityOther, this.buffer = Array(n * 5);
break;
default: r = this._lerp, i = this._lerpAdditive, a = this._setAdditiveIdentityNumeric, this.buffer = new Float64Array(n * 5);
}
this._mixBufferRegion = r, this._mixBufferRegionAdditive = i, this._setIdentity = a, this._origIndex = 3, this._addIndex = 4, this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, this.useCount = 0, this.referenceCount = 0;
}
accumulate(e, t) {
let n = this.buffer, r = this.valueSize, i = e * r + r, a = this.cumulativeWeight;
if (a === 0) {
for (let e = 0; e !== r; ++e) n[i + e] = n[e];
a = t;
} else {
a += t;
let e = t / a;
this._mixBufferRegion(n, i, 0, e, r);
}
this.cumulativeWeight = a;
}
accumulateAdditive(e) {
let t = this.buffer, n = this.valueSize, r = n * this._addIndex;
this.cumulativeWeightAdditive === 0 && this._setIdentity(), this._mixBufferRegionAdditive(t, r, 0, e, n), this.cumulativeWeightAdditive += e;
}
apply(e) {
let t = this.valueSize, n = this.buffer, r = e * t + t, i = this.cumulativeWeight, a = this.cumulativeWeightAdditive, o = this.binding;
if (this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0, i < 1) {
let e = t * this._origIndex;
this._mixBufferRegion(n, r, e, 1 - i, t);
}
a > 0 && this._mixBufferRegionAdditive(n, r, this._addIndex * t, 1, t);
for (let e = t, i = t + t; e !== i; ++e) if (n[e] !== n[e + t]) {
o.setValue(n, r);
break;
}
}
saveOriginalState() {
let e = this.binding, t = this.buffer, n = this.valueSize, r = n * this._origIndex;
e.getValue(t, r);
for (let e = n, i = r; e !== i; ++e) t[e] = t[r + e % n];
this._setIdentity(), this.cumulativeWeight = 0, this.cumulativeWeightAdditive = 0;
}
restoreOriginalState() {
let e = this.valueSize * 3;
this.binding.setValue(this.buffer, e);
}
_setAdditiveIdentityNumeric() {
let e = this._addIndex * this.valueSize, t = e + this.valueSize;
for (let n = e; n < t; n++) this.buffer[n] = 0;
}
_setAdditiveIdentityQuaternion() {
this._setAdditiveIdentityNumeric(), this.buffer[this._addIndex * this.valueSize + 3] = 1;
}
_setAdditiveIdentityOther() {
let e = this._origIndex * this.valueSize, t = this._addIndex * this.valueSize;
for (let n = 0; n < this.valueSize; n++) this.buffer[t + n] = this.buffer[e + n];
}
_select(e, t, n, r, i) {
if (r >= .5) for (let r = 0; r !== i; ++r) e[t + r] = e[n + r];
}
_slerp(e, t, n, r) {
Mn.slerpFlat(e, t, e, t, e, n, r);
}
_slerpAdditive(e, t, n, r, i) {
let a = this._workIndex * i;
Mn.multiplyQuaternionsFlat(e, a, e, t, e, n), Mn.slerpFlat(e, t, e, t, e, a, r);
}
_lerp(e, t, n, r, i) {
let a = 1 - r;
for (let o = 0; o !== i; ++o) {
let i = t + o;
e[i] = e[i] * a + e[n + o] * r;
}
}
_lerpAdditive(e, t, n, r, i) {
for (let a = 0; a !== i; ++a) {
let i = t + a;
e[i] = e[i] + e[n + a] * r;
}
}
}, fd = "\\[\\]\\.:\\/", pd = /* @__PURE__ */ RegExp("[\\[\\]\\.:\\/]", "g"), md = "[^\\[\\]\\.:\\/]", hd = "[^" + fd.replace("\\.", "") + "]", gd = /*@__PURE__*/ "((?:WC+[\\/:])*)".replace("WC", md), _d = /*@__PURE__*/ "(WCOD+)?".replace("WCOD", hd), vd = /*@__PURE__*/ "(?:\\.(WC+)(?:\\[(.+)\\])?)?".replace("WC", md), yd = /*@__PURE__*/ "\\.(WC+)(?:\\[(.+)\\])?".replace("WC", md), bd = RegExp("^" + gd + _d + vd + yd + "$"), xd = [
"material",
"materials",
"bones",
"map"
], Sd = class {
constructor(e, t, n) {
let r = n || Z.parseTrackName(t);
this._targetGroup = e, this._bindings = e.subscribe_(t, r);
}
getValue(e, t) {
this.bind();
let n = this._targetGroup.nCachedObjects_, r = this._bindings[n];
r !== void 0 && r.getValue(e, t);
}
setValue(e, t) {
let n = this._bindings;
for (let r = this._targetGroup.nCachedObjects_, i = n.length; r !== i; ++r) n[r].setValue(e, t);
}
bind() {
let e = this._bindings;
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].bind();
}
unbind() {
let e = this._bindings;
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].unbind();
}
}, Z = class e {
constructor(t, n, r) {
this.path = n, this.parsedPath = r || e.parseTrackName(n), this.node = e.findNode(t, this.parsedPath.nodeName), this.rootNode = t, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
}
static create(t, n, r) {
return t && t.isAnimationObjectGroup ? new e.Composite(t, n, r) : new e(t, n, r);
}
static sanitizeNodeName(e) {
return e.replace(/\s/g, "_").replace(pd, "");
}
static parseTrackName(e) {
let t = bd.exec(e);
if (t === null) throw Error("THREE.PropertyBinding: Cannot parse trackName: " + e);
let n = {
nodeName: t[2],
objectName: t[3],
objectIndex: t[4],
propertyName: t[5],
propertyIndex: t[6]
}, r = n.nodeName && n.nodeName.lastIndexOf(".");
if (r !== void 0 && r !== -1) {
let e = n.nodeName.substring(r + 1);
xd.indexOf(e) !== -1 && (n.nodeName = n.nodeName.substring(0, r), n.objectName = e);
}
if (n.propertyName === null || n.propertyName.length === 0) throw Error("THREE.PropertyBinding: can not parse propertyName from trackName: " + e);
return n;
}
static findNode(e, t) {
if (t === void 0 || t === "" || t === "." || t === -1 || t === e.name || t === e.uuid) return e;
if (e.skeleton) {
let n = e.skeleton.getBoneByName(t);
if (n !== void 0) return n;
}
if (e.children) {
let n = function(e) {
for (let r = 0; r < e.length; r++) {
let i = e[r];
if (i.name === t || i.uuid === t) return i;
let a = n(i.children);
if (a) return a;
}
return null;
}, r = n(e.children);
if (r) return r;
}
return null;
}
_getValue_unavailable() {}
_setValue_unavailable() {}
_getValue_direct(e, t) {
e[t] = this.targetObject[this.propertyName];
}
_getValue_array(e, t) {
let n = this.resolvedProperty;
for (let r = 0, i = n.length; r !== i; ++r) e[t++] = n[r];
}
_getValue_arrayElement(e, t) {
e[t] = this.resolvedProperty[this.propertyIndex];
}
_getValue_toArray(e, t) {
this.resolvedProperty.toArray(e, t);
}
_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;
}
_setValue_array(e, t) {
let n = this.resolvedProperty;
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
}
_setValue_array_setNeedsUpdate(e, t) {
let n = this.resolvedProperty;
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
this.targetObject.needsUpdate = !0;
}
_setValue_array_setMatrixWorldNeedsUpdate(e, t) {
let n = this.resolvedProperty;
for (let r = 0, i = n.length; r !== i; ++r) n[r] = e[t++];
this.targetObject.matrixWorldNeedsUpdate = !0;
}
_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;
}
_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);
}
bind() {
let t = this.node, n = this.parsedPath, r = n.objectName, i = n.propertyName, a = n.propertyIndex;
if (t || (t = e.findNode(this.rootNode, n.nodeName), this.node = t), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !t) {
j("PropertyBinding: No target node found for track: " + this.path + ".");
return;
}
if (r) {
let e = n.objectIndex;
switch (r) {
case "materials":
if (!t.material) {
M("PropertyBinding: Can not bind to material as node does not have a material.", this);
return;
}
if (!t.material.materials) {
M("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
return;
}
t = t.material.materials;
break;
case "bones":
if (!t.skeleton) {
M("PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
return;
}
t = t.skeleton.bones;
for (let n = 0; n < t.length; n++) if (t[n].name === e) {
e = n;
break;
}
break;
case "map":
if ("map" in t) {
t = t.map;
break;
}
if (!t.material) {
M("PropertyBinding: Can not bind to material as node does not have a material.", this);
return;
}
if (!t.material.map) {
M("PropertyBinding: Can not bind to material.map as node.material does not have a map.", this);
return;
}
t = t.material.map;
break;
default:
if (t[r] === void 0) {
M("PropertyBinding: Can not bind to objectName of node undefined.", this);
return;
}
t = t[r];
}
if (e !== void 0) {
if (t[e] === void 0) {
M("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, t);
return;
}
t = t[e];
}
}
let o = t[i];
if (o === void 0) {
let e = n.nodeName;
M("PropertyBinding: Trying to update property for track: " + e + "." + i + " but it wasn't found.", t);
return;
}
let s = this.Versioning.None;
this.targetObject = t, t.isMaterial === !0 ? s = this.Versioning.NeedsUpdate : t.isObject3D === !0 && (s = this.Versioning.MatrixWorldNeedsUpdate);
let c = this.BindingType.Direct;
if (a !== void 0) {
if (i === "morphTargetInfluences") {
if (!t.geometry) {
M("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
return;
}
if (!t.geometry.morphAttributes) {
M("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
return;
}
t.morphTargetDictionary[a] !== void 0 && (a = t.morphTargetDictionary[a]);
}
c = this.BindingType.ArrayElement, this.resolvedProperty = o, this.propertyIndex = a;
} 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 = i;
this.getValue = this.GetterByBindingType[c], this.setValue = this.SetterByBindingTypeAndVersioning[c][s];
}
unbind() {
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound;
}
};
Z.Composite = Sd, Z.prototype.BindingType = {
Direct: 0,
EntireArray: 1,
ArrayElement: 2,
HasFromToArray: 3
}, Z.prototype.Versioning = {
None: 0,
NeedsUpdate: 1,
MatrixWorldNeedsUpdate: 2
}, Z.prototype.GetterByBindingType = [
Z.prototype._getValue_direct,
Z.prototype._getValue_array,
Z.prototype._getValue_arrayElement,
Z.prototype._getValue_toArray
], Z.prototype.SetterByBindingTypeAndVersioning = [
[
Z.prototype._setValue_direct,
Z.prototype._setValue_direct_setNeedsUpdate,
Z.prototype._setValue_direct_setMatrixWorldNeedsUpdate
],
[
Z.prototype._setValue_array,
Z.prototype._setValue_array_setNeedsUpdate,
Z.prototype._setValue_array_setMatrixWorldNeedsUpdate
],
[
Z.prototype._setValue_arrayElement,
Z.prototype._setValue_arrayElement_setNeedsUpdate,
Z.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate
],
[
Z.prototype._setValue_fromArray,
Z.prototype._setValue_fromArray_setNeedsUpdate,
Z.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate
]
];
var Cd = class {
constructor() {
this.isAnimationObjectGroup = !0, this.uuid = dn(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0;
let e = {};
this._indicesByUUID = e;
for (let t = 0, n = arguments.length; t !== n; ++t) e[arguments[t].uuid] = t;
this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {};
let 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() {
let e = this._objects, t = this._indicesByUUID, n = this._paths, r = this._parsedPaths, i = this._bindings, a = i.length, o, s = e.length, c = this.nCachedObjects_;
for (let l = 0, u = arguments.length; l !== u; ++l) {
let u = arguments[l], d = u.uuid, f = t[d];
if (f === void 0) {
f = s++, t[d] = f, e.push(u);
for (let e = 0, t = a; e !== t; ++e) i[e].push(new Z(u, n[e], r[e]));
} else if (f < c) {
o = e[f];
let s = --c, l = e[s];
t[l.uuid] = f, e[f] = l, t[d] = s, e[s] = u;
for (let e = 0, t = a; e !== t; ++e) {
let t = i[e], a = t[s], o = t[f];
t[f] = a, o === void 0 && (o = new Z(u, n[e], r[e])), t[s] = o;
}
} else e[f] !== o && M("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.");
}
this.nCachedObjects_ = c;
}
remove() {
let e = this._objects, t = this._indicesByUUID, n = this._bindings, r = n.length, i = this.nCachedObjects_;
for (let a = 0, o = arguments.length; a !== o; ++a) {
let o = arguments[a], s = o.uuid, c = t[s];
if (c !== void 0 && c >= i) {
let a = i++, l = e[a];
t[l.uuid] = c, e[c] = l, t[s] = a, e[a] = o;
for (let e = 0, t = r; e !== t; ++e) {
let t = n[e], r = t[a], i = t[c];
t[c] = r, t[a] = i;
}
}
}
this.nCachedObjects_ = i;
}
uncache() {
let e = this._objects, t = this._indicesByUUID, n = this._bindings, r = n.length, i = this.nCachedObjects_, a = e.length;
for (let o = 0, s = arguments.length; o !== s; ++o) {
let s = arguments[o].uuid, c = t[s];
if (c !== void 0) if (delete t[s], c < i) {
let o = --i, s = e[o], l = --a, u = e[l];
t[s.uuid] = c, e[c] = s, t[u.uuid] = o, e[o] = u, e.pop();
for (let e = 0, t = r; e !== t; ++e) {
let t = n[e], r = t[o], i = t[l];
t[c] = r, t[o] = i, t.pop();
}
} else {
let i = --a, o = e[i];
i > 0 && (t[o.uuid] = c), e[c] = o, e.pop();
for (let e = 0, t = r; e !== t; ++e) {
let t = n[e];
t[c] = t[i], t.pop();
}
}
}
this.nCachedObjects_ = i;
}
subscribe_(e, t) {
let n = this._bindingsIndicesByPath, r = n[e], i = this._bindings;
if (r !== void 0) return i[r];
let a = this._paths, o = this._parsedPaths, s = this._objects, c = s.length, l = this.nCachedObjects_, u = Array(c);
r = i.length, n[e] = r, a.push(e), o.push(t), i.push(u);
for (let n = l, r = s.length; n !== r; ++n) {
let r = s[n];
u[n] = new Z(r, e, t);
}
return u;
}
unsubscribe_(e) {
let t = this._bindingsIndicesByPath, n = t[e];
if (n !== void 0) {
let r = this._paths, i = this._parsedPaths, a = this._bindings, o = a.length - 1, s = a[o], c = e[o];
t[c] = n, a[n] = s, a.pop(), i[n] = i[o], i.pop(), r[n] = r[o], r.pop();
}
}
}, wd = class {
constructor(e, t, n = null, r = t.blendMode) {
this._mixer = e, this._clip = t, this._localRoot = n, this.blendMode = r;
let i = t.tracks, a = i.length, o = Array(a), s = {
endingStart: ct,
endingEnd: ct
};
for (let e = 0; e !== a; ++e) {
let t = i[e].createInterpolant(null);
o[e] = t, t.settings = s;
}
this._interpolantSettings = s, this._interpolants = o, this._propertyBindings = Array(a), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._restoreTimeScale = null, this._weightInterpolant = null, this.loop = nt, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = Infinity, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0;
}
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);
}
isScheduled() {
return this._mixer._isActiveAction(this);
}
startAt(e) {
return this._startTime = e, this;
}
setLoop(e, t) {
return this.loop = e, this.repetitions = t, this;
}
setEffectiveWeight(e) {
return this.weight = e, this._effectiveWeight = this.enabled ? e : 0, this.stopFading();
}
getEffectiveWeight() {
return this._effectiveWeight;
}
fadeIn(e) {
return this._scheduleFading(e, 0, 1);
}
fadeOut(e) {
return this._scheduleFading(e, 1, 0);
}
crossFadeFrom(e, t, n = !1) {
if (e.fadeOut(t), this.fadeIn(t), n === !0) {
let n = this._clip.duration, r = e._clip.duration, i = r / n, a = n / r;
e._restoreTimeScale = e.timeScale, this._restoreTimeScale = this.timeScale, e.warp(1, i, t), this.warp(a, 1, t);
}
return this;
}
crossFadeTo(e, t, n = !1) {
return e.crossFadeFrom(this, t, n);
}
stopFading() {
let e = this._weightInterpolant;
return e !== null && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this;
}
setEffectiveTimeScale(e) {
return this.timeScale = e, this._effectiveTimeScale = this.paused ? 0 : e, this.stopWarping();
}
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, n) {
let r = this._mixer, i = r.time, a = this.timeScale, o = this._timeScaleInterpolant;
o === null && (o = r._lendControlInterpolant(), this._timeScaleInterpolant = o);
let s = o.parameterPositions, c = o.sampleValues;
return s[0] = i, s[1] = i + n, c[0] = e / a, c[1] = t / a, this;
}
stopWarping() {
let e = this._timeScaleInterpolant;
return e !== null && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(e)), this._restoreTimeScale = null, this;
}
getMixer() {
return this._mixer;
}
getClip() {
return this._clip;
}
getRoot() {
return this._localRoot || this._mixer._root;
}
_update(e, t, n, r) {
if (!this.enabled) {
this._updateWeight(e);
return;
}
let i = this._startTime;
if (i !== null) {
let r = (e - i) * n;
r < 0 || n === 0 ? t = 0 : (this._startTime = null, t = n * r);
}
t *= this._updateTimeScale(e);
let a = this._updateTime(t), o = this._updateWeight(e);
if (o > 0) {
let e = this._interpolants, t = this._propertyBindings;
switch (this.blendMode) {
case ft:
for (let n = 0, r = e.length; n !== r; ++n) e[n].evaluate(a), t[n].accumulateAdditive(o);
break;
case dt:
default: for (let n = 0, i = e.length; n !== i; ++n) e[n].evaluate(a), t[n].accumulate(r, o);
}
}
}
_updateWeight(e) {
let t = 0;
if (this.enabled) {
t = this.weight;
let n = this._weightInterpolant;
if (n !== null) {
let r = n.evaluate(e)[0];
t *= r, e > n.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;
let n = this._timeScaleInterpolant;
if (n !== null) {
let r = n.evaluate(e)[0];
t *= r, e > n.parameterPositions[1] && (t === 0 ? this.paused = !0 : (this._restoreTimeScale !== null && (t = this._restoreTimeScale), this.timeScale = t), this.stopWarping());
}
}
return this._effectiveTimeScale = t, t;
}
_updateTime(e) {
let t = this._clip.duration, n = this.loop, r = this.time + e, i = this._loopCount, a = n === rt;
if (e === 0) return i === -1 ? r : a && (i & 1) == 1 ? t - r : r;
if (n === 2200) {
i === -1 && (this._loopCount = 0, this._setEndings(!0, !0, !1));
handle_stop: {
if (r >= t) r = t;
else if (r < 0) r = 0;
else {
this.time = r;
break handle_stop;
}
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 (i === -1 && (e >= 0 ? (i = 0, this._setEndings(!0, this.repetitions === 0, a)) : this._setEndings(this.repetitions === 0, !0, a)), r >= t || r < 0) {
let n = Math.floor(r / t);
r -= t * n, i += Math.abs(n);
let o = this.repetitions - i;
if (o <= 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 (o === 1) {
let t = e < 0;
this._setEndings(t, !t, a);
} else this._setEndings(!1, !1, a);
this._loopCount = i, this.time = r, this._mixer.dispatchEvent({
type: "loop",
action: this,
loopDelta: n
});
}
} else this._loopCount = i, this.time = r;
if (a && (i & 1) == 1) return t - r;
}
return r;
}
_setEndings(e, t, n) {
let r = this._interpolantSettings;
n ? (r.endingStart = lt, r.endingEnd = lt) : (e ? r.endingStart = this.zeroSlopeAtStart ? lt : ct : r.endingStart = ut, t ? r.endingEnd = this.zeroSlopeAtEnd ? lt : ct : r.endingEnd = ut);
}
_scheduleFading(e, t, n) {
let r = this._mixer, i = r.time, a = this._weightInterpolant;
a === null && (a = r._lendControlInterpolant(), this._weightInterpolant = a);
let o = a.parameterPositions, s = a.sampleValues;
return o[0] = i, s[0] = t, o[1] = i + e, s[1] = n, this;
}
}, Td = /* @__PURE__ */ new Float32Array(1), Ed = class extends on {
constructor(e) {
super(), this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1, typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this }));
}
_bindAction(e, t) {
let n = e._localRoot || this._root, r = e._clip.tracks, i = r.length, a = e._propertyBindings, o = e._interpolants, s = n.uuid, c = this._bindingsByRootAndName, l = c[s];
l === void 0 && (l = {}, c[s] = l);
for (let e = 0; e !== i; ++e) {
let i = r[e], c = i.name, u = l[c];
if (u !== void 0) ++u.referenceCount, a[e] = u;
else {
if (u = a[e], u !== void 0) {
u._cacheIndex === null && (++u.referenceCount, this._addInactiveBinding(u, s, c));
continue;
}
let r = t && t._propertyBindings[e].binding.parsedPath;
u = new dd(Z.create(n, c, r), i.ValueTypeName, i.getValueSize()), ++u.referenceCount, this._addInactiveBinding(u, s, c), a[e] = u;
}
o[e].resultBuffer = u.buffer;
}
}
_activateAction(e) {
if (!this._isActiveAction(e)) {
if (e._cacheIndex === null) {
let t = (e._localRoot || this._root).uuid, n = e._clip.uuid, r = this._actionsByClip[n];
this._bindAction(e, r && r.knownActions[0]), this._addInactiveAction(e, n, t);
}
let t = e._propertyBindings;
for (let e = 0, n = t.length; e !== n; ++e) {
let n = t[e];
n.useCount++ === 0 && (this._lendBinding(n), n.saveOriginalState());
}
this._lendAction(e);
}
}
_deactivateAction(e) {
if (this._isActiveAction(e)) {
let t = e._propertyBindings;
for (let e = 0, n = t.length; e !== n; ++e) {
let n = t[e];
--n.useCount === 0 && (n.restoreOriginalState(), this._takeBackBinding(n));
}
this._takeBackAction(e);
}
}
_initMemoryManager() {
this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0;
let 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;
}
}
};
}
_isActiveAction(e) {
let t = e._cacheIndex;
return t !== null && t < this._nActiveActions;
}
_addInactiveAction(e, t, n) {
let r = this._actions, i = this._actionsByClip, a = i[t];
if (a === void 0) a = {
knownActions: [e],
actionByRoot: {}
}, e._byClipCacheIndex = 0, i[t] = a;
else {
let t = a.knownActions;
e._byClipCacheIndex = t.length, t.push(e);
}
e._cacheIndex = r.length, r.push(e), a.actionByRoot[n] = e;
}
_removeInactiveAction(e) {
let t = this._actions, n = t[t.length - 1], r = e._cacheIndex;
n._cacheIndex = r, t[r] = n, t.pop(), e._cacheIndex = null;
let i = e._clip.uuid, a = this._actionsByClip, o = a[i], s = o.knownActions, c = s[s.length - 1], l = e._byClipCacheIndex;
c._byClipCacheIndex = l, s[l] = c, s.pop(), e._byClipCacheIndex = null;
let u = o.actionByRoot, d = (e._localRoot || this._root).uuid;
delete u[d], s.length === 0 && delete a[i], this._removeInactiveBindingsForAction(e);
}
_removeInactiveBindingsForAction(e) {
let t = e._propertyBindings;
for (let e = 0, n = t.length; e !== n; ++e) {
let n = t[e];
--n.referenceCount === 0 && this._removeInactiveBinding(n);
}
}
_lendAction(e) {
let t = this._actions, n = e._cacheIndex, r = this._nActiveActions++, i = t[r];
e._cacheIndex = r, t[r] = e, i._cacheIndex = n, t[n] = i;
}
_takeBackAction(e) {
let t = this._actions, n = e._cacheIndex, r = --this._nActiveActions, i = t[r];
e._cacheIndex = r, t[r] = e, i._cacheIndex = n, t[n] = i;
}
_addInactiveBinding(e, t, n) {
let r = this._bindingsByRootAndName, i = this._bindings, a = r[t];
a === void 0 && (a = {}, r[t] = a), a[n] = e, e._cacheIndex = i.length, i.push(e);
}
_removeInactiveBinding(e) {
let t = this._bindings, n = e.binding, r = n.rootNode.uuid, i = n.path, a = this._bindingsByRootAndName, o = a[r], s = t[t.length - 1], c = e._cacheIndex;
s._cacheIndex = c, t[c] = s, t.pop(), delete o[i], Object.keys(o).length === 0 && delete a[r];
}
_lendBinding(e) {
let t = this._bindings, n = e._cacheIndex, r = this._nActiveBindings++, i = t[r];
e._cacheIndex = r, t[r] = e, i._cacheIndex = n, t[n] = i;
}
_takeBackBinding(e) {
let t = this._bindings, n = e._cacheIndex, r = --this._nActiveBindings, i = t[r];
e._cacheIndex = r, t[r] = e, i._cacheIndex = n, t[n] = i;
}
_lendControlInterpolant() {
let e = this._controlInterpolants, t = this._nActiveControlInterpolants++, n = e[t];
return n === void 0 && (n = new Dl(/* @__PURE__ */ new Float32Array(2), /* @__PURE__ */ new Float32Array(2), 1, Td), n.__cacheIndex = t, e[t] = n), n;
}
_takeBackControlInterpolant(e) {
let t = this._controlInterpolants, n = e.__cacheIndex, r = --this._nActiveControlInterpolants, i = t[r];
e.__cacheIndex = r, t[r] = e, i.__cacheIndex = n, t[n] = i;
}
clipAction(e, t, n) {
let r = t || this._root, i = r.uuid, a = typeof e == "string" ? Rl.findByName(r, e) : e, o = a === null ? e : a.uuid, s = this._actionsByClip[o], c = null;
if (n === void 0 && (n = a === null ? dt : a.blendMode), s !== void 0) {
let e = s.actionByRoot[i];
if (e !== void 0 && e.blendMode === n) return e;
c = s.knownActions[0], a === null && (a = c._clip);
}
if (a === null) return null;
let l = new wd(this, a, t, n);
return this._bindAction(l, c), this._addInactiveAction(l, o, i), l;
}
existingAction(e, t) {
let n = t || this._root, r = n.uuid, i = typeof e == "string" ? Rl.findByName(n, e) : e, a = i ? i.uuid : e, o = this._actionsByClip[a];
return o === void 0 ? null : o.actionByRoot[r] || null;
}
stopAllAction() {
let e = this._actions, t = this._nActiveActions;
for (let n = t - 1; n >= 0; --n) e[n].stop();
return this;
}
update(e) {
e *= this.timeScale;
let t = this._actions, n = this._nActiveActions, r = this.time += e, i = Math.sign(e), a = this._accuIndex ^= 1;
for (let o = 0; o !== n; ++o) t[o]._update(r, e, i, a);
let o = this._bindings, s = this._nActiveBindings;
for (let e = 0; e !== s; ++e) o[e].apply(a);
return this;
}
setTime(e) {
this.time = 0;
for (let e = 0; e < this._actions.length; e++) this._actions[e].time = 0;
return this.update(e);
}
getRoot() {
return this._root;
}
uncacheClip(e) {
let t = this._actions, n = e.uuid, r = this._actionsByClip, i = r[n];
if (i !== void 0) {
let e = i.knownActions;
for (let n = 0, r = e.length; n !== r; ++n) {
let r = e[n];
this._deactivateAction(r);
let i = r._cacheIndex, a = t[t.length - 1];
r._cacheIndex = null, r._byClipCacheIndex = null, a._cacheIndex = i, t[i] = a, t.pop(), this._removeInactiveBindingsForAction(r);
}
delete r[n];
}
}
uncacheRoot(e) {
let t = e.uuid, n = this._actionsByClip;
for (let e in n) {
let r = n[e].actionByRoot[t];
r !== void 0 && (this._deactivateAction(r), this._removeInactiveAction(r));
}
let r = this._bindingsByRootAndName[t];
if (r !== void 0) for (let e in r) {
let t = r[e];
t.restoreOriginalState(), this._removeInactiveBinding(t);
}
}
uncacheAction(e, t) {
let n = this.existingAction(e, t);
n !== null && (this._deactivateAction(n), this._removeInactiveAction(n));
}
}, Dd = class extends Zn {
constructor(e = 1, t = 1, n = 1, r = {}) {
super(e, t, r), this.isRenderTarget3D = !0, this.depth = n, this.texture = new tr(null, e, t, n), this._setTextureOptions(r), this.texture.isRenderTargetTexture = !0;
}
}, Od = class e {
constructor(e) {
this.value = e;
}
clone() {
return new e(this.value.clone === void 0 ? this.value : this.value.clone());
}
}, kd = 0, Ad = class extends on {
constructor() {
super(), this.isUniformsGroup = !0, Object.defineProperty(this, "id", { value: kd++ }), this.name = "", this.usage = Ot, this.uniforms = [];
}
add(e) {
return this.uniforms.push(e), this;
}
remove(e) {
let t = this.uniforms.indexOf(e);
return t !== -1 && this.uniforms.splice(t, 1), this;
}
setName(e) {
return this.name = e, this;
}
setUsage(e) {
return this.usage = e, this;
}
dispose() {
this.dispatchEvent({ type: "dispose" });
}
copy(e) {
this.name = e.name, this.usage = e.usage;
let t = e.uniforms;
this.uniforms.length = 0;
for (let e = 0, n = t.length; e < n; e++) {
let n = Array.isArray(t[e]) ? t[e] : [t[e]];
for (let e = 0; e < n.length; e++) this.uniforms.push(n[e].clone());
}
return this;
}
clone() {
return new this.constructor().copy(this);
}
}, jd = class extends Li {
constructor(e, t, n = 1) {
super(e, t), this.isInstancedInterleavedBuffer = !0, this.meshPerAttribute = n;
}
copy(e) {
return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this;
}
clone(e) {
let t = super.clone(e);
return t.meshPerAttribute = this.meshPerAttribute, t;
}
toJSON(e) {
let t = super.toJSON(e);
return t.isInstancedInterleavedBuffer = !0, t.meshPerAttribute = this.meshPerAttribute, t;
}
}, Md = class {
constructor(e, t, n, r, i, a = !1) {
this.isGLBufferAttribute = !0, this.name = "", this.buffer = e, this.type = t, this.itemSize = n, this.elementSize = r, this.count = i, this.normalized = a, 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;
}
}, Nd = /*@__PURE__*/ new R(), Pd = class {
constructor(e, t, n = 0, r = Infinity) {
this.ray = new pa(e, t), this.near = n, this.far = r, this.camera = null, this.layers = new pr(), this.params = {
Mesh: {},
Line: { threshold: 1 },
LOD: {},
Points: { threshold: 1 },
Sprite: {}
};
}
set(e, t) {
this.ray.set(e, t);
}
setFromCamera(e, t) {
t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, .5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, t.projectionMatrix.elements[14]).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : M("Raycaster: Unsupported camera type: " + t.type);
}
setFromXRController(e) {
return Nd.identity().extractRotation(e.matrixWorld), this.ray.origin.setFromMatrixPosition(e.matrixWorld), this.ray.direction.set(0, 0, -1).applyMatrix4(Nd), this;
}
intersectObject(e, t = !0, n = []) {
return Id(e, this, n, t), n.sort(Fd), n;
}
intersectObjects(e, t = !0, n = []) {
for (let r = 0, i = e.length; r < i; r++) Id(e[r], this, n, t);
return n.sort(Fd), n;
}
};
function Fd(e, t) {
return e.distance - t.distance;
}
function Id(e, t, n, r) {
let i = !0;
if (e.layers.test(t.layers) && e.raycast(t, n) === !1 && (i = !1), i === !0 && r === !0) {
let r = e.children;
for (let e = 0, i = r.length; e < i; e++) Id(r[e], t, n, !0);
}
}
var Ld = class {
constructor(e = !0) {
this.autoStart = e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1, j("Clock: This module has been deprecated. Please use THREE.Timer instead.");
}
start() {
this.startTime = performance.now(), 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) {
let t = performance.now();
e = (t - this.oldTime) / 1e3, this.oldTime = t, this.elapsedTime += e;
}
return e;
}
}, Rd = class {
constructor(e = 1, t = 0, n = 0) {
this.radius = e, this.phi = t, this.theta = n;
}
set(e, t, n) {
return this.radius = e, this.phi = t, this.theta = n, this;
}
copy(e) {
return this.radius = e.radius, this.phi = e.phi, this.theta = e.theta, this;
}
makeSafe() {
let e = 1e-6;
return this.phi = N(this.phi, e, Math.PI - e), this;
}
setFromVector3(e) {
return this.setFromCartesianCoords(e.x, e.y, e.z);
}
setFromCartesianCoords(e, t, n) {
return this.radius = Math.sqrt(e * e + t * t + n * n), this.radius === 0 ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(e, n), this.phi = Math.acos(N(t / this.radius, -1, 1))), this;
}
clone() {
return new this.constructor().copy(this);
}
}, zd = class {
constructor(e = 1, t = 0, n = 0) {
this.radius = e, this.theta = t, this.y = n;
}
set(e, t, n) {
return this.radius = e, this.theta = t, this.y = n, 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, n) {
return this.radius = Math.sqrt(e * e + n * n), this.theta = Math.atan2(e, n), this.y = t, this;
}
clone() {
return new this.constructor().copy(this);
}
}, Bd = class {
constructor(e, t, n, r) {
this.elements = [
1,
0,
0,
1
], e !== void 0 && this.set(e, t, n, r);
}
identity() {
return this.set(1, 0, 0, 1), this;
}
fromArray(e, t = 0) {
for (let n = 0; n < 4; n++) this.elements[n] = e[n + t];
return this;
}
set(e, t, n, r) {
let i = this.elements;
return i[0] = e, i[2] = t, i[1] = n, i[3] = r, this;
}
};
a = Bd, a.prototype.isMatrix2 = !0;
var Vd = /*@__PURE__*/ new F(), Hd = class {
constructor(e = new F(Infinity, Infinity), t = new F(-Infinity, -Infinity)) {
this.isBox2 = !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, n = e.length; t < n; t++) this.expandByPoint(e[t]);
return this;
}
setFromCenterAndSize(e, t) {
let n = Vd.copy(t).multiplyScalar(.5);
return this.min.copy(e).sub(n), this.max.copy(e).add(n), 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 = Infinity, this.max.x = this.max.y = -Infinity, 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(.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 this.clampPoint(e, Vd).distanceTo(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;
}
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);
}
}, Ud = /*@__PURE__*/ new I(), Wd = /*@__PURE__*/ new I(), Gd = /*@__PURE__*/ new I(), Kd = /*@__PURE__*/ new I(), qd = /*@__PURE__*/ new I(), Jd = /*@__PURE__*/ new I(), Yd = /*@__PURE__*/ new I(), Xd = class {
constructor(e = new I(), t = new I()) {
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(.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) {
Ud.subVectors(e, this.start), Wd.subVectors(this.end, this.start);
let n = Wd.dot(Wd);
if (n === 0) return 0;
let r = Wd.dot(Ud) / n;
return t && (r = N(r, 0, 1)), r;
}
closestPointToPoint(e, t, n) {
let r = this.closestPointToPointParameter(e, t);
return this.delta(n).multiplyScalar(r).add(this.start);
}
distanceSqToLine3(e, t = Jd, n = Yd) {
let r = 1e-8 * 1e-8, i, a, o = this.start, s = e.start, c = this.end, l = e.end;
Gd.subVectors(c, o), Kd.subVectors(l, s), qd.subVectors(o, s);
let u = Gd.dot(Gd), d = Kd.dot(Kd), f = Kd.dot(qd);
if (u <= r && d <= r) return t.copy(o), n.copy(s), t.sub(n), t.dot(t);
if (u <= r) i = 0, a = f / d, a = N(a, 0, 1);
else {
let e = Gd.dot(qd);
if (d <= r) a = 0, i = N(-e / u, 0, 1);
else {
let t = Gd.dot(Kd), n = u * d - t * t;
i = n === 0 ? 0 : N((t * f - e * d) / n, 0, 1), a = (t * i + f) / d, a < 0 ? (a = 0, i = N(-e / u, 0, 1)) : a > 1 && (a = 1, i = N((t - e) / u, 0, 1));
}
}
return t.copy(o).addScaledVector(Gd, i), n.copy(s).addScaledVector(Kd, a), t.distanceToSquared(n);
}
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);
}
}, Zd = /*@__PURE__*/ new I(), Qd = class extends z {
constructor(e, t) {
super(), this.light = e, this.matrixAutoUpdate = !1, this.color = t, this.type = "SpotLightHelper";
let n = new J(), 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 e = 0, t = 1; e < 32; e++, t++) {
let n = e / 32 * Math.PI * 2, i = t / 32 * Math.PI * 2;
r.push(Math.cos(n), Math.sin(n), 1, Math.cos(i), Math.sin(i), 1);
}
n.setAttribute("position", new G(r, 3));
let i = new ko({
fog: !1,
toneMapped: !1
});
this.cone = new Vo(n, i), this.add(this.cone), this.update();
}
dispose() {
this.cone.geometry.dispose(), this.cone.material.dispose();
}
update() {
this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1), this.parent ? (this.parent.updateWorldMatrix(!0), this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)) : this.matrix.copy(this.light.matrixWorld), this.matrixWorldNeedsUpdate = !0;
let e = this.light.distance ? this.light.distance : 1e3, t = e * Math.tan(this.light.angle);
this.cone.scale.set(t, t, e), Zd.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(Zd), this.color === void 0 ? this.cone.material.color.copy(this.light.color) : this.cone.material.color.set(this.color);
}
}, $d = /*@__PURE__*/ new I(), ef = /*@__PURE__*/ new R(), tf = /*@__PURE__*/ new R(), nf = class extends Vo {
constructor(e) {
let t = rf(e), n = new J(), r = [], i = [];
for (let e = 0; e < t.length; e++) {
let n = t[e];
n.parent && n.parent.isBone && (r.push(0, 0, 0), r.push(0, 0, 0), i.push(0, 0, 0), i.push(0, 0, 0));
}
n.setAttribute("position", new G(r, 3)), n.setAttribute("color", new G(i, 3));
let a = new ko({
vertexColors: !0,
depthTest: !1,
depthWrite: !1,
toneMapped: !1,
transparent: !0
});
super(n, a), this.isSkeletonHelper = !0, this.type = "SkeletonHelper", this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1;
let o = new B(255), s = new B(65280);
this.setColors(o, s);
}
updateMatrixWorld(e) {
let t = this.bones, n = this.geometry, r = n.getAttribute("position");
tf.copy(this.root.matrixWorld).invert();
for (let e = 0, n = 0; e < t.length; e++) {
let i = t[e];
i.parent && i.parent.isBone && (ef.multiplyMatrices(tf, i.matrixWorld), $d.setFromMatrixPosition(ef), r.setXYZ(n, $d.x, $d.y, $d.z), ef.multiplyMatrices(tf, i.parent.matrixWorld), $d.setFromMatrixPosition(ef), r.setXYZ(n + 1, $d.x, $d.y, $d.z), n += 2);
}
n.getAttribute("position").needsUpdate = !0, super.updateMatrixWorld(e);
}
setColors(e, t) {
let n = this.geometry.getAttribute("color");
for (let r = 0; r < n.count; r += 2) n.setXYZ(r, e.r, e.g, e.b), n.setXYZ(r + 1, t.r, t.g, t.b);
return n.needsUpdate = !0, this;
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
};
function rf(e) {
let t = [];
e.isBone === !0 && t.push(e);
for (let n = 0; n < e.children.length; n++) t.push(...rf(e.children[n]));
return t;
}
var af = class extends Ea {
constructor(e, t, n) {
let r = new Uc(t, 4, 2), i = new ma({
wireframe: !0,
fog: !1,
toneMapped: !1
});
super(r, i), this.light = e, this.color = n, this.type = "PointLightHelper", this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update();
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
update() {
this.matrixWorldNeedsUpdate = !0, this.light.updateWorldMatrix(!0, !1), this.color === void 0 ? this.material.color.copy(this.light.color) : this.material.color.set(this.color);
}
}, of = /*@__PURE__*/ new I(), sf = /*@__PURE__*/ new B(), cf = /*@__PURE__*/ new B(), lf = class extends z {
constructor(e, t, n) {
super(), this.light = e, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, this.type = "HemisphereLightHelper";
let r = new Rc(t);
r.rotateY(Math.PI * .5), this.material = new ma({
wireframe: !0,
fog: !1,
toneMapped: !1
}), this.color === void 0 && (this.material.vertexColors = !0);
let i = r.getAttribute("position"), a = new Float32Array(i.count * 3);
r.setAttribute("color", new W(a, 3)), this.add(new Ea(r, this.material)), this.update();
}
dispose() {
this.children[0].geometry.dispose(), this.children[0].material.dispose();
}
update() {
let e = this.children[0];
if (this.color !== void 0) this.material.color.set(this.color);
else {
let t = e.geometry.getAttribute("color");
sf.copy(this.light.color), cf.copy(this.light.groundColor);
for (let e = 0, n = t.count; e < n; e++) {
let r = e < n / 2 ? sf : cf;
t.setXYZ(e, r.r, r.g, r.b);
}
t.needsUpdate = !0;
}
this.matrixWorldNeedsUpdate = !0, this.light.updateWorldMatrix(!0, !1), e.lookAt(of.setFromMatrixPosition(this.light.matrixWorld).negate());
}
}, uf = class extends Vo {
constructor(e = 10, t = 10, n = 4473924, r = 8947848) {
n = new B(n), r = new B(r);
let i = t / 2, a = e / t, o = e / 2, s = [], c = [];
for (let e = 0, l = 0, u = -o; e <= t; e++, u += a) {
s.push(-o, 0, u, o, 0, u), s.push(u, 0, -o, u, 0, o);
let t = e === i ? n : r;
t.toArray(c, l), l += 3, t.toArray(c, l), l += 3, t.toArray(c, l), l += 3, t.toArray(c, l), l += 3;
}
let l = new J();
l.setAttribute("position", new G(s, 3)), l.setAttribute("color", new G(c, 3));
let u = new ko({
vertexColors: !0,
toneMapped: !1
});
super(l, u), this.type = "GridHelper";
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
}, df = class extends Vo {
constructor(e = 10, t = 16, n = 8, r = 64, i = 4473924, a = 8947848) {
i = new B(i), a = new B(a);
let o = [], s = [];
if (t > 1) for (let n = 0; n < t; n++) {
let r = n / t * (Math.PI * 2), c = Math.sin(r) * e, l = Math.cos(r) * e;
o.push(0, 0, 0), o.push(c, 0, l);
let u = n & 1 ? i : a;
s.push(u.r, u.g, u.b), s.push(u.r, u.g, u.b);
}
for (let t = 0; t < n; t++) {
let c = t & 1 ? i : a, l = e - e / n * t;
for (let e = 0; e < r; e++) {
let t = e / r * (Math.PI * 2), n = Math.sin(t) * l, i = Math.cos(t) * l;
o.push(n, 0, i), s.push(c.r, c.g, c.b), t = (e + 1) / r * (Math.PI * 2), n = Math.sin(t) * l, i = Math.cos(t) * l, o.push(n, 0, i), s.push(c.r, c.g, c.b);
}
}
let c = new J();
c.setAttribute("position", new G(o, 3)), c.setAttribute("color", new G(s, 3));
let l = new ko({
vertexColors: !0,
toneMapped: !1
});
super(c, l), this.type = "PolarGridHelper";
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
}, ff = /*@__PURE__*/ new I(), pf = /*@__PURE__*/ new I(), mf = /*@__PURE__*/ new I(), hf = class extends z {
constructor(e, t, n) {
super(), this.light = e, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, this.type = "DirectionalLightHelper", t === void 0 && (t = 1);
let r = new J();
r.setAttribute("position", new G([
-t,
t,
0,
t,
t,
0,
t,
-t,
0,
-t,
-t,
0,
-t,
t,
0
], 3));
let i = new ko({
fog: !1,
toneMapped: !1
});
this.lightPlane = new Lo(r, i), this.add(this.lightPlane), r = new J(), r.setAttribute("position", new G([
0,
0,
0,
0,
0,
1
], 3)), this.targetLine = new Lo(r, i), this.add(this.targetLine), this.update();
}
dispose() {
this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose();
}
update() {
this.matrixWorldNeedsUpdate = !0, this.light.updateWorldMatrix(!0, !1), this.light.target.updateWorldMatrix(!0, !1), ff.setFromMatrixPosition(this.light.matrixWorld), pf.setFromMatrixPosition(this.light.target.matrixWorld), mf.subVectors(pf, ff), this.lightPlane.lookAt(pf), this.color === void 0 ? (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)) : (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)), this.targetLine.lookAt(pf), this.targetLine.scale.z = mf.length();
}
}, gf = /*@__PURE__*/ new I(), Q = /*@__PURE__*/ new du(), _f = class extends Vo {
constructor(e) {
let t = new J(), n = new ko({
color: 16777215,
vertexColors: !0,
toneMapped: !1
}), r = [], i = [], a = {};
o("n1", "n2"), o("n2", "n4"), o("n4", "n3"), o("n3", "n1"), o("f1", "f2"), o("f2", "f4"), o("f4", "f3"), o("f3", "f1"), o("n1", "f1"), o("n2", "f2"), o("n3", "f3"), o("n4", "f4"), o("p", "n1"), o("p", "n2"), o("p", "n3"), o("p", "n4"), o("u1", "u2"), o("u2", "u3"), o("u3", "u1"), o("c", "t"), o("p", "c"), o("cn1", "cn2"), o("cn3", "cn4"), o("cf1", "cf2"), o("cf3", "cf4");
function o(e, t) {
s(e), s(t);
}
function s(e) {
r.push(0, 0, 0), i.push(0, 0, 0), a[e] === void 0 && (a[e] = []), a[e].push(r.length / 3 - 1);
}
t.setAttribute("position", new G(r, 3)), t.setAttribute("color", new G(i, 3)), super(t, n), this.type = "CameraHelper", this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = a, this.update();
let c = new B(16755200), l = new B(16711680), u = new B(43775), d = new B(16777215), f = new B(3355443);
this.setColors(c, l, u, d, f);
}
setColors(e, t, n, r, i) {
let a = this.geometry.getAttribute("color");
return a.setXYZ(0, e.r, e.g, e.b), a.setXYZ(1, e.r, e.g, e.b), a.setXYZ(2, e.r, e.g, e.b), a.setXYZ(3, e.r, e.g, e.b), a.setXYZ(4, e.r, e.g, e.b), a.setXYZ(5, e.r, e.g, e.b), a.setXYZ(6, e.r, e.g, e.b), a.setXYZ(7, e.r, e.g, e.b), a.setXYZ(8, e.r, e.g, e.b), a.setXYZ(9, e.r, e.g, e.b), a.setXYZ(10, e.r, e.g, e.b), a.setXYZ(11, e.r, e.g, e.b), a.setXYZ(12, e.r, e.g, e.b), a.setXYZ(13, e.r, e.g, e.b), a.setXYZ(14, e.r, e.g, e.b), a.setXYZ(15, e.r, e.g, e.b), a.setXYZ(16, e.r, e.g, e.b), a.setXYZ(17, e.r, e.g, e.b), a.setXYZ(18, e.r, e.g, e.b), a.setXYZ(19, e.r, e.g, e.b), a.setXYZ(20, e.r, e.g, e.b), a.setXYZ(21, e.r, e.g, e.b), a.setXYZ(22, e.r, e.g, e.b), a.setXYZ(23, e.r, e.g, e.b), a.setXYZ(24, t.r, t.g, t.b), a.setXYZ(25, t.r, t.g, t.b), a.setXYZ(26, t.r, t.g, t.b), a.setXYZ(27, t.r, t.g, t.b), a.setXYZ(28, t.r, t.g, t.b), a.setXYZ(29, t.r, t.g, t.b), a.setXYZ(30, t.r, t.g, t.b), a.setXYZ(31, t.r, t.g, t.b), a.setXYZ(32, n.r, n.g, n.b), a.setXYZ(33, n.r, n.g, n.b), a.setXYZ(34, n.r, n.g, n.b), a.setXYZ(35, n.r, n.g, n.b), a.setXYZ(36, n.r, n.g, n.b), a.setXYZ(37, n.r, n.g, n.b), a.setXYZ(38, r.r, r.g, r.b), a.setXYZ(39, r.r, r.g, r.b), a.setXYZ(40, i.r, i.g, i.b), a.setXYZ(41, i.r, i.g, i.b), a.setXYZ(42, i.r, i.g, i.b), a.setXYZ(43, i.r, i.g, i.b), a.setXYZ(44, i.r, i.g, i.b), a.setXYZ(45, i.r, i.g, i.b), a.setXYZ(46, i.r, i.g, i.b), a.setXYZ(47, i.r, i.g, i.b), a.setXYZ(48, i.r, i.g, i.b), a.setXYZ(49, i.r, i.g, i.b), a.needsUpdate = !0, this;
}
update() {
let e = this.geometry, t = this.pointMap, n, r;
if (Q.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse), this.camera.reversedDepth === !0) n = 1, r = 0;
else if (this.camera.coordinateSystem === 2e3) n = -1, r = 1;
else if (this.camera.coordinateSystem === 2001) n = 0, r = 1;
else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: " + this.camera.coordinateSystem);
$("c", t, e, Q, 0, 0, n), $("t", t, e, Q, 0, 0, r), $("n1", t, e, Q, -1, -1, n), $("n2", t, e, Q, 1, -1, n), $("n3", t, e, Q, -1, 1, n), $("n4", t, e, Q, 1, 1, n), $("f1", t, e, Q, -1, -1, r), $("f2", t, e, Q, 1, -1, r), $("f3", t, e, Q, -1, 1, r), $("f4", t, e, Q, 1, 1, r), $("u1", t, e, Q, 1 * .7, 1 * 1.1, n), $("u2", t, e, Q, -1 * .7, 1 * 1.1, n), $("u3", t, e, Q, 0, 2, n), $("cf1", t, e, Q, -1, 0, r), $("cf2", t, e, Q, 1, 0, r), $("cf3", t, e, Q, 0, -1, r), $("cf4", t, e, Q, 0, 1, r), $("cn1", t, e, Q, -1, 0, n), $("cn2", t, e, Q, 1, 0, n), $("cn3", t, e, Q, 0, -1, n), $("cn4", t, e, Q, 0, 1, n), e.getAttribute("position").needsUpdate = !0;
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
};
function $(e, t, n, r, i, a, o) {
gf.set(i, a, o).unproject(r);
let s = t[e];
if (s !== void 0) {
let e = n.getAttribute("position");
for (let t = 0, n = s.length; t < n; t++) e.setXYZ(s[t], gf.x, gf.y, gf.z);
}
}
var vf = /*@__PURE__*/ new H(), yf = class extends Vo {
constructor(e, t = 16776960) {
let n = 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 = /* @__PURE__ */ new Float32Array(24), i = new J();
i.setIndex(new W(n, 1)), i.setAttribute("position", new W(r, 3)), super(i, new ko({
color: t,
toneMapped: !1
})), this.object = e, this.type = "BoxHelper", this.matrixAutoUpdate = !1, this.update();
}
update() {
if (this.object !== void 0 && vf.setFromObject(this.object), vf.isEmpty()) return;
let e = vf.min, t = vf.max, n = this.geometry.attributes.position, r = n.array;
r[0] = t.x, r[1] = t.y, r[2] = t.z, r[3] = e.x, r[4] = t.y, r[5] = t.z, r[6] = e.x, r[7] = e.y, r[8] = t.z, r[9] = t.x, r[10] = e.y, r[11] = t.z, r[12] = t.x, r[13] = t.y, r[14] = e.z, r[15] = e.x, r[16] = t.y, r[17] = e.z, r[18] = e.x, r[19] = e.y, r[20] = e.z, r[21] = t.x, r[22] = e.y, r[23] = e.z, n.needsUpdate = !0, this.geometry.computeBoundingSphere();
}
setFromObject(e) {
return this.object = e, this.update(), this;
}
copy(e, t) {
return super.copy(e, t), this.object = e.object, this;
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
}, bf = class extends Vo {
constructor(e, t = 16776960) {
let n = 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
], i = new J();
i.setIndex(new W(n, 1)), i.setAttribute("position", new G(r, 3)), super(i, new ko({
color: t,
toneMapped: !1
})), this.box = e, this.type = "Box3Helper", this.geometry.computeBoundingSphere();
}
updateMatrixWorld(e) {
let t = this.box;
t.isEmpty() || (t.getCenter(this.position), t.getSize(this.scale), this.scale.multiplyScalar(.5), super.updateMatrixWorld(e));
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
}, xf = class extends Lo {
constructor(e, t = 1, n = 16776960) {
let r = n, i = [
1,
-1,
0,
-1,
1,
0,
-1,
-1,
0,
1,
1,
0,
-1,
1,
0,
-1,
-1,
0,
1,
-1,
0,
1,
1,
0
], a = new J();
a.setAttribute("position", new G(i, 3)), a.computeBoundingSphere(), super(a, new ko({
color: r,
toneMapped: !1
})), this.type = "PlaneHelper", this.plane = e, this.size = t;
let o = [
1,
1,
0,
-1,
1,
0,
-1,
-1,
0,
1,
1,
0,
-1,
-1,
0,
1,
-1,
0
], s = new J();
s.setAttribute("position", new G(o, 3)), s.computeBoundingSphere(), this.add(new Ea(s, new ma({
color: r,
opacity: .2,
transparent: !0,
depthWrite: !1,
toneMapped: !1
})));
}
updateMatrixWorld(e) {
this.position.set(0, 0, 0), this.scale.set(.5 * this.size, .5 * this.size, 1), this.lookAt(this.plane.normal), this.translateZ(-this.plane.constant), super.updateMatrixWorld(e);
}
dispose() {
this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
}
}, Sf = /*@__PURE__*/ new I(), Cf, wf, Tf = class extends z {
constructor(e = new I(0, 0, 1), t = new I(0, 0, 0), n = 1, r = 16776960, i = n * .2, a = i * .2) {
super(), this.type = "ArrowHelper", Cf === void 0 && (Cf = new J(), Cf.setAttribute("position", new G([
0,
0,
0,
0,
1,
0
], 3)), wf = new fs(.5, 1, 5, 1), wf.translate(0, -.5, 0)), this.position.copy(t), this.line = new Lo(Cf, new ko({
color: r,
toneMapped: !1
})), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new Ea(wf, new ma({
color: r,
toneMapped: !1
})), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(n, i, a);
}
setDirection(e) {
if (e.y > .99999) this.quaternion.set(0, 0, 0, 1);
else if (e.y < -.99999) this.quaternion.set(1, 0, 0, 0);
else {
Sf.set(e.z, 0, -e.x).normalize();
let t = Math.acos(e.y);
this.quaternion.setFromAxisAngle(Sf, t);
}
}
setLength(e, t = e * .2, n = t * .2) {
this.line.scale.set(1, Math.max(1e-4, e - t), 1), this.line.updateMatrix(), this.cone.scale.set(n, t, n), 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;
}
dispose() {
this.line.geometry.dispose(), this.line.material.dispose(), this.cone.geometry.dispose(), this.cone.material.dispose();
}
}, Ef = class extends Vo {
constructor(e = 1) {
let t = [
0,
0,
0,
e,
0,
0,
0,
0,
0,
0,
e,
0,
0,
0,
0,
0,
0,
e
], n = [
1,
0,
0,
1,
.6,
0,
0,
1,
0,
.6,
1,
0,
0,
0,
1,
0,
.6,
1
], r = new J();
r.setAttribute("position", new G(t, 3)), r.setAttribute("color", new G(n, 3));
let i = new ko({
vertexColors: !0,
toneMapped: !1
});
super(r, i), this.type = "AxesHelper";
}
setColors(e, t, n) {
let r = new B(), i = this.geometry.attributes.color.array;
return r.set(e), r.toArray(i, 0), r.toArray(i, 3), r.set(t), r.toArray(i, 6), r.toArray(i, 9), r.set(n), r.toArray(i, 12), r.toArray(i, 15), this.geometry.attributes.color.needsUpdate = !0, this;
}
dispose() {
this.geometry.dispose(), this.material.dispose();
}
}, Df = class {
constructor() {
this.type = "ShapePath", this.color = new B(), this.subPaths = [], this.currentPath = null, this.userData = {};
}
moveTo(e, t) {
return this.currentPath = new Ys(), this.subPaths.push(this.currentPath), this.currentPath.moveTo(e, t), this;
}
lineTo(e, t) {
return this.currentPath.lineTo(e, t), this;
}
quadraticCurveTo(e, t, n, r) {
return this.currentPath.quadraticCurveTo(e, t, n, r), this;
}
bezierCurveTo(e, t, n, r, i, a) {
return this.currentPath.bezierCurveTo(e, t, n, r, i, a), this;
}
splineThru(e) {
return this.currentPath.splineThru(e), this;
}
toShapes() {
function e(e, t) {
let n = !1, r = t.length;
for (let i = 0, a = r - 1; i < r; a = i++) {
let r = t[i], o = t[a];
r.y > e.y != o.y > e.y && e.x < (o.x - r.x) * (e.y - r.y) / (o.y - r.y) + r.x && (n = !n);
}
return n;
}
function t(t, n) {
let r = n.getCenter(new F());
if (e(r, t)) return r;
let i = r.y, a = [], o = t.length;
for (let e = 0; e < o; e++) {
let n = t[e], r = t[(e + 1) % o];
if (n.y > i != r.y > i) {
let e = n.x + (i - n.y) * (r.x - n.x) / (r.y - n.y);
a.push(e);
}
}
return a.length > 1 && (a.sort((e, t) => e - t), r.x = (a[0] + a[1]) / 2), r;
}
let n = this.userData.style && this.userData.style.fillRule || "nonzero";
n !== "nonzero" && n !== "evenodd" && (j("Fill-rule \"" + n + "\" is not supported, falling back to \"nonzero\"."), n = "nonzero");
let r = n === "nonzero" ? ((e) => e !== 0) : ((e) => (e & 1) != 0), i = [];
for (let e of this.subPaths) {
let n = e.getPoints();
if (n.length < 3) continue;
let r = Ac.area(n);
if (r === 0) continue;
let a = new Hd();
for (let e = 0; e < n.length; e++) a.expandByPoint(n[e]);
i.push({
subPath: e,
points: n,
boundingBox: a,
interiorPoint: t(n, a),
absArea: Math.abs(r),
winding: r < 0 ? -1 : 1,
container: null,
exclude: !1,
role: null
});
}
i.sort((e, t) => t.absArea - e.absArea);
for (let t = 0; t < i.length; t++) {
let n = i[t], a = 0;
for (let r = t - 1; r >= 0; r--) {
let t = i[r];
if (t.boundingBox.containsBox(n.boundingBox) && e(n.interiorPoint, t.points)) {
n.container = t.exclude ? t.container : t, a = t.winding, n.winding += a;
break;
}
}
r(n.winding) === r(a) && (n.exclude = !0);
}
for (let e of i) e.exclude || (e.role = e.container === null || e.container.role === "hole" ? "outer" : "hole");
let a = [], o = /* @__PURE__ */ new Map();
for (let e of i) {
if (e.exclude || e.role !== "outer") continue;
let t = new Xs();
t.curves = e.subPath.curves, a.push(t), o.set(e, t);
}
for (let e of i) {
if (e.exclude || e.role !== "hole") continue;
let t = o.get(e.container);
if (!t) continue;
let n = new Ys();
n.curves = e.subPath.curves, t.holes.push(n);
}
return a;
}
}, Of = class extends on {
constructor(e, t = null) {
super(), this.object = e, this.domElement = t, this.enabled = !0, this.state = -1, this.keys = {}, this.mouseButtons = {
LEFT: null,
MIDDLE: null,
RIGHT: null
}, this.touches = {
ONE: null,
TWO: null
};
}
connect(e) {
if (e === void 0) {
j("Controls: connect() now requires an element.");
return;
}
this.domElement !== null && this.disconnect(), this.domElement = e;
}
disconnect() {}
dispose() {}
update() {}
};
function kf(e, t) {
let n = e.image && e.image.width ? e.image.width / e.image.height : 1;
return n > t ? (e.repeat.x = 1, e.repeat.y = n / t, e.offset.x = 0, e.offset.y = (1 - e.repeat.y) / 2) : (e.repeat.x = t / n, e.repeat.y = 1, e.offset.x = (1 - e.repeat.x) / 2, e.offset.y = 0), e;
}
function Af(e, t) {
let n = e.image && e.image.width ? e.image.width / e.image.height : 1;
return n > t ? (e.repeat.x = t / n, e.repeat.y = 1, e.offset.x = (1 - e.repeat.x) / 2, e.offset.y = 0) : (e.repeat.x = 1, e.repeat.y = n / t, e.offset.x = 0, e.offset.y = (1 - e.repeat.y) / 2), e;
}
function jf(e) {
return e.repeat.x = 1, e.repeat.y = 1, e.offset.x = 0, e.offset.y = 0, e;
}
function Mf(e, t, n, r) {
let i = Nf(r);
switch (n) {
case ce: return e * t;
case pe: return e * t / i.components * i.byteLength;
case me: return e * t / i.components * i.byteLength;
case he: return e * t * 2 / i.components * i.byteLength;
case ge: return e * t * 2 / i.components * i.byteLength;
case le: return e * t * 3 / i.components * i.byteLength;
case ue: return e * t * 4 / i.components * i.byteLength;
case ve: return e * t * 4 / i.components * i.byteLength;
case ye:
case be: return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 8;
case xe:
case Se: return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 16;
case we:
case Ee: return Math.max(e, 16) * Math.max(t, 8) / 4;
case Ce:
case Te: return Math.max(e, 8) * Math.max(t, 8) / 2;
case De:
case Oe:
case Ae:
case je: return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 8;
case ke:
case Me:
case Ne: return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 16;
case Pe: return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 16;
case Fe: return Math.floor((e + 4) / 5) * Math.floor((t + 3) / 4) * 16;
case Ie: return Math.floor((e + 4) / 5) * Math.floor((t + 4) / 5) * 16;
case Le: return Math.floor((e + 5) / 6) * Math.floor((t + 4) / 5) * 16;
case Re: return Math.floor((e + 5) / 6) * Math.floor((t + 5) / 6) * 16;
case ze: return Math.floor((e + 7) / 8) * Math.floor((t + 4) / 5) * 16;
case Be: return Math.floor((e + 7) / 8) * Math.floor((t + 5) / 6) * 16;
case Ve: return Math.floor((e + 7) / 8) * Math.floor((t + 7) / 8) * 16;
case He: return Math.floor((e + 9) / 10) * Math.floor((t + 4) / 5) * 16;
case Ue: return Math.floor((e + 9) / 10) * Math.floor((t + 5) / 6) * 16;
case We: return Math.floor((e + 9) / 10) * Math.floor((t + 7) / 8) * 16;
case Ge: return Math.floor((e + 9) / 10) * Math.floor((t + 9) / 10) * 16;
case Ke: return Math.floor((e + 11) / 12) * Math.floor((t + 9) / 10) * 16;
case qe: return Math.floor((e + 11) / 12) * Math.floor((t + 11) / 12) * 16;
case Je:
case Ye:
case Xe: return Math.ceil(e / 4) * Math.ceil(t / 4) * 16;
case Ze:
case Qe: return Math.ceil(e / 4) * Math.ceil(t / 4) * 8;
case $e:
case et: return Math.ceil(e / 4) * Math.ceil(t / 4) * 16;
}
throw Error(`Unable to determine texture byte length for ${n} format.`);
}
function Nf(e) {
switch (e) {
case E:
case D: return {
byteLength: 1,
components: 1
};
case k:
case O:
case ne: return {
byteLength: 2,
components: 1
};
case re:
case ie: return {
byteLength: 2,
components: 4
};
case ee:
case A:
case te: return {
byteLength: 4,
components: 1
};
case oe:
case se: return {
byteLength: 4,
components: 3
};
}
throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`);
}
var Pf = class {
static contain(e, t) {
return kf(e, t);
}
static cover(e, t) {
return Af(e, t);
}
static fill(e) {
return jf(e);
}
static getByteLength(e, t, n, r) {
return Mf(e, t, n, r);
}
};
typeof __THREE_DEVTOOLS__ < "u" && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", { detail: { revision: "185" } })), typeof window < "u" && (window.__THREE__ ? j("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = "185");
//#endregion
export { Ju as $, F as $a, ol as $i, Ou as $n, ve as $r, Ru as $t, W as A, tu as Aa, ye as Ai, Xd as An, zc as Ar, xs as At, us as B, xi as Ba, Zn as Bi, C as Bn, dd as Br, Ir as Bt, za as C, It as Ca, _e as Ci, Al as Cn, $c as Co, z as Cr, hf as Ct, bf as D, u as Da, Oe as Di, nu as Dn, nn as Do, Ys as Dr, kt as Dt, H as E, Il as Ea, De as Ei, pr as En, j as Eo, bu as Er, Ft as Et, du as F, Kc as Fa, pa as Fi, Ho as Fn, Uo as Fr, Jl as Ft, Bn as G, E as Ga, Bc as Gi, Gl as Gn, Pl as Gr, Lt as Gt, Ld as H, Od as Ha, p as Hi, S as Hn, Gs as Hr, oo as Ht, _f as I, Qr as Ia, Pd as Ii, Vo as In, df as Ir, Di as It, ts as J, oe as Ja, Qe as Ji, tt as Jn, $e as Jr, is as Jt, Ut as K, se as Ka, je as Ki, ku as Kn, Ae as Kr, uf as Kt, rs as L, qc as La, wu as Li, x as Ln, ps as Lr, G as Lt, ju as M, Xu as Ma, he as Mi, Hs as Mn, yu as Mr, on as Mt, D as N, Bt as Na, ge as Ni, Us as Nn, af as Nr, ss as Nt, cs as O, Wc as Oa, we as Oi, Eu as On, hu as Or, Mt as Ot, Vl as P, Gc as Pa, sl as Pi, _l as Pn, Jo as Pr, Nc as Pt, Of as Q, k as Qa, Rr as Qi, Y as Qn, ue as Qr, Ic as Qt, ls as R, wi as Ra, pe as Ri, Dl as Rn, ld as Rr, te as Rt, kl as S, Gu as Sa, le as Si, xt as Sn, en as So, Nl as Sr, Su as St, Hd as T, Nt as Ta, Xe as Ti, Lc as Tn, Qt as To, Rc as Tr, ms as Tt, B as U, Ad as Ua, St as Ui, vt as Un, Mn as Ur, co as Ut, m as V, Si as Va, Dd as Vi, w as Vn, Ws as Vr, Qo as Vt, Ml as W, rl as Wa, an as Wi, yt as Wn, Fl as Wr, Md as Wt, Xl as X, re as Xa, _t as Xi, nt as Xn, Me as Xr, ru as Xt, $o as Y, ee as Ya, Ne as Yi, rt as Yn, Ze as Yr, ne as Yt, fs as Z, ie as Za, bt as Zi, l as Zn, mt as Zr, lf as Zt, rd as _, ta as _a, Te as _i, at as _n, Jt as _o, b as _r, Wl as _t, Rl as a, O as aa, qe as ai, Au as an, nr as ao, ma as ar, El as at, pt as b, Ot as ba, Se as bi, Vt as bn, $t as bo, _ as br, as as bt, Cd as c, Ra as ca, Ie as ci, Ci as cn, Qn as co, pl as cr, ds as ct, Yu as d, Uc as da, ze as di, A as dn, Jc as do, ul as dr, $n as dt, Zc as ea, Ge as ei, Ql as en, I as eo, jn as er, os as et, Tf as f, Rd as fa, Be as fi, Li as fn, ut as fo, ll as fr, Ba as ft, Bu as g, Qd as ga, Ee as gi, it as gn, Yt as go, g as gr, Et as gt, ud as h, _u as ha, ke as hi, st as hn, Qc as ho, h as hr, wt as ht, wd as i, Ac as ia, Ke as ii, Wa as in, Xo as io, Ea as ir, Vs as it, J as j, Pf as ja, gt as ji, ko as jn, xf as jr, fr as jt, yf as k, L as ka, Ce as ki, Lo as kn, no as kr, ys as kt, wl as l, Kn as la, Le as li, Ti as ln, zt as lo, gl as lr, zd as lt, id as m, Ks as ma, Je as mi, Tl as mn, lt as mo, dl as mr, _i as mt, ce as n, Vc as na, Ue as ni, Ct as nn, Ll as no, Fn as nr, $l as nt, Yl as o, Ua as oa, Pe as oi, jd as on, er as oo, ml as or, bs as ot, d as p, Tu as pa, Ve as pi, zi as pn, ct as po, cl as pr, eu as pt, es as q, ae as qa, et as qi, Ul as qn, un as qr, kr as qt, Cu as r, Df as ra, We as ri, Tt as rn, Zo as ro, R as rr, Bs as rt, Ed as s, nf as sa, Fe as si, Qa as sn, Rt as so, hl as sr, Js as st, ft as t, Xs as ta, He as ti, Wn as tn, Xn as to, Bd as tr, ns as tt, Ss as u, K as ua, Re as ui, bi as un, jr as uo, fl as ur, tr as ut, Vu as v, Vi as va, be as vi, ot as vn, M as vo, v as vr, de as vt, jl as w, At as wa, Ye as wi, aa as wn, rn as wo, Nu as wr, Ol as wt, Oo as x, jt as xa, ht as xi, Dt as xn, nl as xo, dt as xr, f as xt, Ef as y, Pt as ya, xe as yi, Ht as yn, Mf as yo, y as yr, fe as yt, ks as z, Ei as za, me as zi, T as zn, Z as zr, Lr as zt };