react-two.js 0.8.22-r.1 → 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 O } from "react/jsx-runtime";
2
- import P, { createContext as J, useContext as K, useRef as N, useEffect as v, useState as z, useCallback as W, useMemo as w, useImperativeHandle as S } from "react";
3
- import E from "two.js";
4
- const F = J({
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 = () => K(F), te = (t, f = []) => {
14
- const { two: r } = H(), u = N(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
- }, C = [
30
+ }, [r, ...i]);
31
+ }, L = [
27
32
  "onClick",
28
33
  "onContextMenu",
29
34
  "onDoubleClick",
@@ -37,21 +42,21 @@ const F = J({
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 U(t) {
82
- process.env.NODE_ENV !== "production" && P.Children.forEach(t, (f) => {
83
- if (!P.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,834 +97,849 @@ See: https://github.com/jonobr1/react-two.js#usage`
92
97
  );
93
98
  return;
94
99
  }
95
- if (r === P.Fragment) {
96
- U(
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 && U(
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 = N(null), n = N(/* @__PURE__ */ new Map()), d = N(/* @__PURE__ */ new Set()), l = N(null), [e, o] = z({
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 !== b;
155
- T && (p = h.width), V && (b = h.height), (T || V) && o((j) => ({ ...j, width: p, height: b }));
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, b = 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" && U(t.children);
165
- }, [t.children]), v(() => {
166
- if (!e.two) return;
167
- const a = e.two.renderer.domElement, c = (g, m, 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 A of G) {
171
- const _ = n.current.get(A)?.handlers[m];
172
- if (_) {
173
- const q = $(
174
- y,
175
- M,
176
- A,
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), q.stopped)
163
+ if (te(re), re.stopped)
180
164
  break;
181
165
  }
182
166
  }
183
- }, h = (g) => {
184
- const m = D(g, a), y = x(
167
+ }, y = (P) => {
168
+ const E = N(P, m), b = A(
185
169
  n.current,
186
- m.x,
187
- m.y
170
+ E.x,
171
+ E.y
188
172
  );
189
- y.length > 0 && c(y, "onClick", g);
190
- }, p = (g) => {
191
- const m = 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
- m.x,
194
- m.y
177
+ E.x,
178
+ E.y
195
179
  );
196
- y.length > 0 && c(y, "onContextMenu", g);
197
- }, b = (g) => {
198
- const m = 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
- m.x,
201
- m.y
184
+ E.x,
185
+ E.y
202
186
  );
203
- y.length > 0 && c(y, "onDoubleClick", g);
204
- }, T = (g) => {
205
- const m = 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
- m.x,
208
- m.y
191
+ E.x,
192
+ E.y
209
193
  );
210
- y.length > 0 && c(y, "onWheel", g);
211
- }, V = (g) => {
212
- const m = 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
- m.x,
215
- m.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
- }, j = (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 m = D(g, a), y = x(
217
+ const E = N(P, m), b = A(
234
218
  n.current,
235
- m.x,
236
- m.y
219
+ E.x,
220
+ E.y
237
221
  );
238
- y.length > 0 ? c(y, "onPointerUp", g) : t.onPointerMissed && t.onPointerMissed(g);
239
- }, L = (g) => {
240
- const m = 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
- m.x,
243
- m.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
- }, R = (g) => {
253
- const m = 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
- m.x,
256
- m.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", b), a.addEventListener("wheel", T), a.addEventListener("pointerdown", V), a.addEventListener("pointerup", j), a.addEventListener("pointermove", L), a.addEventListener("pointercancel", R), () => {
261
- a.removeEventListener("click", h), a.removeEventListener("contextmenu", p), a.removeEventListener("dblclick", b), a.removeEventListener("wheel", T), a.removeEventListener("pointerdown", V), a.removeEventListener("pointerup", j), a.removeEventListener("pointermove", L), a.removeEventListener("pointercancel", R);
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(F.Provider, { value: e, children: /* @__PURE__ */ k("div", { ref: u, children: t.children }) });
269
- }, oe = P.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 = w(() => new E.Group(), []), { eventHandlers: a, shapeProps: c } = w(() => {
279
- const h = {}, p = {};
280
- for (const b in r)
281
- C.includes(b) ? h[b] = r[
282
- b
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[b] = r[b];
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
- F.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 = P.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, b] = z(null), { eventHandlers: T, shapeProps: V } = w(() => {
334
- const j = {}, L = {};
335
- for (const R in l)
336
- C.includes(R) ? j[R] = 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[
337
352
  R
338
353
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
- ] : L[R] = l[R];
340
- return { eventHandlers: j, shapeProps: L };
341
- }, [l]);
342
- return v(() => {
343
- !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(
344
366
  '[react-two.js] SVG component requires either "src" or "content" prop'
345
- ), r && u && console.warn(
367
+ ), r && f && console.warn(
346
368
  '[react-two.js] SVG component has both "src" and "content" props. Using "src" and ignoring "content"'
347
369
  );
348
- }, [r, u]), v(() => {
349
- if (!o) return;
350
- const j = r || u;
351
- if (!j) return;
352
- let L = !0;
370
+ }, [r, f]), h(() => {
371
+ if (!s) return;
372
+ const w = r || f;
373
+ if (!w) return;
374
+ let y = !0;
353
375
  try {
354
- const R = o.load(
355
- j,
356
- (g, m) => {
357
- if (L && (b(g), n))
376
+ s.load(
377
+ w,
378
+ (R, M) => {
379
+ if (y && (O.current?.add(R.children), n))
358
380
  try {
359
- n(g, m);
360
- } catch (y) {
381
+ requestAnimationFrame(() => n(O.current, M));
382
+ } catch (F) {
361
383
  console.error(
362
384
  "[react-two.js] Error in SVG onLoad callback:",
363
- y
385
+ F
364
386
  );
365
387
  }
366
388
  }
367
389
  );
368
- b(R);
369
390
  } catch (R) {
370
- if (!L) return;
371
- const g = R instanceof Error ? R : new Error("Failed to load SVG");
372
- if (d)
391
+ if (!y) return;
392
+ const M = R instanceof Error ? R : new Error("Failed to load SVG");
393
+ if (u)
373
394
  try {
374
- d(g);
375
- } catch (m) {
395
+ u(M);
396
+ } catch (F) {
376
397
  console.error(
377
398
  "[react-two.js] Error in SVG onError callback:",
378
- m
399
+ F
379
400
  );
380
401
  }
381
402
  else
382
- console.error("[react-two.js] SVG loading error:", g);
403
+ console.error("[react-two.js] SVG loading error:", M);
383
404
  }
384
405
  return () => {
385
- L = !1;
406
+ y = !1, O.current?.remove(O.current.children);
386
407
  };
387
- }, [o, r, u, n, d]), v(() => {
388
- if (s && p)
389
- return s.add(p), () => {
390
- s.remove(p);
391
- };
392
- }, [p, s]), v(() => {
393
- if (p) {
394
- const j = p;
395
- typeof t == "number" && (j.translation.x = t), typeof f == "number" && (j.translation.y = f);
396
- const L = { ...V };
397
- delete L.children;
398
- for (const R in L)
399
- R in j && (j[R] = L[R]);
400
- }
401
- }, [p, t, f, V]), v(() => {
402
- if (p && Object.keys(T).length > 0)
403
- return c(p, T, s ?? void 0), () => {
404
- h(p);
405
- };
406
- }, [p, c, h, s, T]), S(e, () => p, [p]), /* @__PURE__ */ k(
407
- F.Provider,
408
- {
409
- value: {
410
- two: o,
411
- parent: p,
412
- width: i,
413
- height: a,
414
- registerEventShape: c,
415
- unregisterEventShape: h
416
- },
417
- children: l.children
418
- }
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]
419
438
  );
439
+ return /* @__PURE__ */ S(ae.Provider, { value: I, children: /* @__PURE__ */ S(_.Provider, { value: $, children: /* @__PURE__ */ S(B.Provider, { value: m, children: c.children }) }) });
420
440
  }
421
- ), se = P.forwardRef(
422
- ({ manual: t, x: f, y: r, ...u }, n) => {
423
- const { parent: d, registerEventShape: l, unregisterEventShape: e } = H(), o = w(() => new E.Path(), []), { eventHandlers: s, shapeProps: i } = w(() => {
424
- const a = {}, c = {};
425
- for (const h in u)
426
- C.includes(h) ? a[h] = u[
427
- 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
428
448
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
429
- ] : c[h] = u[h];
430
- return { eventHandlers: a, shapeProps: c };
431
- }, [u]);
432
- return v(() => {
433
- if (d)
434
- return d.add(o), () => {
435
- d.remove(o);
436
- };
437
- }, [d, o]), v(() => {
438
- if (Object.keys(s).length > 0)
439
- return l(o, s, d ?? void 0), () => {
440
- e(o);
441
- };
442
- }, [o, l, e, d, s]), v(() => {
443
- typeof f == "number" && (o.translation.x = f), typeof r == "number" && (o.translation.y = r), typeof t < "u" && (o.automatic = !t);
444
- for (const a in i)
445
- a in o && (o[a] = i[a]);
446
- }, [i, o, f, r, t]), S(n, () => o, [o]), /* @__PURE__ */ k(O, {});
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, {});
447
467
  }
448
- ), ae = P.forwardRef(
449
- ({ x: t, y: f, ...r }, u) => {
450
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.Points(), []), { eventHandlers: o, shapeProps: s } = w(() => {
451
- const i = {}, a = {};
452
- for (const c in r)
453
- C.includes(c) ? i[c] = r[
454
- 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
455
475
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
456
- ] : a[c] = r[c];
457
- return { eventHandlers: i, shapeProps: a };
476
+ ] : d[l] = r[l];
477
+ return { eventHandlers: o, shapeProps: d };
458
478
  }, [r]);
459
- return v(() => {
479
+ return h(() => {
460
480
  if (n)
461
481
  return n.add(e), () => {
462
482
  n.remove(e);
463
483
  };
464
- }, [n, e]), v(() => {
465
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
466
- for (const i in s)
467
- i in e && (e[i] = s[i]);
468
- }, [s, e, t, f]), v(() => {
469
- if (Object.keys(o).length > 0)
470
- return d(e, o, n ?? void 0), () => {
471
- 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);
472
492
  };
473
493
  }, [
474
494
  e,
475
- d,
476
- l,
495
+ u,
496
+ c,
477
497
  n,
478
- o
479
- ]), S(u, () => e, [e]), /* @__PURE__ */ k(O, {});
498
+ s
499
+ ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
480
500
  }
481
- ), ce = P.forwardRef(
482
- ({ x: t, y: f, ...r }, u) => {
483
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.Text(), []), { eventHandlers: o, shapeProps: s } = w(() => {
484
- const i = {}, a = {};
485
- for (const c in r)
486
- C.includes(c) ? i[c] = r[
487
- 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
488
508
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
489
- ] : a[c] = r[c];
490
- return { eventHandlers: i, shapeProps: a };
509
+ ] : d[l] = r[l];
510
+ return { eventHandlers: o, shapeProps: d };
491
511
  }, [r]);
492
- return v(() => {
512
+ return h(() => {
493
513
  if (n)
494
514
  return n.add(e), () => {
495
515
  n.remove(e);
496
516
  };
497
- }, [n, e]), v(() => {
498
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
499
- for (const i in s)
500
- i in e && (e[i] = s[i]);
501
- }, [s, e, t, f]), v(() => {
502
- if (Object.keys(o).length > 0)
503
- return d(e, o, n ?? void 0), () => {
504
- 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);
505
525
  };
506
- }, [e, d, l, n, o]), S(u, () => e, [e]), /* @__PURE__ */ k(O, {});
526
+ }, [e, u, c, n, s]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
507
527
  }
508
- ), fe = P.forwardRef(
509
- ({ x: t, y: f, resolution: r, ...u }, n) => {
510
- const { parent: d, registerEventShape: l, unregisterEventShape: e } = H(), o = w(
511
- () => 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),
512
532
  [r]
513
- ), { eventHandlers: s, shapeProps: i } = w(() => {
514
- const a = {}, c = {};
515
- for (const h in u)
516
- C.includes(h) ? a[h] = u[
517
- 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
518
538
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
519
- ] : c[h] = u[h];
520
- return { eventHandlers: a, shapeProps: c };
521
- }, [u]);
522
- return v(() => {
523
- if (d)
524
- return d.add(o), () => {
525
- d.remove(o);
526
- };
527
- }, [d, o]), v(() => {
528
- typeof t == "number" && (o.translation.x = t), typeof f == "number" && (o.translation.y = f);
529
- for (const a in i)
530
- a in o && (o[a] = i[a]);
531
- }, [i, o, t, f]), v(() => {
532
- if (Object.keys(s).length > 0)
533
- return l(o, s, d ?? void 0), () => {
534
- 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);
535
555
  };
536
556
  }, [
537
- o,
538
- l,
557
+ s,
558
+ c,
539
559
  e,
540
- d,
541
- s
542
- ]), S(n, () => o, [o]), /* @__PURE__ */ k(O, {});
560
+ u,
561
+ a
562
+ ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
543
563
  }
544
- ), le = P.forwardRef(
545
- ({ x: t, y: f, resolution: r, ...u }, n) => {
546
- const { parent: d, registerEventShape: l, unregisterEventShape: e } = H(), o = w(
547
- () => 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),
548
568
  [r]
549
- ), { eventHandlers: s, shapeProps: i } = w(() => {
550
- const a = {}, c = {};
551
- for (const h in u)
552
- C.includes(h) ? a[h] = u[
553
- 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
554
574
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
555
- ] : c[h] = u[h];
556
- return { eventHandlers: a, shapeProps: c };
557
- }, [u]);
558
- return v(() => {
559
- typeof t == "number" && (o.translation.x = t), typeof f == "number" && (o.translation.y = f);
560
- for (const a in i)
561
- a in o && (o[a] = i[a]);
562
- }, [o, i, t, f]), v(() => {
563
- if (d)
564
- return d.add(o), () => {
565
- d.remove(o);
566
- };
567
- }, [d, o]), v(() => {
568
- if (Object.keys(s).length > 0)
569
- return l(o, s, d ?? void 0), () => {
570
- 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);
571
591
  };
572
592
  }, [
573
- o,
574
- l,
593
+ s,
594
+ c,
575
595
  e,
576
- d,
577
- s
578
- ]), S(n, () => o, [o]), /* @__PURE__ */ k(O, {});
596
+ u,
597
+ a
598
+ ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
579
599
  }
580
- ), ue = P.forwardRef(
581
- ({ x: t, y: f, resolution: r, ...u }, n) => {
582
- const { parent: d, registerEventShape: l, unregisterEventShape: e } = H(), o = w(
583
- () => 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),
584
604
  [r]
585
- ), { eventHandlers: s, shapeProps: i } = w(() => {
586
- const a = {}, c = {};
587
- for (const h in u)
588
- C.includes(h) ? a[h] = u[
589
- 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
590
610
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
591
- ] : c[h] = u[h];
592
- return { eventHandlers: a, shapeProps: c };
593
- }, [u]);
594
- return v(() => {
595
- if (d)
596
- return d.add(o), () => {
597
- d.remove(o);
598
- };
599
- }, [d, o]), v(() => {
600
- typeof t == "number" && (o.translation.x = t), typeof f == "number" && (o.translation.y = f);
601
- for (const a in i)
602
- a in o && (o[a] = i[a]);
603
- }, [o, t, f, i]), v(() => {
604
- if (Object.keys(s).length > 0)
605
- return l(o, s, d ?? void 0), () => {
606
- 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);
607
627
  };
608
628
  }, [
609
- o,
610
- l,
629
+ s,
630
+ c,
611
631
  e,
612
- d,
613
- s
614
- ]), S(n, () => o, [o]), /* @__PURE__ */ k(O, {});
632
+ u,
633
+ a
634
+ ]), C(n, () => s, [s]), /* @__PURE__ */ S(G, {});
615
635
  }
