@tresjs/core 4.2.5 → 4.2.6

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.5
3
+ * version: v4.2.6
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 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";
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 Ct, isRef as Mt, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as xt, normalizeClass as kt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
12
12
  import * as et from "three";
13
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.5", 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.6", 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",
@@ -40,9 +40,9 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
40
40
  }, _n = "./dist/tres.js", wn = "./dist/tres.js", bn = "./dist/index.d.ts", Pn = [
41
41
  "*.d.ts",
42
42
  "dist"
43
- ], Mn = {
43
+ ], Cn = {
44
44
  access: "public"
45
- }, Cn = {
45
+ }, Mn = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -122,8 +122,8 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.5", dn = "pnpm@9.1.4", pn =
122
122
  module: wn,
123
123
  types: bn,
124
124
  files: Pn,
125
- publishConfig: Mn,
126
- scripts: Cn,
125
+ publishConfig: Cn,
126
+ scripts: Mn,
127
127
  peerDependencies: En,
128
128
  dependencies: Tn,
129
129
  devDependencies: Sn
@@ -134,7 +134,7 @@ function be(e) {
134
134
  function de(e) {
135
135
  return Array.isArray(e);
136
136
  }
137
- function kn(e) {
137
+ function xn(e) {
138
138
  return typeof e == "number";
139
139
  }
140
140
  function at(e) {
@@ -152,7 +152,7 @@ function N(e) {
152
152
  function We(e) {
153
153
  return U(e) && "isCamera" in e && !!e.isCamera;
154
154
  }
155
- function xn(e) {
155
+ function kn(e) {
156
156
  return U(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
157
157
  }
158
158
  function Ln(e) {
@@ -168,7 +168,7 @@ function Dn(e) {
168
168
  return U(e) && "isScene" in e && !!e.isScene;
169
169
  }
170
170
  function oe(e) {
171
- return N(e) || xn(e) || Ln(e) || On(e);
171
+ return N(e) || kn(e) || Ln(e) || On(e);
172
172
  }
173
173
  function jn(e) {
174
174
  return U(e) && !!e.isPrimitive;
@@ -177,22 +177,22 @@ const Bn = ({ sizes: e }) => {
177
177
  const t = H([]), n = V(
178
178
  () => t.value[0]
179
179
  ), r = (i) => {
180
- const l = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
181
- if (!l)
180
+ const a = i instanceof Dt ? i : t.value.find((o) => o.uuid === i);
181
+ if (!a)
182
182
  return;
183
- const c = t.value.filter(({ uuid: o }) => o !== l.uuid);
184
- t.value = [l, ...c];
185
- }, s = (i, l = !1) => {
183
+ const c = t.value.filter(({ uuid: o }) => o !== a.uuid);
184
+ t.value = [a, ...c];
185
+ }, s = (i, a = !1) => {
186
186
  if (We(i)) {
187
187
  const c = i;
188
188
  if (t.value.some(({ uuid: o }) => o === c.uuid))
189
189
  return;
190
- l ? r(c) : t.value.push(c);
190
+ a ? r(c) : t.value.push(c);
191
191
  }
192
- }, a = (i) => {
192
+ }, l = (i) => {
193
193
  if (We(i)) {
194
- const l = i;
195
- t.value = t.value.filter(({ uuid: c }) => c !== l.uuid);
194
+ const a = i;
195
+ t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
196
196
  }
197
197
  };
198
198
  return Te(() => {
@@ -205,7 +205,7 @@ const Bn = ({ sizes: e }) => {
205
205
  camera: n,
206
206
  cameras: t,
207
207
  registerCamera: s,
208
- deregisterCamera: a,
208
+ deregisterCamera: l,
209
209
  setCameraActive: r
210
210
  };
211
211
  };
@@ -293,12 +293,12 @@ const Ve = (e, t) => {
293
293
  return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
294
294
  }, Yn = (e, t, n) => {
295
295
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
296
- r && r.reduce((s, a, i) => (s[a] === void 0 && (s[a] = {}), i === r.length - 1 && (s[a] = n), s[a]), e);
296
+ r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
297
297
  };
298
298
  function ft(e, t) {
299
299
  if (Ge(e) && Ge(t)) {
300
- const s = e.attributes, a = t.attributes;
301
- return s.length !== a.length ? !1 : Array.from(s).every(({ name: i, value: l }) => t.getAttribute(i) === l);
300
+ const s = e.attributes, l = t.attributes;
301
+ return s.length !== l.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
302
302
  }
303
303
  if (e === t)
304
304
  return !0;
@@ -330,12 +330,12 @@ function Kn(e, t, n, r) {
330
330
  if (u)
331
331
  return u;
332
332
  }
333
- }, a = s(e);
334
- if (!a) {
333
+ }, l = s(e);
334
+ if (!l) {
335
335
  console.warn("Object with UUID not found in the scene.");
336
336
  return;
337
337
  }
338
- let i = a;
338
+ let i = l;
339
339
  for (let c = 0; c < n.length - 1; c++)
340
340
  if (i[n[c]] !== void 0)
341
341
  i = i[n[c]];
@@ -343,8 +343,8 @@ function Kn(e, t, n, r) {
343
343
  console.warn(`Property path is not valid: ${n.join(".")}`);
344
344
  return;
345
345
  }
346
- const l = n[n.length - 1];
347
- i[l] !== void 0 ? i[l] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
346
+ const a = n[n.length - 1];
347
+ i[a] !== void 0 ? i[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
348
348
  }
349
349
  function Qn(e) {
350
350
  const t = new ot({
@@ -374,7 +374,7 @@ function dt(e) {
374
374
  var n, r;
375
375
  if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => dt(s)), !(e instanceof nt)) {
376
376
  const s = e;
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);
377
+ e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((l) => Ye(l)), delete s.material) : s.material && (Ye(s.material), delete s.material);
378
378
  }
379
379
  }
380
380
  function er(e, t) {
@@ -401,12 +401,12 @@ const Je = /-\d+$/;
401
401
  function tr(e, t, n) {
402
402
  if (at(n)) {
403
403
  if (Je.test(n)) {
404
- const a = n.replace(Je, ""), { target: i, key: l } = Pe(e, a);
405
- if (!Array.isArray(i[l])) {
406
- const c = i[l], o = [];
404
+ const l = n.replace(Je, ""), { target: i, key: a } = Pe(e, l);
405
+ if (!Array.isArray(i[a])) {
406
+ const c = i[a], o = [];
407
407
  o.__tresDetach = () => {
408
- o.every((u) => be(u)) && (i[l] = c);
409
- }, i[l] = o;
408
+ o.every((u) => be(u)) && (i[a] = c);
409
+ }, i[a] = o;
410
410
  }
411
411
  }
412
412
  const { target: r, key: s } = Pe(e, n);
@@ -415,13 +415,13 @@ function tr(e, t, n) {
415
415
  t.__tres.previousAttach = n(e, t);
416
416
  }
417
417
  function nr(e, t, n) {
418
- var r, s, a;
418
+ var r, s, l;
419
419
  if (at(n)) {
420
- const { target: i, key: l } = Pe(e, n), c = t.__tres.previousAttach;
421
- c === void 0 ? delete i[l] : i[l] = c, "__tresDetach" in i && i.__tresDetach();
420
+ const { target: i, key: a } = Pe(e, n), c = t.__tres.previousAttach;
421
+ c === void 0 ? delete i[a] : i[a] = c, "__tresDetach" in i && i.__tresDetach();
422
422
  } else
423
423
  (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
424
- (a = t.__tres) == null || delete a.previousAttach;
424
+ (l = t.__tres) == null || delete l.previousAttach;
425
425
  }
426
426
  function z(e, t, n) {
427
427
  const r = e;
@@ -448,24 +448,24 @@ function rr(e, t, n) {
448
448
  return;
449
449
  let r = 0;
450
450
  if (de(n) && n.length >= 2) {
451
- const [a, i] = n;
452
- r = rt.clamp(t, a, i);
453
- } else kn(n) ? r = n : r = t;
451
+ const [l, i] = n;
452
+ r = rt.clamp(t, l, i);
453
+ } else xn(n) ? r = n : r = t;
454
454
  r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
455
455
  }
456
456
  function or(e, t, n, r, s) {
457
- const a = [...t.__tres.objects], i = Q(t);
457
+ const l = [...t.__tres.objects], i = Q(t);
458
458
  if (e = Q(e), i === e)
459
459
  return !0;
460
- const l = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
460
+ const a = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
461
461
  delete o.object;
462
- for (const u of a)
462
+ for (const u of l)
463
463
  mt(u, s), ht(u, s);
464
464
  i.__tres.objects = [], r.remove(t);
465
- for (const [u, y] of Object.entries(o))
466
- r.patchProp(l, u, l[u], y);
465
+ for (const [u, v] of Object.entries(o))
466
+ r.patchProp(a, u, a[u], v);
467
467
  n(e), r.insert(t, c);
468
- for (const u of a)
468
+ for (const u of l)
469
469
  r.insert(u, t);
470
470
  return !0;
471
471
  }
@@ -473,9 +473,9 @@ function Q(e) {
473
473
  return jn(e) ? (e.object.__tres = e.__tres, e.object) : e;
474
474
  }
475
475
  function mt(e, t) {
476
- var r, s, a, i;
476
+ var r, s, l, i;
477
477
  const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
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);
478
+ e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && er(n.__tres.objects, (a) => a !== e), (s = e.__tres) != null && s.attach ? nr(n, e, e.__tres.attach) : ((i = (l = e.parent) == null ? void 0 : l.remove) == null || i.call(l, Q(e)), e.parent = null);
479
479
  }
480
480
  function ht(e, t) {
481
481
  var n;
@@ -504,7 +504,7 @@ const sr = Number.parseInt(Bt.replace("dev", "")), ae = {
504
504
  function ir({
505
505
  canvas: e,
506
506
  options: t,
507
- contextParts: { sizes: n, render: r, invalidate: s, advance: a }
507
+ contextParts: { sizes: n, render: r, invalidate: s, advance: l }
508
508
  }) {
509
509
  const i = V(() => ({
510
510
  alpha: k(t.alpha) ?? !0,
@@ -519,54 +519,54 @@ function ir({
519
519
  preserveDrawingBuffer: k(t.preserveDrawingBuffer),
520
520
  logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
521
521
  failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
522
- })), l = $(new he(i.value));
522
+ })), a = $(new he(i.value));
523
523
  function c() {
524
524
  t.renderMode === "on-demand" && s();
525
525
  }
526
526
  ce(i, () => {
527
- l.value.dispose(), l.value = new he(i.value), c();
527
+ a.value.dispose(), a.value = new he(i.value), c();
528
528
  }), ce([n.width, n.height], () => {
529
- l.value.setSize(n.width.value, n.height.value), c();
529
+ a.value.setSize(n.width.value, n.height.value), c();
530
530
  }, {
531
531
  immediate: !0
532
532
  }), ce(() => t.clearColor, c);
533
533
  const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
534
- const v = new he(), b = {
534
+ const g = new he(), b = {
535
535
  shadowMap: {
536
- enabled: v.shadowMap.enabled,
537
- type: v.shadowMap.type
536
+ enabled: g.shadowMap.enabled,
537
+ type: g.shadowMap.type
538
538
  },
539
- toneMapping: v.toneMapping,
540
- toneMappingExposure: v.toneMappingExposure,
541
- outputColorSpace: v.outputColorSpace
539
+ toneMapping: g.toneMapping,
540
+ toneMappingExposure: g.toneMappingExposure,
541
+ outputColorSpace: g.outputColorSpace
542
542
  };
543
- return v.dispose(), b;
544
- })(), g = k(t.renderMode);
545
- return g === "on-demand" && s(), g === "manual" && setTimeout(() => {
546
- a();
543
+ return g.dispose(), b;
544
+ })(), h = k(t.renderMode);
545
+ return h === "on-demand" && s(), h === "manual" && setTimeout(() => {
546
+ l();
547
547
  }, 100), Te(() => {
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);
548
+ const g = k(t.preset);
549
+ g && (g in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(a.value, ae[g])), rr(a.value, o.value, k(t.dpr)), h === "always" && (r.frames.value = Math.max(1, r.frames.value));
550
+ const b = (C, M) => {
551
+ const P = k(C), E = () => {
552
+ if (g)
553
+ return Ve(ae[g], M);
554
554
  };
555
555
  if (P !== void 0)
556
556
  return P;
557
- const M = S();
558
- return M !== void 0 ? M : Ve(f, E);
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");
557
+ const S = E();
558
+ return S !== void 0 ? S : Ve(f, M);
559
+ }, y = (C, M) => Yn(a.value, M, b(C, M));
560
+ y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? st, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), sr < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
561
561
  const d = b(t.clearColor, "clearColor");
562
- d && l.value.setClearColor(
562
+ d && a.value.setClearColor(
563
563
  d ? Un(d) : new Z(0)
564
564
  // default clear color is not easily/efficiently retrievable from three
565
565
  );
566
566
  }), K(() => {
567
- l.value.dispose(), l.value.forceContextLoss();
567
+ a.value.dispose(), a.value.forceContextLoss();
568
568
  }), {
569
- renderer: l
569
+ renderer: a
570
570
  };
571
571
  }
572
572
  const ar = (e) => !!e && e.constructor === Array;
@@ -577,28 +577,28 @@ function lr(e) {
577
577
  }), t;
578
578
  }
579
579
  async function Nr(e, t, n, r, s) {
580
- const { logError: a } = Y(), i = new e();
580
+ const { logError: l } = Y(), i = new e();
581
581
  s && s(i), n && n(i);
582
582
  const c = (Array.isArray(t) ? t : [t]).map(
583
- (o) => new Promise((u, y) => {
583
+ (o) => new Promise((u, v) => {
584
584
  i.load(
585
585
  o,
586
586
  (f) => {
587
- const g = f;
588
- g.scene && Object.assign(g, lr(g.scene)), u(g);
587
+ const h = f;
588
+ h.scene && Object.assign(h, lr(h.scene)), u(h);
589
589
  },
590
590
  r,
591
- (f) => y(a("[useLoader] - Failed to load resource", f))
591
+ (f) => v(l("[useLoader] - Failed to load resource", f))
592
592
  );
593
593
  })
594
594
  );
595
595
  return ar(t) ? await Promise.all(c) : await c[0];
596
596
  }
597
597
  async function zr(e, t) {
598
- const n = new Ut(t), r = (s) => new Promise((a, i) => {
598
+ const n = new Ut(t), r = (s) => new Promise((l, i) => {
599
599
  n.load(
600
600
  s,
601
- (l) => a(l),
601
+ (a) => l(a),
602
602
  () => null,
603
603
  () => {
604
604
  i(new Error("[useTextures] - Failed to load texture"));
@@ -606,60 +606,60 @@ async function zr(e, t) {
606
606
  );
607
607
  });
608
608
  if (Jn(e)) {
609
- const s = await Promise.all(e.map((a) => r(a)));
609
+ const s = await Promise.all(e.map((l) => r(l)));
610
610
  return e.length > 1 ? s : s[0];
611
611
  } else {
612
612
  const {
613
613
  map: s,
614
- displacementMap: a,
614
+ displacementMap: l,
615
615
  normalMap: i,
616
- roughnessMap: l,
616
+ roughnessMap: a,
617
617
  metalnessMap: c,
618
618
  aoMap: o,
619
619
  alphaMap: u,
620
- matcap: y
620
+ matcap: v
621
621
  } = e;
622
622
  return {
623
623
  map: s ? await r(s) : null,
624
- displacementMap: a ? await r(a) : null,
624
+ displacementMap: l ? await r(l) : null,
625
625
  normalMap: i ? await r(i) : null,
626
- roughnessMap: l ? await r(l) : null,
626
+ roughnessMap: a ? await r(a) : null,
627
627
  metalnessMap: c ? await r(c) : null,
628
628
  aoMap: o ? await r(o) : null,
629
629
  alphaMap: u ? await r(u) : null,
630
- matcap: y ? await r(y) : null
630
+ matcap: v ? await r(v) : null
631
631
  };
632
632
  }
633
633
  }
634
634
  const cr = (e, t) => {
635
- const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: a } = tn({ target: n });
635
+ const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = tn({ target: n });
636
636
  let i = 0;
637
- const { width: l, height: c, top: o, left: u } = nn(n), y = ({ x: h, y: T }) => {
637
+ const { width: a, height: c, top: o, left: u } = nn(n), v = ({ x: m, y: T }) => {
638
638
  if (n.value)
639
639
  return {
640
- x: (h - u.value) / l.value * 2 - 1,
640
+ x: (m - u.value) / a.value * 2 - 1,
641
641
  y: -((T - o.value) / c.value) * 2 + 1
642
642
  };
643
- }, f = ({ x: h, y: T }) => {
643
+ }, f = ({ x: m, y: T }) => {
644
644
  if (t.camera.value)
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({
648
- x: (h == null ? void 0 : h.clientX) ?? s.value,
649
- y: (h == null ? void 0 : h.clientY) ?? a.value
645
+ return t.raycaster.value.setFromCamera(new ge(m, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
646
+ }, h = (m) => {
647
+ const T = v({
648
+ x: (m == null ? void 0 : m.clientX) ?? s.value,
649
+ y: (m == null ? void 0 : m.clientY) ?? l.value
650
650
  });
651
651
  return T ? f(T) || [] : [];
652
- }, v = j(), b = j(), m = j(), d = j(), C = j(), E = j(), P = j(), S = j();
653
- function M(h) {
652
+ }, g = j(), b = j(), y = j(), d = j(), C = j(), M = j(), P = j(), E = j();
653
+ function S(m) {
654
654
  const T = {};
655
- for (const F in h)
656
- typeof F != "function" && (T[F] = h[F]);
655
+ for (const F in m)
656
+ typeof F != "function" && (T[F] = m[F]);
657
657
  return T;
658
658
  }
659
- const _ = (h, T) => {
659
+ const _ = (m, T) => {
660
660
  var Oe, De, je;
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);
662
- h.trigger({
661
+ const F = S(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);
662
+ m.trigger({
663
663
  ...F,
664
664
  intersections: r.value,
665
665
  // The unprojectedPoint is wrong, math needs to be fixed
@@ -671,64 +671,64 @@ const cr = (e, t) => {
671
671
  stopPropagating: !1
672
672
  });
673
673
  };
674
- let L;
675
- const x = (h) => {
676
- g(h), _(m, h), L = h;
674
+ let A;
675
+ const L = (m) => {
676
+ h(m), _(y, m), A = m;
677
677
  }, p = () => {
678
- L && x(L);
678
+ A && L(A);
679
679
  };
680
- let w, A, D;
681
- const O = (h) => {
680
+ let w, x, D;
681
+ const O = (m) => {
682
682
  var T;
683
- w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, A = new ge(
684
- (h == null ? void 0 : h.clientX) ?? s.value,
685
- (h == null ? void 0 : h.clientY) ?? a.value
686
- ), _(C, h);
683
+ w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, x = new ge(
684
+ (m == null ? void 0 : m.clientX) ?? s.value,
685
+ (m == null ? void 0 : m.clientY) ?? l.value
686
+ ), _(C, m);
687
687
  };
688
688
  let B, R = !1;
689
- const ne = (h) => {
689
+ const ne = (m) => {
690
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(
692
- (h == null ? void 0 : h.clientX) ?? s.value,
693
- (h == null ? void 0 : h.clientY) ?? a.value
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));
695
- }, xe = (h) => {
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));
691
+ m instanceof PointerEvent && (r.value.length === 0 && _(M, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
692
+ (m == null ? void 0 : m.clientX) ?? s.value,
693
+ (m == null ? void 0 : m.clientY) ?? l.value
694
+ ), i = x == null ? void 0 : x.distanceTo(D), m.button === 0 ? (_(g, m), B === ((F = r.value[0]) == null ? void 0 : F.object) ? R = !0 : (B = (re = r.value[0]) == null ? void 0 : re.object, R = !1)) : m.button === 2 && _(P, m)), _(d, m));
695
+ }, ke = (m) => {
696
+ R && (_(b, m), B = void 0, R = !1);
697
+ }, Le = (m) => _(y, m), Re = (m) => _(E, m);
698
+ return n.value.addEventListener("pointerup", ne), n.value.addEventListener("pointerdown", O), n.value.addEventListener("pointermove", L), n.value.addEventListener("pointerleave", Le), n.value.addEventListener("dblclick", ke), 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", L), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", ke), n.value.removeEventListener("wheel", Re));
700
700
  }), {
701
701
  intersects: r,
702
- onClick: (h) => v.on(h).off,
703
- onDblClick: (h) => b.on(h).off,
704
- onContextMenu: (h) => P.on(h).off,
705
- onPointerMove: (h) => m.on(h).off,
706
- onPointerUp: (h) => d.on(h).off,
707
- onPointerDown: (h) => C.on(h).off,
708
- onPointerMissed: (h) => E.on(h).off,
709
- onWheel: (h) => S.on(h).off,
702
+ onClick: (m) => g.on(m).off,
703
+ onDblClick: (m) => b.on(m).off,
704
+ onContextMenu: (m) => P.on(m).off,
705
+ onPointerMove: (m) => y.on(m).off,
706
+ onPointerUp: (m) => d.on(m).off,
707
+ onPointerDown: (m) => C.on(m).off,
708
+ onPointerMissed: (m) => M.on(m).off,
709
+ onWheel: (m) => E.on(m).off,
710
710
  forceUpdate: p
711
711
  };
712
712
  };
713
713
  function Gr() {
714
714
  const { logWarning: e } = Y();
715
- function t(a, i, l) {
715
+ function t(l, i, a) {
716
716
  let c = null;
717
- return a.traverse((o) => {
718
- o[i] === l && (c = o);
719
- }), c || e(`Child with ${i} '${l}' not found.`), c;
717
+ return l.traverse((o) => {
718
+ o[i] === a && (c = o);
719
+ }), c || e(`Child with ${i} '${a}' not found.`), c;
720
720
  }
721
- function n(a, i, l) {
721
+ function n(l, i, a) {
722
722
  const c = [];
723
- return a.traverse((o) => {
724
- o[i].includes(l) && c.push(o);
725
- }), c.length || e(`Children with ${i} '${l}' not found.`), c;
723
+ return l.traverse((o) => {
724
+ o[i].includes(a) && c.push(o);
725
+ }), c.length || e(`Children with ${i} '${a}' not found.`), c;
726
726
  }
727
- function r(a, i) {
728
- return t(a, "name", i);
727
+ function r(l, i) {
728
+ return t(l, "name", i);
729
729
  }
730
- function s(a, i) {
731
- return n(a, "name", i);
730
+ function s(l, i) {
731
+ return n(l, "name", i);
732
732
  }
733
733
  return {
734
734
  seek: t,
@@ -737,11 +737,11 @@ function Gr() {
737
737
  seekAllByName: s
738
738
  };
739
739
  }
740
- function ke(e) {
740
+ function xe(e) {
741
741
  let t = 0;
742
742
  return e.traverse((n) => {
743
743
  if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
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;
744
+ const r = n.geometry, s = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = r.attributes.normal ? r.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = r.attributes.uv ? r.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, c = s + l + i + a;
745
745
  t += c;
746
746
  }
747
747
  }), t;
@@ -749,81 +749,81 @@ function ke(e) {
749
749
  function ur(e) {
750
750
  return (e / 1024).toFixed(2);
751
751
  }
752
- const Me = H({}), Ce = (e) => Object.assign(Me.value, e);
752
+ const Ce = H({}), Me = (e) => Object.assign(Ce.value, e);
753
753
  function fr(e, t, n) {
754
- var x;
754
+ var L;
755
755
  const r = $(), s = $();
756
756
  e && (r.value = e), t && (s.value = t);
757
- const a = (p) => {
757
+ const l = (p) => {
758
758
  var w;
759
759
  return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
760
760
  }, i = (p) => {
761
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) || []);
762
+ return ((w = p.children) == null ? void 0 : w.some((x) => i(x))) || l(p);
763
+ }, a = $(((L = r.value) == null ? void 0 : L.children).filter(i) || []);
764
764
  function c(p, w) {
765
765
  if (Array.isArray(p))
766
- for (const A of p)
767
- A(w);
766
+ for (const x of p)
767
+ x(w);
768
768
  typeof p == "function" && p(w);
769
769
  }
770
770
  function o(p, w) {
771
- const A = [], D = () => w.stopPropagating = !0;
771
+ const x = [], D = () => w.stopPropagating = !0;
772
772
  w.stopPropagation = D;
773
773
  for (const O of w == null ? void 0 : w.intersections) {
774
774
  if (w.stopPropagating)
775
775
  return;
776
776
  w = { ...w, ...O };
777
777
  const { object: B } = O;
778
- w.eventObject = B, c(B[p], w), A.push(B);
778
+ w.eventObject = B, c(B[p], w), x.push(B);
779
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;
780
+ for (; R !== null && !w.stopPropagating && !x.includes(R); )
781
+ w.eventObject = R, c(R[p], w), x.push(R), R = R.parent;
782
782
  const ne = Gn(p.slice(2));
783
783
  n(ne, { intersection: O, event: w });
784
784
  }
785
785
  }
786
786
  const {
787
787
  onClick: u,
788
- onDblClick: y,
788
+ onDblClick: v,
789
789
  onContextMenu: f,
790
- onPointerMove: g,
791
- onPointerDown: v,
790
+ onPointerMove: h,
791
+ onPointerDown: g,
792
792
  onPointerUp: b,
793
- onPointerMissed: m,
793
+ onPointerMissed: y,
794
794
  onWheel: d,
795
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));
798
- let E = [];
799
- g((p) => {
800
- const w = p.intersections.map(({ object: D }) => D), A = p.intersections;
801
- E.forEach(({ object: D }) => {
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;
796
+ } = cr(a, t);
797
+ b((p) => o("onPointerUp", p)), g((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), v((p) => o("onDoubleClick", p)), f((p) => o("onContextMenu", p)), d((p) => o("onWheel", p));
798
+ let M = [];
799
+ h((p) => {
800
+ const w = p.intersections.map(({ object: D }) => D), x = p.intersections;
801
+ M.forEach(({ object: D }) => {
802
+ w.includes(D) || (p.intersections = M, o("onPointerLeave", p), o("onPointerOut", p));
803
+ }), p.intersections = x, p.intersections.forEach(({ object: D }) => {
804
+ M.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
805
+ }), o("onPointerMove", p), M = p.intersections;
806
806
  });
807
807
  const P = [];
808
- m((p) => {
808
+ y((p) => {
809
809
  const w = () => p.stopPropagating = !0;
810
- p.stopPropagation = w, P.forEach((A) => {
811
- p.stopPropagating || (p.eventObject = A, c(A.onPointerMissed, p));
810
+ p.stopPropagation = w, P.forEach((x) => {
811
+ p.stopPropagating || (p.eventObject = x, c(x.onPointerMissed, p));
812
812
  }), n("pointer-missed", { event: p });
813
813
  });
814
- function S(p) {
815
- oe(p) && N(p) && l.value.push(p);
814
+ function E(p) {
815
+ oe(p) && N(p) && a.value.push(p);
816
816
  }
817
- function M(p) {
817
+ function S(p) {
818
818
  if (oe(p) && N(p)) {
819
- const w = l.value.indexOf(p);
820
- w > -1 && l.value.splice(w, 1);
819
+ const w = a.value.indexOf(p);
820
+ w > -1 && a.value.splice(w, 1);
821
821
  }
822
822
  }
823
823
  function _(p) {
824
824
  oe(p) && N(p) && p.onPointerMissed && P.push(p);
825
825
  }
826
- function L(p) {
826
+ function A(p) {
827
827
  if (oe(p) && N(p)) {
828
828
  const w = P.indexOf(p);
829
829
  w > -1 && P.splice(w, 1);
@@ -831,22 +831,22 @@ function fr(e, t, n) {
831
831
  }
832
832
  return t.eventManager = {
833
833
  forceUpdate: C,
834
- registerObject: S,
835
- deregisterObject: M,
834
+ registerObject: E,
835
+ deregisterObject: S,
836
836
  registerPointerMissedObject: _,
837
- deregisterPointerMissedObject: L
837
+ deregisterPointerMissedObject: A
838
838
  }, {
839
839
  forceUpdate: C,
840
- registerObject: S,
841
- deregisterObject: M,
840
+ registerObject: E,
841
+ deregisterObject: S,
842
842
  registerPointerMissedObject: _,
843
- deregisterPointerMissedObject: L
843
+ deregisterPointerMissedObject: A
844
844
  };
845
845
  }
846
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);
847
+ const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)), l = ye(Fe(r.height, n)), i = V(() => s.value / l.value);
848
848
  return {
849
- height: a,
849
+ height: l,
850
850
  width: s,
851
851
  aspectRatio: i
852
852
  };
@@ -855,21 +855,21 @@ function ve() {
855
855
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
856
856
  let n = 0, r = !1;
857
857
  const s = () => {
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
+ const o = Array.from(e.entries()).sort((u, v) => {
859
+ const f = u[1].priority - v[1].priority;
860
+ return f === 0 ? u[1].addI - v[1].addI : f;
861
861
  });
862
862
  t.clear(), o.forEach((u) => t.add(u[0]));
863
- }, a = (o) => {
863
+ }, l = (o) => {
864
864
  e.delete(o), t.delete(o);
865
865
  };
866
866
  return { on: (o, u = 0) => {
867
867
  e.set(o, { priority: u, addI: n++ });
868
- const y = () => a(o);
869
- return sn(y), r = !0, {
870
- off: y
868
+ const v = () => l(o);
869
+ return sn(v), r = !0, {
870
+ off: v
871
871
  };
872
- }, off: a, trigger: (...o) => {
872
+ }, off: l, trigger: (...o) => {
873
873
  r && (s(), r = !1), t.forEach((u) => u(...o));
874
874
  }, dispose: () => {
875
875
  e.clear(), t.clear();
@@ -879,50 +879,50 @@ function ve() {
879
879
  }
880
880
  function pr() {
881
881
  let e = !0, t = !0, n = !1;
882
- const r = new tt(!1), s = H(r.running), a = H(!1);
882
+ const r = new tt(!1), s = H(r.running), l = H(!1);
883
883
  let i;
884
- const l = rt.generateUUID();
884
+ const a = rt.generateUUID();
885
885
  let c = null;
886
- const o = ve(), u = ve(), y = ve();
887
- M();
886
+ const o = ve(), u = ve(), v = ve();
887
+ S();
888
888
  let f = {};
889
- function g(_) {
889
+ function h(_) {
890
890
  f = _;
891
891
  }
892
- function v(_, L, x = 0) {
893
- switch (L) {
892
+ function g(_, A, L = 0) {
893
+ switch (A) {
894
894
  case "before":
895
- return o.on(_, x);
895
+ return o.on(_, L);
896
896
  case "render":
897
897
  return c || (c = _), u.dispose(), u.on(_);
898
898
  case "after":
899
- return y.on(_, x);
899
+ return v.on(_, L);
900
900
  }
901
901
  }
902
902
  function b() {
903
- t && (t = !1, M(), S());
903
+ t && (t = !1, S(), E());
904
904
  }
905
- function m() {
906
- t = !0, M(), cancelAnimationFrame(i);
905
+ function y() {
906
+ t = !0, S(), cancelAnimationFrame(i);
907
907
  }
908
908
  function d() {
909
- n = !1, M();
909
+ n = !1, S();
910
910
  }
911
911
  function C() {
912
- n = !0, M();
912
+ n = !0, S();
913
913
  }
914
- function E() {
915
- a.value = !0;
914
+ function M() {
915
+ l.value = !0;
916
916
  }
917
917
  function P() {
918
- a.value = !1;
918
+ l.value = !1;
919
919
  }
920
- function S() {
920
+ function E() {
921
921
  if (!e) {
922
- i = requestAnimationFrame(S);
922
+ i = requestAnimationFrame(E);
923
923
  return;
924
924
  }
925
- const _ = r.getDelta(), L = r.getElapsedTime(), x = {
925
+ const _ = r.getDelta(), A = r.getElapsedTime(), L = {
926
926
  camera: J(f.camera),
927
927
  scene: J(f.scene),
928
928
  renderer: J(f.renderer),
@@ -930,50 +930,50 @@ function pr() {
930
930
  controls: J(f.controls),
931
931
  invalidate: f.invalidate,
932
932
  advance: f.advance
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);
933
+ }, p = { delta: _, elapsed: A, clock: r, ...L };
934
+ s.value && o.trigger(p), l.value || (u.count ? u.trigger(p) : c && c(p)), s.value && v.trigger(p), i = requestAnimationFrame(E);
935
935
  }
936
- function M() {
936
+ function S() {
937
937
  const _ = !t && !n;
938
938
  r.running !== _ && (r.running ? r.stop() : r.start()), s.value = r.running;
939
939
  }
940
940
  return {
941
- loopId: l,
942
- register: (_, L, x) => v(_, L, x),
941
+ loopId: a,
942
+ register: (_, A, L) => g(_, A, L),
943
943
  start: b,
944
- stop: m,
944
+ stop: y,
945
945
  pause: C,
946
946
  resume: d,
947
- pauseRender: E,
947
+ pauseRender: M,
948
948
  resumeRender: P,
949
- isRenderPaused: a,
949
+ isRenderPaused: l,
950
950
  isActive: s,
951
- setContext: g,
951
+ setContext: h,
952
952
  setReady: (_) => e = _
953
953
  };
954
954
  }
955
955
  function mr(e, t, n = 100) {
956
956
  n = n <= 0 ? 100 : n;
957
957
  const r = j(), s = /* @__PURE__ */ new Set();
958
- let a = !1, i = !1, l = null;
958
+ let l = !1, i = !1, a = null;
959
959
  function c() {
960
- l && clearTimeout(l), !i && !a && e() ? (r.trigger(t), s.forEach((f) => f()), s.clear(), a = !0) : !i && !a && (l = setTimeout(c, n));
960
+ a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((f) => f()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
961
961
  }
962
962
  function o() {
963
- i = !0, l && clearTimeout(l);
963
+ i = !0, a && clearTimeout(a);
964
964
  }
965
965
  c();
966
- const u = (f, ...g) => {
967
- f(...g);
966
+ const u = (f, ...h) => {
967
+ f(...h);
968
968
  };
969
969
  return {
970
970
  on: (f) => {
971
- if (a)
971
+ if (l)
972
972
  return u(f, t), { off: () => {
973
973
  } };
974
974
  {
975
- const g = r.on(f);
976
- return s.add(g.off), r.on(f);
975
+ const h = r.on(f);
976
+ return s.add(h.off), r.on(f);
977
977
  }
978
978
  },
979
979
  off: r.off,
@@ -985,15 +985,15 @@ const te = /* @__PURE__ */ new WeakMap();
985
985
  function gt(e) {
986
986
  if (e = e || pe(), te.has(e))
987
987
  return te.get(e);
988
- const t = 100, n = Date.now(), a = mr(() => {
988
+ const t = 100, n = Date.now(), l = mr(() => {
989
989
  if (Date.now() - n >= t)
990
990
  return !0;
991
991
  {
992
- const i = e.renderer.value, l = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
993
- return !!(i && l.width > 0 && l.height > 0);
992
+ const i = e.renderer.value, a = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
993
+ return !!(i && a.width > 0 && a.height > 0);
994
994
  }
995
995
  }, e);
996
- return te.set(e, a), a;
996
+ return te.set(e, l), l;
997
997
  }
998
998
  function Vr(e) {
999
999
  const t = pe();
@@ -1006,43 +1006,43 @@ function hr({
1006
1006
  windowSize: n,
1007
1007
  disableRender: r,
1008
1008
  rendererOptions: s,
1009
- emit: a
1009
+ emit: l
1010
1010
  }) {
1011
- const i = $(e), l = dr(n, t), {
1011
+ const i = $(e), a = dr(n, t), {
1012
1012
  camera: c,
1013
1013
  cameras: o,
1014
1014
  registerCamera: u,
1015
- deregisterCamera: y,
1015
+ deregisterCamera: v,
1016
1016
  setCameraActive: f
1017
- } = Bn({ sizes: l, scene: e }), g = {
1017
+ } = Bn({ sizes: a, scene: e }), h = {
1018
1018
  mode: H(s.renderMode || "always"),
1019
1019
  priority: H(0),
1020
1020
  frames: H(0),
1021
1021
  maxFrames: 60,
1022
- canBeInvalidated: V(() => g.mode.value === "on-demand" && g.frames.value === 0)
1022
+ canBeInvalidated: V(() => h.mode.value === "on-demand" && h.frames.value === 0)
1023
1023
  };
1024
- function v(O = 1) {
1025
- s.renderMode === "on-demand" && (g.frames.value = Math.min(g.maxFrames, g.frames.value + O));
1024
+ function g(O = 1) {
1025
+ s.renderMode === "on-demand" && (h.frames.value = Math.min(h.maxFrames, h.frames.value + O));
1026
1026
  }
1027
1027
  function b() {
1028
- s.renderMode === "manual" && (g.frames.value = 1);
1028
+ s.renderMode === "manual" && (h.frames.value = 1);
1029
1029
  }
1030
- const { renderer: m } = ir(
1030
+ const { renderer: y } = ir(
1031
1031
  {
1032
1032
  scene: e,
1033
1033
  canvas: t,
1034
1034
  options: s,
1035
- emit: a,
1035
+ emit: l,
1036
1036
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
1037
- contextParts: { sizes: l, camera: c, render: g, invalidate: v, advance: b },
1037
+ contextParts: { sizes: a, camera: c, render: h, invalidate: g, advance: b },
1038
1038
  disableRender: r
1039
1039
  }
1040
1040
  ), d = {
1041
- sizes: l,
1041
+ sizes: a,
1042
1042
  scene: i,
1043
1043
  camera: c,
1044
1044
  cameras: ye(o),
1045
- renderer: m,
1045
+ renderer: y,
1046
1046
  raycaster: $(new Ft()),
1047
1047
  controls: H(null),
1048
1048
  perf: {
@@ -1057,41 +1057,41 @@ function hr({
1057
1057
  accumulator: []
1058
1058
  }
1059
1059
  },
1060
- render: g,
1060
+ render: h,
1061
1061
  advance: b,
1062
- extend: Ce,
1063
- invalidate: v,
1062
+ extend: Me,
1063
+ invalidate: g,
1064
1064
  registerCamera: u,
1065
1065
  setCameraActive: f,
1066
- deregisterCamera: y,
1066
+ deregisterCamera: v,
1067
1067
  loop: pr()
1068
1068
  };
1069
1069
  _e("useTres", d), d.scene.value.__tres = {
1070
1070
  root: d
1071
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);
1072
+ c.value && h.frames.value > 0 && (y.value.render(e, c.value), l("render", d.renderer.value)), h.priority.value = 0, h.mode.value === "always" ? h.frames.value = 1 : h.frames.value = Math.max(0, h.frames.value - 1);
1073
1073
  }, "render");
1074
- const { on: C, cancel: E } = gt(d);
1074
+ const { on: C, cancel: M } = gt(d);
1075
1075
  d.loop.setReady(!1), d.loop.start(), C(() => {
1076
- a("ready", d), d.loop.setReady(!0), fr(e, d, a);
1076
+ l("ready", d), d.loop.setReady(!0), fr(e, d, l);
1077
1077
  }), K(() => {
1078
- E(), d.loop.stop();
1078
+ M(), d.loop.stop();
1079
1079
  });
1080
- const P = 100, S = an({ every: P }), { isSupported: M, memory: _ } = ln({ interval: P }), L = 160;
1081
- let x = performance.now();
1080
+ const P = 100, E = an({ every: P }), { isSupported: S, memory: _ } = ln({ interval: P }), A = 160;
1081
+ let L = performance.now();
1082
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));
1083
+ d.scene.value && (d.perf.memory.allocatedMem = xe(d.scene.value)), O - L >= P && (L = O, d.perf.fps.accumulator.push(E.value), d.perf.fps.accumulator.length > A && d.perf.fps.accumulator.shift(), d.perf.fps.value = E.value, S.value && _.value && (d.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > A && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((B, R) => B + R, 0) / d.perf.memory.accumulator.length));
1084
1084
  };
1085
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));
1086
+ const x = 1, { pause: D } = it(({ delta: O }) => {
1087
+ window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
1088
1088
  }, { immediate: !0 });
1089
1089
  return K(() => {
1090
1090
  D();
1091
1091
  }), d;
1092
1092
  }
1093
1093
  function pe() {
1094
- const e = Mt("useTres");
1094
+ const e = Ct("useTres");
1095
1095
  if (!e)
1096
1096
  throw new Error("useTresContext must be used together with useTresContextProvider");
1097
1097
  return e;
@@ -1104,27 +1104,27 @@ function qr() {
1104
1104
  renderer: n,
1105
1105
  loop: r,
1106
1106
  raycaster: s,
1107
- controls: a,
1107
+ controls: l,
1108
1108
  invalidate: i,
1109
- advance: l
1109
+ advance: a
1110
1110
  } = pe();
1111
1111
  r.setContext({
1112
1112
  camera: e,
1113
1113
  scene: t,
1114
1114
  renderer: n,
1115
1115
  raycaster: s,
1116
- controls: a,
1116
+ controls: l,
1117
1117
  invalidate: i,
1118
- advance: l
1118
+ advance: a
1119
1119
  });
1120
- function c(y, f = 0) {
1121
- return r.register(y, "before", f);
1120
+ function c(v, f = 0) {
1121
+ return r.register(v, "before", f);
1122
1122
  }
1123
- function o(y) {
1124
- return r.register(y, "render");
1123
+ function o(v) {
1124
+ return r.register(v, "render");
1125
1125
  }
1126
- function u(y, f = 0) {
1127
- return r.register(y, "after", f);
1126
+ function u(v, f = 0) {
1127
+ return r.register(v, "after", f);
1128
1128
  }
1129
1129
  return {
1130
1130
  pause: r.pause,
@@ -1139,22 +1139,22 @@ function qr() {
1139
1139
  }
1140
1140
  function gr(e, t = {}, n = {}) {
1141
1141
  let r = e;
1142
- const s = (l) => {
1143
- r = l;
1142
+ const s = (a) => {
1143
+ r = a;
1144
1144
  };
1145
- let a = new Proxy({}, {});
1145
+ let l = new Proxy({}, {});
1146
1146
  const i = {
1147
- has(l, c) {
1147
+ has(a, c) {
1148
1148
  return c in t || c in r;
1149
1149
  },
1150
- get(l, c, o) {
1150
+ get(a, c, o) {
1151
1151
  return c in t ? t[c](r) : r[c];
1152
1152
  },
1153
- set(l, c, o) {
1154
- return n[c] ? n[c](o, r, a, s) : r[c] = o, !0;
1153
+ set(a, c, o) {
1154
+ return n[c] ? n[c](o, r, l, s) : r[c] = o, !0;
1155
1155
  }
1156
1156
  };
1157
- return a = new Proxy({}, i), a;
1157
+ return l = new Proxy({}, i), l;
1158
1158
  }
1159
1159
  const { logError: Ke } = Y(), Qe = [
1160
1160
  "onClick",
@@ -1173,16 +1173,16 @@ const { logError: Ke } = Y(), Qe = [
1173
1173
  "onWheel"
1174
1174
  ], vr = (e) => {
1175
1175
  const t = e.scene.value;
1176
- function n(o, u, y, f) {
1176
+ function n(o, u, v, f) {
1177
1177
  if (f || (f = {}), f.args || (f.args = []), o === "template" || Nn(o))
1178
1178
  return null;
1179
- let g = o.replace("Tres", ""), v;
1179
+ let h = o.replace("Tres", ""), g;
1180
1180
  if (o === "primitive") {
1181
- (!U(f.object) || Ct(f.object)) && Ke(
1181
+ (!U(f.object) || Mt(f.object)) && Ke(
1182
1182
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1183
- ), g = f.object.type;
1183
+ ), h = f.object.type;
1184
1184
  const b = {};
1185
- v = gr(
1185
+ g = gr(
1186
1186
  f.object,
1187
1187
  {
1188
1188
  object: (d) => d,
@@ -1190,8 +1190,8 @@ const { logError: Ke } = Y(), Qe = [
1190
1190
  __tres: () => b
1191
1191
  },
1192
1192
  {
1193
- object: (d, C, E, P) => {
1194
- or(d, E, P, { patchProp: a, remove: s, insert: r }, e);
1193
+ object: (d, C, M, P) => {
1194
+ or(d, M, P, { patchProp: l, remove: s, insert: r }, e);
1195
1195
  },
1196
1196
  __tres: (d) => {
1197
1197
  Object.assign(b, d);
@@ -1199,37 +1199,37 @@ const { logError: Ke } = Y(), Qe = [
1199
1199
  }
1200
1200
  );
1201
1201
  } else {
1202
- const b = Me.value[g];
1202
+ const b = Ce.value[h];
1203
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);
1204
+ `${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1205
+ ), g = new b(...f.args);
1206
1206
  }
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
+ return g ? (g.isCamera && (f != null && f.position || g.position.set(3, 3, 3), f != null && f.lookAt || g.lookAt(0, 0, 0)), g = z(g, {
1208
+ ...g.__tres,
1209
+ type: h,
1210
1210
  memoizedProps: f,
1211
1211
  eventCount: 0,
1212
1212
  primitive: o === "primitive",
1213
1213
  attach: f.attach
1214
- }, e), v) : null;
1214
+ }, e), g) : null;
1215
1215
  }
1216
1216
  function r(o, u) {
1217
- var g, v, b;
1217
+ var h, g, b;
1218
1218
  if (!o)
1219
1219
  return;
1220
1220
  u = u || t;
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);
1221
+ const v = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
1222
+ o = Q(v), u = Q(f), o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), v.__tres.attach ? tr(f, v, v.__tres.attach) : N(o) && N(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);
1223
1223
  }
1224
1224
  function s(o, u) {
1225
- var v, b, m, d;
1225
+ var g, b, y, d;
1226
1226
  if (!o)
1227
1227
  return;
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)) {
1228
+ o != null && o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
1229
+ const v = (y = o.__tres) == null ? void 0 : y.dispose;
1230
+ be(v) || (v === null ? u = !1 : u = v);
1231
+ const f = (d = o.__tres) == null ? void 0 : d.primitive, h = u === "default" ? !f : !!u;
1232
+ if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, u)), h && o.children && [...o.children].forEach((C) => s(C, u)), mt(o, e), ht(o, e), h && !Dn(o)) {
1233
1233
  if (G(u))
1234
1234
  u(o);
1235
1235
  else if (G(o.dispose))
@@ -1240,11 +1240,11 @@ const { logError: Ke } = Y(), Qe = [
1240
1240
  }
1241
1241
  "__tres" in o && delete o.__tres;
1242
1242
  }
1243
- function a(o, u, y, f) {
1244
- var C, E;
1243
+ function l(o, u, v, f) {
1244
+ var C, M;
1245
1245
  if (!o)
1246
1246
  return;
1247
- let g = o, v = u;
1247
+ let h = o, g = u;
1248
1248
  if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
1249
1249
  const P = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
1250
1250
  s(o), z(o, { attach: f }, e), P && r(o, P);
@@ -1254,61 +1254,61 @@ const { logError: Ke } = Y(), Qe = [
1254
1254
  o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
1255
1255
  return;
1256
1256
  }
1257
- if (N(o) && v === "blocks-pointer-events") {
1258
- f || f === "" ? o[v] = f : delete o[v];
1257
+ if (N(o) && g === "blocks-pointer-events") {
1258
+ f || f === "" ? o[g] = f : delete o[g];
1259
1259
  return;
1260
1260
  }
1261
1261
  Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
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(
1262
+ let b = ie(g), y = h == null ? void 0 : h[b];
1263
+ if (g === "args") {
1264
+ const P = o, E = v ?? [], S = f ?? [], _ = ((M = o.__tres) == null ? void 0 : M.type) || o.type;
1265
+ _ && E.length && !qn(E, S) && (h = Object.assign(
1266
1266
  P,
1267
- new Me.value[_](...f)
1267
+ new Ce.value[_](...f)
1268
1268
  ));
1269
1269
  return;
1270
1270
  }
1271
- if (g.type === "BufferGeometry") {
1272
- if (v === "args")
1271
+ if (h.type === "BufferGeometry") {
1272
+ if (g === "args")
1273
1273
  return;
1274
- g.setAttribute(
1275
- ie(v),
1274
+ h.setAttribute(
1275
+ ie(g),
1276
1276
  new Wt(...f)
1277
1277
  );
1278
1278
  return;
1279
1279
  }
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
+ if (g.includes("-") && y === void 0) {
1281
+ const P = g.split("-");
1282
+ y = P.reduce((E, S) => E[ie(S)], h), g = P.pop(), b = g, y != null && y.set || (h = P.reduce((E, S) => E[ie(S)], h));
1283
1283
  }
1284
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);
1285
+ if (d === "" && (d = !0), G(y)) {
1286
+ Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (h[b] = d);
1287
1287
  return;
1288
1288
  }
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);
1289
+ !(y != null && y.set) && !G(y) ? h[b] = d : y.constructor === d.constructor && (y != null && y.copy) ? y == null || y.copy(d) : de(d) ? y.set(...d) : !y.isColor && y.setScalar ? y.setScalar(d) : y.set(d), pt(o);
1290
1290
  }
1291
1291
  function i(o) {
1292
1292
  var u;
1293
1293
  return ((u = o == null ? void 0 : o.__tres) == null ? void 0 : u.parent) || null;
1294
1294
  }
1295
- function l(o) {
1295
+ function a(o) {
1296
1296
  const u = z(new Nt(), { type: "Comment" }, e);
1297
1297
  return u.name = o, u;
1298
1298
  }
1299
1299
  function c(o) {
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
+ var h;
1301
+ const u = i(o), v = ((h = u == null ? void 0 : u.__tres) == null ? void 0 : h.objects) || [], f = v.indexOf(o);
1302
+ return f < 0 || f >= v.length - 1 ? null : v[f + 1];
1303
1303
  }
1304
1304
  return {
1305
1305
  insert: r,
1306
1306
  remove: s,
1307
1307
  createElement: n,
1308
- patchProp: a,
1308
+ patchProp: l,
1309
1309
  parentNode: i,
1310
1310
  createText: () => void 0,
1311
- createComment: l,
1311
+ createComment: a,
1312
1312
  setText: () => void 0,
1313
1313
  setElementText: () => void 0,
1314
1314
  nextSibling: c,
@@ -1330,57 +1330,57 @@ function Pr() {
1330
1330
  var e;
1331
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;
1332
1332
  }
1333
- function Mr() {
1333
+ function Cr() {
1334
1334
  return Pr() ? Ee.now() : Date.now();
1335
1335
  }
1336
- class Cr {
1336
+ class Mr {
1337
1337
  constructor(t, n) {
1338
1338
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1339
1339
  const r = {};
1340
1340
  if (t.settings)
1341
1341
  for (const i in t.settings) {
1342
- const l = t.settings[i];
1343
- r[i] = l.defaultValue;
1342
+ const a = t.settings[i];
1343
+ r[i] = a.defaultValue;
1344
1344
  }
1345
1345
  const s = `__vue-devtools-plugin-settings__${t.id}`;
1346
- let a = Object.assign({}, r);
1346
+ let l = Object.assign({}, r);
1347
1347
  try {
1348
- const i = localStorage.getItem(s), l = JSON.parse(i);
1349
- Object.assign(a, l);
1348
+ const i = localStorage.getItem(s), a = JSON.parse(i);
1349
+ Object.assign(l, a);
1350
1350
  } catch {
1351
1351
  }
1352
1352
  this.fallbacks = {
1353
1353
  getSettings() {
1354
- return a;
1354
+ return l;
1355
1355
  },
1356
1356
  setSettings(i) {
1357
1357
  try {
1358
1358
  localStorage.setItem(s, JSON.stringify(i));
1359
1359
  } catch {
1360
1360
  }
1361
- a = i;
1361
+ l = i;
1362
1362
  },
1363
1363
  now() {
1364
- return Mr();
1364
+ return Cr();
1365
1365
  }
1366
- }, n && n.on(br, (i, l) => {
1367
- i === this.plugin.id && this.fallbacks.setSettings(l);
1366
+ }, n && n.on(br, (i, a) => {
1367
+ i === this.plugin.id && this.fallbacks.setSettings(a);
1368
1368
  }), this.proxiedOn = new Proxy({}, {
1369
- get: (i, l) => this.target ? this.target.on[l] : (...c) => {
1369
+ get: (i, a) => this.target ? this.target.on[a] : (...c) => {
1370
1370
  this.onQueue.push({
1371
- method: l,
1371
+ method: a,
1372
1372
  args: c
1373
1373
  });
1374
1374
  }
1375
1375
  }), this.proxiedTarget = new Proxy({}, {
1376
- get: (i, l) => this.target ? this.target[l] : l === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(l) ? (...c) => (this.targetQueue.push({
1377
- method: l,
1376
+ get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...c) => (this.targetQueue.push({
1377
+ method: a,
1378
1378
  args: c,
1379
1379
  resolve: () => {
1380
1380
  }
1381
- }), this.fallbacks[l](...c)) : (...c) => new Promise((o) => {
1381
+ }), this.fallbacks[a](...c)) : (...c) => new Promise((o) => {
1382
1382
  this.targetQueue.push({
1383
- method: l,
1383
+ method: a,
1384
1384
  args: c,
1385
1385
  resolve: o
1386
1386
  });
@@ -1396,11 +1396,11 @@ class Cr {
1396
1396
  }
1397
1397
  }
1398
1398
  function Er(e, t) {
1399
- const n = e, r = vt(), s = yr(), a = _r && n.enableEarlyProxy;
1400
- if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
1399
+ const n = e, r = vt(), s = yr(), l = _r && n.enableEarlyProxy;
1400
+ if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1401
1401
  s.emit(wr, e, t);
1402
1402
  else {
1403
- const i = a ? new Cr(n, s) : null;
1403
+ const i = l ? new Mr(n, s) : null;
1404
1404
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1405
1405
  pluginDescriptor: n,
1406
1406
  setupFn: t,
@@ -1427,7 +1427,7 @@ const yt = (e) => {
1427
1427
  textColor: 5750629,
1428
1428
  backgroundColor: 15793395
1429
1429
  });
1430
- const n = ke(e);
1430
+ const n = xe(e);
1431
1431
  return n > 0 && t.tags.push({
1432
1432
  label: `${ur(n)} KB`,
1433
1433
  textColor: 15707189,
@@ -1466,7 +1466,7 @@ function _t(e, t, n = "") {
1466
1466
  const Sr = [], X = "tres:inspector", Ar = Et({
1467
1467
  sceneGraph: null
1468
1468
  });
1469
- function kr(e, t) {
1469
+ function xr(e, t) {
1470
1470
  Er(
1471
1471
  {
1472
1472
  id: "dev.esm.tres",
@@ -1489,33 +1489,33 @@ function kr(e, t) {
1489
1489
  n.sendInspectorTree(X);
1490
1490
  }, 1e3), setInterval(() => {
1491
1491
  n.notifyComponentUpdate();
1492
- }, 5e3), n.on.getInspectorTree((a) => {
1493
- if (a.inspectorId === X) {
1492
+ }, 5e3), n.on.getInspectorTree((l) => {
1493
+ if (l.inspectorId === X) {
1494
1494
  const i = yt(t.scene.value);
1495
- _t(t.scene.value, i, a.filter), Ar.sceneGraph = i, a.rootNodes = [i];
1495
+ _t(t.scene.value, i, l.filter), Ar.sceneGraph = i, l.rootNodes = [i];
1496
1496
  }
1497
1497
  });
1498
1498
  let r = null, s = null;
1499
- n.on.getInspectorState((a) => {
1499
+ n.on.getInspectorState((l) => {
1500
1500
  var i;
1501
- if (a.inspectorId === X) {
1502
- const [l] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
1503
- if (!l)
1501
+ if (l.inspectorId === X) {
1502
+ const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1503
+ if (!a)
1504
1504
  return;
1505
- if (s && r && r.parent && s.remove(r), l.isMesh) {
1506
- const c = Qn(l);
1507
- l.add(c), r = c, s = l;
1505
+ if (s && r && r.parent && s.remove(r), a.isMesh) {
1506
+ const c = Qn(a);
1507
+ a.add(c), r = c, s = a;
1508
1508
  }
1509
- a.state = {
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")
1511
- }, l.isScene && (a.state.info = {
1512
- memory: ke(l),
1513
- objects: l.children.length,
1509
+ l.state = {
1510
+ object: Object.entries(a).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")
1511
+ }, a.isScene && (l.state.info = {
1512
+ memory: xe(a),
1513
+ objects: a.children.length,
1514
1514
  calls: t.renderer.value.info.render.calls,
1515
1515
  triangles: t.renderer.value.info.render.triangles,
1516
1516
  points: t.renderer.value.info.render.points,
1517
1517
  lines: t.renderer.value.info.render.lines
1518
- }, a.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
1518
+ }, l.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
1519
1519
  key: c.name,
1520
1520
  value: {
1521
1521
  ...c,
@@ -1525,13 +1525,13 @@ function kr(e, t) {
1525
1525
  }
1526
1526
  }))) || []);
1527
1527
  }
1528
- }), n.on.editInspectorState((a) => {
1529
- a.inspectorId === X && Kn(t.scene.value, a.nodeId, a.path, a.state.value);
1528
+ }), n.on.editInspectorState((l) => {
1529
+ l.inspectorId === X && Kn(t.scene.value, l.nodeId, l.path, l.state.value);
1530
1530
  });
1531
1531
  }
1532
1532
  );
1533
1533
  }
1534
- const xr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1534
+ const kr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1535
1535
  __name: "TresCanvas",
1536
1536
  props: {
1537
1537
  shadows: { type: Boolean, default: void 0 },
@@ -1576,78 +1576,80 @@ const xr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1576
1576
  "ready"
1577
1577
  ],
1578
1578
  setup(e, { expose: t, emit: n }) {
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;
1581
- Ce(et);
1582
- const u = (m) => Be({
1579
+ var y;
1580
+ const r = e, s = n, l = Tt(), { logWarning: i } = Y(), a = H(), c = $(new nt()), o = (y = Ie()) == null ? void 0 : y.appContext.app;
1581
+ Me(et);
1582
+ const u = (d, C = !1) => Be({
1583
1583
  setup() {
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
+ var P;
1585
+ const M = (P = Ie()) == null ? void 0 : P.appContext;
1586
+ return M && (M.app = o), _e("useTres", d), _e("extend", Me), typeof window < "u" && xr(M == null ? void 0 : M.app, d), () => He(Ot, null, C ? [] : l.default());
1587
1587
  }
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 = {
1593
- root: m
1594
- }, y(m);
1595
- }, g = V(() => r.disableRender), v = $(null);
1596
- return t({ context: v, dispose: () => f(v.value, !0) }), St(() => {
1597
- const m = l;
1598
- v.value = hr({
1588
+ }), v = (d, C = !1) => {
1589
+ const M = u(d, C), { render: P } = Rt(vr(d));
1590
+ P(He(M), c.value);
1591
+ }, f = (d, C = !1) => {
1592
+ dt(d.scene.value), C && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), c.value.__tres = {
1593
+ root: d
1594
+ };
1595
+ }, h = V(() => r.disableRender), g = $(null);
1596
+ t({ context: g, dispose: () => f(g.value, !0) });
1597
+ const b = () => {
1598
+ f(g.value), v(g.value, !0);
1599
+ };
1600
+ return St(() => {
1601
+ const d = a;
1602
+ g.value = hr({
1599
1603
  scene: c.value,
1600
- canvas: m,
1604
+ canvas: d,
1601
1605
  windowSize: r.windowSize ?? !1,
1602
- disableRender: g.value ?? !1,
1606
+ disableRender: h.value ?? !1,
1603
1607
  rendererOptions: r,
1604
1608
  emit: s
1605
1609
  });
1606
- const { registerCamera: d, camera: C, cameras: E, deregisterCamera: P } = v.value;
1607
- y(v.value);
1610
+ const { registerCamera: C, camera: M, cameras: P, deregisterCamera: E } = g.value;
1611
+ v(g.value);
1608
1612
  const S = () => {
1609
- const M = new we(
1613
+ const _ = new we(
1610
1614
  45,
1611
1615
  window.innerWidth / window.innerHeight,
1612
1616
  0.1,
1613
1617
  1e3
1614
1618
  );
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 || _());
1619
+ _.position.set(3, 3, 3), _.lookAt(0, 0, 0), C(_);
1620
+ const A = Te(() => {
1621
+ P.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
1618
1622
  });
1619
1623
  };
1620
1624
  ce(
1621
1625
  () => r.camera,
1622
- (M, _) => {
1623
- M && d(M), _ && (_.removeFromParent(), P(_));
1626
+ (_, A) => {
1627
+ _ && C(_), A && (A.removeFromParent(), E(A));
1624
1628
  },
1625
1629
  {
1626
1630
  immediate: !0
1627
1631
  }
1628
- ), C.value || (i(
1632
+ ), M.value || (i(
1629
1633
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1630
1634
  ), S());
1631
- }), K(() => {
1632
- f(v.value);
1633
- }), (m, d) => (At(), kt("canvas", {
1635
+ }), K(b), (d, C) => (At(), xt("canvas", {
1634
1636
  ref_key: "canvas",
1635
- ref: l,
1637
+ ref: a,
1636
1638
  "data-scene": c.value.uuid,
1637
- class: xt(m.$attrs.class),
1639
+ class: kt(d.$attrs.class),
1638
1640
  "data-tres": `tresjs ${J(An).version}`,
1639
1641
  style: Lt({
1640
1642
  display: "block",
1641
1643
  width: "100%",
1642
1644
  height: "100%",
1643
- position: m.windowSize ? "fixed" : "relative",
1645
+ position: d.windowSize ? "fixed" : "relative",
1644
1646
  top: 0,
1645
1647
  left: 0,
1646
1648
  pointerEvents: "auto",
1647
1649
  touchAction: "none",
1648
- ...m.$attrs.style
1650
+ ...d.$attrs.style
1649
1651
  })
1650
- }, null, 14, xr));
1652
+ }, null, 14, kr));
1651
1653
  }
1652
1654
  }), Rr = [
1653
1655
  "TresCanvas",
@@ -1672,10 +1674,10 @@ class wt extends zt {
1672
1674
  constructor(t, n) {
1673
1675
  const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new $e();
1674
1676
  s.setAttribute("position", new Ue(r, 3)), s.computeBoundingSphere();
1675
- const a = new Gt({ fog: !1 });
1676
- super(s, a), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1677
- const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], l = new $e();
1678
- l.setAttribute("position", new Ue(i, 3)), l.computeBoundingSphere(), this.add(new Vt(l, new ot({ side: Yt, fog: !1 })));
1677
+ const l = new Gt({ fog: !1 });
1678
+ super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1679
+ const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new $e();
1680
+ a.setAttribute("position", new Ue(i, 3)), a.computeBoundingSphere(), this.add(new Vt(a, new ot({ side: Yt, fog: !1 })));
1679
1681
  }
1680
1682
  updateMatrixWorld() {
1681
1683
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
@@ -1747,11 +1749,11 @@ const Xr = {
1747
1749
  };
1748
1750
  export {
1749
1751
  Lr as TresCanvas,
1750
- Me as catalogue,
1752
+ Ce as catalogue,
1751
1753
  pr as createRenderLoop,
1752
1754
  Zr as default,
1753
1755
  dt as dispose,
1754
- Ce as extend,
1756
+ Me as extend,
1755
1757
  Fr as isProd,
1756
1758
  Un as normalizeColor,
1757
1759
  Wr as normalizeVectorFlexibleParam,