From 2e65efccc54700c661430dad740aca216c26b5c5 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Tue, 30 Apr 2024 06:01:17 +0100 Subject: [PATCH] Fix support for newer TS versions and update depends (#4) * Update package.json for new TS versions * Update package.json URLs * Update depends * Export schema * Mark scene and controls as accessible but read only * Update wintersky * Update package.json for consistent capitalization --------- Co-authored-by: Liam Hanrahan <60296487+outercloudstudio@users.noreply.github.com> --- dist/Animations/Animation.d.ts | 4 +- dist/main.d.ts | 6 +- dist/model-viewer.es.js | 1714 +++++++++++++------------------- dist/model-viewer.umd.js | 2 +- lib/Animations/Animation.ts | 6 +- lib/main.ts | 7 +- package-lock.json | 954 ++++++++++-------- package.json | 26 +- 8 files changed, 1251 insertions(+), 1468 deletions(-) diff --git a/dist/Animations/Animation.d.ts b/dist/Animations/Animation.d.ts index 5ef99af..532d522 100644 --- a/dist/Animations/Animation.d.ts +++ b/dist/Animations/Animation.d.ts @@ -1,4 +1,4 @@ -import { MoLang } from 'molang'; +import { Molang } from 'molang'; import { ISingleAnimation, TBoneModifier } from '../Schema/Animation'; import { SoundEffect } from './SoundEffect'; import { ParticleEffect } from './ParticleEffect'; @@ -14,7 +14,7 @@ export declare class Animation { 'query.delta_time': () => number; 'query.life_time': () => number; }; - protected molang: MoLang; + protected molang: Molang; protected soundEffects: SoundEffect; protected particleEffects: ParticleEffect; constructor(animator: Animator, animationData: ISingleAnimation); diff --git a/dist/main.d.ts b/dist/main.d.ts index 1efd9f7..43a8f4f 100644 --- a/dist/main.d.ts +++ b/dist/main.d.ts @@ -3,6 +3,8 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'; import { Model } from './Model'; import { IGeoSchema } from './Schema/Model'; export { Model } from './Model'; +export * from './Schema/Model'; +export * from './Schema/Animation'; export interface IOptions { antialias?: boolean; width?: number; @@ -14,10 +16,10 @@ export declare class StandaloneModelViewer { protected options: IOptions; protected renderer: WebGLRenderer; protected model: Model; - protected scene: Scene; + readonly scene: Scene; protected camera: PerspectiveCamera; protected renderingRequested: boolean; - protected controls: OrbitControls; + readonly controls: OrbitControls; readonly loadedModel: Promise; constructor(canvasElement: HTMLCanvasElement, modelData: IGeoSchema, texturePath: string, options: IOptions); protected loadModel(): Promise; diff --git a/dist/model-viewer.es.js b/dist/model-viewer.es.js index 6e14cf5..6844197 100644 --- a/dist/model-viewer.es.js +++ b/dist/model-viewer.es.js @@ -1,178 +1,33 @@ -var __defProp = Object.defineProperty; -var __defProps = Object.defineProperties; -var __getOwnPropDescs = Object.getOwnPropertyDescriptors; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); -import { EventDispatcher, Vector3, MOUSE, TOUCH, Quaternion, Spherical, Vector2, MathUtils, BufferGeometry, Group, BufferAttribute, Mesh, NearestFilter, MeshLambertMaterial, DoubleSide, LineBasicMaterial, BoxGeometry, EdgesGeometry, LineSegments, TextureLoader, WebGLRenderer, PerspectiveCamera, Scene, AmbientLight, Color, AxesHelper, GridHelper, BoxHelper, Box3, Sphere } from "three"; -import { MoLang } from "molang"; -import Wintersky from "wintersky"; -const _changeEvent = { type: "change" }; -const _startEvent = { type: "start" }; -const _endEvent = { type: "end" }; -class OrbitControls extends EventDispatcher { - constructor(object, domElement) { - super(); - if (domElement === void 0) - console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'); - if (domElement === document) - console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'); - this.object = object; - this.domElement = domElement; - this.domElement.style.touchAction = "none"; - this.enabled = true; - this.target = new Vector3(); - this.minDistance = 0; - this.maxDistance = Infinity; - this.minZoom = 0; - this.maxZoom = Infinity; - this.minPolarAngle = 0; - this.maxPolarAngle = Math.PI; - this.minAzimuthAngle = -Infinity; - this.maxAzimuthAngle = Infinity; - this.enableDamping = false; - this.dampingFactor = 0.05; - this.enableZoom = true; - this.zoomSpeed = 1; - this.enableRotate = true; - this.rotateSpeed = 1; - this.enablePan = true; - this.panSpeed = 1; - this.screenSpacePanning = true; - this.keyPanSpeed = 7; - this.autoRotate = false; - this.autoRotateSpeed = 2; - this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }; - this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; - this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.zoom0 = this.object.zoom; - this._domElementKeyEvents = null; - this.getPolarAngle = function() { - return spherical.phi; - }; - this.getAzimuthalAngle = function() { - return spherical.theta; - }; - this.getDistance = function() { +import { EventDispatcher as Fe, Vector3 as I, MOUSE as F, TOUCH as D, Quaternion as fe, Spherical as ge, Vector2 as O, MathUtils as _, BufferGeometry as Te, Group as H, BufferAttribute as G, Mesh as Ae, NearestFilter as ye, MeshLambertMaterial as De, DoubleSide as we, LineBasicMaterial as He, BoxGeometry as Ge, EdgesGeometry as Xe, LineSegments as Be, TextureLoader as Ze, WebGLRenderer as Ke, PerspectiveCamera as Ve, Scene as qe, AmbientLight as Ce, Color as We, AxesHelper as $e, GridHelper as Qe, BoxHelper as Je, Box3 as et, Sphere as tt } from "three"; +import { Molang as ot } from "molang"; +import it from "wintersky"; +const be = { type: "change" }, $ = { type: "start" }, Ee = { type: "end" }; +class nt extends Fe { + constructor(o, i) { + super(), this.object = o, this.domElement = i, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new I(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: F.ROTATE, MIDDLE: F.DOLLY, RIGHT: F.PAN }, this.touches = { ONE: D.ROTATE, TWO: D.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() { + return r.phi; + }, this.getAzimuthalAngle = function() { + return r.theta; + }, this.getDistance = function() { return this.object.position.distanceTo(this.target); - }; - this.listenToKeyEvents = function(domElement2) { - domElement2.addEventListener("keydown", onKeyDown); - this._domElementKeyEvents = domElement2; - }; - this.saveState = function() { - scope.target0.copy(scope.target); - scope.position0.copy(scope.object.position); - scope.zoom0 = scope.object.zoom; - }; - this.reset = function() { - scope.target.copy(scope.target0); - scope.object.position.copy(scope.position0); - scope.object.zoom = scope.zoom0; - scope.object.updateProjectionMatrix(); - scope.dispatchEvent(_changeEvent); - scope.update(); - state = STATE.NONE; - }; - this.update = function() { - const offset = new Vector3(); - const quat = new Quaternion().setFromUnitVectors(object.up, new Vector3(0, 1, 0)); - const quatInverse = quat.clone().invert(); - const lastPosition = new Vector3(); - const lastQuaternion = new Quaternion(); - const twoPI = 2 * Math.PI; - return function update() { - const position = scope.object.position; - offset.copy(position).sub(scope.target); - offset.applyQuaternion(quat); - spherical.setFromVector3(offset); - if (scope.autoRotate && state === STATE.NONE) { - rotateLeft(getAutoRotationAngle()); - } - if (scope.enableDamping) { - spherical.theta += sphericalDelta.theta * scope.dampingFactor; - spherical.phi += sphericalDelta.phi * scope.dampingFactor; - } else { - spherical.theta += sphericalDelta.theta; - spherical.phi += sphericalDelta.phi; - } - let min = scope.minAzimuthAngle; - let max = scope.maxAzimuthAngle; - if (isFinite(min) && isFinite(max)) { - if (min < -Math.PI) - min += twoPI; - else if (min > Math.PI) - min -= twoPI; - if (max < -Math.PI) - max += twoPI; - else if (max > Math.PI) - max -= twoPI; - if (min <= max) { - spherical.theta = Math.max(min, Math.min(max, spherical.theta)); - } else { - spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta); - } - } - spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi)); - spherical.makeSafe(); - spherical.radius *= scale; - spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius)); - if (scope.enableDamping === true) { - scope.target.addScaledVector(panOffset, scope.dampingFactor); - } else { - scope.target.add(panOffset); - } - offset.setFromSpherical(spherical); - offset.applyQuaternion(quatInverse); - position.copy(scope.target).add(offset); - scope.object.lookAt(scope.target); - if (scope.enableDamping === true) { - sphericalDelta.theta *= 1 - scope.dampingFactor; - sphericalDelta.phi *= 1 - scope.dampingFactor; - panOffset.multiplyScalar(1 - scope.dampingFactor); - } else { - sphericalDelta.set(0, 0, 0); - panOffset.set(0, 0, 0); - } - scale = 1; - if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) { - scope.dispatchEvent(_changeEvent); - lastPosition.copy(scope.object.position); - lastQuaternion.copy(scope.object.quaternion); - zoomChanged = false; - return true; - } - return false; + }, this.listenToKeyEvents = function(t) { + t.addEventListener("keydown", he), this._domElementKeyEvents = t; + }, this.saveState = function() { + e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom; + }, this.reset = function() { + e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(be), e.update(), s = n.NONE; + }, this.update = function() { + const t = new I(), a = new fe().setFromUnitVectors(o.up, new I(0, 1, 0)), E = a.clone().invert(), T = new I(), v = new fe(), U = 2 * Math.PI; + return function() { + const me = e.object.position; + t.copy(me).sub(e.target), t.applyQuaternion(a), r.setFromVector3(t), e.autoRotate && s === n.NONE && M(j()), e.enableDamping ? (r.theta += h.theta * e.dampingFactor, r.phi += h.phi * e.dampingFactor) : (r.theta += h.theta, r.phi += h.phi); + let L = e.minAzimuthAngle, N = e.maxAzimuthAngle; + return isFinite(L) && isFinite(N) && (L < -Math.PI ? L += U : L > Math.PI && (L -= U), N < -Math.PI ? N += U : N > Math.PI && (N -= U), L <= N ? r.theta = Math.max(L, Math.min(N, r.theta)) : r.theta = r.theta > (L + N) / 2 ? Math.max(L, r.theta) : Math.min(N, r.theta)), r.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, r.phi)), r.makeSafe(), r.radius *= l, r.radius = Math.max(e.minDistance, Math.min(e.maxDistance, r.radius)), e.enableDamping === !0 ? e.target.addScaledVector(g, e.dampingFactor) : e.target.add(g), t.setFromSpherical(r), t.applyQuaternion(E), me.copy(e.target).add(t), e.object.lookAt(e.target), e.enableDamping === !0 ? (h.theta *= 1 - e.dampingFactor, h.phi *= 1 - e.dampingFactor, g.multiplyScalar(1 - e.dampingFactor)) : (h.set(0, 0, 0), g.set(0, 0, 0)), l = 1, c || T.distanceToSquared(e.object.position) > f || 8 * (1 - v.dot(e.object.quaternion)) > f ? (e.dispatchEvent(be), T.copy(e.object.position), v.copy(e.object.quaternion), c = !1, !0) : !1; }; - }(); - this.dispose = function() { - scope.domElement.removeEventListener("contextmenu", onContextMenu); - scope.domElement.removeEventListener("pointerdown", onPointerDown); - scope.domElement.removeEventListener("pointercancel", onPointerCancel); - scope.domElement.removeEventListener("wheel", onMouseWheel); - scope.domElement.removeEventListener("pointermove", onPointerMove); - scope.domElement.removeEventListener("pointerup", onPointerUp); - if (scope._domElementKeyEvents !== null) { - scope._domElementKeyEvents.removeEventListener("keydown", onKeyDown); - } + }(), this.dispose = function() { + e.domElement.removeEventListener("contextmenu", ue), e.domElement.removeEventListener("pointerdown", ae), e.domElement.removeEventListener("pointercancel", ce), e.domElement.removeEventListener("wheel", le), e.domElement.removeEventListener("pointermove", q), e.domElement.removeEventListener("pointerup", C), e._domElementKeyEvents !== null && e._domElementKeyEvents.removeEventListener("keydown", he); }; - const scope = this; - const STATE = { + const e = this, n = { NONE: -1, ROTATE: 0, DOLLY: 1, @@ -182,681 +37,498 @@ class OrbitControls extends EventDispatcher { TOUCH_DOLLY_PAN: 5, TOUCH_DOLLY_ROTATE: 6 }; - let state = STATE.NONE; - const EPS = 1e-6; - const spherical = new Spherical(); - const sphericalDelta = new Spherical(); - let scale = 1; - const panOffset = new Vector3(); - let zoomChanged = false; - const rotateStart = new Vector2(); - const rotateEnd = new Vector2(); - const rotateDelta = new Vector2(); - const panStart = new Vector2(); - const panEnd = new Vector2(); - const panDelta = new Vector2(); - const dollyStart = new Vector2(); - const dollyEnd = new Vector2(); - const dollyDelta = new Vector2(); - const pointers = []; - const pointerPositions = {}; - function getAutoRotationAngle() { - return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; + let s = n.NONE; + const f = 1e-6, r = new ge(), h = new ge(); + let l = 1; + const g = new I(); + let c = !1; + const p = new O(), y = new O(), b = new O(), A = new O(), d = new O(), w = new O(), m = new O(), P = new O(), R = new O(), u = [], Y = {}; + function j() { + return 2 * Math.PI / 60 / 60 * e.autoRotateSpeed; } - function getZoomScale() { - return Math.pow(0.95, scope.zoomSpeed); + function x() { + return Math.pow(0.95, e.zoomSpeed); } - function rotateLeft(angle) { - sphericalDelta.theta -= angle; + function M(t) { + h.theta -= t; } - function rotateUp(angle) { - sphericalDelta.phi -= angle; + function z(t) { + h.phi -= t; } - const panLeft = function() { - const v = new Vector3(); - return function panLeft2(distance, objectMatrix) { - v.setFromMatrixColumn(objectMatrix, 0); - v.multiplyScalar(-distance); - panOffset.add(v); + const X = function() { + const t = new I(); + return function(E, T) { + t.setFromMatrixColumn(T, 0), t.multiplyScalar(-E), g.add(t); }; - }(); - const panUp = function() { - const v = new Vector3(); - return function panUp2(distance, objectMatrix) { - if (scope.screenSpacePanning === true) { - v.setFromMatrixColumn(objectMatrix, 1); - } else { - v.setFromMatrixColumn(objectMatrix, 0); - v.crossVectors(scope.object.up, v); - } - v.multiplyScalar(distance); - panOffset.add(v); + }(), B = function() { + const t = new I(); + return function(E, T) { + e.screenSpacePanning === !0 ? t.setFromMatrixColumn(T, 1) : (t.setFromMatrixColumn(T, 0), t.crossVectors(e.object.up, t)), t.multiplyScalar(E), g.add(t); }; - }(); - const pan = function() { - const offset = new Vector3(); - return function pan2(deltaX, deltaY) { - const element = scope.domElement; - if (scope.object.isPerspectiveCamera) { - const position = scope.object.position; - offset.copy(position).sub(scope.target); - let targetDistance = offset.length(); - targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180); - panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix); - panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix); - } else if (scope.object.isOrthographicCamera) { - panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix); - panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix); - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."); - scope.enablePan = false; - } + }(), k = function() { + const t = new I(); + return function(E, T) { + const v = e.domElement; + if (e.object.isPerspectiveCamera) { + const U = e.object.position; + t.copy(U).sub(e.target); + let Z = t.length(); + Z *= Math.tan(e.object.fov / 2 * Math.PI / 180), X(2 * E * Z / v.clientHeight, e.object.matrix), B(2 * T * Z / v.clientHeight, e.object.matrix); + } else + e.object.isOrthographicCamera ? (X(E * (e.object.right - e.object.left) / e.object.zoom / v.clientWidth, e.object.matrix), B(T * (e.object.top - e.object.bottom) / e.object.zoom / v.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1); }; }(); - function dollyOut(dollyScale) { - if (scope.object.isPerspectiveCamera) { - scale /= dollyScale; - } else if (scope.object.isOrthographicCamera) { - scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale)); - scope.object.updateProjectionMatrix(); - zoomChanged = true; - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."); - scope.enableZoom = false; - } + function V(t) { + e.object.isPerspectiveCamera ? l /= t : e.object.isOrthographicCamera ? (e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom * t)), e.object.updateProjectionMatrix(), c = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1); } - function dollyIn(dollyScale) { - if (scope.object.isPerspectiveCamera) { - scale *= dollyScale; - } else if (scope.object.isOrthographicCamera) { - scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale)); - scope.object.updateProjectionMatrix(); - zoomChanged = true; - } else { - console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."); - scope.enableZoom = false; - } + function Q(t) { + e.object.isPerspectiveCamera ? l *= t : e.object.isOrthographicCamera ? (e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / t)), e.object.updateProjectionMatrix(), c = !0) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1); } - function handleMouseDownRotate(event) { - rotateStart.set(event.clientX, event.clientY); + function J(t) { + p.set(t.clientX, t.clientY); } - function handleMouseDownDolly(event) { - dollyStart.set(event.clientX, event.clientY); + function Pe(t) { + m.set(t.clientX, t.clientY); } - function handleMouseDownPan(event) { - panStart.set(event.clientX, event.clientY); + function ee(t) { + A.set(t.clientX, t.clientY); } - function handleMouseMoveRotate(event) { - rotateEnd.set(event.clientX, event.clientY); - rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed); - const element = scope.domElement; - rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); - rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight); - rotateStart.copy(rotateEnd); - scope.update(); + function xe(t) { + y.set(t.clientX, t.clientY), b.subVectors(y, p).multiplyScalar(e.rotateSpeed); + const a = e.domElement; + M(2 * Math.PI * b.x / a.clientHeight), z(2 * Math.PI * b.y / a.clientHeight), p.copy(y), e.update(); } - function handleMouseMoveDolly(event) { - dollyEnd.set(event.clientX, event.clientY); - dollyDelta.subVectors(dollyEnd, dollyStart); - if (dollyDelta.y > 0) { - dollyOut(getZoomScale()); - } else if (dollyDelta.y < 0) { - dollyIn(getZoomScale()); - } - dollyStart.copy(dollyEnd); - scope.update(); + function ke(t) { + P.set(t.clientX, t.clientY), R.subVectors(P, m), R.y > 0 ? V(x()) : R.y < 0 && Q(x()), m.copy(P), e.update(); } - function handleMouseMovePan(event) { - panEnd.set(event.clientX, event.clientY); - panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed); - pan(panDelta.x, panDelta.y); - panStart.copy(panEnd); - scope.update(); + function ve(t) { + d.set(t.clientX, t.clientY), w.subVectors(d, A).multiplyScalar(e.panSpeed), k(w.x, w.y), A.copy(d), e.update(); } - function handleMouseWheel(event) { - if (event.deltaY < 0) { - dollyIn(getZoomScale()); - } else if (event.deltaY > 0) { - dollyOut(getZoomScale()); - } - scope.update(); + function Re(t) { + t.deltaY < 0 ? Q(x()) : t.deltaY > 0 && V(x()), e.update(); } - function handleKeyDown(event) { - let needsUpdate = false; - switch (event.code) { - case scope.keys.UP: - pan(0, scope.keyPanSpeed); - needsUpdate = true; + function Oe(t) { + let a = !1; + switch (t.code) { + case e.keys.UP: + t.ctrlKey || t.metaKey || t.shiftKey ? z(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : k(0, e.keyPanSpeed), a = !0; break; - case scope.keys.BOTTOM: - pan(0, -scope.keyPanSpeed); - needsUpdate = true; + case e.keys.BOTTOM: + t.ctrlKey || t.metaKey || t.shiftKey ? z(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : k(0, -e.keyPanSpeed), a = !0; break; - case scope.keys.LEFT: - pan(scope.keyPanSpeed, 0); - needsUpdate = true; + case e.keys.LEFT: + t.ctrlKey || t.metaKey || t.shiftKey ? M(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : k(e.keyPanSpeed, 0), a = !0; break; - case scope.keys.RIGHT: - pan(-scope.keyPanSpeed, 0); - needsUpdate = true; + case e.keys.RIGHT: + t.ctrlKey || t.metaKey || t.shiftKey ? M(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : k(-e.keyPanSpeed, 0), a = !0; break; } - if (needsUpdate) { - event.preventDefault(); - scope.update(); - } + a && (t.preventDefault(), e.update()); } - function handleTouchStartRotate() { - if (pointers.length === 1) { - rotateStart.set(pointers[0].pageX, pointers[0].pageY); - } else { - const x = 0.5 * (pointers[0].pageX + pointers[1].pageX); - const y = 0.5 * (pointers[0].pageY + pointers[1].pageY); - rotateStart.set(x, y); + function te() { + if (u.length === 1) + p.set(u[0].pageX, u[0].pageY); + else { + const t = 0.5 * (u[0].pageX + u[1].pageX), a = 0.5 * (u[0].pageY + u[1].pageY); + p.set(t, a); } } - function handleTouchStartPan() { - if (pointers.length === 1) { - panStart.set(pointers[0].pageX, pointers[0].pageY); - } else { - const x = 0.5 * (pointers[0].pageX + pointers[1].pageX); - const y = 0.5 * (pointers[0].pageY + pointers[1].pageY); - panStart.set(x, y); + function oe() { + if (u.length === 1) + A.set(u[0].pageX, u[0].pageY); + else { + const t = 0.5 * (u[0].pageX + u[1].pageX), a = 0.5 * (u[0].pageY + u[1].pageY); + A.set(t, a); } } - function handleTouchStartDolly() { - const dx = pointers[0].pageX - pointers[1].pageX; - const dy = pointers[0].pageY - pointers[1].pageY; - const distance = Math.sqrt(dx * dx + dy * dy); - dollyStart.set(0, distance); + function ie() { + const t = u[0].pageX - u[1].pageX, a = u[0].pageY - u[1].pageY, E = Math.sqrt(t * t + a * a); + m.set(0, E); } - function handleTouchStartDollyPan() { - if (scope.enableZoom) - handleTouchStartDolly(); - if (scope.enablePan) - handleTouchStartPan(); + function Se() { + e.enableZoom && ie(), e.enablePan && oe(); } - function handleTouchStartDollyRotate() { - if (scope.enableZoom) - handleTouchStartDolly(); - if (scope.enableRotate) - handleTouchStartRotate(); + function Le() { + e.enableZoom && ie(), e.enableRotate && te(); } - function handleTouchMoveRotate(event) { - if (pointers.length == 1) { - rotateEnd.set(event.pageX, event.pageY); - } else { - const position = getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - rotateEnd.set(x, y); + function ne(t) { + if (u.length == 1) + y.set(t.pageX, t.pageY); + else { + const E = W(t), T = 0.5 * (t.pageX + E.x), v = 0.5 * (t.pageY + E.y); + y.set(T, v); } - rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed); - const element = scope.domElement; - rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); - rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight); - rotateStart.copy(rotateEnd); + b.subVectors(y, p).multiplyScalar(e.rotateSpeed); + const a = e.domElement; + M(2 * Math.PI * b.x / a.clientHeight), z(2 * Math.PI * b.y / a.clientHeight), p.copy(y); } - function handleTouchMovePan(event) { - if (pointers.length === 1) { - panEnd.set(event.pageX, event.pageY); - } else { - const position = getSecondPointerPosition(event); - const x = 0.5 * (event.pageX + position.x); - const y = 0.5 * (event.pageY + position.y); - panEnd.set(x, y); + function se(t) { + if (u.length === 1) + d.set(t.pageX, t.pageY); + else { + const a = W(t), E = 0.5 * (t.pageX + a.x), T = 0.5 * (t.pageY + a.y); + d.set(E, T); } - panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed); - pan(panDelta.x, panDelta.y); - panStart.copy(panEnd); + w.subVectors(d, A).multiplyScalar(e.panSpeed), k(w.x, w.y), A.copy(d); } - function handleTouchMoveDolly(event) { - const position = getSecondPointerPosition(event); - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - const distance = Math.sqrt(dx * dx + dy * dy); - dollyEnd.set(0, distance); - dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed)); - dollyOut(dollyDelta.y); - dollyStart.copy(dollyEnd); + function re(t) { + const a = W(t), E = t.pageX - a.x, T = t.pageY - a.y, v = Math.sqrt(E * E + T * T); + P.set(0, v), R.set(0, Math.pow(P.y / m.y, e.zoomSpeed)), V(R.y), m.copy(P); } - function handleTouchMoveDollyPan(event) { - if (scope.enableZoom) - handleTouchMoveDolly(event); - if (scope.enablePan) - handleTouchMovePan(event); + function Ne(t) { + e.enableZoom && re(t), e.enablePan && se(t); } - function handleTouchMoveDollyRotate(event) { - if (scope.enableZoom) - handleTouchMoveDolly(event); - if (scope.enableRotate) - handleTouchMoveRotate(event); + function je(t) { + e.enableZoom && re(t), e.enableRotate && ne(t); } - function onPointerDown(event) { - if (scope.enabled === false) - return; - if (pointers.length === 0) { - scope.domElement.setPointerCapture(event.pointerId); - scope.domElement.addEventListener("pointermove", onPointerMove); - scope.domElement.addEventListener("pointerup", onPointerUp); - } - addPointer(event); - if (event.pointerType === "touch") { - onTouchStart(event); - } else { - onMouseDown(event); - } + function ae(t) { + e.enabled !== !1 && (u.length === 0 && (e.domElement.setPointerCapture(t.pointerId), e.domElement.addEventListener("pointermove", q), e.domElement.addEventListener("pointerup", C)), Ue(t), t.pointerType === "touch" ? Ye(t) : Ie(t)); } - function onPointerMove(event) { - if (scope.enabled === false) - return; - if (event.pointerType === "touch") { - onTouchMove(event); - } else { - onMouseMove(event); - } + function q(t) { + e.enabled !== !1 && (t.pointerType === "touch" ? ze(t) : _e(t)); } - function onPointerUp(event) { - removePointer(event); - if (pointers.length === 0) { - scope.domElement.releasePointerCapture(event.pointerId); - scope.domElement.removeEventListener("pointermove", onPointerMove); - scope.domElement.removeEventListener("pointerup", onPointerUp); - } - scope.dispatchEvent(_endEvent); - state = STATE.NONE; + function C(t) { + de(t), u.length === 0 && (e.domElement.releasePointerCapture(t.pointerId), e.domElement.removeEventListener("pointermove", q), e.domElement.removeEventListener("pointerup", C)), e.dispatchEvent(Ee), s = n.NONE; } - function onPointerCancel(event) { - removePointer(event); + function ce(t) { + de(t); } - function onMouseDown(event) { - let mouseAction; - switch (event.button) { + function Ie(t) { + let a; + switch (t.button) { case 0: - mouseAction = scope.mouseButtons.LEFT; + a = e.mouseButtons.LEFT; break; case 1: - mouseAction = scope.mouseButtons.MIDDLE; + a = e.mouseButtons.MIDDLE; break; case 2: - mouseAction = scope.mouseButtons.RIGHT; + a = e.mouseButtons.RIGHT; break; default: - mouseAction = -1; + a = -1; } - switch (mouseAction) { - case MOUSE.DOLLY: - if (scope.enableZoom === false) + switch (a) { + case F.DOLLY: + if (e.enableZoom === !1) return; - handleMouseDownDolly(event); - state = STATE.DOLLY; + Pe(t), s = n.DOLLY; break; - case MOUSE.ROTATE: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - if (scope.enablePan === false) + case F.ROTATE: + if (t.ctrlKey || t.metaKey || t.shiftKey) { + if (e.enablePan === !1) return; - handleMouseDownPan(event); - state = STATE.PAN; + ee(t), s = n.PAN; } else { - if (scope.enableRotate === false) + if (e.enableRotate === !1) return; - handleMouseDownRotate(event); - state = STATE.ROTATE; + J(t), s = n.ROTATE; } break; - case MOUSE.PAN: - if (event.ctrlKey || event.metaKey || event.shiftKey) { - if (scope.enableRotate === false) + case F.PAN: + if (t.ctrlKey || t.metaKey || t.shiftKey) { + if (e.enableRotate === !1) return; - handleMouseDownRotate(event); - state = STATE.ROTATE; + J(t), s = n.ROTATE; } else { - if (scope.enablePan === false) + if (e.enablePan === !1) return; - handleMouseDownPan(event); - state = STATE.PAN; + ee(t), s = n.PAN; } break; default: - state = STATE.NONE; - } - if (state !== STATE.NONE) { - scope.dispatchEvent(_startEvent); + s = n.NONE; } + s !== n.NONE && e.dispatchEvent($); } - function onMouseMove(event) { - if (scope.enabled === false) - return; - switch (state) { - case STATE.ROTATE: - if (scope.enableRotate === false) + function _e(t) { + switch (s) { + case n.ROTATE: + if (e.enableRotate === !1) return; - handleMouseMoveRotate(event); + xe(t); break; - case STATE.DOLLY: - if (scope.enableZoom === false) + case n.DOLLY: + if (e.enableZoom === !1) return; - handleMouseMoveDolly(event); + ke(t); break; - case STATE.PAN: - if (scope.enablePan === false) + case n.PAN: + if (e.enablePan === !1) return; - handleMouseMovePan(event); + ve(t); break; } } - function onMouseWheel(event) { - if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) - return; - event.preventDefault(); - scope.dispatchEvent(_startEvent); - handleMouseWheel(event); - scope.dispatchEvent(_endEvent); + function le(t) { + e.enabled === !1 || e.enableZoom === !1 || s !== n.NONE || (t.preventDefault(), e.dispatchEvent($), Re(t), e.dispatchEvent(Ee)); } - function onKeyDown(event) { - if (scope.enabled === false || scope.enablePan === false) - return; - handleKeyDown(event); + function he(t) { + e.enabled === !1 || e.enablePan === !1 || Oe(t); } - function onTouchStart(event) { - trackPointer(event); - switch (pointers.length) { + function Ye(t) { + switch (pe(t), u.length) { case 1: - switch (scope.touches.ONE) { - case TOUCH.ROTATE: - if (scope.enableRotate === false) + switch (e.touches.ONE) { + case D.ROTATE: + if (e.enableRotate === !1) return; - handleTouchStartRotate(); - state = STATE.TOUCH_ROTATE; + te(), s = n.TOUCH_ROTATE; break; - case TOUCH.PAN: - if (scope.enablePan === false) + case D.PAN: + if (e.enablePan === !1) return; - handleTouchStartPan(); - state = STATE.TOUCH_PAN; + oe(), s = n.TOUCH_PAN; break; default: - state = STATE.NONE; + s = n.NONE; } break; case 2: - switch (scope.touches.TWO) { - case TOUCH.DOLLY_PAN: - if (scope.enableZoom === false && scope.enablePan === false) + switch (e.touches.TWO) { + case D.DOLLY_PAN: + if (e.enableZoom === !1 && e.enablePan === !1) return; - handleTouchStartDollyPan(); - state = STATE.TOUCH_DOLLY_PAN; + Se(), s = n.TOUCH_DOLLY_PAN; break; - case TOUCH.DOLLY_ROTATE: - if (scope.enableZoom === false && scope.enableRotate === false) + case D.DOLLY_ROTATE: + if (e.enableZoom === !1 && e.enableRotate === !1) return; - handleTouchStartDollyRotate(); - state = STATE.TOUCH_DOLLY_ROTATE; + Le(), s = n.TOUCH_DOLLY_ROTATE; break; default: - state = STATE.NONE; + s = n.NONE; } break; default: - state = STATE.NONE; - } - if (state !== STATE.NONE) { - scope.dispatchEvent(_startEvent); + s = n.NONE; } + s !== n.NONE && e.dispatchEvent($); } - function onTouchMove(event) { - trackPointer(event); - switch (state) { - case STATE.TOUCH_ROTATE: - if (scope.enableRotate === false) + function ze(t) { + switch (pe(t), s) { + case n.TOUCH_ROTATE: + if (e.enableRotate === !1) return; - handleTouchMoveRotate(event); - scope.update(); + ne(t), e.update(); break; - case STATE.TOUCH_PAN: - if (scope.enablePan === false) + case n.TOUCH_PAN: + if (e.enablePan === !1) return; - handleTouchMovePan(event); - scope.update(); + se(t), e.update(); break; - case STATE.TOUCH_DOLLY_PAN: - if (scope.enableZoom === false && scope.enablePan === false) + case n.TOUCH_DOLLY_PAN: + if (e.enableZoom === !1 && e.enablePan === !1) return; - handleTouchMoveDollyPan(event); - scope.update(); + Ne(t), e.update(); break; - case STATE.TOUCH_DOLLY_ROTATE: - if (scope.enableZoom === false && scope.enableRotate === false) + case n.TOUCH_DOLLY_ROTATE: + if (e.enableZoom === !1 && e.enableRotate === !1) return; - handleTouchMoveDollyRotate(event); - scope.update(); + je(t), e.update(); break; default: - state = STATE.NONE; + s = n.NONE; } } - function onContextMenu(event) { - if (scope.enabled === false) - return; - event.preventDefault(); + function ue(t) { + e.enabled !== !1 && t.preventDefault(); } - function addPointer(event) { - pointers.push(event); + function Ue(t) { + u.push(t); } - function removePointer(event) { - delete pointerPositions[event.pointerId]; - for (let i = 0; i < pointers.length; i++) { - if (pointers[i].pointerId == event.pointerId) { - pointers.splice(i, 1); + function de(t) { + delete Y[t.pointerId]; + for (let a = 0; a < u.length; a++) + if (u[a].pointerId == t.pointerId) { + u.splice(a, 1); return; } - } } - function trackPointer(event) { - let position = pointerPositions[event.pointerId]; - if (position === void 0) { - position = new Vector2(); - pointerPositions[event.pointerId] = position; - } - position.set(event.pageX, event.pageY); + function pe(t) { + let a = Y[t.pointerId]; + a === void 0 && (a = new O(), Y[t.pointerId] = a), a.set(t.pageX, t.pageY); } - function getSecondPointerPosition(event) { - const pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0]; - return pointerPositions[pointer.pointerId]; + function W(t) { + const a = t.pointerId === u[0].pointerId ? u[1] : u[0]; + return Y[a.pointerId]; } - scope.domElement.addEventListener("contextmenu", onContextMenu); - scope.domElement.addEventListener("pointerdown", onPointerDown); - scope.domElement.addEventListener("pointercancel", onPointerCancel); - scope.domElement.addEventListener("wheel", onMouseWheel, { passive: false }); - this.update(); + e.domElement.addEventListener("contextmenu", ue), e.domElement.addEventListener("pointerdown", ae), e.domElement.addEventListener("pointercancel", ce), e.domElement.addEventListener("wheel", le, { passive: !1 }), this.update(); } } -class AnimationEffect { - constructor(animation, timestampObj) { - this.animation = animation; - this.currentEffectIndex = 0; - this.tickingEffects = []; - this.effects = Object.entries(timestampObj).map(([time, timestampEntry]) => [ - Number(time), - Array.isArray(timestampEntry) ? timestampEntry : [timestampEntry] - ]).sort(([a], [b]) => a - b); +class Me { + constructor(o, i) { + this.animation = o, this.currentEffectIndex = 0, this.tickingEffects = [], this.effects = Object.entries(i).map( + ([e, n]) => [ + Number(e), + Array.isArray(n) ? n : [n] + ] + ).sort(([e], [n]) => e - n); } getCurrentEffects() { if (this.currentEffectIndex >= this.effects.length) return; - const currentEffect = this.effects[this.currentEffectIndex]; - if (currentEffect[0] > this.animation.roundedCurrentTime) - return; - this.currentEffectIndex++; - return currentEffect[1]; + const o = this.effects[this.currentEffectIndex]; + if (!(o[0] > this.animation.roundedCurrentTime)) + return this.currentEffectIndex++, o[1]; } reset() { this.currentEffectIndex = 0; } } -class SoundEffect extends AnimationEffect { +class st extends Me { tick() { - var _a; - const timestampEntry = (_a = super.getCurrentEffects()) != null ? _a : []; - if (timestampEntry.length > 0) - console.log(`Playing sound effects: "${timestampEntry.map((entry) => entry.effect).join(", ")}"`); + const o = super.getCurrentEffects() ?? []; + o.length > 0 && console.log( + `Playing sound effects: "${o.map((i) => i.effect).join(", ")}"` + ); } } -class ParticleEffect extends AnimationEffect { +class rt extends Me { constructor() { - super(...arguments); - this.disposables = []; + super(...arguments), this.disposables = []; } tick() { - var _a; - this.tickingEffects.forEach((effect) => effect.tick()); - const currentEffects = (_a = super.getCurrentEffects()) != null ? _a : []; - for (const { locator, effect, pre_effect_script } of currentEffects) { - if (!effect) + this.tickingEffects.forEach((i) => i.tick()); + const o = super.getCurrentEffects() ?? []; + for (const { locator: i, effect: e, pre_effect_script: n } of o) { + if (!e) return; - const animator = this.animation.getAnimator(); - const model = animator.getModel(); - const emitterConfig = animator.getEmitter(effect); - if (!emitterConfig || !animator.winterskyScene) + const s = this.animation.getAnimator(), f = s.getModel(), r = s.getEmitter(e); + if (!r || !s.winterskyScene) return; - const locatorGroup = locator ? model.getLocator(locator) : void 0; - const emitter = new Wintersky.Emitter(animator.winterskyScene, emitterConfig, { - parent_mode: locatorGroup ? "locator" : "entity", - loop_mode: "once" - }); - if (locatorGroup) { - locatorGroup.add(emitter.local_space); - emitter.local_space.parent = locatorGroup; - } - const tickable = { + const h = i ? f.getLocator(i) : void 0, l = new it.Emitter( + s.winterskyScene, + r, + { + parent_mode: h ? "locator" : "entity", + loop_mode: "once" + } + ); + h && (h.add(l.local_space), l.local_space.parent = h); + const g = { tick: () => { - emitter.tick(); - if (!emitter.enabled) { - emitter.delete(); - this.tickingEffects = this.tickingEffects.filter((current) => current !== tickable); - } + l.tick(), l.enabled || (l.delete(), this.tickingEffects = this.tickingEffects.filter( + (c) => c !== g + )); } }; - this.tickingEffects.push(tickable); - this.disposables.push({ + this.tickingEffects.push(g), this.disposables.push({ dispose: () => { - emitter.delete(); - this.tickingEffects = this.tickingEffects.filter((current) => current !== tickable); + l.delete(), this.tickingEffects = this.tickingEffects.filter( + (c) => c !== g + ); } - }); - emitter.start(); - emitter.tick(); + }), l.start(), l.tick(); } } dispose() { - this.disposables.forEach((disposable) => disposable.dispose()); - this.disposables = []; + this.disposables.forEach((o) => o.dispose()), this.disposables = []; } } -class Animation { - constructor(animator, animationData) { - var _a, _b; - this.animator = animator; - this.animationData = animationData; - this.startTimestamp = 0; - this.lastFrameTimestamp = 0; - this.isRunning = false; - this.env = { +class at { + constructor(o, i) { + this.animator = o, this.animationData = i, this.startTimestamp = 0, this.lastFrameTimestamp = 0, this.isRunning = !1, this.env = { "query.anim_time": () => this.currentTime, "query.delta_time": () => this.startTimestamp - this.lastFrameTimestamp, "query.life_time": () => this.currentTime - }; - this.molang = new MoLang(this.env, { - convertUndefined: true - }); - this.soundEffects = new SoundEffect(this, (_a = this.animationData.sound_effects) != null ? _a : {}); - this.particleEffects = new ParticleEffect(this, (_b = this.animationData.particle_effects) != null ? _b : {}); + }, this.molang = new ot(this.env, { + convertUndefined: !0 + }), this.soundEffects = new st( + this, + this.animationData.sound_effects ?? {} + ), this.particleEffects = new rt( + this, + this.animationData.particle_effects ?? {} + ); } getAnimator() { return this.animator; } - execute(expr) { - return this.molang.executeAndCatch(expr); - } - parseBoneModifier(transform) { - if (typeof transform === "number") { - return [transform, transform, transform]; - } else if (typeof transform === "string") { - const res = typeof transform === "string" ? this.execute(transform) : transform; - return [res, res, res]; - } else if (Array.isArray(transform)) { - return transform.map((t) => typeof t === "string" ? this.execute(t) : t); - } else if (transform !== void 0) { - const timestamps = Object.entries(transform).map(([time, transform2]) => [Number(time), transform2]).sort(([a], [b]) => a - b); - for (let i = timestamps.length - 1; i >= 0; i--) { - let [time, transform2] = timestamps[i]; - if (time > this.currentTime) { - continue; - } else if (time === this.currentTime) { - if (Array.isArray(transform2)) { - return transform2.map((t) => typeof t === "string" ? this.execute(t) : t); - } else { - throw new Error("Format not supported yet"); - } - } else { - let [nextTime, nextTransform] = timestamps[MathUtils.euclideanModulo(i + 1, timestamps.length)]; - let timeDelta = nextTime - time; - if (Array.isArray(transform2) && Array.isArray(nextTransform)) { - transform2 = transform2.map((t) => typeof t === "string" ? this.execute(t) : t); - nextTransform = nextTransform.map((t) => typeof t === "string" ? this.execute(t) : t); - return transform2.map((n, i2) => n + (nextTransform[i2] - n) / timeDelta * (this.currentTime - time)); - } else { - throw new Error("Format not supported yet"); - } + execute(o) { + return this.molang.executeAndCatch(o); + } + parseBoneModifier(o) { + if (typeof o == "number") + return [o, o, o]; + if (typeof o == "string") { + const i = typeof o == "string" ? this.execute(o) : o; + return [i, i, i]; + } else { + if (Array.isArray(o)) + return o.map( + (i) => typeof i == "string" ? this.execute(i) : i + ); + if (o !== void 0) { + const i = Object.entries(o).map( + ([e, n]) => [Number(e), n] + ).sort(([e], [n]) => e - n); + for (let e = i.length - 1; e >= 0; e--) { + let [n, s] = i[e]; + if (!(n > this.currentTime)) + if (n === this.currentTime) { + if (Array.isArray(s)) + return s.map( + (f) => typeof f == "string" ? this.execute(f) : f + ); + throw new Error("Format not supported yet"); + } else { + let [f, r] = i[_.euclideanModulo(e + 1, i.length)], h = f - n; + if (Array.isArray(s) && Array.isArray(r)) + return s = s.map( + (l) => typeof l == "string" ? this.execute(l) : l + ), r = r.map( + (l) => typeof l == "string" ? this.execute(l) : l + ), s.map( + (l, g) => l + (r[g] - l) / h * (this.currentTime - n) + ); + throw new Error("Format not supported yet"); + } } + return [0, 0, 0]; } - return [0, 0, 0]; } } tick() { - this.soundEffects.tick(); - this.particleEffects.tick(); - const boneMap = this.animator.getModel().getBoneMap(); - for (let boneName in this.animationData.bones) { - const bone = boneMap.get(boneName); - if (!bone) + this.soundEffects.tick(), this.particleEffects.tick(); + const o = this.animator.getModel().getBoneMap(); + for (let i in this.animationData.bones) { + const e = o.get(i); + if (!e) continue; - const { position, rotation, scale } = this.animationData.bones[boneName]; - const [positionMod, rotationMod, scaleMod] = [ - position, - rotation, - scale - ].map((mod) => this.parseBoneModifier(mod)); - if (positionMod) { - const currentPosition = bone.position.toArray(); - bone.position.set(...positionMod.map((val, i) => (i === 0 ? -1 : 1) * val + currentPosition[i])); + const { position: n, rotation: s, scale: f } = this.animationData.bones[i], [r, h, l] = [ + n, + s, + f + ].map((g) => this.parseBoneModifier(g)); + if (r) { + const g = e.position.toArray(); + e.position.set( + ...r.map( + (c, p) => (p === 0 ? -1 : 1) * c + g[p] + ) + ); } - if (rotationMod) { - const currentRotation = bone.rotation.toArray(); - bone.rotation.set(...rotationMod.map((n) => MathUtils.degToRad(n)).map((val, i) => currentRotation[i] + (i === 2 ? val : -val))); + if (h) { + const g = e.rotation.toArray(); + e.rotation.set( + ...h.map((c) => _.degToRad(c)).map( + (c, p) => g[p] + (p === 2 ? c : -c) + ) + ); } - if (scaleMod) - bone.scale.set(...scaleMod); + l && e.scale.set(...l); } - if (this.currentTime > this.animationData.animation_length) { - if (this.animationData.loop) - this.loop(); - else - this.pause(); - } - this.lastFrameTimestamp = Date.now(); + this.currentTime > this.animationData.animation_length && (this.animationData.loop ? this.loop() : this.pause()), this.lastFrameTimestamp = Date.now(); } play() { - this.isRunning = true; - this.startTimestamp = Date.now(); + this.isRunning = !0, this.startTimestamp = Date.now(); } pause() { - this.isRunning = false; + this.isRunning = !1; } loop() { - this.startTimestamp = Date.now(); - this.soundEffects.reset(); - this.particleEffects.reset(); + this.startTimestamp = Date.now(), this.soundEffects.reset(), this.particleEffects.reset(); } dispose() { this.particleEffects.dispose(); @@ -871,73 +543,88 @@ class Animation { return this.isRunning; } } -class Animator { - constructor(model) { - this.model = model; - this.animations = new Map(); - this.particleEmitters = new Map(); +class ct { + constructor(o) { + this.model = o, this.animations = /* @__PURE__ */ new Map(), this.particleEmitters = /* @__PURE__ */ new Map(); } setupDefaultBonePoses() { - for (let bone of this.model.getBoneMap().values()) { - bone.userData.defaultRotation = bone.rotation.toArray(); - bone.userData.defaultPosition = bone.position.toArray(); - } + for (let o of this.model.getBoneMap().values()) + o.userData.defaultRotation = o.rotation.toArray(), o.userData.defaultPosition = o.position.toArray(); } dispose() { this.disposeAnimations(); - for (let bone of this.model.getBoneMap().values()) { - delete bone.userData.defaultRotation; - delete bone.userData.defaultPosition; - } + for (let o of this.model.getBoneMap().values()) + delete o.userData.defaultRotation, delete o.userData.defaultPosition; } disposeAnimations() { - this.animations.forEach((anim) => anim.dispose()); + this.animations.forEach((o) => o.dispose()); } - setupWintersky(winterskyScene) { - this.winterskyScene = winterskyScene; + setupWintersky(o) { + this.winterskyScene = o; } - addAnimation(id, animationData) { - this.animations.set(id, new Animation(this, animationData)); + addAnimation(o, i) { + this.animations.set(o, new at(this, i)); } - addEmitter(shortName, emitterConfig) { - this.particleEmitters.set(shortName, emitterConfig); + addEmitter(o, i) { + this.particleEmitters.set(o, i); } - getEmitter(shortName) { - return this.particleEmitters.get(shortName); + getEmitter(o) { + return this.particleEmitters.get(o); } - play(id) { - const animation = this.animations.get(id); - if (!animation) - throw new Error(`Unknown animation: "${id}"`); - animation.play(); + play(o) { + const i = this.animations.get(o); + if (!i) + throw new Error(`Unknown animation: "${o}"`); + i.play(); } - pause(id) { - const animation = this.animations.get(id); - if (!animation) - throw new Error(`Unknown animation: "${id}"`); - animation.pause(); + pause(o) { + const i = this.animations.get(o); + if (!i) + throw new Error(`Unknown animation: "${o}"`); + i.pause(); } pauseAll() { - for (const animation of this.animations.values()) { - animation.pause(); - } + for (const o of this.animations.values()) + o.pause(); } tick() { - for (let bone of this.model.getBoneMap().values()) { - bone.rotation.set(...bone.userData.defaultRotation); - bone.position.set(...bone.userData.defaultPosition); - } - this.animations.forEach((animation) => animation.shouldTick && animation.tick()); + for (let o of this.model.getBoneMap().values()) + o.rotation.set( + ...o.userData.defaultRotation + ), o.position.set( + ...o.userData.defaultPosition + ); + this.animations.forEach( + (o) => o.shouldTick && o.tick() + ); } get shouldTick() { - return [...this.animations.values()].some((animation) => animation.shouldTick); + return [...this.animations.values()].some( + (o) => o.shouldTick + ); } getModel() { return this.model; } } -const CubeFaces = [ +const lt = [ + // Right { + /** + * Position of the texture for this specific cube + * + * baseUV[0] <-> X | baseUV[1] <-> Y + * + * How baseUV maps to a Minecraft cube texture: + * @example + * | X | 0 | 1 | 2 | 3 | + * ----------------------- + * Y | | | | | | + * ----------------------- + * 0 | | | X | X | | + * ----------------------- + * 1 | | X | X | X | X | + */ name: "west", baseUV: [2, 1], dir: [-1, 0, 0], @@ -948,6 +635,7 @@ const CubeFaces = [ { pos: [-0.5, 0, 1], uv: [1, 0] } ] }, + // Left { name: "east", baseUV: [0, 1], @@ -959,6 +647,7 @@ const CubeFaces = [ { pos: [0.5, 0, 0], uv: [1, 0] } ] }, + // Bottom { name: "down", baseUV: [2, 0], @@ -970,6 +659,7 @@ const CubeFaces = [ { pos: [-0.5, 0, 0], uv: [1, 0] } ] }, + // Top { name: "up", baseUV: [1, 0], @@ -981,6 +671,7 @@ const CubeFaces = [ { pos: [0.5, 1, 0], uv: [0, 0] } ] }, + //Front { name: "north", baseUV: [1, 1], @@ -992,6 +683,7 @@ const CubeFaces = [ { pos: [0.5, 1, 0], uv: [0, 1] } ] }, + //Back { name: "south", baseUV: [3, 1], @@ -1003,266 +695,239 @@ const CubeFaces = [ { pos: [0.5, 1, 1], uv: [1, 1] } ] } -]; -const ReduceUvConst = 0.03; -class Cube { - constructor(cubeConfig) { - var _a, _b, _c; - this.positions = []; - this.indices = []; - this.normals = []; - this.uvs = []; - this.geometry = new BufferGeometry(); - this.group = new Group(); +], K = 0.03; +class ht { + constructor(o) { + var d, w; + this.positions = [], this.indices = [], this.normals = [], this.uvs = [], this.geometry = new Te(), this.group = new H(); const { - textureSize: [tW, tH], + textureSize: [i, e], textureDiscrepancyFactor: [ - textureDiscrepancyW, - textureDiscrepancyH + n, + s ], - mirror, - width, - height, - depth - } = cubeConfig; - const [realTextureW, realTextureH] = [ - tW * textureDiscrepancyW, - tH * textureDiscrepancyH - ]; - const startUV = (_a = cubeConfig.startUV) != null ? _a : [0, 0]; - const usesUVObj = !Array.isArray(startUV); - let uvX = 0, uvY = 0; - if (!usesUVObj) - [uvX, uvY] = startUV; + mirror: f, + width: r, + height: h, + depth: l + } = o, [g, c] = [ + i * n, + e * s + ], p = o.startUV ?? [0, 0], y = !Array.isArray(p); + let b = 0, A = 0; + y || ([b, A] = p); for (let { - name, - dir, - corners, - baseUV: [baseUVX, baseUVY] - } of CubeFaces) { - const ndx = this.positions.length / 3; - let uvSizeX, uvSizeY; - if (usesUVObj) { - if (startUV[name] === void 0) + name: m, + dir: P, + corners: R, + baseUV: [u, Y] + } of lt) { + const j = this.positions.length / 3; + let x, M; + if (y) { + if (p[m] === void 0) continue; - [uvX, uvY] = ((_b = startUV[name]) == null ? void 0 : _b.uv) || []; - [uvSizeX, uvSizeY] = ((_c = startUV[name]) == null ? void 0 : _c.uv_size) || []; - uvSizeX *= textureDiscrepancyW; - uvSizeY *= textureDiscrepancyH; - uvX *= textureDiscrepancyW; - uvY *= textureDiscrepancyH; - baseUVX = 0; - baseUVY = 0; + [b, A] = ((d = p[m]) == null ? void 0 : d.uv) || [], [x, M] = ((w = p[m]) == null ? void 0 : w.uv_size) || [], x *= n, M *= s, b *= n, A *= s, u = 0, Y = 0; } for (const { - pos: [oX, oY, oZ], - uv - } of corners) { - this.positions.push((mirror ? -oX : oX) * width, oY * height, oZ * depth); - this.normals.push(...dir); - this.uvs.push((uvX + (Number(baseUVX > 0) + Number(baseUVX > 2)) * Math.floor(uvSizeX != null ? uvSizeX : depth) + Number(baseUVX > 1) * Math.floor(uvSizeX != null ? uvSizeX : width) + uv[0] * (name === "west" || name === "east" ? Math.floor(uvSizeX != null ? uvSizeX : depth) : Math.floor(uvSizeX != null ? uvSizeX : width)) + (uv[0] === 0 ? ReduceUvConst : -ReduceUvConst)) / (realTextureW / (!usesUVObj ? textureDiscrepancyW : 1)), 1 - (uvY + baseUVY * Math.floor(uvSizeY != null ? uvSizeY : depth) + (name === "up" || name === "down" ? Math.floor(uvSizeY != null ? uvSizeY : depth) : Math.floor(uvSizeY != null ? uvSizeY : height)) - uv[1] * (name === "up" || name === "down" ? Math.floor(uvSizeY != null ? uvSizeY : depth) : Math.floor(uvSizeY != null ? uvSizeY : height)) + (uv[1] === 0 ? -ReduceUvConst : ReduceUvConst)) / (realTextureH / (!usesUVObj ? textureDiscrepancyH : 1))); - } - this.indices.push(ndx, ndx + 1, ndx + 2, ndx + 2, ndx + 1, ndx + 3); + pos: [z, X, B], + uv: k + } of R) + this.positions.push( + (f ? -z : z) * r, + X * h, + B * l + ), this.normals.push(...P), this.uvs.push( + //Base offset of the current cube + (b + //Horizontal offset for the current face + (+(u > 0) + +(u > 2)) * Math.floor(x ?? l) + +(u > 1) * Math.floor(x ?? r) + //Face corner specific offsets + k[0] * Math.floor(m === "west" || m === "east" ? x ?? l : x ?? r) + (k[0] === 0 ? K : -K)) / (g / (y ? 1 : n)), + //Align uv to top left corner + 1 - //Base offset of the current cube + (A + //Vertical offset for the current face + Y * Math.floor(M ?? l) + Math.floor(m === "up" || m === "down" ? M ?? l : M ?? h) - //Face corner specific offsets + k[1] * Math.floor(m === "up" || m === "down" ? M ?? l : M ?? h) + (k[1] === 0 ? -K : K)) / (c / (y ? 1 : s)) + ); + this.indices.push(j, j + 1, j + 2, j + 2, j + 1, j + 3); } - this.createGeometry(); - this.createMesh(cubeConfig); + this.createGeometry(), this.createMesh(o); } createGeometry() { - this.geometry.setAttribute("position", new BufferAttribute(new Float32Array(this.positions), 3)); - this.geometry.setAttribute("normal", new BufferAttribute(new Float32Array(this.normals), 3)); - this.geometry.setAttribute("uv", new BufferAttribute(new Float32Array(this.uvs), 2)); - this.geometry.setIndex(this.indices); + this.geometry.setAttribute( + "position", + new G(new Float32Array(this.positions), 3) + ), this.geometry.setAttribute( + "normal", + new G(new Float32Array(this.normals), 3) + ), this.geometry.setAttribute( + "uv", + new G(new Float32Array(this.uvs), 2) + ), this.geometry.setIndex(this.indices); } createMesh({ - material, - width, - height, - depth, - pivot, - rotation, - origin, - inflate = 0 + material: o, + width: i, + height: e, + depth: n, + pivot: s, + rotation: f, + origin: r, + inflate: h = 0 }) { - const calculatedWidth = inflate * 2 + width; - const mesh = new Mesh(this.geometry, material); - this.group.rotation.order = "ZYX"; - if (pivot === void 0) - pivot = [calculatedWidth / 2, height / 2, depth / 2]; - this.group.add(mesh); - if (rotation) { - this.group.position.set(-pivot[0], pivot[1], pivot[2]); - mesh.position.set(-origin[0] - calculatedWidth / 2 + pivot[0] + inflate, origin[1] - pivot[1] - inflate, origin[2] - pivot[2] - inflate); - const [rX, rY, rZ] = rotation; - this.group.rotation.set(MathUtils.degToRad(-rX), MathUtils.degToRad(-rY), MathUtils.degToRad(rZ)); - } else { - this.group.position.set(-origin[0] - calculatedWidth / 2 + inflate, origin[1] - inflate, origin[2] - inflate); - } - if (inflate) - this.group.scale.set(width !== 0 ? 1 + inflate / (width / 2) : 1, height !== 0 ? 1 + inflate / (height / 2) : 1, depth !== 0 ? 1 + inflate / (depth / 2) : 1); + const l = h * 2 + i, g = new Ae(this.geometry, o); + if (this.group.rotation.order = "ZYX", s === void 0 && (s = [l / 2, e / 2, n / 2]), this.group.add(g), f) { + this.group.position.set(-s[0], s[1], s[2]), g.position.set( + -r[0] - l / 2 + s[0] + h, + r[1] - s[1] - h, + r[2] - s[2] - h + ); + const [c, p, y] = f; + this.group.rotation.set( + _.degToRad(-c), + _.degToRad(-p), + _.degToRad(y) + ); + } else + this.group.position.set( + -r[0] - l / 2 + h, + r[1] - h, + r[2] - h + ); + h && this.group.scale.set( + i !== 0 ? 1 + h / (i / 2) : 1, + e !== 0 ? 1 + h / (e / 2) : 1, + n !== 0 ? 1 + h / (n / 2) : 1 + ); } getGroup() { return this.group; } } -class PolyMesh { - constructor(polyMeshConfig) { - var _a, _b, _c, _d, _e, _f, _g; - this.positions = []; - this.indices = []; - this.normals = []; - this.uvs = []; - this.geometry = new BufferGeometry(); - this.group = new Group(); - if (!Array.isArray(polyMeshConfig.polys)) +class ut { + constructor(o) { + var e, n, s, f; + if (this.positions = [], this.indices = [], this.normals = [], this.uvs = [], this.geometry = new Te(), this.group = new H(), !Array.isArray(o.polys)) throw new Error("Format not supported yet!"); - if (!polyMeshConfig.normalized_uvs) - polyMeshConfig.uvs = (_a = polyMeshConfig == null ? void 0 : polyMeshConfig.uvs) == null ? void 0 : _a.map(([uvX, uvY]) => [ - uvX / polyMeshConfig.textureSize[0], - uvY / polyMeshConfig.textureSize[1] - ]); + o.normalized_uvs || (o.uvs = (e = o == null ? void 0 : o.uvs) == null ? void 0 : e.map(([r, h]) => [ + r / o.textureSize[0], + h / o.textureSize[1] + ])); let i = 0; - for (const face of polyMeshConfig.polys) { - for (const [vertexIndex, normalIndex, uvIndex] of face) { - this.positions.push(...(_c = (_b = polyMeshConfig == null ? void 0 : polyMeshConfig.positions) == null ? void 0 : _b[vertexIndex]) != null ? _c : []); - this.normals.push(...(_e = (_d = polyMeshConfig == null ? void 0 : polyMeshConfig.normals) == null ? void 0 : _d[normalIndex]) != null ? _e : []); - this.uvs.push(...(_g = (_f = polyMeshConfig == null ? void 0 : polyMeshConfig.uvs) == null ? void 0 : _f[uvIndex]) != null ? _g : []); - } - if (face.length === 3) { - this.indices.push(i, i + 1, i + 2); - } else { - this.indices.push(i + 2, i + 1, i, i + 2, i, i + 3); - } - i += face.length; + for (const r of o.polys) { + for (const [h, l, g] of r) + this.positions.push( + ...((n = o == null ? void 0 : o.positions) == null ? void 0 : n[h]) ?? [] + ), this.normals.push( + ...((s = o == null ? void 0 : o.normals) == null ? void 0 : s[l]) ?? [] + ), this.uvs.push(...((f = o == null ? void 0 : o.uvs) == null ? void 0 : f[g]) ?? []); + r.length === 3 ? this.indices.push(i, i + 1, i + 2) : this.indices.push(i + 2, i + 1, i, i + 2, i, i + 3), i += r.length; } - this.createGeometry(); - this.createMesh(polyMeshConfig); + this.createGeometry(), this.createMesh(o); } createGeometry() { - this.geometry.setAttribute("position", new BufferAttribute(new Float32Array(this.positions), 3)); - this.geometry.setAttribute("normal", new BufferAttribute(new Float32Array(this.normals), 3)); - this.geometry.setAttribute("uv", new BufferAttribute(new Float32Array(this.uvs), 2)); - this.geometry.setIndex(this.indices); - } - createMesh({ material }) { - const mesh = new Mesh(this.geometry, material); - this.group.add(mesh); + this.geometry.setAttribute( + "position", + new G(new Float32Array(this.positions), 3) + ), this.geometry.setAttribute( + "normal", + new G(new Float32Array(this.normals), 3) + ), this.geometry.setAttribute( + "uv", + new G(new Float32Array(this.uvs), 2) + ), this.geometry.setIndex(this.indices); + } + createMesh({ material: o }) { + const i = new Ae(this.geometry, o); + this.group.add(i); } getGroup() { return this.group; } } -class Model { - constructor(modelData, texturePath) { - var _a, _b; - this.modelData = modelData; - this.texturePath = texturePath; - this.boneMap = new Map(); - this.locators = new Map(); - this.animator = new Animator(this); - const id = (_b = (_a = modelData == null ? void 0 : modelData.description) == null ? void 0 : _a.identifier) != null ? _b : "geometry.unknown"; - this.model = new Group(); - this.model.name = id; +class dt { + constructor(o, i) { + var n; + this.modelData = o, this.texturePath = i, this.boneMap = /* @__PURE__ */ new Map(), this.locators = /* @__PURE__ */ new Map(), this.animator = new ct(this); + const e = ((n = o == null ? void 0 : o.description) == null ? void 0 : n.identifier) ?? "geometry.unknown"; + this.model = new H(), this.model.name = e; } async create() { - var _a, _b, _c, _d, _e, _f; - const modelData = this.modelData; - const texture = await this.loadTexture(this.texturePath); - const textureSize = [ - (_b = (_a = modelData == null ? void 0 : modelData.description) == null ? void 0 : _a.texture_width) != null ? _b : texture.image.width, - (_d = (_c = modelData == null ? void 0 : modelData.description) == null ? void 0 : _c.texture_height) != null ? _d : texture.image.height - ]; - const textureDiscrepancyFactor = [ - texture.image.width / textureSize[0], - texture.image.height / textureSize[1] - ]; - const boneParentMap = new Map(); - texture.magFilter = NearestFilter; - texture.minFilter = NearestFilter; - const modelMaterial = new MeshLambertMaterial({ - side: DoubleSide, + var r, h, l, g; + const o = this.modelData, i = await this.loadTexture(this.texturePath), e = [ + ((r = o == null ? void 0 : o.description) == null ? void 0 : r.texture_width) ?? i.image.width, + ((h = o == null ? void 0 : o.description) == null ? void 0 : h.texture_height) ?? i.image.height + ], n = [ + i.image.width / e[0], + i.image.height / e[1] + ], s = /* @__PURE__ */ new Map(); + i.magFilter = ye, i.minFilter = ye; + const f = new De({ + side: we, alphaTest: 0.2, - transparent: true, - map: texture + transparent: !0, + map: i }); - (_e = modelData == null ? void 0 : modelData.bones) == null ? void 0 : _e.forEach((boneData) => { - var _a2, _b2, _c2, _d2, _e2, _f2; - const currBone = new Group(); - currBone.name = (_a2 = boneData.name) != null ? _a2 : "unknown"; - if (boneData.poly_mesh) { - const polyMeshGroup = new PolyMesh(__spreadProps(__spreadValues({}, boneData.poly_mesh), { - textureSize, - material: modelMaterial, - mirror: (_b2 = boneData.mirror) != null ? _b2 : false, + (l = o == null ? void 0 : o.bones) == null || l.forEach((c) => { + var A; + const p = new H(); + if (p.name = c.name ?? "unknown", c.poly_mesh) { + const d = new ut({ + ...c.poly_mesh, + textureSize: e, + material: f, + mirror: c.mirror ?? !1, origin: [0, 0, 0], - inflate: boneData.inflate, + inflate: c.inflate, rotation: [0, 0, 0], - pivot: boneData.pivot - })).getGroup(); - polyMeshGroup.name = `#bone.${boneData.name}#polyMesh`; - currBone.add(polyMeshGroup); + pivot: c.pivot + }).getGroup(); + d.name = `#bone.${c.name}#polyMesh`, p.add(d); } - (_c2 = boneData.cubes) == null ? void 0 : _c2.forEach((cubeData, i) => { - var _a3, _b3, _c3, _d3, _e3, _f3, _g, _h, _i, _j, _k; - const group = new Cube({ - width: (_b3 = (_a3 = cubeData.size) == null ? void 0 : _a3[0]) != null ? _b3 : 0, - height: (_d3 = (_c3 = cubeData.size) == null ? void 0 : _c3[1]) != null ? _d3 : 0, - depth: (_f3 = (_e3 = cubeData.size) == null ? void 0 : _e3[2]) != null ? _f3 : 0, - startUV: cubeData.uv, - textureSize, - textureDiscrepancyFactor, - material: modelMaterial, - mirror: cubeData.mirror === void 0 && cubeData.rotation === void 0 ? (_g = boneData.mirror) != null ? _g : false : (_h = cubeData.mirror) != null ? _h : false, - origin: (_i = cubeData.origin) != null ? _i : [0, 0, 0], - inflate: (_j = cubeData.inflate) != null ? _j : boneData.inflate, - rotation: cubeData.rotation, - pivot: (_k = cubeData.pivot) != null ? _k : boneData.pivot + (A = c.cubes) == null || A.forEach((d, w) => { + var P, R, u; + const m = new ht({ + width: ((P = d.size) == null ? void 0 : P[0]) ?? 0, + height: ((R = d.size) == null ? void 0 : R[1]) ?? 0, + depth: ((u = d.size) == null ? void 0 : u[2]) ?? 0, + startUV: d.uv, + textureSize: e, + textureDiscrepancyFactor: n, + material: f, + mirror: d.mirror === void 0 && d.rotation === void 0 ? c.mirror ?? !1 : d.mirror ?? !1, + origin: d.origin ?? [0, 0, 0], + inflate: d.inflate ?? c.inflate, + rotation: d.rotation, + pivot: d.pivot ?? c.pivot }).getGroup(); - group.name = `#bone.${boneData.name}#cube.${i}`; - currBone.add(group); + m.name = `#bone.${c.name}#cube.${w}`, p.add(m); }); - const pivotGroup = new Group(); - pivotGroup.rotation.order = "ZYX"; - if (boneData.pivot) { - const [pX, pY, pZ] = boneData.pivot; - pivotGroup.position.set(-pX, pY, pZ); - currBone.position.set(pX, -pY, -pZ); - } else { - pivotGroup.position.set(0, 0, 0); + const y = new H(); + if (y.rotation.order = "ZYX", c.pivot) { + const [d, w, m] = c.pivot; + y.position.set(-d, w, m), p.position.set(d, -w, -m); + } else + y.position.set(0, 0, 0); + if (y.add(p), y.name = `#pivot.${c.name}`, c.rotation) { + const [d, w, m] = c.rotation; + y.rotation.set( + _.degToRad(-d), + _.degToRad(-w), + _.degToRad(m) + ); } - pivotGroup.add(currBone); - pivotGroup.name = `#pivot.${boneData.name}`; - if (boneData.rotation) { - const [rX, rY, rZ] = boneData.rotation; - pivotGroup.rotation.set(MathUtils.degToRad(-rX), MathUtils.degToRad(-rY), MathUtils.degToRad(rZ)); - } - const locators = (_d2 = boneData.locators) != null ? _d2 : {}; - for (const locatorName in locators) { - const locator = new Group(); - locator.name = `locator#${locatorName}`; - const locData = locators[locatorName]; - if (Array.isArray(locData)) { - locator.position.set(...locData); - } else if (typeof locData === "object") { - locator.position.set(...(_e2 = locData.offset) != null ? _e2 : [0, 0, 0]); - locator.rotation.set(...(_f2 = locData.rotation) != null ? _f2 : [0, 0, 0]); - } - this.locators.set(locatorName, locator); - pivotGroup.add(locator); - } - if (!boneData.parent) - this.model.add(pivotGroup); - if (boneData.name) { - boneParentMap.set(boneData.name, [boneData.parent, pivotGroup]); - this.boneMap.set(boneData.name, pivotGroup); + const b = c.locators ?? {}; + for (const d in b) { + const w = new H(); + w.name = `locator#${d}`; + const m = b[d]; + Array.isArray(m) ? w.position.set(...m) : typeof m == "object" && (w.position.set(...m.offset ?? [0, 0, 0]), w.rotation.set(...m.rotation ?? [0, 0, 0])), this.locators.set(d, w), y.add(w); } + c.parent || this.model.add(y), c.name && (s.set(c.name, [c.parent, y]), this.boneMap.set(c.name, y)); }); - for (let [_, [parent, bone]] of boneParentMap) - if (parent) { - const parentGroup = (_f = boneParentMap.get(parent)) == null ? void 0 : _f[1]; - if (parentGroup && parentGroup.name.startsWith("#pivot.")) - parentGroup.children[0].add(bone); - else if (parentGroup) - parentGroup.add(bone); + for (let [c, [p, y]] of s) + if (p) { + const b = (g = s.get(p)) == null ? void 0 : g[1]; + b && b.name.startsWith("#pivot.") ? b.children[0].add(y) : b && b.add(y); } this.animator.setupDefaultBonePoses(); } @@ -1272,8 +937,8 @@ class Model { getBoneMap() { return this.boneMap; } - getLocator(name) { - return this.locators.get(name); + getLocator(o) { + return this.locators.get(o); } tick() { this.animator.tick(); @@ -1281,33 +946,25 @@ class Model { get shouldTick() { return this.animator.shouldTick; } - createOutlineBox(color, position, size) { - const outlineMaterial = new LineBasicMaterial({ - side: DoubleSide, - color, + createOutlineBox(o, i, e) { + const n = new He({ + side: we, + color: o, linewidth: 20 - }); - const cube = new BoxGeometry(size.x, size.y, size.z); - const edges = new EdgesGeometry(cube); - const mesh = new LineSegments(edges, outlineMaterial); - mesh.position.set(position.x, position.y + size.y / 2, position.z); - mesh.name = "helperBox"; - this.model.add(mesh); - return { + }), s = new Ge(e.x, e.y, e.z), f = new Xe(s), r = new Be(f, n); + return r.position.set(i.x, i.y + e.y / 2, i.z), r.name = "helperBox", this.model.add(r), { dispose: () => { - this.model.remove(mesh); + this.model.remove(r); } }; } - hideBone(name) { - const bone = this.boneMap.get(name); - if (bone) - bone.visible = false; + hideBone(o) { + const i = this.boneMap.get(o); + i && (i.visible = !1); } - showBone(name) { - const bone = this.boneMap.get(name); - if (bone) - bone.visible = true; + showBone(o) { + const i = this.boneMap.get(o); + i && (i.visible = !0); } get bones() { return [...this.boneMap.keys()]; @@ -1315,104 +972,67 @@ class Model { dispose() { this.animator.dispose(); } - loadTexture(url) { - return new Promise((resolve, reject) => { - const loader = new TextureLoader(); - loader.load(url, (texture) => { - resolve(texture); + loadTexture(o) { + return new Promise((i, e) => { + new Ze().load(o, (s) => { + i(s); }); }); } } -class StandaloneModelViewer { - constructor(canvasElement, modelData, texturePath, options) { - var _a; - this.canvasElement = canvasElement; - this.texturePath = texturePath; - this.options = options; - this.renderingRequested = false; - this.renderer = new WebGLRenderer({ - canvas: canvasElement, - antialias: (_a = options.antialias) != null ? _a : false - }); - this.renderer.setPixelRatio(window.devicePixelRatio); - this.camera = new PerspectiveCamera(70, 2, 0.1, 1e3); - this.camera.position.x = -20; - this.camera.position.y = 20; - this.camera.position.z = -20; - this.camera.updateProjectionMatrix(); - this.controls = new OrbitControls(this.camera, canvasElement); - this.scene = new Scene(); - this.scene.add(new AmbientLight(16777215)); - this.scene.background = new Color(13299960); - this.model = new Model(modelData, texturePath); - this.scene.add(this.model.getGroup()); - window.addEventListener("resize", this.onResize.bind(this)); - this.controls.addEventListener("change", () => this.requestRendering()); - this.onResize(); - this.loadedModel = this.loadModel().then(() => this.requestRendering()); +class gt { + constructor(o, i, e, n) { + this.canvasElement = o, this.texturePath = e, this.options = n, this.renderingRequested = !1, this.renderer = new Ke({ + canvas: o, + antialias: n.antialias ?? !1 + }), this.renderer.setPixelRatio(window.devicePixelRatio), this.camera = new Ve(70, 2, 0.1, 1e3), this.camera.position.x = -20, this.camera.position.y = 20, this.camera.position.z = -20, this.camera.updateProjectionMatrix(), this.controls = new nt(this.camera, o), this.scene = new qe(), this.scene.add(new Ce(16777215)), this.scene.background = new We(13299960), this.model = new dt(i, e), this.scene.add(this.model.getGroup()), window.addEventListener("resize", this.onResize.bind(this)), this.controls.addEventListener("change", () => this.requestRendering()), this.onResize(), this.loadedModel = this.loadModel().then(() => this.requestRendering()); } async loadModel() { await this.model.create(); } get width() { - var _a; - return (_a = this.options.width) != null ? _a : window.innerWidth; + return this.options.width ?? window.innerWidth; } get height() { - var _a; - return (_a = this.options.height) != null ? _a : window.innerHeight; - } - render(checkShouldTick = true) { - var _a; - this.controls.update(); - this.renderer.render(this.scene, this.camera); - this.renderingRequested = false; - if (checkShouldTick && this.model.shouldTick) { - this.model.tick(); - (_a = this.model.animator.winterskyScene) == null ? void 0 : _a.updateFacingRotation(this.camera); - this.requestRendering(); - } + return this.options.height ?? window.innerHeight; } - requestRendering(immediate = false) { - if (immediate) - return this.render(false); - if (this.renderingRequested) - return; - this.renderingRequested = true; - requestAnimationFrame(() => this.render()); + render(o = !0) { + var i; + this.controls.update(), this.renderer.render(this.scene, this.camera), this.renderingRequested = !1, o && this.model.shouldTick && (this.model.tick(), (i = this.model.animator.winterskyScene) == null || i.updateFacingRotation( + this.camera + ), this.requestRendering()); + } + requestRendering(o = !1) { + if (o) + return this.render(!1); + this.renderingRequested || (this.renderingRequested = !0, requestAnimationFrame(() => this.render())); } onResize() { - this.renderer.setSize(this.width, this.height, true); - this.camera.aspect = this.width / this.height; - this.positionCamera(); - this.requestRendering(); + this.renderer.setSize(this.width, this.height, !0), this.camera.aspect = this.width / this.height, this.positionCamera(), this.requestRendering(); } dispose() { - window.removeEventListener("resize", this.onResize); - this.controls.removeEventListener("change", this.requestRendering); + window.removeEventListener("resize", this.onResize), this.controls.removeEventListener("change", this.requestRendering); } addHelpers() { - this.scene.add(new AxesHelper(50)); - this.scene.add(new GridHelper(20, 20)); - this.scene.add(new BoxHelper(this.model.getGroup(), 16776960)); - this.requestRendering(); + this.scene.add(new $e(50)), this.scene.add(new Qe(20, 20)), this.scene.add(new Je(this.model.getGroup(), 16776960)), this.requestRendering(); } getModel() { return this.model; } - positionCamera(scale = 1.5, rotate = true) { - if (rotate) - this.model.getGroup().rotation.set(0, Math.PI, 0); - const boundingSphere = new Box3().setFromObject(this.model.getGroup()).getBoundingSphere(new Sphere()); - const objectAngularSize = this.camera.fov * Math.PI / 180 * scale; - const distanceToCamera = boundingSphere.radius / Math.tan(objectAngularSize / 2); - const len = Math.sqrt(Math.pow(distanceToCamera, 2) + Math.pow(distanceToCamera, 2)); - this.camera.position.set(len, len, len); - this.controls.update(); - this.camera.lookAt(boundingSphere.center); - this.controls.target.set(boundingSphere.center.x, boundingSphere.center.y, boundingSphere.center.z); - this.camera.updateProjectionMatrix(); + // From: https://github.com/mrdoob/three.js/issues/6784#issuecomment-315963625 + positionCamera(o = 1.5, i = !0) { + i && this.model.getGroup().rotation.set(0, Math.PI, 0); + const e = new et().setFromObject(this.model.getGroup()).getBoundingSphere(new tt()), n = this.camera.fov * Math.PI / 180 * o, s = e.radius / Math.tan(n / 2), f = Math.sqrt( + Math.pow(s, 2) + Math.pow(s, 2) + ); + this.camera.position.set(f, f, f), this.controls.update(), this.camera.lookAt(e.center), this.controls.target.set( + e.center.x, + e.center.y, + e.center.z + ), this.camera.updateProjectionMatrix(); } } -export { Model, StandaloneModelViewer }; +export { + dt as Model, + gt as StandaloneModelViewer +}; diff --git a/dist/model-viewer.umd.js b/dist/model-viewer.umd.js index f38b813..4c0bf5c 100644 --- a/dist/model-viewer.umd.js +++ b/dist/model-viewer.umd.js @@ -1 +1 @@ -var ze=Object.defineProperty,Ce=Object.defineProperties;var Xe=Object.getOwnPropertyDescriptors;var we=Object.getOwnPropertySymbols;var We=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable;var ye=(M,n,v)=>n in M?ze(M,n,{enumerable:!0,configurable:!0,writable:!0,value:v}):M[n]=v,Ee=(M,n)=>{for(var v in n||(n={}))We.call(n,v)&&ye(M,v,n[v]);if(we)for(var v of we(n))Ke.call(n,v)&&ye(M,v,n[v]);return M},Te=(M,n)=>Ce(M,Xe(n));(function(M,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("three"),require("molang"),require("wintersky")):typeof define=="function"&&define.amd?define(["exports","three","molang","wintersky"],n):(M=typeof globalThis!="undefined"?globalThis:M||self,n(M.ModelViewer={},M.three,M.molang,M.Wintersky))})(this,function(M,n,v,Me){"use strict";function Ae(R){return R&&typeof R=="object"&&"default"in R?R:{default:R}}var Pe=Ae(Me);const ee={type:"change"},K={type:"start"},te={type:"end"};class xe extends n.EventDispatcher{constructor(o,i){super();i===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=o,this.domElement=i,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new n.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",pe),this._domElementKeyEvents=t},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(ee),e.update(),a=s.NONE},this.update=function(){const t=new n.Vector3,c=new n.Quaternion().setFromUnitVectors(o.up,new n.Vector3(0,1,0)),O=c.clone().invert(),k=new n.Vector3,_=new n.Quaternion,G=2*Math.PI;return function(){const be=e.object.position;t.copy(be).sub(e.target),t.applyQuaternion(c),r.setFromVector3(t),e.autoRotate&&a===s.NONE&&f(b()),e.enableDamping?(r.theta+=d.theta*e.dampingFactor,r.phi+=d.phi*e.dampingFactor):(r.theta+=d.theta,r.phi+=d.phi);let V=e.minAzimuthAngle,D=e.maxAzimuthAngle;return isFinite(V)&&isFinite(D)&&(V<-Math.PI?V+=G:V>Math.PI&&(V-=G),D<-Math.PI?D+=G:D>Math.PI&&(D-=G),V<=D?r.theta=Math.max(V,Math.min(D,r.theta)):r.theta=r.theta>(V+D)/2?Math.max(V,r.theta):Math.min(D,r.theta)),r.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,r.phi)),r.makeSafe(),r.radius*=u,r.radius=Math.max(e.minDistance,Math.min(e.maxDistance,r.radius)),e.enableDamping===!0?e.target.addScaledVector(h,e.dampingFactor):e.target.add(h),t.setFromSpherical(r),t.applyQuaternion(O),be.copy(e.target).add(t),e.object.lookAt(e.target),e.enableDamping===!0?(d.theta*=1-e.dampingFactor,d.phi*=1-e.dampingFactor,h.multiplyScalar(1-e.dampingFactor)):(d.set(0,0,0),h.set(0,0,0)),u=1,w||k.distanceToSquared(e.object.position)>m||8*(1-_.dot(e.object.quaternion))>m?(e.dispatchEvent(ee),k.copy(e.object.position),_.copy(e.object.quaternion),w=!1,!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",me),e.domElement.removeEventListener("pointerdown",ue),e.domElement.removeEventListener("pointercancel",de),e.domElement.removeEventListener("wheel",he),e.domElement.removeEventListener("pointermove",$),e.domElement.removeEventListener("pointerup",Q),e._domElementKeyEvents!==null&&e._domElementKeyEvents.removeEventListener("keydown",pe)};const e=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=s.NONE;const m=1e-6,r=new n.Spherical,d=new n.Spherical;let u=1;const h=new n.Vector3;let w=!1;const g=new n.Vector2,l=new n.Vector2,A=new n.Vector2,y=new n.Vector2,P=new n.Vector2,L=new n.Vector2,N=new n.Vector2,x=new n.Vector2,I=new n.Vector2,p=[],U={};function b(){return 2*Math.PI/60/60*e.autoRotateSpeed}function E(){return Math.pow(.95,e.zoomSpeed)}function f(t){d.theta-=t}function T(t){d.phi-=t}const F=function(){const t=new n.Vector3;return function(O,k){t.setFromMatrixColumn(k,0),t.multiplyScalar(-O),h.add(t)}}(),H=function(){const t=new n.Vector3;return function(O,k){e.screenSpacePanning===!0?t.setFromMatrixColumn(k,1):(t.setFromMatrixColumn(k,0),t.crossVectors(e.object.up,t)),t.multiplyScalar(O),h.add(t)}}(),j=function(){const t=new n.Vector3;return function(O,k){const _=e.domElement;if(e.object.isPerspectiveCamera){const G=e.object.position;t.copy(G).sub(e.target);let W=t.length();W*=Math.tan(e.object.fov/2*Math.PI/180),F(2*O*W/_.clientHeight,e.object.matrix),H(2*k*W/_.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(F(O*(e.object.right-e.object.left)/e.object.zoom/_.clientWidth,e.object.matrix),H(k*(e.object.top-e.object.bottom)/e.object.zoom/_.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function S(t){e.object.isPerspectiveCamera?u/=t:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*t)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Y(t){e.object.isPerspectiveCamera?u*=t:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/t)),e.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function B(t){g.set(t.clientX,t.clientY)}function z(t){N.set(t.clientX,t.clientY)}function Z(t){y.set(t.clientX,t.clientY)}function C(t){l.set(t.clientX,t.clientY),A.subVectors(l,g).multiplyScalar(e.rotateSpeed);const c=e.domElement;f(2*Math.PI*A.x/c.clientHeight),T(2*Math.PI*A.y/c.clientHeight),g.copy(l),e.update()}function X(t){x.set(t.clientX,t.clientY),I.subVectors(x,N),I.y>0?S(E()):I.y<0&&Y(E()),N.copy(x),e.update()}function Se(t){P.set(t.clientX,t.clientY),L.subVectors(P,y).multiplyScalar(e.panSpeed),j(L.x,L.y),y.copy(P),e.update()}function _e(t){t.deltaY<0?Y(E()):t.deltaY>0&&S(E()),e.update()}function Ie(t){let c=!1;switch(t.code){case e.keys.UP:j(0,e.keyPanSpeed),c=!0;break;case e.keys.BOTTOM:j(0,-e.keyPanSpeed),c=!0;break;case e.keys.LEFT:j(e.keyPanSpeed,0),c=!0;break;case e.keys.RIGHT:j(-e.keyPanSpeed,0),c=!0;break}c&&(t.preventDefault(),e.update())}function ie(){if(p.length===1)g.set(p[0].pageX,p[0].pageY);else{const t=.5*(p[0].pageX+p[1].pageX),c=.5*(p[0].pageY+p[1].pageY);g.set(t,c)}}function se(){if(p.length===1)y.set(p[0].pageX,p[0].pageY);else{const t=.5*(p[0].pageX+p[1].pageX),c=.5*(p[0].pageY+p[1].pageY);y.set(t,c)}}function ae(){const t=p[0].pageX-p[1].pageX,c=p[0].pageY-p[1].pageY,O=Math.sqrt(t*t+c*c);N.set(0,O)}function Ve(){e.enableZoom&&ae(),e.enablePan&&se()}function De(){e.enableZoom&&ae(),e.enableRotate&&ie()}function re(t){if(p.length==1)l.set(t.pageX,t.pageY);else{const O=J(t),k=.5*(t.pageX+O.x),_=.5*(t.pageY+O.y);l.set(k,_)}A.subVectors(l,g).multiplyScalar(e.rotateSpeed);const c=e.domElement;f(2*Math.PI*A.x/c.clientHeight),T(2*Math.PI*A.y/c.clientHeight),g.copy(l)}function ce(t){if(p.length===1)P.set(t.pageX,t.pageY);else{const c=J(t),O=.5*(t.pageX+c.x),k=.5*(t.pageY+c.y);P.set(O,k)}L.subVectors(P,y).multiplyScalar(e.panSpeed),j(L.x,L.y),y.copy(P)}function le(t){const c=J(t),O=t.pageX-c.x,k=t.pageY-c.y,_=Math.sqrt(O*O+k*k);x.set(0,_),I.set(0,Math.pow(x.y/N.y,e.zoomSpeed)),S(I.y),N.copy(x)}function Fe(t){e.enableZoom&&le(t),e.enablePan&&ce(t)}function He(t){e.enableZoom&&le(t),e.enableRotate&&re(t)}function ue(t){e.enabled!==!1&&(p.length===0&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",$),e.domElement.addEventListener("pointerup",Q)),qe(t),t.pointerType==="touch"?Be(t):Ge(t))}function $(t){e.enabled!==!1&&(t.pointerType==="touch"?Ze(t):Ye(t))}function Q(t){fe(t),p.length===0&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",$),e.domElement.removeEventListener("pointerup",Q)),e.dispatchEvent(te),a=s.NONE}function de(t){fe(t)}function Ge(t){let c;switch(t.button){case 0:c=e.mouseButtons.LEFT;break;case 1:c=e.mouseButtons.MIDDLE;break;case 2:c=e.mouseButtons.RIGHT;break;default:c=-1}switch(c){case n.MOUSE.DOLLY:if(e.enableZoom===!1)return;z(t),a=s.DOLLY;break;case n.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enablePan===!1)return;Z(t),a=s.PAN}else{if(e.enableRotate===!1)return;B(t),a=s.ROTATE}break;case n.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enableRotate===!1)return;B(t),a=s.ROTATE}else{if(e.enablePan===!1)return;Z(t),a=s.PAN}break;default:a=s.NONE}a!==s.NONE&&e.dispatchEvent(K)}function Ye(t){if(e.enabled!==!1)switch(a){case s.ROTATE:if(e.enableRotate===!1)return;C(t);break;case s.DOLLY:if(e.enableZoom===!1)return;X(t);break;case s.PAN:if(e.enablePan===!1)return;Se(t);break}}function he(t){e.enabled===!1||e.enableZoom===!1||a!==s.NONE||(t.preventDefault(),e.dispatchEvent(K),_e(t),e.dispatchEvent(te))}function pe(t){e.enabled===!1||e.enablePan===!1||Ie(t)}function Be(t){switch(ge(t),p.length){case 1:switch(e.touches.ONE){case n.TOUCH.ROTATE:if(e.enableRotate===!1)return;ie(),a=s.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(e.enablePan===!1)return;se(),a=s.TOUCH_PAN;break;default:a=s.NONE}break;case 2:switch(e.touches.TWO){case n.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ve(),a=s.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;De(),a=s.TOUCH_DOLLY_ROTATE;break;default:a=s.NONE}break;default:a=s.NONE}a!==s.NONE&&e.dispatchEvent(K)}function Ze(t){switch(ge(t),a){case s.TOUCH_ROTATE:if(e.enableRotate===!1)return;re(t),e.update();break;case s.TOUCH_PAN:if(e.enablePan===!1)return;ce(t),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Fe(t),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;He(t),e.update();break;default:a=s.NONE}}function me(t){e.enabled!==!1&&t.preventDefault()}function qe(t){p.push(t)}function fe(t){delete U[t.pointerId];for(let c=0;c[Number(e),Array.isArray(s)?s:[s]]).sort(([e],[s])=>e-s)}getCurrentEffects(){if(this.currentEffectIndex>=this.effects.length)return;const o=this.effects[this.currentEffectIndex];if(!(o[0]>this.animation.roundedCurrentTime))return this.currentEffectIndex++,o[1]}reset(){this.currentEffectIndex=0}}class Oe extends oe{tick(){var i;const o=(i=super.getCurrentEffects())!=null?i:[];o.length>0&&console.log(`Playing sound effects: "${o.map(e=>e.effect).join(", ")}"`)}}class ke extends oe{constructor(){super(...arguments);this.disposables=[]}tick(){var i;this.tickingEffects.forEach(e=>e.tick());const o=(i=super.getCurrentEffects())!=null?i:[];for(const{locator:e,effect:s,pre_effect_script:a}of o){if(!s)return;const m=this.animation.getAnimator(),r=m.getModel(),d=m.getEmitter(s);if(!d||!m.winterskyScene)return;const u=e?r.getLocator(e):void 0,h=new Pe.default.Emitter(m.winterskyScene,d,{parent_mode:u?"locator":"entity",loop_mode:"once"});u&&(u.add(h.local_space),h.local_space.parent=u);const w={tick:()=>{h.tick(),h.enabled||(h.delete(),this.tickingEffects=this.tickingEffects.filter(g=>g!==w))}};this.tickingEffects.push(w),this.disposables.push({dispose:()=>{h.delete(),this.tickingEffects=this.tickingEffects.filter(g=>g!==w)}}),h.start(),h.tick()}}dispose(){this.disposables.forEach(o=>o.dispose()),this.disposables=[]}}class Re{constructor(o,i){var e,s;this.animator=o,this.animationData=i,this.startTimestamp=0,this.lastFrameTimestamp=0,this.isRunning=!1,this.env={"query.anim_time":()=>this.currentTime,"query.delta_time":()=>this.startTimestamp-this.lastFrameTimestamp,"query.life_time":()=>this.currentTime},this.molang=new v.MoLang(this.env,{convertUndefined:!0}),this.soundEffects=new Oe(this,(e=this.animationData.sound_effects)!=null?e:{}),this.particleEffects=new ke(this,(s=this.animationData.particle_effects)!=null?s:{})}getAnimator(){return this.animator}execute(o){return this.molang.executeAndCatch(o)}parseBoneModifier(o){if(typeof o=="number")return[o,o,o];if(typeof o=="string"){const i=typeof o=="string"?this.execute(o):o;return[i,i,i]}else{if(Array.isArray(o))return o.map(i=>typeof i=="string"?this.execute(i):i);if(o!==void 0){const i=Object.entries(o).map(([e,s])=>[Number(e),s]).sort(([e],[s])=>e-s);for(let e=i.length-1;e>=0;e--){let[s,a]=i[e];if(!(s>this.currentTime))if(s===this.currentTime){if(Array.isArray(a))return a.map(m=>typeof m=="string"?this.execute(m):m);throw new Error("Format not supported yet")}else{let[m,r]=i[n.MathUtils.euclideanModulo(e+1,i.length)],d=m-s;if(Array.isArray(a)&&Array.isArray(r))return a=a.map(u=>typeof u=="string"?this.execute(u):u),r=r.map(u=>typeof u=="string"?this.execute(u):u),a.map((u,h)=>u+(r[h]-u)/d*(this.currentTime-s));throw new Error("Format not supported yet")}}return[0,0,0]}}}tick(){this.soundEffects.tick(),this.particleEffects.tick();const o=this.animator.getModel().getBoneMap();for(let i in this.animationData.bones){const e=o.get(i);if(!e)continue;const{position:s,rotation:a,scale:m}=this.animationData.bones[i],[r,d,u]=[s,a,m].map(h=>this.parseBoneModifier(h));if(r){const h=e.position.toArray();e.position.set(...r.map((w,g)=>(g===0?-1:1)*w+h[g]))}if(d){const h=e.rotation.toArray();e.rotation.set(...d.map(w=>n.MathUtils.degToRad(w)).map((w,g)=>h[g]+(g===2?w:-w)))}u&&e.scale.set(...u)}this.currentTime>this.animationData.animation_length&&(this.animationData.loop?this.loop():this.pause()),this.lastFrameTimestamp=Date.now()}play(){this.isRunning=!0,this.startTimestamp=Date.now()}pause(){this.isRunning=!1}loop(){this.startTimestamp=Date.now(),this.soundEffects.reset(),this.particleEffects.reset()}dispose(){this.particleEffects.dispose()}get currentTime(){return(Date.now()-this.startTimestamp)/1e3}get roundedCurrentTime(){return Math.round((Date.now()-this.startTimestamp)/50)/20}get shouldTick(){return this.isRunning}}class ve{constructor(o){this.model=o,this.animations=new Map,this.particleEmitters=new Map}setupDefaultBonePoses(){for(let o of this.model.getBoneMap().values())o.userData.defaultRotation=o.rotation.toArray(),o.userData.defaultPosition=o.position.toArray()}dispose(){this.disposeAnimations();for(let o of this.model.getBoneMap().values())delete o.userData.defaultRotation,delete o.userData.defaultPosition}disposeAnimations(){this.animations.forEach(o=>o.dispose())}setupWintersky(o){this.winterskyScene=o}addAnimation(o,i){this.animations.set(o,new Re(this,i))}addEmitter(o,i){this.particleEmitters.set(o,i)}getEmitter(o){return this.particleEmitters.get(o)}play(o){const i=this.animations.get(o);if(!i)throw new Error(`Unknown animation: "${o}"`);i.play()}pause(o){const i=this.animations.get(o);if(!i)throw new Error(`Unknown animation: "${o}"`);i.pause()}pauseAll(){for(const o of this.animations.values())o.pause()}tick(){for(let o of this.model.getBoneMap().values())o.rotation.set(...o.userData.defaultRotation),o.position.set(...o.userData.defaultPosition);this.animations.forEach(o=>o.shouldTick&&o.tick())}get shouldTick(){return[...this.animations.values()].some(o=>o.shouldTick)}getModel(){return this.model}}const Le=[{name:"west",baseUV:[2,1],dir:[-1,0,0],corners:[{pos:[-.5,1,0],uv:[0,1]},{pos:[-.5,0,0],uv:[0,0]},{pos:[-.5,1,1],uv:[1,1]},{pos:[-.5,0,1],uv:[1,0]}]},{name:"east",baseUV:[0,1],dir:[1,0,0],corners:[{pos:[.5,1,1],uv:[0,1]},{pos:[.5,0,1],uv:[0,0]},{pos:[.5,1,0],uv:[1,1]},{pos:[.5,0,0],uv:[1,0]}]},{name:"down",baseUV:[2,0],dir:[0,-1,0],corners:[{pos:[.5,0,1],uv:[0,1]},{pos:[-.5,0,1],uv:[1,1]},{pos:[.5,0,0],uv:[0,0]},{pos:[-.5,0,0],uv:[1,0]}]},{name:"up",baseUV:[1,0],dir:[0,1,0],corners:[{pos:[-.5,1,1],uv:[1,1]},{pos:[.5,1,1],uv:[0,1]},{pos:[-.5,1,0],uv:[1,0]},{pos:[.5,1,0],uv:[0,0]}]},{name:"north",baseUV:[1,1],dir:[0,0,-1],corners:[{pos:[-.5,0,0],uv:[1,0]},{pos:[.5,0,0],uv:[0,0]},{pos:[-.5,1,0],uv:[1,1]},{pos:[.5,1,0],uv:[0,1]}]},{name:"south",baseUV:[3,1],dir:[0,0,1],corners:[{pos:[-.5,0,1],uv:[0,0]},{pos:[.5,0,1],uv:[1,0]},{pos:[-.5,1,1],uv:[0,1]},{pos:[.5,1,1],uv:[1,1]}]}],q=.03;class Ne{constructor(o){var P,L,N;this.positions=[],this.indices=[],this.normals=[],this.uvs=[],this.geometry=new n.BufferGeometry,this.group=new n.Group;const{textureSize:[i,e],textureDiscrepancyFactor:[s,a],mirror:m,width:r,height:d,depth:u}=o,[h,w]=[i*s,e*a],g=(P=o.startUV)!=null?P:[0,0],l=!Array.isArray(g);let A=0,y=0;l||([A,y]=g);for(let{name:x,dir:I,corners:p,baseUV:[U,b]}of Le){const E=this.positions.length/3;let f,T;if(l){if(g[x]===void 0)continue;[A,y]=((L=g[x])==null?void 0:L.uv)||[],[f,T]=((N=g[x])==null?void 0:N.uv_size)||[],f*=s,T*=a,A*=s,y*=a,U=0,b=0}for(const{pos:[F,H,j],uv:S}of p)this.positions.push((m?-F:F)*r,H*d,j*u),this.normals.push(...I),this.uvs.push((A+(Number(U>0)+Number(U>2))*Math.floor(f!=null?f:u)+Number(U>1)*Math.floor(f!=null?f:r)+S[0]*Math.floor(x==="west"||x==="east"?f!=null?f:u:f!=null?f:r)+(S[0]===0?q:-q))/(h/(l?1:s)),1-(y+b*Math.floor(T!=null?T:u)+Math.floor(x==="up"||x==="down"?T!=null?T:u:T!=null?T:d)-S[1]*Math.floor(x==="up"||x==="down"?T!=null?T:u:T!=null?T:d)+(S[1]===0?-q:q))/(w/(l?1:a)));this.indices.push(E,E+1,E+2,E+2,E+1,E+3)}this.createGeometry(),this.createMesh(o)}createGeometry(){this.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(this.positions),3)),this.geometry.setAttribute("normal",new n.BufferAttribute(new Float32Array(this.normals),3)),this.geometry.setAttribute("uv",new n.BufferAttribute(new Float32Array(this.uvs),2)),this.geometry.setIndex(this.indices)}createMesh({material:o,width:i,height:e,depth:s,pivot:a,rotation:m,origin:r,inflate:d=0}){const u=d*2+i,h=new n.Mesh(this.geometry,o);if(this.group.rotation.order="ZYX",a===void 0&&(a=[u/2,e/2,s/2]),this.group.add(h),m){this.group.position.set(-a[0],a[1],a[2]),h.position.set(-r[0]-u/2+a[0]+d,r[1]-a[1]-d,r[2]-a[2]-d);const[w,g,l]=m;this.group.rotation.set(n.MathUtils.degToRad(-w),n.MathUtils.degToRad(-g),n.MathUtils.degToRad(l))}else this.group.position.set(-r[0]-u/2+d,r[1]-d,r[2]-d);d&&this.group.scale.set(i!==0?1+d/(i/2):1,e!==0?1+d/(e/2):1,s!==0?1+d/(s/2):1)}getGroup(){return this.group}}class Ue{constructor(o){var e,s,a,m,r,d,u;if(this.positions=[],this.indices=[],this.normals=[],this.uvs=[],this.geometry=new n.BufferGeometry,this.group=new n.Group,!Array.isArray(o.polys))throw new Error("Format not supported yet!");o.normalized_uvs||(o.uvs=(e=o==null?void 0:o.uvs)==null?void 0:e.map(([h,w])=>[h/o.textureSize[0],w/o.textureSize[1]]));let i=0;for(const h of o.polys){for(const[w,g,l]of h)this.positions.push(...(a=(s=o==null?void 0:o.positions)==null?void 0:s[w])!=null?a:[]),this.normals.push(...(r=(m=o==null?void 0:o.normals)==null?void 0:m[g])!=null?r:[]),this.uvs.push(...(u=(d=o==null?void 0:o.uvs)==null?void 0:d[l])!=null?u:[]);h.length===3?this.indices.push(i,i+1,i+2):this.indices.push(i+2,i+1,i,i+2,i,i+3),i+=h.length}this.createGeometry(),this.createMesh(o)}createGeometry(){this.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(this.positions),3)),this.geometry.setAttribute("normal",new n.BufferAttribute(new Float32Array(this.normals),3)),this.geometry.setAttribute("uv",new n.BufferAttribute(new Float32Array(this.uvs),2)),this.geometry.setIndex(this.indices)}createMesh({material:o}){const i=new n.Mesh(this.geometry,o);this.group.add(i)}getGroup(){return this.group}}class ne{constructor(o,i){var s,a;this.modelData=o,this.texturePath=i,this.boneMap=new Map,this.locators=new Map,this.animator=new ve(this);const e=(a=(s=o==null?void 0:o.description)==null?void 0:s.identifier)!=null?a:"geometry.unknown";this.model=new n.Group,this.model.name=e}async create(){var r,d,u,h,w,g;const o=this.modelData,i=await this.loadTexture(this.texturePath),e=[(d=(r=o==null?void 0:o.description)==null?void 0:r.texture_width)!=null?d:i.image.width,(h=(u=o==null?void 0:o.description)==null?void 0:u.texture_height)!=null?h:i.image.height],s=[i.image.width/e[0],i.image.height/e[1]],a=new Map;i.magFilter=n.NearestFilter,i.minFilter=n.NearestFilter;const m=new n.MeshLambertMaterial({side:n.DoubleSide,alphaTest:.2,transparent:!0,map:i});(w=o==null?void 0:o.bones)==null||w.forEach(l=>{var L,N,x,I,p,U;const A=new n.Group;if(A.name=(L=l.name)!=null?L:"unknown",l.poly_mesh){const b=new Ue(Te(Ee({},l.poly_mesh),{textureSize:e,material:m,mirror:(N=l.mirror)!=null?N:!1,origin:[0,0,0],inflate:l.inflate,rotation:[0,0,0],pivot:l.pivot})).getGroup();b.name=`#bone.${l.name}#polyMesh`,A.add(b)}(x=l.cubes)==null||x.forEach((b,E)=>{var T,F,H,j,S,Y,B,z,Z,C,X;const f=new Ne({width:(F=(T=b.size)==null?void 0:T[0])!=null?F:0,height:(j=(H=b.size)==null?void 0:H[1])!=null?j:0,depth:(Y=(S=b.size)==null?void 0:S[2])!=null?Y:0,startUV:b.uv,textureSize:e,textureDiscrepancyFactor:s,material:m,mirror:b.mirror===void 0&&b.rotation===void 0?(B=l.mirror)!=null?B:!1:(z=b.mirror)!=null?z:!1,origin:(Z=b.origin)!=null?Z:[0,0,0],inflate:(C=b.inflate)!=null?C:l.inflate,rotation:b.rotation,pivot:(X=b.pivot)!=null?X:l.pivot}).getGroup();f.name=`#bone.${l.name}#cube.${E}`,A.add(f)});const y=new n.Group;if(y.rotation.order="ZYX",l.pivot){const[b,E,f]=l.pivot;y.position.set(-b,E,f),A.position.set(b,-E,-f)}else y.position.set(0,0,0);if(y.add(A),y.name=`#pivot.${l.name}`,l.rotation){const[b,E,f]=l.rotation;y.rotation.set(n.MathUtils.degToRad(-b),n.MathUtils.degToRad(-E),n.MathUtils.degToRad(f))}const P=(I=l.locators)!=null?I:{};for(const b in P){const E=new n.Group;E.name=`locator#${b}`;const f=P[b];Array.isArray(f)?E.position.set(...f):typeof f=="object"&&(E.position.set(...(p=f.offset)!=null?p:[0,0,0]),E.rotation.set(...(U=f.rotation)!=null?U:[0,0,0])),this.locators.set(b,E),y.add(E)}l.parent||this.model.add(y),l.name&&(a.set(l.name,[l.parent,y]),this.boneMap.set(l.name,y))});for(let[l,[A,y]]of a)if(A){const P=(g=a.get(A))==null?void 0:g[1];P&&P.name.startsWith("#pivot.")?P.children[0].add(y):P&&P.add(y)}this.animator.setupDefaultBonePoses()}getGroup(){return this.model}getBoneMap(){return this.boneMap}getLocator(o){return this.locators.get(o)}tick(){this.animator.tick()}get shouldTick(){return this.animator.shouldTick}createOutlineBox(o,i,e){const s=new n.LineBasicMaterial({side:n.DoubleSide,color:o,linewidth:20}),a=new n.BoxGeometry(e.x,e.y,e.z),m=new n.EdgesGeometry(a),r=new n.LineSegments(m,s);return r.position.set(i.x,i.y+e.y/2,i.z),r.name="helperBox",this.model.add(r),{dispose:()=>{this.model.remove(r)}}}hideBone(o){const i=this.boneMap.get(o);i&&(i.visible=!1)}showBone(o){const i=this.boneMap.get(o);i&&(i.visible=!0)}get bones(){return[...this.boneMap.keys()]}dispose(){this.animator.dispose()}loadTexture(o){return new Promise((i,e)=>{new n.TextureLoader().load(o,a=>{i(a)})})}}class je{constructor(o,i,e,s){var a;this.canvasElement=o,this.texturePath=e,this.options=s,this.renderingRequested=!1,this.renderer=new n.WebGLRenderer({canvas:o,antialias:(a=s.antialias)!=null?a:!1}),this.renderer.setPixelRatio(window.devicePixelRatio),this.camera=new n.PerspectiveCamera(70,2,.1,1e3),this.camera.position.x=-20,this.camera.position.y=20,this.camera.position.z=-20,this.camera.updateProjectionMatrix(),this.controls=new xe(this.camera,o),this.scene=new n.Scene,this.scene.add(new n.AmbientLight(16777215)),this.scene.background=new n.Color(13299960),this.model=new ne(i,e),this.scene.add(this.model.getGroup()),window.addEventListener("resize",this.onResize.bind(this)),this.controls.addEventListener("change",()=>this.requestRendering()),this.onResize(),this.loadedModel=this.loadModel().then(()=>this.requestRendering())}async loadModel(){await this.model.create()}get width(){var o;return(o=this.options.width)!=null?o:window.innerWidth}get height(){var o;return(o=this.options.height)!=null?o:window.innerHeight}render(o=!0){var i;this.controls.update(),this.renderer.render(this.scene,this.camera),this.renderingRequested=!1,o&&this.model.shouldTick&&(this.model.tick(),(i=this.model.animator.winterskyScene)==null||i.updateFacingRotation(this.camera),this.requestRendering())}requestRendering(o=!1){if(o)return this.render(!1);this.renderingRequested||(this.renderingRequested=!0,requestAnimationFrame(()=>this.render()))}onResize(){this.renderer.setSize(this.width,this.height,!0),this.camera.aspect=this.width/this.height,this.positionCamera(),this.requestRendering()}dispose(){window.removeEventListener("resize",this.onResize),this.controls.removeEventListener("change",this.requestRendering)}addHelpers(){this.scene.add(new n.AxesHelper(50)),this.scene.add(new n.GridHelper(20,20)),this.scene.add(new n.BoxHelper(this.model.getGroup(),16776960)),this.requestRendering()}getModel(){return this.model}positionCamera(o=1.5,i=!0){i&&this.model.getGroup().rotation.set(0,Math.PI,0);const e=new n.Box3().setFromObject(this.model.getGroup()).getBoundingSphere(new n.Sphere),s=this.camera.fov*Math.PI/180*o,a=e.radius/Math.tan(s/2),m=Math.sqrt(Math.pow(a,2)+Math.pow(a,2));this.camera.position.set(m,m,m),this.controls.update(),this.camera.lookAt(e.center),this.controls.target.set(e.center.x,e.center.y,e.center.z),this.camera.updateProjectionMatrix()}}M.Model=ne,M.StandaloneModelViewer=je,Object.defineProperty(M,"__esModule",{value:!0}),M[Symbol.toStringTag]="Module"}); +(function(R,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("three"),require("molang"),require("wintersky")):typeof define=="function"&&define.amd?define(["exports","three","molang","wintersky"],n):(R=typeof globalThis<"u"?globalThis:R||self,n(R.ModelViewer={},R.three,R.molang,R.Wintersky))})(this,function(R,n,me,fe){"use strict";const q={type:"change"},D={type:"start"},K={type:"end"};class ge extends n.EventDispatcher{constructor(o,i){super(),this.object=o,this.domElement=i,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new n.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:n.MOUSE.ROTATE,MIDDLE:n.MOUSE.DOLLY,RIGHT:n.MOUSE.PAN},this.touches={ONE:n.TOUCH.ROTATE,TWO:n.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return r.phi},this.getAzimuthalAngle=function(){return r.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(t){t.addEventListener("keydown",le),this._domElementKeyEvents=t},this.saveState=function(){e.target0.copy(e.target),e.position0.copy(e.object.position),e.zoom0=e.object.zoom},this.reset=function(){e.target.copy(e.target0),e.object.position.copy(e.position0),e.object.zoom=e.zoom0,e.object.updateProjectionMatrix(),e.dispatchEvent(q),e.update(),a=s.NONE},this.update=function(){const t=new n.Vector3,c=new n.Quaternion().setFromUnitVectors(o.up,new n.Vector3(0,1,0)),T=c.clone().invert(),M=new n.Vector3,v=new n.Quaternion,Y=2*Math.PI;return function(){const pe=e.object.position;t.copy(pe).sub(e.target),t.applyQuaternion(c),r.setFromVector3(t),e.autoRotate&&a===s.NONE&&P(j()),e.enableDamping?(r.theta+=h.theta*e.dampingFactor,r.phi+=h.phi*e.dampingFactor):(r.theta+=h.theta,r.phi+=h.phi);let N=e.minAzimuthAngle,U=e.maxAzimuthAngle;return isFinite(N)&&isFinite(U)&&(N<-Math.PI?N+=Y:N>Math.PI&&(N-=Y),U<-Math.PI?U+=Y:U>Math.PI&&(U-=Y),N<=U?r.theta=Math.max(N,Math.min(U,r.theta)):r.theta=r.theta>(N+U)/2?Math.max(N,r.theta):Math.min(U,r.theta)),r.phi=Math.max(e.minPolarAngle,Math.min(e.maxPolarAngle,r.phi)),r.makeSafe(),r.radius*=u,r.radius=Math.max(e.minDistance,Math.min(e.maxDistance,r.radius)),e.enableDamping===!0?e.target.addScaledVector(y,e.dampingFactor):e.target.add(y),t.setFromSpherical(r),t.applyQuaternion(T),pe.copy(e.target).add(t),e.object.lookAt(e.target),e.enableDamping===!0?(h.theta*=1-e.dampingFactor,h.phi*=1-e.dampingFactor,y.multiplyScalar(1-e.dampingFactor)):(h.set(0,0,0),y.set(0,0,0)),u=1,l||M.distanceToSquared(e.object.position)>g||8*(1-v.dot(e.object.quaternion))>g?(e.dispatchEvent(q),M.copy(e.object.position),v.copy(e.object.quaternion),l=!1,!0):!1}}(),this.dispose=function(){e.domElement.removeEventListener("contextmenu",ue),e.domElement.removeEventListener("pointerdown",ae),e.domElement.removeEventListener("pointercancel",re),e.domElement.removeEventListener("wheel",ce),e.domElement.removeEventListener("pointermove",B),e.domElement.removeEventListener("pointerup",X),e._domElementKeyEvents!==null&&e._domElementKeyEvents.removeEventListener("keydown",le)};const e=this,s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=s.NONE;const g=1e-6,r=new n.Spherical,h=new n.Spherical;let u=1;const y=new n.Vector3;let l=!1;const m=new n.Vector2,w=new n.Vector2,E=new n.Vector2,A=new n.Vector2,p=new n.Vector2,b=new n.Vector2,f=new n.Vector2,x=new n.Vector2,S=new n.Vector2,d=[],I={};function j(){return 2*Math.PI/60/60*e.autoRotateSpeed}function O(){return Math.pow(.95,e.zoomSpeed)}function P(t){h.theta-=t}function _(t){h.phi-=t}const V=function(){const t=new n.Vector3;return function(T,M){t.setFromMatrixColumn(M,0),t.multiplyScalar(-T),y.add(t)}}(),F=function(){const t=new n.Vector3;return function(T,M){e.screenSpacePanning===!0?t.setFromMatrixColumn(M,1):(t.setFromMatrixColumn(M,0),t.crossVectors(e.object.up,t)),t.multiplyScalar(T),y.add(t)}}(),k=function(){const t=new n.Vector3;return function(T,M){const v=e.domElement;if(e.object.isPerspectiveCamera){const Y=e.object.position;t.copy(Y).sub(e.target);let H=t.length();H*=Math.tan(e.object.fov/2*Math.PI/180),V(2*T*H/v.clientHeight,e.object.matrix),F(2*M*H/v.clientHeight,e.object.matrix)}else e.object.isOrthographicCamera?(V(T*(e.object.right-e.object.left)/e.object.zoom/v.clientWidth,e.object.matrix),F(M*(e.object.top-e.object.bottom)/e.object.zoom/v.clientHeight,e.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),e.enablePan=!1)}}();function G(t){e.object.isPerspectiveCamera?u/=t:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom*t)),e.object.updateProjectionMatrix(),l=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function $(t){e.object.isPerspectiveCamera?u*=t:e.object.isOrthographicCamera?(e.object.zoom=Math.max(e.minZoom,Math.min(e.maxZoom,e.object.zoom/t)),e.object.updateProjectionMatrix(),l=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),e.enableZoom=!1)}function Q(t){m.set(t.clientX,t.clientY)}function xe(t){f.set(t.clientX,t.clientY)}function J(t){A.set(t.clientX,t.clientY)}function Oe(t){w.set(t.clientX,t.clientY),E.subVectors(w,m).multiplyScalar(e.rotateSpeed);const c=e.domElement;P(2*Math.PI*E.x/c.clientHeight),_(2*Math.PI*E.y/c.clientHeight),m.copy(w),e.update()}function ke(t){x.set(t.clientX,t.clientY),S.subVectors(x,f),S.y>0?G(O()):S.y<0&&$(O()),f.copy(x),e.update()}function ve(t){p.set(t.clientX,t.clientY),b.subVectors(p,A).multiplyScalar(e.panSpeed),k(b.x,b.y),A.copy(p),e.update()}function Re(t){t.deltaY<0?$(O()):t.deltaY>0&&G(O()),e.update()}function Se(t){let c=!1;switch(t.code){case e.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?_(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):k(0,e.keyPanSpeed),c=!0;break;case e.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?_(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):k(0,-e.keyPanSpeed),c=!0;break;case e.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?P(2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):k(e.keyPanSpeed,0),c=!0;break;case e.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?P(-2*Math.PI*e.rotateSpeed/e.domElement.clientHeight):k(-e.keyPanSpeed,0),c=!0;break}c&&(t.preventDefault(),e.update())}function ee(){if(d.length===1)m.set(d[0].pageX,d[0].pageY);else{const t=.5*(d[0].pageX+d[1].pageX),c=.5*(d[0].pageY+d[1].pageY);m.set(t,c)}}function te(){if(d.length===1)A.set(d[0].pageX,d[0].pageY);else{const t=.5*(d[0].pageX+d[1].pageX),c=.5*(d[0].pageY+d[1].pageY);A.set(t,c)}}function oe(){const t=d[0].pageX-d[1].pageX,c=d[0].pageY-d[1].pageY,T=Math.sqrt(t*t+c*c);f.set(0,T)}function Le(){e.enableZoom&&oe(),e.enablePan&&te()}function Ne(){e.enableZoom&&oe(),e.enableRotate&&ee()}function ie(t){if(d.length==1)w.set(t.pageX,t.pageY);else{const T=Z(t),M=.5*(t.pageX+T.x),v=.5*(t.pageY+T.y);w.set(M,v)}E.subVectors(w,m).multiplyScalar(e.rotateSpeed);const c=e.domElement;P(2*Math.PI*E.x/c.clientHeight),_(2*Math.PI*E.y/c.clientHeight),m.copy(w)}function ne(t){if(d.length===1)p.set(t.pageX,t.pageY);else{const c=Z(t),T=.5*(t.pageX+c.x),M=.5*(t.pageY+c.y);p.set(T,M)}b.subVectors(p,A).multiplyScalar(e.panSpeed),k(b.x,b.y),A.copy(p)}function se(t){const c=Z(t),T=t.pageX-c.x,M=t.pageY-c.y,v=Math.sqrt(T*T+M*M);x.set(0,v),S.set(0,Math.pow(x.y/f.y,e.zoomSpeed)),G(S.y),f.copy(x)}function Ue(t){e.enableZoom&&se(t),e.enablePan&&ne(t)}function je(t){e.enableZoom&&se(t),e.enableRotate&&ie(t)}function ae(t){e.enabled!==!1&&(d.length===0&&(e.domElement.setPointerCapture(t.pointerId),e.domElement.addEventListener("pointermove",B),e.domElement.addEventListener("pointerup",X)),Ve(t),t.pointerType==="touch"?Ye(t):Ie(t))}function B(t){e.enabled!==!1&&(t.pointerType==="touch"?ze(t):_e(t))}function X(t){he(t),d.length===0&&(e.domElement.releasePointerCapture(t.pointerId),e.domElement.removeEventListener("pointermove",B),e.domElement.removeEventListener("pointerup",X)),e.dispatchEvent(K),a=s.NONE}function re(t){he(t)}function Ie(t){let c;switch(t.button){case 0:c=e.mouseButtons.LEFT;break;case 1:c=e.mouseButtons.MIDDLE;break;case 2:c=e.mouseButtons.RIGHT;break;default:c=-1}switch(c){case n.MOUSE.DOLLY:if(e.enableZoom===!1)return;xe(t),a=s.DOLLY;break;case n.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enablePan===!1)return;J(t),a=s.PAN}else{if(e.enableRotate===!1)return;Q(t),a=s.ROTATE}break;case n.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(e.enableRotate===!1)return;Q(t),a=s.ROTATE}else{if(e.enablePan===!1)return;J(t),a=s.PAN}break;default:a=s.NONE}a!==s.NONE&&e.dispatchEvent(D)}function _e(t){switch(a){case s.ROTATE:if(e.enableRotate===!1)return;Oe(t);break;case s.DOLLY:if(e.enableZoom===!1)return;ke(t);break;case s.PAN:if(e.enablePan===!1)return;ve(t);break}}function ce(t){e.enabled===!1||e.enableZoom===!1||a!==s.NONE||(t.preventDefault(),e.dispatchEvent(D),Re(t),e.dispatchEvent(K))}function le(t){e.enabled===!1||e.enablePan===!1||Se(t)}function Ye(t){switch(de(t),d.length){case 1:switch(e.touches.ONE){case n.TOUCH.ROTATE:if(e.enableRotate===!1)return;ee(),a=s.TOUCH_ROTATE;break;case n.TOUCH.PAN:if(e.enablePan===!1)return;te(),a=s.TOUCH_PAN;break;default:a=s.NONE}break;case 2:switch(e.touches.TWO){case n.TOUCH.DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Le(),a=s.TOUCH_DOLLY_PAN;break;case n.TOUCH.DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;Ne(),a=s.TOUCH_DOLLY_ROTATE;break;default:a=s.NONE}break;default:a=s.NONE}a!==s.NONE&&e.dispatchEvent(D)}function ze(t){switch(de(t),a){case s.TOUCH_ROTATE:if(e.enableRotate===!1)return;ie(t),e.update();break;case s.TOUCH_PAN:if(e.enablePan===!1)return;ne(t),e.update();break;case s.TOUCH_DOLLY_PAN:if(e.enableZoom===!1&&e.enablePan===!1)return;Ue(t),e.update();break;case s.TOUCH_DOLLY_ROTATE:if(e.enableZoom===!1&&e.enableRotate===!1)return;je(t),e.update();break;default:a=s.NONE}}function ue(t){e.enabled!==!1&&t.preventDefault()}function Ve(t){d.push(t)}function he(t){delete I[t.pointerId];for(let c=0;c[Number(e),Array.isArray(s)?s:[s]]).sort(([e],[s])=>e-s)}getCurrentEffects(){if(this.currentEffectIndex>=this.effects.length)return;const o=this.effects[this.currentEffectIndex];if(!(o[0]>this.animation.roundedCurrentTime))return this.currentEffectIndex++,o[1]}reset(){this.currentEffectIndex=0}}class ye extends C{tick(){const o=super.getCurrentEffects()??[];o.length>0&&console.log(`Playing sound effects: "${o.map(i=>i.effect).join(", ")}"`)}}class we extends C{constructor(){super(...arguments),this.disposables=[]}tick(){this.tickingEffects.forEach(i=>i.tick());const o=super.getCurrentEffects()??[];for(const{locator:i,effect:e,pre_effect_script:s}of o){if(!e)return;const a=this.animation.getAnimator(),g=a.getModel(),r=a.getEmitter(e);if(!r||!a.winterskyScene)return;const h=i?g.getLocator(i):void 0,u=new fe.Emitter(a.winterskyScene,r,{parent_mode:h?"locator":"entity",loop_mode:"once"});h&&(h.add(u.local_space),u.local_space.parent=h);const y={tick:()=>{u.tick(),u.enabled||(u.delete(),this.tickingEffects=this.tickingEffects.filter(l=>l!==y))}};this.tickingEffects.push(y),this.disposables.push({dispose:()=>{u.delete(),this.tickingEffects=this.tickingEffects.filter(l=>l!==y)}}),u.start(),u.tick()}}dispose(){this.disposables.forEach(o=>o.dispose()),this.disposables=[]}}class be{constructor(o,i){this.animator=o,this.animationData=i,this.startTimestamp=0,this.lastFrameTimestamp=0,this.isRunning=!1,this.env={"query.anim_time":()=>this.currentTime,"query.delta_time":()=>this.startTimestamp-this.lastFrameTimestamp,"query.life_time":()=>this.currentTime},this.molang=new me.Molang(this.env,{convertUndefined:!0}),this.soundEffects=new ye(this,this.animationData.sound_effects??{}),this.particleEffects=new we(this,this.animationData.particle_effects??{})}getAnimator(){return this.animator}execute(o){return this.molang.executeAndCatch(o)}parseBoneModifier(o){if(typeof o=="number")return[o,o,o];if(typeof o=="string"){const i=typeof o=="string"?this.execute(o):o;return[i,i,i]}else{if(Array.isArray(o))return o.map(i=>typeof i=="string"?this.execute(i):i);if(o!==void 0){const i=Object.entries(o).map(([e,s])=>[Number(e),s]).sort(([e],[s])=>e-s);for(let e=i.length-1;e>=0;e--){let[s,a]=i[e];if(!(s>this.currentTime))if(s===this.currentTime){if(Array.isArray(a))return a.map(g=>typeof g=="string"?this.execute(g):g);throw new Error("Format not supported yet")}else{let[g,r]=i[n.MathUtils.euclideanModulo(e+1,i.length)],h=g-s;if(Array.isArray(a)&&Array.isArray(r))return a=a.map(u=>typeof u=="string"?this.execute(u):u),r=r.map(u=>typeof u=="string"?this.execute(u):u),a.map((u,y)=>u+(r[y]-u)/h*(this.currentTime-s));throw new Error("Format not supported yet")}}return[0,0,0]}}}tick(){this.soundEffects.tick(),this.particleEffects.tick();const o=this.animator.getModel().getBoneMap();for(let i in this.animationData.bones){const e=o.get(i);if(!e)continue;const{position:s,rotation:a,scale:g}=this.animationData.bones[i],[r,h,u]=[s,a,g].map(y=>this.parseBoneModifier(y));if(r){const y=e.position.toArray();e.position.set(...r.map((l,m)=>(m===0?-1:1)*l+y[m]))}if(h){const y=e.rotation.toArray();e.rotation.set(...h.map(l=>n.MathUtils.degToRad(l)).map((l,m)=>y[m]+(m===2?l:-l)))}u&&e.scale.set(...u)}this.currentTime>this.animationData.animation_length&&(this.animationData.loop?this.loop():this.pause()),this.lastFrameTimestamp=Date.now()}play(){this.isRunning=!0,this.startTimestamp=Date.now()}pause(){this.isRunning=!1}loop(){this.startTimestamp=Date.now(),this.soundEffects.reset(),this.particleEffects.reset()}dispose(){this.particleEffects.dispose()}get currentTime(){return(Date.now()-this.startTimestamp)/1e3}get roundedCurrentTime(){return Math.round((Date.now()-this.startTimestamp)/50)/20}get shouldTick(){return this.isRunning}}class Ee{constructor(o){this.model=o,this.animations=new Map,this.particleEmitters=new Map}setupDefaultBonePoses(){for(let o of this.model.getBoneMap().values())o.userData.defaultRotation=o.rotation.toArray(),o.userData.defaultPosition=o.position.toArray()}dispose(){this.disposeAnimations();for(let o of this.model.getBoneMap().values())delete o.userData.defaultRotation,delete o.userData.defaultPosition}disposeAnimations(){this.animations.forEach(o=>o.dispose())}setupWintersky(o){this.winterskyScene=o}addAnimation(o,i){this.animations.set(o,new be(this,i))}addEmitter(o,i){this.particleEmitters.set(o,i)}getEmitter(o){return this.particleEmitters.get(o)}play(o){const i=this.animations.get(o);if(!i)throw new Error(`Unknown animation: "${o}"`);i.play()}pause(o){const i=this.animations.get(o);if(!i)throw new Error(`Unknown animation: "${o}"`);i.pause()}pauseAll(){for(const o of this.animations.values())o.pause()}tick(){for(let o of this.model.getBoneMap().values())o.rotation.set(...o.userData.defaultRotation),o.position.set(...o.userData.defaultPosition);this.animations.forEach(o=>o.shouldTick&&o.tick())}get shouldTick(){return[...this.animations.values()].some(o=>o.shouldTick)}getModel(){return this.model}}const Te=[{name:"west",baseUV:[2,1],dir:[-1,0,0],corners:[{pos:[-.5,1,0],uv:[0,1]},{pos:[-.5,0,0],uv:[0,0]},{pos:[-.5,1,1],uv:[1,1]},{pos:[-.5,0,1],uv:[1,0]}]},{name:"east",baseUV:[0,1],dir:[1,0,0],corners:[{pos:[.5,1,1],uv:[0,1]},{pos:[.5,0,1],uv:[0,0]},{pos:[.5,1,0],uv:[1,1]},{pos:[.5,0,0],uv:[1,0]}]},{name:"down",baseUV:[2,0],dir:[0,-1,0],corners:[{pos:[.5,0,1],uv:[0,1]},{pos:[-.5,0,1],uv:[1,1]},{pos:[.5,0,0],uv:[0,0]},{pos:[-.5,0,0],uv:[1,0]}]},{name:"up",baseUV:[1,0],dir:[0,1,0],corners:[{pos:[-.5,1,1],uv:[1,1]},{pos:[.5,1,1],uv:[0,1]},{pos:[-.5,1,0],uv:[1,0]},{pos:[.5,1,0],uv:[0,0]}]},{name:"north",baseUV:[1,1],dir:[0,0,-1],corners:[{pos:[-.5,0,0],uv:[1,0]},{pos:[.5,0,0],uv:[0,0]},{pos:[-.5,1,0],uv:[1,1]},{pos:[.5,1,0],uv:[0,1]}]},{name:"south",baseUV:[3,1],dir:[0,0,1],corners:[{pos:[-.5,0,1],uv:[0,0]},{pos:[.5,0,1],uv:[1,0]},{pos:[-.5,1,1],uv:[0,1]},{pos:[.5,1,1],uv:[1,1]}]}],z=.03;class Me{constructor(o){var p,b;this.positions=[],this.indices=[],this.normals=[],this.uvs=[],this.geometry=new n.BufferGeometry,this.group=new n.Group;const{textureSize:[i,e],textureDiscrepancyFactor:[s,a],mirror:g,width:r,height:h,depth:u}=o,[y,l]=[i*s,e*a],m=o.startUV??[0,0],w=!Array.isArray(m);let E=0,A=0;w||([E,A]=m);for(let{name:f,dir:x,corners:S,baseUV:[d,I]}of Te){const j=this.positions.length/3;let O,P;if(w){if(m[f]===void 0)continue;[E,A]=((p=m[f])==null?void 0:p.uv)||[],[O,P]=((b=m[f])==null?void 0:b.uv_size)||[],O*=s,P*=a,E*=s,A*=a,d=0,I=0}for(const{pos:[_,V,F],uv:k}of S)this.positions.push((g?-_:_)*r,V*h,F*u),this.normals.push(...x),this.uvs.push((E+(+(d>0)+ +(d>2))*Math.floor(O??u)+ +(d>1)*Math.floor(O??r)+k[0]*Math.floor(f==="west"||f==="east"?O??u:O??r)+(k[0]===0?z:-z))/(y/(w?1:s)),1-(A+I*Math.floor(P??u)+Math.floor(f==="up"||f==="down"?P??u:P??h)-k[1]*Math.floor(f==="up"||f==="down"?P??u:P??h)+(k[1]===0?-z:z))/(l/(w?1:a)));this.indices.push(j,j+1,j+2,j+2,j+1,j+3)}this.createGeometry(),this.createMesh(o)}createGeometry(){this.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(this.positions),3)),this.geometry.setAttribute("normal",new n.BufferAttribute(new Float32Array(this.normals),3)),this.geometry.setAttribute("uv",new n.BufferAttribute(new Float32Array(this.uvs),2)),this.geometry.setIndex(this.indices)}createMesh({material:o,width:i,height:e,depth:s,pivot:a,rotation:g,origin:r,inflate:h=0}){const u=h*2+i,y=new n.Mesh(this.geometry,o);if(this.group.rotation.order="ZYX",a===void 0&&(a=[u/2,e/2,s/2]),this.group.add(y),g){this.group.position.set(-a[0],a[1],a[2]),y.position.set(-r[0]-u/2+a[0]+h,r[1]-a[1]-h,r[2]-a[2]-h);const[l,m,w]=g;this.group.rotation.set(n.MathUtils.degToRad(-l),n.MathUtils.degToRad(-m),n.MathUtils.degToRad(w))}else this.group.position.set(-r[0]-u/2+h,r[1]-h,r[2]-h);h&&this.group.scale.set(i!==0?1+h/(i/2):1,e!==0?1+h/(e/2):1,s!==0?1+h/(s/2):1)}getGroup(){return this.group}}class Ae{constructor(o){var e,s,a,g;if(this.positions=[],this.indices=[],this.normals=[],this.uvs=[],this.geometry=new n.BufferGeometry,this.group=new n.Group,!Array.isArray(o.polys))throw new Error("Format not supported yet!");o.normalized_uvs||(o.uvs=(e=o==null?void 0:o.uvs)==null?void 0:e.map(([r,h])=>[r/o.textureSize[0],h/o.textureSize[1]]));let i=0;for(const r of o.polys){for(const[h,u,y]of r)this.positions.push(...((s=o==null?void 0:o.positions)==null?void 0:s[h])??[]),this.normals.push(...((a=o==null?void 0:o.normals)==null?void 0:a[u])??[]),this.uvs.push(...((g=o==null?void 0:o.uvs)==null?void 0:g[y])??[]);r.length===3?this.indices.push(i,i+1,i+2):this.indices.push(i+2,i+1,i,i+2,i,i+3),i+=r.length}this.createGeometry(),this.createMesh(o)}createGeometry(){this.geometry.setAttribute("position",new n.BufferAttribute(new Float32Array(this.positions),3)),this.geometry.setAttribute("normal",new n.BufferAttribute(new Float32Array(this.normals),3)),this.geometry.setAttribute("uv",new n.BufferAttribute(new Float32Array(this.uvs),2)),this.geometry.setIndex(this.indices)}createMesh({material:o}){const i=new n.Mesh(this.geometry,o);this.group.add(i)}getGroup(){return this.group}}class W{constructor(o,i){var s;this.modelData=o,this.texturePath=i,this.boneMap=new Map,this.locators=new Map,this.animator=new Ee(this);const e=((s=o==null?void 0:o.description)==null?void 0:s.identifier)??"geometry.unknown";this.model=new n.Group,this.model.name=e}async create(){var r,h,u,y;const o=this.modelData,i=await this.loadTexture(this.texturePath),e=[((r=o==null?void 0:o.description)==null?void 0:r.texture_width)??i.image.width,((h=o==null?void 0:o.description)==null?void 0:h.texture_height)??i.image.height],s=[i.image.width/e[0],i.image.height/e[1]],a=new Map;i.magFilter=n.NearestFilter,i.minFilter=n.NearestFilter;const g=new n.MeshLambertMaterial({side:n.DoubleSide,alphaTest:.2,transparent:!0,map:i});(u=o==null?void 0:o.bones)==null||u.forEach(l=>{var A;const m=new n.Group;if(m.name=l.name??"unknown",l.poly_mesh){const p=new Ae({...l.poly_mesh,textureSize:e,material:g,mirror:l.mirror??!1,origin:[0,0,0],inflate:l.inflate,rotation:[0,0,0],pivot:l.pivot}).getGroup();p.name=`#bone.${l.name}#polyMesh`,m.add(p)}(A=l.cubes)==null||A.forEach((p,b)=>{var x,S,d;const f=new Me({width:((x=p.size)==null?void 0:x[0])??0,height:((S=p.size)==null?void 0:S[1])??0,depth:((d=p.size)==null?void 0:d[2])??0,startUV:p.uv,textureSize:e,textureDiscrepancyFactor:s,material:g,mirror:p.mirror===void 0&&p.rotation===void 0?l.mirror??!1:p.mirror??!1,origin:p.origin??[0,0,0],inflate:p.inflate??l.inflate,rotation:p.rotation,pivot:p.pivot??l.pivot}).getGroup();f.name=`#bone.${l.name}#cube.${b}`,m.add(f)});const w=new n.Group;if(w.rotation.order="ZYX",l.pivot){const[p,b,f]=l.pivot;w.position.set(-p,b,f),m.position.set(p,-b,-f)}else w.position.set(0,0,0);if(w.add(m),w.name=`#pivot.${l.name}`,l.rotation){const[p,b,f]=l.rotation;w.rotation.set(n.MathUtils.degToRad(-p),n.MathUtils.degToRad(-b),n.MathUtils.degToRad(f))}const E=l.locators??{};for(const p in E){const b=new n.Group;b.name=`locator#${p}`;const f=E[p];Array.isArray(f)?b.position.set(...f):typeof f=="object"&&(b.position.set(...f.offset??[0,0,0]),b.rotation.set(...f.rotation??[0,0,0])),this.locators.set(p,b),w.add(b)}l.parent||this.model.add(w),l.name&&(a.set(l.name,[l.parent,w]),this.boneMap.set(l.name,w))});for(let[l,[m,w]]of a)if(m){const E=(y=a.get(m))==null?void 0:y[1];E&&E.name.startsWith("#pivot.")?E.children[0].add(w):E&&E.add(w)}this.animator.setupDefaultBonePoses()}getGroup(){return this.model}getBoneMap(){return this.boneMap}getLocator(o){return this.locators.get(o)}tick(){this.animator.tick()}get shouldTick(){return this.animator.shouldTick}createOutlineBox(o,i,e){const s=new n.LineBasicMaterial({side:n.DoubleSide,color:o,linewidth:20}),a=new n.BoxGeometry(e.x,e.y,e.z),g=new n.EdgesGeometry(a),r=new n.LineSegments(g,s);return r.position.set(i.x,i.y+e.y/2,i.z),r.name="helperBox",this.model.add(r),{dispose:()=>{this.model.remove(r)}}}hideBone(o){const i=this.boneMap.get(o);i&&(i.visible=!1)}showBone(o){const i=this.boneMap.get(o);i&&(i.visible=!0)}get bones(){return[...this.boneMap.keys()]}dispose(){this.animator.dispose()}loadTexture(o){return new Promise((i,e)=>{new n.TextureLoader().load(o,a=>{i(a)})})}}class Pe{constructor(o,i,e,s){this.canvasElement=o,this.texturePath=e,this.options=s,this.renderingRequested=!1,this.renderer=new n.WebGLRenderer({canvas:o,antialias:s.antialias??!1}),this.renderer.setPixelRatio(window.devicePixelRatio),this.camera=new n.PerspectiveCamera(70,2,.1,1e3),this.camera.position.x=-20,this.camera.position.y=20,this.camera.position.z=-20,this.camera.updateProjectionMatrix(),this.controls=new ge(this.camera,o),this.scene=new n.Scene,this.scene.add(new n.AmbientLight(16777215)),this.scene.background=new n.Color(13299960),this.model=new W(i,e),this.scene.add(this.model.getGroup()),window.addEventListener("resize",this.onResize.bind(this)),this.controls.addEventListener("change",()=>this.requestRendering()),this.onResize(),this.loadedModel=this.loadModel().then(()=>this.requestRendering())}async loadModel(){await this.model.create()}get width(){return this.options.width??window.innerWidth}get height(){return this.options.height??window.innerHeight}render(o=!0){var i;this.controls.update(),this.renderer.render(this.scene,this.camera),this.renderingRequested=!1,o&&this.model.shouldTick&&(this.model.tick(),(i=this.model.animator.winterskyScene)==null||i.updateFacingRotation(this.camera),this.requestRendering())}requestRendering(o=!1){if(o)return this.render(!1);this.renderingRequested||(this.renderingRequested=!0,requestAnimationFrame(()=>this.render()))}onResize(){this.renderer.setSize(this.width,this.height,!0),this.camera.aspect=this.width/this.height,this.positionCamera(),this.requestRendering()}dispose(){window.removeEventListener("resize",this.onResize),this.controls.removeEventListener("change",this.requestRendering)}addHelpers(){this.scene.add(new n.AxesHelper(50)),this.scene.add(new n.GridHelper(20,20)),this.scene.add(new n.BoxHelper(this.model.getGroup(),16776960)),this.requestRendering()}getModel(){return this.model}positionCamera(o=1.5,i=!0){i&&this.model.getGroup().rotation.set(0,Math.PI,0);const e=new n.Box3().setFromObject(this.model.getGroup()).getBoundingSphere(new n.Sphere),s=this.camera.fov*Math.PI/180*o,a=e.radius/Math.tan(s/2),g=Math.sqrt(Math.pow(a,2)+Math.pow(a,2));this.camera.position.set(g,g,g),this.controls.update(),this.camera.lookAt(e.center),this.controls.target.set(e.center.x,e.center.y,e.center.z),this.camera.updateProjectionMatrix()}}R.Model=W,R.StandaloneModelViewer=Pe,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}); diff --git a/lib/Animations/Animation.ts b/lib/Animations/Animation.ts index 4414019..aea26de 100644 --- a/lib/Animations/Animation.ts +++ b/lib/Animations/Animation.ts @@ -1,4 +1,4 @@ -import { MoLang } from 'molang' +import { Molang } from 'molang' import { ISingleAnimation, TBoneModifier, @@ -18,7 +18,7 @@ export class Animation { 'query.delta_time': () => this.startTimestamp - this.lastFrameTimestamp, 'query.life_time': () => this.currentTime, } - protected molang = new MoLang(this.env, { + protected molang = new Molang(this.env, { convertUndefined: true, }) protected soundEffects: SoundEffect @@ -157,7 +157,7 @@ export class Animation { .map((n) => MathUtils.degToRad(n)) .map( (val, i) => - currentRotation[i] + (i === 2 ? val : -val) + (currentRotation[i] as number) + (i === 2 ? val : -val) ) as [number, number, number]) ) } diff --git a/lib/main.ts b/lib/main.ts index 033bb3a..256387b 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -16,6 +16,9 @@ import { IGeoSchema } from './Schema/Model' export { Model } from './Model' +export * from './Schema/Model' +export * from './Schema/Animation' + export interface IOptions { alpha?: boolean antialias?: boolean @@ -26,10 +29,10 @@ export interface IOptions { export class StandaloneModelViewer { protected renderer: WebGLRenderer protected model: Model - protected scene: Scene + public readonly scene: Scene protected camera: PerspectiveCamera protected renderingRequested = false - protected controls: OrbitControls + public readonly controls: OrbitControls public readonly loadedModel: Promise constructor( diff --git a/package-lock.json b/package-lock.json index 69815ee..8632294 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,55 +9,36 @@ "version": "0.7.7", "license": "MIT", "dependencies": { - "molang": "^1.13.9", - "three": "^0.139.2", - "wintersky": "^1.1.0" + "molang": "^2.0.1", + "three": "^0.147.0", + "wintersky": "^1.3.0" }, "devDependencies": { - "@types/three": "^0.135.0", + "@types/three": "^0.147.0", "typescript": "^4.3.5", - "vite": "^2.7.10" + "vite": "^4.4.9" } }, - "node_modules/@types/three": { - "version": "0.135.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.135.0.tgz", - "integrity": "sha512-l7WLhIHjhHMtlpyTSltPPAKLpiMwgMD1hXHj59AVUpYRoZP7Fd9NNOSRSvZBCPLpTHPYojgQvSJCoza9zoL7bg==", - "dev": true - }, - "node_modules/esbuild": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", - "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "optionalDependencies": { - "esbuild-android-arm64": "0.13.15", - "esbuild-darwin-64": "0.13.15", - "esbuild-darwin-arm64": "0.13.15", - "esbuild-freebsd-64": "0.13.15", - "esbuild-freebsd-arm64": "0.13.15", - "esbuild-linux-32": "0.13.15", - "esbuild-linux-64": "0.13.15", - "esbuild-linux-arm": "0.13.15", - "esbuild-linux-arm64": "0.13.15", - "esbuild-linux-mips64le": "0.13.15", - "esbuild-linux-ppc64le": "0.13.15", - "esbuild-netbsd-64": "0.13.15", - "esbuild-openbsd-64": "0.13.15", - "esbuild-sunos-64": "0.13.15", - "esbuild-windows-32": "0.13.15", - "esbuild-windows-64": "0.13.15", - "esbuild-windows-arm64": "0.13.15" - } - }, - "node_modules/esbuild-android-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", - "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", "cpu": [ "arm64" ], @@ -65,25 +46,31 @@ "optional": true, "os": [ "android" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-darwin-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", - "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", + "node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ - "darwin" - ] + "android" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-darwin-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", - "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", + "node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", "cpu": [ "arm64" ], @@ -91,25 +78,31 @@ "optional": true, "os": [ "darwin" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-freebsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", - "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", "cpu": [ "x64" ], "dev": true, "optional": true, "os": [ - "freebsd" - ] + "darwin" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-freebsd-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", - "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", "cpu": [ "arm64" ], @@ -117,64 +110,95 @@ "optional": true, "os": [ "freebsd" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-32": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", - "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", + "node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", "cpu": [ - "ia32" + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" ], "dev": true, "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", - "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", + "node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", "cpu": [ - "x64" + "arm64" ], "dev": true, "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-arm": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", - "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", + "node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", "cpu": [ - "arm" + "ia32" ], "dev": true, "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", - "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", + "node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", "cpu": [ - "arm64" + "loong64" ], "dev": true, "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-mips64le": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", - "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", + "node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", "cpu": [ "mips64el" ], @@ -182,12 +206,15 @@ "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-linux-ppc64le": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", - "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", + "node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", "cpu": [ "ppc64" ], @@ -195,12 +222,63 @@ "optional": true, "os": [ "linux" - ] + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-netbsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", - "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", + "node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", "cpu": [ "x64" ], @@ -208,12 +286,15 @@ "optional": true, "os": [ "netbsd" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-openbsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", - "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", + "node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", "cpu": [ "x64" ], @@ -221,12 +302,15 @@ "optional": true, "os": [ "openbsd" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-sunos-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", - "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", + "node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", "cpu": [ "x64" ], @@ -234,51 +318,115 @@ "optional": true, "os": [ "sunos" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-windows-32": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", - "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", + "node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", "cpu": [ - "ia32" + "arm64" ], "dev": true, "optional": true, "os": [ "win32" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-windows-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", - "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", + "node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", "cpu": [ - "x64" + "ia32" ], "dev": true, "optional": true, "os": [ "win32" - ] + ], + "engines": { + "node": ">=12" + } }, - "node_modules/esbuild-windows-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", - "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", + "node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "cpu": [ - "arm64" + "x64" ], "dev": true, "optional": true, "os": [ "win32" - ] + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/three": { + "version": "0.147.1", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.147.1.tgz", + "integrity": "sha512-1dGYrF9E7frAXu3CRUYtTFj97PlA/Q0OedDQBROn3fKjtKXNhXc6/VNgkGod3axJMeNPNFDa6ur9eOcQ+aD0zw==", + "dev": true, + "dependencies": { + "@types/webxr": "*" + } + }, + "node_modules/@types/webxr": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.5.tgz", + "integrity": "sha512-HVOsSRTQYx3zpVl0c0FBmmmcY/60BkQLzVnpE9M1aG4f2Z0aKlBWfj4XZ2zr++XNBfkQWYcwhGlmuu44RJPDqg==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -289,39 +437,27 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/molang": { - "version": "1.13.9", - "resolved": "https://registry.npmjs.org/molang/-/molang-1.13.9.tgz", - "integrity": "sha512-Xchil1IMR0ERAxKxP9KacSUvfDFO8aprwJJziODFDA0Rp3sVO8oiycR6DNhPl7WAJA5ClXroHFWGyd6DGfur0A==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/molang/-/molang-2.0.1.tgz", + "integrity": "sha512-zVD9mAgv6MmpVGj54hS1EzG86Q6P2bwt8sP8uHiQT65e2e92nbnItrpjH0C6W65YxXNXrbiaEI4N0DCkcjdEFA==" }, "node_modules/molangjs": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/molangjs/-/molangjs-1.5.0.tgz", - "integrity": "sha512-NrK5yqL/hj+L8+vRv1S87gU5a+dxW/XAv1khZ+GhG0NvnBMace20wTQpWAFLHkongB4qfg6H/+fVdnJrP+HZpg==" + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/molangjs/-/molangjs-1.6.3.tgz", + "integrity": "sha512-53yOSZpHuR7HUZBZ34uTQBd71kxS/yln/oEtUagkRVukHZJf7GSL9WoE7DzOHfoAOUok8ZGQLWiAqLfZomJBKA==" }, "node_modules/nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true, + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -329,12 +465,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -342,51 +472,62 @@ "dev": true }, "node_modules/postcss": { - "version": "8.4.5", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", - "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", - "dev": true, + "version": "8.4.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.30.tgz", + "integrity": "sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "dependencies": { - "nanoid": "^3.1.30", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", - "source-map-js": "^1.0.1" + "source-map-js": "^1.0.2" }, "engines": { "node": "^10 || ^12 || >=14" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" } }, "node_modules/rollup": { - "version": "2.62.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.62.0.tgz", - "integrity": "sha512-cJEQq2gwB0GWMD3rYImefQTSjrPYaC6s4J9pYqnstVLJ1CHa/aZNVkD4Epuvg4iLeMA4KRiq7UM7awKK6j7jcw==", + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, "bin": { "rollup": "dist/bin/rollup" }, "engines": { - "node": ">=10.0.0" + "node": ">=14.18.0", + "npm": ">=8.0.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "node_modules/source-map-js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", - "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true, "engines": { "node": ">=0.10.0" } }, "node_modules/three": { - "version": "0.139.2", - "resolved": "https://registry.npmjs.org/three/-/three-0.139.2.tgz", - "integrity": "sha512-gV7q7QY8rogu7HLFZR9cWnOQAUedUhu2WXAnpr2kdXZP9YDKsG/0ychwQvWkZN5PlNw9mv5MoCTin6zNTXoONg==" + "version": "0.147.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.147.0.tgz", + "integrity": "sha512-LPTOslYQXFkmvceQjFTNnVVli2LaVF6C99Pv34fJypp8NbQLbTlu3KinZ0zURghS5zEehK+VQyvWuPZ/Sm8fzw==" }, "node_modules/tinycolor2": { "version": "1.4.2", @@ -410,271 +551,297 @@ } }, "node_modules/vite": { - "version": "2.7.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-2.7.10.tgz", - "integrity": "sha512-KEY96ntXUid1/xJihJbgmLZx7QSC2D4Tui0FdS0Old5OokYzFclcofhtxtjDdGOk/fFpPbHv9yw88+rB93Tb8w==", + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", + "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", "dev": true, "dependencies": { - "esbuild": "^0.13.12", - "postcss": "^8.4.5", - "resolve": "^1.20.0", - "rollup": "^2.59.0" + "esbuild": "^0.18.10", + "postcss": "^8.4.27", + "rollup": "^3.27.1" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": ">=12.2.0" + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { + "@types/node": ">= 14", "less": "*", + "lightningcss": "^1.21.0", "sass": "*", - "stylus": "*" + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" }, "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, "less": { "optional": true }, + "lightningcss": { + "optional": true + }, "sass": { "optional": true }, "stylus": { "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true } } }, - "node_modules/vite/node_modules/is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/vite/node_modules/resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dev": true, - "dependencies": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/wintersky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/wintersky/-/wintersky-1.1.0.tgz", - "integrity": "sha512-wN4ZjgzZejM/Kvcoe6/7O5sSf2ERLAJvxI/1h0rqXuQdCLW98g40OVWi7v5ZthRqxJikhPcVMdN/TVZ4eCu/RQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/wintersky/-/wintersky-1.3.0.tgz", + "integrity": "sha512-ibeUF+sgoIrFAfgqcNsPlr8+4l0KOfhGw+JgjxKcgtbckSy3gAxqAeNX5LjuQK9y7jcBZDwUIXg9sZDGQ1W+hQ==", "dependencies": { - "molangjs": "^1.5.0", - "three": "^0.139.2", + "molangjs": "^1.6.3", + "three": "^0.134.0", "tinycolor2": "^1.4.2" } + }, + "node_modules/wintersky/node_modules/three": { + "version": "0.134.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.134.0.tgz", + "integrity": "sha512-LbBerg7GaSPjYtTOnu41AMp7tV6efUNR3p4Wk5NzkSsNTBuA5mDGOfwwZL1jhhVMLx9V20HolIUo0+U3AXehbg==" } }, "dependencies": { - "@types/three": { - "version": "0.135.0", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.135.0.tgz", - "integrity": "sha512-l7WLhIHjhHMtlpyTSltPPAKLpiMwgMD1hXHj59AVUpYRoZP7Fd9NNOSRSvZBCPLpTHPYojgQvSJCoza9zoL7bg==", - "dev": true + "@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "dev": true, + "optional": true }, - "esbuild": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.13.15.tgz", - "integrity": "sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw==", + "@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", "dev": true, - "requires": { - "esbuild-android-arm64": "0.13.15", - "esbuild-darwin-64": "0.13.15", - "esbuild-darwin-arm64": "0.13.15", - "esbuild-freebsd-64": "0.13.15", - "esbuild-freebsd-arm64": "0.13.15", - "esbuild-linux-32": "0.13.15", - "esbuild-linux-64": "0.13.15", - "esbuild-linux-arm": "0.13.15", - "esbuild-linux-arm64": "0.13.15", - "esbuild-linux-mips64le": "0.13.15", - "esbuild-linux-ppc64le": "0.13.15", - "esbuild-netbsd-64": "0.13.15", - "esbuild-openbsd-64": "0.13.15", - "esbuild-sunos-64": "0.13.15", - "esbuild-windows-32": "0.13.15", - "esbuild-windows-64": "0.13.15", - "esbuild-windows-arm64": "0.13.15" - } - }, - "esbuild-android-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.13.15.tgz", - "integrity": "sha512-m602nft/XXeO8YQPUDVoHfjyRVPdPgjyyXOxZ44MK/agewFFkPa8tUo6lAzSWh5Ui5PB4KR9UIFTSBKh/RrCmg==", + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", "dev": true, "optional": true }, - "esbuild-darwin-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.13.15.tgz", - "integrity": "sha512-ihOQRGs2yyp7t5bArCwnvn2Atr6X4axqPpEdCFPVp7iUj4cVSdisgvEKdNR7yH3JDjW6aQDw40iQFoTqejqxvQ==", + "@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", "dev": true, "optional": true }, - "esbuild-darwin-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.13.15.tgz", - "integrity": "sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ==", + "@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", "dev": true, "optional": true }, - "esbuild-freebsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.13.15.tgz", - "integrity": "sha512-G3dLBXUI6lC6Z09/x+WtXBXbOYQZ0E8TDBqvn7aMaOCzryJs8LyVXKY4CPnHFXZAbSwkCbqiPuSQ1+HhrNk7EA==", + "@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", "dev": true, "optional": true }, - "esbuild-freebsd-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.13.15.tgz", - "integrity": "sha512-KJx0fzEDf1uhNOZQStV4ujg30WlnwqUASaGSFPhznLM/bbheu9HhqZ6mJJZM32lkyfGJikw0jg7v3S0oAvtvQQ==", + "@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", "dev": true, "optional": true }, - "esbuild-linux-32": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.13.15.tgz", - "integrity": "sha512-ZvTBPk0YWCLMCXiFmD5EUtB30zIPvC5Itxz0mdTu/xZBbbHJftQgLWY49wEPSn2T/TxahYCRDWun5smRa0Tu+g==", + "@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", "dev": true, "optional": true }, - "esbuild-linux-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.13.15.tgz", - "integrity": "sha512-eCKzkNSLywNeQTRBxJRQ0jxRCl2YWdMB3+PkWFo2BBQYC5mISLIVIjThNtn6HUNqua1pnvgP5xX0nHbZbPj5oA==", + "@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", "dev": true, "optional": true }, - "esbuild-linux-arm": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.13.15.tgz", - "integrity": "sha512-wUHttDi/ol0tD8ZgUMDH8Ef7IbDX+/UsWJOXaAyTdkT7Yy9ZBqPg8bgB/Dn3CZ9SBpNieozrPRHm0BGww7W/jA==", + "@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", "dev": true, "optional": true }, - "esbuild-linux-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.13.15.tgz", - "integrity": "sha512-bYpuUlN6qYU9slzr/ltyLTR9YTBS7qUDymO8SV7kjeNext61OdmqFAzuVZom+OLW1HPHseBfJ/JfdSlx8oTUoA==", + "@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", "dev": true, "optional": true }, - "esbuild-linux-mips64le": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.13.15.tgz", - "integrity": "sha512-KlVjIG828uFPyJkO/8gKwy9RbXhCEUeFsCGOJBepUlpa7G8/SeZgncUEz/tOOUJTcWMTmFMtdd3GElGyAtbSWg==", + "@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", "dev": true, "optional": true }, - "esbuild-linux-ppc64le": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.13.15.tgz", - "integrity": "sha512-h6gYF+OsaqEuBjeesTBtUPw0bmiDu7eAeuc2OEH9S6mV9/jPhPdhOWzdeshb0BskRZxPhxPOjqZ+/OqLcxQwEQ==", + "@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", "dev": true, "optional": true }, - "esbuild-netbsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.13.15.tgz", - "integrity": "sha512-3+yE9emwoevLMyvu+iR3rsa+Xwhie7ZEHMGDQ6dkqP/ndFzRHkobHUKTe+NCApSqG5ce2z4rFu+NX/UHnxlh3w==", + "@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", "dev": true, "optional": true }, - "esbuild-openbsd-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.13.15.tgz", - "integrity": "sha512-wTfvtwYJYAFL1fSs8yHIdf5GEE4NkbtbXtjLWjM3Cw8mmQKqsg8kTiqJ9NJQe5NX/5Qlo7Xd9r1yKMMkHllp5g==", + "@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", "dev": true, "optional": true }, - "esbuild-sunos-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.13.15.tgz", - "integrity": "sha512-lbivT9Bx3t1iWWrSnGyBP9ODriEvWDRiweAs69vI+miJoeKwHWOComSRukttbuzjZ8r1q0mQJ8Z7yUsDJ3hKdw==", + "@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", "dev": true, "optional": true }, - "esbuild-windows-32": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.13.15.tgz", - "integrity": "sha512-fDMEf2g3SsJ599MBr50cY5ve5lP1wyVwTe6aLJsM01KtxyKkB4UT+fc5MXQFn3RLrAIAZOG+tHC+yXObpSn7Nw==", + "@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", "dev": true, "optional": true }, - "esbuild-windows-64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.13.15.tgz", - "integrity": "sha512-9aMsPRGDWCd3bGjUIKG/ZOJPKsiztlxl/Q3C1XDswO6eNX/Jtwu4M+jb6YDH9hRSUflQWX0XKAfWzgy5Wk54JQ==", + "@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", "dev": true, "optional": true }, - "esbuild-windows-arm64": { - "version": "0.13.15", - "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz", - "integrity": "sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA==", + "@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", "dev": true, "optional": true }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", "dev": true, "optional": true }, - "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "@types/three": { + "version": "0.147.1", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.147.1.tgz", + "integrity": "sha512-1dGYrF9E7frAXu3CRUYtTFj97PlA/Q0OedDQBROn3fKjtKXNhXc6/VNgkGod3axJMeNPNFDa6ur9eOcQ+aD0zw==", + "dev": true, + "requires": { + "@types/webxr": "*" + } + }, + "@types/webxr": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.5.tgz", + "integrity": "sha512-HVOsSRTQYx3zpVl0c0FBmmmcY/60BkQLzVnpE9M1aG4f2Z0aKlBWfj4XZ2zr++XNBfkQWYcwhGlmuu44RJPDqg==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "dev": true, "requires": { - "function-bind": "^1.1.1" + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" } }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, "molang": { - "version": "1.13.9", - "resolved": "https://registry.npmjs.org/molang/-/molang-1.13.9.tgz", - "integrity": "sha512-Xchil1IMR0ERAxKxP9KacSUvfDFO8aprwJJziODFDA0Rp3sVO8oiycR6DNhPl7WAJA5ClXroHFWGyd6DGfur0A==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/molang/-/molang-2.0.1.tgz", + "integrity": "sha512-zVD9mAgv6MmpVGj54hS1EzG86Q6P2bwt8sP8uHiQT65e2e92nbnItrpjH0C6W65YxXNXrbiaEI4N0DCkcjdEFA==" }, "molangjs": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/molangjs/-/molangjs-1.5.0.tgz", - "integrity": "sha512-NrK5yqL/hj+L8+vRv1S87gU5a+dxW/XAv1khZ+GhG0NvnBMace20wTQpWAFLHkongB4qfg6H/+fVdnJrP+HZpg==" + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/molangjs/-/molangjs-1.6.3.tgz", + "integrity": "sha512-53yOSZpHuR7HUZBZ34uTQBd71kxS/yln/oEtUagkRVukHZJf7GSL9WoE7DzOHfoAOUok8ZGQLWiAqLfZomJBKA==" }, "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", "dev": true }, "picocolors": { @@ -684,35 +851,35 @@ "dev": true }, "postcss": { - "version": "8.4.5", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", - "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", + "version": "8.4.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.30.tgz", + "integrity": "sha512-7ZEao1g4kd68l97aWG/etQKPKq07us0ieSZ2TnFDk11i0ZfDW2AwKHYU8qv4MZKqN2fdBfg+7q0ES06UA73C1g==", "dev": true, "requires": { - "nanoid": "^3.1.30", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", - "source-map-js": "^1.0.1" + "source-map-js": "^1.0.2" } }, "rollup": { - "version": "2.62.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.62.0.tgz", - "integrity": "sha512-cJEQq2gwB0GWMD3rYImefQTSjrPYaC6s4J9pYqnstVLJ1CHa/aZNVkD4Epuvg4iLeMA4KRiq7UM7awKK6j7jcw==", + "version": "3.29.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", + "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", "dev": true, "requires": { "fsevents": "~2.3.2" } }, "source-map-js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", - "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true }, "three": { - "version": "0.139.2", - "resolved": "https://registry.npmjs.org/three/-/three-0.139.2.tgz", - "integrity": "sha512-gV7q7QY8rogu7HLFZR9cWnOQAUedUhu2WXAnpr2kdXZP9YDKsG/0ychwQvWkZN5PlNw9mv5MoCTin6zNTXoONg==" + "version": "0.147.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.147.0.tgz", + "integrity": "sha512-LPTOslYQXFkmvceQjFTNnVVli2LaVF6C99Pv34fJypp8NbQLbTlu3KinZ0zURghS5zEehK+VQyvWuPZ/Sm8fzw==" }, "tinycolor2": { "version": "1.4.2", @@ -726,47 +893,32 @@ "dev": true }, "vite": { - "version": "2.7.10", - "resolved": "https://registry.npmjs.org/vite/-/vite-2.7.10.tgz", - "integrity": "sha512-KEY96ntXUid1/xJihJbgmLZx7QSC2D4Tui0FdS0Old5OokYzFclcofhtxtjDdGOk/fFpPbHv9yw88+rB93Tb8w==", + "version": "4.4.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", + "integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==", "dev": true, "requires": { - "esbuild": "^0.13.12", + "esbuild": "^0.18.10", "fsevents": "~2.3.2", - "postcss": "^8.4.5", - "resolve": "^1.20.0", - "rollup": "^2.59.0" - }, - "dependencies": { - "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", - "dev": true, - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" - } - } + "postcss": "^8.4.27", + "rollup": "^3.27.1" } }, "wintersky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/wintersky/-/wintersky-1.1.0.tgz", - "integrity": "sha512-wN4ZjgzZejM/Kvcoe6/7O5sSf2ERLAJvxI/1h0rqXuQdCLW98g40OVWi7v5ZthRqxJikhPcVMdN/TVZ4eCu/RQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/wintersky/-/wintersky-1.3.0.tgz", + "integrity": "sha512-ibeUF+sgoIrFAfgqcNsPlr8+4l0KOfhGw+JgjxKcgtbckSy3gAxqAeNX5LjuQK9y7jcBZDwUIXg9sZDGQ1W+hQ==", "requires": { - "molangjs": "^1.5.0", - "three": "^0.139.2", + "molangjs": "^1.6.3", + "three": "^0.134.0", "tinycolor2": "^1.4.2" + }, + "dependencies": { + "three": { + "version": "0.134.0", + "resolved": "https://registry.npmjs.org/three/-/three-0.134.0.tgz", + "integrity": "sha512-LbBerg7GaSPjYtTOnu41AMp7tV6efUNR3p4Wk5NzkSsNTBuA5mDGOfwwZL1jhhVMLx9V20HolIUo0+U3AXehbg==" + } } } } diff --git a/package.json b/package.json index abfb682..a57cd86 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bridge-model-viewer", "version": "0.7.7", - "description": "A fast parser for Minecraft's MoLang", + "description": "A fast parser for Minecraft's Molang", "directories": { "lib": "lib" }, @@ -18,24 +18,30 @@ "types": "./dist/main.d.ts", "exports": { ".": { - "import": "./dist/model-viewer.es.js", - "require": "./dist/model-viewer.umd.js" + "import": { + "types": "./dist/main.d.ts", + "default": "./dist/model-viewer.es.js" + }, + "require": { + "types": "./dist/main.d.ts", + "default": "./dist/model-viewer.umd.js" + } } }, "author": "solvedDev", "license": "MIT", "bugs": { - "url": "https://github.com/solvedDev/MoLang/issues" + "url": "https://github.com/bridge-core/model-viewer/issues" }, - "homepage": "https://github.com/solvedDev/MoLang#readme", + "homepage": "https://github.com/bridge-core/model-viewer#readme", "devDependencies": { - "@types/three": "^0.135.0", + "@types/three": "^0.147.0", "typescript": "^4.3.5", - "vite": "^2.7.10" + "vite": "^4.4.9" }, "dependencies": { - "molang": "^1.13.9", - "three": "^0.139.2", - "wintersky": "^1.1.0" + "molang": "^2.0.1", + "three": "^0.147.0", + "wintersky": "^1.3.0" } }