616
- ), de = P.forwardRef(
617
- ({ mode: t, src: f, texture: r, x: u, y: n, ...d }, l) => {
618
- const { parent: e, registerEventShape: o, unregisterEventShape: s } = H(), i = w(() => new E.Image(f), [f]), { eventHandlers: a, shapeProps: c } = w(() => {
619
- const h = {}, p = {};
620
- for (const b in d)
621
- C.includes(b) ? h[b] = d[
622
- b
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
623
643
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
624
- ] : p[b] = d[b];
625
- return { eventHandlers: h, shapeProps: p };
626
- }, [d]);
627
- return v(() => {
644
+ ] : p[O] = u[O];
645
+ return { eventHandlers: v, shapeProps: p };
646
+ }, [u]);
647
+ return h(() => {
628
648
  if (e)
629
- return e.add(i), () => {
630
- e.remove(i);
631
- };
632
- }, [e, i]), v(() => {
633
- 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);
634
- for (const h in c)
635
- h in i && (i[h] = c[h]);
636
- }, [i, c, t, r, u, n]), v(() => {
637
- if (Object.keys(a).length > 0)
638
- return o(i, a, e ?? void 0), () => {
639
- 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);
640
660
  };
641
661
  }, [
642
- i,
643
662
  o,
644
663
  s,
664
+ a,
645
665
  e,
646
- a
647
- ]), S(l, () => i, [i]), /* @__PURE__ */ k(O, {});
666
+ d
667
+ ]), C(c, () => o, [o]), /* @__PURE__ */ S(G, {});
648
668
  }
