@tresjs/core 4.0.1 → 4.1.0-next.0

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,24 +1,24 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.0.1
3
+ * version: v4.1.0-next.0
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- var st = Object.defineProperty;
9
- var it = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
- var se = (e, t, n) => (it(e, typeof t != "symbol" ? t + "" : t, n), n);
11
- import { ref as A, computed as B, watchEffect as ve, onUnmounted as N, shallowRef as U, watch as V, reactive as We, readonly as ue, unref as W, provide as ce, inject as at, defineComponent as Se, useSlots as lt, getCurrentInstance as xe, onMounted as ut, openBlock as ct, createElementBlock as ft, normalizeClass as dt, normalizeStyle as pt, createRenderer as mt, h as Te, Fragment as vt } from "vue";
12
- import * as Ne from "three";
13
- import { PerspectiveCamera as fe, Camera as gt, Clock as ze, Vector3 as ge, Color as re, Scene as Ge, MeshBasicMaterial as Ve, DoubleSide as ht, REVISION as yt, SRGBColorSpace as bt, ACESFilmicToneMapping as qe, PCFSoftShadowMap as wt, NoToneMapping as Mt, WebGLRenderer as ie, TextureLoader as Pt, Vector2 as ae, MathUtils as Ct, Raycaster as _t, BufferAttribute as Et, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Oe, LineBasicMaterial as St, Mesh as xt, BackSide as Tt, DirectionalLightHelper as At, PointLightHelper as Ot, SpotLightHelper as Lt, HemisphereLightHelper as Dt, ArrowHelper as Bt } from "three";
14
- import { createEventHook as x, useRafFn as Ye, toValue as k, unrefElement as Rt, useDevicePixelRatio as jt, usePointer as It, useElementBounding as Ht, useWindowSize as Ut, useElementSize as $t, refDebounced as Le, tryOnScopeDispose as Ft, useFps as Wt, useMemory as Nt } from "@vueuse/core";
15
- const zt = "@tresjs/core", Gt = "module", Vt = "4.0.1", qt = "pnpm@9.1.4", Yt = "Declarative ThreeJS using Vue Components", Jt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Qt = "MIT", Kt = [
8
+ var at = Object.defineProperty;
9
+ var lt = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
10
+ var ie = (e, t, r) => (lt(e, typeof t != "symbol" ? t + "" : t, r), r);
11
+ import { ref as L, computed as D, watchEffect as ve, onUnmounted as N, shallowRef as H, watch as G, reactive as ze, readonly as ue, unref as W, provide as fe, inject as ct, defineComponent as xe, useSlots as ut, getCurrentInstance as ke, onMounted as ft, openBlock as pt, createElementBlock as dt, normalizeClass as mt, normalizeStyle as gt, createRenderer as vt, h as Oe, Fragment as ht } from "vue";
12
+ import * as Ge from "three";
13
+ import { PerspectiveCamera as pe, Camera as yt, Clock as Ve, Vector3 as he, Color as re, Scene as qe, MeshBasicMaterial as Ye, DoubleSide as wt, REVISION as bt, SRGBColorSpace as Mt, ACESFilmicToneMapping as Je, PCFSoftShadowMap as Pt, NoToneMapping as _t, WebGLRenderer as ae, TextureLoader as Ct, Vector2 as le, MathUtils as Et, Raycaster as St, BufferAttribute as Tt, Object3D as xt, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Le, LineBasicMaterial as Ot, Mesh as At, BackSide as Lt, DirectionalLightHelper as Dt, PointLightHelper as Bt, SpotLightHelper as jt, HemisphereLightHelper as Rt, ArrowHelper as It } from "three";
14
+ import { createEventHook as A, useRafFn as Qe, toValue as T, unrefElement as Ht, useDevicePixelRatio as $t, usePointer as Ft, useElementBounding as Ut, useWindowSize as Wt, useElementSize as Nt, refDebounced as De, tryOnScopeDispose as zt, useFps as Gt, useMemory as Vt } from "@vueuse/core";
15
+ const qt = "@tresjs/core", Yt = "module", Jt = "4.1.0-next.0", Qt = "pnpm@9.1.4", Kt = "Declarative ThreeJS using Vue Components", Xt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Zt = "MIT", er = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
19
19
  "three",
20
20
  "threejs-vue"
21
- ], Xt = !1, Zt = {
21
+ ], tr = !1, rr = {
22
22
  ".": {
23
23
  types: "./dist/index.d.ts",
24
24
  import: "./dist/tres.js",
@@ -37,12 +37,12 @@ const zt = "@tresjs/core", Gt = "module", Vt = "4.0.1", qt = "pnpm@9.1.4", Yt =
37
37
  types: "./dist/src/utils/index.d.ts"
38
38
  },
39
39
  "./*": "./*"
40
- }, er = "./dist/tres.js", tr = "./dist/tres.js", rr = "./dist/index.d.ts", nr = [
40
+ }, nr = "./dist/tres.js", or = "./dist/tres.js", sr = "./dist/index.d.ts", ir = [
41
41
  "*.d.ts",
42
42
  "dist"
43
- ], or = {
43
+ ], ar = {
44
44
  access: "public"
45
- }, sr = {
45
+ }, lr = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -59,14 +59,14 @@ const zt = "@tresjs/core", Gt = "module", Vt = "4.0.1", qt = "pnpm@9.1.4", Yt =
59
59
  "docs:preview": "vitepress preview docs",
60
60
  "docs:contributors": "esno scripts/update-contributors.ts",
61
61
  prepare: "node .husky/install.mjs"
