UNPKG

mediaquad-three-component

Version:

This component is built on the [Three.js](https://threejs.org) library.

1,398 lines 1.33 MB
import { defineComponent as ip, ref as ps, watch as Ua, onMounted as sp, onUnmounted as rp, openBlock as ap, createElementBlock as op } from "vue"; /** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT */ const ql = "172", vr = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, pr = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, cp = 0, Nh = 1, lp = 2, Xl = 1, hp = 2, Ri = 3, pi = 0, Cn = 1, Wn = 2, ts = 0, Ir = 1, Uh = 2, kh = 3, Oh = 4, up = 5, Cs = 100, dp = 101, fp = 102, pp = 103, Ap = 104, gp = 200, mp = 201, bp = 202, _p = 203, rl = 204, al = 205, yp = 206, xp = 207, Ep = 208, vp = 209, Ip = 210, Cp = 211, Sp = 212, wp = 213, Mp = 214, ol = 0, cl = 1, ll = 2, Br = 3, hl = 4, ul = 5, dl = 6, fl = 7, Qo = 0, Tp = 1, Rd = 2, ns = 0, Bp = 1, Rp = 2, Fp = 3, Dp = 4, Lp = 5, Fd = 6, Pp = 7, Qh = "attached", Np = "detached", Yl = 300, is = 301, Ts = 302, Rr = 303, ga = 304, Ta = 306, dn = 1e3, $t = 1001, ss = 1002, vn = 1003, Kl = 1004, Ar = 1005, Gt = 1006, oa = 1007, Bn = 1008, xn = 1009, Dd = 1010, Ld = 1011, ma = 1012, jl = 1013, rs = 1014, ln = 1015, Un = 1016, Jl = 1017, Zl = 1018, Fr = 1020, Pd = 35902, Nd = 1021, Ud = 1022, nn = 1023, kd = 1024, Od = 1025, Cr = 1026, Dr = 1027, Pi = 1028, Go = 1029, ws = 1030, $l = 1031, eh = 1033, ca = 33776, la = 33777, ha = 33778, Sr = 33779, To = 35840, pl = 35841, Bo = 35842, Al = 35843, ba = 36196, Ro = 37492, Fo = 37496, _a = 37808, gl = 37809, ml = 37810, bl = 37811, ya = 37812, _l = 37813, yl = 37814, xl = 37815, El = 37816, vl = 37817, Il = 37818, Cl = 37819, Sl = 37820, wl = 37821, ua = 36492, Do = 36494, xa = 36495, Qd = 36283, Ml = 36284, Tl = 36285, Bl = 36286, Up = 2200, kp = 2201, Op = 2202, Ea = 2300, va = 2301, Jo = 2302, gr = 2400, mr = 2401, Lo = 2402, th = 2500, Qp = 2501, Gp = 0, Gd = 1, Rl = 2, Hp = 3200, zp = 3201, Us = 0, Vp = 1, ui = "", pt = "srgb", mn = "srgb-linear", Po = "linear", Vt = "srgb", qs = 7680, Gh = 519, Wp = 512, qp = 513, Xp = 514, Hd = 515, Yp = 516, Kp = 517, jp = 518, Jp = 519, Fl = 35044, Hh = "300 es", Ni = 2e3, No = 2001; class os { addEventListener(e, t) { this._listeners === void 0 && (this._listeners = {}); const n = this._listeners; n[e] === void 0 && (n[e] = []), n[e].indexOf(t) === -1 && n[e].push(t); } hasEventListener(e, t) { if (this._listeners === void 0) return !1; const n = this._listeners; return n[e] !== void 0 && n[e].indexOf(t) !== -1; } removeEventListener(e, t) { if (this._listeners === void 0) return; const i = this._listeners[e]; if (i !== void 0) { const s = i.indexOf(t); s !== -1 && i.splice(s, 1); } } dispatchEvent(e) { if (this._listeners === void 0) return; const n = this._listeners[e.type]; if (n !== void 0) { e.target = this; const i = n.slice(0); for (let s = 0, r = i.length; s < r; s++) i[s].call(this, e); e.target = null; } } } const wn = ["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"]; let zh = 1234567; const wr = Math.PI / 180, Lr = 180 / Math.PI; function ii() { const a = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0; return (wn[a & 255] + wn[a >> 8 & 255] + wn[a >> 16 & 255] + wn[a >> 24 & 255] + "-" + wn[e & 255] + wn[e >> 8 & 255] + "-" + wn[e >> 16 & 15 | 64] + wn[e >> 24 & 255] + "-" + wn[t & 63 | 128] + wn[t >> 8 & 255] + "-" + wn[t >> 16 & 255] + wn[t >> 24 & 255] + wn[n & 255] + wn[n >> 8 & 255] + wn[n >> 16 & 255] + wn[n >> 24 & 255]).toLowerCase(); } function wt(a, e, t) { return Math.max(e, Math.min(t, a)); } function nh(a, e) { return (a % e + e) % e; } function Zp(a, e, t, n, i) { return n + (a - e) * (i - n) / (t - e); } function $p(a, e, t) { return a !== e ? (t - a) / (e - a) : 0; } function da(a, e, t) { return (1 - t) * a + t * e; } function eA(a, e, t, n) { return da(a, e, 1 - Math.exp(-t * n)); } function tA(a, e = 1) { return e - Math.abs(nh(a, e * 2) - e); } function nA(a, e, t) { return a <= e ? 0 : a >= t ? 1 : (a = (a - e) / (t - e), a * a * (3 - 2 * a)); } function iA(a, e, t) { return a <= e ? 0 : a >= t ? 1 : (a = (a - e) / (t - e), a * a * a * (a * (a * 6 - 15) + 10)); } function sA(a, e) { return a + Math.floor(Math.random() * (e - a + 1)); } function rA(a, e) { return a + Math.random() * (e - a); } function aA(a) { return a * (0.5 - Math.random()); } function oA(a) { a !== void 0 && (zh = a); let e = zh += 1831565813; return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296; } function cA(a) { return a * wr; } function lA(a) { return a * Lr; } function hA(a) { return (a & a - 1) === 0 && a !== 0; } function uA(a) { return Math.pow(2, Math.ceil(Math.log(a) / Math.LN2)); } function dA(a) { return Math.pow(2, Math.floor(Math.log(a) / Math.LN2)); } function fA(a, e, t, n, i) { const s = Math.cos, r = Math.sin, o = s(t / 2), c = r(t / 2), l = s((e + n) / 2), h = r((e + n) / 2), u = s((e - n) / 2), d = r((e - n) / 2), f = s((n - e) / 2), A = r((n - e) / 2); switch (i) { case "XYX": a.set(o * h, c * u, c * d, o * l); break; case "YZY": a.set(c * d, o * h, c * u, o * l); break; case "ZXZ": a.set(c * u, c * d, o * h, o * l); break; case "XZX": a.set(o * h, c * A, c * f, o * l); break; case "YXY": a.set(c * f, o * h, c * A, o * l); break; case "ZYZ": a.set(c * A, c * f, o * h, o * l); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i); } } function di(a, e) { switch (e.constructor) { case Float32Array: return a; case Uint32Array: return a / 4294967295; case Uint16Array: return a / 65535; case Uint8Array: return a / 255; case Int32Array: return Math.max(a / 2147483647, -1); case Int16Array: return Math.max(a / 32767, -1); case Int8Array: return Math.max(a / 127, -1); default: throw new Error("Invalid component type."); } } function zt(a, e) { switch (e.constructor) { case Float32Array: return a; case Uint32Array: return Math.round(a * 4294967295); case Uint16Array: return Math.round(a * 65535); case Uint8Array: return Math.round(a * 255); case Int32Array: return Math.round(a * 2147483647); case Int16Array: return Math.round(a * 32767); case Int8Array: return Math.round(a * 127); default: throw new Error("Invalid component type."); } } const rn = { DEG2RAD: wr, RAD2DEG: Lr, generateUUID: ii, clamp: wt, euclideanModulo: nh, mapLinear: Zp, inverseLerp: $p, lerp: da, damp: eA, pingpong: tA, smoothstep: nA, smootherstep: iA, randInt: sA, randFloat: rA, randFloatSpread: aA, seededRandom: oA, degToRad: cA, radToDeg: lA, isPowerOfTwo: hA, ceilPowerOfTwo: uA, floorPowerOfTwo: dA, setQuaternionFromProperEuler: fA, normalize: zt, denormalize: di }; class we { constructor(e = 0, t = 0) { we.prototype.isVector2 = !0, this.x = e, this.y = t; } get width() { return this.x; } set width(e) { this.x = e; } get height() { return this.y; } set height(e) { this.y = e; } set(e, t) { return this.x = e, this.y = t, this; } setScalar(e) { return this.x = e, this.y = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y); } copy(e) { return this.x = e.x, this.y = e.y, this; } add(e) { 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) { const t = this.x, n = this.y, i = e.elements; return this.x = i[0] * t + i[3] * n + i[6], this.y = i[1] * t + i[4] * n + i[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 = wt(this.x, e.x, t.x), this.y = wt(this.y, e.y, t.y), this; } clampScalar(e, t) { return this.x = wt(this.x, e, t), this.y = wt(this.y, e, t), this; } clampLength(e, t) { const n = this.length(); return this.divideScalar(n || 1).multiplyScalar(wt(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) { const t = Math.sqrt(this.lengthSq() * e.lengthSq()); if (t === 0) return Math.PI / 2; const n = this.dot(e) / t; return Math.acos(wt(n, -1, 1)); } distanceTo(e) { return Math.sqrt(this.distanceToSquared(e)); } distanceToSquared(e) { const 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) { const n = Math.cos(t), i = Math.sin(t), s = this.x - e.x, r = this.y - e.y; return this.x = s * n - r * i + e.x, this.y = s * i + r * n + e.y, this; } random() { return this.x = Math.random(), this.y = Math.random(), this; } *[Symbol.iterator]() { yield this.x, yield this.y; } } class St { constructor(e, t, n, i, s, r, o, c, l) { St.prototype.isMatrix3 = !0, this.elements = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ], e !== void 0 && this.set(e, t, n, i, s, r, o, c, l); } set(e, t, n, i, s, r, o, c, l) { const h = this.elements; return h[0] = e, h[1] = i, h[2] = o, h[3] = t, h[4] = s, h[5] = c, h[6] = n, h[7] = r, h[8] = l, this; } identity() { return this.set( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), this; } copy(e) { const 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) { const t = e.elements; return this.set( t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10] ), this; } multiply(e) { return this.multiplyMatrices(this, e); } premultiply(e) { return this.multiplyMatrices(e, this); } multiplyMatrices(e, t) { const n = e.elements, i = t.elements, s = this.elements, r = n[0], o = n[3], c = n[6], l = n[1], h = n[4], u = n[7], d = n[2], f = n[5], A = n[8], m = i[0], g = i[3], p = i[6], _ = i[1], b = i[4], y = i[7], B = i[2], S = i[5], R = i[8]; return s[0] = r * m + o * _ + c * B, s[3] = r * g + o * b + c * S, s[6] = r * p + o * y + c * R, s[1] = l * m + h * _ + u * B, s[4] = l * g + h * b + u * S, s[7] = l * p + h * y + u * R, s[2] = d * m + f * _ + A * B, s[5] = d * g + f * b + A * S, s[8] = d * p + f * y + A * R, this; } multiplyScalar(e) { const t = this.elements; return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this; } determinant() { const e = this.elements, t = e[0], n = e[1], i = e[2], s = e[3], r = e[4], o = e[5], c = e[6], l = e[7], h = e[8]; return t * r * h - t * o * l - n * s * h + n * o * c + i * s * l - i * r * c; } invert() { const e = this.elements, t = e[0], n = e[1], i = e[2], s = e[3], r = e[4], o = e[5], c = e[6], l = e[7], h = e[8], u = h * r - o * l, d = o * c - h * s, f = l * s - r * c, A = t * u + n * d + i * f; if (A === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const m = 1 / A; return e[0] = u * m, e[1] = (i * l - h * n) * m, e[2] = (o * n - i * r) * m, e[3] = d * m, e[4] = (h * t - i * c) * m, e[5] = (i * s - o * t) * m, e[6] = f * m, e[7] = (n * c - l * t) * m, e[8] = (r * t - n * s) * m, this; } transpose() { let e; const t = this.elements; return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this; } getNormalMatrix(e) { return this.setFromMatrix4(e).invert().transpose(); } transposeIntoArray(e) { const t = this.elements; return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this; } setUvTransform(e, t, n, i, s, r, o) { const c = Math.cos(s), l = Math.sin(s); return this.set( n * c, n * l, -n * (c * r + l * o) + r + e, -i * l, i * c, -i * (-l * r + c * o) + o + t, 0, 0, 1 ), this; } // scale(e, t) { return this.premultiply(Zo.makeScale(e, t)), this; } rotate(e) { return this.premultiply(Zo.makeRotation(-e)), this; } translate(e, t) { return this.premultiply(Zo.makeTranslation(e, t)), this; } // for 2D Transforms 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) { const 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) { const t = this.elements, n = e.elements; for (let i = 0; i < 9; i++) if (t[i] !== n[i]) 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) { const 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); } } const Zo = /* @__PURE__ */ new St(); function zd(a) { for (let e = a.length - 1; e >= 0; --e) if (a[e] >= 65535) return !0; return !1; } const pA = { Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array }; function br(a, e) { return new pA[a](e); } function Ia(a) { return document.createElementNS("http://www.w3.org/1999/xhtml", a); } function AA() { const a = Ia("canvas"); return a.style.display = "block", a; } const Vh = {}; function fr(a) { a in Vh || (Vh[a] = !0, console.warn(a)); } function gA(a, e, t) { return new Promise(function(n, i) { function s() { switch (a.clientWaitSync(e, a.SYNC_FLUSH_COMMANDS_BIT, 0)) { case a.WAIT_FAILED: i(); break; case a.TIMEOUT_EXPIRED: setTimeout(s, t); break; default: n(); } } setTimeout(s, t); }); } function mA(a) { const e = a.elements; e[2] = 0.5 * e[2] + 0.5 * e[3], e[6] = 0.5 * e[6] + 0.5 * e[7], e[10] = 0.5 * e[10] + 0.5 * e[11], e[14] = 0.5 * e[14] + 0.5 * e[15]; } function bA(a) { const e = a.elements; e[11] === -1 ? (e[10] = -e[10] - 1, e[14] = -e[14]) : (e[10] = -e[10], e[14] = -e[14] + 1); } const Wh = /* @__PURE__ */ new St().set( 0.4123908, 0.3575843, 0.1804808, 0.212639, 0.7151687, 0.0721923, 0.0193308, 0.1191948, 0.9505322 ), qh = /* @__PURE__ */ new St().set( 3.2409699, -1.5373832, -0.4986108, -0.9692436, 1.8759675, 0.0415551, 0.0556301, -0.203977, 1.0569715 ); function _A() { const a = { enabled: !0, workingColorSpace: mn, /** * Implementations of supported color spaces. * * Required: * - primaries: chromaticity coordinates [ rx ry gx gy bx by ] * - whitePoint: reference white [ x y ] * - transfer: transfer function (pre-defined) * - toXYZ: Matrix3 RGB to XYZ transform * - fromXYZ: Matrix3 XYZ to RGB transform * - luminanceCoefficients: RGB luminance coefficients * * Optional: * - outputColorSpaceConfig: { drawingBufferColorSpace: ColorSpace } * - workingColorSpaceConfig: { unpackColorSpace: ColorSpace } * * Reference: * - https://www.russellcottrell.com/photo/matrixCalculator.htm */ spaces: {}, convert: function(i, s, r) { return this.enabled === !1 || s === r || !s || !r || (this.spaces[s].transfer === Vt && (i.r = Ui(i.r), i.g = Ui(i.g), i.b = Ui(i.b)), this.spaces[s].primaries !== this.spaces[r].primaries && (i.applyMatrix3(this.spaces[s].toXYZ), i.applyMatrix3(this.spaces[r].fromXYZ)), this.spaces[r].transfer === Vt && (i.r = Mr(i.r), i.g = Mr(i.g), i.b = Mr(i.b))), i; }, fromWorkingColorSpace: function(i, s) { return this.convert(i, this.workingColorSpace, s); }, toWorkingColorSpace: function(i, s) { return this.convert(i, s, this.workingColorSpace); }, getPrimaries: function(i) { return this.spaces[i].primaries; }, getTransfer: function(i) { return i === ui ? Po : this.spaces[i].transfer; }, getLuminanceCoefficients: function(i, s = this.workingColorSpace) { return i.fromArray(this.spaces[s].luminanceCoefficients); }, define: function(i) { Object.assign(this.spaces, i); }, // Internal APIs _getMatrix: function(i, s, r) { return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[r].fromXYZ); }, _getDrawingBufferColorSpace: function(i) { return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace; }, _getUnpackColorSpace: function(i = this.workingColorSpace) { return this.spaces[i].workingColorSpaceConfig.unpackColorSpace; } }, e = [0.64, 0.33, 0.3, 0.6, 0.15, 0.06], t = [0.2126, 0.7152, 0.0722], n = [0.3127, 0.329]; return a.define({ [mn]: { primaries: e, whitePoint: n, transfer: Po, toXYZ: Wh, fromXYZ: qh, luminanceCoefficients: t, workingColorSpaceConfig: { unpackColorSpace: pt }, outputColorSpaceConfig: { drawingBufferColorSpace: pt } }, [pt]: { primaries: e, whitePoint: n, transfer: Vt, toXYZ: Wh, fromXYZ: qh, luminanceCoefficients: t, outputColorSpaceConfig: { drawingBufferColorSpace: pt } } }), a; } const mt = /* @__PURE__ */ _A(); function Ui(a) { return a < 0.04045 ? a * 0.0773993808 : Math.pow(a * 0.9478672986 + 0.0521327014, 2.4); } function Mr(a) { return a < 31308e-7 ? a * 12.92 : 1.055 * Math.pow(a, 0.41666) - 0.055; } let Xs; class yA { static getDataURL(e) { if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; let t; if (e instanceof HTMLCanvasElement) t = e; else { Xs === void 0 && (Xs = Ia("canvas")), Xs.width = e.width, Xs.height = e.height; const n = Xs.getContext("2d"); e instanceof ImageData ? n.putImageData(e, 0, 0) : n.drawImage(e, 0, 0, e.width, e.height), t = Xs; } return t.width > 2048 || t.height > 2048 ? (console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons", e), t.toDataURL("image/jpeg", 0.6)) : t.toDataURL("image/png"); } static sRGBToLinear(e) { if (typeof HTMLImageElement < "u" && e instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && e instanceof ImageBitmap) { const t = Ia("canvas"); t.width = e.width, t.height = e.height; const n = t.getContext("2d"); n.drawImage(e, 0, 0, e.width, e.height); const i = n.getImageData(0, 0, e.width, e.height), s = i.data; for (let r = 0; r < s.length; r++) s[r] = Ui(s[r] / 255) * 255; return n.putImageData(i, 0, 0), t; } else if (e.data) { const t = e.data.slice(0); for (let n = 0; n < t.length; n++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[n] = Math.floor(Ui(t[n] / 255) * 255) : t[n] = Ui(t[n]); return { data: t, width: e.width, height: e.height }; } else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e; } } let xA = 0; class _r { constructor(e = null) { this.isSource = !0, Object.defineProperty(this, "id", { value: xA++ }), this.uuid = ii(), this.data = e, this.dataReady = !0, this.version = 0; } set needsUpdate(e) { e === !0 && this.version++; } toJSON(e) { const t = e === void 0 || typeof e == "string"; if (!t && e.images[this.uuid] !== void 0) return e.images[this.uuid]; const n = { uuid: this.uuid, url: "" }, i = this.data; if (i !== null) { let s; if (Array.isArray(i)) { s = []; for (let r = 0, o = i.length; r < o; r++) i[r].isDataTexture ? s.push($o(i[r].image)) : s.push($o(i[r])); } else s = $o(i); n.url = s; } return t || (e.images[this.uuid] = n), n; } } function $o(a) { return typeof HTMLImageElement < "u" && a instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && a instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && a instanceof ImageBitmap ? yA.getDataURL(a) : a.data ? { data: Array.from(a.data), width: a.width, height: a.height, type: a.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } let EA = 0; class on extends os { constructor(e = on.DEFAULT_IMAGE, t = on.DEFAULT_MAPPING, n = $t, i = $t, s = Gt, r = Bn, o = nn, c = xn, l = on.DEFAULT_ANISOTROPY, h = ui) { super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: EA++ }), this.uuid = ii(), this.name = "", this.source = new _r(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = i, this.magFilter = s, this.minFilter = r, this.anisotropy = l, this.format = o, this.internalFormat = null, this.type = c, this.offset = new we(0, 0), this.repeat = new we(1, 1), this.center = new we(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new St(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = h, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.pmremVersion = 0; } get image() { return this.source.data; } set image(e = null) { 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); } 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.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.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this; } toJSON(e) { const t = e === void 0 || typeof e == "string"; if (!t && e.textures[this.uuid] !== void 0) return e.textures[this.uuid]; const n = { metadata: { version: 4.6, 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, 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 !== Yl) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) { case dn: e.x = e.x - Math.floor(e.x); break; case $t: e.x = e.x < 0 ? 0 : 1; break; case ss: Math.abs(Math.floor(e.x) % 2) === 1 ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x); break; } if (e.y < 0 || e.y > 1) switch (this.wrapT) { case dn: e.y = e.y - Math.floor(e.y); break; case $t: e.y = e.y < 0 ? 0 : 1; break; case ss: Math.abs(Math.floor(e.y) % 2) === 1 ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y); break; } return this.flipY && (e.y = 1 - e.y), e; } set needsUpdate(e) { e === !0 && (this.version++, this.source.needsUpdate = !0); } set needsPMREMUpdate(e) { e === !0 && this.pmremVersion++; } } on.DEFAULT_IMAGE = null; on.DEFAULT_MAPPING = Yl; on.DEFAULT_ANISOTROPY = 1; class Dt { constructor(e = 0, t = 0, n = 0, i = 1) { Dt.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = i; } 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, i) { return this.x = e, this.y = t, this.z = n, this.w = i, this; } setScalar(e) { return this.x = e, this.y = e, this.z = e, this.w = e, this; } setX(e) { return this.x = e, this; } setY(e) { return this.y = e, this; } setZ(e) { return this.z = e, this; } setW(e) { return this.w = e, this; } setComponent(e, t) { switch (e) { case 0: this.x = t; break; case 1: this.y = t; break; case 2: this.z = t; break; case 3: this.w = t; break; default: throw new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; case 3: return this.w; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z, this.w); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w !== void 0 ? e.w : 1, this; } add(e) { 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) { const t = this.x, n = this.y, i = this.z, s = this.w, r = e.elements; return this.x = r[0] * t + r[4] * n + r[8] * i + r[12] * s, this.y = r[1] * t + r[5] * n + r[9] * i + r[13] * s, this.z = r[2] * t + r[6] * n + r[10] * i + r[14] * s, this.w = r[3] * t + r[7] * n + r[11] * i + r[15] * s, 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); const t = Math.sqrt(1 - e.w * e.w); return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this; } setAxisAngleFromRotationMatrix(e) { let t, n, i, s; const c = e.elements, l = c[0], h = c[4], u = c[8], d = c[1], f = c[5], A = c[9], m = c[2], g = c[6], p = c[10]; if (Math.abs(h - d) < 0.01 && Math.abs(u - m) < 0.01 && Math.abs(A - g) < 0.01) { if (Math.abs(h + d) < 0.1 && Math.abs(u + m) < 0.1 && Math.abs(A + g) < 0.1 && Math.abs(l + f + p - 3) < 0.1) return this.set(1, 0, 0, 0), this; t = Math.PI; const b = (l + 1) / 2, y = (f + 1) / 2, B = (p + 1) / 2, S = (h + d) / 4, R = (u + m) / 4, D = (A + g) / 4; return b > y && b > B ? b < 0.01 ? (n = 0, i = 0.707106781, s = 0.707106781) : (n = Math.sqrt(b), i = S / n, s = R / n) : y > B ? y < 0.01 ? (n = 0.707106781, i = 0, s = 0.707106781) : (i = Math.sqrt(y), n = S / i, s = D / i) : B < 0.01 ? (n = 0.707106781, i = 0.707106781, s = 0) : (s = Math.sqrt(B), n = R / s, i = D / s), this.set(n, i, s, t), this; } let _ = Math.sqrt((g - A) * (g - A) + (u - m) * (u - m) + (d - h) * (d - h)); return Math.abs(_) < 1e-3 && (_ = 1), this.x = (g - A) / _, this.y = (u - m) / _, this.z = (d - h) / _, this.w = Math.acos((l + f + p - 1) / 2), this; } setFromMatrixPosition(e) { const 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 = wt(this.x, e.x, t.x), this.y = wt(this.y, e.y, t.y), this.z = wt(this.z, e.z, t.z), this.w = wt(this.w, e.w, t.w), this; } clampScalar(e, t) { return this.x = wt(this.x, e, t), this.y = wt(this.y, e, t), this.z = wt(this.z, e, t), this.w = wt(this.w, e, t), this; } clampLength(e, t) { const n = this.length(); return this.divideScalar(n || 1).multiplyScalar(wt(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; } *[Symbol.iterator]() { yield this.x, yield this.y, yield this.z, yield this.w; } } class vA extends os { constructor(e = 1, t = 1, n = {}) { super(), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = 1, this.scissor = new Dt(0, 0, e, t), this.scissorTest = !1, this.viewport = new Dt(0, 0, e, t); const i = { width: e, height: t, depth: 1 }; n = Object.assign({ generateMipmaps: !1, internalFormat: null, minFilter: Gt, depthBuffer: !0, stencilBuffer: !1, resolveDepthBuffer: !0, resolveStencilBuffer: !0, depthTexture: null, samples: 0, count: 1 }, n); const s = new on(i, n.mapping, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.colorSpace); s.flipY = !1, s.generateMipmaps = n.generateMipmaps, s.internalFormat = n.internalFormat, this.textures = []; const r = n.count; for (let o = 0; o < r; o++) this.textures[o] = s.clone(), this.textures[o].isRenderTargetTexture = !0, this.textures[o].renderTarget = this; 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; } 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 i = 0, s = this.textures.length; i < s; i++) this.textures[i].image.width = e, this.textures[i].image.height = t, this.textures[i].image.depth = n; 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 n = 0, i = e.textures.length; n < i; n++) this.textures[n] = e.textures[n].clone(), this.textures[n].isRenderTargetTexture = !0, this.textures[n].renderTarget = this; const t = Object.assign({}, e.texture.image); return this.texture.source = new _r(t), 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; } dispose() { this.dispatchEvent({ type: "dispose" }); } } class Bs extends vA { constructor(e = 1, t = 1, n = {}) { super(e, t, n), this.isWebGLRenderTarget = !0; } } class Vd extends on { constructor(e = null, t = 1, n = 1, i = 1) { super(null), this.isDataArrayTexture = !0, this.image = { data: e, width: t, height: n, depth: i }, this.magFilter = vn, this.minFilter = vn, this.wrapR = $t, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = /* @__PURE__ */ new Set(); } addLayerUpdate(e) { this.layerUpdates.add(e); } clearLayerUpdates() { this.layerUpdates.clear(); } } class Wd extends on { constructor(e = null, t = 1, n = 1, i = 1) { super(null), this.isData3DTexture = !0, this.image = { data: e, width: t, height: n, depth: i }, this.magFilter = vn, this.minFilter = vn, this.wrapR = $t, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; } } class an { constructor(e = 0, t = 0, n = 0, i = 1) { this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = i; } static slerpFlat(e, t, n, i, s, r, o) { let c = n[i + 0], l = n[i + 1], h = n[i + 2], u = n[i + 3]; const d = s[r + 0], f = s[r + 1], A = s[r + 2], m = s[r + 3]; if (o === 0) { e[t + 0] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; return; } if (o === 1) { e[t + 0] = d, e[t + 1] = f, e[t + 2] = A, e[t + 3] = m; return; } if (u !== m || c !== d || l !== f || h !== A) { let g = 1 - o; const p = c * d + l * f + h * A + u * m, _ = p >= 0 ? 1 : -1, b = 1 - p * p; if (b > Number.EPSILON) { const B = Math.sqrt(b), S = Math.atan2(B, p * _); g = Math.sin(g * S) / B, o = Math.sin(o * S) / B; } const y = o * _; if (c = c * g + d * y, l = l * g + f * y, h = h * g + A * y, u = u * g + m * y, g === 1 - o) { const B = 1 / Math.sqrt(c * c + l * l + h * h + u * u); c *= B, l *= B, h *= B, u *= B; } } e[t] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; } static multiplyQuaternionsFlat(e, t, n, i, s, r) { const o = n[i], c = n[i + 1], l = n[i + 2], h = n[i + 3], u = s[r], d = s[r + 1], f = s[r + 2], A = s[r + 3]; return e[t] = o * A + h * u + c * f - l * d, e[t + 1] = c * A + h * d + l * u - o * f, e[t + 2] = l * A + h * f + o * d - c * u, e[t + 3] = h * A - o * u - c * d - l * 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, i) { return this._x = e, this._y = t, this._z = n, this._w = i, 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) { const n = e._x, i = e._y, s = e._z, r = e._order, o = Math.cos, c = Math.sin, l = o(n / 2), h = o(i / 2), u = o(s / 2), d = c(n / 2), f = c(i / 2), A = c(s / 2); switch (r) { case "XYZ": this._x = d * h * u + l * f * A, this._y = l * f * u - d * h * A, this._z = l * h * A + d * f * u, this._w = l * h * u - d * f * A; break; case "YXZ": this._x = d * h * u + l * f * A, this._y = l * f * u - d * h * A, this._z = l * h * A - d * f * u, this._w = l * h * u + d * f * A; break; case "ZXY": this._x = d * h * u - l * f * A, this._y = l * f * u + d * h * A, this._z = l * h * A + d * f * u, this._w = l * h * u - d * f * A; break; case "ZYX": this._x = d * h * u - l * f * A, this._y = l * f * u + d * h * A, this._z = l * h * A - d * f * u, this._w = l * h * u + d * f * A; break; case "YZX": this._x = d * h * u + l * f * A, this._y = l * f * u + d * h * A, this._z = l * h * A - d * f * u, this._w = l * h * u - d * f * A; break; case "XZY": this._x = d * h * u - l * f * A, this._y = l * f * u - d * h * A, this._z = l * h * A + d * f * u, this._w = l * h * u + d * f * A; break; default: console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + r); } return t === !0 && this._onChangeCallback(), this; } setFromAxisAngle(e, t) { const n = t / 2, i = Math.sin(n); return this._x = e.x * i, this._y = e.y * i, this._z = e.z * i, this._w = Math.cos(n), this._onChangeCallback(), this; } setFromRotationMatrix(e) { const t = e.elements, n = t[0], i = t[4], s = t[8], r = t[1], o = t[5], c = t[9], l = t[2], h = t[6], u = t[10], d = n + o + u; if (d > 0) { const f = 0.5 / Math.sqrt(d + 1); this._w = 0.25 / f, this._x = (h - c) * f, this._y = (s - l) * f, this._z = (r - i) * f; } else if (n > o && n > u) { const f = 2 * Math.sqrt(1 + n - o - u); this._w = (h - c) / f, this._x = 0.25 * f, this._y = (i + r) / f, this._z = (s + l) / f; } else if (o > u) { const f = 2 * Math.sqrt(1 + o - n - u); this._w = (s - l) / f, this._x = (i + r) / f, this._y = 0.25 * f, this._z = (c + h) / f; } else { const f = 2 * Math.sqrt(1 + u - n - o); this._w = (r - i) / f, this._x = (s + l) / f, this._y = (c + h) / f, this._z = 0.25 * f; } return this._onChangeCallback(), this; } setFromUnitVectors(e, t) { let n = e.dot(t) + 1; return n < Number.EPSILON ? (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(wt(this.dot(e), -1, 1))); } rotateTowards(e, t) { const n = this.angleTo(e); if (n === 0) return this; const i = Math.min(1, t / n); return this.slerp(e, i), this; } identity() { return this.set(0, 0, 0, 1); } invert() { return this.conjugate(); } conjugate() { return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this; } dot(e) { return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w; } lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; } length() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); } normalize() { let e = this.length(); return e === 0 ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this; } multiply(e) { return this.multiplyQuaternions(this, e); } premultiply(e) { return this.multiplyQuaternions(e, this); } multiplyQuaternions(e, t) { const n = e._x, i = e._y, s = e._z, r = e._w, o = t._x, c = t._y, l = t._z, h = t._w; return this._x = n * h + r * o + i * l - s * c, this._y = i * h + r * c + s * o - n * l, this._z = s * h + r * l + n * c - i * o, this._w = r * h - n * o - i * c - s * l, this._onChangeCallback(), this; } slerp(e, t) { if (t === 0) return this; if (t === 1) return this.copy(e); const n = this._x, i = this._y, s = this._z, r = this._w; let o = r * e._w + n * e._x + i * e._y + s * e._z; if (o < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, o = -o) : this.copy(e), o >= 1) return this._w = r, this._x = n, this._y = i, this._z = s, this; const c = 1 - o * o; if (c <= Number.EPSILON) { const f = 1 - t; return this._w = f * r + t * this._w, this._x = f * n + t * this._x, this._y = f * i + t * this._y, this._z = f * s + t * this._z, this.normalize(), this; } const l = Math.sqrt(c), h = Math.atan2(l, o), u = Math.sin((1 - t) * h) / l, d = Math.sin(t * h) / l; return this._w = r * u + this._w * d, this._x = n * u + this._x * d, this._y = i * u + this._y * d, this._z = s * u + this._z * d, this._onChangeCallback(), this; } slerpQuaternions(e, t, n) { return this.copy(e).slerp(t, n); } random() { const e = 2 * Math.PI * Math.random(), t = 2 * Math.PI * Math.random(), n = Math.random(), i = Math.sqrt(1 - n), s = Math.sqrt(n); return this.set( i * Math.sin(e), i * Math.cos(e), s * Math.sin(t), s * 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; } } class z { constructor(e = 0, t = 0, n = 0) { z.prototype.isVector3 = !0, this.x = e, this.y = t, this