649
- ), he = P.forwardRef(
650
- ({ src: t, x: f, y: r, autoPlay: u, ...n }, d) => {
651
- const { parent: l, registerEventShape: e, unregisterEventShape: o } = H(), s = w(() => new E.ImageSequence(t), [t]), { eventHandlers: i, shapeProps: a } = w(() => {
652
- 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 = {};
653
673
  for (const p in n)
654
- C.includes(p) ? c[p] = n[
674
+ L.includes(p) ? l[p] = n[
655
675
  p
656
676
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
657
- ] : h[p] = n[p];
658
- return { eventHandlers: c, shapeProps: h };
677
+ ] : v[p] = n[p];
678
+ return { eventHandlers: l, shapeProps: v };
659
679
  }, [n]);
660
- return v(() => {
661
- if (l)
662
- return l.add(s), () => {
663
- l.remove(s);
664
- };
665
- }, [l, s]), v(() => {
666
- u ? s.play() : s.pause(), typeof f == "number" && (s.translation.x = f), typeof r == "number" && (s.translation.y = r);
667
- for (const c in a)
668
- c in s && (s[c] = a[c]);
669
- }, [a, s, f, r, u]), v(() => {
670
- if (Object.keys(i).length > 0)
671
- return e(s, i, l ?? void 0), () => {
672
- 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);
673
693
  };
674
694
  }, [
675
- s,
695
+ a,
676
696
  e,
677
- o,
678
- l,
679
- i
680
- ]), S(d, () => s, [s]), /* @__PURE__ */ k(O, {});
697
+ s,
698
+ c,
699
+ o
700
+ ]), C(u, () => a, [a]), /* @__PURE__ */ S(G, {});
681
701
  }
