@omnidotdev/rdk 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/build/assets/onnxWorker-3jptKfHs.js +1 -0
  2. package/build/engine-B_SO7XR5.cjs +1 -0
  3. package/build/{engine-NEJZ-OgD.js → engine-DeBLXgW-.js} +2 -3
  4. package/build/engine.cjs +1 -1
  5. package/build/engine.js +2 -2
  6. package/build/fiducial/FiducialAnchor.d.ts +1 -1
  7. package/build/fiducial/FiducialAnchor.d.ts.map +1 -1
  8. package/build/{fiducial-7pF-ErgE.js → fiducial-DUn6sFBT.js} +17 -13
  9. package/build/fiducial-IzVogwhD.cjs +1 -0
  10. package/build/fiducial.cjs +1 -1
  11. package/build/fiducial.js +1 -2
  12. package/build/geolocation/GeoLine.d.ts +3 -15
  13. package/build/geolocation/GeoLine.d.ts.map +1 -1
  14. package/build/geolocation/GeoPolygon.d.ts +3 -15
  15. package/build/geolocation/GeoPolygon.d.ts.map +1 -1
  16. package/build/geolocation/GeolocationAnchor.d.ts +1 -1
  17. package/build/geolocation/useMaterialStore.d.ts +20 -0
  18. package/build/geolocation/useMaterialStore.d.ts.map +1 -0
  19. package/build/geolocation-BK0FDlmT.cjs +1 -0
  20. package/build/geolocation-DmJvz9om.js +376 -0
  21. package/build/geolocation.cjs +1 -1
  22. package/build/geolocation.js +1 -2
  23. package/build/immersive/ImmersiveSession.d.ts +1 -1
  24. package/build/immersive/ImmersiveSession.d.ts.map +1 -1
  25. package/build/{immersive-CoSRZ58s.js → immersive-BNYjOBFO.js} +2 -3
  26. package/build/{immersive-DMYGUy_v.cjs → immersive-C76xlUbB.cjs} +1 -1
  27. package/build/immersive.cjs +1 -1
  28. package/build/immersive.js +1 -2
  29. package/build/index.cjs +1 -1
  30. package/build/index.js +7 -7
  31. package/build/magic/WorldAnchor.d.ts +1 -1
  32. package/build/magic/WorldAnchor.d.ts.map +1 -1
  33. package/build/magic-BbyHQVOH.cjs +1 -0
  34. package/build/{magic-CjnX9lWp.js → magic-COfaC4at.js} +10 -9
  35. package/build/magic.cjs +1 -1
  36. package/build/magic.js +1 -2
  37. package/build/{useXRStore-BTnI1ZM2.js → useXRStore-CrglOU9_.js} +5 -8
  38. package/build/useXRStore-DfyQv43d.cjs +1 -0
  39. package/build/vision/HandTracker.d.ts +1 -1
  40. package/build/vision/HandTracker.d.ts.map +1 -1
  41. package/build/vision/VisionAnchor.d.ts +1 -1
  42. package/build/vision/VisionAnchor.d.ts.map +1 -1
  43. package/build/vision/VisionSession.d.ts.map +1 -1
  44. package/build/vision/providers/mediapipeProvider.d.ts +6 -0
  45. package/build/vision/providers/mediapipeProvider.d.ts.map +1 -1
  46. package/build/vision/types.d.ts +12 -0
  47. package/build/vision/types.d.ts.map +1 -1
  48. package/build/vision/visionBackend.d.ts +1 -1
  49. package/build/vision/visionBackend.d.ts.map +1 -1
  50. package/build/{vision-Vp2iuVNJ.js → vision-1_qdyG-O.js} +60 -49
  51. package/build/vision-B9EQHClV.cjs +1 -0
  52. package/build/vision.cjs +1 -1
  53. package/build/vision.js +1 -2
  54. package/package.json +5 -5
  55. package/build/assets/onnxWorker-BNjoneWr.js +0 -1
  56. package/build/engine-EvzyijbY.cjs +0 -1
  57. package/build/fiducial-Tris7XAY.cjs +0 -1
  58. package/build/geolocation-B7zCO7n6.js +0 -346
  59. package/build/geolocation-ypey8aeT.cjs +0 -1
  60. package/build/magic-B9pQnRYJ.cjs +0 -1
  61. package/build/useXRStore-Cf_XL0aI.cjs +0 -1
  62. package/build/vision-BLWMU9Ys.cjs +0 -1
