@tresjs/core 4.3.1 → 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,115 +1,18 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.3.1
4
- * (c) 2024
3
+ * version: v4.3.3
4
+ * (c) 2025
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
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 xe, onUnmounted as J, shallowRef as $, watch as ae, readonly as we, provide as le, inject as St, isRef as xt, useSlots as At, getCurrentInstance as He, onMounted as kt, openBlock as Lt, 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 Ae, 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";
14
- import { tryOnScopeDispose as nn, toValue as x, 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.1", hn = "pnpm@9.1.4", gn = "Declarative ThreeJS using Vue Components", vn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", yn = "MIT", _n = {
16
- type: "git",
17
- url: "git+https://github.com/Tresjs/tres.git"
18
- }, wn = [
19
- "vue",
20
- "3d",
21
- "threejs",
22
- "three",
23
- "threejs-vue"
24
- ], bn = !1, Mn = {
25
- ".": {
26
- types: "./dist/index.d.ts",
27
- import: "./dist/tres.js",
28
- require: "./dist/tres.umd.cjs"
29
- },
30
- "./components": {
31
- types: "./dist/src/components/index.d.ts"
32
- },
33
- "./composables": {
34
- types: "./dist/src/composables/index.d.ts"
35
- },
36
- "./types": {
37
- types: "./dist/src/types/index.d.ts"
38
- },
39
- "./utils": {
40
- types: "./dist/src/utils/index.d.ts"
41
- },
42
- "./*": "./*"
43
- }, Pn = "./dist/tres.js", Cn = "./dist/tres.js", En = "./dist/index.d.ts", Tn = [
44
- "*.d.ts",
45
- "dist"
46
- ], Sn = {
47
- access: "public"
48
- }, xn = {
49
- dev: "cd playground/vue && npm run dev",
50
- "dev:nuxt": "cd playground/nuxt && npm run dev",
51
- build: "vite build",
52
- test: "vitest",
53
- "test:ci": "vitest run",
54
- "test:ui": "vitest --ui --coverage.enabled=true",
55
- release: "release-it",
56
- coverage: "vitest run --coverage",
57
- lint: "eslint .",
58
- "lint:fix": "eslint . --fix",
59
- "docs:dev": "vitepress dev docs",
60
- "docs:build": "vitepress build docs",
61
- "docs:serve": "vitepress serve docs",
62
- "docs:preview": "vitepress preview docs",
63
- "docs:contributors": "esno scripts/update-contributors.ts"
64
- }, An = {
65
- three: ">=0.133",
66
- vue: ">=3.4"
67
- }, kn = {
68
- "@alvarosabu/utils": "^3.2.0",
69
- "@vue/devtools-api": "^6.6.3",
70
- "@vueuse/core": "^11.1.0"
71
- }, Ln = {
72
- "@release-it/conventional-changelog": "^9.0.0",
73
- "@stackblitz/sdk": "^1.11.0",
74
- "@tresjs/cientos": "4.0.3",
75
- "@tresjs/eslint-config": "^1.4.0",
76
- "@types/three": "^0.169.0",
77
- "@typescript-eslint/eslint-plugin": "^8.8.1",
78
- "@typescript-eslint/parser": "^8.8.1",
79
- "@vitejs/plugin-vue": "^5.1.4",
80
- "@vitest/coverage-c8": "^0.33.0",
81
- "@vitest/coverage-v8": "^2.1.2",
82
- "@vitest/ui": "^2.1.2",
83
- "@vue/test-utils": "^2.4.6",
84
- eslint: "^9.12.0",
85
- "eslint-plugin-vue": "^9.29.0",
86
- esno: "^4.8.0",
87
- gsap: "^3.12.5",
88
- husky: "^9.1.6",
89
- jsdom: "^25.0.1",
90
- kolorist: "^1.8.0",
91
- ohmyfetch: "^0.4.21",
92
- pathe: "^1.1.2",
93
- "release-it": "^17.8.2",
94
- "rollup-plugin-analyzer": "^4.0.0",
95
- "rollup-plugin-copy": "^3.5.0",
96
- "rollup-plugin-visualizer": "^5.12.0",
97
- sponsorkit: "^0.15.5",
98
- three: "^0.169.0",
99
- unocss: "^0.63.4",
100
- unplugin: "^1.14.1",
101
- "unplugin-vue-components": "^0.27.4",
102
- vite: "^5.4.8",
103
- "vite-plugin-banner": "^0.8.0",
104
- "vite-plugin-dts": "4.2.4",
105
- "vite-plugin-inspect": "^0.8.7",
106
- "vite-plugin-require-transform": "^1.0.21",
107
- "vite-svg-loader": "^5.1.0",
108
- vitepress: "1.4.0",
109
- vitest: "^2.1.2",
110
- vue: "3.5.12",
111
- "vue-demi": "^0.14.10"
112
- }, Rn = {
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
+ 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.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 = {
113
16
  name: dn,
114
17
  type: pn,
115
18
  version: mn,
@@ -126,8 +29,8 @@ const dn = "@tresjs/core", pn = "module", mn = "4.3.1", hn = "pnpm@9.1.4", gn =
126
29
  types: En,
127
30
  files: Tn,
128
31
  publishConfig: Sn,
129
- scripts: xn,
130
- peerDependencies: An,
32
+ scripts: An,
33
+ peerDependencies: xn,
131
34
  dependencies: kn,
132
35
  devDependencies: Ln
133
36
  };
@@ -137,18 +40,18 @@ function On(e) {
137
40
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
138
41
  }), t;
139
42
  }
140
- async function Dn(e, t, n, r, s) {
141
- const { logError: l } = V(), i = new e();
142
- return s && s(i), n && n(i), await new Promise((a, c) => {
143
- 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(
144
47
  t,
145
- (o) => {
146
- const f = o;
48
+ (i) => {
49
+ const f = i;
147
50
  f.scene && Object.assign(f, On(f.scene)), a(f);
148
51
  },
149
52
  r,
150
- (o) => {
151
- l("[useLoader] - Failed to load resource", o), c(o);
53
+ (i) => {
54
+ l("[useLoader] - Failed to load resource", i), c(i);
152
55
  }
153
56
  );
154
57
  });
@@ -161,8 +64,8 @@ const Yr = /* @__PURE__ */ fe({
161
64
  },
162
65
  async setup(e) {
163
66
  let t, n;
164
- const r = e, s = ([t, n] = nt(() => Se(Dn(r.loader, r.url))), t = await t, n(), t);
165
- 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) });
166
69
  }
167
70
  });
168
71
  class jn extends ot.Mesh {
@@ -173,8 +76,8 @@ class jn extends ot.Mesh {
173
76
  this.createTime = Date.now();
174
77
  }
175
78
  onBeforeRender() {
176
- const r = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * r);
177
- 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);
178
81
  }
179
82
  }
180
83
  function Me(e) {
@@ -239,23 +142,23 @@ function Vn(e) {
239
142
  }
240
143
  function Yn(e, t) {
241
144
  const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
242
- for (let s = 0; s < r.length; s++)
243
- n[r[s]] = !0;
244
- 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];
245
148
  }
246
149
  const Ve = (e, t) => {
247
150
  if (!t)
248
151
  return;
249
152
  const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
250
- 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);
251
154
  }, qn = (e, t, n) => {
252
155
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
253
- 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);
254
157
  };
255
158
  function pt(e, t) {
256
159
  if (Ge(e) && Ge(t)) {
257
- const s = e.attributes, l = t.attributes;
258
- 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);
259
162
  }
260
163
  if (e === t)
261
164
  return !0;
@@ -264,8 +167,8 @@ function pt(e, t) {
264
167
  const n = Object.keys(e), r = Object.keys(t);
265
168
  if (n.length !== r.length)
266
169
  return !1;
267
- for (const s of n)
268
- 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]))
269
172
  return !1;
270
173
  return !0;
271
174
  }
@@ -279,29 +182,29 @@ function Kn(e, t) {
279
182
  }
280
183
  const Jn = Array.isArray;