682
- ), ve = P.forwardRef(
683
- ({ x1: t, y1: f, x2: r, y2: u, ...n }, d) => {
684
- const { parent: l, registerEventShape: e, unregisterEventShape: o } = H(), s = w(() => new E.Line(), []), { eventHandlers: i, shapeProps: a } = w(() => {
685
- 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 = {};
686
706
  for (const p in n)
687
- C.includes(p) ? c[p] = n[
707
+ L.includes(p) ? l[p] = n[
688
708
  p
689
709
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
690
- ] : h[p] = n[p];
691
- return { eventHandlers: c, shapeProps: h };
710
+ ] : v[p] = n[p];
711
+ return { eventHandlers: l, shapeProps: v };
692
712
  }, [n]);
693
- return v(() => {
694
- if (l)
695
- return l.add(s), () => {
696
- l.remove(s);
697
- };
698
- }, [l, s]), v(() => {
699
- 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);
700
- for (const c in a)
701
- c in s && (s[c] = a[c]);
702
- }, [a, s, t, f, r, u]), v(() => {
703
- if (Object.keys(i).length > 0)
704
- return e(s, i, l ?? void 0), () => {
705
- o(s);
706
- };
707
- }, [s, e, o, l, i]), S(d, () => s, [s]), /* @__PURE__ */ k(O, {});
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, {});
708
728
  }
