@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.bd2ec84 → 6.4.0-pr.revamp.667.ca77f09

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 (154) hide show
  1. package/README.md +172 -40
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +3 -4
  4. package/dist/3d.js +35 -38
  5. package/dist/CurrentPose/index.cjs +1 -1
  6. package/dist/CurrentPose/index.js +2 -2
  7. package/dist/CurrentPoseBar/index.cjs +1 -1
  8. package/dist/CurrentPoseBar/index.js +1 -1
  9. package/dist/JoggingButtons/index.cjs +1 -1
  10. package/dist/JoggingButtons/index.js +1 -1
  11. package/dist/JoggingGizmo/index.cjs +1 -1
  12. package/dist/JoggingGizmo/index.js +2 -2
  13. package/dist/JoggingJointSlider/index.cjs +1 -1
  14. package/dist/JoggingJointSlider/index.js +1 -1
  15. package/dist/RobotControl/index.cjs +1 -1
  16. package/dist/RobotControl/index.js +2 -2
  17. package/dist/RobotControlPanel/index.cjs +1 -1
  18. package/dist/RobotControlPanel/index.d.ts +1 -1
  19. package/dist/RobotControlPanel/index.js +1 -1
  20. package/dist/RobotHeader/index.cjs +1 -1
  21. package/dist/RobotHeader/index.d.ts +3 -5
  22. package/dist/RobotHeader/index.js +6 -7
  23. package/dist/RobotScene/index.cjs +1 -1
  24. package/dist/RobotScene/index.js +3 -3
  25. package/dist/RobotView/index.cjs +1 -1
  26. package/dist/RobotView/index.js +2 -2
  27. package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
  28. package/dist/SafetyBar/SafetyBar.d.ts +15 -1
  29. package/dist/SafetyBar/index.cjs +1 -1
  30. package/dist/SafetyBar/index.d.ts +0 -1
  31. package/dist/SafetyBar/index.js +3 -4
  32. package/dist/SafetyBar/robotSafetyOf.d.ts +1 -0
  33. package/dist/chunks/{ConnectedMotionGroup-BifrgwV1.js → ConnectedMotionGroup-DNYakgxy.js} +6 -5
  34. package/dist/chunks/ConnectedMotionGroup-IRTsTxwB.cjs +3 -0
  35. package/dist/chunks/{CurrentPose-CMqO8oqX.cjs → CurrentPose-CAq9e9JY.cjs} +1 -1
  36. package/dist/chunks/{CurrentPose-CdD2ZB7B.js → CurrentPose-CgdINEh2.js} +3 -3
  37. package/dist/chunks/{CurrentPoseBar-CX1xFBtm.js → CurrentPoseBar--HkZBGnN.js} +11 -11
  38. package/dist/chunks/{CurrentPoseBar-BTBAwIO4.cjs → CurrentPoseBar-DoOUfRRs.cjs} +1 -1
  39. package/dist/chunks/{JoggingButtons-aijK-3g6.js → JoggingButtons-BNOnpcTH.js} +1 -1
  40. package/dist/chunks/{JoggingButtons-BOHl7hVq.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
  41. package/dist/chunks/{JoggingGizmo-CoKYUtXq.cjs → JoggingGizmo-CNFjpWDv.cjs} +1 -1
  42. package/dist/chunks/{JoggingGizmo-DHvrJouR.js → JoggingGizmo-RDiEVQes.js} +1 -1
  43. package/dist/chunks/{JoggingGizmoOrientation-CIvIAIeO.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
  44. package/dist/chunks/{JoggingGizmoOrientation-DVcagPRJ.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
  45. package/dist/chunks/{JoggingJointSlider-DQtt4-pa.js → JoggingJointSlider-BY-Tof8G.js} +1 -1
  46. package/dist/chunks/{JoggingJointSlider-CTFYKzsU.cjs → JoggingJointSlider-Dm3vILd3.cjs} +1 -1
  47. package/dist/chunks/{JoggingRefusedError-BIkUM6-g.js → JoggingRefusedError-C4D8_YR_.js} +5 -3
  48. package/dist/chunks/JoggingRefusedError-DqyrfUcc.cjs +1 -0
  49. package/dist/chunks/Pose3-BfBNPRDM.cjs +1 -0
  50. package/dist/chunks/{Pose3-B_fLR-Wv.js → Pose3-DWxfC6Dj.js} +1 -2
  51. package/dist/chunks/{Robot-C-IWfxP9.js → Robot-B-VAYuAr.js} +5 -5
  52. package/dist/chunks/{Robot-Cfhjv9Z8.cjs → Robot-DRf8T9Zf.cjs} +1 -1
  53. package/dist/chunks/RobotActivation-CRVxXvlx.cjs +1 -0
  54. package/dist/chunks/RobotActivation-oR-8Y0iq.js +143 -0
  55. package/dist/chunks/RobotControl-Dbe50ZKM.cjs +1 -0
  56. package/dist/chunks/RobotControl-Ms1F7fFe.js +332 -0
  57. package/dist/chunks/RobotControlPanel-B7NxoHsO.cjs +1 -0
  58. package/dist/chunks/RobotControlPanel-CkQlkq8x.js +1029 -0
  59. package/dist/chunks/RobotHeader-CjOaf9s6.cjs +1 -0
  60. package/dist/chunks/RobotHeader-LSuRTDFB.js +395 -0
  61. package/dist/chunks/RobotScene-Au6zpHH1.cjs +1 -0
  62. package/dist/chunks/RobotScene-C6XEgaVR.js +1284 -0
  63. package/dist/chunks/RobotSessionProvider-CoF_tX0O.cjs +1 -0
  64. package/dist/chunks/RobotSessionProvider-DuHi-dtw.js +30 -0
  65. package/dist/chunks/{RobotView-BGYlAWj-.cjs → RobotView-Cg6JfGiY.cjs} +1 -1
  66. package/dist/chunks/{RobotView-D-v8jCM7.js → RobotView-CrAxNkyG.js} +3 -3
  67. package/dist/chunks/{robotSafetyOf-DuKKma1_.js → SafetyBar-C85BAKsL.js} +244 -215
  68. package/dist/chunks/SafetyBar-D2l81Omq.cjs +1 -0
  69. package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
  70. package/dist/chunks/{externalizeComponent-4juwPKL5.js → externalizeComponent-CChY_1bN.js} +34 -8
  71. package/dist/chunks/{useSmoothedMotionState-BSSV8aZN.js → hooks-BWoeBWLV.js} +43 -87
  72. package/dist/chunks/hooks-BXe2bNMo.cjs +1 -0
  73. package/dist/chunks/loadRobotSession-BzY9H3F8.cjs +1 -0
  74. package/dist/chunks/{loadRobotSession-GHHtv5dv.js → loadRobotSession-Ts2MumBB.js} +1065 -679
  75. package/dist/chunks/poseText-BxG4Caa-.js +48 -0
  76. package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
  77. package/dist/chunks/useSmoothedMotionState-CCXmMZ0S.cjs +1 -0
  78. package/dist/chunks/useSmoothedMotionState-CELh-YJa.js +50 -0
  79. package/dist/components/VelocitySlider.d.ts +14 -1
  80. package/dist/components/connectionWarning/ConnectionWarning.d.ts +18 -4
  81. package/dist/components/connectionWarning/connectionWarningOf.d.ts +1 -11
  82. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
  83. package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
  84. package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
  85. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  86. package/dist/components/jogging/JoggingPanel.d.ts +11 -0
  87. package/dist/components/jogging/JoggingRefusedError.d.ts +8 -3
  88. package/dist/components/jogging/JoggingStore.d.ts +206 -17
  89. package/dist/components/jogging/joggingColors.d.ts +6 -0
  90. package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
  91. package/dist/components/robotControl/JogArea.d.ts +6 -3
  92. package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
  93. package/dist/components/robotControl/JointJogTab.d.ts +10 -2
  94. package/dist/components/robotControl/MoveToTab.d.ts +24 -3
  95. package/dist/components/robotControl/PoseField.d.ts +3 -1
  96. package/dist/components/robotControl/RobotControl.d.ts +3 -0
  97. package/dist/components/robotControl/RobotControlPanel.d.ts +91 -22
  98. package/dist/components/robotControl/VelocityRow.d.ts +8 -2
  99. package/dist/components/robotControl/atPose.d.ts +6 -0
  100. package/dist/components/robotControl/poseText.d.ts +13 -1
  101. package/dist/components/robotControl/units.d.ts +10 -2
  102. package/dist/components/robotControl/useRobotControlProps.d.ts +7 -4
  103. package/dist/components/robotControl/velocityText.d.ts +18 -0
  104. package/dist/components/robotHeader/ActivationSwitch.d.ts +13 -2
  105. package/dist/components/robotHeader/RobotHeader.d.ts +25 -4
  106. package/dist/components/robotHeader/robotActivationOf.d.ts +1 -8
  107. package/dist/components/robotScene/RobotScene.d.ts +7 -1
  108. package/dist/components/robots/MotionGroupVisualizer.d.ts +6 -4
  109. package/dist/components/robots/SupportedLinearAxis.d.ts +6 -4
  110. package/dist/components/robots/SupportedRobot.d.ts +7 -5
  111. package/dist/components/robots/useFrameSmoothedMotionState.d.ts +25 -0
  112. package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
  113. package/dist/core.cjs +1 -1
  114. package/dist/core.d.ts +8 -10
  115. package/dist/core.js +60 -69
  116. package/dist/index.cjs +1 -1
  117. package/dist/index.js +100 -113
  118. package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
  119. package/dist/lib/ControllerStateStream.d.ts +9 -9
  120. package/dist/lib/JoggerConnection.d.ts +48 -13
  121. package/dist/lib/MotionStreamConnection.d.ts +3 -2
  122. package/dist/lib/TrajectoryExecutionStore.d.ts +58 -20
  123. package/dist/lib/controllerStateSource.d.ts +6 -5
  124. package/dist/lib/robotSession/RobotActivation.d.ts +52 -21
  125. package/dist/lib/robotSession/RobotSession.d.ts +27 -8
  126. package/dist/lib/robotSession/RobotTargetPose.d.ts +4 -2
  127. package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
  128. package/dist/lib/robotSession/robotPose.d.ts +0 -6
  129. package/dist/session.cjs +1 -1
  130. package/dist/session.d.ts +6 -6
  131. package/dist/session.js +30 -38
  132. package/package.json +22 -1
  133. package/dist/chunks/ConnectedMotionGroup-CybwJHkh.cjs +0 -3
  134. package/dist/chunks/JoggingRefusedError-BuCGsVsa.cjs +0 -1
  135. package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
  136. package/dist/chunks/RobotActivation-Bb0oNSBN.cjs +0 -1
  137. package/dist/chunks/RobotActivation-C0rrwpQZ.js +0 -115
  138. package/dist/chunks/RobotControl-Cv6Sr1Ni.js +0 -289
  139. package/dist/chunks/RobotControl-DFnOYMAa.cjs +0 -1
  140. package/dist/chunks/RobotControlPanel-B1_9g9D-.js +0 -850
  141. package/dist/chunks/RobotControlPanel-BpTpRBgy.cjs +0 -1
  142. package/dist/chunks/RobotScene-0ZJzXL50.cjs +0 -1
  143. package/dist/chunks/RobotScene-DpFeFpnx.js +0 -1255
  144. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +0 -1
  145. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +0 -25
  146. package/dist/chunks/externalizeComponent-Br_U-QAr.cjs +0 -2
  147. package/dist/chunks/loadRobotSession-DYbeNnTI.cjs +0 -1
  148. package/dist/chunks/poseText-BXUaQWnK.cjs +0 -1
  149. package/dist/chunks/poseText-pg4cxE8R.js +0 -41
  150. package/dist/chunks/robotActivationOf-B4oV10Za.cjs +0 -1
  151. package/dist/chunks/robotActivationOf-EzcT9g07.js +0 -368
  152. package/dist/chunks/robotSafetyOf-Dxm6s7Pp.cjs +0 -1
  153. package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +0 -1
  154. package/dist/components/robotHeader/robotSafetyOf.d.ts +0 -11
@@ -1,10 +1,9 @@
1
- import { C as n, R as r, c as t, R as e, r as f } from "../chunks/robotActivationOf-EzcT9g07.js";
2
- import { r as s } from "../chunks/robotSafetyOf-DuKKma1_.js";
1
+ import { A as t, C as e, R as r, R as n } from "../chunks/RobotHeader-LSuRTDFB.js";
2
+ import { S as s } from "../chunks/SafetyBar-C85BAKsL.js";
3
3
  export {
4
- n as ConnectionWarning,
4
+ t as ActivationSwitch,
5
+ e as ConnectionWarning,
5
6
  r as RobotHeader,
6
- t as connectionWarningOf,
7
- e as default,
8
- f as robotActivationOf,
9
- s as robotSafetyOf
7
+ s as SafetyBar,
8
+ n as default
10
9
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotScene-0ZJzXL50.cjs"),o=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.JoggingAxes=e.JoggingAxes;exports.RobotScene=e.RobotScene;exports.RobotSceneView=e.RobotSceneView;exports.default=e.RobotScene;exports.useRobotSceneProps=e.useRobotSceneProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotScene-Au6zpHH1.cjs"),o=require("../chunks/RobotSessionProvider-CoF_tX0O.cjs");exports.JoggingAxes=e.JoggingAxes;exports.RobotScene=e.RobotScene;exports.RobotSceneView=e.RobotSceneView;exports.default=e.RobotScene;exports.useRobotSceneProps=e.useRobotSceneProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
@@ -1,10 +1,10 @@
1
- import { b as s, R as a, e as t, R, u as r } from "../chunks/RobotScene-DpFeFpnx.js";
2
- import { R as n, u as i } from "../chunks/RobotSessionProvider-TVaKGzqa.js";
1
+ import { a as s, R as a, c as t, R, u as r } from "../chunks/RobotScene-C6XEgaVR.js";
2
+ import { R as b, u as i } from "../chunks/RobotSessionProvider-DuHi-dtw.js";
3
3
  export {
4
4
  s as JoggingAxes,
5
5
  a as RobotScene,
6
6
  t as RobotSceneView,
7
- n as RobotSessionProvider,
7
+ b as RobotSessionProvider,
8
8
  R as default,
9
9
  r as useRobotSceneProps,
10
10
  i as useRobotSession
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotView-BGYlAWj-.cjs"),e=require("../chunks/RobotSessionProvider--AekyPqD.cjs");exports.RobotCanvas=o.RobotCanvas;exports.RobotView=o.RobotView;exports.default=o.RobotView;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotView-Cg6JfGiY.cjs"),e=require("../chunks/RobotSessionProvider-CoF_tX0O.cjs");exports.RobotCanvas=o.RobotCanvas;exports.RobotView=o.RobotView;exports.default=o.RobotView;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
@@ -1,5 +1,5 @@
1
- import { R as a, a as e, a as t } from "../chunks/RobotView-D-v8jCM7.js";
2
- import { R, u as b } from "../chunks/RobotSessionProvider-TVaKGzqa.js";
1
+ import { R as a, a as e, a as t } from "../chunks/RobotView-CrAxNkyG.js";
2
+ import { R, u as b } from "../chunks/RobotSessionProvider-DuHi-dtw.js";
3
3
  export {
4
4
  a as RobotCanvas,
5
5
  R as RobotSessionProvider,
@@ -2,7 +2,18 @@ import { type PopoverOrigin } from "@mui/material/Popover";
2
2
  import { type TypographyProps } from "@mui/material/Typography";
3
3
  import type { ElementType, ReactNode } from "react";
4
4
  export type IndicatorWithExplanationProps = {
5
+ /** The id of the popover: one per state and component, so not stable */
5
6
  id: string;
7
+ /**
8
+ * What a test finds the indicator by, whatever it shows: the same for
9
+ * every state, e.g. "safety-state-indicator"
10
+ */
11
+ testId: string;
12
+ /**
13
+ * The name of the indicator for a screen reader and a test, e.g. "Safety
14
+ * state: Safe": it shows an icon, and its text only in the popover
15
+ */
16
+ accessibleName: string;
6
17
  icon: ElementType;
7
18
  color: TypographyProps["color"];
8
19
  title?: ReactNode;
@@ -13,7 +24,7 @@ export type IndicatorWithExplanationProps = {
13
24
  anchorOrigin?: PopoverOrigin;
14
25
  transformOrigin?: PopoverOrigin;
15
26
  };
16
- export declare const IndicatorWithExplanation: (({ id, icon, color, title, name, label, explanation, literalValue, anchorOrigin, transformOrigin, }: IndicatorWithExplanationProps) => import("react/jsx-runtime").JSX.Element) & {
27
+ export declare const IndicatorWithExplanation: (({ id, testId, accessibleName, icon, color, title, name, label, explanation, literalValue, anchorOrigin, transformOrigin, }: IndicatorWithExplanationProps) => import("react/jsx-runtime").JSX.Element) & {
17
28
  displayName: string;
18
29
  };
19
30
  export default IndicatorWithExplanation;
@@ -1,5 +1,6 @@
1
1
  import type { PopoverOrigin } from "@mui/material/Popover";
2
2
  import type { OperationMode, SafetyStateType } from "@wandelbots/nova-js/v2";
3
+ import type { RobotSession } from "../lib/robotSession/RobotSession";
3
4
  export interface SafetyBarProps {
4
5
  isVirtual: boolean;
5
6
  motionGroupId: string;
@@ -9,7 +10,20 @@ export interface SafetyBarProps {
9
10
  transformOrigin?: PopoverOrigin;
10
11
  compact?: boolean;
11
12
  }
12
- export declare const SafetyBar: (({ isVirtual, motionGroupId, operationMode, safetyState, anchorOrigin, transformOrigin, compact, }: SafetyBarProps) => import("react/jsx-runtime").JSX.Element) & {
13
+ /**
14
+ * SafetyBar for a robot session (`session`, else the provider's): its safety
15
+ * state, operation mode and controller type, which any of SafetyBarProps
16
+ * given here replaces. Without a robot, e.g. while none is loaded, nothing.
17
+ */
18
+ export type SafetyBarOfSessionProps = Partial<SafetyBarProps> & {
19
+ session: RobotSession | null | undefined;
20
+ };
21
+ /**
22
+ * The robot's safety state, operation mode and controller type. Given a
23
+ * robot session, it shows the robot's and follows them, e.g. an emergency
24
+ * stop as soon as NOVA reports it: `<SafetyBar session={session} />`.
25
+ */
26
+ export declare const SafetyBar: ((props: SafetyBarProps | SafetyBarOfSessionProps) => import("react/jsx-runtime").JSX.Element | null) & {
13
27
  displayName: string;
14
28
  };
15
29
  export default SafetyBar;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/robotSafetyOf-Dxm6s7Pp.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;exports.robotSafetyOf=e.robotSafetyOf;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-D2l81Omq.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
@@ -1,3 +1,2 @@
1
1
  export * from "./SafetyBar";
2
2
  export { SafetyBar as default } from "./SafetyBar";
3
- export { robotSafetyOf } from "../components/robotHeader/robotSafetyOf";
@@ -1,6 +1,5 @@
1
- import { S as r, S as t, r as e } from "../chunks/robotSafetyOf-DuKKma1_.js";
1
+ import { S as f, S as r } from "../chunks/SafetyBar-C85BAKsL.js";
2
2
  export {
3
- r as SafetyBar,
4
- t as default,
5
- e as robotSafetyOf
3
+ f as SafetyBar,
4
+ r as default
6
5
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -12,7 +12,7 @@ import { RoundedIconButton as Et } from "@wandelbots/mui";
12
12
  import { observer as M, useLocalObservable as pt } from "mobx-react-lite";
13
13
  import * as b from "react";
14
14
  import { useState as G, forwardRef as L, useEffect as K, useRef as q, useId as kt } from "react";
15
- import { e as H } from "./externalizeComponent-4juwPKL5.js";
15
+ import { e as H } from "./externalizeComponent-CChY_1bN.js";
16
16
  import It from "@mui/icons-material/OpenWith";
17
17
  import Jt from "@mui/icons-material/Share";
18
18
  import v from "@mui/material/Stack";
@@ -20,11 +20,11 @@ import Rt from "@mui/material/Tab";
20
20
  import _t from "@mui/material/Tabs";
21
21
  import { runInAction as w, makeAutoObservable as Pt } from "mobx";
22
22
  import { useTranslation as _ } from "react-i18next";
23
- import { O as Ot, J as At, a as Vt, n as Dt, t as Lt } from "./loadRobotSession-GHHtv5dv.js";
23
+ import { O as Ot, J as At, a as Vt, n as Dt, t as Lt } from "./loadRobotSession-Ts2MumBB.js";
24
24
  import mt from "@mui/material/CircularProgress";
25
25
  import { capitalize as $t } from "@mui/material/utils";
26
26
  import { throttle as Bt, lowerFirst as zt, isEqual as Ft, isNumber as Nt } from "lodash-es";
27
- import { m as Gt } from "./robotSafetyOf-DuKKma1_.js";
27
+ import { m as Gt } from "./SafetyBar-C85BAKsL.js";
28
28
  import Ht from "@mui/material/Alert";
29
29
  import Wt from "@mui/material/AlertTitle";
30
30
  import et from "@mui/material/Button";
@@ -33,7 +33,7 @@ import D from "@mui/material/Divider";
33
33
  import rt from "@mui/material/ToggleButton";
34
34
  import { radiansToDegrees as ft, XYZ_TO_VECTOR as at, degreesToRadians as Ut, tryParseJson as W } from "@wandelbots/nova-js";
35
35
  import X from "@mui/material/IconButton";
36
- import { c as nt } from "./useSmoothedMotionState-BSSV8aZN.js";
36
+ import { c as nt } from "./hooks-BWoeBWLV.js";
37
37
  import { e as lt, v as Yt, c as Q } from "./joggingColors-sb6IFdj2.js";
38
38
  import Zt from "@mui/material/InputAdornment";
39
39
  import Kt from "@mui/material/FormControl";
@@ -1404,7 +1404,8 @@ const yt = M(
1404
1404
  };
1405
1405
  }, [t.store, t.nova, t.motionGroupId, t.cellId]), K(() => {
1406
1406
  const n = e.joggingStore;
1407
- n && (t.locked ? n.lock("external") : n.unlock("external"));
1407
+ if (!(!n || !t.locked))
1408
+ return n.lock("external"), () => n.unlock("external");
1408
1409
  }, [e.joggingStore, t.locked]), /* @__PURE__ */ o(
1409
1410
  v,
1410
1411
  {
@@ -0,0 +1,3 @@
1
+ "use strict";const t=require("react/jsx-runtime"),be=require("@mui/material/AppBar"),se=require("@mui/material/Backdrop"),O=require("@mui/material/Box"),ve=require("@mui/material/Menu"),D=require("@mui/material/MenuItem"),je=require("@mui/material/Toolbar"),y=require("@mui/material/Typography"),ye=require("@wandelbots/design-tokens"),Ce=require("@wandelbots/icons/ExpandMoreFilled"),Se=require("@wandelbots/mui"),S=require("mobx-react-lite"),v=require("react"),W=require("./externalizeComponent-CA_sHzyH.cjs"),we=require("@mui/icons-material/OpenWith"),Me=require("@mui/icons-material/Share"),b=require("@mui/material/Stack"),Te=require("@mui/material/Tab"),Ee=require("@mui/material/Tabs"),C=require("mobx"),A=require("react-i18next"),H=require("./loadRobotSession-BzY9H3F8.cjs"),le=require("@mui/material/CircularProgress"),Ie=require("@mui/material/utils"),K=require("lodash-es"),Je=require("./SafetyBar-D2l81Omq.cjs"),ke=require("@mui/material/Alert"),Re=require("@mui/material/AlertTitle"),Q=require("@mui/material/Button"),V=require("@mui/material/styles"),q=require("@mui/material/Divider"),ie=require("@mui/material/ToggleButton"),_=require("@wandelbots/nova-js"),Z=require("@mui/material/IconButton"),te=require("./hooks-BXe2bNMo.cjs"),$=require("./joggingColors-Cqpfuw4G.cjs"),_e=require("@mui/material/InputAdornment"),Ae=require("@mui/material/FormControl"),Pe=require("@mui/material/InputLabel"),Oe=require("@mui/material/Select"),Ve=require("@mui/material/ToggleButtonGroup"),ce=require("@mui/material/Slider"),U=require("@wandelbots/nova-js/v2"),Le=require("@mui/icons-material/ChevronLeft"),De=require("@mui/icons-material/ChevronRight"),qe=require("@mui/material/Dialog"),$e=require("@mui/material/DialogActions"),Be=require("@mui/material/DialogContent"),ze=require("@mui/material/DialogTitle"),Fe=require("three"),G=require("./PoseTransformer-2QIzECOZ.cjs");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,i.get?i:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const f=de(v),re=de(Fe),Ne=W.externalizeComponent(S.observer(e=>{const{appIcon:n,appName:o,apps:i=[],onAppSelect:a,disabled:l=!1,sx:d}=e,[r,g]=v.useState(null),p=!!r,j=s=>{g(s.currentTarget)},u=()=>{g(null)},c=s=>{u(),s.onClick?s.onClick():s.href&&(window.location.href=s.href),a==null||a(s)};return t.jsxs(t.Fragment,{children:[t.jsx(be,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...d},children:t.jsxs(je,{sx:{minHeight:"62px !important"},children:[t.jsx(O,{sx:{mr:1,display:"flex",alignItems:"center"},children:n}),t.jsxs(O,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[t.jsx(y,{component:"h1",variant:"subtitle1",children:o}),i.length>0&&t.jsx(Se.RoundedIconButton,{icon:t.jsx(Ce.ExpandMoreFilled,{size:20}),ariaLabel:"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:j,disabled:l,sx:{ml:1}})]})]})}),t.jsx(se,{open:p,onClick:u,sx:{backdropFilter:"blur(4px)",backgroundColor:ye.ZeroGravityComponentsBackdropFill,zIndex:s=>s.zIndex.modal-1}}),t.jsx(ve,{id:"app-menu",anchorEl:r,open:p,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:s=>s.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:i.map(s=>t.jsxs(D,{onClick:()=>c(s),children:[t.jsx(O,{sx:{display:"flex",alignItems:"center"},children:s.icon}),t.jsx(y,{variant:"body1",sx:{ml:2},children:s.name})]},s.id))})]})})),Ge=({title:e,titleId:n,...o},i)=>f.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("g",{id:"JogMinus"},f.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),He=v.forwardRef(Ge),We=({title:e,titleId:n,...o},i)=>f.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("g",{id:"JogPlus"},f.createElement("g",{id:"Plus"},f.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),f.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),f.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),Ue=v.forwardRef(We),ee=W.externalizeComponent(S.observer(({colors:e,label:n,getDisplayedValue:o,startJogging:i,stopJogging:a,disabled:l,activeJoggingDirection:d,...r})=>{var E,I,J,k,R,B,z;te.useAnimationFrame(()=>{const T=o(),P=c.current;P&&(P.textContent=T)});const g=V.useTheme(),[p,j]=v.useState(null);v.useEffect(()=>{l&&M()},[l]);const u=d||p,c=v.useRef(null);e||(e={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const s=u?(E=e.buttonBackgroundColor)==null?void 0:E.pressed:e.borderColor,m={width:"55px",color:e.color,path:{fill:e.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},h={...m,backgroundColor:(I=e.buttonBackgroundColor)==null?void 0:I.default,":hover":{backgroundColor:(J=e.buttonBackgroundColor)==null?void 0:J.hovered},":active":{backgroundColor:(k=e.buttonBackgroundColor)==null?void 0:k.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor}},":disabled":{backgroundColor:(R=e.buttonBackgroundColor)==null?void 0:R.disabled,"svg path":{fill:g.palette.action.disabled}}},w={...m,backgroundColor:(B=e.buttonBackgroundColor)==null?void 0:B.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor},":disabled":{backgroundColor:(z=e.buttonBackgroundColor)==null?void 0:z.pressed,"svg path":{fill:g.palette.action.disabled}}};function L(T,P){l||T.button===0&&(j(P),i(P))}function M(){j(null),a()}return t.jsxs(b,{height:"64px",direction:"row",justifyContent:"center",...r,children:[t.jsx(Z,{disabled:l,disableRipple:!0,onPointerDown:T=>L(T,"-"),onPointerUp:M,onPointerOut:M,size:"large",sx:{...u==="-"?w:h,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${s??"#fff"}`,borderBottom:`2px solid ${s??"#fff"}`,borderTop:`2px solid ${s??"#fff"}`},children:t.jsx(He,{})}),t.jsxs(b,{spacing:"6px",sx:{width:"150px",backgroundColor:e.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${s??"#fff"}`,borderTop:`2px solid ${s??"#fff"}`},children:[t.jsx(b,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:e.color,".MuiTypography-root":{fontWeight:700,...l?{color:g.palette.action.disabled}:{}},...l?{"svg path":{fill:g.palette.action.disabled}}:{}},children:n}),t.jsx(y,{height:"22px",sx:{fontSize:"15px",color:l?g.palette.action.disabled:e.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:c,children:o()})]}),t.jsx(Z,{disableRipple:!0,disabled:l,onPointerDown:T=>L(T,"+"),onPointerUp:M,onPointerOut:M,size:"large",sx:{...u==="+"?w:h,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${s??"#fff"}`,borderBottom:`2px solid ${s??"#fff"}`,borderTop:`2px solid ${s??"#fff"}`},children:t.jsx(Ue,{})})]})})),ge=W.externalizeComponent(S.observer(({startJogging:e,stopJogging:n,lowerLimit:o,upperLimit:i,useDegree:a,getValue:l,disabled:d,...r})=>{var k,R,B,z,T,P,oe;const{t:g}=A.useTranslation(),[p,j]=v.useState(),u=V.useTheme(),c={background:(k=u.palette.backgroundPaperElevation)==null?void 0:k[4],color:(R=u.palette.backgroundPaperElevation)==null?void 0:R[11]},s=S.useLocalObservable(()=>({activeJoggingDir:null,startJogging(x){this.activeJoggingDir=x,e(x)},stopJogging(){this.activeJoggingDir=null,n()}})),m=K.throttle(()=>{const x=a?h(l()):l();(x===void 0||p===void 0||Math.abs(p-x)>1e-9)&&j(x)},50);te.useAnimationFrame(m);function h(x){if(x!==void 0)return _.radiansToDegrees(x)}function w(x){x.button===0&&s.startJogging("-")}function L(x){x.button===0&&s.startJogging("+")}function M(x){s.stopJogging()}function E(x){s.stopJogging()}function I(x,F=1){if(x===void 0||Number.isNaN(x))return"";const N=g("General.degree.variable",{amount:x.toFixed(F)});return x>0&&F===0?`+${N}`:N}function J(x,F=1){if(x===void 0||Number.isNaN(x))return"";const N=g("General.mm.variable",{amount:x.toFixed(F)});return x>0&&F===0?`+${N}`:N}return t.jsxs(b,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...r,sx:{"& .MuiIconButton-root":{width:"52px",color:u.palette.text.primary,alignContent:"center",backgroundColor:(B=u.palette.backgroundPaperElevation)==null?void 0:B[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(z=u.palette.backgroundPaperElevation)==null?void 0:z[11],color:u.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(T=u.palette.backgroundPaperElevation)==null?void 0:T[9]},"&:active":{...c}}},children:[t.jsx(Z,{onPointerDown:w,onPointerUp:M,onPointerOut:E,disabled:d,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...s.activeJoggingDir==="-"?c:{}},children:t.jsx(Le,{sx:{pointerEvents:"none",color:$.jointArrowColor}})}),t.jsxs(b,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(P=u.palette.backgroundPaperElevation)==null?void 0:P[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[t.jsx(y,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:d?u.palette.action.disabled:u.palette.text.primary},children:a?I(p):J(p)}),t.jsx(ce,{disabled:!0,"aria-label":"Joint position",min:a?h(o):o,max:a?h(i):i,value:p||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:d?u.palette.action.disabled:u.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:d?u.palette.action.disabled:u.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(oe=u.palette.backgroundPaperElevation)==null?void 0:oe[5],opacity:1}},marks:o!==void 0&&i!==void 0&&[{value:a?h(o):o,label:a?I(h(o),0):J(o)},{value:a?h(i):i,label:a?I(h(i),0):J(i)}]})]}),t.jsx(Z,{onPointerDown:L,onPointerUp:M,onPointerOut:E,disabled:d,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...s.activeJoggingDir==="+"?c:{}},children:t.jsx(De,{sx:{pointerEvents:"none",color:$.jointArrowColor}})})]})})),ue=e=>{const n=e.softTimeout||3e3,[o,i]=v.useState(!1);return v.useEffect(()=>{const a=setTimeout(()=>{i(!0)},n);return()=>clearTimeout(a)}),t.jsx(b,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:"text.primary"},children:e.error?t.jsx(pe,{loadingMessage:e.message,error:e.error}):t.jsxs(t.Fragment,{children:[t.jsx(le,{sx:{mb:3}}),!!e.message&&t.jsx(y,{variant:"body1",children:e.message}),t.jsx(y,{variant:"body2",sx:{visibility:o?"visible":"hidden",mt:2,color:"text.secondary"},children:"This is taking longer than expected..."})]})})},pe=e=>{const n=Je.makeErrorMessage(e.error),o=e.error instanceof Error?e.error.stack:null;return t.jsxs(b,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",p:2,overflow:"auto",color:"error.main"},children:[t.jsx(y,{variant:"body1",children:(e.loadingMessage?`Error while ${K.lowerFirst(Ie.capitalize(e.loadingMessage))} - `:"")+n}),o&&t.jsx(O,{component:"pre",sx:{typography:"body2",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",mt:2,pb:6},children:o})]})},Ye=S.observer(({store:e})=>{const{t:n}=A.useTranslation();return t.jsx(se,{"data-testid":"jogging-blocked","aria-label":"jogging-blocked",open:!0,sx:{position:"absolute",zIndex:o=>o.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:t.jsxs(b,{sx:{m:2,width:"100%"},children:[t.jsxs(ke,{severity:"error",sx:{mb:2},children:[t.jsx(Re,{children:n("Jogging.Blocked.ti")}),n("Jogging.Blocked.lb")]}),t.jsx(Q,{variant:"contained",color:"secondary",onClick:()=>e.unblock(),children:n("Jogging.Blocked.Reenable.bt")})]})})}),Ze=({title:e,titleId:n,...o},i)=>f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),Xe=v.forwardRef(Ze),Ke=({title:e,titleId:n,...o},i)=>f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),Qe=v.forwardRef(Ke),et=({title:e,titleId:n,...o},i)=>f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M9.522 14.811A.899.899 0 1 0 8.25 13.54L6.19 15.601V3.16L8.25 5.221A.9.9 0 0 0 9.522 3.95L5.926.354a.9.9 0 0 0-1.272 0L1.058 3.95a.9.9 0 1 0 1.271 1.271L4.391 3.16v12.442L2.329 13.54a.899.899 0 1 0-1.271 1.271l3.596 3.597a.9.9 0 0 0 1.272 0z",clipRule:"evenodd"})),tt=v.forwardRef(et),nt=({title:e,titleId:n,...o},i)=>f.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":n,...o},e?f.createElement("title",{id:n},e):null,f.createElement("path",{d:"M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C11.0583 14.1 12.5083 12.1667 11.475 12.9L12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z",fill:"white"})),ot=v.forwardRef(nt),he=S.observer(({store:e})=>{const{t:n}=A.useTranslation(),[o,i]=v.useState(e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),a=v.useRef(o);te.useAnimationFrame(()=>{const d=e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;K.isEqual(a.current,d)||(a.current=d,i(d))});const l=[];for(const[d,r]of o.entries())r&&l.push(d);return t.jsx(O,{sx:{display:"flex",flexDirection:"row",justifyContent:"center"},children:t.jsx(y,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2,visibility:l.length?"visible":"hidden"},children:n("Jogging.JointLimitsReached.lb",{jointNumbers:l.map(d=>d+1).join(", ")})})})}),it=V.styled(Ae)(({theme:e})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:e.palette.text.primary}}}}));function Y({labelValue:e,...n}){return t.jsxs(it,{fullWidth:!0,variant:"filled",children:[t.jsx(Pe,{id:n.labelId,children:e}),t.jsx(Oe,{...n})]})}const rt=S.observer(({store:e,useDegree:n})=>{var d;const{t:o}=A.useTranslation(),i=v.useId(),a=[];function l(r){switch(r){case"coordsys":return o("Jogging.Orientation.coordsys");case"tool":return o("Jogging.Orientation.tool");default:return r}}return e.showCoordSystemSelect&&a.push(t.jsx(Y,{labelId:`jogging-coord-select-${i}`,labelValue:o("Jogging.CoordinateSystem.hlb"),value:e.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:r=>e.setSelectedCoordSystemId(r.target.value),children:e.coordSystems.map(r=>t.jsx(D,{value:r.coordinate_system,children:r.name&&e.coordSystemCountByName[r.name]>1?`${r.name} / ${r.coordinate_system}`:r.name||r.coordinate_system},r.coordinate_system))},"coord")),e.showTcpSelect&&a.push(t.jsx(Y,{labelId:`jogging-tcp-select-${i}`,labelValue:"TCP",value:e.selectedTcpId,size:"small",variant:"filled",displayEmpty:e.tcpChangeInProgress,onChange:r=>{e.requestTcpChange(r.target.value).catch(g=>{console.error("Failed to change TCP:",g)})},disabled:e.tcpChangeInProgress,endAdornment:e.tcpChangeInProgress?t.jsx(_e,{position:"end",children:t.jsx(le,{size:16})}):void 0,children:e.tcps.map(r=>t.jsx(D,{value:r.id,children:r.id},r.id))},"tcp")),e.showOrientationSelect&&a.push(t.jsx(Y,{labelValue:o("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${i}`,value:e.selectedOrientation,onChange:r=>e.setSelectedOrientation(r.target.value),children:H.ORIENTATION_IDS.map(r=>t.jsx(D,{value:r,children:l(r)},r))},"orientation")),e.showIncrementSelect&&a.push(t.jsxs(Y,{labelValue:o("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${i}`,size:"small",variant:"filled",value:((d=e.activeDiscreteIncrement)==null?void 0:d.id)||"continuous",onChange:r=>e.setSelectedIncrementId(r.target.value),children:[t.jsx(D,{value:"continuous",children:o("Jogging.Increment.Continuous.dd")},"continuous"),e.discreteIncrementOptions.map(r=>t.jsx(D,{value:r.id,children:n?`${r.degrees}°`:`${r.mm}mm`},r.id))]},"increment")),t.jsx(O,{component:"div","data-testid":"jogging-options","aria-label":"jogging-options",sx:{display:"grid",gap:"16px",gridTemplateColumns:"1fr 1fr",gridAutoRows:"min-content","& label":{opacity:.7,fontSize:"12px",marginBottom:"4px"}},children:a.map((r,g)=>t.jsx(O,{sx:{gridColumn:a.length%2===1&&g===a.length-1?"span 2":"auto"},children:r},g))})}),at=V.styled(Ve)(({theme:e})=>{var n;return{"&.MuiToggleButtonGroup-root":{background:(n=e.palette.backgroundPaperElevation)==null?void 0:n[8],borderRadius:"8px",padding:"4px",gap:"4px",button:{border:"none",borderRadius:"4px",flex:"1 1 0px",minWidth:0,"&.MuiToggleButtonGroup-firstButton":{borderRadius:"8px 4px 4px 8px"},"&.MuiToggleButtonGroup-lastButton":{borderRadius:"4px 8px 8px 4px"}}}}}),xe=W.externalizeComponent(S.observer(e=>{const{store:n}=e,{t:o}=A.useTranslation();function i(a,l){l===e.velocity||!K.isNumber(l)||e.onVelocityChange(l,e.useDegree)}return t.jsxs(b,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[n.showVelocityLegend&&t.jsx(y,{sx:{color:$.velocitySliderLegendColor,fontSize:"14px"},children:o("Jogging.Velocity.bt")}),t.jsx(ce,{value:e.velocity,color:"secondary",onChange:i,min:e.min,max:e.max,"aria-labelledby":"input-slider",disabled:e.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),n.showVelocitySliderLabel&&(e.renderValue?e.renderValue(e.velocity):t.jsx(ne,{value:e.velocity.toString()}))]})}));function ne({value:e,sx:n}){var i;const o=V.useTheme();return t.jsx(b,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(i=o.palette.backgroundPaperElevation)==null?void 0:i[8],borderRadius:"10px",minWidth:"111px",...n},children:t.jsx(y,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:o.palette.text.primary,whiteSpace:"nowrap"},children:e})})}const me=S.observer(({store:e,useDegree:n})=>{const{t:o}=A.useTranslation();function i(a,l){return l?`ω = ${o("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:a})}`:`v = ${o("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:a})}`}return t.jsx(xe,{store:e,velocity:e.velocityInDisplayUnits(n),min:e.minVelocityInDisplayUnits(n),max:e.maxVelocityInDisplayUnits(n),onVelocityChange:e.setVelocityFromSlider,useDegree:n,disabled:e.isLocked,renderValue:a=>t.jsx(ne,{value:i(a,n),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),fe=S.observer(({store:e})=>{var d,r,g;const{t:n}=A.useTranslation(),o=V.useTheme(),i=((g=(r=(d=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:d.details)==null?void 0:r.state)==null?void 0:g.kind)??"KIND_UNKNOWN",a=e.lastJogError,l=e.lastJogErrorTranslationKey;return t.jsxs(O,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",color:o.palette.text.primary},children:[t.jsx(y,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:n("Jogging.StreamStateSection.lb")}),t.jsx(y,{variant:"body2",color:a?"error":void 0,sx:{fontSize:"0.75rem",lineHeight:1.2,textAlign:"right"},"data-testid":a?"JOG_ERROR":i,children:a?l?n(l):a:n(`Jogging.StreamStateSection.${i}.lb`)})]})}),st=S.observer(({store:e,children:n})=>{const{t:o}=A.useTranslation(),i=V.useTheme(),a=v.useRef(0);function l(c,s){(s==="translate"||s==="rotate")&&e.setSelectedCartesianMotionType(s)}async function d(c,s){const m=await e.activate(),h=m.motionStream.rapidlyChangingMotionState.tcp_pose,w=m.motionStream.rapidlyChangingMotionState.joint_position;h&&await e.withMotionLock(async()=>{try{e.setCurrentIncrementJog({axis:c.axis,direction:c.direction}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:h,currentJoints:w,coordSystemId:e.activeCoordSystemId,velocityInRelevantUnits:e.selectedCartesianMotionType==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:c.axis,direction:c.direction,motion:e.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:s.mm}:{type:"rotate",distanceRads:_.degreesToRadians(s.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}async function r(c){if(e.isLocked)return;const s=++a.current;try{if(await e.activate(),s!==a.current)return;if(e.activeDiscreteIncrement)return await d(c,e.activeDiscreteIncrement);c.motionType==="translate"?await e.jogger.translateTCP({axis:c.axis,direction:c.direction,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:c.axis,direction:c.direction,velocityRadsPerSec:e.rotationVelocityRadsPerSec})}catch(m){console.error("Jogging failed:",m)}}async function g(){e.activeDiscreteIncrement||(a.current++,await e.deactivate())}const p=[{id:"x",icon:t.jsx(Xe,{}),colors:$.cartesianAxisColors.X},{id:"y",icon:t.jsx(Qe,{}),colors:$.cartesianAxisColors.Y},{id:"z",icon:t.jsx(tt,{}),colors:$.cartesianAxisColors.Z}];function j(c){return o("General.mm.variable",{amount:c.toFixed(1)})}function u(c){return o("General.degree.variable",{amount:_.radiansToDegrees(c).toFixed(1)})}return t.jsxs(b,{"data-testid":"jogging-cartesian-tab","aria-label":"jogging-cartesian-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[t.jsxs(b,{gap:2,children:[t.jsx(rt,{store:e,useDegree:e.selectedCartesianMotionType==="rotate"}),t.jsx(me,{store:e,useDegree:e.selectedCartesianMotionType==="rotate"}),t.jsx(q,{})]}),t.jsx(b,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:t.jsxs(b,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[t.jsxs(at,{value:e.selectedCartesianMotionType,onChange:l,exclusive:!0,"aria-label":o("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[t.jsx(ie,{value:"translate",children:o("Jogging.Cartesian.Translation.bt")}),t.jsx(ie,{value:"rotate",children:o("Jogging.Cartesian.Rotation.bt")})]}),e.selectedCartesianMotionType==="translate"&&p.map(c=>{var s,m;return t.jsx(ee,{"data-testid":`jogging-cartesian-axis-control-${c.id}`,"aria-label":`jogging-cartesian-axis-control-${c.id}`,colors:c.colors,disabled:e.isLocked,activeJoggingDirection:((s=e.incrementJogInProgress)==null?void 0:s.axis)===c.id?e.incrementJogInProgress.direction:void 0,label:t.jsxs(t.Fragment,{children:[c.icon,t.jsx(y,{sx:{fontSize:"24px",color:((m=c.colors)==null?void 0:m.labelColor)??i.palette.text.primary},children:c.id.toUpperCase()})]}),getDisplayedValue:()=>{var h,w;return j(((w=(h=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:h.position)==null?void 0:w[_.XYZ_TO_VECTOR[c.id]])||0)},startJogging:h=>r({axis:c.id,motionType:"translate",direction:h}),stopJogging:g},c.id)}),e.selectedCartesianMotionType==="rotate"&&p.map(c=>{var s,m;return t.jsx(ee,{"data-testid":`jogging-cartesian-axis-control-${c.id}`,"aria-label":`jogging-cartesian-axis-control-${c.id}`,colors:c.colors,disabled:e.isLocked,activeJoggingDirection:((s=e.incrementJogInProgress)==null?void 0:s.axis)===c.id?e.incrementJogInProgress.direction:void 0,label:t.jsxs(t.Fragment,{children:[t.jsx(ot,{}),t.jsx(y,{sx:{fontSize:"24px",color:((m=c.colors)==null?void 0:m.labelColor)??i.palette.text.primary},children:c.id.toUpperCase()})]}),getDisplayedValue:()=>{var h,w;return u(((w=(h=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:h.orientation)==null?void 0:w[_.XYZ_TO_VECTOR[c.id]])||0)},startJogging:h=>r({axis:c.id,motionType:"rotate",direction:h}),stopJogging:g},c.id)})]})}),t.jsx(he,{store:e}),t.jsx(q,{}),t.jsx(fe,{store:e}),n&&t.jsx(q,{}),n]})}),lt=S.observer(({store:e,children:n})=>{const o=V.useTheme(),i=v.useRef(0);async function a(d){const r=++i.current;try{if(await e.activate(),r!==i.current)return;await e.jogger.rotateJoints({joint:d.joint,direction:d.direction,velocityUnit:e.jointType===U.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:e.jointType===U.JointTypeEnum.PrismaticJoint?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec})}catch(g){console.error("Jogging failed:",g)}}async function l(){i.current++,await e.jogger.stop(),await e.deactivate()}return t.jsxs(b,{"data-testid":"jogging-joint-tab","aria-label":"jogging-joint-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[t.jsx(me,{store:e,useDegree:e.jointType===U.JointTypeEnum.RevoluteJoint}),t.jsx(q,{}),t.jsx(b,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:t.jsx(b,{"data-testid":"jogging-joint-value-controls-wrapper","aria-label":"jogging-joint-value-controls-wrapper",alignItems:"center",gap:"24px",children:e.jogger.motionStream.joints.map(d=>{var g,p,j;const r=(j=(p=(g=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:g.joints)==null?void 0:p[d.index])==null?void 0:j.position;return t.jsxs(b,{"data-testid":`jogging-joint-value-control-${d.index}`,"aria-label":`jogging-joint-value-control-${d.index}`,direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[e.showJointsLegend&&t.jsx(y,{color:e.isLocked?o.palette.text.disabled:o.palette.text.secondary,children:`G${d.index+1}`}),t.jsx(ge,{disabled:e.isLocked,lowerLimit:r==null?void 0:r.lower_limit,upperLimit:r==null?void 0:r.upper_limit,useDegree:e.jointType===U.JointTypeEnum.RevoluteJoint,getValue:()=>{const u=e.jogger.motionStream.rapidlyChangingMotionState.joint_position[d.index];return u!==void 0?u:void 0},startJogging:u=>a({joint:d.index,direction:u}),stopJogging:l})]},`joint-${d.index}`)})})}),t.jsx(he,{store:e}),t.jsx(q,{}),t.jsx(fe,{store:e}),n&&t.jsx(q,{}),n]})}),ct=W.externalizeComponent(S.observer(e=>{const n=S.useLocalObservable(()=>({joggingStore:null,loadingError:null}));return v.useEffect(()=>{let o=!1,i;async function a(){C.runInAction(()=>{n.loadingError=null,n.joggingStore=null});try{let l=e.store;if(!l){const d=await H.JoggerConnection.open(e.nova,e.motionGroupId,{cellId:e.cellId});if(o){d.dispose();return}try{l=await H.JoggingStore.loadFor(d)}catch(r){throw d.dispose(),r}if(i=l,o){l.dispose();return}}C.runInAction(()=>{n.joggingStore=l}),e.onSetup&&e.onSetup(l)}catch(l){if(o)return;C.runInAction(()=>{n.loadingError=l})}}return a(),()=>{o=!0,i==null||i.dispose()}},[e.store,e.nova,e.motionGroupId,e.cellId]),v.useEffect(()=>{const o=n.joggingStore;if(!(!o||!e.locked))return o.lock("external"),()=>o.unlock("external")},[n.joggingStore,e.locked]),t.jsx(b,{"data-testid":"jogging-panel","aria-label":"jogging-panel",sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...e.sx},children:n.joggingStore?t.jsx(dt,{store:n.joggingStore,children:e.children}):t.jsx(ue,{message:"Loading jogging",error:n.loadingError})})})),dt=S.observer(({store:e,children:n})=>{const{t:o}=A.useTranslation();function i(){if(e.currentTab.id==="cartesian")return t.jsx(st,{store:e,children:n});if(e.currentTab.id==="joint")return t.jsx(lt,{store:e,children:n})}return t.jsxs(b,{flexGrow:1,sx:{overflow:"hidden"},children:[t.jsx(Ee,{"data-testid":"jogging-tabs","aria-label":"jogging-tabs",value:e.tabIndex,onChange:e.onTabChange,variant:"fullWidth",children:e.tabs.map(a=>{const l=a.label==="Cartesian"?o("Jogging.Cartesian.bt"):o("Jogging.Joints.bt"),d=a.label==="cartesian"?t.jsx(we,{fontSize:"small",sx:{mr:1}}):t.jsx(Me,{fontSize:"small",sx:{mr:1}});return t.jsx(Te,{"data-testid":`jogging-tab-${a.id}`,"aria-label":`jogging-tab-${a.id}`,label:e.showTabIcons?t.jsxs(b,{direction:"row",alignItems:"center",children:[d,l]}):l,id:`jogging-tab-${a.id}`,"aria-controls":`jogging-tab-${a.id}`},a.id)})}),t.jsx(b,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:i()}),e.blocked&&t.jsx(Ye,{store:e})]})});function gt(){const e=window.location.href;return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function ut({baseUrl:e=gt(),...n}){return t.jsxs(qe,{"aria-labelledby":"no-motion-group-modal-title",open:!0,fullWidth:!0,sx:{"& .MuiModal-backdrop":{backdropFilter:"blur(10px)"},"& .MuiDialog-paper":{"::before":{content:'""',height:"8px",width:"100%",background:"linear-gradient(90deg, #FF0E65 0%, #47D3FF 100%)"},background:"#101629"}},children:[t.jsx(ze,{id:"no-motion-group-modal-title",children:"No motion group found"}),t.jsxs(Be,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[t.jsx(y,{color:"#fff",children:"Found no devices to connect to."}),t.jsx(y,{color:"#fff",children:"Please ensure a motion group has been created."})]}),t.jsx($e,{children:t.jsxs(b,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[t.jsx(Q,{href:`${e}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),t.jsx(Q,{href:`${e}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}const ae=1e-4,pt={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class X{constructor(n,o,i,a,l,d,r,g,p,j,u="cell"){this.controller=o,this.motionGroup=i,this.initialMotionState=a,this.motionStateSocket=l,this.isVirtual=d,this.tcps=r,this.description=g,this.initialControllerState=p,this.controllerStateSocket=j,this.cellId=u,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.nova=G.createNovaClient(n),this.rapidlyChangingMotionState=a,this.controllerState=p,j.addEventListener("message",c=>{var m;const s=(m=_.tryParseJson(c.data))==null?void 0:m.result;s&&C.runInAction(()=>{this.controllerState=s})}),l.addEventListener("message",c=>{var m;const s=(m=_.tryParseJson(c.data))==null?void 0:m.result;if(!s)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${c.data}`);H.jointValuesUnchanged(this.rapidlyChangingMotionState.joint_position,s.joint_position,ae)||C.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=s.joint_position}),H.tcpMotionEqual(this.rapidlyChangingMotionState,s,ae)||C.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=s.tcp_pose}),s.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==s.tcp&&C.runInAction(()=>{this.rapidlyChangingMotionState.tcp=s.tcp}),this.rapidlyChangingMotionState.standstill!==s.standstill&&C.runInAction(()=>{this.rapidlyChangingMotionState.standstill=s.standstill})}),C.makeAutoObservable(this)}static async connectMultiple(n,o,i={}){const a=G.createNovaClient(n),l=i.cellId??G.cellIdOf(n);return Promise.all(o.map(d=>X.connect(a,d,{...i,cellId:l})))}static async connect(n,o,i={}){var I,J;const a=G.createNovaClient(n),l=i.cellId??G.cellIdOf(n)??"cell",[d,r]=o.split("@"),g=await a.api.controller.getCurrentRobotControllerState(l,r),p=g==null?void 0:g.motion_groups.find(k=>k.motion_group===o);if(!g||!p)throw new Error(`Controller ${r} or motion group ${o} not found`);const j=a.openReconnectingWebsocket(`/cells/${l}/controllers/${r}/motion-groups/${o}/state-stream`),u=await j.firstMessage(),c=(I=_.tryParseJson(u.data))==null?void 0:I.result;if(!c)throw new Error(`Unable to parse initial motion state message ${u.data}`);console.log(`Connected motion state websocket to motion group ${p.motion_group}. Initial state:
2
+ `,c);const m=(await a.api.controller.getRobotController(l,g.controller)).configuration.kind==="VirtualController",h=await a.api.motionGroup.getMotionGroupDescription(l,r,p.motion_group),w=Object.entries(h.tcps||{}).map(([k,R])=>({id:k,readable_name:R.name,position:R.pose.position,orientation:R.pose.orientation})),L=a.openReconnectingWebsocket(`/cells/${l}/controllers/${g.controller}/state-stream?response_rate=1000`),M=await L.firstMessage(),E=(J=_.tryParseJson(M.data))==null?void 0:J.result;if(!E)throw new Error(`Unable to parse initial controller state message ${M.data}`);return console.log(`Connected controller state websocket to controller ${g.controller}. Initial state:
3
+ `,E),new X(a,g,p,c,j,m,w,h,E,L,l)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get modelFromController(){return this.description.motion_group_model}get joggingVelocityRads(){return this.joggingVelocity*Math.PI/180}get joints(){return this.initialMotionState.joint_position.map((n,o)=>({index:o}))}get dhParameters(){if(this.description.dh_parameters!==void 0)return this.description.dh_parameters.map(n=>({...pt,...n}))}get safetyZones(){return this.description.safety_zones}get mountingPosition(){var n,o,i;return this.description.mounting?[(((n=this.description.mounting.position)==null?void 0:n[0])||0)/1e3,(((o=this.description.mounting.position)==null?void 0:o[1])||0)/1e3,(((i=this.description.mounting.position)==null?void 0:i[2])||0)/1e3]:[0,0,0]}get mountingQuaternion(){var a,l,d,r,g,p;const n=new re.Vector3(((l=(a=this.description.mounting)==null?void 0:a.orientation)==null?void 0:l[0])||0,((r=(d=this.description.mounting)==null?void 0:d.orientation)==null?void 0:r[1])||0,((p=(g=this.description.mounting)==null?void 0:g.orientation)==null?void 0:p[2])||0),o=n.length(),i=n.normalize();return new re.Quaternion().setFromAxisAngle(i,o)}get isEstopActive(){return["SAFETY_STATE_ROBOT_EMERGENCY_STOP","SAFETY_STATE_DEVICE_EMERGENCY_STOP"].includes(this.controllerState.safety_state)}get isMoveableSafetyState(){return["SAFETY_STATE_NORMAL","SAFETY_STATE_REDUCED"].includes(this.controllerState.safety_state)}get isMoveableOperationMode(){return["OPERATION_MODE_AUTO","OPERATION_MODE_MANUAL","OPERATION_MODE_MANUAL_T1","OPERATION_MODE_MANUAL_T2"].includes(this.controllerState.operation_mode)}get canBeMoved(){return this.isMoveableSafetyState&&this.isMoveableOperationMode&&this.activationState==="active"}async deactivate(){if(this.activationState!=="active"){console.error("Tried to deactivate while already deactivating");return}C.runInAction(()=>{this.activationState="deactivating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_MONITOR"),C.runInAction(()=>{this.activationState="inactive"})}catch(n){throw C.runInAction(()=>{this.activationState="active"}),n}}async activate(){if(this.activationState!=="inactive"){console.error("Tried to activate while already activating");return}C.runInAction(()=>{this.activationState="activating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_CONTROL"),C.runInAction(()=>{this.activationState="active"})}catch(n){throw C.runInAction(()=>{this.activationState="inactive"}),n}}toggleActivation(){this.activationState==="inactive"?this.activate():this.activationState==="active"&&this.deactivate()}dispose(){this.motionStateSocket.close(),this.controllerStateSocket.close(),this.connectedJoggingSocket&&this.connectedJoggingSocket.close()}setJoggingVelocity(n){this.joggingVelocity=n}}exports.AppHeader=Ne;exports.ConnectedMotionGroup=X;exports.JoggingCartesianAxisControl=ee;exports.JoggingJointValueControl=ge;exports.JoggingPanel=ct;exports.LoadingCover=ue;exports.LoadingErrorMessage=pe;exports.NoMotionGroupModal=ut;exports.VelocitySlider=xe;exports.VelocitySliderLabel=ne;
@@ -1 +1 @@
1
- "use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider--AekyPqD.cjs"),f=require("./CurrentPoseBar-BTBAwIO4.cjs"),p=require("react"),q=require("react-i18next"),v=require("./externalizeComponent-Br_U-QAr.cjs"),x=require("./coordSystemLabel-BThpFG9n.cjs");function m(n){var u,d,l;const e=n.jogging,{t:r}=q.useTranslation(void 0,{i18n:v.i18n}),[o,s]=p.useState(e.selectedTcpId),[i,g]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,C=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,y=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function I(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:I,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:s}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:x.coordSystemLabel(e,t)})),value:a,onChange:g},state:C,error:y}}const T=S.observer(function({session:e,...r}){const o=b.useRobotSessionOf(e),s=m(o);return P.jsx(f.CurrentPoseBar,{...s,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=m;
1
+ "use strict";const P=require("react/jsx-runtime"),S=require("mobx-react-lite"),b=require("./RobotSessionProvider-CoF_tX0O.cjs"),f=require("./CurrentPoseBar-DoOUfRRs.cjs"),p=require("react"),q=require("react-i18next"),v=require("./externalizeComponent-CA_sHzyH.cjs"),x=require("./coordSystemLabel-BThpFG9n.cjs");function m(n){var u,d,l;const e=n.jogging,{t:r}=q.useTranslation(void 0,{i18n:v.i18n}),[o,s]=p.useState(e.selectedTcpId),[i,g]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,C=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,y=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function I(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:I,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:s}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:x.coordSystemLabel(e,t)})),value:a,onChange:g},state:C,error:y}}const T=S.observer(function({session:e,...r}){const o=b.useRobotSessionOf(e),s=m(o);return P.jsx(f.CurrentPoseBar,{...s,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=m;
@@ -1,10 +1,10 @@
1
1
  import { jsx as y } from "react/jsx-runtime";
2
2
  import { observer as I } from "mobx-react-lite";
3
- import { a as S } from "./RobotSessionProvider-TVaKGzqa.js";
4
- import { C as P } from "./CurrentPoseBar-CX1xFBtm.js";
3
+ import { a as S } from "./RobotSessionProvider-DuHi-dtw.js";
4
+ import { C as P } from "./CurrentPoseBar--HkZBGnN.js";
5
5
  import { useState as l } from "react";
6
6
  import { useTranslation as b } from "react-i18next";
7
- import { i as T } from "./externalizeComponent-4juwPKL5.js";
7
+ import { i as T } from "./externalizeComponent-CChY_1bN.js";
8
8
  import { c as v } from "./coordSystemLabel-Bfy9MUsV.js";
9
9
  function h(n) {
10
10
  var d, m, p;
@@ -8,8 +8,8 @@ import { ContentCopyFilled as tn } from "@wandelbots/icons/ContentCopyFilled";
8
8
  import { Settings as on } from "@wandelbots/icons/Settings";
9
9
  import { memo as rn, useId as K, useRef as $, useState as j, useCallback as T } from "react";
10
10
  import { useTranslation as U } from "react-i18next";
11
- import { e as an } from "./externalizeComponent-4juwPKL5.js";
12
- import { b as sn } from "./poseText-pg4cxE8R.js";
11
+ import { e as an } from "./externalizeComponent-CChY_1bN.js";
12
+ import { p as sn } from "./poseText-BxG4Caa-.js";
13
13
  import { S as ln } from "./SmallSelect-BdD9uLKK.js";
14
14
  import { P as B, a as cn, u as un } from "./useEveryFrame-D04ygIe7.js";
15
15
  import pn from "@mui/material/ListSubheader";
@@ -53,8 +53,8 @@ const X = { X: 0, Y: 1, Z: 2 };
53
53
  function Cn(n) {
54
54
  return n > Math.PI ? n - 2 * Math.PI : n < -Math.PI ? n + 2 * Math.PI : n;
55
55
  }
56
- function bn(n, e) {
57
- const { intrinsic: t, axes: r } = y(e), c = t ? [...r].reverse() : r, i = X[c[0]], s = X[c[1]], p = c[0] === c[2], a = p ? 3 - i - s : X[c[2]], h = (i - s) * (s - a) * (a - i) / 2, F = Math.hypot(...n) || 1, [M, A, v, b] = n.map((en) => en / F), I = [M, A, v], S = I[i] ?? 0, E = I[s] ?? 0, f = (I[a] ?? 0) * h, [O, g, _, w] = p ? [b, S, E, f] : [b - E, S + f, E + b, f - S];
56
+ function fn(n, e) {
57
+ const { intrinsic: t, axes: r } = y(e), c = t ? [...r].reverse() : r, i = X[c[0]], s = X[c[1]], p = c[0] === c[2], a = p ? 3 - i - s : X[c[2]], h = (i - s) * (s - a) * (a - i) / 2, F = Math.hypot(...n) || 1, [M, A, v, f] = n.map((en) => en / F), I = [M, A, v], S = I[i] ?? 0, E = I[s] ?? 0, b = (I[a] ?? 0) * h, [O, g, _, w] = p ? [f, S, E, b] : [f - E, S + b, E + f, b - S];
58
58
  let x = 2 * Math.atan2(Math.hypot(_, w), Math.hypot(O, g));
59
59
  const N = Math.atan2(g, O), P = Math.atan2(w, _);
60
60
  let l, u;
@@ -65,7 +65,7 @@ function Z({ children: n }) {
65
65
  return /* @__PURE__ */ o(pn, { children: n });
66
66
  }
67
67
  Z.muiSkipListHighlight = !0;
68
- function fn({
68
+ function bn({
69
69
  value: n,
70
70
  onChange: e
71
71
  }) {
@@ -174,7 +174,7 @@ function In({
174
174
  }
175
175
  ),
176
176
  r.type === "eulerAngles" && /* @__PURE__ */ o(
177
- fn,
177
+ bn,
178
178
  {
179
179
  value: r.eulerConvention,
180
180
  onChange: (a) => p({ eulerConvention: a })
@@ -214,7 +214,7 @@ function Nn(n, e) {
214
214
  case "quaternion":
215
215
  return Q(n).map((t) => L(t, 3));
216
216
  case "eulerAngles":
217
- return bn(
217
+ return fn(
218
218
  Q(n),
219
219
  e.eulerConvention
220
220
  ).map((t) => V(t, e.angleUnit));
@@ -321,7 +321,7 @@ const Y = () => /* @__PURE__ */ o(J, { orientation: "vertical", flexItem: !1, sx
321
321
  onOrientationFormatChange: s,
322
322
  sx: p
323
323
  }) => {
324
- const { t: a } = U(), h = $(null), [F, M] = j(Sn), A = i ?? F, [v, b] = j(null), { copied: I, copy: S } = cn(), E = un(() => JSON.stringify(n()), !0), f = JSON.parse(E), O = Pn(f, A), g = $({ tcp: e, frame: t, onOrientationFormatChange: s });
324
+ const { t: a } = U(), h = $(null), [F, M] = j(Sn), A = i ?? F, [v, f] = j(null), { copied: I, copy: S } = cn(), E = un(() => JSON.stringify(n()), !0), b = JSON.parse(E), O = Pn(b, A), g = $({ tcp: e, frame: t, onOrientationFormatChange: s });
325
325
  g.current = { tcp: e, frame: t, onOrientationFormatChange: s };
326
326
  const _ = T(
327
327
  (l) => {
@@ -338,7 +338,7 @@ const Y = () => /* @__PURE__ */ o(J, { orientation: "vertical", flexItem: !1, sx
338
338
  ), x = T((l) => {
339
339
  var u, m;
340
340
  M(l), (m = (u = g.current).onOrientationFormatChange) == null || m.call(u, l);
341
- }, []), N = T(() => b(null), []);
341
+ }, []), N = T(() => f(null), []);
342
342
  function P() {
343
343
  const l = n();
344
344
  l && S(sn(l));
@@ -381,7 +381,7 @@ const Y = () => /* @__PURE__ */ o(J, { orientation: "vertical", flexItem: !1, sx
381
381
  "aria-label": a("CurrentPose.OrientationFormat.ti"),
382
382
  "aria-haspopup": "dialog",
383
383
  "aria-expanded": v !== null,
384
- onClick: () => b(h.current),
384
+ onClick: () => f(h.current),
385
385
  sx: { padding: "3px", margin: "-3px", color: "text.secondary" },
386
386
  children: /* @__PURE__ */ o(on, {})
387
387
  }
@@ -468,7 +468,7 @@ const Y = () => /* @__PURE__ */ o(J, { orientation: "vertical", flexItem: !1, sx
468
468
  {
469
469
  "aria-label": a("CurrentPose.Copy.bt"),
470
470
  onClick: P,
471
- disabled: !f,
471
+ disabled: !b,
472
472
  sx: {
473
473
  width: "30px",
474
474
  height: "30px",
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),N=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),q=require("react-i18next"),K=require("./externalizeComponent-Br_U-QAr.cjs"),ee=require("./poseText-BXUaQWnK.cjs"),ne=require("./SmallSelect-Dcsd7_6_.cjs"),_=require("./useEveryFrame-NeKiPXY-.cjs"),te=require("@mui/material/ListSubheader"),re=require("@mui/material/MenuItem"),oe=require("@mui/material/Popover"),ie=require("@wandelbots/mui"),se=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function y(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function le(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function ce(e,n){const{intrinsic:r,axes:o}=y(n),c=r?[...o].reverse():o,i=U[c[0]],a=U[c[1]],p=c[0]===c[2],s=p?3-i-a:U[c[2]],x=(i-a)*(a-s)*(s-i)/2,F=Math.hypot(...e)||1,[L,R,I,m]=e.map(V=>V/F),S=[L,R,I],j=S[i]??0,f=S[a]??0,v=(S[s]??0)*x,[T,g,A,O]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(A,O),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(O,A);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(le)}function X({children:e}){return t.jsx(te,{children:e})}X.muiSkipListHighlight=!0;function ue({value:e,onChange:n}){const{t:r}=q.useTranslation(),o=d.useId(),c=a=>{const{intrinsic:p,axes:s}=y(a);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:s.join("")})},i=a=>ae.filter(p=>y(p).intrinsic===a).map(p=>t.jsx(re,{value:p,children:y(p).axes.join("")},p));return t.jsxs(ie.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:a=>c(a),onChange:a=>n(a.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const pe=d.memo(de,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function de({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=q.useTranslation(),a=i("CurrentPose.OrientationFormat.ti"),p=s=>c({...o,...s});return t.jsxs(oe,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":a,sx:s=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${s.palette.divider}`,background:(x=s.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:s.shadows[16]}}}},children:[t.jsx(N,{variant:"subtitle2",color:"text.primary",children:a}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(_.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:s=>p({type:s}),disabled:!1}),o.type!=="quaternion"&&t.jsx(_.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:s=>p({angleUnit:s}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ue,{value:o.eulerConvention,onChange:s=>p({eulerConvention:s})})]})]})}const xe={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function he(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return y(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function ge(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return ce(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function Ce(e,n){const r=["x","y","z"].map((i,a)=>({label:i.toUpperCase(),value:e?w(e.position[a]??0,1):"–",kind:i})),o=e?ge(e.orientation,n):null,c=he(n).map((i,a)=>({label:i,value:(o==null?void 0:o[a])??"–",kind:"orientation"}));return[...r,...c]}const be={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function me({state:e,error:n}){const{t:r}=q.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":be[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(se,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(N,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},ve={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(N,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ne.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),Ie=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:a,sx:p})=>{const{t:s}=q.useTranslation(),x=d.useRef(null),[F,L]=d.useState(xe),R=i??F,[I,m]=d.useState(null),{copied:S,copy:j}=_.useCopyText(),f=_.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=Ce(v,R),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:a});g.current={tcp:n,frame:r,onOrientationFormatChange:a};const A=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),O=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(ee.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:s("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":s("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:s("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:A})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:s("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:O})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(N,{variant:"caption",sx:{...k,color:ve[h]},children:l}),t.jsx(N,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:s("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":s("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(me,{state:o,error:c}),t.jsx(pe,{anchor:I,open:I!==null,onClose:E,format:R,onChange:C})]})});exports.CurrentPoseBar=Ie;
1
+ "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),N=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),q=require("react-i18next"),K=require("./externalizeComponent-CA_sHzyH.cjs"),ee=require("./poseText-CwplkbDM.cjs"),ne=require("./SmallSelect-Dcsd7_6_.cjs"),_=require("./useEveryFrame-NeKiPXY-.cjs"),te=require("@mui/material/ListSubheader"),re=require("@mui/material/MenuItem"),oe=require("@mui/material/Popover"),ie=require("@wandelbots/mui"),se=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function y(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function le(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function ce(e,n){const{intrinsic:r,axes:o}=y(n),c=r?[...o].reverse():o,i=U[c[0]],a=U[c[1]],p=c[0]===c[2],s=p?3-i-a:U[c[2]],x=(i-a)*(a-s)*(s-i)/2,F=Math.hypot(...e)||1,[L,R,I,m]=e.map(V=>V/F),S=[L,R,I],j=S[i]??0,f=S[a]??0,v=(S[s]??0)*x,[T,g,A,O]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(A,O),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(O,A);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(le)}function X({children:e}){return t.jsx(te,{children:e})}X.muiSkipListHighlight=!0;function ue({value:e,onChange:n}){const{t:r}=q.useTranslation(),o=d.useId(),c=a=>{const{intrinsic:p,axes:s}=y(a);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:s.join("")})},i=a=>ae.filter(p=>y(p).intrinsic===a).map(p=>t.jsx(re,{value:p,children:y(p).axes.join("")},p));return t.jsxs(ie.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:a=>c(a),onChange:a=>n(a.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const pe=d.memo(de,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function de({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=q.useTranslation(),a=i("CurrentPose.OrientationFormat.ti"),p=s=>c({...o,...s});return t.jsxs(oe,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":a,sx:s=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${s.palette.divider}`,background:(x=s.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:s.shadows[16]}}}},children:[t.jsx(N,{variant:"subtitle2",color:"text.primary",children:a}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(_.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:s=>p({type:s}),disabled:!1}),o.type!=="quaternion"&&t.jsx(_.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:s=>p({angleUnit:s}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ue,{value:o.eulerConvention,onChange:s=>p({eulerConvention:s})})]})]})}const xe={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function he(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return y(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function ge(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return ce(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function Ce(e,n){const r=["x","y","z"].map((i,a)=>({label:i.toUpperCase(),value:e?w(e.position[a]??0,1):"–",kind:i})),o=e?ge(e.orientation,n):null,c=he(n).map((i,a)=>({label:i,value:(o==null?void 0:o[a])??"–",kind:"orientation"}));return[...r,...c]}const be={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function me({state:e,error:n}){const{t:r}=q.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":be[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(se,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(N,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},ve={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(N,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ne.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),Ie=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:a,sx:p})=>{const{t:s}=q.useTranslation(),x=d.useRef(null),[F,L]=d.useState(xe),R=i??F,[I,m]=d.useState(null),{copied:S,copy:j}=_.useCopyText(),f=_.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=Ce(v,R),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:a});g.current={tcp:n,frame:r,onOrientationFormatChange:a};const A=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),O=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(ee.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:s("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":s("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:s("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:A})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:s("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:O})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(N,{variant:"caption",sx:{...k,color:ve[h]},children:l}),t.jsx(N,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:s("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":s("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(me,{state:o,error:c}),t.jsx(pe,{anchor:I,open:I!==null,onClose:E,format:R,onChange:C})]})});exports.CurrentPoseBar=Ie;
@@ -6,7 +6,7 @@ import { alpha as d } from "@mui/material/styles";
6
6
  import I from "@mui/material/Typography";
7
7
  import { Rotation as j } from "@wandelbots/icons/Rotation";
8
8
  import { SecondaryButton as y } from "@wandelbots/mui";
9
- import { e as v } from "./externalizeComponent-4juwPKL5.js";
9
+ import { e as v } from "./externalizeComponent-CChY_1bN.js";
10
10
  import { u as J, J as S, a as k, j as u, b as R } from "./joggingColors-sb6IFdj2.js";
11
11
  function $({
12
12
  axis: o,
@@ -1 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-Br_U-QAr.cjs"),t=require("./joggingColors-Cqpfuw4G.cjs");function y({axis:e,motion:n,disabled:i}){const r=t.jogAxisColors[e];return o.jsx(j,{"aria-hidden":!0,sx:{opacity:i?.4:1,width:30,height:30,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,backgroundColor:l.alpha(r,.15),border:`1px solid ${l.alpha(r,.4)}`},children:o.jsx(m,{variant:"caption",sx:{color:r},children:n==="rotate"?`R${e}`:e.toUpperCase()})})}function R(e){return o.jsx(q.Rotation,{style:e.direction==="-"?{transform:"scaleX(-1)"}:void 0})}const v=I.externalizeComponent(e=>{const{motion:n="translate",disabled:i=!1}=e,{handlersFor:r,label:C,isPressed:b}=t.useJogControls(e);return o.jsx(x,{"data-testid":"jogging-buttons",sx:{gap:"16px",width:280,maxWidth:"100%"},children:t.JOG_AXES.map(a=>o.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:"16px"},children:[o.jsx(y,{axis:a,motion:n,disabled:i}),t.JOG_DIRECTIONS.map(c=>{const s={axis:a,direction:c},u=b(s),g=n==="rotate"?R(s):void 0,h=t.jogAxisColors[a],p={backgroundColor:l.alpha(h,.25),borderColor:l.alpha(h,.4)};return o.jsx(f.SecondaryButton,{size:"large",disabled:i,"aria-label":C(s),"aria-pressed":u,startIcon:c==="-"?g:void 0,endIcon:c==="+"?g:void 0,...r(s),sx:{flex:1,touchAction:"none",userSelect:"none","& svg":{width:24,height:24},[`& .${d.buttonClasses.startIcon}`]:{marginLeft:"-6px"},[`& .${d.buttonClasses.endIcon}`]:{marginRight:"-6px"},...u&&{...p,[`&.${d.buttonClasses.disabled}`]:p}},children:t.jogHandleName(s,n)},c)})]},a))})});exports.JoggingButtons=v;
1
+ "use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-CA_sHzyH.cjs"),t=require("./joggingColors-Cqpfuw4G.cjs");function y({axis:e,motion:n,disabled:i}){const r=t.jogAxisColors[e];return o.jsx(j,{"aria-hidden":!0,sx:{opacity:i?.4:1,width:30,height:30,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,backgroundColor:l.alpha(r,.15),border:`1px solid ${l.alpha(r,.4)}`},children:o.jsx(m,{variant:"caption",sx:{color:r},children:n==="rotate"?`R${e}`:e.toUpperCase()})})}function R(e){return o.jsx(q.Rotation,{style:e.direction==="-"?{transform:"scaleX(-1)"}:void 0})}const v=I.externalizeComponent(e=>{const{motion:n="translate",disabled:i=!1}=e,{handlersFor:r,label:C,isPressed:b}=t.useJogControls(e);return o.jsx(x,{"data-testid":"jogging-buttons",sx:{gap:"16px",width:280,maxWidth:"100%"},children:t.JOG_AXES.map(a=>o.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:"16px"},children:[o.jsx(y,{axis:a,motion:n,disabled:i}),t.JOG_DIRECTIONS.map(c=>{const s={axis:a,direction:c},u=b(s),g=n==="rotate"?R(s):void 0,h=t.jogAxisColors[a],p={backgroundColor:l.alpha(h,.25),borderColor:l.alpha(h,.4)};return o.jsx(f.SecondaryButton,{size:"large",disabled:i,"aria-label":C(s),"aria-pressed":u,startIcon:c==="-"?g:void 0,endIcon:c==="+"?g:void 0,...r(s),sx:{flex:1,touchAction:"none",userSelect:"none","& svg":{width:24,height:24},[`& .${d.buttonClasses.startIcon}`]:{marginLeft:"-6px"},[`& .${d.buttonClasses.endIcon}`]:{marginRight:"-6px"},...u&&{...p,[`&.${d.buttonClasses.disabled}`]:p}},children:t.jogHandleName(s,n)},c)})]},a))})});exports.JoggingButtons=v;
@@ -1 +1 @@
1
- "use strict";const p=require("react/jsx-runtime"),_=require("@mui/material/Box"),pt=require("@mui/material/Typography"),q=require("@react-three/fiber"),M=require("react"),dt=require("react-i18next"),m=require("three"),ft=require("./externalizeComponent-Br_U-QAr.cjs"),xt=require("./useWebGLRenderer-CtddVDDb.cjs"),E=require("./joggingColors-Cqpfuw4G.cjs"),$=require("@mui/material/styles"),tt=new m.Vector3(0,1,0),G=.26,et=.1,gt={x:"X",y:"Y",z:"Z"};function F(t){var e;return((e=E.cartesianAxisColors[gt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const yt=200;function N(t){const e=t/yt;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function mt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function bt(t,e){const{gripPx:n,grab:c}=N(t);return{radiusPx:e,gripPx:n,headLength:G,...c}}function St(t,e){const{gripPx:n,grab:c}=N(t);return{radiusPx:e,gripPx:n,beyondTipPx:c.beyondTipPx,headLength:G}}function T(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const R=t=>`${t.axis}${t.direction}`,nt=t=>`label:${t}`,D=[0,1],k=(t,e)=>`half:${R(t)}:${e}`,ot=t=>`halo:${R(t)}`,st=t=>`focus:${R(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:c}){const r=e(t),o=!c&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:o}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function At(t,e){return[R(t),...D.map(c=>k(t,c))].flatMap(c=>e.current.get(c)??[])}function ct(t,{onHover:e,handlersFor:n,overlay:c}){const r=n(t,o=>At(t,c).some(a=>a.contains(o)));return{...r,onPointerEnter:()=>e(t),onPointerLeave:o=>{e(null),r.onPointerLeave(o)}}}const L=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new m.Vector3(1,0,0),y:new m.Vector3(0,1,0),z:new m.Vector3(0,0,1)};function Mt(t,e,n=new m.Quaternion){return n.copy(t).invert().multiply(e)}const Et=new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(new m.Vector3(1,0,0),new m.Vector3(0,0,-1),new m.Vector3(0,1,0))),B=new m.Quaternion,jt=new m.Quaternion;function wt(t){return t.up.z>.5?jt:Et}function Rt(t,e=new m.Quaternion){return t.getWorldQuaternion(B),Mt(B,wt(t),e)}function Ot(t,e,n=new m.Quaternion){return n.copy(t).multiply(e)}const _t=1e-8;function Q(t,e){return t?Math.abs(t.dot(e))<1-_t:!0}function vt(t){const{disabled:e,label:n,overlay:c,size:r}=t,o=$.useTheme(),{gripPx:a}=N(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(s=>{const l={axis:u,direction:s},f=rt(l,t),i=ct(l,t);return p.jsxs(M.Fragment,{children:[p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,ot(l)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(F(u),f)}}),D.map(h=>p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,k(l,h)),...i,sx:{position:"absolute",inset:0,clipPath:C,...L(e)}},h)),p.jsx(_,{component:"button",type:"button",ref:T(c,R(l)),disabled:e,"aria-label":n(l),"aria-pressed":f.pressed,...i,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(o)},"&[data-band='shown']:focus-visible":{outline:"none"},...L(e)}}),p.jsx(_,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:p.jsx("path",{ref:T(c,st(l)),fill:"none",stroke:o.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},R(l))}))}const P=.8,U=.45,lt=2.25,ut={x:[new m.Vector3(0,1,0),new m.Vector3(0,0,1)],y:[new m.Vector3(-1,0,0),new m.Vector3(0,0,1)],z:[new m.Vector3(1,0,0),new m.Vector3(0,1,0)]};function H(t){const e=t==="+"?U:U+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const It=new m.Vector3,V=new m.Vector3,Tt=new m.Vector3;function Gt(t,e=24){const n=[];for(const c of E.JOG_AXES){const[r,o]=ut[c],a=s=>It.copy(r).multiplyScalar(Math.cos(s)*P).addScaledVector(o,Math.sin(s)*P).applyQuaternion(t),u=Math.abs(Tt.copy(J[c]).applyQuaternion(t).z);for(const s of E.JOG_DIRECTIONS){const{start:l,end:f,head:i}=H(s),h=[];for(let A=0;A<=e;A++){const w=a(l+(f-l)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const g=a(i),d={x:g.x+0,y:-g.y+0,depth:g.z},x=s==="+"?1:-1;V.copy(r).multiplyScalar(-Math.sin(i)*x).addScaledVector(o,Math.cos(i)*x).applyQuaternion(t);const y=Math.hypot(V.x,V.y),b=y>1e-9?V.x/y:0,S=y>1e-9?-V.y/y:0;n.push({axis:c,direction:s,points:h,head:{...d,dx:b+0,dy:S+0},openness:u})}}return n}function Pt(t,e,n){let c={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const o=t[r-1],a=t[r],u=(a.x-o.x)**2+(a.y-o.y)**2,s=u===0?0:Math.min(1,Math.max(0,((e-o.x)*(a.x-o.x)+(n-o.y)*(a.y-o.y))/u)),l=Math.hypot(e-(o.x+s*(a.x-o.x)),n-(o.y+s*(a.y-o.y)));l<c.distance&&(c={distance:l,depth:o.depth+s*(a.depth-o.depth)})}return c}function Vt(t,e){const n=t.length,c=t.map(()=>new Array(n).fill(!1));for(let s=0;s<n;s++)for(let l=s+1;l<n;l++){if(t[s].arc===t[l].arc)continue;let f=0;for(const i of t[s].line){const h=Pt(t[l].line,i.x,i.y);h.distance<e&&(f+=i.depth-h.depth)}f>0?c[s][l]=!0:f<0&&(c[l][s]=!0)}const r=t.map(({line:s})=>s.reduce((l,f)=>l+f.depth,0)/s.length),o=(s,l)=>r[s]-r[l],a=new Array(n).fill(0),u=new Set(t.keys());for(let s=1;u.size>0;s++){const l=[...u],f=l.filter(h=>!l.some(g=>c[h][g])),i=(f.length>0?f:l).sort(o)[0];a[i]=s,u.delete(i)}return a}const W=8;function z(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],o=n[n.length-2],a=Math.hypot(r.x-o.x,r.y-o.y)||1;return n.push({x:r.x+(r.x-o.x)/a*e,y:r.y+(r.y-o.y)/a*e,depth:r.depth}),n}let c=-e;for(;n.length>2;){const r=n[n.length-1],o=n[n.length-2],a=Math.hypot(r.x-o.x,r.y-o.y);if(a>c){const u=c/a;return n[n.length-1]={x:r.x+(o.x-r.x)*u,y:r.y+(o.y-r.y)*u,depth:r.depth+(o.depth-r.depth)*u},n}c-=a,n.pop()}return n}const X=(t,e)=>z([...t].reverse(),e).reverse();function Ft(t,e){const n=e/2,c=[],r=[],o=[];let a={x:0,y:0};for(const[s,l]of t.entries()){const f=t[Math.max(0,s-1)],i=t[Math.min(t.length-1,s+1)],h=i.x-f.x,g=i.y-f.y,d=Math.hypot(h,g);d>1e-9&&(a={x:-g/d,y:h/d}),o.push(a),c.push({x:l.x+a.x*n,y:l.y+a.y*n}),r.push({x:l.x-a.x*n,y:l.y-a.y*n})}const u=(s,l)=>{const f=o[s],i={x:f.y,y:-f.x},h=l?1:-1;return Array.from({length:W-1},(g,d)=>{const x=Math.PI*(d+1)/W,y=Math.cos(x)*h,b=Math.sin(x)*h;return{x:t[s].x+(f.x*y+i.x*b)*n,y:t[s].y+(f.y*y+i.y*b)*n}})};return(s,l)=>[...c.slice(s,l+1),...l===t.length-1?u(l,!0):[],...r.slice(s,l+1).reverse(),...s===0?u(s,!1):[]]}function Nt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function $t(t,{radiusPx:e,gripPx:n,beyondTipPx:c,headLength:r}){const o=n/2,a=r/2*e+c-o,u=c-o,s=t.map(d=>{const x=d.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=x[x.length>>1],b=d.direction==="+"?X(z(x,a),u):z(X(x,a),u);return{line:b,middle:b.indexOf(y)}}),l=s.map(({line:d})=>d),f=t.map(d=>2*P*e*d.openness>=n),i=l.flatMap((d,x)=>f[x]?Nt(d.length,s[x].middle).map(({from:y,to:b})=>({arc:x,from:y,to:b,line:d.slice(y,b+1)})):[]),h=Vt(i,n),g=t.map((d,x)=>x).sort((d,x)=>t[d].head.depth-t[x].head.depth);return t.map((d,x)=>{if(!f[x])return null;const y=Ft(l[x],n),b=i.flatMap((S,A)=>S.arc===x?[{...S,layer:h[A]}]:[]);return{band:y(0,l[x].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:d.head.x*e,y:d.head.y*e},headLayer:i.length+1+g.indexOf(x)}})}function ht(t,e,n,c){const r=M.useRef(null),o=q.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,o()},[c,o]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const s=t.current;s&&Q(r.current,s)&&o(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,o]),q.useFrame(()=>{const a=t.current;!a||!e.current||Q(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const K=.03;function Ct({orientation:t,lit:e,disabled:n,size:c,radius:r,overlay:o}){const a=M.useRef(null),u=c/2,s=i=>`${(u+i).toFixed(2)}px`,l=i=>`polygon(${i.map(h=>`${s(h.x)} ${s(h.y)}`).join(", ")})`,f=i=>`M${i.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,i=>{let h=!0;const g=Gt(i),d=$t(g,St(c,r));for(const[x,y]of g.entries()){const b=o.current.get(R(y)),S=o.current.get(ot(y)),A=o.current.get(st(y)),w=D.map(v=>o.current.get(k(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=d[x];b.style.left=s(y.head.x*r),b.style.top=s(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?l(j.band):C,A.setAttribute("d",j?f(j.band):"");for(const[v,I]of w.entries()){if(!I)continue;const O=j==null?void 0:j.halves[v];I.style.clipPath=O?l(O.polygon):C,I.style.zIndex=O?String(O.layer):"0",I.style.pointerEvents=O?"":"none"}}return h},`${c}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(i=>p.jsx(Jt,{axis:i,color:F(i),lit:(e==null?void 0:e.axis)===i?e.direction:null,disabled:n},i))]})}function Jt({axis:t,color:e,lit:n,disabled:c}){const r=M.useMemo(()=>{const[o,a]=ut[t];return new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(o,a,J[t]))},[t]);return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(o=>{const a=n===o,u=a?1:c?.35:.8,s=a?K*1.5:K;return p.jsxs("group",{children:[p.jsxs("mesh",{rotation:[0,0,H(o).start],children:[p.jsx("torusGeometry",{args:[P,s,12,48,lt]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),p.jsx(qt,{direction:o,color:e,opacity:u,lit:a})]},o)})})}function qt({direction:t,color:e,opacity:n,lit:c}){const{position:r,rotation:o}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new m.Vector3(Math.cos(a)*P,Math.sin(a)*P,0),rotation:new m.Quaternion().setFromUnitVectors(tt,new m.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return p.jsxs("mesh",{position:r,quaternion:o,scale:c?1.2:1,children:[p.jsx("coneGeometry",{args:[et,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function Lt(t){const{disabled:e,label:n,overlay:c,size:r}=t,o=$.useTheme(),{gripPx:a,labelFontPx:u}=N(r);return p.jsxs(p.Fragment,{children:[E.JOG_AXES.map(s=>p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,nt(s)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:F(s),opacity:e?.4:1},children:s.toUpperCase()},s)),E.JOG_AXES.flatMap(s=>E.JOG_DIRECTIONS.map(l=>{const f={axis:s,direction:l},i=rt(f,t);return p.jsx(_,{component:"button",type:"button",ref:T(c,R(f)),disabled:e,"aria-label":n(f),"aria-pressed":i.pressed,...ct(f,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(F(s),i),"&:focus-visible":{outline:it(o)},...L(e)}},R(f))}))]})}function zt(t){const e=[];for(const n of E.JOG_AXES)for(const c of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(c==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:c,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Dt(t,e){const{radiusPx:n,gripPx:c,innerPx:r,beyondTipPx:o,minTipPx:a,headLength:u}=e,s=t.map(i=>{const h=Math.hypot(i.x,i.y)*n;return{tip:h,angle:Math.atan2(i.y,i.x),start:r,end:h+o,depth:i.depth,grabbed:h>=a}});for(const[i,h]of s.entries())for(const g of s.slice(i+1)){if(!h.grabbed||!g.grabbed)continue;const[d,x]=h.tip<=g.tip?[h,g]:[g,h],y=h.angle-g.angle,b=d.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=c)continue;const S=x.tip*(1-u);if(d.tip>S){const A=h.depth<g.depth?h:g;A.grabbed=!1}else{const A=(d.tip+S)/2;d.end=Math.min(d.end,A),x.start=Math.max(x.start,A)}}const l=s.map((i,h)=>h);l.sort((i,h)=>s[i].depth-s[h].depth);const f=new Map(l.map((i,h)=>[i,h+1]));return s.map((i,h)=>!i.grabbed||i.end<=i.start?null:{x:Math.cos(i.angle)*i.start,y:Math.sin(i.angle)*i.start,length:i.end-i.start,angle:i.angle,layer:f.get(h)??0})}const Y=.035,Z=1.28;function kt({orientation:t,lit:e,disabled:n,size:c,radius:r,overlay:o}){const a=M.useRef(null),u=c/2;return ht(t,a,s=>{let l=!0;const f=zt(s),i=Dt(f,bt(c,r));for(const[h,g]of f.entries()){const d=o.current.get(R(g)),x=i[h];if(d?x?(d.style.left=`${u+x.x}px`,d.style.top=`${u+x.y}px`,d.style.width=`${x.length}px`,d.style.transform=`translateY(-50%) rotate(${x.angle}rad)`,d.style.zIndex=String(x.layer),d.style.pointerEvents=""):d.style.pointerEvents="none":l=!1,g.direction!=="+")continue;const y=o.current.get(nt(g.axis));y?(y.style.left=`${u+g.x*r*Z}px`,y.style.top=`${u+g.y*r*Z}px`):l=!1}return l},`${c}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(s=>p.jsx(Ht,{axis:s,color:F(s),lit:(e==null?void 0:e.axis)===s?e.direction:null,disabled:n},s))]})}function Ht({axis:t,color:e,lit:n,disabled:c}){const r=M.useMemo(()=>new m.Quaternion().setFromUnitVectors(tt,J[t]),[t]),o=1-G;return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,s=u?1:c?.35:.8,l=u?Y*1.5:Y;return p.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[p.jsxs("mesh",{position:[0,o/2,0],children:[p.jsx("cylinderGeometry",{args:[l,l,o,12]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:s})]}),p.jsxs("mesh",{position:[0,1-G/2,0],scale:u?1.2:1,children:[p.jsx("coneGeometry",{args:[et,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:s})]})]},a)})})}const Bt=new m.Quaternion;function Qt(t,e=Bt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const c=new m.Quaternion;return{get current(){const r=t.current;if(!r)return null;const o=n.current;return Ot(r,typeof o=="function"?o():o,c)}}},[t])}const Ut=3e3;function Wt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let c=requestAnimationFrame(function o(){t.current!==null?n(!0):c=requestAnimationFrame(o)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Ut);return()=>{cancelAnimationFrame(c),clearTimeout(r)}},[e,t]),e}const Xt=ft.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:c,onJogStop:r,activeHandle:o,disabled:a=!1,size:u=200,onWebGLUnavailable:s})=>{const{t:l}=dt.useTranslation(),{unavailable:f,makeRenderer:i}=xt.useWebGLRenderer({onWebGLUnavailable:s}),h=Wt(t),g=a||!h,d=Qt(t,e),{held:x,handlersFor:y,label:b,isPressed:S}=E.useJogControls({motion:n,onJogStart:c,onJogStop:r,activeHandle:o,disabled:g}),[A,w]=M.useState(null);M.useEffect(()=>w(null),[n]);const j=n==="rotate"?Ct:kt,v=n==="rotate"?vt:Lt,I=M.useRef(new Map),O=mt(u,u,N(u).marginPx);return f?p.jsx(_,{"data-testid":"jogging-gizmo-unavailable",sx:{width:u,height:u,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:p.jsx(pt,{variant:"body2",color:"text.secondary",children:l("JoggingGizmo.WebGLUnavailable.lb")})}):p.jsxs(_,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[p.jsx(q.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:O,near:.1,far:100},gl:i,style:{position:"absolute",inset:0,pointerEvents:"none"},children:p.jsx(j,{orientation:d,lit:x??o??A,disabled:g,size:u,radius:O,overlay:I})}),p.jsx(v,{isPressed:S,hovered:A,disabled:g,size:u,onHover:w,handlersFor:y,label:b,overlay:I})]})});exports.JoggingGizmo=Xt;exports.novaAxesSeenBy=Rt;
1
+ "use strict";const p=require("react/jsx-runtime"),_=require("@mui/material/Box"),pt=require("@mui/material/Typography"),q=require("@react-three/fiber"),M=require("react"),dt=require("react-i18next"),m=require("three"),ft=require("./externalizeComponent-CA_sHzyH.cjs"),xt=require("./useWebGLRenderer-CtddVDDb.cjs"),E=require("./joggingColors-Cqpfuw4G.cjs"),$=require("@mui/material/styles"),tt=new m.Vector3(0,1,0),G=.26,et=.1,gt={x:"X",y:"Y",z:"Z"};function F(t){var e;return((e=E.cartesianAxisColors[gt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const yt=200;function N(t){const e=t/yt;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function mt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function bt(t,e){const{gripPx:n,grab:c}=N(t);return{radiusPx:e,gripPx:n,headLength:G,...c}}function St(t,e){const{gripPx:n,grab:c}=N(t);return{radiusPx:e,gripPx:n,beyondTipPx:c.beyondTipPx,headLength:G}}function T(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const R=t=>`${t.axis}${t.direction}`,nt=t=>`label:${t}`,D=[0,1],k=(t,e)=>`half:${R(t)}:${e}`,ot=t=>`halo:${R(t)}`,st=t=>`focus:${R(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:c}){const r=e(t),o=!c&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:o}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function At(t,e){return[R(t),...D.map(c=>k(t,c))].flatMap(c=>e.current.get(c)??[])}function ct(t,{onHover:e,handlersFor:n,overlay:c}){const r=n(t,o=>At(t,c).some(a=>a.contains(o)));return{...r,onPointerEnter:()=>e(t),onPointerLeave:o=>{e(null),r.onPointerLeave(o)}}}const L=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new m.Vector3(1,0,0),y:new m.Vector3(0,1,0),z:new m.Vector3(0,0,1)};function Mt(t,e,n=new m.Quaternion){return n.copy(t).invert().multiply(e)}const Et=new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(new m.Vector3(1,0,0),new m.Vector3(0,0,-1),new m.Vector3(0,1,0))),B=new m.Quaternion,jt=new m.Quaternion;function wt(t){return t.up.z>.5?jt:Et}function Rt(t,e=new m.Quaternion){return t.getWorldQuaternion(B),Mt(B,wt(t),e)}function Ot(t,e,n=new m.Quaternion){return n.copy(t).multiply(e)}const _t=1e-8;function Q(t,e){return t?Math.abs(t.dot(e))<1-_t:!0}function vt(t){const{disabled:e,label:n,overlay:c,size:r}=t,o=$.useTheme(),{gripPx:a}=N(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(s=>{const l={axis:u,direction:s},f=rt(l,t),i=ct(l,t);return p.jsxs(M.Fragment,{children:[p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,ot(l)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(F(u),f)}}),D.map(h=>p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,k(l,h)),...i,sx:{position:"absolute",inset:0,clipPath:C,...L(e)}},h)),p.jsx(_,{component:"button",type:"button",ref:T(c,R(l)),disabled:e,"aria-label":n(l),"aria-pressed":f.pressed,...i,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(o)},"&[data-band='shown']:focus-visible":{outline:"none"},...L(e)}}),p.jsx(_,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:p.jsx("path",{ref:T(c,st(l)),fill:"none",stroke:o.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},R(l))}))}const P=.8,U=.45,lt=2.25,ut={x:[new m.Vector3(0,1,0),new m.Vector3(0,0,1)],y:[new m.Vector3(-1,0,0),new m.Vector3(0,0,1)],z:[new m.Vector3(1,0,0),new m.Vector3(0,1,0)]};function H(t){const e=t==="+"?U:U+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const It=new m.Vector3,V=new m.Vector3,Tt=new m.Vector3;function Gt(t,e=24){const n=[];for(const c of E.JOG_AXES){const[r,o]=ut[c],a=s=>It.copy(r).multiplyScalar(Math.cos(s)*P).addScaledVector(o,Math.sin(s)*P).applyQuaternion(t),u=Math.abs(Tt.copy(J[c]).applyQuaternion(t).z);for(const s of E.JOG_DIRECTIONS){const{start:l,end:f,head:i}=H(s),h=[];for(let A=0;A<=e;A++){const w=a(l+(f-l)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const g=a(i),d={x:g.x+0,y:-g.y+0,depth:g.z},x=s==="+"?1:-1;V.copy(r).multiplyScalar(-Math.sin(i)*x).addScaledVector(o,Math.cos(i)*x).applyQuaternion(t);const y=Math.hypot(V.x,V.y),b=y>1e-9?V.x/y:0,S=y>1e-9?-V.y/y:0;n.push({axis:c,direction:s,points:h,head:{...d,dx:b+0,dy:S+0},openness:u})}}return n}function Pt(t,e,n){let c={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const o=t[r-1],a=t[r],u=(a.x-o.x)**2+(a.y-o.y)**2,s=u===0?0:Math.min(1,Math.max(0,((e-o.x)*(a.x-o.x)+(n-o.y)*(a.y-o.y))/u)),l=Math.hypot(e-(o.x+s*(a.x-o.x)),n-(o.y+s*(a.y-o.y)));l<c.distance&&(c={distance:l,depth:o.depth+s*(a.depth-o.depth)})}return c}function Vt(t,e){const n=t.length,c=t.map(()=>new Array(n).fill(!1));for(let s=0;s<n;s++)for(let l=s+1;l<n;l++){if(t[s].arc===t[l].arc)continue;let f=0;for(const i of t[s].line){const h=Pt(t[l].line,i.x,i.y);h.distance<e&&(f+=i.depth-h.depth)}f>0?c[s][l]=!0:f<0&&(c[l][s]=!0)}const r=t.map(({line:s})=>s.reduce((l,f)=>l+f.depth,0)/s.length),o=(s,l)=>r[s]-r[l],a=new Array(n).fill(0),u=new Set(t.keys());for(let s=1;u.size>0;s++){const l=[...u],f=l.filter(h=>!l.some(g=>c[h][g])),i=(f.length>0?f:l).sort(o)[0];a[i]=s,u.delete(i)}return a}const W=8;function z(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],o=n[n.length-2],a=Math.hypot(r.x-o.x,r.y-o.y)||1;return n.push({x:r.x+(r.x-o.x)/a*e,y:r.y+(r.y-o.y)/a*e,depth:r.depth}),n}let c=-e;for(;n.length>2;){const r=n[n.length-1],o=n[n.length-2],a=Math.hypot(r.x-o.x,r.y-o.y);if(a>c){const u=c/a;return n[n.length-1]={x:r.x+(o.x-r.x)*u,y:r.y+(o.y-r.y)*u,depth:r.depth+(o.depth-r.depth)*u},n}c-=a,n.pop()}return n}const X=(t,e)=>z([...t].reverse(),e).reverse();function Ft(t,e){const n=e/2,c=[],r=[],o=[];let a={x:0,y:0};for(const[s,l]of t.entries()){const f=t[Math.max(0,s-1)],i=t[Math.min(t.length-1,s+1)],h=i.x-f.x,g=i.y-f.y,d=Math.hypot(h,g);d>1e-9&&(a={x:-g/d,y:h/d}),o.push(a),c.push({x:l.x+a.x*n,y:l.y+a.y*n}),r.push({x:l.x-a.x*n,y:l.y-a.y*n})}const u=(s,l)=>{const f=o[s],i={x:f.y,y:-f.x},h=l?1:-1;return Array.from({length:W-1},(g,d)=>{const x=Math.PI*(d+1)/W,y=Math.cos(x)*h,b=Math.sin(x)*h;return{x:t[s].x+(f.x*y+i.x*b)*n,y:t[s].y+(f.y*y+i.y*b)*n}})};return(s,l)=>[...c.slice(s,l+1),...l===t.length-1?u(l,!0):[],...r.slice(s,l+1).reverse(),...s===0?u(s,!1):[]]}function Nt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function $t(t,{radiusPx:e,gripPx:n,beyondTipPx:c,headLength:r}){const o=n/2,a=r/2*e+c-o,u=c-o,s=t.map(d=>{const x=d.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=x[x.length>>1],b=d.direction==="+"?X(z(x,a),u):z(X(x,a),u);return{line:b,middle:b.indexOf(y)}}),l=s.map(({line:d})=>d),f=t.map(d=>2*P*e*d.openness>=n),i=l.flatMap((d,x)=>f[x]?Nt(d.length,s[x].middle).map(({from:y,to:b})=>({arc:x,from:y,to:b,line:d.slice(y,b+1)})):[]),h=Vt(i,n),g=t.map((d,x)=>x).sort((d,x)=>t[d].head.depth-t[x].head.depth);return t.map((d,x)=>{if(!f[x])return null;const y=Ft(l[x],n),b=i.flatMap((S,A)=>S.arc===x?[{...S,layer:h[A]}]:[]);return{band:y(0,l[x].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:d.head.x*e,y:d.head.y*e},headLayer:i.length+1+g.indexOf(x)}})}function ht(t,e,n,c){const r=M.useRef(null),o=q.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,o()},[c,o]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const s=t.current;s&&Q(r.current,s)&&o(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,o]),q.useFrame(()=>{const a=t.current;!a||!e.current||Q(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const K=.03;function Ct({orientation:t,lit:e,disabled:n,size:c,radius:r,overlay:o}){const a=M.useRef(null),u=c/2,s=i=>`${(u+i).toFixed(2)}px`,l=i=>`polygon(${i.map(h=>`${s(h.x)} ${s(h.y)}`).join(", ")})`,f=i=>`M${i.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,i=>{let h=!0;const g=Gt(i),d=$t(g,St(c,r));for(const[x,y]of g.entries()){const b=o.current.get(R(y)),S=o.current.get(ot(y)),A=o.current.get(st(y)),w=D.map(v=>o.current.get(k(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=d[x];b.style.left=s(y.head.x*r),b.style.top=s(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?l(j.band):C,A.setAttribute("d",j?f(j.band):"");for(const[v,I]of w.entries()){if(!I)continue;const O=j==null?void 0:j.halves[v];I.style.clipPath=O?l(O.polygon):C,I.style.zIndex=O?String(O.layer):"0",I.style.pointerEvents=O?"":"none"}}return h},`${c}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(i=>p.jsx(Jt,{axis:i,color:F(i),lit:(e==null?void 0:e.axis)===i?e.direction:null,disabled:n},i))]})}function Jt({axis:t,color:e,lit:n,disabled:c}){const r=M.useMemo(()=>{const[o,a]=ut[t];return new m.Quaternion().setFromRotationMatrix(new m.Matrix4().makeBasis(o,a,J[t]))},[t]);return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(o=>{const a=n===o,u=a?1:c?.35:.8,s=a?K*1.5:K;return p.jsxs("group",{children:[p.jsxs("mesh",{rotation:[0,0,H(o).start],children:[p.jsx("torusGeometry",{args:[P,s,12,48,lt]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),p.jsx(qt,{direction:o,color:e,opacity:u,lit:a})]},o)})})}function qt({direction:t,color:e,opacity:n,lit:c}){const{position:r,rotation:o}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new m.Vector3(Math.cos(a)*P,Math.sin(a)*P,0),rotation:new m.Quaternion().setFromUnitVectors(tt,new m.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return p.jsxs("mesh",{position:r,quaternion:o,scale:c?1.2:1,children:[p.jsx("coneGeometry",{args:[et,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function Lt(t){const{disabled:e,label:n,overlay:c,size:r}=t,o=$.useTheme(),{gripPx:a,labelFontPx:u}=N(r);return p.jsxs(p.Fragment,{children:[E.JOG_AXES.map(s=>p.jsx(_,{component:"span","aria-hidden":!0,ref:T(c,nt(s)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:F(s),opacity:e?.4:1},children:s.toUpperCase()},s)),E.JOG_AXES.flatMap(s=>E.JOG_DIRECTIONS.map(l=>{const f={axis:s,direction:l},i=rt(f,t);return p.jsx(_,{component:"button",type:"button",ref:T(c,R(f)),disabled:e,"aria-label":n(f),"aria-pressed":i.pressed,...ct(f,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(F(s),i),"&:focus-visible":{outline:it(o)},...L(e)}},R(f))}))]})}function zt(t){const e=[];for(const n of E.JOG_AXES)for(const c of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(c==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:c,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Dt(t,e){const{radiusPx:n,gripPx:c,innerPx:r,beyondTipPx:o,minTipPx:a,headLength:u}=e,s=t.map(i=>{const h=Math.hypot(i.x,i.y)*n;return{tip:h,angle:Math.atan2(i.y,i.x),start:r,end:h+o,depth:i.depth,grabbed:h>=a}});for(const[i,h]of s.entries())for(const g of s.slice(i+1)){if(!h.grabbed||!g.grabbed)continue;const[d,x]=h.tip<=g.tip?[h,g]:[g,h],y=h.angle-g.angle,b=d.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=c)continue;const S=x.tip*(1-u);if(d.tip>S){const A=h.depth<g.depth?h:g;A.grabbed=!1}else{const A=(d.tip+S)/2;d.end=Math.min(d.end,A),x.start=Math.max(x.start,A)}}const l=s.map((i,h)=>h);l.sort((i,h)=>s[i].depth-s[h].depth);const f=new Map(l.map((i,h)=>[i,h+1]));return s.map((i,h)=>!i.grabbed||i.end<=i.start?null:{x:Math.cos(i.angle)*i.start,y:Math.sin(i.angle)*i.start,length:i.end-i.start,angle:i.angle,layer:f.get(h)??0})}const Y=.035,Z=1.28;function kt({orientation:t,lit:e,disabled:n,size:c,radius:r,overlay:o}){const a=M.useRef(null),u=c/2;return ht(t,a,s=>{let l=!0;const f=zt(s),i=Dt(f,bt(c,r));for(const[h,g]of f.entries()){const d=o.current.get(R(g)),x=i[h];if(d?x?(d.style.left=`${u+x.x}px`,d.style.top=`${u+x.y}px`,d.style.width=`${x.length}px`,d.style.transform=`translateY(-50%) rotate(${x.angle}rad)`,d.style.zIndex=String(x.layer),d.style.pointerEvents=""):d.style.pointerEvents="none":l=!1,g.direction!=="+")continue;const y=o.current.get(nt(g.axis));y?(y.style.left=`${u+g.x*r*Z}px`,y.style.top=`${u+g.y*r*Z}px`):l=!1}return l},`${c}:${r}`),p.jsxs("group",{ref:a,children:[p.jsxs("mesh",{children:[p.jsx("sphereGeometry",{args:[.07,16,16]}),p.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(s=>p.jsx(Ht,{axis:s,color:F(s),lit:(e==null?void 0:e.axis)===s?e.direction:null,disabled:n},s))]})}function Ht({axis:t,color:e,lit:n,disabled:c}){const r=M.useMemo(()=>new m.Quaternion().setFromUnitVectors(tt,J[t]),[t]),o=1-G;return p.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,s=u?1:c?.35:.8,l=u?Y*1.5:Y;return p.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[p.jsxs("mesh",{position:[0,o/2,0],children:[p.jsx("cylinderGeometry",{args:[l,l,o,12]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:s})]}),p.jsxs("mesh",{position:[0,1-G/2,0],scale:u?1.2:1,children:[p.jsx("coneGeometry",{args:[et,G,20]}),p.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:s})]})]},a)})})}const Bt=new m.Quaternion;function Qt(t,e=Bt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const c=new m.Quaternion;return{get current(){const r=t.current;if(!r)return null;const o=n.current;return Ot(r,typeof o=="function"?o():o,c)}}},[t])}const Ut=3e3;function Wt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let c=requestAnimationFrame(function o(){t.current!==null?n(!0):c=requestAnimationFrame(o)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Ut);return()=>{cancelAnimationFrame(c),clearTimeout(r)}},[e,t]),e}const Xt=ft.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:c,onJogStop:r,activeHandle:o,disabled:a=!1,size:u=200,onWebGLUnavailable:s})=>{const{t:l}=dt.useTranslation(),{unavailable:f,makeRenderer:i}=xt.useWebGLRenderer({onWebGLUnavailable:s}),h=Wt(t),g=a||!h,d=Qt(t,e),{held:x,handlersFor:y,label:b,isPressed:S}=E.useJogControls({motion:n,onJogStart:c,onJogStop:r,activeHandle:o,disabled:g}),[A,w]=M.useState(null);M.useEffect(()=>w(null),[n]);const j=n==="rotate"?Ct:kt,v=n==="rotate"?vt:Lt,I=M.useRef(new Map),O=mt(u,u,N(u).marginPx);return f?p.jsx(_,{"data-testid":"jogging-gizmo-unavailable",sx:{width:u,height:u,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center"},children:p.jsx(pt,{variant:"body2",color:"text.secondary",children:l("JoggingGizmo.WebGLUnavailable.lb")})}):p.jsxs(_,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[p.jsx(q.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:O,near:.1,far:100},gl:i,style:{position:"absolute",inset:0,pointerEvents:"none"},children:p.jsx(j,{orientation:d,lit:x??o??A,disabled:g,size:u,radius:O,overlay:I})}),p.jsx(v,{isPressed:S,hovered:A,disabled:g,size:u,onHover:w,handlersFor:y,label:b,overlay:I})]})});exports.JoggingGizmo=Xt;exports.novaAxesSeenBy=Rt;
@@ -5,7 +5,7 @@ import { useThree as At, useFrame as wt, Canvas as St } from "@react-three/fiber
5
5
  import { Fragment as Et, useRef as k, useEffect as H, useMemo as B, useState as rt } from "react";
6
6
  import { useTranslation as vt } from "react-i18next";
7
7
  import { Vector3 as A, Quaternion as v, Matrix4 as st } from "three";
8
- import { e as Rt } from "./externalizeComponent-4juwPKL5.js";
8
+ import { e as Rt } from "./externalizeComponent-CChY_1bN.js";
9
9
  import { u as Tt } from "./useWebGLRenderer-BozrbZz-.js";
10
10
  import { c as _t, i as Ot, J as P, a as G, u as It } from "./joggingColors-sb6IFdj2.js";
11
11
  import { alpha as K, useTheme as at } from "@mui/material/styles";
@@ -1,6 +1,6 @@
1
1
  import { useThree as o, useFrame as m } from "@react-three/fiber";
2
2
  import { Quaternion as t } from "three";
3
- import { n as a } from "./JoggingGizmo-DHvrJouR.js";
3
+ import { n as a } from "./JoggingGizmo-RDiEVQes.js";
4
4
  function s({
5
5
  target: r
6
6
  }) {
@@ -1 +1 @@
1
- "use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-CoKYUtXq.cjs");function u({target:e}){const r=n.useThree(i=>i.camera);return n.useFrame(()=>{e.current=t.novaAxesSeenBy(r,e.current??new o.Quaternion)}),null}exports.JoggingGizmoOrientation=u;
1
+ "use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-CNFjpWDv.cjs");function u({target:e}){const r=n.useThree(i=>i.camera);return n.useFrame(()=>{e.current=t.novaAxesSeenBy(r,e.current??new o.Quaternion)}),null}exports.JoggingGizmoOrientation=u;
@@ -4,7 +4,7 @@ import v from "@mui/material/Stack";
4
4
  import { useTheme as W, alpha as F } from "@mui/material/styles";
5
5
  import D from "@mui/material/Typography";
6
6
  import { useRef as E, useState as O, useCallback as P, useEffect as Y } from "react";
7
- import { e as tt } from "./externalizeComponent-4juwPKL5.js";
7
+ import { e as tt } from "./externalizeComponent-CChY_1bN.js";
8
8
  import { r as nt, u as ot, p as rt, s as et, c as it, b as st, a as at } from "./holdSafety-Cbej6-Kc.js";
9
9
  const j = 2 * Math.PI;
10
10
  function lt({ min: t, max: n, linear: r }, u) {