62
- }, ir = {
62
+ }, cr = {
63
63
  three: ">=0.133",
64
64
  vue: ">=3.4"
65
- }, ar = {
65
+ }, ur = {
66
66
  "@alvarosabu/utils": "^3.2.0",
67
67
  "@vue/devtools-api": "^6.6.2",
68
68
  "@vueuse/core": "^10.10.0"
69
- }, lr = {
69
+ }, fr = {
70
70
  "@release-it/conventional-changelog": "^8.0.1",
71
71
  "@stackblitz/sdk": "^1.10.0",
72
72
  "@tresjs/cientos": "3.9.0",
@@ -106,77 +106,77 @@ const zt = "@tresjs/core", Gt = "module", Vt = "4.0.1", qt = "pnpm@9.1.4", Yt =
106
106
  vitest: "^1.6.0",
107
107
  vue: "^3.4.27",
108
108
  "vue-demi": "^0.14.8"
109
- }, ur = {
110
- name: zt,
111
- type: Gt,
112
- version: Vt,
113
- packageManager: qt,
114
- description: Yt,
115
- author: Jt,
116
- license: Qt,
117
- keywords: Kt,
118
- sideEffects: Xt,
119
- exports: Zt,
120
- main: er,
121
- module: tr,
122
- types: rr,
123
- files: nr,
124
- publishConfig: or,
125
- scripts: sr,
126
- peerDependencies: ir,
127
- dependencies: ar,
128
- devDependencies: lr
129
- }, cr = ({ sizes: e }) => {
130
- const t = A([]), n = B(
109
+ }, pr = {
110
+ name: qt,
111
+ type: Yt,
112
+ version: Jt,
113
+ packageManager: Qt,
114
+ description: Kt,
115
+ author: Xt,
116
+ license: Zt,
117
+ keywords: er,
118
+ sideEffects: tr,
119
+ exports: rr,
120
+ main: nr,
121
+ module: or,
122
+ types: sr,
123
+ files: ir,
124
+ publishConfig: ar,
125
+ scripts: lr,
126
+ peerDependencies: cr,
127
+ dependencies: ur,
128
+ devDependencies: fr
129
+ }, dr = ({ sizes: e }) => {
130
+ const t = L([]), r = D(
131
131
  () => t.value[0]
132
- ), o = (r) => {
133
- const s = r instanceof gt ? r : t.value.find((a) => a.uuid === r);
134
- if (!s)
132
+ ), o = (i) => {
133
+ const a = i instanceof yt ? i : t.value.find((f) => f.uuid === i);
134
+ if (!a)
135
135
  return;
136
- const u = t.value.filter(({ uuid: a }) => a !== s.uuid);
137
- t.value = [s, ...u];
138
- }, i = (r, s = !1) => {
139
- t.value.some(({ uuid: u }) => u === r.uuid) || (s ? o(r) : t.value.push(r));
140
- }, l = (r) => {
141
- t.value = t.value.filter(({ uuid: s }) => s !== r.uuid);
136
+ const n = t.value.filter(({ uuid: f }) => f !== a.uuid);
137
+ t.value = [a, ...n];
138
+ }, s = (i, a = !1) => {
139
+ t.value.some(({ uuid: n }) => n === i.uuid) || (a ? o(i) : t.value.push(i));
140
+ }, c = (i) => {
141
+ t.value = t.value.filter(({ uuid: a }) => a !== i.uuid);
142
142
  };
143
143
  return ve(() => {
144
- e.aspectRatio.value && t.value.forEach((r) => {
145
- !r.manual && (r instanceof fe || fr(r)) && (r instanceof fe ? r.aspect = e.aspectRatio.value : (r.left = e.width.value * -0.5, r.right = e.width.value * 0.5, r.top = e.height.value * 0.5, r.bottom = e.height.value * -0.5), r.updateProjectionMatrix());
144
+ e.aspectRatio.value && t.value.forEach((i) => {
145
+ !i.manual && (i instanceof pe || mr(i)) && (i instanceof pe ? 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());
146
146
  });
147
147
  }), N(() => {
148
148
  t.value = [];
149
149
  }), {
150
- camera: n,
150
+ camera: r,
151
151
  cameras: t,
152
- registerCamera: i,
153
- deregisterCamera: l,
152
+ registerCamera: s,
153
+ deregisterCamera: c,
154
154
  setCameraActive: o
155
155
  };
156
156
  };
157
- function fr(e) {
157
+ function mr(e) {
158
158
  return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
159
159
  }
160
- const Je = x(), Qe = x(), he = x(), q = new ze();
160
+ const Ke = A(), Xe = A(), ye = A(), V = new Ve();
161
161
  let ne = 0, oe = 0;
162
- const { pause: dr, resume: De, isActive: pr } = Ye(
162
+ const { pause: gr, resume: Be, isActive: vr } = Qe(
163
163
  () => {
164
- Je.trigger({ delta: ne, elapsed: oe, clock: q }), Qe.trigger({ delta: ne, elapsed: oe, clock: q }), he.trigger({ delta: ne, elapsed: oe, clock: q });
164
+ Ke.trigger({ delta: ne, elapsed: oe, clock: V }), Xe.trigger({ delta: ne, elapsed: oe, clock: V }), ye.trigger({ delta: ne, elapsed: oe, clock: V });
165
165
  },
166
166
  { immediate: !1 }
167
167
  );
168
- he.on(() => {
169
- ne = q.getDelta(), oe = q.getElapsedTime();
168
+ ye.on(() => {
169
+ ne = V.getDelta(), oe = V.getElapsedTime();
170
170
  });
171
- let Be = !1;
172
- const un = () => (Be || (Be = !0, De()), {
173
- onBeforeLoop: Je.on,
174
- onLoop: Qe.on,
175
- onAfterLoop: he.on,
176
- pause: dr,
177
- resume: De,
178
- isActive: pr
179
- }), cn = !0, K = "[TresJS ▲ ■ ●] ";
171
+ let je = !1;
172
+ const fn = () => (je || (je = !0, Be()), {
173
+ onBeforeLoop: Ke.on,
174
+ onLoop: Xe.on,
175
+ onAfterLoop: ye.on,
176
+ pause: gr,
177
+ resume: Be,
178
+ isActive: vr
179
+ }), pn = !0, K = "[TresJS ▲ ■ ●] ";
180
180
  function $() {
181
181
  function e(...o) {
182
182
  typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
@@ -184,605 +184,608 @@ function $() {
184
184
  function t(...o) {
185
185
  typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.warn(...o);
186
186
  }
187
- function n(o, i) {
187
+ function r(o, s) {
188
188
  }
189
189
  return {
190
190
  logError: e,
191
191
  logWarning: t,
192
- logMessage: n
192
+ logMessage: r
193
193
  };
194
194
  }
195
- function fn(e) {
196
- return typeof e == "number" ? [e, e, e] : e instanceof ge ? [e.x, e.y, e.z] : e;
195
+ function dn(e) {
196
+ return typeof e == "number" ? [e, e, e] : e instanceof he ? [e.x, e.y, e.z] : e;
197
197
  }
198
- function mr(e) {
198
+ function hr(e) {
199
199
  return e instanceof re ? e : Array.isArray(e) ? new re(...e) : new re(e);
200
200
  }
201
- class vr extends Ne.Mesh {
202
- constructor(...n) {
203
- super(...n);
204
- se(this, "type", "HightlightMesh");
205
- se(this, "createTime");
201
+ class yr extends Ge.Mesh {
202
+ constructor(...r) {
203
+ super(...r);
204
+ ie(this, "type", "HightlightMesh");
205
+ ie(this, "createTime");
206
206
  this.createTime = Date.now();
207
207
  }
208
208
  onBeforeRender() {
209
- const o = (Date.now() - this.createTime) / 1e3, r = 1 + 0.07 * Math.sin(2.5 * o);
210
- this.scale.set(r, r, r);
209
+ const o = (Date.now() - this.createTime) / 1e3, i = 1 + 0.07 * Math.sin(2.5 * o);
210
+ this.scale.set(i, i, i);
211
211
  }
212
212
  }
213
- const Ke = (e, t) => {
214
- for (const n of Object.keys(t))
215
- t[n] instanceof Object && Object.assign(t[n], Ke(e[n], t[n]));
213
+ const Ze = (e, t) => {
214
+ for (const r of Object.keys(t))
215
+ t[r] instanceof Object && Object.assign(t[r], Ze(e[r], t[r]));
216
216
  return Object.assign(e || {}, t), e;
217
- }, gr = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", hr = /* @__PURE__ */ wr(gr);
217
+ }, wr = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", br = /* @__PURE__ */ _r(wr);
218
218
  function Re(e) {
219
219
  return e && e.nodeType === 1;
220
220
  }
221
221
  function X(e) {
222
- return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
222
+ return e.replace(/-([a-z])/g, (t, r) => r.toUpperCase());
223
223
  }
224
- const yr = /\B([A-Z])/g;
225
- function br(e) {
226
- return e.replace(yr, "-$1").toLowerCase();
224
+ const Mr = /\B([A-Z])/g;
225
+ function Pr(e) {
226
+ return e.replace(Mr, "-$1").toLowerCase();
227
227
  }
228
- function wr(e, t) {
229
- const n = /* @__PURE__ */ Object.create(null), o = e.split(",");
230
- for (let i = 0; i < o.length; i++)
231
- n[o[i]] = !0;
232
- return (i) => !!n[i];
228
+ function _r(e, t) {
229
+ const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
230
+ for (let s = 0; s < o.length; s++)
231
+ r[o[s]] = !0;
232
+ return (s) => !!r[s];
233
233
  }
234
- const Mr = (e, t) => {
235
- const n = /* @__PURE__ */ new Set(), o = [];
236
- for (const i of e) {
237
- const l = t(i);
238
- n.has(l) || (n.add(l), o.push(i));
234
+ const Cr = (e, t) => {
235
+ const r = /* @__PURE__ */ new Set(), o = [];
236
+ for (const s of e) {
237
+ const c = t(s);
238
+ r.has(c) || (r.add(c), o.push(s));
239
239
  }
240
240
  return o;
241
- }, je = (e, t) => {
241
+ }, Ie = (e, t) => {
242
242
  if (!t)
243
243
  return;
244
- const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
245
- return n == null ? void 0 : n.reduce((o, i) => o && o[i], e);
246
- }, Pr = (e, t, n) => {
244
+ const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
245
+ return r == null ? void 0 : r.reduce((o, s) => o && o[s], e);
246
+ }, Er = (e, t, r) => {
247
247
  const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
248
- o && o.reduce((i, l, r) => (i[l] === void 0 && (i[l] = {}), r === o.length - 1 && (i[l] = n), i[l]), e);
248
+ o && o.reduce((s, c, i) => (s[c] === void 0 && (s[c] = {}), i === o.length - 1 && (s[c] = r), s[c]), e);
249
249
  };
250
- function Xe(e, t) {
250
+ function et(e, t) {
251
251
  if (Re(e) && Re(t)) {
252
- const i = e.attributes, l = t.attributes;
253
- return i.length !== l.length ? !1 : Array.from(i).every(({ name: r, value: s }) => t.getAttribute(r) === s);
252
+ const s = e.attributes, c = t.attributes;
253
+ return s.length !== c.length ? !1 : Array.from(s).every(({ name: i, value: a }) => t.getAttribute(i) === a);
254
254
  }
255
255
  if (e === t)
256
256
  return !0;
257
257
  if (e === null || typeof e != "object" || t === null || typeof t != "object")
258
258
  return !1;
259
- const n = Object.keys(e), o = Object.keys(t);
260
- if (n.length !== o.length)
259
+ const r = Object.keys(e), o = Object.keys(t);
260
+ if (r.length !== o.length)
261
261
  return !1;
262
- for (const i of n)
263
- if (!o.includes(i) || !Xe(e[i], t[i]))
262
+ for (const s of r)
263
+ if (!o.includes(s) || !et(e[s], t[s]))
264
264
  return !1;
265
265
  return !0;
266
266
  }
267
- function Cr(e, t) {
267
+ function Sr(e, t) {
268
268
  if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
269
269
  return !1;
270
- for (let n = 0; n < e.length; n++)
271
- if (!Xe(e[n], t[n]))
270
+ for (let r = 0; r < e.length; r++)
271
+ if (!et(e[r], t[r]))
272
272
  return !1;
273
273
  return !0;
274
274
  }
275
- const _r = Array.isArray;
276
- function Er(e, t, n, o) {
277
- const i = (u) => {
278
- if (u.uuid === t)
279
- return u;
280
- for (const a of u.children) {
281
- const y = i(a);
282
- if (y)
283
- return y;
275
+ const Tr = Array.isArray;
276
+ function xr(e, t, r, o) {
277
+ const s = (n) => {
278
+ if (n.uuid === t)
279
+ return n;
280
+ for (const f of n.children) {
281
+ const h = s(f);
282
+ if (h)
283
+ return h;
284
284
  }
285
- }, l = i(e);
286
- if (!l) {
285
+ }, c = s(e);
286
+ if (!c) {
287
287
  console.warn("Object with UUID not found in the scene.");
288
288
  return;
289
289
  }
290
- let r = l;
291
- for (let u = 0; u < n.length - 1; u++)
292
- if (r[n[u]] !== void 0)
293
- r = r[n[u]];
290
+ let i = c;
291
+ for (let n = 0; n < r.length - 1; n++)
292
+ if (i[r[n]] !== void 0)
293
+ i = i[r[n]];
294
294
  else {
295
- console.warn(`Property path is not valid: ${n.join(".")}`);
295
+ console.warn(`Property path is not valid: ${r.join(".")}`);
296
296
  return;
297
297
  }
298
- const s = n[n.length - 1];
299
- r[s] !== void 0 ? r[s] = o : console.warn(`Property path is not valid: ${n.join(".")}`);
298
+ const a = r[r.length - 1];
299
+ i[a] !== void 0 ? i[a] = o : console.warn(`Property path is not valid: ${r.join(".")}`);
300
300
  }
301
301
  function kr(e) {
302
- const t = new Ve({
302
+ const t = new Ye({
303
303
  color: 11003607,
304
304
  // Highlight color, e.g., yellow
305
305
  transparent: !0,
306
306
  opacity: 0.2,
307
307
  depthTest: !1,
308
308
  // So the highlight is always visible
309
- side: ht
309
+ side: wt
310
310
  // To e
311
311
  });
312
- return new vr(e.geometry.clone(), t);
312
+ return new yr(e.geometry.clone(), t);
313
313
  }
314
- function Sr(e) {
315
- var n;
314
+ function Or(e) {
315
+ var r;
316
316
  let t = e.value;
317
- return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new ge(...t)), t;
317
+ return e.value && ((r = e.value) != null && r.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new he(...t)), t;
318
318
  }
319
- function xr(e) {
319
+ function Ar(e) {
320
320
  return "map" in e;
321
321
  }
322
- function Ie(e) {
323
- xr(e) && e.map && e.map.dispose(), e.dispose();
322
+ function He(e) {
323
+ Ar(e) && e.map && e.map.dispose(), e.dispose();
324
324
  }
325
- function ye(e) {
326
- var n, o;
327
- if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof Ge)) {
328
- const i = e;
329
- e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((l) => Ie(l)), delete i.material) : i.material && (Ie(i.material), delete i.material);
325
+ function we(e) {
326
+ var r, o;
327
+ if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((s) => we(s)), !(e instanceof qe)) {
328
+ const s = e;
329
+ e && ((o = e.dispose) == null || o.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((c) => He(c)), delete s.material) : s.material && (He(s.material), delete s.material);
330
330
  }
331
331
  }
332
- const Tr = Number.parseInt(yt.replace("dev", "")), Z = {
332
+ const Lr = Number.parseInt(bt.replace("dev", "")), Z = {
333
333
  realistic: {
334
334
  shadows: !0,
335
335
  physicallyCorrectLights: !0,
336
- outputColorSpace: bt,
337
- toneMapping: qe,
336
+ outputColorSpace: Mt,
337
+ toneMapping: Je,
338
338
  toneMappingExposure: 3,
339
339
  shadowMap: {
340
340
  enabled: !0,
341
- type: wt
341
+ type: Pt
342
342
  }
343
343
  },
344
344
  flat: {
345
- toneMapping: Mt,
345
+ toneMapping: _t,
346
346
  toneMappingExposure: 1
347
347
  }
348
348
  };
349
- function Ar({
349
+ function Dr({
350
350
  canvas: e,
351
351
  options: t,
352
- contextParts: { sizes: n, render: o, invalidate: i, advance: l }
352
+ contextParts: { sizes: r, render: o, invalidate: s, advance: c }
353
353
  }) {
354
- const r = B(() => ({
355
- alpha: k(t.alpha) ?? !0,
356
- depth: k(t.depth),
357
- canvas: Rt(e),
358
- context: k(t.context),
359
- stencil: k(t.stencil),
360
- antialias: k(t.antialias) ?? !0,
361
- precision: k(t.precision),
362
- powerPreference: k(t.powerPreference),
363
- premultipliedAlpha: k(t.premultipliedAlpha),
364
- preserveDrawingBuffer: k(t.preserveDrawingBuffer),
365
- logarithmicDepthBuffer: k(t.logarithmicDepthBuffer),
366
- failIfMajorPerformanceCaveat: k(t.failIfMajorPerformanceCaveat)
367
- })), s = U(new ie(r.value));
368
- function u() {
369
- t.renderMode === "on-demand" && i();
354
+ const i = D(() => ({
355
+ alpha: T(t.alpha) ?? !0,
356
+ depth: T(t.depth),
357
+ canvas: Ht(e),
358
+ context: T(t.context),
359
+ stencil: T(t.stencil),
360
+ antialias: T(t.antialias) ?? !0,
361
+ precision: T(t.precision),
362
+ powerPreference: T(t.powerPreference),
363
+ premultipliedAlpha: T(t.premultipliedAlpha),
364
+ preserveDrawingBuffer: T(t.preserveDrawingBuffer),
365
+ logarithmicDepthBuffer: T(t.logarithmicDepthBuffer),
366
+ failIfMajorPerformanceCaveat: T(t.failIfMajorPerformanceCaveat)
367
+ })), a = H(new ae(i.value));
368
+ function n() {
369
+ t.renderMode === "on-demand" && s();
370
370
  }
371
- V(r, () => {
372
- s.value.dispose(), s.value = new ie(r.value), u();
373
- }), V([n.width, n.height], () => {
374
- s.value.setSize(n.width.value, n.height.value), u();
371
+ G(i, () => {
372
+ a.value.dispose(), a.value = new ae(i.value), n();
373
+ }), G([r.width, r.height], () => {
374
+ a.value.setSize(r.width.value, r.height.value), n();
375
375
  }, {
376
376
  immediate: !0
377
- }), V(() => t.clearColor, u);
378
- const { pixelRatio: a } = jt();
379
- V(a, () => {
380
- s.value.setPixelRatio(a.value);
377
+ }), G(() => t.clearColor, n);
378
+ const { pixelRatio: f } = $t();
379
+ G(f, () => {
380
+ a.value.setPixelRatio(f.value);
381
381
  });
382
- const { logError: y } = $(), p = (() => {
383
- const f = new ie(), b = {
382
+ const { logError: h } = $(), w = (() => {
383
+ const p = new ae(), P = {
384
384
  shadowMap: {
385
- enabled: f.shadowMap.enabled,
386
- type: f.shadowMap.type
385
+ enabled: p.shadowMap.enabled,
386
+ type: p.shadowMap.type
387
387
  },
388
- toneMapping: f.toneMapping,
389
- toneMappingExposure: f.toneMappingExposure,
390
- outputColorSpace: f.outputColorSpace
388
+ toneMapping: p.toneMapping,
389
+ toneMappingExposure: p.toneMappingExposure,
390
+ outputColorSpace: p.outputColorSpace
391
391
  };
392
- return f.dispose(), b;
393
- })(), P = k(t.renderMode);
394
- return P === "on-demand" && i(), P === "manual" && setTimeout(() => {
395
- l();
392
+ return p.dispose(), P;
393
+ })(), b = T(t.renderMode);
394
+ return b === "on-demand" && s(), b === "manual" && setTimeout(() => {
395
+ c();
396
396
  }, 100), ve(() => {
397
- const f = k(t.preset);
398
- f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ke(s.value, Z[f])), P === "always" && (o.frames.value = Math.max(1, o.frames.value));
399
- const b = (v, h) => {
400
- const _ = k(v), g = () => {
401
- if (f)
402
- return je(Z[f], h);
397
+ const p = T(t.preset);
398
+ p && (p in Z || h(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ze(a.value, Z[p])), b === "always" && (o.frames.value = Math.max(1, o.frames.value));
399
+ const P = (d, M) => {
400
+ const _ = T(d), u = () => {
401
+ if (p)
402
+ return Ie(Z[p], M);
403
403
  };
404
404
  if (_ !== void 0)
405
405
  return _;
406
- const M = g();
407
- return M !== void 0 ? M : je(p, h);
408
- }, m = (v, h) => Pr(s.value, h, b(v, h));
409
- m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? qe, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), Tr < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
410
- const w = b(t.clearColor, "clearColor");
411
- w && s.value.setClearColor(
412
- w ? mr(w) : new re(0)
406
+ const v = u();
407
+ return v !== void 0 ? v : Ie(w, M);
408
+ }, y = (d, M) => Er(a.value, M, P(d, M));
409
+ y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? Je, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), Lr < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
410
+ const g = P(t.clearColor, "clearColor");
411
+ g && a.value.setClearColor(
412
+ g ? hr(g) : new re(0)
413
413
  // default clear color is not easily/efficiently retrievable from three
414
414
  );
415
415
  }), N(() => {
416
- s.value.dispose(), s.value.forceContextLoss();
416
+ a.value.dispose(), a.value.forceContextLoss();
417
417
  }), {
418
- renderer: s
418
+ renderer: a
419
419
  };
420
420
  }
421
- const ee = (e) => typeof e == "function", Or = (e) => !!e && e.constructor === Array;
422
- function Lr(e) {
421
+ const ee = (e) => typeof e == "function", Br = (e) => !!e && e.constructor === Array;
422
+ function jr(e) {
423
423
  const t = { nodes: {}, materials: {} };
424
- return e && e.traverse((n) => {
425
- n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
424
+ return e && e.traverse((r) => {
425
+ r.name && (t.nodes[r.name] = r), r.material && !t.materials[r.material.name] && (t.materials[r.material.name] = r.material);
426
426
  }), t;
427
427
  }
428
- async function dn(e, t, n, o, i) {
429
- const { logError: l } = $(), r = new e();
430
- i && i(r), n && n(r);
431
- const u = (Array.isArray(t) ? t : [t]).map(
432
- (a) => new Promise((y, c) => {
433
- r.load(
434
- a,
435
- (p) => {
436
- p.scene && Object.assign(p, Lr(p.scene)), y(p);
428
+ async function mn(e, t, r, o, s) {
429
+ const { logError: c } = $(), i = new e();
430
+ s && s(i), r && r(i);
431
+ const n = (Array.isArray(t) ? t : [t]).map(
432
+ (f) => new Promise((h, l) => {
433
+ i.load(
434
+ f,
435
+ (w) => {
436
+ w.scene && Object.assign(w, jr(w.scene)), h(w);
437
437
  },
438
438
  o,
439
- (p) => c(l("[useLoader] - Failed to load resource", p))
439
+ (w) => l(c("[useLoader] - Failed to load resource", w))
440
440
  );
441
441
  })
442
442
  );
443
- return Or(t) ? await Promise.all(u) : await u[0];
443
+ return Br(t) ? await Promise.all(n) : await n[0];
444
444
  }
445
- async function pn(e, t) {
446
- const n = new Pt(t), o = (i) => new Promise((l, r) => {
447
- n.load(
448
- i,
449
- (s) => l(s),
445
+ async function gn(e, t) {
446
+ const r = new Ct(t), o = (s) => new Promise((c, i) => {
447
+ r.load(
448
+ s,
449
+ (a) => c(a),
450
450
  () => null,
451
451
  () => {
452
- r(new Error("[useTextures] - Failed to load texture"));
452
+ i(new Error("[useTextures] - Failed to load texture"));
453
453
  }
454
454
  );
455
455
  });
456
- if (_r(e)) {
457
- const i = await Promise.all(e.map((l) => o(l)));
458
- return e.length > 1 ? i : i[0];
456
+ if (Tr(e)) {
457
+ const s = await Promise.all(e.map((c) => o(c)));
458
+ return e.length > 1 ? s : s[0];
459
459
  } else {
460
460
  const {
461
- map: i,
462
- displacementMap: l,
463
- normalMap: r,
464
- roughnessMap: s,
465
- metalnessMap: u,
466
- aoMap: a,
467
- alphaMap: y,
468
- matcap: c
461
+ map: s,
462
+ displacementMap: c,
463
+ normalMap: i,
464
+ roughnessMap: a,
465
+ metalnessMap: n,
466
+ aoMap: f,
467
+ alphaMap: h,
468
+ matcap: l
469
469
  } = e;
470
470
  return {
471
- map: i ? await o(i) : null,
472
- displacementMap: l ? await o(l) : null,
473
- normalMap: r ? await o(r) : null,
474
- roughnessMap: s ? await o(s) : null,
475
- metalnessMap: u ? await o(u) : null,
476
- aoMap: a ? await o(a) : null,
477
- alphaMap: y ? await o(y) : null,
478
- matcap: c ? await o(c) : null
471
+ map: s ? await o(s) : null,
472
+ displacementMap: c ? await o(c) : null,
473
+ normalMap: i ? await o(i) : null,
474
+ roughnessMap: a ? await o(a) : null,
475
+ metalnessMap: n ? await o(n) : null,
476
+ aoMap: f ? await o(f) : null,
477
+ alphaMap: h ? await o(h) : null,
478
+ matcap: l ? await o(l) : null
479
479
  };
480
480
  }
481
481
  }
482
- const Ze = (e, t) => {
483
- const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: l } = It({ target: n });
484
- let r = 0;
485
- const { width: s, height: u, top: a, left: y } = Ht(n), c = ({ x: d, y: E }) => {
486
- if (n.value)
482
+ const tt = (e, t) => {
483
+ const r = D(() => t.renderer.value.domElement), o = H([]), { x: s, y: c } = Ft({ target: r }), i = D(() => e.value.filter((m) => {
484
+ var C;
485
+ return ((C = m.__tres) == null ? void 0 : C.eventCount) > 0;
486
+ }));
487
+ let a = 0;
488
+ const { width: n, height: f, top: h, left: l } = Ut(r), w = ({ x: m, y: C }) => {
489
+ if (r.value)
487
490
  return {
488
- x: (d - y.value) / s.value * 2 - 1,
489
- y: -((E - a.value) / u.value) * 2 + 1
491
+ x: (m - l.value) / n.value * 2 - 1,
492
+ y: -((C - h.value) / f.value) * 2 + 1
490
493
  };
491
- }, p = ({ x: d, y: E }) => {
494
+ }, b = ({ x: m, y: C }) => {
492
495
  if (t.camera.value)
493
- return t.raycaster.value.setFromCamera(new ae(d, E), t.camera.value), o.value = t.raycaster.value.intersectObjects(e.value, !0), o.value;
494
- }, P = (d) => {
495
- const E = c({
496
- x: (d == null ? void 0 : d.clientX) ?? i.value,
497
- y: (d == null ? void 0 : d.clientY) ?? l.value
496
+ return t.raycaster.value.setFromCamera(new le(m, C), t.camera.value), o.value = t.raycaster.value.intersectObjects(i.value, !0), o.value;
497
+ }, p = (m) => {
498
+ const C = w({
499
+ x: (m == null ? void 0 : m.clientX) ?? s.value,
500
+ y: (m == null ? void 0 : m.clientY) ?? c.value
498
501
  });
499
- return E ? p(E) || [] : [];
500
- }, f = x(), b = x(), m = x(), w = x(), v = x(), h = x(), _ = x(), g = x();
501
- function M(d) {
502
- const E = {};
503
- for (const I in d)
504
- typeof I != "function" && (E[I] = d[I]);
505
- return E;
502
+ return C ? b(C) || [] : [];
503
+ }, P = A(), y = A(), g = A(), d = A(), M = A(), _ = A(), u = A(), v = A();
504
+ function E(m) {
505
+ const C = {};
506
+ for (const R in m)
507
+ typeof R != "function" && (C[R] = m[R]);
508
+ return C;
506
509
  }
507
- const C = (d, E) => {
508
- var _e, Ee, ke;
509
- const I = M(E), Q = new ge(E == null ? void 0 : E.clientX, E == null ? void 0 : E.clientY, 0).unproject((_e = t.camera) == null ? void 0 : _e.value);
510
- d.trigger({
511
- ...I,
510
+ const S = (m, C) => {
511
+ var Ee, Se, Te;
512
+ const R = E(C), Q = new he(C == null ? void 0 : C.clientX, C == null ? void 0 : C.clientY, 0).unproject((Ee = t.camera) == null ? void 0 : Ee.value);
513
+ m.trigger({
514
+ ...R,
512
515
  intersections: o.value,
513
516
  // The unprojectedPoint is wrong, math needs to be fixed
514
517
  unprojectedPoint: Q,
515
- ray: (Ee = t.raycaster) == null ? void 0 : Ee.value.ray,
516
- camera: (ke = t.camera) == null ? void 0 : ke.value,
517
- sourceEvent: E,
518
- delta: r,
518
+ ray: (Se = t.raycaster) == null ? void 0 : Se.value.ray,
519
+ camera: (Te = t.camera) == null ? void 0 : Te.value,
520
+ sourceEvent: C,
521
+ delta: a,
519
522
  stopPropagating: !1
520
523
  });
521
524
  };
522
- let R;
523
- const O = (d) => {
524
- P(d), C(m, d), R = d;
525
- }, T = () => {
526
- R && O(R);
525
+ let B;
526
+ const x = (m) => {
527
+ p(m), S(g, m), B = m;
528
+ }, k = () => {
529
+ B && x(B);
527
530
  };
528
- let S, j, L;
529
- const Y = (d) => {
530
- var E;
531
- S = (E = o.value[0]) == null ? void 0 : E.object, r = 0, j = new ae(
532
- (d == null ? void 0 : d.clientX) ?? i.value,
533
- (d == null ? void 0 : d.clientY) ?? l.value
534
- ), C(v, d);
531
+ let F, O, q;
532
+ const Y = (m) => {
533
+ var C;
534
+ F = (C = o.value[0]) == null ? void 0 : C.object, a = 0, O = new le(
535
+ (m == null ? void 0 : m.clientX) ?? s.value,
536
+ (m == null ? void 0 : m.clientY) ?? c.value
537
+ ), S(M, m);
535
538
  };
536
- let z, J = !1;
537
- const we = (d) => {
538
- var E, I, Q;
539
- d instanceof PointerEvent && (o.value.length === 0 && C(h, d), S === ((E = o.value[0]) == null ? void 0 : E.object) && (L = new ae(
540
- (d == null ? void 0 : d.clientX) ?? i.value,
541
- (d == null ? void 0 : d.clientY) ?? l.value
542
- ), r = j == null ? void 0 : j.distanceTo(L), d.button === 0 ? (C(f, d), z === ((I = o.value[0]) == null ? void 0 : I.object) ? J = !0 : (z = (Q = o.value[0]) == null ? void 0 : Q.object, J = !1)) : d.button === 2 && C(_, d)), C(w, d));
543
- }, Me = (d) => {
544
- J && (C(b, d), z = void 0, J = !1);
545
- }, Pe = (d) => C(m, d), Ce = (d) => C(g, d);
546
- return n.value.addEventListener("pointerup", we), n.value.addEventListener("pointerdown", Y), n.value.addEventListener("pointermove", O), n.value.addEventListener("pointerleave", Pe), n.value.addEventListener("dblclick", Me), n.value.addEventListener("wheel", Ce), N(() => {
547
- n != null && n.value && (n.value.removeEventListener("pointerup", we), n.value.removeEventListener("pointerdown", Y), n.value.removeEventListener("pointermove", O), n.value.removeEventListener("pointerleave", Pe), n.value.removeEventListener("dblclick", Me), n.value.removeEventListener("wheel", Ce));
539
+ let se, J = !1;
540
+ const Me = (m) => {
541
+ var C, R, Q;
542
+ m instanceof PointerEvent && (o.value.length === 0 && S(_, m), F === ((C = o.value[0]) == null ? void 0 : C.object) && (q = new le(
543
+ (m == null ? void 0 : m.clientX) ?? s.value,
544
+ (m == null ? void 0 : m.clientY) ?? c.value
545
+ ), a = O == null ? void 0 : O.distanceTo(q), m.button === 0 ? (S(P, m), se === ((R = o.value[0]) == null ? void 0 : R.object) ? J = !0 : (se = (Q = o.value[0]) == null ? void 0 : Q.object, J = !1)) : m.button === 2 && S(u, m)), S(d, m));
546
+ }, Pe = (m) => {
547
+ J && (S(y, m), se = void 0, J = !1);
548
+ }, _e = (m) => S(g, m), Ce = (m) => S(v, m);
549
+ return r.value.addEventListener("pointerup", Me), r.value.addEventListener("pointerdown", Y), r.value.addEventListener("pointermove", x), r.value.addEventListener("pointerleave", _e), r.value.addEventListener("dblclick", Pe), r.value.addEventListener("wheel", Ce), N(() => {
550
+ r != null && r.value && (r.value.removeEventListener("pointerup", Me), r.value.removeEventListener("pointerdown", Y), r.value.removeEventListener("pointermove", x), r.value.removeEventListener("pointerleave", _e), r.value.removeEventListener("dblclick", Pe), r.value.removeEventListener("wheel", Ce));
548
551
  }), {
549
552
  intersects: o,
550
- onClick: (d) => f.on(d).off,
551
- onDblClick: (d) => b.on(d).off,
552
- onContextMenu: (d) => _.on(d).off,
553
- onPointerMove: (d) => m.on(d).off,
554
- onPointerUp: (d) => w.on(d).off,
555
- onPointerDown: (d) => v.on(d).off,
556
- onPointerMissed: (d) => h.on(d).off,
557
- onWheel: (d) => g.on(d).off,
558
- forceUpdate: T
553
+ onClick: (m) => P.on(m).off,
554
+ onDblClick: (m) => y.on(m).off,
555
+ onContextMenu: (m) => u.on(m).off,
556
+ onPointerMove: (m) => g.on(m).off,
557
+ onPointerUp: (m) => d.on(m).off,
558
+ onPointerDown: (m) => M.on(m).off,
559
+ onPointerMissed: (m) => _.on(m).off,
560
+ onWheel: (m) => v.on(m).off,
561
+ forceUpdate: k
559
562
  };
560
563
  };
561
- function mn() {
564
+ function vn() {
562
565
  const { logWarning: e } = $();
563
- function t(l, r, s) {
564
- let u = null;
565
- return l.traverse((a) => {
566
- a[r] === s && (u = a);
567
- }), u || e(`Child with ${r} '${s}' not found.`), u;
566
+ function t(c, i, a) {
567
+ let n = null;
568
+ return c.traverse((f) => {
569
+ f[i] === a && (n = f);
570
+ }), n || e(`Child with ${i} '${a}' not found.`), n;
568
571
  }
569
- function n(l, r, s) {
570
- const u = [];
571
- return l.traverse((a) => {
572
- a[r].includes(s) && u.push(a);
573
- }), u.length || e(`Children with ${r} '${s}' not found.`), u;
572
+ function r(c, i, a) {
573
+ const n = [];
574
+ return c.traverse((f) => {
575
+ f[i].includes(a) && n.push(f);
576
+ }), n.length || e(`Children with ${i} '${a}' not found.`), n;
574
577
  }
575
- function o(l, r) {
576
- return t(l, "name", r);
578
+ function o(c, i) {
579
+ return t(c, "name", i);
577
580
  }
578
- function i(l, r) {
579
- return n(l, "name", r);
581
+ function s(c, i) {
582
+ return r(c, "name", i);
580
583
  }
581
584
  return {
582
585
  seek: t,
583
586
  seekByName: o,
584
- seekAll: n,
585
- seekAllByName: i
587
+ seekAll: r,
588
+ seekAllByName: s
586
589
  };
587
590
  }
588
- const vn = (e) => {
589
- const t = We({
591
+ const hn = (e) => {
592
+ const t = ze({
590
593
  click: /* @__PURE__ */ new Map(),
591
594
  pointerMove: /* @__PURE__ */ new Map(),
592
595
  pointerEnter: /* @__PURE__ */ new Map(),
593
596
  pointerLeave: /* @__PURE__ */ new Map()
594
- }), n = A(/* @__PURE__ */ new Set()), o = (c) => {
595
- n.value.add(c);
596
- }, i = (c) => {
597
- n.value.delete(c);
598
- }, l = (c) => {
599
- Object.values(t).forEach((p) => p.delete(c)), i(c);
600
- }, r = (c) => {
601
- const { onClick: p, onPointerMove: P, onPointerEnter: f, onPointerLeave: b } = c;
602
- p && t.click.set(c, p), P && t.pointerMove.set(c, P), f && t.pointerEnter.set(c, f), b && t.pointerLeave.set(c, b);
603
- }, s = B(
604
- () => Mr(
597
+ }), r = L(/* @__PURE__ */ new Set()), o = (l) => {
598
+ r.value.add(l);
599
+ }, s = (l) => {
600
+ r.value.delete(l);
601
+ }, c = (l) => {
602
+ Object.values(t).forEach((w) => w.delete(l)), s(l);
603
+ }, i = (l) => {
604
+ const { onClick: w, onPointerMove: b, onPointerEnter: p, onPointerLeave: P } = l;
605
+ w && t.click.set(l, w), b && t.pointerMove.set(l, b), p && t.pointerEnter.set(l, p), P && t.pointerLeave.set(l, P);
606
+ }, a = D(
607
+ () => Cr(
605
608
  [
606
- ...Array.from(n.value),
607
- ...Object.values(t).map((c) => Array.from(c.keys())).flat()
609
+ ...Array.from(r.value),
610
+ ...Object.values(t).map((l) => Array.from(l.keys())).flat()
608
611
  ],
609
- ({ uuid: c }) => c
612
+ ({ uuid: l }) => l
610
613
  )
611
614
  );
612
- e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
613
- const { onClick: u, onPointerMove: a } = Ze(s, e);
614
- u(({ intersects: c, event: p }) => {
615
- var P;
616
- c.length && ((P = t.click.get(c[0].object)) == null || P(c[0], p));
615
+ e.registerObjectAtPointerEventHandler = i, e.deregisterObjectAtPointerEventHandler = c, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = s;
616
+ const { onClick: n, onPointerMove: f } = tt(a, e);
617
+ n(({ intersects: l, event: w }) => {
618
+ var b;
619
+ l.length && ((b = t.click.get(l[0].object)) == null || b(l[0], w));
617
620
  });
618
- let y;
619
- return a(({ intersects: c, event: p }) => {
620
- var w, v, h, _;
621
- const P = (w = c == null ? void 0 : c[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: b, pointerMove: m } = t;
622
- y && y !== P && ((v = f.get(y)) == null || v(y, p)), P && (y !== P && ((h = b.get(P)) == null || h(c[0], p)), (_ = m.get(P)) == null || _(c[0], p)), y = P || null;
621
+ let h;
622
+ return f(({ intersects: l, event: w }) => {
623
+ var g, d, M, _;
624
+ const b = (g = l == null ? void 0 : l[0]) == null ? void 0 : g.object, { pointerLeave: p, pointerEnter: P, pointerMove: y } = t;
625
+ h && h !== b && ((d = p.get(h)) == null || d(h, w)), b && (h !== b && ((M = P.get(b)) == null || M(l[0], w)), (_ = y.get(b)) == null || _(l[0], w)), h = b || null;
623
626
  }), {
624
- registerObject: r,
625
- deregisterObject: l,
627
+ registerObject: i,
628
+ deregisterObject: c,
626
629
  registerBlockingObject: o,
627
- deregisterBlockingObject: i
630
+ deregisterBlockingObject: s
628
631
  };
629
632
  };
630
633
  function be(e) {
631
634
  let t = 0;
632
- return e.traverse((n) => {
633
- if (n.isMesh && n.geometry) {
634
- const o = n.geometry, i = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, r = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, s = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, u = i + l + r + s;
635
- t += u;
635
+ return e.traverse((r) => {
636
+ if (r.isMesh && r.geometry) {
637
+ const o = r.geometry, s = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, c = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, i = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, n = s + c + i + a;
638
+ t += n;
636
639
  }
637
640
  }), t;
638
641
  }
639
- function Dr(e) {
642
+ function Rr(e) {
640
643
  return (e / 1024).toFixed(2);
641
644
  }
642
- const de = A({}), pe = (e) => Object.assign(de.value, e);
643
- function Br(e, t, n = 10) {
644
- const o = k(e) ? Ut() : $t(B(() => k(t).parentElement)), i = ue(Le(o.width, n)), l = ue(Le(o.height, n)), r = B(() => i.value / l.value);
645
+ const de = L({}), me = (e) => Object.assign(de.value, e);
646
+ function Ir(e, t, r = 10) {
647
+ const o = T(e) ? Wt() : Nt(D(() => T(t).parentElement)), s = ue(De(o.width, r)), c = ue(De(o.height, r)), i = D(() => s.value / c.value);
645
648
  return {
646
- height: l,
647
- width: i,
648
- aspectRatio: r
649
+ height: c,
650
+ width: s,
651
+ aspectRatio: i
649
652
  };
650
653
  }
651
- function le() {
654
+ function ce() {
652
655
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
653
- let n = 0, o = !1;
654
- const i = () => {
655
- const a = Array.from(e.entries()).sort((y, c) => {
656
- const p = y[1].priority - c[1].priority;
657
- return p === 0 ? y[1].addI - c[1].addI : p;
656
+ let r = 0, o = !1;
657
+ const s = () => {
658
+ const f = Array.from(e.entries()).sort((h, l) => {
659
+ const w = h[1].priority - l[1].priority;
660
+ return w === 0 ? h[1].addI - l[1].addI : w;
658
661
  });
659
- t.clear(), a.forEach((y) => t.add(y[0]));
660
- }, l = (a) => {
661
- e.delete(a), t.delete(a);
662
+ t.clear(), f.forEach((h) => t.add(h[0]));
663
+ }, c = (f) => {
664
+ e.delete(f), t.delete(f);
662
665
  };
663
- return { on: (a, y = 0) => {
664
- e.set(a, { priority: y, addI: n++ });
665
- const c = () => l(a);
666
- return Ft(c), o = !0, {
667
- off: c
666
+ return { on: (f, h = 0) => {
667
+ e.set(f, { priority: h, addI: r++ });
668
+ const l = () => c(f);
669
+ return zt(l), o = !0, {
670
+ off: l
668
671
  };
669
- }, off: l, trigger: (...a) => {
670
- o && (i(), o = !1), t.forEach((y) => y(...a));
672
+ }, off: c, trigger: (...f) => {
673
+ o && (s(), o = !1), t.forEach((h) => h(...f));
671
674
  }, dispose: () => {
672
675
  e.clear(), t.clear();
673
676
  }, get count() {
674
677
  return e.size;
675
678
  } };
676
679
  }
677
- function Rr() {
678
- const e = new ze(!1), t = A(!1), n = A(!1);
680
+ function Hr() {
681
+ const e = new Ve(!1), t = L(!1), r = L(!1);
679
682
  let o;
680
- const i = Ct.generateUUID();
681
- let l = null;
682
- const r = le(), s = le(), u = le();
683
- let a = {};
684
- function y(h) {
685
- a = h;
683
+ const s = Et.generateUUID();
684
+ let c = null;
685
+ const i = ce(), a = ce(), n = ce();
686
+ let f = {};
687
+ function h(M) {
688
+ f = M;
686
689
  }
687
- function c(h, _, g = 0) {
690
+ function l(M, _, u = 0) {
688
691
  switch (_) {
689
692
  case "before":
690
- return r.on(h, g);
693
+ return i.on(M, u);
691
694
  case "render":
692
- return l || (l = h), s.dispose(), s.on(h);
695
+ return c || (c = M), a.dispose(), a.on(M);
693
696
  case "after":
694
- return u.on(h, g);
697
+ return n.on(M, u);
695
698
  }
696
699
  }
697
- function p() {
698
- t.value || (e.start(), t.value = !0, v());
700
+ function w() {
701
+ t.value || (e.start(), t.value = !0, d());
699
702
  }
700
- function P() {
703
+ function b() {
701
704
  t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
702
705
  }
703
- function f() {
706
+ function p() {
704
707
  e.stop(), t.value = !1;
705
708
  }
706
- function b() {
709
+ function P() {
707
710
  e.start(), t.value = !0;
708
711
  }
709
- function m() {
710
- n.value = !0;
712
+ function y() {
713
+ r.value = !0;
711
714
  }
712
- function w() {
713
- n.value = !1;
715
+ function g() {
716
+ r.value = !1;
714
717
  }
715
- function v() {
716
- const h = e.getDelta(), _ = e.getElapsedTime(), g = {
717
- camera: W(a.camera),
718
- scene: W(a.scene),
719
- renderer: W(a.renderer),
720
- raycaster: W(a.raycaster),
721
- controls: W(a.controls),
722
- invalidate: a.invalidate,
723
- advance: a.advance
724
- }, M = { delta: h, elapsed: _, clock: e, ...g };
725
- t.value && r.trigger(M), n.value || (s.count ? s.trigger(M) : l && l(M)), t.value && u.trigger(M), o = requestAnimationFrame(v);
718
+ function d() {
719
+ const M = e.getDelta(), _ = e.getElapsedTime(), u = {
720
+ camera: W(f.camera),
721
+ scene: W(f.scene),
722
+ renderer: W(f.renderer),
723
+ raycaster: W(f.raycaster),
724
+ controls: W(f.controls),
725
+ invalidate: f.invalidate,
726
+ advance: f.advance
727
+ }, v = { delta: M, elapsed: _, clock: e, ...u };
728
+ t.value && i.trigger(v), r.value || (a.count ? a.trigger(v) : c && c(v)), t.value && n.trigger(v), o = requestAnimationFrame(d);
726
729
  }
727
730
  return {
728
- loopId: i,
729
- register: (h, _, g) => c(h, _, g),
730
- start: p,
731
- stop: P,
732
- pause: f,
733
- resume: b,
734
- pauseRender: m,
735
- resumeRender: w,
736
- isRenderPaused: n,
731
+ loopId: s,
732
+ register: (M, _, u) => l(M, _, u),
733
+ start: w,
734
+ stop: b,
735
+ pause: p,
736
+ resume: P,
737
+ pauseRender: y,
738
+ resumeRender: g,
739
+ isRenderPaused: r,
737
740
  isActive: t,
738
- setContext: y
741
+ setContext: h
739
742
  };
740
743
  }
741
- function jr({
744
+ function $r({
742
745
  scene: e,
743
746
  canvas: t,
744
- windowSize: n,
747
+ windowSize: r,
745
748
  disableRender: o,
746
- rendererOptions: i,
747
- emit: l
749
+ rendererOptions: s,
750
+ emit: c
748
751
  }) {
749
- const { logWarning: r } = $(), s = U(e), u = Br(n, t), {
750
- camera: a,
751
- cameras: y,
752
- registerCamera: c,
753
- deregisterCamera: p,
754
- setCameraActive: P
755
- } = cr({ sizes: u, scene: e }), f = {
756
- mode: A(i.renderMode || "always"),
757
- priority: A(0),
758
- frames: A(0),
752
+ const { logWarning: i } = $(), a = H(e), n = Ir(r, t), {
753
+ camera: f,
754
+ cameras: h,
755
+ registerCamera: l,
756
+ deregisterCamera: w,
757
+ setCameraActive: b
758
+ } = dr({ sizes: n, scene: e }), p = {
759
+ mode: L(s.renderMode || "always"),
760
+ priority: L(0),
761
+ frames: L(0),
759
762
  maxFrames: 60,
760
- canBeInvalidated: B(() => f.mode.value === "on-demand" && f.frames.value === 0)
763
+ canBeInvalidated: D(() => p.mode.value === "on-demand" && p.frames.value === 0)
761
764
  };
762
- function b(L = 1) {
763
- i.renderMode === "on-demand" ? f.frames.value = Math.min(f.maxFrames, f.frames.value + L) : r("`invalidate` can only be used when `renderMode` is set to `on-demand`");
765
+ function P(O = 1) {
766
+ s.renderMode === "on-demand" ? p.frames.value = Math.min(p.maxFrames, p.frames.value + O) : i("`invalidate` can only be used when `renderMode` is set to `on-demand`");
764
767
  }
765
- function m() {
766
- i.renderMode === "manual" ? f.frames.value = 1 : r("`advance` can only be used when `renderMode` is set to `manual`");
768
+ function y() {
769
+ s.renderMode === "manual" ? p.frames.value = 1 : i("`advance` can only be used when `renderMode` is set to `manual`");
767
770
  }
768
- const { renderer: w } = Ar(
771
+ const { renderer: g } = Dr(
769
772
  {
770
773
  scene: e,
771
774
  canvas: t,
772
- options: i,
773
- emit: l,
775
+ options: s,
776
+ emit: c,
774
777
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
775
- contextParts: { sizes: u, camera: a, render: f, invalidate: b, advance: m },
778
+ contextParts: { sizes: n, camera: f, render: p, invalidate: P, advance: y },
776
779
  disableRender: o
777
780
  }
778
- ), v = {
779
- sizes: u,
780
- scene: s,
781
- camera: a,
782
- cameras: ue(y),
783
- renderer: w,
784
- raycaster: U(new _t()),
785
- controls: A(null),
781
+ ), d = {
782
+ sizes: n,
783
+ scene: a,
784
+ camera: f,
785
+ cameras: ue(h),
786
+ renderer: g,
787
+ raycaster: H(new St()),
788
+ controls: L(null),
786
789
  perf: {
787
790
  maxFrames: 160,
788
791
  fps: {
@@ -795,70 +798,70 @@ function jr({
795
798
  accumulator: []
796
799
  }
797
800
  },
798
- render: f,
799
- advance: m,
800
- extend: pe,
801
- invalidate: b,
802
- registerCamera: c,
803
- setCameraActive: P,
804
- deregisterCamera: p,
805
- loop: Rr()
801
+ render: p,
802
+ advance: y,
803
+ extend: me,
804
+ invalidate: P,
805
+ registerCamera: l,
806
+ setCameraActive: b,
807
+ deregisterCamera: w,
808
+ loop: Hr()
806
809
  };
807
- ce("useTres", v), v.scene.value.__tres = {
808
- root: v
809
- }, v.loop.register(() => {
810
- a.value && f.frames.value > 0 && (w.value.render(e, a.value), l("render", v.renderer.value)), f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
811
- }, "render"), v.loop.start(), N(() => {
812
- v.loop.stop();
810
+ fe("useTres", d), d.scene.value.__tres = {
811
+ root: d
812
+ }, d.loop.register(() => {
813
+ f.value && p.frames.value > 0 && (g.value.render(e, f.value), c("render", d.renderer.value)), p.priority.value = 0, p.mode.value === "always" ? p.frames.value = 1 : p.frames.value = Math.max(0, p.frames.value - 1);
814
+ }, "render"), d.loop.start(), N(() => {
815
+ d.loop.stop();
813
816
  });
814
- const h = 100, _ = Wt({ every: h }), { isSupported: g, memory: M } = Nt({ interval: h }), C = 160;
815
- let R = performance.now();
816
- const O = ({ timestamp: L }) => {
817
- v.scene.value && (v.perf.memory.allocatedMem = be(v.scene.value)), L - R >= h && (R = L, v.perf.fps.accumulator.push(_.value), v.perf.fps.accumulator.length > C && v.perf.fps.accumulator.shift(), v.perf.fps.value = _.value, g.value && M.value && (v.perf.memory.accumulator.push(M.value.usedJSHeapSize / 1024 / 1024), v.perf.memory.accumulator.length > C && v.perf.memory.accumulator.shift(), v.perf.memory.currentMem = v.perf.memory.accumulator.reduce((Y, z) => Y + z, 0) / v.perf.memory.accumulator.length));
817
+ const M = 100, _ = Gt({ every: M }), { isSupported: u, memory: v } = Vt({ interval: M }), E = 160;
818
+ let S = performance.now();
819
+ const B = ({ timestamp: O }) => {
820
+ d.scene.value && (d.perf.memory.allocatedMem = be(d.scene.value)), O - S >= M && (S = O, d.perf.fps.accumulator.push(_.value), d.perf.fps.accumulator.length > E && d.perf.fps.accumulator.shift(), d.perf.fps.value = _.value, u.value && v.value && (d.perf.memory.accumulator.push(v.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > E && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((q, Y) => q + Y, 0) / d.perf.memory.accumulator.length));
818
821
  };
819
- let T = 0;
820
- const S = 1, { pause: j } = Ye(({ delta: L }) => {
821
- window.__TRES__DEVTOOLS__ && (O({ timestamp: performance.now() }), T += L, T >= S && (window.__TRES__DEVTOOLS__.cb(v), T = 0));
822
+ let x = 0;
823
+ const k = 1, { pause: F } = Qe(({ delta: O }) => {
824
+ window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x += O, x >= k && (window.__TRES__DEVTOOLS__.cb(d), x = 0));
822
825
  }, { immediate: !0 });
823
826
  return N(() => {
824
- j();
825
- }), v;
827
+ F();
828
+ }), d;
826
829
  }
827
- function et() {
828
- const e = at("useTres");
830
+ function rt() {
831
+ const e = ct("useTres");
829
832
  if (!e)
830
833
  throw new Error("useTresContext must be used together with useTresContextProvider");
831
834
  return e;
832
835
  }
833
- const gn = et;
834
- function hn() {
836
+ const yn = rt;
837
+ function wn() {
835
838
  const {
836
839
  camera: e,
837
840
  scene: t,
838
- renderer: n,
841
+ renderer: r,
839
842
  loop: o,
840
- raycaster: i,
841
- controls: l,
842
- invalidate: r,
843
- advance: s
844
- } = et();
843
+ raycaster: s,
844
+ controls: c,
845
+ invalidate: i,
846
+ advance: a
847
+ } = rt();
845
848
  o.setContext({
846
849
  camera: e,
847
850
  scene: t,
848
- renderer: n,
849
- raycaster: i,
850
- controls: l,
851
- invalidate: r,
852
- advance: s
851
+ renderer: r,
852
+ raycaster: s,
853
+ controls: c,
854
+ invalidate: i,
855
+ advance: a
853
856
  });
854
- function u(c, p = 0) {
855
- return o.register(c, "before", p);
857
+ function n(l, w = 0) {
858
+ return o.register(l, "before", w);
856
859
  }
857
- function a(c) {
858
- return o.register(c, "render");
860
+ function f(l) {
861
+ return o.register(l, "render");
859
862
  }
860
- function y(c, p = 0) {
861
- return o.register(c, "after", p);
863
+ function h(l, w = 0) {
864
+ return o.register(l, "after", w);
862
865
  }
863
866
  return {
864
867
  pause: o.pause,
@@ -866,81 +869,81 @@ function hn() {
866
869
  pauseRender: o.pauseRender,
867
870
  resumeRender: o.resumeRender,
868
871
  isActive: o.isActive,
869
- onBeforeRender: u,
870
- render: a,
871
- onAfterRender: y
872
+ onBeforeRender: n,
873
+ render: f,
874
+ onAfterRender: h
872
875
  };
873
876
  }
874
- function Ir(e, t, n) {
875
- const o = U(), i = U();
876
- e && (o.value = e), t && (i.value = t);
877
- const l = B(
877
+ function Fr(e, t, r) {
878
+ const o = H(), s = H();
879
+ e && (o.value = e), t && (s.value = t);
880
+ const c = D(
878
881
  () => o.value ? o.value.children : []
879
882
  );
880
- function r(g, M) {
881
- if (Array.isArray(g))
882
- for (const C of g)
883
- C(M);
884
- typeof g == "function" && g(M);
883
+ function i(u, v) {
884
+ if (Array.isArray(u))
885
+ for (const E of u)
886
+ E(v);
887
+ typeof u == "function" && u(v);
885
888
  }
886
- function s(g, M) {
887
- const C = [], R = () => M.stopPropagating = !0;
888
- M.stopPropagation = R;
889
- for (const O of M == null ? void 0 : M.intersections) {
890
- if (M.stopPropagating)
889
+ function a(u, v) {
890
+ const E = [], S = () => v.stopPropagating = !0;
891
+ v.stopPropagation = S;
892
+ for (const B of v == null ? void 0 : v.intersections) {
893
+ if (v.stopPropagating)
891
894
  return;
892
- M = { ...M, ...O };
893
- const { object: T } = O;
894
- M.eventObject = T, r(T[g], M), C.push(T);
895
- let S = T.parent;
896
- for (; S !== null && !M.stopPropagating && !C.includes(S); )
897
- M.eventObject = S, r(S[g], M), C.push(S), S = S.parent;
898
- const j = br(g.slice(2));
899
- n(j, { intersection: O, event: M });
895
+ v = { ...v, ...B };
896
+ const { object: x } = B;
897
+ v.eventObject = x, i(x[u], v), E.push(x);
898
+ let k = x.parent;
899
+ for (; k !== null && !v.stopPropagating && !E.includes(k); )
900
+ v.eventObject = k, i(k[u], v), E.push(k), k = k.parent;
901
+ const F = Pr(u.slice(2));
902
+ r(F, { intersection: B, event: v });
900
903
  }
901
904
  }
902
905
  const {
903
- onClick: u,
904
- onDblClick: a,
905
- onContextMenu: y,
906
- onPointerMove: c,
907
- onPointerDown: p,
908
- onPointerUp: P,
909
- onPointerMissed: f,
910
- onWheel: b,
911
- forceUpdate: m
912
- } = Ze(l, t);
913
- P((g) => s("onPointerUp", g)), p((g) => s("onPointerDown", g)), u((g) => s("onClick", g)), a((g) => s("onDoubleClick", g)), y((g) => s("onContextMenu", g)), b((g) => s("onWheel", g));
914
- let w = [];
915
- c((g) => {
916
- const M = g.intersections.map(({ object: C }) => C);
917
- w.forEach((C) => {
918
- M.includes(C) || (s("onPointerLeave", g), s("onPointerOut", g));
919
- }), g.intersections.forEach(({ object: C }) => {
920
- w.includes(C) || (s("onPointerEnter", g), s("onPointerOver", g));
921
- }), s("onPointerMove", g), w = M;
906
+ onClick: n,
907
+ onDblClick: f,
908
+ onContextMenu: h,
909
+ onPointerMove: l,
910
+ onPointerDown: w,
911
+ onPointerUp: b,
912
+ onPointerMissed: p,
913
+ onWheel: P,
914
+ forceUpdate: y
915
+ } = tt(c, t);
916
+ b((u) => a("onPointerUp", u)), w((u) => a("onPointerDown", u)), n((u) => a("onClick", u)), f((u) => a("onDoubleClick", u)), h((u) => a("onContextMenu", u)), P((u) => a("onWheel", u));
917
+ let g = [];
918
+ l((u) => {
919
+ const v = u.intersections.map(({ object: S }) => S), E = u.intersections;
920
+ g.forEach(({ object: S }) => {
921
+ v.includes(S) || (u.intersections = g, a("onPointerLeave", u), a("onPointerOut", u));
922
+ }), u.intersections = E, u.intersections.forEach(({ object: S }) => {
923
+ g.includes(S) || (a("onPointerEnter", u), a("onPointerOver", u));
924
+ }), a("onPointerMove", u), g = u.intersections;
922
925
  });
923
- const v = [];
924
- f((g) => {
925
- const M = () => g.stopPropagating = !0;
926
- g.stopPropagation = M, v.forEach((C) => {
927
- g.stopPropagating || (g.eventObject = C, r(C.onPointerMissed, g));
928
- }), n("pointer-missed", { event: g });
926
+ const d = [];
927
+ p((u) => {
928
+ const v = () => u.stopPropagating = !0;
929
+ u.stopPropagation = v, d.forEach((E) => {
930
+ u.stopPropagating || (u.eventObject = E, i(E.onPointerMissed, u));
931
+ }), r("pointer-missed", { event: u });
929
932
  });
930
- function h(g) {
931
- v.push(g);
933
+ function M(u) {
934
+ d.push(u);
932
935
  }
933
- function _(g) {
934
- const M = v.indexOf(g);
935
- M > -1 && v.splice(M, 1);
936
+ function _(u) {
937
+ const v = d.indexOf(u);
938
+ v > -1 && d.splice(v, 1);
936
939
  }
937
940
  return t.eventManager = {
938
- forceUpdate: m,
939
- registerPointerMissedObject: h,
941
+ forceUpdate: y,
942
+ registerPointerMissedObject: M,
940
943
  deregisterPointerMissedObject: _
941
- }, { forceUpdate: m, registerPointerMissedObject: h, deregisterPointerMissedObject: _ };
944
+ }, { forceUpdate: y, registerPointerMissedObject: M, deregisterPointerMissedObject: _ };
942
945
  }
943
- const { logError: He } = $(), Hr = [
946
+ const { logError: $e } = $(), Fe = [
944
947
  "onClick",
945
948
  "onContextMenu",
946
949
  "onPointerMove",
@@ -957,90 +960,91 @@ const { logError: He } = $(), Hr = [
957
960
  "onWheel"
958
961
  ];
959
962
  function Ue(e) {
960
- var n;
961
- const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
963
+ var r;
964
+ const t = (r = e == null ? void 0 : e.__tres) == null ? void 0 : r.root;
962
965
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
963
966
  }
964
967
  const Ur = () => {
965
968
  let e = null;
966
- function t(r, s, u, a) {
967
- if (a || (a = {}), a.args || (a.args = []), r === "template" || hr(r))
969
+ function t(n, f, h, l) {
970
+ if (l || (l = {}), l.args || (l.args = []), n === "template" || br(n))
968
971
  return null;
969
- let y = r.replace("Tres", ""), c;
970
- if (r === "primitive") {
971
- (a == null ? void 0 : a.object) === void 0 && He("Tres primitives need a prop 'object'");
972
- const p = a.object;
973
- y = p.type, c = Object.assign(p.clone(), { type: y });
972
+ let w = n.replace("Tres", ""), b;
973
+ if (n === "primitive") {
974
+ (l == null ? void 0 : l.object) === void 0 && $e("Tres primitives need a prop 'object'");
975
+ const p = l.object;
976
+ w = p.type, b = Object.assign(p.clone(), { type: w });
974
977
  } else {
975
- const p = de.value[y];
976
- p || He(
977
- `${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
978
- ), c = new p(...a.args);
978
+ const p = de.value[w];
979
+ p || $e(
980
+ `${w} is not defined on the THREE namespace. Use extend to add it to the catalog.`
981
+ ), b = new p(...l.args);
979
982
  }
980
- return c ? (c.isCamera && (a != null && a.position || c.position.set(3, 3, 3), a != null && a.lookAt || c.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (c.isMaterial ? c.attach = "material" : c.isBufferGeometry && (c.attach = "geometry")), c.__tres = {
981
- ...c.__tres,
982
- type: y,
983
- memoizedProps: a,
983
+ return b ? (b.isCamera && (l != null && l.position || b.position.set(3, 3, 3), l != null && l.lookAt || b.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (b.isMaterial ? b.attach = "material" : b.isBufferGeometry && (b.attach = "geometry")), b.__tres = {
984
+ ...b.__tres,
985
+ type: w,
986
+ memoizedProps: l,
984
987
  eventCount: 0,
985
988
  disposable: !0,
986
- primitive: r === "primitive"
987
- }, c.isObject3D && c.__tres && (a != null && a.material || a != null && a.geometry) && (c.__tres.disposable = !1), c) : null;
989
+ primitive: n === "primitive"
990
+ }, b.isObject3D && b.__tres && (l != null && l.material || l != null && l.geometry) && (b.__tres.disposable = !1), b) : null;
988
991
  }
989
- function n(r, s) {
990
- var a, y, c, p, P;
991
- if (!r)
992
+ function r(n, f) {
993
+ var l, w, b, p, P;
994
+ if (!n)
992
995
  return;
993
- s && s.isScene && (e = s), e && r.__tres && (r.__tres.root = e.__tres.root);
994
- const u = s || e;
995
- if (r != null && r.isObject3D) {
996
- const { registerCamera: f } = (a = r == null ? void 0 : r.__tres) == null ? void 0 : a.root;
997
- r != null && r.isCamera && f(r), r.onPointerMissed && ((y = r == null ? void 0 : r.__tres) != null && y.root) && ((P = (p = (c = r == null ? void 0 : r.__tres) == null ? void 0 : c.root) == null ? void 0 : p.eventManager) == null || P.registerPointerMissedObject(r));
996
+ f && f.isScene && (e = f), e && n.__tres && (n.__tres.root = e.__tres.root);
997
+ const h = f || e;
998
+ if (n != null && n.isObject3D) {
999
+ const { registerCamera: y } = (l = n == null ? void 0 : n.__tres) == null ? void 0 : l.root;
1000
+ n != null && n.isCamera && y(n), n.onPointerMissed && ((w = n == null ? void 0 : n.__tres) != null && w.root) && ((P = (p = (b = n == null ? void 0 : n.__tres) == null ? void 0 : b.root) == null ? void 0 : p.eventManager) == null || P.registerPointerMissedObject(n));
998
1001
  }
999
- r != null && r.isObject3D && (u != null && u.isObject3D) ? (u.add(r), r.dispatchEvent({ type: "added" })) : r != null && r.isFog ? u.fog = r : typeof (r == null ? void 0 : r.attach) == "string" && (r.__previousAttach = r[u == null ? void 0 : u.attach], u && (u[r.attach] = r));
1002
+ n != null && n.isObject3D && (h != null && h.isObject3D) ? (h.add(n), n.dispatchEvent({ type: "added" })) : n != null && n.isFog ? h.fog = n : typeof (n == null ? void 0 : n.attach) == "string" && (n.__previousAttach = n[h == null ? void 0 : h.attach], h && (h[n.attach] = n));
1000
1003
  }
1001
- function o(r) {
1002
- var u, a, y, c;
1003
- if (!r)
1004
+ function o(n) {
1005
+ var h, l, w, b;
1006
+ if (!n)
1004
1007
  return;
1005
- const s = r.__tres;
1006
- if (r.parent = r.parent || e, r.isObject3D) {
1007
- const p = (f) => {
1008
- var m, w;
1009
- const b = (w = (m = r == null ? void 0 : r.__tres) == null ? void 0 : m.root) == null ? void 0 : w.deregisterCamera;
1010
- f.isCamera && (b == null || b(f));
1008
+ const f = n.__tres;
1009
+ if (n.parent = n.parent || e, n.isObject3D) {
1010
+ const p = (y) => {
1011
+ var d, M;
1012
+ const g = (M = (d = n == null ? void 0 : n.__tres) == null ? void 0 : d.root) == null ? void 0 : M.deregisterCamera;
1013
+ y.isCamera && (g == null || g(y));
1011
1014
  };
1012
- (u = r.removeFromParent) == null || u.call(r), r.traverse((f) => {
1013
- var b, m;
1014
- p(f), f.onPointerMissed && ((m = (b = s == null ? void 0 : s.root) == null ? void 0 : b.eventManager) == null || m.deregisterPointerMissedObject(f));
1015
- }), p(r), Ue(r), !((a = r.__tres) == null ? void 0 : a.primitive) && ((y = r.__tres) != null && y.disposable) && ye(r), (c = r.dispose) == null || c.call(r);
1015
+ (h = n.removeFromParent) == null || h.call(n), n.traverse((y) => {
1016
+ var g, d;
1017
+ p(y), y.onPointerMissed && ((d = (g = f == null ? void 0 : f.root) == null ? void 0 : g.eventManager) == null || d.deregisterPointerMissedObject(y));
1018
+ }), p(n), Ue(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((w = n.__tres) != null && w.disposable) && we(n), (b = n.dispose) == null || b.call(n);
1016
1019
  }
1017
1020
  }
1018
- function i(r, s, u, a) {
1019
- var y, c;
1020
- if (r) {
1021
- let p = r, P = s;
1022
- if ((y = r == null ? void 0 : r.__tres) != null && y.primitive && P === "object" && u !== null) {
1023
- const w = t("primitive", void 0, void 0, {
1024
- object: a
1021
+ function s(n, f, h, l) {
1022
+ var w, b;
1023
+ if (n) {
1024
+ let p = n, P = f;
1025
+ if ((w = n == null ? void 0 : n.__tres) != null && w.primitive && P === "object" && h !== null) {
1026
+ const M = t("primitive", void 0, void 0, {
1027
+ object: l
1025
1028
  });
1026
- for (const v in w) {
1027
- if (v === "uuid")
1029
+ for (const _ in M) {
1030
+ if (_ === "uuid")
1028
1031
  continue;
1029
- const h = r[v], _ = w[v];
1030
- !(h != null && h.set) && !ee(h) ? r[v] = _ : h.constructor === _.constructor && (h != null && h.copy) ? h == null || h.copy(_) : Array.isArray(_) ? h.set(..._) : !h.isColor && h.setScalar ? h.setScalar(_) : h.set(_);
1032
+ const u = n[_], v = M[_];
1033
+ !(u != null && u.set) && !ee(u) ? n[_] = v : u.constructor === v.constructor && (u != null && u.copy) ? u == null || u.copy(v) : Array.isArray(v) ? u.set(...v) : !u.isColor && u.setScalar ? u.setScalar(v) : u.set(v);
1031
1034
  }
1032
- w != null && w.__tres && (w.__tres.root = e == null ? void 0 : e.__tres.root), w != null && w.isGroup ? (r.geometry = void 0, r.material = void 0) : delete r.isGroup;
1035
+ M != null && M.__tres && (M.__tres.root = e == null ? void 0 : e.__tres.root), M != null && M.isGroup ? (n.geometry = void 0, n.material = void 0) : delete n.isGroup;
1033
1036
  }
1034
- if (r != null && r.isObject3D && P === "blocks-pointer-events") {
1035
- a || a === "" ? r[P] = a : delete r[P];
1037
+ if (n != null && n.isObject3D && P === "blocks-pointer-events") {
1038
+ l || l === "" ? n[P] = l : delete n[P];
1036
1039
  return;
1037
1040
  }
1038
- let f = X(P), b = p == null ? void 0 : p[f];
1041
+ Fe.includes(f) && (n.__tres.eventCount += 1);
1042
+ let y = X(P), g = p == null ? void 0 : p[y];
1039
1043
  if (P === "args") {
1040
- const w = r, v = u ?? [], h = a ?? [], _ = ((c = r == null ? void 0 : r.__tres) == null ? void 0 : c.type) || r.type;
1041
- _ && v.length && !Cr(v, h) && (p = Object.assign(
1042
- w,
1043
- new de.value[_](...a)
1044
+ const M = n, _ = h ?? [], u = l ?? [], v = ((b = n == null ? void 0 : n.__tres) == null ? void 0 : b.type) || n.type;
1045
+ v && _.length && !Sr(_, u) && (p = Object.assign(
1046
+ M,
1047
+ new de.value[v](...l)
1044
1048
  ));
1045
1049
  return;
1046
1050
  }
@@ -1049,140 +1053,150 @@ const Ur = () => {
1049
1053
  return;
1050
1054
  p.setAttribute(
1051
1055
  X(P),
1052
- new Et(...a)
1056
+ new Tt(...l)
1053
1057
  );
1054
1058
  return;
1055
1059
  }
1056
- if (P.includes("-") && b === void 0) {
1057
- const w = P.split("-");
1058
- b = w.reduce((v, h) => v[X(h)], p), P = w.pop(), f = P, b != null && b.set || (p = w.reduce((v, h) => v[X(h)], p));
1060
+ if (P.includes("-") && g === void 0) {
1061
+ const M = P.split("-");
1062
+ g = M.reduce((_, u) => _[X(u)], p), P = M.pop(), y = P, g != null && g.set || (p = M.reduce((_, u) => _[X(u)], p));
1059
1063
  }
1060
- let m = a;
1061
- if (m === "" && (m = !0), ee(b)) {
1062
- Hr.includes(s) || (Array.isArray(m) ? r[f](...m) : r[f](m)), f.startsWith("on") && ee(m) && (p[f] = m);
1064
+ let d = l;
1065
+ if (d === "" && (d = !0), ee(g)) {
1066
+ Fe.includes(f) || (Array.isArray(d) ? n[y](...d) : n[y](d)), y.startsWith("on") && ee(d) && (p[y] = d);
1063
1067
  return;
1064
1068
  }
1065
- !(b != null && b.set) && !ee(b) ? p[f] = m : b.constructor === m.constructor && (b != null && b.copy) ? b == null || b.copy(m) : Array.isArray(m) ? b.set(...m) : !b.isColor && b.setScalar ? b.setScalar(m) : b.set(m), Ue(r);
1069
+ !(g != null && g.set) && !ee(g) ? p[y] = d : g.constructor === d.constructor && (g != null && g.copy) ? g == null || g.copy(d) : Array.isArray(d) ? g.set(...d) : !g.isColor && g.setScalar ? g.setScalar(d) : g.set(d), Ue(n);
1066
1070
  }
1067
1071
  }
1068
- function l(r) {
1069
- return (r == null ? void 0 : r.parent) || null;
1072
+ function c(n) {
1073
+ return (n == null ? void 0 : n.parent) || null;
1074
+ }
1075
+ function i(n) {
1076
+ const f = new xt();
1077
+ return f.name = n, f.__tres = { type: "Comment" }, f.__tres.root = e == null ? void 0 : e.__tres.root, f;
1078
+ }
1079
+ function a(n) {
1080
+ if (!n)
1081
+ return null;
1082
+ const f = n.parent || e, h = f.children.indexOf(n);
1083
+ return f.children[h + 1] || null;
1070
1084
  }
1071
1085
  return {
1072
- insert: n,
1086
+ insert: r,
1073
1087
  remove: o,
1074
1088
  createElement: t,
1075
- patchProp: i,
1076
- parentNode: l,
1089
+ patchProp: s,
1090
+ parentNode: c,
1077
1091
  createText: () => void 0,
1078
- createComment: () => void 0,
1092
+ createComment: i,
1079
1093
  setText: () => void 0,
1080
1094
  setElementText: () => void 0,
1081
- nextSibling: () => void 0,
1095
+ nextSibling: a,
1082
1096
  querySelector: () => void 0,
1083
1097
  setScopeId: () => void 0,
1084
1098
  cloneNode: () => void 0,
1085
1099
  insertStaticContent: () => void 0
1086
1100
  };
1087
1101
  };
1088
- function $r() {
1089
- return tt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1102
+ function Wr() {
1103
+ return nt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1090
1104
  }
1091
- function tt() {
1105
+ function nt() {
1092
1106
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1093
1107
  }
1094
- const Fr = typeof Proxy == "function", Wr = "devtools-plugin:setup", Nr = "plugin:settings:set";
1095
- let F, me;
1096
- function zr() {
1108
+ const Nr = typeof Proxy == "function", zr = "devtools-plugin:setup", Gr = "plugin:settings:set";
1109
+ let U, ge;
1110
+ function Vr() {
1097
1111
  var e;
1098
- return F !== void 0 || (typeof window < "u" && window.performance ? (F = !0, me = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (F = !0, me = globalThis.perf_hooks.performance) : F = !1), F;
1112
+ return U !== void 0 || (typeof window < "u" && window.performance ? (U = !0, ge = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (U = !0, ge = globalThis.perf_hooks.performance) : U = !1), U;
1099
1113
  }
1100
- function Gr() {
1101
- return zr() ? me.now() : Date.now();
1114
+ function qr() {
1115
+ return Vr() ? ge.now() : Date.now();
1102
1116
  }
1103
- class Vr {
1104
- constructor(t, n) {
1105
- this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1117
+ class Yr {
1118
+ constructor(t, r) {
1119
+ this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = r;
1106
1120
  const o = {};
1107
1121
  if (t.settings)
1108
- for (const r in t.settings) {
1109
- const s = t.settings[r];
1110
- o[r] = s.defaultValue;
1122
+ for (const i in t.settings) {
1123
+ const a = t.settings[i];
1124
+ o[i] = a.defaultValue;
1111
1125
  }
1112
- const i = `__vue-devtools-plugin-settings__${t.id}`;
1113
- let l = Object.assign({}, o);
1126
+ const s = `__vue-devtools-plugin-settings__${t.id}`;
1127
+ let c = Object.assign({}, o);
1114
1128
  try {
1115
- const r = localStorage.getItem(i), s = JSON.parse(r);
1116
- Object.assign(l, s);
1129
+ const i = localStorage.getItem(s), a = JSON.parse(i);
1130
+ Object.assign(c, a);
1117
1131
  } catch {
1118
1132
  }
1119
1133
  this.fallbacks = {
1120
1134
  getSettings() {
1121
- return l;
1135
+ return c;
1122
1136
  },
1123
- setSettings(r) {
1137
+ setSettings(i) {
1124
1138
  try {
1125
- localStorage.setItem(i, JSON.stringify(r));
1139
+ localStorage.setItem(s, JSON.stringify(i));
1126
1140
  } catch {
1127
1141
  }
1128
- l = r;
1142
+ c = i;
1129
1143
  },
1130
1144
  now() {
1131
- return Gr();
1145
+ return qr();
1132
1146
  }
1133
- }, n && n.on(Nr, (r, s) => {
1134
- r === this.plugin.id && this.fallbacks.setSettings(s);
1147
+ }, r && r.on(Gr, (i, a) => {
1148
+ i === this.plugin.id && this.fallbacks.setSettings(a);
1135
1149
  }), this.proxiedOn = new Proxy({}, {
1136
- get: (r, s) => this.target ? this.target.on[s] : (...u) => {
1150
+ get: (i, a) => this.target ? this.target.on[a] : (...n) => {
1137
1151
  this.onQueue.push({
1138
- method: s,
1139
- args: u
1152
+ method: a,
1153
+ args: n
1140
1154
  });
1141
1155
  }
1142
1156
  }), this.proxiedTarget = new Proxy({}, {
1143
- get: (r, s) => this.target ? this.target[s] : s === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(s) ? (...u) => (this.targetQueue.push({
1144
- method: s,
1145
- args: u,
1157
+ get: (i, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...n) => (this.targetQueue.push({
1158
+ method: a,
1159
+ args: n,
1146
1160
  resolve: () => {
1147
1161
  }
1148
- }), this.fallbacks[s](...u)) : (...u) => new Promise((a) => {
1162
+ }), this.fallbacks[a](...n)) : (...n) => new Promise((f) => {
1149
1163
  this.targetQueue.push({
1150
- method: s,
1151
- args: u,
1152
- resolve: a
1164
+ method: a,
1165
+ args: n,
1166
+ resolve: f
1153
1167
  });
1154
1168
  })
1155
1169
  });
1156
1170
  }
1157
1171
  async setRealTarget(t) {
1158
1172
  this.target = t;
1159
- for (const n of this.onQueue)
1160
- this.target.on[n.method](...n.args);
1161
- for (const n of this.targetQueue)
1162
- n.resolve(await this.target[n.method](...n.args));
1173
+ for (const r of this.onQueue)
1174
+ this.target.on[r.method](...r.args);
1175
+ for (const r of this.targetQueue)
1176
+ r.resolve(await this.target[r.method](...r.args));
1163
1177
  }
1164
1178
  }
1165
- function qr(e, t) {
1166
- const n = e, o = tt(), i = $r(), l = Fr && n.enableEarlyProxy;
1167
- if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1168
- i.emit(Wr, e, t);
1179
+ function Jr(e, t) {
1180
+ const r = e, o = nt(), s = Wr(), c = Nr && r.enableEarlyProxy;
1181
+ if (s && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !c))
1182
+ s.emit(zr, e, t);
1169
1183
  else {
1170
- const r = l ? new Vr(n, i) : null;
1184
+ const i = c ? new Yr(r, s) : null;
1171
1185
  (o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1172
- pluginDescriptor: n,
1186
+ pluginDescriptor: r,
1173
1187
  setupFn: t,
1174
- proxy: r
1175
- }), r && t(r.proxiedTarget);
1188
+ proxy: i
1189
+ }), i && t(i.proxiedTarget);
1176
1190
  }
1177
1191
  }
1178
- function Yr(e, t) {
1179
- const n = `▲ ■ ●${e}`;
1180
- typeof $e == "function" ? $e(n, t) : console.log(n);
1192
+ function Qr(e, t) {
1193
+ const r = `▲ ■ ●${e}`;
1194
+ typeof We == "function" ? We(r, t) : console.log(r);
1181
1195
  }
1182
- function $e(e, t) {
1196
+ function We(e, t) {
1183
1197
  throw new Error(e + t);
1184
1198
  }
1185
- const rt = (e) => {
1199
+ const ot = (e) => {
1186
1200
  const t = {
1187
1201
  id: e.uuid,
1188
1202
  label: e.type,
@@ -1194,9 +1208,9 @@ const rt = (e) => {
1194
1208
  textColor: 5750629,
1195
1209
  backgroundColor: 15793395
1196
1210
  });
1197
- const n = be(e);
1198
- return n > 0 && t.tags.push({
1199
- label: `${Dr(n)} KB`,
1211
+ const r = be(e);
1212
+ return r > 0 && t.tags.push({
1213
+ label: `${Rr(r)} KB`,
1200
1214
  textColor: 15707189,
1201
1215
  backgroundColor: 16775644,
1202
1216
  tooltip: "Memory usage"
@@ -1222,166 +1236,87 @@ const rt = (e) => {
1222
1236
  tooltip: "Position"
1223
1237
  })), t;
1224
1238
  };
1225
- function nt(e, t, n = "") {
1239
+ function st(e, t, r = "") {
1226
1240
  e.children.forEach((o) => {
1227
- if (o.type === "HightlightMesh" || n && !o.type.includes(n) && !o.name.includes(n))
1241
+ if (o.type === "HightlightMesh" || r && !o.type.includes(r) && !o.name.includes(r))
1228
1242
  return;
1229
- const i = rt(o);
1230
- t.children.push(i), nt(o, i, n);
1243
+ const s = ot(o);
1244
+ t.children.push(s), st(o, s, r);
1231
1245
  });
1232
1246
  }
1233
- const Jr = [], G = "tres:inspector", Qr = We({
1247
+ const Kr = [], z = "tres:inspector", Xr = ze({
1234
1248
  sceneGraph: null
1235
1249
  });
1236
- function Kr(e, t) {
1237
- qr(
1250
+ function Zr(e, t) {
1251
+ Jr(
1238
1252
  {
1239
1253
  id: "dev.esm.tres",
1240
1254
  label: "TresJS 🪐",
1241
1255
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
1242
1256
  packageName: "tresjs",
1243
1257
  homepage: "https://tresjs.org",
1244
- componentStateTypes: Jr,
1258
+ componentStateTypes: Kr,
1245
1259
  app: e
1246
1260
  },
1247
- (n) => {
1248
- typeof n.now != "function" && Yr(
1261
+ (r) => {
1262
+ typeof r.now != "function" && Qr(
1249
1263
  "You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
1250
- ), n.addInspector({
1251
- id: G,
1264
+ ), r.addInspector({
1265
+ id: z,
1252
1266
  label: "TresJS 🪐",
1253
1267
  icon: "account_tree",
1254
1268
  treeFilterPlaceholder: "Search instances"
1255
1269
  }), setInterval(() => {
1256
- n.sendInspectorTree(G);
1270
+ r.sendInspectorTree(z);
1257
1271
  }, 1e3), setInterval(() => {
1258
- n.notifyComponentUpdate();
1259
- }, 5e3), n.on.getInspectorTree((l) => {
1260
- if (l.inspectorId === G) {
1261
- const r = rt(t.scene.value);
1262
- nt(t.scene.value, r, l.filter), Qr.sceneGraph = r, l.rootNodes = [r];
1272
+ r.notifyComponentUpdate();
1273
+ }, 5e3), r.on.getInspectorTree((c) => {
1274
+ if (c.inspectorId === z) {
1275
+ const i = ot(t.scene.value);
1276
+ st(t.scene.value, i, c.filter), Xr.sceneGraph = i, c.rootNodes = [i];
1263
1277
  }
1264
1278
  });
1265
- let o = null, i = null;
1266
- n.on.getInspectorState((l) => {
1267
- var r;
1268
- if (l.inspectorId === G) {
1269
- const [s] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1270
- if (!s)
1279
+ let o = null, s = null;
1280
+ r.on.getInspectorState((c) => {
1281
+ var i;
1282
+ if (c.inspectorId === z) {
1283
+ const [a] = t.scene.value.getObjectsByProperty("uuid", c.nodeId);
1284
+ if (!a)
1271
1285
  return;
1272
- if (i && o && o.parent && i.remove(o), s.isMesh) {
1273
- const u = kr(s);
1274
- s.add(u), o = u, i = s;
1286
+ if (s && o && o.parent && s.remove(o), a.isMesh) {
1287
+ const n = kr(a);
1288
+ a.add(n), o = n, s = a;
1275
1289
  }
1276
- l.state = {
1277
- object: [
1278
- {
1279
- key: "uuid",
1280
- editable: !0,
1281
- value: s.uuid
1282
- },
1283
- {
1284
- key: "name",
1285
- editable: !0,
1286
- value: s.name
1287
- },
1288
- {
1289
- key: "type",
1290
- editable: !0,
1291
- value: s.type
1292
- },
1293
- {
1294
- key: "position",
1295
- editable: !0,
1296
- value: s.position
1297
- },
1298
- {
1299
- key: "rotation",
1300
- editable: !0,
1301
- value: s.rotation
1302
- },
1303
- {
1304
- key: "scale",
1305
- editable: !0,
1306
- value: s.scale
1307
- },
1308
- {
1309
- key: "geometry",
1310
- value: s.geometry
1311
- },
1312
- {
1313
- key: "material",
1314
- value: s.material
1315
- },
1316
- {
1317
- key: "color",
1318
- editable: !0,
1319
- value: s.color
1320
- },
1321
- {
1322
- key: "intensity",
1323
- editable: !0,
1324
- value: s.intensity
1325
- },
1326
- {
1327
- key: "castShadow",
1328
- editable: !0,
1329
- value: s.castShadow
1330
- },
1331
- {
1332
- key: "receiveShadow",
1333
- editable: !0,
1334
- value: s.receiveShadow
1335
- },
1336
- {
1337
- key: "frustumCulled",
1338
- editable: !0,
1339
- value: s.frustumCulled
1340
- },
1341
- {
1342
- key: "matrixAutoUpdate",
1343
- editable: !0,
1344
- value: s.matrixAutoUpdate
1345
- },
1346
- {
1347
- key: "matrixWorldNeedsUpdate",
1348
- editable: !0,
1349
- value: s.matrixWorldNeedsUpdate
1350
- },
1351
- {
1352
- key: "matrixWorld",
1353
- value: s.matrixWorld
1354
- },
1355
- {
1356
- key: "visible",
1357
- editable: !0,
1358
- value: s.visible
1359
- }
1360
- ]
1361
- }, s.isScene && (l.state.info = {
1362
- memory: be(s),
1363
- objects: s.children.length,
1290
+ c.state = {
1291
+ object: Object.entries(a).map(([n, f]) => ({
1292
+ key: n,
1293
+ value: f,
1294
+ editable: !0
1295
+ })).filter(({ key: n }) => n !== "parent")
1296
+ }, a.isScene && (c.state.info = {
1297
+ memory: be(a),
1298
+ objects: a.children.length,
1364
1299
  calls: t.renderer.value.info.render.calls,
1365
1300
  triangles: t.renderer.value.info.render.triangles,
1366
1301
  points: t.renderer.value.info.render.points,
1367
1302
  lines: t.renderer.value.info.render.lines
1368
- }, l.state.programs = ((r = t.renderer.value.info.programs) == null ? void 0 : r.map((u) => ({
1369
- key: u.name,
1303
+ }, c.state.programs = ((i = t.renderer.value.info.programs) == null ? void 0 : i.map((n) => ({
1304
+ key: n.name,
1370
1305
  value: {
1371
- ...u,
1372
- vertexShader: u.vertexShader,
1373
- attributes: u.getAttributes(),
1374
- uniforms: u.getUniforms()
1306
+ ...n,
1307
+ vertexShader: n.vertexShader,
1308
+ attributes: n.getAttributes(),
1309
+ uniforms: n.getUniforms()
1375
1310
  }
1376
1311
  }))) || []);
1377
1312
  }
1378
- }), n.on.editInspectorState((l) => {
1379
- l.inspectorId === G && Er(t.scene.value, l.nodeId, l.path, l.state.value);
1313
+ }), r.on.editInspectorState((c) => {
1314
+ c.inspectorId === z && xr(t.scene.value, c.nodeId, c.path, c.state.value);
1380
1315
  });
1381
1316
  }
1382
1317
  );
1383
1318
  }
1384
- const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1319
+ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1385
1320
  __name: "TresCanvas",
1386
1321
  props: {
1387
1322
  shadows: { type: Boolean, default: void 0 },
@@ -1423,91 +1358,91 @@ const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1423
1358
  "pointer-missed",
1424
1359
  "wheel"
1425
1360
  ],
1426
- setup(e, { expose: t, emit: n }) {
1427
- var b;
1428
- const o = e, i = n, l = lt(), { logWarning: r } = $(), s = A(), u = U(new Ge()), a = (b = xe()) == null ? void 0 : b.appContext.app;
1429
- pe(Ne);
1430
- const y = (m) => Se({
1361
+ setup(e, { expose: t, emit: r }) {
1362
+ var P;
1363
+ const o = e, s = r, c = ut(), { logWarning: i } = $(), a = L(), n = H(new qe()), f = (P = ke()) == null ? void 0 : P.appContext.app;
1364
+ me(Ge);
1365
+ const h = (y) => xe({
1431
1366
  setup() {
1432
- var v;
1433
- const w = (v = xe()) == null ? void 0 : v.appContext;
1434
- return w && (w.app = a), ce("useTres", m), ce("extend", pe), typeof window < "u" && Kr(w == null ? void 0 : w.app, m), () => Te(vt, null, l != null && l.default ? l.default() : []);
1367
+ var d;
1368
+ const g = (d = ke()) == null ? void 0 : d.appContext;
1369
+ return g && (g.app = f), fe("useTres", y), fe("extend", me), typeof window < "u" && Zr(g == null ? void 0 : g.app, y), () => Oe(ht, null, c != null && c.default ? c.default() : []);
1435
1370
  }
1436
- }), c = (m) => {
1437
- const w = y(m), { render: v } = mt(Ur());
1438
- v(Te(w), u.value);
1439
- }, p = (m, w = !1) => {
1440
- ye(m.scene.value), w && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), u.value.__tres = {
1441
- root: m
1442
- }, c(m);
1443
- }, P = B(() => o.disableRender), f = U(null);
1444
- return t({ context: f, dispose: () => p(f.value, !0) }), ut(() => {
1445
- const m = s;
1446
- f.value = jr({
1447
- scene: u.value,
1448
- canvas: m,
1371
+ }), l = (y) => {
1372
+ const g = h(y), { render: d } = vt(Ur());
1373
+ d(Oe(g), n.value);
1374
+ }, w = (y, g = !1) => {
1375
+ we(y.scene.value), g && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), n.value.__tres = {
1376
+ root: y
1377
+ }, l(y);
1378
+ }, b = D(() => o.disableRender), p = H(null);
1379
+ return t({ context: p, dispose: () => w(p.value, !0) }), ft(() => {
1380
+ const y = a;
1381
+ p.value = $r({
1382
+ scene: n.value,
1383
+ canvas: y,
1449
1384
  windowSize: o.windowSize ?? !1,
1450
- disableRender: P.value ?? !1,
1385
+ disableRender: b.value ?? !1,
1451
1386
  rendererOptions: o,
1452
- emit: i
1453
- }), Ir(u.value, f.value, i);
1454
- const { registerCamera: w, camera: v, cameras: h, deregisterCamera: _ } = f.value;
1455
- c(f.value);
1456
- const g = () => {
1457
- const M = new fe(
1387
+ emit: s
1388
+ }), Fr(n.value, p.value, s);
1389
+ const { registerCamera: g, camera: d, cameras: M, deregisterCamera: _ } = p.value;
1390
+ l(p.value);
1391
+ const u = () => {
1392
+ const v = new pe(
1458
1393
  45,
1459
1394
  window.innerWidth / window.innerHeight,
1460
1395
  0.1,
1461
1396
  1e3
1462
1397
  );
1463
- M.position.set(3, 3, 3), M.lookAt(0, 0, 0), w(M);
1464
- const C = ve(() => {
1465
- h.value.length >= 2 && (M.removeFromParent(), _(M), C == null || C());
1398
+ v.position.set(3, 3, 3), v.lookAt(0, 0, 0), g(v);
1399
+ const E = ve(() => {
1400
+ M.value.length >= 2 && (v.removeFromParent(), _(v), E == null || E());
1466
1401
  });
1467
1402
  };
1468
- V(
1403
+ G(
1469
1404
  () => o.camera,
1470
- (M, C) => {
1471
- M && w(M), C && (C.removeFromParent(), _(C));
1405
+ (v, E) => {
1406
+ v && g(v), E && (E.removeFromParent(), _(E));
1472
1407
  },
1473
1408
  {
1474
1409
  immediate: !0
1475
1410
  }
1476
- ), v.value || (r(
1411
+ ), d.value || (i(
1477
1412
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1478
- ), g());
1413
+ ), u());
1479
1414
  }), N(() => {
1480
- p(f.value);
1481
- }), (m, w) => (ct(), ft("canvas", {
1415
+ w(p.value);
1416
+ }), (y, g) => (pt(), dt("canvas", {
1482
1417
  ref_key: "canvas",
1483
- ref: s,
1484
- "data-scene": u.value.uuid,
1485
- class: dt(m.$attrs.class),
1486
- "data-tres": `tresjs ${W(ur).version}`,
1487
- style: pt({
1418
+ ref: a,
1419
+ "data-scene": n.value.uuid,
1420
+ class: mt(y.$attrs.class),
1421
+ "data-tres": `tresjs ${W(pr).version}`,
1422
+ style: gt({
1488
1423
  display: "block",
1489
1424
  width: "100%",
1490
1425
  height: "100%",
1491
- position: m.windowSize ? "fixed" : "relative",
1426
+ position: y.windowSize ? "fixed" : "relative",
1492
1427
  top: 0,
1493
1428
  left: 0,
1494
1429
  pointerEvents: "auto",
1495
1430
  touchAction: "none",
1496
- ...m.$attrs.style
1431
+ ...y.$attrs.style
1497
1432
  })
1498
- }, null, 14, Xr));
1433
+ }, null, 14, en));
1499
1434
  }
1500
- }), en = [
1435
+ }), rn = [
1501
1436
  "TresCanvas",
1502
1437
  "TresLeches",
1503
1438
  "TresScene"
1504
- ], tn = {
1439
+ ], nn = {
1505
1440
  template: {
1506
1441
  compilerOptions: {
1507
- isCustomElement: (e) => e.startsWith("Tres") && !en.includes(e) || e === "primitive"
1442
+ isCustomElement: (e) => e.startsWith("Tres") && !rn.includes(e) || e === "primitive"
1508
1443
  }
1509
1444
  }
1510
- }, yn = tn, bn = {
1445
+ }, bn = nn, Mn = {
1511
1446
  mounted: (e, t) => {
1512
1447
  if (t.arg) {
1513
1448
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1516,22 +1451,22 @@ const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1516
1451
  console.log("v-log", e);
1517
1452
  }
1518
1453
  };
1519
- class ot extends kt {
1520
- constructor(t, n) {
1521
- const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new Ae();
1522
- i.setAttribute("position", new Oe(o, 3)), i.computeBoundingSphere();
1523
- const l = new St({ fog: !1 });
1524
- super(i, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1525
- const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Ae();
1526
- s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new xt(s, new Ve({ side: Tt, fog: !1 })));
1454
+ class it extends kt {
1455
+ constructor(t, r) {
1456
+ const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new Ae();
1457
+ s.setAttribute("position", new Le(o, 3)), s.computeBoundingSphere();
1458
+ const c = new Ot({ fog: !1 });
1459
+ super(s, c), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
1460
+ const i = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new Ae();
1461
+ a.setAttribute("position", new Le(i, 3)), a.computeBoundingSphere(), this.add(new At(a, new Ye({ side: Lt, fog: !1 })));
1527
1462
  }
1528
1463
  updateMatrixWorld() {
1529
1464
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
1530
1465
  this.material.color.set(this.color), this.children[0].material.color.set(this.color);
1531
1466
  else {
1532
1467
  this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);
1533
- const t = this.material.color, n = Math.max(t.r, t.g, t.b);
1534
- n > 1 && t.multiplyScalar(1 / n), this.children[0].material.color.copy(this.material.color);
1468
+ const t = this.material.color, r = Math.max(t.r, t.g, t.b);
1469
+ r > 1 && t.multiplyScalar(1 / r), this.children[0].material.color.copy(this.material.color);
1535
1470
  }
1536
1471
  this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
1537
1472
  }
@@ -1539,87 +1474,87 @@ class ot extends kt {
1539
1474
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1540
1475
  }
1541
1476
  }
1542
- const { logWarning: Fe } = $();
1543
- let te, H;
1544
- const rn = {
1545
- DirectionalLight: At,
1546
- PointLight: Ot,
1547
- SpotLight: Lt,
1548
- HemisphereLight: Dt,
1549
- RectAreaLight: ot
1550
- }, wn = {
1477
+ const { logWarning: Ne } = $();
1478
+ let te, I;
1479
+ const on = {
1480
+ DirectionalLight: Dt,
1481
+ PointLight: Bt,
1482
+ SpotLight: jt,
1483
+ HemisphereLight: Rt,
1484
+ RectAreaLight: it
1485
+ }, Pn = {
1551
1486
  mounted: (e) => {
1552
1487
  if (!e.isLight) {
1553
- Fe(`${e.type} is not a light`);
1488
+ Ne(`${e.type} is not a light`);
1554
1489
  return;
1555
1490
  }
1556
- te = rn[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1491
+ te = on[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1557
1492
  },
1558
1493
  updated: (e) => {
1559
- H = e.parent.children.find((t) => t instanceof te), !(H instanceof ot) && H.update();
1494
+ I = e.parent.children.find((t) => t instanceof te), !(I instanceof it) && I.update();
1560
1495
  },
1561
1496
  unmounted: (e) => {
1562
1497
  if (!e.isLight) {
1563
- Fe(`${e.type} is not a light`);
1498
+ Ne(`${e.type} is not a light`);
1564
1499
  return;
1565
1500
  }
1566
- H = e.parent.children.find((t) => t instanceof te), H && H.dispose && H.dispose(), e.parent.remove(H);
1501
+ I = e.parent.children.find((t) => t instanceof te), I && I.dispose && I.dispose(), e.parent.remove(I);
1567
1502
  }
1568
- }, { logWarning: nn } = $();
1569
- let D = null;
1570
- const Mn = {
1503
+ }, { logWarning: sn } = $();
1504
+ let j = null;
1505
+ const _n = {
1571
1506
  updated: (e, t) => {
1572
- var i;
1573
- const n = Sr(t);
1574
- if (!n) {
1575
- nn(`v-distance-to: problem with binding value: ${t.value}`);
1507
+ var s;
1508
+ const r = Or(t);
1509
+ if (!r) {
1510
+ sn(`v-distance-to: problem with binding value: ${t.value}`);
1576
1511
  return;
1577
1512
  }
1578
- D && (D.dispose(), e.parent.remove(D));
1579
- const o = n.clone().sub(e.position);
1580
- o.normalize(), D = new Bt(o, e.position, e.position.distanceTo(n), 16776960), e.parent.add(D), console.table(
1513
+ j && (j.dispose(), e.parent.remove(j));
1514
+ const o = r.clone().sub(e.position);
1515
+ o.normalize(), j = new It(o, e.position, e.position.distanceTo(r), 16776960), e.parent.add(j), console.table(
1581
1516
  [
1582
- ["Distance:", e.position.distanceTo(n)],
1583
- [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(i = e.position) == null ? void 0 : i.z}`],
1584
- [`Destiny: ${e.name || e.type}`, `x:${n.x}, y:${n.y}, z:${n == null ? void 0 : n.z}`]
1517
+ ["Distance:", e.position.distanceTo(r)],
1518
+ [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
1519
+ [`Destiny: ${e.name || e.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
1585
1520
  ]
1586
1521
  );
1587
1522
  },
1588
1523
  unmounted: (e) => {
1589
- D == null || D.dispose(), e.parent.remove(D);
1524
+ j == null || j.dispose(), e.parent.remove(j);
1590
1525
  }
1591
- }, Pn = {
1526
+ }, Cn = {
1592
1527
  install(e) {
1593
- e.component("TresCanvas", Zr);
1528
+ e.component("TresCanvas", tn);
1594
1529
  }
1595
1530
  };
1596
1531
  export {
1597
- Zr as TresCanvas,
1532
+ tn as TresCanvas,
1598
1533
  de as catalogue,
1599
- Rr as createRenderLoop,
1600
- Pn as default,
1601
- ye as dispose,
1602
- pe as extend,
1603
- cn as isProd,
1604
- mr as normalizeColor,
1605
- fn as normalizeVectorFlexibleParam,
1606
- yn as templateCompilerOptions,
1607
- Lr as trasverseObjects,
1608
- cr as useCamera,
1609
- dn as useLoader,
1534
+ Hr as createRenderLoop,
1535
+ Cn as default,
1536
+ we as dispose,
1537
+ me as extend,
1538
+ pn as isProd,
1539
+ hr as normalizeColor,
1540
+ dn as normalizeVectorFlexibleParam,
1541
+ bn as templateCompilerOptions,
1542
+ jr as trasverseObjects,
1543
+ dr as useCamera,
1544
+ mn as useLoader,
1610
1545
  $ as useLogger,
1611
- hn as useLoop,
1612
- vn as usePointerEventHandler,
1613
- Ze as useRaycaster,
1614
- un as useRenderLoop,
1615
- Ar as useRenderer,
1616
- mn as useSeek,
1617
- pn as useTexture,
1618
- gn as useTres,
1619
- et as useTresContext,
1620
- jr as useTresContextProvider,
1621
- Ir as useTresEventManager,
1622
- Mn as vDistanceTo,
1623
- wn as vLightHelper,
1624
- bn as vLog
1546
+ wn as useLoop,
1547
+ hn as usePointerEventHandler,
1548
+ tt as useRaycaster,
1549
+ fn as useRenderLoop,
1550
+ Dr as useRenderer,
1551
+ vn as useSeek,
1552
+ gn as useTexture,
1553
+ yn as useTres,
1554
+ rt as useTresContext,
1555
+ $r as useTresContextProvider,
1556
+ Fr as useTresEventManager,
1557
+ _n as vDistanceTo,
1558
+ Pn as vLightHelper,
1559
+ Mn as vLog
1625
1560
  };