709
- ), pe = P.forwardRef(
710
- ({ x: t, y: f, ...r }, u) => {
711
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.Polygon(), []), { eventHandlers: o, shapeProps: s } = w(() => {
712
- const i = {}, a = {};
713
- for (const c in r)
714
- C.includes(c) ? i[c] = r[
715
- 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
716
736
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
717
- ] : a[c] = r[c];
718
- return { eventHandlers: i, shapeProps: a };
737
+ ] : d[l] = r[l];
738
+ return { eventHandlers: o, shapeProps: d };
719
739
  }, [r]);
720
- return v(() => {
740
+ return h(() => {
721
741
  if (n)
722
742
  return n.add(e), () => {
723
743
  n.remove(e);
724
744
  };
725
- }, [n, e]), v(() => {
726
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
727
- for (const i in s)
728
- i in e && (e[i] = s[i]);
729
- }, [s, e, t, f]), v(() => {
730
- if (Object.keys(o).length > 0)
731
- return d(e, o, n ?? void 0), () => {
732
- 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);
733
753
  };
734
754
  }, [
735
755
  e,
736
- d,
737
- l,
756
+ u,
757
+ c,
738
758
  n,
739
- o
740
- ]), S(u, () => e, [e]), /* @__PURE__ */ k(O, {});
759
+ s
760
+ ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
741
761
  }