@@ -0,0 +1,376 @@
1
+ import { a as e, i as t, r as n } from "./useXRStore-CrglOU9_.js";
2
+ import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
3
+ import { createPortal as c, useFrame as l, useThree as u } from "@react-three/fiber";
4
+ import { jsx as d } from "react/jsx-runtime";
5
+ import { BackSide as f, BufferAttribute as p, BufferGeometry as m, Color as h, DoubleSide as g, FrontSide as _, Group as v, Mesh as y, MeshBasicMaterial as b, Path as x, Shape as S, ShapeGeometry as C, Vector3 as w } from "three";
6
+ import { Line2 as T } from "three/addons/lines/Line2.js";
7
+ import { LineGeometry as E } from "three/addons/lines/LineGeometry.js";
8
+ import { LineMaterial as D } from "three/addons/lines/LineMaterial.js";
9
+ import { App as O, LocAR as k } from "locar";
10
+ // src/geolocation/useGeolocationBackend.ts
11
+ var A = {
12
+ isPending: !0,
13
+ isSuccess: !1,
14
+ locar: null,
15
+ webcam: null,
16
+ deviceOrientation: null,
17
+ scene: null,
18
+ camera: null,
19
+ lastPosition: null,
20
+ registerAnchor: () => {},
21
+ unregisterAnchor: () => {},
22
+ getAnchor: () => void 0
23
+ }, j = () => {
24
+ let e = n((e) => e.backends).get(t.GEOLOCATION);
25
+ return e ? {
26
+ ...e.getInternal(),
27
+ isPending: !1,
28
+ isSuccess: !0
29
+ } : A;
30
+ }, M = (e) => new h(e).getHexString(), N = e((e, t) => ({
31
+ materialStore: /* @__PURE__ */ new Map(),
32
+ acquireMaterial: (n, r) => {
33
+ let i = t().materialStore.get(n);
34
+ if (i) return i.refCount++, i.material;
35
+ let a = r();
36
+ return e((e) => {
37
+ let t = new Map(e.materialStore);
38
+ return t.set(n, {
39
+ material: a,
40
+ refCount: 1
41
+ }), { materialStore: t };
42
+ }), a;
43
+ },
44
+ releaseMaterial: (n) => {
45
+ let r = t().materialStore.get(n);
46
+ return r ? (r.refCount--, r.refCount > 0 || (r.material.dispose(), e((e) => {
47
+ let t = new Map(e.materialStore);
48
+ return t.delete(n), { materialStore: t };
49
+ }), !1)) : !1;
50
+ }
51
+ })), P = (e, t) => {
52
+ let n = e.length - 1, r = [], i = 0, a = 0;
53
+ for (let o = 0; o < n; o++) {
54
+ let n = e[o + 1].x - e[o].x, s = e[o + 1].y - e[o].y, c = e[o + 1].z - e[o].z, l = Math.sqrt(n * n + s * s + c * c), u = t / 2, d = -(c * u) / l, f = n * u / l, p = o > 0 ? (d + i) / 2 : d, m = o > 0 ? (f + a) / 2 : f;
55
+ r.push(e[o].x - p, e[o].y, e[o].z - m, e[o].x + p, e[o].y, e[o].z + m), i = d, a = f;
56
+ }
57
+ r.push(e[n].x - i, e[n].y, e[n].z - a, e[n].x + i, e[n].y, e[n].z + a);
58
+ let o = [];
59
+ for (let e = 0; e < n; e++) o.push(e * 2, e * 2 + 1, e * 2 + 2), o.push(e * 2 + 1, e * 2 + 3, e * 2 + 2);
60
+ let s = new m();
61
+ return s.setIndex(o), s.setAttribute("position", new p(new Float32Array(r), 3)), s.computeBoundingBox(), s;
62
+ }, F = ({ coordinates: e, color: t = "#ff0000", isDashed: n = !1, dashSize: r = 3, gapSize: l = 1, lineWidth: u = 1, opacity: f = 1, ...p }) => {
63
+ let m = j(), h = o(m);
64
+ h.current = m;
65
+ let [_] = s(() => new v()), x = a(() => Math.random().toString(36).slice(2, 11), []), [S, C] = s(null), O = N((e) => e.acquireMaterial), k = N((e) => e.releaseMaterial);
66
+ return i(() => {
67
+ if (!m.isSuccess || e.length < 2) return;
68
+ let i = null, a = null, [o, s, c = 0] = e[0];
69
+ return h.current.registerAnchor(x, {
70
+ anchor: _,
71
+ isAttached: !1,
72
+ latitude: s,
73
+ longitude: o,
74
+ altitude: c,
75
+ onAttach: (o) => {
76
+ let [s, c, d = 0] = e[0], [p, m] = o.lonLatToWorldCoords(s, c), h = e.map(([e, t, n = 0]) => {
77
+ let [r, i] = o.lonLatToWorldCoords(e, t);
78
+ return new w(r - p, n - d, i - m);
79
+ }), _ = `${M(t)}:${f.toFixed(2)}:${n ? `${u}:1:${r}:${l}` : ":0"}`;
80
+ if (a = _, n) {
81
+ let e = new E().setFromPoints(h), n = O(_, () => new D({
82
+ color: t,
83
+ dashSize: r,
84
+ gapSize: l,
85
+ dashed: !0,
86
+ worldUnits: !0,
87
+ linewidth: u,
88
+ transparent: f < 1,
89
+ opacity: f
90
+ })), a = new T(e, n);
91
+ a.computeLineDistances(), i = a;
92
+ } else {
93
+ let e = P(h, u), n = O(_, () => new b({
94
+ color: t,
95
+ transparent: f < 1,
96
+ opacity: f,
97
+ side: g
98
+ }));
99
+ i = new y(e, n);
100
+ }
101
+ C(i);
102
+ }
103
+ }), () => {
104
+ h.current.unregisterAnchor(x), i?.geometry.dispose(), a && k(a), C(null);
105
+ };
106
+ }, [
107
+ x,
108
+ _,
109
+ e,
110
+ t,
111
+ n,
112
+ r,
113
+ l,
114
+ u,
115
+ f,
116
+ m.isSuccess
117
+ ]), c(/* @__PURE__ */ d("group", {
118
+ ...p,
119
+ children: S && /* @__PURE__ */ d("primitive", { object: S })
120
+ }), _);
121
+ }, I = ({ latitude: e, longitude: t, altitude: n = 0, isBillboard: f = !0, onAttach: p, onGpsUpdate: m, children: h }) => {
122
+ let g = j(), _ = o(g);
123
+ _.current = g;
124
+ let { camera: y } = u(), [b] = s(() => new v()), x = a(() => Math.random().toString(36).slice(2, 11), []), S = r(() => {
125
+ p?.();
126
+ }, [p]), C = r((e, t) => {
127
+ m?.(e, t);
128
+ }, [m]);
129
+ return i(() => {
130
+ if (g.isSuccess) return _.current.registerAnchor(x, {
131
+ anchor: b,
132
+ isAttached: !1,
133
+ latitude: e,
134
+ longitude: t,
135
+ altitude: n,
136
+ onAttach: S,
137
+ onGpsUpdate: C
138
+ }), () => {
139
+ _.current.unregisterAnchor(x);
140
+ };
141
+ }, [
142
+ b,
143
+ x,
144
+ e,
145
+ t,
146
+ n,
147
+ S,
148
+ C,
149
+ g.isSuccess
150
+ ]), l(() => {
151
+ f && y && g.isSuccess && g.getAnchor(x)?.isAttached && b.lookAt(y.position);
152
+ }), c(/* @__PURE__ */ d("group", { children: h }), b);
153
+ }, L = ({ options: e = {}, children: t }) => {
154
+ let { scene: r, camera: a, gl: s, size: c } = u(), { registerBackend: l, unregisterBackend: d } = n(), f = o(null), p = o(e);
155
+ return p.current = e, i(() => {
156
+ if (f.current) return;
157
+ let e = !1;
158
+ return (async () => {
159
+ try {
160
+ let t = B(p.current);
161
+ if (e) return;
162
+ await l(t, {
163
+ scene: r,
164
+ camera: a,
165
+ renderer: s,
166
+ size: c
167
+ }), f.current = t;
168
+ } catch (e) {
169
+ console.error("[GeolocationSession] Failed to initialize:", e);
170
+ }
171
+ })(), () => {
172
+ e = !0, f.current &&= (d(f.current), null);
173
+ };
174
+ }, [
175
+ r,
176
+ a,
177
+ s,
178
+ l,
179
+ d
180
+ ]), i(() => {
181
+ f.current?.setSize(c);
182
+ }, [c]), t;
183
+ }, R = {
184
+ front: _,
185
+ back: f,
186
+ double: g
187
+ }, z = ({ coordinates: e, holes: t, color: n = "#ff0000", opacity: r = 1, isWireframe: l = !1, side: u = "double", ...f }) => {
188
+ let p = j(), m = o(p);
189
+ m.current = p;
190
+ let [h] = s(() => new v()), g = a(() => Math.random().toString(36).slice(2, 11), []), [_, y] = s(null), w = N((e) => e.acquireMaterial), T = N((e) => e.releaseMaterial), [E, D] = s(null);
191
+ return i(() => {
192
+ if (!p.isSuccess || e.length < 3) return;
193
+ let i = null, a = null, [o, s, c = 0] = e[0];
194
+ return m.current.registerAnchor(g, {
195
+ anchor: h,
196
+ isAttached: !1,
197
+ latitude: s,
198
+ longitude: o,
199
+ altitude: c,
200
+ onAttach: (o) => {
201
+ let [s, c, d = 0] = e[0], [f, p] = o.lonLatToWorldCoords(s, c), m = [];
202
+ for (let [t, n, r = 0] of e) {
203
+ let [e, i] = o.lonLatToWorldCoords(t, n);
204
+ m.push({
205
+ x: e - f,
206
+ z: i - p,
207
+ elev: r - d
208
+ });
209
+ }
210
+ let h = new S();
211
+ h.moveTo(m[0].x, m[0].z);
212
+ for (let e = 1; e < m.length; e++) h.lineTo(m[e].x, m[e].z);
213
+ if (h.closePath(), t && t.length > 0) for (let e of t) {
214
+ if (e.length < 3) continue;
215
+ let t = new x(), [n, r] = e[0], [i, a] = o.lonLatToWorldCoords(n, r);
216
+ t.moveTo(i - f, a - p);
217
+ for (let n = 1; n < e.length; n++) {
218
+ let [r, i] = e[n], [a, s] = o.lonLatToWorldCoords(r, i);
219
+ t.lineTo(a - f, s - p);
220
+ }
221
+ t.closePath(), h.holes.push(t);
222
+ }
223
+ let g = new C(h);
224
+ i = g;
225
+ let _ = m.reduce((e, t) => e + t.elev, 0) / m.length;
226
+ g.rotateX(-Math.PI / 2), y({
227
+ geometry: g,
228
+ avgElevation: _
229
+ });
230
+ let v = `${M(n)}:${r.toFixed(2)}::2:${l}:${u}`;
231
+ a = v;
232
+ let T = w(v, () => new b({
233
+ color: n,
234
+ transparent: r < 1,
235
+ wireframe: l,
236
+ opacity: r,
237
+ side: R[u]
238
+ }));
239
+ D(T);
240
+ }
241
+ }), () => {
242
+ m.current.unregisterAnchor(g), i?.dispose(), a && T(a), y(null), D(null);
243
+ };
244
+ }, [
245
+ g,
246
+ h,
247
+ e,
248
+ t,
249
+ p.isSuccess,
250
+ n,
251
+ r,
252
+ u,
253
+ l
254
+ ]), c(/* @__PURE__ */ d("group", { children: _ && E && /* @__PURE__ */ d("group", {
255
+ position: [
256
+ 0,
257
+ _.avgElevation,
258
+ 0
259
+ ],
260
+ children: /* @__PURE__ */ d("mesh", {
261
+ geometry: _.geometry,
262
+ material: E,
263
+ ...f
264
+ })
265
+ }) }), h);
266
+ }, B = (e) => {
267
+ let n = null, r = null, i = null, a = null, o = null, s = null, c = null, l = {
268
+ width: 0,
269
+ height: 0
270
+ }, u = /* @__PURE__ */ new Map(), d = null, f = (e) => {
271
+ if (r && !e.isAttached) try {
272
+ r.add(e.anchor, e.longitude, e.latitude, e.altitude), e.isAttached = !0, e.onAttach?.(r);
273
+ } catch (e) {
274
+ console.error("❌ Failed to attach anchor:", e);
275
+ }
276
+ }, p = (e, t) => {
277
+ u.set(e, t), d !== null && !t.isAttached && (f(t), t.onGpsUpdate?.(d, 0));
278
+ }, m = (e) => {
279
+ let t = u.get(e);
280
+ if (t?.isAttached) try {
281
+ t.anchor.removeFromParent();
282
+ } catch (t) {
283
+ console.error(`⚠️ Error removing anchor ${e}:`, t);
284
+ }
285
+ u.delete(e);
286
+ }, h = (e) => u.get(e);
287
+ return {
288
+ type: t.GEOLOCATION,
289
+ async init(t) {
290
+ let { camera: l, renderer: p, scene: m, size: h } = t;
291
+ if (!m) throw Error("[geolocationBackend] A THREE.Scene is required for location-based AR");
292
+ a = l, o = p, s = m, c = h;
293
+ let g = a, _ = e?.hFov ?? 80;
294
+ g.fov = k.htov(_, h.width / h.height), g.updateProjectionMatrix(), n = new O({
295
+ threeObjects: {
296
+ camera: l,
297
+ renderer: p,
298
+ scene: m
299
+ },
300
+ videoConstraints: e?.webcamConstraints ?? { video: { facingMode: "environment" } },
301
+ deviceOrientationOptions: { enabled: !0 },
302
+ dimensionsProvider: () => c ? {
303
+ width: c.width,
304
+ height: c.height
305
+ } : {
306
+ width: 0,
307
+ height: 0
308
+ }
309
+ }), p.setClearAlpha?.(0), i = (t) => {
310
+ d = t.position;
311
+ for (let e of u.values()) e.isAttached || f(e), e.onGpsUpdate?.(t.position, t.distMoved);
312
+ e?.onGpsUpdate?.(t.position, t.distMoved);
313
+ }, r = await n.start(), r.on("gpsupdate", i), n.webcam?.on?.("webcamerror", (e) => {
314
+ console.error("[geolocationBackend] webcam error:", e);
315
+ }), n.deviceOrientationControls?.on?.("deviceorientationerror", (e) => {
316
+ console.error("[geolocationBackend] Device orientation error:", e);
317
+ }), r.on("gpserror", (e) => {
318
+ console.error("[geolocationBackend] gps error:", e);
319
+ }), typeof e?.fakeLat == "number" && typeof e?.fakeLon == "number" ? r.fakeGps(e.fakeLon, e.fakeLat) : r.startGps();
320
+ let v = r.getLastKnownLocation();
321
+ v !== null && (d = {
322
+ coords: {
323
+ longitude: v.longitude,
324
+ latitude: v.latitude,
325
+ accuracy: 0,
326
+ altitude: null,
327
+ altitudeAccuracy: null,
328
+ heading: null,
329
+ speed: null,
330
+ toJSON: () => v
331
+ },
332
+ timestamp: Date.now(),
333
+ toJSON: () => v
334
+ });
335
+ },
336
+ update() {
337
+ if (n?.deviceOrientationControls?.update?.(), c !== null && (c.width !== l.width || c.height !== l.height)) {
338
+ l = {
339
+ width: c.width,
340
+ height: c.height
341
+ };
342
+ let e = c.width / c.height, t = a;
343
+ t.aspect = e, t.updateProjectionMatrix(), n?.syncFovWithWebcam(e);
344
+ }
345
+ },
346
+ dispose() {
347
+ r && i && r.off("gpsupdate", i), r?.stopGps?.(), n?.webcam?.dispose?.(), o?.setClearAlpha?.(1), n?.deviceOrientationControls?.dispose?.();
348
+ for (let e of u.values()) if (e.isAttached) try {
349
+ e.anchor.removeFromParent();
350
+ } catch (e) {
351
+ console.error("⚠️ Error removing anchor:", e);
352
+ }
353
+ u.clear(), n = null, r = null, a = null, o = null, s = null, i = null, d = null;
354
+ },
355
+ setSize(e) {
356
+ c = {
357
+ width: e.width,
358
+ height: e.height,
359
+ top: 0,
360
+ left: 0
361
+ };
362
+ },
363
+ getInternal: () => ({
364
+ locar: r,
365
+ webcam: n?.webcam ?? null,
366
+ deviceOrientation: n?.deviceOrientationControls ?? null,
367
+ scene: s,
368
+ camera: a,
369
+ lastPosition: d,
370
+ registerAnchor: p,
371
+ unregisterAnchor: m,
372
+ getAnchor: h
373
+ })
374
+ };
375
+ };
376
+ export { F as a, I as i, z as n, j as o, L as r, B as t };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./geolocation-ypey8aeT.cjs`);exports.GeoLine=e.a,exports.GeoPolygon=e.n,exports.GeolocationAnchor=e.i,exports.GeolocationSession=e.r,exports.createGeolocationBackend=e.t,exports.useGeolocationBackend=e.o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./geolocation-BK0FDlmT.cjs");exports.GeoLine=e.a,exports.GeoPolygon=e.n,exports.GeolocationAnchor=e.i,exports.GeolocationSession=e.r,exports.createGeolocationBackend=e.t,exports.useGeolocationBackend=e.o;
@@ -1,2 +1 @@
1
- import { a as e, i as t, n, o as r, r as i, t as a } from "./geolocation-B7zCO7n6.js";
2
- export { e as GeoLine, n as GeoPolygon, t as GeolocationAnchor, i as GeolocationSession, a as createGeolocationBackend, r as useGeolocationBackend };
1
+ export { a as GeoLine, n as GeoPolygon, i as GeolocationAnchor, r as GeolocationSession, t as createGeolocationBackend, o as useGeolocationBackend } from "./geolocation-DmJvz9om.js";
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
2
2
  /**
3
3
  * Immersive session component for WebXR AR/VR experiences, powered by `@react-three/xr`.
4
4
  */
5
- declare const ImmersiveSession: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
+ declare const ImmersiveSession: ({ children }: PropsWithChildren) => import('react').JSX.Element;
6
6
  export default ImmersiveSession;
7
7
  //# sourceMappingURL=ImmersiveSession.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAa/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,4CAqBxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"ImmersiveSession.d.ts","sourceRoot":"","sources":["../../src/immersive/ImmersiveSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAa/C;;GAEG;AACH,QAAA,MAAM,gBAAgB,GAAI,cAAc,iBAAiB,gCAqBxD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,8 +1,8 @@
1
- import { i as e, t } from "./useXRStore-BTnI1ZM2.js";
1
+ import { i as e, t } from "./useXRStore-CrglOU9_.js";
2
2
  import { useEffect as n, useMemo as r } from "react";
3
3
  import { jsx as i } from "react/jsx-runtime";
4
4
  import { XR as a, createXRStore as o } from "@react-three/xr";
5
- //#region src/immersive/ImmersiveSession.tsx
5
+ // src/immersive/ImmersiveSession.tsx
6
6
  var s = () => ({
7
7
  type: e.IMMERSIVE,
8
8
  init: () => {},
@@ -19,5 +19,4 @@ var s = () => ({
19
19
  children: c
20
20
  });
21
21
  };
22
- //#endregion
23
22
  export { c as t };
@@ -1 +1 @@
1
- const e=require(`./useXRStore-Cf_XL0aI.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`),r=require(`@react-three/xr`);var i=()=>({type:e.i.IMMERSIVE,init:()=>{},getInternal:()=>null}),a=({children:a})=>{let o=(0,t.useMemo)(()=>(0,r.createXRStore)(),[]);return(0,t.useEffect)(()=>{let t=e.t(),n=i();return t.backends.set(e.i.IMMERSIVE,n),t.setImmersiveStore(o),()=>{t.backends.delete(e.i.IMMERSIVE),t.setImmersiveStore(null)}},[o]),(0,n.jsx)(r.XR,{store:o,children:a})};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
1
+ const e=require("./useXRStore-DfyQv43d.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@react-three/xr");var i=()=>({type:e.i.IMMERSIVE,init:()=>{},getInternal:()=>null}),a=({children:a})=>{let o=(0,t.useMemo)(()=>(0,r.createXRStore)(),[]);return(0,t.useEffect)(()=>{let t=e.t(),n=i();return t.backends.set(e.i.IMMERSIVE,n),t.setImmersiveStore(o),()=>{t.backends.delete(e.i.IMMERSIVE),t.setImmersiveStore(null)}},[o]),(0,n.jsx)(r.XR,{store:o,children:a})};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./immersive-DMYGUy_v.cjs`);exports.ImmersiveSession=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./immersive-C76xlUbB.cjs");exports.ImmersiveSession=e.t;
@@ -1,2 +1 @@
1
- import { t as e } from "./immersive-CoSRZ58s.js";
2
- export { e as ImmersiveSession };
1
+ export { t as ImmersiveSession } from "./immersive-BNYjOBFO.js";
package/build/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./useXRStore-Cf_XL0aI.cjs`),t=require(`./engine-EvzyijbY.cjs`),n=require(`./fiducial-Tris7XAY.cjs`),r=require(`./geolocation-ypey8aeT.cjs`),i=require(`./immersive-DMYGUy_v.cjs`),a=require(`./magic-B9pQnRYJ.cjs`),o=require(`./vision-BLWMU9Ys.cjs`);require(`@react-three/fiber`),exports.BACKEND_TYPES=e.i,exports.COCO_LABELS=o.c,exports.CameraBackground=o.C,exports.DEFAULT_GESTURES=o._,exports.FiducialAnchor=n.r,exports.FiducialSession=n.n,exports.GeoLine=r.a,exports.GeoPolygon=r.n,exports.GeolocationAnchor=r.i,exports.GeolocationSession=r.r,exports.HandTracker=o.f,exports.ImmersiveSession=i.t,exports.MagicSession=a.n,exports.VisionAnchor=o.o,exports.VisionDebug=o.a,exports.VisionOverlay=o.t,exports.VisionSession=o.r,exports.VisionStatus=o.n,exports.WorldAnchor=a.t,exports.XR=t.t,exports.createFiducialBackend=n.t,exports.createGeolocationBackend=r.t,exports.createMagicBackend=a.r,exports.createVisionBackend=o.i,exports.detectGesture=o.g,exports.fist=o.v,exports.getXRStore=e.t,exports.landmarkToWorld=o.m,exports.landmarksCentroid=o.h,exports.ok=o.y,exports.openHand=o.b,exports.peace=o.x,exports.rfDetr=o.l,exports.subscribeToXRStore=e.n,exports.thumbsUp=o.S,exports.useFiducialBackend=n.i,exports.useGeolocationBackend=r.o,exports.useVisionBackend=o.p,exports.useVisionFrame=o.s,exports.useXRStore=e.r,exports.yolo=o.u,exports.yoloSeg=o.d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useXRStore-DfyQv43d.cjs"),t=require("./engine-B_SO7XR5.cjs"),n=require("./fiducial-IzVogwhD.cjs"),r=require("./geolocation-BK0FDlmT.cjs"),i=require("./immersive-C76xlUbB.cjs"),a=require("./magic-BbyHQVOH.cjs"),o=require("./vision-B9EQHClV.cjs");require("@react-three/fiber"),exports.BACKEND_TYPES=e.i,exports.COCO_LABELS=o.c,exports.CameraBackground=o.C,exports.DEFAULT_GESTURES=o._,exports.FiducialAnchor=n.r,exports.FiducialSession=n.n,exports.GeoLine=r.a,exports.GeoPolygon=r.n,exports.GeolocationAnchor=r.i,exports.GeolocationSession=r.r,exports.HandTracker=o.f,exports.ImmersiveSession=i.t,exports.MagicSession=a.n,exports.VisionAnchor=o.o,exports.VisionDebug=o.a,exports.VisionOverlay=o.t,exports.VisionSession=o.r,exports.VisionStatus=o.n,exports.WorldAnchor=a.t,exports.XR=t.t,exports.createFiducialBackend=n.t,exports.createGeolocationBackend=r.t,exports.createMagicBackend=a.r,exports.createVisionBackend=o.i,exports.detectGesture=o.g,exports.fist=o.v,exports.getXRStore=e.t,exports.landmarkToWorld=o.m,exports.landmarksCentroid=o.h,exports.ok=o.y,exports.openHand=o.b,exports.peace=o.x,exports.rfDetr=o.l,exports.subscribeToXRStore=e.n,exports.thumbsUp=o.S,exports.useFiducialBackend=n.i,exports.useGeolocationBackend=r.o,exports.useVisionBackend=o.p,exports.useVisionFrame=o.s,exports.useXRStore=e.r,exports.yolo=o.u,exports.yoloSeg=o.d;
package/build/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { i as e, n as t, r as n, t as r } from "./useXRStore-BTnI1ZM2.js";
2
- import { t as i } from "./engine-NEJZ-OgD.js";
3
- import { i as a, n as o, r as s, t as c } from "./fiducial-7pF-ErgE.js";
4
- import { a as l, i as u, n as d, o as f, r as p, t as m } from "./geolocation-B7zCO7n6.js";
5
- import { t as h } from "./immersive-CoSRZ58s.js";
6
- import { n as g, r as _, t as v } from "./magic-CjnX9lWp.js";
7
- import { C as y, S as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, l as A, m as j, n as M, o as N, p as P, r as F, s as I, t as L, u as R, v as z, x as B, y as V } from "./vision-Vp2iuVNJ.js";
1
+ import { i as e, n as t, r as n, t as r } from "./useXRStore-CrglOU9_.js";
2
+ import { t as i } from "./engine-DeBLXgW-.js";
3
+ import { i as a, n as o, r as s, t as c } from "./fiducial-DUn6sFBT.js";
4
+ import { a as l, i as u, n as d, o as f, r as p, t as m } from "./geolocation-DmJvz9om.js";
5
+ import { t as h } from "./immersive-BNYjOBFO.js";
6
+ import { n as g, r as _, t as v } from "./magic-COfaC4at.js";
7
+ import { C as y, S as b, _ as x, a as S, b as C, c as w, d as T, f as E, g as D, h as O, i as k, l as A, m as j, n as M, o as N, p as P, r as F, s as I, t as L, u as R, v as z, x as B, y as V } from "./vision-1_qdyG-O.js";
8
8
  import "@react-three/fiber";
9
9
  export { e as BACKEND_TYPES, w as COCO_LABELS, y as CameraBackground, x as DEFAULT_GESTURES, s as FiducialAnchor, o as FiducialSession, l as GeoLine, d as GeoPolygon, u as GeolocationAnchor, p as GeolocationSession, E as HandTracker, h as ImmersiveSession, g as MagicSession, N as VisionAnchor, S as VisionDebug, L as VisionOverlay, F as VisionSession, M as VisionStatus, v as WorldAnchor, i as XR, c as createFiducialBackend, m as createGeolocationBackend, _ as createMagicBackend, k as createVisionBackend, D as detectGesture, z as fist, r as getXRStore, j as landmarkToWorld, O as landmarksCentroid, V as ok, C as openHand, B as peace, A as rfDetr, t as subscribeToXRStore, b as thumbsUp, a as useFiducialBackend, f as useGeolocationBackend, P as useVisionBackend, I as useVisionFrame, n as useXRStore, R as yolo, T as yoloSeg };
@@ -16,6 +16,6 @@ export interface WorldAnchorProps extends PropsWithChildren {
16
16
  * World anchor that positions children relative to the device's initial orientation.
17
17
  * Uses the magic window backend's orientation data for world-space positioning.
18
18
  */
19
- declare const WorldAnchor: ({ position, rotation, scale, isBillboard, children, }: WorldAnchorProps) => import("react/jsx-runtime").JSX.Element;
19
+ declare const WorldAnchor: ({ position, rotation, scale, isBillboard, children, }: WorldAnchorProps) => import('react').JSX.Element;
20
20
  export default WorldAnchor;
21
21
  //# sourceMappingURL=WorldAnchor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorldAnchor.d.ts","sourceRoot":"","sources":["../../src/magic/WorldAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,uDAMlB,gBAAgB,4CA0ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"WorldAnchor.d.ts","sourceRoot":"","sources":["../../src/magic/WorldAnchor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACzD,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,GAAI,uDAMlB,gBAAgB,gCA0ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ const e=require("./useXRStore-DfyQv43d.cjs");let t=require("react"),n=require("@react-three/fiber"),r=require("react/jsx-runtime"),i=require("three");i=e.o(i,1);var a=.15,o=.5,s=t=>{let n=null,r=null,s=null,c=t?.enableOrientation??!0,l=!1,u=t?.enableWorldAnchoring??!0,d=null,f=null,p=t?.smoothingFactor??a,m=t?.deadZone??o,h={alpha:0,beta:0,gamma:0},g={alpha:0,beta:0,gamma:0},_={alpha:0,beta:0,gamma:0},v=!1,y=null,b=null,x=new i.Quaternion,S=new i.Quaternion,C=new i.Euler,w=new i.Quaternion,T=new i.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),E=new i.Vector3(0,0,1),D=new i.Quaternion,O=new i.Quaternion,k=(e,t,n,r)=>{let i=(screen.orientation?.angle??0)*Math.PI/180;C.set(n,t,-r,`YXZ`),e.setFromEuler(C),e.multiply(T),e.multiply(w.setFromAxisAngle(E,-i))},A=(e,t)=>{let n=(t-e)%360+360;return n=(n+180)%360-180,n},j=(e,t,n=!1)=>Math.abs(n?A(e,t):t-e)<m?e:t,M=(e,t,n)=>e+(t-e)*n,N=(e,t,n)=>((e+A(e,t)*n)%360+360)%360,P=async()=>{let e=DeviceOrientationEvent;if(typeof e.requestPermission==`function`)try{return await e.requestPermission()===`granted`?(l=!0,!0):(console.warn(`[MagicBackend] Device orientation permission denied`),!1)}catch(e){return console.error(`[MagicBackend] Error requesting orientation permission:`,e),!1}return l=!0,!0},F=()=>{d=e=>{if(h.alpha=e.alpha??0,h.beta=e.beta??0,h.gamma=e.gamma??0,!v&&(h.alpha!==0||h.beta!==0||h.gamma!==0)){_.alpha=h.alpha,_.beta=h.beta,_.gamma=h.gamma;let{degToRad:e}=i.MathUtils;k(D,e(h.alpha),e(h.beta),e(h.gamma)),O.copy(D).invert(),v=!0}},window.addEventListener(`deviceorientation`,d,!0)},I=async(e,a)=>{let o=t?.webcamConstraints??{video:{facingMode:`environment`}};try{s=await navigator.mediaDevices.getUserMedia(o)}catch(e){throw console.error(`[MagicBackend] Failed to access camera:`,e),e}n=document.createElement(`video`),n.srcObject=s,n.setAttribute(`playsinline`,``),n.setAttribute(`autoplay`,``),n.muted=!0,n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,n.style.width=`100vw`,n.style.height=`100vh`,n.style.objectFit=`cover`,n.style.zIndex=`-1`,n.style.pointerEvents=`none`,document.body.appendChild(n),await n.play(),r=new i.VideoTexture(n),r.minFilter=i.LinearFilter,r.magFilter=i.LinearFilter,r.colorSpace=i.SRGBColorSpace,e.background=r,a.setClearColor(0,0)};return{type:e.i.MAGIC,async init({scene:e,camera:t,renderer:n}){if(y=t,b=e,await I(e,n),c){if(await P())F();else{let e=async()=>{document.removeEventListener(`click`,e),document.removeEventListener(`touchend`,e),f=null,await P()&&F()};f=e,document.addEventListener(`click`,e),document.addEventListener(`touchend`,e)}}},update(){if(!c||!l)return;let e=j(g.alpha,h.alpha,!0),t=j(g.beta,h.beta),n=j(g.gamma,h.gamma);if(g.alpha=N(g.alpha,e,p),g.beta=M(g.beta,t,p),g.gamma=M(g.gamma,n,p),u&&y&&v){let{degToRad:e}=i.MathUtils;k(x,e(h.alpha),e(h.beta),e(h.gamma)),S.copy(O).multiply(x),y.quaternion.slerp(S,p)}r&&(r.needsUpdate=!0)},dispose(){if(d&&=(window.removeEventListener(`deviceorientation`,d),null),f&&=(document.removeEventListener(`click`,f),document.removeEventListener(`touchend`,f),null),s){for(let e of s.getTracks())e.stop();s=null}n&&=(n.pause(),n.srcObject=null,n.parentNode?.removeChild(n),null),r&&=(r.dispose(),null),b&&(b.background=null),y=null,b=null,c=!1,l=!1,u=!1,v=!1,g.alpha=0,g.beta=0,g.gamma=0,h.alpha=0,h.beta=0,h.gamma=0,_.alpha=0,_.beta=0,_.gamma=0,D.identity(),O.identity()},getInternal:()=>({videoElement:n,videoTexture:r,stream:s,orientationEnabled:c,orientationPermissionGranted:l,worldAnchoringEnabled:u,currentOrientation:{...g},initialOrientation:{..._},hasInitialOrientation:v,requestOrientationPermission:async()=>{let e=await P();return e&&!d&&F(),e}})}},c=({options:r={},children:i})=>{let{scene:a,camera:o,gl:c,size:l}=(0,n.useThree)(),{registerBackend:u,unregisterBackend:d}=e.r(),f=(0,t.useRef)(null),p=(0,t.useRef)(r);return p.current=r,(0,t.useEffect)(()=>{if(f.current)return;let e=!1;return(async()=>{try{let t=s(p.current);if(e)return;await u(t,{scene:a,camera:o,renderer:c,size:l}),f.current=t}catch(e){console.error(`[MagicSession] Failed to initialize:`,e)}})(),()=>{e=!0,f.current&&=(d(f.current),null)}},[a,o,c,u,d]),i},l=({position:i=[0,0,-2],rotation:a=[0,0,0],scale:o=1,isBillboard:s=!1,children:c})=>{let l=(0,t.useRef)(null),u=e.r(e=>e.backends);return(0,n.useFrame)(({camera:t})=>{let n=l.current;if(!n)return;let r=u.get(e.i.MAGIC);r&&r.getInternal().hasInitialOrientation&&(n.position.set(i[0],i[1],i[2]),n.rotation.set(a[0],a[1],a[2]),typeof o==`number`?n.scale.setScalar(o):n.scale.set(o[0],o[1],o[2]),s&&n.lookAt(t.position))}),(0,r.jsx)(`group`,{ref:l,children:c})};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -1,9 +1,9 @@
1
- import { i as e, r as t } from "./useXRStore-BTnI1ZM2.js";
1
+ import { i as e, r as t } from "./useXRStore-CrglOU9_.js";
2
2
  import { useEffect as n, useRef as r } from "react";
3
3
  import { useFrame as i, useThree as a } from "@react-three/fiber";
4
4
  import { jsx as o } from "react/jsx-runtime";
5
5
  import * as s from "three";
6
- //#region src/magic/magicBackend.ts
6
+ // src/magic/magicBackend.ts
7
7
  var c = .15, l = .5, u = (t) => {
8
8
  let n = null, r = null, i = null, a = t?.enableOrientation ?? !0, o = !1, u = t?.enableWorldAnchoring ?? !0, d = null, f = null, p = t?.smoothingFactor ?? c, m = t?.deadZone ?? l, h = {
9
9
  alpha: 0,
@@ -51,12 +51,14 @@ var c = .15, l = .5, u = (t) => {
51
51
  return {
52
52
  type: e.MAGIC,
53
53
  async init({ scene: e, camera: t, renderer: n }) {
54
- if (y = t, b = e, await I(e, n), a) if (await P()) F();
55
- else {
56
- let e = async () => {
57
- document.removeEventListener("click", e), document.removeEventListener("touchend", e), f = null, await P() && F();
58
- };
59
- f = e, document.addEventListener("click", e), document.addEventListener("touchend", e);
54
+ if (y = t, b = e, await I(e, n), a) {
55
+ if (await P()) F();
56
+ else {
57
+ let e = async () => {
58
+ document.removeEventListener("click", e), document.removeEventListener("touchend", e), f = null, await P() && F();
59
+ };
60
+ f = e, document.addEventListener("click", e), document.addEventListener("touchend", e);
61
+ }
60
62
  }
61
63
  },
62
64
  update() {
@@ -139,5 +141,4 @@ var c = .15, l = .5, u = (t) => {
139
141
  children: l
140
142
  });
141
143
  };
142
- //#endregion
143
144
  export { d as n, u as r, f as t };
package/build/magic.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./magic-B9pQnRYJ.cjs`);exports.MagicSession=e.n,exports.WorldAnchor=e.t,exports.createMagicBackend=e.r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./magic-BbyHQVOH.cjs");exports.MagicSession=e.n,exports.WorldAnchor=e.t,exports.createMagicBackend=e.r;
package/build/magic.js CHANGED
@@ -1,2 +1 @@
1
- import { n as e, r as t, t as n } from "./magic-CjnX9lWp.js";
2
- export { e as MagicSession, n as WorldAnchor, t as createMagicBackend };
1
+ export { n as MagicSession, t as WorldAnchor, r as createMagicBackend } from "./magic-COfaC4at.js";
@@ -1,5 +1,5 @@
1
1
  import e from "react";
