react-two.js 0.8.22-r.2 → 0.8.22-r.3

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