742
- ), ge = P.forwardRef(
743
- ({ x: t, y: f, ...r }, u) => {
744
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.Rectangle(), []), { eventHandlers: o, shapeProps: s } = w(() => {
745
- const i = {}, a = {};
746
- for (const c in r)
747
- C.includes(c) ? i[c] = r[
748
- 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
749
769
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
750
- ] : a[c] = r[c];
751
- return { eventHandlers: i, shapeProps: a };
770
+ ] : d[l] = r[l];
771
+ return { eventHandlers: o, shapeProps: d };
752
772
  }, [r]);
753
- return v(() => {
773
+ return h(() => {
754
774
  if (n)
755
775
  return n.add(e), () => {
756
776
  n.remove(e);
757
777
  };
758
- }, [n, e]), v(() => {
759
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
760
- for (const i in s)
761
- i in e && (e[i] = s[i]);
762
- }, [s, e, t, f]), v(() => {
763
- if (Object.keys(o).length > 0)
764
- return d(e, o, n ?? void 0), () => {
765
- 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);
766
786
  };
767
787
  }, [
768
788
  e,
769
- d,
770
- l,
789
+ u,
790
+ c,
771
791
  n,
772
- o
773
- ]), S(u, () => e, [e]), /* @__PURE__ */ k(O, {});
792
+ s
793
+ ]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
774
794
  }
775
- ), we = P.forwardRef(
776
- ({ x: t, y: f, ...r }, u) => {
777
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.RoundedRectangle(), []), { eventHandlers: o, shapeProps: s } = w(() => {
778
- const i = {}, a = {};
779
- for (const c in r)
780
- C.includes(c) ? i[c] = r[
781
- 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
782
802
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
783
- ] : a[c] = r[c];
784
- return { eventHandlers: i, shapeProps: a };
803
+ ] : d[l] = r[l];
804
+ return { eventHandlers: o, shapeProps: d };
785
805
  }, [r]);
786
- return v(() => {
806
+ return h(() => {
787
807
  if (n)
788
808
  return n.add(e), () => {
789
809
  n.remove(e);
790
810
  };
791
- }, [n, e]), v(() => {
792
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
793
- for (const i in s)
794
- i in e && (e[i] = s[i]);
795
- }, [s, e, t, f]), v(() => {
796
- if (Object.keys(o).length > 0)
797
- 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(
798
818
  e,
799
- o,
819
+ s,
800
820
  n ?? void 0
801
821
  ), () => {
802
- l(e);
822
+ c(e);
803
823
  };
804
824
  }, [
805
825
  e,
806
- d,
807
- l,
826
+ u,
827
+ c,
808
828
  n,
809
- o
810
- ]), S(u, () => e, [
829
+ s
830
+ ]), C(f, () => e, [
811
831
  e
812
- ]), /* @__PURE__ */ k(O, {});
832
+ ]), /* @__PURE__ */ S(G, {});
813
833
  }