281
184
  function Qn(e, t, n, r) {
282
- const s = (c) => {
185
+ const o = (c) => {
283
186
  if (c.uuid === t)
284
187
  return c;
285
- for (const o of c.children) {
286
- const f = s(o);
188
+ for (const i of c.children) {
189
+ const f = o(i);
287
190
  if (f)
288
191
  return f;
289
192
  }
290
- }, l = s(e);
193
+ }, l = o(e);
291
194
  if (!l) {
292
195
  console.warn("Object with UUID not found in the scene.");
293
196
  return;
294
197
  }
295
- let i = l;
198
+ let s = l;
296
199
  for (let c = 0; c < n.length - 1; c++)
297
- if (i[n[c]] !== void 0)
298
- i = i[n[c]];
200
+ if (s[n[c]] !== void 0)
201
+ s = s[n[c]];
299
202
  else {
300
203
  console.warn(`Property path is not valid: ${n.join(".")}`);
301
204
  return;
302
205
  }
303
206
  const a = n[n.length - 1];
304
- 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(".")}`);
305
208
  }
306
209
  function Xn(e) {
307
210
  const t = new at({
@@ -319,7 +222,7 @@ function Xn(e) {
319
222
  function Zn(e) {
320
223
  var n;
321
224
  let t = e.value;
322
- return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new Ae(...t)), t;
225
+ return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new xe(...t)), t;
323
226
  }
324
227
  function er(e) {
325
228
  return "map" in e;
@@ -329,9 +232,9 @@ function Ye(e) {
329
232
  }
330
233
  function mt(e) {
331
234
  var n, r;
332
- if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((s) => mt(s)), !(e instanceof st)) {
333
- const s = e;
334
- 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);
335
238
  }
336
239
  }
337
240
  function tr(e, t) {
@@ -344,10 +247,10 @@ function Pe(e, t) {
344
247
  let n = e;
345
248
  if (t.includes("-")) {
346
249
  const r = t.split("-");
347
- let s = r.shift();
250
+ let o = r.shift();
348
251
  for (; n && r.length; )
349
- s in n ? (n = n[s], s = r.shift()) : s = qe(s, r.shift());
350
- 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) };
351
254
  } else
352
255
  return { target: n, key: t };
353
256
  }
@@ -358,26 +261,26 @@ const Ke = /-\d+$/;
358
261
  function nr(e, t, n) {
359
262
  if (ft(n)) {
360
263
  if (Ke.test(n)) {
361
- const l = n.replace(Ke, ""), { target: i, key: a } = Pe(e, l);
362
- if (!Array.isArray(i[a])) {
363
- const c = i[a], o = [];
364
- o.__tresDetach = () => {
365
- o.every((f) => Me(f)) && (i[a] = c);
366
- }, 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;
367
270
  }
368
271
  }
369
- const { target: r, key: s } = Pe(e, n);
370
- 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);
371
274
  } else
372
275
  t.__tres.previousAttach = n(e, t);
373
276
  }
374
277
  function rr(e, t, n) {
375
- var r, s, l;
278
+ var r, o, l;
376
279
  if (ft(n)) {
377
- const { target: i, key: a } = Pe(e, n), c = t.__tres.previousAttach;
378
- 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();
379
282
  } else
380
- (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);
381
284
  (l = t.__tres) == null || delete l.previousAttach;
382
285
  }
383
286
  function z(e, t, n) {
@@ -400,81 +303,84 @@ function ht(e) {
400
303
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
401
304
  }
402
305
  function or(e, t, n) {
403
- var s;
306
+ var o;
404
307
  if (!G(e.setPixelRatio))
405
308
  return;
406
309
  let r = 0;
407
- if (de(n) && n.length >= 2) {
408
- const [l, i] = n;
409
- 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
+ }
410
316
  } else Bn(n) ? r = n : r = t;
411
- 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);
412
318
  }
413
- function sr(e, t, n, r, s) {
414
- const l = [...t.__tres.objects], i = Q(t);
415
- 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)
416
322
  return !0;
417
- const a = z(e, t.__tres ?? {}, s), c = t.parent ?? t.__tres.parent ?? null, o = { ...t.__tres.memoizedProps };
418
- 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;
419
325
  for (const f of l)
420
- gt(f, s), vt(f, s);
421
- i.__tres.objects = [], r.remove(t);
422
- for (const [f, y] of Object.entries(o))
423
- 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);
424
330
  n(e), r.insert(t, c);
425
331
  for (const f of l)
426
332
  r.insert(f, t);
427
333
  return !0;
428
334
  }
429
- function Q(e) {
335
+ function J(e) {
430
336
  return Wn(e) ? (e.object.__tres = e.__tres, e.object) : e;
431
337
  }
432
338
  function gt(e, t) {
433
- var r, s, l, i;
339
+ var r, o, l, s;
434
340
  const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
435
- 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);
436
342
  }
437
343
  function vt(e, t) {
438
344
  var n;
439
345
  (n = e.traverse) == null || n.call(e, (r) => {
440
- var s;
441
- t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
346
+ var o;
347
+ t.deregisterCamera(r), (o = t.eventManager) == null || o.deregisterPointerMissedObject(r);
442
348
  }), t.deregisterCamera(e), ht(e);
443
349
  }
444
350
  async function ir(e, t) {
445
- const n = new $t(t), r = (s) => new Promise((l, i) => {
351
+ const n = new $t(t), r = (o) => new Promise((l, s) => {
446
352
  n.load(
447
- s,
353
+ o,
448
354
  (a) => l(a),
449
355
  () => null,
450
356
  () => {
451
- i(new Error("[useTextures] - Failed to load texture"));
357
+ s(new Error("[useTextures] - Failed to load texture"));
452
358
  }
453
359
  );
454
360
  });
455
361
  if (Jn(e)) {
456
- const s = await Promise.all(e.map((l) => r(l)));
457
- 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];
458
364
  } else {
459
365
  const {
460
- map: s,
366
+ map: o,
461
367
  displacementMap: l,
462
- normalMap: i,
368
+ normalMap: s,
463
369
  roughnessMap: a,
464
370
  metalnessMap: c,
465
- aoMap: o,
371
+ aoMap: i,
466
372
  alphaMap: f,
467
- matcap: y
373
+ matcap: g
468
374
  } = e;
469
375
  return {
470
- map: s ? await r(s) : null,
376
+ map: o ? await r(o) : null,
471
377
  displacementMap: l ? await r(l) : null,
472
- normalMap: i ? await r(i) : null,
378
+ normalMap: s ? await r(s) : null,
473
379
  roughnessMap: a ? await r(a) : null,
474
380
  metalnessMap: c ? await r(c) : null,
475
- aoMap: o ? await r(o) : null,
381
+ aoMap: i ? await r(i) : null,
476
382
  alphaMap: f ? await r(f) : null,
477
- matcap: y ? await r(y) : null
383
+ matcap: g ? await r(g) : null
478
384
  };
479
385
  }
480
386
  }
@@ -492,41 +398,41 @@ const qr = /* @__PURE__ */ fe({
492
398
  },
493
399
  async setup(e) {
494
400
  let t, n;
495
- const r = e, s = ([t, n] = nt(() => Se(ir(r))), t = await t, n(), t);
496
- 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) });
497
403
  }
498
404
  }), ar = ({ sizes: e }) => {
499
- const t = I([]), n = K(
405
+ const t = I([]), n = q(
500
406
  () => t.value[0]
501
- ), r = (i) => {
502
- 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);
503
409
  if (!a)
504
410
  return;
505
- const c = t.value.filter(({ uuid: o }) => o !== a.uuid);
411
+ const c = t.value.filter(({ uuid: i }) => i !== a.uuid);
506
412
  t.value = [a, ...c];
507
- }, s = (i, a = !1) => {
508
- if (ze(i)) {
509
- const c = i;
510
- 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))
511
417
  return;
512
418
  a ? r(c) : t.value.push(c);
513
419
  }
514
- }, l = (i) => {
515
- if (ze(i)) {
516
- const a = i;
420
+ }, l = (s) => {
421
+ if (ze(s)) {
422
+ const a = s;
517
423
  t.value = t.value.filter(({ uuid: c }) => c !== a.uuid);
518
424
  }
519
425
  };
520
- return xe(() => {
521
- e.aspectRatio.value && t.value.forEach((i) => {
522
- !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());
426
+ return Ae(() => {
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());
523
429
  });
524
- }), J(() => {
430
+ }), K(() => {
525
431
  t.value = [];
526
432
  }), {
527
433
  camera: n,
528
434
  cameras: t,
529
- registerCamera: s,
435
+ registerCamera: o,
530
436
  deregisterCamera: l,
531
437
  setCameraActive: r
532
438
  };
@@ -543,7 +449,7 @@ function ur(...e) {
543
449
  }
544
450
  function fr(e, t) {
545
451
  }
546
- function V() {
452
+ function Q() {
547
453
  return {
548
454
  logError: cr,
549
455
  logWarning: ur,
@@ -554,23 +460,23 @@ const Ce = I({}), Ee = (e) => Object.assign(Ce.value, e);
554
460
  function ye() {
555
461
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
556
462
  let n = 0, r = !1;
557
- const s = () => {
558
- const o = Array.from(e.entries()).sort((f, y) => {
559
- const u = f[1].priority - y[1].priority;
560
- 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;
561
467
  });
562
- t.clear(), o.forEach((f) => t.add(f[0]));
563
- }, l = (o) => {
564
- 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);
565
471
  };
566
- return { on: (o, f = 0) => {
567
- e.set(o, { priority: f, addI: n++ });
568
- const y = () => l(o);
569
- return nn(y), r = !0, {
570
- 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
571
477
  };
572
- }, off: l, trigger: (...o) => {
573
- r && (s(), r = !1), t.forEach((f) => f(...o));
478
+ }, off: l, trigger: (...i) => {
479
+ r && (o(), r = !1), t.forEach((f) => f(...i));
574
480
  }, dispose: () => {
575
481
  e.clear(), t.clear();
576
482
  }, get count() {
@@ -579,50 +485,50 @@ function ye() {
579
485
  }
580
486
  function dr() {
581
487
  let e = !0, t = !0, n = !1;
582
- const r = new lt(!1), s = I(r.running), l = I(!1);
583
- let i;
488
+ const r = new lt(!1), o = I(r.running), l = I(!1);
489
+ let s;
584
490
  const a = it.generateUUID();
585
491
  let c = null;
586
- const o = ye(), f = ye(), y = ye();
587
- E();
492
+ const i = ye(), f = ye(), g = ye();
493
+ S();
588
494
  let u = {};
589
- function v(M) {
495
+ function y(M) {
590
496
  u = M;
591
497
  }
592
- function h(M, A, p = 0) {
593
- switch (A) {
498
+ function p(M, x, m = 0) {
499
+ switch (x) {
594
500
  case "before":
595
- return o.on(M, p);
501
+ return i.on(M, m);
596
502
  case "render":
597
503
  return c || (c = M), f.dispose(), f.on(M);
598
504
  case "after":
599
- return y.on(M, p);
505
+ return g.on(M, m);
600
506
  }
601
507
  }
602
- function g() {
603
- t && (t = !1, E(), b());
508
+ function _() {
509
+ t && (t = !1, S(), E());
604
510
  }
605
511
  function d() {
606
- t = !0, E(), cancelAnimationFrame(i);
512
+ t = !0, S(), cancelAnimationFrame(s);
607
513
  }
608
- function _() {
609
- n = !1, E();
514
+ function v() {
515
+ n = !1, S();
610
516
  }
611
517
  function P() {
612
- n = !0, E();
518
+ n = !0, S();
613
519
  }
614
520
  function C() {
615
521
  l.value = !0;
616
522
  }
617
- function T() {
523
+ function w() {
618
524
  l.value = !1;
619
525
  }
620
- function b() {
526
+ function E() {
621
527
  if (!e) {
622
- i = requestAnimationFrame(b);
528
+ s = requestAnimationFrame(E);
623
529
  return;
624
530
  }
625
- const M = r.getDelta(), A = r.getElapsedTime(), p = {
531
+ const M = r.getDelta(), x = r.getElapsedTime(), m = {
626
532
  camera: W(u.camera),
627
533
  scene: W(u.scene),
628
534
  renderer: W(u.renderer),
@@ -630,25 +536,25 @@ function dr() {
630
536
  controls: W(u.controls),
631
537
  invalidate: u.invalidate,
632
538
  advance: u.advance
633
- }, w = { delta: M, elapsed: A, clock: r, ...p };
634
- 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);
635
541
  }
636
- function E() {
542
+ function S() {
637
543
  const M = !t && !n;
638
- 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;
639
545
  }
640
546
  return {
641
547
  loopId: a,
642
- register: (M, A, p) => h(M, A, p),
643
- start: g,
548
+ register: (M, x, m) => p(M, x, m),
549
+ start: _,
644
550
  stop: d,
645
551
  pause: P,
646
- resume: _,
552
+ resume: v,
647
553
  pauseRender: C,
648
- resumeRender: T,
554
+ resumeRender: w,
649
555
  isRenderPaused: l,
650
- isActive: s,
651
- setContext: v,
556
+ isActive: o,
557
+ setContext: y,
652
558
  setReady: (M) => e = M
653
559
  };
654
560
  }
@@ -656,7 +562,7 @@ function ke(e) {
656
562
  let t = 0;
657
563
  return e.traverse((n) => {
658
564
  if (n.isMesh && n.geometry && n.type !== "HightlightMesh") {
659
- 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;
660
566
  t += c;
661
567
  }
662
568
  }), t;
@@ -666,7 +572,7 @@ function pr(e) {
666
572
  }
667
573
  const mr = Number.parseInt(Ut.replace("dev", ""));
668
574
  function Jr(e) {
669
- return typeof e == "number" ? [e, e, e] : e instanceof Ae ? [e.x, e.y, e.z] : e;
575
+ return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
670
576
  }
671
577
  function hr(e) {
672
578
  return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
@@ -675,7 +581,7 @@ const se = {
675
581
  realistic: {
676
582
  shadows: !0,
677
583
  physicallyCorrectLights: !0,
678
- outputColorSpace: Ft,
584
+ outputColorSpace: Nt,
679
585
  toneMapping: ct,
680
586
  toneMappingExposure: 3,
681
587
  shadowMap: {
@@ -684,163 +590,163 @@ const se = {
684
590
  }
685
591
  },
686
592
  flat: {
687
- toneMapping: Nt,
593
+ toneMapping: Ft,
688
594
  toneMappingExposure: 1
689
595
  }
690
596
  };
691
597
  function gr({
692
598
  canvas: e,
693
599
  options: t,
694
- contextParts: { sizes: n, render: r, invalidate: s, advance: l }
600
+ contextParts: { sizes: n, render: r, invalidate: o, advance: l }
695
601
  }) {
696
- const i = K(() => ({
697
- alpha: x(t.alpha) ?? !0,
698
- depth: x(t.depth),
602
+ const s = q(() => ({
603
+ alpha: A(t.alpha) ?? !0,
604
+ depth: A(t.depth),
699
605
  canvas: rn(e),
700
- context: x(t.context),
701
- stencil: x(t.stencil),
702
- antialias: x(t.antialias) ?? !0,
703
- precision: x(t.precision),
704
- powerPreference: x(t.powerPreference),
705
- premultipliedAlpha: x(t.premultipliedAlpha),
706
- preserveDrawingBuffer: x(t.preserveDrawingBuffer),
707
- logarithmicDepthBuffer: x(t.logarithmicDepthBuffer),
708
- failIfMajorPerformanceCaveat: x(t.failIfMajorPerformanceCaveat)
709
- })), a = $(new ge(i.value));
606
+ context: A(t.context),
607
+ stencil: A(t.stencil),
608
+ antialias: A(t.antialias) ?? !0,
609
+ precision: A(t.precision),
610
+ powerPreference: A(t.powerPreference),
611
+ premultipliedAlpha: A(t.premultipliedAlpha),
612
+ preserveDrawingBuffer: A(t.preserveDrawingBuffer),
613
+ logarithmicDepthBuffer: A(t.logarithmicDepthBuffer),
614
+ failIfMajorPerformanceCaveat: A(t.failIfMajorPerformanceCaveat)
615
+ })), a = $(new ge(s.value));
710
616
  function c() {
711
- t.renderMode === "on-demand" && s();
617
+ t.renderMode === "on-demand" && o();
712
618
  }
713
- ae(i, () => {
714
- a.value.dispose(), a.value = new ge(i.value), c();
619
+ ae(s, () => {
620
+ a.value.dispose(), a.value = new ge(s.value), c();
715
621
  }), ae([n.width, n.height], () => {
716
622
  a.value.setSize(n.width.value, n.height.value), c();
717
623
  }, {
718
624
  immediate: !0
719
625
  }), ae(() => t.clearColor, c);
720
- const { pixelRatio: o } = on(), { logError: f } = V(), u = (() => {
721
- const h = new ge(), g = {
626
+ const { pixelRatio: i } = on(), { logError: f } = Q(), u = (() => {
627
+ const p = new ge(), _ = {
722
628
  shadowMap: {
723
- enabled: h.shadowMap.enabled,
724
- type: h.shadowMap.type
629
+ enabled: p.shadowMap.enabled,
630
+ type: p.shadowMap.type
725
631
  },
726
- toneMapping: h.toneMapping,
727
- toneMappingExposure: h.toneMappingExposure,
728
- outputColorSpace: h.outputColorSpace
632
+ toneMapping: p.toneMapping,
633
+ toneMappingExposure: p.toneMappingExposure,
634
+ outputColorSpace: p.outputColorSpace
729
635
  };
730
- return h.dispose(), g;
731
- })(), v = x(t.renderMode);
732
- 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(() => {
733
639
  l();
734
- }, 100), xe(() => {
735
- const h = x(t.preset);
736
- 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, x(t.dpr)), v === "always" && (r.frames.value = Math.max(1, r.frames.value));
737
- const g = (P, C) => {
738
- const T = x(P), b = () => {
739
- if (h)
740
- return Ve(se[h], C);
640
+ }, 100), Ae(() => {
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);
741
647
  };
742
- if (T !== void 0)
743
- return T;
744
- const E = b();
745
- return E !== void 0 ? E : Ve(u, C);
746
- }, 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));
747
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");
748
- const _ = g(t.clearColor, "clearColor");
749
- _ && a.value.setClearColor(
750
- _ ? hr(_) : new Z(0)
654
+ const v = _(t.clearColor, "clearColor");
655
+ v && a.value.setClearColor(
656
+ v ? hr(v) : new Z(0)
751
657
  // default clear color is not easily/efficiently retrievable from three
752
658
  );
753
- }), J(() => {
659
+ }), K(() => {
754
660
  a.value.dispose(), a.value.forceContextLoss();
755
661
  }), {
756
662
  renderer: a
757
663
  };
758
664
  }
759
665
  function vr(e, t, n = 10) {
760
- const r = x(e) ? sn() : an(K(() => x(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);
761
667
  return {
762
668
  height: l,
763
- width: s,
764
- aspectRatio: i
669
+ width: o,
670
+ aspectRatio: s
765
671
  };
766
672
  }
767
673
  const yr = (e, t) => {
768
- const n = K(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = ln({ target: n });
769
- let i = 0;
770
- 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 }) => {
771
677
  if (n.value)
772
678
  return {
773
- x: (m - f.value) / a.value * 2 - 1,
774
- 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
775
681
  };
776
- }, u = ({ x: m, y: S }) => {
682
+ }, u = ({ x: h, y: T }) => {
777
683
  if (t.camera.value)
778
- return t.raycaster.value.setFromCamera(new ve(m, S), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
779
- }, v = (m) => {
780
- const S = y({
781
- x: (m == null ? void 0 : m.clientX) ?? s.value,
782
- 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
783
689
  });
784
- return S ? u(S) || [] : [];
785
- }, h = D(), g = D(), d = D(), _ = D(), P = D(), C = D(), T = D(), b = D();
786
- function E(m) {
787
- const S = {};
788
- for (const U in m)
789
- typeof U != "function" && (S[U] = m[U]);
790
- 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;
791
697
  }
792
- const M = (m, S) => {
698
+ const M = (h, T) => {
793
699
  var Be, Ie, $e;
794
- const U = E(S), ne = new Ae(S == null ? void 0 : S.clientX, S == null ? void 0 : S.clientY, 0).unproject((Be = t.camera) == null ? void 0 : Be.value);
795
- 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({
796
702
  ...U,
797
703
  intersections: r.value,
798
704
  // The unprojectedPoint is wrong, math needs to be fixed
799
705
  unprojectedPoint: ne,
800
706
  ray: (Ie = t.raycaster) == null ? void 0 : Ie.value.ray,
801
707
  camera: ($e = t.camera) == null ? void 0 : $e.value,
802
- sourceEvent: S,
803
- delta: i,
708
+ sourceEvent: T,
709
+ delta: s,
804
710
  stopPropagating: !1
805
711
  });
806
712
  };
807
- let A;
808
- const p = (m) => {
809
- v(m), M(d, m), A = m;
810
- }, w = () => {
811
- A && p(A);
713
+ let x;
714
+ const m = (h) => {
715
+ y(h), M(d, h), x = h;
716
+ }, b = () => {
717
+ x && m(x);
812
718
  };
813
719
  let k, L, R;
814
- const j = (m) => {
815
- var S;
816
- k = (S = r.value[0]) == null ? void 0 : S.object, i = 0, L = new ve(
817
- (m == null ? void 0 : m.clientX) ?? s.value,
818
- (m == null ? void 0 : m.clientY) ?? l.value
819
- ), M(P, m);
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);
820
726
  };
821
- let O, Y = !1;
822
- const Re = (m) => {
823
- var S, U, ne;
824
- m instanceof PointerEvent && (r.value.length === 0 && M(C, m), k === ((S = r.value[0]) == null ? void 0 : S.object) && (R = new ve(
825
- (m == null ? void 0 : m.clientX) ?? s.value,
826
- (m == null ? void 0 : m.clientY) ?? l.value
827
- ), i = L == null ? void 0 : L.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));
828
- }, Oe = (m) => {
829
- Y && (M(g, m), O = void 0, Y = !1);
830
- }, De = (m) => M(d, m), je = (m) => M(b, m);
831
- 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(() => {
832
- 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));
833
739
  }), {
834
740
  intersects: r,
835
- onClick: (m) => h.on(m).off,
836
- onDblClick: (m) => g.on(m).off,
837
- onContextMenu: (m) => T.on(m).off,
838
- onPointerMove: (m) => d.on(m).off,
839
- onPointerUp: (m) => _.on(m).off,
840
- onPointerDown: (m) => P.on(m).off,
841
- onPointerMissed: (m) => C.on(m).off,
842
- onWheel: (m) => b.on(m).off,
843
- 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
844
750
  };
845
751
  };
846
752
  function _e(e, t) {
@@ -850,105 +756,105 @@ function _e(e, t) {
850
756
  typeof e == "function" && e(t);
851
757
  }
852
758
  function _r(e, t, n) {
853
- var A;
854
- const r = $(), s = $();
855
- e && (r.value = e), t && (s.value = t);
856
- const l = (p) => {
857
- var w;
858
- return ((w = p.__tres) == null ? void 0 : w.eventCount) > 0;
859
- }, i = (p) => {
860
- var w;
861
- return ((w = p.children) == null ? void 0 : w.some((k) => i(k))) || l(p);
862
- }, a = $(((A = r.value) == null ? void 0 : A.children).filter(i) || []);
863
- function c(p, w) {
864
- const k = [], L = () => w.stopPropagating = !0;
865
- w.stopPropagation = L;
866
- for (const R of w == null ? void 0 : w.intersections) {
867
- if (w.stopPropagating)
759
+ var x;
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)
868
774
  return;
869
- w = { ...w, ...R };
775
+ b = { ...b, ...R };
870
776
  const { object: j } = R;
871
- w.eventObject = j, _e(j[p], w), k.push(j);
777
+ b.eventObject = j, _e(j[m], b), k.push(j);
872
778
  let O = j.parent;
873
- for (; O !== null && !w.stopPropagating && !k.includes(O); )
874
- w.eventObject = O, _e(O[p], w), k.push(O), O = O.parent;
875
- const Y = Vn(p.slice(2));
876
- 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 });
877
783
  }
878
784
  }
879
785
  const {
880
- onClick: o,
786
+ onClick: i,
881
787
  onDblClick: f,
882
- onContextMenu: y,
788
+ onContextMenu: g,
883
789
  onPointerMove: u,
884
- onPointerDown: v,
885
- onPointerUp: h,
886
- onPointerMissed: g,
790
+ onPointerDown: y,
791
+ onPointerUp: p,
792
+ onPointerMissed: _,
887
793
  onWheel: d,
888
- forceUpdate: _
794
+ forceUpdate: v
889
795
  } = yr(a, t);
890
- 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));
891
797
  let P = [];
892
- u((p) => {
893
- const w = p.intersections.map(({ object: L }) => L), k = p.intersections;
798
+ u((m) => {
799
+ const b = m.intersections.map(({ object: L }) => L), k = m.intersections;
894
800
  P.forEach(({ object: L }) => {
895
- w.includes(L) || (p.intersections = P, c("onPointerLeave", p), c("onPointerOut", p));
896
- }), p.intersections = k, p.intersections.forEach(({ object: L }) => {
897
- P.includes(L) || (c("onPointerEnter", p), c("onPointerOver", p));
898
- }), c("onPointerMove", p), P = p.intersections;
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;
899
805
  });
900
806
  const C = [];
901
- g((p) => {
902
- const w = () => p.stopPropagating = !0;
903
- p.stopPropagation = w, C.forEach((k) => {
904
- p.stopPropagating || (p.eventObject = k, _e(k.onPointerMissed, p));
905
- }), 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 });
906
812
  });
907
- function T(p) {
908
- re(p) && N(p) && a.value.push(p);
813
+ function w(m) {
814
+ re(m) && N(m) && a.value.push(m);
909
815
  }
910
- function b(p) {
911
- if (re(p) && N(p)) {
912
- const w = a.value.indexOf(p);
913
- 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);
914
820
  }
915
821
  }
916
- function E(p) {
917
- re(p) && N(p) && p.onPointerMissed && C.push(p);
822
+ function S(m) {
823
+ re(m) && N(m) && m.onPointerMissed && C.push(m);
918
824
  }
919
- function M(p) {
920
- if (re(p) && N(p)) {
921
- const w = C.indexOf(p);
922
- 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);
923
829
  }
924
830
  }
925
831
  return t.eventManager = {
926
- forceUpdate: _,
927
- registerObject: T,
928
- deregisterObject: b,
929
- registerPointerMissedObject: E,
832
+ forceUpdate: v,
833
+ registerObject: w,
834
+ deregisterObject: E,
835
+ registerPointerMissedObject: S,
930
836
  deregisterPointerMissedObject: M
931
837
  }, {
932
- forceUpdate: _,
933
- registerObject: T,
934
- deregisterObject: b,
935
- registerPointerMissedObject: E,
838
+ forceUpdate: v,
839
+ registerObject: w,
840
+ deregisterObject: E,
841
+ registerPointerMissedObject: S,
936
842
  deregisterPointerMissedObject: M
937
843
  };
938
844
  }
939
845
  function wr(e, t, n = 100) {
940
846
  n = n <= 0 ? 100 : n;
941
- const r = D(), s = /* @__PURE__ */ new Set();
942
- let l = !1, i = !1, a = null;
847
+ const r = D(), o = /* @__PURE__ */ new Set();
848
+ let l = !1, s = !1, a = null;
943
849
  function c() {
944
- 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));
945
851
  }
946
- function o() {
947
- i = !0, a && clearTimeout(a);
852
+ function i() {
853
+ s = !0, a && clearTimeout(a);
948
854
  }
949
855
  c();
950
- const f = (u, ...v) => {
951
- u(...v);
856
+ const f = (u, ...y) => {
857
+ u(...y);
952
858
  };
953
859
  return {
954
860
  on: (u) => {
@@ -956,13 +862,14 @@ function wr(e, t, n = 100) {
956
862
  return f(u, t), { off: () => {
957
863
  } };
958
864
  {
959
- const v = r.on(u);
960
- return s.add(v.off), r.on(u);
865
+ const y = r.on(u);
866
+ return o.add(y.off), r.on(u);
961
867
  }
962
868
  },
963
869
  off: r.off,
964
870
  trigger: r.trigger,
965
- cancel: o
871
+ clear: r.clear,
872
+ cancel: i
966
873
  };
967
874
  }
968
875
  const ee = /* @__PURE__ */ new WeakMap();
@@ -973,8 +880,8 @@ function yt(e) {
973
880
  if (Date.now() - n >= t)
974
881
  return !0;
975
882
  {
976
- const i = e.renderer.value, a = (i == null ? void 0 : i.domElement) || { width: 0, height: 0 };
977
- 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);
978
885
  }
979
886
  }, e);
980
887
  return ee.set(e, l), l;
@@ -989,42 +896,40 @@ function br({
989
896
  canvas: t,
990
897
  windowSize: n,
991
898
  rendererOptions: r,
992
- emit: s
899
+ emit: o
993
900
  }) {
994
- const l = $(e), i = vr(n, t), {
901
+ const l = $(e), s = vr(n, t), {
995
902
  camera: a,
996
903
  cameras: c,
997
- registerCamera: o,
904
+ registerCamera: i,
998
905
  deregisterCamera: f,
999
- setCameraActive: y
1000
- } = ar({ sizes: i, scene: e }), u = {
906
+ setCameraActive: g
907
+ } = ar({ sizes: s }), u = {
1001
908
  mode: I(r.renderMode || "always"),
1002
909
  priority: I(0),
1003
910
  frames: I(0),
1004
911
  maxFrames: 60,
1005
- canBeInvalidated: K(() => u.mode.value === "on-demand" && u.frames.value === 0)
912
+ canBeInvalidated: q(() => u.mode.value === "on-demand" && u.frames.value === 0)
1006
913
  };
1007
- function v(R = 1) {
914
+ function y(R = 1) {
1008
915
  r.renderMode === "on-demand" && (u.frames.value = Math.min(u.maxFrames, u.frames.value + R));
1009
916
  }
1010
- function h() {
917
+ function p() {
1011
918
  r.renderMode === "manual" && (u.frames.value = 1);
1012
919
  }
1013
- const { renderer: g } = gr(
920
+ const { renderer: _ } = gr(
1014
921
  {
1015
- scene: e,
1016
922
  canvas: t,
1017
923
  options: r,
1018
- emit: s,
1019
924
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
1020
- contextParts: { sizes: i, camera: a, render: u, invalidate: v, advance: h }
925
+ contextParts: { sizes: s, render: u, invalidate: y, advance: p }
1021
926
  }
1022
927
  ), d = {
1023
- sizes: i,
928
+ sizes: s,
1024
929
  scene: l,
1025
930
  camera: a,
1026
931
  cameras: we(c),
1027
- renderer: g,
932
+ renderer: _,
1028
933
  raycaster: $(new zt()),
1029
934
  controls: I(null),
1030
935
  perf: {
@@ -1040,35 +945,35 @@ function br({
1040
945
  }
1041
946
  },
1042
947
  render: u,
1043
- advance: h,
948
+ advance: p,
1044
949
  extend: Ee,
1045
- invalidate: v,
1046
- registerCamera: o,
1047
- setCameraActive: y,
950
+ invalidate: y,
951
+ registerCamera: i,
952
+ setCameraActive: g,
1048
953
  deregisterCamera: f,
1049
954
  loop: dr()
1050
955
  };
1051
956
  le("useTres", d), d.scene.value.__tres = {
1052
957
  root: d
1053
958
  }, d.loop.register(() => {
1054
- 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);
1055
960
  }, "render");
1056
- const { on: _, cancel: P } = yt(d);
1057
- d.loop.setReady(!1), d.loop.start(), _(() => {
1058
- s("ready", d), d.loop.setReady(!0), _r(e, d, s);
1059
- }), 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(() => {
1060
965
  P(), d.loop.stop();
1061
966
  });
1062
- const C = 100, T = un({ every: C }), { isSupported: b, memory: E } = fn({ interval: C }), M = 160;
1063
- let A = performance.now();
1064
- const p = ({ timestamp: R }) => {
1065
- d.scene.value && (d.perf.memory.allocatedMem = ke(d.scene.value)), R - A >= C && (A = 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));
967
+ const C = 100, w = un({ every: C }), { isSupported: E, memory: S } = fn({ interval: C }), M = 160;
968
+ let x = performance.now();
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));
1066
971
  };
1067
- let w = 0;
972
+ let b = 0;
1068
973
  const k = 1, { pause: L } = ut(({ delta: R }) => {
1069
- window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += R, w >= k && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
974
+ window.__TRES__DEVTOOLS__ && (m({ timestamp: performance.now() }), b += R, b >= k && (window.__TRES__DEVTOOLS__.cb(d), b = 0));
1070
975
  }, { immediate: !0 });
1071
- return J(() => {
976
+ return K(() => {
1072
977
  L();
1073
978
  }), d;
1074
979
  }
@@ -1085,28 +990,28 @@ function Zr() {
1085
990
  scene: t,
1086
991
  renderer: n,
1087
992
  loop: r,
1088
- raycaster: s,
993
+ raycaster: o,
1089
994
  controls: l,
1090
- invalidate: i,
995
+ invalidate: s,
1091
996
  advance: a
1092
997
  } = me();
1093
998
  r.setContext({
1094
999
  camera: e,
1095
1000
  scene: t,
1096
1001
  renderer: n,
1097
- raycaster: s,
1002
+ raycaster: o,
1098
1003
  controls: l,
1099
- invalidate: i,
1004
+ invalidate: s,
1100
1005
  advance: a
1101
1006
  });
1102
- function c(y, u = 0) {
1103
- return r.register(y, "before", u);
1007
+ function c(g, u = 0) {
1008
+ return r.register(g, "before", u);
1104
1009
  }
1105
- function o(y) {
1106
- return r.register(y, "render");
1010
+ function i(g) {
1011
+ return r.register(g, "render");
1107
1012
  }
1108
- function f(y, u = 0) {
1109
- return r.register(y, "after", u);
1013
+ function f(g, u = 0) {
1014
+ return r.register(g, "after", u);
1110
1015
  }
1111
1016
  return {
1112
1017
  pause: r.pause,
@@ -1115,7 +1020,7 @@ function Zr() {
1115
1020
  resumeRender: r.resumeRender,
1116
1021
  isActive: r.isActive,
1117
1022
  onBeforeRender: c,
1118
- render: o,
1023
+ render: i,
1119
1024
  onAfterRender: f
1120
1025
  };
1121
1026
  }
@@ -1140,52 +1045,53 @@ const eo = () => (Qe || (Qe = !0, Je()), {
1140
1045
  isActive: Pr
1141
1046
  });
1142
1047
  function to() {
1143
- const { logWarning: e } = V();
1144
- function t(l, i, a) {
1048
+ const { logWarning: e } = Q();
1049
+ function t(l, s, a) {
1145
1050
  let c = null;
1146
- return l.traverse((o) => {
1147
- o[i] === a && (c = o);
1148
- }), 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;
1149
1054
  }
1150
- function n(l, i, a) {
1055
+ function n(l, s, a) {
1151
1056
  const c = [];
1152
- return l.traverse((o) => {
1153
- o[i].includes(a) && c.push(o);
1154
- }), 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;
1155
1060
  }
1156
- function r(l, i) {
1157
- return t(l, "name", i);
1061
+ function r(l, s) {
1062
+ return t(l, "name", s);
1158
1063
  }
1159
- function s(l, i) {
1160
- return n(l, "name", i);
1064
+ function o(l, s) {
1065
+ return n(l, "name", s);
1161
1066
  }
1162
1067
  return {
1163
1068
  seek: t,
1164
1069
  seekByName: r,
1165
1070
  seekAll: n,
1166
- seekAllByName: s
1071
+ seekAllByName: o
1167
1072
  };
1168
1073
  }
1169
1074
  function Cr(e, t = {}, n = {}) {
1170
1075
  let r = e;
1171
- const s = (a) => {
1076
+ const o = (a) => {
1172
1077
  r = a;
1173
1078
  };
1174
1079
  let l = new Proxy({}, {});
1175
- const i = {
1080
+ const s = {
1176
1081
  has(a, c) {
1177
1082
  return c in t || c in r;
1178
1083
  },
1179
- get(a, c, o) {
1084
+ get(a, c, i) {
1180
1085
  return c in t ? t[c](r) : r[c];
1181
1086
  },
1182
- set(a, c, o) {
1183
- 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;
1184
1090
  }
1185
1091
  };
1186
- return l = new Proxy({}, i), l;
1092
+ return l = new Proxy({}, s), l;
1187
1093
  }
1188
- const { logError: Xe } = V(), Ze = [
1094
+ const { logError: Xe } = Q(), Ze = [
1189
1095
  "onClick",
1190
1096
  "onContextMenu",
1191
1097
  "onPointerMove",
@@ -1202,140 +1108,140 @@ const { logError: Xe } = V(), Ze = [
1202
1108
  "onWheel"
1203
1109
  ], Er = (e) => {
1204
1110
  const t = e.scene.value;
1205
- function n(o, f, y, u) {
1206
- 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))
1207
1113
  return null;
1208
- let v = o.replace("Tres", ""), h;
1209
- if (o === "primitive") {
1210
- (!H(u.object) || xt(u.object)) && Xe(
1114
+ let y = i.replace("Tres", ""), p;
1115
+ if (i === "primitive") {
1116
+ (!H(u.object) || At(u.object)) && Xe(
1211
1117
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1212
- ), v = u.object.type;
1213
- const g = {};
1214
- h = Cr(
1118
+ ), y = u.object.type;
1119
+ const _ = {};
1120
+ p = Cr(
1215
1121
  u.object,
1216
1122
  {
1217
- object: (_) => _,
1123
+ object: (v) => v,
1218
1124
  isPrimitive: () => !0,
1219
- __tres: () => g
1125
+ __tres: () => _
1220
1126
  },
1221
1127
  {
1222
- object: (_, P, C, T) => {
1223
- 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);
1224
1130
  },
1225
- __tres: (_) => {
1226
- Object.assign(g, _);
1131
+ __tres: (v) => {
1132
+ Object.assign(_, v);
1227
1133
  }
1228
1134
  }
1229
1135
  );
1230
1136
  } else {
1231
- const g = Ce.value[v];
1232
- g || Xe(
1233
- `${v} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1234
- ), 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);
1235
1141
  }
