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