@tresjs/core 4.0.2 → 4.1.0

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