@tresjs/core 4.3.2 → 4.3.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.3.2
3
+ * version: v4.3.3
4
4
  * (c) 2025
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 Et = Object.defineProperty;
9
9
  var Tt = (e, t, n) => t in e ? Et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
10
  var he = (e, t, n) => Tt(e, typeof t != "symbol" ? t + "" : t, n);
11
- import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as K, watchEffect as Ae, onUnmounted as J, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as At, useSlots as xt, getCurrentInstance as He, onMounted as Lt, openBlock as kt, createElementBlock as Rt, normalizeClass as Ot, normalizeStyle as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
11
+ import { defineComponent as fe, withAsyncContext as nt, reactive as Se, renderSlot as rt, unref as W, ref as I, computed as q, watchEffect as Ae, onUnmounted as K, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as At, useSlots as xt, getCurrentInstance as He, onMounted as kt, createElementBlock as Lt, openBlock as Rt, normalizeStyle as Ot, normalizeClass as Dt, createRenderer as jt, h as Ue, Fragment as Bt } from "vue";
12
12
  import * as ot from "three";
13
- import { Scene as st, Vector3 as xe, MathUtils as it, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, SRGBColorSpace as Ft, ACESFilmicToneMapping as ct, PCFSoftShadowMap as Wt, NoToneMapping as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, BufferAttribute as Gt, Object3D as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, DirectionalLightHelper as Xt, PointLightHelper as Zt, SpotLightHelper as en, HemisphereLightHelper as tn } from "three";
13
+ import { Scene as st, MathUtils as it, Vector3 as xe, MeshBasicMaterial as at, DoubleSide as It, TextureLoader as $t, PerspectiveCamera as be, Camera as Ht, Clock as lt, REVISION as Ut, Color as Z, NoToneMapping as Ft, PCFSoftShadowMap as Wt, ACESFilmicToneMapping as ct, SRGBColorSpace as Nt, WebGLRenderer as ge, Vector2 as ve, Raycaster as zt, Object3D as Gt, BufferAttribute as Vt, ArrowHelper as Yt, Line as qt, BufferGeometry as Fe, Float32BufferAttribute as We, LineBasicMaterial as Kt, Mesh as Jt, BackSide as Qt, HemisphereLightHelper as Xt, SpotLightHelper as Zt, PointLightHelper as en, DirectionalLightHelper as tn } from "three";
14
14
  import { tryOnScopeDispose as nn, toValue as A, unrefElement as rn, useDevicePixelRatio as on, useWindowSize as sn, useElementSize as an, refDebounced as Ne, usePointer as ln, useElementBounding as cn, createEventHook as D, useFps as un, useMemory as fn, useRafFn as ut } from "@vueuse/core";
15
- const dn = "@tresjs/core", pn = "module", mn = "4.3.2", hn = "pnpm@9.15.1", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, wn = ["vue", "3d", "threejs", "three", "threejs-vue"], bn = !1, Mn = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js", require: "./dist/tres.umd.cjs" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = ["*.d.ts", "dist"], Sn = { access: "public" }, An = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, xn = { three: ">=0.133", vue: ">=3.4" }, Ln = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.0.0" }, kn = { "@release-it/conventional-changelog": "^9.0.3", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.0.3", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.171.0", "@typescript-eslint/eslint-plugin": "^8.18.1", "@typescript-eslint/parser": "^8.18.1", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^2.1.8", "@vitest/ui": "^2.1.8", "@vue/test-utils": "^2.4.6", eslint: "^9.17.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.5", jsdom: "^25.0.1", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^1.1.2", "release-it": "^17.10.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.12.0", sponsorkit: "^0.16.2", three: "^0.171.0", unocss: "^0.65.2", unplugin: "^2.1.0", "unplugin-vue-components": "^0.28.0", vite: "^6.0.5", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.4.0", "vite-plugin-inspect": "^0.10.4", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.5.0", vitest: "2.1.8", vue: "3.5.13", "vue-demi": "^0.14.10" }, Rn = {
15
+ const dn = "@tresjs/core", pn = "module", mn = "4.3.3", hn = "pnpm@9.15.5", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = { type: "git", url: "git+https://github.com/Tresjs/tres.git" }, wn = ["vue", "3d", "threejs", "three", "threejs-vue"], bn = !1, Mn = { ".": { types: "./dist/index.d.ts", import: "./dist/tres.js", require: "./dist/tres.umd.cjs" }, "./components": { types: "./dist/src/components/index.d.ts" }, "./composables": { types: "./dist/src/composables/index.d.ts" }, "./types": { types: "./dist/src/types/index.d.ts" }, "./utils": { types: "./dist/src/utils/index.d.ts" }, "./*": "./*" }, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = ["*.d.ts", "dist"], Sn = { access: "public" }, An = { dev: "pnpm --filter='./playground/vue' dev", "dev:nuxt": "pnpm --filter='./playground/nuxt' dev", build: "vite build", test: "vitest", "test:ci": "vitest run", "test:ui": "vitest --ui --coverage.enabled=true", release: "release-it", coverage: "vitest run --coverage", lint: "eslint .", "lint:fix": "eslint . --fix", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs", "docs:preview": "vitepress preview docs", "docs:contributors": "esno scripts/update-contributors.ts" }, xn = { three: ">=0.133", vue: ">=3.4" }, kn = { "@alvarosabu/utils": "^3.2.0", "@vue/devtools-api": "^6.6.3", "@vueuse/core": "^12.5.0" }, Ln = { "@release-it/conventional-changelog": "^10.0.0", "@stackblitz/sdk": "^1.11.0", "@tresjs/cientos": "4.1.0", "@tresjs/eslint-config": "^1.4.0", "@types/three": "^0.173.0", "@typescript-eslint/eslint-plugin": "^8.23.0", "@typescript-eslint/parser": "^8.23.0", "@vitejs/plugin-vue": "^5.2.1", "@vitest/coverage-c8": "^0.33.0", "@vitest/coverage-v8": "^3.0.5", "@vitest/ui": "^3.0.5", "@vue/test-utils": "^2.4.6", eslint: "^9.19.0", "eslint-plugin-vue": "^9.32.0", esno: "^4.8.0", gsap: "^3.12.7", jsdom: "^26.0.0", kolorist: "^1.8.0", ohmyfetch: "^0.4.21", pathe: "^2.0.2", "release-it": "^18.1.2", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-visualizer": "^5.14.0", sponsorkit: "^16.3.0", three: "^0.173.0", unocss: "^65.4.3", unplugin: "^2.1.2", "unplugin-vue-components": "^28.0.0", vite: "^6.1.0", "vite-plugin-banner": "^0.8.0", "vite-plugin-dts": "4.5.0", "vite-plugin-inspect": "^10.1.0", "vite-plugin-require-transform": "^1.0.21", "vite-svg-loader": "^5.1.0", vitepress: "1.6.3", vitest: "3.0.5", vue: "3.5.13", "vue-demi": "^0.14.10" }, Rn = {
16
16
  name: dn,
17
17
  type: pn,
18
18
  version: mn,
@@ -31,8 +31,8 @@ const dn = "@tresjs/core", pn = "module", mn = "4.3.2", hn = "pnpm@9.15.1", gn =
31
31
  publishConfig: Sn,
32
32
  scripts: An,
33
33
  peerDependencies: xn,
34
- dependencies: Ln,
35
- devDependencies: kn
34
+ dependencies: kn,
35
+ devDependencies: Ln
36
36
  };
37
37
  function On(e) {
38
38
  const t = { nodes: {}, materials: {} };
@@ -40,18 +40,18 @@ function On(e) {
40
40
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
41
41
  }), t;
42
42
  }
