@mavonengine/editor 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Editor.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import { a as e, o as t, r as n } from "./panels-BqmX3eap.mjs";
2
- import r from "@mavonengine/core/Editor/EditorHelper";
3
- import i from "@mavonengine/core/Game";
4
- import { SCENE_SAVE_PATH as a } from "@mavonengine/core/Plugins/types";
5
- import o from "@mavonengine/core/Utils/EventEmitter";
6
- import { AdditiveBlending as s, BoxGeometry as c, BufferGeometry as l, Color as u, Controls as d, CylinderGeometry as f, DoubleSide as p, Euler as m, Float32BufferAttribute as h, HalfFloatType as g, Line as _, LineBasicMaterial as ee, Matrix4 as v, Mesh as y, MeshBasicMaterial as te, MeshDepthMaterial as b, NoBlending as x, Object3D as S, OctahedronGeometry as C, OrthographicCamera as w, PlaneGeometry as T, Quaternion as E, RGBADepthPacking as ne, Raycaster as re, ShaderMaterial as D, SphereGeometry as ie, TorusGeometry as O, UniformsUtils as ae, Vector2 as k, Vector3 as A, WebGLRenderTarget as j } from "three";
7
- import { lightType as M, primitiveType as N } from "@mavonengine/core/Scene/builtinSceneObjects";
8
- import { SCENE_FORMAT_VERSION as oe } from "@mavonengine/core/Scene/types";
1
+ import { a as e, c as t, l as n, r } from "./panels-DFsnKBKK.mjs";
2
+ import i from "@mavonengine/core/Editor/EditorHelper";
3
+ import a from "@mavonengine/core/Game";
4
+ import { SCENE_SAVE_PATH as o } from "@mavonengine/core/Plugins/types";
5
+ import s from "@mavonengine/core/Utils/EventEmitter";
6
+ import { AdditiveBlending as c, BoxGeometry as l, BufferGeometry as u, Color as d, Controls as f, CylinderGeometry as p, DoubleSide as m, EdgesGeometry as h, Euler as g, Float32BufferAttribute as _, Group as v, HalfFloatType as y, Line as b, LineBasicMaterial as ee, LineLoop as x, LineSegments as S, Matrix4 as C, Mesh as w, MeshBasicMaterial as te, MeshDepthMaterial as ne, NoBlending as T, Object3D as E, OctahedronGeometry as D, OrthographicCamera as re, PlaneGeometry as ie, Quaternion as O, RGBADepthPacking as ae, Raycaster as oe, ShaderMaterial as k, SphereGeometry as se, TorusGeometry as A, UniformsUtils as ce, Vector2 as j, Vector3 as M, WebGLRenderTarget as N } from "three";
7
+ import { lightType as le, primitiveType as ue } from "@mavonengine/core/Scene/builtinSceneObjects";
8
+ import { SCENE_FORMAT_VERSION as de } from "@mavonengine/core/Scene/types";
9
9
  // ../../node_modules/three/examples/jsm/controls/FlyControls.js
