@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.d7cab79

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 (56) hide show
  1. package/README.md +56 -5
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +1 -0
  4. package/dist/3d.js +16 -15
  5. package/dist/CurrentPoseBar/index.cjs +1 -1
  6. package/dist/CurrentPoseBar/index.js +1 -1
  7. package/dist/RobotControlPanel/index.cjs +1 -1
  8. package/dist/RobotControlPanel/index.js +1 -1
  9. package/dist/RobotHeader/index.js +1 -1
  10. package/dist/SafetyBar/index.js +1 -1
  11. package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-DENCilvf.js} +1 -1
  12. package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-DrXTcV-I.cjs} +1 -1
  13. package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-DTE8-v2j.cjs} +1 -1
  14. package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-E-hUzMIL.js} +1 -1
  15. package/dist/chunks/{RobotHeader-DDmDkUoV.js → RobotHeader-BvIzk8Fw.js} +1 -1
  16. package/dist/chunks/{SafetyBar-RkN0I1Cb.js → SafetyBar-eYzCHOFD.js} +1 -1
  17. package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
  18. package/dist/chunks/loadRobotSession-DlRzFjYE.cjs +3 -0
  19. package/dist/chunks/loadRobotSession-kKQ96rWu.js +4721 -0
  20. package/dist/chunks/robotModelSource-Bv1Z_miZ.cjs +1 -0
  21. package/dist/chunks/robotModelSource-CKuBOeQ-.js +1295 -0
  22. package/dist/chunks/useEveryFrame-B8t_yz-G.js +155 -0
  23. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
  24. package/dist/components/robotControl/poseText.d.ts +21 -5
  25. package/dist/components/robots/LinearAxis.d.ts +12 -11
  26. package/dist/components/robots/Robot.d.ts +26 -9
  27. package/dist/components/robots/robotModelSource.d.ts +38 -0
  28. package/dist/core.cjs +1 -1
  29. package/dist/core.d.ts +10 -0
  30. package/dist/core.js +58 -39
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +86 -66
  33. package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
  34. package/dist/lib/controllerStateSource.d.ts +6 -4
  35. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  36. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  37. package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
  38. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  39. package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
  40. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  41. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  42. package/dist/lib/robotSession/RobotSession.d.ts +78 -0
  43. package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
  44. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  45. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  46. package/dist/lib/robotSession/robotPose.d.ts +28 -0
  47. package/dist/nats.cjs +1 -0
  48. package/dist/nats.d.ts +4 -0
  49. package/dist/nats.js +131 -0
  50. package/package.json +11 -1
  51. package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
  52. package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
  53. package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
  54. package/dist/chunks/TrajectoryExecutionStore-DYVukgCz.js +0 -3613
  55. package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
  56. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