43
- async function Dn(e, t, n, r, s) {
44
- const { logError: l } = V(), i = new e();
45
- return s && s(i), n && n(i), await new Promise((a, c) => {
46
- i.load(
43
+ async function Dn(e, t, n, r, o) {
44
+ const { logError: l } = Q(), s = new e();
45
+ return o && o(s), n && n(s), await new Promise((a, c) => {
46
+ s.load(
47
47
  t,
48
- (o) => {
49
- const f = o;
48
+ (i) => {
49
+ const f = i;
50
50
  f.scene && Object.assign(f, On(f.scene)), a(f);
51
51
  },
52
52
  r,
53
- (o) => {
54
- l("[useLoader] - Failed to load resource", o), c(o);
53
+ (i) => {
54
+ l("[useLoader] - Failed to load resource", i), c(i);
55
55
  }
56
56
  );
57
57
  });
@@ -64,8 +64,8 @@ const Yr = /* @__PURE__ */ fe({
64
64
  },
65
65
  async setup(e) {
66
66
  let t, n;
67
- const r = e, s = ([t, n] = nt(() => Se(Dn(r.loader, r.url))), t = await t, n(), t);
68
- return (l, i) => rt(l.$slots, "default", { data: W(s) });
67
+ const r = e, o = ([t, n] = nt(() => Se(Dn(r.loader, r.url))), t = await t, n(), t);
68
+ return (l, s) => rt(l.$slots, "default", { data: W(o) });
69
69
  }
70
70
  });
71
71
  class jn extends ot.Mesh {
@@ -76,8 +76,8 @@ class jn extends ot.Mesh {
76
76
  this.createTime = Date.now();
77
77
  }
78
78
  onBeforeRender() {
79
- const r = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * r);
80
- this.scale.set(i, i, i);
79
+ const r = (Date.now() - this.createTime) / 1e3, s = 1 + 0.07 * Math.sin(2.5 * r);
80
+ this.scale.set(s, s, s);
81
81
  }
82
82
  }
83
83
  function Me(e) {
@@ -142,23 +142,23 @@ function Vn(e) {
142
142
  }
143
143
  function Yn(e, t) {
144
144
  const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
145
- for (let s = 0; s < r.length; s++)
146
- n[r[s]] = !0;
147
- return (s) => !!n[s];
145
+ for (let o = 0; o < r.length; o++)
146
+ n[r[o]] = !0;
147
+ return t ? (o) => !!n[o.toLowerCase()] : (o) => !!n[o];
148
148
  }
149
149
  const Ve = (e, t) => {
150
150
  if (!t)
151
151
  return;
152
152
  const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
153
- return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
153
+ return n == null ? void 0 : n.reduce((r, o) => r && r[o], e);
154
154
  }, qn = (e, t, n) => {
155
155
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
156
- r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
156
+ r && r.reduce((o, l, s) => (o[l] === void 0 && (o[l] = {}), s === r.length - 1 && (o[l] = n), o[l]), e);
157
157
  };
158
158
  function pt(e, t) {
159
159
  if (Ge(e) && Ge(t)) {
160
- const s = e.attributes, l = t.attributes;
161
- return s.length !== l.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
160
+ const o = e.attributes, l = t.attributes;
161
+ return o.length !== l.length ? !1 : Array.from(o).every(({ name: s, value: a }) => t.getAttribute(s) === a);
162
162
  }
163
163
  if (e === t)
164
164
  return !0;
@@ -167,8 +167,8 @@ function pt(e, t) {
167
167
  const n = Object.keys(e), r = Object.keys(t);
168
168
  if (n.length !== r.length)
169
169
  return !1;
170
- for (const s of n)
171
- if (!r.includes(s) || !pt(e[s], t[s]))
170
+ for (const o of n)
171
+ if (!r.includes(o) || !pt(e[o], t[o]))
172
172
  return !1;
173
173
  return !0;
174
174
  }
@@ -182,29 +182,29 @@ function Kn(e, t) {
182
182
  }
183
183
  const Jn = Array.isArray;
184
184
  function Qn(e, t, n, r) {
185
- const s = (c) => {
185
+ const o = (c) => {
186
186
  if (c.uuid === t)
187
187
  return c;
188
- for (const o of c.children) {
189
- const f = s(o);
188
+ for (const i of c.children) {
189
+ const f = o(i);
190
190
  if (f)
191
191
  return f;
192
192
  }
193
- }, l = s(e);
193
+ }, l = o(e);
194
194
  if (!l) {
195
195
  console.warn("Object with UUID not found in the scene.");
196
196
  return;
197
197
  }
198
- let i = l;
198
+ let s = l;
199
199
  for (let c = 0; c < n.length - 1; c++)
200
- if (i[n[c]] !== void 0)
201
- i = i[n[c]];
200
+ if (s[n[c]] !== void 0)
201
+ s = s[n[c]];
202
202
  else {
203
203
  console.warn(`Property path is not valid: ${n.join(".")}`);
204
204
  return;
205
205
  }
206
206
  const a = n[n.length - 1];
207
- i[a] !== void 0 ? i[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
207
+ s[a] !== void 0 ? s[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
208
208
  }
209
209
  function Xn(e) {
210
210
  const t = new at({
@@ -232,9 +232,9 @@ function Ye(e) {
232
232
  }
233
233
  function mt(e) {
234
234
  var n, r;
235
- if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => mt(s)), !(e instanceof st)) {
236
- const s = e;
237
- 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);
235
+ if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((o) => mt(o)), !(e instanceof st)) {
236
+ const o = e;
237
+ e && ((r = e.dispose) == null || r.call(e)), o.geometry && o.geometry.dispose(), Array.isArray(o.material) ? o.material.forEach((l) => Ye(l)) : o.material && Ye(o.material);
238
238
  }
239
239
  }
240
240
  function tr(e, t) {
@@ -247,10 +247,10 @@ function Pe(e, t) {
247
247
  let n = e;
248
248
  if (t.includes("-")) {
249
249
  const r = t.split("-");
250
- let s = r.shift();
250
+ let o = r.shift();
251
251
  for (; n && r.length; )
252
- s in n ? (n = n[s], s = r.shift()) : s = qe(s, r.shift());
253
- return { target: n, key: qe(s, ...r) };
252
+ o in n ? (n = n[o], o = r.shift()) : o = qe(o, r.shift());
253
+ return { target: n, key: qe(o, ...r) };
254
254
  } else
255
255
  return { target: n, key: t };
256
256
  }
@@ -261,26 +261,26 @@ const Ke = /-\d+$/;
261
261
  function nr(e, t, n) {
262
262
  if (ft(n)) {
263
263
  if (Ke.test(n)) {
264
- const l = n.replace(Ke, ""), { target: i, key: a } = Pe(e, l);
265
- if (!Array.isArray(i[a])) {
266
- const c = i[a], o = [];
267
- o.__tresDetach = () => {
268
- o.every((f) => Me(f)) && (i[a] = c);
269
- }, i[a] = o;
264
+ const l = n.replace(Ke, ""), { target: s, key: a } = Pe(e, l);
265
+ if (!Array.isArray(s[a])) {
266
+ const c = s[a], i = [];
267
+ i.__tresDetach = () => {
268
+ i.every((f) => Me(f)) && (s[a] = c);
269
+ }, s[a] = i;
270
270
  }
271
271
  }
272
- const { target: r, key: s } = Pe(e, n);
273
- t.__tres.previousAttach = r[s], r[s] = Q(t);
272
+ const { target: r, key: o } = Pe(e, n);
273
+ t.__tres.previousAttach = r[o], r[o] = J(t);
274
274
  } else
275
275
  t.__tres.previousAttach = n(e, t);
276
276
  }
277
277
  function rr(e, t, n) {
278
- var r, s, l;
278
+ var r, o, l;
279
279
  if (ft(n)) {
280
- const { target: i, key: a } = Pe(e, n), c = t.__tres.previousAttach;
281
- c === void 0 ? delete i[a] : i[a] = c, "__tresDetach" in i && i.__tresDetach();
280
+ const { target: s, key: a } = Pe(e, n), c = t.__tres.previousAttach;
281
+ c === void 0 ? delete s[a] : s[a] = c, "__tresDetach" in s && s.__tresDetach();
282
282
  } else
283
- (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
283
+ (o = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || o.call(r, e, t);
284
284
  (l = t.__tres) == null || delete l.previousAttach;
285
285
  }
286
286
  function z(e, t, n) {
@@ -303,81 +303,84 @@ function ht(e) {
303
303
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
304
304
  }
305
305
  function or(e, t, n) {
306
- var s;
306
+ var o;
307
307
  if (!G(e.setPixelRatio))
308
308
  return;
309
309
  let r = 0;
310
- if (n && de(n) && n.length >= 2) {
311
- const [l, i] = n;
312
- r = it.clamp(t, l, i);
310
+ if (n && de(n)) {
311
+ const l = n;
312
+ if (l.length >= 2) {
313
+ const [s, a] = l;
314
+ r = it.clamp(t, s, a);
315
+ }
313
316
  } else Bn(n) ? r = n : r = t;
314
- r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
317
+ r !== ((o = e.getPixelRatio) == null ? void 0 : o.call(e)) && e.setPixelRatio(r);
315
318
  }
316
- function sr(e, t, n, r, s) {
317
- const l = [...t.__tres.objects], i = Q(t);
318
- if (e = Q(e), i === e)
319
+ function sr(e, t, n, r, o) {
320
+ const l = [...t.__tres.objects], s = J(t);
321
+ if (e = J(e), s === e)
319
322
  return !0;
320
- const a = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
321
- delete o.object;
323
+ const a = z(e, t.__tres ?? {}, o), c = t.parent ?? t.__tres.parent ?? null, i = { ...t.__tres.memoizedProps };
324
+ delete i.object;
322
325
  for (const f of l)
323
- gt(f, s), vt(f, s);
324
- i.__tres.objects = [], r.remove(t);
325
- for (const [f, y] of Object.entries(o))
326
- r.patchProp(a, f, a[f], y);
326
+ gt(f, o), vt(f, o);
327
+ s.__tres.objects = [], r.remove(t);
328
+ for (const [f, g] of Object.entries(i))
329
+ r.patchProp(a, f, a[f], g);
327
330
  n(e), r.insert(t, c);
328
331
  for (const f of l)
329
332
  r.insert(f, t);
330
333
  return !0;
331
334
  }
332
- function Q(e) {
335
+ function J(e) {
333
336
  return Wn(e) ? (e.object.__tres = e.__tres, e.object) : e;
334
337
  }
335
338
  function gt(e, t) {
336
- var r, s, l, i;
339
+ var r, o, l, s;
337
340
  const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
338
- e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (s = e.__tres) != null && s.attach ? rr(n, e, e.__tres.attach) : ((i = (l = e.parent) == null ? void 0 : l.remove) == null || i.call(l, Q(e)), e.parent = null);
341
+ e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (o = e.__tres) != null && o.attach ? rr(n, e, e.__tres.attach) : ((s = (l = e.parent) == null ? void 0 : l.remove) == null || s.call(l, J(e)), e.parent = null);
339
342
  }
340
343
  function vt(e, t) {
341
344
  var n;
342
345
  (n = e.traverse) == null || n.call(e, (r) => {
343
- var s;
344
- t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
346
+ var o;
347
+ t.deregisterCamera(r), (o = t.eventManager) == null || o.deregisterPointerMissedObject(r);
345
348
  }), t.deregisterCamera(e), ht(e);
346
349
  }
347
350
  async function ir(e, t) {
348
- const n = new $t(t), r = (s) => new Promise((l, i) => {
351
+ const n = new $t(t), r = (o) => new Promise((l, s) => {
349
352
  n.load(
350
- s,
353
+ o,
351
354
  (a) => l(a),
352
355
  () => null,
353
356
  () => {
354
- i(new Error("[useTextures] - Failed to load texture"));
357
+ s(new Error("[useTextures] - Failed to load texture"));
355
358
  }
356
359
  );
357
360
  });
358
361
  if (Jn(e)) {
359
- const s = await Promise.all(e.map((l) => r(l)));
360
- return e.length > 1 ? s : s[0];
362
+ const o = await Promise.all(e.map((l) => r(l)));
363
+ return e.length > 1 ? o : o[0];
361
364
  } else {
362
365
  const {
363
- map: s,
366
+ map: o,
364
367
  displacementMap: l,
365
- normalMap: i,
368
+ normalMap: s,
366
369
  roughnessMap: a,
367
370
  metalnessMap: c,
368
- aoMap: o,
371
+ aoMap: i,
369
372
  alphaMap: f,
370
- matcap: y
373
+ matcap: g
371
374
  } = e;
372
375
  return {
373
- map: s ? await r(s) : null,
376
+ map: o ? await r(o) : null,
374
377
  displacementMap: l ? await r(l) : null,
375
- normalMap: i ? await r(i) : null,
378
+ normalMap: s ? await r(s) : null,
376
379
  roughnessMap: a ? await r(a) : null,
377
380
  metalnessMap: c ? await r(c) : null,
378
- aoMap: o ? await r(o) : null,
381
+ aoMap: i ? await r(i) : null,
379
382
  alphaMap: f ? await r(f) : null,
380
- matcap: y ? await r(y) : null
383
+ matcap: g ? await r(g) : null
381
384
  };
382
385
  }
383
386
  }
@@ -395,41 +398,41 @@ const qr = /* @__PURE__ */ fe({
395
398
  },
396
399
  async setup(e) {
397
400
  let t, n;
398
- const r = e, s = ([t, n] = nt(() => Se(ir(r))), t = await t, n(), t);
399
- return (l, i) => rt(l.$slots, "default", { textures: W(s) });
401
+ const r = e, o = ([t, n] = nt(() => Se(ir(r))), t = await t, n(), t);
402
+ return (l, s) => rt(l.$slots, "default", { textures: W(o) });
400
403
  }
401
404
  }), ar = ({ sizes: e }) => {
402
- const t = I([]), n = K(
405
+ const t = I([]), n = q(
403
406
  () => t.value[0]
404
- ), r = (i) => {
405
- const a = i instanceof Ht ? i : t.value.find((o) => o.uuid === i);
407
+ ), r = (s) => {
408
+ const a = s instanceof Ht ? s : t.value.find((i) => i.uuid === s);
406
409
  if (!a)
407
410
  return;
408
- const c = t.value.filter(({ uuid: o }) => o !== a.uuid);
411
+ const c = t.value.filter(({ uuid: i }) => i !== a.uuid);
409
412
  t.value = [a, ...c];
410
- }, s = (i, a = !1) => {
411
- if (ze(i)) {
412
- const c = i;
413
- if (t.value.some(({ uuid: o }) => o === c.uuid))
413
+ }, o = (s, a = !1) => {
414
+ if (ze(s)) {
415
+ const c = s;
416
+ if (t.value.some(({ uuid: i }) => i === c.uuid))
414
417
  return;
415
418
  a ? r(c) : t.value.push(c);
416
419
  }
417
- }, l = (i) => {
418
- if (ze(i)) {
419
- const a = i;
420
+ }, l = (s) => {
421
+ if (ze(s)) {
422
+ const a = s;
420
423
  t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
421
424
  }
422
425
  };
423
426
  return Ae(() => {
424
- e.aspectRatio.value && t.value.forEach((i) => {
425
- !i.manual && (i instanceof be || lr(i)) && (i instanceof be ? 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());
427
+ e.aspectRatio.value && t.value.forEach((s) => {
428
+ !s.manual && (s instanceof be || lr(s)) && (s instanceof be ? s.aspect = e.aspectRatio.value : (s.left = e.width.value * -0.5, s.right = e.width.value * 0.5, s.top = e.height.value * 0.5, s.bottom = e.height.value * -0.5), s.updateProjectionMatrix());
426
429
  });
427
- }), J(() => {
430
+ }), K(() => {
428
431
  t.value = [];
429
432
  }), {
430
433
  camera: n,
431
434
  cameras: t,
432
- registerCamera: s,
435
+ registerCamera: o,
433
436
  deregisterCamera: l,
434
437
  setCameraActive: r
435
438
  };
@@ -446,7 +449,7 @@ function ur(...e) {
446
449
  }
447
450
  function fr(e, t) {
448
451
  }
449
- function V() {
452
+ function Q() {
450
453
  return {
451
454
  logError: cr,
452
455
  logWarning: ur,
@@ -457,23 +460,23 @@ const Ce = I({}), Ee = (e) => Object.assign(Ce.value, e);
457
460
  function ye() {
458
461
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
459
462
  let n = 0, r = !1;
460
- const s = () => {
461
- const o = Array.from(e.entries()).sort((f, y) => {
462
- const u = f[1].priority - y[1].priority;
463
- return u === 0 ? f[1].addI - y[1].addI : u;
463
+ const o = () => {
464
+ const i = Array.from(e.entries()).sort((f, g) => {
465
+ const u = f[1].priority - g[1].priority;
466
+ return u === 0 ? f[1].addI - g[1].addI : u;
464
467
  });
465
- t.clear(), o.forEach((f) => t.add(f[0]));
466
- }, l = (o) => {
467
- e.delete(o), t.delete(o);
468
+ t.clear(), i.forEach((f) => t.add(f[0]));
469
+ }, l = (i) => {
470
+ e.delete(i), t.delete(i);
468
471
  };
469
- return { on: (o, f = 0) => {
470
- e.set(o, { priority: f, addI: n++ });
471
- const y = () => l(o);
472
- return nn(y), r = !0, {
473
- off: y
472
+ return { on: (i, f = 0) => {
473
+ e.set(i, { priority: f, addI: n++ });
474
+ const g = () => l(i);
475
+ return nn(g), r = !0, {
476
+ off: g
474
477
  };
475
- }, off: l, trigger: (...o) => {
476
- r && (s(), r = !1), t.forEach((f) => f(...o));
478
+ }, off: l, trigger: (...i) => {
479
+ r && (o(), r = !1), t.forEach((f) => f(...i));
477
480
  }, dispose: () => {
478
481
  e.clear(), t.clear();
479
482
  }, get count() {
@@ -482,50 +485,50 @@ function ye() {
482
485
  }
483
486
  function dr() {
484
487
  let e = !0, t = !0, n = !1;
485
- const r = new lt(!1), s = I(r.running), l = I(!1);
486
- let i;
488
+ const r = new lt(!1), o = I(r.running), l = I(!1);
489
+ let s;
487
490
  const a = it.generateUUID();
488
491
  let c = null;
489
- const o = ye(), f = ye(), y = ye();
490
- E();
492
+ const i = ye(), f = ye(), g = ye();
493
+ S();
491
494
  let u = {};
492
- function v(M) {
495
+ function y(M) {
493
496
  u = M;
494
497
  }
495
- function h(M, x, p = 0) {
498
+ function p(M, x, m = 0) {
496
499
  switch (x) {
497
500
  case "before":
498
- return o.on(M, p);
501
+ return i.on(M, m);
499
502
  case "render":
500
503
  return c || (c = M), f.dispose(), f.on(M);
501
504
  case "after":
502
- return y.on(M, p);
505
+ return g.on(M, m);
503
506
  }
504
507
  }
505
- function g() {
506
- t && (t = !1, E(), b());
508
+ function _() {
509
+ t && (t = !1, S(), E());
507
510
  }
508
511
  function d() {
509
- t = !0, E(), cancelAnimationFrame(i);
512
+ t = !0, S(), cancelAnimationFrame(s);
510
513
  }
511
- function _() {
512
- n = !1, E();
514
+ function v() {
515
+ n = !1, S();
513
516
  }
514
517
  function P() {
515
- n = !0, E();
518
+ n = !0, S();
516
519
  }
517
520
  function C() {
518
521
  l.value = !0;
519
522
  }
520
- function T() {
523
+ function w() {
521
524
  l.value = !1;
522
525
  }
523
- function b() {
526
+ function E() {
524
527
  if (!e) {
525
- i = requestAnimationFrame(b);
528
+ s = requestAnimationFrame(E);
526
529
  return;
527
530
  }
528
- const M = r.getDelta(), x = r.getElapsedTime(), p = {
531
+ const M = r.getDelta(), x = r.getElapsedTime(), m = {
529
532
  camera: W(u.camera),
530
533
  scene: W(u.scene),
531
534
  renderer: W(u.renderer),
@@ -533,33 +536,33 @@ function dr() {
533
536
  controls: W(u.controls),
534
537
  invalidate: u.invalidate,
535
538
  advance: u.advance
536
- }, w = { delta: M, elapsed: x, clock: r, ...p };
537
- s.value && o.trigger(w), l.value || (f.count ? f.trigger(w) : c && c(w)), s.value && y.trigger(w), i = requestAnimationFrame(b);
539
+ }, b = { delta: M, elapsed: x, clock: r, ...m };
540
+ o.value && i.trigger(b), l.value || (f.count ? f.trigger(b) : c && c(b)), o.value && g.trigger(b), s = requestAnimationFrame(E);
538
541
  }
539
- function E() {
542
+ function S() {
540
543
  const M = !t && !n;
541
- r.running !== M && (r.running ? r.stop() : r.start()), s.value = r.running;
544
+ r.running !== M && (r.running ? r.stop() : r.start()), o.value = r.running;
542
545
  }
543
546
  return {
544
547
  loopId: a,
545
- register: (M, x, p) => h(M, x, p),
546
- start: g,
548
+ register: (M, x, m) => p(M, x, m),
549
+ start: _,
547
550
  stop: d,
548
551
  pause: P,
549
- resume: _,
552
+ resume: v,
550
553
  pauseRender: C,
551
- resumeRender: T,
554
+ resumeRender: w,
552
555
  isRenderPaused: l,
553
- isActive: s,
554
- setContext: v,
556
+ isActive: o,
557
+ setContext: y,
555
558
  setReady: (M) => e = M
556
559
  };
557
560
  }
558
- function Le(e) {
561
+ function ke(e) {
559
562
  let t = 0;
560
563
  return e.traverse((n) => {
561
564
  if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
562
- 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;
565
+ const r = n.geometry, o = r.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = r.index ? r.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, s = 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 = o + l + s + a;
563
566
  t += c;
564
567
  }
565
568
  }), t;
@@ -578,7 +581,7 @@ const se = {
578
581
  realistic: {
579
582
  shadows: !0,
580
583
  physicallyCorrectLights: !0,
581
- outputColorSpace: Ft,
584
+ outputColorSpace: Nt,
582
585
  toneMapping: ct,
583
586
  toneMappingExposure: 3,
584
587
  shadowMap: {
@@ -587,16 +590,16 @@ const se = {
587
590
  }
588
591
  },
589
592
  flat: {
590
- toneMapping: Nt,
593
+ toneMapping: Ft,
591
594
  toneMappingExposure: 1
592
595
  }
593
596
  };
594
597
  function gr({
595
598
  canvas: e,
596
599
  options: t,
597
- contextParts: { sizes: n, render: r, invalidate: s, advance: l }
600
+ contextParts: { sizes: n, render: r, invalidate: o, advance: l }
598
601
  }) {
599
- const i = K(() => ({
602
+ const s = q(() => ({
600
603
  alpha: A(t.alpha) ?? !0,
601
604
  depth: A(t.depth),
602
605
  canvas: rn(e),
@@ -609,141 +612,141 @@ function gr({
609
612
  preserveDrawingBuffer: A(t.preserveDrawingBuffer),
610
613
  logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
611
614
  failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
612
- })), a = $(new ge(i.value));
615
+ })), a = $(new ge(s.value));
613
616
  function c() {
614
- t.renderMode === "on-demand" && s();
617
+ t.renderMode === "on-demand" && o();
615
618
  }
616
- ae(i, () => {
617
- a.value.dispose(), a.value = new ge(i.value), c();
619
+ ae(s, () => {
620
+ a.value.dispose(), a.value = new ge(s.value), c();
618
621
  }), ae([n.width, n.height], () => {
619
622
  a.value.setSize(n.width.value, n.height.value), c();
620
623
  }, {
621
624
  immediate: !0
622
625
  }), ae(() => t.clearColor, c);
623
- const { pixelRatio: o } = on(), { logError: f } = V(), u = (() => {
624
- const h = new ge(), g = {
626
+ const { pixelRatio: i } = on(), { logError: f } = Q(), u = (() => {
627
+ const p = new ge(), _ = {
625
628
  shadowMap: {
626
- enabled: h.shadowMap.enabled,
627
- type: h.shadowMap.type
629
+ enabled: p.shadowMap.enabled,
630
+ type: p.shadowMap.type
628
631
  },
629
- toneMapping: h.toneMapping,
630
- toneMappingExposure: h.toneMappingExposure,
631
- outputColorSpace: h.outputColorSpace
632
+ toneMapping: p.toneMapping,
633
+ toneMappingExposure: p.toneMappingExposure,
634
+ outputColorSpace: p.outputColorSpace
632
635
  };
633
- return h.dispose(), g;
634
- })(), v = A(t.renderMode);
635
- return v === "on-demand" && s(), v === "manual" && setTimeout(() => {
636
+ return p.dispose(), _;
637
+ })(), y = A(t.renderMode);
638
+ return y === "on-demand" && o(), y === "manual" && setTimeout(() => {
636
639
  l();
637
640
  }, 100), Ae(() => {
638
- const h = A(t.preset);
639
- h && (h in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[h])), or(a.value, o.value, A(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
640
- const g = (P, C) => {
641
- const T = A(P), b = () => {
642
- if (h)
643
- return Ve(se[h], C);
641
+ const p = A(t.preset);
642
+ p && (p in se || f(`Renderer Preset must be one of these: ${Object.keys(se).join(", ")}`), dt(a.value, se[p])), or(a.value, i.value, A(t.dpr)), y === "always" && (r.frames.value = Math.max(1, r.frames.value));
643
+ const _ = (P, C) => {
644
+ const w = A(P), E = () => {
645
+ if (p)
646
+ return Ve(se[p], C);
644
647
  };
645
- if (T !== void 0)
646
- return T;
647
- const E = b();
648
- return E !== void 0 ? E : Ve(u, C);
649
- }, d = (P, C) => qn(a.value, C, g(P, C));
648
+ if (w !== void 0)
649
+ return w;
650
+ const S = E();
651
+ return S !== void 0 ? S : Ve(u, C);
652
+ }, d = (P, C) => qn(a.value, C, _(P, C));
650
653
  d(t.shadows, "shadowMap.enabled"), d(t.toneMapping ?? ct, "toneMapping"), d(t.shadowMapType, "shadowMap.type"), mr < 150 && d(!t.useLegacyLights, "physicallyCorrectLights"), d(t.outputColorSpace, "outputColorSpace"), d(t.toneMappingExposure, "toneMappingExposure");
651
- const _ = g(t.clearColor, "clearColor");
652
- _ && a.value.setClearColor(
653
- _ ? hr(_) : new Z(0)
654
+ const v = _(t.clearColor, "clearColor");
655
+ v && a.value.setClearColor(
656
+ v ? hr(v) : new Z(0)
654
657
  // default clear color is not easily/efficiently retrievable from three
655
658
  );
656
- }), J(() => {
659
+ }), K(() => {
657
660
  a.value.dispose(), a.value.forceContextLoss();
658
661
  }), {
659
662
  renderer: a
660
663
  };
661
664
  }
662
665
  function vr(e, t, n = 10) {
663
- const r = A(e) ? sn() : an(K(() => A(t).parentElement)), s = we(Ne(r.width, n)), l = we(Ne(r.height, n)), i = K(() => s.value / l.value);
666
+ const r = A(e) ? sn() : an(q(() => A(t).parentElement)), o = we(Ne(r.width, n)), l = we(Ne(r.height, n)), s = q(() => o.value / l.value);
664
667
  return {
665
668
  height: l,
666
- width: s,
667
- aspectRatio: i
669
+ width: o,
670
+ aspectRatio: s
668
671
  };
669
672
  }
670
673
  const yr = (e, t) => {
671
- const n = K(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = ln({ target: n });
672
- let i = 0;
673
- const { width: a, height: c, top: o, left: f } = cn(n), y = ({ x: m, y: S }) => {
674
+ const n = q(() => t.renderer.value.domElement), r = $([]), { x: o, y: l } = ln({ target: n });
675
+ let s = 0;
676
+ const { width: a, height: c, top: i, left: f } = cn(n), g = ({ x: h, y: T }) => {
674
677
  if (n.value)
675
678
  return {
676
- x: (m - f.value) / a.value * 2 - 1,
677
- y: -((S - o.value) / c.value) * 2 + 1
679
+ x: (h - f.value) / a.value * 2 - 1,
680
+ y: -((T - i.value) / c.value) * 2 + 1
678
681
  };
679
- }, u = ({ x: m, y: S }) => {
682
+ }, u = ({ x: h, y: T }) => {
680
683
  if (t.camera.value)
681
- return t.raycaster.value.setFromCamera(new ve(m, S), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
682
- }, v = (m) => {
683
- const S = y({
684
- x: (m == null ? void 0 : m.clientX) ?? s.value,
685
- y: (m == null ? void 0 : m.clientY) ?? l.value
684
+ return t.raycaster.value.setFromCamera(new ve(h, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
685
+ }, y = (h) => {
686
+ const T = g({
687
+ x: (h == null ? void 0 : h.clientX) ?? o.value,
688
+ y: (h == null ? void 0 : h.clientY) ?? l.value
686
689
  });
687
- return S ? u(S) || [] : [];
688
- }, h = D(), g = D(), d = D(), _ = D(), P = D(), C = D(), T = D(), b = D();
689
- function E(m) {
690
- const S = {};
691
- for (const U in m)
692
- typeof U != "function" && (S[U] = m[U]);
693
- return S;
690
+ return T ? u(T) || [] : [];
691
+ }, p = D(), _ = D(), d = D(), v = D(), P = D(), C = D(), w = D(), E = D();
692
+ function S(h) {
693
+ const T = {};
694
+ for (const U in h)
695
+ typeof U != "function" && (T[U] = h[U]);
696
+ return T;
694
697
  }
695
- const M = (m, S) => {
698
+ const M = (h, T) => {
696
699
  var Be, Ie, $e;
697
- const U = E(S), ne = new xe(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
698
- m.trigger({
700
+ const U = S(T), ne = new xe(T == null ? void 0 : T.clientX, T == null ? void 0 : T.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
701
+ h.trigger({
699
702
  ...U,
700
703
  intersections: r.value,
701
704
  // The unprojectedPoint is wrong, math needs to be fixed
702
705
  unprojectedPoint: ne,
703
706
  ray: (Ie = t.raycaster) == null ? void 0 : Ie.value.ray,
704
707
  camera: ($e = t.camera) == null ? void 0 : $e.value,
705
- sourceEvent: S,
706
- delta: i,
708
+ sourceEvent: T,
709
+ delta: s,
707
710
  stopPropagating: !1
708
711
  });
709
712
  };
710
713
  let x;
711
- const p = (m) => {
712
- v(m), M(d, m), x = m;
713
- }, w = () => {
714
- x && p(x);
714
+ const m = (h) => {
715
+ y(h), M(d, h), x = h;
716
+ }, b = () => {
717
+ x && m(x);
715
718
  };
716
- let L, k, R;
717
- const j = (m) => {
718
- var S;
719
- L = (S = r.value[0]) == null ? void 0 : S.object, i = 0, k = new ve(
720
- (m == null ? void 0 : m.clientX) ?? s.value,
721
- (m == null ? void 0 : m.clientY) ?? l.value
722
- ), M(P, m);
719
+ let k, L, R;
720
+ const j = (h) => {
721
+ var T;
722
+ k = (T = r.value[0]) == null ? void 0 : T.object, s = 0, L = new ve(
723
+ (h == null ? void 0 : h.clientX) ?? o.value,
724
+ (h == null ? void 0 : h.clientY) ?? l.value
725
+ ), M(P, h);
723
726
  };
724
- let O, Y = !1;
725
- const Re = (m) => {
726
- var S, U, ne;
727
- m instanceof PointerEvent && (r.value.length === 0 && M(C, m), L === ((S = r.value[0]) == null ? void 0 : S.object) && (R = new ve(
728
- (m == null ? void 0 : m.clientX) ?? s.value,
729
- (m == null ? void 0 : m.clientY) ?? l.value
730
- ), i = k == null ? void 0 : k.distanceTo(R), m.button === 0 ? (M(h, m), O === ((U = r.value[0]) == null ? void 0 : U.object) ? Y = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, Y = !1)) : m.button === 2 && M(T, m)), M(_, m));
731
- }, Oe = (m) => {
732
- Y && (M(g, m), O = void 0, Y = !1);
733
- }, De = (m) => M(d, m), je = (m) => M(b, m);
734
- return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", p), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Oe), n.value.addEventListener("wheel", je), J(() => {
735
- n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", p), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Oe), n.value.removeEventListener("wheel", je));
727
+ let O, V = !1;
728
+ const Re = (h) => {
729
+ var T, U, ne;
730
+ h instanceof PointerEvent && (r.value.length === 0 && M(C, h), k === ((T = r.value[0]) == null ? void 0 : T.object) && (R = new ve(
731
+ (h == null ? void 0 : h.clientX) ?? o.value,
732
+ (h == null ? void 0 : h.clientY) ?? l.value
733
+ ), s = L == null ? void 0 : L.distanceTo(R), h.button === 0 ? (M(p, h), O === ((U = r.value[0]) == null ? void 0 : U.object) ? V = !0 : (O = (ne = r.value[0]) == null ? void 0 : ne.object, V = !1)) : h.button === 2 && M(w, h)), M(v, h));
734
+ }, Oe = (h) => {
735
+ V && (M(_, h), O = void 0, V = !1);
736
+ }, De = (h) => M(d, h), je = (h) => M(E, h);
737
+ return n.value.addEventListener("pointerup", Re), n.value.addEventListener("pointerdown", j), n.value.addEventListener("pointermove", m), n.value.addEventListener("pointerleave", De), n.value.addEventListener("dblclick", Oe), n.value.addEventListener("wheel", je), K(() => {
738
+ n != null && n.value && (n.value.removeEventListener("pointerup", Re), n.value.removeEventListener("pointerdown", j), n.value.removeEventListener("pointermove", m), n.value.removeEventListener("pointerleave", De), n.value.removeEventListener("dblclick", Oe), n.value.removeEventListener("wheel", je));
736
739
  }), {
737
740
  intersects: r,
738
- onClick: (m) => h.on(m).off,
739
- onDblClick: (m) => g.on(m).off,
740
- onContextMenu: (m) => T.on(m).off,
741
- onPointerMove: (m) => d.on(m).off,
742
- onPointerUp: (m) => _.on(m).off,
743
- onPointerDown: (m) => P.on(m).off,
744
- onPointerMissed: (m) => C.on(m).off,
745
- onWheel: (m) => b.on(m).off,
746
- forceUpdate: w
741
+ onClick: (h) => p.on(h).off,
742
+ onDblClick: (h) => _.on(h).off,
743
+ onContextMenu: (h) => w.on(h).off,
744
+ onPointerMove: (h) => d.on(h).off,
745
+ onPointerUp: (h) => v.on(h).off,
746
+ onPointerDown: (h) => P.on(h).off,
747
+ onPointerMissed: (h) => C.on(h).off,
748
+ onWheel: (h) => E.on(h).off,
749
+ forceUpdate: b
747
750
  };
748
751
  };
749
752
  function _e(e, t) {
@@ -754,104 +757,104 @@ function _e(e, t) {
754
757
  }
755
758
  function _r(e, t, n) {
756
759
  var x;
757
- const r = $(), s = $();
758
- e && (r.value = e), t && (s.value = t);
759
- const l = (p) => {
760
- var w;
761
- return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
762
- }, i = (p) => {
763
- var w;
764
- return ((w = p.children) == null ? void 0 : w.some((L) => i(L))) || l(p);
765
- }, a = $(((x = r.value) == null ? void 0 : x.children).filter(i) || []);
766
- function c(p, w) {
767
- const L = [], k = () => w.stopPropagating = !0;
768
- w.stopPropagation = k;
769
- for (const R of w == null ? void 0 : w.intersections) {
770
- if (w.stopPropagating)
760
+ const r = $(), o = $();
761
+ e && (r.value = e), t && (o.value = t);
762
+ const l = (m) => {
763
+ var b;
764
+ return ((b = m.__tres) == null ? void 0 : b.eventCount) > 0;
765
+ }, s = (m) => {
766
+ var b;
767
+ return ((b = m.children) == null ? void 0 : b.some((k) => s(k))) || l(m);
768
+ }, a = $(((x = r.value) == null ? void 0 : x.children).filter(s) || []);
769
+ function c(m, b) {
770
+ const k = [], L = () => b.stopPropagating = !0;
771
+ b.stopPropagation = L;
772
+ for (const R of b == null ? void 0 : b.intersections) {
773
+ if (b.stopPropagating)
771
774
  return;
772
- w = { ...w, ...R };
775
+ b = { ...b, ...R };
773
776
  const { object: j } = R;
774
- w.eventObject = j, _e(j[p], w), L.push(j);
777
+ b.eventObject = j, _e(j[m], b), k.push(j);
775
778
  let O = j.parent;
776
- for (; O !== null && !w.stopPropagating && !L.includes(O); )
777
- w.eventObject = O, _e(O[p], w), L.push(O), O = O.parent;
778
- const Y = Vn(p.slice(2));
779
- n(Y, { intersection: R, event: w });
779
+ for (; O !== null && !b.stopPropagating && !k.includes(O); )
780
+ b.eventObject = O, _e(O[m], b), k.push(O), O = O.parent;
781
+ const V = Vn(m.slice(2));
782
+ n(V, { intersection: R, event: b });
780
783
  }
781
784
  }
782
785
  const {
783
- onClick: o,
786
+ onClick: i,
784
787
  onDblClick: f,
785
- onContextMenu: y,
788
+ onContextMenu: g,
786
789
  onPointerMove: u,
787
- onPointerDown: v,
788
- onPointerUp: h,
789
- onPointerMissed: g,
790
+ onPointerDown: y,
791
+ onPointerUp: p,
792
+ onPointerMissed: _,
790
793
  onWheel: d,
791
- forceUpdate: _
794
+ forceUpdate: v
792
795
  } = yr(a, t);
793
- h((p) => c("onPointerUp", p)), v((p) => c("onPointerDown", p)), o((p) => c("onClick", p)), f((p) => c("onDoubleClick", p)), y((p) => c("onContextMenu", p)), d((p) => c("onWheel", p));
796
+ p((m) => c("onPointerUp", m)), y((m) => c("onPointerDown", m)), i((m) => c("onClick", m)), f((m) => c("onDoubleClick", m)), g((m) => c("onContextMenu", m)), d((m) => c("onWheel", m));
794
797
  let P = [];
795
- u((p) => {
796
- const w = p.intersections.map(({ object: k }) => k), L = p.intersections;
797
- P.forEach(({ object: k }) => {
798
- w.includes(k) || (p.intersections = P, c("onPointerLeave", p), c("onPointerOut", p));
799
- }), p.intersections = L, p.intersections.forEach(({ object: k }) => {
800
- P.includes(k) || (c("onPointerEnter", p), c("onPointerOver", p));
801
- }), c("onPointerMove", p), P = p.intersections;
798
+ u((m) => {
799
+ const b = m.intersections.map(({ object: L }) => L), k = m.intersections;
800
+ P.forEach(({ object: L }) => {
801
+ b.includes(L) || (m.intersections = P, c("onPointerLeave", m), c("onPointerOut", m));
802
+ }), m.intersections = k, m.intersections.forEach(({ object: L }) => {
803
+ P.includes(L) || (c("onPointerEnter", m), c("onPointerOver", m));
804
+ }), c("onPointerMove", m), P = m.intersections;
802
805
  });
803
806
  const C = [];
804
- g((p) => {
805
- const w = () => p.stopPropagating = !0;
806
- p.stopPropagation = w, C.forEach((L) => {
807
- p.stopPropagating || (p.eventObject = L, _e(L.onPointerMissed, p));
808
- }), n("pointer-missed", { event: p });
807
+ _((m) => {
808
+ const b = () => m.stopPropagating = !0;
809
+ m.stopPropagation = b, C.forEach((k) => {
810
+ m.stopPropagating || (m.eventObject = k, _e(k.onPointerMissed, m));
811
+ }), n("pointer-missed", { event: m });
809
812
  });
810
- function T(p) {
811
- re(p) && N(p) && a.value.push(p);
813
+ function w(m) {
814
+ re(m) && N(m) && a.value.push(m);
812
815
  }
813
- function b(p) {
814
- if (re(p) && N(p)) {
815
- const w = a.value.indexOf(p);
816
- w > -1 && a.value.splice(w, 1);
816
+ function E(m) {
817
+ if (re(m) && N(m)) {
818
+ const b = a.value.indexOf(m);
819
+ b > -1 && a.value.splice(b, 1);
817
820
  }
818
821
  }
819
- function E(p) {
820
- re(p) && N(p) && p.onPointerMissed && C.push(p);
822
+ function S(m) {
823
+ re(m) && N(m) && m.onPointerMissed && C.push(m);
821
824
  }
822
- function M(p) {
823
- if (re(p) && N(p)) {
824
- const w = C.indexOf(p);
825
- w > -1 && C.splice(w, 1);
825
+ function M(m) {
826
+ if (re(m) && N(m)) {
827
+ const b = C.indexOf(m);
828
+ b > -1 && C.splice(b, 1);
826
829
  }
827
830
  }
828
831
  return t.eventManager = {
829
- forceUpdate: _,
830
- registerObject: T,
831
- deregisterObject: b,
832
- registerPointerMissedObject: E,
832
+ forceUpdate: v,
833
+ registerObject: w,
834
+ deregisterObject: E,
835
+ registerPointerMissedObject: S,
833
836
  deregisterPointerMissedObject: M
834
837
  }, {
835
- forceUpdate: _,
836
- registerObject: T,
837
- deregisterObject: b,
838
- registerPointerMissedObject: E,
838
+ forceUpdate: v,
839
+ registerObject: w,
840
+ deregisterObject: E,
841
+ registerPointerMissedObject: S,
839
842
  deregisterPointerMissedObject: M
840
843
  };
841
844
  }
842
845
  function wr(e, t, n = 100) {
843
846
  n = n <= 0 ? 100 : n;
844
- const r = D(), s = /* @__PURE__ */ new Set();
845
- let l = !1, i = !1, a = null;
847
+ const r = D(), o = /* @__PURE__ */ new Set();
848
+ let l = !1, s = !1, a = null;
846
849
  function c() {
847
- a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((u) => u()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
850
+ a && clearTimeout(a), !s && !l && e() ? (r.trigger(t), o.forEach((u) => u()), o.clear(), l = !0) : !s && !l && (a = setTimeout(c, n));
848
851
  }
849
- function o() {
850
- i = !0, a && clearTimeout(a);
852
+ function i() {
853
+ s = !0, a && clearTimeout(a);
851
854
  }
852
855
  c();
853
- const f = (u, ...v) => {
854
- u(...v);
856
+ const f = (u, ...y) => {
857
+ u(...y);
855
858
  };
856
859
  return {
857
860
  on: (u) => {
@@ -859,13 +862,14 @@ function wr(e, t, n = 100) {
859
862
  return f(u, t), { off: () => {
860
863
  } };
861
864
  {
862
- const v = r.on(u);
863
- return s.add(v.off), r.on(u);
865
+ const y = r.on(u);
866
+ return o.add(y.off), r.on(u);
864
867
  }
865
868
  },
866
869
  off: r.off,
867
870
  trigger: r.trigger,
868
- cancel: o
871
+ clear: r.clear,
872
+ cancel: i
869
873
  };
870
874
  }
871
875
  const ee = /* @__PURE__ */ new WeakMap();
@@ -876,8 +880,8 @@ function yt(e) {
876
880
  if (Date.now() - n >= t)
877
881
  return !0;
878
882
  {
879
- const i = e.renderer.value, a = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
880
- return !!(i && a.width > 0 && a.height > 0);
883
+ const s = e.renderer.value, a = (s == null ? void 0 : s.domElement) || { width: 0, height: 0 };
884
+ return !!(s && a.width > 0 && a.height > 0);
881
885
  }
882
886
  }, e);
883
887
  return ee.set(e, l), l;
@@ -892,42 +896,40 @@ function br({
892
896
  canvas: t,
893
897
  windowSize: n,
894
898
  rendererOptions: r,
895
- emit: s
899
+ emit: o
896
900
  }) {
897
- const l = $(e), i = vr(n, t), {
901
+ const l = $(e), s = vr(n, t), {
898
902
  camera: a,
899
903
  cameras: c,
900
- registerCamera: o,
904
+ registerCamera: i,
901
905
  deregisterCamera: f,
902
- setCameraActive: y
903
- } = ar({ sizes: i, scene: e }), u = {
906
+ setCameraActive: g
907
+ } = ar({ sizes: s }), u = {
904
908
  mode: I(r.renderMode || "always"),
905
909
  priority: I(0),
906
910
  frames: I(0),
907
911
  maxFrames: 60,
908
- canBeInvalidated: K(() => u.mode.value === "on-demand" && u.frames.value === 0)
912
+ canBeInvalidated: q(() => u.mode.value === "on-demand" && u.frames.value === 0)
909
913
  };
910
- function v(R = 1) {
914
+ function y(R = 1) {
911
915
  r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
912
916
  }
913
- function h() {
917
+ function p() {
914
918
  r.renderMode === "manual" && (u.frames.value = 1);
915
919
  }
916
- const { renderer: g } = gr(
920
+ const { renderer: _ } = gr(
917
921
  {
918
- scene: e,
919
922
  canvas: t,
920
923
  options: r,
921
- emit: s,
922
924
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
923
- contextParts: { sizes: i, camera: a, render: u, invalidate: v, advance: h }
925
+ contextParts: { sizes: s, render: u, invalidate: y, advance: p }
924
926
  }
925
927
  ), d = {
926
- sizes: i,
928
+ sizes: s,
927
929
  scene: l,
928
930
  camera: a,
929
931
  cameras: we(c),
930
- renderer: g,
932
+ renderer: _,
931
933
  raycaster: $(new zt()),
932
934
  controls: I(null),
933
935
  perf: {
@@ -943,36 +945,36 @@ function br({
943
945
  }
944
946
  },
945
947
  render: u,
946
- advance: h,
948
+ advance: p,
947
949
  extend: Ee,
948
- invalidate: v,
949
- registerCamera: o,
950
- setCameraActive: y,
950
+ invalidate: y,
951
+ registerCamera: i,
952
+ setCameraActive: g,
951
953
  deregisterCamera: f,
952
954
  loop: dr()
953
955
  };
954
956
  le("useTres", d), d.scene.value.__tres = {
955
957
  root: d
956
958
  }, d.loop.register(() => {
957
- a.value && u.frames.value > 0 && (g.value.render(e, a.value), s("render", d.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
959
+ a.value && u.frames.value > 0 && (_.value.render(e, a.value), o("render", d.renderer.value)), u.priority.value = 0, u.mode.value === "always" ? u.frames.value = 1 : u.frames.value = Math.max(0, u.frames.value - 1);
958
960
  }, "render");
959
- const { on: _, cancel: P } = yt(d);
960
- d.loop.setReady(!1), d.loop.start(), _(() => {
961
- s("ready", d), d.loop.setReady(!0), _r(e, d, s);
962
- }), J(() => {
961
+ const { on: v, cancel: P } = yt(d);
962
+ d.loop.setReady(!1), d.loop.start(), v(() => {
963
+ o("ready", d), d.loop.setReady(!0), _r(e, d, o);
964
+ }), K(() => {
963
965
  P(), d.loop.stop();
964
966
  });
965
- const C = 100, T = un({ every: C }), { isSupported: b, memory: E } = fn({ interval: C }), M = 160;
967
+ const C = 100, w = un({ every: C }), { isSupported: E, memory: S } = fn({ interval: C }), M = 160;
966
968
  let x = performance.now();
967
- const p = ({ timestamp: R }) => {
968
- d.scene.value && (d.perf.memory.allocatedMem = Le(d.scene.value)), R - x >= C && (x = R, d.perf.fps.accumulator.push(T.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = T.value, b.value && E.value && (d.perf.memory.accumulator.push(E.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > M && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((j, O) => j + O, 0) / d.perf.memory.accumulator.length));
969
+ const m = ({ timestamp: R }) => {
970
+ d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), R - x >= C && (x = R, d.perf.fps.accumulator.push(w.value), d.perf.fps.accumulator.length > M && d.perf.fps.accumulator.shift(), d.perf.fps.value = w.value, E.value && S.value && (d.perf.memory.accumulator.push(S.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > M && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((j, O) => j + O, 0) / d.perf.memory.accumulator.length));
969
971
  };
970
- let w = 0;
971
- const L = 1, { pause: k } = ut(({ delta: R }) => {
972
- window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >= L && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
972
+ let b = 0;
973
+ const k = 1, { pause: L } = ut(({ delta: R }) => {
974
+ window.__TRES__DEVTOOLS__ && (m({ timestamp: performance.now() }), b += R, b >= k && (window.__TRES__DEVTOOLS__.cb(d), b = 0));
973
975
  }, { immediate: !0 });
974
- return J(() => {
975
- k();
976
+ return K(() => {
977
+ L();
976
978
  }), d;
977
979
  }
978
980
  function me() {
@@ -988,28 +990,28 @@ function Zr() {
988
990
  scene: t,
989
991
  renderer: n,
990
992
  loop: r,
991
- raycaster: s,
993
+ raycaster: o,
992
994
  controls: l,
993
- invalidate: i,
995
+ invalidate: s,
994
996
  advance: a
995
997
  } = me();
996
998
  r.setContext({
997
999
  camera: e,
998
1000
  scene: t,
999
1001
  renderer: n,
1000
- raycaster: s,
1002
+ raycaster: o,
1001
1003
  controls: l,
1002
- invalidate: i,
1004
+ invalidate: s,
1003
1005
  advance: a
1004
1006
  });
1005
- function c(y, u = 0) {
1006
- return r.register(y, "before", u);
1007
+ function c(g, u = 0) {
1008
+ return r.register(g, "before", u);
1007
1009
  }
1008
- function o(y) {
1009
- return r.register(y, "render");
1010
+ function i(g) {
1011
+ return r.register(g, "render");
1010
1012
  }
1011
- function f(y, u = 0) {
1012
- return r.register(y, "after", u);
1013
+ function f(g, u = 0) {
1014
+ return r.register(g, "after", u);
1013
1015
  }
1014
1016
  return {
1015
1017
  pause: r.pause,
@@ -1018,77 +1020,78 @@ function Zr() {
1018
1020
  resumeRender: r.resumeRender,
1019
1021
  isActive: r.isActive,
1020
1022
  onBeforeRender: c,
1021
- render: o,
1023
+ render: i,
1022
1024
  onAfterRender: f
1023
1025
  };
1024
1026
  }
1025
- const _t = D(), wt = D(), ke = D(), te = new lt();
1027
+ const _t = D(), wt = D(), Le = D(), te = new lt();
1026
1028
  let ce = 0, ue = 0;
1027
1029
  const { pause: Mr, resume: Je, isActive: Pr } = ut(
1028
1030
  () => {
1029
- _t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), ke.trigger({ delta: ce, elapsed: ue, clock: te });
1031
+ _t.trigger({ delta: ce, elapsed: ue, clock: te }), wt.trigger({ delta: ce, elapsed: ue, clock: te }), Le.trigger({ delta: ce, elapsed: ue, clock: te });
1030
1032
  },
1031
1033
  { immediate: !1 }
1032
1034
  );
1033
- ke.on(() => {
1035
+ Le.on(() => {
1034
1036
  ce = te.getDelta(), ue = te.getElapsedTime();
1035
1037
  });
1036
1038
  let Qe = !1;
1037
1039
  const eo = () => (Qe || (Qe = !0, Je()), {
1038
1040
  onBeforeLoop: _t.on,
1039
1041
  onLoop: wt.on,
1040
- onAfterLoop: ke.on,
1042
+ onAfterLoop: Le.on,
1041
1043
  pause: Mr,
1042
1044
  resume: Je,
1043
1045
  isActive: Pr
1044
1046
  });
1045
1047
  function to() {
1046
- const { logWarning: e } = V();
1047
- function t(l, i, a) {
1048
+ const { logWarning: e } = Q();
1049
+ function t(l, s, a) {
1048
1050
  let c = null;
1049
- return l.traverse((o) => {
1050
- o[i] === a && (c = o);
1051
- }), c || e(`Child with ${i} '${a}' not found.`), c;
1051
+ return l.traverse((i) => {
1052
+ i[s] === a && (c = i);
1053
+ }), c || e(`Child with ${s} '${a}' not found.`), c;
1052
1054
  }
1053
- function n(l, i, a) {
1055
+ function n(l, s, a) {
1054
1056
  const c = [];
1055
- return l.traverse((o) => {
1056
- o[i].includes(a) && c.push(o);
1057
- }), c.length || e(`Children with ${i} '${a}' not found.`), c;
1057
+ return l.traverse((i) => {
1058
+ i[s].includes(a) && c.push(i);
1059
+ }), c.length || e(`Children with ${s} '${a}' not found.`), c;
1058
1060
  }
1059
- function r(l, i) {
1060
- return t(l, "name", i);
1061
+ function r(l, s) {
1062
+ return t(l, "name", s);
1061
1063
  }
1062
- function s(l, i) {
1063
- return n(l, "name", i);
1064
+ function o(l, s) {
1065
+ return n(l, "name", s);
1064
1066
  }
1065
1067
  return {
1066
1068
  seek: t,
1067
1069
  seekByName: r,
1068
1070
  seekAll: n,
1069
- seekAllByName: s
1071
+ seekAllByName: o
1070
1072
  };
1071
1073
  }
1072
1074
  function Cr(e, t = {}, n = {}) {
1073
1075
  let r = e;
1074
- const s = (a) => {
1076
+ const o = (a) => {
1075
1077
  r = a;
1076
1078
  };
1077
1079
  let l = new Proxy({}, {});
1078
- const i = {
1080
+ const s = {
1079
1081
  has(a, c) {
1080
1082
  return c in t || c in r;
1081
1083
  },
1082
- get(a, c, o) {
1084
+ get(a, c, i) {
1083
1085
  return c in t ? t[c](r) : r[c];
1084
1086
  },
1085
- set(a, c, o) {
1086
- return n[c] ? n[c](o, r, l, s) : r[c] = o, !0;
1087
+ set(a, c, i) {
1088
+ const f = n[c];
1089
+ return f && typeof f == "function" ? f(i, r, l, o) : r[c] = i, !0;
1087
1090
  }
1088
1091
  };
1089
- return l = new Proxy({}, i), l;
1092
+ return l = new Proxy({}, s), l;
1090
1093
  }
1091
- const { logError: Xe } = V(), Ze = [
1094
+ const { logError: Xe } = Q(), Ze = [
1092
1095
  "onClick",
1093
1096
  "onContextMenu",
1094
1097
  "onPointerMove",
@@ -1105,140 +1108,140 @@ const { logError: Xe } = V(), Ze = [
1105
1108
  "onWheel"
1106
1109
  ], Er = (e) => {
1107
1110
  const t = e.scene.value;
1108
- function n(o, f, y, u) {
1109
- if (u || (u = {}), u.args || (u.args = []), o === "template" || zn(o))
1111
+ function n(i, f, g, u) {
1112
+ if (u || (u = {}), u.args || (u.args = []), i === "template" || zn(i))
1110
1113
  return null;
1111
- let v = o.replace("Tres", ""), h;
1112
- if (o === "primitive") {
1114
+ let y = i.replace("Tres", ""), p;
1115
+ if (i === "primitive") {
1113
1116
  (!H(u.object) || At(u.object)) && Xe(
1114
1117
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1115
- ), v = u.object.type;
1116
- const g = {};
1117
- h = Cr(
1118
+ ), y = u.object.type;
1119
+ const _ = {};
1120
+ p = Cr(
1118
1121
  u.object,
1119
1122
  {
1120
- object: (_) => _,
1123
+ object: (v) => v,
1121
1124
  isPrimitive: () => !0,
1122
- __tres: () => g
1125
+ __tres: () => _
1123
1126
  },
1124
1127
  {
1125
- object: (_, P, C, T) => {
1126
- sr(_, C, T, { patchProp: l, remove: s, insert: r }, e);
1128
+ object: (v, P, C, w) => {
1129
+ sr(v, C, w, { patchProp: l, remove: o, insert: r }, e);
1127
1130
  },
1128
- __tres: (_) => {
1129
- Object.assign(g, _);
1131
+ __tres: (v) => {
1132
+ Object.assign(_, v);
1130
1133
  }
1131
1134
  }
1132
1135
  );
1133
1136
  } else {
1134
- const g = Ce.value[v];
1135
- g || Xe(
1136
- `${v} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1137
- ), h = new g(...u.args);
1137
+ const _ = Ce.value[y];
1138
+ _ || Xe(
1139
+ `${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1140
+ ), p = new _(...u.args);
1138
1141
  }
1139
- return h ? (h.isCamera && (u != null && u.position || h.position.set(3, 3, 3), u != null && u.lookAt || h.lookAt(0, 0, 0)), h = z(h, {
1140
- ...h.__tres,
1141
- type: v,
1142
+ return p ? (p.isCamera && (u != null && u.position || p.position.set(3, 3, 3), u != null && u.lookAt || p.lookAt(0, 0, 0)), p = z(p, {
1143
+ ...p.__tres,
1144
+ type: y,
1142
1145
  memoizedProps: u,
1143
1146
  eventCount: 0,
1144
- primitive: o === "primitive",
1147
+ primitive: i === "primitive",
1145
1148
  attach: u.attach
1146
- }, e), h) : null;
1149
+ }, e), p) : null;
1147
1150
  }
1148
- function r(o, f) {
1149
- var v, h, g;
1150
- if (!o)
1151
+ function r(i, f) {
1152
+ var y, p, _;
1153
+ if (!i)
1151
1154
  return;
1152
1155
  f = f || t;
1153
- const y = o.__tres ? o : z(o, {}, e), u = f.__tres ? f : z(f, {}, e);
1154
- o = Q(y), f = Q(u), o.__tres && ((v = o.__tres) == null ? void 0 : v.eventCount) > 0 && ((h = e.eventManager) == null || h.registerObject(o)), e.registerCamera(o), (g = e.eventManager) == null || g.registerPointerMissedObject(o), y.__tres.attach ? nr(u, y, y.__tres.attach) : N(o) && N(u) && (u.add(o), o.dispatchEvent({ type: "added" })), y.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(y) && u.__tres.objects.push(y);
1156
+ const g = i.__tres ? i : z(i, {}, e), u = f.__tres ? f : z(f, {}, e);
1157
+ i = J(g), f = J(u), i.__tres && ((y = i.__tres) == null ? void 0 : y.eventCount) > 0 && ((p = e.eventManager) == null || p.registerObject(i)), e.registerCamera(i), (_ = e.eventManager) == null || _.registerPointerMissedObject(i), g.__tres.attach ? nr(u, g, g.__tres.attach) : N(i) && N(u) && (u.add(i), i.dispatchEvent({ type: "added" })), g.__tres.parent = u, u.__tres.objects && !u.__tres.objects.includes(g) && u.__tres.objects.push(g);
1155
1158
  }
1156
- function s(o, f) {
1157
- var h, g, d, _;
1158
- if (!o)
1159
+ function o(i, f) {
1160
+ var p, _, d, v;
1161
+ if (!i)
1159
1162
  return;
1160
- o != null && o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.deregisterObject(o)), f = Me(f) ? "default" : f;
1161
- const y = (d = o.__tres) == null ? void 0 : d.dispose;
1162
- Me(y) || (y === null ? f = !1 : f = y);
1163
- const u = (_ = o.__tres) == null ? void 0 : _.primitive, v = f === "default" ? !u : !!f;
1164
- if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((P) => s(P, f)), v && o.children && [...o.children].forEach((P) => s(P, f)), gt(o, e), vt(o, e), v && !Fn(o)) {
1163
+ i != null && i.__tres && ((p = i.__tres) == null ? void 0 : p.eventCount) > 0 && ((_ = e.eventManager) == null || _.deregisterObject(i)), f = Me(f) ? "default" : f;
1164
+ const g = (d = i.__tres) == null ? void 0 : d.dispose;
1165
+ Me(g) || (g === null ? f = !1 : f = g);
1166
+ const u = (v = i.__tres) == null ? void 0 : v.primitive, y = f === "default" ? !u : !!f;
1167
+ if (i.__tres && "objects" in i.__tres && [...i.__tres.objects].forEach((P) => o(P, f)), y && i.children && [...i.children].forEach((P) => o(P, f)), gt(i, e), vt(i, e), y && !Fn(i)) {
1165
1168
  if (G(f))
1166
- f(o);
1167
- else if (G(o.dispose))
1169
+ f(i);
1170
+ else if (G(i.dispose))
1168
1171
  try {
1169
- o.dispose();
1172
+ i.dispose();
1170
1173
  } catch {
1171
1174
  }
1172
1175
  }
1173
- "__tres" in o && delete o.__tres;
1176
+ "__tres" in i && delete i.__tres;
1174
1177
  }
1175
- function l(o, f, y, u) {
1178
+ function l(i, f, g, u) {
1176
1179
  var P, C;
1177
- if (!o)
1180
+ if (!i)
1178
1181
  return;
1179
- let v = o, h = f;
1180
- if (o.__tres && (o.__tres.memoizedProps[f] = u), f === "attach") {
1181
- const T = ((P = o.__tres) == null ? void 0 : P.parent) || o.parent;
1182
- s(o), z(o, { attach: u }, e), T && r(o, T);
1182
+ let y = i, p = f;
1183
+ if (i.__tres && (i.__tres.memoizedProps[f] = u), f === "attach") {
1184
+ const w = ((P = i.__tres) == null ? void 0 : P.parent) || i.parent;
1185
+ o(i), z(i, { attach: u }, e), w && r(i, w);
1183
1186
  return;
1184
1187
  }
1185
1188
  if (f === "dispose") {
1186
- o.__tres || (o = z(o, {}, e)), o.__tres.dispose = u;
1189
+ i.__tres || (i = z(i, {}, e)), i.__tres.dispose = u;
1187
1190
  return;
1188
1191
  }
1189
- if (N(o) && h === "blocks-pointer-events") {
1190
- u || u === "" ? o[h] = u : delete o[h];
1192
+ if (N(i) && p === "blocks-pointer-events") {
1193
+ u || u === "" ? i[p] = u : delete i[p];
1191
1194
  return;
1192
1195
  }
1193
- Ze.includes(f) && o.__tres && (o.__tres.eventCount += 1);
1194
- let g = oe(h), d = v == null ? void 0 : v[g];
1195
- if (h === "args") {
1196
- const T = o, b = y ?? [], E = u ?? [], M = ((C = o.__tres) == null ? void 0 : C.type) || o.type;
1197
- M && b.length && !Kn(b, E) && (v = Object.assign(
1198
- T,
1196
+ Ze.includes(f) && i.__tres && (i.__tres.eventCount += 1);
1197
+ let _ = oe(p), d = y == null ? void 0 : y[_];
1198
+ if (p === "args") {
1199
+ const w = i, E = g ?? [], S = u ?? [], M = ((C = i.__tres) == null ? void 0 : C.type) || i.type;
1200
+ M && E.length && !Kn(E, S) && (y = Object.assign(
1201
+ w,
1199
1202
  new Ce.value[M](...u)
1200
1203
  ));
1201
1204
  return;
1202
1205
  }
1203
- if (v.type === "BufferGeometry") {
1204
- if (h === "args")
1206
+ if (y.type === "BufferGeometry") {
1207
+ if (p === "args")
1205
1208
  return;
1206
- v.setAttribute(
1207
- oe(h),
1208
- new Gt(...u)
1209
+ y.setAttribute(
1210
+ oe(p),
1211
+ new Vt(...u)
1209
1212
  );
1210
1213
  return;
1211
1214
  }
1212
- if (h.includes("-") && d === void 0) {
1213
- const T = h.split("-");
1214
- d = T.reduce((b, E) => b[oe(E)], v), h = T.pop(), g = h, d != null && d.set || (v = T.reduce((b, E) => b[oe(E)], v));
1215
+ if (p.includes("-") && d === void 0) {
1216
+ const w = p.split("-");
1217
+ d = w.reduce((E, S) => E[oe(S)], y), p = w.pop(), _ = p, d != null && d.set || (y = w.reduce((E, S) => E[oe(S)], y));
1215
1218
  }
1216
- let _ = u;
1217
- if (_ === "" && (_ = !0), G(d)) {
1218
- Ze.includes(f) || (de(_) ? o[g](..._) : o[g](_)), g.startsWith("on") && G(_) && (v[g] = _);
1219
+ let v = u;
1220
+ if (v === "" && (v = !0), G(d)) {
1221
+ Ze.includes(f) || (de(v) ? i[_](...v) : i[_](v)), _.startsWith("on") && G(v) && (y[_] = v);
1219
1222
  return;
1220
1223
  }
1221
- !(d != null && d.set) && !G(d) ? v[g] = _ : d.constructor === _.constructor && (d != null && d.copy) ? d == null || d.copy(_) : de(_) ? d.set(..._) : !d.isColor && d.setScalar ? d.setScalar(_) : d.set(_), ht(o);
1224
+ !(d != null && d.set) && !G(d) ? y[_] = v : d.constructor === v.constructor && (d != null && d.copy) ? d == null || d.copy(v) : de(v) ? d.set(...v) : !d.isColor && d.setScalar ? d.setScalar(v) : d.set(v), ht(i);
1222
1225
  }
1223
- function i(o) {
1226
+ function s(i) {
1224
1227
  var f;
1225
- return ((f = o == null ? void 0 : o.__tres) == null ? void 0 : f.parent) || null;
1228
+ return ((f = i == null ? void 0 : i.__tres) == null ? void 0 : f.parent) || null;
1226
1229
  }
1227
- function a(o) {
1228
- const f = z(new Vt(), { type: "Comment" }, e);
1229
- return f.name = o, f;
1230
+ function a(i) {
1231
+ const f = z(new Gt(), { type: "Comment" }, e);
1232
+ return f.name = i, f;
1230
1233
  }
1231
- function c(o) {
1232
- var v;
1233
- const f = i(o), y = ((v = f == null ? void 0 : f.__tres) == null ? void 0 : v.objects) || [], u = y.indexOf(o);
1234
- return u < 0 || u >= y.length - 1 ? null : y[u + 1];
1234
+ function c(i) {
1235
+ var y;
1236
+ const f = s(i), g = ((y = f == null ? void 0 : f.__tres) == null ? void 0 : y.objects) || [], u = g.indexOf(i);
1237
+ return u < 0 || u >= g.length - 1 ? null : g[u + 1];
1235
1238
  }
1236
1239
  return {
1237
1240
  insert: r,
1238
- remove: s,
1241
+ remove: o,
1239
1242
  createElement: n,
1240
1243
  patchProp: l,
1241
- parentNode: i,
1244
+ parentNode: s,
1242
1245
  createText: () => void 0,
1243
1246
  createComment: a,
1244
1247
  setText: () => void 0,
@@ -1257,27 +1260,27 @@ function bt() {
1257
1260
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1258
1261
  }
1259
1262
  const Sr = typeof Proxy == "function", Ar = "devtools-plugin:setup", xr = "plugin:settings:set";
1260
- let q, Te;
1261
- function Lr() {
1263
+ let Y, Te;
1264
+ function kr() {
1262
1265
  var e;
1263
- return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Te = globalThis.perf_hooks.performance) : q = !1), q;
1266
+ return Y !== void 0 || (typeof window < "u" && window.performance ? (Y = !0, Te = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (Y = !0, Te = globalThis.perf_hooks.performance) : Y = !1), Y;
1264
1267
  }
1265
- function kr() {
1266
- return Lr() ? Te.now() : Date.now();
1268
+ function Lr() {
1269
+ return kr() ? Te.now() : Date.now();
1267
1270
  }
1268
1271
  class Rr {
1269
1272
  constructor(t, n) {
1270
1273
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1271
1274
  const r = {};
1272
1275
  if (t.settings)
1273
- for (const i in t.settings) {
1274
- const a = t.settings[i];
1275
- r[i] = a.defaultValue;
1276
+ for (const s in t.settings) {
1277
+ const a = t.settings[s];
1278
+ r[s] = a.defaultValue;
1276
1279
  }
1277
- const s = `__vue-devtools-plugin-settings__${t.id}`;
1280
+ const o = `__vue-devtools-plugin-settings__${t.id}`;
1278
1281
  let l = Object.assign({}, r);
1279
1282
  try {
1280
- const i = localStorage.getItem(s), a = JSON.parse(i);
1283
+ const s = localStorage.getItem(o), a = JSON.parse(s);
1281
1284
  Object.assign(l, a);
1282
1285
  } catch {
1283
1286
  }
@@ -1285,36 +1288,36 @@ class Rr {
1285
1288
  getSettings() {
1286
1289
  return l;
1287
1290
  },
1288
- setSettings(i) {
1291
+ setSettings(s) {
1289
1292
  try {
1290
- localStorage.setItem(s, JSON.stringify(i));
1293
+ localStorage.setItem(o, JSON.stringify(s));
1291
1294
  } catch {
1292
1295
  }
1293
- l = i;
1296
+ l = s;
1294
1297
  },
1295
1298
  now() {
1296
- return kr();
1299
+ return Lr();
1297
1300
  }
1298
- }, n && n.on(xr, (i, a) => {
1299
- i === this.plugin.id && this.fallbacks.setSettings(a);
1301
+ }, n && n.on(xr, (s, a) => {
1302
+ s === this.plugin.id && this.fallbacks.setSettings(a);
1300
1303
  }), this.proxiedOn = new Proxy({}, {
1301
- get: (i, a) => this.target ? this.target.on[a] : (...c) => {
1304
+ get: (s, a) => this.target ? this.target.on[a] : (...c) => {
1302
1305
  this.onQueue.push({
1303
1306
  method: a,
1304
1307
  args: c
1305
1308
  });
1306
1309
  }
1307
1310
  }), this.proxiedTarget = new Proxy({}, {
1308
- get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...c) => (this.targetQueue.push({
1311
+ get: (s, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...c) => (this.targetQueue.push({
1309
1312
  method: a,
1310
1313
  args: c,
1311
1314
  resolve: () => {
1312
1315
  }
1313
- }), this.fallbacks[a](...c)) : (...c) => new Promise((o) => {
1316
+ }), this.fallbacks[a](...c)) : (...c) => new Promise((i) => {
1314
1317
  this.targetQueue.push({
1315
1318
  method: a,
1316
1319
  args: c,
1317
- resolve: o
1320
+ resolve: i
1318
1321
  });
1319
1322
  })
1320
1323
  });
@@ -1328,16 +1331,16 @@ class Rr {
1328
1331
  }
1329
1332
  }
1330
1333
  function Or(e, t) {
1331
- const n = e, r = bt(), s = Tr(), l = Sr && n.enableEarlyProxy;
1332
- if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1333
- s.emit(Ar, e, t);
1334
+ const n = e, r = bt(), o = Tr(), l = Sr && n.enableEarlyProxy;
1335
+ if (o && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1336
+ o.emit(Ar, e, t);
1334
1337
  else {
1335
- const i = l ? new Rr(n, s) : null;
1338
+ const s = l ? new Rr(n, o) : null;
1336
1339
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1337
1340
  pluginDescriptor: n,
1338
1341
  setupFn: t,
1339
- proxy: i
1340
- }), i && t(i.proxiedTarget);
1342
+ proxy: s
1343
+ }), s && t(s.proxiedTarget);
1341
1344
  }
1342
1345
  }
1343
1346
  function Dr(e, t) {
@@ -1359,7 +1362,7 @@ const Mt = (e) => {
1359
1362
  textColor: 5750629,
1360
1363
  backgroundColor: 15793395
1361
1364
  });
1362
- const n = Le(e);
1365
+ const n = ke(e);
1363
1366
  return n > 0 && t.tags.push({
1364
1367
  label: `${pr(n)} KB`,
1365
1368
  textColor: 15707189,
@@ -1391,8 +1394,8 @@ function Pt(e, t, n = "") {
1391
1394
  e.children.forEach((r) => {
1392
1395
  if (r.type === "HightlightMesh" || n && !r.type.includes(n) && !r.name.includes(n))
1393
1396
  return;
1394
- const s = Mt(r);
1395
- t.children.push(s), Pt(r, s, n);
1397
+ const o = Mt(r);
1398
+ t.children.push(o), Pt(r, o, n);
1396
1399
  });
1397
1400
  }
1398
1401
  const jr = [], X = "tres:inspector", Br = Se({
@@ -1423,39 +1426,46 @@ function Ir(e, t) {
1423
1426
  n.notifyComponentUpdate();
1424
1427
  }, 5e3), n.on.getInspectorTree((l) => {
1425
1428
  if (l.inspectorId === X) {
1426
- const i = Mt(t.scene.value);
1427
- Pt(t.scene.value, i, l.filter), Br.sceneGraph = i, l.rootNodes = [i];
1429
+ const s = Mt(t.scene.value);
1430
+ Pt(t.scene.value, s, l.filter), Br.sceneGraph = s, l.rootNodes = [s];
1428
1431
  }
1429
1432
  });
1430
- let r = null, s = null;
1433
+ let r = null, o = null;
1431
1434
  n.on.getInspectorState((l) => {
1432
- var i;
1435
+ var s;
1433
1436
  if (l.inspectorId === X) {
1434
1437
  const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1435
1438
  if (!a)
1436
1439
  return;
1437
- if (s && r && r.parent && s.remove(r), a.isMesh) {
1440
+ if (o && r && r.parent && o.remove(r), a.isMesh) {
1438
1441
  const c = Xn(a);
1439
- a.add(c), r = c, s = a;
1442
+ a.add(c), r = c, o = a;
1440
1443
  }
1441
1444
  l.state = {
1442
- object: Object.entries(a).map(([c, o]) => c === "children" ? { key: c, value: o.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: o, editable: !0 }).filter(({ key: c }) => c !== "parent")
1443
- }, a.isScene && (l.state.info = {
1444
- objects: a.children.length,
1445
- memory: Le(a),
1446
- calls: t.renderer.value.info.render.calls,
1447
- triangles: t.renderer.value.info.render.triangles,
1448
- points: t.renderer.value.info.render.points,
1449
- lines: t.renderer.value.info.render.lines
1450
- }, l.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
1451
- key: c.name,
1452
- value: {
1453
- ...c,
1454
- vertexShader: c.vertexShader,
1455
- attributes: c.getAttributes(),
1456
- uniforms: c.getUniforms()
1457
- }
1458
- }))) || []);
1445
+ object: Object.entries(a).map(([c, i]) => c === "children" ? { key: c, value: i.filter((f) => f.type !== "HightlightMesh") } : { key: c, value: i, editable: !0 }).filter(({ key: c }) => c !== "parent")
1446
+ }, a.isScene && (l.state = {
1447
+ ...l.state,
1448
+ state: [
1449
+ {
1450
+ key: "Scene Info",
1451
+ value: {
1452
+ objects: a.children.length,
1453
+ memory: ke(a),
1454
+ calls: t.renderer.value.info.render.calls,
1455
+ triangles: t.renderer.value.info.render.triangles,
1456
+ points: t.renderer.value.info.render.points,
1457
+ lines: t.renderer.value.info.render.lines
1458
+ }
1459
+ },
1460
+ {
1461
+ key: "Programs",
1462
+ value: ((s = t.renderer.value.info.programs) == null ? void 0 : s.map((c) => ({
1463
+ ...c,
1464
+ programName: c.name
1465
+ }))) || []
1466
+ }
1467
+ ]
1468
+ });
1459
1469
  }
1460
1470
  }), n.on.editInspectorState((l) => {
1461
1471
  l.inspectorId === X && Qn(t.scene.value, l.nodeId, l.path, l.state.value);
@@ -1509,83 +1519,81 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
1509
1519
  "ready"
1510
1520
  ],
1511
1521
  setup(e, { expose: t, emit: n }) {
1512
- const r = e, s = n, l = xt(), { logWarning: i } = V(), a = I(), c = $(new st()), o = He();
1522
+ const r = e, o = n, l = xt(), s = I(), a = $(new st()), c = He();
1513
1523
  Ee(ot);
1514
- const f = (g, d = !1) => fe({
1524
+ const i = (p, _ = !1) => fe({
1515
1525
  setup() {
1516
- var T;
1517
- const _ = (T = He()) == null ? void 0 : T.appContext;
1518
- _ && (_.app = o == null ? void 0 : o.appContext.app);
1519
- const P = {};
1520
- function C(b) {
1521
- b && (b.parent && C(b.parent), b.provides && Object.assign(P, b.provides));
1526
+ var C;
1527
+ const d = (C = He()) == null ? void 0 : C.appContext;
1528
+ d && (d.app = c == null ? void 0 : c.appContext.app);
1529
+ const v = {};
1530
+ function P(w) {
1531
+ w && (w.parent && P(w.parent), w.provides && Object.assign(v, w.provides));
1522
1532
  }
1523
- return o != null && o.parent && r.enableProvideBridge && (C(o.parent), Reflect.ownKeys(P).forEach((b) => {
1524
- le(b, P[b]);
1525
- })), le("useTres", g), le("extend", Ee), typeof window < "u" && Ir(_ == null ? void 0 : _.app, g), () => Ue(Bt, null, d ? [] : l.default());
1533
+ return c != null && c.parent && r.enableProvideBridge && (P(c.parent), Reflect.ownKeys(v).forEach((w) => {
1534
+ le(w, v[w]);
1535
+ })), le("useTres", p), le("extend", Ee), typeof window < "u" && Ir(d == null ? void 0 : d.app, p), () => Ue(Bt, null, _ ? [] : l.default());
1526
1536
  }
1527
- }), y = (g, d = !1) => {
1528
- const _ = f(g, d), { render: P } = jt(Er(g));
1529
- P(Ue(_), c.value);
1530
- }, u = (g, d = !1) => {
1531
- mt(g.scene.value), d && (g.renderer.value.dispose(), g.renderer.value.renderLists.dispose(), g.renderer.value.forceContextLoss()), c.value.__tres = {
1532
- root: g
1537
+ }), f = (p, _ = !1) => {
1538
+ const d = i(p, _), { render: v } = jt(Er(p));
1539
+ v(Ue(d), a.value);
1540
+ }, g = (p, _ = !1) => {
1541
+ mt(p.scene.value), _ && (p.renderer.value.dispose(), p.renderer.value.renderLists.dispose(), p.renderer.value.forceContextLoss()), a.value.__tres = {
1542
+ root: p
1533
1543
  };
1534
- }, v = $(null);
1535
- t({ context: v, dispose: () => u(v.value, !0) });
1536
- const h = () => {
1537
- u(v.value), y(v.value, !0);
1544
+ }, u = $(null);
1545
+ t({ context: u, dispose: () => g(u.value, !0) });
1546
+ const y = () => {
1547
+ g(u.value), f(u.value, !0);
1538
1548
  };
1539
- return Lt(() => {
1540
- const g = a;
1541
- v.value = br({
1542
- scene: c.value,
1543
- canvas: g,
1549
+ return kt(() => {
1550
+ const p = s;
1551
+ u.value = br({
1552
+ scene: a.value,
1553
+ canvas: p,
1544
1554
  windowSize: r.windowSize ?? !1,
1545
1555
  rendererOptions: r,
1546
- emit: s
1556
+ emit: o
1547
1557
  });
1548
- const { registerCamera: d, camera: _, cameras: P, deregisterCamera: C } = v.value;
1549
- y(v.value);
1550
- const T = () => {
1551
- const b = new be(
1558
+ const { registerCamera: _, camera: d, cameras: v, deregisterCamera: P } = u.value;
1559
+ f(u.value);
1560
+ const C = () => {
1561
+ const w = new be(
1552
1562
  45,
1553
1563
  window.innerWidth / window.innerHeight,
1554
1564
  0.1,
1555
1565
  1e3
1556
1566
  );
1557
- b.position.set(3, 3, 3), b.lookAt(0, 0, 0), d(b);
1567
+ w.position.set(3, 3, 3), w.lookAt(0, 0, 0), _(w);
1558
1568
  const E = Ae(() => {
1559
- P.value.length >= 2 && (b.removeFromParent(), C(b), E == null || E());
1569
+ v.value.length >= 2 && (w.removeFromParent(), P(w), E == null || E());
1560
1570
  });
1561
1571
  };
1562
1572
  ae(
1563
1573
  () => r.camera,
1564
- (b, E) => {
1565
- b && d(b), E && (E.removeFromParent(), C(E));
1574
+ (w, E) => {
1575
+ w && _(w), E && (E.removeFromParent(), P(E));
1566
1576
  },
1567
1577
  {
1568
1578
  immediate: !0
1569
1579
  }
1570
- ), _.value || (i(
1571
- "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1572
- ), T());
1573
- }), J(h), (g, d) => (kt(), Rt("canvas", {
1580
+ ), d.value || C();
1581
+ }), K(y), (p, _) => (Rt(), Lt("canvas", {
1574
1582
  ref_key: "canvas",
1575
- ref: a,
1576
- "data-scene": c.value.uuid,
1577
- class: Ot(g.$attrs.class),
1583
+ ref: s,
1584
+ "data-scene": a.value.uuid,
1585
+ class: Dt(p.$attrs.class),
1578
1586
  "data-tres": `tresjs ${W(Rn).version}`,
1579
- style: Dt({
1587
+ style: Ot({
1580
1588
  display: "block",
1581
1589
  width: "100%",
1582
1590
  height: "100%",
1583
- position: g.windowSize ? "fixed" : "relative",
1591
+ position: p.windowSize ? "fixed" : "relative",
1584
1592
  top: 0,
1585
1593
  left: 0,
1586
1594
  pointerEvents: "auto",
1587
1595
  touchAction: "none",
1588
- ...g.$attrs.style
1596
+ ...p.$attrs.style
1589
1597
  })
1590
1598
  }, null, 14, $r));
1591
1599
  }
@@ -1599,11 +1607,11 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
1599
1607
  isCustomElement: (e) => e.startsWith("Tres") && !Ur.includes(e) || e === "primitive"
1600
1608
  }
1601
1609
  }
1602
- }, { logWarning: Fr } = V();
1610
+ }, { logWarning: Fr } = Q();
1603
1611
  let B = null;
1604
1612
  const ro = {
1605
1613
  updated: (e, t) => {
1606
- var s;
1614
+ var o;
1607
1615
  const n = Zn(t);
1608
1616
  if (!n) {
1609
1617
  Fr(`v-distance-to: problem with binding value: ${t.value}`);
@@ -1614,23 +1622,23 @@ const ro = {
1614
1622
  r.normalize(), B = new Yt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
1615
1623
  [
1616
1624
  ["Distance:", e.position.distanceTo(n)],
1617
- [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
1625
+ [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(o = e.position) == null ? void 0 : o.z}`],
1618
1626
  [`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
1619
1627
  ]
1620
1628
  );
1621
1629
  },
1622
1630
  unmounted: (e) => {
1623
- B == null || B.dispose(), e.parent.remove(B);
1631
+ B == null || B.dispose(), e.parent && e.parent.remove(B);
1624
1632
  }
1625
1633
  };
1626
1634
  class Ct extends qt {
1627
1635
  constructor(t, n) {
1628
- const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Fe();
1629
- s.setAttribute("position", new We(r, 3)), s.computeBoundingSphere();
1636
+ const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], o = new Fe();
1637
+ o.setAttribute("position", new We(r, 3)), o.computeBoundingSphere();
1630
1638
  const l = new Kt({ fog: !1 });
1631
- super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1632
- const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
1633
- a.setAttribute("position", new We(i, 3)), a.computeBoundingSphere(), this.add(new Jt(a, new at({ side: Qt, fog: !1 })));
1639
+ super(o, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1640
+ const s = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
1641
+ a.setAttribute("position", new We(s, 3)), a.computeBoundingSphere(), this.add(new Jt(a, new at({ side: Qt, fog: !1 })));
1634
1642
  }
1635
1643
  updateMatrixWorld() {
1636
1644
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
@@ -1646,13 +1654,13 @@ class Ct extends qt {
1646
1654
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1647
1655
  }
1648
1656
  }
1649
- const { logWarning: tt } = V();
1657
+ const { logWarning: tt } = Q();
1650
1658
  let ie, F;
1651
1659
  const Wr = {
1652
- DirectionalLight: Xt,
1653
- PointLight: Zt,
1654
- SpotLight: en,
1655
- HemisphereLight: tn,
1660
+ DirectionalLight: tn,
1661
+ PointLight: en,
1662
+ SpotLight: Zt,
1663
+ HemisphereLight: Xt,
1656
1664
  RectAreaLight: Ct
1657
1665
  }, oo = {
1658
1666
  mounted: (e) => {
@@ -1670,7 +1678,7 @@ const Wr = {
1670
1678
  tt(`${e.type} is not a light`);
1671
1679
  return;
1672
1680
  }
1673
- F = e.parent.children.find((t) => t instanceof ie), F && F.dispose && F.dispose(), e.parent.remove(F);
1681
+ F = e.parent.children.find((t) => t instanceof ie), F && F.dispose && F.dispose(), e.parent && e.parent.remove(F);
1674
1682
  }
1675
1683
  }, so = {
1676
1684
  mounted: (e, t) => {
@@ -1702,7 +1710,7 @@ export {
1702
1710
  On as traverseObjects,
1703
1711
  ar as useCamera,
1704
1712
  Dn as useLoader,
1705
- V as useLogger,
1713
+ Q as useLogger,
1706
1714
  Zr as useLoop,
1707
1715
  yr as useRaycaster,
1708
1716
  eo as useRenderLoop,