1236
- 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, {
1237
- ...h.__tres,
1238
- 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,
1239
1145
  memoizedProps: u,
1240
1146
  eventCount: 0,
1241
- primitive: o === "primitive",
1147
+ primitive: i === "primitive",
1242
1148
  attach: u.attach
1243
- }, e), h) : null;
1149
+ }, e), p) : null;
1244
1150
  }
1245
- function r(o, f) {
1246
- var v, h, g;
1247
- if (!o)
1151
+ function r(i, f) {
1152
+ var y, p, _;
1153
+ if (!i)
1248
1154
  return;
1249
1155
  f = f || t;
1250
- const y = o.__tres ? o : z(o, {}, e), u = f.__tres ? f : z(f, {}, e);
1251
- 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);
1252
1158
  }
1253
- function s(o, f) {
1254
- var h, g, d, _;
1255
- if (!o)
1159
+ function o(i, f) {
1160
+ var p, _, d, v;
1161
+ if (!i)
1256
1162
  return;
1257
- 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;
1258
- const y = (d = o.__tres) == null ? void 0 : d.dispose;
1259
- Me(y) || (y === null ? f = !1 : f = y);
1260
- const u = (_ = o.__tres) == null ? void 0 : _.primitive, v = f === "default" ? !u : !!f;
1261
- 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)) {
1262
1168
  if (G(f))
1263
- f(o);
1264
- else if (G(o.dispose))
1169
+ f(i);
1170
+ else if (G(i.dispose))
1265
1171
  try {
1266
- o.dispose();
1172
+ i.dispose();
1267
1173
  } catch {
1268
1174
  }
1269
1175
  }
