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