@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0-pr.chore-playground-tool-steps.664.4537d63

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 (191) hide show
  1. package/README.md +323 -120
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +5 -3
  4. package/dist/3d.js +24 -23
  5. package/dist/CurrentPoseBar/index.cjs +1 -0
  6. package/dist/CurrentPoseBar/index.d.ts +2 -0
  7. package/dist/CurrentPoseBar/index.js +5 -0
  8. package/dist/JoggingButtons/index.cjs +1 -0
  9. package/dist/JoggingButtons/index.d.ts +3 -0
  10. package/dist/JoggingButtons/index.js +5 -0
  11. package/dist/JoggingGizmo/index.cjs +1 -0
  12. package/dist/JoggingGizmo/index.d.ts +4 -0
  13. package/dist/JoggingGizmo/index.js +7 -0
  14. package/dist/JoggingJointSlider/index.cjs +1 -0
  15. package/dist/JoggingJointSlider/index.d.ts +2 -0
  16. package/dist/JoggingJointSlider/index.js +5 -0
  17. package/dist/RobotControlPanel/index.cjs +1 -0
  18. package/dist/RobotControlPanel/index.d.ts +2 -0
  19. package/dist/RobotControlPanel/index.js +5 -0
  20. package/dist/RobotHeader/index.cjs +1 -0
  21. package/dist/RobotHeader/index.d.ts +4 -0
  22. package/dist/RobotHeader/index.js +5 -0
  23. package/dist/SafetyBar/index.cjs +1 -1
  24. package/dist/SafetyBar/index.js +1 -1
  25. package/dist/chunks/CurrentPoseBar-CyHUWmjM.cjs +1 -0
  26. package/dist/chunks/CurrentPoseBar-zTZi68tY.js +505 -0
  27. package/dist/chunks/JoggingButtons-CXaozFVz.js +108 -0
  28. package/dist/chunks/JoggingButtons-CbL-5LMK.cjs +1 -0
  29. package/dist/chunks/JoggingGizmo-DGbFLWgT.cjs +1 -0
  30. package/dist/chunks/JoggingGizmo-SuS9MmL7.js +810 -0
  31. package/dist/chunks/JoggingGizmoOrientation-dzned4f4.cjs +1 -0
  32. package/dist/chunks/JoggingGizmoOrientation-x_crT_64.js +14 -0
  33. package/dist/chunks/JoggingJointSlider-CZ-k6XCa.js +406 -0
  34. package/dist/chunks/JoggingJointSlider-R3_A9Ppj.cjs +1 -0
  35. package/dist/chunks/Robot-D0ZqUCn3.cjs +1 -0
  36. package/dist/chunks/Robot-UoykZeYH.js +1272 -0
  37. package/dist/chunks/RobotControlPanel-BnMfmO41.js +822 -0
  38. package/dist/chunks/RobotControlPanel-BuDGcxPR.cjs +1 -0
  39. package/dist/chunks/RobotHeader-BZci9ahT.js +244 -0
  40. package/dist/chunks/RobotHeader-CqK0700U.cjs +1 -0
  41. package/dist/chunks/SafetyBar-Bbg-o8h9.cjs +1 -0
  42. package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-Cuak4ffd.js} +11 -10
  43. package/dist/chunks/SmallSelect-BdD9uLKK.js +52 -0
  44. package/dist/chunks/SmallSelect-Dcsd7_6_.cjs +1 -0
  45. package/dist/chunks/TrajectoryExecutionStore-DPqfDcfn.js +3398 -0
  46. package/dist/chunks/TrajectoryExecutionStore-DV6mLEx9.cjs +3 -0
  47. package/dist/chunks/converters-C8I_A_tA.cjs +1 -0
  48. package/dist/chunks/converters-DpNB_WNQ.js +39 -0
  49. package/dist/chunks/externalizeComponent-BdxGBLIv.cjs +2 -0
  50. package/dist/chunks/externalizeComponent-_w2d1_pz.js +283 -0
  51. package/dist/chunks/holdSafety-BtoZ5We3.cjs +1 -0
  52. package/dist/chunks/holdSafety-Di1GZAWg.js +37 -0
  53. package/dist/chunks/joggingColors-CuT5u0H8.js +135 -0
  54. package/dist/chunks/joggingColors-ZDc_2UCp.cjs +1 -0
  55. package/dist/chunks/useEveryFrame-G_-ma1nC.js +142 -0
  56. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +1 -0
  57. package/dist/chunks/useSmoothedMotionState-COMJRcOt.js +214 -0
  58. package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +1 -0
  59. package/dist/components/AppHeader.d.ts +1 -1
  60. package/dist/components/currentPoseBar/CurrentPoseBar.d.ts +48 -0
  61. package/dist/components/currentPoseBar/OrientationFormatPopover.d.ts +19 -0
  62. package/dist/components/currentPoseBar/StreamStatus.d.ts +10 -0
  63. package/dist/components/currentPoseBar/orientation.d.ts +34 -0
  64. package/dist/components/currentPoseBar/poseValues.d.ts +15 -0
  65. package/dist/components/jogging/JoggingButtons.d.ts +16 -0
  66. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +1 -1
  67. package/dist/components/jogging/JoggingJointTab.d.ts +1 -1
  68. package/dist/components/jogging/JoggingPanel.d.ts +6 -3
  69. package/dist/components/jogging/JoggingStore.d.ts +96 -19
  70. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +43 -0
  71. package/dist/components/jogging/gizmo/JoggingGizmoOrientation.d.ts +26 -0
  72. package/dist/components/jogging/gizmo/RotationHandles.d.ts +7 -0
  73. package/dist/components/jogging/gizmo/RotationScene.d.ts +6 -0
  74. package/dist/components/jogging/gizmo/TranslationHandles.d.ts +6 -0
  75. package/dist/components/jogging/gizmo/TranslationScene.d.ts +6 -0
  76. package/dist/components/jogging/gizmo/arcGrabAreas.d.ts +58 -0
  77. package/dist/components/jogging/gizmo/arcs.d.ts +54 -0
  78. package/dist/components/jogging/gizmo/arrows.d.ts +63 -0
  79. package/dist/components/jogging/gizmo/gizmoShared.d.ts +125 -0
  80. package/dist/components/jogging/gizmo/gizmoView.d.ts +42 -0
  81. package/dist/components/jogging/gizmo/useGizmoTurn.d.ts +11 -0
  82. package/dist/components/jogging/holdSafety.d.ts +44 -0
  83. package/dist/components/jogging/jogError.d.ts +9 -0
  84. package/dist/components/jogging/jogHandle.d.ts +23 -0
  85. package/dist/components/jogging/joggingColors.d.ts +24 -0
  86. package/dist/components/jogging/joggingVelocity.d.ts +21 -0
  87. package/dist/components/jogging/joint/JoggingJointSlider.d.ts +52 -0
  88. package/dist/components/jogging/joint/JointSliderTrack.d.ts +27 -0
  89. package/dist/components/jogging/joint/jointJog.d.ts +55 -0
  90. package/dist/components/jogging/joint/useJointJogHold.d.ts +48 -0
  91. package/dist/components/jogging/useHold.d.ts +38 -0
  92. package/dist/components/jogging/useJogControls.d.ts +45 -0
  93. package/dist/components/robotControl/CartesianJogTab.d.ts +21 -0
  94. package/dist/components/robotControl/HoldToMoveButton.d.ts +25 -0
  95. package/dist/components/robotControl/JogArea.d.ts +22 -0
  96. package/dist/components/robotControl/JogModeToggle.d.ts +8 -0
  97. package/dist/components/robotControl/JointJogTab.d.ts +11 -0
  98. package/dist/components/robotControl/MoveToTab.d.ts +18 -0
  99. package/dist/components/robotControl/PanelSelect.d.ts +13 -0
  100. package/dist/components/robotControl/PoseField.d.ts +21 -0
  101. package/dist/components/robotControl/RobotControlPanel.d.ts +212 -0
  102. package/dist/components/robotControl/Section.d.ts +5 -0
  103. package/dist/components/robotControl/SmallSelect.d.ts +15 -0
  104. package/dist/components/robotControl/VelocityRow.d.ts +14 -0
  105. package/dist/components/robotControl/atPose.d.ts +8 -0
  106. package/dist/components/robotControl/poseText.d.ts +15 -0
  107. package/dist/components/robotControl/units.d.ts +16 -0
  108. package/dist/components/robotControl/useCopyText.d.ts +12 -0
  109. package/dist/components/robotControl/useEveryFrame.d.ts +6 -0
  110. package/dist/components/robotHeader/ActivationSwitch.d.ts +7 -0
  111. package/dist/components/robotHeader/AppNavigation.d.ts +15 -0
  112. package/dist/components/robotHeader/RobotHeader.d.ts +42 -0
  113. package/dist/components/robots/GenericRobot.d.ts +2 -1
  114. package/dist/components/robots/LinearAxis.d.ts +1 -1
  115. package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
  116. package/dist/components/robots/Robot.d.ts +1 -1
  117. package/dist/components/robots/robotModelLogic.d.ts +11 -9
  118. package/dist/components/utils/hooks.d.ts +1 -6
  119. package/dist/core.cjs +1 -1
  120. package/dist/core.d.ts +13 -18
  121. package/dist/core.js +37 -51
  122. package/dist/index.cjs +1 -1
  123. package/dist/index.js +58 -71
  124. package/dist/lib/ConnectedMotionGroup.d.ts +5 -7
  125. package/dist/lib/JoggerConnection.d.ts +137 -27
  126. package/dist/lib/MotionStreamConnection.d.ts +15 -6
  127. package/dist/lib/Pose3.d.ts +22 -0
  128. package/dist/lib/PoseTransformer.d.ts +25 -0
  129. package/dist/lib/TrajectoryExecutionStore.d.ts +129 -0
  130. package/dist/lib/connectionLogger.d.ts +9 -0
  131. package/dist/lib/incrementalCartesianMotion.d.ts +40 -0
  132. package/dist/lib/motionStateUpdate.d.ts +27 -0
  133. package/dist/lib/novaConnection.d.ts +23 -0
  134. package/dist/lib/planErrorTranslation.d.ts +8 -0
  135. package/dist/lib/rotation.d.ts +12 -0
  136. package/package.json +31 -66
  137. package/dist/Setup.d.ts +0 -11
  138. package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
  139. package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
  140. package/dist/chunks/SafetyBar-DPrv_OQA.cjs +0 -1
  141. package/dist/chunks/externalizeComponent-EDymnaGR.js +0 -268
  142. package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
  143. package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
  144. package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
  145. package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
  146. package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
  147. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
  148. package/dist/components/AdornedTextField.d.ts +0 -7
  149. package/dist/components/CopyableText.d.ts +0 -6
  150. package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
  151. package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
  152. package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
  153. package/dist/components/CycleTimer/index.d.ts +0 -27
  154. package/dist/components/CycleTimer/types.d.ts +0 -49
  155. package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
  156. package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
  157. package/dist/components/CycleTimer/utils.d.ts +0 -21
  158. package/dist/components/CycleTimer.d.ts +0 -3
  159. package/dist/components/DataGrid.d.ts +0 -66
  160. package/dist/components/LogPanel.d.ts +0 -38
  161. package/dist/components/LogStore.d.ts +0 -12
  162. package/dist/components/LogViewer.d.ts +0 -46
  163. package/dist/components/ProgramControl.d.ts +0 -55
  164. package/dist/components/ProgramStateIndicator.d.ts +0 -26
  165. package/dist/components/RobotCard.d.ts +0 -98
  166. package/dist/components/RobotListItem.d.ts +0 -34
  167. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
  168. package/dist/components/SelectableFab.d.ts +0 -7
  169. package/dist/components/TabBar.d.ts +0 -45
  170. package/dist/components/ThemeSelect.d.ts +0 -6
  171. package/dist/components/Timer/Timer.d.ts +0 -3
  172. package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
  173. package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
  174. package/dist/components/Timer/index.d.ts +0 -19
  175. package/dist/components/Timer/types.d.ts +0 -35
  176. package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
  177. package/dist/components/Timer/useTimerLogic.d.ts +0 -19
  178. package/dist/components/Timer/utils.d.ts +0 -17
  179. package/dist/components/Timer.d.ts +0 -3
  180. package/dist/components/TransparentOverlay.d.ts +0 -4
  181. package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
  182. package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
  183. package/dist/components/jogging/PoseJointValues.d.ts +0 -8
  184. package/dist/components/robots/AxisConfig.d.ts +0 -2
  185. package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
  186. package/dist/icons/DropdownArrowIcon.d.ts +0 -2
  187. package/dist/icons/index.d.ts +0 -12
  188. package/dist/lib/novaCompat.d.ts +0 -16
  189. package/dist/themes/createDarkTheme.d.ts +0 -7
  190. package/dist/themes/themeTypes.d.ts +0 -40
  191. package/dist/themes/theming.d.ts +0 -24
