@wandelbots/wandelbots-js-react-components 3.1.1 → 3.2.0-pr.feat-improve-exports.414.40b4b4e

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 (87) hide show
  1. package/README.md +79 -2
  2. package/dist/3d.cjs.js +2 -0
  3. package/dist/3d.cjs.js.map +1 -0
  4. package/dist/3d.d.ts +11 -0
  5. package/dist/3d.d.ts.map +1 -0
  6. package/dist/3d.es.js +16 -0
  7. package/dist/3d.es.js.map +1 -0
  8. package/dist/PoseJointValues-C3bsJdfd.js +5446 -0
  9. package/dist/PoseJointValues-C3bsJdfd.js.map +1 -0
  10. package/dist/PoseJointValues-wLOjcYDe.cjs +21 -0
  11. package/dist/PoseJointValues-wLOjcYDe.cjs.map +1 -0
  12. package/dist/ProgramStateIndicator-CTT-CAcJ.js +268 -0
  13. package/dist/ProgramStateIndicator-CTT-CAcJ.js.map +1 -0
  14. package/dist/ProgramStateIndicator-DYKBcj1s.cjs +2 -0
  15. package/dist/ProgramStateIndicator-DYKBcj1s.cjs.map +1 -0
  16. package/dist/VelocitySlider-2Zme2MN7.cjs +5 -0
  17. package/dist/VelocitySlider-2Zme2MN7.cjs.map +1 -0
  18. package/dist/VelocitySlider-QSg_8eb1.js +1906 -0
  19. package/dist/VelocitySlider-QSg_8eb1.js.map +1 -0
  20. package/dist/components/jogging/JoggingStore.d.ts +1 -1
  21. package/dist/core.cjs.js +2 -0
  22. package/dist/core.cjs.js.map +1 -0
  23. package/dist/core.d.ts +23 -0
  24. package/dist/core.d.ts.map +1 -0
  25. package/dist/core.es.js +46 -0
  26. package/dist/core.es.js.map +1 -0
  27. package/dist/createSvgIcon-BG4_bQuX.cjs +56 -0
  28. package/dist/createSvgIcon-BG4_bQuX.cjs.map +1 -0
  29. package/dist/createSvgIcon-D3GRPlVu.js +3072 -0
  30. package/dist/createSvgIcon-D3GRPlVu.js.map +1 -0
  31. package/dist/data.cjs.js +2 -0
  32. package/dist/data.cjs.js.map +1 -0
  33. package/dist/data.d.ts +4 -0
  34. package/dist/data.d.ts.map +1 -0
  35. package/dist/data.es.js +7 -0
  36. package/dist/data.es.js.map +1 -0
  37. package/dist/externalizeComponent-C12Qf79R.cjs +24 -0
  38. package/dist/externalizeComponent-C12Qf79R.cjs.map +1 -0
  39. package/dist/externalizeComponent-RpcZ_G17.js +491 -0
  40. package/dist/externalizeComponent-RpcZ_G17.js.map +1 -0
  41. package/dist/index-8UEqiXug.cjs +7 -0
  42. package/dist/index-8UEqiXug.cjs.map +1 -0
  43. package/dist/index-CQDi5W62.cjs +2 -0
  44. package/dist/index-CQDi5W62.cjs.map +1 -0
  45. package/dist/index-DSz82V23.js +1801 -0
  46. package/dist/index-DSz82V23.js.map +1 -0
  47. package/dist/index-DZubFUuo.js +4909 -0
  48. package/dist/index-DZubFUuo.js.map +1 -0
  49. package/dist/index-MyU3fVEK.cjs +50 -0
  50. package/dist/index-MyU3fVEK.cjs.map +1 -0
  51. package/dist/index-VURe0U2S.js +9443 -0
  52. package/dist/index-VURe0U2S.js.map +1 -0
  53. package/dist/index.cjs.js +2 -0
  54. package/dist/index.cjs.js.map +1 -0
  55. package/dist/index.es.js +72 -0
  56. package/dist/index.es.js.map +1 -0
  57. package/dist/interpolation-CVSmVNjc.cjs +2 -0
  58. package/dist/interpolation-CVSmVNjc.cjs.map +1 -0
  59. package/dist/interpolation-DjBX_Si-.js +138 -0
  60. package/dist/interpolation-DjBX_Si-.js.map +1 -0
  61. package/dist/jogging.cjs.js +2 -0
  62. package/dist/jogging.cjs.js.map +1 -0
  63. package/dist/jogging.d.ts +9 -0
  64. package/dist/jogging.d.ts.map +1 -0
  65. package/dist/jogging.es.js +12 -0
  66. package/dist/jogging.es.js.map +1 -0
  67. package/dist/manufacturerHomePositions-DHqcbFON.js +979 -0
  68. package/dist/manufacturerHomePositions-DHqcbFON.js.map +1 -0
  69. package/dist/manufacturerHomePositions-zd-CKEiQ.cjs +2 -0
  70. package/dist/manufacturerHomePositions-zd-CKEiQ.cjs.map +1 -0
  71. package/dist/theming-BO8z_Hpa.js +2198 -0
  72. package/dist/theming-BO8z_Hpa.js.map +1 -0
  73. package/dist/theming-D5DvGuxX.cjs +4 -0
  74. package/dist/theming-D5DvGuxX.cjs.map +1 -0
  75. package/dist/useThemeProps-P648Ox74.cjs +2 -0
  76. package/dist/useThemeProps-P648Ox74.cjs.map +1 -0
  77. package/dist/useThemeProps-jE_Qg6SI.js +40 -0
  78. package/dist/useThemeProps-jE_Qg6SI.js.map +1 -0
  79. package/package.json +24 -3
  80. package/src/3d.ts +15 -0
  81. package/src/core.ts +23 -0
  82. package/src/data.ts +4 -0
  83. package/src/jogging.ts +9 -0
  84. package/dist/index.cjs +0 -155
  85. package/dist/index.cjs.map +0 -1
  86. package/dist/index.js +0 -30530
  87. package/dist/index.js.map +0 -1
