@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.4e5a9e6 → 6.4.0-pr.revamp.667.4ee5f82

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 (203) hide show
  1. package/README.md +207 -40
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +10 -3
  4. package/dist/3d.js +41 -31
  5. package/dist/CurrentPose/index.cjs +1 -1
  6. package/dist/CurrentPose/index.js +2 -2
  7. package/dist/CurrentPoseBar/index.cjs +1 -1
  8. package/dist/CurrentPoseBar/index.js +1 -1
  9. package/dist/JoggingButtons/index.cjs +1 -1
  10. package/dist/JoggingButtons/index.js +1 -1
  11. package/dist/JoggingGizmo/index.cjs +1 -1
  12. package/dist/JoggingGizmo/index.d.ts +1 -0
  13. package/dist/JoggingGizmo/index.js +2 -2
  14. package/dist/JoggingJointSlider/index.cjs +1 -1
  15. package/dist/JoggingJointSlider/index.js +1 -1
  16. package/dist/RobotControl/index.cjs +1 -1
  17. package/dist/RobotControl/index.js +2 -2
  18. package/dist/RobotControlPanel/index.cjs +1 -1
  19. package/dist/RobotControlPanel/index.d.ts +1 -1
  20. package/dist/RobotControlPanel/index.js +1 -1
  21. package/dist/RobotHeader/index.cjs +1 -1
  22. package/dist/RobotHeader/index.d.ts +2 -0
  23. package/dist/RobotHeader/index.js +6 -4
  24. package/dist/RobotScene/index.cjs +1 -0
  25. package/dist/RobotScene/index.d.ts +5 -0
  26. package/dist/RobotScene/index.js +11 -0
  27. package/dist/RobotView/index.cjs +1 -0
  28. package/dist/RobotView/index.d.ts +4 -0
  29. package/dist/RobotView/index.js +9 -0
  30. package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
  31. package/dist/SafetyBar/index.cjs +1 -1
  32. package/dist/SafetyBar/index.js +1 -1
  33. package/dist/chunks/ConnectedMotionGroup-770Xppk7.cjs +3 -0
  34. package/dist/chunks/ConnectedMotionGroup-CjhZTmlT.js +1822 -0
  35. package/dist/chunks/CurrentPose-DxeimMeU.cjs +1 -0
  36. package/dist/chunks/{CurrentPose-DYKoKD2D.js → CurrentPose-jTdJrjYe.js} +13 -12
  37. package/dist/chunks/{CurrentPoseBar-Cb_Pk2jp.js → CurrentPoseBar--HkZBGnN.js} +17 -16
  38. package/dist/chunks/CurrentPoseBar-DoOUfRRs.cjs +1 -0
  39. package/dist/chunks/{JoggingButtons-DluWqNuO.js → JoggingButtons-BNOnpcTH.js} +2 -2
  40. package/dist/chunks/{JoggingButtons-DC0jII72.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
  41. package/dist/chunks/JoggingGizmo-CNFjpWDv.cjs +1 -0
  42. package/dist/chunks/JoggingGizmo-RDiEVQes.js +847 -0
  43. package/dist/chunks/{JoggingGizmoOrientation-Bba8HLQJ.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
  44. package/dist/chunks/{JoggingGizmoOrientation-l2slmUE_.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
  45. package/dist/chunks/JoggingJointSlider-BY-Tof8G.js +378 -0
  46. package/dist/chunks/JoggingJointSlider-Dm3vILd3.cjs +1 -0
  47. package/dist/chunks/JoggingRefusedError-C4D8_YR_.js +38 -0
  48. package/dist/chunks/JoggingRefusedError-DqyrfUcc.cjs +1 -0
  49. package/dist/chunks/Pose3-BfBNPRDM.cjs +1 -0
  50. package/dist/chunks/{Pose3-B_fLR-Wv.js → Pose3-DWxfC6Dj.js} +1 -2
  51. package/dist/chunks/PoseTransformer-2QIzECOZ.cjs +1 -0
  52. package/dist/chunks/PoseTransformer-CmuoS76S.js +364 -0
  53. package/dist/chunks/Robot-BI3OpLBC.cjs +1 -0
  54. package/dist/chunks/Robot-DzVgWIyl.js +428 -0
  55. package/dist/chunks/RobotActivation-BaPImZRq.cjs +1 -0
  56. package/dist/chunks/RobotActivation-CXUp6Szs.js +131 -0
  57. package/dist/chunks/RobotControl-Do-oagek.cjs +1 -0
  58. package/dist/chunks/RobotControl-Un5D1r8T.js +318 -0
  59. package/dist/chunks/RobotControlPanel-BJ80O4ER.cjs +1 -0
  60. package/dist/chunks/RobotControlPanel-CxTEIelh.js +1019 -0
  61. package/dist/chunks/RobotScene-C1DNfxXU.js +1246 -0
  62. package/dist/chunks/RobotScene-hUDf_S6f.cjs +1 -0
  63. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +1 -0
  64. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +25 -0
  65. package/dist/chunks/RobotView-Cx_eOS9N.js +158 -0
  66. package/dist/chunks/RobotView-KFlt_Isi.cjs +1 -0
  67. package/dist/chunks/coordSystemLabel-BThpFG9n.cjs +1 -0
  68. package/dist/chunks/coordSystemLabel-Bfy9MUsV.js +6 -0
  69. package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
  70. package/dist/chunks/{externalizeComponent-CSzPVfuG.js → externalizeComponent-CChY_1bN.js} +66 -14
  71. package/dist/chunks/holdSafety-Cbej6-Kc.js +62 -0
  72. package/dist/chunks/holdSafety-TeMXlYQe.cjs +1 -0
  73. package/dist/chunks/joggingColors-Cqpfuw4G.cjs +1 -0
  74. package/dist/chunks/joggingColors-sb6IFdj2.js +133 -0
  75. package/dist/chunks/json-3cqBD7UQ.js +18 -0
  76. package/dist/chunks/json-Bd6uGfgP.cjs +1 -0
  77. package/dist/chunks/loadRobotSession-BRuiCc0r.cjs +1 -0
  78. package/dist/chunks/loadRobotSession-IuZ-zs8x.js +3055 -0
  79. package/dist/chunks/poseText-BxG4Caa-.js +48 -0
  80. package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
  81. package/dist/chunks/robotActivationOf-BsFcsAdF.cjs +1 -0
  82. package/dist/chunks/robotActivationOf-SqnXGdFY.js +368 -0
  83. package/dist/chunks/robotSafetyOf-Cbp35lO-.cjs +1 -0
  84. package/dist/chunks/{robotSafetyOf-Dr5Q4rCp.js → robotSafetyOf-kNLaX0_5.js} +255 -228
  85. package/dist/chunks/useEveryFrame-D04ygIe7.js +116 -0
  86. package/dist/chunks/useEveryFrame-NeKiPXY-.cjs +1 -0
  87. package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +1 -0
  88. package/dist/chunks/{useSmoothedMotionState-COMJRcOt.js → useSmoothedMotionState-BSSV8aZN.js} +74 -86
  89. package/dist/chunks/useWebGLRenderer-BozrbZz-.js +45 -0
  90. package/dist/chunks/useWebGLRenderer-CtddVDDb.cjs +1 -0
  91. package/dist/components/VelocitySlider.d.ts +14 -1
  92. package/dist/components/connectionWarning/ConnectionWarning.d.ts +21 -0
  93. package/dist/components/connectionWarning/connectionWarningOf.d.ts +18 -0
  94. package/dist/components/connectionWarning/timeAgo.d.ts +5 -0
  95. package/dist/components/jogging/JoggingButtons.d.ts +3 -1
  96. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
  97. package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
  98. package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
  99. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  100. package/dist/components/jogging/JoggingPanel.d.ts +11 -0
  101. package/dist/components/jogging/JoggingRefusedError.d.ts +24 -0
  102. package/dist/components/jogging/JoggingStore.d.ts +229 -12
  103. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +14 -4
  104. package/dist/components/jogging/gizmo/RotationHandles.d.ts +3 -3
  105. package/dist/components/jogging/gizmo/gizmoShared.d.ts +19 -9
  106. package/dist/components/jogging/holdSafety.d.ts +51 -13
  107. package/dist/components/jogging/joggingColors.d.ts +6 -0
  108. package/dist/components/jogging/joint/JoggingJointSlider.d.ts +9 -5
  109. package/dist/components/jogging/joint/useJointJogHold.d.ts +10 -15
  110. package/dist/components/jogging/useHold.d.ts +17 -13
  111. package/dist/components/jogging/useJogControls.d.ts +2 -3
  112. package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
  113. package/dist/components/robotControl/HoldToMoveButton.d.ts +8 -7
  114. package/dist/components/robotControl/JogArea.d.ts +10 -4
  115. package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
  116. package/dist/components/robotControl/JointJogTab.d.ts +10 -2
  117. package/dist/components/robotControl/MoveToTab.d.ts +22 -4
  118. package/dist/components/robotControl/PoseField.d.ts +3 -1
  119. package/dist/components/robotControl/RobotControl.d.ts +3 -0
  120. package/dist/components/robotControl/RobotControlPanel.d.ts +84 -22
  121. package/dist/components/robotControl/VelocityRow.d.ts +8 -2
  122. package/dist/components/robotControl/atPose.d.ts +6 -0
  123. package/dist/components/robotControl/poseText.d.ts +13 -1
  124. package/dist/components/robotControl/units.d.ts +10 -2
  125. package/dist/components/robotControl/useRobotControlProps.d.ts +11 -2
  126. package/dist/components/robotControl/velocityText.d.ts +18 -0
  127. package/dist/components/robotHeader/robotActivationOf.d.ts +5 -0
  128. package/dist/components/robotHeader/robotSafetyOf.d.ts +8 -1
  129. package/dist/components/robotScene/JoggingAxes.d.ts +38 -0
  130. package/dist/components/robotScene/RobotScene.d.ts +28 -0
  131. package/dist/components/robotScene/RobotSceneView.d.ts +53 -0
  132. package/dist/components/robotScene/useRobotSceneProps.d.ts +18 -0
  133. package/dist/components/robotView/RobotCanvas.d.ts +42 -0
  134. package/dist/components/robotView/RobotView.d.ts +23 -0
  135. package/dist/components/robotView/WebGLUnavailable.d.ts +5 -0
  136. package/dist/components/robots/DHRobot.d.ts +1 -1
  137. package/dist/components/robots/GenericRobot.d.ts +16 -1
  138. package/dist/components/robots/LinearAxisAnimator.d.ts +1 -1
  139. package/dist/components/robots/SupportedLinearAxis.d.ts +16 -3
  140. package/dist/components/robots/SupportedRobot.d.ts +21 -3
  141. package/dist/components/robots/ghostStyle.d.ts +21 -0
  142. package/dist/components/robots/modelRotation.d.ts +14 -0
  143. package/dist/components/robots/robotModelLogic.d.ts +138 -6
  144. package/dist/components/robots/robotModelSource.d.ts +14 -1
  145. package/dist/components/utils/converters.d.ts +0 -2
  146. package/dist/components/utils/json.d.ts +4 -0
  147. package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
  148. package/dist/components/utils/webglSupport.d.ts +11 -0
  149. package/dist/core.cjs +1 -1
  150. package/dist/core.d.ts +8 -5
  151. package/dist/core.js +70 -70
  152. package/dist/index.cjs +1 -1
  153. package/dist/index.js +110 -100
  154. package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
  155. package/dist/lib/ControllerStateStream.d.ts +3 -8
  156. package/dist/lib/JoggerConnection.d.ts +32 -13
  157. package/dist/lib/MotionStreamConnection.d.ts +3 -2
  158. package/dist/lib/TrajectoryExecutionStore.d.ts +103 -10
  159. package/dist/lib/controllerStateSource.d.ts +6 -5
  160. package/dist/lib/incrementalCartesianMotion.d.ts +2 -2
  161. package/dist/lib/poseMath.d.ts +51 -0
  162. package/dist/lib/robotSession/RobotActivation.d.ts +43 -12
  163. package/dist/lib/robotSession/RobotLiveState.d.ts +13 -4
  164. package/dist/lib/robotSession/RobotSession.d.ts +28 -2
  165. package/dist/lib/robotSession/RobotTargetPose.d.ts +44 -8
  166. package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
  167. package/dist/lib/robotSession/robotPose.d.ts +5 -0
  168. package/dist/nats.cjs +1 -1
  169. package/dist/nats.js +1 -1
  170. package/dist/session.cjs +1 -0
  171. package/dist/session.d.ts +22 -0
  172. package/dist/session.js +37 -0
  173. package/package.json +27 -1
  174. package/dist/chunks/CurrentPose-BIPvpQLG.cjs +0 -1
  175. package/dist/chunks/CurrentPoseBar-CAEEifBY.cjs +0 -1
  176. package/dist/chunks/JoggingGizmo-DT7iX5Ka.cjs +0 -1
  177. package/dist/chunks/JoggingGizmo-Hy42DAQU.js +0 -810
  178. package/dist/chunks/JoggingJointSlider-C0lI_9W5.cjs +0 -1
  179. package/dist/chunks/JoggingJointSlider-DePZ3JHW.js +0 -406
  180. package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
  181. package/dist/chunks/RobotControl-C1JzXIAa.js +0 -285
  182. package/dist/chunks/RobotControl-ku4CNQCb.cjs +0 -1
  183. package/dist/chunks/RobotControlPanel-B4u3D3yO.cjs +0 -1
  184. package/dist/chunks/RobotControlPanel-Cy5LwU1h.js +0 -827
  185. package/dist/chunks/converters-BsXgcxCW.cjs +0 -1
  186. package/dist/chunks/converters-D9KpJ2HD.js +0 -47
  187. package/dist/chunks/coordSystemLabel-BJKeaGA3.cjs +0 -1
  188. package/dist/chunks/coordSystemLabel-C1jfhEh5.js +0 -29
  189. package/dist/chunks/externalizeComponent-Bl23ayrr.cjs +0 -2
  190. package/dist/chunks/holdSafety-BtoZ5We3.cjs +0 -1
  191. package/dist/chunks/holdSafety-Di1GZAWg.js +0 -37
  192. package/dist/chunks/joggingColors-CuT5u0H8.js +0 -135
  193. package/dist/chunks/joggingColors-ZDc_2UCp.cjs +0 -1
  194. package/dist/chunks/loadRobotSession-DVkuHA-V.js +0 -4624
  195. package/dist/chunks/loadRobotSession-cQNeaBOf.cjs +0 -3
  196. package/dist/chunks/robotActivationOf-DUHukd46.js +0 -371
  197. package/dist/chunks/robotActivationOf-DeJsI4H5.cjs +0 -1
  198. package/dist/chunks/robotModelSource-C2Mi0LtR.js +0 -1296
  199. package/dist/chunks/robotModelSource-D7VR89r_.cjs +0 -1
  200. package/dist/chunks/robotSafetyOf-Cb4qlwd_.cjs +0 -1
  201. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +0 -1
  202. package/dist/chunks/useEveryFrame-DAuNawGP.js +0 -155
  203. package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";const i=require("react/jsx-runtime"),M=require("three"),k=require("three-stdlib"),S=require("@react-three/drei"),m=require("react"),P=require("./converters-BsXgcxCW.cjs"),E=require("@wandelbots/nova-js/v2"),T=require("./externalizeComponent-Bl23ayrr.cjs"),G=require("./useSmoothedMotionState-Con0E5Bx.cjs"),D=require("react-error-boundary"),Q=require("@react-three/fiber"),re=require("./Pose3-Ch4xVeXV.cjs");function ie(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const w=ie(M);function se(t){switch(t.shape_type){case"convex_hull":return new k.ConvexGeometry(t.vertices.map(e=>new w.Vector3(e[0]/1e3,e[1]/1e3,e[2]/1e3)));case"box":return new w.BoxGeometry(t.size_x/1e3,t.size_y/1e3,t.size_z/1e3);case"sphere":return new w.SphereGeometry(t.radius/1e3);case"capsule":return new w.CapsuleGeometry(t.radius/1e3,t.cylinder_height/1e3);case"cylinder":return new w.CylinderGeometry(t.radius/1e3,t.radius/1e3,t.height/1e3);case"rectangle":return new w.BoxGeometry(t.size_x/1e3,t.size_y/1e3,0);default:return console.warn(`${t.shape_type} is not supported`),new w.BufferGeometry}}function ae({name:t,collider:n,children:e}){var c,l;const r=((c=n.pose)==null?void 0:c.position)??[0,0,0],s=((l=n.pose)==null?void 0:l.orientation)??[0,0,0];return n.margin&&console.warn(`${t} margin is not supported`),i.jsx("mesh",{name:t,position:new w.Vector3(r[0],r[1],r[2]).divideScalar(1e3),rotation:new w.Euler(s[0],s[1],s[2],"XYZ"),geometry:se(n.shape),children:e})}function ce({name:t,colliders:n,meshChildrenProvider:e,...r}){return i.jsx("group",{name:t,...r,children:Object.entries(n).map(([s,c])=>i.jsx(ae,{name:s,collider:c,children:e(s,c)},s))})}function le({scene:t,meshChildrenProvider:n}){const e=t.colliders;return i.jsx("group",{children:e&&i.jsx(ce,{meshChildrenProvider:n,colliders:e})})}function ue(t){const n=(t==null?void 0:t.position)??[],e=(t==null?void 0:t.orientation)??[],r=new M.Vector3(e[0]??0,e[1]??0,e[2]??0),s=r.length(),c=s>0?new M.Quaternion().setFromAxisAngle(r.normalize(),s):new M.Quaternion;return new M.Matrix4().compose(new M.Vector3(n[0]??0,n[1]??0,n[2]??0).divideScalar(1e3),c,new M.Vector3(1,1,1))}function pe(t,n=null,e=[]){const r=ue(n);return t.map((s,c)=>{const l=r.clone(),o=(s.reverse_rotation_direction?-1:1)*(e[c]??0),a=s.type==="PRISMATIC_JOINT",p=(s.theta??0)+(a?0:o),f=(s.d??0)+(a?o:0);return r.multiply(new M.Matrix4().makeRotationZ(p)).multiply(new M.Matrix4().makeTranslation((s.a??0)/1e3,0,f/1e3)).multiply(new M.Matrix4().makeRotationX(s.alpha??0)),l})}const A="#ff4b4b",q="#2fa8ff",fe="#8a8d9e",me=96,he=.15,de=new w.Vector3(0,1,0),xe=.2,ge=2;function ye(t){const{lower_limit:n,upper_limit:e}=t??{};return typeof n!="number"||typeof e!="number"||!Number.isFinite(n)||!Number.isFinite(e)||!(n<e)?null:{lower_limit:n,upper_limit:e}}function C({base:t,direction:n,size:e,color:r,opacity:s}){const c=new w.Quaternion().setFromUnitVectors(de,n.clone().normalize()),l=t.clone().addScaledVector(n.clone().normalize(),e/2);return i.jsxs("mesh",{position:l,quaternion:c,renderOrder:10,children:[i.jsx("coneGeometry",{args:[e*.35,e,16]}),i.jsx("meshBasicMaterial",{color:r,depthTest:!1,transparent:!0,opacity:s})]})}function V({points:t,color:n,width:e,opacity:r}){return i.jsx(S.Line,{points:t,color:n,lineWidth:e,depthTest:!1,transparent:!0,opacity:r,renderOrder:10})}function J(t,n){const e=[...t];let r=n;for(;e.length>1;){const s=e[e.length-1],c=e[e.length-2],l=s.distanceTo(c);if(l>r)return e[e.length-1]=s.clone().lerp(c,r/l),e;r-=l,e.pop()}return e}function je(t,n,e,r){const s=e*t,c=e*n,l=Math.abs(c-s),o=Math.max(2,Math.ceil(l/(2*Math.PI)*me));return Array.from({length:o+1},(a,p)=>{const f=s+(c-s)*p/o,u=l*p/o/(2*Math.PI),j=r*(1+he*u);return new w.Vector3(Math.cos(f)*j,Math.sin(f)*j,0)})}function Me(t,n,e,r){const s=t.theta??0,c=t.d??0,l=t.type==="PRISMATIC_JOINT",o=t.reverse_rotation_direction?-1:1,{lower_limit:a,upper_limit:p}=n;return m.useMemo(()=>{const f=new w.Matrix4().makeRotationZ(s).multiply(new w.Matrix4().makeTranslation(0,0,l?c/1e3:0)),u=(b,_,v)=>new w.Vector3(b,_,v).applyMatrix4(f),j=new w.Vector3().applyMatrix4(f),g=u(0,0,e),d=(l?[u(e*.25,0,o*a/1e3),u(e*.25,0,o*p/1e3)]:je(a,p,o,e*.6)).map(b=>l?b:b.applyMatrix4(f)),h=u(l?e*.25:e*.6,0,0),R=d.slice(1).reduce((b,_,v)=>b+_.distanceTo(d[v]),0),x=Math.min(r,R/3),y=J(J(d,x).reverse(),x).reverse();return{axisPoints:[j,g],axisTip:g,origin:j,restPoints:[j,h],range:d,limitPoints:y,rangeStart:y[0],rangeEnd:y[y.length-1]}},[s,c,l,o,e,a,p,r])}function we({frame:t,dh:n,limit:e,size:r,emphasis:s}){const c=s==="highlighted"?ge:1,l=s==="dimmed"?xe:1,o=r*.2*(s==="highlighted"?1.4:1),a=2*c,{axisPoints:p,axisTip:f,origin:u,restPoints:j,range:g,limitPoints:d,rangeStart:h,rangeEnd:R}=Me(n,e,r,o),{position:x,quaternion:y}=m.useMemo(()=>{const b=new w.Vector3,_=new w.Quaternion;return t.decompose(b,_,new w.Vector3),{position:b,quaternion:_}},[t]);return i.jsxs("group",{position:x,quaternion:y,children:[i.jsx(V,{points:p,color:q,width:a,opacity:l}),i.jsx(C,{base:f,direction:f.clone().sub(u),size:o,color:q,opacity:l}),i.jsx(V,{points:j,color:fe,width:1.5*c,opacity:l}),i.jsx(V,{points:d,color:A,width:a,opacity:l}),i.jsx(C,{base:h,direction:g[0].clone().sub(h),size:h.distanceTo(g[0]),color:A,opacity:l}),i.jsx(C,{base:R,direction:g[g.length-1].clone().sub(R),size:R.distanceTo(g[g.length-1]),color:A,opacity:l})]})}function Re({dhParameters:t,chainOffset:n=null,limits:e,jointPositions:r,size:s=.15,highlightedJoint:c=null}){const l=m.useMemo(()=>pe(t,n,r),[t,n,r]);return i.jsx("group",{children:l.map((o,a)=>{const p=ye(e[a]);return p?i.jsx(we,{frame:o,dh:t[a],limit:p,size:s,emphasis:c===null?"normal":c===a?"highlighted":"dimmed"},a):null})})}function be(){return i.jsx(S.Environment,{frames:1,children:i.jsx(_e,{})})}const Se=[2,0,2,0,2,0,2,0];function _e({positions:t=Se}){return i.jsxs(i.Fragment,{children:[i.jsx(S.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),i.jsx("group",{rotation:[0,.5,0],children:i.jsx("group",{children:t.map((n,e)=>i.jsx(S.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,e*4],scale:[3,1,1]},e))})}),i.jsx(S.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),i.jsx(S.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),i.jsx(S.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),i.jsx(S.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),i.jsx(S.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const N={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function ve({safetyZones:t,dhParameters:n,...e}){const r=m.useMemo(()=>P.dhParametersToPlaneSize(n??[]),[n]),s=(l,o)=>{var j,g;if(!((j=o==null?void 0:o.pose)!=null&&j.position)||!((g=o==null?void 0:o.pose)!=null&&g.orientation))return null;const a=new w.Vector3(o.pose.position[0]/1e3,o.pose.position[1]/1e3,o.pose.position[2]/1e3),p=new w.Vector3(o.pose.orientation[0],o.pose.orientation[1],o.pose.orientation[2]);let f;const u=o.shape.shape_type==="plane"?{...N,side:w.DoubleSide}:{...N,side:w.FrontSide};switch(o.shape.shape_type){case"plane":f=i.jsx("planeGeometry",{args:[r,r]});break;case"sphere":{const d=(o==null?void 0:o.shape).radius/1e3;f=i.jsx("sphereGeometry",{args:[d]});break}case"capsule":{const d=(o==null?void 0:o.shape).radius/1e3,h=(o==null?void 0:o.shape).cylinder_height/1e3;f=i.jsx("capsuleGeometry",{args:[d,h]});break}case"convex_hull":{const d=(o==null?void 0:o.shape).vertices.map(R=>new w.Vector3(R[0]/1e3,R[1]/1e3,R[2]/1e3)),h=P.verticesToCoplanarity(d);if(h.isCoplanar&&h.normal){const x=new w.Vector3().addVectors(d[0],h.normal.multiplyScalar(1e-4));d.push(x)}try{f=i.jsx("primitive",{object:new k.ConvexGeometry(d),attach:"geometry"})}catch(R){return console.log("Error creating ConvexGeometry:",R),null}break}case"rectangular_capsule":{const d=o.shape,h=d.radius/1e3,R=d.sphere_center_distance_x/1e3,x=d.sphere_center_distance_y/1e3,y=h*2;f=i.jsx("primitive",{object:new k.RoundedBoxGeometry(R,x,y,2,h),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",o.shape.shape_type),f=null}return i.jsxs("mesh",{renderOrder:l,position:a,quaternion:P.orientationToQuaternion(p),children:[f,i.jsx("meshStandardMaterial",{...u,polygonOffsetFactor:-l})]},`safety-zone-${o.shape.shape_type}-${l}`)},c=m.useMemo(()=>Object.values(t??{}).map((l,o)=>s(o,l)),[t,r]);return i.jsx("group",{...e,children:c})}function Te({trajectory:t,...n}){const e=(t==null?void 0:t.map(r=>{if(r.position&&r.position.length>=3){const[s,c,l]=r.position;if(Number.isFinite(s)&&Number.isFinite(c)&&Number.isFinite(l))return new w.Vector3(s/1e3,l/1e3,-c/1e3)}return null}).filter(r=>r!==null))||[];return i.jsx("group",{...n,children:e.length>0&&i.jsx(S.Line,{points:e,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const O=new Map;async function L(t,n){const e=n||"";if(!e)throw new Error(`Cannot download the model "${t}": no NOVA instance. Give defaultGetModel the URL of the instance or a NOVA client, or give the component its instanceUrl or getModel.`);const r=`${Ge(e)} ${t}`,s=O.get(r);if(s)return s;const c=(async()=>{const l=G.createNovaClient(e);try{const o=await l.api.motionGroupModels.getMotionGroupGlbModel(t,{responseType:"blob"});return URL.createObjectURL(o)}catch(o){throw console.error("Failed to fetch model:",o),o}})();return O.set(r,c),c.catch(()=>{O.get(r)===c&&O.delete(r)}),c}function Ge(t){return typeof t=="string"?t:t.config.instanceUrl}function $(t){function n(e){return e.children.length===0?[e]:[e,...e.children.flatMap(r=>n(r))]}return n(t).filter(e=>W(e))}function U(t){return t.name.endsWith("_FLG")}function W(t){return/_J[0-9]+$/.test(t.name)}function Le(t,n){let e;function r(s){if(U(s)){if(e)throw Error(`Found multiple flange groups in robot model ${n}; first ${e.name} then ${s.name}. Only one _FLG group is allowed.`);e=s}W(s),s.children.map(r)}if(r(t.scene),!e)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:t}}const H=m.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,onTranslationChanged:c,children:l},o){const a=m.useRef(null),p=m.useRef([]),f=m.useRef(n.joint_position.filter(x=>x!==void 0)),{invalidate:u}=Q.useThree(),j=m.useRef(n);j.current=n;function g(x){a.current=x,x&&d()}function d(){a.current&&(p.current=$(a.current),h(),u())}m.useImperativeHandle(o,()=>({recollectJoints:d}));function h(){const x=f.current;if(c)c(p.current,x);else for(const[y,b]of p.current.entries()){const v=e[y].reverse_rotation_direction?-1:1;b.position.y=v*(x[y]||0)/1e3}}function R(x){f.current=x.joint_position.filter(y=>y!==void 0),h(),u()}return G.useAutorun(()=>{R(j.current)}),i.jsx("group",{ref:g,position:r,quaternion:s,children:l})});function B({rapidlyChangingMotionState:t,dhParameters:n,...e}){const r=new M.Matrix4,s=m.useRef(null),c=m.useRef(null);function l(p){const f=new M.Matrix4;for(let d=0;d<n.length;d++){const h=n[d],R=p[d]??0,x=new M.Matrix4().makeRotationY(h.theta).multiply(new M.Matrix4().makeTranslation(h.a/1e3,(h.d+R*(h.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new M.Matrix4().makeRotationX(h.alpha));f.multiply(x)}const u=new M.Vector3,j=new M.Quaternion,g=new M.Vector3;return f.decompose(u,j,g),u}const o=l(t.joint_position);function a(p,f){r.identity();let u=new M.Vector3;for(let h=0;h<n.length;h++){const R=f[h]??0,x=n[h],y=new M.Matrix4().makeRotationY(x.theta).multiply(new M.Matrix4().makeTranslation(x.a/1e3,(x.d+R*(x.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new M.Matrix4().makeRotationX(x.alpha));r.multiply(y)}const j=new M.Vector3,g=new M.Quaternion,d=new M.Vector3;if(r.decompose(j,g,d),u=j,s.current&&s.current.position.set(u.x,u.y,u.z),c.current){const h=c.current.geometry;h!=null&&h.setPositions&&h.setPositions([0,0,0,u.x,u.y,u.z])}}return i.jsx(H,{rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:a,children:i.jsxs("group",{...e,name:"Scene",children:[i.jsxs("mesh",{name:"Base",position:[0,0,0],children:[i.jsx("sphereGeometry",{args:[.02,32,32]}),i.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),i.jsx(S.Line,{ref:c,points:[new M.Vector3(0,0,0),o],color:"White",lineWidth:5}),i.jsxs("mesh",{ref:s,name:"TCP",position:o,children:[i.jsx("sphereGeometry",{args:[.025,32,32]}),i.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const Ee=console.warn;function X(){return m.useEffect(()=>{console.warn=t=>{t!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ee(t)}},[]),null}function Oe(t){return t.type==="Mesh"}function Pe({url:t,flangeRef:n,postModelRender:e,...r}){const s=S.useGLTF(t),l=Le(s,"robot.glb").gltf;m.useEffect(()=>{e==null||e()},[t,e]);function o(a){try{return Oe(a)?a.geometry?i.jsx("mesh",{name:a.name,geometry:a.geometry,material:a.material,position:a.position,rotation:a.rotation},a.uuid):i.jsx("group",{name:a.name,position:a.position,rotation:a.rotation},a.uuid):i.jsx("group",{name:a.name,position:a.position,rotation:a.rotation,ref:U(a)?n:void 0,children:a.children.map(o)},a.uuid)}catch(p){return console.warn("Error rendering node",a.name,p),null}}return i.jsx("group",{...r,dispose:null,children:o(l.scene)})}function Y({modelURL:t,flangeRef:n,postModelRender:e,...r}){const[s,c]=m.useState(null);return m.useEffect(()=>{let l=!1;return(async()=>{try{const a=typeof t=="string"?t:await t;l||c(p=>p===a?p:a)}catch(a){console.error("Failed to resolve model URL:",a)}})(),()=>{l=!0}},[t]),s?i.jsx(Pe,{url:s,flangeRef:n,postModelRender:e,...r}):null}const Z=(t,n)=>{t.userData.isGhost||(t.traverse(e=>{if(e instanceof w.Mesh){e.material instanceof w.Material&&(e.material.colorWrite=!1);const r=e.clone(),s=e.clone();r.material=new w.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:w.DoubleSide}),r.userData.isGhost=!0,s.material=new w.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:w.DoubleSide}),s.userData.isGhost=!0,e.parent&&(e.parent.add(r),e.parent.add(s))}}),t.userData.isGhost=!0)},K=t=>{if(!t.userData.isGhost)return;const n=[];t.traverse(e=>{var r;e instanceof w.Mesh&&((r=e.userData)!=null&&r.isGhost?n.push(e):e.material instanceof w.Material&&(e.material.colorWrite=!0))}),n.forEach(e=>{e.parent&&e.parent.remove(e)}),t.userData.isGhost=!1},I=T.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,getModel:c=L,flangeRef:l,postModelRender:o,transparentColor:a,instanceUrl:p,...f})=>{const[u,j]=m.useState(null),g=m.useRef(null),d=m.useCallback(y=>{j(y)},[]),h=m.useCallback(()=>{var y;(y=g.current)==null||y.recollectJoints(),o==null||o()},[o]);m.useEffect(()=>{u&&(a?Z(u,a):K(u))},[u,a]);const R=m.useMemo(()=>{const y=c(n,p);if(!y){const b=new Blob([],{type:"model/gltf-binary"}),_=new File([b],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(_))}return y},[n,p,c]),x=i.jsx(B,{rapidlyChangingMotionState:t,dhParameters:e,...f});return i.jsxs(D.ErrorBoundary,{fallback:x,onError:y=>{console.warn(y)},children:[i.jsx(m.Suspense,{fallback:x,children:i.jsx("group",{ref:d,children:i.jsx(H,{ref:g,rapidlyChangingMotionState:t,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,children:i.jsx(Y,{modelURL:R,postModelRender:h,flangeRef:l,...f})})})}),i.jsx(X,{})]})}),z=T.externalizeComponent(({rapidlyChangingMotionState:t,...n})=>{const e=G.useSmoothedMotionState(t);return i.jsx(I,{rapidlyChangingMotionState:e,...n})});function Ae({motionGroup:t,connectedMotionGroup:n,getModel:e,flangeRef:r,transparentColor:s,postModelRender:c,...l}){const o=t??n,a=o==null?void 0:o.nova,p=m.useCallback(g=>L(g,a),[a]),f=e??p;if(!(o!=null&&o.dhParameters))return null;const u=o.modelFromController||"";return u?i.jsx(z,{rapidlyChangingMotionState:o.rapidlyChangingMotionState,modelFromController:u,dhParameters:o.dhParameters,getModel:f,flangeRef:r,transparentColor:s,postModelRender:c,chainOffsetPosition:o.mountingPosition,chainOffsetQuaternion:o.mountingQuaternion,...l}):i.jsx(B,{rapidlyChangingMotionState:o.rapidlyChangingMotionState,dhParameters:o.dhParameters,chainOffsetPosition:o.mountingPosition,chainOffsetQuaternion:o.mountingQuaternion,...l})}const ee=m.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,onRotationChanged:c,children:l},o){const a=m.useRef(null),p=m.useRef([]),f=m.useRef(n.joint_position.filter(x=>x!==void 0)),{invalidate:u}=Q.useThree(),j=m.useRef(n);j.current=n;function g(x){a.current=x,x&&d()}function d(){a.current&&(p.current=$(a.current),h(),u())}m.useImperativeHandle(o,()=>({recollectJoints:d}));function h(){const x=f.current;if(c)c(p.current,x);else for(const[y,b]of p.current.entries()){const _=e[y],v=_.theta||0,oe=_.reverse_rotation_direction?-1:1;b.rotation.y=oe*(x[y]||0)+v}}function R(x){f.current=x.joint_position.filter(y=>y!==void 0),h(),u()}return G.useAutorun(()=>{R(j.current)}),m.useEffect(()=>{R(n)},[n]),i.jsx("group",{ref:g,position:r,quaternion:s,children:l})}),Ce="line",Ve="mesh";function ke({rapidlyChangingMotionState:t,dhParameters:n,...e}){const r=new M.Matrix4,s=m.useRef([]),c=m.useRef([]);m.useEffect(()=>{s.current=new Array(n.length).fill(null),c.current=new Array(n.length).fill(null)},[n.length]);function l(p,f){const u=new M.Vector3,j=new M.Quaternion,g=new M.Vector3;r.decompose(u,j,g);const d=u.clone(),h=new M.Matrix4().makeRotationY(p.theta+f*(p.reverse_rotation_direction?-1:1)).multiply(new M.Matrix4().makeTranslation(0,p.d/1e3,0)).multiply(new M.Matrix4().makeTranslation(p.a/1e3,0,0)).multiply(new M.Matrix4().makeRotationX(p.alpha));return r.multiply(h),r.decompose(u,j,g),{a:d,b:u}}function o(p,f,u,j){if(!n)return;const g=n[p];if(!g)return;const{a:d,b:h}=l(g,j);f.geometry.setPositions([d.toArray(),h.toArray()].flat()),u.position.set(h.x,h.y,h.z)}function a(p,f){r.identity();for(let u=0;u<Math.min(p.length,f.length);u++){const j=s.current[u],g=c.current[u];j&&g&&o(u,j,g,f[u])}}return i.jsx(ee,{rapidlyChangingMotionState:t,dhParameters:n,onRotationChanged:a,children:i.jsxs("group",{...e,name:"Scene",children:[i.jsxs("mesh",{children:[i.jsx("sphereGeometry",{args:[.01,32,32]}),i.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((p,f)=>{const{a:u,b:j}=l(p,t.joint_position[f]??0),g=`dhrobot_J0${f}`;return i.jsxs("group",{name:g,children:[i.jsx(S.Line,{ref:d=>{s.current[f]=d},name:Ce,points:[u,j],color:"white",lineWidth:5}),i.jsxs("mesh",{ref:d=>{c.current[f]=d},name:Ve,position:j,children:[i.jsx("sphereGeometry",{args:[.01,32,32]}),i.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${f}`)]},g)})]})})}const F=T.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,getModel:c=L,flangeRef:l,postModelRender:o,transparentColor:a,instanceUrl:p,...f})=>{const[u,j]=m.useState(null),g=m.useRef(null),d=m.useCallback(y=>{j(y)},[]),h=m.useCallback(()=>{var y;(y=g.current)==null||y.recollectJoints(),o==null||o()},[o]);m.useEffect(()=>{u&&(a?Z(u,a):K(u))},[u,a]);const R=m.useMemo(()=>{const y=c(n,p);if(!y)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return y},[n,p,c]),x=i.jsx(ke,{rapidlyChangingMotionState:t,dhParameters:e,...f});return i.jsxs(D.ErrorBoundary,{fallback:x,onError:y=>{console.warn(y)},children:[i.jsx(m.Suspense,{fallback:x,children:i.jsx("group",{ref:d,children:i.jsx(ee,{ref:g,rapidlyChangingMotionState:t,dhParameters:e,chainOffsetPosition:r,chainOffsetQuaternion:s,children:i.jsx(Y,{modelURL:R,postModelRender:h,flangeRef:l,...f})})})}),i.jsx(X,{})]})}),te=T.externalizeComponent(({rapidlyChangingMotionState:t,...n})=>{const e=G.useSmoothedMotionState(t);return i.jsx(F,{rapidlyChangingMotionState:e,...n})}),ne=T.externalizeComponent(t=>{const{inverseSolver:n,dhParameters:e,...r}=t,[s,c]=m.useState(E.JointTypeEnum.RevoluteJoint);m.useEffect(()=>{e.length&&c(e[0].type??E.JointTypeEnum.RevoluteJoint)},[e]);const l=m.useMemo(()=>n===null&&s===E.JointTypeEnum.RevoluteJoint,[n,s]),o=m.useMemo(()=>n===null&&s===E.JointTypeEnum.PrismaticJoint,[n,s]);return m.useMemo(()=>!!n,[n])||l?i.jsx(F,{dhParameters:e,...r}):o?i.jsx(I,{dhParameters:e,...r}):null}),Ie=T.externalizeComponent(t=>{const n=G.useSmoothedMotionState(t.rapidlyChangingMotionState);return i.jsx(ne,{...t,rapidlyChangingMotionState:n})});function Fe({motionGroup:t,connectedMotionGroup:n,getModel:e,flangeRef:r,transparentColor:s,postModelRender:c,...l}){const o=t??n,a=o==null?void 0:o.nova,p=m.useCallback(f=>L(f,a),[a]);return o!=null&&o.dhParameters?i.jsx(te,{rapidlyChangingMotionState:o.rapidlyChangingMotionState,modelFromController:o.modelFromController||"",dhParameters:o.dhParameters,getModel:e??p,flangeRef:r,transparentColor:s,postModelRender:c,chainOffsetPosition:o.mountingPosition,chainOffsetQuaternion:o.mountingQuaternion,...l}):null}function qe(t){var s,c,l,o,a,p;const{description:n,state:e}=t,r=n.mounting;return{nova:t.nova,modelFromController:n.motionGroupModel,dhParameters:n.dhParameters,rapidlyChangingMotionState:e.rapidlyChangingMotionState,mountingPosition:[(((s=r==null?void 0:r.position)==null?void 0:s[0])??0)/1e3,(((c=r==null?void 0:r.position)==null?void 0:c[1])??0)/1e3,(((l=r==null?void 0:r.position)==null?void 0:l[2])??0)/1e3],mountingQuaternion:re.parseRotationToQuaternion([((o=r==null?void 0:r.orientation)==null?void 0:o[0])??0,((a=r==null?void 0:r.orientation)==null?void 0:a[1])??0,((p=r==null?void 0:r.orientation)==null?void 0:p[2])??0],"ROTATION_VECTOR")}}exports.CollisionSceneRenderer=le;exports.JointLimitGizmo=Re;exports.LinearAxis=Ae;exports.MotionGroupVisualizer=Ie;exports.MotionGroupVisualizerExact=ne;exports.PresetEnvironment=be;exports.Robot=Fe;exports.SafetyZonesRenderer=ve;exports.SupportedLinearAxis=z;exports.SupportedLinearAxisExact=I;exports.SupportedRobot=te;exports.SupportedRobotExact=F;exports.TrajectoryRenderer=Te;exports.defaultGetModel=L;exports.robotModelOf=qe;
@@ -1 +0,0 @@
1
- "use strict";const n=require("react/jsx-runtime"),m=require("@mui/material/Divider"),y=require("@mui/material/Stack"),f=require("mobx-react-lite"),w=require("./externalizeComponent-Bl23ayrr.cjs"),E=require("@mui/material/styles"),c=require("react"),d=require("react-i18next"),A=require("@mui/material/Popover"),g=require("@mui/material/SvgIcon"),h=require("@mui/material/Typography"),T=require("axios"),M=require("./converters-BsXgcxCW.cjs");function _(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const l=_(c);function R(e,t){throw new Error(`${t} ${JSON.stringify(e)}`)}function O(e){var t,a,r,o;return e instanceof T.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof T.AxiosError&&e.response?`${(t=e.response)==null?void 0:t.status} ${(a=e.response)==null?void 0:a.statusText} from ${(r=e.response)==null?void 0:r.config.url}: ${JSON.stringify((o=e.response)==null?void 0:o.data)}`:e instanceof Error?e.message:`Unexpected error: ${M.tryStringifyJson(e)||e}`}const j=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),B=c.forwardRef(j),F=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),Z=c.forwardRef(F),p=f.observer(({id:e,icon:t,color:a,title:r,name:o,label:s,explanation:i,literalValue:u,anchorOrigin:b,transformOrigin:v})=>{const S=f.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!S.anchorEl},openPopover(x){S.anchorEl=x.currentTarget},closePopover(){S.anchorEl=null}}));return n.jsxs(n.Fragment,{children:[n.jsxs(y,{"aria-owns":S.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:S.openPopover,onMouseLeave:S.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[n.jsx(g,{component:t,sx:{color:a}}),s&&n.jsx("div",{style:{color:a},children:s})]}),n.jsx(A,{id:e,sx:{pointerEvents:"none"},open:S.isPopoverOpen,anchorEl:S.anchorEl,anchorOrigin:b??{vertical:"bottom",horizontal:"left"},transformOrigin:v??{vertical:"top",horizontal:"left"},onClose:S.closePopover,disableRestoreFocus:!0,children:n.jsxs(y,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[n.jsxs("div",{children:[r&&n.jsx(h,{component:"span",fontSize:"14px",children:`${r}: `}),n.jsx(h,{component:"span",color:a,fontWeight:"bold",fontSize:"14px",children:o})]}),n.jsx(h,{fontSize:"14px",children:i}),u&&n.jsx(h,{fontSize:"12px",children:u})]})})]})}),C=f.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:a,transformOrigin:r,compact:o})=>{const s=E.useTheme(),i=c.useId(),{t:u}=d.useTranslation();return e?n.jsx(p,{id:`motion-group-virtual-${i}`,icon:Z,color:s.palette.tertiary.main,name:u("SafetyBar.ControllerType.Virtual.lb"),label:o?null:u("SafetyBar.ControllerType.Virtual.lb"),explanation:n.jsxs(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",n.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:a,transformOrigin:r}):n.jsx(p,{id:`motion-group-physical-${i}`,icon:B,color:s.palette.primary.main,name:u("SafetyBar.ControllerType.Physical.lb"),label:o?null:u("SafetyBar.ControllerType.Physical.lb"),explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:n.jsx("code",{}),strong:n.jsx("strong",{})}}),anchorOrigin:a,transformOrigin:r})}),P=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),$=c.forwardRef(P),N=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),V=c.forwardRef(N),Y=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),q=c.forwardRef(Y),I=f.observer(({operationMode:e,anchorOrigin:t,transformOrigin:a,compact:r})=>{const{t:o}=d.useTranslation(),s=E.useTheme(),i=c.useId();switch(e){case"OPERATION_MODE_AUTO":return n.jsx(p,{id:`operation-mode-auto-${i}`,icon:$,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Automatic.ti"),label:r?null:o("SafetyBar.OperationMode.Automatic.ti"),color:s.palette.text.secondary,explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Auto.Explanation.lb",children:"The robot controller is in automatic operation mode. Automated movement without manual confirmation is possible in this mode."}),anchorOrigin:t,transformOrigin:a});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return n.jsx(p,{id:`operation-mode-manual-${i}`,icon:q,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Manual.lb"),label:r?null:o("SafetyBar.OperationMode.Manual.lb"),explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Manual.Explanation.lb",children:"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:return n.jsx(p,{id:`operation-mode-error-${i}`,icon:V,color:s.palette.warning.main,title:o("SafetyBar.OperationMode.ti"),name:o("SafetyBar.OperationMode.Error.lb"),label:r?null:o("SafetyBar.OperationMode.Error.lb"),explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.OperationMode.Error.Explanation.lb",children:"The robot controller has entered an unexpected operation mode. Motion group movement may not be possible."}),literalValue:e,anchorOrigin:t,transformOrigin:a})}}),L=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),K=c.forwardRef(L),D=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),H=c.forwardRef(D),U=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),z=c.forwardRef(U),k=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),W=c.forwardRef(k),G=({title:e,titleId:t,...a},r)=>l.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...a},e?l.createElement("title",{id:t},e):null,l.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),J=c.forwardRef(G),Q=f.observer(({safetyState:e,anchorOrigin:t,transformOrigin:a,compact:r})=>{const{t:o}=d.useTranslation(),s=E.useTheme(),i=c.useId();switch(e){case"SAFETY_STATE_NORMAL":return n.jsx(p,{id:`safety-state-normal-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Normal.lb"),label:r?null:o("SafetyBar.SafetyState.Normal.lb"),icon:W,color:s.palette.text.secondary,explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Normal.Explanation.lb",children:"The robot controller is in a normal safety state. Movement is not prevented by this state."}),anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return n.jsx(p,{id:`safety-state-estop-${i}`,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Estop.lb"),label:r?null:o("SafetyBar.SafetyState.Estop.lb"),icon:H,color:s.palette.error.main,explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.StopState.Estop.Explanation.lb",children:"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_STOP_0":case"SAFETY_STATE_STOP_1":case"SAFETY_STATE_STOP_2":case"SAFETY_STATE_PROTECTIVE_STOP":case"SAFETY_STATE_STOP":return n.jsx(p,{id:`safety-state-stop-${i}`,icon:J,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Stop.lb"),label:r?null:o("SafetyBar.SafetyState.Stop.lb"),color:s.palette.warning.main,explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Stop.Explanation.lb",children:"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_REDUCED":case"SAFETY_STATE_MASTERING":case"SAFETY_STATE_CONFIRM_SAFETY":case"SAFETY_STATE_OPERATOR_SAFETY":case"SAFETY_STATE_RECOVERY":case"SAFETY_STATE_VIOLATION":return n.jsx(p,{id:`safety-state-manual-action-required-${i}`,icon:z,color:s.palette.warning.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.ManualActionRequired.lb"),label:r?null:o("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:a});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return n.jsx(p,{id:`safety-state-error-${i}`,icon:K,color:s.palette.error.main,title:o("SafetyBar.SafetyState.ti"),name:o("SafetyBar.SafetyState.Error.lb"),label:r?null:o("SafetyBar.SafetyState.Error.lb"),explanation:n.jsx(d.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:a});default:R(e,`Unknown safety state ${e}`)}}),X=w.externalizeComponent(f.observer(({isVirtual:e,motionGroupId:t,operationMode:a,safetyState:r,anchorOrigin:o,transformOrigin:s,compact:i=!0})=>{const u=i?1:2;return n.jsxs(y,{direction:"row",gap:u,alignItems:"center",sx:{height:"24px"},children:[n.jsx(Q,{safetyState:r,anchorOrigin:o,transformOrigin:s,compact:i}),n.jsx(m,{orientation:"vertical",flexItem:!0}),n.jsx(I,{operationMode:a,anchorOrigin:o,transformOrigin:s,compact:i}),n.jsx(m,{orientation:"vertical",flexItem:!0}),n.jsx(C,{isVirtual:e,motionGroupId:t,anchorOrigin:o,transformOrigin:s,compact:i})]})}));function ee(e){const{controllerState:t}=e.state;return{isVirtual:e.description.isVirtual,motionGroupId:e.motionGroupId,operationMode:t.operation_mode,safetyState:t.safety_state}}exports.SafetyBar=X;exports.makeErrorMessage=O;exports.robotSafetyOf=ee;
@@ -1 +0,0 @@
1
- "use strict";const u=require("react/jsx-runtime"),T=require("@mui/material/Box"),g=require("@mui/material/MenuItem"),S=require("@mui/material/Stack"),b=require("@mui/material/Typography"),p=require("@wandelbots/mui"),c=require("react");function x(t,e){var i;return((i=t.find(r=>r.id===e))==null?void 0:i.label)??String(e)}function y(t){return t.map(e=>u.jsx(g,{value:e.id,children:e.label},e.id))}function j({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsx(p.AdornedSelect,{label:t,labelId:n,value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})}function I({label:t,options:e,value:i,onChange:r,disabled:s}){const n=c.useId();return u.jsxs(S,{direction:"row",sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[u.jsx(b,{id:n,variant:"body2",color:"text.secondary",children:t}),u.jsx(T,{sx:{width:"calc((100% - 12px) / 2)",flexShrink:0},children:u.jsx(p.AdornedSelect,{labelId:n,adornedSize:"small",value:i,disabled:s,renderValue:o=>x(e,o),onChange:o=>r(String(o.target.value)),children:y(e)})})]})}function m(){try{return document.execCommand("copy")}catch{return!1}}function q(){const[t,e]=c.useState(!1);c.useEffect(()=>{if(!t)return;const r=setTimeout(()=>e(!1),3e3);return()=>clearTimeout(r)},[t]);async function i(r,s){try{if(navigator.clipboard){await navigator.clipboard.writeText(r),e(!0);return}}catch{}if(s){s(),m()&&e(!0);return}const n=document.createElement("textarea");n.value=r,n.readOnly=!0,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),m()&&e(!0),n.remove()}return{copied:t,copy:i}}const C=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,l=(t,e)=>Number.parseFloat(t.toFixed(e));function E(t,e={}){const i=e.positionPrecision??1,r=e.rotationPrecision??4,s=n=>[0,1,2].map(o=>(n==null?void 0:n[o])??0);return`(${[...s(t.position).map(n=>l(n,i)),...s(t.orientation).map(n=>l(n,r))].join(", ")})`}function F(t){return`[${t.map(e=>l(e,4)).join(", ")}]`}function h(t,e,i){let r=t.trim();const s=r.startsWith(e),n=r.endsWith(i);if(s!==n||(s&&(r=r.slice(1,-1)),r.trim()===""))return null;const o=[];for(const a of r.split(",")){const d=a.trim();if(!C.test(d))return null;const f=Number(d);if(!Number.isFinite(f))return null;o.push(f)}return o}function P(t){const e=h(t,"(",")");if((e==null?void 0:e.length)!==6)return null;const[i,r,s,n,o,a]=e;return{position:[i,r,s],orientation:[n,o,a]}}function v(t,e){const i=h(t,"[","]");return(i==null?void 0:i.length)!==e?null:i}function w(t,e){const i=c.useRef(t);i.current=t;const[r,s]=c.useState(t);return c.useEffect(()=>{if(!e)return;let n=0;const o=()=>{s(i.current()),n=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(n)},[e]),r}exports.InlineSelect=I;exports.PanelSelect=j;exports.jointsToText=F;exports.parseJointsText=v;exports.parsePoseText=P;exports.poseToText=E;exports.useCopyText=q;exports.useEveryFrame=w;
@@ -1,155 +0,0 @@
1
- import { jsx as a, jsxs as T } from "react/jsx-runtime";
2
- import S from "@mui/material/Box";
3
- import I from "@mui/material/MenuItem";
4
- import j from "@mui/material/Stack";
5
- import C from "@mui/material/Typography";
6
- import { AdornedSelect as d } from "@wandelbots/mui";
7
- import { useId as p, useState as h, useEffect as x, useRef as w } from "react";
8
- function y(e, t) {
9
- var o;
10
- return ((o = e.find((r) => r.id === t)) == null ? void 0 : o.label) ?? String(t);
11
- }
12
- function g(e) {
13
- return e.map((t) => /* @__PURE__ */ a(I, { value: t.id, children: t.label }, t.id));
14
- }
15
- function V({
16
- label: e,
17
- options: t,
18
- value: o,
19
- onChange: r,
20
- disabled: c
21
- }) {
22
- const n = p();
23
- return /* @__PURE__ */ a(
24
- d,
25
- {
26
- label: e,
27
- labelId: n,
28
- value: o,
29
- disabled: c,
30
- renderValue: (i) => y(t, i),
31
- onChange: (i) => r(String(i.target.value)),
32
- children: g(t)
33
- }
34
- );
35
- }
36
- function $({
37
- label: e,
38
- options: t,
39
- value: o,
40
- onChange: r,
41
- disabled: c
42
- }) {
43
- const n = p();
44
- return /* @__PURE__ */ T(
45
- j,
46
- {
47
- direction: "row",
48
- sx: { alignItems: "center", justifyContent: "space-between", gap: 2 },
49
- children: [
50
- /* @__PURE__ */ a(C, { id: n, variant: "body2", color: "text.secondary", children: e }),
51
- /* @__PURE__ */ a(S, { sx: { width: "calc((100% - 12px) / 2)", flexShrink: 0 }, children: /* @__PURE__ */ a(
52
- d,
53
- {
54
- labelId: n,
55
- adornedSize: "small",
56
- value: o,
57
- disabled: c,
58
- renderValue: (i) => y(t, i),
59
- onChange: (i) => r(String(i.target.value)),
60
- children: g(t)
61
- }
62
- ) })
63
- ]
64
- }
65
- );
66
- }
67
- function m() {
68
- try {
69
- return document.execCommand("copy");
70
- } catch {
71
- return !1;
72
- }
73
- }
74
- function k() {
75
- const [e, t] = h(!1);
76
- x(() => {
77
- if (!e) return;
78
- const r = setTimeout(() => t(!1), 3e3);
79
- return () => clearTimeout(r);
80
- }, [e]);
81
- async function o(r, c) {
82
- try {
83
- if (navigator.clipboard) {
84
- await navigator.clipboard.writeText(r), t(!0);
85
- return;
86
- }
87
- } catch {
88
- }
89
- if (c) {
90
- c(), m() && t(!0);
91
- return;
92
- }
93
- const n = document.createElement("textarea");
94
- n.value = r, n.readOnly = !0, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.select(), m() && t(!0), n.remove();
95
- }
96
- return { copied: e, copy: o };
97
- }
98
- const E = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/, u = (e, t) => Number.parseFloat(e.toFixed(t));
99
- function B(e, t = {}) {
100
- const o = t.positionPrecision ?? 1, r = t.rotationPrecision ?? 4, c = (n) => [0, 1, 2].map((i) => (n == null ? void 0 : n[i]) ?? 0);
101
- return `(${[
102
- ...c(e.position).map((n) => u(n, o)),
103
- ...c(e.orientation).map((n) => u(n, r))
104
- ].join(", ")})`;
105
- }
106
- function D(e) {
107
- return `[${e.map((t) => u(t, 4)).join(", ")}]`;
108
- }
109
- function b(e, t, o) {
110
- let r = e.trim();
111
- const c = r.startsWith(t), n = r.endsWith(o);
112
- if (c !== n || (c && (r = r.slice(1, -1)), r.trim() === "")) return null;
113
- const i = [];
114
- for (const s of r.split(",")) {
115
- const l = s.trim();
116
- if (!E.test(l)) return null;
117
- const f = Number(l);
118
- if (!Number.isFinite(f)) return null;
119
- i.push(f);
120
- }
121
- return i;
122
- }
123
- function M(e) {
124
- const t = b(e, "(", ")");
125
- if ((t == null ? void 0 : t.length) !== 6) return null;
126
- const [o, r, c, n, i, s] = t;
127
- return { position: [o, r, c], orientation: [n, i, s] };
128
- }
129
- function O(e, t) {
130
- const o = b(e, "[", "]");
131
- return (o == null ? void 0 : o.length) !== t ? null : o;
132
- }
133
- function W(e, t) {
134
- const o = w(e);
135
- o.current = e;
136
- const [r, c] = h(e);
137
- return x(() => {
138
- if (!t) return;
139
- let n = 0;
140
- const i = () => {
141
- c(o.current()), n = requestAnimationFrame(i);
142
- };
143
- return i(), () => cancelAnimationFrame(n);
144
- }, [t]), r;
145
- }
146
- export {
147
- $ as I,
148
- V as P,
149
- M as a,
150
- B as b,
151
- k as c,
152
- D as j,
153
- O as p,
154
- W as u
155
- };
@@ -1 +0,0 @@
1
- "use strict";const v=require("@wandelbots/nova-js/v2"),V=require("mobx"),u=require("react");function I(e){u.useEffect(e,[])}function T(e){I(()=>V.autorun(e))}function A(e){return I(()=>{let t;function n(){e(),t=requestAnimationFrame(n)}return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}})}function F(e){return e instanceof v.Nova?e:typeof e=="string"?new v.Nova({instanceUrl:e}):new v.Nova({instanceUrl:e.config.instanceUrl,accessToken:e.accessToken??e.config.accessToken??void 0})}function y(e){return typeof e=="string"?void 0:e.config.cellId}class C{constructor(t=[],n={}){this.currentValues=[],this.targetValues=[],this.previousTargetValues=[],this.targetUpdateTime=0,this.animationId=null,this.updateCount=0,this.velocities=[],this.animate=()=>{this.update(.016666666666666666)?this.animationId=null:this.animationId=requestAnimationFrame(this.animate)},this.options={tension:120,friction:20,threshold:.001,onChange:()=>{},onComplete:()=>{},...n},this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0}update(t=1/60){let n=!1,s=!0;this.updateCount++;const o=Math.min(t,1/15),c=this.updateCount===1?.7:1;for(let i=0;i<this.currentValues.length;i++){const l=this.currentValues[i],f=this.targetValues[i],d=this.velocities[i],r=f-l,a=r*this.options.tension*c,m=d*this.options.friction,h=a-m,g=d+h*o,p=l+g*o;Math.abs(r)<this.options.threshold&&Math.abs(g)<this.options.threshold*10?this.currentValues[i]!==f&&(this.currentValues[i]=f,this.velocities[i]=0,n=!0):(s=!1,this.currentValues[i]=p,this.velocities[i]=g,n=!0)}return n&&this.options.onChange(this.currentValues),s&&this.options.onComplete(this.currentValues),s}setTarget(t){const n=performance.now(),s=n-this.targetUpdateTime;this.previousTargetValues=[...this.targetValues],this.targetValues=[...t],this.targetUpdateTime=n,this.updateCount=0;const o=this.previousTargetValues.every((c,i)=>c===this.currentValues[i]);if(s<8&&s>0&&this.previousTargetValues.length>0&&!o){const c=Math.min(s/8,1);for(let i=0;i<this.targetValues.length;i++){const l=this.previousTargetValues[i]||0,f=t[i]||0;Math.abs(f-l)>.1&&(this.targetValues[i]=l+(f-l)*c)}}for(;this.currentValues.length<t.length;)this.currentValues.push(t[this.currentValues.length]),this.velocities.push(0);this.currentValues.length>t.length&&(this.currentValues=this.currentValues.slice(0,t.length),this.velocities=this.velocities.slice(0,t.length))}getCurrentValues(){return[...this.currentValues]}getValue(t){return this.currentValues[t]??0}isInterpolating(){return this.animationId!==null}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setImmediate(t){this.stop(),this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0,this.options.onChange(this.currentValues)}updateOptions(t){this.options={...this.options,...t}}startAutoInterpolation(){this.startInterpolation()}destroy(){this.stop()}startInterpolation(){this.animationId===null&&this.animate()}}function w(e=[],t={}){const n=u.useRef(null);return n.current||(n.current=new C(e,t)),u.useEffect(()=>{var s;(s=n.current)==null||s.updateOptions(t)},[t]),u.useEffect(()=>()=>{var s;(s=n.current)==null||s.destroy()},[]),[n.current]}function R(e,t){const[n]=u.useState(()=>V.observable({...e})),s=u.useRef(null),o=u.useRef(null),c=u.useRef(0);function i(){o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}function l(){const r=s.current;if(!r)return;const a=performance.now(),m=(a-c.current)/1e3;c.current=a;const h=r.update(m);V.runInAction(()=>{n.joint_position=r.getCurrentValues()}),o.current=h?null:requestAnimationFrame(l)}function f(){o.current===null&&(c.current=performance.now(),o.current=requestAnimationFrame(l))}function d(r){var m;const a=r.joint_position.filter(h=>h!==void 0);(m=s.current)==null||m.setTarget(a),V.runInAction(()=>{const h=r,g=n;for(const p of Object.keys(h))p!=="joint_position"&&g[p]!==h[p]&&(g[p]=h[p])}),f()}return I(()=>{const r=e.joint_position.filter(a=>a!==void 0);return s.current=new C(r,t),()=>{var a;i(),(a=s.current)==null||a.destroy()}}),u.useEffect(()=>{var r;t&&((r=s.current)==null||r.updateOptions(t))},[t]),u.useEffect(()=>V.autorun(()=>d(e)),[e]),n}exports.ValueInterpolator=C;exports.cellIdOf=y;exports.createNovaClient=F;exports.useAnimationFrame=A;exports.useAutorun=T;exports.useInterpolation=w;exports.useSmoothedMotionState=R;