@@ -0,0 +1,3 @@
1
+ "use strict";const c=require("react/jsx-runtime"),ve=require("@mui/material/AppBar"),Jt=require("@mui/material/Backdrop"),F=require("@mui/material/Box"),je=require("@mui/material/Menu"),z=require("@mui/material/MenuItem"),be=require("@mui/material/Toolbar"),w=require("@mui/material/Typography"),xe=require("@wandelbots/design-tokens"),_e=require("@wandelbots/icons/ExpandMoreFilled"),Ie=require("@wandelbots/mui"),M=require("mobx-react-lite"),E=require("react"),X=require("./externalizeComponent-BdxGBLIv.cjs"),Ee=require("@mui/icons-material/OpenWith"),Ce=require("@mui/icons-material/Share"),x=require("@mui/material/Stack"),Te=require("@mui/material/Tab"),we=require("@mui/material/Tabs"),m=require("mobx"),V=require("react-i18next"),Dt=require("@mui/material/CircularProgress"),Me=require("@mui/material/utils"),Lt=require("lodash-es"),Oe=require("./SafetyBar-BVk-SH_0.cjs"),Re=require("@mui/material/Alert"),ke=require("@mui/material/AlertTitle"),lt=require("@mui/material/Button"),B=require("@mui/material/styles"),W=require("@mui/material/Divider"),It=require("@mui/material/ToggleButton"),_=require("@wandelbots/nova-js"),st=require("@mui/material/IconButton"),j=require("./Pose3-DIyg-aZA.cjs"),H=require("./joggingColors-ZDc_2UCp.cjs"),$t=require("lodash-es/isEqual.js"),Ae=require("@mui/material/InputAdornment"),Pe=require("@mui/material/FormControl"),Je=require("@mui/material/InputLabel"),De=require("@mui/material/Select"),Le=require("@mui/material/ToggleButtonGroup"),Nt=require("@mui/material/Slider"),$e=require("lodash-es/isNumber.js"),N=require("@wandelbots/nova-js/v2"),Ne=require("@mui/icons-material/ChevronLeft"),Ve=require("@mui/icons-material/ChevronRight"),Fe=require("lodash-es/throttle.js"),Be=require("@mui/material/Dialog"),Ge=require("@mui/material/DialogActions"),qe=require("@mui/material/DialogContent"),Ue=require("@mui/material/DialogTitle"),q=require("three"),Vt=require("./converters-BsXgcxCW.cjs"),Ft=require("axios"),Q=require("lodash-es/keyBy.js"),ze=require("lodash-es/uniqueId.js"),U=require("./useEveryFrame-CHxg25f4.cjs");function Bt(o){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const b=Bt(E),Et=Bt(q),We=X.externalizeComponent(M.observer(o=>{const{appIcon:t,appName:e,apps:i=[],onAppSelect:n,disabled:r=!1,sx:s}=o,[a,g]=E.useState(null),u=!!a,d=l=>{g(l.currentTarget)},p=()=>{g(null)},h=l=>{p(),l.onClick?l.onClick():l.href&&(window.location.href=l.href),n==null||n(l)};return c.jsxs(c.Fragment,{children:[c.jsx(ve,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...s},children:c.jsxs(be,{sx:{minHeight:"62px !important"},children:[c.jsx(F,{sx:{mr:1,display:"flex",alignItems:"center"},children:t}),c.jsxs(F,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[c.jsx(w,{component:"h1",variant:"subtitle1",children:e}),i.length>0&&c.jsx(Ie.RoundedIconButton,{icon:c.jsx(_e.ExpandMoreFilled,{size:20}),ariaLabel:"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:d,disabled:r,sx:{ml:1}})]})]})}),c.jsx(Jt,{open:u,onClick:p,sx:{backdropFilter:"blur(4px)",backgroundColor:xe.ZeroGravityComponentsBackdropFill,zIndex:l=>l.zIndex.modal-1}}),c.jsx(je,{id:"app-menu",anchorEl:a,open:u,onClose:p,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:l=>l.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:i.map(l=>c.jsxs(z,{onClick:()=>h(l),children:[c.jsx(F,{sx:{display:"flex",alignItems:"center"},children:l.icon}),c.jsx(w,{variant:"body1",sx:{ml:2},children:l.name})]},l.id))})]})})),He=({title:o,titleId:t,...e},i)=>b.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.createElement("g",{id:"JogMinus"},b.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),Ye=E.forwardRef(He),Ke=({title:o,titleId:t,...e},i)=>b.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.createElement("g",{id:"JogPlus"},b.createElement("g",{id:"Plus"},b.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),b.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),b.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),Qe=E.forwardRef(Ke),dt=X.externalizeComponent(M.observer(({colors:o,label:t,getDisplayedValue:e,startJogging:i,stopJogging:n,disabled:r,activeJoggingDirection:s,...a})=>{var O,R,k,C,A,$,G;j.useAnimationFrame(()=>{const D=e(),L=h.current;L&&(L.textContent=D)});const g=B.useTheme(),[u,d]=E.useState(null);E.useEffect(()=>{r&&T()},[r]);const p=s||u,h=E.useRef(null);o||(o={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const l=p?(O=o.buttonBackgroundColor)==null?void 0:O.pressed:o.borderColor,f={width:"55px",color:o.color,path:{fill:o.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},y={...f,backgroundColor:(R=o.buttonBackgroundColor)==null?void 0:R.default,":hover":{backgroundColor:(k=o.buttonBackgroundColor)==null?void 0:k.hovered},":active":{backgroundColor:(C=o.buttonBackgroundColor)==null?void 0:C.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor}},":disabled":{backgroundColor:(A=o.buttonBackgroundColor)==null?void 0:A.disabled,"svg path":{fill:g.palette.action.disabled}}},v={...f,backgroundColor:($=o.buttonBackgroundColor)==null?void 0:$.pressed,color:o.backgroundColor,path:{fill:o.backgroundColor},":disabled":{backgroundColor:(G=o.buttonBackgroundColor)==null?void 0:G.pressed,"svg path":{fill:g.palette.action.disabled}}};function I(D,L){r||D.button===0&&(d(L),i(L))}function T(){d(null),n()}return c.jsxs(x,{height:"64px",direction:"row",justifyContent:"center",...a,children:[c.jsx(st,{disabled:r,disableRipple:!0,onPointerDown:D=>I(D,"-"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="-"?v:y,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${l??"#fff"}`,borderBottom:`2px solid ${l??"#fff"}`,borderTop:`2px solid ${l??"#fff"}`},children:c.jsx(Ye,{})}),c.jsxs(x,{spacing:"6px",sx:{width:"150px",backgroundColor:o.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${l??"#fff"}`,borderTop:`2px solid ${l??"#fff"}`},children:[c.jsx(x,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:o.color,".MuiTypography-root":{fontWeight:700,...r?{color:g.palette.action.disabled}:{}},...r?{"svg path":{fill:g.palette.action.disabled}}:{}},children:t}),c.jsx(w,{height:"22px",sx:{fontSize:"15px",color:r?g.palette.action.disabled:o.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:h,children:e()})]}),c.jsx(st,{disableRipple:!0,disabled:r,onPointerDown:D=>I(D,"+"),onPointerUp:T,onPointerOut:T,size:"large",sx:{...p==="+"?v:y,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${l??"#fff"}`,borderBottom:`2px solid ${l??"#fff"}`,borderTop:`2px solid ${l??"#fff"}`},children:c.jsx(Qe,{})})]})})),Gt=X.externalizeComponent(M.observer(({startJogging:o,stopJogging:t,lowerLimit:e,upperLimit:i,useDegree:n,getValue:r,disabled:s,...a})=>{var C,A,$,G,D,L,it;const{t:g}=V.useTranslation(),[u,d]=E.useState(),p=B.useTheme(),h={background:(C=p.palette.backgroundPaperElevation)==null?void 0:C[4],color:(A=p.palette.backgroundPaperElevation)==null?void 0:A[11]},l=M.useLocalObservable(()=>({activeJoggingDir:null,startJogging(S){this.activeJoggingDir=S,o(S)},stopJogging(){this.activeJoggingDir=null,t()}})),f=Fe(()=>{const S=n?y(r()):r();(S===void 0||u===void 0||Math.abs(u-S)>1e-9)&&d(S)},50);j.useAnimationFrame(f);function y(S){if(S!==void 0)return _.radiansToDegrees(S)}function v(S){S.button===0&&l.startJogging("-")}function I(S){S.button===0&&l.startJogging("+")}function T(S){l.stopJogging()}function O(S){l.stopJogging()}function R(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.degree.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}function k(S,P=1){if(S===void 0||Number.isNaN(S))return"";const J=g("General.mm.variable",{amount:S.toFixed(P)});return S>0&&P===0?`+${J}`:J}return c.jsxs(x,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...a,sx:{"& .MuiIconButton-root":{width:"52px",color:p.palette.text.primary,alignContent:"center",backgroundColor:($=p.palette.backgroundPaperElevation)==null?void 0:$[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(G=p.palette.backgroundPaperElevation)==null?void 0:G[11],color:p.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(D=p.palette.backgroundPaperElevation)==null?void 0:D[9]},"&:active":{...h}}},children:[c.jsx(st,{onPointerDown:v,onPointerUp:T,onPointerOut:O,disabled:s,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...l.activeJoggingDir==="-"?h:{}},children:c.jsx(Ne,{sx:{pointerEvents:"none",color:H.jointArrowColor}})}),c.jsxs(x,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(L=p.palette.backgroundPaperElevation)==null?void 0:L[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[c.jsx(w,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:s?p.palette.action.disabled:p.palette.text.primary},children:n?R(u):k(u)}),c.jsx(Nt,{disabled:!0,"aria-label":"Joint position",min:n?y(e):e,max:n?y(i):i,value:u||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:s?p.palette.action.disabled:p.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:s?p.palette.action.disabled:p.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(it=p.palette.backgroundPaperElevation)==null?void 0:it[5],opacity:1}},marks:e!==void 0&&i!==void 0&&[{value:n?y(e):e,label:n?R(y(e),0):k(e)},{value:n?y(i):i,label:n?R(y(i),0):k(i)}]})]}),c.jsx(st,{onPointerDown:I,onPointerUp:T,onPointerOut:O,disabled:s,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...l.activeJoggingDir==="+"?h:{}},children:c.jsx(Ve,{sx:{pointerEvents:"none",color:H.jointArrowColor}})})]})}));function Ze({currentTcpPose:o,axis:t,direction:e,motion:i,useToolCoordinateSystem:n,coordinateSystemRotation:r}){const s=e==="-"?-1:1;if(i.type==="translate"){if(!o.position)throw new Error("Current pose has no position, cannot perform translation");const p=i.distanceMm*s,h=new q.Vector3;if(h[t]=p,n){if(!o.orientation)throw new Error("Current pose has no orientation, cannot translate relative to tool");h.applyQuaternion(j.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"))}else r&&h.applyQuaternion(r);const l=[...o.position];return l[0]=(l[0]??0)+h.x,l[1]=(l[1]??0)+h.y,l[2]=(l[2]??0)+h.z,{position:l,orientation:o.orientation}}if(!o.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const a=j.parseRotationToQuaternion(o.orientation,"ROTATION_VECTOR"),g=new q.Vector3;g[t]=1,!n&&r&&g.applyQuaternion(r);const u=new q.Quaternion().setFromAxisAngle(g,i.distanceRads*s),d=n?a.multiply(u):u.multiply(a);return{position:o.position,orientation:[...j.quaternionToRotationVector(d)]}}function tt(o,t,e){return t.length!==o.length?!1:qt(o,t,e)}function mt(o,t,e){return t.length!==o.length?!0:qt(o,t,e)}function qt(o,t,e){for(let i=0;i<t.length;i++)if(Math.abs((t[i]??0)-(o[i]??0))>e)return!1;return!0}function Ut(o,t,e){if(o===void 0&&t||o&&t===void 0||(o==null?void 0:o.orientation)===void 0||(t==null?void 0:t.orientation)===void 0||(o==null?void 0:o.position)===void 0||(t==null?void 0:t.position)===void 0)return!1;if(o===void 0||t===void 0)return!0;let i=0;return i+=Math.abs(o.orientation[0]-t.orientation[0]),i+=Math.abs(o.orientation[1]-t.orientation[1]),i+=Math.abs(o.orientation[2]-t.orientation[2]),i+=Math.abs(o.position[0]-t.position[0]),i+=Math.abs(o.position[1]-t.position[1]),i+=Math.abs(o.position[2]-t.position[2]),i<=e}function ft(o,t,e){return o.coordinate_system===t.coordinate_system&&o.tcp===t.tcp&&Ut(o.tcp_pose,t.tcp_pose,e)}function yt(o,t){const e=new q.Vector3(t[0],t[1],t[2]),i=new q.Vector3(o[0],o[1],o[2]),n=e.length(),r=e.normalize();let s=i.length(),a=i.normalize();a.dot(r)<0&&(s=-s,a=a.multiplyScalar(-1));let g=s-n;return g-=2*Math.PI*Math.floor((g+Math.PI)/(2*Math.PI)),s=n+g,[...a.multiplyScalar(s)]}const Xe=2e-4;function St(o){const{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}=o;return{joint_position:t,tcp_pose:e,tcp:i,coordinate_system:n}}function vt(o,t){return o.tcp===t.tcp&&o.coordinate_system===t.coordinate_system&&o.tcp_pose===void 0==(t.tcp_pose===void 0)&&tt(o.joint_position,t.joint_position,Xe)}const Ct=1e-4;class et{constructor(t,e,i,n,r,s,a="cell",g={}){this.controller=e,this.motionGroup=i,this.description=n,this.initialMotionState=r,this.motionStateSocket=s,this.cellId=a,this.nova=j.createNovaClient(t),this.logger=g.logger??console,this.rapidlyChangingMotionState=r,s.addEventListener("message",u=>{var l;const d=(l=_.tryParseJson(u.data))==null?void 0:l.result;if(!d)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${u.data}`);ft(this.rapidlyChangingMotionState,d,Ct)||m.runInAction(()=>{var f,y,v;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=d.tcp_pose:(f=d.tcp_pose)!=null&&f.orientation&&((y=d.tcp_pose)!=null&&y.position)&&((v=this.rapidlyChangingMotionState.tcp_pose)!=null&&v.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:d.tcp_pose.position,orientation:yt(d.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:this.logger.debug("Received incomplete tcp_pose, ignoring",{tcpPose:d.tcp_pose})}),mt(this.rapidlyChangingMotionState.joint_position,d.joint_position,Ct)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=d.joint_position}),d.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==d.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=d.tcp}),this.rapidlyChangingMotionState.standstill!==d.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=d.standstill});const p=this.rapidlyChangingMotionState.joint_limit_reached.limit_reached,h=d.joint_limit_reached.limit_reached;p.some((f,y)=>f!==h[y])&&m.runInAction(()=>{this.rapidlyChangingMotionState.joint_limit_reached=d.joint_limit_reached}),this.rapidlyChangingMotionState.execute!==d.execute&&m.runInAction(()=>{this.rapidlyChangingMotionState.execute=d.execute})}),m.makeAutoObservable(this,{logger:!1,readoutState:m.computed({equals:vt,keepAlive:!0})})}static async open(t,e,i={}){var y;const n=j.createNovaClient(t),r=i.cellId??j.cellIdOf(t)??"cell",[s,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(v=>v.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const d=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await d.firstMessage(),h=(y=_.tryParseJson(p.data))==null?void 0:y.result;if(!h)throw new Error(`Unable to parse initial motion state message ${p.data}`);const l=i.logger??console;l.info("Connected motion state websocket to motion group",{motionGroup:u.motion_group,initialMotionState:h});const f=await n.api.motionGroup.getMotionGroupDescription(r,a,u.motion_group);return new et(n,g,u,f,h,d,r,{logger:l})}get readoutState(){return St(this.rapidlyChangingMotionState)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get joints(){return this.initialMotionState.joint_position.map((t,e)=>({index:e}))}dispose(){this.motionStateSocket.close()}}const Tt="Movement request rejected. Another client is currently executing a 'Jogging' motion!",to=500,eo=5e3;function oo(o){var e;return(((e=o.times)==null?void 0:e[o.times.length-1])??0)*2e3+eo}class ot{constructor(t,e={}){this.motionStream=t,this.options=e,this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",this.NO_TCP=void 0,this.DEFAULT_INIT_TIMEOUT=5e3,this.DEFAULT_ORIENTATION="coordsys",this.mode="off",this.joggingSocket=null,this.trajectorySocket=null,this.timeout=this.DEFAULT_INIT_TIMEOUT,this.incrementalMotionInFlight=!1,this.ownsMotionStream=!1,this.tcp=(e==null?void 0:e.tcp)||t.motionGroup.tcp||this.getDefaultTcp(t),this.coordinateSystem=e==null?void 0:e.coordinateSystem,this.orientation=(e==null?void 0:e.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(e==null?void 0:e.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(e==null?void 0:e.mode)||this.DEFAULT_MODE,this.onError=e==null?void 0:e.onError,this.logger=(e==null?void 0:e.logger)??console}static async open(t,e,i={}){const n=await et.open(t,e,{cellId:i.cellId,logger:i.logger}),r=new ot(n,i);r.ownsMotionStream=!0;try{await r.setJoggingMode(r.mode)}catch(s){throw r.dispose(),s}return r}getDefaultTcp(t){var i,n;const e=(n=(i=t.description.dh_parameters)==null?void 0:i[0])==null?void 0:n.type;return t.joints.length<6&&(e===N.JointTypeEnum.RevoluteJoint||e===N.JointTypeEnum.PrismaticJoint)?this.NO_TCP:this.DEFAULT_TCP}async setOptions(t){return t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),"coordinateSystem"in t&&(this.coordinateSystem=t.coordinateSystem),t.timeout&&(this.timeout=t.timeout),t.mode&&(this.mode=t.mode),t.onError&&(this.onError=t.onError),this.setJoggingMode(this.mode,!1)}get motionGroupId(){return this.motionStream.motionGroupId}get nova(){return this.motionStream.nova}get cellId(){return this.motionStream.cellId}get numJoints(){return this.motionStream.joints.length}async stop(){if(this.joggingSocket){const t=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:t})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const t=this.closeJoggingSockets();return this.ownsMotionStream&&this.motionStream.dispose(),t}closeJoggingSockets(){var e,i;(e=this.endJoggingInit)==null||e.call(this),(i=this.endIncrementalMotion)==null||i.call(this);const t=[this.joggingSocket,this.trajectorySocket].filter(n=>n!==null);return t.forEach(n=>{n.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(t.map(n=>n.closed()))}async setJoggingMode(t,e=!0){if(!(this.mode===t&&e)&&(this.closeJoggingSockets(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,e)=>{const i=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`);this.joggingSocket=i;let n=!1;const r=setTimeout(()=>{s(new Error(`Jogging initialization timeout after ${this.timeout} ms`))},this.timeout),s=u=>{n||(n=!0,clearTimeout(r),i.removeEventListener("close",g),this.endJoggingInit===a&&(this.endJoggingInit=void 0),u?e(u):t())},a=()=>s(),g=()=>{i.disposed&&s()};this.endJoggingInit=a,i.addEventListener("close",g),i.addEventListener("message",u=>{var p,h,l;const d=_.tryParseJson(u.data);if(((p=d==null?void 0:d.result)==null?void 0:p.kind)==="INITIALIZE_RECEIVED"){s();return}if(((h=d==null?void 0:d.result)==null?void 0:h.kind)==="MOTION_ERROR")if(this.onBlocked&&((l=d==null?void 0:d.result)!=null&&l.message.includes(Tt))){s(),i.dispose(),this.onBlocked();return}else this.onError?(s(),this.onError(u.data)):s(new Error(u.data))}),i.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,...this.tcp?{tcp:this.tcp}:{}})})}async rotateJoints({joint:t,direction:e,velocityValue:i,velocityUnit:n}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const r=new Array(this.numJoints).fill(0);r[t]=e==="-"?-i:i,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:r})}async translateTCP({axis:t,direction:e,velocityMmPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:this.velocityAlongAxis(t,e==="-"?-i:i),rotation:[0,0,0],use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:e,velocityRadsPerSec:i}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:[0,0,0],rotation:this.velocityAlongAxis(t,e==="-"?-i:i),use_tool_coordinate_system:this.orientation==="tool"})}get coordinateSystemRotation(){if(!(this.orientation==="tool"||!this.coordinateSystem))return j.Pose3.fromCoordinateSystem(this.coordinateSystem).quaternion}velocityAlongAxis(t,e){const i=new q.Vector3;i[t]=e;const n=this.coordinateSystemRotation;return n&&i.applyQuaternion(n),[i.x,i.y,i.z]}async runIncrementalCartesianMotion(t){if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(!this.incrementalMotionInFlight){this.incrementalMotionInFlight=!0;try{const e=await this.planIncrementalCartesianMotion(t);e&&await this.executeTrajectory(e)}finally{this.incrementalMotionInFlight=!1}}}async planIncrementalCartesianMotion({currentTcpPose:t,currentJoints:e,velocityInRelevantUnits:i,axis:n,direction:r,motion:s}){var y,v,I;const a=[],g=Ze({currentTcpPose:t,axis:n,direction:r,motion:s,useToolCoordinateSystem:this.orientation==="tool",coordinateSystemRotation:this.coordinateSystemRotation});a.push({limits_override:s.type==="translate"?{tcp_velocity_limit:i}:{tcp_orientation_velocity_limit:i},path:{path_definition_name:"PathLine",target_pose:{position:g.position,orientation:g.orientation}}});const u=this.motionStream.description;if(u.cycle_time===void 0){this.logger.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const d=this.motionStream.rapidlyChangingMotionState.tcp,p=d?(v=(y=u.tcps)==null?void 0:y[d])==null?void 0:v.pose:void 0,h={motion_group_model:((I=this.options)==null?void 0:I.motionGroupModel)??u.motion_group_model,cycle_time:u.cycle_time,mounting:u.mounting,tcp_offset:p,global:u.operation_limits.auto_limits},l=await this.nova.api.trajectoryPlanning.planTrajectory(this.cellId,{motion_group_setup:h,start_joint_position:e,motion_commands:a}),f=l.response;if(!f)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(l)}`);if("error_feedback"in f){if(this.onError){this.onError(f);return}throw new Error(`Failed to plan jogging increment motion: ${JSON.stringify(f.error_feedback)}`)}return f}async executeTrajectory(t){const e=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);this.trajectorySocket=e;const i=new AbortController;let n,r;try{await new Promise((s,a)=>{let g=!1;const u=()=>{g||(g=!0,s())},d=h=>{if(!g){if(g=!0,this.onError){this.onError(h),s();return}a(h instanceof Error?h:new Error(`Failed to execute trajectory: ${JSON.stringify(h)}`))}};r=u,this.endIncrementalMotion=u;const p=oo(t);n=setTimeout(()=>{d(new Error(`Jogging motion did not complete within ${p}ms`))},p),e.addEventListener("message",h=>{var f,y;const l=(f=_.tryParseJson(h.data))==null?void 0:f.result;if(!(l!=null&&l.kind)){d(new Error(`Failed to execute trajectory: Received invalid message ${h.data}`));return}if(this.onBlocked&&((y=l.message)!=null&&y.includes(Tt))){this.onBlocked(),u();return}if(l.kind==="INITIALIZE_RECEIVED"){if(l.add_trajectory_error||l.message){d(l);return}e.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})}else if(l.kind==="START_RECEIVED"){if(l.message){d(l);return}this.waitForMotionToFinish(i.signal).then(u,d)}else l.kind==="PAUSE_RECEIVED"||(l.kind==="MOTION_ERROR"&&l.message?d(l):d(new Error(`Failed to execute trajectory, cannot handle message type "${l.kind}"`)))}),e.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:t,tcp:this.tcp}})})}finally{clearTimeout(n),i.abort(),this.endIncrementalMotion===r&&(this.endIncrementalMotion=void 0),e.dispose(),this.trajectorySocket===e&&(this.trajectorySocket=null)}}async waitForMotionToFinish(t){const e=()=>this.motionStream.rapidlyChangingMotionState.standstill;await m.when(()=>!e(),{timeout:to,signal:t}).catch(()=>{}),await m.when(e,{signal:t})}}const zt=o=>{const t=o.softTimeout||3e3,[e,i]=E.useState(!1);return E.useEffect(()=>{const n=setTimeout(()=>{i(!0)},t);return()=>clearTimeout(n)}),c.jsx(x,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:"text.primary"},children:o.error?c.jsx(Wt,{loadingMessage:o.message,error:o.error}):c.jsxs(c.Fragment,{children:[c.jsx(Dt,{sx:{mb:3}}),!!o.message&&c.jsx(w,{variant:"body1",children:o.message}),c.jsx(w,{variant:"body2",sx:{visibility:e?"visible":"hidden",mt:2,color:"text.secondary"},children:"This is taking longer than expected..."})]})})},Wt=o=>{const t=Oe.makeErrorMessage(o.error),e=o.error instanceof Error?o.error.stack:null;return c.jsxs(x,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",p:2,overflow:"auto",color:"error.main"},children:[c.jsx(w,{variant:"body1",children:(o.loadingMessage?`Error while ${Lt.lowerFirst(Me.capitalize(o.loadingMessage))} - `:"")+t}),e&&c.jsx(F,{component:"pre",sx:{typography:"body2",fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word",mt:2,pb:6},children:e})]})},io=M.observer(({store:o})=>{const{t}=V.useTranslation();return c.jsx(Jt,{"data-testid":"jogging-blocked","aria-label":"jogging-blocked",open:!0,sx:{position:"absolute",zIndex:e=>e.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:c.jsxs(x,{sx:{m:2,width:"100%"},children:[c.jsxs(Re,{severity:"error",sx:{mb:2},children:[c.jsx(ke,{children:t("Jogging.Blocked.ti")}),t("Jogging.Blocked.lb")]}),c.jsx(lt,{variant:"contained",color:"secondary",onClick:()=>o.unblock(),children:t("Jogging.Blocked.Reenable.bt")})]})})}),no=({title:o,titleId:t,...e},i)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.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"})),ro=E.forwardRef(no),so=({title:o,titleId:t,...e},i)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.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"})),ao=E.forwardRef(so),co=({title:o,titleId:t,...e},i)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.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"})),lo=E.forwardRef(co),go=({title:o,titleId:t,...e},i)=>b.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:i,"aria-labelledby":t,...e},o?b.createElement("title",{id:t},o):null,b.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"})),uo=E.forwardRef(go),Ht=M.observer(({store:o})=>{const{t}=V.useTranslation(),[e,i]=E.useState(o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),n=E.useRef(e);j.useAnimationFrame(()=>{const s=o.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;$t(n.current,s)||(n.current=s,i(s))});const r=[];for(const[s,a]of e.entries())a&&r.push(s);return c.jsx(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"center"},children:c.jsx(w,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2,visibility:r.length?"visible":"hidden"},children:t("Jogging.JointLimitsReached.lb",{jointNumbers:r.map(s=>s+1).join(", ")})})})}),ho=B.styled(Pe)(({theme:o})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:o.palette.text.primary}}}}));function nt({labelValue:o,...t}){return c.jsxs(ho,{fullWidth:!0,variant:"filled",children:[c.jsx(Je,{id:t.labelId,children:o}),c.jsx(De,{...t})]})}function wt(o){const t=o.lastIndexOf("On");return t>0?o.slice(0,t):o}function Yt(o,t){const e=o[t];if(e)return e;const i=wt(t),n=o[i];if(n)return n;const r=Object.keys(o).filter(a=>wt(a)===i);if(r.length!==1)return;const s=r[0];return s?o[s]:void 0}const po={coordinate_system:"world",name:"world",reference_coordinate_system:"",position:[0,0,0],orientation:[0,0,0],orientation_type:"ROTATION_VECTOR"};function Kt(o){const t=Q(o.map(n=>({...n,coordinate_system:n.coordinate_system||"world"})),"coordinate_system");t.world??(t.world=po);const e={},i=n=>{const r=e[n];if(r)return r;const s=Yt(t,n);if(!s)throw new Error(`Unknown coordinate system ${n}. Known coordinate systems are: ${Object.keys(t).join(", ")}`);const a=s.reference_coordinate_system||"world";let g;if(a==="world")g=s;else{const u=i(a),d=j.Pose3.fromCoordinateSystem(u).multiply(j.Pose3.fromCoordinateSystem(s));g={...s,position:[d.position.x,d.position.y,d.position.z],orientation:[d.orientation.x,d.orientation.y,d.orientation.z],orientation_type:"ROTATION_VECTOR",reference_coordinate_system:u.reference_coordinate_system}}return e[n]=g,g};return Object.fromEntries(Object.keys(t).map(n=>[n,i(n)]))}function gt(o,t){const e=Yt(o,t||"world");if(!e)throw new Error(`Unknown coordinate system ${t}. Known coordinate systems are: ${Object.keys(o).join(", ")}`);return e}function Qt(o,t){return gt(Kt(t),o)}function Z(o,t,e){if(o.coordinateSystemId===t)return o;const i=Kt(e),n=gt(i,o.coordinateSystemId||"world"),r=gt(i,t);if(n.coordinate_system===r.coordinate_system)return{...o,coordinateSystemId:r.coordinate_system};const s=j.Pose3.fromCoordinateSystem(r).inverse().multiply(j.Pose3.fromCoordinateSystem(n).multiply(j.Pose3.fromPose(o.pose)));return{...o,pose:{position:[s.position.x,s.position.y,s.position.z],orientation:[s.orientation.x,s.orientation.y,s.orientation.z]},coordinateSystemId:r.coordinate_system}}function Zt(o,t,e){const i=j.Pose3.fromPose(o).multiply(j.Pose3.fromRobotTcp(t).inverse()).multiply(j.Pose3.fromRobotTcp(e)),{position:n,orientation:r}=i;return{position:[n.x,n.y,n.z],orientation:[r.x,r.y,r.z]}}function Mt(o,t){const e=o==null?void 0:o[t];if(!e)throw new Error(`Unknown TCP ${t}. Known TCPs are: ${Object.keys(o??{}).join(", ")}`);return{position:e.pose.position??[0,0,0],orientation:e.pose.orientation??[0,0,0],orientation_type:"ROTATION_VECTOR"}}function ut({inputPose:o,selectedTcpId:t,selectedCoordinateSystemId:e,tcpOffsetsById:i,coordinateSystems:n}){const r=t&&t!==o.tcpId?{...o,pose:Zt(o.pose,Mt(i,o.tcpId),Mt(i,t)),tcpId:t}:o;return e?Z(r,e,n):r}function Xt(o){var t,e,i,n,r;if(typeof o=="string"){const s=_.tryParseJson(o);return s?Xt(s):o}if(o&&typeof o=="object"){const s=o;return((t=s.error_feedback)==null?void 0:t.error_feedback_name)||((e=s.add_trajectory_error)==null?void 0:e.message)||s.message||((n=(i=s.result)==null?void 0:i.add_trajectory_error)==null?void 0:n.message)||((r=s.result)==null?void 0:r.message)||"Jogging motion failed"}return"Jogging motion failed"}const mo=[{pattern:/^FeedbackSingularity$/,translationKey:"Jogging.StreamStateSection.Error.Singularity.lb"},{pattern:/^FeedbackJointLimitExceeded$/,translationKey:"Jogging.StreamStateSection.Error.JointLimit.lb"},{pattern:/^FeedbackOutOfWorkspace$/,translationKey:"Jogging.StreamStateSection.Error.OutOfWorkspace.lb"},{pattern:/^FeedbackCollision$/,translationKey:"Jogging.StreamStateSection.Error.Collision.lb"},{pattern:/^FeedbackNoSolutionInCurrentConfiguration$/,translationKey:"Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb"},{pattern:/^Feedback\w+$/,translationKey:"Jogging.StreamStateSection.Error.PlanningFailed.lb"}];function fo(o){var t;return((t=mo.find(({pattern:e})=>e.test(o)))==null?void 0:t.translationKey)??null}const yo=5,So=250;function vo(o){var i,n,r,s;const t=[(n=(i=o==null?void 0:o.manual_t1_limits)==null?void 0:i.tcp)==null?void 0:n.velocity,(s=(r=o==null?void 0:o.manual_limits)==null?void 0:r.tcp)==null?void 0:s.velocity].filter(a=>typeof a=="number"&&Number.isFinite(a)&&a>0);return Math.min(So,...t)/10}const ht=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],jo=[{id:"continuous"},...ht],bo=["coordsys","tool"],Ot="joggingToolStore",xo=()=>typeof localStorage>"u"?void 0:localStorage;class Y{constructor(t,e,i,n,r,s={}){var g,u,d;this.jogger=t,this.coordSystems=e,this.motionGroupDescription=i,this.tcps=n,this.inverseSolverValue=r,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.jogCoordSystemId="world",this.selectedTcpId="",this.tcpChangeInProgress=!1,this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.lastJogError=null,this.onBeforeActivate=null,this.rotationVelocityDegPerSec=yo,this.minTranslationVelocityMmPerSec=1,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=N.JointTypeEnum.RevoluteJoint,this.storage=s.storage??xo();for(const p of e)if(p.coordinate_system===""){p.coordinate_system="world";break}this.selectedCoordSystemId=((g=e[0])==null?void 0:g.coordinate_system)||"world",this.jogCoordSystemId=this.selectedCoordSystemId,this.selectedTcpId=t.motionStream.rapidlyChangingMotionState.tcp??"",this.tcpChangeInProgress=this.tcps.length>0&&!this.selectedTcpId,this.inverseSolver=r,this.translationVelocityMmPerSec=vo(i==null?void 0:i.operation_limits),this.jointType=((d=(u=i==null?void 0:i.dh_parameters)==null?void 0:u[0])==null?void 0:d.type)??N.JointTypeEnum.RevoluteJoint,m.makeAutoObservable(this,{storage:!1},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()};const a=this.jogger.onError;this.jogger.onError=p=>{this.setLastJogError(Xt(p)),a==null||a(p)},this.loadFromLocalStorage(),this.disposers.push(m.autorun(()=>this.saveToLocalStorage())),this.disposers.push(m.autorun(()=>{const p=this.jogger.motionStream.rapidlyChangingMotionState.tcp;p&&p!==this.selectedTcpId&&m.runInAction(()=>{this.selectedTcpId=p,this.tcpChangeInProgress=!1})}))}static async loadFor(t,e={}){const{nova:i,cellId:n}=t,[r,s]=await Promise.all([i.api.controller.listCoordinateSystems(n,t.motionStream.controllerId,"ROTATION_VECTOR"),i.api.motionGroup.getMotionGroupDescription(n,t.motionStream.controllerId,t.motionGroupId)]),a=await i.api.motionGroupModels.getMotionGroupKinematicModel(s.motion_group_model);return Y.create(t,{coordinateSystems:r||[],description:s,kinematicModel:a},e)}static create(t,e,i={}){const{coordinateSystems:n,description:r,kinematicModel:s}=e,a=Object.entries(r.tcps||{}).map(([g,u])=>({id:g,readable_name:u.name,position:u.pose.position,orientation:u.pose.orientation}));return new Y(t,n,r,a,s.inverse_solver,i)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return Lt.countBy(this.coordSystems,t=>t.name)}async deactivate(){this.jogger.mode==="jogging"&&await this.jogger.setJoggingMode("off")}async activate(){var t;return this.lastJogError=null,await((t=this.onBeforeActivate)==null?void 0:t.call(this)),this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&await this.jogger.setOptions({tcp:this.selectedTcpId||void 0,orientation:this.selectedOrientation}),this.jogger.coordinateSystem=this.jogCoordSystem,this.activeDiscreteIncrement?await this.jogger.setJoggingMode("trajectory"):await this.jogger.setJoggingMode("jogging")):await this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){var i;const t=(i=this.storage)==null?void 0:i.getItem(Ot),e=t?_.tryParseJson(t):void 0;e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.coordSystemsById[e.jogCoordSystemId]&&(this.jogCoordSystemId=e.jogCoordSystemId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){var t;(t=this.storage)==null||t.setItem(Ot,JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get lastJogErrorTranslationKey(){return this.lastJogError?fo(this.lastJogError):null}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,jogCoordSystemId:this.jogCoordSystemId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get canJogCartesian(){return this.inverseSolver!==null}get tabs(){const t=[{id:"joint",label:"Joints"}];return this.canJogCartesian&&t.unshift({id:"cartesian",label:"Cartesian"}),t}get incrementOptions(){return jo}get discreteIncrementOptions(){return ht}get incrementOptionsById(){return Q(this.incrementOptions,t=>t.id)}get tabsById(){return Q(this.tabs,t=>t.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return Q(this.coordSystems,t=>t.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get jogCoordSystem(){return Qt(this.jogCoordSystemId,this.coordSystems)}get tcpPoseInSelectedCoordSystem(){const{tcp_pose:t,coordinate_system:e}=this.jogger.motionStream.readoutState;return!(t!=null&&t.position)||!t.orientation?t:Z({pose:{position:t.position,orientation:t.orientation},coordinateSystemId:e||"world"},this.selectedCoordSystemId,this.coordSystems).pose}get tcpsById(){return Q(this.tcps,t=>t.id)}tcpPoseIn(t,e){const{tcp_pose:i,tcp:n,coordinate_system:r}=this.jogger.motionStream.readoutState,s=this.tcpsById[n||this.selectedTcpId],a=this.tcpsById[t];if(!(!(i!=null&&i.position)||!i.orientation)&&!(!s||!a))try{return Z({pose:Zt(i,s,a),coordinateSystemId:r||"world"},e,this.coordSystems).pose}catch{return}}get activeDiscreteIncrement(){return ht.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(t){return t?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(t){return t?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(t){return t?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(t,e){const i=this.tabs[e]||this.tabs[0];this.selectedTabId=i.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.requestTcpChange(t).catch(e=>{console.error("Failed to change TCP:",e)})}async requestTcpChange(t){if(t===this.selectedTcpId)return;this.tcpChangeInProgress=!0;const e=this.jogger.tcp,i=this.jogger.mode!=="jogging";try{this.jogger.tcp=t,i?await this.jogger.setJoggingMode("jogging"):await this.jogger.setJoggingMode("jogging",!1);let n=await this.waitForTcpConfirmation(t,1e3);i&&await this.jogger.setJoggingMode("off"),n||(n=await this.waitForTcpConfirmation(t,2e3)),m.runInAction(()=>{n?this.selectedTcpId=t:(this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(n){throw i&&await this.jogger.setJoggingMode("off").catch(()=>{}),m.runInAction(()=>{this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??""}),n}finally{m.runInAction(()=>{this.tcpChangeInProgress=!1})}}waitForTcpConfirmation(t,e){return new Promise(i=>{const n=setTimeout(()=>{r(),i(!1)},e),r=m.when(()=>this.jogger.motionStream.rapidlyChangingMotionState.tcp===t,()=>{clearTimeout(n),i(!0)})})}setSelectedOrientation(t){this.selectedOrientation=t}setMoveRelativeToSelectedTcp(){this.selectedOrientation="tool"}setMoveRelativeToCoordSystem(t){this.selectedOrientation="coordsys",this.jogCoordSystemId=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setLastJogError(t){this.lastJogError=t}setVelocityFromSlider(t,e){!Number.isFinite(t)||t<this.minVelocityInDisplayUnits(e)||t>this.maxVelocityInDisplayUnits(e)||(e?this.rotationVelocityDegPerSec=t:this.translationVelocityMmPerSec=t)}setSelectedCartesianMotionType(t){this.selectedCartesianMotionType=t}lock(t){this.locks.add(t)}unlock(t){this.locks.delete(t)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket().catch(t=>{console.error("Failed to initialize jogging:",t)})}async withMotionLock(t){const e=ze();this.lock(e);try{return await t()}finally{this.unlock(e)}}}const _o=M.observer(({store:o,useDegree:t})=>{var s;const{t:e}=V.useTranslation(),i=E.useId(),n=[];function r(a){switch(a){case"coordsys":return e("Jogging.Orientation.coordsys");case"tool":return e("Jogging.Orientation.tool");default:return a}}return o.showCoordSystemSelect&&n.push(c.jsx(nt,{labelId:`jogging-coord-select-${i}`,labelValue:e("Jogging.CoordinateSystem.hlb"),value:o.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:a=>o.setSelectedCoordSystemId(a.target.value),children:o.coordSystems.map(a=>c.jsx(z,{value:a.coordinate_system,children:a.name&&o.coordSystemCountByName[a.name]>1?`${a.name} / ${a.coordinate_system}`:a.name||a.coordinate_system},a.coordinate_system))},"coord")),o.showTcpSelect&&n.push(c.jsx(nt,{labelId:`jogging-tcp-select-${i}`,labelValue:"TCP",value:o.selectedTcpId,size:"small",variant:"filled",displayEmpty:o.tcpChangeInProgress,onChange:a=>{o.requestTcpChange(a.target.value).catch(g=>{console.error("Failed to change TCP:",g)})},disabled:o.tcpChangeInProgress,endAdornment:o.tcpChangeInProgress?c.jsx(Ae,{position:"end",children:c.jsx(Dt,{size:16})}):void 0,children:o.tcps.map(a=>c.jsx(z,{value:a.id,children:a.id},a.id))},"tcp")),o.showOrientationSelect&&n.push(c.jsx(nt,{labelValue:e("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${i}`,value:o.selectedOrientation,onChange:a=>o.setSelectedOrientation(a.target.value),children:bo.map(a=>c.jsx(z,{value:a,children:r(a)},a))},"orientation")),o.showIncrementSelect&&n.push(c.jsxs(nt,{labelValue:e("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${i}`,size:"small",variant:"filled",value:((s=o.activeDiscreteIncrement)==null?void 0:s.id)||"continuous",onChange:a=>o.setSelectedIncrementId(a.target.value),children:[c.jsx(z,{value:"continuous",children:e("Jogging.Increment.Continuous.dd")},"continuous"),o.discreteIncrementOptions.map(a=>c.jsx(z,{value:a.id,children:t?`${a.degrees}°`:`${a.mm}mm`},a.id))]},"increment")),c.jsx(F,{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:n.map((a,g)=>c.jsx(F,{sx:{gridColumn:n.length%2===1&&g===n.length-1?"span 2":"auto"},children:a},g))})}),Io=B.styled(Le)(({theme:o})=>{var t;return{"&.MuiToggleButtonGroup-root":{background:(t=o.palette.backgroundPaperElevation)==null?void 0:t[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"}}}}}),te=X.externalizeComponent(M.observer(o=>{const{store:t}=o,{t:e}=V.useTranslation();function i(n,r){r===o.velocity||!$e(r)||o.onVelocityChange(r,o.useDegree)}return c.jsxs(x,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[t.showVelocityLegend&&c.jsx(w,{sx:{color:H.velocitySliderLegendColor,fontSize:"14px"},children:e("Jogging.Velocity.bt")}),c.jsx(Nt,{value:o.velocity,color:"secondary",onChange:i,min:o.min,max:o.max,"aria-labelledby":"input-slider",disabled:o.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),t.showVelocitySliderLabel&&(o.renderValue?o.renderValue(o.velocity):c.jsx(jt,{value:o.velocity.toString()}))]})}));function jt({value:o,sx:t}){var i;const e=B.useTheme();return c.jsx(x,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(i=e.palette.backgroundPaperElevation)==null?void 0:i[8],borderRadius:"10px",minWidth:"111px",...t},children:c.jsx(w,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:e.palette.text.primary,whiteSpace:"nowrap"},children:o})})}const ee=M.observer(({store:o,useDegree:t})=>{const{t:e}=V.useTranslation();function i(n,r){return r?`ω = ${e("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:n})}`:`v = ${e("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:n})}`}return c.jsx(te,{store:o,velocity:o.velocityInDisplayUnits(t),min:o.minVelocityInDisplayUnits(t),max:o.maxVelocityInDisplayUnits(t),onVelocityChange:o.setVelocityFromSlider,useDegree:t,disabled:o.isLocked,renderValue:n=>c.jsx(jt,{value:i(n,t),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),oe=M.observer(({store:o})=>{var s,a,g;const{t}=V.useTranslation(),e=B.useTheme(),i=((g=(a=(s=o.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:s.details)==null?void 0:a.state)==null?void 0:g.kind)??"KIND_UNKNOWN",n=o.lastJogError,r=o.lastJogErrorTranslationKey;return c.jsxs(F,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",color:e.palette.text.primary},children:[c.jsx(w,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:t("Jogging.StreamStateSection.lb")}),c.jsx(w,{variant:"body2",color:n?"error":void 0,sx:{fontSize:"0.75rem",lineHeight:1.2,textAlign:"right"},"data-testid":n?"JOG_ERROR":i,children:n?r?t(r):n:t(`Jogging.StreamStateSection.${i}.lb`)})]})}),Eo=M.observer(({store:o,children:t})=>{const{t:e}=V.useTranslation(),i=B.useTheme(),n=E.useRef(0);function r(h,l){(l==="translate"||l==="rotate")&&o.setSelectedCartesianMotionType(l)}async function s(h,l){const f=await o.activate(),y=f.motionStream.rapidlyChangingMotionState.tcp_pose,v=f.motionStream.rapidlyChangingMotionState.joint_position;y&&await o.withMotionLock(async()=>{try{o.setCurrentIncrementJog({axis:h.axis,direction:h.direction}),await o.jogger.runIncrementalCartesianMotion({currentTcpPose:y,currentJoints:v,coordSystemId:o.activeCoordSystemId,velocityInRelevantUnits:o.selectedCartesianMotionType==="translate"?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec,axis:h.axis,direction:h.direction,motion:o.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:l.mm}:{type:"rotate",distanceRads:_.degreesToRadians(l.degrees)}})}finally{o.setCurrentIncrementJog(null),await o.deactivate()}})}async function a(h){if(o.isLocked)return;const l=++n.current;try{if(await o.activate(),l!==n.current)return;if(o.activeDiscreteIncrement)return await s(h,o.activeDiscreteIncrement);h.motionType==="translate"?await o.jogger.translateTCP({axis:h.axis,direction:h.direction,velocityMmPerSec:o.translationVelocityMmPerSec}):await o.jogger.rotateTCP({axis:h.axis,direction:h.direction,velocityRadsPerSec:o.rotationVelocityRadsPerSec})}catch(f){console.error("Jogging failed:",f)}}async function g(){o.isLocked||o.activeDiscreteIncrement||(n.current++,await o.deactivate())}const u=[{id:"x",icon:c.jsx(ro,{}),colors:H.cartesianAxisColors.X},{id:"y",icon:c.jsx(ao,{}),colors:H.cartesianAxisColors.Y},{id:"z",icon:c.jsx(lo,{}),colors:H.cartesianAxisColors.Z}];function d(h){return e("General.mm.variable",{amount:h.toFixed(1)})}function p(h){return e("General.degree.variable",{amount:_.radiansToDegrees(h).toFixed(1)})}return c.jsxs(x,{"data-testid":"jogging-cartesian-tab","aria-label":"jogging-cartesian-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[c.jsxs(x,{gap:2,children:[c.jsx(_o,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),c.jsx(ee,{store:o,useDegree:o.selectedCartesianMotionType==="rotate"}),c.jsx(W,{})]}),c.jsx(x,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:c.jsxs(x,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[c.jsxs(Io,{value:o.selectedCartesianMotionType,onChange:r,exclusive:!0,"aria-label":e("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[c.jsx(It,{value:"translate",children:e("Jogging.Cartesian.Translation.bt")}),c.jsx(It,{value:"rotate",children:e("Jogging.Cartesian.Rotation.bt")})]}),o.selectedCartesianMotionType==="translate"&&u.map(h=>{var l,f;return c.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${h.id}`,"aria-label":`jogging-cartesian-axis-control-${h.id}`,colors:h.colors,disabled:o.isLocked,activeJoggingDirection:((l=o.incrementJogInProgress)==null?void 0:l.axis)===h.id?o.incrementJogInProgress.direction:void 0,label:c.jsxs(c.Fragment,{children:[h.icon,c.jsx(w,{sx:{fontSize:"24px",color:((f=h.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:h.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,v;return d(((v=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.position)==null?void 0:v[_.XYZ_TO_VECTOR[h.id]])||0)},startJogging:y=>a({axis:h.id,motionType:"translate",direction:y}),stopJogging:g},h.id)}),o.selectedCartesianMotionType==="rotate"&&u.map(h=>{var l,f;return c.jsx(dt,{"data-testid":`jogging-cartesian-axis-control-${h.id}`,"aria-label":`jogging-cartesian-axis-control-${h.id}`,colors:h.colors,disabled:o.isLocked,activeJoggingDirection:((l=o.incrementJogInProgress)==null?void 0:l.axis)===h.id?o.incrementJogInProgress.direction:void 0,label:c.jsxs(c.Fragment,{children:[c.jsx(uo,{}),c.jsx(w,{sx:{fontSize:"24px",color:((f=h.colors)==null?void 0:f.labelColor)??i.palette.text.primary},children:h.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,v;return p(((v=(y=o.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.orientation)==null?void 0:v[_.XYZ_TO_VECTOR[h.id]])||0)},startJogging:y=>a({axis:h.id,motionType:"rotate",direction:y}),stopJogging:g},h.id)})]})}),c.jsx(Ht,{store:o}),c.jsx(W,{}),c.jsx(oe,{store:o}),t&&c.jsx(W,{}),t]})}),Co=M.observer(({store:o,children:t})=>{const e=B.useTheme(),i=E.useRef(0);async function n(s){const a=++i.current;try{if(await o.activate(),a!==i.current)return;await o.jogger.rotateJoints({joint:s.joint,direction:s.direction,velocityUnit:o.jointType===N.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:o.jointType===N.JointTypeEnum.PrismaticJoint?o.translationVelocityMmPerSec:o.rotationVelocityRadsPerSec})}catch(g){console.error("Jogging failed:",g)}}async function r(){i.current++,await o.jogger.stop(),await o.deactivate()}return c.jsxs(x,{"data-testid":"jogging-joint-tab","aria-label":"jogging-joint-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[c.jsx(ee,{store:o,useDegree:o.jointType===N.JointTypeEnum.RevoluteJoint}),c.jsx(W,{}),c.jsx(x,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:c.jsx(x,{"data-testid":"jogging-joint-value-controls-wrapper","aria-label":"jogging-joint-value-controls-wrapper",alignItems:"center",gap:"24px",children:o.jogger.motionStream.joints.map(s=>{var g,u,d;const a=(d=(u=(g=o.motionGroupDescription.operation_limits.auto_limits)==null?void 0:g.joints)==null?void 0:u[s.index])==null?void 0:d.position;return c.jsxs(x,{"data-testid":`jogging-joint-value-control-${s.index}`,"aria-label":`jogging-joint-value-control-${s.index}`,direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[o.showJointsLegend&&c.jsx(w,{color:o.isLocked?e.palette.text.disabled:e.palette.text.secondary,children:`G${s.index+1}`}),c.jsx(Gt,{disabled:o.isLocked,lowerLimit:a==null?void 0:a.lower_limit,upperLimit:a==null?void 0:a.upper_limit,useDegree:o.jointType===N.JointTypeEnum.RevoluteJoint,getValue:()=>{const p=o.jogger.motionStream.rapidlyChangingMotionState.joint_position[s.index];return p!==void 0?p:void 0},startJogging:p=>n({joint:s.index,direction:p}),stopJogging:r})]},`joint-${s.index}`)})})}),c.jsx(Ht,{store:o}),c.jsx(W,{}),c.jsx(oe,{store:o}),t&&c.jsx(W,{}),t]})}),To=X.externalizeComponent(M.observer(o=>{const t=M.useLocalObservable(()=>({joggingStore:null,loadingError:null}));return E.useEffect(()=>{let e=!1,i;async function n(){m.runInAction(()=>{t.loadingError=null,t.joggingStore=null});try{let r=o.store;if(!r){const s=await ot.open(o.nova,o.motionGroupId,{cellId:o.cellId});if(e){s.dispose();return}try{r=await Y.loadFor(s)}catch(a){throw s.dispose(),a}if(i=r,e){r.dispose();return}}m.runInAction(()=>{t.joggingStore=r}),o.onSetup&&o.onSetup(r)}catch(r){if(e)return;m.runInAction(()=>{t.loadingError=r})}}return n(),()=>{e=!0,i==null||i.dispose()}},[o.store,o.nova,o.motionGroupId,o.cellId]),E.useEffect(()=>{const e=t.joggingStore;e&&(o.locked?e.lock("external"):e.unlock("external"))},[t.joggingStore,o.locked]),c.jsx(x,{"data-testid":"jogging-panel","aria-label":"jogging-panel",sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...o.sx},children:t.joggingStore?c.jsx(wo,{store:t.joggingStore,children:o.children}):c.jsx(zt,{message:"Loading jogging",error:t.loadingError})})})),wo=M.observer(({store:o,children:t})=>{const{t:e}=V.useTranslation();function i(){if(o.currentTab.id==="cartesian")return c.jsx(Eo,{store:o,children:t});if(o.currentTab.id==="joint")return c.jsx(Co,{store:o,children:t})}return c.jsxs(x,{flexGrow:1,sx:{overflow:"hidden"},children:[c.jsx(we,{"data-testid":"jogging-tabs","aria-label":"jogging-tabs",value:o.tabIndex,onChange:o.onTabChange,variant:"fullWidth",children:o.tabs.map(n=>{const r=n.label==="Cartesian"?e("Jogging.Cartesian.bt"):e("Jogging.Joints.bt"),s=n.label==="cartesian"?c.jsx(Ee,{fontSize:"small",sx:{mr:1}}):c.jsx(Ce,{fontSize:"small",sx:{mr:1}});return c.jsx(Te,{"data-testid":`jogging-tab-${n.id}`,"aria-label":`jogging-tab-${n.id}`,label:o.showTabIcons?c.jsxs(x,{direction:"row",alignItems:"center",children:[s,r]}):r,id:`jogging-tab-${n.id}`,"aria-controls":`jogging-tab-${n.id}`},n.id)})}),c.jsx(x,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:i()}),o.blocked&&c.jsx(io,{store:o})]})});function Mo(){const o=window.location.href;return o.substring(0,o.indexOf("/",o.indexOf("//")+2))}function Oo({baseUrl:o=Mo(),...t}){return c.jsxs(Be,{"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:[c.jsx(Ue,{id:"no-motion-group-modal-title",children:"No motion group found"}),c.jsxs(qe,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[c.jsx(w,{color:"#fff",children:"Found no devices to connect to."}),c.jsx(w,{color:"#fff",children:"Please ensure a motion group has been created."})]}),c.jsx(Ge,{children:c.jsxs(x,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[c.jsx(lt,{href:`${o}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),c.jsx(lt,{href:`${o}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}const Rt=1e-4,Ro={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class at{constructor(t,e,i,n,r,s,a,g,u,d,p="cell"){this.controller=e,this.motionGroup=i,this.initialMotionState=n,this.motionStateSocket=r,this.isVirtual=s,this.tcps=a,this.description=g,this.initialControllerState=u,this.controllerStateSocket=d,this.cellId=p,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.nova=j.createNovaClient(t),this.rapidlyChangingMotionState=n,this.controllerState=u,d.addEventListener("message",h=>{var f;const l=(f=_.tryParseJson(h.data))==null?void 0:f.result;l&&m.runInAction(()=>{this.controllerState=l})}),r.addEventListener("message",h=>{var f;const l=(f=_.tryParseJson(h.data))==null?void 0:f.result;if(!l)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${h.data}`);mt(this.rapidlyChangingMotionState.joint_position,l.joint_position,Rt)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=l.joint_position}),ft(this.rapidlyChangingMotionState,l,Rt)||m.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=l.tcp_pose}),l.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==l.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=l.tcp}),this.rapidlyChangingMotionState.standstill!==l.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=l.standstill})}),m.makeAutoObservable(this)}static async connectMultiple(t,e,i={}){const n=j.createNovaClient(t),r=i.cellId??j.cellIdOf(t);return Promise.all(e.map(s=>at.connect(n,s,{...i,cellId:r})))}static async connect(t,e,i={}){var R,k;const n=j.createNovaClient(t),r=i.cellId??j.cellIdOf(t)??"cell",[s,a]=e.split("@"),g=await n.api.controller.getCurrentRobotControllerState(r,a),u=g==null?void 0:g.motion_groups.find(C=>C.motion_group===e);if(!g||!u)throw new Error(`Controller ${a} or motion group ${e} not found`);const d=n.openReconnectingWebsocket(`/cells/${r}/controllers/${a}/motion-groups/${e}/state-stream`),p=await d.firstMessage(),h=(R=_.tryParseJson(p.data))==null?void 0:R.result;if(!h)throw new Error(`Unable to parse initial motion state message ${p.data}`);console.log(`Connected motion state websocket to motion group ${u.motion_group}. Initial state:
2
+ `,h);const f=(await n.api.controller.getRobotController(r,g.controller)).configuration.kind==="VirtualController",y=await n.api.motionGroup.getMotionGroupDescription(r,a,u.motion_group),v=Object.entries(y.tcps||{}).map(([C,A])=>({id:C,readable_name:A.name,position:A.pose.position,orientation:A.pose.orientation})),I=n.openReconnectingWebsocket(`/cells/${r}/controllers/${g.controller}/state-stream?response_rate=1000`),T=await I.firstMessage(),O=(k=_.tryParseJson(T.data))==null?void 0:k.result;if(!O)throw new Error(`Unable to parse initial controller state message ${T.data}`);return console.log(`Connected controller state websocket to controller ${g.controller}. Initial state:
3
+ `,O),new at(n,g,u,h,d,f,v,y,O,I,r)}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((t,e)=>({index:e}))}get dhParameters(){if(this.description.dh_parameters!==void 0)return this.description.dh_parameters.map(t=>({...Ro,...t}))}get safetyZones(){return this.description.safety_zones}get mountingPosition(){var t,e,i;return this.description.mounting?[(((t=this.description.mounting.position)==null?void 0:t[0])||0)/1e3,(((e=this.description.mounting.position)==null?void 0:e[1])||0)/1e3,(((i=this.description.mounting.position)==null?void 0:i[2])||0)/1e3]:[0,0,0]}get mountingQuaternion(){var n,r,s,a,g,u;const t=new Et.Vector3(((r=(n=this.description.mounting)==null?void 0:n.orientation)==null?void 0:r[0])||0,((a=(s=this.description.mounting)==null?void 0:s.orientation)==null?void 0:a[1])||0,((u=(g=this.description.mounting)==null?void 0:g.orientation)==null?void 0:u[2])||0),e=t.length(),i=t.normalize();return new Et.Quaternion().setFromAxisAngle(i,e)}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}m.runInAction(()=>{this.activationState="deactivating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_MONITOR"),m.runInAction(()=>{this.activationState="inactive"})}catch(t){throw m.runInAction(()=>{this.activationState="active"}),t}}async activate(){if(this.activationState!=="inactive"){console.error("Tried to activate while already activating");return}m.runInAction(()=>{this.activationState="activating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_CONTROL"),m.runInAction(()=>{this.activationState="active"})}catch(t){throw m.runInAction(()=>{this.activationState="inactive"}),t}}toggleActivation(){this.activationState==="inactive"?this.activate():this.activationState==="active"&&this.deactivate()}dispose(){this.motionStateSocket.close(),this.controllerStateSocket.close(),this.connectedJoggingSocket&&this.connectedJoggingSocket.close()}setJoggingVelocity(t){this.joggingVelocity=t}}const bt=1e-4,ko=new Set(["timestamp","sequence_number","joint_position","joint_torque","joint_current","flange_pose","tcp_pose","flange_velocity","tcp_velocity"]),Ao=1,kt=o=>Array.isArray(o)&&o.length===3&&o.every(t=>typeof t=="number");class ie{constructor(t,e,i,n={}){this.source=t,this.motionGroupId=e,this.lastMessageReceivedAt=Date.now(),this.lastInvalidStateMessage=null,this.connectionQuality="good";const r=i.motion_groups.find(s=>s.motion_group===e);if(!r)throw new Error(`Motion group ${e} not found in initial controller state`);this.isVirtual=n.isVirtual??!1,this.onError=n.onError,this.reconnectsOnFocus=(n.reconnectOnFocus??!0)&&typeof window<"u",this.rapidlyChangingMotionState=r,this.lastValidStateMessage={receivedAt:Date.now(),data:i},m.makeAutoObservable(this,{source:!1,lastMessageReceivedAt:!1,connectionQualityInterval:!1,isVirtual:!1,onError:!1,reconnectsOnFocus:!1,readoutState:m.computed({equals:vt,keepAlive:!0})},{autoBind:!0}),this.source.addEventListener("message",this.handleMessage),this.connectionQualityInterval=setInterval(this.updateConnectionQuality,500),this.reconnectsOnFocus&&window.addEventListener("focus",this.handleWindowFocus)}get controllerState(){return this.lastValidStateMessage.data}get readoutState(){return St(this.rapidlyChangingMotionState)}async nextMotionState(){var i,n;const t=await this.source.nextMessage(),e=(n=(i=this.source.parse(t.data))==null?void 0:i.motion_groups)==null?void 0:n.find(r=>r.motion_group===this.motionGroupId);if(!e)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${t.data}`);return e}setLastInvalidStateMessage(t){this.lastInvalidStateMessage={receivedAt:Date.now(),data:t}}setLastValidStateMessage(t){this.lastValidStateMessage={receivedAt:Date.now(),data:t}}updateRapidlyChangingMotionState(t,e){const i=this.rapidlyChangingMotionState,n=t;for(const r of Object.keys(n))e!=null&&e.has(r)||$t(i[r],n[r])||(i[r]=n[r]);for(const r of Object.keys(i))e!=null&&e.has(r)||r in n||delete i[r]}setConnectionQuality(t){this.connectionQuality=t}handleWindowFocus(){this.source.reconnect()}updateConnectionQuality(){const t=Date.now()-this.lastMessageReceivedAt,e=this.isVirtual?3e3:1e3,i=this.isVirtual?6e3:3e3;if(t>i){this.source.readyState===Ao&&this.source.reconnect(),this.setConnectionQuality("critical");return}if(t>e){this.setConnectionQuality("struggling");return}this.setConnectionQuality("good")}dispose(){this.source.removeEventListener("message",this.handleMessage),clearInterval(this.connectionQualityInterval),this.reconnectsOnFocus&&window.removeEventListener("focus",this.handleWindowFocus)}handleMessage(t){var u,d;const e=this.source.parse(t.data);if(!(e!=null&&e.motion_groups)){(u=this.onError)==null||u.call(this,{message:_.makeErrorMessage(t.data),url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}this.lastMessageReceivedAt=Date.now();const i=this.lastValidStateMessage.data;(i.safety_state!==e.safety_state||i.operation_mode!==e.operation_mode||i.mode!==e.mode)&&this.setLastValidStateMessage(e);const n=e.motion_groups.find(p=>p.motion_group===this.motionGroupId);if(!n){(d=this.onError)==null||d.call(this,{message:`Motion group ${this.motionGroupId} not found in controller state: ${JSON.stringify(t.data)}`,url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}const r=!tt(this.rapidlyChangingMotionState.joint_position,n.joint_position,bt),s=this.rapidlyChangingMotionState.tcp!==n.tcp;if(!r&&!s){this.updateRapidlyChangingMotionState(n,ko);return}const a=this.rapidlyChangingMotionState.flange_pose,g=n.flange_pose;if((g==null?void 0:g.orientation)==null||!kt(g.orientation)){const p=g==null?void 0:g.orientation;throw new Error(`Invalid newFlangePose.orientation: expected [number, number, number] (got ${p==null?"null":p.length})`)}if((a==null?void 0:a.orientation)==null||!kt(a.orientation)){const p=a==null?void 0:a.orientation;throw new Error(`Invalid oldFlangePose.orientation: expected [number, number, number] (got ${p==null?"null":p.length})`)}g.orientation=yt(g.orientation,a.orientation),this.updateRapidlyChangingMotionState(n)}}function Po(o){return{get url(){return o.url},get readyState(){return o.readyState},addEventListener:(t,e)=>o.addEventListener(t,e),removeEventListener:(t,e)=>o.removeEventListener(t,e),firstMessage:()=>o.firstMessage(),nextMessage:()=>o.nextMessage(),reconnect:()=>o.reconnect(),close:()=>o.close(),parse:t=>{var e;return(e=Vt.tryParseJson(t))==null?void 0:e.result}}}function ne(o,{controllerId:t,cellId:e,responseRateMs:i}){const n=j.createNovaClient(o),r=e??j.cellIdOf(o)??"cell",s=i===void 0?"":`?response_rate=${i}`;return Po(n.openReconnectingWebsocket(`/cells/${r}/controllers/${t}/state-stream${s}`))}const Jo=["FeedbackOutOfWorkspace","FeedbackJointLimitExceeded","FeedbackAxisRangeExceeded","FeedbackNoSolutionInCurrentConfiguration"];function re(o){return o==="FeedbackSingularity"?"Jogging.TargetPose.Error.Singularity.lb":o==="FeedbackCollision"?"Jogging.TargetPose.Error.Collision.lb":Jo.includes(o)?"Jogging.TargetPose.Error.NotReachable.lb":"Jogging.TargetPose.Error.PlanningFailed.lb"}function se(o){const t=o.api.opts.axiosInstance;if(!t)throw new Error("Nova API client has no configured HTTP transport");return t}function pt(o,t){const e=o.api.opts.baseOptions??{},i={...e,...t};return(e.headers||t.headers)&&(i.headers={...e.headers,...t.headers}),(e.params||t.params)&&(i.params={...e.params,...t.params}),i}async function Do(o,t,e,i){var r;if(!e)return t;const n=`/experimental/motion-group-models/${encodeURIComponent(t)}/description`;i==null||i(`${n}?serial_number=${encodeURIComponent(e)}`);try{return(await se(o).get(n,pt(o,{params:{serial_number:e}}))).data.name}catch(s){if(!Ft.isAxiosError(s)||((r=s.response)==null?void 0:r.status)!==404)throw s;return t}}async function Lo(o,t,e,i,n){var u;const r=se(o),s=`/motion-group-models/${encodeURIComponent(t)}/${i}`,a={};if(e){const d=`/experimental${s}`;n==null||n(`${d}?serial_number=${encodeURIComponent(e)}`);try{return(await r.get(d,pt(o,{...a,params:{serial_number:e}}))).data}catch(p){if(!Ft.isAxiosError(p)||((u=p.response)==null?void 0:u.status)!==404)throw p}}return n==null||n(s),(await r.get(s,pt(o,a))).data}const ae=["motionGroupDescription","controllerConfiguration","kinematicModel","motionGroupModel","coordinateSystems","controllerState","motionStateStream","controllerStateStream"];class xt extends Error{constructor(t,e,i){super(i),this.stepId=t,this.cause=e,this.name="RobotLoadStepError"}}function rt(o){return o instanceof xt}class ce{constructor(t=null,e=null){this.motionGroupId=null,this.controllerId=null,this.steps=[],this.retryAttempt=0,this.fatalError=null,this.currentStepStartedAt=null,this.motionGroupId=t,this.controllerId=e,this.steps=ae.map(i=>({id:i,status:"pending",url:null,error:null})),m.makeAutoObservable(this,{},{autoBind:!0})}beginRetry(t){for(const e of this.steps)e.status="pending",e.url=null,e.error=null;this.retryAttempt=t,this.fatalError=null,this.currentStepStartedAt=null}stepById(t){return this.steps.find(e=>e.id===t)}startStep(t,e){const i=this.stepById(t);i&&(i.status="running",i.url=e,i.error=null,this.currentStepStartedAt=Date.now())}updateStepUrl(t,e){const i=this.stepById(t);i&&(i.url=e)}succeedStep(t){const e=this.stepById(t);e&&(e.status="succeeded",this.currentStepStartedAt=null)}failStep(t,e){const i=this.stepById(t);i&&(i.status="failed",i.error=e,this.currentStepStartedAt=null)}failWith(t){this.fatalError=t,this.currentStepStartedAt=null}get totalCount(){return this.steps.length}get succeededCount(){return this.steps.filter(t=>t.status==="succeeded").length}get runningStep(){return this.steps.find(t=>t.status==="running")}get failedStep(){return this.steps.find(t=>t.status==="failed")}get isFailed(){return this.fatalError!==null||this.failedStep!==void 0}get isComplete(){return this.steps.length>0&&this.steps.every(t=>t.status==="succeeded")}}const $o=1e4;async function At(o,t,e){let i;o.catch(()=>{});try{return await Promise.race([o,new Promise((n,r)=>{i=setTimeout(()=>r(new Error(e)),t)})])}finally{clearTimeout(i)}}async function No({nova:o,cellId:t,controllerId:e,motionGroupId:i,progress:n,createStateSource:r,isStale:s=()=>!1,socketTimeoutMs:a=$o}){let g,u,d=!1;function p(){g==null||g.dispose(),u==null||u.close()}async function h(l,f,y){n.startStep(l,f);try{const v=await y();return n.succeedStep(l),v}catch(v){throw n.failStep(l,v),new xt(l,v,_.makeErrorMessage(v))}}try{if(s())return null;const l=`/cells/${t}/controllers/${e}/motion-groups/${i}`,f=`/cells/${t}/controllers/${e}`,y=await h("motionGroupDescription",`${l}/description`,()=>o.api.motionGroup.getMotionGroupDescription(t,e,i));if(s())return null;const{configuration:v}=await h("controllerConfiguration",f,()=>o.api.controller.getRobotController(t,e));if(s())return null;const I={model:y.motion_group_model,serialNumber:y.serial_number},T=I.serialNumber?`?serial_number=${encodeURIComponent(I.serialNumber)}`:"",O=await h("kinematicModel",`/experimental/motion-group-models/${encodeURIComponent(I.model)}/kinematic${T}`,()=>Lo(o,I.model,I.serialNumber,"kinematic",S=>n.updateStepUrl("kinematicModel",S)));if(s())return null;const R=await h("motionGroupModel",`/experimental/motion-group-models/${encodeURIComponent(I.model)}/description${T}`,()=>Do(o,I.model,I.serialNumber,S=>n.updateStepUrl("motionGroupModel",S)));if(s())return null;const k=await h("coordinateSystems",`${f}/coordinate-systems?orientation_type=ROTATION_VECTOR`,async()=>await o.api.controller.listCoordinateSystems(t,e,"ROTATION_VECTOR")??[]);if(s())return null;const{controllerState:C,motionGroupState:A}=await h("controllerState",`${f}/state`,async()=>{const S=await o.api.controller.getCurrentRobotControllerState(t,e),P=S==null?void 0:S.motion_groups.find(J=>J.motion_group===i);if(!S||!P)throw new Error(`Controller ${e} or motion group ${i} not found`);return{controllerState:S,motionGroupState:P}});if(s())return null;const $=`${l}/state-stream`,{socket:G,initialMotionState:D}=await h("motionStateStream",$,async()=>{var K;const S=o.openReconnectingWebsocket($);g=S;const P=await At(S.firstMessage(),a,`No motion state received from ${$} within ${a/1e3}s`),J=(K=Vt.tryParseJson(P.data))==null?void 0:K.result;if(!J)throw new Error(`Unable to parse initial motion state message ${P.data}`);return{socket:S,initialMotionState:J}});if(s())return null;const{source:L,initialControllerState:it}=await h("controllerStateStream",`${f}/state`,async()=>{var K;const S=r({cellId:t,controllerId:e});u=S,n.updateStepUrl("controllerStateStream",S.url);const P=await At(S.firstMessage(),a,`No controller state received from ${S.url} within ${a/1e3}s`),J=S.parse(P.data);if(!J)throw new Error(`Unable to parse initial controller state message ${P.data}`);if(!((K=J.motion_groups)!=null&&K.some(Se=>Se.motion_group===i)))throw new Error(`Controller state from ${S.url} does not list motion group ${i} yet`);return{source:S,initialControllerState:J}});return s()?null:(d=!0,{motionGroupDescription:y,controllerConfiguration:v,kinematicModel:O,motionGroupModelName:R,coordinateSystems:k,controllerState:C,motionGroupState:A,initialMotionState:D,motionStateSocket:G,stateSource:L,initialControllerState:it,dispose:p})}finally{d||p()}}class le{constructor(t){this.options=t,this.plannedTrajectory=null,this.trajectoryState="idle",this.lastError=null,this.disposers=[],this.logger=t.logger??console,m.makeAutoObservable(this,{socket:!1,disposers:!1,logger:!1,options:!1},{autoBind:!0}),this.socket=this.openSocket(),this.disposers.push(m.reaction(()=>this.executionState,e=>{e==="END_OF_TRAJECTORY"&&this.reset()}))}get joggingStore(){return this.options.joggingStore}get jogger(){return this.options.joggingStore.jogger}get motionStream(){return this.options.joggingStore.jogger.motionStream}get executionState(){var t,e;return(e=(t=this.motionStream.rapidlyChangingMotionState.execute)==null?void 0:t.details)==null?void 0:e.state.kind}async planTrajectory(t){var I,T,O,R,k;if((T=(I=this.options).isLocked)!=null&&T.call(I))throw this.reset(),new Error("Cannot plan trajectory: the robot is locked");await this.ensureMovementOwnership();const e=this.motionStream.rapidlyChangingMotionState.joint_position??[],{cycle_time:i,mounting:n,motion_group_model:r,tcps:s}=this.motionStream.description,a=this.joggingStore.selectedTcpId,g=a?(O=s==null?void 0:s[a])==null?void 0:O.pose:void 0,u={motion_group_model:((R=this.jogger.options)==null?void 0:R.motionGroupModel)??r,cycle_time:i??0,mounting:n,...g&&{tcp_offset:g}};let d;if(t.type==="cartesian"){let C=t.pose;const A=t.coordinateSystemId||"world";if(A!=="world")try{C=Z({pose:{position:C.position??[0,0,0],orientation:C.orientation??[0,0,0]},coordinateSystemId:A},"world",this.joggingStore.coordSystems).pose}catch{return this.reset(),{ok:!1,errorFeedbackName:"FeedbackUnknown"}}d={limits_override:{tcp_velocity_limit:this.joggingStore.translationVelocityMmPerSec},path:{target_pose:C,path_definition_name:"PathCartesianPTP"}}}else d={limits_override:{joint_velocity_limits:Array(e.length).fill(this.joggingStore.rotationVelocityRadsPerSec)},path:{target_joint_position:t.joints,path_definition_name:"PathJointPTP"}};m.runInAction(()=>{this.lastError=null,this.trajectoryState="planning"});let p;try{p=await this.jogger.nova.api.trajectoryPlanning.planTrajectory(this.jogger.cellId,{motion_group_setup:u,start_joint_position:e,motion_commands:[d]})}catch(C){throw this.reset(),C}const h=p.response;if("error_feedback"in h){const C=((k=h.error_feedback)==null?void 0:k.error_feedback_name)??"FeedbackUnknown";return this.reset(),{ok:!1,errorFeedbackName:C}}const l=h.joint_positions,f=l[0],y=l[l.length-1];if(!f||!y)throw this.reset(),new Error("Trajectory returned invalid joint positions");const v={message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.jogger.motionGroupId,tcp:a||void 0,data:h}};return this.socket.sendJson(v),m.runInAction(()=>{this.plannedTrajectory={startJoints:f,endJoints:y}}),{ok:!0}}start(){if(!this.plannedTrajectory)throw new Error("Cannot start trajectory: no planned trajectory exists");if(this.trajectoryState!=="planned")throw new Error(`Cannot start trajectory: expected state "planned", got "${this.trajectoryState}"`);if(this.executionState==="RUNNING")throw new Error("Cannot start trajectory: robot is already running");const t={message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"};this.socket.sendJson(t)}async pause(){if(this.trajectoryState!=="moving")throw new Error(`Cannot pause trajectory: expected state "moving", got "${this.trajectoryState}"`);if(this.executionState==="PAUSED_BY_USER")throw new Error("Cannot pause trajectory: robot is already paused");const t={message_type:"PauseMovementRequest"};this.socket.sendJson(t),await this.waitUntilStopped(),m.runInAction(()=>{this.trajectoryState=this.plannedTrajectory?"planned":"idle"})}async stopAndReset(){try{if(this.executionState==="RUNNING"||this.trajectoryState==="moving"){const t={message_type:"PauseMovementRequest"};this.socket.sendJson(t),await this.waitUntilStopped()}}catch(t){this.logger.warn("Failed to stop trajectory execution cleanly",t)}finally{this.reset(),this.closeSocket(),this.socket=this.openSocket()}}reset(){this.plannedTrajectory=null,this.trajectoryState="idle"}clearError(){this.lastError=null}dispose(){for(const t of this.disposers)t();this.closeSocket()}async ensureMovementOwnership(){if(this.options.ensureMovementOwnership){await this.options.ensureMovementOwnership();return}this.jogger.mode!=="trajectory"&&(await this.joggingStore.deactivate(),await this.jogger.setJoggingMode("trajectory"))}async waitUntilStopped(){await m.when(()=>this.motionStream.rapidlyChangingMotionState.standstill)}handleMessage(t){var i,n;const e=(i=_.tryParseJson(t.data))==null?void 0:i.result;if(e)switch(e.kind){case"INITIALIZE_RECEIVED":e.add_trajectory_error||e.message?(this.lastError=((n=e.add_trajectory_error)==null?void 0:n.message)??e.message??"NOVA refused the trajectory",this.reset()):this.trajectoryState="planned";break;case"START_RECEIVED":this.trajectoryState="moving";break;case"PAUSE_RECEIVED":this.trajectoryState==="moving"&&(this.trajectoryState="stopping");break;case"MOTION_ERROR":this.lastError=e.message,this.reset();break}}openSocket(){const t=this.jogger.nova.openReconnectingWebsocket(`/cells/${this.jogger.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);return t.addEventListener("message",this.handleMessage),t}closeSocket(){this.socket.removeEventListener("message",this.handleMessage),this.socket.dispose()}}class _t extends Error{constructor(t,e,i){super(t),this.url=e,this.cause=i,this.name="RobotModeChangeError"}}class de{constructor(t,e,i,n,r){this.nova=t,this.ids=e,this.live=i,this.safety=n,this.logger=r,this.state="inactive",this.disposers=[],i.controllerState.mode==="MODE_CONTROL"&&(this.state="active"),m.makeAutoObservable(this,{nova:!1,ids:!1,live:!1,safety:!1,logger:!1,disposers:!1},{autoBind:!0}),this.disposers.push(m.reaction(()=>this.live.controllerState.mode,s=>{this.state=s==="MODE_CONTROL"?"active":"inactive"})),this.disposers.push(m.reaction(()=>this.live.connectionQuality,s=>{s==="critical"&&(this.state="inactive")}))}async activate(){if(this.state!=="inactive"){this.logger.warn("Tried to activate while already activating");return}const t=this.safety().activationBlockedReason;if(t){this.logger.warn(`Not enabling control mode for controller "${this.ids.controllerId}" because ${t}`);return}this.state="activating";try{await this.setMode("ROBOT_SYSTEM_MODE_CONTROL"),m.runInAction(()=>{this.live.controllerState.mode==="MODE_CONTROL"&&(this.state="active")})}catch(e){throw m.runInAction(()=>{this.state="inactive"}),e}}async deactivate(){if(this.state!=="active"){this.logger.warn("Tried to deactivate while already deactivating");return}this.state="deactivating";try{await this.setMode("ROBOT_SYSTEM_MODE_MONITOR"),m.runInAction(()=>{this.live.controllerState.mode!=="MODE_CONTROL"&&(this.state="inactive")})}catch(t){throw m.runInAction(()=>{this.state="active"}),t}}async toggle(){this.state==="inactive"?await this.activate():this.state==="active"&&await this.deactivate()}dispose(){for(const t of this.disposers)t()}async setMode(t){const{cellId:e,controllerId:i}=this.ids;try{await this.nova.api.controller.setDefaultMode(e,i,t)}catch(n){const r=(typeof n=="object"&&n!==null&&"url"in n&&typeof n.url=="string"?n.url:void 0)??`/cells/${e}/controllers/${i}/mode`;throw new _t(`Failed to set controller "${i}" to ${t}: ${_.makeErrorMessage(n)}`,r,n)}}}const Vo={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class ge{constructor(t,e,i,n,r){this.motionGroupDescription=t,this.controllerConfiguration=e,this.kinematicModel=i,this.resolvedMotionGroupModel=n,this.coordinateSystems=r,this.dhParameters=(t.dh_parameters??[]).map(s=>({...Vo,...s}))}get isVirtual(){return this.controllerConfiguration.kind==="VirtualController"}get motionGroupModel(){return this.motionGroupDescription.motion_group_model}get serialNumber(){return this.motionGroupDescription.serial_number}get inverseSolver(){return this.kinematicModel.inverse_solver}get jointType(){var t,e;return((e=(t=this.motionGroupDescription.dh_parameters)==null?void 0:t[0])==null?void 0:e.type)??N.JointTypeEnum.RevoluteJoint}get jointLimits(){var t;return((t=this.motionGroupDescription.operation_limits.auto_limits)==null?void 0:t.joints)??[]}get safetyZones(){return this.motionGroupDescription.safety_zones}get safetyLinkColliders(){return this.motionGroupDescription.safety_link_colliders}get safetyToolColliders(){return this.motionGroupDescription.safety_tool_colliders}get kinematicChainOffset(){return this.kinematicModel.kinematic_chain_offset??this.motionGroupDescription.kinematic_chain_offset??null}get flangeOffset(){return this.kinematicModel.flange_offset??this.motionGroupDescription.flange_offset??null}get mounting(){return this.motionGroupDescription.mounting??null}get tcps(){return Object.entries(this.motionGroupDescription.tcps??{}).map(([t,e])=>({id:t,name:e.name}))}get tcpOffsetsById(){return this.motionGroupDescription.tcps??{}}}const Pt=o=>Array.isArray(o)&&o.length===3&&o.every(t=>typeof t=="number"),Fo=.001,Bo=.5,Go=.01,ct=(o,t,e)=>!!(o&&t&&tt([...o],[...t],e));class ue{constructor(t,e,i){this.stream=t,this.description=e,this.jogging=i,m.makeAutoObservable(this,{stream:!1,description:!1,jogging:!1},{autoBind:!0})}get controllerState(){return this.stream.controllerState}get rapidlyChangingMotionState(){return this.stream.rapidlyChangingMotionState}get readoutState(){return this.stream.readoutState}get jointPose(){return this.stream.readoutState.joint_position}get connectionQuality(){return this.stream.connectionQuality}get lastValidStateMessage(){return this.stream.lastValidStateMessage}get lastInvalidStateMessage(){return this.stream.lastInvalidStateMessage}get measuredTcpPoseReference(){return this.tcpPoseReferenceOf(this.rapidlyChangingMotionState)}get displayedTcpPoseReference(){return this.inSelectedFrame(this.measuredTcpPoseReference)}get displayedTcpPose(){return this.inSelectedFrame(this.tcpPoseReferenceOf(this.readoutState)).pose}isAt(t){if(t.type==="joint")return ct(t.joints,this.rapidlyChangingMotionState.joint_position,Fo);try{const e=ut({inputPose:this.measuredTcpPoseReference,selectedTcpId:t.tcpPose.tcpId,selectedCoordinateSystemId:t.tcpPose.coordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems});return ct(t.tcpPose.pose.position,e.pose.position,Bo)&&ct(t.tcpPose.pose.orientation,e.pose.orientation,Go)}catch{return!1}}nextMotionState(){return this.stream.nextMotionState()}async waitUntilStopped(){let t=await this.stream.nextMotionState(),e=await this.stream.nextMotionState();for(;!tt(t.joint_position,e.joint_position,bt);)t=e,e=await this.stream.nextMotionState()}tcpPoseReferenceOf(t){var n,r;const e=(n=t.tcp_pose)==null?void 0:n.position,i=(r=t.tcp_pose)==null?void 0:r.orientation;if(!e||!Pt(e))throw new Error(`Invalid current TCP pose position for motion group ${this.stream.motionGroupId}`);if(!i||!Pt(i))throw new Error(`Invalid current TCP pose orientation for motion group ${this.stream.motionGroupId}`);return{pose:{position:e,orientation:i},tcpId:t.tcp??"",coordinateSystemId:t.coordinate_system??"world"}}inSelectedFrame(t){return ut({inputPose:t,selectedTcpId:this.jogging.selectedTcpId,selectedCoordinateSystemId:this.jogging.selectedCoordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems})}}const qo=["SAFETY_STATE_ROBOT_EMERGENCY_STOP","SAFETY_STATE_DEVICE_EMERGENCY_STOP"],Uo=["SAFETY_STATE_NORMAL","SAFETY_STATE_REDUCED"],zo=["SAFETY_STATE_STOP","SAFETY_STATE_STOP_0","SAFETY_STATE_STOP_1","SAFETY_STATE_STOP_2"],Wo=["OPERATION_MODE_AUTO","OPERATION_MODE_MANUAL","OPERATION_MODE_MANUAL_T1","OPERATION_MODE_MANUAL_T2"];class he{constructor(t,e){this.state=t,this.activationState=e,m.makeAutoObservable(this,{state:!1,activationState:!1},{autoBind:!0})}get safetyState(){return this.state.controllerState.safety_state}get operationMode(){return this.state.controllerState.operation_mode}get isEstopActive(){return qo.includes(this.safetyState)}get isMoveableSafetyState(){return Uo.includes(this.safetyState)}get isMoveableOperationMode(){return Wo.includes(this.operationMode)}get isActivatableSafetyState(){return this.isMoveableSafetyState||zo.includes(this.safetyState)}get activationBlockedReason(){return this.isEstopActive?`an emergency stop is active (${this.safetyState})`:this.isActivatableSafetyState?this.isMoveableOperationMode?null:`the operation mode is ${this.operationMode}`:`the safety state is ${this.safetyState}`}get canBeActive(){return this.activationBlockedReason===null}get notMoveableReason(){return this.state.connectionQuality==="critical"?{code:"disconnected"}:this.isMoveableSafetyState?this.isMoveableOperationMode?this.activationState()==="inactive"?{code:"deactivated"}:null:{code:"operation_mode",value:this.operationMode}:{code:"safety_state",value:this.safetyState}}get canBeMoved(){return this.isMoveableSafetyState&&this.isMoveableOperationMode&&this.activationState()==="active"&&this.state.connectionQuality!=="critical"}}function pe(o){return o.type==="joint"?{type:"joint",joints:o.joints}:{type:"cartesian",pose:o.tcpPose.pose,coordinateSystemId:o.tcpPose.coordSystemId}}class me{constructor(t,e){this.robot=t,this.logger=e,this.editing=!1,this.draft="",this.confirming=!1,this.staged=null,this.moveStarted=!1,this.disposers=[],m.makeAutoObservable(this,{robot:!1,logger:!1,disposers:!1,onBeforePlan:!1},{autoBind:!0}),this.disposers.push(m.reaction(()=>this.robot.jogging.selectedTabId,()=>{(this.editing||this.staged)&&this.resetToLive()})),this.disposers.push(m.reaction(()=>({trajectoryState:this.robot.trajectory.trajectoryState,executionState:this.robot.trajectory.executionState,isRobotAtStagedPose:this.isRobotAtStagedPose}),({trajectoryState:i,executionState:n,isRobotAtStagedPose:r})=>{if(!this.stagedPose)return;if(i==="moving"){this.moveStarted=!0;return}(n==="END_OF_TRAJECTORY"||this.moveStarted&&r&&i!=="stopping")&&this.resetToLive()}))}dispose(){for(const t of this.disposers)t()}get phase(){return this.editing?"editing":this.staged?this.staged.errorKey?"error":"staged":"view"}get isJointTab(){return this.robot.jogging.selectedTabId==="joint"}get liveDisplayString(){return this.isJointTab?U.jointsToText(this.robot.state.jointPose):U.poseToText(this.robot.state.displayedTcpPose)}get displayString(){var t;return((t=this.staged)==null?void 0:t.displayString)??this.liveDisplayString}get parsedDraft(){const{state:t,motionGroupId:e}=this.robot;if(this.isJointTab){const r=U.parseJointsText(this.draft,t.jointPose.length);return r?{type:"joint",motionGroupId:e,joints:r}:null}const i=U.parsePoseText(this.draft);if(!i)return null;const n=t.displayedTcpPoseReference;return{type:"cartesian",motionGroupId:e,tcpPose:{pose:{position:i.position,orientation:i.orientation},coordSystemId:n.coordinateSystemId,tcpId:n.tcpId}}}get draftValid(){return this.parsedDraft!==null}beginEdit(){this.draft=this.displayString,this.editing=!0}setDraft(t){this.draft=t}cancelEdit(){this.editing=!1,this.draft=""}async confirmEdit(){var i;const t=this.parsedDraft;if(!t||this.confirming||this.robot.notMoveableReason())return;const e=t.type==="joint"?U.jointsToText(t.joints):U.poseToText(t.tcpPose.pose);this.confirming=!0;try{await((i=this.onBeforePlan)==null?void 0:i.call(this));const n=await this.robot.trajectory.planTrajectory(pe(t));m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:n.ok?null:re(n.errorFeedbackName)},this.editing=!1,this.draft=""})}catch(n){this.logger.warn("Failed to plan trajectory to typed pose",n),m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:"Jogging.TargetPose.Error.PlanningFailed.lb"},this.editing=!1,this.draft=""})}finally{m.runInAction(()=>{this.confirming=!1})}}async resetToLive(){const t=this.staged!==null&&!this.staged.errorKey;this.staged=null,this.moveStarted=!1,this.editing=!1,this.draft="",t&&await this.robot.trajectory.stopAndReset()}clear(){this.editing=!1,this.staged=null}get stagedPose(){return!this.staged||this.staged.errorKey?null:this.staged.pose}get isRobotAtStagedPose(){return this.stagedPose?this.robot.state.isAt(this.stagedPose):!1}}const Ho={getItem:()=>null,setItem:()=>{}};class fe{constructor(t,e,i,n={}){const r=n.logger??console;this.onError=n.onError??(()=>{}),this.nova=t,this.motionGroupId=e.motionGroupId,this.controllerId=e.controllerId,this.cellId=e.cellId,this.stateSource=i.stateSource,this.motionStateSocket=i.motionStateSocket;const s=new et(t,i.controllerState,i.motionGroupState,i.motionGroupDescription,i.initialMotionState,i.motionStateSocket,e.cellId,{logger:r}),a=new ot(s,{cellId:e.cellId,motionGroupModel:i.motionGroupModelName,logger:r,onError:u=>this.onError({kind:"jog",message:_.makeErrorMessage(u),url:a.motionStream.motionStateSocket.url,cause:u})});this.jogging=Y.create(a,{coordinateSystems:i.coordinateSystems,description:i.motionGroupDescription,kinematicModel:i.kinematicModel},{storage:n.storage??Ho}),this.description=new ge(i.motionGroupDescription,i.controllerConfiguration,i.kinematicModel,i.motionGroupModelName,this.jogging.coordSystems);const g=new ie(i.stateSource,e.motionGroupId,i.initialControllerState,{isVirtual:this.description.isVirtual,onError:u=>this.onError({kind:"stream",...u})});this.state=new ue(g,this.description,this.jogging),this.activation=new de(t,e,this.state,()=>this.safety,r),this.safety=new he(this.state,()=>this.activation.state),this.trajectory=new le({joggingStore:this.jogging,isLocked:n.isLocked,ensureMovementOwnership:()=>this.ensureMovementOwnership("trajectory"),logger:r}),this.targetPose=new me({motionGroupId:e.motionGroupId,state:this.state,jogging:this.jogging,trajectory:this.trajectory,notMoveableReason:()=>{var u;return this.safety.notMoveableReason??((u=n.isLocked)!=null&&u.call(n)?{code:"locked"}:null)}},r),this.jogging.onBeforeActivate=async()=>{this.targetPose.staged&&await this.targetPose.resetToLive()},n.autoActivateVirtual&&this.description.isVirtual&&this.activation.state==="inactive"&&this.activation.activate().catch(u=>{this.onError({kind:"mode",message:_.makeErrorMessage(u),url:u instanceof _t?u.url:void 0,cause:u})})}get movementOwner(){return this.jogging.jogger.mode}async ensureMovementOwnership(t){this.movementOwner!==t&&(await this.jogging.deactivate(),await this.jogging.jogger.setJoggingMode(t))}dispose(){this.activation.dispose(),this.targetPose.dispose(),this.state.stream.dispose(),this.trajectory.dispose(),this.stateSource.close(),this.jogging.dispose(),this.motionStateSocket.dispose()}}const Yo=[1e3,2e3],Ko=o=>new Promise(t=>setTimeout(t,o));class ye{constructor(t,e,i,n){this.nova=t,this.motionGroupId=e,this.ids=i,this.options=n,this.state="loading",this.session=null,this.error=null,this.attempt=0,this.disposed=!1,this.progress=new ce(e,i.controllerId),m.makeAutoObservable(this,{nova:!1,ids:!1,options:!1,attempt:!1,disposed:!1,readyPromise:!1,settle:!1,progress:!1},{autoBind:!0}),this.start()}get ready(){return this.readyPromise}retry(){this.disposed||this.state!=="failed"||this.start()}dispose(){var t;this.disposed||(this.disposed=!0,this.attempt++,(t=this.session)==null||t.dispose(),this.session=null,this.settle.reject(new Error("The robot session load was disposed")))}start(){this.attempt++;const t=this.attempt;this.readyPromise=new Promise((e,i)=>{this.settle={resolve:e,reject:i}}),this.readyPromise.catch(()=>{}),m.runInAction(()=>{this.state="loading",this.error=null}),this.run(t)}isStale(t){return this.disposed||t!==this.attempt}async run(t){var a,g;const{cellId:e,controllerId:i}=this.ids,n=this.options.retryDelaysMs??Yo,r=this.options.logger??console,s=this.options.stateSource??(u=>ne(this.nova,u));for(let u=0;;u++)try{const d=await No({nova:this.nova,cellId:e,controllerId:i,motionGroupId:this.motionGroupId,progress:this.progress,createStateSource:s,isStale:()=>this.isStale(t),socketTimeoutMs:this.options.socketTimeoutMs});if(!d)return;if(this.isStale(t)){d.dispose();return}let p;try{p=new fe(this.nova,{cellId:e,controllerId:i,motionGroupId:this.motionGroupId},d,this.options)}catch(h){throw d.dispose(),h}if(this.isStale(t)){p.dispose();return}m.runInAction(()=>{this.session=p,this.state="ready"}),this.settle.resolve(p);return}catch(d){if(this.isStale(t))return;const p=rt(d)?n[u]:void 0;if(p===void 0){m.runInAction(()=>{rt(d)?this.progress.failStep(d.stepId,d.cause):this.progress.failWith(d),this.state="failed",this.error=d}),(g=(a=this.options).onEvent)==null||g.call(a,{type:"loadFailed",motionGroupId:this.motionGroupId,step:rt(d)?d.stepId:"unknown",message:_.makeErrorMessage(d),attempts:u+1}),this.settle.reject(d);return}if(r.warn(`Retrying load of robot "${this.motionGroupId}" after: ${_.makeErrorMessage(d)}`),m.runInAction(()=>{this.progress.beginRetry(u+1)}),await Ko(p),this.isStale(t))return}}}function Qo(o,t,e={}){return Zo(j.createNovaClient(o),t,{...e,cellId:e.cellId??j.cellIdOf(o)})}function Zo(o,t,e={}){const i=e.cellId??"cell",n=e.controllerId??t.split("@")[1]??"";return new ye(o,t,{cellId:i,controllerId:n},e)}exports.AppHeader=We;exports.ConnectedMotionGroup=at;exports.ControllerStateStream=ie;exports.JoggerConnection=ot;exports.JoggingCartesianAxisControl=dt;exports.JoggingJointValueControl=Gt;exports.JoggingPanel=To;exports.JoggingStore=Y;exports.LoadingCover=zt;exports.LoadingErrorMessage=Wt;exports.MOTION_DELTA_THRESHOLD=bt;exports.MotionStreamConnection=et;exports.NoMotionGroupModal=Oo;exports.ROBOT_LOAD_STEP_IDS=ae;exports.RobotActivation=de;exports.RobotDescription=ge;exports.RobotLiveState=ue;exports.RobotLoadProgress=ce;exports.RobotLoadStepError=xt;exports.RobotModeChangeError=_t;exports.RobotSafety=he;exports.RobotSession=fe;exports.RobotSessionLoad=ye;exports.RobotTargetPose=me;exports.TrajectoryExecutionStore=le;exports.VelocitySlider=te;exports.VelocitySliderLabel=jt;exports.controllerStateWebsocket=ne;exports.deriveSelectedTcpPose=ut;exports.isRobotLoadStepError=rt;exports.jointValuesEqual=tt;exports.jointValuesUnchanged=mt;exports.loadRobotSession=Qo;exports.planErrorTranslationKey=re;exports.poseEqual=Ut;exports.readoutOf=St;exports.readoutsEqual=vt;exports.resolveCoordinateSystemInWorld=Qt;exports.tcpMotionEqual=ft;exports.trajectoryTargetOf=pe;exports.transformPoseToCoordinateSystem=Z;exports.unwrapRotationVector=yt;