@@ -0,0 +1,979 @@
1
+ import { j as t, e as q } from "./externalizeComponent-RpcZ_G17.js";
2
+ import * as d from "three";
3
+ import { Matrix4 as G, Vector3 as L, Quaternion as ie } from "three";
4
+ import { ConvexGeometry as X } from "three-stdlib";
5
+ import { useThree as ae, useFrame as le, Canvas as W } from "@react-three/fiber";
6
+ import { Environment as ce, Lightformer as v, Line as Z, useGLTF as ue, Bounds as $ } from "@react-three/drei";
7
+ import { useTheme as fe, Card as de, Box as y, Typography as B, Divider as H, Button as U } from "@mui/material";
8
+ import { observer as he } from "mobx-react-lite";
9
+ import me, { useRef as R, useEffect as T, useCallback as _, useState as C, Suspense as pe } from "react";
10
+ import { useTranslation as xe } from "react-i18next";
11
+ import { b as J } from "./ProgramStateIndicator-CTT-CAcJ.js";
12
+ import { a as ge } from "./index-DSz82V23.js";
13
+ import { V as ye } from "./interpolation-DjBX_Si-.js";
14
+ import { ErrorBoundary as je } from "react-error-boundary";
15
+ import { M as j } from "./index-DZubFUuo.js";
16
+ function we(e) {
17
+ switch (e.shape_type) {
18
+ case "convex_hull":
19
+ return new X(
20
+ e.vertices.map(
21
+ (r) => new d.Vector3(
22
+ r[0] / 1e3,
23
+ r[1] / 1e3,
24
+ r[2] / 1e3
25
+ )
26
+ )
27
+ );
28
+ case "box":
29
+ return new d.BoxGeometry(
30
+ e.size_x / 1e3,
31
+ e.size_y / 1e3,
32
+ e.size_z / 1e3
33
+ );
34
+ case "sphere":
35
+ return new d.SphereGeometry(e.radius / 1e3);
36
+ case "capsule":
37
+ return new d.CapsuleGeometry(
38
+ e.radius / 1e3,
39
+ e.cylinder_height / 1e3
40
+ );
41
+ case "cylinder":
42
+ return new d.CylinderGeometry(
43
+ e.radius / 1e3,
44
+ e.radius / 1e3,
45
+ e.height / 1e3
46
+ );
47
+ case "rectangle":
48
+ return new d.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
49
+ default:
50
+ return console.warn(`${e.shape_type} is not supported`), new d.BufferGeometry();
51
+ }
52
+ }
53
+ function be({
54
+ name: e,
55
+ collider: n,
56
+ children: r
57
+ }) {
58
+ var u, l;
59
+ const s = ((u = n.pose) == null ? void 0 : u.position) ?? [0, 0, 0], o = ((l = n.pose) == null ? void 0 : l.orientation) ?? [0, 0, 0];
60
+ return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
61
+ "mesh",
62
+ {
63
+ name: e,
64
+ position: new d.Vector3(
65
+ s[0],
66
+ s[1],
67
+ s[2]
68
+ ).divideScalar(1e3),
69
+ rotation: new d.Euler(o[0], o[1], o[2], "XYZ"),
70
+ geometry: we(n.shape),
71
+ children: r
72
+ }
73
+ );
74
+ }
75
+ function Me({
76
+ name: e,
77
+ colliders: n,
78
+ meshChildrenProvider: r,
79
+ ...s
80
+ }) {
81
+ return /* @__PURE__ */ t.jsx("group", { name: e, ...s, children: Object.entries(n).map(([o, u]) => /* @__PURE__ */ t.jsx(
82
+ be,
83
+ {
84
+ name: o,
85
+ collider: u,
86
+ children: r(o, u)
87
+ },
88
+ o
89
+ )) });
90
+ }
91
+ function et({
92
+ scene: e,
93
+ meshChildrenProvider: n
94
+ }) {
95
+ const r = e.colliders;
96
+ return /* @__PURE__ */ t.jsx("group", { children: r && /* @__PURE__ */ t.jsx(
97
+ Me,
98
+ {
99
+ meshChildrenProvider: n,
100
+ colliders: r
101
+ }
102
+ ) });
103
+ }
104
+ function N() {
105
+ return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(ve, {}) });
106
+ }
107
+ function ve({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
108
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
109
+ /* @__PURE__ */ t.jsx(
110
+ v,
111
+ {
112
+ intensity: 5,
113
+ "rotation-x": Math.PI / 2,
114
+ position: [0, 5, -9],
115
+ scale: [10, 10, 1]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((n, r) => /* @__PURE__ */ t.jsx(
119
+ v,
120
+ {
121
+ form: "circle",
122
+ intensity: 5,
123
+ rotation: [Math.PI / 2, 0, 0],
124
+ position: [n, 4, r * 4],
125
+ scale: [3, 1, 1]
126
+ },
127
+ r
128
+ )) }) }),
129
+ /* @__PURE__ */ t.jsx(
130
+ v,
131
+ {
132
+ intensity: 40,
133
+ "rotation-y": Math.PI / 2,
134
+ position: [-5, 1, -1],
135
+ scale: [20, 0.1, 1]
136
+ }
137
+ ),
138
+ /* @__PURE__ */ t.jsx(
139
+ v,
140
+ {
141
+ intensity: 20,
142
+ "rotation-y": -Math.PI,
143
+ position: [-5, -2, -1],
144
+ scale: [20, 0.1, 1]
145
+ }
146
+ ),
147
+ /* @__PURE__ */ t.jsx(
148
+ v,
149
+ {
150
+ "rotation-y": Math.PI / 2,
151
+ position: [-5, -1, -1],
152
+ scale: [20, 0.5, 1],
153
+ intensity: 5
154
+ }
155
+ ),
156
+ /* @__PURE__ */ t.jsx(
157
+ v,
158
+ {
159
+ "rotation-y": -Math.PI / 2,
160
+ position: [10, 1, 0],
161
+ scale: [20, 1, 1],
162
+ intensity: 10
163
+ }
164
+ ),
165
+ /* @__PURE__ */ t.jsx(
166
+ v,
167
+ {
168
+ form: "ring",
169
+ color: "white",
170
+ intensity: 5,
171
+ scale: 10,
172
+ position: [-15, 4, -18],
173
+ target: [0, 0, 0]
174
+ }
175
+ )
176
+ ] });
177
+ }
178
+ function Re(e) {
179
+ if (e.length < 3)
180
+ return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
181
+ const n = new d.Vector3(e[0].x, e[0].y, e[0].z), r = new d.Vector3(e[1].x, e[1].y, e[1].z), s = new d.Vector3(e[2].x, e[2].y, e[2].z), o = new d.Vector3().subVectors(r, n), u = new d.Vector3().subVectors(s, n), l = new d.Vector3().crossVectors(o, u).normalize();
182
+ for (let a = 3; a < e.length; a++) {
183
+ const p = new d.Vector3(e[a].x, e[a].y, e[a].z), h = new d.Vector3().subVectors(p, n), f = l.dot(h);
184
+ if (Math.abs(f) > 1e-6)
185
+ return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
186
+ }
187
+ return { isCoplanar: !0, normal: l };
188
+ }
189
+ function tt({
190
+ safetyZones: e,
191
+ ...n
192
+ }) {
193
+ return /* @__PURE__ */ t.jsx("group", { ...n, children: e.map((r, s) => {
194
+ let o = [];
195
+ return r.geometry && (r.geometry.compound ? o = r.geometry.compound.child_geometries : r.geometry.convex_hull && (o = [r.geometry])), o.map((u, l) => {
196
+ if (!u.convex_hull) return null;
197
+ const a = u.convex_hull.vertices.map(
198
+ (f) => new d.Vector3(f.x / 1e3, f.y / 1e3, f.z / 1e3)
199
+ ), p = Re(a);
200
+ if (p.isCoplanar && p.normal) {
201
+ const i = new d.Vector3().addVectors(
202
+ a[0],
203
+ p.normal.multiplyScalar(1e-4)
204
+ );
205
+ a.push(i);
206
+ }
207
+ let h;
208
+ try {
209
+ h = new X(a);
210
+ } catch (f) {
211
+ return console.log("Error creating ConvexGeometry:", f), null;
212
+ }
213
+ return /* @__PURE__ */ t.jsx("mesh", { geometry: h, children: /* @__PURE__ */ t.jsx(
214
+ "meshStandardMaterial",
215
+ {
216
+ attach: "material",
217
+ color: "#009f4d",
218
+ opacity: 0.2,
219
+ depthTest: !1,
220
+ depthWrite: !1,
221
+ transparent: !0,
222
+ polygonOffset: !0,
223
+ polygonOffsetFactor: -l
224
+ },
225
+ s
226
+ ) }, `${s}-${l}`);
227
+ });
228
+ }) });
229
+ }
230
+ function rt({
231
+ trajectory: e,
232
+ ...n
233
+ }) {
234
+ var s;
235
+ const r = ((s = e.trajectory) == null ? void 0 : s.map((o) => o.tcp_pose ? new d.Vector3(
236
+ o.tcp_pose.position.x / 1e3,
237
+ o.tcp_pose.position.z / 1e3,
238
+ -o.tcp_pose.position.y / 1e3
239
+ ) : null).filter((o) => o !== null)) || [];
240
+ return /* @__PURE__ */ t.jsx("group", { ...n, children: r.length > 0 && /* @__PURE__ */ t.jsx(
241
+ Z,
242
+ {
243
+ points: r,
244
+ lineWidth: 3,
245
+ polygonOffset: !0,
246
+ polygonOffsetFactor: 10,
247
+ polygonOffsetUnits: 10
248
+ }
249
+ ) });
250
+ }
251
+ const Y = "0.0.0-semantically-released";
252
+ function Q(e) {
253
+ let n = Y;
254
+ return Y.startsWith("0.") && (n = ""), `https://cdn.jsdelivr.net/gh/wandelbotsgmbh/wandelbots-js-react-components${n ? `@${n}` : ""}/public/models/${e}.glb`;
255
+ }
256
+ function _e(e) {
257
+ function n(r) {
258
+ return r.children.length === 0 ? [r] : [r, ...r.children.flatMap((s) => n(s))];
259
+ }
260
+ return n(e).filter((r) => te(r));
261
+ }
262
+ function ee(e) {
263
+ return e.name.endsWith("_FLG");
264
+ }
265
+ function te(e) {
266
+ return /_J[0-9]+$/.test(e.name);
267
+ }
268
+ function Ge(e, n) {
269
+ let r;
270
+ function s(o) {
271
+ if (ee(o)) {
272
+ if (r)
273
+ throw Error(
274
+ `Found multiple flange groups in robot model ${n}; first ${r.name} then ${o.name}. Only one _FLG group is allowed.`
275
+ );
276
+ r = o;
277
+ }
278
+ te(o), o.children.map(s);
279
+ }
280
+ if (s(e.scene), !r)
281
+ throw Error(
282
+ `No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
283
+ );
284
+ return { gltf: e };
285
+ }
286
+ function re({
287
+ rapidlyChangingMotionState: e,
288
+ dhParameters: n,
289
+ onRotationChanged: r,
290
+ children: s
291
+ }) {
292
+ const o = R([]), u = R([]), l = R(null), { invalidate: a } = ae();
293
+ T(() => {
294
+ const i = e.joint_position.filter(
295
+ (c) => c !== void 0
296
+ );
297
+ return l.current = new ye(i, {
298
+ tension: 120,
299
+ // Controls spring stiffness - higher values create faster, more responsive motion
300
+ friction: 20,
301
+ // Controls damping - higher values reduce oscillation and create smoother settling
302
+ threshold: 1e-3
303
+ }), () => {
304
+ var c;
305
+ (c = l.current) == null || c.destroy();
306
+ };
307
+ }, []), le((i, c) => {
308
+ if (l.current) {
309
+ const m = l.current.update(c);
310
+ f(), m || a();
311
+ }
312
+ });
313
+ function p(i) {
314
+ i && (u.current = _e(i), f(), a());
315
+ }
316
+ function h(i) {
317
+ var c;
318
+ o.current = i, (c = l.current) == null || c.setTarget(i);
319
+ }
320
+ function f() {
321
+ var c;
322
+ const i = ((c = l.current) == null ? void 0 : c.getCurrentValues()) || [];
323
+ if (r)
324
+ r(u.current, i);
325
+ else
326
+ for (const [m, x] of u.current.entries()) {
327
+ const g = n[m], b = g.theta || 0, M = g.reverse_rotation_direction ? -1 : 1;
328
+ x.rotation.y = M * (i[m] || 0) + b;
329
+ }
330
+ }
331
+ return ge(() => {
332
+ const i = e.joint_position.filter(
333
+ (c) => c !== void 0
334
+ );
335
+ requestAnimationFrame(() => h(i));
336
+ }), /* @__PURE__ */ t.jsx("group", { ref: p, children: s });
337
+ }
338
+ const Ce = "line", Fe = "mesh";
339
+ function Ie({
340
+ rapidlyChangingMotionState: e,
341
+ dhParameters: n,
342
+ ...r
343
+ }) {
344
+ const s = new G(), o = R([]), u = R([]);
345
+ me.useEffect(() => {
346
+ o.current = new Array(n.length).fill(null), u.current = new Array(n.length).fill(null);
347
+ }, [n.length]);
348
+ function l(h, f) {
349
+ const i = new L(), c = new ie(), m = new L();
350
+ s.decompose(i, c, m);
351
+ const x = i.clone(), g = new G().makeRotationY(
352
+ h.theta + f * (h.reverse_rotation_direction ? -1 : 1)
353
+ ).multiply(new G().makeTranslation(0, h.d / 1e3, 0)).multiply(new G().makeTranslation(h.a / 1e3, 0, 0)).multiply(new G().makeRotationX(h.alpha));
354
+ return s.multiply(g), s.decompose(i, c, m), { a: x, b: i };
355
+ }
356
+ function a(h, f, i, c) {
357
+ if (!n)
358
+ return;
359
+ const m = n[h];
360
+ if (!m)
361
+ return;
362
+ const { a: x, b: g } = l(m, c);
363
+ f.geometry.setPositions([x.toArray(), g.toArray()].flat()), i.position.set(g.x, g.y, g.z);
364
+ }
365
+ function p(h, f) {
366
+ s.identity();
367
+ for (let i = 0; i < Math.min(h.length, f.length); i++) {
368
+ const c = o.current[i], m = u.current[i];
369
+ c && m && a(i, c, m, f[i]);
370
+ }
371
+ }
372
+ return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
373
+ re,
374
+ {
375
+ rapidlyChangingMotionState: e,
376
+ dhParameters: n,
377
+ onRotationChanged: p,
378
+ children: /* @__PURE__ */ t.jsxs("group", { ...r, name: "Scene", children: [
379
+ /* @__PURE__ */ t.jsxs("mesh", { children: [
380
+ /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
381
+ /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
382
+ ] }),
383
+ n.map((h, f) => {
384
+ const { a: i, b: c } = l(
385
+ h,
386
+ e.joint_position[f] ?? 0
387
+ ), m = `dhrobot_J0${f}`;
388
+ return /* @__PURE__ */ t.jsxs("group", { name: m, children: [
389
+ /* @__PURE__ */ t.jsx(
390
+ Z,
391
+ {
392
+ ref: (x) => {
393
+ o.current[f] = x;
394
+ },
395
+ name: Ce,
396
+ points: [i, c],
397
+ color: "white",
398
+ lineWidth: 5
399
+ }
400
+ ),
401
+ /* @__PURE__ */ t.jsxs(
402
+ "mesh",
403
+ {
404
+ ref: (x) => {
405
+ u.current[f] = x;
406
+ },
407
+ name: Fe,
408
+ position: c,
409
+ children: [
410
+ /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
411
+ /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
412
+ ]
413
+ },
414
+ "mesh_" + f
415
+ )
416
+ ] }, m);
417
+ })
418
+ ] })
419
+ }
420
+ ) });
421
+ }
422
+ const Se = console.warn;
423
+ function Ve() {
424
+ return T(() => {
425
+ console.warn = (e) => {
426
+ e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Se(e);
427
+ };
428
+ }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
429
+ }
430
+ function De(e) {
431
+ return e.type === "Mesh";
432
+ }
433
+ function Te({
434
+ modelURL: e,
435
+ flangeRef: n,
436
+ postModelRender: r,
437
+ ...s
438
+ }) {
439
+ const { gltf: o } = Ge(
440
+ ue(e),
441
+ e.split("/").pop() || e
442
+ ), u = _(
443
+ (a) => {
444
+ a && r && r();
445
+ },
446
+ [e]
447
+ );
448
+ function l(a) {
449
+ return De(a) ? /* @__PURE__ */ t.jsx(
450
+ "mesh",
451
+ {
452
+ name: a.name,
453
+ geometry: a.geometry,
454
+ material: a.material,
455
+ position: a.position,
456
+ rotation: a.rotation
457
+ },
458
+ a.uuid
459
+ ) : /* @__PURE__ */ t.jsx(
460
+ "group",
461
+ {
462
+ name: a.name,
463
+ position: a.position,
464
+ rotation: a.rotation,
465
+ ref: ee(a) ? n : void 0,
466
+ children: a.children.map(l)
467
+ },
468
+ a.uuid
469
+ );
470
+ }
471
+ return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: u, children: l(o.scene) });
472
+ }
473
+ const Ae = (e, n) => {
474
+ e.userData.isGhost || (e.traverse((r) => {
475
+ if (r instanceof d.Mesh) {
476
+ r.material instanceof d.Material && (r.material.colorWrite = !1);
477
+ const s = r.clone(), o = r.clone();
478
+ s.material = new d.MeshStandardMaterial({
479
+ depthTest: !0,
480
+ depthWrite: !0,
481
+ colorWrite: !1,
482
+ polygonOffset: !0,
483
+ polygonOffsetFactor: -1,
484
+ side: d.DoubleSide
485
+ }), s.userData.isGhost = !0, o.material = new d.MeshStandardMaterial({
486
+ color: n,
487
+ opacity: 0.3,
488
+ depthTest: !0,
489
+ depthWrite: !1,
490
+ transparent: !0,
491
+ polygonOffset: !0,
492
+ polygonOffsetFactor: -2,
493
+ side: d.DoubleSide
494
+ }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
495
+ }
496
+ }), e.userData.isGhost = !0);
497
+ }, ke = (e) => {
498
+ if (!e.userData.isGhost) return;
499
+ const n = [];
500
+ e.traverse((r) => {
501
+ var s;
502
+ r instanceof d.Mesh && ((s = r.userData) != null && s.isGhost ? n.push(r) : r.material instanceof d.Material && (r.material.colorWrite = !0));
503
+ }), n.forEach((r) => {
504
+ r.parent && r.parent.remove(r);
505
+ }), e.userData.isGhost = !1;
506
+ }, ze = q(
507
+ ({
508
+ rapidlyChangingMotionState: e,
509
+ modelFromController: n,
510
+ dhParameters: r,
511
+ getModel: s = Q,
512
+ flangeRef: o,
513
+ postModelRender: u,
514
+ transparentColor: l,
515
+ ...a
516
+ }) => {
517
+ const [p, h] = C(null), f = _((c) => {
518
+ h(c);
519
+ }, []);
520
+ T(() => {
521
+ p && (l ? Ae(p, l) : ke(p));
522
+ }, [p, l]);
523
+ const i = /* @__PURE__ */ t.jsx(
524
+ Ie,
525
+ {
526
+ rapidlyChangingMotionState: e,
527
+ dhParameters: r,
528
+ ...a
529
+ }
530
+ );
531
+ return /* @__PURE__ */ t.jsxs(
532
+ je,
533
+ {
534
+ fallback: i,
535
+ onError: (c) => {
536
+ console.error(c);
537
+ },
538
+ children: [
539
+ /* @__PURE__ */ t.jsx(pe, { fallback: i, children: /* @__PURE__ */ t.jsx("group", { ref: f, children: /* @__PURE__ */ t.jsx(
540
+ re,
541
+ {
542
+ rapidlyChangingMotionState: e,
543
+ dhParameters: r,
544
+ children: /* @__PURE__ */ t.jsx(
545
+ Te,
546
+ {
547
+ modelURL: s(n),
548
+ postModelRender: u,
549
+ flangeRef: o,
550
+ ...a
551
+ }
552
+ )
553
+ }
554
+ ) }) }),
555
+ /* @__PURE__ */ t.jsx(Ve, {})
556
+ ]
557
+ }
558
+ );
559
+ }
560
+ );
561
+ function Pe({
562
+ connectedMotionGroup: e,
563
+ getModel: n = Q,
564
+ flangeRef: r,
565
+ transparentColor: s,
566
+ postModelRender: o,
567
+ ...u
568
+ }) {
569
+ return e.dhParameters ? /* @__PURE__ */ t.jsx(
570
+ ze,
571
+ {
572
+ rapidlyChangingMotionState: e.rapidlyChangingMotionState,
573
+ modelFromController: e.modelFromController || "",
574
+ dhParameters: e.dhParameters,
575
+ getModel: n,
576
+ flangeRef: r,
577
+ transparentColor: s,
578
+ postModelRender: o,
579
+ ...u
580
+ }
581
+ ) : null;
582
+ }
583
+ const nt = q(
584
+ he(
585
+ ({
586
+ robotName: e,
587
+ programState: n,
588
+ safetyState: r,
589
+ operationMode: s,
590
+ driveToHomeEnabled: o = !1,
591
+ onDriveToHomePress: u,
592
+ onDriveToHomeRelease: l,
593
+ connectedMotionGroup: a,
594
+ robotComponent: p = Pe,
595
+ customContentComponent: h,
596
+ className: f
597
+ }) => {
598
+ var z;
599
+ const i = fe(), { t: c } = xe(), [m, x] = C(!1), g = R(null), b = R(null), [M, ne] = C(!1), [F, oe] = C({ width: 400, height: 600 }), [Ee, se] = C(0);
600
+ T(() => {
601
+ const D = () => {
602
+ if (b.current) {
603
+ const { offsetWidth: O, offsetHeight: E } = b.current;
604
+ ne(O > E), oe({ width: O, height: E });
605
+ }
606
+ };
607
+ D();
608
+ const P = new ResizeObserver(D);
609
+ return b.current && P.observe(b.current), () => {
610
+ P.disconnect();
611
+ };
612
+ }, []);
613
+ const A = _(() => {
614
+ se((D) => D + 1);
615
+ }, []), I = _(() => {
616
+ !o || !u || (x(!0), u());
617
+ }, [o, u]), S = _(() => {
618
+ !o || !l || (x(!1), l());
619
+ }, [o, l]), k = _(() => {
620
+ m && l && (x(!1), l());
621
+ }, [m, l]), w = M ? F.width < 350 : F.height < 200, V = M ? F.height < 310 : F.height < 450;
622
+ return /* @__PURE__ */ t.jsx(
623
+ de,
624
+ {
625
+ ref: b,
626
+ className: f,
627
+ sx: {
628
+ width: "100%",
629
+ height: "100%",
630
+ display: "flex",
631
+ flexDirection: M ? "row" : "column",
632
+ position: "relative",
633
+ overflow: "hidden",
634
+ minWidth: { xs: 180, sm: 220, md: 250 },
635
+ minHeight: M ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
636
+ // Allow progressive hiding in portrait mode
637
+ border: `1px solid ${i.palette.divider}`,
638
+ borderRadius: "18px",
639
+ boxShadow: "none",
640
+ backgroundColor: ((z = i.palette.backgroundPaperElevation) == null ? void 0 : z[8]) || "#2A2A3F",
641
+ backgroundImage: "none"
642
+ // Override any gradient from elevation
643
+ },
644
+ children: M ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
645
+ /* @__PURE__ */ t.jsx(
646
+ y,
647
+ {
648
+ sx: {
649
+ flex: "0 0 50%",
650
+ position: "relative",
651
+ height: "100%",
652
+ minHeight: "100%",
653
+ maxHeight: "100%",
654
+ borderRadius: 1,
655
+ m: { xs: 1.5, sm: 2, md: 3 },
656
+ mr: { xs: 0.75, sm: 1, md: 1.5 },
657
+ overflow: "hidden",
658
+ // Prevent content from affecting container size
659
+ display: w ? "none" : "block"
660
+ },
661
+ children: !w && /* @__PURE__ */ t.jsxs(
662
+ W,
663
+ {
664
+ orthographic: !0,
665
+ camera: {
666
+ position: [3, 2, 3],
667
+ zoom: 1
668
+ },
669
+ shadows: !0,
670
+ frameloop: "demand",
671
+ style: {
672
+ borderRadius: i.shape.borderRadius,
673
+ width: "100%",
674
+ height: "100%",
675
+ background: "transparent",
676
+ position: "absolute",
677
+ top: 0,
678
+ left: 0
679
+ },
680
+ dpr: [1, 2],
681
+ gl: { alpha: !0, antialias: !0 },
682
+ children: [
683
+ /* @__PURE__ */ t.jsx(N, {}),
684
+ /* @__PURE__ */ t.jsx($, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
685
+ p,
686
+ {
687
+ connectedMotionGroup: a,
688
+ postModelRender: A
689
+ }
690
+ ) })
691
+ ]
692
+ }
693
+ )
694
+ }
695
+ ),
696
+ /* @__PURE__ */ t.jsxs(
697
+ y,
698
+ {
699
+ sx: {
700
+ flex: "1",
701
+ display: "flex",
702
+ flexDirection: "column",
703
+ justifyContent: "flex-start",
704
+ width: w ? "100%" : "50%"
705
+ },
706
+ children: [
707
+ /* @__PURE__ */ t.jsxs(
708
+ y,
709
+ {
710
+ sx: {
711
+ p: { xs: 1.5, sm: 2, md: 3 },
712
+ pb: { xs: 1, sm: 1.5, md: 2 },
713
+ textAlign: "left"
714
+ },
715
+ children: [
716
+ /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
717
+ /* @__PURE__ */ t.jsx(
718
+ J,
719
+ {
720
+ programState: n,
721
+ safetyState: r,
722
+ operationMode: s
723
+ }
724
+ )
725
+ ]
726
+ }
727
+ ),
728
+ /* @__PURE__ */ t.jsxs(
729
+ y,
730
+ {
731
+ sx: {
732
+ p: { xs: 1.5, sm: 2, md: 3 },
733
+ pt: 0,
734
+ flex: "1",
735
+ display: "flex",
736
+ flexDirection: "column",
737
+ justifyContent: "space-between"
738
+ },
739
+ children: [
740
+ !V && h && /* @__PURE__ */ t.jsxs(y, { children: [
741
+ /* @__PURE__ */ t.jsx(h, {}),
742
+ /* @__PURE__ */ t.jsx(
743
+ H,
744
+ {
745
+ sx: {
746
+ mt: 1,
747
+ mb: 0,
748
+ borderColor: i.palette.divider,
749
+ opacity: 0.5
750
+ }
751
+ }
752
+ )
753
+ ] }),
754
+ /* @__PURE__ */ t.jsx(
755
+ y,
756
+ {
757
+ sx: {
758
+ mt: !V && h ? "auto" : 0
759
+ },
760
+ children: /* @__PURE__ */ t.jsx(
761
+ y,
762
+ {
763
+ sx: {
764
+ display: "flex",
765
+ justifyContent: "flex-start",
766
+ mt: { xs: 1, sm: 1.5, md: 2 },
767
+ mb: { xs: 0.5, sm: 0.75, md: 1 }
768
+ },
769
+ children: /* @__PURE__ */ t.jsx(
770
+ U,
771
+ {
772
+ ref: g,
773
+ variant: "contained",
774
+ color: "secondary",
775
+ size: "small",
776
+ disabled: !o,
777
+ onMouseDown: I,
778
+ onMouseUp: S,
779
+ onMouseLeave: k,
780
+ onTouchStart: I,
781
+ onTouchEnd: S,
782
+ sx: {
783
+ textTransform: "none",
784
+ px: 1.5,
785
+ py: 0.5
786
+ },
787
+ children: c("RobotCard.DriveToHome.bt")
788
+ }
789
+ )
790
+ }
791
+ )
792
+ }
793
+ )
794
+ ]
795
+ }
796
+ )
797
+ ]
798
+ }
799
+ )
800
+ ] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
801
+ y,
802
+ {
803
+ sx: {
804
+ p: 3,
805
+ height: "100%",
806
+ display: "flex",
807
+ flexDirection: "column"
808
+ },
809
+ children: [
810
+ /* @__PURE__ */ t.jsxs(y, { children: [
811
+ /* @__PURE__ */ t.jsx(B, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
812
+ /* @__PURE__ */ t.jsx(
813
+ J,
814
+ {
815
+ programState: n,
816
+ safetyState: r,
817
+ operationMode: s
818
+ }
819
+ )
820
+ ] }),
821
+ /* @__PURE__ */ t.jsx(
822
+ y,
823
+ {
824
+ sx: {
825
+ flex: w ? 0 : 1,
826
+ position: "relative",
827
+ minHeight: w ? 0 : { xs: 120, sm: 150, md: 200 },
828
+ height: w ? 0 : "auto",
829
+ borderRadius: 1,
830
+ overflow: "hidden",
831
+ display: w ? "none" : "block"
832
+ },
833
+ children: !w && /* @__PURE__ */ t.jsxs(
834
+ W,
835
+ {
836
+ orthographic: !0,
837
+ camera: {
838
+ position: [3, 2, 3],
839
+ zoom: 1
840
+ },
841
+ shadows: !0,
842
+ frameloop: "demand",
843
+ style: {
844
+ borderRadius: i.shape.borderRadius,
845
+ width: "100%",
846
+ height: "100%",
847
+ background: "transparent",
848
+ position: "absolute"
849
+ },
850
+ dpr: [1, 2],
851
+ gl: { alpha: !0, antialias: !0 },
852
+ children: [
853
+ /* @__PURE__ */ t.jsx(N, {}),
854
+ /* @__PURE__ */ t.jsx($, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
855
+ p,
856
+ {
857
+ connectedMotionGroup: a,
858
+ postModelRender: A
859
+ }
860
+ ) })
861
+ ]
862
+ }
863
+ )
864
+ }
865
+ ),
866
+ /* @__PURE__ */ t.jsxs(y, { children: [
867
+ !V && h && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
868
+ /* @__PURE__ */ t.jsx(h, {}),
869
+ /* @__PURE__ */ t.jsx(
870
+ H,
871
+ {
872
+ sx: {
873
+ mt: 1,
874
+ mb: 0,
875
+ borderColor: i.palette.divider,
876
+ opacity: 0.5
877
+ }
878
+ }
879
+ )
880
+ ] }),
881
+ /* @__PURE__ */ t.jsx(
882
+ y,
883
+ {
884
+ sx: {
885
+ display: "flex",
886
+ justifyContent: "flex-start",
887
+ mt: !V && h ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
888
+ mb: { xs: 0.5, sm: 0.75, md: 1 }
889
+ },
890
+ children: /* @__PURE__ */ t.jsx(
891
+ U,
892
+ {
893
+ ref: g,
894
+ variant: "contained",
895
+ color: "secondary",
896
+ size: "small",
897
+ disabled: !o,
898
+ onMouseDown: I,
899
+ onMouseUp: S,
900
+ onMouseLeave: k,
901
+ onTouchStart: I,
902
+ onTouchEnd: S,
903
+ sx: {
904
+ textTransform: "none",
905
+ px: 1.5,
906
+ py: 0.5
907
+ },
908
+ children: c("RobotCard.DriveToHome.bt")
909
+ }
910
+ )
911
+ }
912
+ )
913
+ ] })
914
+ ]
915
+ }
916
+ ) })
917
+ }
918
+ );
919
+ }
920
+ )
921
+ ), ot = Array(6).fill(2 * Math.PI), K = {
922
+ [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
923
+ [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
924
+ [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
925
+ [j.Kuka]: [
926
+ 0,
927
+ -Math.PI / 2,
928
+ Math.PI / 2,
929
+ 0,
930
+ Math.PI / 2,
931
+ 0,
932
+ 0
933
+ ],
934
+ [j.Universalrobots]: [
935
+ 0,
936
+ -Math.PI / 2,
937
+ -Math.PI / 2,
938
+ -Math.PI / 2,
939
+ Math.PI / 2,
940
+ -Math.PI / 2,
941
+ 0
942
+ ]
943
+ };
944
+ function Oe(e) {
945
+ const [n] = e.split("_");
946
+ switch (n) {
947
+ case "ABB":
948
+ return j.Abb;
949
+ case "FANUC":
950
+ return j.Fanuc;
951
+ case "YASKAWA":
952
+ return j.Yaskawa;
953
+ case "KUKA":
954
+ return j.Kuka;
955
+ case "UniversalRobots":
956
+ return j.Universalrobots;
957
+ default:
958
+ return null;
959
+ }
960
+ }
961
+ function st(e, n) {
962
+ const r = Oe(e);
963
+ return r && r in K ? K[r] : n || null;
964
+ }
965
+ export {
966
+ et as C,
967
+ K as M,
968
+ N as P,
969
+ nt as R,
970
+ tt as S,
971
+ rt as T,
972
+ ot as a,
973
+ Pe as b,
974
+ ze as c,
975
+ Q as d,
976
+ Oe as e,
977
+ st as g
978
+ };
979
+ //# sourceMappingURL=manufacturerHomePositions-DHqcbFON.js.map