@wandelbots/wandelbots-js-react-components 5.5.5-pr.fix-select-tcp.609.fb23fba → 5.5.5-pr.fix-select-tcp.609.2c295d2

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.
@@ -0,0 +1,4 @@
1
+ "use strict";const o=require("react/jsx-runtime"),A=require("@mui/material/styles"),Ye=require("@mui/material/AppBar"),Ee=require("@mui/material/Backdrop"),T=require("@mui/material/Box"),W=require("@mui/material/IconButton"),Ze=require("@mui/material/Menu"),G=require("@mui/material/MenuItem"),Xe=require("@mui/material/Toolbar"),E=require("@mui/material/Typography"),D=require("mobx-react-lite"),m=require("react"),F=require("./externalizeComponent-BHZdH14U.cjs"),Qe=require("@mui/material/SvgIcon"),q=require("@mui/material/Fade"),Ke=require("@mui/x-charts/Gauge"),L=require("react-i18next"),Q=require("./interpolation-B84QX33C.cjs"),et=require("@mui/icons-material/Clear"),tt=require("@mui/icons-material/FilterList"),ve=require("@mui/icons-material/Search"),U=require("@mui/material/Divider"),z=require("@mui/x-data-grid"),nt=require("@mui/icons-material/OpenWith"),ot=require("@mui/icons-material/Share"),_=require("@mui/material/Stack"),Pe=require("@mui/material/Tab"),_e=require("@mui/material/Tabs"),V=require("@wandelbots/nova-js/v2"),ue=require("lodash-es"),k=require("mobx"),J=require("@wandelbots/nova-js"),se=require("three/src/math/Vector3.js"),Oe=require("@mui/material/CircularProgress"),it=require("@mui/material/utils"),rt=require("./SafetyBar-CLm3UQRA.cjs"),at=require("@mui/material/Alert"),st=require("@mui/material/AlertTitle"),H=require("@mui/material/Button"),Te=require("@mui/material/ToggleButton"),N=require("./robot-SEtfVAmf.cjs"),lt=require("lodash-es/isEqual.js"),ct=require("@mui/material/InputAdornment"),dt=require("@mui/material/FormControl"),ut=require("@mui/material/InputLabel"),gt=require("@mui/material/Select"),te=require("lodash-es/keyBy.js"),pt=require("lodash-es/uniqueId.js"),mt=require("@mui/material/ToggleButtonGroup"),Ae=require("@mui/material/Slider"),ht=require("lodash-es/isNumber.js"),ft=require("@mui/icons-material/ChevronLeft"),xt=require("@mui/icons-material/ChevronRight"),bt=require("lodash-es/throttle.js"),yt=require("@mui/material/Tooltip"),St=require("@mui/icons-material/ContentCopy"),jt=require("@mui/icons-material/DescriptionOutlined"),Ct=require("@mui/icons-material/ExpandLess"),vt=require("@mui/icons-material/ExpandMore"),Tt=require("@mui/material/Paper"),wt=require("@mui/material/Dialog"),Mt=require("@mui/material/DialogActions"),It=require("@mui/material/DialogContent"),kt=require("@mui/material/DialogTitle"),Rt=require("@mui/icons-material/Error"),Et=require("@mui/material/Chip"),Pt=require("@mui/material/Fab"),_t=require("@mui/material/Badge"),Ot=require("@mui/x-charts"),le=require("three");function At(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 we=At(le),Dt=t=>o.jsx(Qe,{...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"})}),Jt=F.externalizeComponent(D.observer(t=>{const{appIcon:e,appName:n,apps:a=[],onAppSelect:r,disabled:i=!1,sx:c}=t,[s,l]=m.useState(null),g=!!s,x=p=>{l(p.currentTarget)},u=()=>{l(null)},d=p=>{u(),p.onClick?p.onClick():p.href&&(window.location.href=p.href),r==null||r(p)};return o.jsxs(o.Fragment,{children:[o.jsx(Ye,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...c},children:o.jsxs(Xe,{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(E,{component:"h1",sx:{fontWeight:"bold",fontSize:"1rem"},children:n}),a.length>0&&o.jsx(W,{color:"inherit","aria-label":"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:x,disabled:i,sx:{ml:1,width:28,height:28,borderRadius:"6px",padding:0,backgroundColor:p=>A.alpha(p.palette.common.white,.1),opacity:1,"&:hover":{backgroundColor:p=>A.alpha(p.palette.common.white,.16)},"& .MuiSvgIcon-root":{fontSize:"8px",width:"8px",height:"6px"}},children:o.jsx(Dt,{})})]})]})}),o.jsx(Ee,{open:g,onClick:u,sx:{backdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.3)",zIndex:p=>p.zIndex.modal-1}}),o.jsx(Ze,{id:"app-menu",anchorEl:s,open:g,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:p=>p.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:a.map(p=>o.jsxs(G,{onClick:()=>d(p),children:[o.jsx(T,{sx:{display:"flex",alignItems:"center"},children:p.icon}),o.jsx(E,{variant:"body1",sx:{ml:2},children:p.name})]},p.id))})]})})),Ft=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(":")},$=(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(" ")},Bt=(t,e,n)=>t==="countdown"&&n!==null?Math.min(100,e/n*100):t==="measuring"?e/60%1*100:0,Lt=({timerState:t,animationState:e,hasError:n,className:a})=>{const{t:r,i18n:i}=L.useTranslation(),c=A.useTheme(),{currentState:s,remainingTime:l,maxTime:g,currentProgress:x}=t,{showErrorAnimation:u,showPauseAnimation:d,showPulsatingText:p,pulsatingFinished:y,showLabels:S,showMainText:f,showIdlePulsating:h,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(Ke.Gauge,{width:264,height:264,value:s==="idle"?0:x,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:d||u?.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:"#171927",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:"#292B3F",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(q,{in:S&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(E,{variant:"body2",sx:{fontSize:"12px",color:s==="measured"&&(p||y)?c.palette.success.main:c.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:o.jsx("span",{style:{opacity:s==="measured"&&y?p?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(q,{in:f&&s==="idle"&&!n,timeout:200,children:o.jsxs(E,{variant:"body2",sx:{position:"absolute",fontSize:"12px",fontWeight:400,color:"rgba(255, 255, 255, 0.7)",lineHeight:"166%",letterSpacing:"0.17px",textAlign:"center",width:"200px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx("span",{style:{opacity:h?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:h?1:.6,transition:"opacity 2s ease-in-out"},children:".".repeat(j)})]})}),o.jsx(q,{in:f&&n,timeout:200,children:o.jsx(E,{variant:"h3",sx:{position:"absolute",fontSize:"40px",fontWeight:400,color:"#FFFFFF",lineHeight:"116.7%"},children:r("CycleTimer.Error.lb","Error")})}),o.jsx(q,{in:f&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(E,{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:Ft(l)})})})]}),o.jsx(T,{sx:{height:"16px",display:"flex",marginTop:.5,alignItems:"center",justifyContent:"center"},children:o.jsx(q,{in:S&&!n&&s!=="idle"&&s!=="success",timeout:300,children:o.jsx(E,{variant:"body2",sx:{fontSize:"12px",color:s==="measured"&&(p||y)?c.palette.success.main:c.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:o.jsx("span",{style:{opacity:s==="measured"&&y?p?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"&&g!==null?r("CycleTimer.OfTime.lb",{time:$(g,i.language)}):""})})})})]})]})},zt=({timerState:t,animationState:e,hasError:n,compact:a,className:r})=>{const{t:i,i18n:c}=L.useTranslation(),s=A.useTheme(),{currentState:l,remainingTime:g,maxTime:x}=t,{showErrorAnimation:u,showPauseAnimation:d,showPulsatingText:p,pulsatingFinished:y,showIdlePulsating:S,idleDotsCount:f}=e;return a&&l==="idle"?o.jsx(T,{className:r,sx:{display:"flex",alignItems:"center",m:0},children:o.jsx(E,{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":$(g,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:d||u?.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"?p||y?s.palette.success.main:s.palette.text.secondary:s.palette.success.main,strokeWidth:"2",opacity:l==="measured"&&y?p?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"?p||y?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"&&y?p?1:.6:1,transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),o.jsx(E,{variant:"body2",sx:{color:n?s.palette.error.light:l==="idle"?"rgba(255, 255, 255, 0.7)":l==="measured"?p||y?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"&&y?p?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(f)})]}):l==="measuring"?a?$(g,c.language):`${$(g,c.language)} / ${i("CycleTimer.Measuring.lb","measuring...")}`:l==="measured"?a?$(g,c.language):`${$(g,c.language)} / ${i("CycleTimer.Determined.lb","determined")}`:l==="countdown"&&x!==null?a?$(g,c.language):`${$(g,c.language)} / ${i("CycleTimer.Time.lb",{time:$(x,c.language)})}`:$(g,c.language)})]})},$t=()=>{const[t,e]=m.useState({showPauseAnimation:!1,showErrorAnimation:!1,showPulsatingText:!1,pulsatingFinished:!1,showLabels:!0,showMainText:!0,showIdlePulsating:!1,idleDotsCount:0}),n=m.useRef(null),a=m.useRef(null),r=m.useRef(null),i=m.useRef(null),c=m.useRef(0),s=m.useRef(null),l=m.useRef(null),g=m.useCallback(()=>{e(b=>({...b,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(b=>({...b,showPauseAnimation:!1}))},800)},[]),x=m.useCallback(()=>{e(b=>({...b,showErrorAnimation:!0})),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{e(b=>({...b,showErrorAnimation:!1}))},600)},[]),u=m.useCallback(()=>{e(b=>({...b,showErrorAnimation:!1})),a.current&&clearTimeout(a.current)},[]),d=m.useCallback(b=>{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),b&&b()},800)},[]),p=m.useCallback(()=>{r.current&&(clearInterval(r.current),r.current=null),e(b=>({...b,showPulsatingText:!1,pulsatingFinished:!1})),c.current=0},[]),y=m.useCallback(()=>{e(b=>({...b,showIdlePulsating:!0})),s.current=setInterval(()=>{e(b=>({...b,showIdlePulsating:!b.showIdlePulsating}))},2e3),l.current=setInterval(()=>{e(b=>({...b,idleDotsCount:(b.idleDotsCount+1)%4}))},800)},[]),S=m.useCallback(()=>{s.current&&(clearInterval(s.current),s.current=null),l.current&&(clearInterval(l.current),l.current=null),e(b=>({...b,showIdlePulsating:!1,idleDotsCount:0}))},[]),f=m.useCallback(()=>{e(b=>({...b,showLabels:!1,showMainText:!1})),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{e(b=>({...b,showLabels:!0,showMainText:!0}))},200)},[]),h=m.useCallback(()=>{e(b=>({...b,showLabels:!0,showMainText:!0}))},[]),j=m.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:g,triggerErrorAnimation:x,clearErrorAnimation:u,startPulsatingAnimation:d,stopPulsatingAnimation:p,startIdleAnimations:y,stopIdleAnimations:S,triggerFadeTransition:f,setInitialAnimationState:h,cleanup:j}},Vt=({autoStart:t,onCycleEnd:e,onMeasuringComplete:n,hasError:a,onPauseAnimation:r,onErrorAnimation:i,onClearErrorAnimation:c,onStartPulsating:s})=>{const[l,g]=m.useState({currentState:"idle",remainingTime:0,maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),x=m.useRef(null),u=m.useRef(null),d=m.useRef(0),[p]=Q.useInterpolation([0],{tension:80,friction:18,onChange:([C])=>{g(w=>({...w,currentProgress:C}))}}),y=m.useCallback(()=>{g(C=>({...C,currentState:"idle",maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0})),d.current=0,u.current=null,p.setImmediate([0])},[p]),S=m.useCallback((C=0)=>{const w=C/60%1*100;g(I=>({...I,currentState:"measuring",maxTime:null,remainingTime:C,isPausedState:!1,currentProgress:w})),d.current=0,p.setImmediate([w]),t?(u.current=Date.now()-C*1e3,g(I=>({...I,isRunning:!0}))):u.current=null},[t,p]),f=m.useCallback((C,w=0)=>{g(M=>({...M,isRunning:!1})),u.current=null,g(M=>({...M,currentState:"countdown",maxTime:C,isPausedState:!1})),d.current=0;const I=Math.max(0,C-w),R=w>0?w/C*100:0;g(M=>({...M,remainingTime:I,currentProgress:R})),p.setImmediate([R]),I===0?(g(M=>({...M,isRunning:!1})),u.current=null,e&&queueMicrotask(()=>e())):t?setTimeout(()=>{u.current=Date.now()-w*1e3,g(M=>({...M,isRunning:!0}))},0):u.current=null},[t,e,p]),h=m.useCallback(()=>{g(C=>({...C,isRunning:!1,currentState:"measured"})),u.current=null,s(()=>{n&&n()})},[s,n]),j=m.useCallback(()=>{if(u.current&&l.isRunning){const w=Date.now()-u.current;d.current+=w;const I=d.current/1e3,R=Bt(l.currentState,I,l.maxTime);p.setTarget([R])}g(C=>({...C,isRunning:!1,isPausedState:!0})),r()},[l.isRunning,l.currentState,l.maxTime,p,r]),b=m.useCallback(()=>{l.isPausedState&&(l.remainingTime>0||l.currentState!=="countdown")&&(u.current=Date.now(),g(C=>({...C,isRunning:!0,isPausedState:!1})))},[l.isPausedState,l.remainingTime,l.currentState]),v=m.useCallback(()=>l.isPausedState,[l.isPausedState]);return m.useEffect(()=>{a?(l.isRunning&&!l.isPausedState&&(g(C=>({...C,wasRunningBeforeError:!0})),j()),i()):(l.wasRunningBeforeError&&l.isPausedState&&(g(C=>({...C,wasRunningBeforeError:!1})),b()),c())},[a,l.isRunning,l.isPausedState,l.wasRunningBeforeError,j,b,i,c]),m.useEffect(()=>{if(l.isRunning){const C=()=>{if(u.current){const I=(Date.now()-u.current+d.current)/1e3;if(l.currentState==="countdown"&&l.maxTime!==null){const R=Math.max(0,l.maxTime-I);g(P=>({...P,remainingTime:Math.ceil(R)}));const M=Math.min(100,I/l.maxTime*100);if(p.setTarget([M]),R<=0){g(P=>({...P,isRunning:!1,remainingTime:0})),u.current=null,p.setTarget([100]),e&&queueMicrotask(()=>e());return}}else if(l.currentState==="measuring"){g(M=>({...M,remainingTime:Math.floor(I)}));const R=I/60%1*100;p.setTarget([R])}l.isRunning&&(x.current=requestAnimationFrame(C))}};x.current=requestAnimationFrame(C)}else x.current&&(cancelAnimationFrame(x.current),x.current=null);return()=>{x.current&&cancelAnimationFrame(x.current)}},[l.isRunning,e,l.currentState,l.maxTime,p]),m.useEffect(()=>{let C=null;const w=()=>{p.update(1/60),C=requestAnimationFrame(w)};return C=requestAnimationFrame(w),()=>{C&&cancelAnimationFrame(C)}},[p]),{timerState:l,controls:{startNewCycle:f,startMeasuring:S,setIdle:y,completeMeasuring:h,pause:j,resume:b,isPaused:v}}},qt=F.externalizeComponent(D.observer(({onCycleComplete:t,onCycleEnd:e,onMeasuringComplete:n,autoStart:a=!0,variant:r="default",compact:i=!1,className:c,hasError:s=!1})=>{const l=m.useRef(void 0),{animationState:g,triggerPauseAnimation:x,triggerErrorAnimation:u,clearErrorAnimation:d,startPulsatingAnimation:p,stopPulsatingAnimation:y,startIdleAnimations:S,stopIdleAnimations:f,triggerFadeTransition:h,setInitialAnimationState:j,cleanup:b}=$t(),{timerState:v,controls:C}=Vt({autoStart:a,onCycleEnd:e,onMeasuringComplete:n,hasError:s,onPauseAnimation:x,onErrorAnimation:u,onClearErrorAnimation:d,onStartPulsating:p});return m.useEffect(()=>{const w=l.current;l.current!==void 0&&w!==v.currentState?(w==="measured"&&y(),w==="idle"&&f(),h()):j(),v.currentState==="idle"&&S(),l.current=v.currentState},[v.currentState,y,f,S,h,j]),m.useEffect(()=>{let w=!0;const I=setTimeout(()=>{w&&t(C)},0);return()=>{w=!1,clearTimeout(I)}},[t,C]),m.useEffect(()=>b,[b]),r==="small"?o.jsx(zt,{timerState:v,animationState:g,hasError:s,compact:i,className:c}):o.jsx(Lt,{timerState:v,animationState:g,hasError:s,className:c})})),De=F.externalizeComponent(D.observer(({data:t,columns:e,getRowData:n,onRowClick:a,selectedItem:r,getItemId:i,title:c,showCount:s=!0,searchPlaceholder:l="Search programs",dataGridProps:g,CustomToolbar:x,selectFirstByDefault:u=!1,sx:d})=>{var R;const p=A.useTheme(),y=z.useGridApiRef(),S=m.useRef(null),[f,h]=m.useState(null),j=m.useMemo(()=>t.map(n),[t,n]);m.useEffect(()=>{y.current&&j.length>0&&y.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:e.map(M=>M.field)})},[j,e,y]),m.useEffect(()=>{if(!S.current||!y.current)return;const M=new ResizeObserver(()=>{setTimeout(()=>{y.current&&j.length>0&&y.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:e.map(P=>P.field)})},100)});return M.observe(S.current),()=>{M.disconnect()}},[y,j.length,e]);const b=m.useMemo(()=>{if(r!==void 0)return r;if(f!==null)return f;if(u&&t.length>0){const M=t[0];return h(M),M}return null},[u,t,r,f]),v=M=>{const P=t.find(B=>n(B).id===M.id);P&&(r===void 0&&h(P),a&&a(P,M))},C=m.useMemo(()=>!b||!i?null:i(b),[b,i]);function w(){return o.jsx(z.Toolbar,{children:o.jsxs(T,{sx:{display:"flex",width:"100%",gap:1,p:.5,alignItems:"center"},children:[c&&o.jsxs(E,{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(z.FilterPanelTrigger,{render:o.jsx(z.ToolbarButton,{"aria-label":"Show filters",children:o.jsx(tt,{fontSize:"small"})})}),o.jsx(U,{orientation:"vertical",flexItem:!0,sx:{height:"24px",alignSelf:"center"}}),o.jsx(z.QuickFilter,{render:(M,P)=>o.jsxs(T,{...M,sx:{display:"flex",overflow:"hidden"},children:[!P.expanded&&o.jsx(z.QuickFilterTrigger,{render:o.jsx(z.ToolbarButton,{"aria-label":"Search",children:o.jsx(ve,{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:"#171927",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(ve,{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(z.QuickFilterControl,{placeholder:l})]}),P.expanded&&P.value!==""&&o.jsx(z.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(z.ToolbarButton,{"aria-label":"Clear",children:o.jsx(et,{fontSize:"small"})})})})})]})]})})]})]})})}const I=x||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:`${p.palette.divider} transparent`,"&::-webkit-scrollbar":{display:"block",width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:p.palette.divider,borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:p.palette.action.hover}},...d},children:o.jsx(z.DataGrid,{apiRef:y,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:[]}},...g==null?void 0:g.initialState},...g,autosizeOnMount:!0,autosizeOptions:{...(g==null?void 0:g.autosizeOptions)||{},includeOutliers:!0,includeHeaders:!0,expand:!0,columns:((R=g==null?void 0:g.autosizeOptions)==null?void 0:R.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:"rgba(255, 255, 255, 0.08) !important",borderRadius:"16px",zIndex:0},"&:hover":{backgroundColor:"transparent !important"},"&:hover::before":{backgroundColor:"rgba(255, 255, 255, 0.12) !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":{},...g==null?void 0:g.sx}})})}));De.displayName="WandelbotsDataGrid";const ce=F.externalizeComponent(D.observer(({colors:t,label:e,getDisplayedValue:n,startJogging:a,stopJogging:r,disabled:i,activeJoggingDirection:c,...s})=>{var b,v,C,w,I,R,M;Q.useAnimationFrame(()=>{const P=n(),B=d.current;B&&(B.textContent=P)});const l=A.useTheme(),[g,x]=m.useState(null);m.useEffect(()=>{i&&j()},[i]);const u=c||g,d=m.useRef(null);t||(t={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const p=u?(b=t.buttonBackgroundColor)==null?void 0:b.pressed:t.borderColor,y={width:"55px",color:t.color,path:{fill:t.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},S={...y,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}}},f={...y,backgroundColor:(R=t.buttonBackgroundColor)==null?void 0:R.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 h(P,B){i||P.button===0&&(x(B),a(B))}function j(){x(null),r()}return o.jsxs(_,{height:"64px",direction:"row",justifyContent:"center",...s,children:[o.jsx(W,{disabled:i,disableRipple:!0,onPointerDown:P=>h(P,"-"),onPointerUp:j,onPointerOut:j,size:"large",sx:{...u==="-"?f:S,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${p??"#fff"}`,borderBottom:`2px solid ${p??"#fff"}`,borderTop:`2px solid ${p??"#fff"}`},children:o.jsx(N.ForwardRef$3,{})}),o.jsxs(_,{spacing:"6px",sx:{width:"150px",backgroundColor:t.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${p??"#fff"}`,borderTop:`2px solid ${p??"#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(E,{height:"22px",sx:{fontSize:"15px",color:i?l.palette.action.disabled:t.color,fontWeight:700,fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center"},ref:d,children:n()})]}),o.jsx(W,{disableRipple:!0,disabled:i,onPointerDown:P=>h(P,"+"),onPointerUp:j,onPointerOut:j,size:"large",sx:{...u==="+"?f:S,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${p??"#fff"}`,borderBottom:`2px solid ${p??"#fff"}`,borderTop:`2px solid ${p??"#fff"}`},children:o.jsx(N.ForwardRef$4,{})})]})})),Je=F.externalizeComponent(D.observer(({startJogging:t,stopJogging:e,lowerLimit:n,upperLimit:a,useDegree:r,getValue:i,disabled:c,...s})=>{var w,I,R,M,P,B,Y,ee,fe,xe,be,ye,Se,je,Ce;const{t:l}=L.useTranslation(),[g,x]=m.useState(),u=A.useTheme(),d={background:(w=u.palette.backgroundPaperElevation)==null?void 0:w[4],color:(I=u.palette.backgroundPaperElevation)==null?void 0:I[11]},p=D.useLocalObservable(()=>({activeJoggingDir:null,startJogging(O){this.activeJoggingDir=O,t(O)},stopJogging(){this.activeJoggingDir=null,e()}})),y=bt(()=>{const O=r?S(i()):i();(O===void 0||g===void 0||Math.abs(g-O)>1e-9)&&x(O)},50);Q.useAnimationFrame(y);function S(O){if(O!==void 0)return J.radiansToDegrees(O)}function f(O){O.button===0&&p.startJogging("-")}function h(O){O.button===0&&p.startJogging("+")}function j(O){p.stopJogging()}function b(O){p.stopJogging()}function v(O,Z=1){if(O===void 0||Number.isNaN(O))return"";const X=l("General.degree.variable",{amount:O.toFixed(Z)});return O>0&&Z===0?`+${X}`:X}function C(O,Z=1){if(O===void 0||Number.isNaN(O))return"";const X=l("General.mm.variable",{amount:O.toFixed(Z)});return O>0&&Z===0?`+${X}`:X}return o.jsxs(_,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...s,sx:{"& .MuiIconButton-root":{width:"52px",color:u.palette.text.primary,alignContent:"center",backgroundColor:(R=u.palette.backgroundPaperElevation)==null?void 0:R[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(M=u.palette.backgroundPaperElevation)==null?void 0:M[11],color:u.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(P=u.palette.backgroundPaperElevation)==null?void 0:P[9]},"&:active":{...d}}},children:[o.jsx(W,{onPointerDown:f,onPointerUp:j,onPointerOut:b,disabled:c,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...p.activeJoggingDir==="-"?d:{}},children:o.jsx(ft,{sx:{pointerEvents:"none",color:(fe=(ee=(Y=(B=u.componentsExt)==null?void 0:B.JoggingPanel)==null?void 0:Y.JoggingJoint)==null?void 0:ee.Joint)==null?void 0:fe.arrowColor}})}),o.jsxs(_,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(xe=u.palette.backgroundPaperElevation)==null?void 0:xe[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[o.jsx(E,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:c?u.palette.action.disabled:u.palette.text.primary},children:r?v(g):C(g)}),o.jsx(Ae,{disabled:!0,"aria-label":"Joint position",min:r?S(n):n,max:r?S(a):a,value:g||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:c?u.palette.action.disabled:u.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:c?u.palette.action.disabled:u.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(be=u.palette.backgroundPaperElevation)==null?void 0:be[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(W,{onPointerDown:h,onPointerUp:j,onPointerOut:b,disabled:c,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...p.activeJoggingDir==="+"?d:{}},children:o.jsx(xt,{sx:{pointerEvents:"none",color:(Ce=(je=(Se=(ye=u.componentsExt)==null?void 0:ye.JoggingPanel)==null?void 0:Se.JoggingJoint)==null?void 0:je.Joint)==null?void 0:Ce.arrowColor}})})]})}));function ge(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 Fe(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 pe(t,e,n){return t.coordinate_system===e.coordinate_system&&t.tcp===e.tcp&&Fe(t.tcp_pose,e.tcp_pose,n)}function Be(t,e){const n=new le.Vector3(e[0],e[1],e[2]),a=new le.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)]}const Me=1e-4;class ie{constructor(e,n,a,r,i,c){this.nova=e,this.controller=n,this.motionGroup=a,this.description=r,this.initialMotionState=i,this.motionStateSocket=c,this.rapidlyChangingMotionState=i,c.addEventListener("message",s=>{var g;const l=(g=J.tryParseJson(s.data))==null?void 0:g.result;if(!l)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${s.data}`);ge(this.rapidlyChangingMotionState.joint_position,l.joint_position,Me)||k.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=l.joint_position}),pe(this.rapidlyChangingMotionState,l,Me)||k.runInAction(()=>{var x,u,d;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=l.tcp_pose:(x=l.tcp_pose)!=null&&x.orientation&&((u=l.tcp_pose)!=null&&u.position)&&((d=this.rapidlyChangingMotionState.tcp_pose)!=null&&d.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:l.tcp_pose.position,orientation:Be(l.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:console.warn("Received incomplete tcp_pose, ignoring",l.tcp_pose)}),l.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==l.tcp&&k.runInAction(()=>{this.rapidlyChangingMotionState.tcp=l.tcp}),this.rapidlyChangingMotionState.standstill!==l.standstill&&k.runInAction(()=>{this.rapidlyChangingMotionState.standstill=l.standstill})}),k.makeAutoObservable(this)}static async open(e,n){var u;const[a,r]=n.split("@"),i=await e.api.controller.getCurrentRobotControllerState(r),c=i==null?void 0:i.motion_groups.find(d=>d.motion_group===n);if(!i||!c)throw new Error(`Controller ${r} or motion group ${n} not found`);const s=e.openReconnectingWebsocket(`/controllers/${r}/motion-groups/${n}/state-stream`),l=await s.firstMessage(),g=(u=J.tryParseJson(l.data))==null?void 0:u.result;if(!g)throw new Error(`Unable to parse initial motion state message ${l.data}`);console.log(`Connected motion state websocket to motion group ${c.motion_group}. Initial state:
2
+ `,g);const x=await e.api.motionGroup.getMotionGroupDescription(r,c.motion_group);return new ie(e,i,c,x,g,s)}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 Ie="Movement request rejected. Another client is currently executing a 'Jogging' motion!";class re{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 ie.open(e,n),i=new re(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===V.JointTypeEnum.RevoluteJoint||n===V.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 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(`/controllers/${this.motionStream.controllerId}/execution/jogging`),this.joggingSocket.addEventListener("message",r=>{var c,s,l,g;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(Ie))){(g=this.joggingSocket)==null||g.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 f=[...e.position];f[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:f,orientation:e.orientation}}})}else if(c.type==="rotate"){if(!e.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const f=new se.Vector3(e.orientation[0],e.orientation[1],e.orientation[2]),h=f.length(),j=f.clone().normalize(),b=c.distanceRads*(i==="-"?-1:1),v=new se.Vector3(0,0,0);v[r]=1;const C=Math.cos(.5*b)*Math.cos(.5*h),w=Math.sin(.5*b)*Math.sin(.5*h),I=Math.sin(.5*b)*Math.cos(.5*h),R=Math.cos(.5*b)*Math.sin(.5*h),M=v.dot(j),P=v.clone().cross(j),B=2*Math.acos(C-w*M),Y=B/Math.sin(.5*B),ee=new se.Vector3().addScaledVector(P,w).addScaledVector(v,I).addScaledVector(j,R).multiplyScalar(Y);s.push({limits_override:{tcp_orientation_velocity_limit:a},path:{path_definition_name:"PathLine",target_pose:{position:e.position,orientation:[...ee]}}})}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 g={motion_group_model:l.motion_group_model,cycle_time:l.cycle_time,mounting:l.mounting,global:l.operation_limits.auto_limits},x=await this.nova.api.trajectoryPlanning.planTrajectory({motion_group_setup:g,start_joint_position:n,motion_commands:s}),u=x.response;if(!u)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(x)}`);this.trajectorySocket&&(console.warn("Trajectory jogging websocket already open; will close"),this.trajectorySocket.dispose()),this.trajectorySocket=this.nova.openReconnectingWebsocket(`/controllers/${this.motionStream.controllerId}/execution/trajectory`);const d=f=>{var h;if(!f||f.add_trajectory_error||f.message)if(this.onError)this.onError(f);else throw new Error(((h=f==null?void 0:f.add_trajectory_error)==null?void 0:h.message)||(f==null?void 0:f.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"})},p=async()=>{var f;await k.when(()=>!this.motionStream.rapidlyChangingMotionState.standstill),await k.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(f=this.trajectorySocket)==null||f.dispose(),this.trajectorySocket=null},y=async()=>{var f;await k.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(f=this.trajectorySocket)==null||f.dispose(),this.trajectorySocket=null},S=async f=>{if(f!=null&&f.message)if(this.onError){this.onError(f);return}else throw new Error(f.message||"Failed to execute trajectory, unknown error");this.motionStream.rapidlyChangingMotionState.standstill?await p():await y()};this.trajectorySocket.addEventListener("message",f=>{var j,b;const h=J.tryParseJson(f.data);if(!((j=h==null?void 0:h.result)!=null&&j.kind))throw new Error(`Failed to execute trajectory: Received invalid message ${f.data}`);if(this.onBlocked&&((b=h.result.message)!=null&&b.includes(Ie))){this.onBlocked();return}if(h.result.kind==="INITIALIZE_RECEIVED")d(h.result);else if(h.result.kind==="START_RECEIVED")S(h);else if(h.result.kind!=="PAUSE_RECEIVED")if(h.result.kind==="MOTION_ERROR"&&h.result.message)if(this.onError){this.onError(h);return}else throw new Error(h.result.message);else throw new Error(`Failed to execute trajectory, cannot handle message type "${h.result.kind}"`)}),this.trajectorySocket.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:u,tcp:this.tcp}})}}const Le=t=>{const e=t.softTimeout||3e3,[n,a]=m.useState(!1),r=A.useTheme();return m.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(ze,{loadingMessage:t.message,error:t.error}):o.jsxs(o.Fragment,{children:[o.jsx(Oe,{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..."})]})})},ze=t=>{const e=rt.makeErrorMessage(t.error),n=t.error instanceof Error?t.error.stack:null,a=A.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 ${ue.lowerFirst(it.capitalize(t.loadingMessage))} - `:"")+e,o.jsx("br",{}),n&&o.jsx("pre",{children:n})]})},Nt=D.observer(({store:t})=>{const{t:e}=L.useTranslation();return o.jsx(Ee,{"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(at,{severity:"error",sx:{mb:2},children:[o.jsx(st,{children:e("Jogging.Blocked.ti")}),e("Jogging.Blocked.lb")]}),o.jsx(H,{variant:"contained",color:"secondary",onClick:()=>t.unblock(),children:e("Jogging.Blocked.Reenable.bt")})]})})}),$e=D.observer(({store:t})=>{const{t:e}=L.useTranslation(),[n,a]=m.useState(t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),r=m.useRef(n);Q.useAnimationFrame(()=>{const c=t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;lt(r.current,c)||(r.current=c,a(c))});const i=[];for(const[c,s]of n.entries())s&&i.push(c);return o.jsx(E,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",sx:{margin:"0.5rem 1rem",textAlign:"center",minHeight:"1.5rem",visibility:i.length?"visible":"hidden"},children:e("Jogging.JointLimitsReached.lb",{jointNumbers:i.map(c=>c+1).join(", ")})})}),Wt=A.styled(dt)(({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 ne({labelValue:t,...e}){return o.jsxs(Wt,{fullWidth:!0,variant:"filled",children:[o.jsx(ut,{id:e.labelId,children:t}),o.jsx(gt,{...e})]})}const de=[{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}],Gt=[{id:"continuous"},...de],Ut=["coordsys","tool"];class ae{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=V.JointTypeEnum.RevoluteJoint;for(const g of n)if(g.coordinate_system===""){g.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)??V.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 g=this.jogger.motionStream.rapidlyChangingMotionState.tcp;g&&g!==this.selectedTcpId&&k.runInAction(()=>{this.selectedTcpId=g,this.tcpChangeInProgress=!1})})),window.joggingStore=this}static async loadFor(e){const{nova:n}=e,[a,r]=await Promise.all([n.api.controller.listCoordinateSystems(e.motionStream.controllerId,"ROTATION_VECTOR"),n.api.motionGroup.getMotionGroupDescription(e.motionStream.controllerId,e.motionGroupId)]),i=await n.api.motionGroupModels.getMotionGroupKinematicModel(r.motion_group_model),c=Object.entries(r.tcps||{}).map(([s,l])=>({id:s,readable_name:l.name,position:l.pose.position,orientation:l.pose.orientation}));return new ae(e,a||[],r,c,i.inverse_solver)}dispose(){for(const e of this.disposers)e();this.jogger.dispose()}get coordSystemCountByName(){return ue.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 Gt}get discreteIncrementOptions(){return de}get incrementOptionsById(){return te(this.incrementOptions,e=>e.id)}get tabsById(){return te(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 te(this.coordSystems,e=>e.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return te(this.tcps,e=>e.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:de.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}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("off")):await this.jogger.setJoggingMode("jogging",!1);const r=await this.waitForTcpConfirmation(e,1e4);k.runInAction(()=>{r?this.selectedTcpId=e:(this.jogger.tcp=n,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(r){throw 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=pt();this.lock(n);try{return await e()}finally{this.unlock(n)}}}const Ht=D.observer(({store:t,useDegree:e})=>{var c;const{t:n}=L.useTranslation(),a=m.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(ne,{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),disabled:t.isLocked,children:t.coordSystems.map(s=>o.jsx(G,{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(ne,{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.isLocked||t.tcpChangeInProgress,endAdornment:t.tcpChangeInProgress?o.jsx(ct,{position:"end",children:o.jsx(Oe,{size:16})}):void 0,children:t.tcps.map(s=>o.jsx(G,{value:s.id,children:s.id},s.id))},"tcp")),t.showOrientationSelect&&r.push(o.jsx(ne,{labelValue:n("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${a}`,value:t.selectedOrientation,onChange:s=>t.setSelectedOrientation(s.target.value),disabled:t.isLocked,children:Ut.map(s=>o.jsx(G,{value:s,children:i(s)},s))},"orientation")),t.showIncrementSelect&&r.push(o.jsxs(ne,{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),disabled:t.isLocked,children:[o.jsx(G,{value:"continuous",children:n("Jogging.Increment.Continuous.dd")},"continuous"),t.selectedOrientation==="tool"?null:t.discreteIncrementOptions.map(s=>o.jsx(G,{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))})}),Yt=A.styled(mt)(({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"}}}}}),Ve=D.observer(t=>{var i,c,s;const e=A.useTheme(),{store:n}=t,{t:a}=L.useTranslation();function r(l,g){g===t.velocity||!ht(g)||t.onVelocityChange(g,t.useDegree)}return o.jsxs(_,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[n.showVelocityLegend&&o.jsx(E,{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(Ae,{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(me,{value:t.velocity.toString()}))]})});function me({value:t,sx:e}){var a;const n=A.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(E,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:n.palette.text.primary,whiteSpace:"nowrap"},children:t})})}const qe=D.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(Ve,{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(me,{value:a(r,e),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),Zt=D.observer(({store:t,children:e})=>{const{t:n}=L.useTranslation(),a=A.useTheme();function r(d,p){(p==="translate"||p==="rotate")&&t.setSelectedCartesianMotionType(p)}async function i(d,p){const y=await t.activate(),S=y.motionStream.rapidlyChangingMotionState.tcp_pose,f=y.motionStream.rapidlyChangingMotionState.joint_position;S&&await t.withMotionLock(async()=>{try{t.setCurrentIncrementJog({axis:d.axis,direction:d.direction}),await t.jogger.runIncrementalCartesianMotion({currentTcpPose:S,currentJoints:f,coordSystemId:t.activeCoordSystemId,velocityInRelevantUnits:t.selectedCartesianMotionType==="translate"?t.translationVelocityMmPerSec:t.rotationVelocityRadsPerSec,axis:d.axis,direction:d.direction,motion:t.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:p.mm}:{type:"rotate",distanceRads:J.degreesToRadians(p.degrees)}})}finally{t.setCurrentIncrementJog(null),await t.deactivate()}})}async function c(d){if(!t.isLocked){if(await t.activate(),t.activeDiscreteIncrement)return i(d,t.activeDiscreteIncrement);d.motionType==="translate"?await t.jogger.translateTCP({axis:d.axis,direction:d.direction,velocityMmPerSec:t.translationVelocityMmPerSec}):await t.jogger.rotateTCP({axis:d.axis,direction:d.direction,velocityRadsPerSec:t.rotationVelocityRadsPerSec})}}async function s(){t.isLocked||t.activeDiscreteIncrement||await t.deactivate()}function l(d,p,y){var f,h,j;const S=(j=(h=(f=y.componentsExt)==null?void 0:f.JoggingPanel)==null?void 0:h.JoggingCartesian)==null?void 0:j.Axis;if(S)return p==="translate"?S[d]:S.CustomRotation??S[d]}const g=[{id:"x",icon:o.jsx(N.ForwardRef,{}),colors:l("X",t.selectedCartesianMotionType,a)},{id:"y",icon:o.jsx(N.ForwardRef$1,{}),colors:l("Y",t.selectedCartesianMotionType,a)},{id:"z",icon:o.jsx(N.ForwardRef$2,{}),colors:l("Z",t.selectedCartesianMotionType,a)}];function x(d){return n("General.mm.variable",{amount:d.toFixed(1)})}function u(d){return n("General.degree.variable",{amount:J.radiansToDegrees(d).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(Ht,{store:t,useDegree:t.selectedCartesianMotionType==="rotate"}),o.jsx(qe,{store:t,useDegree:t.selectedCartesianMotionType==="rotate"}),o.jsx(U,{})]}),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(Yt,{value:t.selectedCartesianMotionType,onChange:r,exclusive:!0,"aria-label":n("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[o.jsx(Te,{value:"translate",children:n("Jogging.Cartesian.Translation.bt")}),o.jsx(Te,{value:"rotate",children:n("Jogging.Cartesian.Rotation.bt")})]}),t.selectedCartesianMotionType==="translate"&&g.map(d=>{var p,y;return o.jsx(ce,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:t.isLocked,activeJoggingDirection:((p=t.incrementJogInProgress)==null?void 0:p.axis)===d.id?t.incrementJogInProgress.direction:void 0,label:o.jsxs(o.Fragment,{children:[d.icon,o.jsx(E,{sx:{fontSize:"24px",color:((y=d.colors)==null?void 0:y.labelColor)??a.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var S,f;return x(((f=(S=t.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:S.position)==null?void 0:f[J.XYZ_TO_VECTOR[d.id]])||0)},startJogging:S=>c({axis:d.id,motionType:"translate",direction:S}),stopJogging:s},d.id)}),t.selectedCartesianMotionType==="rotate"&&g.map(d=>{var p,y;return o.jsx(ce,{"data-testid":`jogging-cartesian-axis-control-${d.id}`,"aria-label":`jogging-cartesian-axis-control-${d.id}`,colors:d.colors,disabled:t.isLocked,activeJoggingDirection:((p=t.incrementJogInProgress)==null?void 0:p.axis)===d.id?t.incrementJogInProgress.direction:void 0,label:o.jsxs(o.Fragment,{children:[o.jsx(N.ForwardRef$6,{}),o.jsx(E,{sx:{fontSize:"24px",color:((y=d.colors)==null?void 0:y.labelColor)??a.palette.text.primary},children:d.id.toUpperCase()})]}),getDisplayedValue:()=>{var S,f;return u(((f=(S=t.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:S.orientation)==null?void 0:f[J.XYZ_TO_VECTOR[d.id]])||0)},startJogging:S=>c({axis:d.id,motionType:"rotate",direction:S}),stopJogging:s},d.id)})]})}),o.jsx($e,{store:t}),e&&o.jsx(U,{}),e]})}),Xt=D.observer(({store:t,children:e})=>{const n=A.useTheme();async function a(i){await t.activate(),await t.jogger.rotateJoints({joint:i.joint,direction:i.direction,velocityUnit:t.jointType===V.JointTypeEnum.PrismaticJoint?"mm/s":"rad/s",velocityValue:t.jointType===V.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(qe,{store:t,useDegree:t.jointType===V.JointTypeEnum.RevoluteJoint}),o.jsx(U,{}),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,g;const c=(g=(l=(s=t.motionGroupDescription.operation_limits.auto_limits)==null?void 0:s.joints)==null?void 0:l[i.index])==null?void 0:g.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(E,{color:t.isLocked?n.palette.text.disabled:n.palette.text.secondary,children:`G${i.index+1}`}),o.jsx(Je,{disabled:t.isLocked,lowerLimit:c==null?void 0:c.lower_limit,upperLimit:c==null?void 0:c.upper_limit,useDegree:t.jointType===V.JointTypeEnum.RevoluteJoint,getValue:()=>{const x=t.jogger.motionStream.rapidlyChangingMotionState.joint_position[i.index];return x!==void 0?x:void 0},startJogging:x=>a({joint:i.index,direction:x}),stopJogging:r})]},`joint-${i.index}`)})})}),o.jsx($e,{store:t}),e&&o.jsx(U,{}),e]})}),Qt=F.externalizeComponent(D.observer(t=>{const e=ue.isString(t.nova)?new V.NovaClient({instanceUrl:t.nova}):t.nova,n=D.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 re.open(e,t.motionGroupId);r=await ae.loadFor(i)}k.runInAction(()=>{n.joggingStore=r}),t.onSetup&&t.onSetup(r)}catch(r){n.loadingError=r}}return m.useEffect(()=>(a(),t.store?()=>null:()=>{var r;(r=n.joggingStore)==null||r.dispose()}),[t.store,t.nova,t.motionGroupId]),m.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(Kt,{store:n.joggingStore,children:t.children}):o.jsx(Le,{message:"Loading jogging",error:n.loadingError})})})),Kt=D.observer(({store:t,children:e})=>{const{t:n}=L.useTranslation();function a(){if(t.currentTab.id==="cartesian")return o.jsx(Zt,{store:t,children:e});if(t.currentTab.id==="joint")return o.jsx(Xt,{store:t,children:e})}return o.jsxs(_,{flexGrow:1,sx:{overflow:"hidden"},children:[o.jsx(_e,{"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(nt,{fontSize:"small",sx:{mr:1}}):o.jsx(ot,{fontSize:"small",sx:{mr:1}});return o.jsx(Pe,{"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(Nt,{store:t})]})}),Ne=t=>{var s;const{value:e,ref:n}=t,a=A.useTheme(),[r,i]=m.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 g=window.getSelection();if(g&&n&&"current"in n&&n.current){const x=document.createRange();x.selectNodeContents(n.current),g.removeAllRanges(),g.addRange(x)}}return!1}return m.useEffect(()=>{if(!r)return;const l=setTimeout(()=>i(!1),3e3);return()=>{l&&clearTimeout(l)}},[r]),o.jsx(yt,{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(E,{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})})})},en=F.externalizeComponent(D.observer(({tcpPose:t,showCopyButton:e=!1})=>{const[n,a]=m.useState(null),r=V.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(Ne,{value:r}),e&&o.jsx(H,{variant:"contained",color:"secondary",size:"small",onClick:i,sx:{flexShrink:0},children:n||"Copy"})]})})),tn=F.externalizeComponent(D.observer(({joints:t,showCopyButton:e=!1})=>{const[n,a]=m.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(Ne,{value:r}),e&&o.jsx(H,{variant:"contained",color:"secondary",size:"small",onClick:i,sx:{flexShrink:0},children:n||"Copy"})]})}));class We{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 K=(t,e,n)=>({id:n||`${Date.now()}-${Math.random().toString(36).substring(2,11)}`,timestamp:new Date,message:t,level:e}),nn=(t,e)=>K(t,"debug",e),on=(t,e)=>K(t,"info",e),rn=(t,e)=>K(t,"warning",e),an=(t,e)=>K(t,"error",e),Ge=F.externalizeComponent(D.observer(t=>{var x;const{messages:e=[],onClear:n,height:a=400,sx:r}=t,i=A.useTheme(),c=m.useRef(null);m.useEffect(()=>{if(e.length===0)return;const u=c.current;if(!u)return;const d=setTimeout(()=>{u.scrollTop=u.scrollHeight},10);return()=>clearTimeout(d)},[e.length]);const s=u=>u.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),l=u=>{switch(u){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}},g=({message:u})=>{const[d,p]=m.useState(!1),[y,S]=m.useState(!1),[f,h]=m.useState(!1),j=u.message.length>150,b=async()=>{try{await navigator.clipboard.writeText(u.message),S(!0),setTimeout(()=>S(!1),2e3)}catch(C){console.error("Failed to copy message:",C)}},v=j&&!d?`${u.message.substring(0,150)}...`:u.message;return o.jsx(T,{onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!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(E,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:i.palette.text.disabled,whiteSpace:"nowrap",flexShrink:0},children:["[",s(u.timestamp),"]"]}),o.jsx(E,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:l(u.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:f?1:0,transition:"opacity 0.2s ease-in-out",visibility:f?"visible":"hidden"},children:[o.jsx(W,{size:"small",onClick:b,sx:{padding:"2px",color:i.palette.text.secondary,"&:hover":{backgroundColor:i.palette.action.hover}},title:y?"Copied!":"Copy message",children:o.jsx(St,{sx:{fontSize:12}})}),j&&o.jsx(W,{size:"small",onClick:()=>p(!d),sx:{padding:"2px",color:i.palette.text.secondary,"&:hover":{backgroundColor:i.palette.action.hover}},title:d?"Collapse":"Expand",children:d?o.jsx(Ct,{sx:{fontSize:12}}):o.jsx(vt,{sx:{fontSize:12}})})]})]})},u.id)};return o.jsxs(Tt,{sx:{backgroundColor:((x=i.palette.backgroundPaperElevation)==null?void 0:x[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(jt,{sx:{fontSize:16,color:i.palette.action.active,opacity:.56}}),o.jsx(E,{sx:{fontWeight:500,fontSize:"14px",lineHeight:"143%",letterSpacing:"0.17px",color:i.palette.text.primary},children:"Log"})]}),o.jsx(H,{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(E,{sx:{color:i.palette.text.disabled,fontSize:"12px",fontStyle:"italic",textAlign:"center",marginTop:2},children:"No log messages"}):e.map(u=>o.jsx(g,{message:u},u.id))})]})})),sn=F.externalizeComponent(D.observer(t=>{const{store:e,onStoreReady:n,...a}=t,r=m.useRef(n);m.useEffect(()=>{r.current=n},[n]);const i=m.useMemo(()=>{var l;const s=e||new We;return(l=r.current)==null||l.call(r,s),s},[e]),c=()=>{i.clearMessages()};return o.jsx(Ge,{...a,messages:i.messages,onClear:c})}));function ln(){const t=window.location.href;return t.substring(0,t.indexOf("/",t.indexOf("//")+2))}function cn({baseUrl:t=ln(),...e}){return o.jsxs(wt,{"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(kt,{id:"no-motion-group-modal-title",children:"No motion group found"}),o.jsxs(It,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[o.jsx(E,{color:"#fff",children:"Found no devices to connect to."}),o.jsx(E,{color:"#fff",children:"Please ensure a motion group has been created."})]}),o.jsx(Mt,{children:o.jsxs(_,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[o.jsx(H,{href:`${t}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),o.jsx(H,{href:`${t}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}var he=(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))(he||{});const Ue=F.externalizeComponent(D.observer(({setupState:t,className:e})=>{const n=A.useTheme(),{t:a}=L.useTranslation(),r=()=>{var g,x,u,d,p,y,S;switch(t){case"READY":return{label:a("RobotSetupReadinessIndicator.Ready.lb"),indicatorColor:((g=n.palette.tertiary)==null?void 0:g.main)||n.palette.primary.main,backgroundColor:((x=n.palette.backgroundPaperElevation)==null?void 0:x[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:((u=n.palette.backgroundPaperElevation)==null?void 0:u[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:((d=n.palette.backgroundPaperElevation)==null?void 0:d[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:((p=n.palette.backgroundPaperElevation)==null?void 0:p[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:((y=n.palette.backgroundPaperElevation)==null?void 0:y[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(Et,{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(E,{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}}})})),dn=F.externalizeComponent(D.observer(({robotName:t,robotType:e,setupState:n,PreconditionComponent:a=Ue,className:r})=>{var l;const i=A.useTheme(),c=e||"Robot",s=n===he.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(N.ForwardRef$5,{})}):o.jsx(Rt,{sx:{color:i.palette.error.main,fontSize:24}}),o.jsx(E,{variant:"body1",sx:{fontWeight:500,color:i.palette.text.primary},children:t}),o.jsx(U,{orientation:"vertical",flexItem:!0,sx:{backgroundColor:i.palette.text.secondary,opacity:.3,width:"1px"}}),o.jsx(E,{variant:"body2",sx:{color:i.palette.text.secondary},children:c})]}),a&&o.jsx(a,{setupState:n})]})})),un=A.styled(Pt,{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}}]}}),gn=t=>{const{ref:e,...n}=t;return o.jsx(un,{ref:e,selected:t.selected,...n,color:"secondary",variant:"circular"})};function pn(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 mn({children:t,...e}){const{fullWidth:n,indicator:a,onChange:r,orientation:i,scrollButtons:c,selectionFollowsFocus:s,textColor:l,value:g,variant:x,...u}=e;return o.jsx(T,{...u,children:t})}const hn=F.externalizeComponent(D.observer(t=>{const{items:e,activeTab:n,defaultActiveTab:a=0,onTabChange:r,sx:i,ref:c}=t,s=n!==void 0,[l,g]=m.useState(a),x=s?n:l;m.useEffect(()=>{s||e.length!==0&&(l<0||l>e.length-1)&&g(0)},[e.length,s,l]);const u=(d,p)=>{s||g(p),r==null||r(p)};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:d=>d.spacing(2),paddingRight:d=>d.spacing(2.5)},children:o.jsx(_e,{value:x,onChange:u,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((d,p)=>{var v,C,w;const y=()=>{if(!d.badge)return;const I=d.badge.content,R=d.badge.max;return typeof I=="number"&&R&&I>R?`${R}+`:I},S=()=>{if(!d.badge)return!1;const I=d.badge.content,R=d.badge.showZero;return!(I===0&&!R)},f=y(),h=S(),j=()=>{s||g(p),r==null||r(p)},b=o.jsx(Pe,{label:d.label,icon:d.icon,iconPosition:"start",disableRipple:!0,onClick:j,sx:{minHeight:"32px",height:"32px",padding:"0px 10px",borderRadius:"12px",backgroundColor:I=>{var R;return((R=I.palette.backgroundPaperElevation)==null?void 0:R[11])||"#32344B"},color:"text.primary",opacity:x===p?1:.38,fontSize:"13px",transition:"all 0.2s ease-in-out",position:"relative",overflow:"visible","&:hover":{opacity:x===p?1:.6},"&.Mui-selected":{opacity:1,backgroundColor:I=>{var R;return((R=I.palette.backgroundPaperElevation)==null?void 0:R[11])||"#32344B"},color:"text.primary"},"&:focus":{outline:"none"},"&:active":{transform:"none"}}},d.id);return h?o.jsx(mn,{component:"span",sx:{display:"inline-flex"},children:o.jsx(_t,{badgeContent:f,color:((v=d.badge)==null?void 0:v.color)||"error",max:(C=d.badge)==null?void 0:C.max,showZero:(w=d.badge)==null?void 0:w.showZero,anchorOrigin:{vertical:"top",horizontal:"right"},overlap:"rectangular",sx:{"& .MuiBadge-badge":{opacity:"1 !important"}},children:b})},d.id):b})})}),o.jsx(T,{sx:{mt:d=>d.spacing(2),borderBottom:1,borderColor:"divider"}}),o.jsx(T,{sx:{flex:1,overflow:"auto"},children:e.map((d,p)=>o.jsx(pn,{value:x,index:p,children:d.content},d.id))})]})})),fn=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(":")},ke=(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(" ")},xn=({timerState:t,animationState:e,hasError:n,className:a})=>{const{t:r}=L.useTranslation(),i=A.useTheme(),{elapsedTime:c,currentProgress:s}=t,{showErrorAnimation:l,showPauseAnimation:g,showMainText:x}=e;return o.jsxs(T,{className:a,sx:{position:"relative",width:264,height:264,display:"flex",alignItems:"center",justifyContent:"center"},children:[o.jsx(Ot.Gauge,{width:264,height:264,value:s,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:g||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:"#171927",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:"#292B3F",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(q,{in:x&&n,timeout:200,children:o.jsx(E,{variant:"h6",sx:{position:"absolute",fontSize:"16px",fontWeight:500,color:i.palette.error.light},children:r("timer.error")})}),o.jsx(q,{in:x&&!n,timeout:300,children:o.jsx(E,{variant:"h1",sx:{position:"absolute",fontSize:"48px",fontWeight:500,color:i.palette.text.primary,lineHeight:1,letterSpacing:"-0.5px"},children:fn(c)})})]})})]})},bn=({timerState:t,animationState:e,hasError:n,compact:a,className:r})=>{const{t:i,i18n:c}=L.useTranslation(),s=A.useTheme(),{elapsedTime:l,currentProgress:g}=t,{showErrorAnimation:x,showPauseAnimation:u}=e;return a?o.jsx(T,{className:r,sx:{display:"flex",alignItems:"center",m:0},children:o.jsx(E,{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"):ke(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:u||x?.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-g/100)}`,style:{transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),o.jsx(E,{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"):ke(l,c.language)})]})},yn=()=>{const[t,e]=m.useState({showPauseAnimation:!1,showErrorAnimation:!1,showMainText:!0}),n=m.useRef(null),a=m.useRef(null),r=m.useRef(null),i=m.useCallback(()=>{e(u=>({...u,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(u=>({...u,showPauseAnimation:!1}))},800)},[]),c=m.useCallback(()=>{e(u=>({...u,showErrorAnimation:!0})),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{e(u=>({...u,showErrorAnimation:!1}))},600)},[]),s=m.useCallback(()=>{e(u=>({...u,showErrorAnimation:!1})),a.current&&clearTimeout(a.current)},[]),l=m.useCallback(()=>{e(u=>({...u,showMainText:!1})),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(u=>({...u,showMainText:!0}))},200)},[]),g=m.useCallback(()=>{e(u=>({...u,showMainText:!0}))},[]),x=m.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:g,cleanup:x}},Sn=({autoStart:t,hasError:e,onPauseAnimation:n,onErrorAnimation:a,onClearErrorAnimation:r})=>{const[i,c]=m.useState({elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),s=m.useRef(null),l=m.useRef(null),g=m.useRef(0),x=m.useRef(0),[u]=Q.useInterpolation([0],{tension:80,friction:18,onChange:([h])=>{c(j=>({...j,currentProgress:h}))}}),d=m.useCallback((h=0)=>{const j=h/60%1*100;c(b=>({...b,elapsedTime:h,isPausedState:!1,currentProgress:j})),g.current=0,x.current=j,u.setImmediate([j]),t?(l.current=Date.now()-h*1e3,c(b=>({...b,isRunning:!0}))):l.current=null},[t,u]),p=m.useCallback(()=>{if(l.current&&i.isRunning){const j=(Date.now()-l.current)/1e3+g.current,b=j/60%1*100;u.setTarget([b]),c(v=>({...v,elapsedTime:Math.floor(j)}))}c(h=>({...h,isRunning:!1,isPausedState:!0})),n()},[i.isRunning,u,n]),y=m.useCallback(()=>{i.isPausedState&&(g.current=i.elapsedTime,l.current=Date.now(),c(h=>({...h,isRunning:!0,isPausedState:!1})))},[i.isPausedState,i.elapsedTime]),S=m.useCallback(()=>{c(h=>({...h,elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0})),g.current=0,l.current=null,x.current=0,u.setImmediate([0])},[u]),f=m.useCallback(()=>i.isPausedState,[i.isPausedState]);return m.useEffect(()=>{e?(i.isRunning&&(c(h=>({...h,wasRunningBeforeError:!0})),p()),a()):(i.wasRunningBeforeError&&!i.isRunning&&(c(h=>({...h,wasRunningBeforeError:!1})),y()),r())},[e,i.isRunning,i.wasRunningBeforeError,p,y,a,r]),m.useEffect(()=>{if(i.isRunning){const h=()=>{if(l.current){const b=(Date.now()-l.current)/1e3+g.current,v=b/60%1*100;c(w=>({...w,elapsedTime:Math.floor(b)})),Math.abs(v-x.current)>.1&&(u.setTarget([v]),x.current=v)}s.current=requestAnimationFrame(h)};s.current=requestAnimationFrame(h)}else s.current&&(cancelAnimationFrame(s.current),s.current=null);return()=>{s.current&&(cancelAnimationFrame(s.current),s.current=null)}},[i.isRunning,u]),m.useEffect(()=>{let h=null;const j=()=>{u.update(),h=requestAnimationFrame(j)};return h=requestAnimationFrame(j),()=>{h&&cancelAnimationFrame(h)}},[u]),{timerState:i,controls:{start:d,pause:p,resume:y,reset:S,isPaused:f}}},jn=F.externalizeComponent(D.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:g,setInitialAnimationState:x,cleanup:u}=yn(),{timerState:d,controls:p}=Sn({autoStart:e,hasError:i,onPauseAnimation:s,onErrorAnimation:l,onClearErrorAnimation:g});return m.useEffect(()=>{x()},[x]),m.useEffect(()=>{let y=!0;const S=setTimeout(()=>{y&&t(p)},0);return()=>{y=!1,clearTimeout(S)}},[t,p]),m.useEffect(()=>u,[u]),n==="small"?o.jsx(bn,{timerState:d,animationState:c,hasError:i,compact:a,className:r}):o.jsx(xn,{timerState:d,animationState:c,hasError:i,className:r})})),Re=1e-4,Cn={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class oe{constructor(e,n,a,r,i,c,s,l,g,x){this.nova=e,this.controller=n,this.motionGroup=a,this.initialMotionState=r,this.motionStateSocket=i,this.isVirtual=c,this.tcps=s,this.description=l,this.initialControllerState=g,this.controllerStateSocket=x,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.rapidlyChangingMotionState=r,this.controllerState=g,x.addEventListener("message",u=>{var p;const d=(p=J.tryParseJson(u.data))==null?void 0:p.result;d&&k.runInAction(()=>{this.controllerState=d})}),i.addEventListener("message",u=>{var p;const d=(p=J.tryParseJson(u.data))==null?void 0:p.result;if(!d)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${u.data}`);ge(this.rapidlyChangingMotionState.joint_position,d.joint_position,Re)||k.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=d.joint_position}),pe(this.rapidlyChangingMotionState,d,Re)||k.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=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})}),k.makeAutoObservable(this)}static async connectMultiple(e,n){return Promise.all(n.map(a=>oe.connect(e,a)))}static async connect(e,n){var h,j;const[a,r]=n.split("@"),i=await e.api.controller.getCurrentRobotControllerState(r),c=i==null?void 0:i.motion_groups.find(b=>b.motion_group===n);if(!i||!c)throw new Error(`Controller ${r} or motion group ${n} not found`);const s=e.openReconnectingWebsocket(`/controllers/${r}/motion-groups/${n}/state-stream`),l=await s.firstMessage(),g=(h=J.tryParseJson(l.data))==null?void 0:h.result;if(!g)throw new Error(`Unable to parse initial motion state message ${l.data}`);console.log(`Connected motion state websocket to motion group ${c.motion_group}. Initial state:
3
+ `,g);const u=(await e.api.controller.getRobotController(i.controller)).configuration.kind==="VirtualController",d=await e.api.motionGroup.getMotionGroupDescription(r,c.motion_group),p=Object.entries(d.tcps||{}).map(([b,v])=>({id:b,readable_name:v.name,position:v.pose.position,orientation:v.pose.orientation})),y=e.openReconnectingWebsocket(`/controllers/${i.controller}/state-stream?response_rate=1000`),S=await y.firstMessage(),f=(j=J.tryParseJson(S.data))==null?void 0:j.result;if(!f)throw new Error(`Unable to parse initial controller state message ${S.data}`);return console.log(`Connected controller state websocket to controller ${i.controller}. Initial state:
4
+ `,f),new oe(e,i,c,g,s,u,p,d,f,y)}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=>({...Cn,...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,g;const e=new we.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,((g=(l=this.description.mounting)==null?void 0:l.orientation)==null?void 0:g[2])||0),n=e.length(),a=e.normalize();return new we.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.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.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}}function He(){var e,n,a,r,i,c;const t=A.createTheme({palette:{mode:"dark",text:{primary:"rgba(255, 255, 255, 1)",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.38)"},primary:{main:"rgba(142, 86, 252, 1)",dark:"rgba(136, 58, 255, 1)",light:"rgba(157, 131, 246, 1)",contrastText:"rgba(255, 255, 255, 0.87)"},secondary:{main:"rgba(255, 255, 255, 1)",dark:"rgba(255, 255, 255, 0.06)",contrastText:"rgba(255, 255, 255, 0.87)"},tertiary:{main:"rgba(100, 255, 218, 1)",dark:"rgba(38, 166, 154, 1)",light:"rgba(167, 255, 235, 1)",contrastText:"rgba(0, 0, 0, 1)"},error:{main:"rgba(239, 83, 80, 1)",dark:"rgba(229, 57, 53, 1)",light:"rgba(239, 154, 154, 1)",contrastText:"rgba(255, 255, 255, 1)"},warning:{main:"rgba(255, 171, 64, 1)",dark:"rgba(255, 145, 0, 1)",light:"rgba(255, 209, 128, 1)",contrastText:"rgba(0, 0, 0, 0.87)"},success:{main:"rgba(38, 166, 154, 1)",dark:"rgba(0, 121, 107, 1)",light:"rgba(128, 203, 196, 1)",contrastText:"rgba(255, 255, 255, 0.87)"},background:{default:"rgba(2, 6, 23, 1)",paper:"rgba(17, 19, 31, 1)"},action:{active:"rgba(255, 255, 255, 0.56)",hover:"rgba(255, 255, 255, 0.08)",selected:"rgba(255, 255, 255, 0.16)",disabledBackground:"rgba(255, 255, 255, 0.12)",focus:"rgba(255, 255, 255, 0.12)",disabled:"rgba(255, 255, 255, 0.38)"},common:{white:"rgba(255, 255, 255, 1)",black:"rgba(0, 0, 0, 1)"},divider:"rgba(255, 255, 255, 0.12)",backgroundPaperElevation:{0:"rgba(17,19,31,1.0)",1:"rgba(20,22,35,1.0)",2:"rgba(23,25,39,1.0)",3:"rgba(26,28,43,1.0)",4:"rgba(29,31,47,1.0)",5:"rgba(32,34,51,1.0)",6:"rgba(35,37,55,1.0)",7:"rgba(38,40,59,1.0)",8:"rgba(41,43,63,1.0)",9:"rgba(44,46,67,1.0)",10:"rgba(47,49,71,1.0)",11:"rgba(50,52,75,1.0)",12:"rgba(53,55,79,1.0)",13:"rgba(56,58,83,1.0)",14:"rgba(59,61,87,1.0)",15:"rgba(62,64,91,1.0)",16:"rgba(57,63,87,1.0)"}},paletteExt:{primary:{hover:"rgba(142, 86, 252, 0.08)",selected:"rgba(142, 86, 252, 0.16)",focus:"rgba(142, 86, 252, 0.12)",focusVisible:"rgba(142, 86, 252, 0.3)",outlineBorder:"rgba(142, 86, 252, 0.5)"},secondary:{tonal:"rgba(255,255,255,0.1)"}}});return{...t,components:{MuiCssBaseline:{styleOverrides:{"html, body, *":{scrollbarWidth:"none",msOverflowStyle:"none"},"html:hover, body:hover, *:hover":{scrollbarWidth:"thin",scrollbarColor:`${t.palette.divider} transparent`},".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:{root:{},panelContent:{borderRadius:"16px !important"},filterForm:{"& .MuiInputBase-root":{borderRadius:"10px !important","& fieldset":{borderRadius:"10px !important"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"10px !important"}}},filterFormValueInput:{"& .MuiInputBase-root":{borderRadius:"10px !important","& fieldset":{borderRadius:"10px !important"},"& .MuiOutlinedInput-notchedOutline":{borderRadius:"10px !important"}}}}},MuiButton:{styleOverrides:{root:{textTransform:"none",borderRadius:"10px"}},variants:[{props:{color:"secondary",variant:"contained"},style:{border:`1px solid ${t.palette.divider}`,background:(a=(n=(e=t.paletteExt)==null?void 0:e.secondary)==null?void 0:n.tonal)==null?void 0:a.toString()}},{props:{color:"secondary",variant:"outlined"},style:{border:`1px solid ${t.palette.divider}`}}]},MuiTab:{styleOverrides:{root:{textTransform:"none",color:t.palette.text.secondary,"&.Mui-selected":{color:t.palette.text.primary}}}},MuiTabs:{styleOverrides:{root:{background:(r=t.palette.backgroundPaperElevation)==null?void 0:r[1]}}},MuiToggleButtonGroup:{styleOverrides:{root:{".MuiToggleButtonGroup-firstButton":{borderRadius:"10px 0 0 10px"},".MuiToggleButtonGroup-lastButton":{borderRadius:"0 10px 10px 0"}}}},MuiToggleButton:{styleOverrides:{root:{textTransform:"none",padding:"6px 16px"}}},MuiSelect:{variants:[{props:{variant:"filled"},style:{borderRadius:"10px","::before, ::after":{visibility:"collapse"},".MuiInputBase-input":{padding:"6px 16px",borderRadius:"10px"}}}]},MuiDrawer:{styleOverrides:{paper:{border:"none",boxShadow:"4px 0 8px -4px rgba(0, 0, 0, 0.3)"}}},MuiFab:{styleOverrides:{root:{background:(c=(i=t.paletteExt)==null?void 0:i.secondary)==null?void 0:c.tonal}},variants:[{props:{color:"primary"},style:{background:t.palette.primary.main}}]}},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:t.palette.text.primary},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:t.palette.text.primary},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:t.palette.text.primary}}},JoggingJoint:{Joint:{arrowColor:t.palette.text.primary}},VelocitySlider:{sliderLegendColor:t.palette.text.primary}}}}}function vn(){const t=He();return t.palette.mode="light",t}function Tn(t){var a,r,i,c;let e=!0;((a=t.palette)==null?void 0:a.mode)==="light"?e=!1:((r=t.palette)==null?void 0:r.mode)!=="dark"&&(e=!(typeof window<"u"&&((c=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: light)"))==null?void 0:c.matches)));const n=e?He():vn();return A.createTheme(n,t)}exports.AppHeader=Jt;exports.ConnectedMotionGroup=oe;exports.CycleTimer=qt;exports.JoggerConnection=re;exports.JoggingCartesianAxisControl=ce;exports.JoggingJointValueControl=Je;exports.JoggingPanel=Qt;exports.JoggingStore=ae;exports.LoadingCover=Le;exports.LoadingErrorMessage=ze;exports.LogPanel=sn;exports.LogStore=We;exports.LogViewer=Ge;exports.MotionStreamConnection=ie;exports.NoMotionGroupModal=cn;exports.PoseCartesianValues=en;exports.PoseJointValues=tn;exports.RobotListItem=dn;exports.RobotSetupReadinessIndicator=Ue;exports.RobotSetupReadinessState=he;exports.SelectableFab=gn;exports.TabBar=hn;exports.Timer=jn;exports.VelocitySlider=Ve;exports.VelocitySliderLabel=me;exports.WandelbotsDataGrid=De;exports.createDebugMessage=nn;exports.createErrorMessage=an;exports.createInfoMessage=on;exports.createLogMessage=K;exports.createNovaMuiTheme=Tn;exports.createWarningMessage=rn;exports.jointValuesEqual=ge;exports.poseEqual=Fe;exports.tcpMotionEqual=pe;exports.unwrapRotationVector=Be;