814
- ), ye = P.forwardRef(
815
- ({ src: t, x: f, y: r, autoPlay: u, ...n }, d) => {
816
- const { parent: l, registerEventShape: e, unregisterEventShape: o } = H(), s = w(() => new E.Sprite(t), [t]), { eventHandlers: i, shapeProps: a } = w(() => {
817
- 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 = {};
818
838
  for (const p in n)
819
- C.includes(p) ? c[p] = n[
839
+ L.includes(p) ? l[p] = n[
820
840
  p
821
841
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
822
- ] : h[p] = n[p];
823
- return { eventHandlers: c, shapeProps: h };
842
+ ] : v[p] = n[p];
843
+ return { eventHandlers: l, shapeProps: v };
824
844
  }, [n]);
825
- return v(() => {
826
- if (l)
827
- return l.add(s), () => {
828
- l.remove(s);
829
- };
830
- }, [l, s]), v(() => {
831
- typeof f == "number" && (s.translation.x = f), typeof r == "number" && (s.translation.y = r), u ? s.play() : s.pause();
832
- for (const c in a)
833
- c in s && (s[c] = a[c]);
834
- }, [a, s, f, r, u]), v(() => {
835
- if (Object.keys(i).length > 0)
836
- return e(s, i, l ?? void 0), () => {
837
- 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);
838
858
  };
839
859
  }, [
840
- s,
860
+ a,
841
861
  e,
842
- o,
843
- l,
844
- i
845
- ]), S(d, () => s, [s]), /* @__PURE__ */ k(O, {});
862
+ s,
863
+ c,
864
+ o
865
+ ]), C(u, () => a, [a]), /* @__PURE__ */ S(G, {});
846
866
  }
847
- ), me = P.forwardRef(
848
- ({ x: t, y: f, ...r }, u) => {
849
- const { parent: n, registerEventShape: d, unregisterEventShape: l } = H(), e = w(() => new E.Star(), []), { eventHandlers: o, shapeProps: s } = w(() => {
850
- const i = {}, a = {};
851
- for (const c in r)
852
- C.includes(c) ? i[c] = r[
853
- 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
854
874
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
855
- ] : a[c] = r[c];
856
- return { eventHandlers: i, shapeProps: a };
875
+ ] : d[l] = r[l];
876
+ return { eventHandlers: o, shapeProps: d };
857
877
  }, [r]);
858
- return v(() => {
878
+ return h(() => {
859
879
  if (n)
860
880
  return n.add(e), () => {
861
881
  n.remove(e);
862
882
  };
863
- }, [n, e]), v(() => {
864
- typeof t == "number" && (e.translation.x = t), typeof f == "number" && (e.translation.y = f);
865
- for (const i in s)
866
- i in e && (e[i] = s[i]);
867
- }, [s, e, t, f]), v(() => {
868
- if (Object.keys(o).length > 0)
869
- return d(e, o, n ?? void 0), () => {
870
- 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);
871
891
  };
872
- }, [e, d, l, n, o]), S(u, () => e, [e]), /* @__PURE__ */ k(O, {});
892
+ }, [e, u, c, n, s]), C(f, () => e, [e]), /* @__PURE__ */ S(G, {});
873
893
  }
874
- ), Pe = P.forwardRef(
875
- ({ x1: t, y1: f, x2: r, y2: u, ...n }, d) => {
876
- const l = w(() => new E.LinearGradient(), []);
877
- return v(() => {
878
- 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);
879
899
  for (const e in n)
880
- e in l && (l[e] = n[e]);
881
- }, [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;
882
902
  }
883
- ), be = P.forwardRef(
884
- ({ x: t, y: f, focalX: r, focalY: u, ...n }, d) => {
885
- const l = w(() => new E.RadialGradient(), []);
886
- return v(() => {
887
- 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);
888
908
  for (const e in n)
889
- e in l && (l[e] = n[e]);
890
- }, [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;
891
911
  }
892
- ), Ee = P.forwardRef(
893
- ({ src: t, ...f }, r) => {
894
- const u = w(() => new E.Texture(t), [t]);
895
- return v(() => {
896
- for (const n in f)
897
- n in u && (u[n] = f[n]);
898
- }, [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;
899
919
  }
900
920
  );
901
921
  export {
902
- fe as ArcSegment,
903
- re as Canvas,
904
- le as Circle,
905
- F as Context,
906
- ue as Ellipse,
907
- oe as Group,
908
- de as Image,
909
- he as ImageSequence,
910
- ve as Line,
911
- Pe as LinearGradient,
912
- se as Path,
913
- ae as Points,
914
- pe as Polygon,
915
- be as RadialGradient,
916
- ge as Rectangle,
917
- we as RoundedRectangle,
918
- ie as SVG,
919
- ye as Sprite,
920
- me as Star,
921
- ce as Text,
922
- Ee as Texture,
923
- te as useFrame,
924
- 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
925
945
  };