10
- var P = { type: "change" }, se = 1e-6, ce = new E(), le = class extends d {
10
+ var fe = { type: "change" }, pe = 1e-6, me = new O(), he = class extends f {
11
11
  constructor(e, t = null) {
12
12
  super(e, t), this.movementSpeed = 1, this.rollSpeed = .005, this.dragToLook = !1, this.autoForward = !1, this._moveState = {
13
13
  up: 0,
@@ -22,7 +22,7 @@ var P = { type: "change" }, se = 1e-6, ce = new E(), le = class extends d {
22
22
  yawRight: 0,
23
23
  rollLeft: 0,
24
24
  rollRight: 0
25
- }, this._moveVector = new A(0, 0, 0), this._rotationVector = new A(0, 0, 0), this._lastQuaternion = new E(), this._lastPosition = new A(), this._status = 0, this._onKeyDown = ue.bind(this), this._onKeyUp = de.bind(this), this._onPointerMove = pe.bind(this), this._onPointerDown = fe.bind(this), this._onPointerUp = me.bind(this), this._onPointerCancel = he.bind(this), this._onContextMenu = ge.bind(this), t !== null && this.connect(t);
25
+ }, this._moveVector = new M(0, 0, 0), this._rotationVector = new M(0, 0, 0), this._lastQuaternion = new O(), this._lastPosition = new M(), this._status = 0, this._onKeyDown = ge.bind(this), this._onKeyUp = _e.bind(this), this._onPointerMove = ye.bind(this), this._onPointerDown = ve.bind(this), this._onPointerUp = be.bind(this), this._onPointerCancel = xe.bind(this), this._onContextMenu = Se.bind(this), t !== null && this.connect(t);
26
26
  }
27
27
  connect(e) {
28
28
  super.connect(e), window.addEventListener("keydown", this._onKeyDown), window.addEventListener("keyup", this._onKeyUp), this.domElement.addEventListener("pointermove", this._onPointerMove), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.addEventListener("pointercancel", this._onPointerCancel), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.style.touchAction = "none";
@@ -36,7 +36,7 @@ var P = { type: "change" }, se = 1e-6, ce = new E(), le = class extends d {
36
36
  update(e) {
37
37
  if (this.enabled === !1) return;
38
38
  let t = this.object, n = e * this.movementSpeed, r = e * this.rollSpeed;
39
- t.translateX(this._moveVector.x * n), t.translateY(this._moveVector.y * n), t.translateZ(this._moveVector.z * n), ce.set(this._rotationVector.x * r, this._rotationVector.y * r, this._rotationVector.z * r, 1).normalize(), t.quaternion.multiply(ce), (this._lastPosition.distanceToSquared(t.position) > se || 8 * (1 - this._lastQuaternion.dot(t.quaternion)) > se) && (this.dispatchEvent(P), this._lastQuaternion.copy(t.quaternion), this._lastPosition.copy(t.position));
39
+ t.translateX(this._moveVector.x * n), t.translateY(this._moveVector.y * n), t.translateZ(this._moveVector.z * n), me.set(this._rotationVector.x * r, this._rotationVector.y * r, this._rotationVector.z * r, 1).normalize(), t.quaternion.multiply(me), (this._lastPosition.distanceToSquared(t.position) > pe || 8 * (1 - this._lastQuaternion.dot(t.quaternion)) > pe) && (this.dispatchEvent(fe), this._lastQuaternion.copy(t.quaternion), this._lastPosition.copy(t.position));
40
40
  }
41
41
  _updateMovementVector() {
42
42
  let e = this._moveState.forward || this.autoForward && !this._moveState.back ? 1 : 0;
@@ -55,7 +55,7 @@ var P = { type: "change" }, se = 1e-6, ce = new E(), le = class extends d {
55
55
  };
56
56
  }
57
57
  };
58
- function ue(e) {
58
+ function ge(e) {
59
59
  if (!(e.altKey || this.enabled === !1)) {
60
60
  switch (e.code) {
61
61
  case "ShiftLeft":
@@ -100,7 +100,7 @@ function ue(e) {
100
100
  this._updateMovementVector(), this._updateRotationVector();
101
101
  }
102
102
  }
103
- function de(e) {
103
+ function _e(e) {
104
104
  if (this.enabled !== !1) {
105
105
  switch (e.code) {
106
106
  case "ShiftLeft":
@@ -145,7 +145,7 @@ function de(e) {
145
145
  this._updateMovementVector(), this._updateRotationVector();
146
146
  }
147
147
  }
148
- function fe(e) {
148
+ function ve(e) {
149
149
  if (this.enabled !== !1) {
150
150
  if (this.dragToLook) this._status++;
151
151
  else {
@@ -159,13 +159,13 @@ function fe(e) {
159
159
  }
160
160
  }
161
161
  }
162
- function pe(e) {
162
+ function ye(e) {
163
163
  if (this.enabled !== !1 && (!this.dragToLook || this._status > 0)) {
164
164
  let t = this._getContainerDimensions(), n = t.size[0] / 2, r = t.size[1] / 2;
165
165
  this._moveState.yawLeft = -(e.pageX - t.offset[0] - n) / n, this._moveState.pitchDown = (e.pageY - t.offset[1] - r) / r, this._updateRotationVector();
166
166
  }
167
167
  }
168
- function me(e) {
168
+ function be(e) {
169
169
  if (this.enabled !== !1) {
170
170
  if (this.dragToLook) this._status--, this._moveState.yawLeft = this._moveState.pitchDown = 0;
171
171
  else {
@@ -180,31 +180,31 @@ function me(e) {
180
180
  this._updateRotationVector();
181
181
  }
182
182
  }
183
- function he() {
183
+ function xe() {
184
184
  this.enabled !== !1 && (this.dragToLook ? (this._status = 0, this._moveState.yawLeft = this._moveState.pitchDown = 0) : (this._moveState.forward = 0, this._moveState.back = 0, this._updateMovementVector()), this._updateRotationVector());
185
185
  }
186
- function ge(e) {
186
+ function Se(e) {
187
187
  this.enabled !== !1 && e.preventDefault();
188
188
  }
189
189
  // ../../node_modules/three/examples/jsm/controls/TransformControls.js
190
- var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
191
- X: new A(1, 0, 0),
192
- Y: new A(0, 1, 0),
193
- Z: new A(0, 0, 1)
194
- }, z = { type: "change" }, ve = {
190
+ var P = new oe(), F = new M(), I = new M(), L = new O(), Ce = {
191
+ X: new M(1, 0, 0),
192
+ Y: new M(0, 1, 0),
193
+ Z: new M(0, 0, 1)
194
+ }, R = { type: "change" }, we = {
195
195
  type: "mouseDown",
196
196
  mode: null
197
- }, ye = {
197
+ }, Te = {
198
198
  type: "mouseUp",
199
199
  mode: null
200
- }, be = { type: "objectChange" }, xe = class extends d {
200
+ }, Ee = { type: "objectChange" }, De = class extends f {
201
201
  constructor(e, t = null) {
202
202
  super(void 0, t);
203
- let n = new Ae(this);
203
+ let n = new Ie(this);
204
204
  this._root = n;
205
- let r = new je();
205
+ let r = new Le();
206
206
  this._gizmo = r, n.add(r);
207
- let i = new Me();
207
+ let i = new Re();
208
208
  this._plane = i, n.add(i);
209
209
  let a = this;
210
210
  function o(e, t) {
@@ -217,13 +217,13 @@ var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
217
217
  n !== t && (n = t, i[e] = t, r[e] = t, a.dispatchEvent({
218
218
  type: e + "-changed",
219
219
  value: t
220
- }), a.dispatchEvent(z));
220
+ }), a.dispatchEvent(R));
221
221
  }
222
222
  }), a[e] = t, i[e] = t, r[e] = t;
223
223
  }
224
224
  o("camera", e), o("object", void 0), o("enabled", !0), o("axis", null), o("mode", "translate"), o("translationSnap", null), o("rotationSnap", null), o("scaleSnap", null), o("space", "world"), o("size", 1), o("dragging", !1), o("showX", !0), o("showY", !0), o("showZ", !0), o("showXY", !0), o("showYZ", !0), o("showXZ", !0), o("minX", -Infinity), o("maxX", Infinity), o("minY", -Infinity), o("maxY", Infinity), o("minZ", -Infinity), o("maxZ", Infinity);
225
- let s = new A(), c = new A(), l = new E(), u = new E(), d = new A(), f = new E(), p = new A(), m = new A(), h = new A(), g = new A();
226
- o("worldPosition", s), o("worldPositionStart", c), o("worldQuaternion", l), o("worldQuaternionStart", u), o("cameraPosition", d), o("cameraQuaternion", f), o("pointStart", p), o("pointEnd", m), o("rotationAxis", h), o("rotationAngle", 0), o("eye", g), this._offset = new A(), this._startNorm = new A(), this._endNorm = new A(), this._cameraScale = new A(), this._parentPosition = new A(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new A(), this._worldScaleStart = new A(), this._worldQuaternionInv = new E(), this._worldScale = new A(), this._positionStart = new A(), this._quaternionStart = new E(), this._scaleStart = new A(), this._getPointer = Se.bind(this), this._onPointerDown = we.bind(this), this._onPointerHover = Ce.bind(this), this._onPointerMove = Te.bind(this), this._onPointerUp = Ee.bind(this), t !== null && this.connect(t);
225
+ let s = new M(), c = new M(), l = new O(), u = new O(), d = new M(), f = new O(), p = new M(), m = new M(), h = new M(), g = new M();
226
+ o("worldPosition", s), o("worldPositionStart", c), o("worldQuaternion", l), o("worldQuaternionStart", u), o("cameraPosition", d), o("cameraQuaternion", f), o("pointStart", p), o("pointEnd", m), o("rotationAxis", h), o("rotationAngle", 0), o("eye", g), this._offset = new M(), this._startNorm = new M(), this._endNorm = new M(), this._cameraScale = new M(), this._parentPosition = new M(), this._parentQuaternion = new O(), this._parentQuaternionInv = new O(), this._parentScale = new M(), this._worldScaleStart = new M(), this._worldQuaternionInv = new O(), this._worldScale = new M(), this._positionStart = new M(), this._quaternionStart = new O(), this._scaleStart = new M(), this._getPointer = Oe.bind(this), this._onPointerDown = Ae.bind(this), this._onPointerHover = ke.bind(this), this._onPointerMove = je.bind(this), this._onPointerUp = Me.bind(this), t !== null && this.connect(t);
227
227
  }
228
228
  connect(e) {
229
229
  super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp), this.domElement.style.touchAction = "none";
@@ -236,40 +236,40 @@ var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
236
236
  }
237
237
  pointerHover(e) {
238
238
  if (this.object === void 0 || this.dragging === !0) return;
239
- e !== null && F.setFromCamera(e, this.camera);
240
- let t = B(this._gizmo.picker[this.mode], F);
239
+ e !== null && P.setFromCamera(e, this.camera);
240
+ let t = z(this._gizmo.picker[this.mode], P);
241
241
  this.axis = t ? t.object.name : null;
242
242
  }
243
243
  pointerDown(e) {
244
244
  if (!(this.object === void 0 || this.dragging === !0 || e != null && e.button !== 0) && this.axis !== null) {
245
- e !== null && F.setFromCamera(e, this.camera);
246
- let t = B(this._plane, F, !0);
247
- t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, ve.mode = this.mode, this.dispatchEvent(ve);
245
+ e !== null && P.setFromCamera(e, this.camera);
246
+ let t = z(this._plane, P, !0);
247
+ t && (this.object.updateMatrixWorld(), this.object.parent.updateMatrixWorld(), this._positionStart.copy(this.object.position), this._quaternionStart.copy(this.object.quaternion), this._scaleStart.copy(this.object.scale), this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart), this.pointStart.copy(t.point).sub(this.worldPositionStart)), this.dragging = !0, we.mode = this.mode, this.dispatchEvent(we);
248
248
  }
249
249
  }
250
250
  pointerMove(e) {
251
251
  let t = this.axis, n = this.mode, r = this.object, i = this.space;
252
252
  if (n === "scale" ? i = "local" : (t === "E" || t === "XYZE" || t === "XYZ") && (i = "world"), r === void 0 || t === null || this.dragging === !1 || e !== null && e.button !== -1) return;
253
- e !== null && F.setFromCamera(e, this.camera);
254
- let a = B(this._plane, F, !0);
253
+ e !== null && P.setFromCamera(e, this.camera);
254
+ let a = z(this._plane, P, !0);
255
255
  if (a) {
256
- if (this.pointEnd.copy(a.point).sub(this.worldPositionStart), n === "translate") this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), r.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (r.position.applyQuaternion(R.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.position.applyQuaternion(this._quaternionStart)), i === "world" && (r.parent && r.position.add(I.setFromMatrixPosition(r.parent.matrixWorld)), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.parent && r.position.sub(I.setFromMatrixPosition(r.parent.matrixWorld)))), r.position.x = Math.max(this.minX, Math.min(this.maxX, r.position.x)), r.position.y = Math.max(this.minY, Math.min(this.maxY, r.position.y)), r.position.z = Math.max(this.minZ, Math.min(this.maxZ, r.position.z));
256
+ if (this.pointEnd.copy(a.point).sub(this.worldPositionStart), n === "translate") this._offset.copy(this.pointEnd).sub(this.pointStart), i === "local" && t !== "XYZ" && this._offset.applyQuaternion(this._worldQuaternionInv), t.indexOf("X") === -1 && (this._offset.x = 0), t.indexOf("Y") === -1 && (this._offset.y = 0), t.indexOf("Z") === -1 && (this._offset.z = 0), i === "local" && t !== "XYZ" ? this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale) : this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale), r.position.copy(this._offset).add(this._positionStart), this.translationSnap && (i === "local" && (r.position.applyQuaternion(L.copy(this._quaternionStart).invert()), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.position.applyQuaternion(this._quaternionStart)), i === "world" && (r.parent && r.position.add(F.setFromMatrixPosition(r.parent.matrixWorld)), t.search("X") !== -1 && (r.position.x = Math.round(r.position.x / this.translationSnap) * this.translationSnap), t.search("Y") !== -1 && (r.position.y = Math.round(r.position.y / this.translationSnap) * this.translationSnap), t.search("Z") !== -1 && (r.position.z = Math.round(r.position.z / this.translationSnap) * this.translationSnap), r.parent && r.position.sub(F.setFromMatrixPosition(r.parent.matrixWorld)))), r.position.x = Math.max(this.minX, Math.min(this.maxX, r.position.x)), r.position.y = Math.max(this.minY, Math.min(this.maxY, r.position.y)), r.position.z = Math.max(this.minZ, Math.min(this.maxZ, r.position.z));
257
257
  else if (n === "scale") {
258
258
  if (t.search("XYZ") !== -1) {
259
259
  let e = this.pointEnd.length() / this.pointStart.length();
260
- this.pointEnd.dot(this.pointStart) < 0 && (e *= -1), L.set(e, e, e);
261
- } else I.copy(this.pointStart), L.copy(this.pointEnd), I.applyQuaternion(this._worldQuaternionInv), L.applyQuaternion(this._worldQuaternionInv), L.divide(I), t.search("X") === -1 && (L.x = 1), t.search("Y") === -1 && (L.y = 1), t.search("Z") === -1 && (L.z = 1);
262
- r.scale.copy(this._scaleStart).multiply(L), this.scaleSnap && (t.search("X") !== -1 && (r.scale.x = Math.round(r.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (r.scale.y = Math.round(r.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (r.scale.z = Math.round(r.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
260
+ this.pointEnd.dot(this.pointStart) < 0 && (e *= -1), I.set(e, e, e);
261
+ } else F.copy(this.pointStart), I.copy(this.pointEnd), F.applyQuaternion(this._worldQuaternionInv), I.applyQuaternion(this._worldQuaternionInv), I.divide(F), t.search("X") === -1 && (I.x = 1), t.search("Y") === -1 && (I.y = 1), t.search("Z") === -1 && (I.z = 1);
262
+ r.scale.copy(this._scaleStart).multiply(I), this.scaleSnap && (t.search("X") !== -1 && (r.scale.x = Math.round(r.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (r.scale.y = Math.round(r.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (r.scale.z = Math.round(r.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
263
263
  } else if (n === "rotate") {
264
264
  this._offset.copy(this.pointEnd).sub(this.pointStart);
265
- let e = 20 / this.worldPosition.distanceTo(I.setFromMatrixPosition(this.camera.matrixWorld)), n = !1;
266
- t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(I.copy(this.rotationAxis).cross(this.eye)) * e) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(_e[t]), I.copy(_e[t]), i === "local" && I.applyQuaternion(this.worldQuaternion), I.cross(this.eye), I.length() === 0 ? n = !0 : this.rotationAngle = this._offset.dot(I.normalize()) * e), (t === "E" || n) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (r.quaternion.copy(this._quaternionStart), r.quaternion.multiply(R.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), r.quaternion.copy(R.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), r.quaternion.multiply(this._quaternionStart).normalize());
265
+ let e = 20 / this.worldPosition.distanceTo(F.setFromMatrixPosition(this.camera.matrixWorld)), n = !1;
266
+ t === "XYZE" ? (this.rotationAxis.copy(this._offset).cross(this.eye).normalize(), this.rotationAngle = this._offset.dot(F.copy(this.rotationAxis).cross(this.eye)) * e) : (t === "X" || t === "Y" || t === "Z") && (this.rotationAxis.copy(Ce[t]), F.copy(Ce[t]), i === "local" && F.applyQuaternion(this.worldQuaternion), F.cross(this.eye), F.length() === 0 ? n = !0 : this.rotationAngle = this._offset.dot(F.normalize()) * e), (t === "E" || n) && (this.rotationAxis.copy(this.eye), this.rotationAngle = this.pointEnd.angleTo(this.pointStart), this._startNorm.copy(this.pointStart).normalize(), this._endNorm.copy(this.pointEnd).normalize(), this.rotationAngle *= this._endNorm.cross(this._startNorm).dot(this.eye) < 0 ? 1 : -1), this.rotationSnap && (this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap), i === "local" && t !== "E" && t !== "XYZE" ? (r.quaternion.copy(this._quaternionStart), r.quaternion.multiply(L.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize()) : (this.rotationAxis.applyQuaternion(this._parentQuaternionInv), r.quaternion.copy(L.setFromAxisAngle(this.rotationAxis, this.rotationAngle)), r.quaternion.multiply(this._quaternionStart).normalize());
267
267
  }
268
- this.dispatchEvent(z), this.dispatchEvent(be);
268
+ this.dispatchEvent(R), this.dispatchEvent(Ee);
269
269
  }
270
270
  }
271
271
  pointerUp(e) {
272
- (e === null || e.button === 0) && (this.dragging && this.axis !== null && (ye.mode = this.mode, this.dispatchEvent(ye)), this.dragging = !1, this.axis = null);
272
+ (e === null || e.button === 0) && (this.dragging && this.axis !== null && (Te.mode = this.mode, this.dispatchEvent(Te)), this.dragging = !1, this.axis = null);
273
273
  }
274
274
  dispose() {
275
275
  this.disconnect(), this._root.dispose();
@@ -281,10 +281,10 @@ var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
281
281
  return this.object = void 0, this.axis = null, this._root.visible = !1, this;
282
282
  }
283
283
  reset() {
284
- this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(z), this.dispatchEvent(be), this.pointStart.copy(this.pointEnd));
284
+ this.enabled && this.dragging && (this.object.position.copy(this._positionStart), this.object.quaternion.copy(this._quaternionStart), this.object.scale.copy(this._scaleStart), this.dispatchEvent(R), this.dispatchEvent(Ee), this.pointStart.copy(this.pointEnd));
285
285
  }
286
286
  getRaycaster() {
287
- return F;
287
+ return P;
288
288
  }
289
289
  getMode() {
290
290
  return this.mode;
@@ -312,7 +312,7 @@ var F = new re(), I = new A(), L = new A(), R = new E(), _e = {
312
312
  i.xAxis.color.set(e), i.yAxis.color.set(t), i.zAxis.color.set(n), i.active.color.set(r), i.xAxisTransparent.color.set(e), i.yAxisTransparent.color.set(t), i.zAxisTransparent.color.set(n), i.activeTransparent.color.set(r), i.xAxis._color && i.xAxis._color.set(e), i.yAxis._color && i.yAxis._color.set(t), i.zAxis._color && i.zAxis._color.set(n), i.active._color && i.active._color.set(r), i.xAxisTransparent._color && i.xAxisTransparent._color.set(e), i.yAxisTransparent._color && i.yAxisTransparent._color.set(t), i.zAxisTransparent._color && i.zAxisTransparent._color.set(n), i.activeTransparent._color && i.activeTransparent._color.set(r);
313
313
  }
314
314
  };
315
- function Se(e) {
315
+ function Oe(e) {
316
316
  if (this.domElement.ownerDocument.pointerLockElement) return {
317
317
  x: 0,
318
318
  y: 0,
@@ -327,27 +327,27 @@ function Se(e) {
327
327
  };
328
328
  }
329
329
  }
330
- function Ce(e) {
330
+ function ke(e) {
331
331
  if (this.enabled) switch (e.pointerType) {
332
332
  case "mouse":
333
333
  case "pen": this.pointerHover(this._getPointer(e));
334
334
  }
335
335
  }
336
- function we(e) {
336
+ function Ae(e) {
337
337
  this.enabled && (document.pointerLockElement || this.domElement.setPointerCapture(e.pointerId), this.domElement.addEventListener("pointermove", this._onPointerMove), this.pointerHover(this._getPointer(e)), this.pointerDown(this._getPointer(e)));
338
338
  }
339
- function Te(e) {
339
+ function je(e) {
340
340
  this.enabled && this.pointerMove(this._getPointer(e));
341
341
  }
342
- function Ee(e) {
342
+ function Me(e) {
343
343
  this.enabled && (this.domElement.releasePointerCapture(e.pointerId), this.domElement.removeEventListener("pointermove", this._onPointerMove), this.pointerUp(this._getPointer(e)));
344
344
  }
345
- function B(e, t, n) {
345
+ function z(e, t, n) {
346
346
  let r = t.intersectObject(e, !0);
347
347
  for (let e = 0; e < r.length; e++) if (r[e].object.visible || n) return r[e];
348
348
  return !1;
349
349
  }
350
- var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new E(), W = new E(), G = new A(), ke = new v(), K = new A(1, 0, 0), q = new A(0, 1, 0), J = new A(0, 0, 1), Y = new A(), X = new A(), Z = new A(), Ae = class extends S {
350
+ var B = new g(), V = new M(0, 1, 0), Ne = new M(0, 0, 0), Pe = new C(), H = new O(), U = new O(), W = new M(), Fe = new C(), G = new M(1, 0, 0), K = new M(0, 1, 0), q = new M(0, 0, 1), J = new M(), Y = new M(), X = new M(), Ie = class extends E {
351
351
  constructor(e) {
352
352
  super(), this.isTransformControlsRoot = !0, this.controls = e, this.visible = !1;
353
353
  }
@@ -360,7 +360,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
360
360
  e.geometry && e.geometry.dispose(), e.material && e.material.dispose();
361
361
  });
362
362
  }
363
- }, je = class extends S {
363
+ }, Le = class extends E {
364
364
  constructor() {
365
365
  super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
366
366
  let e = new te({
@@ -387,33 +387,33 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
387
387
  o.color.setHex(255);
388
388
  let s = e.clone();
389
389
  s.color.setHex(16711680), s.opacity = .5;
390
- let u = e.clone();
391
- u.color.setHex(65280), u.opacity = .5;
390
+ let c = e.clone();
391
+ c.color.setHex(65280), c.opacity = .5;
392
392
  let d = e.clone();
393
393
  d.color.setHex(255), d.opacity = .5;
394
- let p = e.clone();
395
- p.opacity = .25;
394
+ let f = e.clone();
395
+ f.opacity = .25;
396
396
  let m = e.clone();
397
397
  m.color.setHex(16776960), m.opacity = .25;
398
+ let h = e.clone();
399
+ h.color.setHex(16776960);
398
400
  let g = e.clone();
399
- g.color.setHex(16776960);
400
- let v = e.clone();
401
- v.color.setHex(7895160), this.materialLib = {
401
+ g.color.setHex(7895160), this.materialLib = {
402
402
  xAxis: i,
403
403
  yAxis: a,
404
404
  zAxis: o,
405
- active: g,
405
+ active: h,
406
406
  xAxisTransparent: s,
407
- yAxisTransparent: u,
407
+ yAxisTransparent: c,
408
408
  zAxisTransparent: d,
409
409
  activeTransparent: m
410
410
  };
411
- let b = new f(0, .04, .1, 12);
412
- b.translate(0, .05, 0);
413
- let x = new c(.08, .08, .08);
414
- x.translate(0, .04, 0);
415
- let w = new l();
416
- w.setAttribute("position", new h([
411
+ let v = new p(0, .04, .1, 12);
412
+ v.translate(0, .05, 0);
413
+ let y = new l(.08, .08, .08);
414
+ y.translate(0, .04, 0);
415
+ let x = new u();
416
+ x.setAttribute("position", new _([
417
417
  0,
418
418
  0,
419
419
  0,
@@ -421,15 +421,15 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
421
421
  0,
422
422
  0
423
423
  ], 3));
424
- let T = new f(.0075, .0075, .5, 3);
425
- T.translate(0, .25, 0);
426
- function E(e, t) {
427
- let n = new O(e, .0075, 3, 64, t * Math.PI * 2);
424
+ let S = new p(.0075, .0075, .5, 3);
425
+ S.translate(0, .25, 0);
426
+ function C(e, t) {
427
+ let n = new A(e, .0075, 3, 64, t * Math.PI * 2);
428
428
  return n.rotateY(Math.PI / 2), n.rotateX(Math.PI / 2), n;
429
429
  }
430
430
  function ne() {
431
- let e = new l();
432
- return e.setAttribute("position", new h([
431
+ let e = new u();
432
+ return e.setAttribute("position", new _([
433
433
  0,
434
434
  0,
435
435
  0,
@@ -438,10 +438,10 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
438
438
  1
439
439
  ], 3)), e;
440
440
  }
441
- let re = {
441
+ let T = {
442
442
  X: [
443
443
  [
444
- new y(b, i),
444
+ new w(v, i),
445
445
  [
446
446
  .5,
447
447
  0,
@@ -454,7 +454,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
454
454
  ]
455
455
  ],
456
456
  [
457
- new y(b, i),
457
+ new w(v, i),
458
458
  [
459
459
  -.5,
460
460
  0,
@@ -467,7 +467,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
467
467
  ]
468
468
  ],
469
469
  [
470
- new y(T, i),
470
+ new w(S, i),
471
471
  [
472
472
  0,
473
473
  0,
@@ -481,13 +481,13 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
481
481
  ]
482
482
  ],
483
483
  Y: [
484
- [new y(b, a), [
484
+ [new w(v, a), [
485
485
  0,
486
486
  .5,
487
487
  0
488
488
  ]],
489
489
  [
490
- new y(b, a),
490
+ new w(v, a),
491
491
  [
492
492
  0,
493
493
  -.5,
@@ -499,11 +499,11 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
499
499
  0
500
500
  ]
501
501
  ],
502
- [new y(T, a)]
502
+ [new w(S, a)]
503
503
  ],
504
504
  Z: [
505
505
  [
506
- new y(b, o),
506
+ new w(v, o),
507
507
  [
508
508
  0,
509
509
  0,
@@ -516,7 +516,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
516
516
  ]
517
517
  ],
518
518
  [
519
- new y(b, o),
519
+ new w(v, o),
520
520
  [
521
521
  0,
522
522
  0,
@@ -529,7 +529,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
529
529
  ]
530
530
  ],
531
531
  [
532
- new y(T, o),
532
+ new w(S, o),
533
533
  null,
534
534
  [
535
535
  Math.PI / 2,
@@ -538,18 +538,18 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
538
538
  ]
539
539
  ]
540
540
  ],
541
- XYZ: [[new y(new C(.1, 0), p), [
541
+ XYZ: [[new w(new D(.1, 0), f), [
542
542
  0,
543
543
  0,
544
544
  0
545
545
  ]]],
546
- XY: [[new y(new c(.15, .15, .01), d), [
546
+ XY: [[new w(new l(.15, .15, .01), d), [
547
547
  .15,
548
548
  .15,
549
549
  0
550
550
  ]]],
551
551
  YZ: [[
552
- new y(new c(.15, .15, .01), s),
552
+ new w(new l(.15, .15, .01), s),
553
553
  [
554
554
  0,
555
555
  .15,
@@ -562,7 +562,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
562
562
  ]
563
563
  ]],
564
564
  XZ: [[
565
- new y(new c(.15, .15, .01), u),
565
+ new w(new l(.15, .15, .01), c),
566
566
  [
567
567
  .15,
568
568
  0,
@@ -574,9 +574,9 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
574
574
  0
575
575
  ]
576
576
  ]]
577
- }, D = {
577
+ }, re = {
578
578
  X: [[
579
- new y(new f(.2, 0, .6, 4), n),
579
+ new w(new p(.2, 0, .6, 4), n),
580
580
  [
581
581
  .3,
582
582
  0,
@@ -588,7 +588,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
588
588
  -Math.PI / 2
589
589
  ]
590
590
  ], [
591
- new y(new f(.2, 0, .6, 4), n),
591
+ new w(new p(.2, 0, .6, 4), n),
592
592
  [
593
593
  -.3,
594
594
  0,
@@ -600,12 +600,12 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
600
600
  Math.PI / 2
601
601
  ]
602
602
  ]],
603
- Y: [[new y(new f(.2, 0, .6, 4), n), [
603
+ Y: [[new w(new p(.2, 0, .6, 4), n), [
604
604
  0,
605
605
  .3,
606
606
  0
607
607
  ]], [
608
- new y(new f(.2, 0, .6, 4), n),
608
+ new w(new p(.2, 0, .6, 4), n),
609
609
  [
610
610
  0,
611
611
  -.3,
@@ -618,7 +618,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
618
618
  ]
619
619
  ]],
620
620
  Z: [[
621
- new y(new f(.2, 0, .6, 4), n),
621
+ new w(new p(.2, 0, .6, 4), n),
622
622
  [
623
623
  0,
624
624
  0,
@@ -630,7 +630,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
630
630
  0
631
631
  ]
632
632
  ], [
633
- new y(new f(.2, 0, .6, 4), n),
633
+ new w(new p(.2, 0, .6, 4), n),
634
634
  [
635
635
  0,
636
636
  0,
@@ -642,14 +642,14 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
642
642
  0
643
643
  ]
644
644
  ]],
645
- XYZ: [[new y(new C(.2, 0), n)]],
646
- XY: [[new y(new c(.2, .2, .01), n), [
645
+ XYZ: [[new w(new D(.2, 0), n)]],
646
+ XY: [[new w(new l(.2, .2, .01), n), [
647
647
  .15,
648
648
  .15,
649
649
  0
650
650
  ]]],
651
651
  YZ: [[
652
- new y(new c(.2, .2, .01), n),
652
+ new w(new l(.2, .2, .01), n),
653
653
  [
654
654
  0,
655
655
  .15,
@@ -662,7 +662,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
662
662
  ]
663
663
  ]],
664
664
  XZ: [[
665
- new y(new c(.2, .2, .01), n),
665
+ new w(new l(.2, .2, .01), n),
666
666
  [
667
667
  .15,
668
668
  0,
@@ -674,30 +674,30 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
674
674
  0
675
675
  ]
676
676
  ]]
677
- }, ae = {
677
+ }, ie = {
678
678
  START: [[
679
- new y(new C(.01, 2), r),
679
+ new w(new D(.01, 2), r),
680
680
  null,
681
681
  null,
682
682
  null,
683
683
  "helper"
684
684
  ]],
685
685
  END: [[
686
- new y(new C(.01, 2), r),
686
+ new w(new D(.01, 2), r),
687
687
  null,
688
688
  null,
689
689
  null,
690
690
  "helper"
691
691
  ]],
692
692
  DELTA: [[
693
- new _(ne(), r),
693
+ new b(ne(), r),
694
694
  null,
695
695
  null,
696
696
  null,
697
697
  "helper"
698
698
  ]],
699
699
  X: [[
700
- new _(w, r),
700
+ new b(x, r),
701
701
  [
702
702
  -1e3,
703
703
  0,
@@ -712,7 +712,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
712
712
  "helper"
713
713
  ]],
714
714
  Y: [[
715
- new _(w, r),
715
+ new b(x, r),
716
716
  [
717
717
  0,
718
718
  -1e3,
@@ -731,7 +731,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
731
731
  "helper"
732
732
  ]],
733
733
  Z: [[
734
- new _(w, r),
734
+ new b(x, r),
735
735
  [
736
736
  0,
737
737
  0,
@@ -749,9 +749,9 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
749
749
  ],
750
750
  "helper"
751
751
  ]]
752
- }, k = {
752
+ }, O = {
753
753
  XYZE: [[
754
- new y(E(.5, 1), v),
754
+ new w(C(.5, 1), g),
755
755
  null,
756
756
  [
757
757
  0,
@@ -759,9 +759,9 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
759
759
  0
760
760
  ]
761
761
  ]],
762
- X: [[new y(E(.5, .5), i)]],
762
+ X: [[new w(C(.5, .5), i)]],
763
763
  Y: [[
764
- new y(E(.5, .5), a),
764
+ new w(C(.5, .5), a),
765
765
  null,
766
766
  [
767
767
  0,
@@ -770,7 +770,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
770
770
  ]
771
771
  ]],
772
772
  Z: [[
773
- new y(E(.5, .5), o),
773
+ new w(C(.5, .5), o),
774
774
  null,
775
775
  [
776
776
  0,
@@ -779,7 +779,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
779
779
  ]
780
780
  ]],
781
781
  E: [[
782
- new y(E(.75, 1), m),
782
+ new w(C(.75, 1), m),
783
783
  null,
784
784
  [
785
785
  0,
@@ -787,8 +787,8 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
787
787
  0
788
788
  ]
789
789
  ]]
790
- }, A = { AXIS: [[
791
- new _(w, r),
790
+ }, ae = { AXIS: [[
791
+ new b(x, r),
792
792
  [
793
793
  -1e3,
794
794
  0,
@@ -801,10 +801,10 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
801
801
  1
802
802
  ],
803
803
  "helper"
804
- ]] }, j = {
805
- XYZE: [[new y(new ie(.25, 10, 8), n)]],
804
+ ]] }, oe = {
805
+ XYZE: [[new w(new se(.25, 10, 8), n)]],
806
806
  X: [[
807
- new y(new O(.5, .1, 4, 24), n),
807
+ new w(new A(.5, .1, 4, 24), n),
808
808
  [
809
809
  0,
810
810
  0,
@@ -817,7 +817,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
817
817
  ]
818
818
  ]],
819
819
  Y: [[
820
- new y(new O(.5, .1, 4, 24), n),
820
+ new w(new A(.5, .1, 4, 24), n),
821
821
  [
822
822
  0,
823
823
  0,
@@ -830,7 +830,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
830
830
  ]
831
831
  ]],
832
832
  Z: [[
833
- new y(new O(.5, .1, 4, 24), n),
833
+ new w(new A(.5, .1, 4, 24), n),
834
834
  [
835
835
  0,
836
836
  0,
@@ -842,11 +842,11 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
842
842
  -Math.PI / 2
843
843
  ]
844
844
  ]],
845
- E: [[new y(new O(.75, .1, 2, 24), n)]]
846
- }, M = {
845
+ E: [[new w(new A(.75, .1, 2, 24), n)]]
846
+ }, k = {
847
847
  X: [
848
848
  [
849
- new y(x, i),
849
+ new w(y, i),
850
850
  [
851
851
  .5,
852
852
  0,
@@ -859,7 +859,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
859
859
  ]
860
860
  ],
861
861
  [
862
- new y(T, i),
862
+ new w(S, i),
863
863
  [
864
864
  0,
865
865
  0,
@@ -872,7 +872,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
872
872
  ]
873
873
  ],
874
874
  [
875
- new y(x, i),
875
+ new w(y, i),
876
876
  [
877
877
  -.5,
878
878
  0,
@@ -886,14 +886,14 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
886
886
  ]
887
887
  ],
888
888
  Y: [
889
- [new y(x, a), [
889
+ [new w(y, a), [
890
890
  0,
891
891
  .5,
892
892
  0
893
893
  ]],
894
- [new y(T, a)],
894
+ [new w(S, a)],
895
895
  [
896
- new y(x, a),
896
+ new w(y, a),
897
897
  [
898
898
  0,
899
899
  -.5,
@@ -908,7 +908,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
908
908
  ],
909
909
  Z: [
910
910
  [
911
- new y(x, o),
911
+ new w(y, o),
912
912
  [
913
913
  0,
914
914
  0,
@@ -921,7 +921,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
921
921
  ]
922
922
  ],
923
923
  [
924
- new y(T, o),
924
+ new w(S, o),
925
925
  [
926
926
  0,
927
927
  0,
@@ -934,7 +934,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
934
934
  ]
935
935
  ],
936
936
  [
937
- new y(x, o),
937
+ new w(y, o),
938
938
  [
939
939
  0,
940
940
  0,
@@ -947,13 +947,13 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
947
947
  ]
948
948
  ]
949
949
  ],
950
- XY: [[new y(new c(.15, .15, .01), d), [
950
+ XY: [[new w(new l(.15, .15, .01), d), [
951
951
  .15,
952
952
  .15,
953
953
  0
954
954
  ]]],
955
955
  YZ: [[
956
- new y(new c(.15, .15, .01), s),
956
+ new w(new l(.15, .15, .01), s),
957
957
  [
958
958
  0,
959
959
  .15,
@@ -966,7 +966,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
966
966
  ]
967
967
  ]],
968
968
  XZ: [[
969
- new y(new c(.15, .15, .01), u),
969
+ new w(new l(.15, .15, .01), c),
970
970
  [
971
971
  .15,
972
972
  0,
@@ -978,10 +978,10 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
978
978
  0
979
979
  ]
980
980
  ]],
981
- XYZ: [[new y(new c(.1, .1, .1), p)]]
982
- }, N = {
981
+ XYZ: [[new w(new l(.1, .1, .1), f)]]
982
+ }, ce = {
983
983
  X: [[
984
- new y(new f(.2, 0, .6, 4), n),
984
+ new w(new p(.2, 0, .6, 4), n),
985
985
  [
986
986
  .3,
987
987
  0,
@@ -993,7 +993,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
993
993
  -Math.PI / 2
994
994
  ]
995
995
  ], [
996
- new y(new f(.2, 0, .6, 4), n),
996
+ new w(new p(.2, 0, .6, 4), n),
997
997
  [
998
998
  -.3,
999
999
  0,
@@ -1005,12 +1005,12 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1005
1005
  Math.PI / 2
1006
1006
  ]
1007
1007
  ]],
1008
- Y: [[new y(new f(.2, 0, .6, 4), n), [
1008
+ Y: [[new w(new p(.2, 0, .6, 4), n), [
1009
1009
  0,
1010
1010
  .3,
1011
1011
  0
1012
1012
  ]], [
1013
- new y(new f(.2, 0, .6, 4), n),
1013
+ new w(new p(.2, 0, .6, 4), n),
1014
1014
  [
1015
1015
  0,
1016
1016
  -.3,
@@ -1023,7 +1023,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1023
1023
  ]
1024
1024
  ]],
1025
1025
  Z: [[
1026
- new y(new f(.2, 0, .6, 4), n),
1026
+ new w(new p(.2, 0, .6, 4), n),
1027
1027
  [
1028
1028
  0,
1029
1029
  0,
@@ -1035,7 +1035,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1035
1035
  0
1036
1036
  ]
1037
1037
  ], [
1038
- new y(new f(.2, 0, .6, 4), n),
1038
+ new w(new p(.2, 0, .6, 4), n),
1039
1039
  [
1040
1040
  0,
1041
1041
  0,
@@ -1047,13 +1047,13 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1047
1047
  0
1048
1048
  ]
1049
1049
  ]],
1050
- XY: [[new y(new c(.2, .2, .01), n), [
1050
+ XY: [[new w(new l(.2, .2, .01), n), [
1051
1051
  .15,
1052
1052
  .15,
1053
1053
  0
1054
1054
  ]]],
1055
1055
  YZ: [[
1056
- new y(new c(.2, .2, .01), n),
1056
+ new w(new l(.2, .2, .01), n),
1057
1057
  [
1058
1058
  0,
1059
1059
  .15,
@@ -1066,7 +1066,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1066
1066
  ]
1067
1067
  ]],
1068
1068
  XZ: [[
1069
- new y(new c(.2, .2, .01), n),
1069
+ new w(new l(.2, .2, .01), n),
1070
1070
  [
1071
1071
  .15,
1072
1072
  0,
@@ -1078,14 +1078,14 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1078
1078
  0
1079
1079
  ]
1080
1080
  ]],
1081
- XYZ: [[new y(new c(.2, .2, .2), n), [
1081
+ XYZ: [[new w(new l(.2, .2, .2), n), [
1082
1082
  0,
1083
1083
  0,
1084
1084
  0
1085
1085
  ]]]
1086
- }, oe = {
1086
+ }, j = {
1087
1087
  X: [[
1088
- new _(w, r),
1088
+ new b(x, r),
1089
1089
  [
1090
1090
  -1e3,
1091
1091
  0,
@@ -1100,7 +1100,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1100
1100
  "helper"
1101
1101
  ]],
1102
1102
  Y: [[
1103
- new _(w, r),
1103
+ new b(x, r),
1104
1104
  [
1105
1105
  0,
1106
1106
  -1e3,
@@ -1119,7 +1119,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1119
1119
  "helper"
1120
1120
  ]],
1121
1121
  Z: [[
1122
- new _(w, r),
1122
+ new b(x, r),
1123
1123
  [
1124
1124
  0,
1125
1125
  0,
@@ -1138,8 +1138,8 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1138
1138
  "helper"
1139
1139
  ]]
1140
1140
  };
1141
- function P(e) {
1142
- let t = new S();
1141
+ function M(e) {
1142
+ let t = new E();
1143
1143
  for (let n in e) for (let r = e[n].length; r--;) {
1144
1144
  let i = e[n][r][0].clone(), a = e[n][r][1], o = e[n][r][2], s = e[n][r][3], c = e[n][r][4];
1145
1145
  i.name = n, i.tag = c, a && i.position.set(a[0], a[1], a[2]), o && i.rotation.set(o[0], o[1], o[2]), s && i.scale.set(s[0], s[1], s[2]), i.updateMatrix();
@@ -1148,10 +1148,10 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1148
1148
  }
1149
1149
  return t;
1150
1150
  }
1151
- this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = P(re)), this.add(this.gizmo.rotate = P(k)), this.add(this.gizmo.scale = P(M)), this.add(this.picker.translate = P(D)), this.add(this.picker.rotate = P(j)), this.add(this.picker.scale = P(N)), this.add(this.helper.translate = P(ae)), this.add(this.helper.rotate = P(A)), this.add(this.helper.scale = P(oe)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
1151
+ this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = M(T)), this.add(this.gizmo.rotate = M(O)), this.add(this.gizmo.scale = M(k)), this.add(this.picker.translate = M(re)), this.add(this.picker.rotate = M(oe)), this.add(this.picker.scale = M(ce)), this.add(this.helper.translate = M(ie)), this.add(this.helper.rotate = M(ae)), this.add(this.helper.scale = M(j)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
1152
1152
  }
1153
1153
  updateMatrixWorld(e) {
1154
- let t = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : W;
1154
+ let t = (this.mode === "scale" ? "local" : this.space) === "local" ? this.worldQuaternion : U;
1155
1155
  this.gizmo.translate.visible = this.mode === "translate", this.gizmo.rotate.visible = this.mode === "rotate", this.gizmo.scale.visible = this.mode === "scale", this.helper.translate.visible = this.mode === "translate", this.helper.rotate.visible = this.mode === "rotate", this.helper.scale.visible = this.mode === "scale";
1156
1156
  let n = [];
1157
1157
  n = n.concat(this.picker[this.mode].children), n = n.concat(this.gizmo[this.mode].children), n = n.concat(this.helper[this.mode].children);
@@ -1159,12 +1159,12 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1159
1159
  let r = n[e];
1160
1160
  r.visible = !0, r.rotation.set(0, 0, 0), r.position.copy(this.worldPosition);
1161
1161
  let i;
1162
- if (i = this.camera.isOrthographicCamera ? (this.camera.top - this.camera.bottom) / this.camera.zoom : this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), r.scale.set(1, 1, 1).multiplyScalar(i * this.size / 4), r.tag === "helper") r.visible = !1, r.name === "AXIS" ? (r.visible = !!this.axis, this.axis === "X" && (R.setFromEuler(V.set(0, 0, 0)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Y" && (R.setFromEuler(V.set(0, 0, Math.PI / 2)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Z" && (R.setFromEuler(V.set(0, Math.PI / 2, 0)), r.quaternion.copy(t).multiply(R), Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "XYZE" && (R.setFromEuler(V.set(0, Math.PI / 2, 0)), H.copy(this.rotationAxis), r.quaternion.setFromRotationMatrix(Oe.lookAt(De, H, q)), r.quaternion.multiply(R), r.visible = this.dragging), this.axis === "E" && (r.visible = !1)) : r.name === "START" ? (r.position.copy(this.worldPositionStart), r.visible = this.dragging) : r.name === "END" ? (r.position.copy(this.worldPosition), r.visible = this.dragging) : r.name === "DELTA" ? (r.position.copy(this.worldPositionStart), r.quaternion.copy(this.worldQuaternionStart), I.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), I.applyQuaternion(this.worldQuaternionStart.clone().invert()), r.scale.copy(I), r.visible = this.dragging) : (r.quaternion.copy(t), this.dragging ? r.position.copy(this.worldPositionStart) : r.position.copy(this.worldPosition), this.axis && (r.visible = this.axis.search(r.name) !== -1));
1162
+ if (i = this.camera.isOrthographicCamera ? (this.camera.top - this.camera.bottom) / this.camera.zoom : this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), r.scale.set(1, 1, 1).multiplyScalar(i * this.size / 4), r.tag === "helper") r.visible = !1, r.name === "AXIS" ? (r.visible = !!this.axis, this.axis === "X" && (L.setFromEuler(B.set(0, 0, 0)), r.quaternion.copy(t).multiply(L), Math.abs(V.copy(G).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Y" && (L.setFromEuler(B.set(0, 0, Math.PI / 2)), r.quaternion.copy(t).multiply(L), Math.abs(V.copy(K).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "Z" && (L.setFromEuler(B.set(0, Math.PI / 2, 0)), r.quaternion.copy(t).multiply(L), Math.abs(V.copy(q).applyQuaternion(t).dot(this.eye)) > .9 && (r.visible = !1)), this.axis === "XYZE" && (L.setFromEuler(B.set(0, Math.PI / 2, 0)), V.copy(this.rotationAxis), r.quaternion.setFromRotationMatrix(Pe.lookAt(Ne, V, K)), r.quaternion.multiply(L), r.visible = this.dragging), this.axis === "E" && (r.visible = !1)) : r.name === "START" ? (r.position.copy(this.worldPositionStart), r.visible = this.dragging) : r.name === "END" ? (r.position.copy(this.worldPosition), r.visible = this.dragging) : r.name === "DELTA" ? (r.position.copy(this.worldPositionStart), r.quaternion.copy(this.worldQuaternionStart), F.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), F.applyQuaternion(this.worldQuaternionStart.clone().invert()), r.scale.copy(F), r.visible = this.dragging) : (r.quaternion.copy(t), this.dragging ? r.position.copy(this.worldPositionStart) : r.position.copy(this.worldPosition), this.axis && (r.visible = this.axis.search(r.name) !== -1));
1163
1163
  else {
1164
1164
  if (r.quaternion.copy(t), this.mode === "translate" || this.mode === "scale") {
1165
1165
  let e = .99, n = .2;
1166
- r.name === "X" && Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Y" && Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Z" && Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XY" && Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "YZ" && Math.abs(H.copy(K).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XZ" && Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1);
1167
- } else this.mode === "rotate" && (U.copy(t), H.copy(this.eye).applyQuaternion(R.copy(t).invert()), r.name.search("E") !== -1 && r.quaternion.setFromRotationMatrix(Oe.lookAt(this.eye, De, q)), r.name === "X" && (R.setFromAxisAngle(K, Math.atan2(-H.y, H.z)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)), r.name === "Y" && (R.setFromAxisAngle(q, Math.atan2(H.x, H.z)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)), r.name === "Z" && (R.setFromAxisAngle(J, Math.atan2(H.y, H.x)), R.multiplyQuaternions(U, R), r.quaternion.copy(R)));
1166
+ r.name === "X" && Math.abs(V.copy(G).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Y" && Math.abs(V.copy(K).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "Z" && Math.abs(V.copy(q).applyQuaternion(t).dot(this.eye)) > e && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XY" && Math.abs(V.copy(q).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "YZ" && Math.abs(V.copy(G).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1), r.name === "XZ" && Math.abs(V.copy(K).applyQuaternion(t).dot(this.eye)) < n && (r.scale.set(1e-10, 1e-10, 1e-10), r.visible = !1);
1167
+ } else this.mode === "rotate" && (H.copy(t), V.copy(this.eye).applyQuaternion(L.copy(t).invert()), r.name.search("E") !== -1 && r.quaternion.setFromRotationMatrix(Pe.lookAt(this.eye, Ne, K)), r.name === "X" && (L.setFromAxisAngle(G, Math.atan2(-V.y, V.z)), L.multiplyQuaternions(H, L), r.quaternion.copy(L)), r.name === "Y" && (L.setFromAxisAngle(K, Math.atan2(V.x, V.z)), L.multiplyQuaternions(H, L), r.quaternion.copy(L)), r.name === "Z" && (L.setFromAxisAngle(q, Math.atan2(V.y, V.x)), L.multiplyQuaternions(H, L), r.quaternion.copy(L)));
1168
1168
  r.visible = r.visible && (r.name.indexOf("X") === -1 || this.showX), r.visible = r.visible && (r.name.indexOf("Y") === -1 || this.showY), r.visible = r.visible && (r.name.indexOf("Z") === -1 || this.showZ), r.visible = r.visible && (r.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), r.visible = r.visible && (r.name.indexOf("XY") === -1 || this.showXY), r.visible = r.visible && (r.name.indexOf("YZ") === -1 || this.showYZ), r.visible = r.visible && (r.name.indexOf("XZ") === -1 || this.showXZ), r.material._color = r.material._color || r.material.color.clone(), r.material._opacity = r.material._opacity || r.material.opacity, r.material.color.copy(r.material._color), r.material.opacity = r.material._opacity, this.enabled && this.axis && (r.name === this.axis || this.axis.split("").some(function(e) {
1169
1169
  return r.name === e;
1170
1170
  })) && (r.material.color.copy(this.materialLib.active.color), r.material.opacity = 1);
@@ -1172,12 +1172,12 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1172
1172
  }
1173
1173
  super.updateMatrixWorld(e);
1174
1174
  }
1175
- }, Me = class extends y {
1175
+ }, Re = class extends w {
1176
1176
  constructor() {
1177
- super(new T(1e5, 1e5, 2, 2), new te({
1177
+ super(new ie(1e5, 1e5, 2, 2), new te({
1178
1178
  visible: !1,
1179
1179
  wireframe: !0,
1180
- side: p,
1180
+ side: m,
1181
1181
  transparent: !0,
1182
1182
  opacity: .1,
1183
1183
  toneMapped: !1
@@ -1185,37 +1185,37 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1185
1185
  }
1186
1186
  updateMatrixWorld(e) {
1187
1187
  let t = this.space;
1188
- switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), Y.copy(K).applyQuaternion(t === "local" ? this.worldQuaternion : W), X.copy(q).applyQuaternion(t === "local" ? this.worldQuaternion : W), Z.copy(J).applyQuaternion(t === "local" ? this.worldQuaternion : W), H.copy(X), this.mode) {
1188
+ switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(G).applyQuaternion(t === "local" ? this.worldQuaternion : U), Y.copy(K).applyQuaternion(t === "local" ? this.worldQuaternion : U), X.copy(q).applyQuaternion(t === "local" ? this.worldQuaternion : U), V.copy(Y), this.mode) {
1189
1189
  case "translate":
1190
1190
  case "scale":
1191
1191
  switch (this.axis) {
1192
1192
  case "X":
1193
- H.copy(this.eye).cross(Y), G.copy(Y).cross(H);
1193
+ V.copy(this.eye).cross(J), W.copy(J).cross(V);
1194
1194
  break;
1195
1195
  case "Y":
1196
- H.copy(this.eye).cross(X), G.copy(X).cross(H);
1196
+ V.copy(this.eye).cross(Y), W.copy(Y).cross(V);
1197
1197
  break;
1198
1198
  case "Z":
1199
- H.copy(this.eye).cross(Z), G.copy(Z).cross(H);
1199
+ V.copy(this.eye).cross(X), W.copy(X).cross(V);
1200
1200
  break;
1201
1201
  case "XY":
1202
- G.copy(Z);
1202
+ W.copy(X);
1203
1203
  break;
1204
1204
  case "YZ":
1205
- G.copy(Y);
1205
+ W.copy(J);
1206
1206
  break;
1207
1207
  case "XZ":
1208
- H.copy(Z), G.copy(X);
1208
+ V.copy(X), W.copy(Y);
1209
1209
  break;
1210
1210
  case "XYZ":
1211
- case "E": G.set(0, 0, 0);
1211
+ case "E": W.set(0, 0, 0);
1212
1212
  }
1213
1213
  break;
1214
- default: G.set(0, 0, 0);
1214
+ default: W.set(0, 0, 0);
1215
1215
  }
1216
- G.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (ke.lookAt(I.set(0, 0, 0), G, H), this.quaternion.setFromRotationMatrix(ke)), super.updateMatrixWorld(e);
1216
+ W.length() === 0 ? this.quaternion.copy(this.cameraQuaternion) : (Fe.lookAt(F.set(0, 0, 0), W, V), this.quaternion.setFromRotationMatrix(Fe)), super.updateMatrixWorld(e);
1217
1217
  }
1218
- }, Ne = class {
1218
+ }, ze = class {
1219
1219
  constructor() {
1220
1220
  this.isPass = !0, this.enabled = !0, this.needsSwap = !0, this.clear = !1, this.renderToScreen = !1;
1221
1221
  }
@@ -1224,9 +1224,9 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1224
1224
  console.error("THREE.Pass: .render() must be implemented in derived pass.");
1225
1225
  }
1226
1226
  dispose() {}
1227
- }, Pe = new w(-1, 1, 1, -1, 0, 1), Fe = new class extends l {
1227
+ }, Be = new re(-1, 1, 1, -1, 0, 1), Ve = new class extends u {
1228
1228
  constructor() {
1229
- super(), this.setAttribute("position", new h([
1229
+ super(), this.setAttribute("position", new _([
1230
1230
  -1,
1231
1231
  3,
1232
1232
  0,
@@ -1236,7 +1236,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1236
1236
  3,
1237
1237
  -1,
1238
1238
  0
1239
- ], 3)), this.setAttribute("uv", new h([
1239
+ ], 3)), this.setAttribute("uv", new _([
1240
1240
  0,
1241
1241
  2,
1242
1242
  0,
@@ -1245,15 +1245,15 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1245
1245
  0
1246
1246
  ], 2));
1247
1247
  }
1248
- }(), Ie = class {
1248
+ }(), He = class {
1249
1249
  constructor(e) {
1250
- this._mesh = new y(Fe, e);
1250
+ this._mesh = new w(Ve, e);
1251
1251
  }
1252
1252
  dispose() {
1253
1253
  this._mesh.geometry.dispose();
1254
1254
  }
1255
1255
  render(e) {
1256
- e.render(this._mesh, Pe);
1256
+ e.render(this._mesh, Be);
1257
1257
  }
1258
1258
  get material() {
1259
1259
  return this._mesh.material;
@@ -1261,7 +1261,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1261
1261
  set material(e) {
1262
1262
  this._mesh.material = e;
1263
1263
  }
1264
- }, Le = {
1264
+ }, Ue = {
1265
1265
  name: "CopyShader",
1266
1266
  uniforms: {
1267
1267
  tDiffuse: { value: null },
@@ -1269,20 +1269,20 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1269
1269
  },
1270
1270
  vertexShader: "\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",
1271
1271
  fragmentShader: "\n\n uniform float opacity;\n\n uniform sampler2D tDiffuse;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 texel = texture2D( tDiffuse, vUv );\n gl_FragColor = opacity * texel;\n\n\n }"
1272
- }, Re = class e extends Ne {
1272
+ }, We = class e extends ze {
1273
1273
  constructor(e, t, n, r) {
1274
- super(), this.renderScene = t, this.renderCamera = n, this.selectedObjects = r === void 0 ? [] : r, this.visibleEdgeColor = new u(1, 1, 1), this.hiddenEdgeColor = new u(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.patternTexture = null, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = 2, this.pulsePeriod = 0, this._visibilityCache = /* @__PURE__ */ new Map(), this._selectionCache = /* @__PURE__ */ new Set(), this.resolution = e === void 0 ? new k(256, 256) : new k(e.x, e.y);
1274
+ super(), this.renderScene = t, this.renderCamera = n, this.selectedObjects = r === void 0 ? [] : r, this.visibleEdgeColor = new d(1, 1, 1), this.hiddenEdgeColor = new d(.1, .04, .02), this.edgeGlow = 0, this.usePatternTexture = !1, this.patternTexture = null, this.edgeThickness = 1, this.edgeStrength = 3, this.downSampleRatio = 2, this.pulsePeriod = 0, this._visibilityCache = /* @__PURE__ */ new Map(), this._selectionCache = /* @__PURE__ */ new Set(), this.resolution = e === void 0 ? new j(256, 256) : new j(e.x, e.y);
1275
1275
  let i = Math.round(this.resolution.x / this.downSampleRatio), a = Math.round(this.resolution.y / this.downSampleRatio);
1276
- this.renderTargetMaskBuffer = new j(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new b(), this.depthMaterial.side = p, this.depthMaterial.depthPacking = ne, this.depthMaterial.blending = x, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = p, this.prepareMaskMaterial.fragmentShader = s(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new j(this.resolution.x, this.resolution.y, { type: g }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new j(i, a, { type: g }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new j(i, a, { type: g }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new j(Math.round(i / 2), Math.round(a / 2), { type: g }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new j(i, a, { type: g }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new j(Math.round(i / 2), Math.round(a / 2), { type: g }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(i, a), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(i / 2), Math.round(a / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
1277
- let o = Le;
1278
- this.copyUniforms = ae.clone(o.uniforms), this.materialCopy = new D({
1276
+ this.renderTargetMaskBuffer = new N(this.resolution.x, this.resolution.y), this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask", this.renderTargetMaskBuffer.texture.generateMipmaps = !1, this.depthMaterial = new ne(), this.depthMaterial.side = m, this.depthMaterial.depthPacking = ae, this.depthMaterial.blending = T, this.prepareMaskMaterial = this._getPrepareMaskMaterial(), this.prepareMaskMaterial.side = m, this.prepareMaskMaterial.fragmentShader = s(this.prepareMaskMaterial.fragmentShader, this.renderCamera), this.renderTargetDepthBuffer = new N(this.resolution.x, this.resolution.y, { type: y }), this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth", this.renderTargetDepthBuffer.texture.generateMipmaps = !1, this.renderTargetMaskDownSampleBuffer = new N(i, a, { type: y }), this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample", this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1, this.renderTargetBlurBuffer1 = new N(i, a, { type: y }), this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1", this.renderTargetBlurBuffer1.texture.generateMipmaps = !1, this.renderTargetBlurBuffer2 = new N(Math.round(i / 2), Math.round(a / 2), { type: y }), this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2", this.renderTargetBlurBuffer2.texture.generateMipmaps = !1, this.edgeDetectionMaterial = this._getEdgeDetectionMaterial(), this.renderTargetEdgeBuffer1 = new N(i, a, { type: y }), this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1", this.renderTargetEdgeBuffer1.texture.generateMipmaps = !1, this.renderTargetEdgeBuffer2 = new N(Math.round(i / 2), Math.round(a / 2), { type: y }), this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2", this.renderTargetEdgeBuffer2.texture.generateMipmaps = !1, this.separableBlurMaterial1 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial1.uniforms.texSize.value.set(i, a), this.separableBlurMaterial1.uniforms.kernelRadius.value = 1, this.separableBlurMaterial2 = this._getSeparableBlurMaterial(4), this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(i / 2), Math.round(a / 2)), this.separableBlurMaterial2.uniforms.kernelRadius.value = 4, this.overlayMaterial = this._getOverlayMaterial();
1277
+ let o = Ue;
1278
+ this.copyUniforms = ce.clone(o.uniforms), this.materialCopy = new k({
1279
1279
  uniforms: this.copyUniforms,
1280
1280
  vertexShader: o.vertexShader,
1281
1281
  fragmentShader: o.fragmentShader,
1282
- blending: x,
1282
+ blending: T,
1283
1283
  depthTest: !1,
1284
1284
  depthWrite: !1
1285
- }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new u(), this.oldClearAlpha = 1, this._fsQuad = new Ie(null), this.tempPulseColor1 = new u(), this.tempPulseColor2 = new u(), this.textureMatrix = new v();
1285
+ }), this.enabled = !0, this.needsSwap = !1, this._oldClearColor = new d(), this.oldClearAlpha = 1, this._fsQuad = new He(null), this.tempPulseColor1 = new d(), this.tempPulseColor2 = new d(), this.textureMatrix = new C();
1286
1286
  function s(e, t) {
1287
1287
  let n = t.isPerspectiveCamera ? "perspective" : "orthographic";
1288
1288
  return e.replace(/DEPTH_TO_VIEW_Z/g, n + "DepthToViewZ");
@@ -1337,10 +1337,10 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1337
1337
  this.textureMatrix.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), this.textureMatrix.multiply(this.renderCamera.projectionMatrix), this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse);
1338
1338
  }
1339
1339
  _getPrepareMaskMaterial() {
1340
- return new D({
1340
+ return new k({
1341
1341
  uniforms: {
1342
1342
  depthTexture: { value: null },
1343
- cameraNearFar: { value: new k(.5, .5) },
1343
+ cameraNearFar: { value: new j(.5, .5) },
1344
1344
  textureMatrix: { value: null }
1345
1345
  },
1346
1346
  vertexShader: "#include <batching_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n\n varying vec4 projTexCoord;\n varying vec4 vPosition;\n uniform mat4 textureMatrix;\n\n void main() {\n\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n\n vPosition = mvPosition;\n\n vec4 worldPosition = vec4( transformed, 1.0 );\n\n #ifdef USE_INSTANCING\n\n worldPosition = instanceMatrix * worldPosition;\n\n #endif\n\n worldPosition = modelMatrix * worldPosition;\n\n projTexCoord = textureMatrix * worldPosition;\n\n }",
@@ -1348,24 +1348,24 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1348
1348
  });
1349
1349
  }
1350
1350
  _getEdgeDetectionMaterial() {
1351
- return new D({
1351
+ return new k({
1352
1352
  uniforms: {
1353
1353
  maskTexture: { value: null },
1354
- texSize: { value: new k(.5, .5) },
1355
- visibleEdgeColor: { value: new A(1, 1, 1) },
1356
- hiddenEdgeColor: { value: new A(1, 1, 1) }
1354
+ texSize: { value: new j(.5, .5) },
1355
+ visibleEdgeColor: { value: new M(1, 1, 1) },
1356
+ hiddenEdgeColor: { value: new M(1, 1, 1) }
1357
1357
  },
1358
1358
  vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1359
1359
  fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform vec2 texSize;\n uniform vec3 visibleEdgeColor;\n uniform vec3 hiddenEdgeColor;\n\n void main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r)*0.5;\n float diff2 = (c3.r - c4.r)*0.5;\n float d = length( vec2(diff1, diff2) );\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n }"
1360
1360
  });
1361
1361
  }
1362
1362
  _getSeparableBlurMaterial(e) {
1363
- return new D({
1363
+ return new k({
1364
1364
  defines: { MAX_RADIUS: e },
1365
1365
  uniforms: {
1366
1366
  colorTexture: { value: null },
1367
- texSize: { value: new k(.5, .5) },
1368
- direction: { value: new k(.5, .5) },
1367
+ texSize: { value: new j(.5, .5) },
1368
+ direction: { value: new j(.5, .5) },
1369
1369
  kernelRadius: { value: 1 }
1370
1370
  },
1371
1371
  vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
@@ -1373,7 +1373,7 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1373
1373
  });
1374
1374
  }
1375
1375
  _getOverlayMaterial() {
1376
- return new D({
1376
+ return new k({
1377
1377
  uniforms: {
1378
1378
  maskTexture: { value: null },
1379
1379
  edgeTexture1: { value: null },
@@ -1385,17 +1385,17 @@ var V = new m(), H = new A(0, 1, 0), De = new A(0, 0, 0), Oe = new v(), U = new
1385
1385
  },
1386
1386
  vertexShader: "varying vec2 vUv;\n\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",
1387
1387
  fragmentShader: "varying vec2 vUv;\n\n uniform sampler2D maskTexture;\n uniform sampler2D edgeTexture1;\n uniform sampler2D edgeTexture2;\n uniform sampler2D patternTexture;\n uniform float edgeStrength;\n uniform float edgeGlow;\n uniform bool usePatternTexture;\n\n void main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if(usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n }",
1388
- blending: s,
1388
+ blending: c,
1389
1389
  depthTest: !1,
1390
1390
  depthWrite: !1,
1391
1391
  transparent: !0
1392
1392
  });
1393
1393
  }
1394
1394
  };
1395
- Re.BlurDirectionX = new k(1, 0), Re.BlurDirectionY = new k(0, 1);
1395
+ We.BlurDirectionX = new j(1, 0), We.BlurDirectionY = new j(0, 1);
1396
1396
  // src/Editor/demoScene.ts
1397
- var Q = "main";
1398
- function $(e, t, n, r) {
1397
+ var Z = "main";
1398
+ function Q(e, t, n, r) {
1399
1399
  return {
1400
1400
  id: e,
1401
1401
  type: t,
@@ -1415,19 +1415,19 @@ function $(e, t, n, r) {
1415
1415
  ...r ? { props: r } : {}
1416
1416
  };
1417
1417
  }
1418
- function ze() {
1419
- let e = 5 * .707, t = (e, t, n) => $(e, N(t), n, { castShadow: !0 });
1418
+ function Ge() {
1419
+ let e = 5 * .707, t = (e, t, n) => Q(e, ue(t), n, { castShadow: !0 });
1420
1420
  return {
1421
- version: oe,
1422
- name: Q,
1421
+ version: de,
1422
+ name: Z,
1423
1423
  settings: {},
1424
1424
  objects: [
1425
- $("ambient_light", M("AmbientLight"), [
1425
+ Q("ambient_light", le("AmbientLight"), [
1426
1426
  0,
1427
1427
  5,
1428
1428
  0
1429
1429
  ]),
1430
- $("sun", M("DirectionalLightShadow"), [
1430
+ Q("sun", le("DirectionalLightShadow"), [
1431
1431
  10,
1432
1432
  15,
1433
1433
  5
@@ -1435,7 +1435,7 @@ function ze() {
1435
1435
  intensity: 5,
1436
1436
  castShadow: !0
1437
1437
  }),
1438
- $("ground", N("Plane"), [
1438
+ Q("ground", ue("Plane"), [
1439
1439
  0,
1440
1440
  0,
1441
1441
  0
@@ -1493,34 +1493,195 @@ function ze() {
1493
1493
  ]
1494
1494
  };
1495
1495
  }
1496
+ // src/Editor/Network/SyncStore.ts
1497
+ var Ke = class {
1498
+ constructor(e = 250, n = t) {
1499
+ this.intervalMs = e, this.load = n, this.state = {}, this.listeners = /* @__PURE__ */ new Set(), this.loading = !1, this.get = () => this.state, this.subscribe = (e) => (this.listeners.add(e), this.timer || (this.timer = setInterval(() => void this.refresh(), this.intervalMs), this.refresh()), () => {
1500
+ this.listeners.delete(e), !this.listeners.size && this.timer && (clearInterval(this.timer), this.timer = void 0);
1501
+ });
1502
+ }
1503
+ async refresh() {
1504
+ if (!this.loading) {
1505
+ this.loading = !0;
1506
+ try {
1507
+ this.state = { sync: await this.load() };
1508
+ } catch (e) {
1509
+ let t = e.message;
1510
+ if (this.state.error === t && !this.state.sync) return;
1511
+ this.state = { error: t };
1512
+ } finally {
1513
+ this.loading = !1;
1514
+ }
1515
+ this.listeners.forEach((e) => e());
1516
+ }
1517
+ }
1518
+ }, qe = {
1519
+ synced: 5163440,
1520
+ stale: 13537656,
1521
+ untracked: 8947848
1522
+ }, Je = 31436, Ye = 16777215, Xe = 16009031, Ze = 96, Qe = 2e3, $e = .01, et = "editor-network-overlay";
1523
+ function tt(e, t, n, r) {
1524
+ if (n) {
1525
+ let t = r ? n.players.find((e) => e.id === r) : void 0;
1526
+ if (t) return t.id === e.id || t.tracked.includes(e.id) ? "synced" : "untracked";
1527
+ let i = n.entities.find((t) => t.id === e.id);
1528
+ if (i && !i.player && i.trackedBy === 0 && n.players.length > 0) return "untracked";
1529
+ }
1530
+ return t !== null && t - e.tick > 1 ? "stale" : "synced";
1531
+ }
1532
+ function nt() {
1533
+ let e = {
1534
+ ghosts: !1,
1535
+ rings: !1,
1536
+ viewAs: null
1537
+ };
1538
+ try {
1539
+ return {
1540
+ ...e,
1541
+ ...JSON.parse(localStorage.getItem(et) ?? "{}"),
1542
+ viewAs: null
1543
+ };
1544
+ } catch {
1545
+ return e;
1546
+ }
1547
+ }
1548
+ var rt = class extends s {
1549
+ constructor(e = new Ke(), t = nt()) {
1550
+ super(), this.group = new v(), this.ghosts = /* @__PURE__ */ new Map(), this.rings = /* @__PURE__ */ new Map(), this.errorMaterial = $(Xe), this.ringMaterial = $(Je), this.ringSelectedMaterial = $(Ye), this.sync = e, this._options = t, this.group.name = "NetworkOverlay", this.group.userData.isEditorInternal = !0;
1551
+ let n = new l(1, 1, 1);
1552
+ n.translate(0, .5, 0), this.boxGeometry = new h(n), n.dispose();
1553
+ let r = [];
1554
+ for (let e = 0; e < Ze; e++) {
1555
+ let t = e / Ze * Math.PI * 2;
1556
+ r.push(Math.cos(t), 0, Math.sin(t));
1557
+ }
1558
+ this.ringGeometry = new u().setAttribute("position", new _(r, 3)), this.materials = {
1559
+ synced: $(qe.synced),
1560
+ stale: $(qe.stale),
1561
+ untracked: $(qe.untracked)
1562
+ }, this.applyOptions();
1563
+ }
1564
+ get options() {
1565
+ return this._options;
1566
+ }
1567
+ setOptions(e) {
1568
+ this._options = {
1569
+ ...this._options,
1570
+ ...e
1571
+ };
1572
+ try {
1573
+ localStorage.setItem(et, JSON.stringify({
1574
+ ghosts: this._options.ghosts,
1575
+ rings: this._options.rings
1576
+ }));
1577
+ } catch {}
1578
+ this.applyOptions(), this.trigger("changed", this._options);
1579
+ }
1580
+ get active() {
1581
+ return this._options.ghosts || this._options.rings;
1582
+ }
1583
+ applyOptions() {
1584
+ let e = a.instance().scene;
1585
+ this.active && !this.group.parent ? (e.add(this.group), this.unsubscribe = this.sync.subscribe(() => {})) : !this.active && this.group.parent && (e.remove(this.group), this.unsubscribe?.(), this.unsubscribe = void 0);
1586
+ }
1587
+ update() {
1588
+ this.active && (this.group.parent || a.instance().scene.add(this.group), this.updateGhosts(), this.updateRings());
1589
+ }
1590
+ updateGhosts() {
1591
+ let e = a.instance().network, t = this._options.ghosts ? e?.serverView : void 0, { sync: n } = this.sync.get(), r = a.instance().world.entities.items, i = performance.now(), o = /* @__PURE__ */ new Set();
1592
+ for (let e of t?.entities.values() ?? []) {
1593
+ let a = r.get(e.id);
1594
+ if (!a && i - e.receivedAt > Qe) continue;
1595
+ o.add(e.id);
1596
+ let s = this.ghosts.get(e.id) ?? this.createGhost(e.id);
1597
+ s.box.position.set(e.position.x, e.position.y, e.position.z), s.box.rotation.set(e.rotation.x, e.rotation.y, e.rotation.z), s.box.scale.set(e.scale.x, e.scale.y * 2, e.scale.z), s.box.material = this.materials[tt(e, t.tick, n, this._options.viewAs)];
1598
+ let c = a ? a.position.distanceTo(s.box.position) : 0;
1599
+ if (s.error.visible = c > $e, s.error.visible) {
1600
+ let t = s.error.geometry.getAttribute("position");
1601
+ t.setXYZ(0, e.position.x, e.position.y, e.position.z), t.setXYZ(1, a.position.x, a.position.y, a.position.z), t.needsUpdate = !0;
1602
+ }
1603
+ }
1604
+ for (let [e, t] of this.ghosts) o.has(e) || (this.group.remove(t.box, t.error), t.error.geometry.dispose(), this.ghosts.delete(e));
1605
+ }
1606
+ createGhost(e) {
1607
+ let t = it(new S(this.boxGeometry, this.materials.synced));
1608
+ t.name = `ServerGhost:${e}`;
1609
+ let n = new u().setAttribute("position", new _([
1610
+ 0,
1611
+ 0,
1612
+ 0,
1613
+ 0,
1614
+ 0,
1615
+ 0
1616
+ ], 3)), r = it(new b(n, this.errorMaterial));
1617
+ r.frustumCulled = !1, r.visible = !1;
1618
+ let i = {
1619
+ box: t,
1620
+ error: r
1621
+ };
1622
+ return this.group.add(t, r), this.ghosts.set(e, i), i;
1623
+ }
1624
+ updateRings() {
1625
+ let { sync: e } = this.sync.get(), t = this._options.rings && e?.syncDistance ? e.players : [], n = /* @__PURE__ */ new Set();
1626
+ for (let r of t) {
1627
+ n.add(r.id);
1628
+ let t = this.rings.get(r.id);
1629
+ t || (t = it(new x(this.ringGeometry, this.ringMaterial)), t.name = `SyncRing:${r.id}`, this.rings.set(r.id, t), this.group.add(t)), t.position.set(r.position.x, r.position.y + .05, r.position.z), t.scale.setScalar(e.syncDistance), t.material = r.id === this._options.viewAs ? this.ringSelectedMaterial : this.ringMaterial;
1630
+ }
1631
+ for (let [e, t] of this.rings) n.has(e) || (this.group.remove(t), this.rings.delete(e));
1632
+ }
1633
+ get counts() {
1634
+ return {
1635
+ ghosts: this.ghosts.size,
1636
+ rings: this.rings.size
1637
+ };
1638
+ }
1639
+ dispose() {
1640
+ this.unsubscribe?.(), this.unsubscribe = void 0, this.group.removeFromParent(), this.ghosts.forEach((e) => e.error.geometry.dispose()), this.ghosts.clear(), this.rings.clear(), this.boxGeometry.dispose(), this.ringGeometry.dispose(), Object.values(this.materials).forEach((e) => e.dispose()), this.errorMaterial.dispose(), this.ringMaterial.dispose(), this.ringSelectedMaterial.dispose();
1641
+ }
1642
+ };
1643
+ function $(e) {
1644
+ return new ee({
1645
+ color: e,
1646
+ depthTest: !1,
1647
+ depthWrite: !1,
1648
+ transparent: !0,
1649
+ toneMapped: !1
1650
+ });
1651
+ }
1652
+ function it(e) {
1653
+ return e.raycast = () => {}, e.renderOrder = 999, e.userData.isEditorInternal = !0, e;
1654
+ }
1496
1655
  // src/Editor.ts
1497
- var Be = class s extends o {
1656
+ var at = class t extends s {
1498
1657
  static registerPanel(e) {
1499
- return n(e);
1658
+ return r(e);
1500
1659
  }
1501
1660
  static registerListener() {
1502
- i.instance().input.on("keydown", (e) => {
1503
- (e.code === "Insert" || e.code === "Period") && (i.instance().editor = new s());
1661
+ a.instance().input.on("keydown", (e) => {
1662
+ (e.code === "Insert" || e.code === "Period") && (a.instance().editor = new t());
1504
1663
  });
1505
1664
  }
1506
1665
  constructor() {
1507
- super(), this.activeToolMode = "translate", this.shadeMode = "solid", this.originalMaterials = /* @__PURE__ */ new Map(), this.shadeOverrideMaterials = /* @__PURE__ */ new Map(), this.flatColors = /* @__PURE__ */ new Map(), this.helpers = [], this.lightHelpers = [], this._showHelpers = !0, this.abort = new AbortController(), this.activeAssetCategory = "Object", i.instance().editor = this, i.instance().logger?.info("Booting Editor"), i.instance().trigger("editorBoot", this), i.instance().trigger("uiDestroy", this);
1508
- let e = i.instance().activeScene;
1509
- e ? e.rebuild() : this.clearGame(), this.initEditorScene(), e || this.openDefaultScene(), i.instance().contextMenuAbort.abort(), i.instance().uiRoot.innerHTML = "", i.instance().uiRoot.style.opacity = "1", document.title = "MavonEngine | Editor", document.getElementsByTagName("body")[0].removeAttribute("onContextMenu"), Promise.all([import("./mount-CnirMLg0.mjs"), import("./global-l94NfB94.mjs").then((e) => e.t)]).then(([{ mountEditorUI: e }]) => {
1510
- this.reactRoot = e(i.instance().uiRoot);
1666
+ super(), this.activeToolMode = "translate", this.shadeMode = "solid", this.originalMaterials = /* @__PURE__ */ new Map(), this.shadeOverrideMaterials = /* @__PURE__ */ new Map(), this.flatColors = /* @__PURE__ */ new Map(), this.helpers = [], this.lightHelpers = [], this._showHelpers = !0, this.abort = new AbortController(), this.activeAssetCategory = "Object", a.instance().editor = this, a.instance().logger?.info("Booting Editor"), a.instance().trigger("editorBoot", this), a.instance().trigger("uiDestroy", this);
1667
+ let e = a.instance().activeScene;
1668
+ e ? e.rebuild() : this.clearGame(), this.initEditorScene(), e || this.openDefaultScene(), a.instance().contextMenuAbort.abort(), a.instance().uiRoot.innerHTML = "", a.instance().uiRoot.style.opacity = "1", document.title = "MavonEngine | Editor", document.getElementsByTagName("body")[0].removeAttribute("onContextMenu"), Promise.all([import("./mount-BfaV9yI_.mjs"), import("./global-l94NfB94.mjs").then((e) => e.t)]).then(([{ mountEditorUI: e }]) => {
1669
+ this.reactRoot = e(a.instance().uiRoot);
1670
+ }).catch((e) => {
1671
+ a.instance().logger?.error(`The editor's UI could not be loaded: ${e?.stack ?? e}`);
1511
1672
  });
1512
1673
  }
1513
1674
  initEditorScene() {
1514
- i.instance().camera.instance.position.set(20, 10, 20), i.instance().camera.instance.rotation.set(0, 0, 0), i.instance().camera.instance.rotateY(Math.PI / 360 * 90), i.instance().camera.instance.rotateX(Math.PI / 360 * -45), this.outlinePass = new Re(new k(i.instance().sizes.width, i.instance().sizes.height), i.instance().scene, i.instance().camera.instance), i.instance().renderer.composer.addPass(this.outlinePass), this.initFlyControls(), this.watchScene(i.instance().activeScene), i.instance().on("sceneLoaded", (e) => {
1675
+ a.instance().camera.instance.position.set(20, 10, 20), a.instance().camera.instance.rotation.set(0, 0, 0), a.instance().camera.instance.rotateY(Math.PI / 360 * 90), a.instance().camera.instance.rotateX(Math.PI / 360 * -45), this.outlinePass = new We(new j(a.instance().sizes.width, a.instance().sizes.height), a.instance().scene, a.instance().camera.instance), a.instance().renderer.composer.addPass(this.outlinePass), this.initFlyControls(), this.networkOverlay = new rt(), this.watchScene(a.instance().activeScene), a.instance().on("sceneLoaded", (e) => {
1515
1676
  this.deselect(), this.watchScene(e), this.trigger("sceneChanged");
1516
1677
  }), window.addEventListener("keydown", (e) => {
1517
1678
  (e.ctrlKey || e.metaKey) && e.code === "KeyS" && (e.preventDefault(), this.saveScene());
1518
- }, { signal: this.abort.signal }), this.trigger("sceneChanged"), i.instance().input.on("mousedown", (e) => {
1519
- e.target === i.instance().canvas && this.handleCanvasClick(e);
1520
- }), i.instance().input.on("keydown", (e) => {
1679
+ }, { signal: this.abort.signal }), this.trigger("sceneChanged"), a.instance().input.on("mousedown", (e) => {
1680
+ e.target === a.instance().canvas && this.handleCanvasClick(e);
1681
+ }), a.instance().input.on("keydown", (e) => {
1521
1682
  e.code === "Escape" && this.activeItem && this.deselect();
1522
1683
  }), this.handleItemDelete(), this.on("setTransformMode", (e) => {
1523
- this.activeToolMode = e, this.transformControls?.setMode(e), i.instance().logger?.info(`Setting editor tool mode: ${e}`);
1684
+ this.activeToolMode = e, this.transformControls?.setMode(e), a.instance().logger?.info(`Setting editor tool mode: ${e}`);
1524
1685
  }), this.on("setShadeMode", (e) => {
1525
1686
  this.applyShadeMode(e);
1526
1687
  }), this.on("assetDropped", () => {
@@ -1528,27 +1689,27 @@ var Be = class s extends o {
1528
1689
  }), this.initAssetsFilter();
1529
1690
  }
1530
1691
  initAssetsFilter() {
1531
- this.availableAssetCategories = [...new Set(Object.entries(i.instance().resources.items).map(([e, t]) => t.constructor.name))];
1692
+ this.availableAssetCategories = [...new Set(Object.entries(a.instance().resources.items).map(([e, t]) => t.constructor.name))];
1532
1693
  }
1533
1694
  setActiveAssetCategory(e) {
1534
1695
  this.activeAssetCategory = e;
1535
1696
  }
1536
1697
  applyShadeMode(e) {
1537
- this.shadeMode = e, t(i.instance().scene, e, this.originalMaterials, this.shadeOverrideMaterials, this.flatColors);
1698
+ this.shadeMode = e, n(a.instance().scene, e, this.originalMaterials, this.shadeOverrideMaterials, this.flatColors);
1538
1699
  }
1539
1700
  initFlyControls() {
1540
- this.flyControls = new le(i.instance().camera.instance, i.instance().canvas), this.flyControls.autoForward = !1, this.flyControls.dragToLook = !0, this.flyControls.movementSpeed = 10, this.flyControls.rollSpeed = .5;
1701
+ this.flyControls = new he(a.instance().camera.instance, a.instance().canvas), this.flyControls.autoForward = !1, this.flyControls.dragToLook = !0, this.flyControls.movementSpeed = 10, this.flyControls.rollSpeed = .5;
1541
1702
  }
1542
1703
  handleItemDelete() {
1543
- i.instance().input.on("keydown", (e) => {
1704
+ a.instance().input.on("keydown", (e) => {
1544
1705
  if (e.code === "Delete" && this.activeItem) {
1545
1706
  let e = this.activeItem;
1546
- for (; e.parent && e.parent !== i.instance().scene;) e = e.parent;
1707
+ for (; e.parent && e.parent !== a.instance().scene;) e = e.parent;
1547
1708
  e.traverse((e) => {
1548
- e instanceof y && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
1709
+ e instanceof w && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
1549
1710
  }), this.deselect();
1550
- let t = r.from(e), n = i.instance().activeScene, a = n?.entryOfObject3D(e) ?? (t?.owner && n?.getEntries().find((e) => e.object === t.owner));
1551
- n && a ? n.remove(a.data.id) : t?.owner ? t.owner.destroy() : (t && (t.dispose(), this.helpers = this.helpers.filter((e) => e !== t)), i.instance().scene.remove(e)), this.trigger("sceneChanged");
1711
+ let t = i.from(e), n = a.instance().activeScene, r = n?.entryOfObject3D(e) ?? (t?.owner && n?.getEntries().find((e) => e.object === t.owner));
1712
+ n && r ? n.remove(r.data.id) : t?.owner ? t.owner.destroy() : (t && (t.dispose(), this.helpers = this.helpers.filter((e) => e !== t)), a.instance().scene.remove(e)), this.trigger("sceneChanged");
1552
1713
  }
1553
1714
  });
1554
1715
  }
@@ -1561,37 +1722,37 @@ var Be = class s extends o {
1561
1722
  handleCanvasClick(e) {
1562
1723
  if (e.button === 0) {
1563
1724
  if (this.transformControls && (this.transformControls.dragging || this.transformControls.axis !== null)) return;
1564
- let e = i.instance().input.getPointerWorldPosition(void 0, null, !0);
1565
- e instanceof S ? this.selectObject(e) : this.deselect();
1725
+ let e = a.instance().input.getPointerWorldPosition(void 0, null, !0);
1726
+ e instanceof E ? this.selectObject(e) : this.deselect();
1566
1727
  }
1567
1728
  }
1568
1729
  handleHelperTool() {
1569
1730
  if (!this.transformControls) {
1570
- this.transformControls = new xe(i.instance().camera.instance, i.instance().canvas), this.transformControls.addEventListener("dragging-changed", (e) => {
1731
+ this.transformControls = new De(a.instance().camera.instance, a.instance().canvas), this.transformControls.addEventListener("dragging-changed", (e) => {
1571
1732
  this.flyControls.enabled = !e.value, e.value || this.initFlyControls();
1572
1733
  });
1573
1734
  let e = this.transformControls.getHelper();
1574
- e.userData.isEditorInternal = !0, i.instance().scene.add(e);
1735
+ e.userData.isEditorInternal = !0, a.instance().scene.add(e);
1575
1736
  }
1576
1737
  this.transformControls.setMode(this.activeToolMode), this.transformControls.attach(this.activeItem);
1577
1738
  }
1578
1739
  addPanel(e) {
1579
- return n(e);
1740
+ return r(e);
1580
1741
  }
1581
1742
  removePanel(t) {
1582
1743
  e(t);
1583
1744
  }
1584
1745
  saveScene(e = fetch) {
1585
- let t = i.instance().activeScene;
1586
- if (!t) return i.instance().logger?.warn("No scene to save"), Promise.resolve(!1);
1746
+ let t = a.instance().activeScene;
1747
+ if (!t) return a.instance().logger?.warn("No scene to save"), Promise.resolve(!1);
1587
1748
  if (this.saving) return this.saving;
1588
1749
  let n = t.source ?? "main", r = t.serialize();
1589
1750
  this.trigger("sceneSaving", { name: n });
1590
- let o = (e) => (i.instance().logger?.error(`Could not save scene ${n}: ${e}`), this.trigger("sceneSaveFailed", {
1751
+ let i = (e) => (a.instance().logger?.error(`Could not save scene ${n}: ${e}`), this.trigger("sceneSaveFailed", {
1591
1752
  name: n,
1592
1753
  error: e
1593
1754
  }), !1);
1594
- return this.saving = e(a, {
1755
+ return this.saving = e(o, {
1595
1756
  method: "POST",
1596
1757
  headers: { "Content-Type": "application/json" },
1597
1758
  body: JSON.stringify({
@@ -1599,29 +1760,29 @@ var Be = class s extends o {
1599
1760
  scene: r
1600
1761
  })
1601
1762
  }).then(async (e) => {
1602
- let a = await e.json().catch(() => ({}));
1603
- return e.ok ? (t.source = n, t.markSaved(r), i.instance().logger?.info(`Saved scene ${n} to ${a.file ?? n}`), this.trigger("sceneSaved", {
1763
+ let o = await e.json().catch(() => ({}));
1764
+ return e.ok ? (t.source = n, t.markSaved(r), a.instance().logger?.info(`Saved scene ${n} to ${o.file ?? n}`), this.trigger("sceneSaved", {
1604
1765
  name: n,
1605
- file: a.file
1606
- }), !0) : o(a.error ?? `${e.status} ${e.statusText}`);
1607
- }, (e) => o(e.message)).finally(() => {
1766
+ file: o.file
1767
+ }), !0) : i(o.error ?? `${e.status} ${e.statusText}`);
1768
+ }, (e) => i(e.message)).finally(() => {
1608
1769
  this.saving = void 0;
1609
1770
  }), this.saving;
1610
1771
  }
1611
1772
  async openDefaultScene() {
1612
1773
  try {
1613
- await i.instance().openScene(Q);
1774
+ await a.instance().openScene(Z);
1614
1775
  } catch {
1615
- i.instance().logger?.info(`No scenes/${Q}.json yet, opening a demo scene. Save it with Ctrl+S`), i.instance().loadScene(ze(), Q);
1776
+ a.instance().logger?.info(`No scenes/${Z}.json yet, opening a demo scene. Save it with Ctrl+S`), a.instance().loadScene(Ge(), Z);
1616
1777
  }
1617
1778
  }
1618
1779
  watchScene(e) {
1619
1780
  e?.on("changed", () => this.trigger("sceneChanged"));
1620
1781
  }
1621
1782
  clearGame() {
1622
- i.instance().world.destroy(), i.instance().world.entities.items.clear(), i.instance().scene.traverse((e) => {
1623
- e instanceof y && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
1624
- }), i.instance().scene.clear();
1783
+ a.instance().world.destroy(), a.instance().world.entities.items.clear(), a.instance().scene.traverse((e) => {
1784
+ e instanceof w && (e.geometry?.dispose(), Array.isArray(e.material) ? e.material.forEach((e) => e.dispose()) : e.material?.dispose());
1785
+ }), a.instance().scene.clear();
1625
1786
  }
1626
1787
  addHelper(e) {
1627
1788
  this.helpers.push(e), this._showHelpers || (e.mesh.visible = !1, e.label.domElement.style.display = "none");
@@ -1641,15 +1802,15 @@ var Be = class s extends o {
1641
1802
  }), this.lightHelpers.forEach((t) => t.visible = e);
1642
1803
  }
1643
1804
  update(e) {
1644
- this.updateCamera(e), this.helpers.forEach((t) => t.update(e));
1805
+ this.updateCamera(e), this.helpers.forEach((t) => t.update(e)), this.networkOverlay.update();
1645
1806
  }
1646
1807
  updateCamera(e) {
1647
1808
  this.flyControls.update(e);
1648
- let t = i.instance().camera.instance, n = new A();
1649
- t.getWorldDirection(n), t.quaternion.setFromRotationMatrix(new v().lookAt(new A(), n, new A(0, 1, 0)));
1809
+ let t = a.instance().camera.instance, n = new M();
1810
+ t.getWorldDirection(n), t.quaternion.setFromRotationMatrix(new C().lookAt(new M(), n, new M(0, 1, 0)));
1650
1811
  }
1651
1812
  destroy() {
1652
- this.abort.abort(), this.reactRoot.unmount(), this.outlinePass.dispose(), this.shadeOverrideMaterials.forEach((e) => e.dispose()), this.shadeOverrideMaterials.clear(), this.originalMaterials.clear(), this.flatColors.clear();
1813
+ this.abort.abort(), this.reactRoot.unmount(), this.outlinePass.dispose(), this.networkOverlay.dispose(), this.shadeOverrideMaterials.forEach((e) => e.dispose()), this.shadeOverrideMaterials.clear(), this.originalMaterials.clear(), this.flatColors.clear();
1653
1814
  }
1654
1815
  };
1655
- export { Be as default, n as registerEditorPanel, e as unregisterEditorPanel };
1816
+ export { at as default, r as registerEditorPanel, e as unregisterEditorPanel };