@wandelbots/wandelbots-js-react-components 5.8.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/3d.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/MotionGroupVisualizer-DKuoN4_j.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.LinearAxis=e.LinearAxis;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.MotionGroupVisualizer=e.MotionGroupVisualizer;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/MotionGroupVisualizer-zDM0Lgd-.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.LinearAxis=e.LinearAxis;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.MotionGroupVisualizer=e.MotionGroupVisualizer;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedLinearAxis=e.SupportedLinearAxis;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;
package/dist/3d.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as o, L as r, M as s, h as t, P as n, b as i, R as d, S as f, c as u, f as R, T as l, a as C, d as p, e as M, g as S } from "./chunks/MotionGroupVisualizer-Da-rqhb2.js";
1
+ import { C as o, L as r, M as s, h as t, P as n, b as i, R as d, S as f, c as u, f as R, T as l, a as C, d as p, e as M, g as S } from "./chunks/MotionGroupVisualizer-BRec-k-p.js";
2
2
  export {
3
3
  o as CollisionSceneRenderer,
4
4
  r as LinearAxis,
@@ -2,9 +2,9 @@ import { jsx as r, jsxs as x, Fragment as J } from "react/jsx-runtime";
2
2
  import * as w from "three";
3
3
  import { Matrix4 as v, Vector3 as L, Quaternion as $ } from "three";
4
4
  import { ConvexGeometry as ce, RoundedBoxGeometry as Ge } from "three-stdlib";
5
- import Le, { useMemo as F, forwardRef as Ie, useRef as R, useEffect as T, useImperativeHandle as Ae, useState as I, useCallback as G, Suspense as le } from "react";
6
- import { d as Pe, v as Fe, o as De, e as C } from "./externalizeComponent-EDymnaGR.js";
7
- import { Environment as Oe, Lightformer as P, Line as N, useGLTF as Ve, Bounds as z } from "@react-three/drei";
5
+ import Le, { useMemo as F, forwardRef as Ie, useRef as R, useEffect as T, useImperativeHandle as Pe, useState as I, useCallback as G, Suspense as le } from "react";
6
+ import { d as Ae, v as Fe, o as De, e as C } from "./externalizeComponent-EDymnaGR.js";
7
+ import { Environment as Oe, Lightformer as A, Line as N, useGLTF as Ve, Bounds as z } from "@react-three/drei";
8
8
  import { useTheme as Ee } from "@mui/material/styles";
9
9
  import M from "@mui/material/Box";
10
10
  import ee from "@mui/material/Button";
@@ -112,7 +112,7 @@ const Ne = [2, 0, 2, 0, 2, 0, 2, 0];
112
112
  function He({ positions: e = Ne }) {
113
113
  return /* @__PURE__ */ x(J, { children: [
114
114
  /* @__PURE__ */ r(
115
- P,
115
+ A,
116
116
  {
117
117
  intensity: 5,
118
118
  "rotation-x": Math.PI / 2,
@@ -121,7 +121,7 @@ function He({ positions: e = Ne }) {
121
121
  }
122
122
  ),
123
123
  /* @__PURE__ */ r("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ r("group", { children: e.map((n, t) => /* @__PURE__ */ r(
124
- P,
124
+ A,
125
125
  {
126
126
  form: "circle",
127
127
  intensity: 5,
@@ -132,7 +132,7 @@ function He({ positions: e = Ne }) {
132
132
  t
133
133
  )) }) }),
134
134
  /* @__PURE__ */ r(
135
- P,
135
+ A,
136
136
  {
137
137
  intensity: 40,
138
138
  "rotation-y": Math.PI / 2,
@@ -141,7 +141,7 @@ function He({ positions: e = Ne }) {
141
141
  }
142
142
  ),
143
143
  /* @__PURE__ */ r(
144
- P,
144
+ A,
145
145
  {
146
146
  intensity: 20,
147
147
  "rotation-y": -Math.PI,
@@ -150,7 +150,7 @@ function He({ positions: e = Ne }) {
150
150
  }
151
151
  ),
152
152
  /* @__PURE__ */ r(
153
- P,
153
+ A,
154
154
  {
155
155
  "rotation-y": Math.PI / 2,
156
156
  position: [-5, -1, -1],
@@ -159,7 +159,7 @@ function He({ positions: e = Ne }) {
159
159
  }
160
160
  ),
161
161
  /* @__PURE__ */ r(
162
- P,
162
+ A,
163
163
  {
164
164
  "rotation-y": -Math.PI / 2,
165
165
  position: [10, 1, 0],
@@ -168,7 +168,7 @@ function He({ positions: e = Ne }) {
168
168
  }
169
169
  ),
170
170
  /* @__PURE__ */ r(
171
- P,
171
+ A,
172
172
  {
173
173
  form: "ring",
174
174
  color: "white",
@@ -195,7 +195,7 @@ function Rt({
195
195
  ...t
196
196
  }) {
197
197
  const s = F(
198
- () => Pe(n ?? []),
198
+ () => Ae(n ?? []),
199
199
  [n]
200
200
  ), a = (c, o) => {
201
201
  var p, y;
@@ -409,7 +409,7 @@ const be = Ie(
409
409
  function p() {
410
410
  c.current && (o.current = me(c.current), y(), i());
411
411
  }
412
- Ae(f, () => ({ recollectJoints: p }));
412
+ Pe(f, () => ({ recollectJoints: p }));
413
413
  function y() {
414
414
  var d;
415
415
  const u = ((d = g.current) == null ? void 0 : d.getCurrentValues()) || [];
@@ -417,7 +417,7 @@ const be = Ie(
417
417
  s(o.current, u);
418
418
  else
419
419
  for (const [b, S] of o.current.entries()) {
420
- const A = t[b], B = A.theta || 0, H = A.reverse_rotation_direction ? -1 : 1;
420
+ const P = t[b], B = P.theta || 0, H = P.reverse_rotation_direction ? -1 : 1;
421
421
  S.rotation.y = H * (u[b] || 0) + B;
422
422
  }
423
423
  }
@@ -745,7 +745,7 @@ const Mt = C(
745
745
  className: h
746
746
  }) => {
747
747
  var X;
748
- const l = Ee(), { t: p } = Ce(), [y, m] = I(!1), u = R(null), d = R(null), [b, S] = I(!1), [A, B] = I({ width: 400, height: 600 }), [H, ke] = I(0);
748
+ const l = Ee(), { t: p } = Ce(), [y, m] = I(!1), u = R(null), d = R(null), [b, S] = I(!1), [P, B] = I({ width: 400, height: 600 }), [H, ke] = I(0);
749
749
  T(() => {
750
750
  const E = () => {
751
751
  if (d.current) {
@@ -767,7 +767,7 @@ const Mt = C(
767
767
  !a || !c || (m(!1), c());
768
768
  }, [a, c]), q = G(() => {
769
769
  y && c && (m(!1), c());
770
- }, [y, c]), k = b ? A.width < 350 : A.height < 200, V = b ? A.height < 310 : A.height < 450;
770
+ }, [y, c]), k = b ? P.width < 350 : P.height < 200, V = b ? P.height < 310 : P.height < 450;
771
771
  return /* @__PURE__ */ r(
772
772
  Ue,
773
773
  {
@@ -786,7 +786,7 @@ const Mt = C(
786
786
  border: `1px solid ${l.palette.divider}`,
787
787
  borderRadius: "18px",
788
788
  boxShadow: "none",
789
- backgroundColor: ((X = l.palette.backgroundPaperElevation) == null ? void 0 : X[8]) || "#2A2A3F",
789
+ backgroundColor: ((X = l.palette.backgroundPaperElevation) == null ? void 0 : X[8]) || "#292B3F",
790
790
  backgroundImage: "none"
791
791
  // Override any gradient from elevation
792
792
  },
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),b=require("three"),O=require("three-stdlib"),l=require("react"),L=require("./externalizeComponent-OO4jcrz5.cjs"),M=require("@react-three/drei"),he=require("@mui/material/styles"),v=require("@mui/material/Box"),X=require("@mui/material/Button"),me=require("@mui/material/Card"),Z=require("@mui/material/Divider"),K=require("@mui/material/Typography"),k=require("@react-three/fiber"),xe=require("mobx-react-lite"),ye=require("react-i18next"),E=require("./interpolation-C9sLsved.cjs"),R=require("@wandelbots/nova-js/v2"),ee=require("react-error-boundary");function ge(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const w=ge(b);function je(t){switch(t.shape_type){case"convex_hull":return new O.ConvexGeometry(t.vertices.map(r=>new w.Vector3(r[0]/1e3,r[1]/1e3,r[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 be({name:t,collider:n,children:r}){var d,c;const o=((d=n.pose)==null?void 0:d.position)??[0,0,0],a=((c=n.pose)==null?void 0:c.orientation)??[0,0,0];return n.margin&&console.warn(`${t} margin is not supported`),e.jsx("mesh",{name:t,position:new w.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new w.Euler(a[0],a[1],a[2],"XYZ"),geometry:je(n.shape),children:r})}function we({name:t,colliders:n,meshChildrenProvider:r,...o}){return e.jsx("group",{name:t,...o,children:Object.entries(n).map(([a,d])=>e.jsx(be,{name:a,collider:d,children:r(a,d)},a))})}function Re({scene:t,meshChildrenProvider:n}){const r=t.colliders;return e.jsx("group",{children:r&&e.jsx(we,{meshChildrenProvider:n,colliders:r})})}function D(){return e.jsx(M.Environment,{frames:1,children:e.jsx(ve,{})})}const Me=[2,0,2,0,2,0,2,0];function ve({positions:t=Me}){return e.jsxs(e.Fragment,{children:[e.jsx(M.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),e.jsx("group",{rotation:[0,.5,0],children:e.jsx("group",{children:t.map((n,r)=>e.jsx(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),e.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),e.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),e.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const z={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function Se({safetyZones:t,dhParameters:n,...r}){const o=l.useMemo(()=>L.dhParametersToPlaneSize(n??[]),[n]),a=(c,s)=>{var p,y;if(!((p=s==null?void 0:s.pose)!=null&&p.position)||!((y=s==null?void 0:s.pose)!=null&&y.orientation))return null;const g=new w.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),i=new w.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let m;const u=s.shape.shape_type==="plane"?{...z,side:w.DoubleSide}:{...z,side:w.FrontSide};switch(s.shape.shape_type){case"plane":m=e.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const x=(s==null?void 0:s.shape).radius/1e3;m=e.jsx("sphereGeometry",{args:[x]});break}case"capsule":{const x=(s==null?void 0:s.shape).radius/1e3,f=(s==null?void 0:s.shape).cylinder_height/1e3;m=e.jsx("capsuleGeometry",{args:[x,f]});break}case"convex_hull":{const x=(s==null?void 0:s.shape).vertices.map(h=>new w.Vector3(h[0]/1e3,h[1]/1e3,h[2]/1e3)),f=L.verticesToCoplanarity(x);if(f.isCoplanar&&f.normal){const j=new w.Vector3().addVectors(x[0],f.normal.multiplyScalar(1e-4));x.push(j)}try{m=e.jsx("primitive",{object:new O.ConvexGeometry(x),attach:"geometry"})}catch(h){return console.log("Error creating ConvexGeometry:",h),null}break}case"rectangular_capsule":{const x=s.shape,f=x.radius/1e3,h=x.sphere_center_distance_x/1e3,j=x.sphere_center_distance_y/1e3,S=f*2;m=e.jsx("primitive",{object:new O.RoundedBoxGeometry(h,j,S,2,f),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),m=null}return e.jsxs("mesh",{renderOrder:c,position:g,quaternion:L.orientationToQuaternion(i),children:[m,e.jsx("meshStandardMaterial",{...u,polygonOffsetFactor:-c})]},`safety-zone-${s.shape.shape_type}-${c}`)},d=l.useMemo(()=>Object.values(t??{}).map((c,s)=>a(s,c)),[t,o]);return e.jsx("group",{...r,children:d})}function _e({trajectory:t,...n}){const r=(t==null?void 0:t.map(o=>{if(o.position&&o.position.length>=3){const[a,d,c]=o.position;if(Number.isFinite(a)&&Number.isFinite(d)&&Number.isFinite(c))return new w.Vector3(a/1e3,c/1e3,-d/1e3)}return null}).filter(o=>o!==null))||[];return e.jsx("group",{...n,children:r.length>0&&e.jsx(M.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const V=new Map;async function G(t,n){if(V.has(t))return V.get(t);const r=(async()=>{var c;const o=n||"",a=new R.Nova({instanceUrl:o}),d=a.api.motionGroupModels;(c=d.axios)!=null&&c.interceptors&&d.axios.interceptors.request.use(s=>{var g;return(g=s.url)!=null&&g.includes("/glb")&&(s.responseType="blob"),s});try{const s=await a.api.motionGroupModels.getMotionGroupGlbModel(t);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return V.set(t,r),r}function te(t){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(t).filter(r=>ne(r))}function re(t){return t.name.endsWith("_FLG")}function ne(t){return/_J[0-9]+$/.test(t.name)}function Te(t,n){let r;function o(a){if(re(a)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${a.name}. Only one _FLG group is allowed.`);r=a}ne(a),a.children.map(o)}if(o(t.scene),!r)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:t}}const se=l.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:r,onRotationChanged:o,children:a},d){const c=l.useRef(null),s=l.useRef([]),g=l.useRef(null),{invalidate:i}=k.useThree(),m=l.useRef(n);m.current=n,l.useEffect(()=>{const f=n.joint_position.filter(h=>h!==void 0);return g.current=new E.ValueInterpolator(f,{tension:120,friction:20,threshold:.001}),()=>{var h;(h=g.current)==null||h.destroy()}},[]),k.useFrame((f,h)=>{if(!g.current)return;s.current.length===0&&c.current&&p();const j=g.current.update(h);y(),j||i()});function u(f){c.current=f,f&&p()}function p(){c.current&&(s.current=te(c.current),y(),i())}l.useImperativeHandle(d,()=>({recollectJoints:p}));function y(){var h;const f=((h=g.current)==null?void 0:h.getCurrentValues())||[];if(o)o(s.current,f);else for(const[j,S]of s.current.entries()){const T=r[j],F=T.theta||0,B=T.reverse_rotation_direction?-1:1;S.rotation.y=B*(f[j]||0)+F}}function x(f){var j;const h=f.joint_position.filter(S=>S!==void 0);(j=g.current)==null||j.setTarget(h),i()}return E.useAutorun(()=>{x(m.current)}),l.useEffect(()=>{x(n)},[n]),e.jsx("group",{ref:u,children:a})}),Le="line",ke="mesh";function Ee({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef([]),d=l.useRef([]);l.useEffect(()=>{a.current=new Array(n.length).fill(null),d.current=new Array(n.length).fill(null)},[n.length]);function c(i,m){const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;o.decompose(u,p,y);const x=u.clone(),f=new b.Matrix4().makeRotationY(i.theta+m*(i.reverse_rotation_direction?-1:1)).multiply(new b.Matrix4().makeTranslation(0,i.d/1e3,0)).multiply(new b.Matrix4().makeTranslation(i.a/1e3,0,0)).multiply(new b.Matrix4().makeRotationX(i.alpha));return o.multiply(f),o.decompose(u,p,y),{a:x,b:u}}function s(i,m,u,p){if(!n)return;const y=n[i];if(!y)return;const{a:x,b:f}=c(y,p);m.geometry.setPositions([x.toArray(),f.toArray()].flat()),u.position.set(f.x,f.y,f.z)}function g(i,m){o.identity();for(let u=0;u<Math.min(i.length,m.length);u++){const p=a.current[u],y=d.current[u];p&&y&&s(u,p,y,m[u])}}return e.jsx(se,{rapidlyChangingMotionState:t,dhParameters:n,onRotationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((i,m)=>{const{a:u,b:p}=c(i,t.joint_position[m]??0),y=`dhrobot_J0${m}`;return e.jsxs("group",{name:y,children:[e.jsx(M.Line,{ref:x=>{a.current[m]=x},name:Le,points:[u,p],color:"white",lineWidth:5}),e.jsxs("mesh",{ref:x=>{d.current[m]=x},name:ke,position:p,children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${m}`)]},y)})]})})}const Ge=console.warn;function oe(){return l.useEffect(()=>{console.warn=t=>{t!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ge(t)}},[]),null}function Ae(t){return t.type==="Mesh"}function Ce({url:t,flangeRef:n,postModelRender:r,...o}){const a=M.useGLTF(t),c=Te(a,"robot.glb").gltf,s=l.useCallback(i=>{i&&r&&r()},[r]);function g(i){try{return Ae(i)?i.geometry?e.jsx("mesh",{name:i.name,geometry:i.geometry,material:i.material,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation,ref:re(i)?n:void 0,children:i.children.map(g)},i.uuid)}catch(m){return console.warn("Error rendering node",i.name,m),null}}return e.jsx("group",{...o,dispose:null,ref:s,children:g(c.scene)})}function ie({modelURL:t,flangeRef:n,postModelRender:r,...o}){const[a,d]=l.useState(null);return l.useEffect(()=>{let c=!1;return(async()=>{try{const g=typeof t=="string"?t:await t;c||d(i=>i===g?i:g)}catch(g){console.error("Failed to resolve model URL:",g)}})(),()=>{c=!0}},[t]),a?e.jsx(Ce,{url:a,flangeRef:n,postModelRender:r,...o}):null}const ae=(t,n)=>{t.userData.isGhost||(t.traverse(r=>{if(r instanceof w.Mesh){r.material instanceof w.Material&&(r.material.colorWrite=!1);const o=r.clone(),a=r.clone();o.material=new w.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:w.DoubleSide}),o.userData.isGhost=!0,a.material=new w.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:w.DoubleSide}),a.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(a))}}),t.userData.isGhost=!0)},ce=t=>{if(!t.userData.isGhost)return;const n=[];t.traverse(r=>{var o;r instanceof w.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof w.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),t.userData.isGhost=!1},J=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useRef(null),p=l.useCallback(h=>{m(h)},[]),y=l.useCallback(()=>{var h;(h=u.current)==null||h.recollectJoints(),d==null||d()},[d]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const x=l.useMemo(()=>{const h=o(n,s);if(!h)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return h},[n,s,o]),f=e.jsx(Ee,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:f,onError:h=>{console.warn(h)},children:[e.jsx(l.Suspense,{fallback:f,children:e.jsx("group",{ref:p,children:e.jsx(se,{ref:u,rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:x,postModelRender:y,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function ue({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){return t.dhParameters?e.jsx(J,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:t.modelFromController||"",dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):null}const Ie=L.externalizeComponent(xe.observer(({robotName:t,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:a=!1,onDriveToHomePress:d,onDriveToHomeRelease:c,connectedMotionGroup:s,robotComponent:g=ue,customContentComponent:i,className:m})=>{var H;const u=he.useTheme(),{t:p}=ye.useTranslation(),[y,x]=l.useState(!1),f=l.useRef(null),h=l.useRef(null),[j,S]=l.useState(!1),[T,F]=l.useState({width:400,height:600}),[B,pe]=l.useState(0);l.useEffect(()=>{const P=()=>{if(h.current){const{offsetWidth:Y,offsetHeight:Q}=h.current;S(Y>Q),F({width:Y,height:Q})}};P();const $=new ResizeObserver(P);return h.current&&$.observe(h.current),()=>{$.disconnect()}},[]);const N=l.useCallback(()=>{pe(P=>P+1)},[]),A=l.useCallback(()=>{!a||!d||(x(!0),d())},[a,d]),C=l.useCallback(()=>{!a||!c||(x(!1),c())},[a,c]),W=l.useCallback(()=>{y&&c&&(x(!1),c())},[y,c]),_=j?T.width<350:T.height<200,I=j?T.height<310:T.height<450;return e.jsx(me,{ref:h,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:j?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:j?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${u.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((H=u.palette.backgroundPaperElevation)==null?void 0:H[8])||"#2A2A3F",backgroundImage:"none"},children:j?e.jsxs(e.Fragment,{children:[e.jsx(v,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:_?"100%":"50%"},children:[e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!I&&i&&e.jsxs(v,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{mt:!I&&i?"auto":0},children:e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:A,onMouseUp:C,onMouseLeave:W,onTouchStart:A,onTouchEnd:C,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})})]})]})]}):e.jsx(e.Fragment,{children:e.jsxs(v,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs(v,{children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsx(v,{sx:{flex:_?0:1,position:"relative",minHeight:_?0:{xs:120,sm:150,md:200},height:_?0:"auto",borderRadius:1,overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{children:[!I&&i&&e.jsxs(e.Fragment,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:!I&&i?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:A,onMouseUp:C,onMouseLeave:W,onTouchStart:A,onTouchEnd:C,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})]})]})})})})),Pe=Array(6).fill(2*Math.PI);function le({rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:r,children:o}){const a=l.useRef([]),d=l.useRef([]),c=l.useRef(null),{invalidate:s}=k.useThree();l.useEffect(()=>{const u=t.joint_position.filter(p=>p!==void 0);return c.current=new E.ValueInterpolator(u,{tension:120,friction:20,threshold:.001}),()=>{var p;(p=c.current)==null||p.destroy()}},[]),k.useFrame((u,p)=>{if(c.current){const y=c.current.update(p);i(),y||s()}});function g(u){u&&(d.current=te(u),i(),s())}function i(){var p;const u=((p=c.current)==null?void 0:p.getCurrentValues())||[];if(r)r(d.current,u);else for(const[y,x]of d.current.entries()){const h=n[y].reverse_rotation_direction?-1:1;x.position.y=h*(u[y]||0)/1e3}}const m=l.useCallback(()=>{const u=t.joint_position.filter(p=>p!==void 0);requestAnimationFrame(()=>{var p;a.current=u,(p=c.current)==null||p.setTarget(u)})},[t]);return l.useEffect(()=>{m()},[t,m]),E.useAutorun(()=>{m()}),e.jsx("group",{ref:g,children:o})}function fe({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef(null),d=l.useRef(null);function c(i){const m=new b.Matrix4;for(let x=0;x<n.length;x++){const f=n[x],h=i[x]??0,j=new b.Matrix4().makeRotationY(f.theta).multiply(new b.Matrix4().makeTranslation(f.a/1e3,(f.d+h*(f.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(f.alpha));m.multiply(j)}const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;return m.decompose(u,p,y),u}const s=c(t.joint_position);function g(i,m){o.identity();let u=new b.Vector3;for(let f=0;f<n.length;f++){const h=m[f]??0,j=n[f],S=new b.Matrix4().makeRotationY(j.theta).multiply(new b.Matrix4().makeTranslation(j.a/1e3,(j.d+h*(j.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(j.alpha));o.multiply(S)}const p=new b.Vector3,y=new b.Quaternion,x=new b.Vector3;if(o.decompose(p,y,x),u=p,a.current&&a.current.position.set(u.x,u.y,u.z),d.current){const f=d.current.geometry;f!=null&&f.setPositions&&f.setPositions([0,0,0,u.x,u.y,u.z])}}return e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{name:"Base",position:[0,0,0],children:[e.jsx("sphereGeometry",{args:[.02,32,32]}),e.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),e.jsx(M.Line,{ref:d,points:[new b.Vector3(0,0,0),s],color:"White",lineWidth:5}),e.jsxs("mesh",{ref:a,name:"TCP",position:s,children:[e.jsx("sphereGeometry",{args:[.025,32,32]}),e.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const U=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useCallback(y=>{m(y)},[]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const p=e.jsx(fe,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:p,onError:y=>{console.warn(y)},children:[e.jsx(l.Suspense,{fallback:p,children:e.jsx("group",{ref:u,children:e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:(()=>{const y=o(n,s);if(!y){const x=new Blob([],{type:"model/gltf-binary"}),f=new File([x],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(f))}return y})(),postModelRender:d,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function Fe({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){if(!t.dhParameters)return null;const c=t.modelFromController||"";return c&&n(c)?e.jsx(U,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:c,dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):e.jsx(fe,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,dhParameters:t.dhParameters,...d})}const q={[R.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[R.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[R.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0],[R.Manufacturer.Staubli]:[0,-Math.PI/2,Math.PI/2,0,0,0,0]};function de(t){const[n]=t.split("_");switch(n){case"ABB":return R.Manufacturer.Abb;case"FANUC":return R.Manufacturer.Fanuc;case"YASKAWA":return R.Manufacturer.Yaskawa;case"KUKA":return R.Manufacturer.Kuka;case"UniversalRobots":return R.Manufacturer.Universalrobots;case"STAUBLI":return R.Manufacturer.Staubli;default:return null}}function Ve(t,n){const r=de(t);return r&&r in q?q[r]:n||null}const Oe=L.externalizeComponent(t=>{const{inverseSolver:n,dhParameters:r,...o}=t,[a,d]=l.useState(R.JointTypeEnum.RevoluteJoint);l.useEffect(()=>{r.length&&d(r[0].type??R.JointTypeEnum.RevoluteJoint)},[r]);const c=l.useMemo(()=>n===null&&a===R.JointTypeEnum.RevoluteJoint,[n,a]),s=l.useMemo(()=>n===null&&a===R.JointTypeEnum.PrismaticJoint,[n,a]);return l.useMemo(()=>!!n,[n])||c?e.jsx(J,{dhParameters:r,...o}):s?e.jsx(U,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=Re;exports.LinearAxis=Fe;exports.MANUFACTURER_HOME_CONFIGS=q;exports.MotionGroupVisualizer=Oe;exports.PresetEnvironment=D;exports.Robot=ue;exports.RobotCard=Ie;exports.SafetyZonesRenderer=Se;exports.SupportedLinearAxis=U;exports.SupportedRobot=J;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Pe;exports.defaultGetModel=G;exports.extractManufacturer=de;exports.getDefaultHomeConfig=Ve;
1
+ "use strict";const e=require("react/jsx-runtime"),b=require("three"),O=require("three-stdlib"),l=require("react"),L=require("./externalizeComponent-OO4jcrz5.cjs"),M=require("@react-three/drei"),he=require("@mui/material/styles"),v=require("@mui/material/Box"),X=require("@mui/material/Button"),me=require("@mui/material/Card"),Z=require("@mui/material/Divider"),K=require("@mui/material/Typography"),k=require("@react-three/fiber"),xe=require("mobx-react-lite"),ye=require("react-i18next"),E=require("./interpolation-C9sLsved.cjs"),R=require("@wandelbots/nova-js/v2"),ee=require("react-error-boundary");function ge(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const w=ge(b);function je(t){switch(t.shape_type){case"convex_hull":return new O.ConvexGeometry(t.vertices.map(r=>new w.Vector3(r[0]/1e3,r[1]/1e3,r[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 be({name:t,collider:n,children:r}){var d,c;const o=((d=n.pose)==null?void 0:d.position)??[0,0,0],a=((c=n.pose)==null?void 0:c.orientation)??[0,0,0];return n.margin&&console.warn(`${t} margin is not supported`),e.jsx("mesh",{name:t,position:new w.Vector3(o[0],o[1],o[2]).divideScalar(1e3),rotation:new w.Euler(a[0],a[1],a[2],"XYZ"),geometry:je(n.shape),children:r})}function we({name:t,colliders:n,meshChildrenProvider:r,...o}){return e.jsx("group",{name:t,...o,children:Object.entries(n).map(([a,d])=>e.jsx(be,{name:a,collider:d,children:r(a,d)},a))})}function Re({scene:t,meshChildrenProvider:n}){const r=t.colliders;return e.jsx("group",{children:r&&e.jsx(we,{meshChildrenProvider:n,colliders:r})})}function D(){return e.jsx(M.Environment,{frames:1,children:e.jsx(ve,{})})}const Me=[2,0,2,0,2,0,2,0];function ve({positions:t=Me}){return e.jsxs(e.Fragment,{children:[e.jsx(M.Lightformer,{intensity:5,"rotation-x":Math.PI/2,position:[0,5,-9],scale:[10,10,1]}),e.jsx("group",{rotation:[0,.5,0],children:e.jsx("group",{children:t.map((n,r)=>e.jsx(M.Lightformer,{form:"circle",intensity:5,rotation:[Math.PI/2,0,0],position:[n,4,r*4],scale:[3,1,1]},r))})}),e.jsx(M.Lightformer,{intensity:40,"rotation-y":Math.PI/2,position:[-5,1,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{intensity:20,"rotation-y":-Math.PI,position:[-5,-2,-1],scale:[20,.1,1]}),e.jsx(M.Lightformer,{"rotation-y":Math.PI/2,position:[-5,-1,-1],scale:[20,.5,1],intensity:5}),e.jsx(M.Lightformer,{"rotation-y":-Math.PI/2,position:[10,1,0],scale:[20,1,1],intensity:10}),e.jsx(M.Lightformer,{form:"ring",color:"white",intensity:5,scale:10,position:[-15,4,-18],target:[0,0,0]})]})}const z={attach:"material",color:"#009f4d",opacity:.2,depthTest:!1,depthWrite:!1,transparent:!0,polygonOffset:!0};function Se({safetyZones:t,dhParameters:n,...r}){const o=l.useMemo(()=>L.dhParametersToPlaneSize(n??[]),[n]),a=(c,s)=>{var p,y;if(!((p=s==null?void 0:s.pose)!=null&&p.position)||!((y=s==null?void 0:s.pose)!=null&&y.orientation))return null;const g=new w.Vector3(s.pose.position[0]/1e3,s.pose.position[1]/1e3,s.pose.position[2]/1e3),i=new w.Vector3(s.pose.orientation[0],s.pose.orientation[1],s.pose.orientation[2]);let m;const u=s.shape.shape_type==="plane"?{...z,side:w.DoubleSide}:{...z,side:w.FrontSide};switch(s.shape.shape_type){case"plane":m=e.jsx("planeGeometry",{args:[o,o]});break;case"sphere":{const x=(s==null?void 0:s.shape).radius/1e3;m=e.jsx("sphereGeometry",{args:[x]});break}case"capsule":{const x=(s==null?void 0:s.shape).radius/1e3,f=(s==null?void 0:s.shape).cylinder_height/1e3;m=e.jsx("capsuleGeometry",{args:[x,f]});break}case"convex_hull":{const x=(s==null?void 0:s.shape).vertices.map(h=>new w.Vector3(h[0]/1e3,h[1]/1e3,h[2]/1e3)),f=L.verticesToCoplanarity(x);if(f.isCoplanar&&f.normal){const j=new w.Vector3().addVectors(x[0],f.normal.multiplyScalar(1e-4));x.push(j)}try{m=e.jsx("primitive",{object:new O.ConvexGeometry(x),attach:"geometry"})}catch(h){return console.log("Error creating ConvexGeometry:",h),null}break}case"rectangular_capsule":{const x=s.shape,f=x.radius/1e3,h=x.sphere_center_distance_x/1e3,j=x.sphere_center_distance_y/1e3,S=f*2;m=e.jsx("primitive",{object:new O.RoundedBoxGeometry(h,j,S,2,f),attach:"geometry"});break}default:console.warn("Unsupported safety zone shape type:",s.shape.shape_type),m=null}return e.jsxs("mesh",{renderOrder:c,position:g,quaternion:L.orientationToQuaternion(i),children:[m,e.jsx("meshStandardMaterial",{...u,polygonOffsetFactor:-c})]},`safety-zone-${s.shape.shape_type}-${c}`)},d=l.useMemo(()=>Object.values(t??{}).map((c,s)=>a(s,c)),[t,o]);return e.jsx("group",{...r,children:d})}function _e({trajectory:t,...n}){const r=(t==null?void 0:t.map(o=>{if(o.position&&o.position.length>=3){const[a,d,c]=o.position;if(Number.isFinite(a)&&Number.isFinite(d)&&Number.isFinite(c))return new w.Vector3(a/1e3,c/1e3,-d/1e3)}return null}).filter(o=>o!==null))||[];return e.jsx("group",{...n,children:r.length>0&&e.jsx(M.Line,{points:r,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}const V=new Map;async function G(t,n){if(V.has(t))return V.get(t);const r=(async()=>{var c;const o=n||"",a=new R.Nova({instanceUrl:o}),d=a.api.motionGroupModels;(c=d.axios)!=null&&c.interceptors&&d.axios.interceptors.request.use(s=>{var g;return(g=s.url)!=null&&g.includes("/glb")&&(s.responseType="blob"),s});try{const s=await a.api.motionGroupModels.getMotionGroupGlbModel(t);return URL.createObjectURL(s)}catch(s){throw console.error("Failed to fetch model:",s),s}})();return V.set(t,r),r}function te(t){function n(r){return r.children.length===0?[r]:[r,...r.children.flatMap(o=>n(o))]}return n(t).filter(r=>ne(r))}function re(t){return t.name.endsWith("_FLG")}function ne(t){return/_J[0-9]+$/.test(t.name)}function Te(t,n){let r;function o(a){if(re(a)){if(r)throw Error(`Found multiple flange groups in robot model ${n}; first ${r.name} then ${a.name}. Only one _FLG group is allowed.`);r=a}ne(a),a.children.map(o)}if(o(t.scene),!r)throw Error(`No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`);return{gltf:t}}const se=l.forwardRef(function({rapidlyChangingMotionState:n,dhParameters:r,onRotationChanged:o,children:a},d){const c=l.useRef(null),s=l.useRef([]),g=l.useRef(null),{invalidate:i}=k.useThree(),m=l.useRef(n);m.current=n,l.useEffect(()=>{const f=n.joint_position.filter(h=>h!==void 0);return g.current=new E.ValueInterpolator(f,{tension:120,friction:20,threshold:.001}),()=>{var h;(h=g.current)==null||h.destroy()}},[]),k.useFrame((f,h)=>{if(!g.current)return;s.current.length===0&&c.current&&p();const j=g.current.update(h);y(),j||i()});function u(f){c.current=f,f&&p()}function p(){c.current&&(s.current=te(c.current),y(),i())}l.useImperativeHandle(d,()=>({recollectJoints:p}));function y(){var h;const f=((h=g.current)==null?void 0:h.getCurrentValues())||[];if(o)o(s.current,f);else for(const[j,S]of s.current.entries()){const T=r[j],F=T.theta||0,B=T.reverse_rotation_direction?-1:1;S.rotation.y=B*(f[j]||0)+F}}function x(f){var j;const h=f.joint_position.filter(S=>S!==void 0);(j=g.current)==null||j.setTarget(h),i()}return E.useAutorun(()=>{x(m.current)}),l.useEffect(()=>{x(n)},[n]),e.jsx("group",{ref:u,children:a})}),Le="line",ke="mesh";function Ee({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef([]),d=l.useRef([]);l.useEffect(()=>{a.current=new Array(n.length).fill(null),d.current=new Array(n.length).fill(null)},[n.length]);function c(i,m){const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;o.decompose(u,p,y);const x=u.clone(),f=new b.Matrix4().makeRotationY(i.theta+m*(i.reverse_rotation_direction?-1:1)).multiply(new b.Matrix4().makeTranslation(0,i.d/1e3,0)).multiply(new b.Matrix4().makeTranslation(i.a/1e3,0,0)).multiply(new b.Matrix4().makeRotationX(i.alpha));return o.multiply(f),o.decompose(u,p,y),{a:x,b:u}}function s(i,m,u,p){if(!n)return;const y=n[i];if(!y)return;const{a:x,b:f}=c(y,p);m.geometry.setPositions([x.toArray(),f.toArray()].flat()),u.position.set(f.x,f.y,f.z)}function g(i,m){o.identity();for(let u=0;u<Math.min(i.length,m.length);u++){const p=a.current[u],y=d.current[u];p&&y&&s(u,p,y,m[u])}}return e.jsx(se,{rapidlyChangingMotionState:t,dhParameters:n,onRotationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]}),n==null?void 0:n.map((i,m)=>{const{a:u,b:p}=c(i,t.joint_position[m]??0),y=`dhrobot_J0${m}`;return e.jsxs("group",{name:y,children:[e.jsx(M.Line,{ref:x=>{a.current[m]=x},name:Le,points:[u,p],color:"white",lineWidth:5}),e.jsxs("mesh",{ref:x=>{d.current[m]=x},name:ke,position:p,children:[e.jsx("sphereGeometry",{args:[.01,32,32]}),e.jsx("meshStandardMaterial",{color:"black",depthTest:!0})]},`mesh_${m}`)]},y)})]})})}const Ge=console.warn;function oe(){return l.useEffect(()=>{console.warn=t=>{t!=="Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"&&Ge(t)}},[]),null}function Ce(t){return t.type==="Mesh"}function Ie({url:t,flangeRef:n,postModelRender:r,...o}){const a=M.useGLTF(t),c=Te(a,"robot.glb").gltf,s=l.useCallback(i=>{i&&r&&r()},[r]);function g(i){try{return Ce(i)?i.geometry?e.jsx("mesh",{name:i.name,geometry:i.geometry,material:i.material,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation},i.uuid):e.jsx("group",{name:i.name,position:i.position,rotation:i.rotation,ref:re(i)?n:void 0,children:i.children.map(g)},i.uuid)}catch(m){return console.warn("Error rendering node",i.name,m),null}}return e.jsx("group",{...o,dispose:null,ref:s,children:g(c.scene)})}function ie({modelURL:t,flangeRef:n,postModelRender:r,...o}){const[a,d]=l.useState(null);return l.useEffect(()=>{let c=!1;return(async()=>{try{const g=typeof t=="string"?t:await t;c||d(i=>i===g?i:g)}catch(g){console.error("Failed to resolve model URL:",g)}})(),()=>{c=!0}},[t]),a?e.jsx(Ie,{url:a,flangeRef:n,postModelRender:r,...o}):null}const ae=(t,n)=>{t.userData.isGhost||(t.traverse(r=>{if(r instanceof w.Mesh){r.material instanceof w.Material&&(r.material.colorWrite=!1);const o=r.clone(),a=r.clone();o.material=new w.MeshStandardMaterial({depthTest:!0,depthWrite:!0,colorWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,side:w.DoubleSide}),o.userData.isGhost=!0,a.material=new w.MeshStandardMaterial({color:n,opacity:.3,depthTest:!0,depthWrite:!1,transparent:!0,polygonOffset:!0,polygonOffsetFactor:-2,side:w.DoubleSide}),a.userData.isGhost=!0,r.parent&&(r.parent.add(o),r.parent.add(a))}}),t.userData.isGhost=!0)},ce=t=>{if(!t.userData.isGhost)return;const n=[];t.traverse(r=>{var o;r instanceof w.Mesh&&((o=r.userData)!=null&&o.isGhost?n.push(r):r.material instanceof w.Material&&(r.material.colorWrite=!0))}),n.forEach(r=>{r.parent&&r.parent.remove(r)}),t.userData.isGhost=!1},J=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useRef(null),p=l.useCallback(h=>{m(h)},[]),y=l.useCallback(()=>{var h;(h=u.current)==null||h.recollectJoints(),d==null||d()},[d]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const x=l.useMemo(()=>{const h=o(n,s);if(!h)throw new Error(`No model found for robot "${n}". Ensure the model is available or provide a custom getModel function.`);return h},[n,s,o]),f=e.jsx(Ee,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:f,onError:h=>{console.warn(h)},children:[e.jsx(l.Suspense,{fallback:f,children:e.jsx("group",{ref:p,children:e.jsx(se,{ref:u,rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:x,postModelRender:y,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function ue({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){return t.dhParameters?e.jsx(J,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:t.modelFromController||"",dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):null}const Ae=L.externalizeComponent(xe.observer(({robotName:t,programState:n,safetyState:r,operationMode:o,driveToHomeEnabled:a=!1,onDriveToHomePress:d,onDriveToHomeRelease:c,connectedMotionGroup:s,robotComponent:g=ue,customContentComponent:i,className:m})=>{var H;const u=he.useTheme(),{t:p}=ye.useTranslation(),[y,x]=l.useState(!1),f=l.useRef(null),h=l.useRef(null),[j,S]=l.useState(!1),[T,F]=l.useState({width:400,height:600}),[B,pe]=l.useState(0);l.useEffect(()=>{const P=()=>{if(h.current){const{offsetWidth:Y,offsetHeight:Q}=h.current;S(Y>Q),F({width:Y,height:Q})}};P();const $=new ResizeObserver(P);return h.current&&$.observe(h.current),()=>{$.disconnect()}},[]);const N=l.useCallback(()=>{pe(P=>P+1)},[]),C=l.useCallback(()=>{!a||!d||(x(!0),d())},[a,d]),I=l.useCallback(()=>{!a||!c||(x(!1),c())},[a,c]),W=l.useCallback(()=>{y&&c&&(x(!1),c())},[y,c]),_=j?T.width<350:T.height<200,A=j?T.height<310:T.height<450;return e.jsx(me,{ref:h,className:m,sx:{width:"100%",height:"100%",display:"flex",flexDirection:j?"row":"column",position:"relative",overflow:"hidden",minWidth:{xs:180,sm:220,md:250},minHeight:j?{xs:200,sm:240,md:260}:{xs:150,sm:180,md:220},border:`1px solid ${u.palette.divider}`,borderRadius:"18px",boxShadow:"none",backgroundColor:((H=u.palette.backgroundPaperElevation)==null?void 0:H[8])||"#292B3F",backgroundImage:"none"},children:j?e.jsxs(e.Fragment,{children:[e.jsx(v,{sx:{flex:"0 0 50%",position:"relative",height:"100%",minHeight:"100%",maxHeight:"100%",borderRadius:1,m:{xs:1.5,sm:2,md:3},mr:{xs:.75,sm:1,md:1.5},overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute",top:0,left:0},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{sx:{flex:"1",display:"flex",flexDirection:"column",justifyContent:"flex-start",width:_?"100%":"50%"},children:[e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pb:{xs:1,sm:1.5,md:2},textAlign:"left"},children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsxs(v,{sx:{p:{xs:1.5,sm:2,md:3},pt:0,flex:"1",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[!A&&i&&e.jsxs(v,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{mt:!A&&i?"auto":0},children:e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:{xs:1,sm:1.5,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:C,onMouseUp:I,onMouseLeave:W,onTouchStart:C,onTouchEnd:I,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})})]})]})]}):e.jsx(e.Fragment,{children:e.jsxs(v,{sx:{p:3,height:"100%",display:"flex",flexDirection:"column"},children:[e.jsxs(v,{children:[e.jsx(K,{variant:"h6",component:"h2",sx:{mb:1},children:t}),e.jsx(E.ProgramStateIndicator,{programState:n,safetyState:r,operationMode:o})]}),e.jsx(v,{sx:{flex:_?0:1,position:"relative",minHeight:_?0:{xs:120,sm:150,md:200},height:_?0:"auto",borderRadius:1,overflow:"hidden",display:_?"none":"block"},children:!_&&e.jsxs(k.Canvas,{orthographic:!0,camera:{position:[3,2,3],zoom:1},shadows:!0,frameloop:"demand",style:{borderRadius:u.shape.borderRadius,width:"100%",height:"100%",background:"transparent",position:"absolute"},dpr:[1,2],gl:{alpha:!0,antialias:!0},children:[e.jsx(D,{}),e.jsx(M.Bounds,{fit:!0,clip:!0,observe:!0,margin:1,maxDuration:1,children:e.jsx(g,{connectedMotionGroup:s,postModelRender:N})})]})}),e.jsxs(v,{children:[!A&&i&&e.jsxs(e.Fragment,{children:[e.jsx(i,{}),e.jsx(Z,{sx:{mt:1,mb:0,borderColor:u.palette.divider,opacity:.5}})]}),e.jsx(v,{sx:{display:"flex",justifyContent:"flex-start",mt:!A&&i?{xs:1,sm:2,md:5}:{xs:.5,sm:1,md:2},mb:{xs:.5,sm:.75,md:1}},children:e.jsx(X,{ref:f,variant:"contained",color:"secondary",size:"small",disabled:!a,onMouseDown:C,onMouseUp:I,onMouseLeave:W,onTouchStart:C,onTouchEnd:I,sx:{textTransform:"none",px:1.5,py:.5},children:p("RobotCard.DriveToHome.bt")})})]})]})})})})),Pe=Array(6).fill(2*Math.PI);function le({rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:r,children:o}){const a=l.useRef([]),d=l.useRef([]),c=l.useRef(null),{invalidate:s}=k.useThree();l.useEffect(()=>{const u=t.joint_position.filter(p=>p!==void 0);return c.current=new E.ValueInterpolator(u,{tension:120,friction:20,threshold:.001}),()=>{var p;(p=c.current)==null||p.destroy()}},[]),k.useFrame((u,p)=>{if(c.current){const y=c.current.update(p);i(),y||s()}});function g(u){u&&(d.current=te(u),i(),s())}function i(){var p;const u=((p=c.current)==null?void 0:p.getCurrentValues())||[];if(r)r(d.current,u);else for(const[y,x]of d.current.entries()){const h=n[y].reverse_rotation_direction?-1:1;x.position.y=h*(u[y]||0)/1e3}}const m=l.useCallback(()=>{const u=t.joint_position.filter(p=>p!==void 0);requestAnimationFrame(()=>{var p;a.current=u,(p=c.current)==null||p.setTarget(u)})},[t]);return l.useEffect(()=>{m()},[t,m]),E.useAutorun(()=>{m()}),e.jsx("group",{ref:g,children:o})}function fe({rapidlyChangingMotionState:t,dhParameters:n,...r}){const o=new b.Matrix4,a=l.useRef(null),d=l.useRef(null);function c(i){const m=new b.Matrix4;for(let x=0;x<n.length;x++){const f=n[x],h=i[x]??0,j=new b.Matrix4().makeRotationY(f.theta).multiply(new b.Matrix4().makeTranslation(f.a/1e3,(f.d+h*(f.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(f.alpha));m.multiply(j)}const u=new b.Vector3,p=new b.Quaternion,y=new b.Vector3;return m.decompose(u,p,y),u}const s=c(t.joint_position);function g(i,m){o.identity();let u=new b.Vector3;for(let f=0;f<n.length;f++){const h=m[f]??0,j=n[f],S=new b.Matrix4().makeRotationY(j.theta).multiply(new b.Matrix4().makeTranslation(j.a/1e3,(j.d+h*(j.reverse_rotation_direction?-1:1))/1e3,0)).multiply(new b.Matrix4().makeRotationX(j.alpha));o.multiply(S)}const p=new b.Vector3,y=new b.Quaternion,x=new b.Vector3;if(o.decompose(p,y,x),u=p,a.current&&a.current.position.set(u.x,u.y,u.z),d.current){const f=d.current.geometry;f!=null&&f.setPositions&&f.setPositions([0,0,0,u.x,u.y,u.z])}}return e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:n,onTranslationChanged:g,children:e.jsxs("group",{...r,name:"Scene",children:[e.jsxs("mesh",{name:"Base",position:[0,0,0],children:[e.jsx("sphereGeometry",{args:[.02,32,32]}),e.jsx("meshStandardMaterial",{color:"green",depthTest:!0})]}),e.jsx(M.Line,{ref:d,points:[new b.Vector3(0,0,0),s],color:"White",lineWidth:5}),e.jsxs("mesh",{ref:a,name:"TCP",position:s,children:[e.jsx("sphereGeometry",{args:[.025,32,32]}),e.jsx("meshStandardMaterial",{color:"red",depthTest:!0})]})]})})}const U=L.externalizeComponent(({rapidlyChangingMotionState:t,modelFromController:n,dhParameters:r,getModel:o=G,flangeRef:a,postModelRender:d,transparentColor:c,instanceUrl:s,...g})=>{const[i,m]=l.useState(null),u=l.useCallback(y=>{m(y)},[]);l.useEffect(()=>{i&&(c?ae(i,c):ce(i))},[i,c]);const p=e.jsx(fe,{rapidlyChangingMotionState:t,dhParameters:r,...g});return e.jsxs(ee.ErrorBoundary,{fallback:p,onError:y=>{console.warn(y)},children:[e.jsx(l.Suspense,{fallback:p,children:e.jsx("group",{ref:u,children:e.jsx(le,{rapidlyChangingMotionState:t,dhParameters:r,children:e.jsx(ie,{modelURL:(()=>{const y=o(n,s);if(!y){const x=new Blob([],{type:"model/gltf-binary"}),f=new File([x],`${n}.glb`,{type:"model/gltf-binary"});return Promise.resolve(URL.createObjectURL(f))}return y})(),postModelRender:d,flangeRef:a,...g})})})}),e.jsx(oe,{})]})});function Fe({connectedMotionGroup:t,getModel:n=G,flangeRef:r,transparentColor:o,postModelRender:a,...d}){if(!t.dhParameters)return null;const c=t.modelFromController||"";return c&&n(c)?e.jsx(U,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:c,dhParameters:t.dhParameters,getModel:n,flangeRef:r,transparentColor:o,postModelRender:a,...d}):e.jsx(fe,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,dhParameters:t.dhParameters,...d})}const q={[R.Manufacturer.Abb]:[0,0,0,0,Math.PI/2,0,0],[R.Manufacturer.Fanuc]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Yaskawa]:[0,0,0,0,-Math.PI/2,0,0],[R.Manufacturer.Kuka]:[0,-Math.PI/2,Math.PI/2,0,Math.PI/2,0,0],[R.Manufacturer.Universalrobots]:[0,-Math.PI/2,-Math.PI/2,-Math.PI/2,Math.PI/2,-Math.PI/2,0],[R.Manufacturer.Staubli]:[0,-Math.PI/2,Math.PI/2,0,0,0,0]};function de(t){const[n]=t.split("_");switch(n){case"ABB":return R.Manufacturer.Abb;case"FANUC":return R.Manufacturer.Fanuc;case"YASKAWA":return R.Manufacturer.Yaskawa;case"KUKA":return R.Manufacturer.Kuka;case"UniversalRobots":return R.Manufacturer.Universalrobots;case"STAUBLI":return R.Manufacturer.Staubli;default:return null}}function Ve(t,n){const r=de(t);return r&&r in q?q[r]:n||null}const Oe=L.externalizeComponent(t=>{const{inverseSolver:n,dhParameters:r,...o}=t,[a,d]=l.useState(R.JointTypeEnum.RevoluteJoint);l.useEffect(()=>{r.length&&d(r[0].type??R.JointTypeEnum.RevoluteJoint)},[r]);const c=l.useMemo(()=>n===null&&a===R.JointTypeEnum.RevoluteJoint,[n,a]),s=l.useMemo(()=>n===null&&a===R.JointTypeEnum.PrismaticJoint,[n,a]);return l.useMemo(()=>!!n,[n])||c?e.jsx(J,{dhParameters:r,...o}):s?e.jsx(U,{dhParameters:r,...o}):null});exports.CollisionSceneRenderer=Re;exports.LinearAxis=Fe;exports.MANUFACTURER_HOME_CONFIGS=q;exports.MotionGroupVisualizer=Oe;exports.PresetEnvironment=D;exports.Robot=ue;exports.RobotCard=Ae;exports.SafetyZonesRenderer=Se;exports.SupportedLinearAxis=U;exports.SupportedRobot=J;exports.TrajectoryRenderer=_e;exports.defaultAxisConfig=Pe;exports.defaultGetModel=G;exports.extractManufacturer=de;exports.getDefaultHomeConfig=Ve;
@@ -0,0 +1,4 @@
1
+ "use strict";const o=require("react/jsx-runtime"),D=require("@mui/material/styles"),Ke=require("@mui/material/TextField"),et=require("@mui/material/AppBar"),Ae=require("@mui/material/Backdrop"),T=require("@mui/material/Box"),G=require("@mui/material/IconButton"),tt=require("@mui/material/Menu"),H=require("@mui/material/MenuItem"),nt=require("@mui/material/Toolbar"),R=require("@mui/material/Typography"),O=require("mobx-react-lite"),h=require("react"),B=require("./externalizeComponent-OO4jcrz5.cjs"),ot=require("@mui/material/SvgIcon"),N=require("@mui/material/Fade"),it=require("@mui/x-charts/Gauge"),L=require("react-i18next"),ee=require("./interpolation-C9sLsved.cjs"),rt=require("@mui/icons-material/Clear"),at=require("@mui/icons-material/FilterList"),Ie=require("@mui/icons-material/Search"),V=require("@mui/material/Divider"),$=require("@mui/x-data-grid"),st=require("@mui/icons-material/OpenWith"),lt=require("@mui/icons-material/Share"),_=require("@mui/material/Stack"),Oe=require("@mui/material/Tab"),De=require("@mui/material/Tabs"),q=require("@wandelbots/nova-js/v2"),he=require("lodash-es"),k=require("mobx"),J=require("@wandelbots/nova-js"),de=require("three/src/math/Vector3.js"),Je=require("@mui/material/CircularProgress"),ct=require("@mui/material/utils"),dt=require("./SafetyBar-VvOZ9aRM.cjs"),ut=require("@mui/material/Alert"),gt=require("@mui/material/AlertTitle"),Y=require("@mui/material/Button"),Me=require("@mui/material/ToggleButton"),W=require("./robot-SEtfVAmf.cjs"),pt=require("lodash-es/isEqual.js"),ht=require("@mui/material/InputAdornment"),mt=require("@mui/material/FormControl"),ft=require("@mui/material/InputLabel"),xt=require("@mui/material/Select"),oe=require("lodash-es/keyBy.js"),bt=require("lodash-es/uniqueId.js"),yt=require("@mui/material/ToggleButtonGroup"),Fe=require("@mui/material/Slider"),St=require("lodash-es/isNumber.js"),jt=require("@mui/icons-material/ChevronLeft"),Ct=require("@mui/icons-material/ChevronRight"),vt=require("lodash-es/throttle.js"),Tt=require("@mui/material/Tooltip"),wt=require("@mui/icons-material/ContentCopy"),It=require("@mui/icons-material/DescriptionOutlined"),Mt=require("@mui/icons-material/ExpandLess"),kt=require("@mui/icons-material/ExpandMore"),Rt=require("@mui/material/Paper"),Et=require("@mui/material/Dialog"),Pt=require("@mui/material/DialogActions"),_t=require("@mui/material/DialogContent"),At=require("@mui/material/DialogTitle"),Ot=require("@mui/icons-material/Error"),Dt=require("@mui/material/Chip"),Jt=require("@mui/material/Fab"),Ft=require("@mui/material/Badge"),Bt=require("@mui/x-charts"),ue=require("three"),Lt=require("@wandelbots/design-tokens/mui"),U=require("@wandelbots/design-tokens");require("@mui/x-data-grid/themeAugmentation");function $t(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,a.get?a:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const ke=$t(ue),zt=D.styled(Ke,{shouldForwardProp:t=>t!=="adornedSize"})(({theme:t,adornedSize:e="medium"})=>({"&.MuiTextField-root":{".MuiInputBase-root":{background:t.palette.secondary.dark,borderRadius:"10px"},".MuiInputBase-input":{"&::placeholder":{opacity:"1",color:t.palette.text.disabled}},".MuiInputBase-root .MuiInputBase-input":{padding:e==="small"?"8px 16px":"16px 14px"},".MuiFormLabel-root + .MuiInputBase-root .MuiInputBase-input":{padding:e==="small"?"8px 16px":"24px 14px 8px"},label:{transform:"translate(14px, 8px) scale(0.75)"},":hover":{fieldset:{border:`1px solid ${t.palette.action.hover}`}},".Mui-focused":{fieldset:{border:`1px solid ${t.palette.primary.main}`,legend:{width:0}}},fieldset:{borderRadius:"10px",border:"1px solid transparent",legend:{width:0}}}})),qt=({adornedSize:t="medium",...e})=>{var n;return o.jsx(zt,{adornedSize:t,...e,slotProps:{...e.slotProps,inputLabel:{...(n=e.slotProps)==null?void 0:n.inputLabel,shrink:!0}}})},Vt=t=>o.jsx(ot,{...t,viewBox:"0 0 10 8",children:o.jsx("path",{d:"M8.825 0.9125L5 4.72917L1.175 0.9125L0 2.0875L5 7.0875L10 2.0875L8.825 0.9125Z",fill:"currentColor",fillOpacity:"0.56"})}),Nt=B.externalizeComponent(O.observer(t=>{const{appIcon:e,appName:n,apps:a=[],onAppSelect:r,disabled:i=!1,sx:c}=t,[s,l]=h.useState(null),d=!!s,m=u=>{l(u.currentTarget)},g=()=>{l(null)},p=u=>{g(),u.onClick?u.onClick():u.href&&(window.location.href=u.href),r==null||r(u)};return o.jsxs(o.Fragment,{children:[o.jsx(et,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...c},children:o.jsxs(nt,{sx:{minHeight:"62px !important"},children:[o.jsx(T,{sx:{mr:1,display:"flex",alignItems:"center"},children:e}),o.jsxs(T,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[o.jsx(R,{component:"h1",sx:{fontWeight:"bold",fontSize:"1rem"},children:n}),a.length>0&&o.jsx(G,{color:"inherit","aria-label":"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:m,disabled:i,sx:{ml:1,width:28,height:28,borderRadius:"6px",padding:0,backgroundColor:u=>D.alpha(u.palette.common.white,.1),opacity:1,"&:hover":{backgroundColor:u=>D.alpha(u.palette.common.white,.16)},"& .MuiSvgIcon-root":{fontSize:"8px",width:"8px",height:"6px"}},children:o.jsx(Vt,{})})]})]})}),o.jsx(Ae,{open:d,onClick:g,sx:{backdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.3)",zIndex:u=>u.zIndex.modal-1}}),o.jsx(tt,{id:"app-menu",anchorEl:s,open:d,onClose:g,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:u=>u.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:a.map(u=>o.jsxs(H,{onClick:()=>p(u),children:[o.jsx(T,{sx:{display:"flex",alignItems:"center"},children:u.icon}),o.jsx(R,{variant:"body1",sx:{ml:2},children:u.name})]},u.id))})]})})),Wt=t=>{const e=Math.floor(t/86400),n=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),r=t%60,i=[];return e>0?(i.push(e.toString()),i.push(n.toString().padStart(2,"0")),i.push(a.toString().padStart(2,"0")),i.push(r.toString().padStart(2,"0"))):n>0?(i.push(n.toString()),i.push(a.toString().padStart(2,"0")),i.push(r.toString().padStart(2,"0"))):(i.push(a.toString()),i.push(r.toString().padStart(2,"0"))),i.join(":")},z=(t,e)=>{const n=Math.floor(t/86400),a=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;if(typeof Intl<"u"&&"DurationFormat"in Intl)try{const s={};return n>0&&(s.days=n),a>0&&(s.hours=a),r>0&&(s.minutes=r),(i>0||Object.keys(s).length===0)&&(s.seconds=i),new Intl.DurationFormat(e,{style:"narrow"}).format(s)}catch{}const c=[];return n>0&&c.push(`${n}d`),a>0&&c.push(`${a}h`),r>0&&c.push(`${r}m`),(i>0||c.length===0)&&c.push(`${i}s`),c.join(" ")},Gt=(t,e,n)=>t==="countdown"&&n!==null?Math.min(100,e/n*100):t==="measuring"?e/60%1*100:0,Ut=({timerState:t,animationState:e,hasError:n,className:a})=>{var x,v;const{t:r,i18n:i}=L.useTranslation(),c=D.useTheme(),{currentState:s,remainingTime:l,maxTime:d,currentProgress:m}=t,{showErrorAnimation:g,showPauseAnimation:p,showPulsatingText:u,pulsatingFinished:b,showLabels:S,showMainText:y,showIdlePulsating:f,idleDotsCount:j}=e;return o.jsxs(T,{className:a,sx:{position:"relative",width:264,height:264,display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx(it.Gauge,{width:264,height:264,value:s==="idle"?0:m,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:p||g?.6:1,transition:"opacity 0.5s ease-out","& .MuiGauge-valueArc":{fill:n?c.palette.error.light:c.palette.success.main,transition:"fill 0.5s ease-out"},"& .MuiGauge-referenceArc":{fill:(x=c.palette.backgroundPaperElevation)==null?void 0:x[2],stroke:"transparent",strokeWidth:0,transition:"fill 0.5s ease-out, stroke 0.5s ease-out, stroke-width 0.5s ease-out"},"& .MuiGauge-valueText":{display:"none"},"& .MuiGauge-text":{display:"none"}}}),o.jsxs(T,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:225,height:225,borderRadius:"50%",backgroundColor:(v=c.palette.backgroundPaperElevation)==null?void 0:v[8],display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",gap:1,transition:"background-color 0.5s ease-out"},children:[o.jsx(T,{sx:{height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:1},children:o.jsx(N,{in:S&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(R,{variant:"body2",sx:{fontSize:"12px",color:s==="measured"&&(u||b)?c.palette.success.main:c.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:o.jsx("span",{style:{opacity:s==="measured"&&b?u?1:.6:1,transition:"opacity 2s ease-in-out"},children:s==="measuring"||s==="measured"?r("CycleTimer.CycleTime.lb","Cycle Time"):s==="countdown"?r("CycleTimer.RemainingTime.lb","Remaining Time"):""})})})}),o.jsxs(T,{sx:{position:"relative",height:"48px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:.5},children:[o.jsx(N,{in:y&&s==="idle"&&!n,timeout:200,children:o.jsxs(R,{variant:"body2",sx:{position:"absolute",fontSize:"12px",fontWeight:400,color:c.palette.text.secondary,lineHeight:"166%",letterSpacing:"0.17px",textAlign:"center",width:"200px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx("span",{style:{opacity:f?1:.6,transition:"opacity 2s ease-in-out"},children:r("CycleTimer.WaitingForCycle.lb","Waiting for program cycle")}),o.jsx("span",{style:{display:"inline-block",width:"18px",textAlign:"left",opacity:f?1:.6,transition:"opacity 2s ease-in-out"},children:".".repeat(j)})]})}),o.jsx(N,{in:y&&n,timeout:200,children:o.jsx(R,{variant:"h3",sx:{position:"absolute",fontSize:"40px",fontWeight:400,color:c.palette.text.primary,lineHeight:"116.7%"},children:r("CycleTimer.Error.lb","Error")})}),o.jsx(N,{in:y&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(R,{variant:"h1",sx:{position:"absolute",fontSize:"48px",fontWeight:500,color:c.palette.text.primary,lineHeight:1,transition:"color 0.8s ease-in-out"},children:o.jsx("span",{style:{opacity:1,transition:"opacity 2s ease-in-out"},children:Wt(l)})})})]}),o.jsx(T,{sx:{height:"16px",display:"flex",marginTop:.5,alignItems:"center",justifyContent:"center"},children:o.jsx(N,{in:S&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(R,{variant:"body2",sx:{fontSize:"12px",color:s==="measured"&&(u||b)?c.palette.success.main:c.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:o.jsx("span",{style:{opacity:s==="measured"&&b?u?1:.6:1,transition:"opacity 2s ease-in-out"},children:s==="measuring"?r("CycleTimer.Measuring.lb","measuring..."):s==="measured"?r("CycleTimer.Determined.lb","determined"):s==="countdown"&&d!==null?r("CycleTimer.OfTime.lb",{time:z(d,i.language)}):""})})})})]})]})},Ht=({timerState:t,animationState:e,hasError:n,compact:a,className:r})=>{const{t:i,i18n:c}=L.useTranslation(),s=D.useTheme(),{currentState:l,remainingTime:d,maxTime:m}=t,{showErrorAnimation:g,showPauseAnimation:p,showPulsatingText:u,pulsatingFinished:b,showIdlePulsating:S,idleDotsCount:y}=e;return a&&l==="idle"?o.jsx(T,{className:r,sx:{display:"flex",alignItems:"center",m:0},children:o.jsx(R,{variant:"body2",sx:{color:n?s.palette.error.light:s.palette.text.primary,fontSize:"14px",transition:"color 0.5s ease-out"},children:n?i("CycleTimer.Error.lb","Error"):l==="idle"?"0s":z(d,c.language)})}):o.jsxs(T,{className:r,sx:{display:"flex",alignItems:"center",m:0,gap:1},children:[!(l==="idle"&&a)&&o.jsx(T,{sx:{width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",opacity:p||g?.6:1,transition:"opacity 0.5s ease-out"},children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",style:{transform:"rotate(-90deg)"},role:"img","aria-label":"Timer progress",children:[o.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?s.palette.error.light:l==="measured"?u||b?s.palette.success.main:s.palette.text.secondary:s.palette.success.main,strokeWidth:"2",opacity:l==="measured"&&b?u?1:.6:.3,style:{transition:"stroke 0.8s ease-in-out, opacity 2s ease-in-out"}}),o.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?s.palette.error.light:l==="measured"?u||b?s.palette.success.main:s.palette.text.secondary:s.palette.success.main,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*8}`,strokeDashoffset:`${2*Math.PI*8*(1-(l==="idle"?0:t.currentProgress)/100)}`,style:{opacity:l==="measured"&&b?u?1:.6:1,transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),o.jsx(R,{variant:"body2",sx:{color:n?s.palette.error.light:l==="idle"?s.palette.text.secondary:l==="measured"?u||b?s.palette.success.main:s.palette.text.secondary:s.palette.text.primary,fontSize:"14px",lineHeight:"normal",letterSpacing:"normal",opacity:l==="idle"?S?1:.6:l==="measured"&&b?u?1:.6:1,transition:"color 0.8s ease-in-out, font-size 0.3s ease-out, opacity 2s ease-in-out"},children:n?i("CycleTimer.Error.lb","Error"):l==="idle"?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:i("CycleTimer.WaitingForCycle.lb","Waiting for program cycle")}),o.jsx("span",{style:{display:"inline-block",width:"18px",textAlign:"left"},children:".".repeat(y)})]}):l==="measuring"?a?z(d,c.language):`${z(d,c.language)} / ${i("CycleTimer.Measuring.lb","measuring...")}`:l==="measured"?a?z(d,c.language):`${z(d,c.language)} / ${i("CycleTimer.Determined.lb","determined")}`:l==="countdown"&&m!==null?a?z(d,c.language):`${z(d,c.language)} / ${i("CycleTimer.Time.lb",{time:z(m,c.language)})}`:z(d,c.language)})]})},Yt=()=>{const[t,e]=h.useState({showPauseAnimation:!1,showErrorAnimation:!1,showPulsatingText:!1,pulsatingFinished:!1,showLabels:!0,showMainText:!0,showIdlePulsating:!1,idleDotsCount:0}),n=h.useRef(null),a=h.useRef(null),r=h.useRef(null),i=h.useRef(null),c=h.useRef(0),s=h.useRef(null),l=h.useRef(null),d=h.useCallback(()=>{e(x=>({...x,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(x=>({...x,showPauseAnimation:!1}))},800)},[]),m=h.useCallback(()=>{e(x=>({...x,showErrorAnimation:!0})),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{e(x=>({...x,showErrorAnimation:!1}))},600)},[]),g=h.useCallback(()=>{e(x=>({...x,showErrorAnimation:!1})),a.current&&clearTimeout(a.current)},[]),p=h.useCallback(x=>{c.current=0,e(v=>({...v,showPulsatingText:!0,pulsatingFinished:!1})),setTimeout(()=>{e(v=>({...v,pulsatingFinished:!0})),r.current=setInterval(()=>{e(v=>({...v,showPulsatingText:!v.showPulsatingText}))},2e3),x&&x()},800)},[]),u=h.useCallback(()=>{r.current&&(clearInterval(r.current),r.current=null),e(x=>({...x,showPulsatingText:!1,pulsatingFinished:!1})),c.current=0},[]),b=h.useCallback(()=>{e(x=>({...x,showIdlePulsating:!0})),s.current=setInterval(()=>{e(x=>({...x,showIdlePulsating:!x.showIdlePulsating}))},2e3),l.current=setInterval(()=>{e(x=>({...x,idleDotsCount:(x.idleDotsCount+1)%4}))},800)},[]),S=h.useCallback(()=>{s.current&&(clearInterval(s.current),s.current=null),l.current&&(clearInterval(l.current),l.current=null),e(x=>({...x,showIdlePulsating:!1,idleDotsCount:0}))},[]),y=h.useCallback(()=>{e(x=>({...x,showLabels:!1,showMainText:!1})),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{e(x=>({...x,showLabels:!0,showMainText:!0}))},200)},[]),f=h.useCallback(()=>{e(x=>({...x,showLabels:!0,showMainText:!0}))},[]),j=h.useCallback(()=>{n.current&&clearTimeout(n.current),a.current&&clearTimeout(a.current),i.current&&clearTimeout(i.current),r.current&&clearInterval(r.current),s.current&&clearInterval(s.current),l.current&&clearInterval(l.current)},[]);return{animationState:t,triggerPauseAnimation:d,triggerErrorAnimation:m,clearErrorAnimation:g,startPulsatingAnimation:p,stopPulsatingAnimation:u,startIdleAnimations:b,stopIdleAnimations:S,triggerFadeTransition:y,setInitialAnimationState:f,cleanup:j}},Zt=({autoStart:t,onCycleEnd:e,onMeasuringComplete:n,hasError:a,onPauseAnimation:r,onErrorAnimation:i,onClearErrorAnimation:c,onStartPulsating:s})=>{const[l,d]=h.useState({currentState:"idle",remainingTime:0,maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),m=h.useRef(null),g=h.useRef(null),p=h.useRef(0),[u]=ee.useInterpolation([0],{tension:80,friction:18,onChange:([C])=>{d(w=>({...w,currentProgress:C}))}}),b=h.useCallback(()=>{d(C=>({...C,currentState:"idle",maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0})),p.current=0,g.current=null,u.setImmediate([0])},[u]),S=h.useCallback((C=0)=>{const w=C/60%1*100;d(I=>({...I,currentState:"measuring",maxTime:null,remainingTime:C,isPausedState:!1,currentProgress:w})),p.current=0,u.setImmediate([w]),t?(g.current=Date.now()-C*1e3,d(I=>({...I,isRunning:!0}))):g.current=null},[t,u]),y=h.useCallback((C,w=0)=>{d(M=>({...M,isRunning:!1})),g.current=null,d(M=>({...M,currentState:"countdown",maxTime:C,isPausedState:!1})),p.current=0;const I=Math.max(0,C-w),E=w>0?w/C*100:0;d(M=>({...M,remainingTime:I,currentProgress:E})),u.setImmediate([E]),I===0?(d(M=>({...M,isRunning:!1})),g.current=null,e&&queueMicrotask(()=>e())):t?setTimeout(()=>{g.current=Date.now()-w*1e3,d(M=>({...M,isRunning:!0}))},0):g.current=null},[t,e,u]),f=h.useCallback(()=>{d(C=>({...C,isRunning:!1,currentState:"measured"})),g.current=null,s(()=>{n&&n()})},[s,n]),j=h.useCallback(()=>{if(g.current&&l.isRunning){const w=Date.now()-g.current;p.current+=w;const I=p.current/1e3,E=Gt(l.currentState,I,l.maxTime);u.setTarget([E])}d(C=>({...C,isRunning:!1,isPausedState:!0})),r()},[l.isRunning,l.currentState,l.maxTime,u,r]),x=h.useCallback(()=>{l.isPausedState&&(l.remainingTime>0||l.currentState!=="countdown")&&(g.current=Date.now(),d(C=>({...C,isRunning:!0,isPausedState:!1})))},[l.isPausedState,l.remainingTime,l.currentState]),v=h.useCallback(()=>l.isPausedState,[l.isPausedState]);return h.useEffect(()=>{a?(l.isRunning&&!l.isPausedState&&(d(C=>({...C,wasRunningBeforeError:!0})),j()),i()):(l.wasRunningBeforeError&&l.isPausedState&&(d(C=>({...C,wasRunningBeforeError:!1})),x()),c())},[a,l.isRunning,l.isPausedState,l.wasRunningBeforeError,j,x,i,c]),h.useEffect(()=>{if(l.isRunning){const C=()=>{if(g.current){const I=(Date.now()-g.current+p.current)/1e3;if(l.currentState==="countdown"&&l.maxTime!==null){const E=Math.max(0,l.maxTime-I);d(P=>({...P,remainingTime:Math.ceil(E)}));const M=Math.min(100,I/l.maxTime*100);if(u.setTarget([M]),E<=0){d(P=>({...P,isRunning:!1,remainingTime:0})),g.current=null,u.setTarget([100]),e&&queueMicrotask(()=>e());return}}else if(l.currentState==="measuring"){d(M=>({...M,remainingTime:Math.floor(I)}));const E=I/60%1*100;u.setTarget([E])}l.isRunning&&(m.current=requestAnimationFrame(C))}};m.current=requestAnimationFrame(C)}else m.current&&(cancelAnimationFrame(m.current),m.current=null);return()=>{m.current&&cancelAnimationFrame(m.current)}},[l.isRunning,e,l.currentState,l.maxTime,u]),h.useEffect(()=>{let C=null;const w=()=>{u.update(1/60),C=requestAnimationFrame(w)};return C=requestAnimationFrame(w),()=>{C&&cancelAnimationFrame(C)}},[u]),{timerState:l,controls:{startNewCycle:y,startMeasuring:S,setIdle:b,completeMeasuring:f,pause:j,resume:x,isPaused:v}}},Xt=B.externalizeComponent(O.observer(({onCycleComplete:t,onCycleEnd:e,onMeasuringComplete:n,autoStart:a=!0,variant:r="default",compact:i=!1,className:c,hasError:s=!1})=>{const l=h.useRef(void 0),{animationState:d,triggerPauseAnimation:m,triggerErrorAnimation:g,clearErrorAnimation:p,startPulsatingAnimation:u,stopPulsatingAnimation:b,startIdleAnimations:S,stopIdleAnimations:y,triggerFadeTransition:f,setInitialAnimationState:j,cleanup:x}=Yt(),{timerState:v,controls:C}=Zt({autoStart:a,onCycleEnd:e,onMeasuringComplete:n,hasError:s,onPauseAnimation:m,onErrorAnimation:g,onClearErrorAnimation:p,onStartPulsating:u});return h.useEffect(()=>{const w=l.current;l.current!==void 0&&w!==v.currentState?(w==="measured"&&b(),w==="idle"&&y(),f()):j(),v.currentState==="idle"&&S(),l.current=v.currentState},[v.currentState,b,y,S,f,j]),h.useEffect(()=>{let w=!0;const I=setTimeout(()=>{w&&t(C)},0);return()=>{w=!1,clearTimeout(I)}},[t,C]),h.useEffect(()=>x,[x]),r==="small"?o.jsx(Ht,{timerState:v,animationState:d,hasError:s,compact:i,className:c}):o.jsx(Ut,{timerState:v,animationState:d,hasError:s,className:c})})),Be=B.externalizeComponent(O.observer(({data:t,columns:e,getRowData:n,onRowClick:a,selectedItem:r,getItemId:i,title:c,showCount:s=!0,searchPlaceholder:l="Search programs",dataGridProps:d,CustomToolbar:m,selectFirstByDefault:g=!1,sx:p})=>{var E;const u=D.useTheme(),b=$.useGridApiRef(),S=h.useRef(null),[y,f]=h.useState(null),j=h.useMemo(()=>t.map(n),[t,n]);h.useEffect(()=>{b.current&&j.length>0&&b.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:e.map(M=>M.field)})},[j,e,b]),h.useEffect(()=>{if(!S.current||!b.current)return;const M=new ResizeObserver(()=>{setTimeout(()=>{b.current&&j.length>0&&b.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:e.map(P=>P.field)})},100)});return M.observe(S.current),()=>{M.disconnect()}},[b,j.length,e]);const x=h.useMemo(()=>{if(r!==void 0)return r;if(y!==null)return y;if(g&&t.length>0){const M=t[0];return f(M),M}return null},[g,t,r,y]),v=M=>{const P=t.find(F=>n(F).id===M.id);P&&(r===void 0&&f(P),a&&a(P,M))},C=h.useMemo(()=>!x||!i?null:i(x),[x,i]);function w(){return o.jsx($.Toolbar,{children:o.jsxs(T,{sx:{display:"flex",width:"100%",gap:1,p:.5,alignItems:"center"},children:[c&&o.jsxs(R,{variant:"h6",sx:{fontWeight:500,color:"white"},children:[c,s&&` (${t.length})`]}),o.jsxs(T,{sx:{ml:"auto",display:"flex",gap:.5,alignItems:"center",pr:1},children:[o.jsx($.FilterPanelTrigger,{render:o.jsx($.ToolbarButton,{"aria-label":"Show filters",children:o.jsx(at,{fontSize:"small"})})}),o.jsx(V,{orientation:"vertical",flexItem:!0,sx:{height:"24px",alignSelf:"center"}}),o.jsx($.QuickFilter,{render:(M,P)=>{var F;return o.jsxs(T,{...M,sx:{display:"flex",overflow:"hidden"},children:[!P.expanded&&o.jsx($.QuickFilterTrigger,{render:o.jsx($.ToolbarButton,{"aria-label":"Search",children:o.jsx(Ie,{fontSize:"small"})})}),o.jsxs(T,{sx:{display:"flex",overflow:"hidden",transition:"all 0.3s ease-in-out",width:P.expanded?"200px":"0px",position:"relative"},children:[o.jsxs(T,{sx:{flex:1,position:"relative","& .MuiInputBase-root":{height:"32px",borderRadius:"16px",backgroundColor:(F=u.palette.backgroundPaperElevation)==null?void 0:F[2],paddingLeft:"40px",paddingRight:P.expanded&&P.value!==""?"40px":"12px",color:"white",fontSize:"14px",border:"none !important",outline:"none !important",boxShadow:"none !important","&::before":{display:"none !important",border:"none !important"},"&::after":{display:"none !important",border:"none !important"},"&:hover":{"&::before":{display:"none !important",border:"none !important"},"&::after":{display:"none !important",border:"none !important"}},"&:focus-within":{outline:"none !important",boxShadow:"none !important","&::before":{display:"none !important",border:"none !important"},"&::after":{display:"none !important",border:"none !important"}},"&.Mui-focused":{outline:"none !important",boxShadow:"none !important","&::before":{display:"none !important",border:"none !important"},"&::after":{display:"none !important",border:"none !important"}},"& .MuiInputBase-input":{padding:"8px 0",border:"none !important",outline:"none !important",boxShadow:"none !important","&:focus":{outline:"none !important",boxShadow:"none !important",border:"none !important"},"&::placeholder":{color:"rgba(255, 255, 255, 0.3)",opacity:1}},"& fieldset":{border:"none !important",display:"none !important"},"& .MuiOutlinedInput-notchedOutline":{border:"none !important",display:"none !important"}}},children:[P.expanded&&o.jsx(Ie,{fontSize:"small",sx:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:"rgba(255, 255, 255, 0.6)",zIndex:1,pointerEvents:"none"}}),o.jsx($.QuickFilterControl,{placeholder:l})]}),P.expanded&&P.value!==""&&o.jsx($.QuickFilterClear,{render:o.jsx(T,{sx:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",zIndex:1},children:o.jsx(T,{sx:{minWidth:"24px",width:"24px",height:"24px",padding:0,color:"rgba(255, 255, 255, 0.6)","&:hover":{backgroundColor:"rgba(255, 255, 255, 0.1)"}},children:o.jsx($.ToolbarButton,{"aria-label":"Clear",children:o.jsx(rt,{fontSize:"small"})})})})})]})]})}})]})]})})}const I=m||w;return o.jsx(T,{ref:S,sx:{height:"100%",display:"flex",flexDirection:"column","& *":{scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}},"&:hover *":{scrollbarWidth:"thin",scrollbarColor:`${u.palette.divider} transparent`,"&::-webkit-scrollbar":{display:"block",width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:u.palette.divider,borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:u.palette.action.hover}},...p},children:o.jsx($.DataGrid,{apiRef:b,rows:j,columns:e,onRowClick:v,disableColumnMenu:!1,disableRowSelectionOnClick:!0,disableMultipleRowSelection:!0,hideFooterSelectedRowCount:!0,filterMode:"client",sortingOrder:["desc","asc"],hideFooter:!1,showToolbar:!0,slots:{toolbar:I},initialState:{sorting:{sortModel:[]},filter:{filterModel:{items:[]}},...d==null?void 0:d.initialState},...d,autosizeOnMount:!0,autosizeOptions:{...(d==null?void 0:d.autosizeOptions)||{},includeOutliers:!0,includeHeaders:!0,expand:!0,columns:((E=d==null?void 0:d.autosizeOptions)==null?void 0:E.columns)||e.map(M=>M.field)},sx:{border:"none",width:"100%","& .MuiPaper-root":{boxShadow:"none !important"},"& .MuiDataGrid-overlay":{},"& .MuiDataGrid-main":{border:"none","& .MuiPaper-root":{}},"& .MuiDataGrid-container--top [role=row]":{},"& .MuiDataGrid-topContainer":{borderBottom:"none !important"},"& .MuiDataGrid-columnHeaders":{border:"none",borderBottom:"none !important"},"& .MuiDataGrid-row":{cursor:a?"pointer":"default",border:"none",margin:"1px 0",position:"relative",backgroundColor:"transparent !important","&:hover":{backgroundColor:"transparent !important","&::before":{content:'""',position:"absolute",top:0,left:"16px",right:"16px",bottom:0,backgroundColor:"action.hover",borderRadius:"16px",zIndex:0}},"&.Mui-selected":{backgroundColor:"transparent !important","&:hover":{backgroundColor:"transparent !important"}},...C!==null&&{[`&[data-id="${C}"]`]:{backgroundColor:"transparent !important","&::before":{content:'""',position:"absolute",top:0,left:"16px",right:"16px",bottom:0,backgroundColor:`${u.palette.action.hover} !important`,borderRadius:"16px",zIndex:0},"&:hover":{backgroundColor:"transparent !important"},"&:hover::before":{backgroundColor:`${u.palette.divider} !important`}}}},"& .MuiDataGrid-cell--textLeft":{paddingLeft:"40px"},"& .MuiDataGrid-cell":{border:"none",position:"relative",zIndex:1,"&:focus":{outline:"none"},"&:focus-within":{outline:"none"},"&:hover":{backgroundColor:"transparent !important"}},"& .MuiDataGrid-columnHeader":{border:"none",paddingLeft:"40px",paddingRight:"40px","& .MuiDataGrid-columnHeaderTitle":{color:"rgba(255, 255, 255, 0.6)"}},"& .MuiDataGrid-toolbarContainer":{padding:"8px",border:"none !important",borderBottom:"none !important","& .MuiBox-root":{},"& .MuiFormControl-root":{},"& .MuiInputBase-root":{},"& .MuiPaper-root":{boxShadow:"none !important"},"& *":{borderBottom:"none !important"}},"& .MuiDataGrid-toolbar":{borderBottom:"none !important"},"& .MuiDataGrid-toolbarFilterList":{border:"none"},"& .MuiDataGrid-withBorderColor":{borderColor:"transparent !important"},"& .MuiDataGrid-columnSeparator":{display:"none"},"& .MuiDataGrid-footerContainer":{display:"none"},"& .MuiDataGrid-filler":{border:"none !important",borderTop:"none !important",borderBottom:"none !important",borderLeft:"none !important",borderRight:"none !important","--rowBorderColor":"none !important"},"& .MuiBackdrop-root":{},"& .MuiModal-backdrop":{},...d==null?void 0:d.sx}})})}));Be.displayName="WandelbotsDataGrid";const ge=B.externalizeComponent(O.observer(({colors:t,label:e,getDisplayedValue:n,startJogging:a,stopJogging:r,disabled:i,activeJoggingDirection:c,...s})=>{var x,v,C,w,I,E,M;ee.useAnimationFrame(()=>{const P=n(),F=p.current;F&&(F.textContent=P)});const l=D.useTheme(),[d,m]=h.useState(null);h.useEffect(()=>{i&&j()},[i]);const g=c||d,p=h.useRef(null);t||(t={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const u=g?(x=t.buttonBackgroundColor)==null?void 0:x.pressed:t.borderColor,b={width:"55px",color:t.color,path:{fill:t.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},S={...b,backgroundColor:(v=t.buttonBackgroundColor)==null?void 0:v.default,":hover":{backgroundColor:(C=t.buttonBackgroundColor)==null?void 0:C.hovered},":active":{backgroundColor:(w=t.buttonBackgroundColor)==null?void 0:w.pressed,color:t.backgroundColor,path:{fill:t.backgroundColor}},":disabled":{backgroundColor:(I=t.buttonBackgroundColor)==null?void 0:I.disabled,"svg path":{fill:l.palette.action.disabled}}},y={...b,backgroundColor:(E=t.buttonBackgroundColor)==null?void 0:E.pressed,color:t.backgroundColor,path:{fill:t.backgroundColor},":disabled":{backgroundColor:(M=t.buttonBackgroundColor)==null?void 0:M.pressed,"svg path":{fill:l.palette.action.disabled}}};function f(P,F){i||P.button===0&&(m(F),a(F))}function j(){m(null),r()}return o.jsxs(_,{height:"64px",direction:"row",justifyContent:"center",...s,children:[o.jsx(G,{disabled:i,disableRipple:!0,onPointerDown:P=>f(P,"-"),onPointerUp:j,onPointerOut:j,size:"large",sx:{...g==="-"?y:S,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${u??"#fff"}`,borderBottom:`2px solid ${u??"#fff"}`,borderTop:`2px solid ${u??"#fff"}`},children:o.jsx(W.ForwardRef$3,{})}),o.jsxs(_,{spacing:"6px",sx:{width:"150px",backgroundColor:t.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${u??"#fff"}`,borderTop:`2px solid ${u??"#fff"}`},children:[o.jsx(_,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:t.color,".MuiTypography-root":{fontWeight:700,...i?{color:l.palette.action.disabled}:{}},...i?{"svg path":{fill:l.palette.action.disabled}}:{}},children:e}),o.jsx(R,{height:"22px",sx:{fontSize:"15px",color:i?l.palette.action.disabled:t.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:p,children:n()})]}),o.jsx(G,{disableRipple:!0,disabled:i,onPointerDown:P=>f(P,"+"),onPointerUp:j,onPointerOut:j,size:"large",sx:{...g==="+"?y:S,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${u??"#fff"}`,borderBottom:`2px solid ${u??"#fff"}`,borderTop:`2px solid ${u??"#fff"}`},children:o.jsx(W.ForwardRef$4,{})})]})})),Le=B.externalizeComponent(O.observer(({startJogging:t,stopJogging:e,lowerLimit:n,upperLimit:a,useDegree:r,getValue:i,disabled:c,...s})=>{var w,I,E,M,P,F,Z,ne,ye,Se,je,Ce,ve,Te,we;const{t:l}=L.useTranslation(),[d,m]=h.useState(),g=D.useTheme(),p={background:(w=g.palette.backgroundPaperElevation)==null?void 0:w[4],color:(I=g.palette.backgroundPaperElevation)==null?void 0:I[11]},u=O.useLocalObservable(()=>({activeJoggingDir:null,startJogging(A){this.activeJoggingDir=A,t(A)},stopJogging(){this.activeJoggingDir=null,e()}})),b=vt(()=>{const A=r?S(i()):i();(A===void 0||d===void 0||Math.abs(d-A)>1e-9)&&m(A)},50);ee.useAnimationFrame(b);function S(A){if(A!==void 0)return J.radiansToDegrees(A)}function y(A){A.button===0&&u.startJogging("-")}function f(A){A.button===0&&u.startJogging("+")}function j(A){u.stopJogging()}function x(A){u.stopJogging()}function v(A,X=1){if(A===void 0||Number.isNaN(A))return"";const Q=l("General.degree.variable",{amount:A.toFixed(X)});return A>0&&X===0?`+${Q}`:Q}function C(A,X=1){if(A===void 0||Number.isNaN(A))return"";const Q=l("General.mm.variable",{amount:A.toFixed(X)});return A>0&&X===0?`+${Q}`:Q}return o.jsxs(_,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...s,sx:{"& .MuiIconButton-root":{width:"52px",color:g.palette.text.primary,alignContent:"center",backgroundColor:(E=g.palette.backgroundPaperElevation)==null?void 0:E[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(M=g.palette.backgroundPaperElevation)==null?void 0:M[11],color:g.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(P=g.palette.backgroundPaperElevation)==null?void 0:P[9]},"&:active":{...p}}},children:[o.jsx(G,{onPointerDown:y,onPointerUp:j,onPointerOut:x,disabled:c,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...u.activeJoggingDir==="-"?p:{}},children:o.jsx(jt,{sx:{pointerEvents:"none",color:(ye=(ne=(Z=(F=g.componentsExt)==null?void 0:F.JoggingPanel)==null?void 0:Z.JoggingJoint)==null?void 0:ne.Joint)==null?void 0:ye.arrowColor}})}),o.jsxs(_,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(Se=g.palette.backgroundPaperElevation)==null?void 0:Se[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[o.jsx(R,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:c?g.palette.action.disabled:g.palette.text.primary},children:r?v(d):C(d)}),o.jsx(Fe,{disabled:!0,"aria-label":"Joint position",min:r?S(n):n,max:r?S(a):a,value:d||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:c?g.palette.action.disabled:g.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:c?g.palette.action.disabled:g.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(je=g.palette.backgroundPaperElevation)==null?void 0:je[5],opacity:1}},marks:n!==void 0&&a!==void 0&&[{value:r?S(n):n,label:r?v(S(n),0):C(n)},{value:r?S(a):a,label:r?v(S(a),0):C(a)}]})]}),o.jsx(G,{onPointerDown:f,onPointerUp:j,onPointerOut:x,disabled:c,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...u.activeJoggingDir==="+"?p:{}},children:o.jsx(Ct,{sx:{pointerEvents:"none",color:(we=(Te=(ve=(Ce=g.componentsExt)==null?void 0:Ce.JoggingPanel)==null?void 0:ve.JoggingJoint)==null?void 0:Te.Joint)==null?void 0:we.arrowColor}})})]})}));function me(t,e,n){if(e.length!==t.length)return!0;for(let a=0;a<e.length;a++)if(Math.abs(e[a]-t[a])>n)return!1;return!0}function $e(t,e,n){if(t===void 0&&e||t&&e===void 0||(t==null?void 0:t.orientation)===void 0||(e==null?void 0:e.orientation)===void 0||(t==null?void 0:t.position)===void 0||(e==null?void 0:e.position)===void 0)return!1;if(t===void 0||e===void 0)return!0;let a=0;return a+=Math.abs(t.orientation[0]-e.orientation[0]),a+=Math.abs(t.orientation[1]-e.orientation[1]),a+=Math.abs(t.orientation[2]-e.orientation[2]),a+=Math.abs(t.position[0]-e.position[0]),a+=Math.abs(t.position[1]-e.position[1]),a+=Math.abs(t.position[2]-e.position[2]),a<=n}function fe(t,e,n){return t.coordinate_system===e.coordinate_system&&t.tcp===e.tcp&&$e(t.tcp_pose,e.tcp_pose,n)}function ze(t,e){const n=new ue.Vector3(e[0],e[1],e[2]),a=new ue.Vector3(t[0],t[1],t[2]),r=n.length(),i=n.normalize();let c=a.length(),s=a.normalize();s.dot(i)<0&&(c=-c,s=s.multiplyScalar(-1));let l=c-r;return l-=2*Math.PI*Math.floor((l+Math.PI)/(2*Math.PI)),c=r+l,[...s.multiplyScalar(c)]}function Qt(t){return"cellId"in t.api}function re(t){if(!Qt(t))return t;const e=t,n=e.api.cellId,a=new Proxy(e.api,{get(r,i){const c=Reflect.get(r,i);return!c||typeof c!="object"?c:new Proxy(c,{get(s,l){const d=Reflect.get(s,l);return typeof d!="function"?d:(...m)=>m.length>0&&m[0]===n?d.apply(s,m.slice(1)):d.apply(s,m)}})}});return new Proxy(e,{get(r,i){return i==="api"?a:i==="openReconnectingWebsocket"?c=>r.openReconnectingWebsocket(c.replace(/^\/cells\/[^/]+/,"")):Reflect.get(r,i)}})}const Re=1e-4;class se{constructor(e,n,a,r,i,c,s="cell"){this.controller=n,this.motionGroup=a,this.description=r,this.initialMotionState=i,this.motionStateSocket=c,this.cellId=s,this.nova=re(e),this.rapidlyChangingMotionState=i,c.addEventListener("message",l=>{var p;const d=(p=J.tryParseJson(l.data))==null?void 0:p.result;if(!d)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${l.data}`);me(this.rapidlyChangingMotionState.joint_position,d.joint_position,Re)||k.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=d.joint_position}),fe(this.rapidlyChangingMotionState,d,Re)||k.runInAction(()=>{var u,b,S;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=d.tcp_pose:(u=d.tcp_pose)!=null&&u.orientation&&((b=d.tcp_pose)!=null&&b.position)&&((S=this.rapidlyChangingMotionState.tcp_pose)!=null&&S.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:d.tcp_pose.position,orientation:ze(d.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:console.warn("Received incomplete tcp_pose, ignoring",d.tcp_pose)}),d.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==d.tcp&&k.runInAction(()=>{this.rapidlyChangingMotionState.tcp=d.tcp}),this.rapidlyChangingMotionState.standstill!==d.standstill&&k.runInAction(()=>{this.rapidlyChangingMotionState.standstill=d.standstill});const m=this.rapidlyChangingMotionState.joint_limit_reached.limit_reached,g=d.joint_limit_reached.limit_reached;m.some((u,b)=>u!==g[b])&&k.runInAction(()=>{this.rapidlyChangingMotionState.joint_limit_reached=d.joint_limit_reached}),this.rapidlyChangingMotionState.execute!==d.execute&&k.runInAction(()=>{this.rapidlyChangingMotionState.execute=d.execute})}),k.makeAutoObservable(this)}static async open(e,n,a={}){var b;const r=re(e),i=a.cellId??"cell",[c,s]=n.split("@"),l=await r.api.controller.getCurrentRobotControllerState(i,s),d=l==null?void 0:l.motion_groups.find(S=>S.motion_group===n);if(!l||!d)throw new Error(`Controller ${s} or motion group ${n} not found`);const m=r.openReconnectingWebsocket(`/cells/${i}/controllers/${s}/motion-groups/${n}/state-stream`),g=await m.firstMessage(),p=(b=J.tryParseJson(g.data))==null?void 0:b.result;if(!p)throw new Error(`Unable to parse initial motion state message ${g.data}`);console.log(`Connected motion state websocket to motion group ${d.motion_group}. Initial state:
2
+ `,p);const u=await r.api.motionGroup.getMotionGroupDescription(i,s,d.motion_group);return new se(r,l,d,u,p,m,i)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get joints(){return this.initialMotionState.joint_position.map((e,n)=>({index:n}))}dispose(){this.motionStateSocket.close()}}const Ee="Movement request rejected. Another client is currently executing a 'Jogging' motion!";class le{constructor(e,n={}){this.motionStream=e,this.options=n,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.tcp=(n==null?void 0:n.tcp)||e.motionGroup.tcp||this.getDefaultTcp(e),this.orientation=(n==null?void 0:n.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(n==null?void 0:n.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(n==null?void 0:n.mode)||this.DEFAULT_MODE,this.onError=n==null?void 0:n.onError}static async open(e,n,a={}){const r=await se.open(e,n,{cellId:a.cellId}),i=new le(r,a);return await i.setJoggingMode(i.mode),i}getDefaultTcp(e){var a,r;const n=(r=(a=e.description.dh_parameters)==null?void 0:a[0])==null?void 0:r.type;return e.joints.length<6&&(n===q.JointTypeEnum.RevoluteJoint||n===q.JointTypeEnum.PrismaticJoint)?this.NO_TCP:this.DEFAULT_TCP}async setOptions(e){e.tcp&&(this.tcp=e.tcp),e.orientation&&(this.orientation=e.orientation),e.timeout&&(this.timeout=e.timeout),e.mode&&(this.mode=e.mode),e.onError&&(this.onError=e.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 e=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:e})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const e=[this.joggingSocket,this.trajectorySocket].filter(n=>n!==null);return e.forEach(n=>{n.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(e.map(n=>n.closed()))}async setJoggingMode(e,n=!0){if(!(this.mode===e&&n)&&(this.dispose(),this.mode=e,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((e,n)=>{const a=setTimeout(()=>{n(new Error(`Jogging initialization timeout after ${this.timeout} seconds`))},this.timeout);this.joggingSocket=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`),this.joggingSocket.addEventListener("message",r=>{var c,s,l,d;const i=J.tryParseJson(r.data);if(((c=i==null?void 0:i.result)==null?void 0:c.kind)==="INITIALIZE_RECEIVED"){clearTimeout(a),e();return}if(((s=i==null?void 0:i.result)==null?void 0:s.kind)==="MOTION_ERROR")if(clearTimeout(a),this.onBlocked&&((l=i==null?void 0:i.result)!=null&&l.message.includes(Ee))){(d=this.joggingSocket)==null||d.dispose(),this.onBlocked();return}else this.onError?this.onError(r.data):n(new Error(r.data))}),this.joggingSocket.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,...this.tcp?{tcp:this.tcp}:{}})})}async rotateJoints({joint:e,direction:n,velocityValue:a,velocityUnit:r}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const i=new Array(this.numJoints).fill(0);i[e]=n==="-"?-a:a,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:i})}async translateTCP({axis:e,direction:n,velocityMmPerSec:a}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const r=[0,0,0],i=[0,0,0];i[J.XYZ_TO_VECTOR[e]]=n==="-"?-a:a,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:i,rotation:r,use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:e,direction:n,velocityRadsPerSec:a}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const r=[0,0,0],i=[0,0,0];r[J.XYZ_TO_VECTOR[e]]=n==="-"?-a:a,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:i,rotation:r,use_tool_coordinate_system:this.orientation==="tool"})}async runIncrementalCartesianMotion({currentTcpPose:e,currentJoints:n,velocityInRelevantUnits:a,axis:r,direction:i,motion:c}){const s=[];if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(c.type==="translate"){if(!e.position)throw new Error("Current pose has no position, cannot perform translation");const y=[...e.position];y[J.XYZ_TO_VECTOR[r]]+=c.distanceMm*(i==="-"?-1:1),s.push({limits_override:{tcp_velocity_limit:a},path:{path_definition_name:"PathLine",target_pose:{position:y,orientation:e.orientation}}})}else if(c.type==="rotate"){if(!e.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const y=new de.Vector3(e.orientation[0],e.orientation[1],e.orientation[2]),f=y.length(),j=y.clone().normalize(),x=c.distanceRads*(i==="-"?-1:1),v=new de.Vector3(0,0,0);v[r]=1;const C=Math.cos(.5*x)*Math.cos(.5*f),w=Math.sin(.5*x)*Math.sin(.5*f),I=Math.sin(.5*x)*Math.cos(.5*f),E=Math.cos(.5*x)*Math.sin(.5*f),M=v.dot(j),P=v.clone().cross(j),F=2*Math.acos(C-w*M),Z=F/Math.sin(.5*F),ne=new de.Vector3().addScaledVector(P,w).addScaledVector(v,I).addScaledVector(j,E).multiplyScalar(Z);s.push({limits_override:{tcp_orientation_velocity_limit:a},path:{path_definition_name:"PathLine",target_pose:{position:e.position,orientation:[...ne]}}})}const l=this.motionStream.description;if(l.cycle_time===void 0){console.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const d={motion_group_model:l.motion_group_model,cycle_time:l.cycle_time,mounting:l.mounting,global:l.operation_limits.auto_limits},m=await this.nova.api.trajectoryPlanning.planTrajectory(this.cellId,{motion_group_setup:d,start_joint_position:n,motion_commands:s}),g=m.response;if(!g)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(m)}`);this.trajectorySocket&&(console.warn("Trajectory jogging websocket already open; will close"),this.trajectorySocket.dispose()),this.trajectorySocket=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);const p=y=>{var f;if(!y||y.add_trajectory_error||y.message)if(this.onError)this.onError(y);else throw new Error(((f=y==null?void 0:y.add_trajectory_error)==null?void 0:f.message)||(y==null?void 0:y.message)||"Failed to execute trajectory, unknown error");if(!this.trajectorySocket)throw new Error("Failed to execute trajectory, websocket not available anymore");this.trajectorySocket.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})},u=async()=>{var y;await k.when(()=>!this.motionStream.rapidlyChangingMotionState.standstill),await k.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(y=this.trajectorySocket)==null||y.dispose(),this.trajectorySocket=null},b=async()=>{var y;await k.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(y=this.trajectorySocket)==null||y.dispose(),this.trajectorySocket=null},S=async y=>{if(y!=null&&y.message)if(this.onError){this.onError(y);return}else throw new Error(y.message||"Failed to execute trajectory, unknown error");this.motionStream.rapidlyChangingMotionState.standstill?await u():await b()};this.trajectorySocket.addEventListener("message",y=>{var j,x;const f=J.tryParseJson(y.data);if(!((j=f==null?void 0:f.result)!=null&&j.kind))throw new Error(`Failed to execute trajectory: Received invalid message ${y.data}`);if(this.onBlocked&&((x=f.result.message)!=null&&x.includes(Ee))){this.onBlocked();return}if(f.result.kind==="INITIALIZE_RECEIVED")p(f.result);else if(f.result.kind==="START_RECEIVED")S(f);else if(f.result.kind!=="PAUSE_RECEIVED")if(f.result.kind==="MOTION_ERROR"&&f.result.message)if(this.onError){this.onError(f);return}else throw new Error(f.result.message);else throw new Error(`Failed to execute trajectory, cannot handle message type "${f.result.kind}"`)}),this.trajectorySocket.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:g,tcp:this.tcp}})}}const qe=t=>{const e=t.softTimeout||3e3,[n,a]=h.useState(!1),r=D.useTheme();return h.useEffect(()=>{const i=setTimeout(()=>{a(!0)},e);return()=>clearTimeout(i)}),o.jsx(_,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:r.palette.text.primary},children:t.error?o.jsx(Ve,{loadingMessage:t.message,error:t.error}):o.jsxs(o.Fragment,{children:[o.jsx(Je,{sx:{marginBottom:"24px"}}),!!t.message&&o.jsx("div",{children:t.message}),o.jsx(_,{sx:{visibility:n?"visible":"hidden",marginTop:"1rem",color:r.palette.text.secondary},children:"This is taking longer than expected..."})]})})},Ve=t=>{const e=dt.makeErrorMessage(t.error),n=t.error instanceof Error?t.error.stack:null,a=D.useTheme();return o.jsxs(_,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",padding:2,overflow:"auto",color:a.palette.error.main,"& pre":{whiteSpace:"pre-wrap",wordBreak:"break-word",paddingBottom:"3rem"}},children:[(t.loadingMessage?`Error while ${he.lowerFirst(ct.capitalize(t.loadingMessage))} - `:"")+e,o.jsx("br",{}),n&&o.jsx("pre",{children:n})]})},Kt=O.observer(({store:t})=>{const{t:e}=L.useTranslation();return o.jsx(Ae,{"data-testid":"jogging-blocked","aria-label":"jogging-blocked",open:!0,sx:{position:"absolute",zIndex:n=>n.zIndex.drawer+1,color:"#fff",background:"rgba(15, 15, 15, 0.88)",justifyContent:"flex-start",alignItems:"flex-start"},children:o.jsxs(_,{sx:{m:2,width:"100%"},children:[o.jsxs(ut,{severity:"error",sx:{mb:2},children:[o.jsx(gt,{children:e("Jogging.Blocked.ti")}),e("Jogging.Blocked.lb")]}),o.jsx(Y,{variant:"contained",color:"secondary",onClick:()=>t.unblock(),children:e("Jogging.Blocked.Reenable.bt")})]})})}),Ne=O.observer(({store:t})=>{const{t:e}=L.useTranslation(),[n,a]=h.useState(t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),r=h.useRef(n);ee.useAnimationFrame(()=>{const c=t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;pt(r.current,c)||(r.current=c,a(c))});const i=[];for(const[c,s]of n.entries())s&&i.push(c);return o.jsx(T,{sx:{display:"flex",flexDirection:"row",justifyContent:"center"},children:o.jsx(R,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2,visibility:i.length?"visible":"hidden"},children:e("Jogging.JointLimitsReached.lb",{jointNumbers:i.map(c=>c+1).join(", ")})})})}),en=D.styled(mt)(({theme:t})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:t.palette.text.primary}}}}));function ie({labelValue:t,...e}){return o.jsxs(en,{fullWidth:!0,variant:"filled",children:[o.jsx(ft,{id:e.labelId,children:t}),o.jsx(xt,{...e})]})}const pe=[{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}],tn=[{id:"continuous"},...pe],nn=["coordsys","tool"];class ce{constructor(e,n,a,r,i){var c,s,l;this.jogger=e,this.coordSystems=n,this.motionGroupDescription=a,this.tcps=r,this.inverseSolverValue=i,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.selectedTcpId="",this.tcpChangeInProgress=!1,this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.translationVelocityMmPerSec=10,this.rotationVelocityDegPerSec=1,this.minTranslationVelocityMmPerSec=5,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=q.JointTypeEnum.RevoluteJoint;for(const d of n)if(d.coordinate_system===""){d.coordinate_system="world";break}this.selectedCoordSystemId=((c=n[0])==null?void 0:c.coordinate_system)||"world",this.selectedTcpId=e.motionStream.rapidlyChangingMotionState.tcp??"",this.tcpChangeInProgress=this.tcps.length>0&&!this.selectedTcpId,this.inverseSolver=i,this.jointType=((l=(s=a==null?void 0:a.dh_parameters)==null?void 0:s[0])==null?void 0:l.type)??q.JointTypeEnum.RevoluteJoint,k.makeAutoObservable(this,{},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()},this.loadFromLocalStorage(),this.disposers.push(k.autorun(()=>this.saveToLocalStorage())),this.disposers.push(k.autorun(()=>{const d=this.jogger.motionStream.rapidlyChangingMotionState.tcp;d&&d!==this.selectedTcpId&&k.runInAction(()=>{this.selectedTcpId=d,this.tcpChangeInProgress=!1})})),window.joggingStore=this}static async loadFor(e){const{nova:n,cellId:a}=e,[r,i]=await Promise.all([n.api.controller.listCoordinateSystems(a,e.motionStream.controllerId,"ROTATION_VECTOR"),n.api.motionGroup.getMotionGroupDescription(a,e.motionStream.controllerId,e.motionGroupId)]),c=await n.api.motionGroupModels.getMotionGroupKinematicModel(i.motion_group_model),s=Object.entries(i.tcps||{}).map(([l,d])=>({id:l,readable_name:d.name,position:d.pose.position,orientation:d.pose.orientation}));return new ce(e,r||[],i,s,c.inverse_solver)}dispose(){for(const e of this.disposers)e();this.jogger.dispose()}get coordSystemCountByName(){return he.countBy(this.coordSystems,e=>e.name)}async deactivate(){this.jogger.mode==="jogging"&&await this.jogger.setJoggingMode("off")}async activate(){return 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.activeDiscreteIncrement?this.jogger.setJoggingMode("trajectory"):this.jogger.setJoggingMode("jogging")):this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){const e=J.tryParseJson(localStorage.getItem("joggingToolStore"));e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),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(){localStorage.setItem("joggingToolStore",JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get tabs(){const e=[{id:"joint",label:"Joints"}];return this.inverseSolver!==null&&e.unshift({id:"cartesian",label:"Cartesian"}),e}get incrementOptions(){return tn}get discreteIncrementOptions(){return pe}get incrementOptionsById(){return oe(this.incrementOptions,e=>e.id)}get tabsById(){return oe(this.tabs,e=>e.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return oe(this.coordSystems,e=>e.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return oe(this.tcps,e=>e.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:pe.find(e=>e.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(e){return e?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(e){return e?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(e){return e?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(e,n){const a=this.tabs[n]||this.tabs[0];this.selectedTabId=a.id}setSelectedCoordSystemId(e){this.selectedCoordSystemId=e}setSelectedTcpId(e){this.requestTcpChange(e).catch(n=>{console.error("Failed to change TCP:",n)})}async requestTcpChange(e){if(e===this.selectedTcpId)return;this.tcpChangeInProgress=!0;const n=this.jogger.tcp,a=this.jogger.mode!=="jogging";try{this.jogger.tcp=e,a?await this.jogger.setJoggingMode("jogging"):await this.jogger.setJoggingMode("jogging",!1);let r=await this.waitForTcpConfirmation(e,1e3);a&&await this.jogger.setJoggingMode("off"),r||(r=await this.waitForTcpConfirmation(e,2e3)),k.runInAction(()=>{r?this.selectedTcpId=e:(this.jogger.tcp=n,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(r){throw a&&await this.jogger.setJoggingMode("off").catch(()=>{}),k.runInAction(()=>{this.jogger.tcp=n,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??""}),r}finally{k.runInAction(()=>{this.tcpChangeInProgress=!1})}}waitForTcpConfirmation(e,n){return new Promise(a=>{const r=setTimeout(()=>{i(),a(!1)},n),i=k.when(()=>this.jogger.motionStream.rapidlyChangingMotionState.tcp===e,()=>{clearTimeout(r),a(!0)})})}setSelectedOrientation(e){this.selectedOrientation=e}setSelectedIncrementId(e){this.selectedIncrementId=e}setCurrentIncrementJog(e){this.incrementJogInProgress=e}setVelocityFromSlider(e,n){n?this.rotationVelocityDegPerSec=e:this.translationVelocityMmPerSec=e}setSelectedCartesianMotionType(e){this.selectedCartesianMotionType=e}lock(e){this.locks.add(e)}unlock(e){this.locks.delete(e)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket()}async withMotionLock(e){const n=bt();this.lock(n);try{return await e()}finally{this.unlock(n)}}}const on=O.observer(({store:t,useDegree:e})=>{var c;const{t:n}=L.useTranslation(),a=h.useId(),r=[];function i(s){switch(s){case"coordsys":return n("Jogging.Orientation.coordsys");case"tool":return n("Jogging.Orientation.tool");default:return s}}return t.showCoordSystemSelect&&r.push(o.jsx(ie,{labelId:`jogging-coord-select-${a}`,labelValue:n("Jogging.CoordinateSystem.hlb"),value:t.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:s=>t.setSelectedCoordSystemId(s.target.value),children:t.coordSystems.map(s=>o.jsx(H,{value:s.coordinate_system,children:s.name&&t.coordSystemCountByName[s.name]>1?`${s.name} / ${s.coordinate_system}`:s.name||s.coordinate_system},s.coordinate_system))},"coord")),t.showTcpSelect&&r.push(o.jsx(ie,{labelId:`jogging-tcp-select-${a}`,labelValue:"TCP",value:t.selectedTcpId,size:"small",variant:"filled",displayEmpty:t.tcpChangeInProgress,onChange:s=>{t.requestTcpChange(s.target.value).catch(l=>{console.error("Failed to change TCP:",l)})},disabled:t.tcpChangeInProgress,endAdornment:t.tcpChangeInProgress?o.jsx(ht,{position:"end",children:o.jsx(Je,{size:16})}):void 0,children:t.tcps.map(s=>o.jsx(H,{value:s.id,children:s.id},s.id))},"tcp")),t.showOrientationSelect&&r.push(o.jsx(ie,{labelValue:n("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${a}`,value:t.selectedOrientation,onChange:s=>t.setSelectedOrientation(s.target.value),children:nn.map(s=>o.jsx(H,{value:s,children:i(s)},s))},"orientation")),t.showIncrementSelect&&r.push(o.jsxs(ie,{labelValue:n("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${a}`,size:"small",variant:"filled",value:((c=t.activeDiscreteIncrement)==null?void 0:c.id)||"continuous",onChange:s=>t.setSelectedIncrementId(s.target.value),children:[o.jsx(H,{value:"continuous",children:n("Jogging.Increment.Continuous.dd")},"continuous"),t.selectedOrientation==="tool"?null:t.discreteIncrementOptions.map(s=>o.jsx(H,{value:s.id,children:e?`${s.degrees}°`:`${s.mm}mm`},s.id))]},"increment")),o.jsx(T,{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:r.map((s,l)=>o.jsx(T,{sx:{gridColumn:r.length%2===1&&l===r.length-1?"span 2":"auto"},children:s},l))})}),rn=D.styled(yt)(({theme:t})=>{var e;return{"&.MuiToggleButtonGroup-root":{background:(e=t.palette.backgroundPaperElevation)==null?void 0:e[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"}}}}}),We=O.observer(t=>{var i,c,s;const e=D.useTheme(),{store:n}=t,{t:a}=L.useTranslation();function r(l,d){d===t.velocity||!St(d)||t.onVelocityChange(d,t.useDegree)}return o.jsxs(_,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[n.showVelocityLegend&&o.jsx(R,{sx:{color:(s=(c=(i=e.componentsExt)==null?void 0:i.JoggingPanel)==null?void 0:c.VelocitySlider)==null?void 0:s.sliderLegendColor,fontSize:"14px"},children:a("Jogging.Velocity.bt")}),o.jsx(Fe,{value:t.velocity,color:"secondary",onChange:r,min:t.min,max:t.max,"aria-labelledby":"input-slider",disabled:t.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),n.showVelocitySliderLabel&&(t.renderValue?t.renderValue(t.velocity):o.jsx(xe,{value:t.velocity.toString()}))]})});function xe({value:t,sx:e}){var a;const n=D.useTheme();return o.jsx(_,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(a=n.palette.backgroundPaperElevation)==null?void 0:a[8],borderRadius:"10px",minWidth:"111px",...e},children:o.jsx(R,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:n.palette.text.primary,whiteSpace:"nowrap"},children:t})})}const Ge=O.observer(({store:t,useDegree:e})=>{const{t:n}=L.useTranslation();function a(r,i){return i?`ω = ${n("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:r})}`:`v = ${n("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:r})}`}return o.jsx(We,{store:t,velocity:t.velocityInDisplayUnits(e),min:t.minVelocityInDisplayUnits(e),max:t.maxVelocityInDisplayUnits(e),onVelocityChange:t.setVelocityFromSlider,useDegree:e,disabled:t.isLocked,renderValue:r=>o.jsx(xe,{value:a(r,e),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),Ue=O.observer(({store:t})=>{var r,i,c;const{t:e}=L.useTranslation(),n=D.useTheme(),a=((c=(i=(r=t.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:r.details)==null?void 0:i.state)==null?void 0:c.kind)??"KIND_UNKNOWN";return o.jsxs(T,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",color:n.palette.text.primary},children:[o.jsx(R,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},children:e("Jogging.StreamStateSection.lb")}),o.jsx(R,{variant:"body2",sx:{fontSize:"0.75rem",lineHeight:1.2},"data-testid":a,children:e(`Jogging.StreamStateSection.${a}.lb`)})]})}),an=O.observer(({store:t,children:e})=>{const{t:n}=L.useTranslation(),a=D.useTheme();function r(p,u){(u==="translate"||u==="rotate")&&t.setSelectedCartesianMotionType(u)}async function i(p,u){const b=await t.activate(),S=b.motionStream.rapidlyChangingMotionState.tcp_pose,y=b.motionStream.rapidlyChangingMotionState.joint_position;S&&await t.withMotionLock(async()=>{try{t.setCurrentIncrementJog({axis:p.axis,direction:p.direction}),await t.jogger.runIncrementalCartesianMotion({currentTcpPose:S,currentJoints:y,coordSystemId:t.activeCoordSystemId,velocityInRelevantUnits:t.selectedCartesianMotionType==="translate"?t.translationVelocityMmPerSec:t.rotationVelocityRadsPerSec,axis:p.axis,direction:p.direction,motion:t.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:u.mm}:{type:"rotate",distanceRads:J.degreesToRadians(u.degrees)}})}finally{t.setCurrentIncrementJog(null),await t.deactivate()}})}async function c(p){if(!t.isLocked){if(await t.activate(),t.activeDiscreteIncrement)return i(p,t.activeDiscreteIncrement);p.motionType==="translate"?await t.jogger.translateTCP({axis:p.axis,direction:p.direction,velocityMmPerSec:t.translationVelocityMmPerSec}):await t.jogger.rotateTCP({axis:p.axis,direction:p.direction,velocityRadsPerSec:t.rotationVelocityRadsPerSec})}}async function s(){t.isLocked||t.activeDiscreteIncrement||await t.deactivate()}function l(p,u,b){var y,f,j;const S=(j=(f=(y=b.componentsExt)==null?void 0:y.JoggingPanel)==null?void 0:f.JoggingCartesian)==null?void 0:j.Axis;if(S)return u==="translate"?S[p]:S.CustomRotation??S[p]}const d=[{id:"x",icon:o.jsx(W.ForwardRef,{}),colors:l("X",t.selectedCartesianMotionType,a)},{id:"y",icon:o.jsx(W.ForwardRef$1,{}),colors:l("Y",t.selectedCartesianMotionType,a)},{id:"z",icon:o.jsx(W.ForwardRef$2,{}),colors:l("Z",t.selectedCartesianMotionType,a)}];function m(p){return n("General.mm.variable",{amount:p.toFixed(1)})}function g(p){return n("General.degree.variable",{amount:J.radiansToDegrees(p).toFixed(1)})}return o.jsxs(_,{"data-testid":"jogging-cartesian-tab","aria-label":"jogging-cartesian-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[o.jsxs(_,{gap:2,children:[o.jsx(on,{store:t,useDegree:t.selectedCartesianMotionType==="rotate"}),o.jsx(Ge,{store:t,useDegree:t.selectedCartesianMotionType==="rotate"}),o.jsx(V,{})]}),o.jsx(_,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:o.jsxs(_,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[o.jsxs(rn,{value:t.selectedCartesianMotionType,onChange:r,exclusive:!0,"aria-label":n("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[o.jsx(Me,{value:"translate",children:n("Jogging.Cartesian.Translation.bt")}),o.jsx(Me,{value:"rotate",children:n("Jogging.Cartesian.Rotation.bt")})]}),t.selectedCartesianMotionType==="translate"&&d.map(p=>{var u,b;return o.jsx(ge,{"data-testid":`jogging-cartesian-axis-control-${p.id}`,"aria-label":`jogging-cartesian-axis-control-${p.id}`,colors:p.colors,disabled:t.isLocked,activeJoggingDirection:((u=t.incrementJogInProgress)==null?void 0:u.axis)===p.id?t.incrementJogInProgress.direction:void 0,label:o.jsxs(o.Fragment,{children:[p.icon,o.jsx(R,{sx:{fontSize:"24px",color:((b=p.colors)==null?void 0:b.labelColor)??a.palette.text.primary},children:p.id.toUpperCase()})]}),getDisplayedValue:()=>{var S,y;return m(((y=(S=t.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:S.position)==null?void 0:y[J.XYZ_TO_VECTOR[p.id]])||0)},startJogging:S=>c({axis:p.id,motionType:"translate",direction:S}),stopJogging:s},p.id)}),t.selectedCartesianMotionType==="rotate"&&d.map(p=>{var u,b;return o.jsx(ge,{"data-testid":`jogging-cartesian-axis-control-${p.id}`,"aria-label":`jogging-cartesian-axis-control-${p.id}`,colors:p.colors,disabled:t.isLocked,activeJoggingDirection:((u=t.incrementJogInProgress)==null?void 0:u.axis)===p.id?t.incrementJogInProgress.direction:void 0,label:o.jsxs(o.Fragment,{children:[o.jsx(W.ForwardRef$6,{}),o.jsx(R,{sx:{fontSize:"24px",color:((b=p.colors)==null?void 0:b.labelColor)??a.palette.text.primary},children:p.id.toUpperCase()})]}),getDisplayedValue:()=>{var S,y;return g(((y=(S=t.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:S.orientation)==null?void 0:y[J.XYZ_TO_VECTOR[p.id]])||0)},startJogging:S=>c({axis:p.id,motionType:"rotate",direction:S}),stopJogging:s},p.id)})]})}),o.jsx(Ne,{store:t}),o.jsx(V,{}),o.jsx(Ue,{store:t}),e&&o.jsx(V,{}),e]})}),sn=O.observer(({store:t,children:e})=>{const n=D.useTheme();async function a(i){await t.activate(),await t.jogger.rotateJoints({joint:i.joint,direction:i.direction,velocityUnit:t.jointType===q.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:t.jointType===q.JointTypeEnum.PrismaticJoint?t.translationVelocityMmPerSec:t.rotationVelocityRadsPerSec})}async function r(){await t.jogger.stop(),await t.deactivate()}return o.jsxs(_,{"data-testid":"jogging-joint-tab","aria-label":"jogging-joint-tab",flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[o.jsx(Ge,{store:t,useDegree:t.jointType===q.JointTypeEnum.RevoluteJoint}),o.jsx(V,{}),o.jsx(_,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:o.jsx(_,{"data-testid":"jogging-joint-value-controls-wrapper","aria-label":"jogging-joint-value-controls-wrapper",alignItems:"center",gap:"24px",children:t.jogger.motionStream.joints.map(i=>{var s,l,d;const c=(d=(l=(s=t.motionGroupDescription.operation_limits.auto_limits)==null?void 0:s.joints)==null?void 0:l[i.index])==null?void 0:d.position;return o.jsxs(_,{"data-testid":`jogging-joint-value-control-${i.index}`,"aria-label":`jogging-joint-value-control-${i.index}`,direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[t.showJointsLegend&&o.jsx(R,{color:t.isLocked?n.palette.text.disabled:n.palette.text.secondary,children:`G${i.index+1}`}),o.jsx(Le,{disabled:t.isLocked,lowerLimit:c==null?void 0:c.lower_limit,upperLimit:c==null?void 0:c.upper_limit,useDegree:t.jointType===q.JointTypeEnum.RevoluteJoint,getValue:()=>{const m=t.jogger.motionStream.rapidlyChangingMotionState.joint_position[i.index];return m!==void 0?m:void 0},startJogging:m=>a({joint:i.index,direction:m}),stopJogging:r})]},`joint-${i.index}`)})})}),o.jsx(Ne,{store:t}),o.jsx(V,{}),o.jsx(Ue,{store:t}),e&&o.jsx(V,{}),e]})}),ln=B.externalizeComponent(O.observer(t=>{const e=he.isString(t.nova)?new q.Nova({instanceUrl:t.nova}):t.nova,n=O.useLocalObservable(()=>({joggingStore:null,loadingError:null}));async function a(){k.runInAction(()=>{n.loadingError=null,n.joggingStore=null});try{let r=t.store;if(!r){const i=await le.open(e,t.motionGroupId,{cellId:t.cellId});r=await ce.loadFor(i)}k.runInAction(()=>{n.joggingStore=r}),t.onSetup&&t.onSetup(r)}catch(r){n.loadingError=r}}return h.useEffect(()=>(a(),t.store?()=>null:()=>{var r;(r=n.joggingStore)==null||r.dispose()}),[t.store,t.nova,t.motionGroupId,t.cellId]),h.useEffect(()=>{const r=n.joggingStore;r&&(t.locked?r.lock("external"):r.unlock("external"))},[n.joggingStore,t.locked]),o.jsx(_,{"data-testid":"jogging-panel","aria-label":"jogging-panel",sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...t.sx},children:n.joggingStore?o.jsx(cn,{store:n.joggingStore,children:t.children}):o.jsx(qe,{message:"Loading jogging",error:n.loadingError})})})),cn=O.observer(({store:t,children:e})=>{const{t:n}=L.useTranslation();function a(){if(t.currentTab.id==="cartesian")return o.jsx(an,{store:t,children:e});if(t.currentTab.id==="joint")return o.jsx(sn,{store:t,children:e})}return o.jsxs(_,{flexGrow:1,sx:{overflow:"hidden"},children:[o.jsx(De,{"data-testid":"jogging-tabs","aria-label":"jogging-tabs",value:t.tabIndex,onChange:t.onTabChange,variant:"fullWidth",children:t.tabs.map(r=>{const i=r.label==="Cartesian"?n("Jogging.Cartesian.bt"):n("Jogging.Joints.bt"),c=r.label==="cartesian"?o.jsx(st,{fontSize:"small",sx:{mr:1}}):o.jsx(lt,{fontSize:"small",sx:{mr:1}});return o.jsx(Oe,{"data-testid":`jogging-tab-${r.id}`,"aria-label":`jogging-tab-${r.id}`,label:t.showTabIcons?o.jsxs(_,{direction:"row",alignItems:"center",children:[c,i]}):i,id:`jogging-tab-${r.id}`,"aria-controls":`jogging-tab-${r.id}`},r.id)})}),o.jsx(_,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:a()}),t.blocked&&o.jsx(Kt,{store:t})]})}),He=t=>{var s;const{value:e,ref:n}=t,a=D.useTheme(),[r,i]=h.useState(!1);async function c(){if(!n||!("current"in n))return console.warn("No copy target found"),!1;try{return await navigator.clipboard.writeText(e),console.log("Copied!"),i(!0),!0}catch(l){console.error(l);const d=window.getSelection();if(d&&n&&"current"in n&&n.current){const m=document.createRange();m.selectNodeContents(n.current),d.removeAllRanges(),d.addRange(m)}}return!1}return h.useEffect(()=>{if(!r)return;const l=setTimeout(()=>i(!1),3e3);return()=>{l&&clearTimeout(l)}},[r]),o.jsx(Tt,{open:r,title:"Copied!",children:o.jsx(_,{justifyContent:"center",sx:{height:"100%",boxSizing:"border-box",padding:"6px 12px",background:(s=a.palette.backgroundPaperElevation)==null?void 0:s[8],borderRadius:"10px",minWidth:"0",cursor:"pointer"},onClick:()=>c(),children:o.jsx(R,{ref:n,align:"center",sx:{pointerEvents:"none",fontSize:"12px",color:a.palette.text.primary,whiteSpace:"nowrap",minWidth:0,textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:e})})})},dn=B.externalizeComponent(O.observer(({tcpPose:t,showCopyButton:e=!1})=>{const[n,a]=h.useState(null),r=q.poseToWandelscriptString(t),i=async()=>{try{await navigator.clipboard.writeText(r),a("Copied!"),setTimeout(()=>a(null),2e3)}catch{a("Copy failed"),setTimeout(()=>a(null),2e3)}};return o.jsxs(_,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-cartesian-values",children:[o.jsx(He,{value:r}),e&&o.jsx(Y,{variant:"contained",color:"secondary",size:"small",onClick:i,sx:{flexShrink:0},children:n||"Copy"})]})})),un=B.externalizeComponent(O.observer(({joints:t,showCopyButton:e=!1})=>{const[n,a]=h.useState(null),r=`[${t.map(c=>parseFloat(c.toFixed(4))).join(", ")}]`,i=async()=>{try{await navigator.clipboard.writeText(r),a("Copied!"),setTimeout(()=>a(null),2e3)}catch{a("Copy failed"),setTimeout(()=>a(null),2e3)}};return o.jsxs(_,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-joint-values",children:[o.jsx(He,{value:r}),e&&o.jsx(Y,{variant:"contained",color:"secondary",size:"small",onClick:i,sx:{flexShrink:0},children:n||"Copy"})]})}));class Ye{constructor(){this.messages=[],this.addMessage=(e,n="info")=>{const a={id:Math.random().toString(36).substring(2,11),timestamp:new Date,message:e,level:n};this.messages.push(a)},this.clearMessages=()=>{this.messages=[]},this.addInfo=e=>{this.addMessage(e,"info")},this.addWarning=e=>{this.addMessage(e,"warning")},this.addError=e=>{this.addMessage(e,"error")},this.addDebug=e=>{this.addMessage(e,"debug")},k.makeObservable(this,{messages:k.observable,addMessage:k.action,clearMessages:k.action})}}const te=(t,e,n)=>({id:n||`${Date.now()}-${Math.random().toString(36).substring(2,11)}`,timestamp:new Date,message:t,level:e}),gn=(t,e)=>te(t,"debug",e),pn=(t,e)=>te(t,"info",e),hn=(t,e)=>te(t,"warning",e),mn=(t,e)=>te(t,"error",e),Ze=B.externalizeComponent(O.observer(t=>{var m;const{messages:e=[],onClear:n,height:a=400,sx:r}=t,i=D.useTheme(),c=h.useRef(null);h.useEffect(()=>{if(e.length===0)return;const g=c.current;if(!g)return;const p=setTimeout(()=>{g.scrollTop=g.scrollHeight},10);return()=>clearTimeout(p)},[e.length]);const s=g=>g.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),l=g=>{switch(g){case"error":return i.palette.error.main;case"warning":return i.palette.warning.main;case"info":return i.palette.info.main;case"debug":return i.palette.text.disabled;default:return i.palette.text.secondary}},d=({message:g})=>{const[p,u]=h.useState(!1),[b,S]=h.useState(!1),[y,f]=h.useState(!1),j=g.message.length>150,x=async()=>{try{await navigator.clipboard.writeText(g.message),S(!0),setTimeout(()=>S(!1),2e3)}catch(C){console.error("Failed to copy message:",C)}},v=j&&!p?`${g.message.substring(0,150)}...`:g.message;return o.jsx(T,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),sx:{display:"flex",gap:1,fontFamily:"monospace",flexDirection:"column","&:hover":{backgroundColor:i.palette.action.hover},borderRadius:"4px",padding:"2px 4px",margin:"-2px -4px"},children:o.jsxs(T,{sx:{display:"flex",gap:1},children:[o.jsxs(R,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:i.palette.text.disabled,whiteSpace:"nowrap",flexShrink:0},children:["[",s(g.timestamp),"]"]}),o.jsx(R,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:l(g.level),wordBreak:"break-word",overflowWrap:"anywhere",hyphens:"auto",flex:1,whiteSpace:"pre-wrap"},children:v}),o.jsxs(T,{sx:{display:"flex",alignItems:"flex-start",gap:.5,opacity:y?1:0,transition:"opacity 0.2s ease-in-out",visibility:y?"visible":"hidden"},children:[o.jsx(G,{size:"small",onClick:x,sx:{padding:"2px",color:i.palette.text.secondary,"&:hover":{backgroundColor:i.palette.action.hover}},title:b?"Copied!":"Copy message",children:o.jsx(wt,{sx:{fontSize:12}})}),j&&o.jsx(G,{size:"small",onClick:()=>u(!p),sx:{padding:"2px",color:i.palette.text.secondary,"&:hover":{backgroundColor:i.palette.action.hover}},title:p?"Collapse":"Expand",children:p?o.jsx(Mt,{sx:{fontSize:12}}):o.jsx(kt,{sx:{fontSize:12}})})]})]})},g.id)};return o.jsxs(Rt,{sx:{backgroundColor:((m=i.palette.backgroundPaperElevation)==null?void 0:m[2])||"#171927",backgroundImage:"none",height:a,display:"flex",flexDirection:"column",overflow:"hidden",...r},children:[o.jsxs(T,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px"},children:[o.jsxs(T,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.jsx(It,{sx:{fontSize:16,color:i.palette.action.active,opacity:.56}}),o.jsx(R,{sx:{fontWeight:500,fontSize:"14px",lineHeight:"143%",letterSpacing:"0.17px",color:i.palette.text.primary},children:"Log"})]}),o.jsx(Y,{onClick:n,variant:"text",sx:{fontWeight:500,fontSize:"13px",lineHeight:"22px",letterSpacing:"0.46px",color:i.palette.primary.main,textTransform:"none",minWidth:"auto",padding:"4px 8px","&:hover":{backgroundColor:`${i.palette.primary.main}14`}},children:"Clear"})]}),o.jsx(T,{ref:c,sx:{flex:1,overflow:"auto",padding:"8px 16px",display:"flex",flexDirection:"column",gap:"2px",scrollbarWidth:"thin",scrollbarColor:`${i.palette.divider} transparent`,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:i.palette.divider,borderRadius:"3px","&:hover":{backgroundColor:i.palette.divider}}},children:e.length===0?o.jsx(R,{sx:{color:i.palette.text.disabled,fontSize:"12px",fontStyle:"italic",textAlign:"center",marginTop:2},children:"No log messages"}):e.map(g=>o.jsx(d,{message:g},g.id))})]})})),fn=B.externalizeComponent(O.observer(t=>{const{store:e,onStoreReady:n,...a}=t,r=h.useRef(n);h.useEffect(()=>{r.current=n},[n]);const i=h.useMemo(()=>{var l;const s=e||new Ye;return(l=r.current)==null||l.call(r,s),s},[e]),c=()=>{i.clearMessages()};return o.jsx(Ze,{...a,messages:i.messages,onClear:c})}));function xn(){const t=window.location.href;return t.substring(0,t.indexOf("/",t.indexOf("//")+2))}function bn({baseUrl:t=xn(),...e}){return o.jsxs(Et,{"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:[o.jsx(At,{id:"no-motion-group-modal-title",children:"No motion group found"}),o.jsxs(_t,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[o.jsx(R,{color:"#fff",children:"Found no devices to connect to."}),o.jsx(R,{color:"#fff",children:"Please ensure a motion group has been created."})]}),o.jsx(Pt,{children:o.jsxs(_,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[o.jsx(Y,{href:`${t}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),o.jsx(Y,{href:`${t}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}var be=(t=>(t.PRECONDITION_NOT_FULFILLED="PRECONDITION_NOT_FULFILLED",t.ROBOT_DISCONNECTED="ROBOT_DISCONNECTED",t.CELL_OPEN="CELL_OPEN",t.E_STOP="E_STOP",t.MANUAL_MODE="MANUAL_MODE",t.READY="READY",t))(be||{});const Xe=B.externalizeComponent(O.observer(({setupState:t,className:e})=>{const n=D.useTheme(),{t:a}=L.useTranslation(),r=()=>{var d,m,g,p,u,b,S;switch(t){case"READY":return{label:a("RobotSetupReadinessIndicator.Ready.lb"),indicatorColor:((d=n.palette.tertiary)==null?void 0:d.main)||n.palette.primary.main,backgroundColor:((m=n.palette.backgroundPaperElevation)==null?void 0:m[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"ROBOT_DISCONNECTED":return{label:a("RobotSetupReadinessIndicator.RobotDisconnected.lb"),indicatorColor:n.palette.error.main,backgroundColor:((g=n.palette.backgroundPaperElevation)==null?void 0:g[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"CELL_OPEN":return{label:a("RobotSetupReadinessIndicator.CellOpen.lb"),indicatorColor:n.palette.error.main,backgroundColor:((p=n.palette.backgroundPaperElevation)==null?void 0:p[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"E_STOP":return{label:a("RobotSetupReadinessIndicator.EStop.lb"),indicatorColor:n.palette.error.main,backgroundColor:((u=n.palette.backgroundPaperElevation)==null?void 0:u[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"MANUAL_MODE":return{label:a("RobotSetupReadinessIndicator.ManualMode.lb"),indicatorColor:n.palette.error.main,backgroundColor:((b=n.palette.backgroundPaperElevation)==null?void 0:b[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};default:return{label:a("RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb"),indicatorColor:n.palette.error.main,backgroundColor:((S=n.palette.backgroundPaperElevation)==null?void 0:S[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText}}},{label:i,indicatorColor:c,backgroundColor:s,textColor:l}=r();return o.jsx(Dt,{className:e,label:o.jsxs(T,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.jsx(T,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:c,flexShrink:0}}),o.jsx(R,{variant:"body2",sx:{color:l,fontSize:"0.75rem",lineHeight:1.2},children:i})]}),variant:"filled",sx:{backgroundColor:s,color:n.palette.getContrastText(s),fontWeight:500,height:"auto","& .MuiChip-label":{paddingX:1.5,paddingY:.5}}})})),yn=B.externalizeComponent(O.observer(({robotName:t,robotType:e,setupState:n,PreconditionComponent:a=Xe,className:r})=>{var l;const i=D.useTheme(),c=e||"Robot",s=n===be.READY;return o.jsxs(T,{className:r,sx:{border:`1px solid ${i.palette.divider}`,background:((l=i.palette.backgroundPaperElevation)==null?void 0:l[8])||"#292B3F",borderRadius:"8px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"space-between",opacity:1},children:[o.jsxs(T,{sx:{display:"flex",alignItems:"center",gap:2,flex:1},children:[s?o.jsx(T,{sx:{fontSize:24,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,"& svg":{fill:`${i.palette.primary.main} !important`},"& svg path":{fill:`${i.palette.primary.main} !important`}},children:o.jsx(W.ForwardRef$5,{})}):o.jsx(Ot,{sx:{color:i.palette.error.main,fontSize:24}}),o.jsx(R,{variant:"body1",sx:{fontWeight:500,color:i.palette.text.primary},children:t}),o.jsx(V,{orientation:"vertical",flexItem:!0,sx:{backgroundColor:i.palette.text.secondary,opacity:.3,width:"1px"}}),o.jsx(R,{variant:"body2",sx:{color:i.palette.text.secondary},children:c})]}),a&&o.jsx(a,{setupState:n})]})})),Sn=D.styled(Jt,{shouldForwardProp:t=>t!=="selected"})(({theme:t})=>{var e,n,a;return{borderRadius:"20px","&:hover":{background:(e=t.palette.backgroundPaperElevation)==null?void 0:e[7]},variants:[{props:({selected:r})=>!r,style:{background:(n=t.palette.backgroundPaperElevation)==null?void 0:n[0],color:t.palette.action.disabled,"> img":{opacity:.4}}},{props:({selected:r})=>r,style:{background:(a=t.palette.backgroundPaperElevation)==null?void 0:a[11],border:`1px solid ${t.palette.divider}`,color:t.palette.primary.contrastText}}]}}),jn=t=>{const{ref:e,...n}=t;return o.jsx(Sn,{ref:e,selected:t.selected,...n,color:"secondary",variant:"circular"})};function Cn(t){const{children:e,value:n,index:a,...r}=t;return o.jsx("div",{role:"tabpanel",hidden:n!==a,id:`tabpanel-${a}`,"aria-labelledby":`tab-${a}`,...r,children:n===a&&o.jsx(T,{children:e})})}function vn({children:t,...e}){const{fullWidth:n,indicator:a,onChange:r,orientation:i,scrollButtons:c,selectionFollowsFocus:s,textColor:l,value:d,variant:m,...g}=e;return o.jsx(T,{...g,children:t})}const Tn=B.externalizeComponent(O.observer(t=>{const{items:e,activeTab:n,defaultActiveTab:a=0,onTabChange:r,sx:i,ref:c}=t,s=n!==void 0,[l,d]=h.useState(a),m=s?n:l;h.useEffect(()=>{s||e.length!==0&&(l<0||l>e.length-1)&&d(0)},[e.length,s,l]);const g=(p,u)=>{s||d(u),r==null||r(u)};return o.jsxs(T,{ref:c,sx:{height:"100%",display:"flex",flexDirection:"column",...i},children:[o.jsx(T,{sx:{px:0,py:0,overflow:"visible",position:"relative",paddingTop:p=>p.spacing(2),paddingRight:p=>p.spacing(2.5)},children:o.jsx(De,{value:m,onChange:g,sx:{minHeight:"32px",backgroundColor:"transparent",overflow:"visible","& .MuiTabs-indicator":{display:"none"},"& .MuiTabs-flexContainer":{gap:2,overflow:"visible",paddingTop:0,paddingBottom:0},"& .MuiTabs-scroller":{overflow:"visible !important"},"& .MuiTab-root":{overflow:"visible"}},children:e.map((p,u)=>{var v,C,w;const b=()=>{if(!p.badge)return;const I=p.badge.content,E=p.badge.max;return typeof I=="number"&&E&&I>E?`${E}+`:I},S=()=>{if(!p.badge)return!1;const I=p.badge.content,E=p.badge.showZero;return!(I===0&&!E)},y=b(),f=S(),j=()=>{s||d(u),r==null||r(u)},x=o.jsx(Oe,{label:p.label,icon:p.icon,iconPosition:"start",disableRipple:!0,onClick:j,sx:{minHeight:"32px",height:"32px",padding:"0px 10px",borderRadius:"12px",backgroundColor:I=>{var E;return((E=I.palette.backgroundPaperElevation)==null?void 0:E[11])||"#32344B"},color:"text.primary",opacity:m===u?1:.38,fontSize:"13px",transition:"all 0.2s ease-in-out",position:"relative",overflow:"visible","&:hover":{opacity:m===u?1:.6},"&.Mui-selected":{opacity:1,backgroundColor:I=>{var E;return((E=I.palette.backgroundPaperElevation)==null?void 0:E[11])||"#32344B"},color:"text.primary"},"&:focus":{outline:"none"},"&:active":{transform:"none"}}},p.id);return f?o.jsx(vn,{component:"span",sx:{display:"inline-flex"},children:o.jsx(Ft,{badgeContent:y,color:((v=p.badge)==null?void 0:v.color)||"error",max:(C=p.badge)==null?void 0:C.max,showZero:(w=p.badge)==null?void 0:w.showZero,anchorOrigin:{vertical:"top",horizontal:"right"},overlap:"rectangular",sx:{"& .MuiBadge-badge":{opacity:"1 !important"}},children:x})},p.id):x})})}),o.jsx(T,{sx:{mt:p=>p.spacing(2),borderBottom:1,borderColor:"divider"}}),o.jsx(T,{sx:{flex:1,overflow:"auto"},children:e.map((p,u)=>o.jsx(Cn,{value:m,index:u,children:p.content},p.id))})]})})),wn=t=>{const e=Math.floor(t/86400),n=Math.floor(t%86400/3600),a=Math.floor(t%3600/60),r=t%60,i=[];return e>0?(i.push(e.toString()),i.push(n.toString().padStart(2,"0")),i.push(a.toString().padStart(2,"0")),i.push(r.toString().padStart(2,"0"))):n>0?(i.push(n.toString()),i.push(a.toString().padStart(2,"0")),i.push(r.toString().padStart(2,"0"))):(i.push(a.toString()),i.push(r.toString().padStart(2,"0"))),i.join(":")},Pe=(t,e)=>{const n=Math.floor(t/86400),a=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=t%60;if(typeof Intl<"u"&&"DurationFormat"in Intl)try{const s={};return n>0&&(s.days=n),a>0&&(s.hours=a),r>0&&(s.minutes=r),(i>0||Object.keys(s).length===0)&&(s.seconds=i),new Intl.DurationFormat(e,{style:"narrow"}).format(s)}catch{}const c=[];return n>0&&c.push(`${n}d`),a>0&&c.push(`${a}h`),r>0&&c.push(`${r}m`),(i>0||c.length===0)&&c.push(`${i}s`),c.join(" ")},In=({timerState:t,animationState:e,hasError:n,className:a})=>{var g,p;const{t:r}=L.useTranslation(),i=D.useTheme(),{elapsedTime:c,currentProgress:s}=t,{showErrorAnimation:l,showPauseAnimation:d,showMainText:m}=e;return o.jsxs(T,{className:a,sx:{position:"relative",width:264,height:264,display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx(Bt.Gauge,{width:264,height:264,value:s,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:d||l?.6:1,transition:"opacity 0.5s ease-out","& .MuiGauge-valueArc":{fill:n?i.palette.error.light:i.palette.success.main,transition:"fill 0.5s ease-out"},"& .MuiGauge-referenceArc":{fill:(g=i.palette.backgroundPaperElevation)==null?void 0:g[2],stroke:"transparent",strokeWidth:0,transition:"fill 0.5s ease-out, stroke 0.5s ease-out, stroke-width 0.5s ease-out"},"& .MuiGauge-valueText":{display:"none"},"& .MuiGauge-text":{display:"none"}}}),o.jsx(T,{sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:225,height:225,borderRadius:"50%",backgroundColor:(p=i.palette.backgroundPaperElevation)==null?void 0:p[8],display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",gap:1,transition:"background-color 0.5s ease-out"},children:o.jsxs(T,{sx:{position:"relative",height:"48px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:.5},children:[o.jsx(N,{in:m&&n,timeout:200,children:o.jsx(R,{variant:"h6",sx:{position:"absolute",fontSize:"16px",fontWeight:500,color:i.palette.error.light},children:r("timer.error")})}),o.jsx(N,{in:m&&!n,timeout:300,children:o.jsx(R,{variant:"h1",sx:{position:"absolute",fontSize:"48px",fontWeight:500,color:i.palette.text.primary,lineHeight:1,letterSpacing:"-0.5px"},children:wn(c)})})]})})]})},Mn=({timerState:t,animationState:e,hasError:n,compact:a,className:r})=>{const{t:i,i18n:c}=L.useTranslation(),s=D.useTheme(),{elapsedTime:l,currentProgress:d}=t,{showErrorAnimation:m,showPauseAnimation:g}=e;return a?o.jsx(T,{className:r,sx:{display:"flex",alignItems:"center",m:0},children:o.jsx(R,{variant:"body2",sx:{color:n?s.palette.error.light:s.palette.text.primary,fontSize:"14px",transition:"color 0.5s ease-out"},children:n?i("timer.error"):Pe(l,c.language)})}):o.jsxs(T,{className:r,sx:{display:"flex",alignItems:"center",m:0,gap:1},children:[o.jsx(T,{sx:{width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",opacity:g||m?.6:1,transition:"opacity 0.5s ease-out"},children:o.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",style:{transform:"rotate(-90deg)"},role:"img","aria-label":"Timer progress",children:[o.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?s.palette.error.light:s.palette.success.main,strokeWidth:"2",opacity:.3,style:{transition:"stroke 0.8s ease-in-out, opacity 2s ease-in-out"}}),o.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?s.palette.error.light:s.palette.success.main,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*8}`,strokeDashoffset:`${2*Math.PI*8*(1-d/100)}`,style:{transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),o.jsx(R,{variant:"body2",sx:{color:n?s.palette.error.light:s.palette.text.primary,fontSize:"14px",lineHeight:"normal",letterSpacing:"normal",transition:"color 0.8s ease-in-out, font-size 0.3s ease-out, opacity 2s ease-in-out"},children:n?i("timer.error"):Pe(l,c.language)})]})},kn=()=>{const[t,e]=h.useState({showPauseAnimation:!1,showErrorAnimation:!1,showMainText:!0}),n=h.useRef(null),a=h.useRef(null),r=h.useRef(null),i=h.useCallback(()=>{e(g=>({...g,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(g=>({...g,showPauseAnimation:!1}))},800)},[]),c=h.useCallback(()=>{e(g=>({...g,showErrorAnimation:!0})),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{e(g=>({...g,showErrorAnimation:!1}))},600)},[]),s=h.useCallback(()=>{e(g=>({...g,showErrorAnimation:!1})),a.current&&clearTimeout(a.current)},[]),l=h.useCallback(()=>{e(g=>({...g,showMainText:!1})),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(g=>({...g,showMainText:!0}))},200)},[]),d=h.useCallback(()=>{e(g=>({...g,showMainText:!0}))},[]),m=h.useCallback(()=>{n.current&&clearTimeout(n.current),a.current&&clearTimeout(a.current),r.current&&clearTimeout(r.current)},[]);return{animationState:t,triggerPauseAnimation:i,triggerErrorAnimation:c,clearErrorAnimation:s,triggerFadeTransition:l,setInitialAnimationState:d,cleanup:m}},Rn=({autoStart:t,hasError:e,onPauseAnimation:n,onErrorAnimation:a,onClearErrorAnimation:r})=>{const[i,c]=h.useState({elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),s=h.useRef(null),l=h.useRef(null),d=h.useRef(0),m=h.useRef(0),[g]=ee.useInterpolation([0],{tension:80,friction:18,onChange:([f])=>{c(j=>({...j,currentProgress:f}))}}),p=h.useCallback((f=0)=>{const j=f/60%1*100;c(x=>({...x,elapsedTime:f,isPausedState:!1,currentProgress:j})),d.current=0,m.current=j,g.setImmediate([j]),t?(l.current=Date.now()-f*1e3,c(x=>({...x,isRunning:!0}))):l.current=null},[t,g]),u=h.useCallback(()=>{if(l.current&&i.isRunning){const j=(Date.now()-l.current)/1e3+d.current,x=j/60%1*100;g.setTarget([x]),c(v=>({...v,elapsedTime:Math.floor(j)}))}c(f=>({...f,isRunning:!1,isPausedState:!0})),n()},[i.isRunning,g,n]),b=h.useCallback(()=>{i.isPausedState&&(d.current=i.elapsedTime,l.current=Date.now(),c(f=>({...f,isRunning:!0,isPausedState:!1})))},[i.isPausedState,i.elapsedTime]),S=h.useCallback(()=>{c(f=>({...f,elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0})),d.current=0,l.current=null,m.current=0,g.setImmediate([0])},[g]),y=h.useCallback(()=>i.isPausedState,[i.isPausedState]);return h.useEffect(()=>{e?(i.isRunning&&(c(f=>({...f,wasRunningBeforeError:!0})),u()),a()):(i.wasRunningBeforeError&&!i.isRunning&&(c(f=>({...f,wasRunningBeforeError:!1})),b()),r())},[e,i.isRunning,i.wasRunningBeforeError,u,b,a,r]),h.useEffect(()=>{if(i.isRunning){const f=()=>{if(l.current){const x=(Date.now()-l.current)/1e3+d.current,v=x/60%1*100;c(w=>({...w,elapsedTime:Math.floor(x)})),Math.abs(v-m.current)>.1&&(g.setTarget([v]),m.current=v)}s.current=requestAnimationFrame(f)};s.current=requestAnimationFrame(f)}else s.current&&(cancelAnimationFrame(s.current),s.current=null);return()=>{s.current&&(cancelAnimationFrame(s.current),s.current=null)}},[i.isRunning,g]),h.useEffect(()=>{let f=null;const j=()=>{g.update(),f=requestAnimationFrame(j)};return f=requestAnimationFrame(j),()=>{f&&cancelAnimationFrame(f)}},[g]),{timerState:i,controls:{start:p,pause:u,resume:b,reset:S,isPaused:y}}},En=B.externalizeComponent(O.observer(({onTimerReady:t,autoStart:e=!0,variant:n="default",compact:a=!1,className:r,hasError:i=!1})=>{const{animationState:c,triggerPauseAnimation:s,triggerErrorAnimation:l,clearErrorAnimation:d,setInitialAnimationState:m,cleanup:g}=kn(),{timerState:p,controls:u}=Rn({autoStart:e,hasError:i,onPauseAnimation:s,onErrorAnimation:l,onClearErrorAnimation:d});return h.useEffect(()=>{m()},[m]),h.useEffect(()=>{let b=!0;const S=setTimeout(()=>{b&&t(u)},0);return()=>{b=!1,clearTimeout(S)}},[t,u]),h.useEffect(()=>g,[g]),n==="small"?o.jsx(Mn,{timerState:p,animationState:c,hasError:i,compact:a,className:r}):o.jsx(In,{timerState:p,animationState:c,hasError:i,className:r})})),_e=1e-4,Pn={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class ae{constructor(e,n,a,r,i,c,s,l,d,m,g="cell"){this.controller=n,this.motionGroup=a,this.initialMotionState=r,this.motionStateSocket=i,this.isVirtual=c,this.tcps=s,this.description=l,this.initialControllerState=d,this.controllerStateSocket=m,this.cellId=g,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.nova=re(e),this.rapidlyChangingMotionState=r,this.controllerState=d,m.addEventListener("message",p=>{var b;const u=(b=J.tryParseJson(p.data))==null?void 0:b.result;u&&k.runInAction(()=>{this.controllerState=u})}),i.addEventListener("message",p=>{var b;const u=(b=J.tryParseJson(p.data))==null?void 0:b.result;if(!u)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${p.data}`);me(this.rapidlyChangingMotionState.joint_position,u.joint_position,_e)||k.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=u.joint_position}),fe(this.rapidlyChangingMotionState,u,_e)||k.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=u.tcp_pose}),u.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==u.tcp&&k.runInAction(()=>{this.rapidlyChangingMotionState.tcp=u.tcp}),this.rapidlyChangingMotionState.standstill!==u.standstill&&k.runInAction(()=>{this.rapidlyChangingMotionState.standstill=u.standstill})}),k.makeAutoObservable(this)}static async connectMultiple(e,n,a={}){return Promise.all(n.map(r=>ae.connect(e,r,a)))}static async connect(e,n,a={}){var v,C;const r=re(e),i=a.cellId??"cell",[c,s]=n.split("@"),l=await r.api.controller.getCurrentRobotControllerState(i,s),d=l==null?void 0:l.motion_groups.find(w=>w.motion_group===n);if(!l||!d)throw new Error(`Controller ${s} or motion group ${n} not found`);const m=r.openReconnectingWebsocket(`/cells/${i}/controllers/${s}/motion-groups/${n}/state-stream`),g=await m.firstMessage(),p=(v=J.tryParseJson(g.data))==null?void 0:v.result;if(!p)throw new Error(`Unable to parse initial motion state message ${g.data}`);console.log(`Connected motion state websocket to motion group ${d.motion_group}. Initial state:
3
+ `,p);const b=(await r.api.controller.getRobotController(i,l.controller)).configuration.kind==="VirtualController",S=await r.api.motionGroup.getMotionGroupDescription(i,s,d.motion_group),y=Object.entries(S.tcps||{}).map(([w,I])=>({id:w,readable_name:I.name,position:I.pose.position,orientation:I.pose.orientation})),f=r.openReconnectingWebsocket(`/cells/${i}/controllers/${l.controller}/state-stream?response_rate=1000`),j=await f.firstMessage(),x=(C=J.tryParseJson(j.data))==null?void 0:C.result;if(!x)throw new Error(`Unable to parse initial controller state message ${j.data}`);return console.log(`Connected controller state websocket to controller ${l.controller}. Initial state:
4
+ `,x),new ae(r,l,d,p,m,b,y,S,x,f,i)}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((e,n)=>({index:n}))}get dhParameters(){if(this.description.dh_parameters!==void 0)return this.description.dh_parameters.map(e=>({...Pn,...e}))}get safetyZones(){return this.description.safety_zones}get mountingPosition(){var e,n,a;return this.description.mounting?[(((e=this.description.mounting.position)==null?void 0:e[0])||0)/1e3,(((n=this.description.mounting.position)==null?void 0:n[1])||0)/1e3,(((a=this.description.mounting.position)==null?void 0:a[2])||0)/1e3]:[0,0,0]}get mountingQuaternion(){var r,i,c,s,l,d;const e=new ke.Vector3(((i=(r=this.description.mounting)==null?void 0:r.orientation)==null?void 0:i[0])||0,((s=(c=this.description.mounting)==null?void 0:c.orientation)==null?void 0:s[1])||0,((d=(l=this.description.mounting)==null?void 0:l.orientation)==null?void 0:d[2])||0),n=e.length(),a=e.normalize();return new ke.Quaternion().setFromAxisAngle(a,n)}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}k.runInAction(()=>{this.activationState="deactivating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_MONITOR"),k.runInAction(()=>{this.activationState="inactive"})}catch(e){throw k.runInAction(()=>{this.activationState="active"}),e}}async activate(){if(this.activationState!=="inactive"){console.error("Tried to activate while already activating");return}k.runInAction(()=>{this.activationState="activating"});try{await this.nova.api.controller.setDefaultMode(this.cellId,this.controllerId,"ROBOT_SYSTEM_MODE_CONTROL"),k.runInAction(()=>{this.activationState="active"})}catch(e){throw k.runInAction(()=>{this.activationState="inactive"}),e}}toggleActivation(){this.activationState==="inactive"?this.activate():this.activationState==="active"&&this.deactivate()}dispose(){this.motionStateSocket.close(),this.connectedJoggingSocket&&this.connectedJoggingSocket.close()}setJoggingVelocity(e){this.joggingVelocity=e}}const K="rgba(255, 255, 255, 1)",_n={components:{MuiCssBaseline:{styleOverrides:{".MuiDataGrid-panelContent":{borderRadius:"16px !important","& .MuiPaper-root":{borderRadius:"16px !important"}},".MuiDataGrid-filterForm":{borderRadius:"16px !important","& .MuiInputBase-root":{borderRadius:"16px !important","& fieldset":{borderRadius:"16px !important"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"16px !important"}},"& .MuiTextField-root":{"& .MuiInputBase-root":{borderRadius:"16px !important","& fieldset":{borderRadius:"16px !important"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"16px !important"}}}},".MuiDataGrid-filterFormValueInput":{"& .MuiInputBase-root":{borderRadius:"16px !important","& fieldset":{borderRadius:"16px !important"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"16px !important"}}}}},MuiDataGrid:{styleOverrides:{panelContent:{borderRadius:"16px !important"},filterForm:{"& .MuiInputBase-root":{borderRadius:`${U.RadiusSm}px !important`,"& fieldset":{borderRadius:`${U.RadiusSm}px !important`},"& .MuiOutlinedInput-notchedOutline":{borderRadius:`${U.RadiusSm}px !important`}}},filterFormValueInput:{"& .MuiInputBase-root":{borderRadius:`${U.RadiusSm}px !important`,"& fieldset":{borderRadius:`${U.RadiusSm}px !important`},"& .MuiOutlinedInput-notchedOutline":{borderRadius:`${U.RadiusSm}px !important`}}}}}},componentsExt:{JoggingPanel:{JoggingCartesian:{Axis:{X:{backgroundColor:"rgba(215, 66, 56, 1)",borderColor:"rgba(215, 66, 56, 1)",buttonBackgroundColor:{default:"rgba(241, 77, 66, 1)",pressed:"rgba(138, 41, 35, 1)",hovered:"rgba(241, 77, 66, 1)",disabled:"rgba(241, 77, 66, 1)"},color:"rgba(255, 198, 198, 1)",labelColor:K},Y:{backgroundColor:"rgba(20, 151, 108, 1)",borderColor:"rgba(20, 151, 108, 1)",buttonBackgroundColor:{default:"rgba(28, 188, 135, 1)",pressed:"rgba(11, 89, 63, 1)",disabled:"rgba(28, 188, 135, 1)",hovered:"rgba(28, 188, 135, 1)"},color:"rgba(215, 255, 242, 1)",labelColor:K},Z:{backgroundColor:"rgba(1, 87, 155, 1)",borderColor:"rgba(1, 87, 155, 1)",buttonBackgroundColor:{default:"rgba(2, 136, 209, 1)",pressed:"rgba(2, 64, 114, 1)",disabled:"rgba(2, 136, 209, 1)",hovered:"rgba(2, 136, 209, 1)"},color:"rgba(210, 239, 255, 1)",labelColor:K}}},JoggingJoint:{Joint:{arrowColor:K}},VelocitySlider:{sliderLegendColor:K}}}};function Qe(...t){return Lt.createNovaMuiTheme(_n,...t)}function An(t={}){return Qe(t)}exports.AdornedTextField=qt;exports.AppHeader=Nt;exports.ConnectedMotionGroup=ae;exports.CycleTimer=Xt;exports.JoggerConnection=le;exports.JoggingCartesianAxisControl=ge;exports.JoggingJointValueControl=Le;exports.JoggingPanel=ln;exports.JoggingStore=ce;exports.LoadingCover=qe;exports.LoadingErrorMessage=Ve;exports.LogPanel=fn;exports.LogStore=Ye;exports.LogViewer=Ze;exports.MotionStreamConnection=se;exports.NoMotionGroupModal=bn;exports.PoseCartesianValues=dn;exports.PoseJointValues=un;exports.RobotListItem=yn;exports.RobotSetupReadinessIndicator=Xe;exports.RobotSetupReadinessState=be;exports.SelectableFab=jn;exports.TabBar=Tn;exports.Timer=En;exports.VelocitySlider=We;exports.VelocitySliderLabel=xe;exports.WandelbotsDataGrid=Be;exports.createDebugMessage=gn;exports.createErrorMessage=mn;exports.createInfoMessage=pn;exports.createLogMessage=te;exports.createNovaMuiTheme=An;exports.createNovaTheme=Qe;exports.createWarningMessage=hn;exports.jointValuesEqual=me;exports.poseEqual=$e;exports.tcpMotionEqual=fe;exports.unwrapRotationVector=ze;