2
- //#region ../../node_modules/.bun/zustand@5.0.9+3efc971a6f010947/node_modules/zustand/esm/vanilla.mjs
2
+ // ../../node_modules/.bun/zustand@5.1.0+3e03dee3e8bcedfa/node_modules/zustand/esm/vanilla.mjs
3
3
  var t = (e) => {
4
4
  let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
5
5
  let i = typeof e == "function" ? e(t) : e;
@@ -16,7 +16,7 @@ var t = (e) => {
16
16
  return a;
17
17
  }, n = ((e) => e ? t(e) : t), r = (e) => e;
18
18
  function i(t, n = r) {
19
- let i = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
19
+ let i = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), () => n(t.getInitialState()));
20
20
  return e.useDebugValue(i), i;
21
21
  }
22
22
  var a = (e) => {
@@ -54,8 +54,7 @@ var a = (e) => {
54
54
  function f(e, t) {
55
55
  return Object.is(e, t) ? !0 : typeof e != "object" || !e || typeof t != "object" || !t || Object.getPrototypeOf(e) !== Object.getPrototypeOf(t) ? !1 : c(e) && c(t) ? l(e) && l(t) ? u(e, t) : d(e, t) : u({ entries: () => Object.entries(e) }, { entries: () => Object.entries(t) });
56
56
  }
57
- //#endregion
58
- //#region ../../node_modules/.bun/zustand@5.0.9+3efc971a6f010947/node_modules/zustand/esm/react/shallow.mjs
57
+ // ../../node_modules/.bun/zustand@5.1.0+3e03dee3e8bcedfa/node_modules/zustand/esm/react/shallow.mjs
59
58
  function p(t) {
60
59
  let n = e.useRef(void 0);
61
60
  return (e) => {
@@ -63,8 +62,7 @@ function p(t) {
63
62
  return f(n.current, r) ? n.current : n.current = r;
64
63
  };
65
64
  }
66
- //#endregion
67
- //#region src/lib/types/engine/backend/Backend.interface.ts
65
+ // src/lib/types/engine/backend/Backend.interface.ts
68
66
  var m = {
69
67
  FIDUCIAL: "fiducial",
70
68
  GEOLOCATION: "geolocation",
@@ -129,5 +127,4 @@ var m = {
129
127
  };
130
128
  return e ? e(n) : n;
131
129
  }));
132
- //#endregion
133
- export { m as i, _ as n, v as r, g as t };
130
+ export { o as a, m as i, _ as n, v as r, g as t };
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);var l=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},u=(e=>e?l(e):l),d=e=>e;function f(e,t=d){let n=c.default.useSyncExternalStore(e.subscribe,c.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return c.default.useDebugValue(n),n}var p=e=>{let t=u(e),n=e=>f(t,e);return Object.assign(n,t),n},m=(e=>e?p(e):p),h=e=>(t,n,r)=>{let i=r.subscribe;return r.subscribe=((e,t,n)=>{let a=e;if(t){let i=n?.equalityFn||Object.is,o=e(r.getState());a=n=>{let r=e(n);if(!i(o,r)){let e=o;t(o=r,e)}},n?.fireImmediately&&t(o,o)}return i(a)}),e(t,n,r)},g=e=>Symbol.iterator in e,_=e=>`entries`in e,v=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},y=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function b(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:g(e)&&g(t)?_(e)&&_(t)?v(e,t):y(e,t):v({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function x(e){let t=c.default.useRef(void 0);return n=>{let r=e(n);return b(t.current,r)?t.current:t.current=r}}var S={FIDUCIAL:`fiducial`,GEOLOCATION:`geolocation`,IMMERSIVE:`immersive`,MAGIC:`magic`,VISION:`vision`},C=m()(h((e,t)=>({video:null,backends:new Map,immersiveStore:null,registerBackend:async(n,r)=>{try{let i=t(),a=new Set(i.backends.keys()),o=a.has(S.FIDUCIAL)||n.type===S.FIDUCIAL,s=a.has(S.GEOLOCATION)||n.type===S.GEOLOCATION;if(o&&s){let e=`❌ [RDK] INCOMPATIBLE SESSIONS: fiducial and geolocation backends cannot be used together due to camera/video conflicts between AR.js and LocAR.js libraries. Use only one session type per app.`;throw console.error(e),Error(e)}await n.init({scene:r.scene,camera:r.camera,renderer:r.renderer,size:r.size}),e(e=>{let t=new Map(e.backends);return t.set(n.type,n),{backends:t}})}catch(e){throw console.error(`[XRStore] Failed to register backend:`,e),e}},unregisterBackend:t=>{e(e=>{let n=new Map(e.backends);n.delete(t.type);try{t.dispose?.()}catch(e){console.error(`[XRStore] Error disposing backend:`,e)}return{backends:n}})},setVideo:t=>{e({video:t})},updateBackends:e=>{let{backends:n}=t();for(let t of n.values())try{t.update?.(e)}catch(e){console.error(`[XRStore] Backend update error:`,e)}},setImmersiveStore:t=>{e({immersiveStore:t})}}))),w=()=>C.getState(),T=C.subscribe,E=e=>C(x(t=>{let n={...t,isImmersive:t.backends.has(S.IMMERSIVE),immersive:t.immersiveStore||null};return e?e(n):n}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}});
@@ -18,6 +18,6 @@ export type HandTrackerProps = {
18
18
  * the render loop (no per-frame React state). Renders inside an R3F Canvas
19
19
  * (e.g. as a child of `VisionOverlay`).
20
20
  */
21
- declare const HandTracker: ({ onHandMove, onGesture, landmarkIndex, mirror, children, }: HandTrackerProps) => import("react/jsx-runtime").JSX.Element;
21
+ declare const HandTracker: ({ onHandMove, onGesture, landmarkIndex, mirror, children, }: HandTrackerProps) => import('react').JSX.Element;
22
22
  export default HandTracker;
23
23
  //# sourceMappingURL=HandTracker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HandTracker.d.ts","sourceRoot":"","sources":["../../src/vision/HandTracker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,GAAI,6DAMlB,gBAAgB,4CAwClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"HandTracker.d.ts","sourceRoot":"","sources":["../../src/vision/HandTracker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,GAAI,6DAMlB,gBAAgB,gCAwClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -23,6 +23,6 @@ export type VisionAnchorProps = {
23
23
  * markers use a single instanced mesh). Renders inside an R3F Canvas (e.g. as a
24
24
  * child of `VisionOverlay`).
25
25
  */
26
- declare const VisionAnchor: ({ task, index, debug, mirror, smoothing, children, }: VisionAnchorProps) => import("react/jsx-runtime").JSX.Element;
26
+ declare const VisionAnchor: ({ task, index, debug, mirror, smoothing, children, }: VisionAnchorProps) => import('react').JSX.Element;
27
27
  export default VisionAnchor;
28
28
  //# sourceMappingURL=VisionAnchor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"VisionAnchor.d.ts","sourceRoot":"","sources":["../../src/vision/VisionAnchor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAWF;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,GAAI,sDAOnB,iBAAiB,4CAyFnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"VisionAnchor.d.ts","sourceRoot":"","sources":["../../src/vision/VisionAnchor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAWF;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,GAAI,sDAOnB,iBAAiB,gCAyFnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"VisionSession.d.ts","sourceRoot":"","sources":["../../src/vision/VisionSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mCAAmC;IACnC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAyD/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"VisionSession.d.ts","sourceRoot":"","sources":["../../src/vision/VisionSession.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,mCAAmC;IACnC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA2D/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -9,14 +9,20 @@ declare class MediaPipeProvider implements VisionProvider {
9
9
  private animationId;
10
10
  private lastProcessTime;
11
11
  private callbacks;
12
+ private errorCallbacks;
12
13
  private options;
13
14
  constructor(options: VisionSessionOptions);
14
15
  initialize(video: HTMLVideoElement): Promise<void>;
15
16
  startDetection(): void;
16
17
  stopDetection(): void;
17
18
  onDetection(callback: (frame: VisionFrame) => void): () => void;
19
+ onError(callback: (error: Error) => void): () => void;
18
20
  dispose(): void;
19
21
  private processFrame;
22
+ /**
23
+ * Stop detection for good and notify error subscribers.
24
+ */
25
+ private fail;
20
26
  private handleResult;
21
27
  }
22
28
  export default MediaPipeProvider;