react-two.js 0.8.22-r.4 → 0.8.22-r.5

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.
@@ -1,34 +1,34 @@
1
- import { jsx as S, Fragment as G } from "react/jsx-runtime";
2
- import k, { createContext as Q, useContext as J, useRef as q, useEffect as h, useState as W, useCallback as oe, useMemo as g, useImperativeHandle as C } from "react";
1
+ import { jsx as E, Fragment as T } from "react/jsx-runtime";
2
+ import k, { createContext as Z, useContext as X, useRef as A, useEffect as h, useState as $, useCallback as oe, useMemo as g, useImperativeHandle as R } from "react";
3
3
  import H from "two.js";
4
- const X = Q({
4
+ const ee = Z({
5
5
  two: null,
6
6
  registerEventShape: () => {
7
7
  },
8
8
  unregisterEventShape: () => {
9
9
  }
10
- }), _ = Q({
10
+ }), J = Z({
11
11
  parent: null
12
- }), B = Q({
12
+ }), Q = Z({
13
13
  width: 0,
14
14
  height: 0
15
- }), ae = X, j = () => {
16
- const t = J(X), i = J(_), r = J(B);
17
- return { ...t, ...i, ...r };
18
- }, ve = (t, i = []) => {
19
- const { two: r } = j(), f = q(t);
15
+ }), ce = ee, C = () => {
16
+ const t = X(ee), s = X(J), r = X(Q);
17
+ return { ...t, ...s, ...r };
18
+ }, ve = (t, s = []) => {
19
+ const { two: r } = C(), l = A(t);
20
20
  h(() => {
21
- f.current = t;
22
- }, [t, ...i]), h(() => {
21
+ l.current = t;
22
+ }, [t, ...s]), h(() => {
23
23
  if (!r)
24
24
  return;
25
25
  let n = 0;
26
26
  return r.bind("update", u), () => r.unbind("update", u);
27
- function u(c, e) {
28
- n += e / 1e3, f.current?.(n, e);
27
+ function u(a, e) {
28
+ n += e / 1e3, l.current?.(n, e);
29
29
  }
30
- }, [r, ...i]);
31
- }, L = [
30
+ }, [r, ...s]);
31
+ }, O = [
32
32
  "onClick",
33
33
  "onContextMenu",
34
34
  "onDoubleClick",
@@ -42,21 +42,21 @@ const X = Q({
42
42
  "onPointerMove",
43
43
  "onPointerCancel"
44
44
  ];
45
- function ie(t, i, r) {
46
- const f = i.getBoundingClientRect(), n = t.clientX - f.left - r.width / 2, u = t.clientY - f.top - r.height / 2;
45
+ function ie(t, s, r) {
46
+ const l = s.getBoundingClientRect(), n = t.clientX - l.left - r.width / 2, u = t.clientY - l.top - r.height / 2;
47
47
  return { x: n, y: u };
48
48
  }
49
- function N(t, i) {
50
- const r = i.getBoundingClientRect(), f = t.clientX - r.left, n = t.clientY - r.top;
51
- return { x: f, y: n };
49
+ function U(t, s) {
50
+ const r = s.getBoundingClientRect(), l = t.clientX - r.left, n = t.clientY - r.top;
51
+ return { x: l, y: n };
52
52
  }
53
- function se(t, i, r, f) {
53
+ function se(t, s, r, l) {
54
54
  let n = !1;
55
55
  return {
56
56
  nativeEvent: t,
57
- target: i,
57
+ target: s,
58
58
  currentTarget: r,
59
- point: f,
59
+ point: l,
60
60
  stopPropagation: () => {
61
61
  n = !0;
62
62
  },
@@ -65,29 +65,29 @@ function se(t, i, r, f) {
65
65
  }
66
66
  };
67
67
  }
68
- function ce(t, i, r) {
69
- return "visible" in t && !t.visible ? !1 : typeof t.contains == "function" ? t.contains(i, r) : !1;
68
+ function ae(t, s, r) {
69
+ return "visible" in t && !t.visible ? !1 : typeof t.contains == "function" ? t.contains(s, r) : !1;
70
70
  }
71
- function A(t, i, r) {
72
- const f = [];
71
+ function q(t, s, r) {
72
+ const l = [];
73
73
  for (const [n] of t)
74
- ce(n, i, r) && f.push(n);
75
- return f;
74
+ ae(n, s, r) && l.push(n);
75
+ return l;
76
76
  }
77
- function fe(t, i) {
78
- const r = [t], f = i.get(t);
79
- if (f?.parent) {
80
- let n = f.parent;
77
+ function le(t, s) {
78
+ const r = [t], l = s.get(t);
79
+ if (l?.parent) {
80
+ let n = l.parent;
81
81
  for (; n; )
82
- r.push(n), n = i.get(n)?.parent;
82
+ r.push(n), n = s.get(n)?.parent;
83
83
  }
84
84
  return r;
85
85
  }
86
- function K(t) {
87
- process.env.NODE_ENV !== "production" && k.Children.forEach(t, (i) => {
88
- if (!k.isValidElement(i))
86
+ function Y(t) {
87
+ process.env.NODE_ENV !== "production" && k.Children.forEach(t, (s) => {
88
+ if (!k.isValidElement(s))
89
89
  return;
90
- const r = i.type;
90
+ const r = s.type;
91
91
  if (typeof r == "string") {
92
92
  console.warn(
93
93
  `[react-two.js] <${r}> is not compatible with Canvas.
@@ -98,383 +98,396 @@ See: https://github.com/jonobr1/react-two.js#usage`
98
98
  return;
99
99
  }
100
100
  if (r === k.Fragment) {
101
- K(
102
- i.props.children
101
+ Y(
102
+ s.props.children
103
103
  );
104
104
  return;
105
105
  }
106
- typeof r == "function" && i.props.children && K(
107
- i.props.children
106
+ typeof r == "function" && s.props.children && Y(
107
+ s.props.children
108
108
  );
109
109
  });
110
110
  }
111
111
  const pe = (t) => {
112
- const { two: i, parent: r } = j(), f = q(null), n = q(/* @__PURE__ */ new Map()), u = q(/* @__PURE__ */ new Set()), c = q(null), [e, s] = W(i), [a, o] = W(r), [d, l] = W(0), [v, p] = W(0), O = oe(
113
- (m, w, y) => {
114
- n.current.set(m, { shape: m, handlers: w, parent: y });
112
+ const { two: s, parent: r } = C(), l = A(null), n = A(/* @__PURE__ */ new Map()), u = A(/* @__PURE__ */ new Set()), a = A(null), [e, o] = $(s), [c, i] = $(r), [d, f] = $(0), [v, p] = $(0), j = oe(
113
+ (m, S, b) => {
114
+ n.current.set(m, { shape: m, handlers: S, parent: b });
115
115
  },
116
116
  []
117
- ), V = oe((m) => {
118
- n.current.delete(m), u.current.delete(m), c.current === m && (c.current = null);
117
+ ), M = oe((m) => {
118
+ n.current.delete(m), u.current.delete(m), a.current === m && (a.current = null);
119
119
  }, []);
120
120
  h(() => {
121
- if (!i) {
122
- const w = { ...t };
123
- delete w.children;
124
- const y = new H(w).appendTo(f.current);
125
- return s(y), o(y.scene), l(y.width), p(y.height), () => {
126
- y.renderer.domElement.parentElement?.removeChild(
127
- y.renderer.domElement
128
- ), y.pause(), y.unbind(), y.release();
129
- const R = H.Instances.indexOf(y);
130
- R >= 0 && H.Instances.splice(R, 1), y.clear();
121
+ if (!s) {
122
+ const S = { ...t };
123
+ delete S.children;
124
+ const b = new H(S).appendTo(l.current);
125
+ return o(b), i(b.scene), f(b.width), p(b.height), () => {
126
+ b.renderer.domElement.parentElement?.removeChild(
127
+ b.renderer.domElement
128
+ ), b.pause(), b.unbind(), b.release();
129
+ const I = H.Instances.indexOf(b);
130
+ I >= 0 && H.Instances.splice(I, 1), b.clear();
131
131
  };
132
132
  }
133
133
  }, []), h(() => {
134
- !i && (typeof t.width == "number" && (e && (e.width = t.width), l(t.width)), typeof t.height == "number" && (e && (e.height = t.height), p(t.height)));
135
- }, [i, e, t.width, t.height]), h(() => {
136
- if (!i && e) {
137
- let w = function() {
138
- const F = y.width !== R, z = y.height !== M;
139
- F && (R = y.width), z && (M = y.height), (F || z) && (l(R), p(M));
134
+ !s && (typeof t.width == "number" && (e && (e.width = t.width), f(t.width)), typeof t.height == "number" && (e && (e.height = t.height), p(t.height)));
135
+ }, [s, e, t.width, t.height]), h(() => {
136
+ if (!s && e) {
137
+ let S = function() {
138
+ const V = b.width !== I, G = b.height !== L;
139
+ V && (I = b.width), G && (L = b.height), (V || G) && (f(I), p(L));
140
140
  };
141
- const y = e;
142
- let R = y.width, M = y.height;
143
- return (t.fullscreen || t.fitted) && y.bind("update", w), () => {
144
- y.unbind("update", w);
141
+ const b = e;
142
+ let I = b.width, L = b.height;
143
+ return (t.fullscreen || t.fitted) && b.bind("update", S), () => {
144
+ b.unbind("update", S);
145
145
  };
146
146
  }
147
- }, [i, e, t.fullscreen, t.fitted]), h(() => {
148
- process.env.NODE_ENV !== "production" && K(t.children);
147
+ }, [s, e, t.fullscreen, t.fitted]), h(() => {
148
+ process.env.NODE_ENV !== "production" && Y(t.children);
149
149
  }, [t.children]), h(() => {
150
150
  if (!e) return;
151
- const m = e.renderer.domElement, w = (P, E, b) => {
152
- if (P.length === 0) return;
153
- const D = P[0], U = ie(b, m, e), x = fe(D, n.current);
154
- for (const ne of x) {
155
- const te = n.current.get(ne)?.handlers[E];
151
+ const m = e.renderer.domElement, S = (y, w, P) => {
152
+ if (y.length === 0) return;
153
+ const N = y[0], B = ie(P, m, e), F = le(N, n.current);
154
+ for (const ne of F) {
155
+ const te = n.current.get(ne)?.handlers[w];
156
156
  if (te) {
157
157
  const re = se(
158
- b,
159
- D,
158
+ P,
159
+ N,
160
160
  ne,
161
- U
161
+ B
162
162
  );
163
163
  if (te(re), re.stopped)
164
164
  break;
165
165
  }
166
166
  }
167
- }, y = (P) => {
168
- const E = N(P, m), b = A(
167
+ }, b = (y) => {
168
+ const w = U(y, m), P = q(
169
169
  n.current,
170
- E.x,
171
- E.y
170
+ w.x,
171
+ w.y
172
172
  );
173
- b.length > 0 && w(b, "onClick", P);
174
- }, R = (P) => {
175
- const E = N(P, m), b = A(
173
+ P.length > 0 && S(P, "onClick", y);
174
+ }, I = (y) => {
175
+ const w = U(y, m), P = q(
176
176
  n.current,
177
- E.x,
178
- E.y
177
+ w.x,
178
+ w.y
179
179
  );
180
- b.length > 0 && w(b, "onContextMenu", P);
181
- }, M = (P) => {
182
- const E = N(P, m), b = A(
180
+ P.length > 0 && S(P, "onContextMenu", y);
181
+ }, L = (y) => {
182
+ const w = U(y, m), P = q(
183
183
  n.current,
184
- E.x,
185
- E.y
184
+ w.x,
185
+ w.y
186
186
  );
187
- b.length > 0 && w(b, "onDoubleClick", P);
188
- }, F = (P) => {
189
- const E = N(P, m), b = A(
187
+ P.length > 0 && S(P, "onDoubleClick", y);
188
+ }, V = (y) => {
189
+ const w = U(y, m), P = q(
190
190
  n.current,
191
- E.x,
192
- E.y
191
+ w.x,
192
+ w.y
193
193
  );
194
- b.length > 0 && w(b, "onWheel", P);
195
- }, z = (P) => {
196
- const E = N(P, m), b = A(
194
+ P.length > 0 && S(P, "onWheel", y);
195
+ }, G = (y) => {
196
+ const w = U(y, m), P = q(
197
197
  n.current,
198
- E.x,
199
- E.y
198
+ w.x,
199
+ w.y
200
200
  );
201
- b.length > 0 && (w(b, "onPointerDown", P), P.target instanceof Element && P.target.hasPointerCapture?.(P.pointerId) && (c.current = b[0]));
202
- }, Y = (P) => {
203
- if (c.current) {
204
- const D = n.current.get(c.current);
205
- if (D?.handlers.onPointerUp) {
206
- const U = ie(P, m, e), x = se(
207
- P,
208
- c.current,
209
- c.current,
210
- U
201
+ P.length > 0 && (S(P, "onPointerDown", y), y.target instanceof Element && y.target.hasPointerCapture?.(y.pointerId) && (a.current = P[0]));
202
+ }, _ = (y) => {
203
+ if (a.current) {
204
+ const N = n.current.get(a.current);
205
+ if (N?.handlers.onPointerUp) {
206
+ const B = ie(y, m, e), F = se(
207
+ y,
208
+ a.current,
209
+ a.current,
210
+ B
211
211
  );
212
- D.handlers.onPointerUp(x);
212
+ N.handlers.onPointerUp(F);
213
213
  }
214
- c.current = null;
214
+ a.current = null;
215
215
  return;
216
216
  }
217
- const E = N(P, m), b = A(
217
+ const w = U(y, m), P = q(
218
218
  n.current,
219
- E.x,
220
- E.y
219
+ w.x,
220
+ w.y
221
221
  );
222
- b.length > 0 ? w(b, "onPointerUp", P) : t.onPointerMissed && t.onPointerMissed(P);
223
- }, Z = (P) => {
224
- const E = N(P, m), b = A(
222
+ P.length > 0 ? S(P, "onPointerUp", y) : t.onPointerMissed && t.onPointerMissed(y);
223
+ }, z = (y) => {
224
+ const w = U(y, m), P = q(
225
225
  n.current,
226
- E.x,
227
- E.y
228
- ), D = new Set(b);
229
- b.length > 0 && w(b, "onPointerMove", P);
230
- const U = u.current;
231
- for (const x of D)
232
- U.has(x) || (w([x], "onPointerEnter", P), w([x], "onPointerOver", P));
233
- for (const x of U)
234
- D.has(x) || (w([x], "onPointerLeave", P), w([x], "onPointerOut", P));
235
- u.current = D;
236
- }, ee = (P) => {
237
- const E = N(P, m), b = A(
226
+ w.x,
227
+ w.y
228
+ ), N = new Set(P);
229
+ P.length > 0 && S(P, "onPointerMove", y);
230
+ const B = u.current;
231
+ for (const F of N)
232
+ B.has(F) || (S([F], "onPointerEnter", y), S([F], "onPointerOver", y));
233
+ for (const F of B)
234
+ N.has(F) || (S([F], "onPointerLeave", y), S([F], "onPointerOut", y));
235
+ u.current = N;
236
+ }, W = (y) => {
237
+ const w = U(y, m), P = q(
238
238
  n.current,
239
- E.x,
240
- E.y
239
+ w.x,
240
+ w.y
241
241
  );
242
- b.length > 0 && w(b, "onPointerCancel", P), c.current = null;
242
+ P.length > 0 && S(P, "onPointerCancel", y), a.current = null;
243
243
  };
244
- return m.addEventListener("click", y), m.addEventListener("contextmenu", R), m.addEventListener("dblclick", M), m.addEventListener("wheel", F), m.addEventListener("pointerdown", z), m.addEventListener("pointerup", Y), m.addEventListener("pointermove", Z), m.addEventListener("pointercancel", ee), () => {
245
- m.removeEventListener("click", y), m.removeEventListener("contextmenu", R), m.removeEventListener("dblclick", M), m.removeEventListener("wheel", F), m.removeEventListener("pointerdown", z), m.removeEventListener("pointerup", Y), m.removeEventListener("pointermove", Z), m.removeEventListener("pointercancel", ee);
244
+ return m.addEventListener("click", b), m.addEventListener("contextmenu", I), m.addEventListener("dblclick", L), m.addEventListener("wheel", V), m.addEventListener("pointerdown", G), m.addEventListener("pointerup", _), m.addEventListener("pointermove", z), m.addEventListener("pointercancel", W), () => {
245
+ m.removeEventListener("click", b), m.removeEventListener("contextmenu", I), m.removeEventListener("dblclick", L), m.removeEventListener("wheel", V), m.removeEventListener("pointerdown", G), m.removeEventListener("pointerup", _), m.removeEventListener("pointermove", z), m.removeEventListener("pointercancel", W);
246
246
  };
247
247
  }, [
248
248
  e,
249
249
  t.onPointerMissed,
250
- O,
251
- V
250
+ j,
251
+ M
252
252
  ]);
253
- const T = g(
253
+ const x = g(
254
254
  () => ({
255
255
  two: e,
256
- registerEventShape: O,
257
- unregisterEventShape: V
256
+ registerEventShape: j,
257
+ unregisterEventShape: M
258
258
  }),
259
259
  [
260
260
  e,
261
- O,
262
- V
261
+ j,
262
+ M
263
263
  ]
264
- ), I = g(
264
+ ), D = g(
265
265
  () => ({
266
- parent: a
266
+ parent: c
267
267
  }),
268
- [a]
269
- ), $ = g(
268
+ [c]
269
+ ), K = g(
270
270
  () => ({
271
271
  width: d,
272
272
  height: v
273
273
  }),
274
274
  [d, v]
275
275
  );
276
- return /* @__PURE__ */ S(X.Provider, { value: T, children: /* @__PURE__ */ S(_.Provider, { value: I, children: /* @__PURE__ */ S(B.Provider, { value: $, children: /* @__PURE__ */ S("div", { ref: f, children: t.children }) }) }) });
276
+ return /* @__PURE__ */ E(ee.Provider, { value: x, children: /* @__PURE__ */ E(J.Provider, { value: D, children: /* @__PURE__ */ E(Q.Provider, { value: K, children: /* @__PURE__ */ E("div", { ref: l, children: t.children }) }) }) });
277
277
  }, ge = k.forwardRef(
278
- ({ x: t, y: i, ...r }, f) => {
278
+ ({ x: t, y: s, ...r }, l) => {
279
279
  const {
280
280
  two: n,
281
281
  parent: u,
282
- width: c,
282
+ width: a,
283
283
  height: e,
284
- registerEventShape: s,
285
- unregisterEventShape: a
286
- } = j(), o = g(() => new H.Group(), []), { eventHandlers: d, shapeProps: l } = g(() => {
287
- const V = {}, T = {};
288
- for (const I in r)
289
- L.includes(I) ? V[I] = r[
290
- I
284
+ registerEventShape: o,
285
+ unregisterEventShape: c
286
+ } = C(), i = g(() => new H.Group(), []), { eventHandlers: d, shapeProps: f } = g(() => {
287
+ const M = {}, x = {};
288
+ for (const D in r)
289
+ O.includes(D) ? M[D] = r[
290
+ D
291
291
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
292
- ] : T[I] = r[I];
293
- return { eventHandlers: V, shapeProps: T };
292
+ ] : x[D] = r[D];
293
+ return { eventHandlers: M, shapeProps: x };
294
294
  }, [r]);
295
295
  h(() => {
296
296
  if (u)
297
- return u.add(o), () => {
298
- u.remove(o);
299
- };
300
- }, [u, o]), h(() => {
301
- typeof t == "number" && (o.translation.x = t), typeof i == "number" && (o.translation.y = i);
302
- const V = { ...l };
303
- delete V.children;
304
- for (const T in V)
305
- T in o && (o[T] = V[T]);
306
- }, [o, t, i, l]), h(() => {
297
+ return u.add(i), () => {
298
+ u.remove(i);
299
+ };
300
+ }, [u, i]), h(() => {
301
+ typeof t == "number" && (i.translation.x = t), typeof s == "number" && (i.translation.y = s);
302
+ const M = { ...f };
303
+ delete M.children;
304
+ for (const x in M)
305
+ x in i && (i[x] = M[x]);
306
+ }, [i, t, s, f]), h(() => {
307
307
  if (Object.keys(d).length > 0)
308
- return s(o, d, u ?? void 0), () => {
309
- a(o);
308
+ return o(i, d, u ?? void 0), () => {
309
+ c(i);
310
310
  };
311
311
  }, [
312
+ i,
312
313
  o,
313
- s,
314
- a,
314
+ c,
315
315
  u,
316
316
  d
317
- ]), C(f, () => o, [o]);
317
+ ]), R(l, () => i, [i]);
318
318
  const v = g(
319
319
  () => ({
320
320
  two: n,
321
- registerEventShape: s,
322
- unregisterEventShape: a
321
+ registerEventShape: o,
322
+ unregisterEventShape: c
323
323
  }),
324
- [n, s, a]
324
+ [n, o, c]
325
325
  ), p = g(
326
326
  () => ({
327
- parent: o
327
+ parent: i
328
328
  }),
329
- [o]
330
- ), O = g(
329
+ [i]
330
+ ), j = g(
331
331
  () => ({
332
- width: c,
332
+ width: a,
333
333
  height: e
334
334
  }),
335
- [c, e]
335
+ [a, e]
336
336
  );
337
- return /* @__PURE__ */ S(ae.Provider, { value: v, children: /* @__PURE__ */ S(_.Provider, { value: p, children: /* @__PURE__ */ S(B.Provider, { value: O, children: r.children }) }) });
337
+ return /* @__PURE__ */ E(ce.Provider, { value: v, children: /* @__PURE__ */ E(J.Provider, { value: p, children: /* @__PURE__ */ E(Q.Provider, { value: j, children: r.children }) }) });
338
338
  }
339
- ), me = k.forwardRef(
340
- ({ x: t, y: i, src: r, content: f, onLoad: n, onError: u, ...c }, e) => {
339
+ ), ye = k.forwardRef(
340
+ ({ x: t, y: s, src: r, content: l, onLoad: n, onError: u, ...a }, e) => {
341
341
  const {
342
- two: s,
343
- parent: a,
344
- width: o,
342
+ two: o,
343
+ parent: c,
344
+ width: i,
345
345
  height: d,
346
- registerEventShape: l,
346
+ registerEventShape: f,
347
347
  unregisterEventShape: v
348
- } = j(), p = g(() => new H.Group(), []), O = q(null), { eventHandlers: V, shapeProps: T } = g(() => {
349
- const w = {}, y = {};
350
- for (const R in c)
351
- L.includes(R) ? w[R] = c[
352
- R
348
+ } = C(), p = g(() => new H.Group(), []), j = A(null), M = A(n), x = A(u), D = A({ two: null, key: null });
349
+ h(() => {
350
+ M.current = n;
351
+ }, [n]), h(() => {
352
+ x.current = u;
353
+ }, [u]);
354
+ const { eventHandlers: K, shapeProps: m } = g(() => {
355
+ const L = {}, V = {};
356
+ for (const G in a)
357
+ O.includes(G) ? L[G] = a[
358
+ G
353
359
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
354
- ] : y[R] = c[R];
355
- return { eventHandlers: w, shapeProps: y };
356
- }, [c]);
360
+ ] : V[G] = a[G];
361
+ return { eventHandlers: L, shapeProps: V };
362
+ }, [a]);
357
363
  h(() => {
358
- O.current = p;
364
+ j.current = p;
359
365
  }, [p]), h(() => {
360
- if (a && p)
361
- return a.add(p), () => {
362
- a.remove(p);
366
+ if (c && p)
367
+ return c.add(p), () => {
368
+ c.remove(p);
363
369
  };
364
- }, [p, a]), h(() => {
365
- !r && !f && console.warn(
370
+ }, [p, c]), h(() => {
371
+ !r && !l && console.warn(
366
372
  '[react-two.js] SVG component requires either "src" or "content" prop'
367
- ), r && f && console.warn(
373
+ ), r && l && console.warn(
368
374
  '[react-two.js] SVG component has both "src" and "content" props. Using "src" and ignoring "content"'
369
375
  );
370
- }, [r, f]), h(() => {
371
- if (!s) return;
372
- const w = r || f;
373
- if (!w) return;
374
- let y = !0;
376
+ }, [r, l]), h(() => {
377
+ if (!o) return;
378
+ const L = r || l;
379
+ if (!L) return;
380
+ const V = L, G = D.current;
381
+ if (G.two === o && G.key === V)
382
+ return;
383
+ let _ = !0;
384
+ D.current = { two: o, key: V };
375
385
  try {
376
- s.load(
377
- w,
378
- (R, M) => {
379
- if (y && (O.current?.add(R.children), n))
386
+ o.load(
387
+ L,
388
+ (z, W) => {
389
+ if (!_) return;
390
+ j.current?.add(z.children);
391
+ const y = M.current;
392
+ if (y)
380
393
  try {
381
- requestAnimationFrame(() => n(O.current, M));
382
- } catch (F) {
394
+ requestAnimationFrame(() => y(j.current, W));
395
+ } catch (w) {
383
396
  console.error(
384
397
  "[react-two.js] Error in SVG onLoad callback:",
385
- F
398
+ w
386
399
  );
387
400
  }
388
401
  }
389
402
  );
390
- } catch (R) {
391
- if (!y) return;
392
- const M = R instanceof Error ? R : new Error("Failed to load SVG");
393
- if (u)
403
+ } catch (z) {
404
+ if (!_) return;
405
+ const W = z instanceof Error ? z : new Error("Failed to load SVG"), y = x.current;
406
+ if (y)
394
407
  try {
395
- u(M);
396
- } catch (F) {
408
+ y(W);
409
+ } catch (w) {
397
410
  console.error(
398
411
  "[react-two.js] Error in SVG onError callback:",
399
- F
412
+ w
400
413
  );
401
414
  }
402
415
  else
403
- console.error("[react-two.js] SVG loading error:", M);
416
+ console.error("[react-two.js] SVG loading error:", W);
404
417
  }
405
418
  return () => {
406
- y = !1, O.current?.remove(O.current.children);
419
+ _ = !1, D.current = { two: null, key: null }, j.current?.remove(j.current.children);
407
420
  };
408
- }, [s, r, f, n, u]), h(() => {
409
- typeof t == "number" && (p.translation.x = t), typeof i == "number" && (p.translation.y = i);
410
- const w = { ...T };
411
- delete w.children;
412
- for (const y in w)
413
- y in p && (p[y] = w[y]);
414
- }, [p, t, i, T]), h(() => {
415
- if (Object.keys(V).length > 0)
416
- return l(p, V, a ?? void 0), () => {
421
+ }, [o, r, l]), h(() => {
422
+ typeof t == "number" && (p.translation.x = t), typeof s == "number" && (p.translation.y = s);
423
+ const L = { ...m };
424
+ delete L.children;
425
+ for (const V in L)
426
+ V in p && (p[V] = L[V]);
427
+ }, [p, t, s, m]), h(() => {
428
+ if (Object.keys(K).length > 0)
429
+ return f(p, K, c ?? void 0), () => {
417
430
  v(p);
418
431
  };
419
- }, [p, l, v, a, V]), C(e, () => p, [p]);
420
- const I = g(
432
+ }, [p, f, v, c, K]), R(e, () => p, [p]);
433
+ const S = g(
421
434
  () => ({
422
- two: s,
423
- registerEventShape: l,
435
+ two: o,
436
+ registerEventShape: f,
424
437
  unregisterEventShape: v
425
438
  }),
426
- [s, l, v]
427
- ), $ = g(
439
+ [o, f, v]
440
+ ), b = g(
428
441
  () => ({
429
442
  parent: p
430
443
  }),
431
444
  [p]
432
- ), m = g(
445
+ ), I = g(
433
446
  () => ({
434
- width: o,
447
+ width: i,
435
448
  height: d
436
449
  }),
437
- [o, d]
450
+ [i, d]
438
451
  );
439
- return /* @__PURE__ */ S(ae.Provider, { value: I, children: /* @__PURE__ */ S(_.Provider, { value: $, children: /* @__PURE__ */ S(B.Provider, { value: m, children: c.children }) }) });
452
+ return /* @__PURE__ */ E(ce.Provider, { value: S, children: /* @__PURE__ */ E(J.Provider, { value: b, children: /* @__PURE__ */ E(Q.Provider, { value: I, children: a.children }) }) });
440
453
  }
441
- ), ye = k.forwardRef(
442
- ({ manual: t, x: i, y: r, ...f }, n) => {
443
- const { parent: u, registerEventShape: c, unregisterEventShape: e } = j(), s = g(() => new H.Path(), []), { eventHandlers: a, shapeProps: o } = g(() => {
444
- const d = {}, l = {};
445
- for (const v in f)
446
- L.includes(v) ? d[v] = f[
454
+ ), me = k.forwardRef(
455
+ ({ manual: t, x: s, y: r, ...l }, n) => {
456
+ const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(() => new H.Path(), []), { eventHandlers: c, shapeProps: i } = g(() => {
457
+ const d = {}, f = {};
458
+ for (const v in l)
459
+ O.includes(v) ? d[v] = l[
447
460
  v
448
461
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
449
- ] : l[v] = f[v];
450
- return { eventHandlers: d, shapeProps: l };
451
- }, [f]);
462
+ ] : f[v] = l[v];
463
+ return { eventHandlers: d, shapeProps: f };
464
+ }, [l]);
452
465
  return h(() => {
453
466
  if (u)
454
- return u.add(s), () => {
455
- u.remove(s);
456
- };
457
- }, [u, s]), h(() => {
458
- if (Object.keys(a).length > 0)
459
- return c(s, a, u ?? void 0), () => {
460
- e(s);
461
- };
462
- }, [s, c, e, u, a]), h(() => {
463
- typeof i == "number" && (s.translation.x = i), typeof r == "number" && (s.translation.y = r), typeof t < "u" && (s.automatic = !t);
464
- for (const d in o)
465
- d in s && (s[d] = o[d]);
466
- }, [o, s, i, r, t]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
467
+ return u.add(o), () => {
468
+ u.remove(o);
469
+ };
470
+ }, [u, o]), h(() => {
471
+ if (Object.keys(c).length > 0)
472
+ return a(o, c, u ?? void 0), () => {
473
+ e(o);
474
+ };
475
+ }, [o, a, e, u, c]), h(() => {
476
+ typeof s == "number" && (o.translation.x = s), typeof r == "number" && (o.translation.y = r), typeof t < "u" && (o.automatic = !t);
477
+ for (const d in i)
478
+ d in o && (o[d] = i[d]);
479
+ }, [i, o, s, r, t]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
467
480
  }
468
- ), Pe = k.forwardRef(
469
- ({ x: t, y: i, ...r }, f) => {
470
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.Points(), []), { eventHandlers: s, shapeProps: a } = g(() => {
471
- const o = {}, d = {};
472
- for (const l in r)
473
- L.includes(l) ? o[l] = r[
474
- l
481
+ ), we = k.forwardRef(
482
+ ({ x: t, y: s, ...r }, l) => {
483
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Points(), []), { eventHandlers: o, shapeProps: c } = g(() => {
484
+ const i = {}, d = {};
485
+ for (const f in r)
486
+ O.includes(f) ? i[f] = r[
487
+ f
475
488
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
476
- ] : d[l] = r[l];
477
- return { eventHandlers: o, shapeProps: d };
489
+ ] : d[f] = r[f];
490
+ return { eventHandlers: i, shapeProps: d };
478
491
  }, [r]);
479
492
  return h(() => {
480
493
  if (n)
@@ -482,32 +495,32 @@ const pe = (t) => {
482
495
  n.remove(e);
483
496
  };
484
497
  }, [n, e]), h(() => {
485
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
486
- for (const o in a)
487
- o in e && (e[o] = a[o]);
488
- }, [a, e, t, i]), h(() => {
489
- if (Object.keys(s).length > 0)
490
- return u(e, s, n ?? void 0), () => {
491
- c(e);
498
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
499
+ for (const i in c)
500
+ i in e && (e[i] = c[i]);
501
+ }, [c, e, t, s]), h(() => {
502
+ if (Object.keys(o).length > 0)
503
+ return u(e, o, n ?? void 0), () => {
504
+ a(e);
492
505
  };
493
506
  }, [
494
507
  e,
495
508
  u,
496
- c,
509
+ a,
497
510
  n,
498
- s
499
- ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
511
+ o
512
+ ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
500
513
  }
501
- ), we = k.forwardRef(
502
- ({ x: t, y: i, ...r }, f) => {
503
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.Text(), []), { eventHandlers: s, shapeProps: a } = g(() => {
504
- const o = {}, d = {};
505
- for (const l in r)
506
- L.includes(l) ? o[l] = r[
507
- l
514
+ ), Pe = k.forwardRef(
515
+ ({ x: t, y: s, ...r }, l) => {
516
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Text(), []), { eventHandlers: o, shapeProps: c } = g(() => {
517
+ const i = {}, d = {};
518
+ for (const f in r)
519
+ O.includes(f) ? i[f] = r[
520
+ f
508
521
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
509
- ] : d[l] = r[l];
510
- return { eventHandlers: o, shapeProps: d };
522
+ ] : d[f] = r[f];
523
+ return { eventHandlers: i, shapeProps: d };
511
524
  }, [r]);
512
525
  return h(() => {
513
526
  if (n)
@@ -515,227 +528,227 @@ const pe = (t) => {
515
528
  n.remove(e);
516
529
  };
517
530
  }, [n, e]), h(() => {
518
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
519
- for (const o in a)
520
- o in e && (e[o] = a[o]);
521
- }, [a, e, t, i]), h(() => {
522
- if (Object.keys(s).length > 0)
523
- return u(e, s, n ?? void 0), () => {
524
- c(e);
525
- };
526
- }, [e, u, c, n, s]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
531
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
532
+ for (const i in c)
533
+ i in e && (e[i] = c[i]);
534
+ }, [c, e, t, s]), h(() => {
535
+ if (Object.keys(o).length > 0)
536
+ return u(e, o, n ?? void 0), () => {
537
+ a(e);
538
+ };
539
+ }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
527
540
  }
528
541
  ), be = k.forwardRef(
529
- ({ x: t, y: i, resolution: r, ...f }, n) => {
530
- const { parent: u, registerEventShape: c, unregisterEventShape: e } = j(), s = g(
542
+ ({ x: t, y: s, resolution: r, ...l }, n) => {
543
+ const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
531
544
  () => new H.ArcSegment(0, 0, 0, 0, 0, 0, r),
532
545
  [r]
533
- ), { eventHandlers: a, shapeProps: o } = g(() => {
534
- const d = {}, l = {};
535
- for (const v in f)
536
- L.includes(v) ? d[v] = f[
546
+ ), { eventHandlers: c, shapeProps: i } = g(() => {
547
+ const d = {}, f = {};
548
+ for (const v in l)
549
+ O.includes(v) ? d[v] = l[
537
550
  v
538
551
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
539
- ] : l[v] = f[v];
540
- return { eventHandlers: d, shapeProps: l };
541
- }, [f]);
552
+ ] : f[v] = l[v];
553
+ return { eventHandlers: d, shapeProps: f };
554
+ }, [l]);
542
555
  return h(() => {
543
556
  if (u)
544
- return u.add(s), () => {
545
- u.remove(s);
546
- };
547
- }, [u, s]), h(() => {
548
- typeof t == "number" && (s.translation.x = t), typeof i == "number" && (s.translation.y = i);
549
- for (const d in o)
550
- d in s && (s[d] = o[d]);
551
- }, [o, s, t, i]), h(() => {
552
- if (Object.keys(a).length > 0)
553
- return c(s, a, u ?? void 0), () => {
554
- e(s);
557
+ return u.add(o), () => {
558
+ u.remove(o);
559
+ };
560
+ }, [u, o]), h(() => {
561
+ typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
562
+ for (const d in i)
563
+ d in o && (o[d] = i[d]);
564
+ }, [i, o, t, s]), h(() => {
565
+ if (Object.keys(c).length > 0)
566
+ return a(o, c, u ?? void 0), () => {
567
+ e(o);
555
568
  };
556
569
  }, [
557
- s,
558
- c,
570
+ o,
571
+ a,
559
572
  e,
560
573
  u,
561
- a
562
- ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
574
+ c
575
+ ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
563
576
  }
564
577
  ), Ee = k.forwardRef(
565
- ({ x: t, y: i, resolution: r, ...f }, n) => {
566
- const { parent: u, registerEventShape: c, unregisterEventShape: e } = j(), s = g(
578
+ ({ x: t, y: s, resolution: r, ...l }, n) => {
579
+ const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
567
580
  () => new H.Circle(0, 0, 0, r),
568
581
  [r]
569
- ), { eventHandlers: a, shapeProps: o } = g(() => {
570
- const d = {}, l = {};
571
- for (const v in f)
572
- L.includes(v) ? d[v] = f[
582
+ ), { eventHandlers: c, shapeProps: i } = g(() => {
583
+ const d = {}, f = {};
584
+ for (const v in l)
585
+ O.includes(v) ? d[v] = l[
573
586
  v
574
587
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
575
- ] : l[v] = f[v];
576
- return { eventHandlers: d, shapeProps: l };
577
- }, [f]);
588
+ ] : f[v] = l[v];
589
+ return { eventHandlers: d, shapeProps: f };
590
+ }, [l]);
578
591
  return h(() => {
579
- typeof t == "number" && (s.translation.x = t), typeof i == "number" && (s.translation.y = i);
580
- for (const d in o)
581
- d in s && (s[d] = o[d]);
582
- }, [s, o, t, i]), h(() => {
592
+ typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
593
+ for (const d in i)
594
+ d in o && (o[d] = i[d]);
595
+ }, [o, i, t, s]), h(() => {
583
596
  if (u)
584
- return u.add(s), () => {
585
- u.remove(s);
597
+ return u.add(o), () => {
598
+ u.remove(o);
586
599
  };
587
- }, [u, s]), h(() => {
588
- if (Object.keys(a).length > 0)
589
- return c(s, a, u ?? void 0), () => {
590
- e(s);
600
+ }, [u, o]), h(() => {
601
+ if (Object.keys(c).length > 0)
602
+ return a(o, c, u ?? void 0), () => {
603
+ e(o);
591
604
  };
592
605
  }, [
593
- s,
594
- c,
606
+ o,
607
+ a,
595
608
  e,
596
609
  u,
597
- a
598
- ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
610
+ c
611
+ ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
599
612
  }
600
613
  ), Se = k.forwardRef(
601
- ({ x: t, y: i, resolution: r, ...f }, n) => {
602
- const { parent: u, registerEventShape: c, unregisterEventShape: e } = j(), s = g(
614
+ ({ x: t, y: s, resolution: r, ...l }, n) => {
615
+ const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
603
616
  () => new H.Ellipse(0, 0, 0, 0, r),
604
617
  [r]
605
- ), { eventHandlers: a, shapeProps: o } = g(() => {
606
- const d = {}, l = {};
607
- for (const v in f)
608
- L.includes(v) ? d[v] = f[
618
+ ), { eventHandlers: c, shapeProps: i } = g(() => {
619
+ const d = {}, f = {};
620
+ for (const v in l)
621
+ O.includes(v) ? d[v] = l[
609
622
  v
610
623
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
611
- ] : l[v] = f[v];
612
- return { eventHandlers: d, shapeProps: l };
613
- }, [f]);
624
+ ] : f[v] = l[v];
625
+ return { eventHandlers: d, shapeProps: f };
626
+ }, [l]);
614
627
  return h(() => {
615
628
  if (u)
616
- return u.add(s), () => {
617
- u.remove(s);
618
- };
619
- }, [u, s]), h(() => {
620
- typeof t == "number" && (s.translation.x = t), typeof i == "number" && (s.translation.y = i);
621
- for (const d in o)
622
- d in s && (s[d] = o[d]);
623
- }, [s, t, i, o]), h(() => {
624
- if (Object.keys(a).length > 0)
625
- return c(s, a, u ?? void 0), () => {
626
- e(s);
629
+ return u.add(o), () => {
630
+ u.remove(o);
631
+ };
632
+ }, [u, o]), h(() => {
633
+ typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
634
+ for (const d in i)
635
+ d in o && (o[d] = i[d]);
636
+ }, [o, t, s, i]), h(() => {
637
+ if (Object.keys(c).length > 0)
638
+ return a(o, c, u ?? void 0), () => {
639
+ e(o);
627
640
  };
628
641
  }, [
629
- s,
630
- c,
642
+ o,
643
+ a,
631
644
  e,
632
645
  u,
633
- a
634
- ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
646
+ c
647
+ ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
635
648
  }
636
649
  ), ke = k.forwardRef(
637
- ({ mode: t, src: i, texture: r, x: f, y: n, ...u }, c) => {
638
- const { parent: e, registerEventShape: s, unregisterEventShape: a } = j(), o = g(() => new H.Image(i), [i]), { eventHandlers: d, shapeProps: l } = g(() => {
650
+ ({ mode: t, src: s, texture: r, x: l, y: n, ...u }, a) => {
651
+ const { parent: e, registerEventShape: o, unregisterEventShape: c } = C(), i = g(() => new H.Image(s), [s]), { eventHandlers: d, shapeProps: f } = g(() => {
639
652
  const v = {}, p = {};
640
- for (const O in u)
641
- L.includes(O) ? v[O] = u[
642
- O
653
+ for (const j in u)
654
+ O.includes(j) ? v[j] = u[
655
+ j
643
656
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
644
- ] : p[O] = u[O];
657
+ ] : p[j] = u[j];
645
658
  return { eventHandlers: v, shapeProps: p };
646
659
  }, [u]);
647
660
  return h(() => {
648
661
  if (e)
649
- return e.add(o), () => {
650
- e.remove(o);
662
+ return e.add(i), () => {
663
+ e.remove(i);
651
664
  };
652
- }, [e, o]), h(() => {
653
- typeof t < "u" && (o.mode = t), typeof r < "u" && (o.texture = r), typeof f == "number" && (o.translation.x = f), typeof n == "number" && (o.translation.y = n);
654
- for (const v in l)
655
- v in o && (o[v] = l[v]);
656
- }, [o, l, t, r, f, n]), h(() => {
665
+ }, [e, i]), h(() => {
666
+ typeof t < "u" && (i.mode = t), typeof r < "u" && (i.texture = r), typeof l == "number" && (i.translation.x = l), typeof n == "number" && (i.translation.y = n);
667
+ for (const v in f)
668
+ v in i && (i[v] = f[v]);
669
+ }, [i, f, t, r, l, n]), h(() => {
657
670
  if (Object.keys(d).length > 0)
658
- return s(o, d, e ?? void 0), () => {
659
- a(o);
671
+ return o(i, d, e ?? void 0), () => {
672
+ c(i);
660
673
  };
661
674
  }, [
675
+ i,
662
676
  o,
663
- s,
664
- a,
677
+ c,
665
678
  e,
666
679
  d
667
- ]), C(c, () => o, [o]), /* @__PURE__ */ S(G, {});
680
+ ]), R(a, () => i, [i]), /* @__PURE__ */ E(T, {});
668
681
  }
669
682
  ), He = k.forwardRef(
670
- ({ src: t, x: i, y: r, autoPlay: f, ...n }, u) => {
671
- const { parent: c, registerEventShape: e, unregisterEventShape: s } = j(), a = g(() => new H.ImageSequence(t), [t]), { eventHandlers: o, shapeProps: d } = g(() => {
672
- const l = {}, v = {};
683
+ ({ src: t, x: s, y: r, autoPlay: l, ...n }, u) => {
684
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.ImageSequence(t), [t]), { eventHandlers: i, shapeProps: d } = g(() => {
685
+ const f = {}, v = {};
673
686
  for (const p in n)
674
- L.includes(p) ? l[p] = n[
687
+ O.includes(p) ? f[p] = n[
675
688
  p
676
689
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
677
690
  ] : v[p] = n[p];
678
- return { eventHandlers: l, shapeProps: v };
691
+ return { eventHandlers: f, shapeProps: v };
679
692
  }, [n]);
680
693
  return h(() => {
681
- if (c)
682
- return c.add(a), () => {
683
- c.remove(a);
684
- };
685
- }, [c, a]), h(() => {
686
- f ? a.play() : a.pause(), typeof i == "number" && (a.translation.x = i), typeof r == "number" && (a.translation.y = r);
687
- for (const l in d)
688
- l in a && (a[l] = d[l]);
689
- }, [d, a, i, r, f]), h(() => {
690
- if (Object.keys(o).length > 0)
691
- return e(a, o, c ?? void 0), () => {
692
- s(a);
694
+ if (a)
695
+ return a.add(c), () => {
696
+ a.remove(c);
697
+ };
698
+ }, [a, c]), h(() => {
699
+ l ? c.play() : c.pause(), typeof s == "number" && (c.translation.x = s), typeof r == "number" && (c.translation.y = r);
700
+ for (const f in d)
701
+ f in c && (c[f] = d[f]);
702
+ }, [d, c, s, r, l]), h(() => {
703
+ if (Object.keys(i).length > 0)
704
+ return e(c, i, a ?? void 0), () => {
705
+ o(c);
693
706
  };
694
707
  }, [
695
- a,
696
- e,
697
- s,
698
708
  c,
699
- o
700
- ]), C(u, () => a, [a]), /* @__PURE__ */ S(G, {});
709
+ e,
710
+ o,
711
+ a,
712
+ i
713
+ ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
701
714
  }
702
715
  ), Re = k.forwardRef(
703
- ({ x1: t, y1: i, x2: r, y2: f, ...n }, u) => {
704
- const { parent: c, registerEventShape: e, unregisterEventShape: s } = j(), a = g(() => new H.Line(), []), { eventHandlers: o, shapeProps: d } = g(() => {
705
- const l = {}, v = {};
716
+ ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
717
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Line(), []), { eventHandlers: i, shapeProps: d } = g(() => {
718
+ const f = {}, v = {};
706
719
  for (const p in n)
707
- L.includes(p) ? l[p] = n[
720
+ O.includes(p) ? f[p] = n[
708
721
  p
709
722
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
710
723
  ] : v[p] = n[p];
711
- return { eventHandlers: l, shapeProps: v };
724
+ return { eventHandlers: f, shapeProps: v };
712
725
  }, [n]);
713
726
  return h(() => {
714
- if (c)
715
- return c.add(a), () => {
716
- c.remove(a);
717
- };
718
- }, [c, a]), h(() => {
719
- typeof t == "number" && (a.left.x = t), typeof i == "number" && (a.left.y = i), typeof r == "number" && (a.right.x = r), typeof f == "number" && (a.right.y = f);
720
- for (const l in d)
721
- l in a && (a[l] = d[l]);
722
- }, [d, a, t, i, r, f]), h(() => {
723
- if (Object.keys(o).length > 0)
724
- return e(a, o, c ?? void 0), () => {
725
- s(a);
726
- };
727
- }, [a, e, s, c, o]), C(u, () => a, [a]), /* @__PURE__ */ S(G, {});
727
+ if (a)
728
+ return a.add(c), () => {
729
+ a.remove(c);
730
+ };
731
+ }, [a, c]), h(() => {
732
+ typeof t == "number" && (c.left.x = t), typeof s == "number" && (c.left.y = s), typeof r == "number" && (c.right.x = r), typeof l == "number" && (c.right.y = l);
733
+ for (const f in d)
734
+ f in c && (c[f] = d[f]);
735
+ }, [d, c, t, s, r, l]), h(() => {
736
+ if (Object.keys(i).length > 0)
737
+ return e(c, i, a ?? void 0), () => {
738
+ o(c);
739
+ };
740
+ }, [c, e, o, a, i]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
728
741
  }
729
742
  ), Ce = k.forwardRef(
730
- ({ x: t, y: i, ...r }, f) => {
731
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.Polygon(), []), { eventHandlers: s, shapeProps: a } = g(() => {
732
- const o = {}, d = {};
733
- for (const l in r)
734
- L.includes(l) ? o[l] = r[
735
- l
743
+ ({ x: t, y: s, ...r }, l) => {
744
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Polygon(), []), { eventHandlers: o, shapeProps: c } = g(() => {
745
+ const i = {}, d = {};
746
+ for (const f in r)
747
+ O.includes(f) ? i[f] = r[
748
+ f
736
749
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
737
- ] : d[l] = r[l];
738
- return { eventHandlers: o, shapeProps: d };
750
+ ] : d[f] = r[f];
751
+ return { eventHandlers: i, shapeProps: d };
739
752
  }, [r]);
740
753
  return h(() => {
741
754
  if (n)
@@ -743,32 +756,32 @@ const pe = (t) => {
743
756
  n.remove(e);
744
757
  };
745
758
  }, [n, e]), h(() => {
746
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
747
- for (const o in a)
748
- o in e && (e[o] = a[o]);
749
- }, [a, e, t, i]), h(() => {
750
- if (Object.keys(s).length > 0)
751
- return u(e, s, n ?? void 0), () => {
752
- c(e);
759
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
760
+ for (const i in c)
761
+ i in e && (e[i] = c[i]);
762
+ }, [c, e, t, s]), h(() => {
763
+ if (Object.keys(o).length > 0)
764
+ return u(e, o, n ?? void 0), () => {
765
+ a(e);
753
766
  };
754
767
  }, [
755
768
  e,
756
769
  u,
757
- c,
770
+ a,
758
771
  n,
759
- s
760
- ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
772
+ o
773
+ ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
761
774
  }
762
775
  ), je = k.forwardRef(
763
- ({ x: t, y: i, ...r }, f) => {
764
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.Rectangle(), []), { eventHandlers: s, shapeProps: a } = g(() => {
765
- const o = {}, d = {};
766
- for (const l in r)
767
- L.includes(l) ? o[l] = r[
768
- l
776
+ ({ x: t, y: s, ...r }, l) => {
777
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Rectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
778
+ const i = {}, d = {};
779
+ for (const f in r)
780
+ O.includes(f) ? i[f] = r[
781
+ f
769
782
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
770
- ] : d[l] = r[l];
771
- return { eventHandlers: o, shapeProps: d };
783
+ ] : d[f] = r[f];
784
+ return { eventHandlers: i, shapeProps: d };
772
785
  }, [r]);
773
786
  return h(() => {
774
787
  if (n)
@@ -776,32 +789,32 @@ const pe = (t) => {
776
789
  n.remove(e);
777
790
  };
778
791
  }, [n, e]), h(() => {
779
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
780
- for (const o in a)
781
- o in e && (e[o] = a[o]);
782
- }, [a, e, t, i]), h(() => {
783
- if (Object.keys(s).length > 0)
784
- return u(e, s, n ?? void 0), () => {
785
- c(e);
792
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
793
+ for (const i in c)
794
+ i in e && (e[i] = c[i]);
795
+ }, [c, e, t, s]), h(() => {
796
+ if (Object.keys(o).length > 0)
797
+ return u(e, o, n ?? void 0), () => {
798
+ a(e);
786
799
  };
787
800
  }, [
788
801
  e,
789
802
  u,
790
- c,
803
+ a,
791
804
  n,
792
- s
793
- ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
805
+ o
806
+ ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
794
807
  }
795
- ), Oe = k.forwardRef(
796
- ({ x: t, y: i, ...r }, f) => {
797
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.RoundedRectangle(), []), { eventHandlers: s, shapeProps: a } = g(() => {
798
- const o = {}, d = {};
799
- for (const l in r)
800
- L.includes(l) ? o[l] = r[
801
- l
808
+ ), Le = k.forwardRef(
809
+ ({ x: t, y: s, ...r }, l) => {
810
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.RoundedRectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
811
+ const i = {}, d = {};
812
+ for (const f in r)
813
+ O.includes(f) ? i[f] = r[
814
+ f
802
815
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
803
- ] : d[l] = r[l];
804
- return { eventHandlers: o, shapeProps: d };
816
+ ] : d[f] = r[f];
817
+ return { eventHandlers: i, shapeProps: d };
805
818
  }, [r]);
806
819
  return h(() => {
807
820
  if (n)
@@ -809,71 +822,71 @@ const pe = (t) => {
809
822
  n.remove(e);
810
823
  };
811
824
  }, [n, e]), h(() => {
812
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
813
- for (const o in a)
814
- o in e && (e[o] = a[o]);
815
- }, [a, e, t, i]), h(() => {
816
- if (Object.keys(s).length > 0)
825
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
826
+ for (const i in c)
827
+ i in e && (e[i] = c[i]);
828
+ }, [c, e, t, s]), h(() => {
829
+ if (Object.keys(o).length > 0)
817
830
  return u(
818
831
  e,
819
- s,
832
+ o,
820
833
  n ?? void 0
821
834
  ), () => {
822
- c(e);
835
+ a(e);
823
836
  };
824
837
  }, [
825
838
  e,
826
839
  u,
827
- c,
840
+ a,
828
841
  n,
829
- s
830
- ]), C(f, () => e, [
842
+ o
843
+ ]), R(l, () => e, [
831
844
  e
832
- ]), /* @__PURE__ */ S(G, {});
845
+ ]), /* @__PURE__ */ E(T, {});
833
846
  }
834
- ), Le = k.forwardRef(
835
- ({ src: t, x: i, y: r, autoPlay: f, ...n }, u) => {
836
- const { parent: c, registerEventShape: e, unregisterEventShape: s } = j(), a = g(() => new H.Sprite(t), [t]), { eventHandlers: o, shapeProps: d } = g(() => {
837
- const l = {}, v = {};
847
+ ), Oe = k.forwardRef(
848
+ ({ src: t, x: s, y: r, autoPlay: l, ...n }, u) => {
849
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Sprite(t), [t]), { eventHandlers: i, shapeProps: d } = g(() => {
850
+ const f = {}, v = {};
838
851
  for (const p in n)
839
- L.includes(p) ? l[p] = n[
852
+ O.includes(p) ? f[p] = n[
840
853
  p
841
854
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
842
855
  ] : v[p] = n[p];
843
- return { eventHandlers: l, shapeProps: v };
856
+ return { eventHandlers: f, shapeProps: v };
844
857
  }, [n]);
845
858
  return h(() => {
846
- if (c)
847
- return c.add(a), () => {
848
- c.remove(a);
849
- };
850
- }, [c, a]), h(() => {
851
- typeof i == "number" && (a.translation.x = i), typeof r == "number" && (a.translation.y = r), f ? a.play() : a.pause();
852
- for (const l in d)
853
- l in a && (a[l] = d[l]);
854
- }, [d, a, i, r, f]), h(() => {
855
- if (Object.keys(o).length > 0)
856
- return e(a, o, c ?? void 0), () => {
857
- s(a);
859
+ if (a)
860
+ return a.add(c), () => {
861
+ a.remove(c);
862
+ };
863
+ }, [a, c]), h(() => {
864
+ typeof s == "number" && (c.translation.x = s), typeof r == "number" && (c.translation.y = r), l ? c.play() : c.pause();
865
+ for (const f in d)
866
+ f in c && (c[f] = d[f]);
867
+ }, [d, c, s, r, l]), h(() => {
868
+ if (Object.keys(i).length > 0)
869
+ return e(c, i, a ?? void 0), () => {
870
+ o(c);
858
871
  };
859
872
  }, [
860
- a,
861
- e,
862
- s,
863
873
  c,
864
- o
865
- ]), C(u, () => a, [a]), /* @__PURE__ */ S(G, {});
874
+ e,
875
+ o,
876
+ a,
877
+ i
878
+ ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
866
879
  }
867
880
  ), Ve = k.forwardRef(
868
- ({ x: t, y: i, ...r }, f) => {
869
- const { parent: n, registerEventShape: u, unregisterEventShape: c } = j(), e = g(() => new H.Star(), []), { eventHandlers: s, shapeProps: a } = g(() => {
870
- const o = {}, d = {};
871
- for (const l in r)
872
- L.includes(l) ? o[l] = r[
873
- l
881
+ ({ x: t, y: s, ...r }, l) => {
882
+ const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Star(), []), { eventHandlers: o, shapeProps: c } = g(() => {
883
+ const i = {}, d = {};
884
+ for (const f in r)
885
+ O.includes(f) ? i[f] = r[
886
+ f
874
887
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
875
- ] : d[l] = r[l];
876
- return { eventHandlers: o, shapeProps: d };
888
+ ] : d[f] = r[f];
889
+ return { eventHandlers: i, shapeProps: d };
877
890
  }, [r]);
878
891
  return h(() => {
879
892
  if (n)
@@ -881,65 +894,65 @@ const pe = (t) => {
881
894
  n.remove(e);
882
895
  };
883
896
  }, [n, e]), h(() => {
884
- typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
885
- for (const o in a)
886
- o in e && (e[o] = a[o]);
887
- }, [a, e, t, i]), h(() => {
888
- if (Object.keys(s).length > 0)
889
- return u(e, s, n ?? void 0), () => {
890
- c(e);
891
- };
892
- }, [e, u, c, n, s]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
897
+ typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
898
+ for (const i in c)
899
+ i in e && (e[i] = c[i]);
900
+ }, [c, e, t, s]), h(() => {
901
+ if (Object.keys(o).length > 0)
902
+ return u(e, o, n ?? void 0), () => {
903
+ a(e);
904
+ };
905
+ }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
893
906
  }
894
907
  ), Ge = k.forwardRef(
895
- ({ x1: t, y1: i, x2: r, y2: f, ...n }, u) => {
896
- const c = g(() => new H.LinearGradient(), []);
908
+ ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
909
+ const a = g(() => new H.LinearGradient(), []);
897
910
  return h(() => {
898
- typeof t == "number" && (c.left.x = t), typeof i == "number" && (c.left.y = i), typeof r == "number" && (c.right.x = r), typeof f == "number" && (c.right.y = f);
911
+ typeof t == "number" && (a.left.x = t), typeof s == "number" && (a.left.y = s), typeof r == "number" && (a.right.x = r), typeof l == "number" && (a.right.y = l);
899
912
  for (const e in n)
900
- e in c && (c[e] = n[e]);
901
- }, [c, t, i, r, f, n]), C(u, () => c, [c]), null;
913
+ e in a && (a[e] = n[e]);
914
+ }, [a, t, s, r, l, n]), R(u, () => a, [a]), null;
902
915
  }
903
916
  ), Te = k.forwardRef(
904
- ({ x: t, y: i, focalX: r, focalY: f, ...n }, u) => {
905
- const c = g(() => new H.RadialGradient(), []);
917
+ ({ x: t, y: s, focalX: r, focalY: l, ...n }, u) => {
918
+ const a = g(() => new H.RadialGradient(), []);
906
919
  return h(() => {
907
- typeof t == "number" && (c.center.x = t), typeof i == "number" && (c.center.y = i), typeof r == "number" && (c.focal.x = r), typeof f == "number" && (c.focal.y = f);
920
+ typeof t == "number" && (a.center.x = t), typeof s == "number" && (a.center.y = s), typeof r == "number" && (a.focal.x = r), typeof l == "number" && (a.focal.y = l);
908
921
  for (const e in n)
909
- e in c && (c[e] = n[e]);
910
- }, [n, c, t, i, r, f]), C(u, () => c, [c]), null;
922
+ e in a && (a[e] = n[e]);
923
+ }, [n, a, t, s, r, l]), R(u, () => a, [a]), null;
911
924
  }
912
925
  ), Me = k.forwardRef(
913
- ({ src: t, ...i }, r) => {
914
- const f = g(() => new H.Texture(t), [t]);
926
+ ({ src: t, ...s }, r) => {
927
+ const l = g(() => new H.Texture(t), [t]);
915
928
  return h(() => {
916
- for (const n in i)
917
- n in f && (f[n] = i[n]);
918
- }, [i, f]), C(r, () => f, [f]), null;
929
+ for (const n in s)
930
+ n in l && (l[n] = s[n]);
931
+ }, [s, l]), R(r, () => l, [l]), null;
919
932
  }
920
933
  );
921
934
  export {
922
935
  be as ArcSegment,
923
936
  pe as Canvas,
924
937
  Ee as Circle,
925
- ae as Context,
938
+ ce as Context,
926
939
  Se as Ellipse,
927
940
  ge as Group,
928
941
  ke as Image,
929
942
  He as ImageSequence,
930
943
  Re as Line,
931
944
  Ge as LinearGradient,
932
- ye as Path,
933
- Pe as Points,
945
+ me as Path,
946
+ we as Points,
934
947
  Ce as Polygon,
935
948
  Te as RadialGradient,
936
949
  je as Rectangle,
937
- Oe as RoundedRectangle,
938
- me as SVG,
939
- Le as Sprite,
950
+ Le as RoundedRectangle,
951
+ ye as SVG,
952
+ Oe as Sprite,
940
953
  Ve as Star,
941
- we as Text,
954
+ Pe as Text,
942
955
  Me as Texture,
943
956
  ve as useFrame,
944
- j as useTwo
957
+ C as useTwo
945
958
  };