1270
- "__tres" in o && delete o.__tres;
1176
+ "__tres" in i && delete i.__tres;
1271
1177
  }
1272
- function l(o, f, y, u) {
1178
+ function l(i, f, g, u) {
1273
1179
  var P, C;
1274
- if (!o)
1180
+ if (!i)
1275
1181
  return;
1276
- let v = o, h = f;
1277
- if (o.__tres && (o.__tres.memoizedProps[f] = u), f === "attach") {
1278
- const T = ((P = o.__tres) == null ? void 0 : P.parent) || o.parent;
1279
- 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);
1280
1186
  return;
1281
1187
  }
1282
1188
  if (f === "dispose") {
1283
- o.__tres || (o = z(o, {}, e)), o.__tres.dispose = u;
1189
+ i.__tres || (i = z(i, {}, e)), i.__tres.dispose = u;
1284
1190
  return;
1285
1191
  }
1286
- if (N(o) && h === "blocks-pointer-events") {
1287
- 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];
1288
1194
  return;
1289
1195
  }
1290
- Ze.includes(f) && o.__tres && (o.__tres.eventCount += 1);
1291
- let g = oe(h), d = v == null ? void 0 : v[g];
1292
- if (h === "args") {
1293
- const T = o, b = y ?? [], E = u ?? [], M = ((C = o.__tres) == null ? void 0 : C.type) || o.type;
1294
- M && b.length && !Kn(b, E) && (v = Object.assign(
1295
- 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,
1296
1202
  new Ce.value[M](...u)
1297
1203
  ));
1298
1204
  return;
1299
1205
  }
