@tresjs/core 4.0.1 → 4.0.2

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.0.2
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 ge, onUnmounted as N, shallowRef as H, watch as G, reactive as ze, readonly as ce, unref as W, provide as fe, inject as ut, defineComponent as xe, useSlots as ct, getCurrentInstance as Te, onMounted as ft, openBlock as dt, createElementBlock as pt, normalizeClass as mt, normalizeStyle as vt, createRenderer as gt, h as Ae, Fragment as ht } from "vue";
12
+ import * as Ge from "three";
13
+ import { PerspectiveCamera as de, Camera as yt, Clock as Ve, Vector3 as he, Color as re, Scene as qe, MeshBasicMaterial as Ye, DoubleSide as bt, REVISION as wt, 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 kt, BufferAttribute as St, Object3D as xt, Line as Tt, BufferGeometry as Oe, Float32BufferAttribute as Le, LineBasicMaterial as At, Mesh as Ot, BackSide as Lt, DirectionalLightHelper as Dt, PointLightHelper as Bt, SpotLightHelper as jt, HemisphereLightHelper as Rt, ArrowHelper as It } from "three";
14
+ import { createEventHook as O, useRafFn as Qe, toValue as S, unrefElement as Ht, useDevicePixelRatio as Ut, usePointer as $t, useElementBounding as Ft, 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.0.2", 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
+ }, ur = {
63
63
  three: ">=0.133",
64
64
  vue: ">=3.4"
65
- }, ar = {
65
+ }, cr = {
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,310 +106,310 @@ 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
+ }, dr = {
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: ur,
127
+ dependencies: cr,
128
+ devDependencies: fr
129
+ }, pr = ({ 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);
132
+ ), o = (a) => {
133
+ const s = a instanceof yt ? a : t.value.find((f) => f.uuid === a);
134
134
  if (!s)
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 !== s.uuid);
137
+ t.value = [s, ...n];
138
+ }, i = (a, s = !1) => {
139
+ t.value.some(({ uuid: n }) => n === a.uuid) || (s ? o(a) : t.value.push(a));
140
+ }, u = (a) => {
141
+ t.value = t.value.filter(({ uuid: s }) => s !== a.uuid);
142
142
  };
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());
143
+ return ge(() => {
144
+ e.aspectRatio.value && t.value.forEach((a) => {
145
+ !a.manual && (a instanceof de || mr(a)) && (a instanceof de ? a.aspect = e.aspectRatio.value : (a.left = e.width.value * -0.5, a.right = e.width.value * 0.5, a.top = e.height.value * 0.5, a.bottom = e.height.value * -0.5), a.updateProjectionMatrix());
146
146
  });
147
147
  }), N(() => {
148
148
  t.value = [];
149
149
  }), {
150
- camera: n,
150
+ camera: r,
151
151
  cameras: t,
152
152
  registerCamera: i,
153
- deregisterCamera: l,
153
+ deregisterCamera: u,
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 = O(), Xe = O(), ye = O(), V = new Ve();
161
161
  let ne = 0, oe = 0;
162
- const { pause: dr, resume: De, isActive: pr } = Ye(
162
+ const { pause: vr, resume: Be, isActive: gr } = 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 ▲ ■ ●] ";
180
- function $() {
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: vr,
177
+ resume: Be,
178
+ isActive: gr
179
+ }), dn = !0, K = "[TresJS ▲ ■ ●] ";
180
+ function U() {
181
181
  function e(...o) {
182
182
  typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
183
183
  }
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, i) {
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 pn(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, a = 1 + 0.07 * Math.sin(2.5 * o);
210
+ this.scale.set(a, a, a);
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
+ }, br = "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", wr = /* @__PURE__ */ _r(br);
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(",");
228
+ function _r(e, t) {
229
+ const r = /* @__PURE__ */ Object.create(null), o = e.split(",");
230
230
  for (let i = 0; i < o.length; i++)
231
- n[o[i]] = !0;
232
- return (i) => !!n[i];
231
+ r[o[i]] = !0;
232
+ return (i) => !!r[i];
233
233
  }
234
- const Mr = (e, t) => {
235
- const n = /* @__PURE__ */ new Set(), o = [];
234
+ const Cr = (e, t) => {
235
+ const r = /* @__PURE__ */ new Set(), o = [];
236
236
  for (const i of e) {
237
- const l = t(i);
238
- n.has(l) || (n.add(l), o.push(i));
237
+ const u = t(i);
238
+ r.has(u) || (r.add(u), o.push(i));
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, i) => o && o[i], 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((i, u, a) => (i[u] === void 0 && (i[u] = {}), a === o.length - 1 && (i[u] = r), i[u]), 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 i = e.attributes, u = t.attributes;
253
+ return i.length !== u.length ? !1 : Array.from(i).every(({ name: a, value: s }) => t.getAttribute(a) === s);
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 i of r)
263
+ if (!o.includes(i) || !et(e[i], t[i]))
264
264
  return !1;
265
265
  return !0;
266
266
  }
267
- function Cr(e, t) {
267
+ function kr(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 Sr = Array.isArray;
276
+ function xr(e, t, r, o) {
277
+ const i = (n) => {
278
+ if (n.uuid === t)
279
+ return n;
280
+ for (const f of n.children) {
281
+ const h = i(f);
282
+ if (h)
283
+ return h;
284
284
  }
285
- }, l = i(e);
286
- if (!l) {
285
+ }, u = i(e);
286
+ if (!u) {
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 a = u;
291
+ for (let n = 0; n < r.length - 1; n++)
292
+ if (a[r[n]] !== void 0)
293
+ a = a[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 s = r[r.length - 1];
299
+ a[s] !== void 0 ? a[s] = o : console.warn(`Property path is not valid: ${r.join(".")}`);
300
300
  }
301
- function kr(e) {
302
- const t = new Ve({
301
+ function Tr(e) {
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: bt
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 Ar(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 Or(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
+ Or(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)) {
325
+ function be(e) {
326
+ var r, o;
327
+ if (e.parent && ((r = e.removeFromParent) == null || r.call(e)), delete e.__tres, [...e.children].forEach((i) => be(i)), !(e instanceof qe)) {
328
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);
329
+ e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((u) => He(u)), delete i.material) : i.material && (He(i.material), delete i.material);
330
330
  }
331
331
  }
332
- const Tr = Number.parseInt(yt.replace("dev", "")), Z = {
332
+ const Lr = Number.parseInt(wt.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: i, advance: u }
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() {
354
+ const a = D(() => ({
355
+ alpha: S(t.alpha) ?? !0,
356
+ depth: S(t.depth),
357
+ canvas: Ht(e),
358
+ context: S(t.context),
359
+ stencil: S(t.stencil),
360
+ antialias: S(t.antialias) ?? !0,
361
+ precision: S(t.precision),
362
+ powerPreference: S(t.powerPreference),
363
+ premultipliedAlpha: S(t.premultipliedAlpha),
364
+ preserveDrawingBuffer: S(t.preserveDrawingBuffer),
365
+ logarithmicDepthBuffer: S(t.logarithmicDepthBuffer),
366
+ failIfMajorPerformanceCaveat: S(t.failIfMajorPerformanceCaveat)
367
+ })), s = H(new ae(a.value));
368
+ function n() {
369
369
  t.renderMode === "on-demand" && i();
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(a, () => {
372
+ s.value.dispose(), s.value = new ae(a.value), n();
373
+ }), G([r.width, r.height], () => {
374
+ s.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 } = Ut();
379
+ G(f, () => {
380
+ s.value.setPixelRatio(f.value);
381
381
  });
382
- const { logError: y } = $(), p = (() => {
383
- const f = new ie(), b = {
382
+ const { logError: h } = U(), b = (() => {
383
+ const d = new ae(), P = {
384
384
  shadowMap: {
385
- enabled: f.shadowMap.enabled,
386
- type: f.shadowMap.type
385
+ enabled: d.shadowMap.enabled,
386
+ type: d.shadowMap.type
387
387
  },
388
- toneMapping: f.toneMapping,
389
- toneMappingExposure: f.toneMappingExposure,
390
- outputColorSpace: f.outputColorSpace
388
+ toneMapping: d.toneMapping,
389
+ toneMappingExposure: d.toneMappingExposure,
390
+ outputColorSpace: d.outputColorSpace
391
391
  };
392
- return f.dispose(), b;
393
- })(), P = k(t.renderMode);
394
- return P === "on-demand" && i(), P === "manual" && setTimeout(() => {
395
- l();
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);
392
+ return d.dispose(), P;
393
+ })(), w = S(t.renderMode);
394
+ return w === "on-demand" && i(), w === "manual" && setTimeout(() => {
395
+ u();
396
+ }, 100), ge(() => {
397
+ const d = S(t.preset);
398
+ d && (d in Z || h(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ze(s.value, Z[d])), w === "always" && (o.frames.value = Math.max(1, o.frames.value));
399
+ const P = (p, M) => {
400
+ const _ = S(p), c = () => {
401
+ if (d)
402
+ return Ie(Z[d], 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 g = c();
407
+ return g !== void 0 ? g : Ie(b, M);
408
+ }, y = (p, M) => Er(s.value, M, P(p, 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 v = P(t.clearColor, "clearColor");
411
+ v && s.value.setClearColor(
412
+ v ? hr(v) : new re(0)
413
413
  // default clear color is not easily/efficiently retrievable from three
414
414
  );
415
415
  }), N(() => {
@@ -418,371 +418,374 @@ function Ar({
418
418
  renderer: s
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, i) {
429
+ const { logError: u } = U(), a = new e();
430
+ i && i(a), r && r(a);
431
+ const n = (Array.isArray(t) ? t : [t]).map(
432
+ (f) => new Promise((h, l) => {
433
+ a.load(
434
+ f,
435
+ (b) => {
436
+ b.scene && Object.assign(b, jr(b.scene)), h(b);
437
437
  },
438
438
  o,
439
- (p) => c(l("[useLoader] - Failed to load resource", p))
439
+ (b) => l(u("[useLoader] - Failed to load resource", b))
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(
445
+ async function vn(e, t) {
446
+ const r = new Ct(t), o = (i) => new Promise((u, a) => {
447
+ r.load(
448
448
  i,
449
- (s) => l(s),
449
+ (s) => u(s),
450
450
  () => null,
451
451
  () => {
452
- r(new Error("[useTextures] - Failed to load texture"));
452
+ a(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)));
456
+ if (Sr(e)) {
457
+ const i = await Promise.all(e.map((u) => o(u)));
458
458
  return e.length > 1 ? i : i[0];
459
459
  } else {
460
460
  const {
461
461
  map: i,
462
- displacementMap: l,
463
- normalMap: r,
462
+ displacementMap: u,
463
+ normalMap: a,
464
464
  roughnessMap: s,
465
- metalnessMap: u,
466
- aoMap: a,
467
- alphaMap: y,
468
- matcap: c
465
+ metalnessMap: n,
466
+ aoMap: f,
467
+ alphaMap: h,
468
+ matcap: l
469
469
  } = e;
470
470
  return {
471
471
  map: i ? await o(i) : null,
472
- displacementMap: l ? await o(l) : null,
473
- normalMap: r ? await o(r) : null,
472
+ displacementMap: u ? await o(u) : null,
473
+ normalMap: a ? await o(a) : null,
474
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
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: i, y: u } = $t({ target: r }), a = D(() => e.value.filter((m) => {
484
+ var C;
485
+ return ((C = m.__tres) == null ? void 0 : C.eventCount) > 0;
486
+ }));
487
+ let s = 0;
488
+ const { width: n, height: f, top: h, left: l } = Ft(r), b = ({ 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
+ }, w = ({ 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(a.value, !0), o.value;
497
+ }, d = (m) => {
498
+ const C = b({
499
+ x: (m == null ? void 0 : m.clientX) ?? i.value,
500
+ y: (m == null ? void 0 : m.clientY) ?? u.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 ? w(C) || [] : [];
503
+ }, P = O(), y = O(), v = O(), p = O(), M = O(), _ = O(), c = O(), g = O();
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 k = (m, C) => {
511
+ var Ee, ke, Se;
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: (ke = t.raycaster) == null ? void 0 : ke.value.ray,
519
+ camera: (Se = t.camera) == null ? void 0 : Se.value,
520
+ sourceEvent: C,
521
+ delta: s,
519
522
  stopPropagating: !1
520
523
  });
521
524
  };
522
- let R;
523
- const O = (d) => {
524
- P(d), C(m, d), R = d;
525
+ let B;
526
+ const x = (m) => {
527
+ d(m), k(v, m), B = m;
525
528
  }, T = () => {
526
- R && O(R);
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 $, A, q;
532
+ const Y = (m) => {
533
+ var C;
534
+ $ = (C = o.value[0]) == null ? void 0 : C.object, s = 0, A = new le(
535
+ (m == null ? void 0 : m.clientX) ?? i.value,
536
+ (m == null ? void 0 : m.clientY) ?? u.value
537
+ ), k(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 && k(_, m), $ === ((C = o.value[0]) == null ? void 0 : C.object) && (q = new le(
543
+ (m == null ? void 0 : m.clientX) ?? i.value,
544
+ (m == null ? void 0 : m.clientY) ?? u.value
545
+ ), s = A == null ? void 0 : A.distanceTo(q), m.button === 0 ? (k(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 && k(c, m)), k(p, m));
546
+ }, Pe = (m) => {
547
+ J && (k(y, m), se = void 0, J = !1);
548
+ }, _e = (m) => k(v, m), Ce = (m) => k(g, 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,
553
+ onClick: (m) => P.on(m).off,
554
+ onDblClick: (m) => y.on(m).off,
555
+ onContextMenu: (m) => c.on(m).off,
556
+ onPointerMove: (m) => v.on(m).off,
557
+ onPointerUp: (m) => p.on(m).off,
558
+ onPointerDown: (m) => M.on(m).off,
559
+ onPointerMissed: (m) => _.on(m).off,
560
+ onWheel: (m) => g.on(m).off,
558
561
  forceUpdate: T
559
562
  };
560
563
  };
561
- function mn() {
562
- 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;
564
+ function gn() {
565
+ const { logWarning: e } = U();
566
+ function t(u, a, s) {
567
+ let n = null;
568
+ return u.traverse((f) => {
569
+ f[a] === s && (n = f);
570
+ }), n || e(`Child with ${a} '${s}' 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(u, a, s) {
573
+ const n = [];
574
+ return u.traverse((f) => {
575
+ f[a].includes(s) && n.push(f);
576
+ }), n.length || e(`Children with ${a} '${s}' not found.`), n;
574
577
  }
575
- function o(l, r) {
576
- return t(l, "name", r);
578
+ function o(u, a) {
579
+ return t(u, "name", a);
577
580
  }
578
- function i(l, r) {
579
- return n(l, "name", r);
581
+ function i(u, a) {
582
+ return r(u, "name", a);
580
583
  }
581
584
  return {
582
585
  seek: t,
583
586
  seekByName: o,
584
- seekAll: n,
587
+ seekAll: r,
585
588
  seekAllByName: i
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
+ }, i = (l) => {
600
+ r.value.delete(l);
601
+ }, u = (l) => {
602
+ Object.values(t).forEach((b) => b.delete(l)), i(l);
603
+ }, a = (l) => {
604
+ const { onClick: b, onPointerMove: w, onPointerEnter: d, onPointerLeave: P } = l;
605
+ b && t.click.set(l, b), w && t.pointerMove.set(l, w), d && t.pointerEnter.set(l, d), P && t.pointerLeave.set(l, P);
606
+ }, s = 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 = a, e.deregisterObjectAtPointerEventHandler = u, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
616
+ const { onClick: n, onPointerMove: f } = tt(s, e);
617
+ n(({ intersects: l, event: b }) => {
618
+ var w;
619
+ l.length && ((w = t.click.get(l[0].object)) == null || w(l[0], b));
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: b }) => {
623
+ var v, p, M, _;
624
+ const w = (v = l == null ? void 0 : l[0]) == null ? void 0 : v.object, { pointerLeave: d, pointerEnter: P, pointerMove: y } = t;
625
+ h && h !== w && ((p = d.get(h)) == null || p(h, b)), w && (h !== w && ((M = P.get(w)) == null || M(l[0], b)), (_ = y.get(w)) == null || _(l[0], b)), h = w || null;
623
626
  }), {
624
- registerObject: r,
625
- deregisterObject: l,
627
+ registerObject: a,
628
+ deregisterObject: u,
626
629
  registerBlockingObject: o,
627
630
  deregisterBlockingObject: i
628
631
  };
629
632
  };
630
- function be(e) {
633
+ function we(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, i = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, u = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, a = 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, n = i + u + a + s;
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 pe = L({}), me = (e) => Object.assign(pe.value, e);
646
+ function Ir(e, t, r = 10) {
647
+ const o = S(e) ? Wt() : Nt(D(() => S(t).parentElement)), i = ce(De(o.width, r)), u = ce(De(o.height, r)), a = D(() => i.value / u.value);
645
648
  return {
646
- height: l,
649
+ height: u,
647
650
  width: i,
648
- aspectRatio: r
651
+ aspectRatio: a
649
652
  };
650
653
  }
651
- function le() {
654
+ function ue() {
652
655
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
653
- let n = 0, o = !1;
656
+ let r = 0, o = !1;
654
657
  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;
658
+ const f = Array.from(e.entries()).sort((h, l) => {
659
+ const b = h[1].priority - l[1].priority;
660
+ return b === 0 ? h[1].addI - l[1].addI : b;
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
+ }, u = (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 = () => u(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: u, trigger: (...f) => {
673
+ o && (i(), 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 i = Et.generateUUID();
684
+ let u = null;
685
+ const a = ue(), s = ue(), n = ue();
686
+ let f = {};
687
+ function h(M) {
688
+ f = M;
686
689
  }
687
- function c(h, _, g = 0) {
690
+ function l(M, _, c = 0) {
688
691
  switch (_) {
689
692
  case "before":
690
- return r.on(h, g);
693
+ return a.on(M, c);
691
694
  case "render":
692
- return l || (l = h), s.dispose(), s.on(h);
695
+ return u || (u = M), s.dispose(), s.on(M);
693
696
  case "after":
694
- return u.on(h, g);
697
+ return n.on(M, c);
695
698
  }
696
699
  }
697
- function p() {
698
- t.value || (e.start(), t.value = !0, v());
700
+ function b() {
701
+ t.value || (e.start(), t.value = !0, p());
699
702
  }
700
- function P() {
703
+ function w() {
701
704
  t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
702
705
  }
703
- function f() {
706
+ function d() {
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;
711
- }
712
- function w() {
713
- n.value = !1;
712
+ function y() {
713
+ r.value = !0;
714
714
  }
715
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);
716
+ r.value = !1;
717
+ }
718
+ function p() {
719
+ const M = e.getDelta(), _ = e.getElapsedTime(), c = {
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
+ }, g = { delta: M, elapsed: _, clock: e, ...c };
728
+ t.value && a.trigger(g), r.value || (s.count ? s.trigger(g) : u && u(g)), t.value && n.trigger(g), o = requestAnimationFrame(p);
726
729
  }
727
730
  return {
728
731
  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,
732
+ register: (M, _, c) => l(M, _, c),
733
+ start: b,
734
+ stop: w,
735
+ pause: d,
736
+ resume: P,
737
+ pauseRender: y,
738
+ resumeRender: v,
739
+ isRenderPaused: r,
737
740
  isActive: t,
738
- setContext: y
741
+ setContext: h
739
742
  };
740
743
  }
741
- function jr({
744
+ function Ur({
742
745
  scene: e,
743
746
  canvas: t,
744
- windowSize: n,
747
+ windowSize: r,
745
748
  disableRender: o,
746
749
  rendererOptions: i,
747
- emit: l
750
+ emit: u
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: a } = U(), s = H(e), n = Ir(r, t), {
753
+ camera: f,
754
+ cameras: h,
755
+ registerCamera: l,
756
+ deregisterCamera: b,
757
+ setCameraActive: w
758
+ } = pr({ sizes: n, scene: e }), d = {
759
+ mode: L(i.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(() => d.mode.value === "on-demand" && d.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(A = 1) {
766
+ i.renderMode === "on-demand" ? d.frames.value = Math.min(d.maxFrames, d.frames.value + A) : a("`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
+ i.renderMode === "manual" ? d.frames.value = 1 : a("`advance` can only be used when `renderMode` is set to `manual`");
767
770
  }
768
- const { renderer: w } = Ar(
771
+ const { renderer: v } = Dr(
769
772
  {
770
773
  scene: e,
771
774
  canvas: t,
772
775
  options: i,
773
- emit: l,
776
+ emit: u,
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: d, invalidate: P, advance: y },
776
779
  disableRender: o
777
780
  }
778
- ), v = {
779
- sizes: u,
781
+ ), p = {
782
+ sizes: n,
780
783
  scene: s,
781
- camera: a,
782
- cameras: ue(y),
783
- renderer: w,
784
- raycaster: U(new _t()),
785
- controls: A(null),
784
+ camera: f,
785
+ cameras: ce(h),
786
+ renderer: v,
787
+ raycaster: H(new kt()),
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: d,
802
+ advance: y,
803
+ extend: me,
804
+ invalidate: P,
805
+ registerCamera: l,
806
+ setCameraActive: w,
807
+ deregisterCamera: b,
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", p), p.scene.value.__tres = {
811
+ root: p
812
+ }, p.loop.register(() => {
813
+ f.value && d.frames.value > 0 && (v.value.render(e, f.value), u("render", p.renderer.value)), d.priority.value = 0, d.mode.value === "always" ? d.frames.value = 1 : d.frames.value = Math.max(0, d.frames.value - 1);
814
+ }, "render"), p.loop.start(), N(() => {
815
+ p.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: c, memory: g } = Vt({ interval: M }), E = 160;
818
+ let k = performance.now();
819
+ const B = ({ timestamp: A }) => {
820
+ p.scene.value && (p.perf.memory.allocatedMem = we(p.scene.value)), A - k >= M && (k = A, p.perf.fps.accumulator.push(_.value), p.perf.fps.accumulator.length > E && p.perf.fps.accumulator.shift(), p.perf.fps.value = _.value, c.value && g.value && (p.perf.memory.accumulator.push(g.value.usedJSHeapSize / 1024 / 1024), p.perf.memory.accumulator.length > E && p.perf.memory.accumulator.shift(), p.perf.memory.currentMem = p.perf.memory.accumulator.reduce((q, Y) => q + Y, 0) / p.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 T = 1, { pause: $ } = Qe(({ delta: A }) => {
824
+ window.__TRES__DEVTOOLS__ && (B({ timestamp: performance.now() }), x += A, x >= T && (window.__TRES__DEVTOOLS__.cb(p), x = 0));
822
825
  }, { immediate: !0 });
823
826
  return N(() => {
824
- j();
825
- }), v;
827
+ $();
828
+ }), p;
826
829
  }
827
- function et() {
828
- const e = at("useTres");
830
+ function rt() {
831
+ const e = ut("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 bn() {
835
838
  const {
836
839
  camera: e,
837
840
  scene: t,
838
- renderer: n,
841
+ renderer: r,
839
842
  loop: o,
840
843
  raycaster: i,
841
- controls: l,
842
- invalidate: r,
844
+ controls: u,
845
+ invalidate: a,
843
846
  advance: s
844
- } = et();
847
+ } = rt();
845
848
  o.setContext({
846
849
  camera: e,
847
850
  scene: t,
848
- renderer: n,
851
+ renderer: r,
849
852
  raycaster: i,
850
- controls: l,
851
- invalidate: r,
853
+ controls: u,
854
+ invalidate: a,
852
855
  advance: s
853
856
  });
854
- function u(c, p = 0) {
855
- return o.register(c, "before", p);
857
+ function n(l, b = 0) {
858
+ return o.register(l, "before", b);
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, b = 0) {
864
+ return o.register(l, "after", b);
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();
877
+ function $r(e, t, r) {
878
+ const o = H(), i = H();
876
879
  e && (o.value = e), t && (i.value = t);
877
- const l = B(
880
+ const u = 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 a(c, g) {
884
+ if (Array.isArray(c))
885
+ for (const E of c)
886
+ E(g);
887
+ typeof c == "function" && c(g);
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 s(c, g) {
890
+ const E = [], k = () => g.stopPropagating = !0;
891
+ g.stopPropagation = k;
892
+ for (const B of g == null ? void 0 : g.intersections) {
893
+ if (g.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
+ g = { ...g, ...B };
896
+ const { object: x } = B;
897
+ g.eventObject = x, a(x[c], g), E.push(x);
898
+ let T = x.parent;
899
+ for (; T !== null && !g.stopPropagating && !E.includes(T); )
900
+ g.eventObject = T, a(T[c], g), E.push(T), T = T.parent;
901
+ const $ = Pr(c.slice(2));
902
+ r($, { intersection: B, event: g });
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: b,
911
+ onPointerUp: w,
912
+ onPointerMissed: d,
913
+ onWheel: P,
914
+ forceUpdate: y
915
+ } = tt(u, t);
916
+ w((c) => s("onPointerUp", c)), b((c) => s("onPointerDown", c)), n((c) => s("onClick", c)), f((c) => s("onDoubleClick", c)), h((c) => s("onContextMenu", c)), P((c) => s("onWheel", c));
917
+ let v = [];
918
+ l((c) => {
919
+ const g = c.intersections.map(({ object: k }) => k), E = c.intersections;
920
+ v.forEach(({ object: k }) => {
921
+ g.includes(k) || (c.intersections = v, s("onPointerLeave", c), s("onPointerOut", c));
922
+ }), c.intersections = E, c.intersections.forEach(({ object: k }) => {
923
+ v.includes(k) || (s("onPointerEnter", c), s("onPointerOver", c));
924
+ }), s("onPointerMove", c), v = c.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 p = [];
927
+ d((c) => {
928
+ const g = () => c.stopPropagating = !0;
929
+ c.stopPropagation = g, p.forEach((E) => {
930
+ c.stopPropagating || (c.eventObject = E, a(E.onPointerMissed, c));
931
+ }), r("pointer-missed", { event: c });
929
932
  });
930
- function h(g) {
931
- v.push(g);
933
+ function M(c) {
934
+ p.push(c);
932
935
  }
933
- function _(g) {
934
- const M = v.indexOf(g);
935
- M > -1 && v.splice(M, 1);
936
+ function _(c) {
937
+ const g = p.indexOf(c);
938
+ g > -1 && p.splice(g, 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: Ue } = U(), $e = [
944
947
  "onClick",
945
948
  "onContextMenu",
946
949
  "onPointerMove",
@@ -956,233 +959,244 @@ const { logError: He } = $(), Hr = [
956
959
  "onLostPointerCapture",
957
960
  "onWheel"
958
961
  ];
959
- function Ue(e) {
960
- var n;
961
- const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
962
+ function Fe(e) {
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
- const Ur = () => {
967
+ const Fr = () => {
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" || wr(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 b = n.replace("Tres", ""), w;
973
+ if (n === "primitive") {
974
+ (l == null ? void 0 : l.object) === void 0 && Ue("Tres primitives need a prop 'object'");
975
+ const d = l.object;
976
+ b = d.type, w = Object.assign(d.clone(), { type: b });
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 d = pe.value[b];
979
+ d || Ue(
980
+ `${b} is not defined on the THREE namespace. Use extend to add it to the catalog.`
981
+ ), w = new d(...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 w ? (w.isCamera && (l != null && l.position || w.position.set(3, 3, 3), l != null && l.lookAt || w.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (w.isMaterial ? w.attach = "material" : w.isBufferGeometry && (w.attach = "geometry")), w.__tres = {
984
+ ...w.__tres,
985
+ type: b,
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
+ }, w.isObject3D && w.__tres && (l != null && l.material || l != null && l.geometry) && (w.__tres.disposable = !1), w) : 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, b, w, d, 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 && ((b = n == null ? void 0 : n.__tres) != null && b.root) && ((P = (d = (w = n == null ? void 0 : n.__tres) == null ? void 0 : w.root) == null ? void 0 : d.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, b, w;
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 d = (y) => {
1011
+ var p, M;
1012
+ const v = (M = (p = n == null ? void 0 : n.__tres) == null ? void 0 : p.root) == null ? void 0 : M.deregisterCamera;
1013
+ y.isCamera && (v == null || v(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 v, p;
1017
+ d(y), y.onPointerMissed && ((p = (v = f == null ? void 0 : f.root) == null ? void 0 : v.eventManager) == null || p.deregisterPointerMissedObject(y));
1018
+ }), d(n), Fe(n), !((l = n.__tres) == null ? void 0 : l.primitive) && ((b = n.__tres) != null && b.disposable) && be(n), (w = n.dispose) == null || w.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 i(n, f, h, l) {
1022
+ var b, w;
1023
+ if (n) {
1024
+ let d = n, P = f;
1025
+ if ((b = n == null ? void 0 : n.__tres) != null && b.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 c = n[_], g = M[_];
1033
+ !(c != null && c.set) && !ee(c) ? n[_] = g : c.constructor === g.constructor && (c != null && c.copy) ? c == null || c.copy(g) : Array.isArray(g) ? c.set(...g) : !c.isColor && c.setScalar ? c.setScalar(g) : c.set(g);
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
+ $e.includes(f) && (n.__tres.eventCount += 1);
1042
+ let y = X(P), v = d == null ? void 0 : d[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 ?? [], c = l ?? [], g = ((w = n == null ? void 0 : n.__tres) == null ? void 0 : w.type) || n.type;
1045
+ g && _.length && !kr(_, c) && (d = Object.assign(
1046
+ M,
1047
+ new pe.value[g](...l)
1044
1048
  ));
1045
1049
  return;
1046
1050
  }
1047
- if (p.type === "BufferGeometry") {
1051
+ if (d.type === "BufferGeometry") {
1048
1052
  if (P === "args")
1049
1053
  return;
1050
- p.setAttribute(
1054
+ d.setAttribute(
1051
1055
  X(P),
1052
- new Et(...a)
1056
+ new St(...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("-") && v === void 0) {
1061
+ const M = P.split("-");
1062
+ v = M.reduce((_, c) => _[X(c)], d), P = M.pop(), y = P, v != null && v.set || (d = M.reduce((_, c) => _[X(c)], d));
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 p = l;
1065
+ if (p === "" && (p = !0), ee(v)) {
1066
+ $e.includes(f) || (Array.isArray(p) ? n[y](...p) : n[y](p)), y.startsWith("on") && ee(p) && (d[y] = p);
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
+ !(v != null && v.set) && !ee(v) ? d[y] = p : v.constructor === p.constructor && (v != null && v.copy) ? v == null || v.copy(p) : Array.isArray(p) ? v.set(...p) : !v.isColor && v.setScalar ? v.setScalar(p) : v.set(p), Fe(n);
1066
1070
  }
1067
1071
  }
1068
- function l(r) {
1069
- return (r == null ? void 0 : r.parent) || null;
1072
+ function u(n) {
1073
+ return (n == null ? void 0 : n.parent) || null;
1074
+ }
1075
+ function a(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 s(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
1089
  patchProp: i,
1076
- parentNode: l,
1090
+ parentNode: u,
1077
1091
  createText: () => void 0,
1078
- createComment: () => void 0,
1092
+ createComment: a,
1079
1093
  setText: () => void 0,
1080
1094
  setElementText: () => void 0,
1081
- nextSibling: () => void 0,
1095
+ nextSibling: s,
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 F, ve;
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 F !== void 0 || (typeof window < "u" && window.performance ? (F = !0, ve = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (F = !0, ve = globalThis.perf_hooks.performance) : F = !1), F;
1099
1113
  }
1100
- function Gr() {
1101
- return zr() ? me.now() : Date.now();
1114
+ function qr() {
1115
+ return Vr() ? ve.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 a in t.settings) {
1123
+ const s = t.settings[a];
1124
+ o[a] = s.defaultValue;
1111
1125
  }
1112
1126
  const i = `__vue-devtools-plugin-settings__${t.id}`;
1113
- let l = Object.assign({}, o);
1127
+ let u = Object.assign({}, o);
1114
1128
  try {
1115
- const r = localStorage.getItem(i), s = JSON.parse(r);
1116
- Object.assign(l, s);
1129
+ const a = localStorage.getItem(i), s = JSON.parse(a);
1130
+ Object.assign(u, s);
1117
1131
  } catch {
1118
1132
  }
1119
1133
  this.fallbacks = {
1120
1134
  getSettings() {
1121
- return l;
1135
+ return u;
1122
1136
  },
1123
- setSettings(r) {
1137
+ setSettings(a) {
1124
1138
  try {
1125
- localStorage.setItem(i, JSON.stringify(r));
1139
+ localStorage.setItem(i, JSON.stringify(a));
1126
1140
  } catch {
1127
1141
  }
1128
- l = r;
1142
+ u = a;
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, (a, s) => {
1148
+ a === this.plugin.id && this.fallbacks.setSettings(s);
1135
1149
  }), this.proxiedOn = new Proxy({}, {
1136
- get: (r, s) => this.target ? this.target.on[s] : (...u) => {
1150
+ get: (a, s) => this.target ? this.target.on[s] : (...n) => {
1137
1151
  this.onQueue.push({
1138
1152
  method: s,
1139
- args: u
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({
1157
+ get: (a, s) => this.target ? this.target[s] : s === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(s) ? (...n) => (this.targetQueue.push({
1144
1158
  method: s,
1145
- args: u,
1159
+ args: n,
1146
1160
  resolve: () => {
1147
1161
  }
1148
- }), this.fallbacks[s](...u)) : (...u) => new Promise((a) => {
1162
+ }), this.fallbacks[s](...n)) : (...n) => new Promise((f) => {
1149
1163
  this.targetQueue.push({
1150
1164
  method: s,
1151
- args: u,
1152
- resolve: 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(), i = Wr(), u = Nr && r.enableEarlyProxy;
1181
+ if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !u))
1182
+ i.emit(zr, e, t);
1169
1183
  else {
1170
- const r = l ? new Vr(n, i) : null;
1184
+ const a = u ? new Yr(r, i) : 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: a
1189
+ }), a && t(a.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 = we(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,58 +1236,58 @@ 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 i = ot(o);
1244
+ t.children.push(i), st(o, i, 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((u) => {
1274
+ if (u.inspectorId === z) {
1275
+ const a = ot(t.scene.value);
1276
+ st(t.scene.value, a, u.filter), Xr.sceneGraph = a, u.rootNodes = [a];
1263
1277
  }
1264
1278
  });
1265
1279
  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);
1280
+ r.on.getInspectorState((u) => {
1281
+ var a;
1282
+ if (u.inspectorId === z) {
1283
+ const [s] = t.scene.value.getObjectsByProperty("uuid", u.nodeId);
1270
1284
  if (!s)
1271
1285
  return;
1272
1286
  if (i && o && o.parent && i.remove(o), s.isMesh) {
1273
- const u = kr(s);
1274
- s.add(u), o = u, i = s;
1287
+ const n = Tr(s);
1288
+ s.add(n), o = n, i = s;
1275
1289
  }
1276
- l.state = {
1290
+ u.state = {
1277
1291
  object: [
1278
1292
  {
1279
1293
  key: "uuid",
@@ -1358,30 +1372,30 @@ function Kr(e, t) {
1358
1372
  value: s.visible
1359
1373
  }
1360
1374
  ]
1361
- }, s.isScene && (l.state.info = {
1362
- memory: be(s),
1375
+ }, s.isScene && (u.state.info = {
1376
+ memory: we(s),
1363
1377
  objects: s.children.length,
1364
1378
  calls: t.renderer.value.info.render.calls,
1365
1379
  triangles: t.renderer.value.info.render.triangles,
1366
1380
  points: t.renderer.value.info.render.points,
1367
1381
  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,
1382
+ }, u.state.programs = ((a = t.renderer.value.info.programs) == null ? void 0 : a.map((n) => ({
1383
+ key: n.name,
1370
1384
  value: {
1371
- ...u,
1372
- vertexShader: u.vertexShader,
1373
- attributes: u.getAttributes(),
1374
- uniforms: u.getUniforms()
1385
+ ...n,
1386
+ vertexShader: n.vertexShader,
1387
+ attributes: n.getAttributes(),
1388
+ uniforms: n.getUniforms()
1375
1389
  }
1376
1390
  }))) || []);
1377
1391
  }
1378
- }), n.on.editInspectorState((l) => {
1379
- l.inspectorId === G && Er(t.scene.value, l.nodeId, l.path, l.state.value);
1392
+ }), r.on.editInspectorState((u) => {
1393
+ u.inspectorId === z && xr(t.scene.value, u.nodeId, u.path, u.state.value);
1380
1394
  });
1381
1395
  }
1382
1396
  );
1383
1397
  }
1384
- const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1398
+ const en = ["data-scene", "data-tres"], tn = /* @__PURE__ */ xe({
1385
1399
  __name: "TresCanvas",
1386
1400
  props: {
1387
1401
  shadows: { type: Boolean, default: void 0 },
@@ -1423,91 +1437,91 @@ const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1423
1437
  "pointer-missed",
1424
1438
  "wheel"
1425
1439
  ],
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({
1440
+ setup(e, { expose: t, emit: r }) {
1441
+ var P;
1442
+ const o = e, i = r, u = ct(), { logWarning: a } = U(), s = L(), n = H(new qe()), f = (P = Te()) == null ? void 0 : P.appContext.app;
1443
+ me(Ge);
1444
+ const h = (y) => xe({
1431
1445
  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() : []);
1446
+ var p;
1447
+ const v = (p = Te()) == null ? void 0 : p.appContext;
1448
+ return v && (v.app = f), fe("useTres", y), fe("extend", me), typeof window < "u" && Zr(v == null ? void 0 : v.app, y), () => Ae(ht, null, u != null && u.default ? u.default() : []);
1435
1449
  }
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,
1450
+ }), l = (y) => {
1451
+ const v = h(y), { render: p } = gt(Fr());
1452
+ p(Ae(v), n.value);
1453
+ }, b = (y, v = !1) => {
1454
+ be(y.scene.value), v && (y.renderer.value.dispose(), y.renderer.value.renderLists.dispose(), y.renderer.value.forceContextLoss()), n.value.__tres = {
1455
+ root: y
1456
+ }, l(y);
1457
+ }, w = D(() => o.disableRender), d = H(null);
1458
+ return t({ context: d, dispose: () => b(d.value, !0) }), ft(() => {
1459
+ const y = s;
1460
+ d.value = Ur({
1461
+ scene: n.value,
1462
+ canvas: y,
1449
1463
  windowSize: o.windowSize ?? !1,
1450
- disableRender: P.value ?? !1,
1464
+ disableRender: w.value ?? !1,
1451
1465
  rendererOptions: o,
1452
1466
  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(
1467
+ }), $r(n.value, d.value, i);
1468
+ const { registerCamera: v, camera: p, cameras: M, deregisterCamera: _ } = d.value;
1469
+ l(d.value);
1470
+ const c = () => {
1471
+ const g = new de(
1458
1472
  45,
1459
1473
  window.innerWidth / window.innerHeight,
1460
1474
  0.1,
1461
1475
  1e3
1462
1476
  );
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());
1477
+ g.position.set(3, 3, 3), g.lookAt(0, 0, 0), v(g);
1478
+ const E = ge(() => {
1479
+ M.value.length >= 2 && (g.removeFromParent(), _(g), E == null || E());
1466
1480
  });
1467
1481
  };
1468
- V(
1482
+ G(
1469
1483
  () => o.camera,
1470
- (M, C) => {
1471
- M && w(M), C && (C.removeFromParent(), _(C));
1484
+ (g, E) => {
1485
+ g && v(g), E && (E.removeFromParent(), _(E));
1472
1486
  },
1473
1487
  {
1474
1488
  immediate: !0
1475
1489
  }
1476
- ), v.value || (r(
1490
+ ), p.value || (a(
1477
1491
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1478
- ), g());
1492
+ ), c());
1479
1493
  }), N(() => {
1480
- p(f.value);
1481
- }), (m, w) => (ct(), ft("canvas", {
1494
+ b(d.value);
1495
+ }), (y, v) => (dt(), pt("canvas", {
1482
1496
  ref_key: "canvas",
1483
1497
  ref: s,
1484
- "data-scene": u.value.uuid,
1485
- class: dt(m.$attrs.class),
1486
- "data-tres": `tresjs ${W(ur).version}`,
1487
- style: pt({
1498
+ "data-scene": n.value.uuid,
1499
+ class: mt(y.$attrs.class),
1500
+ "data-tres": `tresjs ${W(dr).version}`,
1501
+ style: vt({
1488
1502
  display: "block",
1489
1503
  width: "100%",
1490
1504
  height: "100%",
1491
- position: m.windowSize ? "fixed" : "relative",
1505
+ position: y.windowSize ? "fixed" : "relative",
1492
1506
  top: 0,
1493
1507
  left: 0,
1494
1508
  pointerEvents: "auto",
1495
1509
  touchAction: "none",
1496
- ...m.$attrs.style
1510
+ ...y.$attrs.style
1497
1511
  })
1498
- }, null, 14, Xr));
1512
+ }, null, 14, en));
1499
1513
  }
1500
- }), en = [
1514
+ }), rn = [
1501
1515
  "TresCanvas",
1502
1516
  "TresLeches",
1503
1517
  "TresScene"
1504
- ], tn = {
1518
+ ], nn = {
1505
1519
  template: {
1506
1520
  compilerOptions: {
1507
- isCustomElement: (e) => e.startsWith("Tres") && !en.includes(e) || e === "primitive"
1521
+ isCustomElement: (e) => e.startsWith("Tres") && !rn.includes(e) || e === "primitive"
1508
1522
  }
1509
1523
  }
1510
- }, yn = tn, bn = {
1524
+ }, wn = nn, Mn = {
1511
1525
  mounted: (e, t) => {
1512
1526
  if (t.arg) {
1513
1527
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1516,22 +1530,22 @@ const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1516
1530
  console.log("v-log", e);
1517
1531
  }
1518
1532
  };
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 })));
1533
+ class it extends Tt {
1534
+ constructor(t, r) {
1535
+ const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new Oe();
1536
+ i.setAttribute("position", new Le(o, 3)), i.computeBoundingSphere();
1537
+ const u = new At({ fog: !1 });
1538
+ super(i, u), this.light = t, this.color = r, this.type = "RectAreaLightHelper";
1539
+ const a = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Oe();
1540
+ s.setAttribute("position", new Le(a, 3)), s.computeBoundingSphere(), this.add(new Ot(s, new Ye({ side: Lt, fog: !1 })));
1527
1541
  }
1528
1542
  updateMatrixWorld() {
1529
1543
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
1530
1544
  this.material.color.set(this.color), this.children[0].material.color.set(this.color);
1531
1545
  else {
1532
1546
  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);
1547
+ const t = this.material.color, r = Math.max(t.r, t.g, t.b);
1548
+ r > 1 && t.multiplyScalar(1 / r), this.children[0].material.color.copy(this.material.color);
1535
1549
  }
1536
1550
  this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld), this.children[0].matrixWorld.copy(this.matrixWorld);
1537
1551
  }
@@ -1539,87 +1553,87 @@ class ot extends kt {
1539
1553
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1540
1554
  }
1541
1555
  }
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 = {
1556
+ const { logWarning: Ne } = U();
1557
+ let te, I;
1558
+ const on = {
1559
+ DirectionalLight: Dt,
1560
+ PointLight: Bt,
1561
+ SpotLight: jt,
1562
+ HemisphereLight: Rt,
1563
+ RectAreaLight: it
1564
+ }, Pn = {
1551
1565
  mounted: (e) => {
1552
1566
  if (!e.isLight) {
1553
- Fe(`${e.type} is not a light`);
1567
+ Ne(`${e.type} is not a light`);
1554
1568
  return;
1555
1569
  }
1556
- te = rn[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1570
+ te = on[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1557
1571
  },
1558
1572
  updated: (e) => {
1559
- H = e.parent.children.find((t) => t instanceof te), !(H instanceof ot) && H.update();
1573
+ I = e.parent.children.find((t) => t instanceof te), !(I instanceof it) && I.update();
1560
1574
  },
1561
1575
  unmounted: (e) => {
1562
1576
  if (!e.isLight) {
1563
- Fe(`${e.type} is not a light`);
1577
+ Ne(`${e.type} is not a light`);
1564
1578
  return;
1565
1579
  }
1566
- H = e.parent.children.find((t) => t instanceof te), H && H.dispose && H.dispose(), e.parent.remove(H);
1580
+ I = e.parent.children.find((t) => t instanceof te), I && I.dispose && I.dispose(), e.parent.remove(I);
1567
1581
  }
1568
- }, { logWarning: nn } = $();
1569
- let D = null;
1570
- const Mn = {
1582
+ }, { logWarning: sn } = U();
1583
+ let j = null;
1584
+ const _n = {
1571
1585
  updated: (e, t) => {
1572
1586
  var i;
1573
- const n = Sr(t);
1574
- if (!n) {
1575
- nn(`v-distance-to: problem with binding value: ${t.value}`);
1587
+ const r = Ar(t);
1588
+ if (!r) {
1589
+ sn(`v-distance-to: problem with binding value: ${t.value}`);
1576
1590
  return;
1577
1591
  }
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(
1592
+ j && (j.dispose(), e.parent.remove(j));
1593
+ const o = r.clone().sub(e.position);
1594
+ o.normalize(), j = new It(o, e.position, e.position.distanceTo(r), 16776960), e.parent.add(j), console.table(
1581
1595
  [
1582
- ["Distance:", e.position.distanceTo(n)],
1596
+ ["Distance:", e.position.distanceTo(r)],
1583
1597
  [`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}`]
1598
+ [`Destiny: ${e.name || e.type}`, `x:${r.x}, y:${r.y}, z:${r == null ? void 0 : r.z}`]
1585
1599
  ]
1586
1600
  );
1587
1601
  },
1588
1602
  unmounted: (e) => {
1589
- D == null || D.dispose(), e.parent.remove(D);
1603
+ j == null || j.dispose(), e.parent.remove(j);
1590
1604
  }
1591
- }, Pn = {
1605
+ }, Cn = {
1592
1606
  install(e) {
1593
- e.component("TresCanvas", Zr);
1607
+ e.component("TresCanvas", tn);
1594
1608
  }
1595
1609
  };
1596
1610
  export {
1597
- Zr as TresCanvas,
1598
- 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,
1610
- $ 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
1611
+ tn as TresCanvas,
1612
+ pe as catalogue,
1613
+ Hr as createRenderLoop,
1614
+ Cn as default,
1615
+ be as dispose,
1616
+ me as extend,
1617
+ dn as isProd,
1618
+ hr as normalizeColor,
1619
+ pn as normalizeVectorFlexibleParam,
1620
+ wn as templateCompilerOptions,
1621
+ jr as trasverseObjects,
1622
+ pr as useCamera,
1623
+ mn as useLoader,
1624
+ U as useLogger,
1625
+ bn as useLoop,
1626
+ hn as usePointerEventHandler,
1627
+ tt as useRaycaster,
1628
+ fn as useRenderLoop,
1629
+ Dr as useRenderer,
1630
+ gn as useSeek,
1631
+ vn as useTexture,
1632
+ yn as useTres,
1633
+ rt as useTresContext,
1634
+ Ur as useTresContextProvider,
1635
+ $r as useTresEventManager,
1636
+ _n as vDistanceTo,
1637
+ Pn as vLightHelper,
1638
+ Mn as vLog
1625
1639
  };