@tresjs/core 4.2.1 → 4.2.3

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/tres.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.2.1
3
+ * version: v4.2.3
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
@@ -8,11 +8,11 @@
8
8
  var bt = Object.defineProperty;
9
9
  var Pt = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
10
  var me = (e, t, n) => Pt(e, typeof t != "symbol" ? t + "" : t, n);
11
- import { ref as I, computed as Y, watchEffect as Te, onUnmounted as Q, shallowRef as H, watch as le, readonly as ye, unref as K, provide as _e, inject as Mt, isRef as Ct, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as kt, normalizeClass as xt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
11
+ import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as ce, readonly as ye, unref as J, provide as _e, inject as Mt, isRef as Ct, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as kt, normalizeClass as xt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
12
12
  import * as et from "three";
13
- import { PerspectiveCamera as we, Camera as Dt, Clock as tt, Vector3 as Se, Color as ce, Scene as nt, MathUtils as rt, MeshBasicMaterial as ot, DoubleSide as jt, REVISION as Bt, SRGBColorSpace as It, ACESFilmicToneMapping as st, PCFSoftShadowMap as Ht, NoToneMapping as $t, WebGLRenderer as he, TextureLoader as Ut, Vector2 as ge, Raycaster as Ft, BufferAttribute as Wt, Object3D as Nt, Line as zt, BufferGeometry as $e, Float32BufferAttribute as Ue, LineBasicMaterial as Gt, Mesh as Vt, BackSide as Yt, DirectionalLightHelper as qt, PointLightHelper as Jt, SpotLightHelper as Kt, HemisphereLightHelper as Qt, ArrowHelper as Xt } from "three";
13
+ import { PerspectiveCamera as we, Camera as Dt, Clock as tt, Vector3 as Se, Color as Z, Scene as nt, MathUtils as rt, MeshBasicMaterial as ot, DoubleSide as jt, REVISION as Bt, SRGBColorSpace as It, ACESFilmicToneMapping as st, PCFSoftShadowMap as Ht, NoToneMapping as $t, WebGLRenderer as he, TextureLoader as Ut, Vector2 as ge, Raycaster as Ft, BufferAttribute as Wt, Object3D as Nt, Line as zt, BufferGeometry as $e, Float32BufferAttribute as Ue, LineBasicMaterial as Gt, Mesh as Vt, BackSide as Yt, DirectionalLightHelper as qt, PointLightHelper as Jt, SpotLightHelper as Kt, HemisphereLightHelper as Qt, ArrowHelper as Xt } from "three";
14
14
  import { createEventHook as j, useRafFn as it, toValue as k, unrefElement as Zt, useDevicePixelRatio as en, usePointer as tn, useElementBounding as nn, useWindowSize as rn, useElementSize as on, refDebounced as Fe, tryOnScopeDispose as sn, useFps as an, useMemory as ln } from "@vueuse/core";
15
- const cn = "@tresjs/core", un = "module", fn = "4.2.1", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = [
15
+ const cn = "@tresjs/core", un = "module", fn = "4.2.3", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
@@ -140,38 +140,41 @@ function kn(e) {
140
140
  function at(e) {
141
141
  return typeof e == "string";
142
142
  }
143
- function V(e) {
143
+ function G(e) {
144
144
  return typeof e == "function";
145
145
  }
146
- function N(e) {
147
- return e === Object(e) && !de(e) && !V(e);
146
+ function U(e) {
147
+ return e === Object(e) && !de(e) && !G(e);
148
148
  }
149
- function W(e) {
150
- return N(e) && "isObject3D" in e && !!e.isObject3D;
149
+ function N(e) {
150
+ return U(e) && "isObject3D" in e && !!e.isObject3D;
151
151
  }
152
152
  function We(e) {
153
- return N(e) && "isCamera" in e && !!e.isCamera;
153
+ return U(e) && "isCamera" in e && !!e.isCamera;
154
154
  }
155
155
  function xn(e) {
156
- return N(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
156
+ return U(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
157
157
  }
158
158
  function Ln(e) {
159
- return N(e) && "isMaterial" in e && !!e.isMaterial;
159
+ return U(e) && "isMaterial" in e && !!e.isMaterial;
160
160
  }
161
161
  function Rn(e) {
162
- return N(e) && "isFog" in e && !!e.isFog;
162
+ return U(e) && "isLight" in e && !!e.isLight;
163
163
  }
164
164
  function On(e) {
165
- return N(e) && "isScene" in e && !!e.isScene;
166
- }
167
- function re(e) {
168
- return W(e) || xn(e) || Ln(e) || Rn(e);
165
+ return U(e) && "isFog" in e && !!e.isFog;
169
166
  }
170
167
  function Dn(e) {
171
- return N(e) && !!e.isPrimitive;
168
+ return U(e) && "isScene" in e && !!e.isScene;
169
+ }
170
+ function oe(e) {
171
+ return N(e) || xn(e) || Ln(e) || On(e);
172
172
  }
173
- const jn = ({ sizes: e }) => {
174
- const t = I([]), n = Y(
173
+ function jn(e) {
174
+ return U(e) && !!e.isPrimitive;
175
+ }
176
+ const Bn = ({ sizes: e }) => {
177
+ const t = H([]), n = V(
175
178
  () => t.value[0]
176
179
  ), r = (i) => {
177
180
  const l = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
@@ -194,9 +197,9 @@ const jn = ({ sizes: e }) => {
194
197
  };
195
198
  return Te(() => {
196
199
  e.aspectRatio.value && t.value.forEach((i) => {
197
- !i.manual && (i instanceof we || Bn(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
200
+ !i.manual && (i instanceof we || In(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
198
201
  });
199
- }), Q(() => {
202
+ }), K(() => {
200
203
  t.value = [];
201
204
  }), {
202
205
  camera: n,
@@ -206,12 +209,12 @@ const jn = ({ sizes: e }) => {
206
209
  setCameraActive: r
207
210
  };
208
211
  };
209
- function Bn(e) {
212
+ function In(e) {
210
213
  return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
211
214
  }
212
215
  const lt = j(), ct = j(), Ae = j(), ee = new tt();
213
216
  let ue = 0, fe = 0;
214
- const { pause: In, resume: Ne, isActive: Hn } = it(
217
+ const { pause: Hn, resume: Ne, isActive: $n } = it(
215
218
  () => {
216
219
  lt.trigger({ delta: ue, elapsed: fe, clock: ee }), ct.trigger({ delta: ue, elapsed: fe, clock: ee }), Ae.trigger({ delta: ue, elapsed: fe, clock: ee });
217
220
  },
@@ -221,20 +224,20 @@ Ae.on(() => {
221
224
  ue = ee.getDelta(), fe = ee.getElapsedTime();
222
225
  });
223
226
  let ze = !1;
224
- const $r = () => (ze || (ze = !0, Ne()), {
227
+ const Ur = () => (ze || (ze = !0, Ne()), {
225
228
  onBeforeLoop: lt.on,
226
229
  onLoop: ct.on,
227
230
  onAfterLoop: Ae.on,
228
- pause: In,
231
+ pause: Hn,
229
232
  resume: Ne,
230
- isActive: Hn
231
- }), Ur = !0, oe = "[TresJS ▲ ■ ●] ";
232
- function z() {
233
+ isActive: $n
234
+ }), Fr = !0, se = "[TresJS ▲ ■ ●] ";
235
+ function Y() {
233
236
  function e(...r) {
234
- typeof r[0] == "string" ? r[0] = oe + r[0] : r.unshift(oe), console.error(...r);
237
+ typeof r[0] == "string" ? r[0] = se + r[0] : r.unshift(se), console.error(...r);
235
238
  }
236
239
  function t(...r) {
237
- typeof r[0] == "string" ? r[0] = oe + r[0] : r.unshift(oe), console.warn(...r);
240
+ typeof r[0] == "string" ? r[0] = se + r[0] : r.unshift(se), console.warn(...r);
238
241
  }
239
242
  function n(r, s) {
240
243
  }
@@ -244,13 +247,13 @@ function z() {
244
247
  logMessage: n
245
248
  };
246
249
  }
247
- function Fr(e) {
250
+ function Wr(e) {
248
251
  return typeof e == "number" ? [e, e, e] : e instanceof Se ? [e.x, e.y, e.z] : e;
249
252
  }
250
- function $n(e) {
251
- return e instanceof ce ? e : Array.isArray(e) ? new ce(...e) : new ce(e);
253
+ function Un(e) {
254
+ return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
252
255
  }
253
- class Un extends et.Mesh {
256
+ class Fn extends et.Mesh {
254
257
  constructor(...n) {
255
258
  super(...n);
256
259
  me(this, "type", "HightlightMesh");
@@ -266,18 +269,18 @@ const ut = (e, t) => {
266
269
  for (const n of Object.keys(t))
267
270
  t[n] instanceof Object && Object.assign(t[n], ut(e[n], t[n]));
268
271
  return Object.assign(e || {}, t), e;
269
- }, Fn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", Wn = /* @__PURE__ */ Gn(Fn);
272
+ }, Wn = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", Nn = /* @__PURE__ */ Vn(Wn);
270
273
  function Ge(e) {
271
274
  return e && e.nodeType === 1;
272
275
  }
273
- function se(e) {
276
+ function ie(e) {
274
277
  return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
275
278
  }
276
- const Nn = /\B([A-Z])/g;
277
- function zn(e) {
278
- return e.replace(Nn, "-$1").toLowerCase();
279
+ const zn = /\B([A-Z])/g;
280
+ function Gn(e) {
281
+ return e.replace(zn, "-$1").toLowerCase();
279
282
  }
280
- function Gn(e, t) {
283
+ function Vn(e, t) {
281
284
  const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
282
285
  for (let s = 0; s < r.length; s++)
283
286
  n[r[s]] = !0;
@@ -288,7 +291,7 @@ const Ve = (e, t) => {
288
291
  return;
289
292
  const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
290
293
  return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
291
- }, Vn = (e, t, n) => {
294
+ }, Yn = (e, t, n) => {
292
295
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
293
296
  r && r.reduce((s, a, i) => (s[a] === void 0 && (s[a] = {}), i === r.length - 1 && (s[a] = n), s[a]), e);
294
297
  };
@@ -309,7 +312,7 @@ function ft(e, t) {
309
312
  return !1;
310
313
  return !0;
311
314
  }
312
- function Yn(e, t) {
315
+ function qn(e, t) {
313
316
  if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
314
317
  return !1;
315
318
  for (let n = 0; n < e.length; n++)
@@ -317,8 +320,8 @@ function Yn(e, t) {
317
320
  return !1;
318
321
  return !0;
319
322
  }
320
- const qn = Array.isArray;
321
- function Jn(e, t, n, r) {
323
+ const Jn = Array.isArray;
324
+ function Kn(e, t, n, r) {
322
325
  const s = (c) => {
323
326
  if (c.uuid === t)
324
327
  return c;
@@ -343,7 +346,7 @@ function Jn(e, t, n, r) {
343
346
  const l = n[n.length - 1];
344
347
  i[l] !== void 0 ? i[l] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
345
348
  }
346
- function Kn(e) {
349
+ function Qn(e) {
347
350
  const t = new ot({
348
351
  color: 11003607,
349
352
  // Highlight color, e.g., yellow
@@ -354,18 +357,18 @@ function Kn(e) {
354
357
  side: jt
355
358
  // To e
356
359
  });
357
- return new Un(e.geometry.clone(), t);
360
+ return new Fn(e.geometry.clone(), t);
358
361
  }
359
- function Qn(e) {
362
+ function Xn(e) {
360
363
  var n;
361
364
  let t = e.value;
362
365
  return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new Se(...t)), t;
363
366
  }
364
- function Xn(e) {
367
+ function Zn(e) {
365
368
  return "map" in e;
366
369
  }
367
370
  function Ye(e) {
368
- Xn(e) && e.map && e.map.dispose(), e.dispose();
371
+ Zn(e) && e.map && e.map.dispose(), e.dispose();
369
372
  }
370
373
  function dt(e) {
371
374
  var n, r;
@@ -374,7 +377,7 @@ function dt(e) {
374
377
  e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((a) => Ye(a)), delete s.material) : s.material && (Ye(s.material), delete s.material);
375
378
  }
376
379
  }
377
- function Zn(e, t) {
380
+ function er(e, t) {
378
381
  let n = 0;
379
382
  for (let r = 0; r < e.length; r++)
380
383
  t(e[r], r) && (e[n] = e[r], n++);
@@ -395,7 +398,7 @@ function qe(...e) {
395
398
  return e.map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
396
399
  }
397
400
  const Je = /-\d+$/;
398
- function er(e, t, n) {
401
+ function tr(e, t, n) {
399
402
  if (at(n)) {
400
403
  if (Je.test(n)) {
401
404
  const a = n.replace(Je, ""), { target: i, key: l } = Pe(e, a);
@@ -407,11 +410,11 @@ function er(e, t, n) {
407
410
  }
408
411
  }
409
412
  const { target: r, key: s } = Pe(e, n);
410
- t.__tres.previousAttach = r[s], r[s] = X(t);
413
+ t.__tres.previousAttach = r[s], r[s] = Q(t);
411
414
  } else
412
415
  t.__tres.previousAttach = n(e, t);
413
416
  }
414
- function tr(e, t, n) {
417
+ function nr(e, t, n) {
415
418
  var r, s, a;
416
419
  if (at(n)) {
417
420
  const { target: i, key: l } = Pe(e, n), c = t.__tres.previousAttach;
@@ -420,7 +423,7 @@ function tr(e, t, n) {
420
423
  (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
421
424
  (a = t.__tres) == null || delete a.previousAttach;
422
425
  }
423
- function G(e, t, n) {
426
+ function z(e, t, n) {
424
427
  const r = e;
425
428
  return r.__tres = {
426
429
  type: "unknown",
@@ -439,9 +442,9 @@ function pt(e) {
439
442
  const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
440
443
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
441
444
  }
442
- function nr(e, t, n) {
445
+ function rr(e, t, n) {
443
446
  var s;
444
- if (!V(e.setPixelRatio))
447
+ if (!G(e.setPixelRatio))
445
448
  return;
446
449
  let r = 0;
447
450
  if (de(n) && n.length >= 2) {
@@ -450,29 +453,29 @@ function nr(e, t, n) {
450
453
  } else kn(n) ? r = n : r = t;
451
454
  r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
452
455
  }
453
- function rr(e, t, n, r, s) {
454
- const a = [...t.__tres.objects], i = X(t);
455
- if (e = X(e), i === e)
456
+ function or(e, t, n, r, s) {
457
+ const a = [...t.__tres.objects], i = Q(t);
458
+ if (e = Q(e), i === e)
456
459
  return !0;
457
- const l = G(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
460
+ const l = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
458
461
  delete o.object;
459
462
  for (const u of a)
460
463
  mt(u, s), ht(u, s);
461
464
  i.__tres.objects = [], r.remove(t);
462
- for (const [u, v] of Object.entries(o))
463
- r.patchProp(l, u, l[u], v);
465
+ for (const [u, y] of Object.entries(o))
466
+ r.patchProp(l, u, l[u], y);
464
467
  n(e), r.insert(t, c);
465
468
  for (const u of a)
466
469
  r.insert(u, t);
467
470
  return !0;
468
471
  }
469
- function X(e) {
470
- return Dn(e) ? (e.object.__tres = e.__tres, e.object) : e;
472
+ function Q(e) {
473
+ return jn(e) ? (e.object.__tres = e.__tres, e.object) : e;
471
474
  }
472
475
  function mt(e, t) {
473
476
  var r, s, a, i;
474
477
  const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
475
- e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && Zn(n.__tres.objects, (l) => l !== e), (s = e.__tres) != null && s.attach ? tr(n, e, e.__tres.attach) : ((i = (a = e.parent) == null ? void 0 : a.remove) == null || i.call(a, X(e)), e.parent = null);
478
+ e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && er(n.__tres.objects, (l) => l !== e), (s = e.__tres) != null && s.attach ? nr(n, e, e.__tres.attach) : ((i = (a = e.parent) == null ? void 0 : a.remove) == null || i.call(a, Q(e)), e.parent = null);
476
479
  }
477
480
  function ht(e, t) {
478
481
  var n;
@@ -481,7 +484,7 @@ function ht(e, t) {
481
484
  t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
482
485
  }), t.deregisterCamera(e), pt(e);
483
486
  }
484
- const or = Number.parseInt(Bt.replace("dev", "")), ie = {
487
+ const sr = Number.parseInt(Bt.replace("dev", "")), ae = {
485
488
  realistic: {
486
489
  shadows: !0,
487
490
  physicallyCorrectLights: !0,
@@ -498,12 +501,12 @@ const or = Number.parseInt(Bt.replace("dev", "")), ie = {
498
501
  toneMappingExposure: 1
499
502
  }
500
503
  };
501
- function sr({
504
+ function ir({
502
505
  canvas: e,
503
506
  options: t,
504
507
  contextParts: { sizes: n, render: r, invalidate: s, advance: a }
505
508
  }) {
506
- const i = Y(() => ({
509
+ const i = V(() => ({
507
510
  alpha: k(t.alpha) ?? !0,
508
511
  depth: k(t.depth),
509
512
  canvas: Zt(e),
@@ -516,82 +519,82 @@ function sr({
516
519
  preserveDrawingBuffer: k(t.preserveDrawingBuffer),
517
520
  logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
518
521
  failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
519
- })), l = H(new he(i.value));
522
+ })), l = $(new he(i.value));
520
523
  function c() {
521
524
  t.renderMode === "on-demand" && s();
522
525
  }
523
- le(i, () => {
526
+ ce(i, () => {
524
527
  l.value.dispose(), l.value = new he(i.value), c();
525
- }), le([n.width, n.height], () => {
528
+ }), ce([n.width, n.height], () => {
526
529
  l.value.setSize(n.width.value, n.height.value), c();
527
530
  }, {
528
531
  immediate: !0
529
- }), le(() => t.clearColor, c);
530
- const { pixelRatio: o } = en(), { logError: u } = z(), f = (() => {
531
- const p = new he(), P = {
532
+ }), ce(() => t.clearColor, c);
533
+ const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
534
+ const v = new he(), b = {
532
535
  shadowMap: {
533
- enabled: p.shadowMap.enabled,
534
- type: p.shadowMap.type
536
+ enabled: v.shadowMap.enabled,
537
+ type: v.shadowMap.type
535
538
  },
536
- toneMapping: p.toneMapping,
537
- toneMappingExposure: p.toneMappingExposure,
538
- outputColorSpace: p.outputColorSpace
539
+ toneMapping: v.toneMapping,
540
+ toneMappingExposure: v.toneMappingExposure,
541
+ outputColorSpace: v.outputColorSpace
539
542
  };
540
- return p.dispose(), P;
541
- })(), _ = k(t.renderMode);
542
- return _ === "on-demand" && s(), _ === "manual" && setTimeout(() => {
543
+ return v.dispose(), b;
544
+ })(), g = k(t.renderMode);
545
+ return g === "on-demand" && s(), g === "manual" && setTimeout(() => {
543
546
  a();
544
547
  }, 100), Te(() => {
545
- const p = k(t.preset);
546
- p && (p in ie || u(`Renderer Preset must be one of these: ${Object.keys(ie).join(", ")}`), ut(l.value, ie[p])), nr(l.value, o.value, k(t.dpr)), _ === "always" && (r.frames.value = Math.max(1, r.frames.value));
547
- const P = (g, E) => {
548
- const C = k(g), T = () => {
549
- if (p)
550
- return Ve(ie[p], E);
548
+ const v = k(t.preset);
549
+ v && (v in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(l.value, ae[v])), rr(l.value, o.value, k(t.dpr)), g === "always" && (r.frames.value = Math.max(1, r.frames.value));
550
+ const b = (C, E) => {
551
+ const P = k(C), S = () => {
552
+ if (v)
553
+ return Ve(ae[v], E);
551
554
  };
552
- if (C !== void 0)
553
- return C;
554
- const M = T();
555
+ if (P !== void 0)
556
+ return P;
557
+ const M = S();
555
558
  return M !== void 0 ? M : Ve(f, E);
556
- }, m = (g, E) => Vn(l.value, E, P(g, E));
557
- m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? st, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), or < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
558
- const y = P(t.clearColor, "clearColor");
559
- y && l.value.setClearColor(
560
- y ? $n(y) : new ce(0)
559
+ }, m = (C, E) => Yn(l.value, E, b(C, E));
560
+ m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? st, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), sr < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
561
+ const d = b(t.clearColor, "clearColor");
562
+ d && l.value.setClearColor(
563
+ d ? Un(d) : new Z(0)
561
564
  // default clear color is not easily/efficiently retrievable from three
562
565
  );
563
- }), Q(() => {
566
+ }), K(() => {
564
567
  l.value.dispose(), l.value.forceContextLoss();
565
568
  }), {
566
569
  renderer: l
567
570
  };
568
571
  }
569
- const ir = (e) => !!e && e.constructor === Array;
570
- function ar(e) {
572
+ const ar = (e) => !!e && e.constructor === Array;
573
+ function lr(e) {
571
574
  const t = { nodes: {}, materials: {} };
572
575
  return e && e.traverse((n) => {
573
576
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
574
577
  }), t;
575
578
  }
576
- async function Wr(e, t, n, r, s) {
577
- const { logError: a } = z(), i = new e();
579
+ async function Nr(e, t, n, r, s) {
580
+ const { logError: a } = Y(), i = new e();
578
581
  s && s(i), n && n(i);
579
582
  const c = (Array.isArray(t) ? t : [t]).map(
580
- (o) => new Promise((u, v) => {
583
+ (o) => new Promise((u, y) => {
581
584
  i.load(
582
585
  o,
583
586
  (f) => {
584
- const _ = f;
585
- _.scene && Object.assign(_, ar(_.scene)), u(_);
587
+ const g = f;
588
+ g.scene && Object.assign(g, lr(g.scene)), u(g);
586
589
  },
587
590
  r,
588
- (f) => v(a("[useLoader] - Failed to load resource", f))
591
+ (f) => y(a("[useLoader] - Failed to load resource", f))
589
592
  );
590
593
  })
591
594
  );
592
- return ir(t) ? await Promise.all(c) : await c[0];
595
+ return ar(t) ? await Promise.all(c) : await c[0];
593
596
  }
594
- async function Nr(e, t) {
597
+ async function zr(e, t) {
595
598
  const n = new Ut(t), r = (s) => new Promise((a, i) => {
596
599
  n.load(
597
600
  s,
@@ -602,7 +605,7 @@ async function Nr(e, t) {
602
605
  }
603
606
  );
604
607
  });
605
- if (qn(e)) {
608
+ if (Jn(e)) {
606
609
  const s = await Promise.all(e.map((a) => r(a)));
607
610
  return e.length > 1 ? s : s[0];
608
611
  } else {
@@ -614,7 +617,7 @@ async function Nr(e, t) {
614
617
  metalnessMap: c,
615
618
  aoMap: o,
616
619
  alphaMap: u,
617
- matcap: v
620
+ matcap: y
618
621
  } = e;
619
622
  return {
620
623
  map: s ? await r(s) : null,
@@ -624,91 +627,91 @@ async function Nr(e, t) {
624
627
  metalnessMap: c ? await r(c) : null,
625
628
  aoMap: o ? await r(o) : null,
626
629
  alphaMap: u ? await r(u) : null,
627
- matcap: v ? await r(v) : null
630
+ matcap: y ? await r(y) : null
628
631
  };
629
632
  }
630
633
  }
631
- const lr = (e, t) => {
632
- const n = Y(() => t.renderer.value.domElement), r = H([]), { x: s, y: a } = tn({ target: n });
634
+ const cr = (e, t) => {
635
+ const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: a } = tn({ target: n });
633
636
  let i = 0;
634
- const { width: l, height: c, top: o, left: u } = nn(n), v = ({ x: h, y: S }) => {
637
+ const { width: l, height: c, top: o, left: u } = nn(n), y = ({ x: h, y: T }) => {
635
638
  if (n.value)
636
639
  return {
637
640
  x: (h - u.value) / l.value * 2 - 1,
638
- y: -((S - o.value) / c.value) * 2 + 1
641
+ y: -((T - o.value) / c.value) * 2 + 1
639
642
  };
640
- }, f = ({ x: h, y: S }) => {
643
+ }, f = ({ x: h, y: T }) => {
641
644
  if (t.camera.value)
642
- return t.raycaster.value.setFromCamera(new ge(h, S), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
643
- }, _ = (h) => {
644
- const S = v({
645
+ return t.raycaster.value.setFromCamera(new ge(h, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
646
+ }, g = (h) => {
647
+ const T = y({
645
648
  x: (h == null ? void 0 : h.clientX) ?? s.value,
646
649
  y: (h == null ? void 0 : h.clientY) ?? a.value
647
650
  });
648
- return S ? f(S) || [] : [];
649
- }, p = j(), P = j(), m = j(), y = j(), g = j(), E = j(), C = j(), T = j();
651
+ return T ? f(T) || [] : [];
652
+ }, v = j(), b = j(), m = j(), d = j(), C = j(), E = j(), P = j(), S = j();
650
653
  function M(h) {
651
- const S = {};
652
- for (const U in h)
653
- typeof U != "function" && (S[U] = h[U]);
654
- return S;
654
+ const T = {};
655
+ for (const F in h)
656
+ typeof F != "function" && (T[F] = h[F]);
657
+ return T;
655
658
  }
656
- const w = (h, S) => {
659
+ const _ = (h, T) => {
657
660
  var Oe, De, je;
658
- const U = M(S), ne = new Se(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Oe = t.camera) == null ? void 0 : Oe.value);
661
+ const F = M(T), re = new Se(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Oe = t.camera) == null ? void 0 : Oe.value);
659
662
  h.trigger({
660
- ...U,
663
+ ...F,
661
664
  intersections: r.value,
662
665
  // The unprojectedPoint is wrong, math needs to be fixed
663
- unprojectedPoint: ne,
666
+ unprojectedPoint: re,
664
667
  ray: (De = t.raycaster) == null ? void 0 : De.value.ray,
665
668
  camera: (je = t.camera) == null ? void 0 : je.value,
666
- sourceEvent: S,
669
+ sourceEvent: T,
667
670
  delta: i,
668
671
  stopPropagating: !1
669
672
  });
670
673
  };
671
674
  let L;
672
675
  const x = (h) => {
673
- _(h), w(m, h), L = h;
674
- }, d = () => {
676
+ g(h), _(m, h), L = h;
677
+ }, p = () => {
675
678
  L && x(L);
676
679
  };
677
- let b, A, D;
678
- const $ = (h) => {
679
- var S;
680
- b = (S = r.value[0]) == null ? void 0 : S.object, i = 0, A = new ge(
680
+ let w, A, D;
681
+ const O = (h) => {
682
+ var T;
683
+ w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, A = new ge(
681
684
  (h == null ? void 0 : h.clientX) ?? s.value,
682
685
  (h == null ? void 0 : h.clientY) ?? a.value
683
- ), w(g, h);
686
+ ), _(C, h);
684
687
  };
685
- let R, O = !1;
686
- const q = (h) => {
687
- var S, U, ne;
688
- h instanceof PointerEvent && (r.value.length === 0 && w(E, h), b === ((S = r.value[0]) == null ? void 0 : S.object) && (D = new ge(
688
+ let B, R = !1;
689
+ const ne = (h) => {
690
+ var T, F, re;
691
+ h instanceof PointerEvent && (r.value.length === 0 && _(E, h), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
689
692
  (h == null ? void 0 : h.clientX) ?? s.value,
690
693
  (h == null ? void 0 : h.clientY) ?? a.value
691
- ), i = A == null ? void 0 : A.distanceTo(D), h.button === 0 ? (w(p, h), R === ((U = r.value[0]) == null ? void 0 : U.object) ? O = !0 : (R = (ne = r.value[0]) == null ? void 0 : ne.object, O = !1)) : h.button === 2 && w(C, h)), w(y, h));
694
+ ), i = A == null ? void 0 : A.distanceTo(D), h.button === 0 ? (_(v, h), B === ((F = r.value[0]) == null ? void 0 : F.object) ? R = !0 : (B = (re = r.value[0]) == null ? void 0 : re.object, R = !1)) : h.button === 2 && _(P, h)), _(d, h));
692
695
  }, xe = (h) => {
693
- O && (w(P, h), R = void 0, O = !1);
694
- }, Le = (h) => w(m, h), Re = (h) => w(T, h);
695
- return n.value.addEventListener("pointerup", q), n.value.addEventListener("pointerdown", $), n.value.addEventListener("pointermove", x), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", xe), n.value.addEventListener("wheel", Re), Q(() => {
696
- n != null && n.value && (n.value.removeEventListener("pointerup", q), n.value.removeEventListener("pointerdown", $), n.value.removeEventListener("pointermove", x), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", xe), n.value.removeEventListener("wheel", Re));
696
+ R && (_(b, h), B = void 0, R = !1);
697
+ }, Le = (h) => _(m, h), Re = (h) => _(S, h);
698
+ return n.value.addEventListener("pointerup", ne), n.value.addEventListener("pointerdown", O), n.value.addEventListener("pointermove", x), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", xe), n.value.addEventListener("wheel", Re), K(() => {
699
+ n != null && n.value && (n.value.removeEventListener("pointerup", ne), n.value.removeEventListener("pointerdown", O), n.value.removeEventListener("pointermove", x), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", xe), n.value.removeEventListener("wheel", Re));
697
700
  }), {
698
701
  intersects: r,
699
- onClick: (h) => p.on(h).off,
700
- onDblClick: (h) => P.on(h).off,
701
- onContextMenu: (h) => C.on(h).off,
702
+ onClick: (h) => v.on(h).off,
703
+ onDblClick: (h) => b.on(h).off,
704
+ onContextMenu: (h) => P.on(h).off,
702
705
  onPointerMove: (h) => m.on(h).off,
703
- onPointerUp: (h) => y.on(h).off,
704
- onPointerDown: (h) => g.on(h).off,
706
+ onPointerUp: (h) => d.on(h).off,
707
+ onPointerDown: (h) => C.on(h).off,
705
708
  onPointerMissed: (h) => E.on(h).off,
706
- onWheel: (h) => T.on(h).off,
707
- forceUpdate: d
709
+ onWheel: (h) => S.on(h).off,
710
+ forceUpdate: p
708
711
  };
709
712
  };
710
- function zr() {
711
- const { logWarning: e } = z();
713
+ function Gr() {
714
+ const { logWarning: e } = Y();
712
715
  function t(a, i, l) {
713
716
  let c = null;
714
717
  return a.traverse((o) => {
@@ -737,111 +740,111 @@ function zr() {
737
740
  function ke(e) {
738
741
  let t = 0;
739
742
  return e.traverse((n) => {
740
- if (n.isMesh && n.geometry) {
743
+ if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
741
744
  const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, a = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = r.attributes.normal ? r.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, l = r.attributes.uv ? r.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, c = s + a + i + l;
742
745
  t += c;
743
746
  }
744
747
  }), t;
745
748
  }
746
- function cr(e) {
749
+ function ur(e) {
747
750
  return (e / 1024).toFixed(2);
748
751
  }
749
- const Me = I({}), Ce = (e) => Object.assign(Me.value, e);
750
- function ur(e, t, n) {
752
+ const Me = H({}), Ce = (e) => Object.assign(Me.value, e);
753
+ function fr(e, t, n) {
751
754
  var x;
752
- const r = H(), s = H();
755
+ const r = $(), s = $();
753
756
  e && (r.value = e), t && (s.value = t);
754
- const a = (d) => {
755
- var b;
756
- return ((b = d.__tres) == null ? void 0 : b.eventCount) > 0;
757
- }, i = (d) => {
758
- var b;
759
- return ((b = d.children) == null ? void 0 : b.some((A) => i(A))) || a(d);
760
- }, l = H(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
761
- function c(d, b) {
762
- if (Array.isArray(d))
763
- for (const A of d)
764
- A(b);
765
- typeof d == "function" && d(b);
757
+ const a = (p) => {
758
+ var w;
759
+ return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
760
+ }, i = (p) => {
761
+ var w;
762
+ return ((w = p.children) == null ? void 0 : w.some((A) => i(A))) || a(p);
763
+ }, l = $(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
764
+ function c(p, w) {
765
+ if (Array.isArray(p))
766
+ for (const A of p)
767
+ A(w);
768
+ typeof p == "function" && p(w);
766
769
  }
767
- function o(d, b) {
768
- const A = [], D = () => b.stopPropagating = !0;
769
- b.stopPropagation = D;
770
- for (const $ of b == null ? void 0 : b.intersections) {
771
- if (b.stopPropagating)
770
+ function o(p, w) {
771
+ const A = [], D = () => w.stopPropagating = !0;
772
+ w.stopPropagation = D;
773
+ for (const O of w == null ? void 0 : w.intersections) {
774
+ if (w.stopPropagating)
772
775
  return;
773
- b = { ...b, ...$ };
774
- const { object: R } = $;
775
- b.eventObject = R, c(R[d], b), A.push(R);
776
- let O = R.parent;
777
- for (; O !== null && !b.stopPropagating && !A.includes(O); )
778
- b.eventObject = O, c(O[d], b), A.push(O), O = O.parent;
779
- const q = zn(d.slice(2));
780
- n(q, { intersection: $, event: b });
776
+ w = { ...w, ...O };
777
+ const { object: B } = O;
778
+ w.eventObject = B, c(B[p], w), A.push(B);
779
+ let R = B.parent;
780
+ for (; R !== null && !w.stopPropagating && !A.includes(R); )
781
+ w.eventObject = R, c(R[p], w), A.push(R), R = R.parent;
782
+ const ne = Gn(p.slice(2));
783
+ n(ne, { intersection: O, event: w });
781
784
  }
782
785
  }
783
786
  const {
784
787
  onClick: u,
785
- onDblClick: v,
788
+ onDblClick: y,
786
789
  onContextMenu: f,
787
- onPointerMove: _,
788
- onPointerDown: p,
789
- onPointerUp: P,
790
+ onPointerMove: g,
791
+ onPointerDown: v,
792
+ onPointerUp: b,
790
793
  onPointerMissed: m,
791
- onWheel: y,
792
- forceUpdate: g
793
- } = lr(l, t);
794
- P((d) => o("onPointerUp", d)), p((d) => o("onPointerDown", d)), u((d) => o("onClick", d)), v((d) => o("onDoubleClick", d)), f((d) => o("onContextMenu", d)), y((d) => o("onWheel", d));
794
+ onWheel: d,
795
+ forceUpdate: C
796
+ } = cr(l, t);
797
+ b((p) => o("onPointerUp", p)), v((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), y((p) => o("onDoubleClick", p)), f((p) => o("onContextMenu", p)), d((p) => o("onWheel", p));
795
798
  let E = [];
796
- _((d) => {
797
- const b = d.intersections.map(({ object: D }) => D), A = d.intersections;
799
+ g((p) => {
800
+ const w = p.intersections.map(({ object: D }) => D), A = p.intersections;
798
801
  E.forEach(({ object: D }) => {
799
- b.includes(D) || (d.intersections = E, o("onPointerLeave", d), o("onPointerOut", d));
800
- }), d.intersections = A, d.intersections.forEach(({ object: D }) => {
801
- E.includes(D) || (o("onPointerEnter", d), o("onPointerOver", d));
802
- }), o("onPointerMove", d), E = d.intersections;
802
+ w.includes(D) || (p.intersections = E, o("onPointerLeave", p), o("onPointerOut", p));
803
+ }), p.intersections = A, p.intersections.forEach(({ object: D }) => {
804
+ E.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
805
+ }), o("onPointerMove", p), E = p.intersections;
803
806
  });
804
- const C = [];
805
- m((d) => {
806
- const b = () => d.stopPropagating = !0;
807
- d.stopPropagation = b, C.forEach((A) => {
808
- d.stopPropagating || (d.eventObject = A, c(A.onPointerMissed, d));
809
- }), n("pointer-missed", { event: d });
807
+ const P = [];
808
+ m((p) => {
809
+ const w = () => p.stopPropagating = !0;
810
+ p.stopPropagation = w, P.forEach((A) => {
811
+ p.stopPropagating || (p.eventObject = A, c(A.onPointerMissed, p));
812
+ }), n("pointer-missed", { event: p });
810
813
  });
811
- function T(d) {
812
- re(d) && W(d) && l.value.push(d);
814
+ function S(p) {
815
+ oe(p) && N(p) && l.value.push(p);
813
816
  }
814
- function M(d) {
815
- if (re(d) && W(d)) {
816
- const b = l.value.indexOf(d);
817
- b > -1 && l.value.splice(b, 1);
817
+ function M(p) {
818
+ if (oe(p) && N(p)) {
819
+ const w = l.value.indexOf(p);
820
+ w > -1 && l.value.splice(w, 1);
818
821
  }
819
822
  }
820
- function w(d) {
821
- re(d) && W(d) && d.onPointerMissed && C.push(d);
823
+ function _(p) {
824
+ oe(p) && N(p) && p.onPointerMissed && P.push(p);
822
825
  }
823
- function L(d) {
824
- if (re(d) && W(d)) {
825
- const b = C.indexOf(d);
826
- b > -1 && C.splice(b, 1);
826
+ function L(p) {
827
+ if (oe(p) && N(p)) {
828
+ const w = P.indexOf(p);
829
+ w > -1 && P.splice(w, 1);
827
830
  }
828
831
  }
829
832
  return t.eventManager = {
830
- forceUpdate: g,
831
- registerObject: T,
833
+ forceUpdate: C,
834
+ registerObject: S,
832
835
  deregisterObject: M,
833
- registerPointerMissedObject: w,
836
+ registerPointerMissedObject: _,
834
837
  deregisterPointerMissedObject: L
835
838
  }, {
836
- forceUpdate: g,
837
- registerObject: T,
839
+ forceUpdate: C,
840
+ registerObject: S,
838
841
  deregisterObject: M,
839
- registerPointerMissedObject: w,
842
+ registerPointerMissedObject: _,
840
843
  deregisterPointerMissedObject: L
841
844
  };
842
845
  }
843
- function fr(e, t, n = 10) {
844
- const r = k(e) ? rn() : on(Y(() => k(t).parentElement)), s = ye(Fe(r.width, n)), a = ye(Fe(r.height, n)), i = Y(() => s.value / a.value);
846
+ function dr(e, t, n = 10) {
847
+ const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)), a = ye(Fe(r.height, n)), i = V(() => s.value / a.value);
845
848
  return {
846
849
  height: a,
847
850
  width: s,
@@ -852,9 +855,9 @@ function ve() {
852
855
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
853
856
  let n = 0, r = !1;
854
857
  const s = () => {
855
- const o = Array.from(e.entries()).sort((u, v) => {
856
- const f = u[1].priority - v[1].priority;
857
- return f === 0 ? u[1].addI - v[1].addI : f;
858
+ const o = Array.from(e.entries()).sort((u, y) => {
859
+ const f = u[1].priority - y[1].priority;
860
+ return f === 0 ? u[1].addI - y[1].addI : f;
858
861
  });
859
862
  t.clear(), o.forEach((u) => t.add(u[0]));
860
863
  }, a = (o) => {
@@ -862,9 +865,9 @@ function ve() {
862
865
  };
863
866
  return { on: (o, u = 0) => {
864
867
  e.set(o, { priority: u, addI: n++ });
865
- const v = () => a(o);
866
- return sn(v), r = !0, {
867
- off: v
868
+ const y = () => a(o);
869
+ return sn(y), r = !0, {
870
+ off: y
868
871
  };
869
872
  }, off: a, trigger: (...o) => {
870
873
  r && (s(), r = !1), t.forEach((u) => u(...o));
@@ -874,82 +877,82 @@ function ve() {
874
877
  return e.size;
875
878
  } };
876
879
  }
877
- function dr() {
880
+ function pr() {
878
881
  let e = !0, t = !0, n = !1;
879
- const r = new tt(!1), s = I(r.running), a = I(!1);
882
+ const r = new tt(!1), s = H(r.running), a = H(!1);
880
883
  let i;
881
884
  const l = rt.generateUUID();
882
885
  let c = null;
883
- const o = ve(), u = ve(), v = ve();
886
+ const o = ve(), u = ve(), y = ve();
884
887
  M();
885
888
  let f = {};
886
- function _(w) {
887
- f = w;
889
+ function g(_) {
890
+ f = _;
888
891
  }
889
- function p(w, L, x = 0) {
892
+ function v(_, L, x = 0) {
890
893
  switch (L) {
891
894
  case "before":
892
- return o.on(w, x);
895
+ return o.on(_, x);
893
896
  case "render":
894
- return c || (c = w), u.dispose(), u.on(w);
897
+ return c || (c = _), u.dispose(), u.on(_);
895
898
  case "after":
896
- return v.on(w, x);
899
+ return y.on(_, x);
897
900
  }
898
901
  }
899
- function P() {
900
- t && (t = !1, M(), T());
902
+ function b() {
903
+ t && (t = !1, M(), S());
901
904
  }
902
905
  function m() {
903
906
  t = !0, M(), cancelAnimationFrame(i);
904
907
  }
905
- function y() {
908
+ function d() {
906
909
  n = !1, M();
907
910
  }
908
- function g() {
911
+ function C() {
909
912
  n = !0, M();
910
913
  }
911
914
  function E() {
912
915
  a.value = !0;
913
916
  }
914
- function C() {
917
+ function P() {
915
918
  a.value = !1;
916
919
  }
917
- function T() {
920
+ function S() {
918
921
  if (!e) {
919
- i = requestAnimationFrame(T);
922
+ i = requestAnimationFrame(S);
920
923
  return;
921
924
  }
922
- const w = r.getDelta(), L = r.getElapsedTime(), x = {
923
- camera: K(f.camera),
924
- scene: K(f.scene),
925
- renderer: K(f.renderer),
926
- raycaster: K(f.raycaster),
927
- controls: K(f.controls),
925
+ const _ = r.getDelta(), L = r.getElapsedTime(), x = {
926
+ camera: J(f.camera),
927
+ scene: J(f.scene),
928
+ renderer: J(f.renderer),
929
+ raycaster: J(f.raycaster),
930
+ controls: J(f.controls),
928
931
  invalidate: f.invalidate,
929
932
  advance: f.advance
930
- }, d = { delta: w, elapsed: L, clock: r, ...x };
931
- s.value && o.trigger(d), a.value || (u.count ? u.trigger(d) : c && c(d)), s.value && v.trigger(d), i = requestAnimationFrame(T);
933
+ }, p = { delta: _, elapsed: L, clock: r, ...x };
934
+ s.value && o.trigger(p), a.value || (u.count ? u.trigger(p) : c && c(p)), s.value && y.trigger(p), i = requestAnimationFrame(S);
932
935
  }
933
936
  function M() {
934
- const w = !t && !n;
935
- r.running !== w && (r.running ? r.stop() : r.start()), s.value = r.running;
937
+ const _ = !t && !n;
938
+ r.running !== _ && (r.running ? r.stop() : r.start()), s.value = r.running;
936
939
  }
937
940
  return {
938
941
  loopId: l,
939
- register: (w, L, x) => p(w, L, x),
940
- start: P,
942
+ register: (_, L, x) => v(_, L, x),
943
+ start: b,
941
944
  stop: m,
942
- pause: g,
943
- resume: y,
945
+ pause: C,
946
+ resume: d,
944
947
  pauseRender: E,
945
- resumeRender: C,
948
+ resumeRender: P,
946
949
  isRenderPaused: a,
947
950
  isActive: s,
948
- setContext: _,
949
- setReady: (w) => e = w
951
+ setContext: g,
952
+ setReady: (_) => e = _
950
953
  };
951
954
  }
952
- function pr(e, t, n = 100) {
955
+ function mr(e, t, n = 100) {
953
956
  n = n <= 0 ? 100 : n;
954
957
  const r = j(), s = /* @__PURE__ */ new Set();
955
958
  let a = !1, i = !1, l = null;
@@ -960,8 +963,8 @@ function pr(e, t, n = 100) {
960
963
  i = !0, l && clearTimeout(l);
961
964
  }
962
965
  c();
963
- const u = (f, ..._) => {
964
- f(..._);
966
+ const u = (f, ...g) => {
967
+ f(...g);
965
968
  };
966
969
  return {
967
970
  on: (f) => {
@@ -969,8 +972,8 @@ function pr(e, t, n = 100) {
969
972
  return u(f, t), { off: () => {
970
973
  } };
971
974
  {
972
- const _ = r.on(f);
973
- return s.add(_.off), r.on(f);
975
+ const g = r.on(f);
976
+ return s.add(g.off), r.on(f);
974
977
  }
975
978
  },
976
979
  off: r.off,
@@ -982,7 +985,7 @@ const te = /* @__PURE__ */ new WeakMap();
982
985
  function gt(e) {
983
986
  if (e = e || pe(), te.has(e))
984
987
  return te.get(e);
985
- const t = 100, n = Date.now(), a = pr(() => {
988
+ const t = 100, n = Date.now(), a = mr(() => {
986
989
  if (Date.now() - n >= t)
987
990
  return !0;
988
991
  {
@@ -992,12 +995,12 @@ function gt(e) {
992
995
  }, e);
993
996
  return te.set(e, a), a;
994
997
  }
995
- function Gr(e) {
998
+ function Vr(e) {
996
999
  const t = pe();
997
1000
  if (t)
998
1001
  return te.has(t) ? te.get(t).on(e) : gt(t).on(e);
999
1002
  }
1000
- function mr({
1003
+ function hr({
1001
1004
  scene: e,
1002
1005
  canvas: t,
1003
1006
  windowSize: n,
@@ -1005,43 +1008,43 @@ function mr({
1005
1008
  rendererOptions: s,
1006
1009
  emit: a
1007
1010
  }) {
1008
- const { logWarning: i } = z(), l = H(e), c = fr(n, t), {
1009
- camera: o,
1010
- cameras: u,
1011
- registerCamera: v,
1012
- deregisterCamera: f,
1013
- setCameraActive: _
1014
- } = jn({ sizes: c, scene: e }), p = {
1015
- mode: I(s.renderMode || "always"),
1016
- priority: I(0),
1017
- frames: I(0),
1011
+ const i = $(e), l = dr(n, t), {
1012
+ camera: c,
1013
+ cameras: o,
1014
+ registerCamera: u,
1015
+ deregisterCamera: y,
1016
+ setCameraActive: f
1017
+ } = Bn({ sizes: l, scene: e }), g = {
1018
+ mode: H(s.renderMode || "always"),
1019
+ priority: H(0),
1020
+ frames: H(0),
1018
1021
  maxFrames: 60,
1019
- canBeInvalidated: Y(() => p.mode.value === "on-demand" && p.frames.value === 0)
1022
+ canBeInvalidated: V(() => g.mode.value === "on-demand" && g.frames.value === 0)
1020
1023
  };
1021
- function P(R = 1) {
1022
- s.renderMode === "on-demand" ? p.frames.value = Math.min(p.maxFrames, p.frames.value + R) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
1024
+ function v(O = 1) {
1025
+ s.renderMode === "on-demand" && (g.frames.value = Math.min(g.maxFrames, g.frames.value + O));
1023
1026
  }
1024
- function m() {
1025
- s.renderMode === "manual" ? p.frames.value = 1 : i("`advance` can only be used when `renderMode` is set to `manual`");
1027
+ function b() {
1028
+ s.renderMode === "manual" && (g.frames.value = 1);
1026
1029
  }
1027
- const { renderer: y } = sr(
1030
+ const { renderer: m } = ir(
1028
1031
  {
1029
1032
  scene: e,
1030
1033
  canvas: t,
1031
1034
  options: s,
1032
1035
  emit: a,
1033
1036
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
1034
- contextParts: { sizes: c, camera: o, render: p, invalidate: P, advance: m },
1037
+ contextParts: { sizes: l, camera: c, render: g, invalidate: v, advance: b },
1035
1038
  disableRender: r
1036
1039
  }
1037
- ), g = {
1038
- sizes: c,
1039
- scene: l,
1040
- camera: o,
1041
- cameras: ye(u),
1042
- renderer: y,
1043
- raycaster: H(new Ft()),
1044
- controls: I(null),
1040
+ ), d = {
1041
+ sizes: l,
1042
+ scene: i,
1043
+ camera: c,
1044
+ cameras: ye(o),
1045
+ renderer: m,
1046
+ raycaster: $(new Ft()),
1047
+ controls: H(null),
1045
1048
  perf: {
1046
1049
  maxFrames: 160,
1047
1050
  fps: {
@@ -1054,38 +1057,38 @@ function mr({
1054
1057
  accumulator: []
1055
1058
  }
1056
1059
  },
1057
- render: p,
1058
- advance: m,
1060
+ render: g,
1061
+ advance: b,
1059
1062
  extend: Ce,
1060
- invalidate: P,
1061
- registerCamera: v,
1062
- setCameraActive: _,
1063
- deregisterCamera: f,
1064
- loop: dr()
1063
+ invalidate: v,
1064
+ registerCamera: u,
1065
+ setCameraActive: f,
1066
+ deregisterCamera: y,
1067
+ loop: pr()
1065
1068
  };
1066
- _e("useTres", g), g.scene.value.__tres = {
1067
- root: g
1068
- }, g.loop.register(() => {
1069
- o.value && p.frames.value > 0 && (y.value.render(e, o.value), a("render", g.renderer.value)), p.priority.value = 0, p.mode.value === "always" ? p.frames.value = 1 : p.frames.value = Math.max(0, p.frames.value - 1);
1069
+ _e("useTres", d), d.scene.value.__tres = {
1070
+ root: d
1071
+ }, d.loop.register(() => {
1072
+ c.value && g.frames.value > 0 && (m.value.render(e, c.value), a("render", d.renderer.value)), g.priority.value = 0, g.mode.value === "always" ? g.frames.value = 1 : g.frames.value = Math.max(0, g.frames.value - 1);
1070
1073
  }, "render");
1071
- const { on: E, cancel: C } = gt(g);
1072
- g.loop.setReady(!1), g.loop.start(), E(() => {
1073
- a("ready", g), g.loop.setReady(!0), ur(e, g, a);
1074
- }), Q(() => {
1075
- C(), g.loop.stop();
1074
+ const { on: C, cancel: E } = gt(d);
1075
+ d.loop.setReady(!1), d.loop.start(), C(() => {
1076
+ a("ready", d), d.loop.setReady(!0), fr(e, d, a);
1077
+ }), K(() => {
1078
+ E(), d.loop.stop();
1076
1079
  });
1077
- const T = 100, M = an({ every: T }), { isSupported: w, memory: L } = ln({ interval: T }), x = 160;
1078
- let d = performance.now();
1079
- const b = ({ timestamp: R }) => {
1080
- g.scene.value && (g.perf.memory.allocatedMem = ke(g.scene.value)), R - d >= T && (d = R, g.perf.fps.accumulator.push(M.value), g.perf.fps.accumulator.length > x && g.perf.fps.accumulator.shift(), g.perf.fps.value = M.value, w.value && L.value && (g.perf.memory.accumulator.push(L.value.usedJSHeapSize / 1024 / 1024), g.perf.memory.accumulator.length > x && g.perf.memory.accumulator.shift(), g.perf.memory.currentMem = g.perf.memory.accumulator.reduce((O, q) => O + q, 0) / g.perf.memory.accumulator.length));
1080
+ const P = 100, S = an({ every: P }), { isSupported: M, memory: _ } = ln({ interval: P }), L = 160;
1081
+ let x = performance.now();
1082
+ const p = ({ timestamp: O }) => {
1083
+ d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), O - x >= P && (x = O, d.perf.fps.accumulator.push(S.value), d.perf.fps.accumulator.length > L && d.perf.fps.accumulator.shift(), d.perf.fps.value = S.value, M.value && _.value && (d.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > L && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((B, R) => B + R, 0) / d.perf.memory.accumulator.length));
1081
1084
  };
1082
- let A = 0;
1083
- const D = 1, { pause: $ } = it(({ delta: R }) => {
1084
- window.__TRES__DEVTOOLS__ && (b({ timestamp: performance.now() }), A += R, A >= D && (window.__TRES__DEVTOOLS__.cb(g), A = 0));
1085
+ let w = 0;
1086
+ const A = 1, { pause: D } = it(({ delta: O }) => {
1087
+ window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= A && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
1085
1088
  }, { immediate: !0 });
1086
- return Q(() => {
1087
- $();
1088
- }), g;
1089
+ return K(() => {
1090
+ D();
1091
+ }), d;
1089
1092
  }
1090
1093
  function pe() {
1091
1094
  const e = Mt("useTres");
@@ -1093,8 +1096,8 @@ function pe() {
1093
1096
  throw new Error("useTresContext must be used together with useTresContextProvider");
1094
1097
  return e;
1095
1098
  }
1096
- const Vr = pe;
1097
- function Yr() {
1099
+ const Yr = pe;
1100
+ function qr() {
1098
1101
  const {
1099
1102
  camera: e,
1100
1103
  scene: t,
@@ -1114,14 +1117,14 @@ function Yr() {
1114
1117
  invalidate: i,
1115
1118
  advance: l
1116
1119
  });
1117
- function c(v, f = 0) {
1118
- return r.register(v, "before", f);
1120
+ function c(y, f = 0) {
1121
+ return r.register(y, "before", f);
1119
1122
  }
1120
- function o(v) {
1121
- return r.register(v, "render");
1123
+ function o(y) {
1124
+ return r.register(y, "render");
1122
1125
  }
1123
- function u(v, f = 0) {
1124
- return r.register(v, "after", f);
1126
+ function u(y, f = 0) {
1127
+ return r.register(y, "after", f);
1125
1128
  }
1126
1129
  return {
1127
1130
  pause: r.pause,
@@ -1134,7 +1137,7 @@ function Yr() {
1134
1137
  onAfterRender: u
1135
1138
  };
1136
1139
  }
1137
- function hr(e, t = {}, n = {}) {
1140
+ function gr(e, t = {}, n = {}) {
1138
1141
  let r = e;
1139
1142
  const s = (l) => {
1140
1143
  r = l;
@@ -1153,7 +1156,7 @@ function hr(e, t = {}, n = {}) {
1153
1156
  };
1154
1157
  return a = new Proxy({}, i), a;
1155
1158
  }
1156
- const { logError: Ke } = z(), Qe = [
1159
+ const { logError: Ke } = Y(), Qe = [
1157
1160
  "onClick",
1158
1161
  "onContextMenu",
1159
1162
  "onPointerMove",
@@ -1168,68 +1171,68 @@ const { logError: Ke } = z(), Qe = [
1168
1171
  "onPointerMissed",
1169
1172
  "onLostPointerCapture",
1170
1173
  "onWheel"
1171
- ], gr = (e) => {
1174
+ ], vr = (e) => {
1172
1175
  const t = e.scene.value;
1173
- function n(o, u, v, f) {
1174
- if (f || (f = {}), f.args || (f.args = []), o === "template" || Wn(o))
1176
+ function n(o, u, y, f) {
1177
+ if (f || (f = {}), f.args || (f.args = []), o === "template" || Nn(o))
1175
1178
  return null;
1176
- let _ = o.replace("Tres", ""), p;
1179
+ let g = o.replace("Tres", ""), v;
1177
1180
  if (o === "primitive") {
1178
- (!N(f.object) || Ct(f.object)) && Ke(
1181
+ (!U(f.object) || Ct(f.object)) && Ke(
1179
1182
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1180
- ), _ = f.object.type;
1181
- const P = {};
1182
- p = hr(
1183
+ ), g = f.object.type;
1184
+ const b = {};
1185
+ v = gr(
1183
1186
  f.object,
1184
1187
  {
1185
- object: (y) => y,
1188
+ object: (d) => d,
1186
1189
  isPrimitive: () => !0,
1187
- __tres: () => P
1190
+ __tres: () => b
1188
1191
  },
1189
1192
  {
1190
- object: (y, g, E, C) => {
1191
- rr(y, E, C, { patchProp: a, remove: s, insert: r }, e);
1193
+ object: (d, C, E, P) => {
1194
+ or(d, E, P, { patchProp: a, remove: s, insert: r }, e);
1192
1195
  },
1193
- __tres: (y) => {
1194
- Object.assign(P, y);
1196
+ __tres: (d) => {
1197
+ Object.assign(b, d);
1195
1198
  }
1196
1199
  }
1197
1200
  );
1198
1201
  } else {
1199
- const P = Me.value[_];
1200
- P || Ke(
1201
- `${_} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1202
- ), p = new P(...f.args);
1202
+ const b = Me.value[g];
1203
+ b || Ke(
1204
+ `${g} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1205
+ ), v = new b(...f.args);
1203
1206
  }
1204
- return p ? (p.isCamera && (f != null && f.position || p.position.set(3, 3, 3), f != null && f.lookAt || p.lookAt(0, 0, 0)), p = G(p, {
1205
- ...p.__tres,
1206
- type: _,
1207
+ return v ? (v.isCamera && (f != null && f.position || v.position.set(3, 3, 3), f != null && f.lookAt || v.lookAt(0, 0, 0)), v = z(v, {
1208
+ ...v.__tres,
1209
+ type: g,
1207
1210
  memoizedProps: f,
1208
1211
  eventCount: 0,
1209
1212
  primitive: o === "primitive",
1210
1213
  attach: f.attach
1211
- }, e), p) : null;
1214
+ }, e), v) : null;
1212
1215
  }
1213
1216
  function r(o, u) {
1214
- var _, p, P;
1217
+ var g, v, b;
1215
1218
  if (!o)
1216
1219
  return;
1217
1220
  u = u || t;
1218
- const v = o.__tres ? o : G(o, {}, e), f = u.__tres ? u : G(u, {}, e);
1219
- o = X(v), u = X(f), o.__tres && ((_ = o.__tres) == null ? void 0 : _.eventCount) > 0 && ((p = e.eventManager) == null || p.registerObject(o)), e.registerCamera(o), (P = e.eventManager) == null || P.registerPointerMissedObject(o), v.__tres.attach ? er(f, v, v.__tres.attach) : W(o) && W(f) && (f.add(o), o.dispatchEvent({ type: "added" })), v.__tres.parent = f, f.__tres.objects && !f.__tres.objects.includes(v) && f.__tres.objects.push(v);
1221
+ const y = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
1222
+ o = Q(y), u = Q(f), o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((v = e.eventManager) == null || v.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), y.__tres.attach ? tr(f, y, y.__tres.attach) : N(o) && N(f) && (f.add(o), o.dispatchEvent({ type: "added" })), y.__tres.parent = f, f.__tres.objects && !f.__tres.objects.includes(y) && f.__tres.objects.push(y);
1220
1223
  }
1221
1224
  function s(o, u) {
1222
- var p, P, m, y;
1225
+ var v, b, m, d;
1223
1226
  if (!o)
1224
1227
  return;
1225
- o != null && o.__tres && ((p = o.__tres) == null ? void 0 : p.eventCount) > 0 && ((P = e.eventManager) == null || P.deregisterObject(o)), u = be(u) ? "default" : u;
1226
- const v = (m = o.__tres) == null ? void 0 : m.dispose;
1227
- be(v) || (v === null ? u = !1 : u = v);
1228
- const f = (y = o.__tres) == null ? void 0 : y.primitive, _ = u === "default" ? !f : !!u;
1229
- if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((g) => s(g, u)), _ && o.children && [...o.children].forEach((g) => s(g, u)), mt(o, e), ht(o, e), _ && !On(o)) {
1230
- if (V(u))
1228
+ o != null && o.__tres && ((v = o.__tres) == null ? void 0 : v.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
1229
+ const y = (m = o.__tres) == null ? void 0 : m.dispose;
1230
+ be(y) || (y === null ? u = !1 : u = y);
1231
+ const f = (d = o.__tres) == null ? void 0 : d.primitive, g = u === "default" ? !f : !!u;
1232
+ if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, u)), g && o.children && [...o.children].forEach((C) => s(C, u)), mt(o, e), ht(o, e), g && !Dn(o)) {
1233
+ if (G(u))
1231
1234
  u(o);
1232
- else if (V(o.dispose))
1235
+ else if (G(o.dispose))
1233
1236
  try {
1234
1237
  o.dispose();
1235
1238
  } catch {
@@ -1237,66 +1240,66 @@ const { logError: Ke } = z(), Qe = [
1237
1240
  }
1238
1241
  "__tres" in o && delete o.__tres;
1239
1242
  }
1240
- function a(o, u, v, f) {
1241
- var g, E;
1243
+ function a(o, u, y, f) {
1244
+ var C, E;
1242
1245
  if (!o)
1243
1246
  return;
1244
- let _ = o, p = u;
1247
+ let g = o, v = u;
1245
1248
  if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
1246
- const C = ((g = o.__tres) == null ? void 0 : g.parent) || o.parent;
1247
- s(o), G(o, { attach: f }, e), C && r(o, C);
1249
+ const P = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
1250
+ s(o), z(o, { attach: f }, e), P && r(o, P);
1248
1251
  return;
1249
1252
  }
1250
1253
  if (u === "dispose") {
1251
- o.__tres || (o = G(o, {}, e)), o.__tres.dispose = f;
1254
+ o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
1252
1255
  return;
1253
1256
  }
1254
- if (W(o) && p === "blocks-pointer-events") {
1255
- f || f === "" ? o[p] = f : delete o[p];
1257
+ if (N(o) && v === "blocks-pointer-events") {
1258
+ f || f === "" ? o[v] = f : delete o[v];
1256
1259
  return;
1257
1260
  }
1258
1261
  Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
1259
- let P = se(p), m = _ == null ? void 0 : _[P];
1260
- if (p === "args") {
1261
- const C = o, T = v ?? [], M = f ?? [], w = ((E = o.__tres) == null ? void 0 : E.type) || o.type;
1262
- w && T.length && !Yn(T, M) && (_ = Object.assign(
1263
- C,
1264
- new Me.value[w](...f)
1262
+ let b = ie(v), m = g == null ? void 0 : g[b];
1263
+ if (v === "args") {
1264
+ const P = o, S = y ?? [], M = f ?? [], _ = ((E = o.__tres) == null ? void 0 : E.type) || o.type;
1265
+ _ && S.length && !qn(S, M) && (g = Object.assign(
1266
+ P,
1267
+ new Me.value[_](...f)
1265
1268
  ));
1266
1269
  return;
1267
1270
  }
1268
- if (_.type === "BufferGeometry") {
1269
- if (p === "args")
1271
+ if (g.type === "BufferGeometry") {
1272
+ if (v === "args")
1270
1273
  return;
1271
- _.setAttribute(
1272
- se(p),
1274
+ g.setAttribute(
1275
+ ie(v),
1273
1276
  new Wt(...f)
1274
1277
  );
1275
1278
  return;
1276
1279
  }
1277
- if (p.includes("-") && m === void 0) {
1278
- const C = p.split("-");
1279
- m = C.reduce((T, M) => T[se(M)], _), p = C.pop(), P = p, m != null && m.set || (_ = C.reduce((T, M) => T[se(M)], _));
1280
+ if (v.includes("-") && m === void 0) {
1281
+ const P = v.split("-");
1282
+ m = P.reduce((S, M) => S[ie(M)], g), v = P.pop(), b = v, m != null && m.set || (g = P.reduce((S, M) => S[ie(M)], g));
1280
1283
  }
1281
- let y = f;
1282
- if (y === "" && (y = !0), V(m)) {
1283
- Qe.includes(u) || (de(y) ? o[P](...y) : o[P](y)), P.startsWith("on") && V(y) && (_[P] = y);
1284
+ let d = f;
1285
+ if (d === "" && (d = !0), G(m)) {
1286
+ Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (g[b] = d);
1284
1287
  return;
1285
1288
  }
1286
- !(m != null && m.set) && !V(m) ? _[P] = y : m.constructor === y.constructor && (m != null && m.copy) ? m == null || m.copy(y) : de(y) ? m.set(...y) : !m.isColor && m.setScalar ? m.setScalar(y) : m.set(y), pt(o);
1289
+ !(m != null && m.set) && !G(m) ? g[b] = d : m.constructor === d.constructor && (m != null && m.copy) ? m == null || m.copy(d) : de(d) ? m.set(...d) : !m.isColor && m.setScalar ? m.setScalar(d) : m.set(d), pt(o);
1287
1290
  }
1288
1291
  function i(o) {
1289
1292
  var u;
1290
1293
  return ((u = o == null ? void 0 : o.__tres) == null ? void 0 : u.parent) || null;
1291
1294
  }
1292
1295
  function l(o) {
1293
- const u = G(new Nt(), { type: "Comment" }, e);
1296
+ const u = z(new Nt(), { type: "Comment" }, e);
1294
1297
  return u.name = o, u;
1295
1298
  }
1296
1299
  function c(o) {
1297
- var _;
1298
- const u = i(o), v = ((_ = u == null ? void 0 : u.__tres) == null ? void 0 : _.objects) || [], f = v.indexOf(o);
1299
- return f < 0 || f >= v.length - 1 ? null : v[f + 1];
1300
+ var g;
1301
+ const u = i(o), y = ((g = u == null ? void 0 : u.__tres) == null ? void 0 : g.objects) || [], f = y.indexOf(o);
1302
+ return f < 0 || f >= y.length - 1 ? null : y[f + 1];
1300
1303
  }
1301
1304
  return {
1302
1305
  insert: r,
@@ -1315,22 +1318,22 @@ const { logError: Ke } = z(), Qe = [
1315
1318
  insertStaticContent: () => void 0
1316
1319
  };
1317
1320
  };
1318
- function vr() {
1321
+ function yr() {
1319
1322
  return vt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1320
1323
  }
1321
1324
  function vt() {
1322
1325
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1323
1326
  }
1324
- const yr = typeof Proxy == "function", _r = "devtools-plugin:setup", wr = "plugin:settings:set";
1325
- let J, Ee;
1326
- function br() {
1327
+ const _r = typeof Proxy == "function", wr = "devtools-plugin:setup", br = "plugin:settings:set";
1328
+ let q, Ee;
1329
+ function Pr() {
1327
1330
  var e;
1328
- return J !== void 0 || (typeof window < "u" && window.performance ? (J = !0, Ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (J = !0, Ee = globalThis.perf_hooks.performance) : J = !1), J;
1331
+ return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Ee = globalThis.perf_hooks.performance) : q = !1), q;
1329
1332
  }
1330
- function Pr() {
1331
- return br() ? Ee.now() : Date.now();
1333
+ function Mr() {
1334
+ return Pr() ? Ee.now() : Date.now();
1332
1335
  }
1333
- class Mr {
1336
+ class Cr {
1334
1337
  constructor(t, n) {
1335
1338
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1336
1339
  const r = {};
@@ -1358,9 +1361,9 @@ class Mr {
1358
1361
  a = i;
1359
1362
  },
1360
1363
  now() {
1361
- return Pr();
1364
+ return Mr();
1362
1365
  }
1363
- }, n && n.on(wr, (i, l) => {
1366
+ }, n && n.on(br, (i, l) => {
1364
1367
  i === this.plugin.id && this.fallbacks.setSettings(l);
1365
1368
  }), this.proxiedOn = new Proxy({}, {
1366
1369
  get: (i, l) => this.target ? this.target.on[l] : (...c) => {
@@ -1392,12 +1395,12 @@ class Mr {
1392
1395
  n.resolve(await this.target[n.method](...n.args));
1393
1396
  }
1394
1397
  }
1395
- function Cr(e, t) {
1396
- const n = e, r = vt(), s = vr(), a = yr && n.enableEarlyProxy;
1398
+ function Er(e, t) {
1399
+ const n = e, r = vt(), s = yr(), a = _r && n.enableEarlyProxy;
1397
1400
  if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
1398
- s.emit(_r, e, t);
1401
+ s.emit(wr, e, t);
1399
1402
  else {
1400
- const i = a ? new Mr(n, s) : null;
1403
+ const i = a ? new Cr(n, s) : null;
1401
1404
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1402
1405
  pluginDescriptor: n,
1403
1406
  setupFn: t,
@@ -1405,7 +1408,7 @@ function Cr(e, t) {
1405
1408
  }), i && t(i.proxiedTarget);
1406
1409
  }
1407
1410
  }
1408
- function Er(e, t) {
1411
+ function Tr(e, t) {
1409
1412
  const n = `▲ ■ ●${e}`;
1410
1413
  typeof Xe == "function" ? Xe(n, t) : console.log(n);
1411
1414
  }
@@ -1426,17 +1429,17 @@ const yt = (e) => {
1426
1429
  });
1427
1430
  const n = ke(e);
1428
1431
  return n > 0 && t.tags.push({
1429
- label: `${cr(n)} KB`,
1432
+ label: `${ur(n)} KB`,
1430
1433
  textColor: 15707189,
1431
1434
  backgroundColor: 16775644,
1432
1435
  tooltip: "Memory usage"
1433
- }), e.type.includes("Light") && (t.tags.push({
1436
+ }), e.type.includes("Light") && (Rn(e) && t.tags.push({
1434
1437
  label: `${e.intensity}`,
1435
1438
  textColor: 9738662,
1436
1439
  backgroundColor: 16316922,
1437
1440
  tooltip: "Intensity"
1438
1441
  }), t.tags.push({
1439
- label: `#${e.color.getHexString()}`,
1442
+ label: `#${new Z(e.color).getHexString()}`,
1440
1443
  textColor: 9738662,
1441
1444
  backgroundColor: 16316922,
1442
1445
  tooltip: "Color"
@@ -1460,51 +1463,51 @@ function _t(e, t, n = "") {
1460
1463
  t.children.push(s), _t(r, s, n);
1461
1464
  });
1462
1465
  }
1463
- const Tr = [], Z = "tres:inspector", Sr = Et({
1466
+ const Sr = [], X = "tres:inspector", Ar = Et({
1464
1467
  sceneGraph: null
1465
1468
  });
1466
- function Ar(e, t) {
1467
- Cr(
1469
+ function kr(e, t) {
1470
+ Er(
1468
1471
  {
1469
1472
  id: "dev.esm.tres",
1470
1473
  label: "TresJS 🪐",
1471
1474
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
1472
1475
  packageName: "tresjs",
1473
1476
  homepage: "https://tresjs.org",
1474
- componentStateTypes: Tr,
1477
+ componentStateTypes: Sr,
1475
1478
  app: e
1476
1479
  },
1477
1480
  (n) => {
1478
- typeof n.now != "function" && Er(
1481
+ typeof n.now != "function" && Tr(
1479
1482
  "You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
1480
1483
  ), n.addInspector({
1481
- id: Z,
1484
+ id: X,
1482
1485
  label: "TresJS 🪐",
1483
1486
  icon: "account_tree",
1484
1487
  treeFilterPlaceholder: "Search instances"
1485
1488
  }), setInterval(() => {
1486
- n.sendInspectorTree(Z);
1489
+ n.sendInspectorTree(X);
1487
1490
  }, 1e3), setInterval(() => {
1488
1491
  n.notifyComponentUpdate();
1489
1492
  }, 5e3), n.on.getInspectorTree((a) => {
1490
- if (a.inspectorId === Z) {
1493
+ if (a.inspectorId === X) {
1491
1494
  const i = yt(t.scene.value);
1492
- _t(t.scene.value, i, a.filter), Sr.sceneGraph = i, a.rootNodes = [i];
1495
+ _t(t.scene.value, i, a.filter), Ar.sceneGraph = i, a.rootNodes = [i];
1493
1496
  }
1494
1497
  });
1495
1498
  let r = null, s = null;
1496
1499
  n.on.getInspectorState((a) => {
1497
1500
  var i;
1498
- if (a.inspectorId === Z) {
1501
+ if (a.inspectorId === X) {
1499
1502
  const [l] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
1500
1503
  if (!l)
1501
1504
  return;
1502
1505
  if (s && r && r.parent && s.remove(r), l.isMesh) {
1503
- const c = Kn(l);
1506
+ const c = Qn(l);
1504
1507
  l.add(c), r = c, s = l;
1505
1508
  }
1506
1509
  a.state = {
1507
- object: Object.entries(l).map(([c, o]) => ({ key: c, value: o, editable: !0 })).filter(({ key: c }) => c !== "parent")
1510
+ object: Object.entries(l).map(([c, o]) => c === "children" ? { key: c, value: o.filter((u) => u.type !== "HightlightMesh") } : { key: c, value: o, editable: !0 }).filter(({ key: c }) => c !== "parent")
1508
1511
  }, l.isScene && (a.state.info = {
1509
1512
  memory: ke(l),
1510
1513
  objects: l.children.length,
@@ -1523,12 +1526,12 @@ function Ar(e, t) {
1523
1526
  }))) || []);
1524
1527
  }
1525
1528
  }), n.on.editInspectorState((a) => {
1526
- a.inspectorId === Z && Jn(t.scene.value, a.nodeId, a.path, a.state.value);
1529
+ a.inspectorId === X && Kn(t.scene.value, a.nodeId, a.path, a.state.value);
1527
1530
  });
1528
1531
  }
1529
1532
  );
1530
1533
  }
1531
- const kr = ["data-scene", "data-tres"], xr = /* @__PURE__ */ Be({
1534
+ const xr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1532
1535
  __name: "TresCanvas",
1533
1536
  props: {
1534
1537
  shadows: { type: Boolean, default: void 0 },
@@ -1573,66 +1576,66 @@ const kr = ["data-scene", "data-tres"], xr = /* @__PURE__ */ Be({
1573
1576
  "ready"
1574
1577
  ],
1575
1578
  setup(e, { expose: t, emit: n }) {
1576
- var P;
1577
- const r = e, s = n, a = Tt(), { logWarning: i } = z(), l = I(), c = H(new nt()), o = (P = Ie()) == null ? void 0 : P.appContext.app;
1579
+ var b;
1580
+ const r = e, s = n, a = Tt(), { logWarning: i } = Y(), l = H(), c = $(new nt()), o = (b = Ie()) == null ? void 0 : b.appContext.app;
1578
1581
  Ce(et);
1579
1582
  const u = (m) => Be({
1580
1583
  setup() {
1581
- var g;
1582
- const y = (g = Ie()) == null ? void 0 : g.appContext;
1583
- return y && (y.app = o), _e("useTres", m), _e("extend", Ce), typeof window < "u" && Ar(y == null ? void 0 : y.app, m), () => He(Ot, null, a != null && a.default ? a.default() : []);
1584
+ var C;
1585
+ const d = (C = Ie()) == null ? void 0 : C.appContext;
1586
+ return d && (d.app = o), _e("useTres", m), _e("extend", Ce), typeof window < "u" && kr(d == null ? void 0 : d.app, m), () => He(Ot, null, a != null && a.default ? a.default() : []);
1584
1587
  }
1585
- }), v = (m) => {
1586
- const y = u(m), { render: g } = Rt(gr(m));
1587
- g(He(y), c.value);
1588
- }, f = (m, y = !1) => {
1589
- dt(m.scene.value), y && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), c.value.__tres = {
1588
+ }), y = (m) => {
1589
+ const d = u(m), { render: C } = Rt(vr(m));
1590
+ C(He(d), c.value);
1591
+ }, f = (m, d = !1) => {
1592
+ dt(m.scene.value), d && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), c.value.__tres = {
1590
1593
  root: m
1591
- }, v(m);
1592
- }, _ = Y(() => r.disableRender), p = H(null);
1593
- return t({ context: p, dispose: () => f(p.value, !0) }), St(() => {
1594
+ }, y(m);
1595
+ }, g = V(() => r.disableRender), v = $(null);
1596
+ return t({ context: v, dispose: () => f(v.value, !0) }), St(() => {
1594
1597
  const m = l;
1595
- p.value = mr({
1598
+ v.value = hr({
1596
1599
  scene: c.value,
1597
1600
  canvas: m,
1598
1601
  windowSize: r.windowSize ?? !1,
1599
- disableRender: _.value ?? !1,
1602
+ disableRender: g.value ?? !1,
1600
1603
  rendererOptions: r,
1601
1604
  emit: s
1602
1605
  });
1603
- const { registerCamera: y, camera: g, cameras: E, deregisterCamera: C } = p.value;
1604
- v(p.value);
1605
- const T = () => {
1606
+ const { registerCamera: d, camera: C, cameras: E, deregisterCamera: P } = v.value;
1607
+ y(v.value);
1608
+ const S = () => {
1606
1609
  const M = new we(
1607
1610
  45,
1608
1611
  window.innerWidth / window.innerHeight,
1609
1612
  0.1,
1610
1613
  1e3
1611
1614
  );
1612
- M.position.set(3, 3, 3), M.lookAt(0, 0, 0), y(M);
1613
- const w = Te(() => {
1614
- E.value.length >= 2 && (M.removeFromParent(), C(M), w == null || w());
1615
+ M.position.set(3, 3, 3), M.lookAt(0, 0, 0), d(M);
1616
+ const _ = Te(() => {
1617
+ E.value.length >= 2 && (M.removeFromParent(), P(M), _ == null || _());
1615
1618
  });
1616
1619
  };
1617
- le(
1620
+ ce(
1618
1621
  () => r.camera,
1619
- (M, w) => {
1620
- M && y(M), w && (w.removeFromParent(), C(w));
1622
+ (M, _) => {
1623
+ M && d(M), _ && (_.removeFromParent(), P(_));
1621
1624
  },
1622
1625
  {
1623
1626
  immediate: !0
1624
1627
  }
1625
- ), g.value || (i(
1628
+ ), C.value || (i(
1626
1629
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1627
- ), T());
1628
- }), Q(() => {
1629
- f(p.value);
1630
- }), (m, y) => (At(), kt("canvas", {
1630
+ ), S());
1631
+ }), K(() => {
1632
+ f(v.value);
1633
+ }), (m, d) => (At(), kt("canvas", {
1631
1634
  ref_key: "canvas",
1632
1635
  ref: l,
1633
1636
  "data-scene": c.value.uuid,
1634
1637
  class: xt(m.$attrs.class),
1635
- "data-tres": `tresjs ${K(An).version}`,
1638
+ "data-tres": `tresjs ${J(An).version}`,
1636
1639
  style: Lt({
1637
1640
  display: "block",
1638
1641
  width: "100%",
@@ -1644,19 +1647,19 @@ const kr = ["data-scene", "data-tres"], xr = /* @__PURE__ */ Be({
1644
1647
  touchAction: "none",
1645
1648
  ...m.$attrs.style
1646
1649
  })
1647
- }, null, 14, kr));
1650
+ }, null, 14, xr));
1648
1651
  }
1649
- }), Lr = [
1652
+ }), Rr = [
1650
1653
  "TresCanvas",
1651
1654
  "TresLeches",
1652
1655
  "TresScene"
1653
- ], Rr = {
1656
+ ], Or = {
1654
1657
  template: {
1655
1658
  compilerOptions: {
1656
- isCustomElement: (e) => e.startsWith("Tres") && !Lr.includes(e) || e === "primitive"
1659
+ isCustomElement: (e) => e.startsWith("Tres") && !Rr.includes(e) || e === "primitive"
1657
1660
  }
1658
1661
  }
1659
- }, qr = Rr, Jr = {
1662
+ }, Jr = Or, Kr = {
1660
1663
  mounted: (e, t) => {
1661
1664
  if (t.arg) {
1662
1665
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1688,45 +1691,45 @@ class wt extends zt {
1688
1691
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1689
1692
  }
1690
1693
  }
1691
- const { logWarning: Ze } = z();
1692
- let ae, F;
1693
- const Or = {
1694
+ const { logWarning: Ze } = Y();
1695
+ let le, W;
1696
+ const Dr = {
1694
1697
  DirectionalLight: qt,
1695
1698
  PointLight: Jt,
1696
1699
  SpotLight: Kt,
1697
1700
  HemisphereLight: Qt,
1698
1701
  RectAreaLight: wt
1699
- }, Kr = {
1702
+ }, Qr = {
1700
1703
  mounted: (e) => {
1701
1704
  if (!e.isLight) {
1702
1705
  Ze(`${e.type} is not a light`);
1703
1706
  return;
1704
1707
  }
1705
- ae = Or[e.type], e.parent.add(new ae(e, 1, e.color.getHex()));
1708
+ le = Dr[e.type], e.parent.add(new le(e, 1, e.color.getHex()));
1706
1709
  },
1707
1710
  updated: (e) => {
1708
- F = e.parent.children.find((t) => t instanceof ae), !(F instanceof wt) && F.update();
1711
+ W = e.parent.children.find((t) => t instanceof le), !(W instanceof wt) && W.update();
1709
1712
  },
1710
1713
  unmounted: (e) => {
1711
1714
  if (!e.isLight) {
1712
1715
  Ze(`${e.type} is not a light`);
1713
1716
  return;
1714
1717
  }
1715
- F = e.parent.children.find((t) => t instanceof ae), F && F.dispose && F.dispose(), e.parent.remove(F);
1718
+ W = e.parent.children.find((t) => t instanceof le), W && W.dispose && W.dispose(), e.parent.remove(W);
1716
1719
  }
1717
- }, { logWarning: Dr } = z();
1718
- let B = null;
1719
- const Qr = {
1720
+ }, { logWarning: jr } = Y();
1721
+ let I = null;
1722
+ const Xr = {
1720
1723
  updated: (e, t) => {
1721
1724
  var s;
1722
- const n = Qn(t);
1725
+ const n = Xn(t);
1723
1726
  if (!n) {
1724
- Dr(`v-distance-to: problem with binding value: ${t.value}`);
1727
+ jr(`v-distance-to: problem with binding value: ${t.value}`);
1725
1728
  return;
1726
1729
  }
1727
- B && (B.dispose(), e.parent.remove(B));
1730
+ I && (I.dispose(), e.parent.remove(I));
1728
1731
  const r = n.clone().sub(e.position);
1729
- r.normalize(), B = new Xt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
1732
+ r.normalize(), I = new Xt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(I), console.table(
1730
1733
  [
1731
1734
  ["Distance:", e.position.distanceTo(n)],
1732
1735
  [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
@@ -1735,40 +1738,40 @@ const Qr = {
1735
1738
  );
1736
1739
  },
1737
1740
  unmounted: (e) => {
1738
- B == null || B.dispose(), e.parent.remove(B);
1741
+ I == null || I.dispose(), e.parent.remove(I);
1739
1742
  }
1740
- }, Xr = {
1743
+ }, Zr = {
1741
1744
  install(e) {
1742
- e.component("TresCanvas", xr);
1745
+ e.component("TresCanvas", Lr);
1743
1746
  }
1744
1747
  };
1745
1748
  export {
1746
- xr as TresCanvas,
1749
+ Lr as TresCanvas,
1747
1750
  Me as catalogue,
1748
- dr as createRenderLoop,
1749
- Xr as default,
1751
+ pr as createRenderLoop,
1752
+ Zr as default,
1750
1753
  dt as dispose,
1751
1754
  Ce as extend,
1752
- Ur as isProd,
1753
- $n as normalizeColor,
1754
- Fr as normalizeVectorFlexibleParam,
1755
- Gr as onTresReady,
1756
- qr as templateCompilerOptions,
1757
- ar as trasverseObjects,
1758
- jn as useCamera,
1759
- Wr as useLoader,
1760
- z as useLogger,
1761
- Yr as useLoop,
1762
- lr as useRaycaster,
1763
- $r as useRenderLoop,
1764
- sr as useRenderer,
1765
- zr as useSeek,
1766
- Nr as useTexture,
1767
- Vr as useTres,
1755
+ Fr as isProd,
1756
+ Un as normalizeColor,
1757
+ Wr as normalizeVectorFlexibleParam,
1758
+ Vr as onTresReady,
1759
+ Jr as templateCompilerOptions,
1760
+ lr as trasverseObjects,
1761
+ Bn as useCamera,
1762
+ Nr as useLoader,
1763
+ Y as useLogger,
1764
+ qr as useLoop,
1765
+ cr as useRaycaster,
1766
+ Ur as useRenderLoop,
1767
+ ir as useRenderer,
1768
+ Gr as useSeek,
1769
+ zr as useTexture,
1770
+ Yr as useTres,
1768
1771
  pe as useTresContext,
1769
- mr as useTresContextProvider,
1770
- ur as useTresEventManager,
1771
- Qr as vDistanceTo,
1772
- Kr as vLightHelper,
1773
- Jr as vLog
1772
+ hr as useTresContextProvider,
1773
+ fr as useTresEventManager,
1774
+ Xr as vDistanceTo,
1775
+ Qr as vLightHelper,
1776
+ Kr as vLog
1774
1777
  };