1300
- if (v.type === "BufferGeometry") {
1301
- if (h === "args")
1206
+ if (y.type === "BufferGeometry") {
1207
+ if (p === "args")
1302
1208
  return;
1303
- v.setAttribute(
1304
- oe(h),
1305
- new Gt(...u)
1209
+ y.setAttribute(
1210
+ oe(p),
1211
+ new Vt(...u)
1306
1212
  );
1307
1213
  return;
1308
1214
  }
1309
- if (h.includes("-") && d === void 0) {
1310
- const T = h.split("-");
1311
- 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));
1312
1218
  }
1313
- let _ = u;
1314
- if (_ === "" && (_ = !0), G(d)) {
1315
- 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);
1316
1222
  return;
1317
1223
  }
1318
- !(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);
1319
1225
  }
1320
- function i(o) {
1226
+ function s(i) {
1321
1227
  var f;
1322
- 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;
1323
1229
  }
1324
- function a(o) {
1325
- const f = z(new Vt(), { type: "Comment" }, e);
1326
- return f.name = o, f;
1230
+ function a(i) {
1231
+ const f = z(new Gt(), { type: "Comment" }, e);
1232
+ return f.name = i, f;
1327
1233
  }
1328
- function c(o) {
1329
- var v;
1330
- const f = i(o), y = ((v = f == null ? void 0 : f.__tres) == null ? void 0 : v.objects) || [], u = y.indexOf(o);
1331
- 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];
1332
1238
  }
1333
1239
  return {
1334
1240
  insert: r,
1335
- remove: s,
1241
+ remove: o,
1336
1242
  createElement: n,
1337
1243
  patchProp: l,
1338
- parentNode: i,
1244
+ parentNode: s,
1339
1245
  createText: () => void 0,
1340
1246
  createComment: a,
1341
1247
  setText: () => void 0,
@@ -1353,11 +1259,11 @@ function Tr() {
1353
1259
  function bt() {
1354
1260
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1355
1261
  }
1356
- const Sr = typeof Proxy == "function", xr = "devtools-plugin:setup", Ar = "plugin:settings:set";
1357
- let q, Te;
1262
+ const Sr = typeof Proxy == "function", Ar = "devtools-plugin:setup", xr = "plugin:settings:set";
1263
+ let Y, Te;
1358
1264
  function kr() {
1359
1265
  var e;
1360
- 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;
1361
1267
  }
1362
1268
  function Lr() {
1363
1269
  return kr() ? Te.now() : Date.now();
@@ -1367,14 +1273,14 @@ class Rr {
1367
1273
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1368
1274
  const r = {};
1369
1275
  if (t.settings)
1370
- for (const i in t.settings) {
1371
- const a = t.settings[i];
1372
- r[i] = a.defaultValue;
1276
+ for (const s in t.settings) {
1277
+ const a = t.settings[s];
1278
+ r[s] = a.defaultValue;
1373
1279
  }
1374
- const s = `__vue-devtools-plugin-settings__${t.id}`;
1280
+ const o = `__vue-devtools-plugin-settings__${t.id}`;
1375
1281
  let l = Object.assign({}, r);
1376
1282
  try {
1377
- const i = localStorage.getItem(s), a = JSON.parse(i);
1283
+ const s = localStorage.getItem(o), a = JSON.parse(s);
1378
1284
  Object.assign(l, a);
1379
1285
  } catch {
1380
1286
  }
@@ -1382,36 +1288,36 @@ class Rr {
1382
1288
  getSettings() {
1383
1289
  return l;
1384
1290
  },
1385
- setSettings(i) {
1291
+ setSettings(s) {
1386
1292
  try {
1387
- localStorage.setItem(s, JSON.stringify(i));
1293
+ localStorage.setItem(o, JSON.stringify(s));
1388
1294
  } catch {
1389
1295
  }
1390
- l = i;
1296
+ l = s;
1391
1297
  },
1392
1298
  now() {
1393
1299
  return Lr();
1394
1300
  }
1395
- }, n && n.on(Ar, (i, a) => {
1396
- i === this.plugin.id && this.fallbacks.setSettings(a);
1301
+ }, n && n.on(xr, (s, a) => {
1302
+ s === this.plugin.id && this.fallbacks.setSettings(a);
1397
1303
  }), this.proxiedOn = new Proxy({}, {
1398
- get: (i, a) => this.target ? this.target.on[a] : (...c) => {
1304
+ get: (s, a) => this.target ? this.target.on[a] : (...c) => {
1399
1305
  this.onQueue.push({
1400
1306
  method: a,
1401
1307
  args: c
1402
1308
  });
1403
1309
  }
1404
1310
  }), this.proxiedTarget = new Proxy({}, {
1405
- 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({
1406
1312
  method: a,
1407
1313
  args: c,
1408
1314
  resolve: () => {
1409
1315
  }
1410
- }), this.fallbacks[a](...c)) : (...c) => new Promise((o) => {
1316
+ }), this.fallbacks[a](...c)) : (...c) => new Promise((i) => {
1411
1317
  this.targetQueue.push({
1412
1318
  method: a,
1413
1319
  args: c,
1414
- resolve: o
1320
+ resolve: i
1415
1321
  });
1416
1322
  })
1417
1323
  });
@@ -1425,16 +1331,16 @@ class Rr {
1425
1331
  }
1426
1332
  }
1427
1333
  function Or(e, t) {
1428
- const n = e, r = bt(), s = Tr(), l = Sr && n.enableEarlyProxy;
1429
- if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1430
- s.emit(xr, 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);
1431
1337
  else {
1432
- const i = l ? new Rr(n, s) : null;
1338
+ const s = l ? new Rr(n, o) : null;
1433
1339
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1434
1340
  pluginDescriptor: n,
1435
1341
  setupFn: t,
1436
- proxy: i
1437
- }), i && t(i.proxiedTarget);
1342
+ proxy: s
1343
+ }), s && t(s.proxiedTarget);
1438
1344
  }
1439
1345
  }
1440
1346
  function Dr(e, t) {
@@ -1488,8 +1394,8 @@ function Pt(e, t, n = "") {
1488
1394
  e.children.forEach((r) => {
1489
1395
  if (r.type === "HightlightMesh" || n && !r.type.includes(n) && !r.name.includes(n))
1490
1396
  return;
1491
- const s = Mt(r);
1492
- t.children.push(s), Pt(r, s, n);
1397
+ const o = Mt(r);
1398
+ t.children.push(o), Pt(r, o, n);
1493
1399
  });
1494
1400
  }
1495
1401
  const jr = [], X = "tres:inspector", Br = Se({
@@ -1520,39 +1426,46 @@ function Ir(e, t) {
1520
1426
  n.notifyComponentUpdate();
1521
1427
  }, 5e3), n.on.getInspectorTree((l) => {
1522
1428
  if (l.inspectorId === X) {
1523
- const i = Mt(t.scene.value);
1524
- 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];
1525
1431
  }
1526
1432
  });
1527
- let r = null, s = null;
1433
+ let r = null, o = null;
1528
1434
  n.on.getInspectorState((l) => {
1529
- var i;
1435
+ var s;
1530
1436
  if (l.inspectorId === X) {
1531
1437
  const [a] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1532
1438
  if (!a)
1533
1439
  return;
1534
- if (s && r && r.parent && s.remove(r), a.isMesh) {
1440
+ if (o && r && r.parent && o.remove(r), a.isMesh) {
1535
1441
  const c = Xn(a);
1536
- a.add(c), r = c, s = a;
1442
+ a.add(c), r = c, o = a;
1537
1443
  }
1538
1444
  l.state = {
1539
- 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")
1540
- }, a.isScene && (l.state.info = {
1541
- objects: a.children.length,
1542
- memory: ke(a),
1543
- calls: t.renderer.value.info.render.calls,
1544
- triangles: t.renderer.value.info.render.triangles,
1545
- points: t.renderer.value.info.render.points,
1546
- lines: t.renderer.value.info.render.lines
1547
- }, l.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((c) => ({
1548
- key: c.name,
1549
- value: {
1550
- ...c,
1551
- vertexShader: c.vertexShader,
1552
- attributes: c.getAttributes(),
1553
- uniforms: c.getUniforms()
1554
- }
1555
- }))) || []);
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
+ });
1556
1469
  }
1557
1470
  }), n.on.editInspectorState((l) => {
1558
1471
  l.inspectorId === X && Qn(t.scene.value, l.nodeId, l.path, l.state.value);
@@ -1606,83 +1519,81 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
1606
1519
  "ready"
1607
1520
  ],
1608
1521
  setup(e, { expose: t, emit: n }) {
1609
- const r = e, s = n, l = At(), { 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();
1610
1523
  Ee(ot);
1611
- const f = (g, d = !1) => fe({
1524
+ const i = (p, _ = !1) => fe({
1612
1525
  setup() {
1613
- var T;
1614
- const _ = (T = He()) == null ? void 0 : T.appContext;
1615
- _ && (_.app = o == null ? void 0 : o.appContext.app);
1616
- const P = {};
1617
- function C(b) {
1618
- 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));
1619
1532
  }
1620
- return o != null && o.parent && r.enableProvideBridge && (C(o.parent), Reflect.ownKeys(P).forEach((b) => {
1621
- le(b, P[b]);
1622
- })), 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());
1623
1536
  }
1624
- }), y = (g, d = !1) => {
1625
- const _ = f(g, d), { render: P } = jt(Er(g));
1626
- P(Ue(_), c.value);
1627
- }, u = (g, d = !1) => {
1628
- mt(g.scene.value), d && (g.renderer.value.dispose(), g.renderer.value.renderLists.dispose(), g.renderer.value.forceContextLoss()), c.value.__tres = {
1629
- 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
1630
1543
  };
1631
- }, v = $(null);
1632
- t({ context: v, dispose: () => u(v.value, !0) });
1633
- const h = () => {
1634
- 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);
1635
1548
  };
1636
1549
  return kt(() => {
1637
- const g = a;
1638
- v.value = br({
1639
- scene: c.value,
1640
- canvas: g,
1550
+ const p = s;
1551
+ u.value = br({
1552
+ scene: a.value,
1553
+ canvas: p,
1641
1554
  windowSize: r.windowSize ?? !1,
1642
1555
  rendererOptions: r,
1643
- emit: s
1556
+ emit: o
1644
1557
  });
1645
- const { registerCamera: d, camera: _, cameras: P, deregisterCamera: C } = v.value;
1646
- y(v.value);
1647
- const T = () => {
1648
- 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(
1649
1562
  45,
1650
1563
  window.innerWidth / window.innerHeight,
1651
1564
  0.1,
1652
1565
  1e3
1653
1566
  );
1654
- b.position.set(3, 3, 3), b.lookAt(0, 0, 0), d(b);
1655
- const E = xe(() => {
1656
- P.value.length >= 2 && (b.removeFromParent(), C(b), E == null || E());
1567
+ w.position.set(3, 3, 3), w.lookAt(0, 0, 0), _(w);
1568
+ const E = Ae(() => {
1569
+ v.value.length >= 2 && (w.removeFromParent(), P(w), E == null || E());
1657
1570
  });
1658
1571
  };
1659
1572
  ae(
1660
1573
  () => r.camera,
1661
- (b, E) => {
1662
- b && d(b), E && (E.removeFromParent(), C(E));
1574
+ (w, E) => {
1575
+ w && _(w), E && (E.removeFromParent(), P(E));
1663
1576
  },
1664
1577
  {
1665
1578
  immediate: !0
1666
1579
  }
1667
- ), _.value || (i(
1668
- "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1669
- ), T());
1670
- }), J(h), (g, d) => (Lt(), Rt("canvas", {
1580
+ ), d.value || C();
1581
+ }), K(y), (p, _) => (Rt(), Lt("canvas", {
1671
1582
  ref_key: "canvas",
1672
- ref: a,
1673
- "data-scene": c.value.uuid,
1674
- class: Ot(g.$attrs.class),
1583
+ ref: s,
1584
+ "data-scene": a.value.uuid,
1585
+ class: Dt(p.$attrs.class),
1675
1586
  "data-tres": `tresjs ${W(Rn).version}`,
1676
- style: Dt({
1587
+ style: Ot({
1677
1588
  display: "block",
1678
1589
  width: "100%",
1679
1590
  height: "100%",
1680
- position: g.windowSize ? "fixed" : "relative",
1591
+ position: p.windowSize ? "fixed" : "relative",
1681
1592
  top: 0,
1682
1593
  left: 0,
1683
1594
  pointerEvents: "auto",
1684
1595
  touchAction: "none",
1685
- ...g.$attrs.style
1596
+ ...p.$attrs.style
1686
1597
  })
1687
1598
  }, null, 14, $r));
1688
1599
  }
@@ -1696,11 +1607,11 @@ const $r = ["data-scene", "data-tres"], Hr = /* @__PURE__ */ fe({
1696
1607
  isCustomElement: (e) => e.startsWith("Tres") && !Ur.includes(e) || e === "primitive"
1697
1608
  }
1698
1609
  }
1699
- }, { logWarning: Fr } = V();
1610
+ }, { logWarning: Fr } = Q();
1700
1611
  let B = null;
1701
1612
  const ro = {
1702
1613
  updated: (e, t) => {
1703
- var s;
1614
+ var o;
1704
1615
  const n = Zn(t);
1705
1616
  if (!n) {
1706
1617
  Fr(`v-distance-to: problem with binding value: ${t.value}`);
@@ -1711,23 +1622,23 @@ const ro = {
1711
1622
  r.normalize(), B = new Yt(r, e.position, e.position.distanceTo(n), 16776960), e.parent.add(B), console.table(
1712
1623
  [
1713
1624
  ["Distance:", e.position.distanceTo(n)],
1714
- [`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}`],
1715
1626
  [`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
1716
1627
  ]
1717
1628
  );
1718
1629
  },
1719
1630
  unmounted: (e) => {
1720
- B == null || B.dispose(), e.parent.remove(B);
1631
+ B == null || B.dispose(), e.parent && e.parent.remove(B);
1721
1632
  }
1722
1633
  };
1723
1634
  class Ct extends qt {
1724
1635
  constructor(t, n) {
1725
- const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Fe();
1726
- 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();
1727
1638
  const l = new Kt({ fog: !1 });
1728
- super(s, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1729
- const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Fe();
1730
- 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 })));
1731
1642
  }
1732
1643
  updateMatrixWorld() {
1733
1644
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
@@ -1743,13 +1654,13 @@ class Ct extends qt {
1743
1654
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1744
1655
  }
1745
1656
  }
1746
- const { logWarning: tt } = V();
1657
+ const { logWarning: tt } = Q();
1747
1658
  let ie, F;
1748
1659
  const Wr = {
1749
- DirectionalLight: Xt,
1750
- PointLight: Zt,
1751
- SpotLight: en,
1752
- HemisphereLight: tn,
1660
+ DirectionalLight: tn,
1661
+ PointLight: en,
1662
+ SpotLight: Zt,
1663
+ HemisphereLight: Xt,
1753
1664
  RectAreaLight: Ct
1754
1665
  }, oo = {
1755
1666
  mounted: (e) => {
@@ -1767,7 +1678,7 @@ const Wr = {
1767
1678
  tt(`${e.type} is not a light`);
1768
1679
  return;
1769
1680
  }
1770
- 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);
1771
1682
  }
1772
1683
  }, so = {
1773
1684
  mounted: (e, t) => {
@@ -1796,10 +1707,10 @@ export {
1796
1707
  Jr as normalizeVectorFlexibleParam,
1797
1708
  Qr as onTresReady,
1798
1709
  no as templateCompilerOptions,
1799
- On as trasverseObjects,
1710
+ On as traverseObjects,
1800
1711
  ar as useCamera,
1801
1712
  Dn as useLoader,
1802
- V as useLogger,
1713
+ Q as useLogger,
1803
1714
  Zr as useLoop,
1804
1715
  yr as useRaycaster,
1805
1716
  eo as useRenderLoop,