@@ -0,0 +1,822 @@
1
+ import { jsxs as m, jsx as n, Fragment as z } from "react/jsx-runtime";
2
+ import U from "@mui/material/IconButton";
3
+ import M from "@mui/material/Stack";
4
+ import L from "@mui/material/Tab";
5
+ import Z from "@mui/material/Tabs";
6
+ import H from "@mui/material/Typography";
7
+ import { CloseFilled as Y } from "@wandelbots/icons/CloseFilled";
8
+ import { useId as j, useRef as w, useState as E, useEffect as V } from "react";
9
+ import { useTranslation as J } from "react-i18next";
10
+ import { e as tt } from "./externalizeComponent-_w2d1_pz.js";
11
+ import N from "@mui/material/Divider";
12
+ import F from "@mui/material/Tooltip";
13
+ import { Jog as ot } from "@wandelbots/icons/Jog";
14
+ import { ViewModuleFilled as nt } from "@wandelbots/icons/ViewModuleFilled";
15
+ import { J as et } from "./JoggingGizmo-SuS9MmL7.js";
16
+ import { J as rt } from "./JoggingButtons-CXaozFVz.js";
17
+ import { styled as lt } from "@mui/material/styles";
18
+ import D from "@mui/material/ToggleButton";
19
+ import at from "@mui/material/ToggleButtonGroup";
20
+ import { P as O, I as it, u as ct, a as W, b as st, p as K } from "./useEveryFrame-G_-ma1nC.js";
21
+ import ut from "@mui/material/Slider";
22
+ import { J as pt } from "./JoggingJointSlider-CZ-k6XCa.js";
23
+ import { Undo as dt } from "@wandelbots/icons/Undo";
24
+ import { PrimaryButton as ft, AdornedTextField as bt, RoundedIconButton as B } from "@wandelbots/mui";
25
+ import { NorthEastFilled as gt } from "@wandelbots/icons/NorthEastFilled";
26
+ import { d as ht } from "./joggingColors-CuT5u0H8.js";
27
+ import { CheckFilled as Q } from "@wandelbots/icons/CheckFilled";
28
+ import { ContentCopyFilled as mt } from "@wandelbots/icons/ContentCopyFilled";
29
+ import { EditFilled as Ct } from "@wandelbots/icons/EditFilled";
30
+ function xt({
31
+ view: t,
32
+ onViewChange: o,
33
+ mode: e,
34
+ controls: a,
35
+ gizmoOrientation: i,
36
+ gizmoFrameQuaternion: d
37
+ }) {
38
+ const { t: r } = J(), l = t === "gizmo" && i !== void 0, c = r(l ? e === "increment" ? "RobotControl.JogArea.Hint.ClickHandle.lb" : "RobotControl.JogArea.Hint.HoldHandle.lb" : e === "increment" ? "RobotControl.JogArea.Hint.ClickButton.lb" : "RobotControl.JogArea.Hint.HoldButton.lb"), u = r(l ? "RobotControl.JogArea.ShowButtons.bt" : "RobotControl.JogArea.ShowGizmo.bt");
39
+ return /* @__PURE__ */ m(
40
+ M,
41
+ {
42
+ "data-testid": "jog-area",
43
+ sx: { position: "relative", alignItems: "center", gap: "16px" },
44
+ children: [
45
+ i && /* @__PURE__ */ n(F, { title: u, placement: "left", children: /* @__PURE__ */ n(
46
+ U,
47
+ {
48
+ "aria-label": u,
49
+ onClick: () => o(l ? "buttons" : "gizmo"),
50
+ size: "small",
51
+ sx: (p) => {
52
+ var b;
53
+ return {
54
+ position: "absolute",
55
+ top: 0,
56
+ right: 0,
57
+ zIndex: 1,
58
+ borderRadius: "8px",
59
+ border: `1px solid ${p.palette.divider}`,
60
+ background: (b = p.palette.backgroundPaperElevation) == null ? void 0 : b[11]
61
+ };
62
+ },
63
+ children: l ? /* @__PURE__ */ n(nt, {}) : /* @__PURE__ */ n(ot, {})
64
+ }
65
+ ) }),
66
+ l ? /* @__PURE__ */ n(
67
+ et,
68
+ {
69
+ ...a,
70
+ orientation: i,
71
+ frameQuaternion: d,
72
+ size: 180
73
+ }
74
+ ) : /* @__PURE__ */ n(rt, { ...a }),
75
+ /* @__PURE__ */ n(H, { variant: "body2", color: "text.secondary", textAlign: "center", children: c })
76
+ ]
77
+ }
78
+ );
79
+ }
80
+ const vt = lt(at)(({ theme: t }) => {
81
+ var o;
82
+ return {
83
+ gap: "4px",
84
+ "& .MuiToggleButton-root": {
85
+ border: "none",
86
+ borderRadius: "8px",
87
+ padding: "6px 16px",
88
+ textTransform: "none",
89
+ fontSize: "14px",
90
+ color: t.palette.text.secondary
91
+ },
92
+ "& .MuiToggleButton-root.Mui-selected": {
93
+ color: t.palette.text.primary,
94
+ background: (o = t.palette.backgroundPaperElevation) == null ? void 0 : o[11]
95
+ }
96
+ };
97
+ });
98
+ function Rt({
99
+ value: t,
100
+ onChange: o,
101
+ disabled: e
102
+ }) {
103
+ const { t: a } = J();
104
+ return /* @__PURE__ */ m(
105
+ vt,
106
+ {
107
+ exclusive: !0,
108
+ value: t,
109
+ disabled: e,
110
+ "aria-label": a("RobotControl.JogMode.lb"),
111
+ onChange: (i, d) => {
112
+ d !== null && o(d);
113
+ },
114
+ children: [
115
+ /* @__PURE__ */ n(D, { value: "continuous", children: a("RobotControl.JogMode.Continuous.bt") }),
116
+ /* @__PURE__ */ n(D, { value: "increment", children: a("RobotControl.JogMode.Increment.bt") })
117
+ ]
118
+ }
119
+ );
120
+ }
121
+ function I({ children: t }) {
122
+ return /* @__PURE__ */ n(M, { sx: { padding: "16px 20px", gap: "16px" }, children: t });
123
+ }
124
+ function Mt(t) {
125
+ return t * 180 / Math.PI;
126
+ }
127
+ function Tt(t) {
128
+ return t * Math.PI / 180;
129
+ }
130
+ function X(t, o) {
131
+ return t === "rotate" ? Mt(o) : o;
132
+ }
133
+ function yt(t, o) {
134
+ return t === "rotate" ? Tt(o) : o;
135
+ }
136
+ function St(t, o) {
137
+ const e = String(Number(X(t, o).toFixed(2)));
138
+ return t === "rotate" ? `${e}°` : `${e} mm`;
139
+ }
140
+ function wt(t, o) {
141
+ const e = Math.round(X(t, o));
142
+ return t === "rotate" ? `${e}°/s` : `${e} mm/s`;
143
+ }
144
+ function _({
145
+ motion: t,
146
+ velocity: o,
147
+ onChange: e,
148
+ disabled: a
149
+ }) {
150
+ const { t: i } = J(), d = j(), r = (l) => X(t, l);
151
+ return /* @__PURE__ */ m(M, { gap: "4px", children: [
152
+ /* @__PURE__ */ m(M, { direction: "row", sx: { justifyContent: "space-between" }, children: [
153
+ /* @__PURE__ */ n(H, { id: d, variant: "body2", color: "text.secondary", children: i("RobotControl.Velocity.lb") }),
154
+ /* @__PURE__ */ n(
155
+ H,
156
+ {
157
+ variant: "body2",
158
+ color: "text.primary",
159
+ sx: { fontVariantNumeric: "tabular-nums" },
160
+ children: wt(t, o.value)
161
+ }
162
+ )
163
+ ] }),
164
+ /* @__PURE__ */ n(
165
+ ut,
166
+ {
167
+ "aria-labelledby": d,
168
+ size: "small",
169
+ value: Math.round(r(o.value)),
170
+ min: Math.ceil(r(o.min)),
171
+ max: Math.floor(r(o.max)),
172
+ disabled: a,
173
+ onChange: (l, c) => {
174
+ typeof c == "number" && e(yt(t, c));
175
+ },
176
+ sx: (l) => {
177
+ var c;
178
+ return {
179
+ // The rail and the hollow thumb of the joint sliders, as in the
180
+ // design: a 4 px rail (the small slider's is 2 px)
181
+ height: 4,
182
+ "& .MuiSlider-rail": { opacity: 0.38 },
183
+ "& .MuiSlider-thumb": {
184
+ width: 16,
185
+ height: 16,
186
+ border: `3px solid ${l.palette.primary.main}`,
187
+ backgroundColor: (c = l.palette.backgroundPaperElevation) == null ? void 0 : c[5]
188
+ }
189
+ };
190
+ }
191
+ }
192
+ )
193
+ ] });
194
+ }
195
+ function Jt({
196
+ motion: t,
197
+ settings: o,
198
+ onSettingsChange: e,
199
+ disabled: a = !1,
200
+ tcp: i,
201
+ jogFrame: d,
202
+ velocity: r,
203
+ onVelocityChange: l,
204
+ onJogStart: c,
205
+ onJogStop: u,
206
+ increments: p,
207
+ gizmoOrientation: b,
208
+ gizmoFrameQuaternion: x
209
+ }) {
210
+ const { t: C } = J(), s = p ? o.mode : "continuous", T = (p == null ? void 0 : p.steps[t]) ?? [], v = Math.min(o.step[t], T.length - 1), g = T[v], y = w(!1);
211
+ function k(h, f) {
212
+ if (s === "increment") {
213
+ p && g !== void 0 && p.onStep(t, h, f, g);
214
+ return;
215
+ }
216
+ y.current = !0, c(t, h, f);
217
+ }
218
+ function P() {
219
+ y.current && (y.current = !1, u());
220
+ }
221
+ return /* @__PURE__ */ m(z, { children: [
222
+ (i || d) && /* @__PURE__ */ m(z, { children: [
223
+ /* @__PURE__ */ n(I, { children: /* @__PURE__ */ m(M, { direction: "row", sx: { gap: "12px" }, children: [
224
+ i && /* @__PURE__ */ n(
225
+ O,
226
+ {
227
+ label: C("RobotControl.Tcp.lb"),
228
+ ...i,
229
+ disabled: a
230
+ }
231
+ ),
232
+ d && /* @__PURE__ */ n(
233
+ O,
234
+ {
235
+ label: C("RobotControl.JogFrame.lb"),
236
+ ...d,
237
+ disabled: a
238
+ }
239
+ )
240
+ ] }) }),
241
+ /* @__PURE__ */ n(N, { sx: { marginX: "20px" } })
242
+ ] }),
243
+ /* @__PURE__ */ m(I, { children: [
244
+ p && /* @__PURE__ */ n(
245
+ Rt,
246
+ {
247
+ value: s,
248
+ onChange: (h) => e({ ...o, mode: h }),
249
+ disabled: a
250
+ }
251
+ ),
252
+ /* @__PURE__ */ n(
253
+ _,
254
+ {
255
+ motion: t,
256
+ velocity: r[t],
257
+ onChange: (h) => l(t, h),
258
+ disabled: a
259
+ }
260
+ ),
261
+ s === "increment" && g !== void 0 && /* @__PURE__ */ n(
262
+ it,
263
+ {
264
+ label: C("RobotControl.StepSize.lb"),
265
+ value: String(v),
266
+ options: T.map((h, f) => ({
267
+ id: String(f),
268
+ label: St(t, h)
269
+ })),
270
+ onChange: (h) => e({
271
+ ...o,
272
+ step: { ...o.step, [t]: Number(h) }
273
+ }),
274
+ disabled: a
275
+ }
276
+ )
277
+ ] }),
278
+ /* @__PURE__ */ n(N, { sx: { marginX: "20px" } }),
279
+ /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(
280
+ xt,
281
+ {
282
+ view: o.view,
283
+ onViewChange: (h) => e({ ...o, view: h }),
284
+ mode: s,
285
+ controls: {
286
+ motion: t,
287
+ onJogStart: k,
288
+ onJogStop: P,
289
+ activeHandle: s === "increment" ? p == null ? void 0 : p.running : null,
290
+ disabled: a
291
+ },
292
+ gizmoOrientation: b,
293
+ gizmoFrameQuaternion: x
294
+ },
295
+ s
296
+ ) })
297
+ ] });
298
+ }
299
+ function kt({
300
+ joints: t,
301
+ disabled: o
302
+ }) {
303
+ const e = w(null), [a, i] = E(null);
304
+ function d(l, c) {
305
+ e.current !== null && e.current !== l || (e.current = l, i(l), t.onJogStart(l, c));
306
+ }
307
+ function r(l) {
308
+ e.current === l && (e.current = null, i(null), t.onJogStop());
309
+ }
310
+ return /* @__PURE__ */ m(z, { children: [
311
+ /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(M, { sx: { gap: "8px", paddingX: "4px" }, children: t.joints.map((l, c) => /* @__PURE__ */ n(
312
+ pt,
313
+ {
314
+ label: `J${c + 1}`,
315
+ name: l.name,
316
+ value: l.value,
317
+ min: l.min,
318
+ max: l.max,
319
+ linear: t.linear,
320
+ onJogStart: (u) => d(c, u),
321
+ onJogStop: () => r(c),
322
+ disabled: o || a !== null && a !== c
323
+ },
324
+ c
325
+ )) }) }),
326
+ /* @__PURE__ */ n(N, { sx: { marginX: "20px" } }),
327
+ /* @__PURE__ */ n(I, { children: /* @__PURE__ */ n(
328
+ _,
329
+ {
330
+ motion: t.linear ? "translate" : "rotate",
331
+ velocity: t.velocity,
332
+ onChange: t.onVelocityChange,
333
+ disabled: o
334
+ }
335
+ ) })
336
+ ] });
337
+ }
338
+ const It = 0.5, Et = 0.01;
339
+ function Pt(t, o) {
340
+ return t ? Math.hypot(
341
+ t.position[0] - o.position[0],
342
+ t.position[1] - o.position[1],
343
+ t.position[2] - o.position[2]
344
+ ) <= It && At(t.orientation, o.orientation) <= Et : !1;
345
+ }
346
+ function q(t) {
347
+ const o = Math.hypot(...t);
348
+ if (o < 1e-12) return [1, 0, 0, 0];
349
+ const e = Math.sin(o / 2) / o;
350
+ return [
351
+ Math.cos(o / 2),
352
+ t[0] * e,
353
+ t[1] * e,
354
+ t[2] * e
355
+ ];
356
+ }
357
+ function At(t, o) {
358
+ const e = q(t), a = q(o), i = Math.abs(e[0] * a[0] + e[1] * a[1] + e[2] * a[2] + e[3] * a[3]);
359
+ return 2 * Math.acos(Math.min(1, i));
360
+ }
361
+ const Bt = "move", Vt = 200;
362
+ function zt({
363
+ state: t,
364
+ ready: o,
365
+ atPose: e,
366
+ disabled: a,
367
+ onMoveStart: i,
368
+ onMoveStop: d,
369
+ stopRef: r
370
+ }) {
371
+ const { t: l } = J(), [c, u] = E(!1), p = w(void 0), b = w(!1), x = w({ onMoveStart: i, onMoveStop: d });
372
+ x.current = { onMoveStart: i, onMoveStop: d };
373
+ const C = t === "planned", s = C || t === "moving", { handlersFor: T, stop: v } = ht({
374
+ onStart: () => {
375
+ u(!0), p.current = setTimeout(() => {
376
+ p.current = void 0, b.current = !0, x.current.onMoveStart();
377
+ }, Vt);
378
+ },
379
+ onStop: () => {
380
+ u(!1), clearTimeout(p.current), p.current = void 0, b.current && (b.current = !1, x.current.onMoveStop());
381
+ },
382
+ disabled: c ? a || !o || !s : a || !o || e || !C,
383
+ isSame: () => !0
384
+ });
385
+ r && (r.current = v), V(() => () => clearTimeout(p.current), []);
386
+ const g = l(t === "moving" ? "RobotControl.MoveTo.Moving.bt" : t === "stopping" ? "RobotControl.MoveTo.Stopping.bt" : "RobotControl.MoveTo.MoveTo.bt");
387
+ return /* @__PURE__ */ n(
388
+ F,
389
+ {
390
+ title: l(e ? "RobotControl.MoveTo.AtPose.lb" : "RobotControl.MoveTo.HoldToMove.lb"),
391
+ placement: "top",
392
+ children: /* @__PURE__ */ n(
393
+ "span",
394
+ {
395
+ ...T(Bt),
396
+ style: {
397
+ display: "block",
398
+ flexGrow: 1,
399
+ touchAction: "none",
400
+ userSelect: "none"
401
+ },
402
+ children: /* @__PURE__ */ n(
403
+ ft,
404
+ {
405
+ fullWidth: !0,
406
+ disabled: a || !o || e || !s,
407
+ loading: t === "planning" || t === "stopping",
408
+ loadingPosition: "start",
409
+ startIcon: /* @__PURE__ */ n(gt, {}),
410
+ "aria-pressed": c,
411
+ children: g
412
+ }
413
+ )
414
+ }
415
+ )
416
+ }
417
+ );
418
+ }
419
+ function Ht({
420
+ text: t,
421
+ editing: o,
422
+ onEdit: e,
423
+ onDraftChange: a,
424
+ onCancel: i,
425
+ onConfirm: d,
426
+ canConfirm: r,
427
+ error: l,
428
+ disabled: c
429
+ }) {
430
+ const { t: u } = J(), p = w(null), { copied: b, copy: x } = ct();
431
+ V(() => {
432
+ const s = p.current;
433
+ s && (o ? (s.focus(), s.setSelectionRange(s.value.length, s.value.length)) : document.activeElement === s && (s.blur(), s.scrollLeft = 0));
434
+ }, [o]);
435
+ function C() {
436
+ return x(t, () => {
437
+ var s;
438
+ return (s = p.current) == null ? void 0 : s.select();
439
+ });
440
+ }
441
+ return /* @__PURE__ */ m(M, { direction: "row", sx: { gap: "8px", alignItems: "flex-start" }, children: [
442
+ /* @__PURE__ */ n(
443
+ bt,
444
+ {
445
+ label: u("RobotControl.MoveTo.Coordinates.lb"),
446
+ value: t,
447
+ inputRef: p,
448
+ onChange: (s) => a(s.target.value),
449
+ onClick: () => {
450
+ !o && !c && e();
451
+ },
452
+ onKeyDown: (s) => {
453
+ o && (s.key === "Enter" && r ? d() : s.key === "Escape" && i());
454
+ },
455
+ error: !!l,
456
+ helperText: l ?? void 0,
457
+ fullWidth: !0,
458
+ autoComplete: "off",
459
+ slotProps: {
460
+ htmlInput: { readOnly: !o, spellCheck: !1 }
461
+ },
462
+ sx: {
463
+ "& input": {
464
+ fontVariantNumeric: "tabular-nums",
465
+ cursor: o || c ? void 0 : "text"
466
+ }
467
+ }
468
+ }
469
+ ),
470
+ /* @__PURE__ */ n(
471
+ M,
472
+ {
473
+ direction: "row",
474
+ sx: { gap: "8px", height: "56px", alignItems: "center" },
475
+ children: o ? /* @__PURE__ */ m(z, { children: [
476
+ /* @__PURE__ */ n(
477
+ B,
478
+ {
479
+ icon: /* @__PURE__ */ n(Y, {}),
480
+ ariaLabel: u("RobotControl.MoveTo.Cancel.bt"),
481
+ onClick: i
482
+ }
483
+ ),
484
+ /* @__PURE__ */ n(
485
+ F,
486
+ {
487
+ title: u("RobotControl.MoveTo.ConfirmEdit.lb"),
488
+ placement: "left",
489
+ children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(
490
+ B,
491
+ {
492
+ icon: /* @__PURE__ */ n(Q, {}),
493
+ ariaLabel: u("RobotControl.MoveTo.ConfirmEdit.lb"),
494
+ onClick: d,
495
+ disabled: !r,
496
+ sx: { color: "primary.main" }
497
+ }
498
+ ) })
499
+ }
500
+ )
501
+ ] }) : /* @__PURE__ */ m(z, { children: [
502
+ /* @__PURE__ */ n(
503
+ F,
504
+ {
505
+ title: u("RobotControl.MoveTo.Copied.lb"),
506
+ open: b,
507
+ disableHoverListener: !0,
508
+ placement: "left",
509
+ children: /* @__PURE__ */ n(
510
+ B,
511
+ {
512
+ icon: b ? /* @__PURE__ */ n(Q, {}) : /* @__PURE__ */ n(mt, {}),
513
+ ariaLabel: u("RobotControl.MoveTo.Copy.bt"),
514
+ onClick: () => void C()
515
+ }
516
+ )
517
+ }
518
+ ),
519
+ /* @__PURE__ */ n(
520
+ B,
521
+ {
522
+ icon: /* @__PURE__ */ n(Ct, {}),
523
+ ariaLabel: u("RobotControl.MoveTo.Edit.bt"),
524
+ onClick: e,
525
+ disabled: c
526
+ }
527
+ )
528
+ ] })
529
+ }
530
+ )
531
+ ] });
532
+ }
533
+ function Ft({
534
+ moveTo: t,
535
+ tcp: o,
536
+ velocity: e,
537
+ onVelocityChange: a,
538
+ disabled: i
539
+ }) {
540
+ var S;
541
+ const { t: d } = J(), [r, l] = E(null), [c, u] = E(null), p = W(
542
+ () => {
543
+ const R = t.getCurrentPose();
544
+ return R ? K(R) : "";
545
+ },
546
+ r === null && c === null
547
+ ), b = (r == null ? void 0 : r.text) ?? p, x = c !== null, C = c === null ? null : st(c), s = r !== null && !t.error && !x, T = W(
548
+ () => r !== null && Pt(t.getCurrentPose(), r.pose),
549
+ s
550
+ ) && s, v = w(!1), g = w(null);
551
+ function y() {
552
+ var R;
553
+ (R = g.current) == null || R.call(g), v.current = !1, l(null), u(null), t.onTargetChange(null);
554
+ }
555
+ function k() {
556
+ C === null || i || (v.current = !1, l({ pose: C, text: K(C) }), u(null), t.onTargetChange(C));
557
+ }
558
+ V(() => {
559
+ if (s) {
560
+ if (t.state === "moving") {
561
+ v.current = !0;
562
+ return;
563
+ }
564
+ v.current && T && t.state !== "stopping" && y();
565
+ }
566
+ }, [s, t.state, T]);
567
+ const P = [o == null ? void 0 : o.value, (S = t.frame) == null ? void 0 : S.value].join("\0");
568
+ V(() => {
569
+ r && y();
570
+ }, [P]);
571
+ const h = w({ target: r, onTargetChange: t.onTargetChange });
572
+ h.current = { target: r, onTargetChange: t.onTargetChange }, V(
573
+ () => () => {
574
+ var R;
575
+ (R = g.current) == null || R.call(g), h.current.target && h.current.onTargetChange(null);
576
+ },
577
+ []
578
+ );
579
+ const f = c !== null ? C === null ? d("RobotControl.MoveTo.InvalidPose.lb") : null : r ? t.error ?? null : null;
580
+ return /* @__PURE__ */ m(I, { children: [
581
+ o && /* @__PURE__ */ n(
582
+ O,
583
+ {
584
+ label: d("RobotControl.Tcp.lb"),
585
+ ...o,
586
+ disabled: i
587
+ }
588
+ ),
589
+ /* @__PURE__ */ n(H, { variant: "body1", color: "text.primary", children: d("RobotControl.MoveTo.TargetPose.lb") }),
590
+ /* @__PURE__ */ m(M, { sx: { gap: "8px" }, children: [
591
+ t.frame && /* @__PURE__ */ n(
592
+ O,
593
+ {
594
+ label: d("RobotControl.MoveTo.RelativeTo.lb"),
595
+ ...t.frame,
596
+ disabled: i
597
+ }
598
+ ),
599
+ /* @__PURE__ */ n(
600
+ Ht,
601
+ {
602
+ text: c ?? b,
603
+ editing: x,
604
+ onEdit: () => {
605
+ i || u(b);
606
+ },
607
+ onDraftChange: u,
608
+ onCancel: () => u(null),
609
+ onConfirm: k,
610
+ canConfirm: C !== null && !i && t.state !== "planning",
611
+ error: f,
612
+ disabled: i
613
+ }
614
+ )
615
+ ] }),
616
+ /* @__PURE__ */ n(
617
+ _,
618
+ {
619
+ motion: "translate",
620
+ velocity: e,
621
+ onChange: a,
622
+ disabled: i
623
+ }
624
+ ),
625
+ /* @__PURE__ */ m(M, { direction: "row", sx: { gap: "12px", alignItems: "center" }, children: [
626
+ r && !x && /* @__PURE__ */ n(F, { title: d("RobotControl.MoveTo.Reset.lb"), placement: "top", children: /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(
627
+ B,
628
+ {
629
+ icon: /* @__PURE__ */ n(dt, {}),
630
+ ariaLabel: d("RobotControl.MoveTo.Reset.lb"),
631
+ onClick: y
632
+ }
633
+ ) }) }),
634
+ /* @__PURE__ */ n(
635
+ zt,
636
+ {
637
+ state: r ? t.state : "idle",
638
+ ready: s,
639
+ atPose: T,
640
+ disabled: i,
641
+ onMoveStart: () => {
642
+ r && t.onMoveStart(r.pose);
643
+ },
644
+ onMoveStop: t.onMoveStop,
645
+ stopRef: g
646
+ }
647
+ )
648
+ ] })
649
+ ] });
650
+ }
651
+ const go = tt(
652
+ ({
653
+ onClose: t,
654
+ sx: o,
655
+ joints: e,
656
+ moveTo: a,
657
+ jogDisabled: i = !1,
658
+ tab: d,
659
+ onTabChange: r,
660
+ jogMode: l,
661
+ onJogModeChange: c,
662
+ ...u
663
+ }) => {
664
+ const { t: p } = J(), b = u.disabled ?? !1, [x, C] = E("translate"), [s, T] = E({
665
+ mode: "continuous",
666
+ view: "gizmo",
667
+ step: { translate: 0, rotate: 0 }
668
+ }), v = d ?? x, g = v === "joint" && !e || v === "moveTo" && !a ? "translate" : v, y = Lt(s, l, u.increments), k = p("RobotControl.Title.ti");
669
+ function P(f) {
670
+ C(f), r == null || r(f);
671
+ }
672
+ function h(f) {
673
+ var S, R, G;
674
+ T(f), f.mode !== y.mode && (c == null || c(f.mode));
675
+ for (const A of ["translate", "rotate"]) {
676
+ const $ = (S = u.increments) == null ? void 0 : S.steps[A][f.step[A]];
677
+ f.step[A] !== y.step[A] && $ !== void 0 && ((G = (R = u.increments) == null ? void 0 : R.onStepChange) == null || G.call(R, A, $));
678
+ }
679
+ }
680
+ return /* @__PURE__ */ m(
681
+ M,
682
+ {
683
+ "data-testid": "robot-control-panel",
684
+ sx: [
685
+ (f) => {
686
+ var S;
687
+ return {
688
+ minHeight: 0,
689
+ overflow: "hidden",
690
+ borderRadius: "16px",
691
+ background: (S = f.palette.backgroundPaperElevation) == null ? void 0 : S[5]
692
+ };
693
+ },
694
+ ...Array.isArray(o) ? o : [o]
695
+ ],
696
+ children: [
697
+ /* @__PURE__ */ m(
698
+ M,
699
+ {
700
+ direction: "row",
701
+ sx: {
702
+ alignItems: "center",
703
+ justifyContent: "space-between",
704
+ padding: "20px 20px 8px"
705
+ },
706
+ children: [
707
+ /* @__PURE__ */ n(
708
+ H,
709
+ {
710
+ component: "h2",
711
+ color: "text.primary",
712
+ sx: { fontSize: "20px" },
713
+ children: k
714
+ }
715
+ ),
716
+ t && /* @__PURE__ */ n(
717
+ U,
718
+ {
719
+ "aria-label": p("RobotControl.Close.bt"),
720
+ onClick: t,
721
+ size: "small",
722
+ children: /* @__PURE__ */ n(Y, {})
723
+ }
724
+ )
725
+ ]
726
+ }
727
+ ),
728
+ /* @__PURE__ */ m(
729
+ Z,
730
+ {
731
+ value: g,
732
+ onChange: (f, S) => P(S),
733
+ "aria-label": k,
734
+ variant: "scrollable",
735
+ scrollButtons: !1,
736
+ sx: {
737
+ marginX: "20px",
738
+ borderBottom: 1,
739
+ borderColor: "divider",
740
+ // The theme gives tabs a background of their own; here they sit
741
+ // on the panel
742
+ background: "transparent"
743
+ },
744
+ children: [
745
+ /* @__PURE__ */ n(
746
+ L,
747
+ {
748
+ value: "translate",
749
+ label: p("RobotControl.Tab.Translate.bt"),
750
+ sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
751
+ }
752
+ ),
753
+ /* @__PURE__ */ n(
754
+ L,
755
+ {
756
+ value: "rotate",
757
+ label: p("RobotControl.Tab.Rotate.bt"),
758
+ sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
759
+ }
760
+ ),
761
+ e && /* @__PURE__ */ n(
762
+ L,
763
+ {
764
+ value: "joint",
765
+ label: p("RobotControl.Tab.Joint.bt"),
766
+ sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
767
+ }
768
+ ),
769
+ a && /* @__PURE__ */ n(
770
+ L,
771
+ {
772
+ value: "moveTo",
773
+ label: p("RobotControl.Tab.MoveTo.bt"),
774
+ sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
775
+ }
776
+ )
777
+ ]
778
+ }
779
+ ),
780
+ /* @__PURE__ */ n(M, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden" }, children: g === "joint" && e ? /* @__PURE__ */ n(kt, { joints: e, disabled: b || i }) : g === "moveTo" && a ? /* @__PURE__ */ n(
781
+ Ft,
782
+ {
783
+ moveTo: a,
784
+ tcp: u.tcp,
785
+ velocity: u.velocity.translate,
786
+ onVelocityChange: (f) => u.onVelocityChange("translate", f),
787
+ disabled: b
788
+ }
789
+ ) : /* @__PURE__ */ n(
790
+ Jt,
791
+ {
792
+ ...u,
793
+ disabled: b || i,
794
+ motion: g === "rotate" ? "rotate" : "translate",
795
+ settings: y,
796
+ onSettingsChange: h
797
+ }
798
+ ) })
799
+ ]
800
+ }
801
+ );
802
+ }
803
+ );
804
+ function Lt(t, o, e) {
805
+ const a = (i) => {
806
+ var l;
807
+ const d = (l = e == null ? void 0 : e.step) == null ? void 0 : l[i];
808
+ if (d === void 0) return t.step[i];
809
+ const r = e == null ? void 0 : e.steps[i].findIndex(
810
+ (c) => Math.abs(c - d) <= 1e-9 * Math.max(1, Math.abs(c))
811
+ );
812
+ return r === void 0 || r < 0 ? t.step[i] : r;
813
+ };
814
+ return {
815
+ ...t,
816
+ mode: o ?? t.mode,
817
+ step: { translate: a("translate"), rotate: a("rotate") }
818
+ };
819
+ }
820
+ export {
821
+ go as R
822
+ };