UNPKG

flower3d

Version:

+ 基于THREE和CANNON的VUE组件库

1,406 lines 916 kB
var nu = Object.defineProperty; var iu = (o, e, t) => e in o ? nu(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t; var Ye = (o, e, t) => (iu(o, typeof e != "symbol" ? e + "" : e, t), t); import { defineComponent as Bn, ref as _n, provide as Tr, onMounted as su, openBlock as ru, createElementBlock as ou, renderSlot as us, toRaw as Ls, watch as au, watchEffect as La, inject as Fn } from "vue"; /** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */ const na = "161", wi = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 }, Ri = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }, cu = 0, Pa = 1, lu = 2, ql = 1, hu = 2, Pn = 3, On = 0, Ht = 1, fn = 2, ei = 0, Qi = 1, Ia = 2, Na = 3, Da = 4, uu = 5, pi = 100, du = 101, fu = 102, Ua = 103, Fa = 104, pu = 200, mu = 201, gu = 202, _u = 203, Go = 204, Vo = 205, vu = 206, xu = 207, yu = 208, Mu = 209, Eu = 210, Su = 211, bu = 212, Tu = 213, Au = 214, wu = 0, Ru = 1, Cu = 2, Rr = 3, Lu = 4, Pu = 5, Iu = 6, Nu = 7, jl = 0, Du = 1, Uu = 2, ti = 0, Fu = 1, Ou = 2, Bu = 3, zu = 4, ku = 5, Hu = 6, Oa = "attached", Gu = "detached", Yl = 300, ns = 301, is = 302, Cr = 303, Wo = 304, Br = 306, ss = 1e3, kt = 1001, Lr = 1002, wt = 1003, Xo = 1004, Yi = 1005, mt = 1006, Ar = 1007, mn = 1008, ni = 1009, Vu = 1010, Wu = 1011, ia = 1012, Kl = 1013, Jn = 1014, qt = 1015, Nn = 1016, $l = 1017, Zl = 1018, vi = 1020, Xu = 1021, Zt = 1023, qu = 1024, ju = 1025, xi = 1026, rs = 1027, Yu = 1028, Jl = 1029, Ku = 1030, Ql = 1031, eh = 1033, Zr = 33776, Jr = 33777, Qr = 33778, eo = 33779, Ba = 35840, za = 35841, ka = 35842, Ha = 35843, th = 36196, Ga = 37492, Va = 37496, Wa = 37808, Xa = 37809, qa = 37810, ja = 37811, Ya = 37812, Ka = 37813, $a = 37814, Za = 37815, Ja = 37816, Qa = 37817, ec = 37818, tc = 37819, nc = 37820, ic = 37821, to = 36492, sc = 36494, rc = 36495, $u = 36283, oc = 36284, ac = 36285, cc = 36286, Zu = 2200, Ju = 2201, Qu = 2202, Us = 2300, os = 2301, no = 2302, Ki = 2400, $i = 2401, Pr = 2402, sa = 2500, ed = 2501, td = 0, nh = 1, qo = 2, ih = 3e3, yi = 3001, nd = 3200, id = 3201, sh = 0, sd = 1, Jt = "", dt = "srgb", Et = "srgb-linear", ra = "display-p3", zr = "display-p3-linear", Ir = "linear", ct = "srgb", Nr = "rec709", Dr = "p3", Ci = 7680, lc = 519, rd = 512, od = 513, ad = 514, rh = 515, cd = 516, ld = 517, hd = 518, ud = 519, jo = 35044, hc = "300 es", Yo = 1035, Dn = 2e3, Ur = 2001; class si { 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 Pt = ["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 uc = 1234567; const Ps = Math.PI / 180, as = 180 / Math.PI; function an() { const o = Math.random() * 4294967295 | 0, e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0; return (Pt[o & 255] + Pt[o >> 8 & 255] + Pt[o >> 16 & 255] + Pt[o >> 24 & 255] + "-" + Pt[e & 255] + Pt[e >> 8 & 255] + "-" + Pt[e >> 16 & 15 | 64] + Pt[e >> 24 & 255] + "-" + Pt[t & 63 | 128] + Pt[t >> 8 & 255] + "-" + Pt[t >> 16 & 255] + Pt[t >> 24 & 255] + Pt[n & 255] + Pt[n >> 8 & 255] + Pt[n >> 16 & 255] + Pt[n >> 24 & 255]).toLowerCase(); } function Rt(o, e, t) { return Math.max(e, Math.min(t, o)); } function oa(o, e) { return (o % e + e) % e; } function dd(o, e, t, n, i) { return n + (o - e) * (i - n) / (t - e); } function fd(o, e, t) { return o !== e ? (t - o) / (e - o) : 0; } function Is(o, e, t) { return (1 - t) * o + t * e; } function pd(o, e, t, n) { return Is(o, e, 1 - Math.exp(-t * n)); } function md(o, e = 1) { return e - Math.abs(oa(o, e * 2) - e); } function gd(o, e, t) { return o <= e ? 0 : o >= t ? 1 : (o = (o - e) / (t - e), o * o * (3 - 2 * o)); } function _d(o, e, t) { return o <= e ? 0 : o >= t ? 1 : (o = (o - e) / (t - e), o * o * o * (o * (o * 6 - 15) + 10)); } function vd(o, e) { return o + Math.floor(Math.random() * (e - o + 1)); } function xd(o, e) { return o + Math.random() * (e - o); } function yd(o) { return o * (0.5 - Math.random()); } function Md(o) { o !== void 0 && (uc = o); let e = uc += 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 Ed(o) { return o * Ps; } function Sd(o) { return o * as; } function Ko(o) { return (o & o - 1) === 0 && o !== 0; } function bd(o) { return Math.pow(2, Math.ceil(Math.log(o) / Math.LN2)); } function Fr(o) { return Math.pow(2, Math.floor(Math.log(o) / Math.LN2)); } function Td(o, e, t, n, i) { const s = Math.cos, r = Math.sin, a = 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), p = s((n - e) / 2), g = r((n - e) / 2); switch (i) { case "XYX": o.set(a * h, c * u, c * d, a * l); break; case "YZY": o.set(c * d, a * h, c * u, a * l); break; case "ZXZ": o.set(c * u, c * d, a * h, a * l); break; case "XZX": o.set(a * h, c * g, c * p, a * l); break; case "YXY": o.set(c * p, a * h, c * g, a * l); break; case "ZYZ": o.set(c * g, c * p, a * h, a * l); break; default: console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + i); } } function rn(o, e) { switch (e.constructor) { case Float32Array: return o; case Uint32Array: return o / 4294967295; case Uint16Array: return o / 65535; case Uint8Array: return o / 255; case Int32Array: return Math.max(o / 2147483647, -1); case Int16Array: return Math.max(o / 32767, -1); case Int8Array: return Math.max(o / 127, -1); default: throw new Error("Invalid component type."); } } function it(o, e) { switch (e.constructor) { case Float32Array: return o; case Uint32Array: return Math.round(o * 4294967295); case Uint16Array: return Math.round(o * 65535); case Uint8Array: return Math.round(o * 255); case Int32Array: return Math.round(o * 2147483647); case Int16Array: return Math.round(o * 32767); case Int8Array: return Math.round(o * 127); default: throw new Error("Invalid component type."); } } const aa = { DEG2RAD: Ps, RAD2DEG: as, generateUUID: an, clamp: Rt, euclideanModulo: oa, mapLinear: dd, inverseLerp: fd, lerp: Is, damp: pd, pingpong: md, smoothstep: gd, smootherstep: _d, randInt: vd, randFloat: xd, randFloatSpread: yd, seededRandom: Md, degToRad: Ed, radToDeg: Sd, isPowerOfTwo: Ko, ceilPowerOfTwo: bd, floorPowerOfTwo: Fr, setQuaternionFromProperEuler: Td, normalize: it, denormalize: rn }; class Le { constructor(e = 0, t = 0) { Le.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 = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this; } clampLength(e, t) { const n = this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))); } 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(Rt(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 Xe { constructor(e, t, n, i, s, r, a, c, l) { Xe.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, a, c, l); } set(e, t, n, i, s, r, a, c, l) { const h = this.elements; return h[0] = e, h[1] = i, h[2] = a, 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], a = n[3], c = n[6], l = n[1], h = n[4], u = n[7], d = n[2], p = n[5], g = n[8], _ = i[0], f = i[3], m = i[6], v = i[1], x = i[4], E = i[7], R = i[2], A = i[5], T = i[8]; return s[0] = r * _ + a * v + c * R, s[3] = r * f + a * x + c * A, s[6] = r * m + a * E + c * T, s[1] = l * _ + h * v + u * R, s[4] = l * f + h * x + u * A, s[7] = l * m + h * E + u * T, s[2] = d * _ + p * v + g * R, s[5] = d * f + p * x + g * A, s[8] = d * m + p * E + g * T, 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], a = e[5], c = e[6], l = e[7], h = e[8]; return t * r * h - t * a * l - n * s * h + n * a * 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], a = e[5], c = e[6], l = e[7], h = e[8], u = h * r - a * l, d = a * c - h * s, p = l * s - r * c, g = t * u + n * d + i * p; if (g === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const _ = 1 / g; return e[0] = u * _, e[1] = (i * l - h * n) * _, e[2] = (a * n - i * r) * _, e[3] = d * _, e[4] = (h * t - i * c) * _, e[5] = (i * s - a * t) * _, e[6] = p * _, e[7] = (n * c - l * t) * _, e[8] = (r * t - n * s) * _, 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, a) { const c = Math.cos(s), l = Math.sin(s); return this.set( n * c, n * l, -n * (c * r + l * a) + r + e, -i * l, i * c, -i * (-l * r + c * a) + a + t, 0, 0, 1 ), this; } // scale(e, t) { return this.premultiply(io.makeScale(e, t)), this; } rotate(e) { return this.premultiply(io.makeRotation(-e)), this; } translate(e, t) { return this.premultiply(io.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 io = /* @__PURE__ */ new Xe(); function oh(o) { for (let e = o.length - 1; e >= 0; --e) if (o[e] >= 65535) return !0; return !1; } function Fs(o) { return document.createElementNS("http://www.w3.org/1999/xhtml", o); } function Ad() { const o = Fs("canvas"); return o.style.display = "block", o; } const dc = {}; function Mi(o) { o in dc || (dc[o] = !0, console.warn(o)); } const fc = /* @__PURE__ */ new Xe().set( 0.8224621, 0.177538, 0, 0.0331941, 0.9668058, 0, 0.0170827, 0.0723974, 0.9105199 ), pc = /* @__PURE__ */ new Xe().set( 1.2249401, -0.2249404, 0, -0.0420569, 1.0420571, 0, -0.0196376, -0.0786361, 1.0982735 ), Xs = { [Et]: { transfer: Ir, primaries: Nr, toReference: (o) => o, fromReference: (o) => o }, [dt]: { transfer: ct, primaries: Nr, toReference: (o) => o.convertSRGBToLinear(), fromReference: (o) => o.convertLinearToSRGB() }, [zr]: { transfer: Ir, primaries: Dr, toReference: (o) => o.applyMatrix3(pc), fromReference: (o) => o.applyMatrix3(fc) }, [ra]: { transfer: ct, primaries: Dr, toReference: (o) => o.convertSRGBToLinear().applyMatrix3(pc), fromReference: (o) => o.applyMatrix3(fc).convertLinearToSRGB() } }, wd = /* @__PURE__ */ new Set([Et, zr]), nt = { enabled: !0, _workingColorSpace: Et, get workingColorSpace() { return this._workingColorSpace; }, set workingColorSpace(o) { if (!wd.has(o)) throw new Error(`Unsupported working color space, "${o}".`); this._workingColorSpace = o; }, convert: function(o, e, t) { if (this.enabled === !1 || e === t || !e || !t) return o; const n = Xs[e].toReference, i = Xs[t].fromReference; return i(n(o)); }, fromWorkingColorSpace: function(o, e) { return this.convert(o, this._workingColorSpace, e); }, toWorkingColorSpace: function(o, e) { return this.convert(o, e, this._workingColorSpace); }, getPrimaries: function(o) { return Xs[o].primaries; }, getTransfer: function(o) { return o === Jt ? Ir : Xs[o].transfer; } }; function es(o) { return o < 0.04045 ? o * 0.0773993808 : Math.pow(o * 0.9478672986 + 0.0521327014, 2.4); } function so(o) { return o < 31308e-7 ? o * 12.92 : 1.055 * Math.pow(o, 0.41666) - 0.055; } let Li; class ah { static getDataURL(e) { if (/^data:/i.test(e.src) || typeof HTMLCanvasElement > "u") return e.src; let t; if (e instanceof HTMLCanvasElement) t = e; else { Li === void 0 && (Li = Fs("canvas")), Li.width = e.width, Li.height = e.height; const n = Li.getContext("2d"); e instanceof ImageData ? n.putImageData(e, 0, 0) : n.drawImage(e, 0, 0, e.width, e.height), t = Li; } 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 = Fs("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] = es(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(es(t[n] / 255) * 255) : t[n] = es(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 Rd = 0; class ch { constructor(e = null) { this.isSource = !0, Object.defineProperty(this, "id", { value: Rd++ }), this.uuid = an(), 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, a = i.length; r < a; r++) i[r].isDataTexture ? s.push(ro(i[r].image)) : s.push(ro(i[r])); } else s = ro(i); n.url = s; } return t || (e.images[this.uuid] = n), n; } } function ro(o) { return typeof HTMLImageElement < "u" && o instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && o instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && o instanceof ImageBitmap ? ah.getDataURL(o) : o.data ? { data: Array.from(o.data), width: o.width, height: o.height, type: o.data.constructor.name } : (console.warn("THREE.Texture: Unable to serialize Texture."), {}); } let Cd = 0; class Mt extends si { constructor(e = Mt.DEFAULT_IMAGE, t = Mt.DEFAULT_MAPPING, n = kt, i = kt, s = mt, r = mn, a = Zt, c = ni, l = Mt.DEFAULT_ANISOTROPY, h = Jt) { super(), this.isTexture = !0, Object.defineProperty(this, "id", { value: Cd++ }), this.uuid = an(), this.name = "", this.source = new ch(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 = a, this.internalFormat = null, this.type = c, this.offset = new Le(0, 0), this.repeat = new Le(1, 1), this.center = new Le(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Xe(), this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, typeof h == "string" ? this.colorSpace = h : (Mi("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace = h === yi ? dt : Jt), this.userData = {}, this.version = 0, this.onUpdate = null, this.isRenderTargetTexture = !1, this.needsPMREMUpdate = !1; } 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.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 ss: e.x = e.x - Math.floor(e.x); break; case kt: e.x = e.x < 0 ? 0 : 1; break; case Lr: 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 ss: e.y = e.y - Math.floor(e.y); break; case kt: e.y = e.y < 0 ? 0 : 1; break; case Lr: 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); } get encoding() { return Mi("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace === dt ? yi : ih; } set encoding(e) { Mi("THREE.Texture: Property .encoding has been replaced by .colorSpace."), this.colorSpace = e === yi ? dt : Jt; } } Mt.DEFAULT_IMAGE = null; Mt.DEFAULT_MAPPING = Yl; Mt.DEFAULT_ANISOTROPY = 1; class rt { constructor(e = 0, t = 0, n = 0, i = 1) { rt.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; } 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], p = c[5], g = c[9], _ = c[2], f = c[6], m = c[10]; if (Math.abs(h - d) < 0.01 && Math.abs(u - _) < 0.01 && Math.abs(g - f) < 0.01) { if (Math.abs(h + d) < 0.1 && Math.abs(u + _) < 0.1 && Math.abs(g + f) < 0.1 && Math.abs(l + p + m - 3) < 0.1) return this.set(1, 0, 0, 0), this; t = Math.PI; const x = (l + 1) / 2, E = (p + 1) / 2, R = (m + 1) / 2, A = (h + d) / 4, T = (u + _) / 4, U = (g + f) / 4; return x > E && x > R ? x < 0.01 ? (n = 0, i = 0.707106781, s = 0.707106781) : (n = Math.sqrt(x), i = A / n, s = T / n) : E > R ? E < 0.01 ? (n = 0.707106781, i = 0, s = 0.707106781) : (i = Math.sqrt(E), n = A / i, s = U / i) : R < 0.01 ? (n = 0.707106781, i = 0.707106781, s = 0) : (s = Math.sqrt(R), n = T / s, i = U / s), this.set(n, i, s, t), this; } let v = Math.sqrt((f - g) * (f - g) + (u - _) * (u - _) + (d - h) * (d - h)); return Math.abs(v) < 1e-3 && (v = 1), this.x = (f - g) / v, this.y = (u - _) / v, this.z = (d - h) / v, this.w = Math.acos((l + p + m - 1) / 2), this; } min(e) { return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this; } max(e) { return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this; } clamp(e, t) { return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this.w = Math.max(e.w, Math.min(t.w, this.w)), this; } clampScalar(e, t) { return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this.w = Math.max(e, Math.min(t, this.w)), this; } clampLength(e, t) { const n = this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))); } 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 Ld extends si { constructor(e = 1, t = 1, n = {}) { super(), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = 1, this.scissor = new rt(0, 0, e, t), this.scissorTest = !1, this.viewport = new rt(0, 0, e, t); const i = { width: e, height: t, depth: 1 }; n.encoding !== void 0 && (Mi("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."), n.colorSpace = n.encoding === yi ? dt : Jt), n = Object.assign({ generateMipmaps: !1, internalFormat: null, minFilter: mt, depthBuffer: !0, stencilBuffer: !1, depthTexture: null, samples: 0 }, n), this.texture = new Mt(i, n.mapping, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.flipY = !1, this.texture.generateMipmaps = n.generateMipmaps, this.texture.internalFormat = n.internalFormat, this.depthBuffer = n.depthBuffer, this.stencilBuffer = n.stencilBuffer, this.depthTexture = n.depthTexture, this.samples = n.samples; } setSize(e, t, n = 1) { (this.width !== e || this.height !== t || this.depth !== n) && (this.width = e, this.height = t, this.depth = n, this.texture.image.width = e, this.texture.image.height = t, this.texture.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.texture = e.texture.clone(), this.texture.isRenderTargetTexture = !0; const t = Object.assign({}, e.texture.image); return this.texture.source = new ch(t), this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, e.depthTexture !== null && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this; } dispose() { this.dispatchEvent({ type: "dispose" }); } } class Si extends Ld { constructor(e = 1, t = 1, n = {}) { super(e, t, n), this.isWebGLRenderTarget = !0; } } class lh extends Mt { 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 = wt, this.minFilter = wt, this.wrapR = kt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; } } class Pd extends Mt { 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 = wt, this.minFilter = wt, this.wrapR = kt, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1; } } let Gt = class { 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, a) { let c = n[i + 0], l = n[i + 1], h = n[i + 2], u = n[i + 3]; const d = s[r + 0], p = s[r + 1], g = s[r + 2], _ = s[r + 3]; if (a === 0) { e[t + 0] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; return; } if (a === 1) { e[t + 0] = d, e[t + 1] = p, e[t + 2] = g, e[t + 3] = _; return; } if (u !== _ || c !== d || l !== p || h !== g) { let f = 1 - a; const m = c * d + l * p + h * g + u * _, v = m >= 0 ? 1 : -1, x = 1 - m * m; if (x > Number.EPSILON) { const R = Math.sqrt(x), A = Math.atan2(R, m * v); f = Math.sin(f * A) / R, a = Math.sin(a * A) / R; } const E = a * v; if (c = c * f + d * E, l = l * f + p * E, h = h * f + g * E, u = u * f + _ * E, f === 1 - a) { const R = 1 / Math.sqrt(c * c + l * l + h * h + u * u); c *= R, l *= R, h *= R, u *= R; } } e[t] = c, e[t + 1] = l, e[t + 2] = h, e[t + 3] = u; } static multiplyQuaternionsFlat(e, t, n, i, s, r) { const a = n[i], c = n[i + 1], l = n[i + 2], h = n[i + 3], u = s[r], d = s[r + 1], p = s[r + 2], g = s[r + 3]; return e[t] = a * g + h * u + c * p - l * d, e[t + 1] = c * g + h * d + l * u - a * p, e[t + 2] = l * g + h * p + a * d - c * u, e[t + 3] = h * g - a * u - c * d - l * p, 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, a = Math.cos, c = Math.sin, l = a(n / 2), h = a(i / 2), u = a(s / 2), d = c(n / 2), p = c(i / 2), g = c(s / 2); switch (r) { case "XYZ": this._x = d * h * u + l * p * g, this._y = l * p * u - d * h * g, this._z = l * h * g + d * p * u, this._w = l * h * u - d * p * g; break; case "YXZ": this._x = d * h * u + l * p * g, this._y = l * p * u - d * h * g, this._z = l * h * g - d * p * u, this._w = l * h * u + d * p * g; break; case "ZXY": this._x = d * h * u - l * p * g, this._y = l * p * u + d * h * g, this._z = l * h * g + d * p * u, this._w = l * h * u - d * p * g; break; case "ZYX": this._x = d * h * u - l * p * g, this._y = l * p * u + d * h * g, this._z = l * h * g - d * p * u, this._w = l * h * u + d * p * g; break; case "YZX": this._x = d * h * u + l * p * g, this._y = l * p * u + d * h * g, this._z = l * h * g - d * p * u, this._w = l * h * u - d * p * g; break; case "XZY": this._x = d * h * u - l * p * g, this._y = l * p * u - d * h * g, this._z = l * h * g + d * p * u, this._w = l * h * u + d * p * g; 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], a = t[5], c = t[9], l = t[2], h = t[6], u = t[10], d = n + a + u; if (d > 0) { const p = 0.5 / Math.sqrt(d + 1); this._w = 0.25 / p, this._x = (h - c) * p, this._y = (s - l) * p, this._z = (r - i) * p; } else if (n > a && n > u) { const p = 2 * Math.sqrt(1 + n - a - u); this._w = (h - c) / p, this._x = 0.25 * p, this._y = (i + r) / p, this._z = (s + l) / p; } else if (a > u) { const p = 2 * Math.sqrt(1 + a - n - u); this._w = (s - l) / p, this._x = (i + r) / p, this._y = 0.25 * p, this._z = (c + h) / p; } else { const p = 2 * Math.sqrt(1 + u - n - a); this._w = (r - i) / p, this._x = (s + l) / p, this._y = (c + h) / p, this._z = 0.25 * p; } 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(Rt(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, a = t._x, c = t._y, l = t._z, h = t._w; return this._x = n * h + r * a + i * l - s * c, this._y = i * h + r * c + s * a - n * l, this._z = s * h + r * l + n * c - i * a, this._w = r * h - n * a - 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 a = r * e._w + n * e._x + i * e._y + s * e._z; if (a < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, a = -a) : this.copy(e), a >= 1) return this._w = r, this._x = n, this._y = i, this._z = s, this; const c = 1 - a * a; if (c <= Number.EPSILON) { const p = 1 - t; return this._w = p * r + t * this._w, this._x = p * n + t * this._x, this._y = p * i + t * this._y, this._z = p * s + t * this._z, this.normalize(), this; } const l = Math.sqrt(c), h = Math.atan2(l, a), 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 = Math.random(), t = Math.sqrt(1 - e), n = Math.sqrt(e), i = 2 * Math.PI * Math.random(), s = 2 * Math.PI * Math.random(); return this.set( t * Math.cos(i), n * Math.sin(s), n * Math.cos(s), t * Math.sin(i) ); } equals(e) { return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w; } fromArray(e, t = 0) { return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this; } toArray(e = [], t = 0) { return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e; } fromBufferAttribute(e, t) { return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this._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 O { constructor(e = 0, t = 0, n = 0) { O.prototype.isVector3 = !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 new Error("index is out of range: " + e); } return this; } getComponent(e) { switch (e) { case 0: return this.x; case 1: return this.y; case 2: return this.z; default: throw new Error("index is out of range: " + e); } } clone() { return new this.constructor(this.x, this.y, this.z); } copy(e) { return this.x = e.x, this.y = e.y, this.z = e.z, this; } add(e) { 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(mc.setFromEuler(e)); } applyAxisAngle(e, t) { return this.applyQuaternion(mc.setFromAxisAngle(e, t)); } applyMatrix3(e) { const t = this.x, n = this.y, i = this.z, s = e.elements; return this.x = s[0] * t + s[3] * n + s[6] * i, this.y = s[1] * t + s[4] * n + s[7] * i, this.z = s[2] * t + s[5] * n + s[8] * i, this; } applyNormalMatrix(e) { return this.applyMatrix3(e).normalize(); } applyMatrix4(e) { const t = this.x, n = this.y, i = this.z, s = e.elements, r = 1 / (s[3] * t + s[7] * n + s[11] * i + s[15]); return this.x = (s[0] * t + s[4] * n + s[8] * i + s[12]) * r, this.y = (s[1] * t + s[5] * n + s[9] * i + s[13]) * r, this.z = (s[2] * t + s[6