@wandelbots/wandelbots-js-react-components 3.3.2-pr.docs-robot.419.890441d → 3.3.2-pr.fix-update-dependencies.436.72f7910

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/3d.cjs.js +1 -1
  2. package/dist/3d.es.js +1 -1
  3. package/dist/{LoadingCover-CunO727J.js → LoadingCover-Dr9hDTku.js} +2 -2
  4. package/dist/{LoadingCover-CunO727J.js.map → LoadingCover-Dr9hDTku.js.map} +1 -1
  5. package/dist/{LoadingCover-TeNDvBAl.cjs → LoadingCover-r2yhJZF9.cjs} +2 -2
  6. package/dist/{LoadingCover-TeNDvBAl.cjs.map → LoadingCover-r2yhJZF9.cjs.map} +1 -1
  7. package/dist/{WandelscriptEditor-b2onJkmt.cjs → WandelscriptEditor-Dj7TBCkF.cjs} +2 -2
  8. package/dist/{WandelscriptEditor-b2onJkmt.cjs.map → WandelscriptEditor-Dj7TBCkF.cjs.map} +1 -1
  9. package/dist/{WandelscriptEditor-CB2JeI-5.js → WandelscriptEditor-DnJvITTA.js} +3 -3
  10. package/dist/{WandelscriptEditor-CB2JeI-5.js.map → WandelscriptEditor-DnJvITTA.js.map} +1 -1
  11. package/dist/core.cjs.js +1 -1
  12. package/dist/core.es.js +4 -4
  13. package/dist/externalizeComponent.d.ts.map +1 -1
  14. package/dist/index-CAib4NKw.js +2261 -0
  15. package/dist/index-CAib4NKw.js.map +1 -0
  16. package/dist/{index-KsgdpgvF.cjs → index-CqMZL0FV.cjs} +2 -2
  17. package/dist/{index-KsgdpgvF.cjs.map → index-CqMZL0FV.cjs.map} +1 -1
  18. package/dist/{index-BSBCGCFW.js → index-CxasuX80.js} +2 -2
  19. package/dist/{index-BSBCGCFW.js.map → index-CxasuX80.js.map} +1 -1
  20. package/dist/index-DxwppshT.cjs +29 -0
  21. package/dist/index-DxwppshT.cjs.map +1 -0
  22. package/dist/index.cjs.js +1 -1
  23. package/dist/index.es.js +6 -6
  24. package/dist/{manufacturerHomePositions--1G0LNoV.cjs → manufacturerHomePositions-Ca80ycLi.cjs} +2 -2
  25. package/dist/{manufacturerHomePositions--1G0LNoV.cjs.map → manufacturerHomePositions-Ca80ycLi.cjs.map} +1 -1
  26. package/dist/{manufacturerHomePositions-CZto6Qyy.js → manufacturerHomePositions-CgaG5vaK.js} +3 -3
  27. package/dist/{manufacturerHomePositions-CZto6Qyy.js.map → manufacturerHomePositions-CgaG5vaK.js.map} +1 -1
  28. package/dist/theming-BQcKj8Gp.cjs +133 -0
  29. package/dist/theming-BQcKj8Gp.cjs.map +1 -0
  30. package/dist/{theming-BHuWUUZY.js → theming-Bafjg0Wg.js} +8553 -5916
  31. package/dist/theming-Bafjg0Wg.js.map +1 -0
  32. package/dist/wandelscript.cjs.js +1 -1
  33. package/dist/wandelscript.es.js +1 -1
  34. package/package.json +12 -12
  35. package/src/externalizeComponent.tsx +1 -17
  36. package/dist/index-DH-ITo65.cjs +0 -115
  37. package/dist/index-DH-ITo65.cjs.map +0 -1
  38. package/dist/index-DLrnRIOH.js +0 -5676
  39. package/dist/index-DLrnRIOH.js.map +0 -1
  40. package/dist/theming-BHuWUUZY.js.map +0 -1
  41. package/dist/theming-neVGQ-FN.cjs +0 -79
  42. package/dist/theming-neVGQ-FN.cjs.map +0 -1
@@ -1,79 +0,0 @@
1
- "use strict";var Vu=Object.defineProperty;var Hu=(e,t,n)=>t in e?Vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Hu(e,typeof t!="symbol"?t+"":t,n);const p=require("./index-DH-ITo65.cjs"),T=require("@mui/material"),re=require("mobx-react-lite"),O=require("react"),le=require("react-i18next"),g=require("prop-types"),se=require("./index-KsgdpgvF.cjs"),Ne=require("@mui/x-data-grid"),Sl=require("lodash-es"),ae=require("mobx"),me=require("@wandelbots/nova-js"),Tl=require("./LoadingCover-TeNDvBAl.cjs"),Kn=require("@mui/icons-material"),Wu=require("@mui/x-charts"),Wi=require("three");function Cl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const R=Cl(O),Ts=Cl(Wi);function qu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}const Yu=e=>{var r;const t={systemProps:{},otherProps:{}},n=((r=e==null?void 0:e.theme)==null?void 0:r.unstable_sxConfig)??p.defaultSxConfig;return Object.keys(e).forEach(i=>{n[i]?t.systemProps[i]=e[i]:t.otherProps[i]=e[i]}),t};function Ju(e){const{sx:t,...n}=e,{systemProps:r,otherProps:i}=Yu(n);let o;return Array.isArray(t)?o=[r,...t]:typeof t=="function"?o=(...s)=>{const a=t(...s);return p.isPlainObject(a)?{...r,...a}:r}:o={...r,...t},{...i,sx:o}}function Fr(e,t,n="Mui"){const r={};return t.forEach(i=>{r[i]=p.generateUtilityClass(e,i,n)}),r}function _l(e,t=""){return e.displayName||e.name||t}function Cs(e,t,n){const r=_l(t);return e.displayName||(r!==""?`${n}(${r})`:n)}function Xu(e){if(e!=null){if(typeof e=="string")return e;if(typeof e=="function")return _l(e,"Component");if(typeof e=="object")switch(e.$$typeof){case p.reactIsExports.ForwardRef:return Cs(e,e.render,"ForwardRef");case p.reactIsExports.Memo:return Cs(e,e.type,"memo");default:return}}}function Ml(e){const{variants:t,...n}=e,r={variants:t,style:p.internal_serializeStyles(n),isProcessed:!0};return r.style===n||t&&t.forEach(i=>{typeof i.style!="function"&&(i.style=p.internal_serializeStyles(i.style))}),r}const Ku=p.createTheme();function yi(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function At(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Zu(e){return e?(t,n)=>n[e]:null}function Qu(e,t,n){e.theme=nd(e.theme)?n:e.theme[t]||e.theme}function mr(e,t,n){const r=typeof t=="function"?t(e):t;if(Array.isArray(r))return r.flatMap(i=>mr(e,i,n));if(Array.isArray(r==null?void 0:r.variants)){let i;if(r.isProcessed)i=n?At(r.style,n):r.style;else{const{variants:o,...s}=r;i=n?At(p.internal_serializeStyles(s),n):s}return Rl(e,r.variants,[i],n)}return r!=null&&r.isProcessed?n?At(p.internal_serializeStyles(r.style),n):r.style:n?At(p.internal_serializeStyles(r),n):r}function Rl(e,t,n=[],r=void 0){var o;let i;e:for(let s=0;s<t.length;s+=1){const a=t[s];if(typeof a.props=="function"){if(i??(i={...e,...e.ownerState,ownerState:e.ownerState}),!a.props(i))continue}else for(const c in a.props)if(e[c]!==a.props[c]&&((o=e.ownerState)==null?void 0:o[c])!==a.props[c])continue e;typeof a.style=="function"?(i??(i={...e,...e.ownerState,ownerState:e.ownerState}),n.push(r?At(p.internal_serializeStyles(a.style(i)),r):a.style(i))):n.push(r?At(p.internal_serializeStyles(a.style),r):a.style)}return n}function jl(e={}){const{themeId:t,defaultTheme:n=Ku,rootShouldForwardProp:r=yi,slotShouldForwardProp:i=yi}=e;function o(a){Qu(a,t,n)}return(a,c={})=>{p.internal_mutateStyles(a,w=>w.filter(E=>E!==p.styleFunctionSx));const{name:l,slot:u,skipVariantsResolver:d,skipSx:h,overridesResolver:f=Zu(Il(u)),...m}=c,y=l&&l.startsWith("Mui")||u?"components":"custom",x=d!==void 0?d:u&&u!=="Root"&&u!=="root"||!1,b=h||!1;let S=yi;u==="Root"||u==="root"?S=r:u?S=i:rd(a)&&(S=void 0);const v=p.styled(a,{shouldForwardProp:S,label:td(l,u),...m}),_=w=>{if(w.__emotion_real===w)return w;if(typeof w=="function")return function(M){return mr(M,w,M.theme.modularCssLayers?y:void 0)};if(p.isPlainObject(w)){const E=Ml(w);return function(j){return E.variants?mr(j,E,j.theme.modularCssLayers?y:void 0):j.theme.modularCssLayers?At(E.style,y):E.style}}return w},C=(...w)=>{const E=[],M=w.map(_),j=[];if(E.push(o),l&&f&&j.push(function(I){var Y,F;const U=(F=(Y=I.theme.components)==null?void 0:Y[l])==null?void 0:F.styleOverrides;if(!U)return null;const N={};for(const J in U)N[J]=mr(I,U[J],I.theme.modularCssLayers?"theme":void 0);return f(I,N)}),l&&!x&&j.push(function(I){var N,Y;const k=I.theme,U=(Y=(N=k==null?void 0:k.components)==null?void 0:N[l])==null?void 0:Y.variants;return U?Rl(I,U,[],I.theme.modularCssLayers?"theme":void 0):null}),b||j.push(p.styleFunctionSx),Array.isArray(M[0])){const P=M.shift(),I=new Array(E.length).fill(""),k=new Array(j.length).fill("");let U;U=[...I,...P,...k],U.raw=[...I,...P.raw,...k],E.unshift(U)}const D=[...E,...M,...j],A=v(...D);return a.muiName&&(A.muiName=a.muiName),process.env.NODE_ENV!=="production"&&(A.displayName=ed(l,u,a)),A};return v.withConfig&&(C.withConfig=v.withConfig),C}}function ed(e,t,n){return e?`${e}${p.capitalize(t||"")}`:`Styled(${Xu(n)})`}function td(e,t){let n;return process.env.NODE_ENV!=="production"&&e&&(n=`${e}-${Il(t||"Root")}`),n}function nd(e){for(const t in e)return!1;return!0}function rd(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Il(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}const id=jl();function od(e){const{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:p.resolveProps(t.components[n].defaultProps,r)}function Al({props:e,name:t,defaultTheme:n,themeId:r}){let i=p.useTheme(n);return r&&(i=i[r]||i),od({theme:i,name:t,props:e})}const _s={theme:void 0};function sd(e){let t,n;return function(i){let o=t;return(o===void 0||i.theme!==n)&&(_s.theme=i.theme,o=Ml(e(_s)),t=o,n=i.theme),o}}function zn(e,t,n=void 0){const r={};for(const i in e){const o=e[i];let s="",a=!0;for(let c=0;c<o.length;c+=1){const l=o[c];l&&(s+=(a===!0?"":" ")+t(l),a=!1,n&&n[l]&&(s+=" "+n[l]))}r[i]=s}return r}const ad=p.createTheme(),ld=id("div",{name:"MuiStack",slot:"Root"});function cd(e){return Al({props:e,name:"MuiStack",defaultTheme:ad})}function ud(e,t){const n=R.Children.toArray(e).filter(Boolean);return n.reduce((r,i,o)=>(r.push(i),o<n.length-1&&r.push(R.cloneElement(t,{key:`separator-${o}`})),r),[])}const dd=e=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[e],hd=({ownerState:e,theme:t})=>{let n={display:"flex",flexDirection:"column",...p.handleBreakpoints({theme:t},p.resolveBreakpointValues({values:e.direction,breakpoints:t.breakpoints.values}),r=>({flexDirection:r}))};if(e.spacing){const r=p.createUnarySpacing(t),i=Object.keys(t.breakpoints.values).reduce((c,l)=>((typeof e.spacing=="object"&&e.spacing[l]!=null||typeof e.direction=="object"&&e.direction[l]!=null)&&(c[l]=!0),c),{}),o=p.resolveBreakpointValues({values:e.direction,base:i}),s=p.resolveBreakpointValues({values:e.spacing,base:i});typeof o=="object"&&Object.keys(o).forEach((c,l,u)=>{if(!o[c]){const h=l>0?o[u[l-1]]:"column";o[c]=h}});const a=(c,l)=>e.useFlexGap?{gap:p.getValue(r,c)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${dd(l?o[l]:e.direction)}`]:p.getValue(r,c)}};n=p.deepmerge(n,p.handleBreakpoints({theme:t},s,a))}return n=p.mergeBreakpointsInOrder(t.breakpoints,n),n};function fd(e={}){const{createStyledComponent:t=ld,useThemeProps:n=cd,componentName:r="MuiStack"}=e,i=()=>zn({root:["root"]},c=>p.generateUtilityClass(r,c),{}),o=t(hd),s=R.forwardRef(function(c,l){const u=n(c),d=Ju(u),{component:h="div",direction:f="column",spacing:m=0,divider:y,children:x,className:b,useFlexGap:S=!1,...v}=d,_={direction:f,spacing:m,useFlexGap:S},C=i();return p.jsxRuntimeExports.jsx(o,{as:h,ownerState:_,ref:l,className:p.clsx(C.root,b),...v,children:y?ud(x,y):x})});return process.env.NODE_ENV!=="production"&&(s.propTypes={children:g.node,direction:g.oneOfType([g.oneOf(["column-reverse","column","row-reverse","row"]),g.arrayOf(g.oneOf(["column-reverse","column","row-reverse","row"])),g.object]),divider:g.node,spacing:g.oneOfType([g.arrayOf(g.oneOfType([g.number,g.string])),g.number,g.object,g.string]),sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object])}),s}function pd({props:e,name:t}){return Al({props:e,name:t,defaultTheme:p.defaultTheme,themeId:p.THEME_ID})}function go(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const md=e=>go(e)&&e!=="classes",Ae=jl({themeId:p.THEME_ID,defaultTheme:p.defaultTheme,rootShouldForwardProp:md});/*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */var qi=function(e,t){return qi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},qi(e,t)};function kl(e,t){qi(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function gd(e){var t=typeof Symbol=="function"&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function xd(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function yd(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(xd(arguments[t]));return e}var Ol=(function(){function e(t,n){this.target=n,this.type=t}return e})(),bd=(function(e){kl(t,e);function t(n,r){var i=e.call(this,"error",r)||this;return i.message=n.message,i.error=n,i}return t})(Ol),vd=(function(e){kl(t,e);function t(n,r,i){n===void 0&&(n=1e3),r===void 0&&(r="");var o=e.call(this,"close",i)||this;return o.wasClean=!0,o.code=n,o.reason=r,o}return t})(Ol);/*!
15
- * Reconnecting WebSocket
16
- * by Pedro Ladaria <pedro.ladaria@gmail.com>
17
- * https://github.com/pladaria/reconnecting-websocket
18
- * License MIT
19
- */var wd=function(){if(typeof WebSocket<"u")return WebSocket},Ed=function(e){return typeof e<"u"&&!!e&&e.CLOSING===2},Rt={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0},Sd=(function(){function e(t,n,r){var i=this;r===void 0&&(r={}),this._listeners={error:[],message:[],open:[],close:[]},this._retryCount=-1,this._shouldReconnect=!0,this._connectLock=!1,this._binaryType="blob",this._closeCalled=!1,this._messageQueue=[],this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this._handleOpen=function(o){i._debug("open event");var s=i._options.minUptime,a=s===void 0?Rt.minUptime:s;clearTimeout(i._connectTimeout),i._uptimeTimeout=setTimeout(function(){return i._acceptOpen()},a),i._ws.binaryType=i._binaryType,i._messageQueue.forEach(function(c){return i._ws.send(c)}),i._messageQueue=[],i.onopen&&i.onopen(o),i._listeners.open.forEach(function(c){return i._callEventListener(o,c)})},this._handleMessage=function(o){i._debug("message event"),i.onmessage&&i.onmessage(o),i._listeners.message.forEach(function(s){return i._callEventListener(o,s)})},this._handleError=function(o){i._debug("error event",o.message),i._disconnect(void 0,o.message==="TIMEOUT"?"timeout":void 0),i.onerror&&i.onerror(o),i._debug("exec error listeners"),i._listeners.error.forEach(function(s){return i._callEventListener(o,s)}),i._connect()},this._handleClose=function(o){i._debug("close event"),i._clearTimeouts(),i._shouldReconnect&&i._connect(),i.onclose&&i.onclose(o),i._listeners.close.forEach(function(s){return i._callEventListener(o,s)})},this._url=t,this._protocols=n,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._connect()}return Object.defineProperty(e,"CONNECTING",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e,"OPEN",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSING",{get:function(){return 2},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CLOSED",{get:function(){return 3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CONNECTING",{get:function(){return e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"OPEN",{get:function(){return e.OPEN},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSING",{get:function(){return e.CLOSING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CLOSED",{get:function(){return e.CLOSED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"binaryType",{get:function(){return this._ws?this._ws.binaryType:this._binaryType},set:function(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"retryCount",{get:function(){return Math.max(this._retryCount,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bufferedAmount",{get:function(){var t=this._messageQueue.reduce(function(n,r){return typeof r=="string"?n+=r.length:r instanceof Blob?n+=r.size:n+=r.byteLength,n},0);return t+(this._ws?this._ws.bufferedAmount:0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){return this._ws?this._ws.extensions:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"protocol",{get:function(){return this._ws?this._ws.protocol:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return this._ws?this._ws.url:""},enumerable:!0,configurable:!0}),e.prototype.close=function(t,n){if(t===void 0&&(t=1e3),this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,n)},e.prototype.reconnect=function(t,n){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,n),this._connect())},e.prototype.send=function(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{var n=this._options.maxEnqueuedMessages,r=n===void 0?Rt.maxEnqueuedMessages:n;this._messageQueue.length<r&&(this._debug("enqueue",t),this._messageQueue.push(t))}},e.prototype.addEventListener=function(t,n){this._listeners[t]&&this._listeners[t].push(n)},e.prototype.dispatchEvent=function(t){var n,r,i=this._listeners[t.type];if(i)try{for(var o=gd(i),s=o.next();!s.done;s=o.next()){var a=s.value;this._callEventListener(t,a)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!0},e.prototype.removeEventListener=function(t,n){this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(function(r){return r!==n}))},e.prototype._debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._options.debug&&console.log.apply(console,yd(["RWS>"],t))},e.prototype._getNextDelay=function(){var t=this._options,n=t.reconnectionDelayGrowFactor,r=n===void 0?Rt.reconnectionDelayGrowFactor:n,i=t.minReconnectionDelay,o=i===void 0?Rt.minReconnectionDelay:i,s=t.maxReconnectionDelay,a=s===void 0?Rt.maxReconnectionDelay:s,c=0;return this._retryCount>0&&(c=o*Math.pow(r,this._retryCount-1),c>a&&(c=a)),this._debug("next delay",c),c},e.prototype._wait=function(){var t=this;return new Promise(function(n){setTimeout(n,t._getNextDelay())})},e.prototype._getNextUrl=function(t){if(typeof t=="string")return Promise.resolve(t);if(typeof t=="function"){var n=t();if(typeof n=="string")return Promise.resolve(n);if(n.then)return n}throw Error("Invalid URL")},e.prototype._connect=function(){var t=this;if(!(this._connectLock||!this._shouldReconnect)){this._connectLock=!0;var n=this._options,r=n.maxRetries,i=r===void 0?Rt.maxRetries:r,o=n.connectionTimeout,s=o===void 0?Rt.connectionTimeout:o,a=n.WebSocket,c=a===void 0?wd():a;if(this._retryCount>=i){this._debug("max retries reached",this._retryCount,">=",i);return}if(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),!Ed(c))throw Error("No valid WebSocket class provided");this._wait().then(function(){return t._getNextUrl(t._url)}).then(function(l){t._closeCalled||(t._debug("connect",{url:l,protocols:t._protocols}),t._ws=t._protocols?new c(l,t._protocols):new c(l),t._ws.binaryType=t._binaryType,t._connectLock=!1,t._addListeners(),t._connectTimeout=setTimeout(function(){return t._handleTimeout()},s))})}},e.prototype._handleTimeout=function(){this._debug("timeout event"),this._handleError(new bd(Error("TIMEOUT"),this))},e.prototype._disconnect=function(t,n){if(t===void 0&&(t=1e3),this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new vd(t,n,this))}catch{}}},e.prototype._acceptOpen=function(){this._debug("accept open"),this._retryCount=0},e.prototype._callEventListener=function(t,n){"handleEvent"in n?n.handleEvent(t):n(t)},e.prototype._removeListeners=function(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))},e.prototype._addListeners=function(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))},e.prototype._clearTimeouts=function(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)},e})(),Td=class extends Sd{constructor(e,t={}){console.log("Opening websocket to",e),super(()=>this.targetUrl||e,void 0,{startClosed:!0}),this.opts=t,this.disposed=!1,Object.defineProperty(this,"url",{get(){return this.targetUrl}}),this.targetUrl=e,this.addEventListener("open",()=>{console.log(`Websocket to ${this.url} opened`)}),this.addEventListener("message",r=>{this.receivedFirstMessage||(this.receivedFirstMessage=r)}),this.addEventListener("close",()=>{console.log(`Websocket to ${this.url} closed`)});const n=this.reconnect;this.reconnect=()=>{this.opts.mock?this.opts.mock.handleWebsocketConnection(this):n.apply(this)},this.reconnect()}changeUrl(e){this.receivedFirstMessage=void 0,this.targetUrl=e,this.reconnect()}sendJson(e){this.opts.mock?this.opts.mock.handleWebsocketMessage(this,JSON.stringify(e)):this.send(JSON.stringify(e))}dispose(){this.close(),this.disposed=!0,this.opts.onDispose&&this.opts.onDispose()}async opened(){return new Promise((e,t)=>{this.readyState===WebSocket.OPEN?e():(this.addEventListener("open",()=>e()),this.addEventListener("error",t))})}async closed(){return new Promise((e,t)=>{this.readyState===WebSocket.CLOSED?e():(this.addEventListener("close",()=>e()),this.addEventListener("error",t))})}async firstMessage(){return this.receivedFirstMessage?this.receivedFirstMessage:new Promise((e,t)=>{const n=i=>{this.receivedFirstMessage=i,this.removeEventListener("message",n),this.removeEventListener("error",r),e(i)},r=i=>{this.removeEventListener("message",n),this.removeEventListener("error",r),t(i)};this.addEventListener("message",n),this.addEventListener("error",r)})}async nextMessage(){return new Promise((e,t)=>{const n=i=>{this.removeEventListener("message",n),this.removeEventListener("error",r),e(i)},r=i=>{this.removeEventListener("message",n),this.removeEventListener("error",r),t(i)};this.addEventListener("message",n),this.addEventListener("error",r)})}},Cd=class{constructor(){this.available=typeof window<"u"&&!!window.localStorage}getJSON(e){if(!this.available)return null;const t=window.localStorage.getItem(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}setJSON(e,t){if(!this.available)return null;window.localStorage.setItem(e,JSON.stringify(t))}delete(e){if(!this.available)return null;window.localStorage.removeItem(e)}setString(e,t){if(!this.available)return null;window.localStorage.setItem(e,t)}getString(e){return this.available?window.localStorage.getItem(e):null}};const bi=new Cd,tn="wandelbots.io",vi={dev:{domain:`https://auth.portal.dev.${tn}`,clientId:"fLbJD0RLp5r2Dpucm5j8BjwMR6Hunfha"},stg:{domain:`https://auth.portal.stg.${tn}`,clientId:"joVDeD9e786WzFNSGCqoVq7HNkWt5j6s"},prod:{domain:`https://auth.portal.${tn}`,clientId:"J7WJUi38xVQdJAEBNRT9Xw1b0fXDb4J2"}},_d=e=>{if(e.endsWith(`dev.${tn}`))return vi.dev;if(e.endsWith(`stg.${tn}`))return vi.stg;if(e.endsWith(tn))return vi.prod;throw new Error("Unsupported instance URL. Cannot determine Auth0 configuration.")},Md=async e=>{if(typeof window>"u")throw new Error("Access token must be set to use NovaClient when not in a browser environment.");const t=_d(e);if(new URL(e).origin===window.location.origin)throw window.location.reload(),new Error("Failed to reload page to get auth details, please refresh manually");const{Auth0Client:n}=await Promise.resolve().then(()=>require("./auth0-spa-js.production.esm-BcLLh1tx.cjs")),r=new n({domain:t.domain,clientId:t.clientId??"",useRefreshTokens:!1,authorizationParams:{audience:"nova-api",redirect_uri:window.location.origin}});if(window.location.search.includes("code=")&&window.location.search.includes("state=")){const{appState:i}=await r.handleRedirectCallback();window.history.replaceState({},document.title,(i==null?void 0:i.returnTo)||window.location.pathname)}else await r.loginWithRedirect();return await r.getTokenSilently()};function Rd(e){var t=[];if(e.length===0)return"";if(typeof e[0]!="string")throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r<e.length;r++){var i=e[r];if(typeof i!="string")throw new TypeError("Url must be a string. Received "+i);i!==""&&(r>0&&(i=i.replace(/^[\/]+/,"")),r<e.length-1?i=i.replace(/[\/]+$/,""):i=i.replace(/[\/]+$/,"/"),t.push(i))}var o=t.join("/");o=o.replace(/\/(\?|&|#[^!])/g,"$1");var s=o.split("?");return o=s.shift()+(s.length>0?"?":"")+s.join("&"),o}function wi(){var e;return typeof arguments[0]=="object"?e=arguments[0]:e=[].slice.call(arguments),Rd(e)}var Oe={},Ms;function jd(){if(Ms)return Oe;Ms=1,Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.PathError=Oe.TokenData=void 0,Oe.parse=l,Oe.compile=u,Oe.match=f,Oe.pathToRegexp=m,Oe.stringify=_;const e="/",t=E=>E,n=/^[$_\p{ID_Start}]$/u,r=/^[$\u200c\u200d\p{ID_Continue}]$/u,i={"{":"{","}":"}","(":"(",")":")","[":"[","]":"]","+":"+","?":"?","!":"!"};function o(E){return E.replace(/[{}()\[\]+?!:*\\]/g,"\\$&")}function s(E){return E.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}class a{constructor(M,j){this.tokens=M,this.originalPath=j}}Oe.TokenData=a;class c extends TypeError{constructor(M,j){let D=M;j&&(D+=`: ${j}`),D+="; visit https://git.new/pathToRegexpError for info",super(D),this.originalPath=j}}Oe.PathError=c;function l(E,M={}){const{encodePath:j=t}=M,D=[...E],A=[];let P=0,I=0;function k(){let N="";if(n.test(D[P]))do N+=D[P++];while(r.test(D[P]));else if(D[P]==='"'){let Y=P;for(;P++<D.length;){if(D[P]==='"'){P++,Y=0;break}D[P]==="\\"&&P++,N+=D[P]}if(Y)throw new c(`Unterminated quote at index ${Y}`,E)}if(!N)throw new c(`Missing parameter name at index ${P}`,E);return N}for(;P<D.length;){const N=D[P],Y=i[N];Y?A.push({type:Y,index:P++,value:N}):N==="\\"?A.push({type:"escape",index:P++,value:D[P++]}):N===":"?A.push({type:"param",index:P++,value:k()}):N==="*"?A.push({type:"wildcard",index:P++,value:k()}):A.push({type:"char",index:P++,value:N})}A.push({type:"end",index:P,value:""});function U(N){const Y=[];for(;;){const F=A[I++];if(F.type===N)break;if(F.type==="char"||F.type==="escape"){let J=F.value,ie=A[I];for(;ie.type==="char"||ie.type==="escape";)J+=ie.value,ie=A[++I];Y.push({type:"text",value:j(J)});continue}if(F.type==="param"||F.type==="wildcard"){Y.push({type:F.type,name:F.value});continue}if(F.type==="{"){Y.push({type:"group",tokens:U("}")});continue}throw new c(`Unexpected ${F.type} at index ${F.index}, expected ${N}`,E)}return Y}return new a(U("end"),E)}function u(E,M={}){const{encode:j=encodeURIComponent,delimiter:D=e}=M,A=typeof E=="object"?E:l(E,M),P=d(A.tokens,D,j);return function(k={}){const[U,...N]=P(k);if(N.length)throw new TypeError(`Missing parameters: ${N.join(", ")}`);return U}}function d(E,M,j){const D=E.map(A=>h(A,M,j));return A=>{const P=[""];for(const I of D){const[k,...U]=I(A);P[0]+=k,P.push(...U)}return P}}function h(E,M,j){if(E.type==="text")return()=>[E.value];if(E.type==="group"){const A=d(E.tokens,M,j);return P=>{const[I,...k]=A(P);return k.length?[""]:[I]}}const D=j||t;return E.type==="wildcard"&&j!==!1?A=>{const P=A[E.name];if(P==null)return["",E.name];if(!Array.isArray(P)||P.length===0)throw new TypeError(`Expected "${E.name}" to be a non-empty array`);return[P.map((I,k)=>{if(typeof I!="string")throw new TypeError(`Expected "${E.name}/${k}" to be a string`);return D(I)}).join(M)]}:A=>{const P=A[E.name];if(P==null)return["",E.name];if(typeof P!="string")throw new TypeError(`Expected "${E.name}" to be a string`);return[D(P)]}}function f(E,M={}){const{decode:j=decodeURIComponent,delimiter:D=e}=M,{regexp:A,keys:P}=m(E,M),I=P.map(k=>j===!1?t:k.type==="param"?j:U=>U.split(D).map(j));return function(U){const N=A.exec(U);if(!N)return!1;const Y=N[0],F=Object.create(null);for(let J=1;J<N.length;J++){if(N[J]===void 0)continue;const ie=P[J-1],Z=I[J-1];F[ie.name]=Z(N[J])}return{path:Y,params:F}}}function m(E,M={}){const{delimiter:j=e,end:D=!0,sensitive:A=!1,trailing:P=!0}=M,I=[],k=A?"":"i",U=[];for(const F of y(E,[])){const J=typeof F=="object"?F:l(F,M);for(const ie of x(J.tokens,0,[]))U.push(b(ie,j,I,J.originalPath))}let N=`^(?:${U.join("|")})`;return P&&(N+=`(?:${s(j)}$)?`),N+=D?"$":`(?=${s(j)}|$)`,{regexp:new RegExp(N,k),keys:I}}function y(E,M){if(Array.isArray(E))for(const j of E)y(j,M);else M.push(E);return M}function*x(E,M,j){if(M===E.length)return yield j;const D=E[M];if(D.type==="group")for(const A of x(D.tokens,0,j.slice()))yield*x(E,M+1,A);else j.push(D);yield*x(E,M+1,j)}function b(E,M,j,D){let A="",P="",I=!0;for(const k of E){if(k.type==="text"){A+=s(k.value),P+=k.value,I||(I=k.value.includes(M));continue}if(k.type==="param"||k.type==="wildcard"){if(!I&&!P)throw new c(`Missing text before "${k.name}" ${k.type}`,D);k.type==="param"?A+=`(${S(M,I?"":P)}+)`:A+="([\\s\\S]+)",j.push(k),P="",I=!1;continue}}return A}function S(E,M){return M.length<2?E.length<2?`[^${s(E+M)}]`:`(?:(?!${s(E)})[^${s(M)}])`:E.length<2?`(?:(?!${s(M)})[^${s(E)}])`:`(?:(?!${s(M)}|${s(E)})[\\s\\S])`}function v(E){let M="",j=0;function D(A){return C(A)&&w(E[j])?A:JSON.stringify(A)}for(;j<E.length;){const A=E[j++];if(A.type==="text"){M+=o(A.value);continue}if(A.type==="group"){M+=`{${v(A.tokens)}}`;continue}if(A.type==="param"){M+=`:${D(A.name)}`;continue}if(A.type==="wildcard"){M+=`*${D(A.name)}`;continue}throw new TypeError(`Unknown token type: ${A.type}`)}return M}function _(E){return v(E.tokens)}function C(E){const[M,...j]=E;return n.test(M)&&j.every(D=>r.test(D))}function w(E){return E&&E.type==="text"?!r.test(E.value[0]):!0}return Oe}var Id=jd(),Ad=class{constructor(e,t){this.cellId=e,this.opts=t,this.system=this.withUnwrappedResponsesOnly(se.SystemApi),this.cell=this.withUnwrappedResponsesOnly(se.CellApi),this.motionGroup=this.withCellId(se.MotionGroupApi),this.motionGroupModels=this.withCellId(se.MotionGroupModelsApi),this.controller=this.withCellId(se.ControllerApi),this.controllerIOs=this.withCellId(se.ControllerInputsOutputsApi),this.trajectoryPlanning=this.withCellId(se.TrajectoryPlanningApi),this.trajectoryExecution=this.withCellId(se.TrajectoryExecutionApi),this.trajectoryCaching=this.withCellId(se.TrajectoryCachingApi),this.application=this.withCellId(se.ApplicationApi),this.applicationGlobal=this.withUnwrappedResponsesOnly(se.ApplicationApi),this.jogging=this.withCellId(se.JoggingApi),this.kinematics=this.withCellId(se.KinematicsApi),this.busInputsOutputs=this.withCellId(se.BUSInputsOutputsApi),this.virtualController=this.withCellId(se.VirtualControllerApi),this.virtualControllerBehavior=this.withCellId(se.VirtualControllerBehaviorApi),this.virtualControllerIOs=this.withCellId(se.VirtualControllerInputsOutputsApi),this.storeObject=this.withCellId(se.StoreObjectApi),this.storeCollisionComponents=this.withCellId(se.StoreCollisionComponentsApi),this.storeCollisionSetups=this.withCellId(se.StoreCollisionSetupsApi)}withCellId(e){const t=new e({...this.opts,isJsonMime:n=>n==="application/json"},this.opts.basePath??"",this.opts.axiosInstance??p.axios.create());for(const n of Reflect.ownKeys(Reflect.getPrototypeOf(t)))if(n!=="constructor"&&typeof t[n]=="function"){const r=t[n];t[n]=(...i)=>r.apply(t,[this.cellId,...i]).then(o=>o.data)}return t}withUnwrappedResponsesOnly(e){const t=new e({...this.opts,isJsonMime:n=>n==="application/json"},this.opts.basePath??"",this.opts.axiosInstance??p.axios.create());for(const n of Reflect.ownKeys(Reflect.getPrototypeOf(t)))if(n!=="constructor"&&typeof t[n]=="function"){const r=t[n];t[n]=(...i)=>r.apply(t,i).then(o=>o.data)}return t}},kd=class{constructor(){this.connections=[]}async handleAPIRequest(e){var i,o,s;const t=[{method:"GET",path:"/cells/:cellId/controllers",handle(){return["mock-ur5e"]}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId",handle(){return{configuration:{initial_joint_position:"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]",kind:"VirtualController",manufacturer:"universalrobots",type:"universalrobots-ur5e"},name:"mock-ur5"}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/state",handle(){return{mode:"MODE_CONTROL",last_error:[],timestamp:"2025-10-16T09:19:26.634534092Z",sequence_number:1054764,controller:"mock-ur5e",operation_mode:"OPERATION_MODE_AUTO",safety_state:"SAFETY_STATE_NORMAL",velocity_override:100,motion_groups:[{timestamp:"2025-10-16T09:19:26.634534092Z",sequence_number:1054764,motion_group:"0@mock-ur5e",controller:"mock-ur5e",joint_position:[1.487959623336792,-1.8501918315887451,1.8003005981445312,6.034560203552246,1.4921919107437134,1.593459963798523],joint_limit_reached:{limit_reached:[!1,!1,!1,!1,!1,!1]},joint_torque:[],joint_current:[0,0,0,0,0,0],flange_pose:{position:[107.6452433732927,-409.0402987746852,524.2402132330305],orientation:[.9874434028353319,-.986571714997442,1.3336589451098142]},tcp:"Flange",tcp_pose:{position:[107.6452433732927,-409.0402987746852,524.2402132330305],orientation:[.9874434028353319,-.986571714997442,1.3336589451098142]},payload:"",coordinate_system:"",standstill:!0}]}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description",handle(){return{motion_group_model:"UniversalRobots_UR5e",mounting:{position:[0,0,0],orientation:[0,0,0]},tcps:{Flange:{name:"Default-Flange",pose:{position:[0,0,0],orientation:[0,0,0]}}},payloads:{"FPay-0":{name:"FPay-0",payload:0,center_of_mass:[0,0,0],moment_of_inertia:[0,0,0]}},cycle_time:8,dh_parameters:[{alpha:1.5707963267948966,d:162.25},{a:-425},{a:-392.2},{alpha:1.5707963267948966,d:133.3},{alpha:-1.5707963267948966,d:99.7},{d:99.6}],operation_limits:{auto_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3},elbow:{velocity:5e3},flange:{velocity:5e3}},manual_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}},manual_t1_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}},manual_t2_limits:{joints:[{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:150},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28},{position:{lower_limit:-6.283185307179586,upper_limit:6.283185307179586},velocity:3.34159255027771,acceleration:40,torque:28}],tcp:{velocity:5e3}}},serial_number:"WBVirtualRobot"}}},{method:"GET",path:"/cells/:cellId/controllers/:controllerId/coordinate-systems",handle(){return[{coordinate_system:"",name:"world",reference_coordinate_system:"",position:[0,0,0],orientation:[0,0,0],orientation_type:"ROTATION_VECTOR"},{coordinate_system:"CS-0",name:"Default-CS",reference_coordinate_system:"",position:[0,0,0],orientation:[0,0,0],orientation_type:"ROTATION_VECTOR"}]}}],n=((i=e.method)==null?void 0:i.toUpperCase())||"GET",r=`/cells${(s=(o=e.url)==null?void 0:o.split("/cells")[1])==null?void 0:s.split("?")[0]}`;for(const a of t){const c=Id.match(a.path)(r||"");if(n===a.method&&c){const l=a.handle();return{status:200,statusText:"Success",data:JSON.stringify(l),headers:{},config:e,request:{responseURL:e.url}}}}throw new p.AxiosError(`No mock handler matched this request: ${n} ${r}`,"404",e)}handleWebsocketConnection(e){this.connections.push(e),setTimeout(()=>{e.dispatchEvent(new Event("open")),console.log("Websocket connection opened from",e.url),e.url.includes("/state-stream")&&e.dispatchEvent(new MessageEvent("message",{data:JSON.stringify(Od)})),e.url.includes("/execution/jogging")&&e.dispatchEvent(new MessageEvent("message",{data:JSON.stringify({result:{message:"string",kind:"INITIALIZE_RECEIVED"}})}))},10)}handleWebsocketMessage(e,t){console.log(`Received message on ${e.url}`,t)}};const Od={result:{motion_group:"0@universalrobots-ur5e",controller:"universalrobots-ur5e",timestamp:new Date().toISOString(),sequence_number:1,joint_position:[1.1699999570846558,-1.5700000524520874,1.3600000143051147,1.0299999713897705,1.2899999618530273,1.2799999713897705],joint_limit_reached:{limit_reached:[!1,!1,!1,!1,!1,!1]},standstill:!1,flange_pose:{position:[1.3300010259703043,-409.2680714682808,531.0203477065281],orientation:[1.7564919306270736,-1.7542521568325058,.7326972590614671]},tcp_pose:{position:[1.3300010259703043,-409.2680714682808,531.0203477065281],orientation:[1.7564919306270736,-1.7542521568325058,.7326972590614671]}}};function Pd(e){return e.startsWith("http")||(e=`http://${e}`),new URL(e).toString()}var Dd=class{constructor(e){this.authPromise=null,this.accessToken=null;const t=e.cellId??"cell";this.config={cellId:t,...e},this.accessToken=e.accessToken||bi.getString("wbjs.access_token")||null,this.config.instanceUrl==="https://mock.example.com"?this.mock=new kd:this.config.instanceUrl=Pd(this.config.instanceUrl);const n=p.axios.create({baseURL:wi(this.config.instanceUrl,"/api/v2"),headers:typeof window<"u"&&window.location.origin.includes("localhost")?{}:{"X-Wandelbots-Client":"Wandelbots-Nova-JS-SDK"}});n.interceptors.request.use(async r=>(r.headers.Authorization||(this.accessToken?r.headers.Authorization=`Bearer ${this.accessToken}`:this.config.username&&this.config.password&&(r.headers.Authorization=`Basic ${btoa(`${e.username}:${e.password}`)}`)),r)),typeof window<"u"&&n.interceptors.response.use(r=>r,async r=>{var i,o;if(p.isAxiosError(r))if(((i=r.response)==null?void 0:i.status)===401)try{if(await this.renewAuthentication(),r.config)return this.accessToken?r.config.headers.Authorization=`Bearer ${this.accessToken}`:delete r.config.headers.Authorization,n.request(r.config)}catch(s){return Promise.reject(s)}else((o=r.response)==null?void 0:o.status)===503&&(await fetch(window.location.href)).status===503&&window.location.reload();return Promise.reject(r)}),this.api=new Ad(t,{...e,basePath:wi(this.config.instanceUrl,"/api/v2"),isJsonMime:r=>r==="application/json",baseOptions:{...this.mock?{adapter:r=>this.mock.handleAPIRequest(r)}:{},...e.baseOptions},axiosInstance:n})}async renewAuthentication(){if(!this.authPromise){this.authPromise=Md(this.config.instanceUrl);try{this.accessToken=await this.authPromise,this.accessToken?bi.setString("wbjs.access_token",this.accessToken):bi.delete("wbjs.access_token")}finally{this.authPromise=null}}}makeWebsocketURL(e){const t=new URL(wi(this.config.instanceUrl,`/api/v2/cells/${this.config.cellId}`,e));return t.protocol=t.protocol.replace("http","ws"),t.protocol=t.protocol.replace("https","wss"),this.accessToken?t.searchParams.append("token",this.accessToken):this.config.username&&this.config.password&&(t.username=this.config.username,t.password=this.config.password),t.toString()}openReconnectingWebsocket(e){return new Td(this.makeWebsocketURL(e),{mock:this.mock})}};function Ld(e){var o,s,a,c,l,u;const t=[((o=e.position)==null?void 0:o[0])??0,((s=e.position)==null?void 0:s[1])??0,((a=e.position)==null?void 0:a[2])??0],n=[((c=e.orientation)==null?void 0:c[0])??0,((l=e.orientation)==null?void 0:l[1])??0,((u=e.orientation)==null?void 0:u[2])??0],r=t.map(d=>d.toFixed(1)),i=n.map(d=>d.toFixed(4));return`(${r.concat(i).join(", ")})`}const $d=e=>p.jsxRuntimeExports.jsx(T.SvgIcon,{...e,viewBox:"0 0 10 8",children:p.jsxRuntimeExports.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"})}),zd=p.externalizeComponent(re.observer(e=>{const{appIcon:t,appName:n,apps:r=[],onAppSelect:i,disabled:o=!1,sx:s}=e,[a,c]=O.useState(null),l=!!a,u=f=>{c(f.currentTarget)},d=()=>{c(null)},h=f=>{d(),f.onClick?f.onClick():f.href&&(window.location.href=f.href),i==null||i(f)};return p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[p.jsxRuntimeExports.jsx(T.AppBar,{position:"static",sx:{boxShadow:"none",backgroundImage:"none","& .MuiAppBar-root":{backgroundImage:"none",backgroundColor:"transparent"},...s},children:p.jsxRuntimeExports.jsxs(T.Toolbar,{sx:{minHeight:"62px !important"},children:[p.jsxRuntimeExports.jsx(T.Box,{sx:{mr:1,display:"flex",alignItems:"center"},children:t}),p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[p.jsxRuntimeExports.jsx(T.Typography,{component:"h1",sx:{fontWeight:"bold",fontSize:"1rem"},children:n}),r.length>0&&p.jsxRuntimeExports.jsx(T.IconButton,{color:"inherit","aria-label":"switch app","aria-controls":"app-menu","aria-haspopup":"true",onClick:u,disabled:o,sx:{ml:1,width:28,height:28,borderRadius:"6px",padding:0,backgroundColor:f=>T.alpha(f.palette.common.white,.1),opacity:1,"&:hover":{backgroundColor:f=>T.alpha(f.palette.common.white,.16)},"& .MuiSvgIcon-root":{fontSize:"8px",width:"8px",height:"6px"}},children:p.jsxRuntimeExports.jsx($d,{})})]})]})}),p.jsxRuntimeExports.jsx(T.Backdrop,{open:l,onClick:d,sx:{backdropFilter:"blur(4px)",backgroundColor:"rgba(0, 0, 0, 0.3)",zIndex:f=>f.zIndex.modal-1}}),p.jsxRuntimeExports.jsx(T.Menu,{id:"app-menu",anchorEl:a,open:l,onClose:d,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{zIndex:f=>f.zIndex.modal,"& .MuiPaper-root":{minWidth:200,mt:1}},children:r.map(f=>p.jsxRuntimeExports.jsxs(T.MenuItem,{onClick:()=>h(f),children:[p.jsxRuntimeExports.jsx(T.Box,{sx:{display:"flex",alignItems:"center"},children:f.icon}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body1",sx:{ml:2},children:f.name})]},f.id))})]})}));function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function Je(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Gr(...e){const t=R.useRef(void 0),n=R.useCallback(r=>{const i=e.map(o=>{if(o==null)return null;if(typeof o=="function"){const s=o,a=s(r);return typeof a=="function"?a:()=>{s(null)}}return o.current=r,()=>{o.current=null}});return()=>{i.forEach(o=>o==null?void 0:o())}},e);return R.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}var Nd=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const i={};e(i)===i&&(r=!0)}catch{}if(r){let i;try{throw new Error}catch(o){({stack:i}=o)}console.warn(`The result function returned its own inputs without modification. e.g
20
- \`createSelector([state => state.todos], todos => todos)\`
21
- This could lead to inefficient memoization and unnecessary re-renders.
22
- Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:i})}}},Fd=(e,t,n)=>{const{memoize:r,memoizeOptions:i}=t,{inputSelectorResults:o,inputSelectorResultsCopy:s}=e,a=r(()=>({}),...i);if(!(a.apply(null,o)===a.apply(null,s))){let l;try{throw new Error}catch(u){({stack:l}=u)}console.warn(`An input selector returned a different result when passed same arguments.
23
- This means your output selector will likely run more frequently than intended.
24
- Avoid returning a new reference inside your input selector, e.g.
25
- \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:o,secondInputs:s,stack:l})}},Gd={inputStabilityCheck:"once",identityFunctionCheck:"once"},br=Symbol("NOT_FOUND");function Bd(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Ud(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Vd(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Rs=e=>Array.isArray(e)?e:[e];function Hd(e){const t=Array.isArray(e[0])?e[0]:e;return Vd(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function js(e,t){const n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var Wd=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Gd,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:Nd},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:Fd}}};function qd(e){let t;return{get(n){return t&&e(t.key,n)?t.value:br},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Yd(e,t){let n=[];function r(a){const c=n.findIndex(l=>t(a,l.key));if(c>-1){const l=n[c];return c>0&&(n.splice(c,1),n.unshift(l)),l.value}return br}function i(a,c){r(a)===br&&(n.unshift({key:a,value:c}),n.length>e&&n.pop())}function o(){return n}function s(){n=[]}return{get:r,put:i,getEntries:o,clear:s}}var Jd=(e,t)=>e===t;function Xd(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:i}=n;for(let o=0;o<i;o++)if(!e(n[o],r[o]))return!1;return!0}}function Kd(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=Jd,maxSize:i=1,resultEqualityCheck:o}=n,s=Xd(r);let a=0;const c=i<=1?qd(s):Yd(i,s);function l(){let u=c.get(arguments);if(u===br){if(u=e.apply(null,arguments),a++,o){const h=c.getEntries().find(f=>o(f.value,u));h&&(u=h.value,a!==0&&a--)}c.put(arguments,u)}return u}return l.clearCache=()=>{c.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var Zd=class{constructor(e){this.value=e}deref(){return this.value}},Qd=typeof WeakRef<"u"?WeakRef:Zd,eh=0,Is=1;function Zn(){return{s:eh,v:void 0,o:null,p:null}}function Pl(e,t={}){let n=Zn();const{resultEqualityCheck:r}=t;let i,o=0;function s(){var d;let a=n;const{length:c}=arguments;for(let h=0,f=c;h<f;h++){const m=arguments[h];if(typeof m=="function"||typeof m=="object"&&m!==null){let y=a.o;y===null&&(a.o=y=new WeakMap);const x=y.get(m);x===void 0?(a=Zn(),y.set(m,a)):a=x}else{let y=a.p;y===null&&(a.p=y=new Map);const x=y.get(m);x===void 0?(a=Zn(),y.set(m,a)):a=x}}const l=a;let u;if(a.s===Is)u=a.v;else if(u=e.apply(null,arguments),o++,r){const h=((d=i==null?void 0:i.deref)==null?void 0:d.call(i))??i;h!=null&&r(h,u)&&(u=h,o!==0&&o--),i=typeof u=="object"&&u!==null||typeof u=="function"?new Qd(u):u}return l.s=Is,l.v=u,u}return s.clearCache=()=>{n=Zn(),s.resetResultsCount()},s.resultsCount=()=>o,s.resetResultsCount=()=>{o=0},s}function Dl(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...i)=>{let o=0,s=0,a,c={},l=i.pop();typeof l=="object"&&(c=l,l=i.pop()),Bd(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:d,memoizeOptions:h=[],argsMemoize:f=Pl,argsMemoizeOptions:m=[],devModeChecks:y={}}=u,x=Rs(h),b=Rs(m),S=Hd(i),v=d(function(){return o++,l.apply(null,arguments)},...x);let _=!0;const C=f(function(){s++;const E=js(S,arguments);if(a=v.apply(null,E),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:M,inputStabilityCheck:j}=Wd(_,y);if(M.shouldRun&&M.run(l,E,a),j.shouldRun){const D=js(S,arguments);j.run({inputSelectorResults:E,inputSelectorResultsCopy:D},{memoize:d,memoizeOptions:x},arguments)}_&&(_=!1)}return a},...b);return Object.assign(C,{resultFunc:l,memoizedResultFunc:v,dependencies:S,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>a,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:d,argsMemoize:f})};return Object.assign(r,{withTypes:()=>r}),r}var th=Dl(Pl),nh=Object.assign((e,t=th)=>{Ud(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(o=>e[o]);return t(r,(...o)=>o.reduce((s,a,c)=>(s[n[c]]=a,s),{}))},{withTypes:()=>nh});const rh=Dl({memoize:Kd,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),X=(e,t,n,r,i,o,s,a,...c)=>{if(c.length>0)throw new Error("Unsupported number of selectors");let l;if(e&&t&&n&&r&&i&&o&&s&&a)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f),x=n(u,d,h,f),b=r(u,d,h,f),S=i(u,d,h,f),v=o(u,d,h,f),_=s(u,d,h,f);return a(m,y,x,b,S,v,_,d,h,f)};else if(e&&t&&n&&r&&i&&o&&s)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f),x=n(u,d,h,f),b=r(u,d,h,f),S=i(u,d,h,f),v=o(u,d,h,f);return s(m,y,x,b,S,v,d,h,f)};else if(e&&t&&n&&r&&i&&o)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f),x=n(u,d,h,f),b=r(u,d,h,f),S=i(u,d,h,f);return o(m,y,x,b,S,d,h,f)};else if(e&&t&&n&&r&&i)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f),x=n(u,d,h,f),b=r(u,d,h,f);return i(m,y,x,b,d,h,f)};else if(e&&t&&n&&r)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f),x=n(u,d,h,f);return r(m,y,x,d,h,f)};else if(e&&t&&n)l=(u,d,h,f)=>{const m=e(u,d,h,f),y=t(u,d,h,f);return n(m,y,d,h,f)};else if(e&&t)l=(u,d,h,f)=>{const m=e(u,d,h,f);return t(m,d,h,f)};else if(e)l=e;else throw new Error("Missing arguments");return l},xo=e=>(...t)=>{const n=new WeakMap;let r=1;const i=t[t.length-1],o=t.length-1||1,s=Math.max(i.length-o,0);if(s>3)throw new Error("Unsupported number of arguments");return(c,l,u,d)=>{let h=c.__cacheKey__;h||(h={id:r},c.__cacheKey__=h,r+=1);let f=n.get(h);if(!f){const m=t.length===1?[b=>b,i]:t;let y=t;const x=[void 0,void 0,void 0];switch(s){case 0:break;case 1:{y=[...m.slice(0,-1),()=>x[0],i];break}case 2:{y=[...m.slice(0,-1),()=>x[0],()=>x[1],i];break}case 3:{y=[...m.slice(0,-1),()=>x[0],()=>x[1],()=>x[2],i];break}default:throw new Error("Unsupported number of arguments")}e&&(y=[...y,e]),f=rh(...y),f.selectorArgs=x,n.set(h,f)}switch(s){case 3:f.selectorArgs[2]=d;case 2:f.selectorArgs[1]=u;case 1:f.selectorArgs[0]=l}switch(s){case 0:return f(c);case 1:return f(c,l);case 2:return f(c,l,u);case 3:return f(c,l,u,d);default:throw new Error("unreachable")}}},be=xo();var Qn={exports:{}},Ei={};/**
26
- * @license React
27
- * use-sync-external-store-shim.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var As;function ih(){if(As)return Ei;As=1;var e=O;function t(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(d,h){var f=h(),m=r({inst:{value:f,getSnapshot:h}}),y=m[0].inst,x=m[1];return o(function(){y.value=f,y.getSnapshot=h,c(y)&&x({inst:y})},[d,f,h]),i(function(){return c(y)&&x({inst:y}),d(function(){c(y)&&x({inst:y})})},[d]),s(f),f}function c(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!n(d,f)}catch{return!0}}function l(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Ei.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Ei}var Si={};/**
34
- * @license React
35
- * use-sync-external-store-shim.development.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var ks;function oh(){return ks||(ks=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}function t(f,m){u||i.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=m();if(!d){var x=m();o(y,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}x=s({inst:{value:y,getSnapshot:m}});var b=x[0].inst,S=x[1];return c(function(){b.value=y,b.getSnapshot=m,n(b)&&S({inst:b})},[f,y,m]),a(function(){return n(b)&&S({inst:b}),f(function(){n(b)&&S({inst:b})})},[f]),l(y),y}function n(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!o(f,y)}catch{return!0}}function r(f,m){return m()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var i=O,o=typeof Object.is=="function"?Object.is:e,s=i.useState,a=i.useEffect,c=i.useLayoutEffect,l=i.useDebugValue,u=!1,d=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Si.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Si}var Os;function yo(){return Os||(Os=1,process.env.NODE_ENV==="production"?Qn.exports=ih():Qn.exports=oh()),Qn.exports}var sh=yo(),er={exports:{}},Ti={};/**
42
- * @license React
43
- * use-sync-external-store-shim/with-selector.production.js
44
- *
45
- * Copyright (c) Meta Platforms, Inc. and affiliates.
46
- *
47
- * This source code is licensed under the MIT license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */var Ps;function ah(){if(Ps)return Ti;Ps=1;var e=O,t=yo();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Ti.useSyncExternalStoreWithSelector=function(l,u,d,h,f){var m=o(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function b(w){if(!S){if(S=!0,v=w,w=h(w),f!==void 0&&y.hasValue){var E=y.value;if(f(E,w))return _=E}return _=w}if(E=_,r(v,w))return E;var M=h(w);return f!==void 0&&f(E,M)?(v=w,E):(v=w,_=M)}var S=!1,v,_,C=d===void 0?null:d;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,d,h,f]);var x=i(l,m[0],m[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),c(x),x},Ti}var Ci={};/**
50
- * @license React
51
- * use-sync-external-store-shim/with-selector.development.js
52
- *
53
- * Copyright (c) Meta Platforms, Inc. and affiliates.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE file in the root directory of this source tree.
57
- */var Ds;function lh(){return Ds||(Ds=1,process.env.NODE_ENV!=="production"&&(function(){function e(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=O,n=yo(),r=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,a=t.useMemo,c=t.useDebugValue;Ci.useSyncExternalStoreWithSelector=function(l,u,d,h,f){var m=o(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=a(function(){function b(w){if(!S){if(S=!0,v=w,w=h(w),f!==void 0&&y.hasValue){var E=y.value;if(f(E,w))return _=E}return _=w}if(E=_,r(v,w))return E;var M=h(w);return f!==void 0&&f(E,M)?(v=w,E):(v=w,_=M)}var S=!1,v,_,C=d===void 0?null:d;return[function(){return b(u())},C===null?void 0:function(){return b(C())}]},[u,d,h,f]);var x=i(l,m[0],m[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),c(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ci}var Ls;function ch(){return Ls||(Ls=1,process.env.NODE_ENV==="production"?er.exports=ah():er.exports=lh()),er.exports}var uh=ch();const dh=parseInt(R.version,10),hh=dh>=19,fh=hh?ph:mh;function Ll(e,t,n,r,i){return fh(e,t,n,r,i)}function ph(e,t,n,r,i){const o=R.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return sh.useSyncExternalStore(e.subscribe,o,o)}function mh(e,t,n,r,i){return uh.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,i))}const $s={};function gh(e,t){const n=R.useRef($s);return n.current===$s&&(n.current=e(t)),n}const xh=[];function yh(e){R.useEffect(e,xh)}const bh=()=>{};function vh(e,t,n){const r=gh(wh,{store:e,selector:t}).current;r.effect=n,yh(r.onMount)}function wh(e){const{store:t,selector:n}=e;let r=n(t.state);const i={effect:bh,dispose:null,subscribe:()=>{i.dispose??(i.dispose=t.subscribe(o=>{const s=n(o);if(!Object.is(r,s)){const a=r;r=s,i.effect(a,s)}}))},onMount:()=>(i.subscribe(),()=>{var o;(o=i.dispose)==null||o.call(i),i.dispose=null})};return i.subscribe(),i}class bo{constructor(t){V(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));V(this,"getSnapshot",()=>this.state);V(this,"use",(t,n,r,i)=>Ll(this,t,n,r,i));this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new bo(t)}setState(t){this.state=t,this.updateTick+=1;const n=this.updateTick,r=this.listeners.values();let i;for(;i=r.next(),!i.done;){if(n!==this.updateTick)return;const o=i.value;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState(z({},this.state,t));return}}set(t,n){Object.is(this.state[t],n)||this.setState(z({},this.state,{[t]:n}))}}const Br=({params:e,store:t})=>{R.useEffect(()=>{t.set("animation",z({},t.state.animation,{skip:e.skipAnimation}))},[t,e.skipAnimation]);const n=R.useCallback(()=>{let r=!1;return t.set("animation",z({},t.state.animation,{skipAnimationRequests:t.state.animation.skipAnimationRequests+1})),()=>{r||(r=!0,t.set("animation",z({},t.state.animation,{skipAnimationRequests:t.state.animation.skipAnimationRequests-1})))}},[t]);return p.useEnhancedEffect(()=>{if(typeof window>"u"||!(window!=null&&window.matchMedia))return;let i;const o=a=>{a.matches?i=n():i==null||i()},s=window.matchMedia("(prefers-reduced-motion)");return o(s),s.addEventListener("change",o),()=>{s.removeEventListener("change",o)}},[n,t]),{instance:{disableAnimation:n}}};Br.params={skipAnimation:!0};Br.getDefaultizedParams=({params:e})=>z({},e,{skipAnimation:e.skipAnimation??!1});Br.getInitialState=({skipAnimation:e})=>{const t=typeof window>"u"||!(window!=null&&window.matchMedia),n=process.env.NODE_ENV==="test"?t:!1;return{animation:{skip:e,skipAnimationRequests:n?1:0}}};const Eh=e=>e.animation,Sh=X(Eh,e=>e.skip||e.skipAnimationRequests>0);function $l(e,t){const n=R.useRef(!0);R.useEffect(()=>{if(n.current){n.current=!1;return}return e()},t)}function Cn(e){return e&&e.ownerDocument||document}function Th(e){return Cn(e).defaultView||window}const pe=Ll,Ch="DEFAULT_X_AXIS_KEY",_h="DEFAULT_Y_AXIS_KEY",Mh={top:20,bottom:20,left:20,right:20},Rh=45,jh=25,zl=20,dt=e=>{var t;return(t=e.cartesianAxis)==null?void 0:t.x},ht=e=>{var t;return(t=e.cartesianAxis)==null?void 0:t.y},Ih=X(ht,function(t){return(t??[]).reduce((n,r)=>{var i;return r.position==="left"?n+(r.width||0)+((i=r.zoom)!=null&&i.slider.enabled?r.zoom.slider.size:0):n},0)}),Ah=X(ht,function(t){return(t??[]).reduce((n,r)=>{var i;return r.position==="right"?n+(r.width||0)+((i=r.zoom)!=null&&i.slider.enabled?r.zoom.slider.size:0):n},0)}),kh=X(dt,function(t){return(t??[]).reduce((n,r)=>{var i;return r.position==="top"?n+(r.height||0)+((i=r.zoom)!=null&&i.slider.enabled?r.zoom.slider.size:0):n},0)}),Oh=X(dt,function(t){return(t??[]).reduce((n,r)=>{var i;return r.position==="bottom"?n+(r.height||0)+((i=r.zoom)!=null&&i.slider.enabled?r.zoom.slider.size:0):n},0)}),Ph=be(Ih,Ah,kh,Oh,function(t,n,r,i){return{left:t,right:n,top:r,bottom:i}}),Nn=e=>e.dimensions,Dh=e=>e.dimensions.margin,Ke=be(Nn,Dh,Ph,function({width:t,height:n},{top:r,right:i,bottom:o,left:s},{left:a,right:c,top:l,bottom:u}){return{width:t-s-i-a-c,left:s+a,right:i+c,height:n-r-o-l-u,top:r+l,bottom:o+u}}),Lh=X(Nn,e=>e.width),$h=X(Nn,e=>e.height),zh=X(Nn,e=>e.propsWidth),Nh=X(Nn,e=>e.propsHeight);function Nl(e,t){return typeof e=="number"?{top:e,bottom:e,left:e,right:e}:t?z({},t,e):e}const Fh=10,Ur=({params:e,store:t,svgRef:n})=>{const r=e.width!==void 0&&e.height!==void 0,i=R.useRef({displayError:!1,initialCompute:!0,computeRun:0}),[o,s]=R.useState(0),[a,c]=R.useState(0),l=R.useCallback(()=>{const m=n==null?void 0:n.current;if(!m)return{};const x=Th(m).getComputedStyle(m),b=Math.floor(parseFloat(x.height))||0,S=Math.floor(parseFloat(x.width))||0;return(t.state.dimensions.width!==S||t.state.dimensions.height!==b)&&t.set("dimensions",{margin:{top:e.margin.top,right:e.margin.right,bottom:e.margin.bottom,left:e.margin.left},width:e.width??S,height:e.height??b,propsWidth:e.width,propsHeight:e.height}),{height:b,width:S}},[t,n,e.height,e.width,e.margin.left,e.margin.right,e.margin.top,e.margin.bottom]);$l(()=>{const m=e.width??t.state.dimensions.width,y=e.height??t.state.dimensions.height;t.set("dimensions",{margin:{top:e.margin.top,right:e.margin.right,bottom:e.margin.bottom,left:e.margin.left},width:m,height:y,propsHeight:e.height,propsWidth:e.width})},[t,e.height,e.width,e.margin.left,e.margin.right,e.margin.top,e.margin.bottom]),R.useEffect(()=>{i.current.displayError=!0},[]),p.useEnhancedEffect(()=>{if(r||!i.current.initialCompute||i.current.computeRun>Fh)return;const m=l();m.width!==o||m.height!==a?(i.current.computeRun+=1,m.width!==void 0&&s(m.width),m.height!==void 0&&c(m.height)):i.current.initialCompute&&(i.current.initialCompute=!1)},[a,o,l,r]),p.useEnhancedEffect(()=>{if(r)return()=>{};l();const m=n.current;if(typeof ResizeObserver>"u")return()=>{};let y;const x=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{l()})});return m&&x.observe(m),()=>{y&&cancelAnimationFrame(y),m&&x.unobserve(m)}},[l,r,n]),process.env.NODE_ENV!=="production"&&(i.current.displayError&&e.width===void 0&&o===0&&(console.error("MUI X Charts: ChartContainer does not have `width` prop, and its container has no `width` defined."),i.current.displayError=!1),i.current.displayError&&e.height===void 0&&a===0&&(console.error("MUI X Charts: ChartContainer does not have `height` prop, and its container has no `height` defined."),i.current.displayError=!1));const u=pe(t,Ke),d=R.useCallback(m=>m>=u.left-1&&m<=u.left+u.width,[u.left,u.width]),h=R.useCallback(m=>m>=u.top-1&&m<=u.top+u.height,[u.height,u.top]);return{instance:{isPointInside:R.useCallback((m,y,x)=>x&&"closest"in x&&x.closest("[data-drawing-container]")?!0:d(m)&&h(y),[d,h]),isXInside:d,isYInside:h}}};Ur.params={width:!0,height:!0,margin:!0};Ur.getDefaultizedParams=({params:e})=>z({},e,{margin:Nl(e.margin,Mh)});Ur.getInitialState=({width:e,height:t,margin:n})=>({dimensions:{margin:n,width:e??0,height:t??0,propsWidth:e,propsHeight:t}});const vo=({params:e,store:t})=>(p.useEnhancedEffect(()=>{t.set("experimentalFeatures",e.experimentalFeatures)},[t,e.experimentalFeatures]),{});vo.params={experimentalFeatures:!0};vo.getInitialState=({experimentalFeatures:e})=>({experimentalFeatures:e});const Gh=e=>e.experimentalFeatures,Vr=X(Gh,e=>!!(e!=null&&e.preferStrictDomainInLineCharts));let zs=0;const Bh=()=>(zs+=1,`mui-chart-${zs}`),wo=({params:e,store:t})=>(R.useEffect(()=>{e.id===void 0||e.id===t.state.id.providedChartId&&t.state.id.chartId!==void 0||t.set("id",z({},t.state.id,{chartId:e.id??Bh()}))},[t,e.id]),{});wo.params={id:!0};wo.getInitialState=({id:e})=>({id:{chartId:e,providedChartId:e}});const Uh=e=>e.id,Vh=X(Uh,e=>e.chartId),Hh=["#4254FB","#FFB422","#FA4F58","#0DBEFF","#22BF75","#FA83B4","#FF7511"],Wh=["#495AFB","#FFC758","#F35865","#30C8FF","#44CE8D","#F286B3","#FF8C39"],Fl=e=>e==="dark"?Wh:Hh,Gl=({series:e,colors:t,seriesConfig:n})=>{const r={};return e.forEach((i,o)=>{var c;const s=n[i.type].getSeriesWithDefaultValues(i,o,t),a=s.id;if(r[i.type]===void 0&&(r[i.type]={series:{},seriesOrder:[]}),((c=r[i.type])==null?void 0:c.series[a])!==void 0)throw new Error(`MUI X Charts: series' id "${a}" is not unique.`);r[i.type].series[a]=s,r[i.type].seriesOrder.push(a)}),r},qh=(e,t,n)=>{const r={};return Object.keys(t).forEach(i=>{var s,a;const o=e[i];o!==void 0&&(r[i]=((a=(s=t[i])==null?void 0:s.seriesProcessor)==null?void 0:a.call(s,o,n))??o)}),r},Yh=(e,t,n)=>{let r=!1;const i={};return Object.keys(e).forEach(o=>{var c;const s=(c=t[o])==null?void 0:c.seriesLayout,a=e[o];if(s!==void 0&&a!==void 0){const l=s(a,n);l&&l!==e[o]&&(r=!0,i[o]=l)}}),r?i:{}},Hr=({params:e,store:t,seriesConfig:n})=>{const{series:r,dataset:i,theme:o,colors:s}=e;return $l(()=>{t.set("series",z({},t.state.series,{defaultizedSeries:Gl({series:r,colors:typeof s=="function"?s(o):s,seriesConfig:n}),dataset:i}))},[s,i,r,o,n,t]),{}};Hr.params={dataset:!0,series:!0,colors:!0,theme:!0};const Jh=[];Hr.getDefaultizedParams=({params:e})=>{var t;return z({},e,{series:(t=e.series)!=null&&t.length?e.series:Jh,colors:e.colors??Fl,theme:e.theme??"light"})};Hr.getInitialState=({series:e=[],colors:t,theme:n,dataset:r},i,o)=>({series:{seriesConfig:o,defaultizedSeries:Gl({series:e,colors:typeof t=="function"?t(n):t,seriesConfig:o}),dataset:r}});const Eo=e=>e.series,Xh=X(Eo,e=>e.defaultizedSeries),Et=X(Eo,e=>e.seriesConfig),Kh=X(Eo,e=>e.dataset),Be=be(Xh,Et,Kh,function(t,n,r){return qh(t,n,r)});be(Be,Et,Ke,function(t,n,r){return Yh(t,n,r)});const Zh={abort:!0,animationcancel:!0,animationend:!0,animationiteration:!0,animationstart:!0,auxclick:!0,beforeinput:!0,beforetoggle:!0,blur:!0,cancel:!0,canplay:!0,canplaythrough:!0,change:!0,click:!0,close:!0,compositionend:!0,compositionstart:!0,compositionupdate:!0,contextlost:!0,contextmenu:!0,contextrestored:!0,copy:!0,cuechange:!0,cut:!0,dblclick:!0,drag:!0,dragend:!0,dragenter:!0,dragleave:!0,dragover:!0,dragstart:!0,drop:!0,durationchange:!0,emptied:!0,ended:!0,error:!0,focus:!0,focusin:!0,focusout:!0,formdata:!0,gotpointercapture:!0,input:!0,invalid:!0,keydown:!0,keypress:!0,keyup:!0,load:!0,loadeddata:!0,loadedmetadata:!0,loadstart:!0,lostpointercapture:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,paste:!0,pause:!0,play:!0,playing:!0,pointercancel:!0,pointerdown:!0,pointerenter:!0,pointerleave:!0,pointermove:!0,pointerout:!0,pointerover:!0,pointerup:!0,progress:!0,ratechange:!0,reset:!0,resize:!0,scroll:!0,scrollend:!0,securitypolicyviolation:!0,seeked:!0,seeking:!0,select:!0,selectionchange:!0,selectstart:!0,slotchange:!0,stalled:!0,submit:!0,suspend:!0,timeupdate:!0,toggle:!0,touchcancel:!0,touchend:!0,touchmove:!0,touchstart:!0,transitioncancel:!0,transitionend:!0,transitionrun:!0,transitionstart:!0,volumechange:!0,waiting:!0,webkitanimationend:!0,webkitanimationiteration:!0,webkitanimationstart:!0,webkittransitionend:!0,wheel:!0,beforematch:!0,pointerrawupdate:!0};class Bl{constructor(t){V(this,"customData",{});V(this,"handleOptionsChange",t=>{t&&t.detail&&this.updateOptions(t.detail)});V(this,"handleStateChange",t=>{t&&t.detail&&this.updateState(t.detail)});if(!t||!t.name)throw new Error("Gesture must be initialized with a valid name.");if(t.name in Zh)throw new Error(`Gesture can't be created with a native event name. Tried to use "${t.name}". Please use a custom name instead.`);this.name=t.name,this.preventDefault=t.preventDefault??!1,this.stopPropagation=t.stopPropagation??!1,this.preventIf=t.preventIf??[],this.requiredKeys=t.requiredKeys??[],this.pointerMode=t.pointerMode??[],this.pointerOptions=t.pointerOptions??{}}init(t,n,r,i){this.element=t,this.pointerManager=n,this.gesturesRegistry=r,this.keyboardManager=i;const o=`${this.name}ChangeOptions`;this.element.addEventListener(o,this.handleOptionsChange);const s=`${this.name}ChangeState`;this.element.addEventListener(s,this.handleStateChange)}updateOptions(t){this.preventDefault=t.preventDefault??this.preventDefault,this.stopPropagation=t.stopPropagation??this.stopPropagation,this.preventIf=t.preventIf??this.preventIf,this.requiredKeys=t.requiredKeys??this.requiredKeys,this.pointerMode=t.pointerMode??this.pointerMode,this.pointerOptions=t.pointerOptions??this.pointerOptions}getBaseConfig(){return{requiredKeys:this.requiredKeys}}getEffectiveConfig(t,n){if(t!=="mouse"&&t!=="touch"&&t!=="pen")return n;const r=this.pointerOptions[t];return r?z({},n,r):n}updateState(t){Object.assign(this.state,t)}getTargetElement(t){return this.isActive||this.element===t.target||"contains"in this.element&&this.element.contains(t.target)||"getRootNode"in this.element&&this.element.getRootNode()instanceof ShadowRoot&&t.composedPath().includes(this.element)?this.element:null}set isActive(t){t?this.gesturesRegistry.registerActiveGesture(this.element,this):this.gesturesRegistry.unregisterActiveGesture(this.element,this)}get isActive(){return this.gesturesRegistry.isGestureActive(this.element,this)??!1}shouldPreventGesture(t,n){const r=this.getEffectiveConfig(n,this.getBaseConfig());if(!this.keyboardManager.areKeysPressed(r.requiredKeys))return!0;if(this.preventIf.length===0)return!1;const i=this.gesturesRegistry.getActiveGestures(t);return this.preventIf.some(o=>i[o])}isPointerTypeAllowed(t){return!this.pointerMode||this.pointerMode.length===0?!0:this.pointerMode.includes(t)}destroy(){const t=`${this.name}ChangeOptions`;this.element.removeEventListener(t,this.handleOptionsChange);const n=`${this.name}ChangeState`;this.element.removeEventListener(n,this.handleStateChange)}}class Qh{constructor(){V(this,"activeGestures",new Map)}registerActiveGesture(t,n){this.activeGestures.has(t)||this.activeGestures.set(t,new Set);const r=this.activeGestures.get(t),i={gesture:n,element:t};r.add(i)}unregisterActiveGesture(t,n){const r=this.activeGestures.get(t);r&&(r.forEach(i=>{i.gesture===n&&r.delete(i)}),r.size===0&&this.activeGestures.delete(t))}getActiveGestures(t){const n=this.activeGestures.get(t);return n?Array.from(n).reduce((r,i)=>(r[i.gesture.name]=!0,r),{}):{}}isGestureActive(t,n){const r=this.activeGestures.get(t);return r?Array.from(r).some(i=>i.gesture===n):!1}destroy(){this.activeGestures.clear()}unregisterElement(t){this.activeGestures.delete(t)}}class ef{constructor(){V(this,"pressedKeys",new Set);V(this,"handleKeyDown",t=>{this.pressedKeys.add(t.key)});V(this,"handleKeyUp",t=>{this.pressedKeys.delete(t.key)});V(this,"clearKeys",()=>{this.pressedKeys.clear()});this.initialize()}initialize(){typeof window>"u"||(window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("keyup",this.handleKeyUp),window.addEventListener("blur",this.clearKeys))}areKeysPressed(t){return!t||t.length===0?!0:t.every(n=>n==="ControlOrMeta"?navigator.platform.includes("Mac")?this.pressedKeys.has("Meta"):this.pressedKeys.has("Control"):this.pressedKeys.has(n))}destroy(){typeof window<"u"&&(window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("keyup",this.handleKeyUp),window.removeEventListener("blur",this.clearKeys)),this.clearKeys()}}class tf{constructor(t){V(this,"preventEventInterruption",!0);V(this,"pointers",new Map);V(this,"gestureHandlers",new Set);V(this,"handleInterruptEvents",t=>{if(this.preventEventInterruption&&"pointerType"in t&&t.pointerType==="touch"){t.preventDefault();return}const n=new PointerEvent("forceCancel",{bubbles:!1,cancelable:!1}),r=this.pointers.values().next().value;if(this.pointers.size>0&&r){Object.defineProperties(n,{clientX:{value:r.clientX},clientY:{value:r.clientY},pointerId:{value:r.pointerId},pointerType:{value:r.pointerType}});for(const[i,o]of this.pointers.entries()){const s=z({},o,{type:"forceCancel"});this.pointers.set(i,s)}}this.notifyHandlers(n),this.pointers.clear()});V(this,"handlePointerEvent",t=>{const{type:n,pointerId:r}=t;if(n==="pointerdown"||n==="pointermove")this.pointers.set(r,this.createPointerData(t));else if(n==="pointerup"||n==="pointercancel"||n==="forceCancel"){this.pointers.set(r,this.createPointerData(t)),this.notifyHandlers(t),this.pointers.delete(r);return}this.notifyHandlers(t)});this.root=t.root??document.getRootNode({composed:!0})??document.body,this.touchAction=t.touchAction||"auto",this.passive=t.passive??!1,this.preventEventInterruption=t.preventEventInterruption??!0,this.setupEventListeners()}registerGestureHandler(t){return this.gestureHandlers.add(t),()=>{this.gestureHandlers.delete(t)}}getPointers(){return new Map(this.pointers)}setupEventListeners(){this.touchAction!=="auto"&&(this.root.style.touchAction=this.touchAction),this.root.addEventListener("pointerdown",this.handlePointerEvent,{passive:this.passive}),this.root.addEventListener("pointermove",this.handlePointerEvent,{passive:this.passive}),this.root.addEventListener("pointerup",this.handlePointerEvent,{passive:this.passive}),this.root.addEventListener("pointercancel",this.handlePointerEvent,{passive:this.passive}),this.root.addEventListener("forceCancel",this.handlePointerEvent,{passive:this.passive}),this.root.addEventListener("blur",this.handleInterruptEvents),this.root.addEventListener("contextmenu",this.handleInterruptEvents)}notifyHandlers(t){this.gestureHandlers.forEach(n=>n(this.pointers,t))}createPointerData(t){return{pointerId:t.pointerId,clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,target:t.target,timeStamp:t.timeStamp,type:t.type,isPrimary:t.isPrimary,pressure:t.pressure,width:t.width,height:t.height,pointerType:t.pointerType,srcEvent:t}}destroy(){this.root.removeEventListener("pointerdown",this.handlePointerEvent),this.root.removeEventListener("pointermove",this.handlePointerEvent),this.root.removeEventListener("pointerup",this.handlePointerEvent),this.root.removeEventListener("pointercancel",this.handlePointerEvent),this.root.removeEventListener("forceCancel",this.handlePointerEvent),this.root.removeEventListener("blur",this.handleInterruptEvents),this.root.removeEventListener("contextmenu",this.handleInterruptEvents),this.pointers.clear(),this.gestureHandlers.clear()}}class nf{constructor(t){V(this,"gestureTemplates",new Map);V(this,"elementGestureMap",new Map);V(this,"activeGesturesRegistry",new Qh);V(this,"keyboardManager",new ef);this.pointerManager=new tf({root:t.root,touchAction:t.touchAction,passive:t.passive}),t.gestures&&t.gestures.length>0&&t.gestures.forEach(n=>{this.addGestureTemplate(n)})}addGestureTemplate(t){this.gestureTemplates.has(t.name)&&console.warn(`Gesture template with name "${t.name}" already exists. It will be overwritten.`),this.gestureTemplates.set(t.name,t)}setGestureOptions(t,n,r){const i=this.elementGestureMap.get(n);if(!i||!i.has(t)){console.error(`Gesture "${t}" not found on the provided element.`);return}const o=new CustomEvent(`${t}ChangeOptions`,{detail:r,bubbles:!1,cancelable:!1,composed:!1});n.dispatchEvent(o)}setGestureState(t,n,r){const i=this.elementGestureMap.get(n);if(!i||!i.has(t)){console.error(`Gesture "${t}" not found on the provided element.`);return}const o=new CustomEvent(`${t}ChangeState`,{detail:r,bubbles:!1,cancelable:!1,composed:!1});n.dispatchEvent(o)}registerElement(t,n,r){return Array.isArray(t)||(t=[t]),t.forEach(i=>{const o=r==null?void 0:r[i];this.registerSingleGesture(i,n,o)}),n}registerSingleGesture(t,n,r){const i=this.gestureTemplates.get(t);if(!i)return console.error(`Gesture template "${t}" not found.`),!1;this.elementGestureMap.has(n)||this.elementGestureMap.set(n,new Map);const o=this.elementGestureMap.get(n);o.has(t)&&(console.warn(`Element already has gesture "${t}" registered. It will be replaced.`),this.unregisterElement(t,n));const s=i.clone(r);return s.init(n,this.pointerManager,this.activeGesturesRegistry,this.keyboardManager),o.set(t,s),!0}unregisterElement(t,n){const r=this.elementGestureMap.get(n);return!r||!r.has(t)?!1:(r.get(t).destroy(),r.delete(t),this.activeGesturesRegistry.unregisterElement(n),r.size===0&&this.elementGestureMap.delete(n),!0)}unregisterAllGestures(t){const n=this.elementGestureMap.get(t);if(n){for(const[,r]of n)r.destroy(),this.activeGesturesRegistry.unregisterElement(t);this.elementGestureMap.delete(t)}}destroy(){for(const[t]of this.elementGestureMap)this.unregisterAllGestures(t);this.gestureTemplates.clear(),this.elementGestureMap.clear(),this.activeGesturesRegistry.destroy(),this.keyboardManager.destroy(),this.pointerManager.destroy()}}class Ft extends Bl{constructor(n){super(n);V(this,"unregisterHandler",null);V(this,"originalTarget",null);this.minPointers=n.minPointers??1,this.maxPointers=n.maxPointers??1/0}init(n,r,i,o){super.init(n,r,i,o),this.unregisterHandler=this.pointerManager.registerGestureHandler(this.handlePointerEvent)}updateOptions(n){super.updateOptions(n),this.minPointers=n.minPointers??this.minPointers,this.maxPointers=n.maxPointers??this.maxPointers}getBaseConfig(){return{requiredKeys:this.requiredKeys,minPointers:this.minPointers,maxPointers:this.maxPointers}}isWithinPointerCount(n,r){const i=this.getEffectiveConfig(r,this.getBaseConfig());return n.length>=i.minPointers&&n.length<=i.maxPointers}getRelevantPointers(n,r){return n.filter(i=>this.isPointerTypeAllowed(i.pointerType)&&(r===i.target||i.target===this.originalTarget||r===this.originalTarget||"contains"in r&&r.contains(i.target))||"getRootNode"in r&&r.getRootNode()instanceof ShadowRoot&&i.srcEvent.composedPath().includes(r))}destroy(){this.unregisterHandler&&(this.unregisterHandler(),this.unregisterHandler=null),super.destroy()}}function rf(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function _i(e){if(e.length<2)return 0;let t=0,n=0;for(let r=0;r<e.length;r+=1)for(let i=r+1;i<e.length;i+=1)t+=rf({x:e[r].clientX,y:e[r].clientY},{x:e[i].clientX,y:e[i].clientY}),n+=1;return n>0?t/n:0}function at(e){if(e.length===0)return{x:0,y:0};const t=e.reduce((n,r)=>(n.x+=r.clientX,n.y+=r.clientY,n),{x:0,y:0});return{x:t.x/e.length,y:t.y/e.length}}function ze(e,t){return`${e}${t==="ongoing"?"":t.charAt(0).toUpperCase()+t.slice(1)}`}const tr=1e-5,xt=1e-5,Ns=.15;function of(e,t){const n=t.x-e.x,r=t.y-e.y,i={vertical:null,horizontal:null,mainAxis:null},o=sf(t,e),s=Math.abs(n)>Math.abs(r)?"horizontal":"vertical",a=o||s==="horizontal"?tr:Ns,c=o?tr:s==="horizontal"?Ns:tr;return Math.abs(n)>a&&(i.horizontal=n>0?"right":"left"),Math.abs(r)>c&&(i.vertical=r>0?"down":"up"),i.mainAxis=o?"diagonal":s,i}function sf(e,t){const n=t.x-e.x,r=t.y-e.y,i=Math.atan2(r,n)*180/Math.PI;return i>=-45+xt&&i<=-22.5+xt||i>=22.5+xt&&i<=45+xt||i>=135+xt&&i<=157.5+xt||i>=-157.5+xt&&i<=-135+xt}function af(e,t){if(!e.vertical&&!e.horizontal)return!1;if(t.length===0)return!0;const n=e.vertical===null||t.includes(e.vertical),r=e.horizontal===null||t.includes(e.horizontal);return n&&r}const Fs=0,lf=e=>e>Fs?1:e<-Fs?-1:0,bt=e=>{e.cancelable&&e.preventDefault()};class So extends Ft{constructor(n){super(n);V(this,"state",{lastPosition:null});V(this,"handleElementEnter",n=>{if(n.pointerType!=="mouse"&&n.pointerType!=="pen")return;const r=this.pointerManager.getPointers()||new Map,i=Array.from(r.values());if(this.isWithinPointerCount(i,n.pointerType)){this.isActive=!0;const o={x:n.clientX,y:n.clientY};this.state.lastPosition=o,this.emitMoveEvent(this.element,"start",i,n),this.emitMoveEvent(this.element,"ongoing",i,n)}});V(this,"handleElementLeave",n=>{if(n.pointerType!=="mouse"&&n.pointerType!=="pen"||!this.isActive)return;const r=this.pointerManager.getPointers()||new Map,i=Array.from(r.values());this.emitMoveEvent(this.element,"end",i,n),this.resetState()});V(this,"handlePointerEvent",(n,r)=>{if(r.type!=="pointermove"||r.pointerType!=="mouse"&&r.pointerType!=="pen")return;this.preventDefault&&r.preventDefault(),this.stopPropagation&&r.stopPropagation();const i=Array.from(n.values()),o=this.getTargetElement(r);if(!o||!this.isWithinPointerCount(i,r.pointerType))return;if(this.shouldPreventGesture(o,r.pointerType)){if(!this.isActive)return;this.resetState(),this.emitMoveEvent(o,"end",i,r);return}const s={x:r.clientX,y:r.clientY};this.state.lastPosition=s,this.isActive||(this.isActive=!0,this.emitMoveEvent(o,"start",i,r)),this.emitMoveEvent(o,"ongoing",i,r)});this.threshold=n.threshold||0}clone(n){return new So(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,threshold:this.threshold,minPointers:this.minPointers,maxPointers:this.maxPointers,requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}init(n,r,i,o){super.init(n,r,i,o),this.element.addEventListener("pointerenter",this.handleElementEnter),this.element.addEventListener("pointerleave",this.handleElementLeave)}destroy(){this.element.removeEventListener("pointerenter",this.handleElementEnter),this.element.removeEventListener("pointerleave",this.handleElementLeave),this.resetState(),super.destroy()}updateOptions(n){super.updateOptions(n)}resetState(){this.isActive=!1,this.state={lastPosition:null}}emitMoveEvent(n,r,i,o){const s=this.state.lastPosition||at(i),a=this.gesturesRegistry.getActiveGestures(n),c={gestureName:this.name,centroid:s,target:o.target,srcEvent:o,phase:r,pointers:i,timeStamp:o.timeStamp,activeGestures:a,customData:this.customData},l=ze(this.name,r),u=new CustomEvent(l,{bubbles:!0,cancelable:!0,composed:!0,detail:c});n.dispatchEvent(u)}}class Pt extends Ft{constructor(n){super(n);V(this,"state",{startPointers:new Map,startCentroid:null,lastCentroid:null,movementThresholdReached:!1,totalDeltaX:0,totalDeltaY:0,activeDeltaX:0,activeDeltaY:0,lastDirection:{vertical:null,horizontal:null,mainAxis:null},lastDeltas:null});V(this,"handlePointerEvent",(n,r)=>{const i=Array.from(n.values());if(r.type==="forceCancel"){this.cancel(r.target,i,r);return}const o=this.getTargetElement(r);if(!o)return;if(this.shouldPreventGesture(o,r.pointerType)){this.cancel(o,i,r);return}const s=this.getRelevantPointers(i,o);if(!this.isWithinPointerCount(s,r.pointerType)){this.cancel(o,s,r);return}switch(r.type){case"pointerdown":!this.isActive&&!this.state.startCentroid&&(s.forEach(a=>{this.state.startPointers.set(a.pointerId,a)}),this.originalTarget=o,this.state.startCentroid=at(s),this.state.lastCentroid=z({},this.state.startCentroid));break;case"pointermove":if(this.state.startCentroid&&this.isWithinPointerCount(i,r.pointerType)){const a=at(s),c=a.x-this.state.startCentroid.x,l=a.y-this.state.startCentroid.y,u=Math.sqrt(c*c+l*l),d=of(this.state.lastCentroid??this.state.startCentroid,a),h=this.state.lastCentroid?a.x-this.state.lastCentroid.x:0,f=this.state.lastCentroid?a.y-this.state.lastCentroid.y:0;!this.state.movementThresholdReached&&u>=this.threshold&&af(d,this.direction)?(this.state.movementThresholdReached=!0,this.isActive=!0,this.state.lastDeltas={x:h,y:f},this.state.totalDeltaX+=h,this.state.totalDeltaY+=f,this.state.activeDeltaX+=h,this.state.activeDeltaY+=f,this.emitPanEvent(o,"start",s,r,a),this.emitPanEvent(o,"ongoing",s,r,a)):this.state.movementThresholdReached&&this.isActive&&(this.state.lastDeltas={x:h,y:f},this.state.totalDeltaX+=h,this.state.totalDeltaY+=f,this.state.activeDeltaX+=h,this.state.activeDeltaY+=f,this.emitPanEvent(o,"ongoing",s,r,a)),this.state.lastCentroid=a,this.state.lastDirection=d}break;case"pointerup":case"pointercancel":case"forceCancel":if(this.isActive&&this.state.movementThresholdReached){const a=s.filter(c=>c.type!=="pointerup"&&c.type!=="pointercancel");if(!this.isWithinPointerCount(a,r.pointerType)){const c=this.state.lastCentroid||this.state.startCentroid;r.type==="pointercancel"&&this.emitPanEvent(o,"cancel",s,r,c),this.emitPanEvent(o,"end",s,r,c),this.resetState()}}else this.resetState();break}});this.direction=n.direction||["up","down","left","right"],this.threshold=n.threshold||0}clone(n){return new Pt(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,threshold:this.threshold,minPointers:this.minPointers,maxPointers:this.maxPointers,direction:[...this.direction],requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}destroy(){this.resetState(),super.destroy()}updateOptions(n){super.updateOptions(n),this.direction=n.direction||this.direction,this.threshold=n.threshold??this.threshold}resetState(){this.isActive=!1,this.state=z({},this.state,{startPointers:new Map,startCentroid:null,lastCentroid:null,lastDeltas:null,activeDeltaX:0,activeDeltaY:0,movementThresholdReached:!1,lastDirection:{vertical:null,horizontal:null,mainAxis:null}})}emitPanEvent(n,r,i,o,s){var S,v;if(!this.state.startCentroid)return;const a=((S=this.state.lastDeltas)==null?void 0:S.x)??0,c=((v=this.state.lastDeltas)==null?void 0:v.y)??0,l=this.state.startPointers.values().next().value,u=l?(o.timeStamp-l.timeStamp)/1e3:0,d=u>0?a/u:0,h=u>0?c/u:0,f=Math.sqrt(d*d+h*h),m=this.gesturesRegistry.getActiveGestures(n),y={gestureName:this.name,initialCentroid:this.state.startCentroid,centroid:s,target:o.target,srcEvent:o,phase:r,pointers:i,timeStamp:o.timeStamp,deltaX:a,deltaY:c,direction:this.state.lastDirection,velocityX:d,velocityY:h,velocity:f,totalDeltaX:this.state.totalDeltaX,totalDeltaY:this.state.totalDeltaY,activeDeltaX:this.state.activeDeltaX,activeDeltaY:this.state.activeDeltaY,activeGestures:m,customData:this.customData},x=ze(this.name,r),b=new CustomEvent(x,{bubbles:!0,cancelable:!0,composed:!0,detail:y});n.dispatchEvent(b),this.preventDefault&&o.preventDefault(),this.stopPropagation&&o.stopPropagation()}cancel(n,r,i){if(this.isActive){const o=n??this.element;this.emitPanEvent(o,"cancel",r,i,this.state.lastCentroid),this.emitPanEvent(o,"end",r,i,this.state.lastCentroid)}this.resetState()}}class To extends Ft{constructor(n){super(z({},n,{minPointers:n.minPointers??2}));V(this,"state",{startDistance:0,lastDistance:0,lastScale:1,lastTime:0,velocity:0,totalScale:1,deltaScale:0});V(this,"handlePointerEvent",(n,r)=>{const i=Array.from(n.values()),o=this.getTargetElement(r);if(!o)return;if(this.shouldPreventGesture(o,r.pointerType)){this.isActive&&(this.emitPinchEvent(o,"cancel",i,r),this.resetState());return}const s=this.getRelevantPointers(i,o);switch(r.type){case"pointerdown":if(s.length>=2&&!this.isActive){const a=_i(s);this.state.startDistance=a,this.state.lastDistance=a,this.state.lastTime=r.timeStamp,this.originalTarget=o}break;case"pointermove":if(this.state.startDistance&&this.isWithinPointerCount(s,r.pointerType)){const a=_i(s),c=Math.abs(a-this.state.lastDistance);if(c!==0&&c>=this.threshold){const l=this.state.startDistance?a/this.state.startDistance:1,u=l/this.state.lastScale;this.state.totalScale*=u;const d=(r.timeStamp-this.state.lastTime)/1e3;if(this.state.lastDistance){const f=(a-this.state.lastDistance)/d;this.state.velocity=Number.isNaN(f)?0:f}this.state.lastDistance=a,this.state.deltaScale=l-this.state.lastScale,this.state.lastScale=l,this.state.lastTime=r.timeStamp,this.isActive?this.emitPinchEvent(o,"ongoing",s,r):(this.isActive=!0,this.emitPinchEvent(o,"start",s,r),this.emitPinchEvent(o,"ongoing",s,r))}}break;case"pointerup":case"pointercancel":case"forceCancel":if(this.isActive){const a=s.filter(c=>c.type!=="pointerup"&&c.type!=="pointercancel");if(!this.isWithinPointerCount(a,r.pointerType))r.type==="pointercancel"&&this.emitPinchEvent(o,"cancel",s,r),this.emitPinchEvent(o,"end",s,r),this.resetState();else if(a.length>=2){const c=_i(a);this.state.startDistance=c/this.state.lastScale}}break}});this.threshold=n.threshold??0}clone(n){return new To(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,threshold:this.threshold,minPointers:this.minPointers,maxPointers:this.maxPointers,requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}destroy(){this.resetState(),super.destroy()}updateOptions(n){super.updateOptions(n)}resetState(){this.isActive=!1,this.state=z({},this.state,{startDistance:0,lastDistance:0,lastScale:1,lastTime:0,velocity:0,deltaScale:0})}emitPinchEvent(n,r,i,o){const s=at(i),a=this.state.lastDistance,c=this.state.lastScale,l=this.gesturesRegistry.getActiveGestures(n),u={gestureName:this.name,centroid:s,target:o.target,srcEvent:o,phase:r,pointers:i,timeStamp:o.timeStamp,scale:c,deltaScale:this.state.deltaScale,totalScale:this.state.totalScale,distance:a,velocity:this.state.velocity,activeGestures:l,direction:lf(this.state.velocity),customData:this.customData};this.preventDefault&&o.preventDefault(),this.stopPropagation&&o.stopPropagation();const d=ze(this.name,r),h=new CustomEvent(d,{bubbles:!0,cancelable:!0,composed:!0,detail:u});n.dispatchEvent(h)}}class Wr extends Ft{constructor(n){super(n);V(this,"state",{startCentroid:null,lastPosition:null,timerId:null,startTime:0,pressThresholdReached:!1});V(this,"handlePointerEvent",(n,r)=>{const i=Array.from(n.values());if(r.type==="forceCancel"){this.cancelPress(r.target,i,r);return}const o=this.getTargetElement(r);if(!o)return;if(this.shouldPreventGesture(o,r.pointerType)){this.isActive&&this.cancelPress(o,i,r);return}const s=this.getRelevantPointers(i,o);if(!this.isWithinPointerCount(s,r.pointerType)){this.isActive&&this.cancelPress(o,s,r);return}switch(r.type){case"pointerdown":!this.isActive&&!this.state.startCentroid&&(this.state.startCentroid=at(s),this.state.lastPosition=z({},this.state.startCentroid),this.state.startTime=r.timeStamp,this.isActive=!0,this.originalTarget=o,this.clearPressTimer(),this.state.timerId=setTimeout(()=>{if(this.isActive&&this.state.startCentroid){this.state.pressThresholdReached=!0;const a=this.state.lastPosition;this.emitPressEvent(o,"start",s,r,a),this.emitPressEvent(o,"ongoing",s,r,a)}},this.duration));break;case"pointermove":if(this.isActive&&this.state.startCentroid){const a=at(s);this.state.lastPosition=a;const c=a.x-this.state.startCentroid.x,l=a.y-this.state.startCentroid.y;Math.sqrt(c*c+l*l)>this.maxDistance&&this.cancelPress(o,s,r)}break;case"pointerup":if(this.isActive){if(this.state.pressThresholdReached){const a=this.state.lastPosition||this.state.startCentroid;this.emitPressEvent(o,"end",s,r,a)}this.resetState()}break;case"pointercancel":case"forceCancel":this.cancelPress(o,s,r);break}});this.duration=n.duration??500,this.maxDistance=n.maxDistance??10}clone(n){return new Wr(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,minPointers:this.minPointers,maxPointers:this.maxPointers,duration:this.duration,maxDistance:this.maxDistance,requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}destroy(){this.clearPressTimer(),this.resetState(),super.destroy()}updateOptions(n){super.updateOptions(n),this.duration=n.duration??this.duration,this.maxDistance=n.maxDistance??this.maxDistance}resetState(){this.clearPressTimer(),this.isActive=!1,this.state=z({},this.state,{startCentroid:null,lastPosition:null,timerId:null,startTime:0,pressThresholdReached:!1})}clearPressTimer(){this.state.timerId!==null&&(clearTimeout(this.state.timerId),this.state.timerId=null)}emitPressEvent(n,r,i,o,s){const a=this.gesturesRegistry.getActiveGestures(n),c=o.timeStamp-this.state.startTime,l={gestureName:this.name,centroid:s,target:o.target,srcEvent:o,phase:r,pointers:i,timeStamp:o.timeStamp,x:s.x,y:s.y,duration:c,activeGestures:a,customData:this.customData},u=ze(this.name,r),d=new CustomEvent(u,{bubbles:!0,cancelable:!0,composed:!0,detail:l});n.dispatchEvent(d),this.preventDefault&&o.preventDefault(),this.stopPropagation&&o.stopPropagation()}cancelPress(n,r,i){if(this.isActive&&this.state.pressThresholdReached){const o=this.state.lastPosition||this.state.startCentroid;this.emitPressEvent(n??this.element,"cancel",r,i,o),this.emitPressEvent(n??this.element,"end",r,i,o)}this.resetState()}}class Co extends Ft{constructor(n){super(n);V(this,"state",{phase:"waitingForPress",dragTimeoutId:null});V(this,"pressHandler",()=>{this.state.phase==="waitingForPress"&&(this.state.phase="pressDetected",this.setTouchAction(),this.state.dragTimeoutId=setTimeout(()=>{this.resetState()},this.dragTimeout))});V(this,"dragStartHandler",n=>{this.state.phase==="pressDetected"&&(this.state.dragTimeoutId!==null&&(clearTimeout(this.state.dragTimeoutId),this.state.dragTimeoutId=null),this.restoreTouchAction(),this.state.phase="dragging",this.isActive=!0,this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n)))});V(this,"dragMoveHandler",n=>{this.state.phase==="dragging"&&this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n))});V(this,"dragEndHandler",n=>{this.state.phase==="dragging"&&(this.resetState(),this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n)))});this.pressDuration=n.pressDuration??500,this.pressMaxDistance=n.pressMaxDistance??10,this.dragTimeout=n.dragTimeout??1e3,this.dragThreshold=n.dragThreshold??0,this.dragDirection=n.dragDirection||["up","down","left","right"],this.pressGesture=new Wr({name:`${this.name}-press`,duration:this.pressDuration,maxDistance:this.pressMaxDistance,maxPointers:this.maxPointers,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}),this.panGesture=new Pt({name:`${this.name}-pan`,minPointers:this.minPointers,maxPointers:this.maxPointers,threshold:this.dragThreshold,direction:this.dragDirection,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)})}clone(n){return new Co(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,minPointers:this.minPointers,maxPointers:this.maxPointers,pressDuration:this.pressDuration,pressMaxDistance:this.pressMaxDistance,dragTimeout:this.dragTimeout,dragThreshold:this.dragThreshold,dragDirection:[...this.dragDirection],requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}init(n,r,i,o){super.init(n,r,i,o),this.pressGesture.init(n,r,i,o),this.panGesture.init(n,r,i,o),this.element.addEventListener(this.pressGesture.name,this.pressHandler),this.element.addEventListener(`${this.panGesture.name}Start`,this.dragStartHandler),this.element.addEventListener(this.panGesture.name,this.dragMoveHandler),this.element.addEventListener(`${this.panGesture.name}End`,this.dragEndHandler),this.element.addEventListener(`${this.panGesture.name}Cancel`,this.dragEndHandler)}destroy(){this.resetState(),this.pressGesture.destroy(),this.panGesture.destroy(),this.element.removeEventListener(this.pressGesture.name,this.pressHandler),this.element.removeEventListener(`${this.panGesture.name}Start`,this.dragStartHandler),this.element.removeEventListener(this.panGesture.name,this.dragMoveHandler),this.element.removeEventListener(`${this.panGesture.name}End`,this.dragEndHandler),this.element.removeEventListener(`${this.panGesture.name}Cancel`,this.dragEndHandler),super.destroy()}updateOptions(n){super.updateOptions(n),this.pressDuration=n.pressDuration??this.pressDuration,this.pressMaxDistance=n.pressMaxDistance??this.pressMaxDistance,this.dragTimeout=n.dragTimeout??this.dragTimeout,this.dragThreshold=n.dragThreshold??this.dragThreshold,this.dragDirection=n.dragDirection||this.dragDirection,this.element.dispatchEvent(new CustomEvent(`${this.panGesture.name}ChangeOptions`,{detail:{minPointers:this.minPointers,maxPointers:this.maxPointers,threshold:this.dragThreshold,direction:this.dragDirection,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}})),this.element.dispatchEvent(new CustomEvent(`${this.pressGesture.name}ChangeOptions`,{detail:{duration:this.pressDuration,maxDistance:this.pressMaxDistance,maxPointers:this.maxPointers,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}}))}resetState(){this.state.dragTimeoutId!==null&&clearTimeout(this.state.dragTimeoutId),this.restoreTouchAction(),this.isActive=!1,this.state={phase:"waitingForPress",dragTimeoutId:null}}handlePointerEvent(){}setTouchAction(){this.element.addEventListener("touchstart",bt,{passive:!1}),this.element.addEventListener("touchmove",bt,{passive:!1}),this.element.addEventListener("touchend",bt,{passive:!1})}restoreTouchAction(){this.element.removeEventListener("touchstart",bt),this.element.removeEventListener("touchmove",bt),this.element.removeEventListener("touchend",bt)}}class jn extends Ft{constructor(n){super(n);V(this,"state",{startCentroid:null,currentTapCount:0,lastTapTime:0,lastPosition:null});V(this,"handlePointerEvent",(n,r)=>{const i=Array.from(n.values()),o=this.getTargetElement(r);if(!o)return;const s=this.getRelevantPointers(i,o);if(this.shouldPreventGesture(o,r.pointerType)||!this.isWithinPointerCount(s,r.pointerType)){this.isActive&&this.cancelTap(o,s,r);return}switch(r.type){case"pointerdown":this.isActive||(this.state.startCentroid=at(s),this.state.lastPosition=z({},this.state.startCentroid),this.isActive=!0,this.originalTarget=o);break;case"pointermove":if(this.isActive&&this.state.startCentroid){const a=at(s);this.state.lastPosition=a;const c=a.x-this.state.startCentroid.x,l=a.y-this.state.startCentroid.y;Math.sqrt(c*c+l*l)>this.maxDistance&&this.cancelTap(o,s,r)}break;case"pointerup":if(this.isActive){this.state.currentTapCount+=1;const a=this.state.lastPosition||this.state.startCentroid;if(!a){this.cancelTap(o,s,r);return}this.state.currentTapCount>=this.taps?(this.fireTapEvent(o,s,r,a),this.resetState()):(this.state.lastTapTime=r.timeStamp,this.isActive=!1,this.state.startCentroid=null,setTimeout(()=>{this.state&&this.state.currentTapCount>0&&this.state.currentTapCount<this.taps&&(this.state.currentTapCount=0)},300))}break;case"pointercancel":case"forceCancel":this.cancelTap(o,s,r);break}});this.maxDistance=n.maxDistance??10,this.taps=n.taps??1}clone(n){return new jn(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,minPointers:this.minPointers,maxPointers:this.maxPointers,maxDistance:this.maxDistance,taps:this.taps,requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}destroy(){this.resetState(),super.destroy()}updateOptions(n){super.updateOptions(n),this.maxDistance=n.maxDistance??this.maxDistance,this.taps=n.taps??this.taps}resetState(){this.isActive=!1,this.state={startCentroid:null,currentTapCount:0,lastTapTime:0,lastPosition:null}}fireTapEvent(n,r,i,o){const s=this.gesturesRegistry.getActiveGestures(n),a={gestureName:this.name,centroid:o,target:i.target,srcEvent:i,phase:"end",pointers:r,timeStamp:i.timeStamp,x:o.x,y:o.y,tapCount:this.state.currentTapCount,activeGestures:s,customData:this.customData},c=new CustomEvent(this.name,{bubbles:!0,cancelable:!0,composed:!0,detail:a});n.dispatchEvent(c),this.preventDefault&&i.preventDefault(),this.stopPropagation&&i.stopPropagation()}cancelTap(n,r,i){if(this.state.startCentroid||this.state.lastPosition){const o=this.state.lastPosition||this.state.startCentroid,s=this.gesturesRegistry.getActiveGestures(n),a={gestureName:this.name,centroid:o,target:i.target,srcEvent:i,phase:"cancel",pointers:r,timeStamp:i.timeStamp,x:o.x,y:o.y,tapCount:this.state.currentTapCount,activeGestures:s,customData:this.customData},c=ze(this.name,"cancel"),l=new CustomEvent(c,{bubbles:!0,cancelable:!0,composed:!0,detail:a});n.dispatchEvent(l)}this.resetState()}}class _o extends Ft{constructor(n){super(n);V(this,"state",{phase:"waitingForTap",dragTimeoutId:null});V(this,"tapHandler",()=>{this.state.phase==="waitingForTap"&&(this.state.phase="tapDetected",this.setTouchAction(),this.state.dragTimeoutId=setTimeout(()=>{this.resetState()},this.dragTimeout))});V(this,"dragStartHandler",n=>{this.state.phase==="tapDetected"&&(this.state.dragTimeoutId!==null&&(clearTimeout(this.state.dragTimeoutId),this.state.dragTimeoutId=null),this.restoreTouchAction(),this.state.phase="dragging",this.isActive=!0,this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n)))});V(this,"dragMoveHandler",n=>{this.state.phase==="dragging"&&this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n))});V(this,"dragEndHandler",n=>{this.state.phase==="dragging"&&(this.resetState(),this.element.dispatchEvent(new CustomEvent(ze(this.name,n.detail.phase),n)))});this.tapMaxDistance=n.tapMaxDistance??10,this.dragTimeout=n.dragTimeout??1e3,this.dragThreshold=n.dragThreshold??0,this.dragDirection=n.dragDirection||["up","down","left","right"],this.tapGesture=new jn({name:`${this.name}-tap`,maxDistance:this.tapMaxDistance,maxPointers:this.maxPointers,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}),this.panGesture=new Pt({name:`${this.name}-pan`,minPointers:this.minPointers,maxPointers:this.maxPointers,threshold:this.dragThreshold,direction:this.dragDirection,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)})}clone(n){return new _o(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,minPointers:this.minPointers,maxPointers:this.maxPointers,tapMaxDistance:this.tapMaxDistance,dragTimeout:this.dragTimeout,dragThreshold:this.dragThreshold,dragDirection:[...this.dragDirection],requiredKeys:[...this.requiredKeys],pointerMode:[...this.pointerMode],preventIf:[...this.preventIf],pointerOptions:structuredClone(this.pointerOptions)},n))}init(n,r,i,o){super.init(n,r,i,o),this.tapGesture.init(n,r,i,o),this.panGesture.init(n,r,i,o),this.element.addEventListener(this.tapGesture.name,this.tapHandler),this.element.addEventListener(`${this.panGesture.name}Start`,this.dragStartHandler),this.element.addEventListener(this.panGesture.name,this.dragMoveHandler),this.element.addEventListener(`${this.panGesture.name}End`,this.dragEndHandler),this.element.addEventListener(`${this.panGesture.name}Cancel`,this.dragEndHandler)}destroy(){this.resetState(),this.tapGesture.destroy(),this.panGesture.destroy(),this.element.removeEventListener(this.tapGesture.name,this.tapHandler),this.element.removeEventListener(`${this.panGesture.name}Start`,this.dragStartHandler),this.element.removeEventListener(this.panGesture.name,this.dragMoveHandler),this.element.removeEventListener(`${this.panGesture.name}End`,this.dragEndHandler),this.element.removeEventListener(`${this.panGesture.name}Cancel`,this.dragEndHandler),super.destroy()}updateOptions(n){super.updateOptions(n),this.tapMaxDistance=n.tapMaxDistance??this.tapMaxDistance,this.dragTimeout=n.dragTimeout??this.dragTimeout,this.dragThreshold=n.dragThreshold??this.dragThreshold,this.dragDirection=n.dragDirection||this.dragDirection,this.element.dispatchEvent(new CustomEvent(`${this.panGesture.name}ChangeOptions`,{detail:{minPointers:this.minPointers,maxPointers:this.maxPointers,threshold:this.dragThreshold,direction:this.dragDirection,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}})),this.element.dispatchEvent(new CustomEvent(`${this.tapGesture.name}ChangeOptions`,{detail:{maxDistance:this.tapMaxDistance,maxPointers:this.maxPointers,pointerMode:this.pointerMode,requiredKeys:this.requiredKeys,preventIf:this.preventIf,pointerOptions:structuredClone(this.pointerOptions)}}))}resetState(){this.state.dragTimeoutId!==null&&clearTimeout(this.state.dragTimeoutId),this.restoreTouchAction(),this.isActive=!1,this.state={phase:"waitingForTap",dragTimeoutId:null}}handlePointerEvent(){}setTouchAction(){this.element.addEventListener("touchstart",bt,{passive:!1})}restoreTouchAction(){this.element.removeEventListener("touchstart",bt)}}class vr extends Bl{constructor(n){super(n);V(this,"state",{totalDeltaX:0,totalDeltaY:0,totalDeltaZ:0});V(this,"handleWheelEvent",n=>{if(this.shouldPreventGesture(this.element,"mouse"))return;const r=this.pointerManager.getPointers()||new Map,i=Array.from(r.values());this.state.totalDeltaX+=n.deltaX*this.sensitivity*(this.invert?-1:1),this.state.totalDeltaY+=n.deltaY*this.sensitivity*(this.invert?-1:1),this.state.totalDeltaZ+=n.deltaZ*this.sensitivity*(this.invert?-1:1),["totalDeltaX","totalDeltaY","totalDeltaZ"].forEach(o=>{this.state[o]<this.min&&(this.state[o]=this.min),this.state[o]>this.max&&(this.state[o]=this.max)}),this.emitWheelEvent(i,n)});this.sensitivity=n.sensitivity??1,this.max=n.max??Number.MAX_SAFE_INTEGER,this.min=n.min??Number.MIN_SAFE_INTEGER,this.initialDelta=n.initialDelta??0,this.invert=n.invert??!1,this.state.totalDeltaX=this.initialDelta,this.state.totalDeltaY=this.initialDelta,this.state.totalDeltaZ=this.initialDelta}clone(n){return new vr(z({name:this.name,preventDefault:this.preventDefault,stopPropagation:this.stopPropagation,sensitivity:this.sensitivity,max:this.max,min:this.min,initialDelta:this.initialDelta,invert:this.invert,requiredKeys:[...this.requiredKeys],preventIf:[...this.preventIf]},n))}init(n,r,i,o){super.init(n,r,i,o),this.element.addEventListener("wheel",this.handleWheelEvent)}destroy(){this.element.removeEventListener("wheel",this.handleWheelEvent),this.resetState(),super.destroy()}resetState(){this.isActive=!1,this.state={totalDeltaX:0,totalDeltaY:0,totalDeltaZ:0}}updateOptions(n){super.updateOptions(n),this.sensitivity=n.sensitivity??this.sensitivity,this.max=n.max??this.max,this.min=n.min??this.min,this.initialDelta=n.initialDelta??this.initialDelta,this.invert=n.invert??this.invert}emitWheelEvent(n,r){const i=n.length>0?at(n):{x:r.clientX,y:r.clientY},o=this.gesturesRegistry.getActiveGestures(this.element),s={gestureName:this.name,centroid:i,target:r.target,srcEvent:r,phase:"ongoing",pointers:n,timeStamp:r.timeStamp,deltaX:r.deltaX*this.sensitivity*(this.invert?-1:1),deltaY:r.deltaY*this.sensitivity*(this.invert?-1:1),deltaZ:r.deltaZ*this.sensitivity*(this.invert?-1:1),deltaMode:r.deltaMode,totalDeltaX:this.state.totalDeltaX,totalDeltaY:this.state.totalDeltaY,totalDeltaZ:this.state.totalDeltaZ,activeGestures:o,customData:this.customData};this.preventDefault&&r.preventDefault(),this.stopPropagation&&r.stopPropagation();const a=ze(this.name,"ongoing"),c=new CustomEvent(a,{bubbles:!0,cancelable:!0,composed:!0,detail:s});this.element.dispatchEvent(c)}}const Xt=e=>e.preventDefault(),Mo=({svgRef:e})=>{const t=R.useRef(null);R.useEffect(()=>{const i=e.current;t.current||(t.current=new nf({gestures:[new Pt({name:"pan",threshold:0,maxPointers:1}),new So({name:"move",preventIf:["pan","zoomPinch","zoomPan"]}),new jn({name:"tap",preventIf:["pan","zoomPinch","zoomPan"]}),new Wr({name:"quickPress",duration:50}),new Pt({name:"brush",threshold:0,maxPointers:1}),new Pt({name:"zoomPan",threshold:0,preventIf:["zoomTapAndDrag","zoomPressAndDrag"]}),new To({name:"zoomPinch",threshold:5}),new vr({name:"zoomTurnWheel",sensitivity:.01,initialDelta:1}),new vr({name:"panTurnWheel",sensitivity:.5}),new _o({name:"zoomTapAndDrag",dragThreshold:10}),new Co({name:"zoomPressAndDrag",dragThreshold:10,preventIf:["zoomPinch"]}),new jn({name:"zoomDoubleTapReset",taps:2})]}));const o=t.current;if(!(!i||!o))return o.registerElement(["pan","move","zoomPinch","zoomPan","zoomTurnWheel","panTurnWheel","tap","quickPress","zoomTapAndDrag","zoomPressAndDrag","zoomDoubleTapReset","brush"],i),()=>{o.unregisterAllGestures(i)}},[e,t]);const n=R.useCallback((i,o,s)=>{const a=e.current;return a==null||a.addEventListener(i,o,s),{cleanup:()=>a==null?void 0:a.removeEventListener(i,o)}},[e]),r=R.useCallback((i,o)=>{const s=e.current,a=t.current;!a||!s||a.setGestureOptions(i,s,o??{})},[e,t]);return R.useEffect(()=>{const i=e.current;return i==null||i.addEventListener("gesturestart",Xt),i==null||i.addEventListener("gesturechange",Xt),i==null||i.addEventListener("gestureend",Xt),()=>{i==null||i.removeEventListener("gesturestart",Xt),i==null||i.removeEventListener("gesturechange",Xt),i==null||i.removeEventListener("gestureend",Xt)}},[e]),{instance:{addInteractionListener:n,updateZoomInteractionListeners:r}}};Mo.params={};Mo.getInitialState=()=>({});const cf=[wo,vo,Ur,Hr,Mo,Br],uf=["apiRef"],df=e=>{let{plugins:t}=e,n=Je(e.props,uf);const r={};t.forEach(s=>{Object.assign(r,s.params)});const i={};return Object.keys(n).forEach(s=>{const a=n[s];r[s]&&(i[s]=a)}),t.reduce((s,a)=>a.getDefaultizedParams?a.getDefaultizedParams({params:s}):s,i)};let Gs=0;function hf(e,t,n){const r=p.useId(),i=R.useMemo(()=>[...cf,...e],[e]),o=df({plugins:i,props:t});o.id=o.id??r;const a=R.useRef({}).current,c=pf(t.apiRef),l=R.useRef(null),u=R.useRef(null),d=R.useRef(null);if(d.current==null){Gs+=1;const m={cacheKey:{id:Gs}};i.forEach(y=>{y.getInitialState&&Object.assign(m,y.getInitialState(o,m,n))}),d.current=new bo(m)}const h=m=>{const y=m({instance:a,params:o,plugins:i,store:d.current,svgRef:u,chartRootRef:l,seriesConfig:n});y.publicAPI&&Object.assign(c.current,y.publicAPI),y.instance&&Object.assign(a,y.instance)};return i.forEach(h),{contextValue:R.useMemo(()=>({store:d.current,publicAPI:c.current,instance:a,svgRef:u,chartRootRef:l}),[a,c])}}function ff(e){return e.current==null&&(e.current={}),e}function pf(e){const t=R.useRef({});return e?ff(e):t}const Ro=R.createContext(null);process.env.NODE_ENV!=="production"&&(Ro.displayName="ChartContext");const Bs=new Set;function an(e,t="warning"){if(process.env.NODE_ENV==="production")return;const n=Array.isArray(e)?e.join(`
58
- `):e;Bs.has(n)||(Bs.add(n),t==="error"?console.error(n):console.warn(n))}function mf(e){const{componentName:t,propName:n,controlled:r,defaultValue:i,warningPrefix:o="MUI X"}=e,[{initialDefaultValue:s,isControlled:a}]=R.useState({initialDefaultValue:i,isControlled:r!==void 0});a!==(r!==void 0)&&an([`${o}: A component is changing the ${a?"":"un"}controlled ${n} state of ${t} to be ${a?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"],"error"),JSON.stringify(s)!==JSON.stringify(i)&&an([`${o}: A component is changing the default ${n} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`],"error")}const Ul=process.env.NODE_ENV==="production"?()=>{}:mf,Vl=4,Hl=20+2*Vl,gf=40+2*Vl,xf="hover",nr={minStart:0,maxEnd:100,step:5,minSpan:10,maxSpan:100,panning:!0,filterMode:"keep",reverse:!1,slider:{enabled:!1,preview:!1,size:Hl,showTooltip:xf}},jo=(e,t,n,r)=>{var i;if(e)return e===!0?z({axisId:t,axisDirection:n},nr,{reverse:r??!1}):z({axisId:t,axisDirection:n},nr,{reverse:r??!1},e,{slider:z({},nr.slider,{size:((i=e.slider)==null?void 0:i.preview)??nr.slider.preview?gf:Hl},e.slider)})};function Wl(e,t){const n={top:0,bottom:0,none:0};return(e&&e.length>0?e:[{id:Ch,scaleType:"linear"}]).map((o,s)=>{var f;const a=o.dataKey,c=s===0?"bottom":"none",l=o.position??c,u=jh+(o.label?zl:0),d=o.id??`defaultized-x-axis-${s}`,h=z({offset:n[l]},o,{id:d,position:l,height:o.height??u,zoom:jo(o.zoom,d,"x",o.reverse)});if(l!=="none"&&(n[l]+=h.height,(f=h.zoom)!=null&&f.slider.enabled&&(n[l]+=h.zoom.slider.size)),a===void 0||o.data!==void 0)return h;if(t===void 0)throw new Error("MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.");return z({},h,{data:t.map(m=>m[a])})})}function ql(e,t){const n={right:0,left:0,none:0};return(e&&e.length>0?e:[{id:_h,scaleType:"linear"}]).map((o,s)=>{var f;const a=o.dataKey,c=s===0?"left":"none",l=o.position??c,u=Rh+(o.label?zl:0),d=o.id??`defaultized-y-axis-${s}`,h=z({offset:n[l]},o,{id:d,position:l,width:o.width??u,zoom:jo(o.zoom,d,"y",o.reverse)});if(l!=="none"&&(n[l]+=h.width,(f=h.zoom)!=null&&f.slider.enabled&&(n[l]+=h.zoom.slider.size)),a===void 0||o.data!==void 0)return h;if(t===void 0)throw new Error("MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.");return z({},h,{data:t.map(m=>m[a])})})}function yf(e,t){return function(r,i){if(i.location==="tick"){const o=i.scale.domain();return o[0]===o[1]?i.scale.tickFormat(1)(r):i.scale.tickFormat(e)(r)}return i.location==="zoom-slider-tooltip"?t.tickFormat(2)(r):`${r}`}}function mn(e){return e.scaleType==="band"}function gn(e){return e.scaleType==="point"}function bf(e){return e.scaleType==="symlog"}function gr(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function vf(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Io(e){let t,n,r;e.length!==2?(t=gr,n=(a,c)=>gr(e(a),c),r=(a,c)=>e(a)-c):(t=e===gr||e===vf?e:wf,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{const d=l+u>>>1;n(a[d],c)<0?l=d+1:u=d}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{const d=l+u>>>1;n(a[d],c)<=0?l=d+1:u=d}while(l<u)}return l}function s(a,c,l=0,u=a.length){const d=i(a,c,l,u-1);return d>l&&r(a[d-1],c)>-r(a[d],c)?d-1:d}return{left:i,center:s,right:o}}function wf(){return 0}function Ef(e){return e===null?NaN:+e}const Sf=Io(gr),Yl=Sf.right;Io(Ef).center;class wr extends Map{constructor(t,n=_f){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(Us(this,t))}has(t){return super.has(Us(this,t))}set(t,n){return super.set(Tf(this,t),n)}delete(t){return super.delete(Cf(this,t))}}function Us({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Tf({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Cf({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function _f(e){return e!==null&&typeof e=="object"?e.valueOf():e}const Mf=Math.sqrt(50),Rf=Math.sqrt(10),jf=Math.sqrt(2);function Er(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=Mf?10:o>=Rf?5:o>=jf?2:1;let a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?Er(e,t,n*2):[a,c,l]}function Yi(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,o,s]=r?Er(t,e,n):Er(e,t,n);if(!(o>=i))return[];const a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Ji(e,t,n){return t=+t,e=+e,n=+n,Er(e,t,n)[2]}function Xi(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?Ji(t,e,n):Ji(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function If(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function St(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Af(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Vs=Symbol("implicit");function Ki(){var e=new wr,t=[],n=[],r=Vs;function i(o){let s=e.get(o);if(s===void 0){if(r!==Vs)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new wr;for(const s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Ki(t,n).unknown(r)},St.apply(i,arguments),i}function Ao(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Jl(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Fn(){}var In=.7,Sr=1/In,nn="\\s*([+-]?\\d+)\\s*",An="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kf=/^#([0-9a-f]{3,8})$/,Of=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),Pf=new RegExp(`^rgb\\(${qe},${qe},${qe}\\)$`),Df=new RegExp(`^rgba\\(${nn},${nn},${nn},${An}\\)$`),Lf=new RegExp(`^rgba\\(${qe},${qe},${qe},${An}\\)$`),$f=new RegExp(`^hsl\\(${An},${qe},${qe}\\)$`),zf=new RegExp(`^hsla\\(${An},${qe},${qe},${An}\\)$`),Hs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ao(Fn,kn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ws,formatHex:Ws,formatHex8:Nf,formatHsl:Ff,formatRgb:qs,toString:qs});function Ws(){return this.rgb().formatHex()}function Nf(){return this.rgb().formatHex8()}function Ff(){return Xl(this).formatHsl()}function qs(){return this.rgb().formatRgb()}function kn(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ys(t):n===3?new je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rr(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Of.exec(e))?new je(t[1],t[2],t[3],1):(t=Pf.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Df.exec(e))?rr(t[1],t[2],t[3],t[4]):(t=Lf.exec(e))?rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$f.exec(e))?Ks(t[1],t[2]/100,t[3]/100,1):(t=zf.exec(e))?Ks(t[1],t[2]/100,t[3]/100,t[4]):Hs.hasOwnProperty(e)?Ys(Hs[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function Ys(e){return new je(e>>16&255,e>>8&255,e&255,1)}function rr(e,t,n,r){return r<=0&&(e=t=n=NaN),new je(e,t,n,r)}function Gf(e){return e instanceof Fn||(e=kn(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function Zi(e,t,n,r){return arguments.length===1?Gf(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ao(je,Zi,Jl(Fn,{brighter(e){return e=e==null?Sr:Math.pow(Sr,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(Dt(this.r),Dt(this.g),Dt(this.b),Tr(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Js,formatHex:Js,formatHex8:Bf,formatRgb:Xs,toString:Xs}));function Js(){return`#${kt(this.r)}${kt(this.g)}${kt(this.b)}`}function Bf(){return`#${kt(this.r)}${kt(this.g)}${kt(this.b)}${kt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Xs(){const e=Tr(this.opacity);return`${e===1?"rgb(":"rgba("}${Dt(this.r)}, ${Dt(this.g)}, ${Dt(this.b)}${e===1?")":`, ${e})`}`}function Tr(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Dt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kt(e){return e=Dt(e),(e<16?"0":"")+e.toString(16)}function Ks(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fe(e,t,n,r)}function Xl(e){if(e instanceof Fe)return new Fe(e.h,e.s,e.l,e.opacity);if(e instanceof Fn||(e=kn(e)),!e)return new Fe;if(e instanceof Fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Fe(s,a,c,e.opacity)}function Uf(e,t,n,r){return arguments.length===1?Xl(e):new Fe(e,t,n,r??1)}function Fe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ao(Fe,Uf,Jl(Fn,{brighter(e){return e=e==null?Sr:Math.pow(Sr,e),new Fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new Fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new je(Mi(e>=240?e-240:e+120,i,r),Mi(e,i,r),Mi(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Fe(Zs(this.h),ir(this.s),ir(this.l),Tr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tr(this.opacity);return`${e===1?"hsl(":"hsla("}${Zs(this.h)}, ${ir(this.s)*100}%, ${ir(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Zs(e){return e=(e||0)%360,e<0?e+360:e}function ir(e){return Math.max(0,Math.min(1,e||0))}function Mi(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ko=e=>()=>e;function Vf(e,t){return function(n){return e+n*t}}function Hf(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Wf(e){return(e=+e)==1?Kl:function(t,n){return n-t?Hf(t,n,e):ko(isNaN(t)?n:t)}}function Kl(e,t){var n=t-e;return n?Vf(e,n):ko(isNaN(e)?t:e)}const Qs=(function e(t){var n=Wf(t);function r(i,o){var s=n((i=Zi(i)).r,(o=Zi(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Kl(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r})(1);function qf(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function Yf(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Jf(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=qr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function Oo(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ge(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Xf(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=qr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Qi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ri=new RegExp(Qi.source,"g");function Kf(e){return function(){return e}}function Zf(e){return function(t){return e(t)+""}}function Qf(e,t){var n=Qi.lastIndex=Ri.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Qi.exec(e))&&(i=Ri.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Ge(r,i)})),n=Ri.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?Zf(c[0].x):Kf(t):(t=c.length,function(l){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(l);return a.join("")})}function qr(e,t){var n=typeof t,r;return t==null||n==="boolean"?ko(t):(n==="number"?Ge:n==="string"?(r=kn(t))?(t=r,Qs):Qf:t instanceof kn?Qs:t instanceof Date?Oo:Yf(t)?qf:Array.isArray(t)?Jf:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Xf:Ge)(e,t)}function Zl(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function ep(e){return function(){return e}}function tp(e){return+e}var ea=[0,1];function De(e){return e}function eo(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:ep(isNaN(t)?NaN:.5)}function np(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function rp(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=eo(i,r),o=n(s,o)):(r=eo(r,i),o=n(o,s)),function(a){return o(r(a))}}function ip(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=eo(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Yl(e,a,1,r)-1;return o[c](i[c](a))}}function Gn(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Yr(){var e=ea,t=ea,n=qr,r,i,o,s=De,a,c,l;function u(){var h=Math.min(e.length,t.length);return s!==De&&(s=np(e[0],e[h-1])),a=h>2?ip:rp,c=l=null,d}function d(h){return h==null||isNaN(h=+h)?o:(c||(c=a(e.map(r),t,n)))(r(s(h)))}return d.invert=function(h){return s(i((l||(l=a(t,e.map(r),Ge)))(h)))},d.domain=function(h){return arguments.length?(e=Array.from(h,tp),u()):e.slice()},d.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},d.rangeRound=function(h){return t=Array.from(h),n=Zl,u()},d.clamp=function(h){return arguments.length?(s=h?!0:De,u()):s!==De},d.interpolate=function(h){return arguments.length?(n=h,u()):n},d.unknown=function(h){return arguments.length?(o=h,d):o},function(h,f){return r=h,i=f,u()}}function Ql(){return Yr()(De,De)}function op(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Cr(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function ln(e){return e=Cr(Math.abs(e)),e?e[1]:NaN}function sp(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function ap(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var lp=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function On(e){if(!(t=lp.exec(e)))throw new Error("invalid format: "+e);var t;return new Po({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}On.prototype=Po.prototype;function Po(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Po.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function cp(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var ec;function up(e,t){var n=Cr(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(ec=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Cr(e,Math.max(0,t+o-1))[0]}function ta(e,t){var n=Cr(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const na={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:op,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ta(e*100,t),r:ta,s:up,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function ra(e){return e}var ia=Array.prototype.map,oa=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function dp(e){var t=e.grouping===void 0||e.thousands===void 0?ra:sp(ia.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?ra:ap(ia.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(d){d=On(d);var h=d.fill,f=d.align,m=d.sign,y=d.symbol,x=d.zero,b=d.width,S=d.comma,v=d.precision,_=d.trim,C=d.type;C==="n"?(S=!0,C="g"):na[C]||(v===void 0&&(v=12),_=!0,C="g"),(x||h==="0"&&f==="=")&&(x=!0,h="0",f="=");var w=y==="$"?n:y==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",E=y==="$"?r:/[%p]/.test(C)?s:"",M=na[C],j=/[defgprs%]/.test(C);v=v===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function D(A){var P=w,I=E,k,U,N;if(C==="c")I=M(A)+I,A="";else{A=+A;var Y=A<0||1/A<0;if(A=isNaN(A)?c:M(Math.abs(A),v),_&&(A=cp(A)),Y&&+A==0&&m!=="+"&&(Y=!1),P=(Y?m==="("?m:a:m==="-"||m==="("?"":m)+P,I=(C==="s"?oa[8+ec/3]:"")+I+(Y&&m==="("?")":""),j){for(k=-1,U=A.length;++k<U;)if(N=A.charCodeAt(k),48>N||N>57){I=(N===46?i+A.slice(k+1):A.slice(k))+I,A=A.slice(0,k);break}}}S&&!x&&(A=t(A,1/0));var F=P.length+A.length+I.length,J=F<b?new Array(b-F+1).join(h):"";switch(S&&x&&(A=t(J+A,J.length?b-I.length:1/0),J=""),f){case"<":A=P+A+I+J;break;case"=":A=P+J+A+I;break;case"^":A=J.slice(0,F=J.length>>1)+P+A+I+J.slice(F);break;default:A=J+P+A+I;break}return o(A)}return D.toString=function(){return d+""},D}function u(d,h){var f=l((d=On(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(ln(h)/3)))*3,y=Math.pow(10,-m),x=oa[8+m/3];return function(b){return f(y*b)+x}}return{format:l,formatPrefix:u}}var or,Do,tc;hp({thousands:",",grouping:[3],currency:["$",""]});function hp(e){return or=dp(e),Do=or.format,tc=or.formatPrefix,or}function fp(e){return Math.max(0,-ln(Math.abs(e)))}function pp(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ln(t)/3)))*3-ln(Math.abs(e)))}function mp(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ln(t)-ln(e))+1}function gp(e,t,n,r){var i=Xi(e,t,n),o;switch(r=On(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=pp(i,s))&&(r.precision=o),tc(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=mp(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=fp(i))&&(r.precision=o-(r.type==="%")*2);break}}return Do(r)}function Jr(e){var t=e.domain;return e.ticks=function(n){var r=t();return Yi(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return gp(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Ji(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Lo(){var e=Ql();return e.copy=function(){return Gn(e,Lo())},St.apply(e,arguments),Jr(e)}function nc(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function sa(e){return Math.log(e)}function aa(e){return Math.exp(e)}function xp(e){return-Math.log(-e)}function yp(e){return-Math.exp(-e)}function bp(e){return isFinite(e)?+("1e"+e):e<0?0:e}function vp(e){return e===10?bp:e===Math.E?Math.exp:t=>Math.pow(e,t)}function wp(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function la(e){return(t,n)=>-e(-t,n)}function Ep(e){const t=e(sa,aa),n=t.domain;let r=10,i,o;function s(){return i=wp(r),o=vp(r),n()[0]<0?(i=la(i),o=la(o),e(xp,yp)):e(sa,aa),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{const c=n();let l=c[0],u=c[c.length-1];const d=u<l;d&&([l,u]=[u,l]);let h=i(l),f=i(u),m,y;const x=a==null?10:+a;let b=[];if(!(r%1)&&f-h<x){if(h=Math.floor(h),f=Math.ceil(f),l>0){for(;h<=f;++h)for(m=1;m<r;++m)if(y=h<0?m/o(-h):m*o(h),!(y<l)){if(y>u)break;b.push(y)}}else for(;h<=f;++h)for(m=r-1;m>=1;--m)if(y=h>0?m/o(-h):m*o(h),!(y<l)){if(y>u)break;b.push(y)}b.length*2<x&&(b=Yi(l,u,x))}else b=Yi(h,f,Math.min(f-h,x)).map(o);return d?b.reverse():b},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=On(c)).precision==null&&(c.trim=!0),c=Do(c)),a===1/0)return c;const l=Math.max(1,r*a/t.ticks().length);return u=>{let d=u/o(Math.round(i(u)));return d*r<r-.5&&(d*=r),d<=l?c(u):""}},t.nice=()=>n(nc(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function _r(){const e=Ep(Yr()).domain([1,10]);return e.copy=()=>Gn(e,_r()).base(e.base()),St.apply(e,arguments),e}function ca(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function ua(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Sp(e){var t=1,n=e(ca(t),ua(t));return n.constant=function(r){return arguments.length?e(ca(t=+r),ua(t)):t},Jr(n)}function rc(){var e=Sp(Yr());return e.copy=function(){return Gn(e,rc()).constant(e.constant())},St.apply(e,arguments)}function da(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Tp(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Cp(e){return e<0?-e*e:e*e}function _p(e){var t=e(De,De),n=1;function r(){return n===1?e(De,De):n===.5?e(Tp,Cp):e(da(n),da(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Jr(t)}function $o(){var e=_p(Yr());return e.copy=function(){return Gn(e,$o()).exponent(e.exponent())},St.apply(e,arguments),e}function Mp(){return $o.apply(null,arguments).exponent(.5)}function ic(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Yl(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return ic().domain(e).range(t).unknown(n)},St.apply(i,arguments)}const ji=new Date,Ii=new Date;function ge(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{const c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>ge(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(ji.setTime(+o),Ii.setTime(+s),e(ji),e(Ii),Math.floor(n(ji,Ii))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const Mr=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Mr.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Mr);Mr.range;const it=1e3,Le=it*60,ot=Le*60,lt=ot*24,zo=lt*7,ha=lt*30,Ai=lt*365,Ot=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*it)},(e,t)=>(t-e)/it,e=>e.getUTCSeconds());Ot.range;const No=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*it)},(e,t)=>{e.setTime(+e+t*Le)},(e,t)=>(t-e)/Le,e=>e.getMinutes());No.range;const Fo=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Le)},(e,t)=>(t-e)/Le,e=>e.getUTCMinutes());Fo.range;const Go=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*it-e.getMinutes()*Le)},(e,t)=>{e.setTime(+e+t*ot)},(e,t)=>(t-e)/ot,e=>e.getHours());Go.range;const Bo=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ot)},(e,t)=>(t-e)/ot,e=>e.getUTCHours());Bo.range;const Bn=ge(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Le)/lt,e=>e.getDate()-1);Bn.range;const Xr=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/lt,e=>e.getUTCDate()-1);Xr.range;const oc=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/lt,e=>Math.floor(e/lt));oc.range;function Gt(e){return ge(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Le)/zo)}const Kr=Gt(0),Rr=Gt(1),Rp=Gt(2),jp=Gt(3),cn=Gt(4),Ip=Gt(5),Ap=Gt(6);Kr.range;Rr.range;Rp.range;jp.range;cn.range;Ip.range;Ap.range;function Bt(e){return ge(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/zo)}const Zr=Bt(0),jr=Bt(1),kp=Bt(2),Op=Bt(3),un=Bt(4),Pp=Bt(5),Dp=Bt(6);Zr.range;jr.range;kp.range;Op.range;un.range;Pp.range;Dp.range;const Uo=ge(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Uo.range;const Vo=ge(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Vo.range;const ct=ge(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());ct.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});ct.range;const ut=ge(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ut.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ut.range;function sc(e,t,n,r,i,o){const s=[[Ot,1,it],[Ot,5,5*it],[Ot,15,15*it],[Ot,30,30*it],[o,1,Le],[o,5,5*Le],[o,15,15*Le],[o,30,30*Le],[i,1,ot],[i,3,3*ot],[i,6,6*ot],[i,12,12*ot],[r,1,lt],[r,2,2*lt],[n,1,zo],[t,1,ha],[t,3,3*ha],[e,1,Ai]];function a(l,u,d){const h=u<l;h&&([l,u]=[u,l]);const f=d&&typeof d.range=="function"?d:c(l,u,d),m=f?f.range(l,+u+1):[];return h?m.reverse():m}function c(l,u,d){const h=Math.abs(u-l)/d,f=Io(([,,x])=>x).right(s,h);if(f===s.length)return e.every(Xi(l/Ai,u/Ai,d));if(f===0)return Mr.every(Math.max(Xi(l,u,d),1));const[m,y]=s[h/s[f-1][2]<s[f][2]/h?f-1:f];return m.every(y)}return[a,c]}const[Lp,$p]=sc(ut,Vo,Zr,oc,Bo,Fo),[zp,Np]=sc(ct,Uo,Kr,Bn,Go,No);function ki(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Oi(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function yn(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Fp(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=bn(i),u=vn(i),d=bn(o),h=vn(o),f=bn(s),m=vn(s),y=bn(a),x=vn(a),b=bn(c),S=vn(c),v={a:Y,A:F,b:J,B:ie,c:null,d:ya,e:ya,f:cm,g:bm,G:wm,H:sm,I:am,j:lm,L:ac,m:um,M:dm,p:Z,q:_e,Q:wa,s:Ea,S:hm,u:fm,U:pm,V:mm,w:gm,W:xm,x:null,X:null,y:ym,Y:vm,Z:Em,"%":va},_={a:Qe,A:et,b:Se,B:tt,c:null,d:ba,e:ba,f:_m,g:Lm,G:zm,H:Sm,I:Tm,j:Cm,L:cc,m:Mm,M:Rm,p:Ue,q:Ie,Q:wa,s:Ea,S:jm,u:Im,U:Am,V:km,w:Om,W:Pm,x:null,X:null,y:Dm,Y:$m,Z:Nm,"%":va},C={a:D,A,b:P,B:I,c:k,d:ga,e:ga,f:nm,g:ma,G:pa,H:xa,I:xa,j:Zp,L:tm,m:Kp,M:Qp,p:j,q:Xp,Q:im,s:om,S:em,u:Hp,U:Wp,V:qp,w:Vp,W:Yp,x:U,X:N,y:ma,Y:pa,Z:Jp,"%":rm};v.x=w(n,v),v.X=w(r,v),v.c=w(t,v),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(G,W){return function(K){var L=[],ne=-1,Q=0,we=G.length,xe,ue,gt;for(K instanceof Date||(K=new Date(+K));++ne<we;)G.charCodeAt(ne)===37&&(L.push(G.slice(Q,ne)),(ue=fa[xe=G.charAt(++ne)])!=null?xe=G.charAt(++ne):ue=xe==="e"?" ":"0",(gt=W[xe])&&(xe=gt(K,ue)),L.push(xe),Q=ne+1);return L.push(G.slice(Q,ne)),L.join("")}}function E(G,W){return function(K){var L=yn(1900,void 0,1),ne=M(L,G,K+="",0),Q,we;if(ne!=K.length)return null;if("Q"in L)return new Date(L.Q);if("s"in L)return new Date(L.s*1e3+("L"in L?L.L:0));if(W&&!("Z"in L)&&(L.Z=0),"p"in L&&(L.H=L.H%12+L.p*12),L.m===void 0&&(L.m="q"in L?L.q:0),"V"in L){if(L.V<1||L.V>53)return null;"w"in L||(L.w=1),"Z"in L?(Q=Oi(yn(L.y,0,1)),we=Q.getUTCDay(),Q=we>4||we===0?jr.ceil(Q):jr(Q),Q=Xr.offset(Q,(L.V-1)*7),L.y=Q.getUTCFullYear(),L.m=Q.getUTCMonth(),L.d=Q.getUTCDate()+(L.w+6)%7):(Q=ki(yn(L.y,0,1)),we=Q.getDay(),Q=we>4||we===0?Rr.ceil(Q):Rr(Q),Q=Bn.offset(Q,(L.V-1)*7),L.y=Q.getFullYear(),L.m=Q.getMonth(),L.d=Q.getDate()+(L.w+6)%7)}else("W"in L||"U"in L)&&("w"in L||(L.w="u"in L?L.u%7:"W"in L?1:0),we="Z"in L?Oi(yn(L.y,0,1)).getUTCDay():ki(yn(L.y,0,1)).getDay(),L.m=0,L.d="W"in L?(L.w+6)%7+L.W*7-(we+5)%7:L.w+L.U*7-(we+6)%7);return"Z"in L?(L.H+=L.Z/100|0,L.M+=L.Z%100,Oi(L)):ki(L)}}function M(G,W,K,L){for(var ne=0,Q=W.length,we=K.length,xe,ue;ne<Q;){if(L>=we)return-1;if(xe=W.charCodeAt(ne++),xe===37){if(xe=W.charAt(ne++),ue=C[xe in fa?W.charAt(ne++):xe],!ue||(L=ue(G,K,L))<0)return-1}else if(xe!=K.charCodeAt(L++))return-1}return L}function j(G,W,K){var L=l.exec(W.slice(K));return L?(G.p=u.get(L[0].toLowerCase()),K+L[0].length):-1}function D(G,W,K){var L=f.exec(W.slice(K));return L?(G.w=m.get(L[0].toLowerCase()),K+L[0].length):-1}function A(G,W,K){var L=d.exec(W.slice(K));return L?(G.w=h.get(L[0].toLowerCase()),K+L[0].length):-1}function P(G,W,K){var L=b.exec(W.slice(K));return L?(G.m=S.get(L[0].toLowerCase()),K+L[0].length):-1}function I(G,W,K){var L=y.exec(W.slice(K));return L?(G.m=x.get(L[0].toLowerCase()),K+L[0].length):-1}function k(G,W,K){return M(G,t,W,K)}function U(G,W,K){return M(G,n,W,K)}function N(G,W,K){return M(G,r,W,K)}function Y(G){return s[G.getDay()]}function F(G){return o[G.getDay()]}function J(G){return c[G.getMonth()]}function ie(G){return a[G.getMonth()]}function Z(G){return i[+(G.getHours()>=12)]}function _e(G){return 1+~~(G.getMonth()/3)}function Qe(G){return s[G.getUTCDay()]}function et(G){return o[G.getUTCDay()]}function Se(G){return c[G.getUTCMonth()]}function tt(G){return a[G.getUTCMonth()]}function Ue(G){return i[+(G.getUTCHours()>=12)]}function Ie(G){return 1+~~(G.getUTCMonth()/3)}return{format:function(G){var W=w(G+="",v);return W.toString=function(){return G},W},parse:function(G){var W=E(G+="",!1);return W.toString=function(){return G},W},utcFormat:function(G){var W=w(G+="",_);return W.toString=function(){return G},W},utcParse:function(G){var W=E(G+="",!0);return W.toString=function(){return G},W}}}var fa={"-":"",_:" ",0:"0"},ve=/^\s*\d+/,Gp=/^%/,Bp=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function Up(e){return e.replace(Bp,"\\$&")}function bn(e){return new RegExp("^(?:"+e.map(Up).join("|")+")","i")}function vn(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Vp(e,t,n){var r=ve.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Hp(e,t,n){var r=ve.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Wp(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function qp(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Yp(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function pa(e,t,n){var r=ve.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function ma(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Jp(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Xp(e,t,n){var r=ve.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Kp(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function ga(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Zp(e,t,n){var r=ve.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function xa(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Qp(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function em(e,t,n){var r=ve.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function tm(e,t,n){var r=ve.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function nm(e,t,n){var r=ve.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rm(e,t,n){var r=Gp.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function im(e,t,n){var r=ve.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function om(e,t,n){var r=ve.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function ya(e,t){return te(e.getDate(),t,2)}function sm(e,t){return te(e.getHours(),t,2)}function am(e,t){return te(e.getHours()%12||12,t,2)}function lm(e,t){return te(1+Bn.count(ct(e),e),t,3)}function ac(e,t){return te(e.getMilliseconds(),t,3)}function cm(e,t){return ac(e,t)+"000"}function um(e,t){return te(e.getMonth()+1,t,2)}function dm(e,t){return te(e.getMinutes(),t,2)}function hm(e,t){return te(e.getSeconds(),t,2)}function fm(e){var t=e.getDay();return t===0?7:t}function pm(e,t){return te(Kr.count(ct(e)-1,e),t,2)}function lc(e){var t=e.getDay();return t>=4||t===0?cn(e):cn.ceil(e)}function mm(e,t){return e=lc(e),te(cn.count(ct(e),e)+(ct(e).getDay()===4),t,2)}function gm(e){return e.getDay()}function xm(e,t){return te(Rr.count(ct(e)-1,e),t,2)}function ym(e,t){return te(e.getFullYear()%100,t,2)}function bm(e,t){return e=lc(e),te(e.getFullYear()%100,t,2)}function vm(e,t){return te(e.getFullYear()%1e4,t,4)}function wm(e,t){var n=e.getDay();return e=n>=4||n===0?cn(e):cn.ceil(e),te(e.getFullYear()%1e4,t,4)}function Em(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function ba(e,t){return te(e.getUTCDate(),t,2)}function Sm(e,t){return te(e.getUTCHours(),t,2)}function Tm(e,t){return te(e.getUTCHours()%12||12,t,2)}function Cm(e,t){return te(1+Xr.count(ut(e),e),t,3)}function cc(e,t){return te(e.getUTCMilliseconds(),t,3)}function _m(e,t){return cc(e,t)+"000"}function Mm(e,t){return te(e.getUTCMonth()+1,t,2)}function Rm(e,t){return te(e.getUTCMinutes(),t,2)}function jm(e,t){return te(e.getUTCSeconds(),t,2)}function Im(e){var t=e.getUTCDay();return t===0?7:t}function Am(e,t){return te(Zr.count(ut(e)-1,e),t,2)}function uc(e){var t=e.getUTCDay();return t>=4||t===0?un(e):un.ceil(e)}function km(e,t){return e=uc(e),te(un.count(ut(e),e)+(ut(e).getUTCDay()===4),t,2)}function Om(e){return e.getUTCDay()}function Pm(e,t){return te(jr.count(ut(e)-1,e),t,2)}function Dm(e,t){return te(e.getUTCFullYear()%100,t,2)}function Lm(e,t){return e=uc(e),te(e.getUTCFullYear()%100,t,2)}function $m(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function zm(e,t){var n=e.getUTCDay();return e=n>=4||n===0?un(e):un.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function Nm(){return"+0000"}function va(){return"%"}function wa(e){return+e}function Ea(e){return Math.floor(+e/1e3)}var Kt,dc,hc;Fm({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Fm(e){return Kt=Fp(e),dc=Kt.format,Kt.parse,hc=Kt.utcFormat,Kt.utcParse,Kt}function Gm(e){return new Date(e)}function Bm(e){return e instanceof Date?+e:+new Date(+e)}function Ho(e,t,n,r,i,o,s,a,c,l){var u=Ql(),d=u.invert,h=u.domain,f=l(".%L"),m=l(":%S"),y=l("%I:%M"),x=l("%I %p"),b=l("%a %d"),S=l("%b %d"),v=l("%B"),_=l("%Y");function C(w){return(c(w)<w?f:a(w)<w?m:s(w)<w?y:o(w)<w?x:r(w)<w?i(w)<w?b:S:n(w)<w?v:_)(w)}return u.invert=function(w){return new Date(d(w))},u.domain=function(w){return arguments.length?h(Array.from(w,Bm)):h().map(Gm)},u.ticks=function(w){var E=h();return e(E[0],E[E.length-1],w??10)},u.tickFormat=function(w,E){return E==null?C:l(E)},u.nice=function(w){var E=h();return(!w||typeof w.range!="function")&&(w=t(E[0],E[E.length-1],w??10)),w?h(nc(E,w)):u},u.copy=function(){return Gn(u,Ho(e,t,n,r,i,o,s,a,c,l))},u}function fc(){return St.apply(Ho(zp,Np,ct,Uo,Kr,Bn,Go,No,Ot,dc).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Um(){return St.apply(Ho(Lp,$p,ut,Vo,Zr,Xr,Bo,Fo,Ot,hc).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Vm(){var e=0,t=1,n,r,i,o,s=De,a=!1,c;function l(d){return d==null||isNaN(d=+d)?c:s(i===0?.5:(d=(o(d)-n)*i,a?Math.max(0,Math.min(1,d)):d))}l.domain=function(d){return arguments.length?([e,t]=d,n=o(e=+e),r=o(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(d){return arguments.length?(a=!!d,l):a},l.interpolator=function(d){return arguments.length?(s=d,l):s};function u(d){return function(h){var f,m;return arguments.length?([f,m]=h,s=d(f,m),l):[s(0),s(1)]}}return l.range=u(qr),l.rangeRound=u(Zl),l.unknown=function(d){return arguments.length?(c=d,l):c},function(d){return o=d,n=d(e),r=d(t),i=n===r?0:1/(r-n),l}}function Hm(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function pc(){var e=Jr(Vm()(De));return e.copy=function(){return Hm(e,pc())},Af.apply(e,arguments)}function mc(e){return e.type==="piecewise"?ic(e.thresholds,e.colors):pc([e.min??0,e.max??100],e.color)}function Ir(e){return e.values?Ki(e.values,e.colors).unknown(e.unknownColor??null):Ki(e.colors.map((t,n)=>n),e.colors).unknown(e.unknownColor??null)}function to(e){return e.type==="ordinal"?Ir(e):mc(e)}function Wo(e,t,n){const{tickMaxStep:r,tickMinStep:i,tickNumber:o}=e,s=i===void 0?999:Math.floor(Math.abs(t[1]-t[0])/i),a=r===void 0?2:Math.ceil(Math.abs(t[1]-t[0])/r);return Math.min(s,Math.max(a,o??n))}function Wm(e,t){return t[1]-t[0]===0?1:e/((t[1]-t[0])/100)}function gc(e){return Math.floor(Math.abs(e)/50)}function Sa(e){return Array.isArray(e)?JSON.stringify(e):typeof e=="object"&&e!==null?e.valueOf():e}function qo(...e){let t=new wr(void 0,Sa),n=[],r=[],i=0,o=1,s,a,c=!1,l=0,u=0,d=.5;const h=x=>{const b=t.get(x);if(b!==void 0)return r[b%r.length]},f=()=>{const x=n.length,b=o<i,S=b?o:i,v=b?i:o;s=(v-S)/Math.max(1,x-l+u*2),c&&(s=Math.floor(s));const _=S+(v-S-s*(x-l))*d;a=s*(1-l);const C=c?Math.round(_):_;a=c?Math.round(a):a;const E=If(x).map(M=>C+s*M);return r=b?E.reverse():E,h};h.domain=function(x){if(!arguments.length)return n.slice();n=[],t=new wr(void 0,Sa);for(const b of x)t.has(b)||t.set(b,n.push(b)-1);return f()},h.range=function(x){if(!arguments.length)return[i,o];const[b,S]=x;return i=+b,o=+S,f()},h.rangeRound=function(x){const[b,S]=x;return i=+b,o=+S,c=!0,f()},h.bandwidth=function(){return a},h.step=function(){return s},h.round=function(x){return arguments.length?(c=!!x,f()):c},h.padding=function(x){return arguments.length?(l=Math.min(1,u=+x),f()):l},h.paddingInner=function(x){return arguments.length?(l=Math.min(1,x),f()):l},h.paddingOuter=function(x){return arguments.length?(u=+x,f()):u},h.align=function(x){return arguments.length?(d=Math.max(0,Math.min(1,x)),f()):d},h.copy=()=>qo(n,[i,o]).round(c).paddingInner(l).paddingOuter(u).align(d);const[m,y]=e;return e.length>1?(h.domain(m),h.range(y)):m?h.range(m):f(),h}function qm(...e){const t=qo(...e).paddingInner(1),n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=()=>{const r=n();return r.padding=r.paddingOuter,delete r.paddingInner,delete r.paddingOuter,r.copy=t.copy,r},t}function xc(...e){const t=rc(...e),n=t.ticks,{negativeScale:r,linearScale:i,positiveScale:o}=Ym(t);return t.ticks=s=>{const a=n(s),c=t.constant();let l=0,u=0,d=0;a.forEach(f=>{f>-c&&f<c&&(u+=1),f<=-c&&(l+=1),f>=c&&(d+=1)});const h=[];if(l>0&&h.push(...r.ticks(l)),u>0){const f=i.ticks(u);h.at(-1)===f[0]?h.push(...f.slice(1)):h.push(...f)}if(d>0){const f=o.ticks(d);h.at(-1)===f[0]?h.push(...f.slice(1)):h.push(...f)}return h},t.tickFormat=(s=10,a)=>{const c=t.constant(),[l,u]=t.domain(),d=u-l,h=r.domain(),f=h[1]-h[0],y=(d===0?0:f/d)*s,x=i.domain(),b=x[1]-x[0],v=(d===0?0:b/d)*s,_=o.domain(),C=_[1]-_[0],E=(d===0?0:C/d)*s,M=r.tickFormat(y,a),j=i.tickFormat(v,a),D=o.tickFormat(E,a);return A=>(A.valueOf()<=-c?M:A.valueOf()>=c?D:j)(A)},t.copy=()=>xc(t.domain(),t.range()).constant(t.constant()),t}function Ym(e){const t=e.constant(),n=e.domain(),r=[n[0],Math.min(n[1],-t)],i=_r(r,e.range()),o=[Math.max(n[0],-t),Math.min(n[1],t)],s=Lo(o,e.range()),a=[Math.max(n[0],t),n[1]],c=_r(a,e.range());return{negativeScale:i,linearScale:s,positiveScale:c}}function Yo(e,t,n){switch(e){case"log":return _r(t,n);case"pow":return $o(t,n);case"sqrt":return Mp(t,n);case"time":return fc(t,n);case"utc":return Um(t,n);case"symlog":return xc(t,n);default:return Lo(t,n)}}const Jm=e=>(e==null?void 0:e[0])instanceof Date;function Xm(e,t,n){const r=fc(e,t);return(i,{location:o})=>o==="tick"?r.tickFormat(n)(i):`${i.toLocaleString()}`}let Ta,Ca;class Km{constructor(){V(this,"types",new Set);if(Ta)throw new Error("You can only create one instance!");Ta=this.types}addType(t){this.types.add(t)}getTypes(){return this.types}}class Zm{constructor(){V(this,"types",new Set);if(Ca)throw new Error("You can only create one instance!");Ca=this.types}addType(t){this.types.add(t)}getTypes(){return this.types}}const Qr=new Km;Qr.addType("bar");Qr.addType("line");Qr.addType("scatter");const Qm=new Zm;Qm.addType("radar");function yc(e){return Qr.getTypes().has(e)}const eg=(e,t,n,r)=>{const i=new Set;return Object.keys(t).filter(yc).forEach(s=>{var l,u,d;const a=((l=n[s])==null?void 0:l.series)??{},c=(d=(u=t[s]).axisTooltipGetter)==null?void 0:d.call(u,a);c!==void 0&&c.forEach(({axisId:h,direction:f})=>{f===e&&i.add(h??r)})}),i};function Un(e){return e.bandwidth!==void 0}function tg(e){return Un(e)&&e.paddingOuter!==void 0}function ng(e,t,n){const r=t==="x"?[e.left,e.left+e.width]:[e.top+e.height,e.top];return n?[r[1],r[0]]:r}const rg=.2,ig=.1;function bc({scales:e,drawingArea:t,formattedSeries:n,axis:r,seriesConfig:i,axisDirection:o,zoomMap:s,domains:a}){if(r===void 0)return{axis:{},axisIds:[]};const c=eg(o,i,n,r[0].id),l={};return r.forEach(u=>{const d=u,h=e[d.id],f=s==null?void 0:s.get(d.id),m=f?[f.start,f.end]:[0,100],y=ng(t,o,d.reverse??!1),x=a[d.id].tickNumber,b=!d.ignoreTooltip&&c.has(d.id),S=Wm(x,m),v=d.data??[];if(Un(h)){const w=o==="y"?[y[1],y[0]]:y;if(tg(h)&&mn(d)){const E=d.categoryGapRatio??rg,M=d.barGapRatio??ig;l[d.id]=z({offset:0,height:0,categoryGapRatio:E,barGapRatio:M,triggerTooltip:b},d,{data:v,scale:h,tickNumber:S,colorScale:d.colorMap&&(d.colorMap.type==="ordinal"?Ir(z({values:d.data},d.colorMap)):to(d.colorMap))})}if(gn(d)&&(l[d.id]=z({offset:0,height:0,triggerTooltip:b},d,{data:v,scale:h,tickNumber:S,colorScale:d.colorMap&&(d.colorMap.type==="ordinal"?Ir(z({values:d.data},d.colorMap)):to(d.colorMap))})),Jm(d.data)){const E=Xm(d.data,w,d.tickNumber);l[d.id].valueFormatter=d.valueFormatter??E}return}if(d.scaleType==="band"||d.scaleType==="point")return;const _=d,C=_.scaleType??"linear";l[d.id]=z({offset:0,height:0,triggerTooltip:b},_,{data:v,scaleType:C,scale:h,tickNumber:S,colorScale:_.colorMap&&mc(_.colorMap),valueFormatter:d.valueFormatter??yf(S,Yo(C,y.map(w=>h.invert(w)),y))})}),{axis:l,axisIds:r.map(({id:u})=>u)}}function og(e){return e!=null}function sg(e,t,n,r){const i=(e==null?void 0:e.length)??0,o=Math.floor(t*i/100),s=Math.ceil(n*i/100);return function(c,l){return(c[r]??(e==null?void 0:e[l]))==null?!0:l>=o&&l<s}}function ag(e,t,n,r,i){const o=e[0].valueOf(),s=e[1].valueOf(),a=o+t*(s-o)/100,c=o+n*(s-o)/100;return function(u,d){const h=u[r]??(i==null?void 0:i[d]);return h==null?!0:h>=a&&h<=c}}const lg=e=>({currentAxisId:t,seriesXAxisId:n,seriesYAxisId:r,isDefaultAxis:i})=>(o,s)=>{var l,u;return!(t===n?r:n)||i?((u=(l=Object.values(e??{}))[0])==null?void 0:u.call(l,o,s))??!0:[r,n].filter(d=>d!==t).map(d=>e[d??""]).filter(og).every(d=>d(o,s))},_a=e=>(t=[])=>t.reduce((n,r)=>{const{zoom:i,id:o,reverse:s}=r,a=jo(i,o,e,s);return a&&(n[o]=a),n},{}),cg=.2;function vc(e,t,n){const r=t==="x"?[e.left,e.left+e.width]:[e.top+e.height,e.top];return n.reverse?[r[1],r[0]]:r}function wc(e,t){const n=[0,1];if(mn(e)){const o=e.categoryGapRatio??cg;return qo(t,n).paddingInner(o).paddingOuter(o/2)}if(gn(e))return qm(t,n);const r=e.scaleType??"linear",i=Yo(r,t,n);return bf(e)&&e.constant!=null&&i.constant(e.constant),i}const Ec=(e,t)=>{const n=e[1]-e[0],r=t[1]-t[0],i=e[0]-t[0]*n/r,o=e[1]+(100-t[1])*n/r;return[i,o]},ug=(e,t,n,r,i,o,s)=>{var l;const a=n==="x"?r[e].xExtremumGetter:r[e].yExtremumGetter,c=((l=o[e])==null?void 0:l.series)??{};return(a==null?void 0:a({series:c,axis:t,axisIndex:i,isDefaultAxis:i===0,getFilters:s}))??[1/0,-1/0]};function ei(e,t,n,r,i,o){const s=Object.keys(n).filter(yc);let a=[1/0,-1/0];for(const c of s){const[l,u]=ug(c,e,t,n,r,i,o);a=[Math.min(a[0],l),Math.max(a[1],u)]}return Number.isNaN(a[0])||Number.isNaN(a[1])?[1/0,-1/0]:a}const dg=(e,t,n,r)=>{var i;if(e.domainLimit!==void 0)return e.domainLimit;if(t==="x")for(const o of((i=r.line)==null?void 0:i.seriesOrder)??[]){const s=r.line.series[o];if(s.xAxisId===e.id||s.xAxisId===void 0&&n===0)return"strict"}return"nice"};function Sc(e,t,n){return Yo(e??"linear",t,[0,1]).nice(n).domain()}function Tc(e,t,n,r,[i,o],s,a){const c=_c(e,t,n,r,a);let l=Mc(e,i,o);if(typeof c=="function"){const{min:d,max:h}=c(i.valueOf(),o.valueOf());l[0]=d,l[1]=h}const u=Wo(e,l,s);return c==="nice"&&(l=Sc(e.scaleType,l,u)),l=["min"in e?e.min??l[0]:l[0],"max"in e?e.max??l[1]:l[1]],{domain:l,tickNumber:u}}function Cc(e,t,n,r,[i,o],s,a){const c=_c(e,t,n,r,a);let l=Mc(e,i,o);if(typeof c=="function"){const{min:u,max:d}=c(i.valueOf(),o.valueOf());l[0]=u,l[1]=d}return c==="nice"&&(l=Sc(e.scaleType,l,s)),[e.min??l[0],e.max??l[1]]}function _c(e,t,n,r,i){return i?dg(e,t,n,r):e.domainLimit??"nice"}function Mc(e,t,n){let r=t,i=n;return"max"in e&&e.max!=null&&e.max<t&&(r=e.max),"min"in e&&e.min!=null&&e.min>t&&(i=e.min),!("min"in e)&&!("max"in e)?[r,i]:[e.min??r,e.max??i]}class hg{constructor(){this.ids=[],this.values=[],this.length=0}clear(){this.length=0}push(t,n){let r=this.length++;for(;r>0;){const i=r-1>>1,o=this.values[i];if(n>=o)break;this.ids[r]=this.ids[i],this.values[r]=o,r=i}this.ids[r]=t,this.values[r]=n}pop(){if(this.length===0)return;const t=this.ids,n=this.values,r=t[0],i=--this.length;if(i>0){const o=t[i],s=n[i];let a=0;const c=i>>1;for(;a<c;){const l=(a<<1)+1,u=l+1,d=l+(+(u<i)&+(n[u]<n[l]));if(n[d]>=s)break;t[a]=t[d],n[a]=n[d],a=d}t[a]=o,n[a]=s}return r}peek(){return this.length>0?this.ids[0]:void 0}peekValue(){return this.length>0?this.values[0]:void 0}shrink(){this.ids.length=this.values.length=this.length}}const Ma=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Pi=3;class Jo{static from(t,n=0){if(n%8!==0)throw new Error("byteOffset must be 8-byte aligned.");if(!t||t.byteLength===void 0||t.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[r,i]=new Uint8Array(t,n+0,2);if(r!==251)throw new Error("Data does not appear to be in a Flatbush format.");const o=i>>4;if(o!==Pi)throw new Error(`Got v${o} data when expected v${Pi}.`);const s=Ma[i&15];if(!s)throw new Error("Unrecognized array type.");const[a]=new Uint16Array(t,n+2,1),[c]=new Uint32Array(t,n+4,1);return new Jo(c,a,s,void 0,t,n)}constructor(t,n=16,r=Float64Array,i=ArrayBuffer,o,s=0){if(t===void 0)throw new Error("Missing required argument: numItems.");if(isNaN(t)||t<=0)throw new Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.byteOffset=s;let a=t,c=a;this._levelBounds=[a*4];do a=Math.ceil(a/this.nodeSize),c+=a,this._levelBounds.push(c*4);while(a!==1);this.ArrayType=r,this.IndexArrayType=c<16384?Uint16Array:Uint32Array;const l=Ma.indexOf(r),u=c*4*r.BYTES_PER_ELEMENT;if(l<0)throw new Error(`Unexpected typed array class: ${r}.`);if(o)this.data=o,this._boxes=new r(o,s+8,c*4),this._indices=new this.IndexArrayType(o,s+8+u,c),this._pos=c*4,this.minX=this._boxes[this._pos-4],this.minY=this._boxes[this._pos-3],this.maxX=this._boxes[this._pos-2],this.maxY=this._boxes[this._pos-1];else{const d=this.data=new i(8+u+c*this.IndexArrayType.BYTES_PER_ELEMENT);this._boxes=new r(d,8,c*4),this._indices=new this.IndexArrayType(d,8+u,c),this._pos=0,this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,new Uint8Array(d,0,2).set([251,(Pi<<4)+l]),new Uint16Array(d,2,1)[0]=n,new Uint32Array(d,4,1)[0]=t}this._queue=new hg}add(t,n,r=t,i=n){const o=this._pos>>2,s=this._boxes;return this._indices[o]=o,s[this._pos++]=t,s[this._pos++]=n,s[this._pos++]=r,s[this._pos++]=i,t<this.minX&&(this.minX=t),n<this.minY&&(this.minY=n),r>this.maxX&&(this.maxX=r),i>this.maxY&&(this.maxY=i),o}finish(){if(this._pos>>2!==this.numItems)throw new Error(`Added ${this._pos>>2} items when expected ${this.numItems}.`);const t=this._boxes;if(this.numItems<=this.nodeSize){t[this._pos++]=this.minX,t[this._pos++]=this.minY,t[this._pos++]=this.maxX,t[this._pos++]=this.maxY;return}const n=this.maxX-this.minX||1,r=this.maxY-this.minY||1,i=new Uint32Array(this.numItems),o=65535;for(let s=0,a=0;s<this.numItems;s++){const c=t[a++],l=t[a++],u=t[a++],d=t[a++],h=Math.floor(o*((c+u)/2-this.minX)/n),f=Math.floor(o*((l+d)/2-this.minY)/r);i[s]=mg(h,f)}no(i,t,this._indices,0,this.numItems-1,this.nodeSize);for(let s=0,a=0;s<this._levelBounds.length-1;s++){const c=this._levelBounds[s];for(;a<c;){const l=a;let u=t[a++],d=t[a++],h=t[a++],f=t[a++];for(let m=1;m<this.nodeSize&&a<c;m++)u=Math.min(u,t[a++]),d=Math.min(d,t[a++]),h=Math.max(h,t[a++]),f=Math.max(f,t[a++]);this._indices[this._pos>>2]=l,t[this._pos++]=u,t[this._pos++]=d,t[this._pos++]=h,t[this._pos++]=f}}}search(t,n,r,i,o){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let s=this._boxes.length-4;const a=[],c=[];for(;s!==void 0;){const l=Math.min(s+this.nodeSize*4,Ra(s,this._levelBounds));for(let u=s;u<l;u+=4){if(r<this._boxes[u]||i<this._boxes[u+1]||t>this._boxes[u+2]||n>this._boxes[u+3])continue;const d=this._indices[u>>2]|0;s>=this.numItems*4?a.push(d):(o===void 0||o(d))&&(c.push(d),c.push(this._boxes[u]),c.push(this._boxes[u+1]))}s=a.pop()}return c}neighbors(t,n,r=1/0,i=1/0,o,s=fg){if(this._pos!==this._boxes.length)throw new Error("Data not yet indexed - call index.finish().");let a=this._boxes.length-4;const c=this._queue,l=[];e:for(;a!==void 0;){const u=Math.min(a+this.nodeSize*4,Ra(a,this._levelBounds));for(let d=a;d<u;d+=4){const h=this._indices[d>>2]|0,f=this._boxes[d],m=this._boxes[d+1],y=this._boxes[d+2],x=this._boxes[d+3],b=t<f?f-t:t>y?t-y:0,S=n<m?m-n:n>x?n-x:0,v=s(b,S);v>i||(a>=this.numItems*4?c.push(h<<1,v):(o===void 0||o(h))&&c.push((h<<1)+1,v))}for(;c.length&&c.peek()&1;)if(c.peekValue()>i||(l.push(c.pop()>>1),l.length===r))break e;a=c.length?c.pop()>>1:void 0}return c.clear(),l}}function fg(e,t){return e*e+t*t}function Ra(e,t){let n=0,r=t.length-1;for(;n<r;){const i=n+r>>1;t[i]>e?r=i:n=i+1}return t[n]}function no(e,t,n,r,i,o){if(Math.floor(r/o)>=Math.floor(i/o))return;const s=e[r],a=e[r+i>>1],c=e[i];let l=c;const u=Math.max(s,a);c>u?l=u:u===s?l=Math.max(a,c):u===a&&(l=Math.max(s,c));let d=r-1,h=i+1;for(;;){do d++;while(e[d]<l);do h--;while(e[h]>l);if(d>=h)break;pg(e,t,n,d,h)}no(e,t,n,r,h,o),no(e,t,n,h+1,i,o)}function pg(e,t,n,r,i){const o=e[r];e[r]=e[i],e[i]=o;const s=4*r,a=4*i,c=t[s],l=t[s+1],u=t[s+2],d=t[s+3];t[s]=t[a],t[s+1]=t[a+1],t[s+2]=t[a+2],t[s+3]=t[a+3],t[a]=c,t[a+1]=l,t[a+2]=u,t[a+3]=d;const h=n[r];n[r]=n[i],n[i]=h}function mg(e,t){let n=e^t,r=65535^n,i=65535^(e|t),o=e&(t^65535),s=n|r>>1,a=n>>1^n,c=i>>1^r&o>>1^i,l=n&i>>1^o>>1^o;n=s,r=a,i=c,o=l,s=n&n>>2^r&r>>2,a=n&r>>2^r&(n^r)>>2,c^=n&i>>2^r&o>>2,l^=r&i>>2^(n^r)&o>>2,n=s,r=a,i=c,o=l,s=n&n>>4^r&r>>4,a=n&r>>4^r&(n^r)>>4,c^=n&i>>4^r&o>>4,l^=r&i>>4^(n^r)&o>>4,n=s,r=a,i=c,o=l,c^=n&i>>8^r&o>>8,l^=r&i>>8^(n^r)&o>>8,n=c^c>>1,r=l^l>>1;let u=e^t,d=r|65535^(u|n);return u=(u|u<<8)&16711935,u=(u|u<<4)&252645135,u=(u|u<<2)&858993459,u=(u|u<<1)&1431655765,d=(d|d<<8)&16711935,d=(d|d<<4)&252645135,d=(d|d<<2)&858993459,d=(d|d<<1)&1431655765,(d<<1|u)>>>0}const gg=e=>{const t=new Map;return e.forEach(n=>{t.set(n.axisId,n)}),t},Rc=e=>e.zoom,xg=X(dt,ht,(e,t)=>(e==null?void 0:e.some(n=>!!n.zoom))||(t==null?void 0:t.some(n=>!!n.zoom))||!1);X(Rc,e=>e==null?void 0:e.isInteracting);const Tt=be(Rc,function(t){return(t==null?void 0:t.zoomData)&&gg(t==null?void 0:t.zoomData)});X(Tt,(e,t)=>e==null?void 0:e.get(t));const ti=be(dt,ht,function(t,n){return z({},_a("x")(t),_a("y")(n))});X(ti,(e,t)=>e[t]);const yg=X(Ke,function(t){return gc(t.width)}),bg=X(Ke,function(t){return gc(t.height)}),Xo=be(dt,Be,Et,Vr,yg,function(t,n,r,i,o){const a={};return t==null||t.forEach((c,l)=>{var h,f;const u=c;if(mn(u)||gn(u)){a[u.id]={domain:u.data},u.ordinalTimeTicks!==void 0&&(a[u.id].tickNumber=Wo(u,[(h=u.data)==null?void 0:h.find(m=>m!==null),(f=u.data)==null?void 0:f.findLast(m=>m!==null)],o));return}const d=ei(u,"x",r,l,n);a[u.id]=Tc(u,"x",l,n,d,o,i)}),{axes:t,domains:a}}),Ko=be(ht,Be,Et,Vr,bg,function(t,n,r,i,o){const a={};return t==null||t.forEach((c,l)=>{var h,f;const u=c;if(mn(u)||gn(u)){a[u.id]={domain:u.data},u.ordinalTimeTicks!==void 0&&(a[u.id].tickNumber=Wo(u,[(h=u.data)==null?void 0:h.find(m=>m!==null),(f=u.data)==null?void 0:f.findLast(m=>m!==null)],o));return}const d=ei(u,"y",r,l,n);a[u.id]=Tc(u,"y",l,n,d,o,i)}),{axes:t,domains:a}}),jc=be(Tt,ti,Xo,Ko,function(t,n,{axes:r,domains:i},{axes:o,domains:s}){if(!t||!n)return;let a=!1;const c={},l=[...r??[],...o??[]];for(let u=0;u<l.length;u+=1){const d=l[u];if(!n[d.id]||n[d.id].filterMode!=="discard")continue;const h=t.get(d.id);if(h===void 0||h.start<=0&&h.end>=100)continue;const f=u<((r==null?void 0:r.length)??0)?"x":"y";if(d.scaleType==="band"||d.scaleType==="point")c[d.id]=sg(d.data,h.start,h.end,f);else{const{domain:m}=f==="x"?i[d.id]:s[d.id];c[d.id]=ag(m,h.start,h.end,f,d.data)}a=!0}if(a)return lg(c)}),vg=be(Be,Et,Tt,ti,jc,Vr,Xo,function(t,n,r,i,o,s,{axes:a,domains:c}){const l={};return a==null||a.forEach((u,d)=>{const h=c[u.id].domain;if(mn(u)||gn(u)){l[u.id]=h;return}const f=r==null?void 0:r.get(u.id),m=i==null?void 0:i[u.id],y=f===void 0&&!m?o:void 0;if(!y){l[u.id]=h;return}const x=c[u.id].tickNumber,b=ei(u,"x",n,d,t,y);l[u.id]=Cc(u,"x",d,t,b,x,s)}),l}),wg=be(Be,Et,Tt,ti,jc,Vr,Ko,function(t,n,r,i,o,s,{axes:a,domains:c}){const l={};return a==null||a.forEach((u,d)=>{const h=c[u.id].domain;if(mn(u)||gn(u)){l[u.id]=h;return}const f=r==null?void 0:r.get(u.id),m=i==null?void 0:i[u.id],y=f===void 0&&!m?o:void 0;if(!y){l[u.id]=h;return}const x=c[u.id].tickNumber,b=ei(u,"y",n,d,t,y);l[u.id]=Cc(u,"y",d,t,b,x,s)}),l}),Ic=be(dt,vg,function(t,n){const r={};return t==null||t.forEach(i=>{const o=i,s=n[o.id];r[o.id]=wc(o,s)}),r}),Ac=be(ht,wg,function(t,n){const r={};return t==null||t.forEach(i=>{const o=i,s=n[o.id];r[o.id]=wc(o,s)}),r}),Eg=be(dt,Ic,Ke,Tt,function(t,n,r,i){const o={};return t==null||t.forEach(s=>{const a=s,c=i==null?void 0:i.get(a.id),l=c?[c.start,c.end]:[0,100],u=vc(r,"x",a),d=n[a.id].copy(),h=Ec(u,l);d.range(h),o[a.id]=d}),o}),Sg=be(ht,Ac,Ke,Tt,function(t,n,r,i){const o={};return t==null||t.forEach(s=>{const a=s,c=i==null?void 0:i.get(a.id),l=c?[c.start,c.end]:[0,100],u=vc(r,"y",a),d=n[a.id].copy(),h=Un(d)?u.reverse():u,f=Ec(h,l);d.range(f),o[a.id]=d}),o}),Ct=be(Ke,Be,Et,Tt,Xo,Eg,function(t,n,r,i,{axes:o,domains:s},a){return bc({scales:a,drawingArea:t,formattedSeries:n,axis:o,seriesConfig:r,axisDirection:"x",zoomMap:i,domains:s})}),_t=be(Ke,Be,Et,Tt,Ko,Sg,function(t,n,r,i,{axes:o,domains:s},a){return bc({scales:a,drawingArea:t,formattedSeries:n,axis:o,seriesConfig:r,axisDirection:"y",zoomMap:i,domains:s})});X(Ct,_t,(e,t,n)=>(e==null?void 0:e.axis[n])??(t==null?void 0:t.axis[n]));X(dt,ht,(e,t,n)=>{const r=(e==null?void 0:e.find(i=>i.id===n))??(t==null?void 0:t.find(i=>i.id===n))??null;if(r)return r});const Tg=X(dt,e=>e[0].id),Cg=X(ht,e=>e[0].id);be(Be,Ic,Ac,Tg,Cg,function(t,n,r,i,o){const s=t.scatter,a=new Map;return s&&s.seriesOrder.forEach(c=>{const{data:l,xAxisId:u=i,yAxisId:d=o}=s.series[c],h=new Jo(l.length),f=n[u],m=r[d];for(const y of l)h.add(f(y.x),m(y.y));h.finish(),a.set(c,h)}),a});function Zt(e){return e instanceof Date?e.getTime():e}function dn(e,t){const{scale:n,data:r,reverse:i}=e;if(!Un(n)){const s=n.invert(t);if(r===void 0)return-1;const a=Zt(s);return r==null?void 0:r.findIndex((l,u)=>{const d=Zt(l);return d>a&&(u===0||Math.abs(a-d)<=Math.abs(a-Zt(r[u-1])))||d<=a&&(u===r.length-1||Math.abs(Zt(s)-d)<Math.abs(Zt(s)-Zt(r[u+1])))})}const o=n.bandwidth()===0?Math.floor((t-Math.min(...n.range())+n.step()/2)/n.step()):Math.floor((t-Math.min(...n.range()))/n.step());return o<0||o>=r.length?-1:i?r.length-1-o:o}function ja(e,t,n,r){if(!Un(e)){if(r===null){const i=e.invert(n);return Number.isNaN(i)?null:i}return t[r]}return r===null||r<0||r>=t.length?null:t[r]}function Ia(e,t){const n=e.createSVGPoint();return n.x=t.clientX,n.y=t.clientY,n.matrixTransform(e.getScreenCTM().inverse())}function Ye(e){const t=R.useRef(e);return p.useEnhancedEffect(()=>{t.current=e}),R.useRef((...n)=>(0,t.current)(...n)).current}const Zo=({store:e})=>{const t=Ye(function(){e.update({interaction:z({},e.state.interaction,{pointer:null})})}),n=Ye(function(o){e.state.interaction.lastUpdate!==o&&e.set("interaction",z({},e.state.interaction,{lastUpdate:o}))}),r=Ye(function(o){e.set("interaction",z({},e.state.interaction,{pointer:o,lastUpdate:o!==null?"pointer":e.state.interaction.lastUpdate}))});return{instance:{cleanInteraction:t,setLastUpdateSource:n,setPointerCoordinate:r}}};Zo.getInitialState=()=>({interaction:{item:null,pointer:null,lastUpdate:"pointer"}});Zo.params={};const Qo=e=>e.interaction,_g=X(Qo,e=>e!==void 0),kc=X(Qo,e=>(e==null?void 0:e.pointer)??null),ni=X(kc,e=>e&&e.x),ri=X(kc,e=>e&&e.y);X(Qo,e=>e==null?void 0:e.lastUpdate);function _n(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)){const i=e.length;if(i!==t.length)return!1;for(let o=0;o<i;o+=1)if(!_n(e[o],t[o]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;const i=Array.from(e.entries());for(let o=0;o<i.length;o+=1)if(!t.has(i[o][0]))return!1;for(let o=0;o<i.length;o+=1){const s=i[o];if(!_n(s[1],t.get(s[0])))return!1}return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;const i=Array.from(e.entries());for(let o=0;o<i.length;o+=1)if(!t.has(i[o][0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){const i=e.length;if(i!==t.length)return!1;for(let o=0;o<i;o+=1)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();const n=Object.keys(e),r=n.length;if(r!==Object.keys(t).length)return!1;for(let i=0;i<r;i+=1)if(!Object.prototype.hasOwnProperty.call(t,n[i]))return!1;for(let i=0;i<r;i+=1){const o=n[i];if(!_n(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function ro(e,t,n=t.axisIds[0]){return Array.isArray(n)?n.map(r=>dn(t.axis[r],e)):dn(t.axis[n],e)}const Oc=(e,t,n)=>{if(e===null)return null;const r=ro(e,t,n);return r===-1?null:r},Mg=X(ni,Ct,Oc),Rg=X(ri,_t,Oc),jg=X(ni,ri,Ct,_t,(e,t,n,r)=>[...e===null?[]:n.axisIds.map(i=>({axisId:i,dataIndex:ro(e,n,i)})),...t===null?[]:r.axisIds.map(i=>({axisId:i,dataIndex:ro(t,r,i)}))].filter(i=>i.dataIndex!==null&&i.dataIndex>=0));function Pc(e,t,n,r=t.axisIds[0]){return Array.isArray(r)?r.map((i,o)=>{const s=t.axis[i];return ja(s.scale,s.data,e,n[o])}):ja(t.axis[r].scale,t.axis[r].data,e,n)}X(ni,Ct,Mg,(e,t,n,r)=>e===null||t.axisIds.length===0?null:Pc(e,t,n,r));X(ri,_t,Rg,(e,t,n,r)=>e===null||t.axisIds.length===0?null:Pc(e,t,n,r));const Dc=[],Ig=xo({memoizeOptions:{resultEqualityCheck:_n}})(ni,Ct,(e,t)=>e===null?Dc:t.axisIds.filter(n=>t.axis[n].triggerTooltip).map(n=>({axisId:n,dataIndex:dn(t.axis[n],e)})).filter(({dataIndex:n})=>n>=0)),Ag=xo({memoizeOptions:{resultEqualityCheck:_n}})(ri,_t,(e,t)=>e===null?Dc:t.axisIds.filter(n=>t.axis[n].triggerTooltip).map(n=>({axisId:n,dataIndex:dn(t.axis[n],e)})).filter(({dataIndex:n})=>n>=0));X(Ig,Ag,(e,t)=>e.length>0||t.length>0);function kg(e){return e.setPointerCoordinate!==void 0}const ii=({params:e,store:t,seriesConfig:n,svgRef:r,instance:i})=>{const{xAxis:o,yAxis:s,dataset:a,onHighlightedAxisChange:c}=e;if(process.env.NODE_ENV!=="production"){const _=[...o??[],...s??[]].filter(w=>w.id).map(w=>w.id),C=new Set(_.filter((w,E)=>_.indexOf(w)!==E));C.size>0&&an([`MUI X Charts: The following axis ids are duplicated: ${Array.from(C).join(", ")}.`,"Please make sure that each axis has a unique id."].join(`
59
- `),"error")}const l=pe(t,Ke),u=pe(t,Be),d=pe(t,_g),{axis:h,axisIds:f}=pe(t,Ct),{axis:m,axisIds:y}=pe(t,_t);Ul({warningPrefix:"MUI X Charts",componentName:"Chart",propName:"highlightedAxis",controlled:e.highlightedAxis,defaultValue:void 0}),p.useEnhancedEffect(()=>{e.highlightedAxis!==void 0&&t.set("controlledCartesianAxisHighlight",e.highlightedAxis)},[t,e.highlightedAxis]);const x=R.useRef(!0);R.useEffect(()=>{if(x.current){x.current=!1;return}t.set("cartesianAxis",{x:Wl(o,a),y:ql(s,a)})},[n,l,o,s,a,t]);const b=f[0],S=y[0];vh(t,jg,(_,C)=>{if(c&&!Object.is(_,C)){if(_.length!==C.length){c(C);return}_!=null&&_.some(({axisId:w,dataIndex:E},M)=>C[M].axisId!==w||C[M].dataIndex!==E)&&c(C)}});const v=kg(i);return R.useEffect(()=>{const _=r.current;if(!d||!v||!_||e.disableAxisListener)return()=>{};const C=i.addInteractionListener("moveEnd",P=>{P.detail.activeGestures.pan||i.cleanInteraction()}),w=i.addInteractionListener("panEnd",P=>{P.detail.activeGestures.move||i.cleanInteraction()}),E=i.addInteractionListener("quickPressEnd",P=>{!P.detail.activeGestures.move&&!P.detail.activeGestures.pan&&i.cleanInteraction()}),M=P=>{var N;const I=P.detail.srcEvent,k=P.detail.target,U=Ia(_,I);if(P.detail.srcEvent.buttons>=1&&(k!=null&&k.hasPointerCapture(P.detail.srcEvent.pointerId))&&!(k!=null&&k.closest("[data-charts-zoom-slider]"))&&(k==null||k.releasePointerCapture(P.detail.srcEvent.pointerId)),!i.isPointInside(U.x,U.y,k)){(N=i.cleanInteraction)==null||N.call(i);return}i.setPointerCoordinate(U)},j=i.addInteractionListener("move",M),D=i.addInteractionListener("pan",M),A=i.addInteractionListener("quickPress",M);return()=>{j.cleanup(),C.cleanup(),D.cleanup(),w.cleanup(),A.cleanup(),E.cleanup()}},[r,t,h,b,m,S,i,e.disableAxisListener,d,v]),R.useEffect(()=>{const _=r.current,C=e.onAxisClick;if(_===null||!C)return()=>{};const w=i.addInteractionListener("tap",E=>{let M=null,j=!1;const D=Ia(_,E.detail.srcEvent),A=dn(h[b],D.x);j=A!==-1,M=j?A:dn(m[S],D.y);const P=j?f[0]:y[0];if(M==null||M===-1)return;const I=(j?h:m)[P].data[M],k={};Object.keys(u).filter(U=>["bar","line"].includes(U)).forEach(U=>{var N;(N=u[U])==null||N.seriesOrder.forEach(Y=>{const F=u[U].series[Y],J=F.xAxisId,ie=F.yAxisId,Z=j?J:ie;(Z===void 0||Z===P)&&(k[Y]=F.data[M])})}),C(E.detail.srcEvent,{dataIndex:M,axisValue:I,seriesValues:k})});return()=>{w.cleanup()}},[e.onAxisClick,u,r,h,f,m,y,b,S,i]),{}};ii.params={xAxis:!0,yAxis:!0,dataset:!0,onAxisClick:!0,disableAxisListener:!0,onHighlightedAxisChange:!0,highlightedAxis:!0};ii.getDefaultizedParams=({params:e})=>z({},e,{colors:e.colors??Fl,theme:e.theme??"light",defaultizedXAxis:Wl(e.xAxis,e.dataset),defaultizedYAxis:ql(e.yAxis,e.dataset)});ii.getInitialState=e=>z({cartesianAxis:{x:e.defaultizedXAxis,y:e.defaultizedYAxis}},e.highlightedAxis===void 0?{}:{controlledCartesianAxisHighlight:e.highlightedAxis});const Ut=e=>e.keyboardNavigation;X(Ut,(e,t)=>(e==null?void 0:e.item)!=null&&e.item.type===t.seriesType&&e.item.seriesId===t.seriesId&&e.item.dataIndex===t.dataIndex);const Og=X(Ut,e=>(e==null?void 0:e.item)!=null),es=X(Ut,e=>{var t;return(t=e==null?void 0:e.item)==null?void 0:t.type}),ts=X(Ut,e=>{var t;return(t=e==null?void 0:e.item)==null?void 0:t.seriesId}),ns=X(Ut,e=>{var t;return(t=e==null?void 0:e.item)==null?void 0:t.dataIndex}),Pg=X(Ut,e=>!!(e!=null&&e.enableKeyboardNavigation)),Lc=e=>(t,n,r,i,o)=>{var c;if(t===void 0||n===void 0||r===void 0)return;const s=(c=o[t])==null?void 0:c.series[n];if(!s)return;let a=e==="x"?"xAxisId"in s&&s.xAxisId:"yAxisId"in s&&s.yAxisId;return(a===void 0||a===!1)&&(a=i.axisIds[0]),{axisId:a,dataIndex:r}};X(es,ts,ns,Ct,Be,Lc("x"));X(es,ts,ns,_t,Be,Lc("y"));X(Ut,function(t){if((t==null?void 0:t.item)==null)return null;const{type:n,seriesId:r}=t.item;return n===void 0||r===void 0?null:t.item});X(es,ts,ns,function(t,n,r){return n!==void 0&&r!==void 0});const Dg=Object.is;function io(e,t){if(e===t)return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=0,r=0;for(const i in e)if(n+=1,!Dg(e[i],t[i])||!(i in t))return!1;for(const i in t)r+=1;return n===r}const rs=({store:e})=>{const t=Ye(function(i){const o=e.state.tooltip.item;if(!i){o!==null&&e.set("tooltip",{item:null});return}o===null||!io(o,i)||e.set("tooltip",{item:null})});return{instance:{setTooltipItem:Ye(function(i){io(e.state.tooltip.item,i)||e.set("tooltip",{item:i})}),removeTooltipItem:t}}};rs.getInitialState=()=>({tooltip:{item:null}});rs.params={};const rn=(e,t)=>e===void 0?t:Math.PI*e/180;function Aa(e,t){return e.id!==void 0?e:z({id:t},e)}function ka(e){return e.colorMap?z({},e,{colorScale:e.colorMap.type==="ordinal"&&e.data?Ir(z({values:e.data},e.colorMap)):to(e.colorMap.type==="continuous"?z({min:e.min,max:e.max},e.colorMap):e.colorMap)}):e}function $c(e,t){if(!e||e.length===0)return{axis:{},axisIds:[]};const n={},r=[];return e.forEach((i,o)=>{const s=i.dataKey,a=i.id??`defaultized-z-axis-${o}`;if(s===void 0||i.data!==void 0){n[a]=ka(Aa(i,a)),r.push(a);return}if(t===void 0)throw new Error("MUI X Charts: z-axis uses `dataKey` but no `dataset` is provided.");n[a]=ka(Aa(z({},i,{data:t.map(c=>c[s])}),a)),r.push(a)}),{axis:n,axisIds:r}}const is=({params:e,store:t})=>{const{zAxis:n,dataset:r}=e,i=R.useRef(!0);return R.useEffect(()=>{if(i.current){i.current=!1;return}t.set("zAxis",$c(n,r))},[n,r,t]),{}};is.params={zAxis:!0,dataset:!0};is.getInitialState=e=>({zAxis:$c(e.zAxis,e.dataset)});const Lg=e=>e,$g=X(Lg,e=>e.zAxis),os=({store:e,params:t})=>{Ul({warningPrefix:"MUI X Charts",componentName:"Chart",propName:"highlightedItem",controlled:t.highlightedItem,defaultValue:null}),p.useEnhancedEffect(()=>{e.state.highlight.item!==t.highlightedItem&&e.set("highlight",z({},e.state.highlight,{item:t.highlightedItem})),process.env.NODE_ENV!=="production"&&t.highlightedItem!==void 0&&!e.state.highlight.isControlled&&an(["MUI X Charts: The `highlightedItem` switched between controlled and uncontrolled state.","To remove the highlight when using controlled state, you must provide `null` to the `highlightedItem` prop instead of `undefined`."].join(`
60
- `))},[e,t.highlightedItem]);const n=Ye(()=>{var o;(o=t.onHighlightChange)==null||o.call(t,null);const i=e.state.highlight;i.item===null||i.isControlled||e.set("highlight",{item:null,lastUpdate:"pointer",isControlled:!1})}),r=Ye(i=>{var s;const o=e.state.highlight;o.isControlled||io(o.item,i)||((s=t.onHighlightChange)==null||s.call(t,i),e.set("highlight",{item:i,lastUpdate:"pointer",isControlled:!1}))});return{instance:{clearHighlight:n,setHighlight:r}}};os.getInitialState=e=>({highlight:{item:e.highlightedItem,lastUpdate:"pointer",isControlled:e.highlightedItem!==void 0}});os.params={highlightedItem:!0,onHighlightChange:!0};function Ar(e){let t=1/0,n=-1/0;for(const r of e??[])r<t&&(t=r),r>n&&(n=r);return[t,n]}const Oa=(e,t)=>t==="x"?{x:e,y:null}:{x:null,y:e},zc=e=>{var s;const{axis:t,getFilters:n,isDefaultAxis:r}=e,i=n==null?void 0:n({currentAxisId:t.id,isDefaultAxis:r}),o=i?(s=t.data)==null?void 0:s.filter((a,c)=>i({x:null,y:null},c)):t.data;return Ar(o??[])},Nc=e=>t=>{const{series:n,axis:r,getFilters:i,isDefaultAxis:o}=t;return Object.keys(n).filter(s=>{const a=e==="x"?n[s].xAxisId:n[s].yAxisId;return a===r.id||o&&a===void 0}).reduce((s,a)=>{const{stackedData:c}=n[a],l=i==null?void 0:i({currentAxisId:r.id,isDefaultAxis:o,seriesXAxisId:n[a].xAxisId,seriesYAxisId:n[a].yAxisId}),[u,d]=(c==null?void 0:c.reduce((h,f,m)=>l&&(!l(Oa(f[0],e),m)||!l(Oa(f[1],e),m))?h:[Math.min(...f,h[0]),Math.max(...f,h[1])],[1/0,-1/0]))??[1/0,-1/0];return[Math.min(u,s[0]),Math.max(d,s[1])]},[1/0,-1/0])},zg=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?Nc("x")(e):zc(e),Ng=e=>Object.keys(e.series).some(n=>e.series[n].layout==="horizontal")?zc(e):Nc("y")(e);function fe(e){return function(){return e}}const Pa=Math.abs,Te=Math.atan2,jt=Math.cos,Fg=Math.max,Di=Math.min,Ve=Math.sin,en=Math.sqrt,Re=1e-12,Pn=Math.PI,kr=Pn/2,xr=2*Pn;function Gg(e){return e>1?0:e<-1?Pn:Math.acos(e)}function Da(e){return e>=1?kr:e<=-1?-kr:Math.asin(e)}const oo=Math.PI,so=2*oo,It=1e-6,Bg=so-It;function Fc(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Ug(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return Fc;const n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class Vg{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?Fc:Ug(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,d=a-n,h=u*u+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>It)if(!(Math.abs(d*c-l*u)>It)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let f=r-s,m=i-a,y=c*c+l*l,x=f*f+m*m,b=Math.sqrt(y),S=Math.sqrt(h),v=o*Math.tan((oo-Math.acos((y+h-x)/(2*b*S)))/2),_=v/S,C=v/b;Math.abs(_-1)>It&&this._append`L${t+_*u},${n+_*d}`,this._append`A${o},${o},0,0,${+(d*f>u*m)},${this._x1=t+C*c},${this._y1=n+C*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,d=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>It||Math.abs(this._y1-u)>It)&&this._append`L${l},${u}`,r&&(h<0&&(h=h%so+so),h>Bg?this._append`A${r},${r},0,1,${d},${t-a},${n-c}A${r},${r},0,1,${d},${this._x1=l},${this._y1=u}`:h>It&&this._append`A${r},${r},0,${+(h>=oo)},${d},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function Hg(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Vg(t)}function Wg(e){return e.innerRadius}function qg(e){return e.outerRadius}function Yg(e){return e.startAngle}function Jg(e){return e.endAngle}function Xg(e){return e&&e.padAngle}function Kg(e,t,n,r,i,o,s,a){var c=n-e,l=r-t,u=s-i,d=a-o,h=d*c-u*l;if(!(h*h<Re))return h=(u*(t-o)-d*(e-i))/h,[e+h*c,t+h*l]}function sr(e,t,n,r,i,o,s){var a=e-n,c=t-r,l=(s?o:-o)/en(a*a+c*c),u=l*c,d=-l*a,h=e+u,f=t+d,m=n+u,y=r+d,x=(h+m)/2,b=(f+y)/2,S=m-h,v=y-f,_=S*S+v*v,C=i-o,w=h*y-m*f,E=(v<0?-1:1)*en(Fg(0,C*C*_-w*w)),M=(w*v-S*E)/_,j=(-w*S-v*E)/_,D=(w*v+S*E)/_,A=(-w*S+v*E)/_,P=M-x,I=j-b,k=D-x,U=A-b;return P*P+I*I>k*k+U*U&&(M=D,j=A),{cx:M,cy:j,x01:-u,y01:-d,x11:M*(i/C-1),y11:j*(i/C-1)}}function Gc(){var e=Wg,t=qg,n=fe(0),r=null,i=Yg,o=Jg,s=Xg,a=null,c=Hg(l);function l(){var u,d,h=+e.apply(this,arguments),f=+t.apply(this,arguments),m=i.apply(this,arguments)-kr,y=o.apply(this,arguments)-kr,x=Pa(y-m),b=y>m;if(a||(a=u=c()),f<h&&(d=f,f=h,h=d),!(f>Re))a.moveTo(0,0);else if(x>xr-Re)a.moveTo(f*jt(m),f*Ve(m)),a.arc(0,0,f,m,y,!b),h>Re&&(a.moveTo(h*jt(y),h*Ve(y)),a.arc(0,0,h,y,m,b));else{var S=m,v=y,_=m,C=y,w=x,E=x,M=s.apply(this,arguments)/2,j=M>Re&&(r?+r.apply(this,arguments):en(h*h+f*f)),D=Di(Pa(f-h)/2,+n.apply(this,arguments)),A=D,P=D,I,k;if(j>Re){var U=Da(j/h*Ve(M)),N=Da(j/f*Ve(M));(w-=U*2)>Re?(U*=b?1:-1,_+=U,C-=U):(w=0,_=C=(m+y)/2),(E-=N*2)>Re?(N*=b?1:-1,S+=N,v-=N):(E=0,S=v=(m+y)/2)}var Y=f*jt(S),F=f*Ve(S),J=h*jt(C),ie=h*Ve(C);if(D>Re){var Z=f*jt(v),_e=f*Ve(v),Qe=h*jt(_),et=h*Ve(_),Se;if(x<Pn)if(Se=Kg(Y,F,Qe,et,Z,_e,J,ie)){var tt=Y-Se[0],Ue=F-Se[1],Ie=Z-Se[0],G=_e-Se[1],W=1/Ve(Gg((tt*Ie+Ue*G)/(en(tt*tt+Ue*Ue)*en(Ie*Ie+G*G)))/2),K=en(Se[0]*Se[0]+Se[1]*Se[1]);A=Di(D,(h-K)/(W-1)),P=Di(D,(f-K)/(W+1))}else A=P=0}E>Re?P>Re?(I=sr(Qe,et,Y,F,f,P,b),k=sr(Z,_e,J,ie,f,P,b),a.moveTo(I.cx+I.x01,I.cy+I.y01),P<D?a.arc(I.cx,I.cy,P,Te(I.y01,I.x01),Te(k.y01,k.x01),!b):(a.arc(I.cx,I.cy,P,Te(I.y01,I.x01),Te(I.y11,I.x11),!b),a.arc(0,0,f,Te(I.cy+I.y11,I.cx+I.x11),Te(k.cy+k.y11,k.cx+k.x11),!b),a.arc(k.cx,k.cy,P,Te(k.y11,k.x11),Te(k.y01,k.x01),!b))):(a.moveTo(Y,F),a.arc(0,0,f,S,v,!b)):a.moveTo(Y,F),!(h>Re)||!(w>Re)?a.lineTo(J,ie):A>Re?(I=sr(J,ie,Z,_e,h,-A,b),k=sr(Y,F,Qe,et,h,-A,b),a.lineTo(I.cx+I.x01,I.cy+I.y01),A<D?a.arc(I.cx,I.cy,A,Te(I.y01,I.x01),Te(k.y01,k.x01),!b):(a.arc(I.cx,I.cy,A,Te(I.y01,I.x01),Te(I.y11,I.x11),!b),a.arc(0,0,h,Te(I.cy+I.y11,I.cx+I.x11),Te(k.cy+k.y11,k.cx+k.x11),b),a.arc(k.cx,k.cy,A,Te(k.y11,k.x11),Te(k.y01,k.x01),!b))):a.arc(0,0,h,C,_,b)}if(a.closePath(),u)return a=null,u+""||null}return l.centroid=function(){var u=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,d=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Pn/2;return[jt(d)*u,Ve(d)*u]},l.innerRadius=function(u){return arguments.length?(e=typeof u=="function"?u:fe(+u),l):e},l.outerRadius=function(u){return arguments.length?(t=typeof u=="function"?u:fe(+u),l):t},l.cornerRadius=function(u){return arguments.length?(n=typeof u=="function"?u:fe(+u),l):n},l.padRadius=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:fe(+u),l):r},l.startAngle=function(u){return arguments.length?(i=typeof u=="function"?u:fe(+u),l):i},l.endAngle=function(u){return arguments.length?(o=typeof u=="function"?u:fe(+u),l):o},l.padAngle=function(u){return arguments.length?(s=typeof u=="function"?u:fe(+u),l):s},l.context=function(u){return arguments.length?(a=u??null,l):a},l}function Bc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zg(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function Qg(e){return e}function e0(){var e=Qg,t=Zg,n=null,r=fe(0),i=fe(xr),o=fe(0);function s(a){var c,l=(a=Bc(a)).length,u,d,h=0,f=new Array(l),m=new Array(l),y=+r.apply(this,arguments),x=Math.min(xr,Math.max(-xr,i.apply(this,arguments)-y)),b,S=Math.min(Math.abs(x)/l,o.apply(this,arguments)),v=S*(x<0?-1:1),_;for(c=0;c<l;++c)(_=m[f[c]=c]=+e(a[c],c,a))>0&&(h+=_);for(t!=null?f.sort(function(C,w){return t(m[C],m[w])}):n!=null&&f.sort(function(C,w){return n(a[C],a[w])}),c=0,d=h?(x-l*v)/h:0;c<l;++c,y=b)u=f[c],_=m[u],b=y+(_>0?_*d:0)+v,m[u]={data:a[u],index:c,value:_,startAngle:y,endAngle:b,padAngle:S};return m}return s.value=function(a){return arguments.length?(e=typeof a=="function"?a:fe(+a),s):e},s.sortValues=function(a){return arguments.length?(t=a,n=null,s):t},s.sort=function(a){return arguments.length?(n=a,t=null,s):n},s.startAngle=function(a){return arguments.length?(r=typeof a=="function"?a:fe(+a),s):r},s.endAngle=function(a){return arguments.length?(i=typeof a=="function"?a:fe(+a),s):i},s.padAngle=function(a){return arguments.length?(o=typeof a=="function"?a:fe(+a),s):o},s}function hn(e,t){if((s=e.length)>1)for(var n=1,r,i,o=e[t[0]],s,a=o.length;n<s;++n)for(i=o,o=e[t[n]],r=0;r<a;++r)o[r][1]+=o[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function fn(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function t0(e,t){return e[t]}function n0(e){const t=[];return t.key=e,t}function Uc(){var e=fe([]),t=fn,n=hn,r=t0;function i(o){var s=Array.from(e.apply(this,arguments),n0),a,c=s.length,l=-1,u;for(const d of o)for(a=0,++l;a<c;++a)(s[a][l]=[0,+r(d,s[a].key,l,o)]).data=d;for(a=0,u=Bc(t(s));a<c;++a)s[u[a]].index=a;return n(s,u),s}return i.keys=function(o){return arguments.length?(e=typeof o=="function"?o:fe(Array.from(o)),i):e},i.value=function(o){return arguments.length?(r=typeof o=="function"?o:fe(+o),i):r},i.order=function(o){return arguments.length?(t=o==null?fn:typeof o=="function"?o:fe(Array.from(o)),i):t},i.offset=function(o){return arguments.length?(n=o??hn,i):n},i}function r0(e,t){if((r=e.length)>0){for(var n,r,i=0,o=e[0].length,s;i<o;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}hn(e,t)}}function i0(e,t){if((c=e.length)>0)for(var n,r=0,i,o,s,a,c,l=e[t[0]].length;r<l;++r)for(s=a=0,n=0;n<c;++n)(o=(i=e[t[n]][r])[1]-i[0])>0?(i[0]=s,i[1]=s+=o):o<0?(i[1]=a,i[0]=a+=o):(i[0]=0,i[1]=o)}function o0(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,o=r.length;n<o;++n){for(var s=0,a=0;s<i;++s)a+=e[s][n][1]||0;r[n][1]+=r[n][0]=-a/2}hn(e,t)}}function s0(e,t){if(!(!((s=e.length)>0)||!((o=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,o,s;r<o;++r){for(var a=0,c=0,l=0;a<s;++a){for(var u=e[t[a]],d=u[r][1]||0,h=u[r-1][1]||0,f=(d-h)/2,m=0;m<a;++m){var y=e[t[m]],x=y[r][1]||0,b=y[r-1][1]||0;f+=x-b}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,hn(e,t)}}function Vc(e){var t=e.map(a0);return fn(e).sort(function(n,r){return t[n]-t[r]})}function a0(e){for(var t=-1,n=0,r=e.length,i,o=-1/0;++t<r;)(i=+e[t][1])>o&&(o=i,n=t);return n}function Hc(e){var t=e.map(Wc);return fn(e).sort(function(n,r){return t[n]-t[r]})}function Wc(e){for(var t=0,n=-1,r=e.length,i;++n<r;)(i=+e[n][1])&&(t+=i);return t}function l0(e){return Hc(e).reverse()}function c0(e){var t=e.length,n,r,i=e.map(Wc),o=Vc(e),s=0,a=0,c=[],l=[];for(n=0;n<t;++n)r=o[n],s<a?(s+=i[r],c.push(r)):(a+=i[r],l.push(r));return l.reverse().concat(c)}function u0(e){return fn(e).reverse()}const Li={appearance:Vc,ascending:Hc,descending:l0,insideOut:c0,none:fn,reverse:u0},$i={expand:r0,diverging:i0,none:hn,silhouette:o0,wiggle:s0},qc=e=>{const{series:t,seriesOrder:n,defaultStrategy:r}=e,i=[],o={};return n.forEach(s=>{const{stack:a,stackOrder:c,stackOffset:l}=t[s];a===void 0?i.push({ids:[s],stackingOrder:Li.none,stackingOffset:$i.none}):o[a]===void 0?(o[a]=i.length,i.push({ids:[s],stackingOrder:Li[c??(r==null?void 0:r.stackOrder)??"none"],stackingOffset:$i[l??(r==null?void 0:r.stackOffset)??"diverging"]})):(i[o[a]].ids.push(s),c!==void 0&&(i[o[a]].stackingOrder=Li[c]),l!==void 0&&(i[o[a]].stackingOffset=$i[l]))}),i},d0=e=>e==null?"":e.toLocaleString(),h0=(e,t)=>{const{seriesOrder:n,series:r}=e,i=qc(e),o=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{o.length<=u?o.push({[a]:l}):o[u][a]=l});else if(t===void 0)throw new Error([`MUI X Charts: bar series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
61
- `));if(process.env.NODE_ENV!=="production"&&!c&&t){const l=r[a].dataKey;if(!l)throw new Error([`MUI X Charts: bar series with id='${a}' has no data and no dataKey.`,"You must provide a dataKey when using the dataset prop."].join(`
62
- `));t.forEach((u,d)=>{const h=u[l];h!=null&&typeof h!="number"&&an([`MUI X Charts: your dataset key "${l}" is used for plotting bars, but the dataset contains the non-null non-numerical element "${h}" at index ${d}.`,"Bar plots only support numeric and null values."].join(`
63
- `))})}});const s={};return i.forEach(a=>{const{ids:c,stackingOffset:l,stackingOrder:u}=a,d=Uc().keys(c.map(h=>{const f=r[h].dataKey;return r[h].data===void 0&&f!==void 0?f:h})).value((h,f)=>h[f]??0).order(u).offset(l)(o);c.forEach((h,f)=>{const m=r[h].dataKey;s[h]=z({layout:"vertical",labelMarkType:"square",minBarSize:0,valueFormatter:r[h].valueFormatter??d0},r[h],{data:m?t.map(y=>{const x=y[m];return typeof x=="number"?x:null}):r[h].data,stackedData:d[f].map(([y,x])=>[y,x])})})}),{seriesOrder:n,stackingGroups:i,series:s}};function ft(e,t){return typeof e=="function"?e(t):e}const f0=e=>{const{seriesOrder:t,series:n}=e;return t.reduce((r,i)=>{const o=ft(n[i].label,"legend");return o===void 0||r.push({markType:n[i].labelMarkType,id:i,seriesId:i,color:n[i].color,label:o}),r},[])};function ss(e){return e.colorGetter?e.colorGetter:()=>e.color}const p0=(e,t,n)=>{const r=e.layout==="vertical",i=r?t==null?void 0:t.colorScale:n==null?void 0:n.colorScale,o=r?n==null?void 0:n.colorScale:t==null?void 0:t.colorScale,s=r?t==null?void 0:t.data:n==null?void 0:n.data,a=ss(e);return o?c=>{if(c===void 0)return e.color;const l=e.data[c],u=l===null?a({value:l,dataIndex:c}):o(l);return u===null?a({value:l,dataIndex:c}):u}:i&&s?c=>{if(c===void 0)return e.color;const l=s[c],u=l===null?a({value:l,dataIndex:c}):i(l);return u===null?a({value:l,dataIndex:c}):u}:c=>{if(c===void 0)return e.color;const l=e.data[c];return a({value:l,dataIndex:c})}},m0=e=>{const{series:t,getColor:n,identifier:r}=e;if(!r||r.dataIndex===void 0)return null;const i=ft(t.label,"tooltip"),o=t.data[r.dataIndex];if(o==null)return null;const s=t.valueFormatter(o,{dataIndex:r.dataIndex});return{identifier:r,color:n(r.dataIndex),label:i,value:o,formattedValue:s,markType:t.labelMarkType}},g0=e=>Object.values(e).map(t=>t.layout==="horizontal"?{direction:"y",axisId:t.yAxisId}:{direction:"x",axisId:t.xAxisId});function x0(e,t,n){if(n===0)return{barWidth:e/t,offset:0};const r=e/(t+(t-1)*n),i=n*r;return{barWidth:r,offset:i}}function y0(e,t,n){const r=e&&t>0,i=!e&&t<0,o=r||i;return n?!o:o}function b0(e){const{verticalLayout:t,xAxisConfig:n,yAxisConfig:r,series:i,dataIndex:o,numberOfGroups:s,groupIndex:a}=e,c=t?n:r,l=(t?r.reverse:n.reverse)??!1,{barWidth:u,offset:d}=x0(c.scale.bandwidth(),s,c.barGapRatio),h=a*(u+d),f=n.scale,m=r.scale,y=c.data[o],x=i.data[o];if(x==null)return null;const S=i.stackedData[o].map(E=>t?m(E):f(E)),v=Math.round(Math.min(...S)),_=Math.round(Math.max(...S)),C=x===0?0:Math.max(i.minBarSize,_-v),w=y0(t,x,l)?_-C:v;return{x:t?f(y)+h:w,y:t?w:m(y)+h,height:t?C:u,width:t?u:C}}const v0=e=>{var d;const{series:t,identifier:n,axesConfig:r,placement:i}=e;if(!n||n.dataIndex===void 0)return null;const o=(d=t.bar)==null?void 0:d.series[n.seriesId];if(t.bar==null||o==null||r.x===void 0||r.y===void 0)return null;const s=b0({verticalLayout:o.layout==="vertical",xAxisConfig:r.x,yAxisConfig:r.y,series:o,dataIndex:n.dataIndex,numberOfGroups:t.bar.stackingGroups.length,groupIndex:t.bar.stackingGroups.findIndex(h=>h.ids.includes(o.id))});if(s==null)return null;const{x:a,y:c,width:l,height:u}=s;switch(i){case"right":return{x:a+l,y:c+u/2};case"bottom":return{x:a+l/2,y:c+u};case"left":return{x:a,y:c+u/2};case"top":default:return{x:a+l/2,y:c}}};function w0(e,t,n){return z({},e,{id:e.id??`auto-generated-id-${t}`,color:e.color??n[t%n.length]})}const E0={seriesProcessor:h0,colorProcessor:p0,legendGetter:f0,tooltipGetter:m0,tooltipItemPositionGetter:v0,axisTooltipGetter:g0,xExtremumGetter:zg,yExtremumGetter:Ng,getSeriesWithDefaultValues:w0},S0=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:i}=e;let o=1/0,s=-1/0;for(const a in t){if(!Object.hasOwn(t,a))continue;const c=t[a].xAxisId;if(!(c===n.id||c===void 0&&r))continue;const l=i==null?void 0:i({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[a].xAxisId,seriesYAxisId:t[a].yAxisId}),u=t[a].data??[];for(let d=0;d<u.length;d+=1){const h=u[d];l&&!l(h,d)||h.x!==null&&(h.x<o&&(o=h.x),h.x>s&&(s=h.x))}}return[o,s]},T0=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:i}=e;let o=1/0,s=-1/0;for(const a in t){if(!Object.hasOwn(t,a))continue;const c=t[a].yAxisId;if(!(c===n.id||c===void 0&&r))continue;const l=i==null?void 0:i({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[a].xAxisId,seriesYAxisId:t[a].yAxisId}),u=t[a].data??[];for(let d=0;d<u.length;d+=1){const h=u[d];l&&!l(h,d)||h.y!==null&&(h.y<o&&(o=h.y),h.y>s&&(s=h.y))}}return[o,s]},C0=({series:e,seriesOrder:t},n)=>({series:Object.fromEntries(Object.entries(e).map(([i,o])=>{const s=o==null?void 0:o.datasetKeys,a=["x","y"].filter(l=>typeof(s==null?void 0:s[l])!="string");if(o!=null&&o.datasetKeys&&a.length>0)throw new Error([`MUI X Charts: scatter series with id='${i}' has incomplete datasetKeys.`,`Properties ${a.map(l=>`"${l}"`).join(", ")} are missing.`].join(`
64
- `));const c=s?(n==null?void 0:n.map(l=>({x:l[s.x]??null,y:l[s.y]??null,z:s.z&&l[s.z],id:s.id&&l[s.id]})))??[]:o.data??[];return[i,z({labelMarkType:"circle",markerSize:4},o,{preview:z({markerSize:1},o==null?void 0:o.preview),data:c,valueFormatter:o.valueFormatter??(l=>l&&`(${l.x}, ${l.y})`)})]})),seriesOrder:t}),_0=(e,t,n,r)=>{const i=r==null?void 0:r.colorScale,o=n==null?void 0:n.colorScale,s=t==null?void 0:t.colorScale,a=ss(e);return i?c=>{var d,h;if(c===void 0)return e.color;if(((d=r==null?void 0:r.data)==null?void 0:d[c])!==void 0){const f=i((h=r==null?void 0:r.data)==null?void 0:h[c]);if(f!==null)return f}const l=e.data[c],u=l===null?a({value:l,dataIndex:c}):i(l.z);return u===null?a({value:l,dataIndex:c}):u}:o?c=>{if(c===void 0)return e.color;const l=e.data[c],u=l===null?a({value:l,dataIndex:c}):o(l.y);return u===null?a({value:l,dataIndex:c}):u}:s?c=>{if(c===void 0)return e.color;const l=e.data[c],u=l===null?a({value:l,dataIndex:c}):s(l.x);return u===null?a({value:l,dataIndex:c}):u}:c=>{if(c===void 0)return e.color;const l=e.data[c];return a({value:l,dataIndex:c})}},M0=e=>{const{seriesOrder:t,series:n}=e;return t.reduce((r,i)=>{const o=ft(n[i].label,"legend");return o===void 0||r.push({markType:n[i].labelMarkType,id:i,seriesId:i,color:n[i].color,label:o}),r},[])},R0=e=>{const{series:t,getColor:n,identifier:r}=e;if(!r||r.dataIndex===void 0)return null;const i=ft(t.label,"tooltip"),o=t.data[r.dataIndex],s=t.valueFormatter(o,{dataIndex:r.dataIndex});return{identifier:r,color:n(r.dataIndex),label:i,value:o,formattedValue:s,markType:t.labelMarkType}},j0=(e,t,n)=>z({},e,{id:e.id??`auto-generated-id-${t}`,color:e.color??n[t%n.length]}),I0=e=>{var a,c,l;const{series:t,identifier:n,axesConfig:r}=e;if(!n||n.dataIndex===void 0)return null;const i=(a=t.scatter)==null?void 0:a.series[n.seriesId];if(i==null||r.x===void 0||r.y===void 0)return null;const o=(c=i.data)==null?void 0:c[n.dataIndex].x,s=(l=i.data)==null?void 0:l[n.dataIndex].y;return o==null||s==null?null:{x:r.x.scale(o),y:r.y.scale(s)}},A0={seriesProcessor:C0,colorProcessor:_0,legendGetter:M0,tooltipGetter:R0,tooltipItemPositionGetter:I0,xExtremumGetter:S0,yExtremumGetter:T0,getSeriesWithDefaultValues:j0},k0=e=>{const{axis:t}=e;return Ar(t.data??[])};function O0(e,t,n,r){return n.reduce((i,o,s)=>{if(t[s]===null)return i;const[a,c]=e(o);return r&&(!r({y:a,x:null},s)||!r({y:c,x:null},s))?i:[Math.min(a,c,i[0]),Math.max(a,c,i[1])]},[1/0,-1/0])}const P0=e=>{const{series:t,axis:n,isDefaultAxis:r,getFilters:i}=e;return Object.keys(t).filter(o=>{const s=t[o].yAxisId;return s===n.id||r&&s===void 0}).reduce((o,s)=>{const{area:a,stackedData:c,data:l}=t[s],u=a!==void 0,d=i==null?void 0:i({currentAxisId:n.id,isDefaultAxis:r,seriesXAxisId:t[s].xAxisId,seriesYAxisId:t[s].yAxisId}),h=u&&n.scaleType!=="log"&&typeof t[s].baseline!="string"?x=>x:x=>[x[1],x[1]],f=O0(h,l,c,d),[m,y]=f;return[Math.min(m,o[0]),Math.max(y,o[1])]},[1/0,-1/0])},D0=(e,t)=>{const{seriesOrder:n,series:r}=e,i=qc(z({},e,{defaultStrategy:{stackOffset:"none"}})),o=t??[];n.forEach(a=>{const c=r[a].data;if(c!==void 0)c.forEach((l,u)=>{o.length<=u?o.push({[a]:l}):o[u][a]=l});else if(t===void 0&&process.env.NODE_ENV!=="production")throw new Error([`MUI X Charts: line series with id='${a}' has no data.`,"Either provide a data property to the series or use the dataset prop."].join(`
65
- `));if(process.env.NODE_ENV!=="production"&&!c&&t){const l=r[a].dataKey;if(!l)throw new Error([`MUI X Charts: line series with id='${a}' has no data and no dataKey.`,"You must provide a dataKey when using the dataset prop."].join(`
66
- `));t.forEach((u,d)=>{const h=u[l];h!=null&&typeof h!="number"&&an([`MUI X Charts: your dataset key "${l}" is used for plotting lines, but the dataset contains the non-null non-numerical element "${h}" at index ${d}.`,"Line plots only support numeric and null values."].join(`
67
- `))})}});const s={};return i.forEach(a=>{const{ids:c,stackingOrder:l,stackingOffset:u}=a,d=Uc().keys(c.map(h=>{const f=r[h].dataKey;return r[h].data===void 0&&f!==void 0?f:h})).value((h,f)=>h[f]??0).order(l).offset(u)(o);c.forEach((h,f)=>{var y;const m=r[h].dataKey;s[h]=z({labelMarkType:"line"},r[h],{data:m?t.map(x=>{const b=x[m];return typeof b=="number"?b:null}):r[h].data,stackedData:d[f].map(([x,b])=>[x,b]),valueFormatter:((y=r[h])==null?void 0:y.valueFormatter)??(x=>x==null?"":x.toLocaleString())})})}),{seriesOrder:n,stackingGroups:i,series:s}},L0=(e,t,n)=>{const r=n==null?void 0:n.colorScale,i=t==null?void 0:t.colorScale,o=ss(e);return r?s=>{if(s===void 0)return e.color;const a=e.data[s],c=a===null?o({value:a,dataIndex:s}):r(a);return c===null?o({value:a,dataIndex:s}):c}:i?s=>{var l;if(s===void 0)return e.color;const a=(l=t.data)==null?void 0:l[s],c=a===null?o({value:a,dataIndex:s}):i(a);return c===null?o({value:a,dataIndex:s}):c}:s=>{if(s===void 0)return e.color;const a=e.data[s];return o({value:a,dataIndex:s})}},$0=e=>{const{seriesOrder:t,series:n}=e;return t.reduce((r,i)=>{const o=ft(n[i].label,"legend");return o===void 0||r.push({markType:n[i].labelMarkType,id:i,seriesId:i,color:n[i].color,label:o}),r},[])},z0=e=>{const{series:t,getColor:n,identifier:r}=e;if(!r||r.dataIndex===void 0)return null;const i=ft(t.label,"tooltip"),o=t.data[r.dataIndex],s=t.valueFormatter(o,{dataIndex:r.dataIndex});return{identifier:r,color:n(r.dataIndex),label:i,value:o,formattedValue:s,markType:t.labelMarkType}},N0=e=>Object.values(e).map(t=>({direction:"x",axisId:t.xAxisId})),F0=(e,t,n)=>z({},e,{id:e.id??`auto-generated-id-${t}`,color:e.color??n[t%n.length]}),G0=e=>{var a,c;const{series:t,identifier:n,axesConfig:r}=e;if(!n||n.dataIndex===void 0)return null;const i=(a=t.line)==null?void 0:a.series[n.seriesId];if(i==null||r.x===void 0||r.y===void 0)return null;const o=(c=r.x.data)==null?void 0:c[n.dataIndex],s=i.data[n.dataIndex];return o==null||s==null?null:{x:r.x.scale(o),y:r.y.scale(s)}},B0={colorProcessor:L0,seriesProcessor:D0,legendGetter:$0,tooltipGetter:z0,tooltipItemPositionGetter:G0,axisTooltipGetter:N0,xExtremumGetter:k0,yExtremumGetter:P0,getSeriesWithDefaultValues:F0},U0=(e="none")=>{if(typeof e=="function")return e;switch(e){case"none":return null;case"desc":return(t,n)=>n-t;case"asc":return(t,n)=>t-n;default:return null}},V0=e=>{const{seriesOrder:t,series:n}=e,r={};return t.forEach(i=>{const o=e0().startAngle(rn(n[i].startAngle??0)).endAngle(rn(n[i].endAngle??360)).padAngle(rn(n[i].paddingAngle??0)).sortValues(U0(n[i].sortingValues??"none"))(n[i].data.map(s=>s.value));r[i]=z({labelMarkType:"circle",valueFormatter:s=>s.value.toLocaleString()},n[i],{data:n[i].data.map((s,a)=>z({},s,{id:s.id??`auto-generated-pie-id-${i}-${a}`},o[a])).map((s,a)=>{var c,l;return z({labelMarkType:"circle"},s,{formattedValue:((l=(c=n[i]).valueFormatter)==null?void 0:l.call(c,z({},s,{label:ft(s.label,"arc")}),{dataIndex:a}))??s.value.toLocaleString()})})})}),{seriesOrder:t,series:r}},H0=e=>t=>e.data[t].color,W0=e=>{const{seriesOrder:t,series:n}=e;return t.reduce((r,i)=>(n[i].data.forEach((o,s)=>{const a=ft(o.label,"legend");a!==void 0&&r.push({markType:o.labelMarkType??n[i].labelMarkType,id:o.id??s,seriesId:i,color:o.color,label:a,itemId:o.id??s})}),r),[])},q0=e=>{const{series:t,getColor:n,identifier:r}=e;if(!r||r.dataIndex===void 0)return null;const i=t.data[r.dataIndex];if(i==null)return null;const o=ft(i.label,"tooltip"),s=z({},i,{label:o}),a=t.valueFormatter(s,{dataIndex:r.dataIndex});return{identifier:r,color:n(r.dataIndex),label:o,value:s,formattedValue:a,markType:i.labelMarkType??t.labelMarkType}};function Pe(e,t){if(typeof e=="number")return e;if(e==="100%")return t;if(e.endsWith("%")){const n=Number.parseFloat(e.slice(0,e.length-1));if(!Number.isNaN(n))return n*t/100}if(e.endsWith("px")){const n=Number.parseFloat(e.slice(0,e.length-2));if(!Number.isNaN(n))return n}throw new Error(`MUI X Charts: Received an unknown value "${e}". It should be a number, or a string with a percentage value.`)}function Yc(e,t){const{height:n,width:r}=t,{cx:i,cy:o}=e,s=Math.min(r,n)/2,a=Pe(i??"50%",r),c=Pe(o??"50%",n);return{cx:a,cy:c,availableRadius:s}}const Y0=(e,t)=>{const n={};for(const r of e.seriesOrder){const{innerRadius:i,outerRadius:o,arcLabelRadius:s,cx:a,cy:c}=e.series[r],{cx:l,cy:u,availableRadius:d}=Yc({cx:a,cy:c},{width:t.width,height:t.height}),h=Pe(o??d,d),f=Pe(i??0,d),m=s===void 0?(f+h)/2:Pe(s,d);n[r]={radius:{available:d,inner:f,outer:h,label:m},center:{x:t.left+l,y:t.top+u}}}return n},J0=(e,t,n)=>z({},e,{id:e.id??`auto-generated-id-${t}`,data:e.data.map((r,i)=>z({},r,{color:r.color??n[i%n.length]}))}),X0=e=>{var _;const{series:t,drawingArea:n,identifier:r,placement:i}=e;if(!r||r.dataIndex===void 0)return null;const o=(_=t.pie)==null?void 0:_.series[r.seriesId];if(o==null)return null;const{cx:s,cy:a,availableRadius:c}=Yc({cx:o.cx,cy:o.cy},n),{data:l,innerRadius:u=0,outerRadius:d}=o,h=Math.max(0,Pe(u??0,c)),f=Math.max(0,Pe(d??c,c)),m=l[r.dataIndex];if(!m)return null;const y=[[h,m.startAngle],[h,m.endAngle],[f,m.startAngle],[f,m.endAngle]].map(([C,w])=>({x:s+C*Math.sin(w),y:a-C*Math.cos(w)})),[x,b]=Ar(y.map(C=>C.x)),[S,v]=Ar(y.map(C=>C.y));switch(i){case"bottom":return{x:(b+x)/2,y:v};case"left":return{x,y:(v+S)/2};case"right":return{x:b,y:(v+S)/2};case"top":default:return{x:(b+x)/2,y:S}}},K0={colorProcessor:H0,seriesProcessor:V0,seriesLayout:Y0,legendGetter:W0,tooltipGetter:q0,tooltipItemPositionGetter:X0,getSeriesWithDefaultValues:J0},Z0={bar:E0,scatter:A0,line:B0,pie:K0},Q0=[is,rs,Zo,ii,os];function ex(e){const{children:t,plugins:n=Q0,pluginParams:r={},seriesConfig:i=Z0}=e,{contextValue:o}=hf(n,r,i);return p.jsxRuntimeExports.jsx(Ro.Provider,{value:o,children:t})}const Jc=()=>{const e=R.useContext(Ro);if(e==null)throw new Error(["MUI X Charts: Could not find the Chart context.","It looks like you rendered your component outside of a ChartDataProvider.","This can also happen if you are bundling multiple versions of the library."].join(`
68
- `));return e};function Vt(){const e=Jc();if(!e)throw new Error(["MUI X Charts: Could not find the charts context.","It looks like you rendered your component outside of a ChartContainer parent component."].join(`
69
- `));return e.store}function Xc(){const e=Vt();return pe(e,Ke)}function Kc(){const e=Vt();return pe(e,Vh)}function tx(){const e=Vt(),{axis:t,axisIds:n}=pe(e,Ct);return{xAxis:t,xAxisIds:n}}function nx(){const e=Vt(),{axis:t,axisIds:n}=pe(e,_t);return{yAxis:t,yAxisIds:n}}function rx(){const e=Vt(),{axis:t,axisIds:n}=pe(e,$g)??{axis:{},axisIds:[]};return{zAxis:t,zAxisIds:n}}function ix(){const e=Jc();if(!e)throw new Error(["MUI X Charts: Could not find the svg ref context.","It looks like you rendered your component outside of a ChartContainer parent component."].join(`
70
- `));return e.svgRef}function ox(){const e=Kc();return R.useCallback(t=>`${e}-gradient-${t}`,[e])}function sx(){const e=Kc();return R.useCallback(t=>`${e}-gradient-${t}-object-bound`,[e])}var zi,La;function ax(){if(La)return zi;La=1;var e=4,t=.001,n=1e-7,r=10,i=11,o=1/(i-1),s=typeof Float32Array=="function";function a(y,x){return 1-3*x+3*y}function c(y,x){return 3*x-6*y}function l(y){return 3*y}function u(y,x,b){return((a(x,b)*y+c(x,b))*y+l(x))*y}function d(y,x,b){return 3*a(x,b)*y*y+2*c(x,b)*y+l(x)}function h(y,x,b,S,v){var _,C,w=0;do C=x+(b-x)/2,_=u(C,S,v)-y,_>0?b=C:x=C;while(Math.abs(_)>n&&++w<r);return C}function f(y,x,b,S){for(var v=0;v<e;++v){var _=d(x,b,S);if(_===0)return x;var C=u(x,b,S)-y;x-=C/_}return x}function m(y){return y}return zi=function(x,b,S,v){if(!(0<=x&&x<=1&&0<=S&&S<=1))throw new Error("bezier x values must be in [0, 1] range");if(x===b&&S===v)return m;for(var _=s?new Float32Array(i):new Array(i),C=0;C<i;++C)_[C]=u(C*o,x,S);function w(E){for(var M=0,j=1,D=i-1;j!==D&&_[j]<=E;++j)M+=o;--j;var A=(E-_[j])/(_[j+1]-_[j]),P=M+A*o,I=d(P,x,S);return I>=t?f(E,P,x,S):I===0?P:h(E,M,M+o,x,S)}return function(M){return M===0?0:M===1?1:u(w(M),b,v)}},zi}var lx=ax();const cx=qu(lx),ux=300,dx=cx(.66,0,.34,1);var pn=0,Sn=0,wn=0,Zc=1e3,Or,Tn,Pr=0,Lt=0,oi=0,Dn=typeof performance=="object"&&performance.now?performance:Date,Qc=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function as(){return Lt||(Qc(hx),Lt=Dn.now()+oi)}function hx(){Lt=0}function Dr(){this._call=this._time=this._next=null}Dr.prototype=eu.prototype={constructor:Dr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?as():+n)+(t==null?0:+t),!this._next&&Tn!==this&&(Tn?Tn._next=this:Or=this,Tn=this),this._call=e,this._time=n,ao()},stop:function(){this._call&&(this._call=null,this._time=1/0,ao())}};function eu(e,t,n){var r=new Dr;return r.restart(e,t,n),r}function fx(){as(),++pn;for(var e=Or,t;e;)(t=Lt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pn}function $a(){Lt=(Pr=Dn.now())+oi,pn=Sn=0;try{fx()}finally{pn=0,mx(),Lt=0}}function px(){var e=Dn.now(),t=e-Pr;t>Zc&&(oi-=t,Pr=e)}function mx(){for(var e,t=Or,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Or=n);Tn=e,ao(r)}function ao(e){if(!pn){Sn&&(Sn=clearTimeout(Sn));var t=e-Lt;t>24?(e<1/0&&(Sn=setTimeout($a,e-Dn.now()-oi)),wn&&(wn=clearInterval(wn))):(wn||(Pr=Dn.now(),wn=setInterval(px,Zc)),pn=1,Qc($a))}}function gx(e,t,n){var r=new Dr;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}class xx{constructor(t,n,r){V(this,"elapsed",0);V(this,"timer",null);this.duration=t,this.easingFn=n,this.onTickCallback=r,this.resume()}get running(){return this.timer!==null}timerCallback(t){this.elapsed=Math.min(t,this.duration);const n=this.duration===0?1:this.elapsed/this.duration,r=this.easingFn(n);this.onTickCallback(r),this.elapsed>=this.duration&&this.stop()}resume(){if(this.running||this.elapsed>=this.duration)return this;const t=as()-this.elapsed;return this.timer=eu(n=>this.timerCallback(n),0,t),this}stop(){return this.running?(this.timer&&(this.timer.stop(),this.timer=null),this):this}finish(){return this.stop(),gx(()=>this.timerCallback(this.duration)),this}}function yx(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){const o=n[i];if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1}return!0}function bx(e,{createInterpolator:t,applyProps:n,skip:r,initialProps:i=e}){const o=R.useRef(i),s=R.useRef(null),a=R.useRef(null),c=R.useRef(e);p.useEnhancedEffect(()=>{c.current=e},[e]),p.useEnhancedEffect(()=>{var d;r&&((d=s.current)==null||d.finish(),s.current=null,a.current=null,o.current=e)},[e,r]);const l=R.useCallback(d=>{const h=o.current,f=t(h,e);s.current=new xx(ux,dx,m=>{const y=f(m);o.current=y,n(d,y)})},[n,t,e]);return[R.useCallback(d=>{var f,m,y,x;if(d===null){(f=s.current)==null||f.stop();return}const h=a.current;if(h===d){if(yx(c.current,e)){(m=s.current)==null||m.resume();return}(y=s.current)==null||y.stop()}h&&((x=s.current)==null||x.stop()),a.current=d,(s.current||!r)&&l(d)},[l,e,r]),o.current]}function vx(e,{createInterpolator:t,transformProps:n,applyProps:r,skip:i,initialProps:o=e,ref:s}){const a=n??(d=>d),[c,l]=bx(e,{initialProps:o,createInterpolator:t,applyProps:(d,h)=>r(d,a(h)),skip:i}),u=n(i?e:l);return z({},u,{ref:Gr(c,s)})}function za(e){const{isReversed:t,gradientId:n,size:r,direction:i,scale:o,colorMap:s}=e;return r<=0?null:p.jsxRuntimeExports.jsx("linearGradient",{id:n,x1:"0",x2:"0",y1:"0",y2:"0",[`${i}${t?1:2}`]:`${r}px`,gradientUnits:"userSpaceOnUse",children:s.thresholds.map((a,c)=>{const l=o(a);if(l===void 0)return null;const u=t?1-l/r:l/r;return Number.isNaN(u)?null:p.jsxRuntimeExports.jsxs(R.Fragment,{children:[p.jsxRuntimeExports.jsx("stop",{offset:u,stopColor:s.colors[c],stopOpacity:1}),p.jsxRuntimeExports.jsx("stop",{offset:u,stopColor:s.colors[c+1],stopOpacity:1})]},a.toString()+c)})})}const wx=10;function Na(e){const{gradientUnits:t,isReversed:n,gradientId:r,size:i,direction:o,scale:s,colorScale:a,colorMap:c}=e,l=[c.min??0,c.max??100],u=l.map(s).filter(m=>m!==void 0);if(u.length!==2)return null;const d=typeof l[0]=="number"?Ge(l[0],l[1]):Oo(l[0],l[1]),h=Math.round((Math.max(...u)-Math.min(...u))/wx),f=`${l[0]}-${l[1]}-`;return p.jsxRuntimeExports.jsx("linearGradient",{id:r,x1:"0",x2:"0",y1:"0",y2:"0",[`${o}${n?1:2}`]:t==="objectBoundingBox"?1:`${i}px`,gradientUnits:t??"userSpaceOnUse",children:Array.from({length:h+1},(m,y)=>{const x=d(y/h);if(x===void 0)return null;const b=s(x);if(b===void 0)return null;const S=n?1-b/i:b/i,v=a(x);return v===null?null:p.jsxRuntimeExports.jsx("stop",{offset:S,stopColor:v,stopOpacity:1},f+y)})})}const Ex=10,Sx=e=>e?{x1:"1",x2:"0",y1:"0",y2:"0"}:{x1:"0",x2:"1",y1:"0",y2:"0"};function Ni(e){const{isReversed:t,gradientId:n,colorScale:r,colorMap:i}=e,o=[i.min??0,i.max??100],s=typeof o[0]=="number"?Ge(o[0],o[1]):Oo(o[0],o[1]),a=Ex,c=`${o[0]}-${o[1]}-`;return p.jsxRuntimeExports.jsx("linearGradient",z({id:n},Sx(t),{gradientUnits:"objectBoundingBox",children:Array.from({length:a+1},(l,u)=>{const d=u/a,h=s(d);if(h===void 0)return null;const f=r(h);return f===null?null:p.jsxRuntimeExports.jsx("stop",{offset:d,stopColor:f,stopOpacity:1},c+u)})}))}function Tx(){const{top:e,height:t,bottom:n,left:r,width:i,right:o}=Xc(),s=e+t+n,a=r+i+o,c=ox(),l=sx(),{xAxis:u,xAxisIds:d}=tx(),{yAxis:h,yAxisIds:f}=nx(),{zAxis:m,zAxisIds:y}=rx(),x=f.filter(v=>h[v].colorMap!==void 0),b=d.filter(v=>u[v].colorMap!==void 0),S=y.filter(v=>m[v].colorMap!==void 0);return x.length===0&&b.length===0&&S.length===0?null:p.jsxRuntimeExports.jsxs("defs",{children:[x.map(v=>{const _=c(v),C=l(v),{colorMap:w,scale:E,colorScale:M,reverse:j}=h[v];return(w==null?void 0:w.type)==="piecewise"?p.jsxRuntimeExports.jsx(za,{isReversed:!j,scale:E,colorMap:w,size:s,gradientId:_,direction:"y"},_):(w==null?void 0:w.type)==="continuous"?p.jsxRuntimeExports.jsxs(R.Fragment,{children:[p.jsxRuntimeExports.jsx(Na,{isReversed:!j,scale:E,colorScale:M,colorMap:w,size:s,gradientId:_,direction:"y"}),p.jsxRuntimeExports.jsx(Ni,{isReversed:j,colorScale:M,colorMap:w,gradientId:C})]},_):null}),b.map(v=>{const _=c(v),C=l(v),{colorMap:w,scale:E,reverse:M,colorScale:j}=u[v];return(w==null?void 0:w.type)==="piecewise"?p.jsxRuntimeExports.jsx(za,{isReversed:M,scale:E,colorMap:w,size:a,gradientId:_,direction:"x"},_):(w==null?void 0:w.type)==="continuous"?p.jsxRuntimeExports.jsxs(R.Fragment,{children:[p.jsxRuntimeExports.jsx(Na,{isReversed:M,scale:E,colorScale:j,colorMap:w,size:a,gradientId:_,direction:"x"}),p.jsxRuntimeExports.jsx(Ni,{isReversed:M,colorScale:j,colorMap:w,gradientId:C})]},_):null}),S.map(v=>{const _=l(v),{colorMap:C,colorScale:w}=m[v];return(C==null?void 0:C.type)==="continuous"?p.jsxRuntimeExports.jsx(Ni,{colorScale:w,colorMap:C,gradientId:_},_):null})]})}function Cx(e){return p.generateUtilityClass("MuiChartsSurface",e)}const _x=()=>zn({root:["root"]},Cx);Fr("MuiChartsSurface",["root"]);const Mx=["children","className","title","desc"],Rx=Ae("svg",{name:"MuiChartsSurface",slot:"Root"})(({ownerState:e})=>({width:e.width??"100%",height:e.height??"100%",display:"flex",position:"relative",flexDirection:"column",alignItems:"center",justifyContent:"center",overflow:"hidden",touchAction:e.hasZoom?"pan-y":void 0,userSelect:"none",gridArea:"chart","&:focus":{outline:"none"}})),ls=R.forwardRef(function(t,n){const r=Vt(),i=pe(r,Lh),o=pe(r,$h),s=pe(r,zh),a=pe(r,Nh),c=pe(r,Pg),l=pe(r,Og),u=pe(r,xg),d=ix(),h=Gr(d,n),f=pd({props:t,name:"MuiChartsSurface"}),{children:m,className:y,title:x,desc:b}=f,S=Je(f,Mx),v=_x(),_=o>0&&i>0;return p.jsxRuntimeExports.jsxs(Rx,z({ownerState:{width:s,height:a,hasZoom:u},viewBox:`0 0 ${i} ${o}`,className:p.clsx(v.root,y),tabIndex:c?0:void 0,"data-has-focused-item":l||void 0},S,{ref:h,children:[x&&p.jsxRuntimeExports.jsx("title",{children:x}),b&&p.jsxRuntimeExports.jsx("desc",{children:b}),p.jsxRuntimeExports.jsx(Tx,{}),_&&m]}))});process.env.NODE_ENV!=="production"&&(ls.displayName="ChartsSurface");process.env.NODE_ENV!=="production"&&(ls.propTypes={children:g.node,className:g.string,desc:g.string,sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),title:g.string});function Fi(e){const t=rn(e);return[Math.sin(t),-Math.cos(t)]}function jx(e,t){const n=[[0,0],Fi(e),Fi(t)],r=Math.min(e,t),i=Math.max(e,t),o=Math.floor(r/90)*90;for(let u=1;u<=4;u+=1){const d=o+u*90;d<i&&n.push(Fi(d))}const s=Math.min(...n.map(([u])=>u)),a=Math.max(...n.map(([u])=>u)),c=Math.min(...n.map(([,u])=>u)),l=Math.max(...n.map(([,u])=>u));return{cx:-s/(a-s),cy:-c/(l-c),minX:s,maxX:a,minY:c,maxY:l}}function Ix(e,t,n,r,{minX:i,maxX:o,minY:s,maxY:a}){return Math.min(...[{ratio:Math.abs(i),space:e},{ratio:Math.abs(o),space:n-e},{ratio:Math.abs(s),space:t},{ratio:Math.abs(a),space:r-t}].map(({ratio:c,space:l})=>c<1e-5?1/0:l/c))}const cs=R.createContext({value:null,valueMin:0,valueMax:0,startAngle:0,endAngle:0,innerRadius:0,outerRadius:0,cornerRadius:0,cx:0,cy:0,maxRadius:0,valueAngle:null});process.env.NODE_ENV!=="production"&&(cs.displayName="GaugeContext");function Ax(e){const{value:t=null,valueMin:n=0,valueMax:r=100,startAngle:i=0,endAngle:o=360,outerRadius:s,innerRadius:a,cornerRadius:c,cx:l,cy:u,children:d}=e,{left:h,top:f,width:m,height:y}=Xc(),x=jx(i,o),b=l?Pe(l,m):x.cx*m,S=u?Pe(u,y):x.cy*y;let v=h+b,_=f+S;const C=Ix(b,S,m,y,x);if(l===void 0){const D=C*(x.maxX-x.minX);v=h+(m-D)/2+x.cx*D}if(u===void 0){const D=C*(x.maxY-x.minY);_=f+(y-D)/2+x.cy*D}const w=Pe(s??C,C),E=Pe(a??"80%",C),M=Pe(c??0,w-E),j=R.useMemo(()=>{const D=rn(i),A=rn(o);return{value:t,valueMin:n,valueMax:r,startAngle:D,endAngle:A,outerRadius:w,innerRadius:E,cornerRadius:M,cx:v,cy:_,maxRadius:C,valueAngle:t===null?null:D+(A-D)*(t-n)/(r-n)}},[t,n,r,i,o,w,E,M,v,_,C]);return p.jsxRuntimeExports.jsx(cs.Provider,{value:j,children:d})}function us(){return R.useContext(cs)}const kx=["width","height","margin","title","desc","value","valueMin","valueMax","startAngle","endAngle","outerRadius","innerRadius","cornerRadius","cx","cy","children"],Ox=Ae("g")(({theme:e})=>({"& text":{fill:(e.vars||e).palette.text.primary}})),ds=R.forwardRef(function(t,n){const{width:r,height:i,margin:o,title:s,desc:a,value:c,valueMin:l=0,valueMax:u=100,startAngle:d,endAngle:h,outerRadius:f,innerRadius:m,cornerRadius:y,cx:x,cy:b,children:S}=t,v=Je(t,kx);return p.jsxRuntimeExports.jsx(ex,{pluginParams:{width:r,height:i,margin:Nl(o,{left:10,right:10,top:10,bottom:10})},plugins:[],children:p.jsxRuntimeExports.jsx(Ax,{value:c,valueMin:l,valueMax:u,startAngle:d,endAngle:h,outerRadius:f,innerRadius:m,cornerRadius:y,cx:x,cy:b,children:p.jsxRuntimeExports.jsx(ls,z({title:s,desc:a,role:"meter","aria-valuenow":c===null?void 0:c,"aria-valuemin":l,"aria-valuemax":u},v,{ref:n,children:p.jsxRuntimeExports.jsx(Ox,{"aria-hidden":"true",children:S})}))})})});process.env.NODE_ENV!=="production"&&(ds.displayName="GaugeContainer");process.env.NODE_ENV!=="production"&&(ds.propTypes={children:g.node,className:g.string,cornerRadius:g.oneOfType([g.number,g.string]),cx:g.oneOfType([g.number,g.string]),cy:g.oneOfType([g.number,g.string]),desc:g.string,endAngle:g.number,height:g.number,id:g.string,innerRadius:g.oneOfType([g.number,g.string]),margin:g.oneOfType([g.number,g.shape({bottom:g.number,left:g.number,right:g.number,top:g.number})]),outerRadius:g.oneOfType([g.number,g.string]),skipAnimation:g.bool,startAngle:g.number,sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),title:g.string,value:g.number,valueMax:g.number,valueMin:g.number,width:g.number});function Px(e){const t=Vt(),n=pe(t,Sh);return e||n}function Dx(e,t){const n=Ge(e.startAngle,t.startAngle),r=Ge(e.endAngle,t.endAngle),i=Ge(e.innerRadius,t.innerRadius),o=Ge(e.outerRadius,t.outerRadius),s=Ge(e.cornerRadius,t.cornerRadius);return a=>({startAngle:n(a),endAngle:r(a),innerRadius:i(a),outerRadius:o(a),cornerRadius:s(a)})}function Lx(e){return vx({startAngle:e.startAngle,endAngle:e.endAngle,innerRadius:e.innerRadius,outerRadius:e.outerRadius,cornerRadius:e.cornerRadius},{createInterpolator:Dx,transformProps:t=>({d:Gc().cornerRadius(t.cornerRadius)({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle})}),applyProps(t,n){t.setAttribute("d",n.d)},initialProps:{startAngle:e.startAngle,endAngle:e.startAngle,innerRadius:e.innerRadius,outerRadius:e.outerRadius,cornerRadius:e.cornerRadius},skip:e.skipAnimation,ref:e.ref})}function $x(e){return p.generateUtilityClass("MuiGauge",e)}const hs=Fr("MuiGauge",["root","valueArc","referenceArc","valueText"]),zx=["className"],Nx=["cx","cy","startAngle","endAngle","cornerRadius","innerRadius","outerRadius","skipAnimation"],Fx=Ae("path",{name:"MuiGauge",slot:"ValueArc"})(({theme:e})=>({fill:(e.vars||e).palette.primary.main}));function tu(e){let{className:t}=e,n=Je(e,zx);const{value:r,valueMin:i,valueMax:o,startAngle:s,endAngle:a,outerRadius:c,innerRadius:l,cornerRadius:u,cx:d,cy:h}=us();if(r===null)return null;const f=s+(r-i)/(o-i)*(a-s);return p.jsxRuntimeExports.jsx(nu,z({},n,{className:p.clsx(hs.valueArc,t),cx:d,cy:h,startAngle:s,endAngle:f,cornerRadius:u,innerRadius:l,outerRadius:c}))}process.env.NODE_ENV!=="production"&&(tu.propTypes={skipAnimation:g.bool});function nu(e){let{cx:t,cy:n,startAngle:r,endAngle:i,cornerRadius:o,innerRadius:s,outerRadius:a,skipAnimation:c}=e,l=Je(e,Nx);const u=Px(c),d=Lx({startAngle:r,endAngle:i,cornerRadius:o,innerRadius:s,outerRadius:a,skipAnimation:u});return p.jsxRuntimeExports.jsx(Fx,z({},d,{transform:`translate(${t}, ${n})`},l))}process.env.NODE_ENV!=="production"&&(nu.propTypes={cornerRadius:g.number.isRequired,cx:g.number.isRequired,cy:g.number.isRequired,endAngle:g.number.isRequired,innerRadius:g.number.isRequired,outerRadius:g.number.isRequired,skipAnimation:g.bool,startAngle:g.number.isRequired});const Gx=["className"],Bx=Ae("path",{name:"MuiGauge",slot:"ReferenceArc"})(({theme:e})=>({fill:(e.vars||e).palette.divider}));function Ux(e){let{className:t}=e,n=Je(e,Gx);const{startAngle:r,endAngle:i,outerRadius:o,innerRadius:s,cornerRadius:a,cx:c,cy:l}=us();return p.jsxRuntimeExports.jsx(Bx,z({className:p.clsx(hs.referenceArc,t),transform:`translate(${c}, ${l})`,d:Gc().cornerRadius(a)({startAngle:r,endAngle:i,innerRadius:s,outerRadius:o})},n))}function Vx(){return typeof window>"u"}const ar=new Map,Hx=2e3,Wx=new Set(["minWidth","maxWidth","width","minHeight","maxHeight","height","top","left","fontSize","padding","margin","paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom"]);function ru(e,t){return Wx.has(e)&&t===+t?`${t}px`:t}const qx=/([A-Z])/g;function iu(e){return String(e).replace(qx,t=>`-${t.toLowerCase()}`)}function Yx(e){let t="";for(const n in e)if(Object.hasOwn(e,n)){const r=n,i=e[r];if(i===void 0)continue;t+=`${iu(r)}:${ru(r,i)};`}return t}const Jx=(e,t={})=>{if(e==null||Vx())return{width:0,height:0};const n=String(e),r=Yx(t),i=`${n}-${r}`,o=ar.get(i);if(o)return o;try{const s=Kx(),a=document.createElementNS("http://www.w3.org/2000/svg","text");Object.keys(t).map(l=>(a.style[iu(l)]=ru(l,t[l]),l)),a.textContent=n,s.replaceChildren(a);const c=Xx(a);return ar.set(i,c),ar.size+1>Hx&&ar.clear(),process.env.NODE_ENV==="test"&&s.replaceChildren(),c}catch{return{width:0,height:0}}};function Xx(e){try{const t=e.getBBox();return{width:t.width,height:t.height}}catch{const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}}let Me=null;function Kx(){return Me===null&&(Me=document.createElementNS("http://www.w3.org/2000/svg","svg"),Me.setAttribute("aria-hidden","true"),Me.style.position="absolute",Me.style.top="-20000px",Me.style.left="0",Me.style.padding="0",Me.style.margin="0",Me.style.border="none",Me.style.pointerEvents="none",Me.style.visibility="hidden",Me.style.contain="strict",document.body.appendChild(Me)),Me}function Zx({style:e,needsComputation:t,text:n}){return n.split(`
71
- `).map(r=>z({text:r},t?Jx(r,e):{width:0,height:0}))}function Qx(){const[e,t]=R.useState(!1);return R.useEffect(()=>{t(!0)},[]),e}const ey=["x","y","style","text","ownerState"],ty=["angle","textAnchor","dominantBaseline"];function ou(e){const{x:t,y:n,style:r,text:i}=e,o=Je(e,ey),s=r??{},{angle:a,textAnchor:c,dominantBaseline:l}=s,u=Je(s,ty),d=Qx(),h=R.useMemo(()=>Zx({style:u,needsComputation:d&&i.includes(`
72
- `),text:i}),[u,i,d]);let f;switch(l){case"hanging":case"text-before-edge":f=0;break;case"central":f=(h.length-1)/2*-h[0].height;break;default:f=(h.length-1)*-h[0].height;break}return p.jsxRuntimeExports.jsx("text",z({},o,{transform:a?`rotate(${a}, ${t}, ${n})`:void 0,x:t,y:n,textAnchor:c,dominantBaseline:l,style:u,children:h.map((m,y)=>p.jsxRuntimeExports.jsx("tspan",{x:t,dy:`${y===0?f:h[0].height}px`,dominantBaseline:l,children:m.text},y))}))}process.env.NODE_ENV!=="production"&&(ou.propTypes={lineHeight:g.number,needsComputation:g.bool,ownerState:g.any,style:g.object,text:g.string.isRequired});const ny=["text","className"];function ry({value:e}){return e===null?null:e.toLocaleString()}function su(e){const{text:t=ry,className:n}=e,r=Je(e,ny),{value:i,valueMin:o,valueMax:s,cx:a,cy:c}=us(),l=typeof t=="function"?t({value:i,valueMin:o,valueMax:s}):t;return l===null?null:p.jsxRuntimeExports.jsx("g",{className:p.clsx(hs.valueText,n),children:p.jsxRuntimeExports.jsx(ou,z({x:a,y:c,text:l,style:{textAnchor:"middle",dominantBaseline:"central"}},r))})}process.env.NODE_ENV!=="production"&&(su.propTypes={lineHeight:g.number,needsComputation:g.bool,ownerState:g.any,style:g.object,text:g.oneOfType([g.func,g.string])});const iy=["text","children","classes","className","skipAnimation"],oy=e=>{const{classes:t}=e;return zn({root:["root"]},$x,t)},fs=R.forwardRef(function(t,n){const{text:r,children:i,className:o,skipAnimation:s}=t,a=Je(t,iy),c=oy(t);return p.jsxRuntimeExports.jsxs(ds,z({},a,{className:p.clsx(c.root,o),ref:n,children:[p.jsxRuntimeExports.jsx(Ux,{}),p.jsxRuntimeExports.jsx(tu,{skipAnimation:s}),p.jsxRuntimeExports.jsx(su,{text:r}),i]}))});process.env.NODE_ENV!=="production"&&(fs.displayName="Gauge");process.env.NODE_ENV!=="production"&&(fs.propTypes={children:g.node,classes:g.object,className:g.string,cornerRadius:g.oneOfType([g.number,g.string]),cx:g.oneOfType([g.number,g.string]),cy:g.oneOfType([g.number,g.string]),desc:g.string,endAngle:g.number,height:g.number,id:g.string,innerRadius:g.oneOfType([g.number,g.string]),margin:g.oneOfType([g.number,g.shape({bottom:g.number,left:g.number,right:g.number,top:g.number})]),outerRadius:g.oneOfType([g.number,g.string]),skipAnimation:g.bool,startAngle:g.number,sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),text:g.oneOfType([g.func,g.string]),title:g.string,value:g.number,valueMax:g.number,valueMin:g.number,width:g.number});const sy=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=e%60,o=[];return t>0?(o.push(t.toString()),o.push(n.toString().padStart(2,"0")),o.push(r.toString().padStart(2,"0")),o.push(i.toString().padStart(2,"0"))):n>0?(o.push(n.toString()),o.push(r.toString().padStart(2,"0")),o.push(i.toString().padStart(2,"0"))):(o.push(r.toString()),o.push(i.toString().padStart(2,"0"))),o.join(":")},He=(e,t)=>{const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60),o=e%60;if(typeof Intl<"u"&&"DurationFormat"in Intl)try{const a={};return n>0&&(a.days=n),r>0&&(a.hours=r),i>0&&(a.minutes=i),(o>0||Object.keys(a).length===0)&&(a.seconds=o),new Intl.DurationFormat(t,{style:"narrow"}).format(a)}catch{}const s=[];return n>0&&s.push(`${n}d`),r>0&&s.push(`${r}h`),i>0&&s.push(`${i}m`),(o>0||s.length===0)&&s.push(`${o}s`),s.join(" ")},ay=(e,t,n)=>e==="countdown"&&n!==null?Math.min(100,t/n*100):e==="measuring"?t/60%1*100:0,ly=({timerState:e,animationState:t,hasError:n,className:r})=>{const{t:i,i18n:o}=le.useTranslation(),s=T.useTheme(),{currentState:a,remainingTime:c,maxTime:l,currentProgress:u}=e,{showErrorAnimation:d,showPauseAnimation:h,showPulsatingText:f,pulsatingFinished:m,showLabels:y,showMainText:x,showIdlePulsating:b,idleDotsCount:S}=t;return p.jsxRuntimeExports.jsxs(T.Box,{className:r,sx:{position:"relative",width:264,height:264,display:"flex",alignItems:"center",justifyContent:"center"},children:[p.jsxRuntimeExports.jsx(fs,{width:264,height:264,value:a==="idle"?0:u,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:h||d?.6:1,transition:"opacity 0.5s ease-out","& .MuiGauge-valueArc":{fill:n?s.palette.error.light:s.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"}}}),p.jsxRuntimeExports.jsxs(T.Box,{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:[p.jsxRuntimeExports.jsx(T.Box,{sx:{height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:1},children:p.jsxRuntimeExports.jsx(T.Fade,{in:y&&!n&&a!=="idle"&&a!=="success",timeout:300,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{fontSize:"12px",color:a==="measured"&&(f||m)?s.palette.success.main:s.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:p.jsxRuntimeExports.jsx("span",{style:{opacity:a==="measured"&&m?f?1:.6:1,transition:"opacity 2s ease-in-out"},children:a==="measuring"||a==="measured"?i("CycleTimer.CycleTime.lb","Cycle Time"):a==="countdown"?i("CycleTimer.RemainingTime.lb","Remaining Time"):""})})})}),p.jsxRuntimeExports.jsxs(T.Box,{sx:{position:"relative",height:"48px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:.5},children:[p.jsxRuntimeExports.jsx(T.Fade,{in:x&&a==="idle"&&!n,timeout:200,children:p.jsxRuntimeExports.jsxs(T.Typography,{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:[p.jsxRuntimeExports.jsx("span",{style:{opacity:b?1:.6,transition:"opacity 2s ease-in-out"},children:i("CycleTimer.WaitingForCycle.lb","Waiting for program cycle")}),p.jsxRuntimeExports.jsx("span",{style:{display:"inline-block",width:"18px",textAlign:"left",opacity:b?1:.6,transition:"opacity 2s ease-in-out"},children:".".repeat(S)})]})}),p.jsxRuntimeExports.jsx(T.Fade,{in:x&&n,timeout:200,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"h3",sx:{position:"absolute",fontSize:"40px",fontWeight:400,color:"#FFFFFF",lineHeight:"116.7%"},children:i("CycleTimer.Error.lb","Error")})}),p.jsxRuntimeExports.jsx(T.Fade,{in:x&&!n&&a!=="idle"&&a!=="success",timeout:300,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"h1",sx:{position:"absolute",fontSize:"48px",fontWeight:500,color:s.palette.text.primary,lineHeight:1,transition:"color 0.8s ease-in-out"},children:p.jsxRuntimeExports.jsx("span",{style:{opacity:1,transition:"opacity 2s ease-in-out"},children:sy(c)})})})]}),p.jsxRuntimeExports.jsx(T.Box,{sx:{height:"16px",display:"flex",marginTop:.5,alignItems:"center",justifyContent:"center"},children:p.jsxRuntimeExports.jsx(T.Fade,{in:y&&!n&&a!=="idle"&&a!=="success",timeout:300,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{fontSize:"12px",color:a==="measured"&&(f||m)?s.palette.success.main:s.palette.text.secondary,transition:"color 0.8s ease-in-out"},children:p.jsxRuntimeExports.jsx("span",{style:{opacity:a==="measured"&&m?f?1:.6:1,transition:"opacity 2s ease-in-out"},children:a==="measuring"?i("CycleTimer.Measuring.lb","measuring..."):a==="measured"?i("CycleTimer.Determined.lb","determined"):a==="countdown"&&l!==null?i("CycleTimer.OfTime.lb",{time:He(l,o.language)}):""})})})})]})]})},cy=({timerState:e,animationState:t,hasError:n,compact:r,className:i})=>{const{t:o,i18n:s}=le.useTranslation(),a=T.useTheme(),{currentState:c,remainingTime:l,maxTime:u}=e,{showErrorAnimation:d,showPauseAnimation:h,showPulsatingText:f,pulsatingFinished:m,showIdlePulsating:y,idleDotsCount:x}=t;return r&&c==="idle"?p.jsxRuntimeExports.jsx(T.Box,{className:i,sx:{display:"flex",alignItems:"center",m:0},children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:n?a.palette.error.light:a.palette.text.primary,fontSize:"14px",transition:"color 0.5s ease-out"},children:n?o("CycleTimer.Error.lb","Error"):c==="idle"?"0s":He(l,s.language)})}):p.jsxRuntimeExports.jsxs(T.Box,{className:i,sx:{display:"flex",alignItems:"center",m:0,gap:1},children:[!(c==="idle"&&r)&&p.jsxRuntimeExports.jsx(T.Box,{sx:{width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",opacity:h||d?.6:1,transition:"opacity 0.5s ease-out"},children:p.jsxRuntimeExports.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",style:{transform:"rotate(-90deg)"},role:"img","aria-label":"Timer progress",children:[p.jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?a.palette.error.light:c==="measured"?f||m?a.palette.success.main:a.palette.text.secondary:a.palette.success.main,strokeWidth:"2",opacity:c==="measured"&&m?f?1:.6:.3,style:{transition:"stroke 0.8s ease-in-out, opacity 2s ease-in-out"}}),p.jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?a.palette.error.light:c==="measured"?f||m?a.palette.success.main:a.palette.text.secondary:a.palette.success.main,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*8}`,strokeDashoffset:`${2*Math.PI*8*(1-(c==="idle"?0:e.currentProgress)/100)}`,style:{opacity:c==="measured"&&m?f?1:.6:1,transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:n?a.palette.error.light:c==="idle"?"rgba(255, 255, 255, 0.7)":c==="measured"?f||m?a.palette.success.main:a.palette.text.secondary:a.palette.text.primary,fontSize:"14px",lineHeight:"normal",letterSpacing:"normal",opacity:c==="idle"?y?1:.6:c==="measured"&&m?f?1:.6:1,transition:"color 0.8s ease-in-out, font-size 0.3s ease-out, opacity 2s ease-in-out"},children:n?o("CycleTimer.Error.lb","Error"):c==="idle"?p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[p.jsxRuntimeExports.jsx("span",{children:o("CycleTimer.WaitingForCycle.lb","Waiting for program cycle")}),p.jsxRuntimeExports.jsx("span",{style:{display:"inline-block",width:"18px",textAlign:"left"},children:".".repeat(x)})]}):c==="measuring"?r?He(l,s.language):`${He(l,s.language)} / ${o("CycleTimer.Measuring.lb","measuring...")}`:c==="measured"?r?He(l,s.language):`${He(l,s.language)} / ${o("CycleTimer.Determined.lb","determined")}`:c==="countdown"&&u!==null?r?He(l,s.language):`${He(l,s.language)} / ${o("CycleTimer.Time.lb",{time:He(u,s.language)})}`:He(l,s.language)})]})},uy=()=>{const[e,t]=O.useState({showPauseAnimation:!1,showErrorAnimation:!1,showPulsatingText:!1,pulsatingFinished:!1,showLabels:!0,showMainText:!0,showIdlePulsating:!1,idleDotsCount:0}),n=O.useRef(null),r=O.useRef(null),i=O.useRef(null),o=O.useRef(null),s=O.useRef(0),a=O.useRef(null),c=O.useRef(null),l=O.useCallback(()=>{t(v=>({...v,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t(v=>({...v,showPauseAnimation:!1}))},800)},[]),u=O.useCallback(()=>{t(v=>({...v,showErrorAnimation:!0})),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{t(v=>({...v,showErrorAnimation:!1}))},600)},[]),d=O.useCallback(()=>{t(v=>({...v,showErrorAnimation:!1})),r.current&&clearTimeout(r.current)},[]),h=O.useCallback(v=>{s.current=0,t(_=>({..._,showPulsatingText:!0,pulsatingFinished:!1})),setTimeout(()=>{t(_=>({..._,pulsatingFinished:!0})),i.current=setInterval(()=>{t(_=>({..._,showPulsatingText:!_.showPulsatingText}))},2e3),v&&v()},800)},[]),f=O.useCallback(()=>{i.current&&(clearInterval(i.current),i.current=null),t(v=>({...v,showPulsatingText:!1,pulsatingFinished:!1})),s.current=0},[]),m=O.useCallback(()=>{t(v=>({...v,showIdlePulsating:!0})),a.current=setInterval(()=>{t(v=>({...v,showIdlePulsating:!v.showIdlePulsating}))},2e3),c.current=setInterval(()=>{t(v=>({...v,idleDotsCount:(v.idleDotsCount+1)%4}))},800)},[]),y=O.useCallback(()=>{a.current&&(clearInterval(a.current),a.current=null),c.current&&(clearInterval(c.current),c.current=null),t(v=>({...v,showIdlePulsating:!1,idleDotsCount:0}))},[]),x=O.useCallback(()=>{t(v=>({...v,showLabels:!1,showMainText:!1})),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{t(v=>({...v,showLabels:!0,showMainText:!0}))},200)},[]),b=O.useCallback(()=>{t(v=>({...v,showLabels:!0,showMainText:!0}))},[]),S=O.useCallback(()=>{n.current&&clearTimeout(n.current),r.current&&clearTimeout(r.current),o.current&&clearTimeout(o.current),i.current&&clearInterval(i.current),a.current&&clearInterval(a.current),c.current&&clearInterval(c.current)},[]);return{animationState:e,triggerPauseAnimation:l,triggerErrorAnimation:u,clearErrorAnimation:d,startPulsatingAnimation:h,stopPulsatingAnimation:f,startIdleAnimations:m,stopIdleAnimations:y,triggerFadeTransition:x,setInitialAnimationState:b,cleanup:S}},dy=({autoStart:e,onCycleEnd:t,onMeasuringComplete:n,hasError:r,onPauseAnimation:i,onErrorAnimation:o,onClearErrorAnimation:s,onStartPulsating:a})=>{const[c,l]=O.useState({currentState:"idle",remainingTime:0,maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),u=O.useRef(null),d=O.useRef(null),h=O.useRef(0),[f]=se.useInterpolation([0],{tension:80,friction:18,onChange:([C])=>{l(w=>({...w,currentProgress:C}))}}),m=O.useCallback(()=>{l(C=>({...C,currentState:"idle",maxTime:null,isRunning:!1,isPausedState:!1,currentProgress:0})),h.current=0,d.current=null,f.setImmediate([0])},[f]),y=O.useCallback((C=0)=>{const w=C/60%1*100;l(E=>({...E,currentState:"measuring",maxTime:null,remainingTime:C,isPausedState:!1,currentProgress:w})),h.current=0,f.setImmediate([w]),e?(d.current=Date.now()-C*1e3,l(E=>({...E,isRunning:!0}))):d.current=null},[e,f]),x=O.useCallback((C,w=0)=>{l(j=>({...j,isRunning:!1})),d.current=null,l(j=>({...j,currentState:"countdown",maxTime:C,isPausedState:!1})),h.current=0;const E=Math.max(0,C-w),M=w>0?w/C*100:0;l(j=>({...j,remainingTime:E,currentProgress:M})),f.setImmediate([M]),E===0?(l(j=>({...j,isRunning:!1})),d.current=null,t&&queueMicrotask(()=>t())):e?setTimeout(()=>{d.current=Date.now()-w*1e3,l(j=>({...j,isRunning:!0}))},0):d.current=null},[e,t,f]),b=O.useCallback(()=>{l(C=>({...C,isRunning:!1,currentState:"measured"})),d.current=null,a(()=>{n&&n()})},[a,n]),S=O.useCallback(()=>{if(d.current&&c.isRunning){const w=Date.now()-d.current;h.current+=w;const E=h.current/1e3,M=ay(c.currentState,E,c.maxTime);f.setTarget([M])}l(C=>({...C,isRunning:!1,isPausedState:!0})),i()},[c.isRunning,c.currentState,c.maxTime,f,i]),v=O.useCallback(()=>{c.isPausedState&&(c.remainingTime>0||c.currentState!=="countdown")&&(d.current=Date.now(),l(C=>({...C,isRunning:!0,isPausedState:!1})))},[c.isPausedState,c.remainingTime,c.currentState]),_=O.useCallback(()=>c.isPausedState,[c.isPausedState]);return O.useEffect(()=>{r?(c.isRunning&&!c.isPausedState&&(l(C=>({...C,wasRunningBeforeError:!0})),S()),o()):(c.wasRunningBeforeError&&c.isPausedState&&(l(C=>({...C,wasRunningBeforeError:!1})),v()),s())},[r,c.isRunning,c.isPausedState,c.wasRunningBeforeError,S,v,o,s]),O.useEffect(()=>{if(c.isRunning){const C=()=>{if(d.current){const E=(Date.now()-d.current+h.current)/1e3;if(c.currentState==="countdown"&&c.maxTime!==null){const M=Math.max(0,c.maxTime-E);l(D=>({...D,remainingTime:Math.ceil(M)}));const j=Math.min(100,E/c.maxTime*100);if(f.setTarget([j]),M<=0){l(D=>({...D,isRunning:!1,remainingTime:0})),d.current=null,f.setTarget([100]),t&&queueMicrotask(()=>t());return}}else if(c.currentState==="measuring"){l(j=>({...j,remainingTime:Math.floor(E)}));const M=E/60%1*100;f.setTarget([M])}c.isRunning&&(u.current=requestAnimationFrame(C))}};u.current=requestAnimationFrame(C)}else u.current&&(cancelAnimationFrame(u.current),u.current=null);return()=>{u.current&&cancelAnimationFrame(u.current)}},[c.isRunning,t,c.currentState,c.maxTime,f]),O.useEffect(()=>{let C=null;const w=()=>{f.update(1/60),C=requestAnimationFrame(w)};return C=requestAnimationFrame(w),()=>{C&&cancelAnimationFrame(C)}},[f]),{timerState:c,controls:{startNewCycle:x,startMeasuring:y,setIdle:m,completeMeasuring:b,pause:S,resume:v,isPaused:_}}},hy=p.externalizeComponent(re.observer(({onCycleComplete:e,onCycleEnd:t,onMeasuringComplete:n,autoStart:r=!0,variant:i="default",compact:o=!1,className:s,hasError:a=!1})=>{const c=O.useRef(void 0),{animationState:l,triggerPauseAnimation:u,triggerErrorAnimation:d,clearErrorAnimation:h,startPulsatingAnimation:f,stopPulsatingAnimation:m,startIdleAnimations:y,stopIdleAnimations:x,triggerFadeTransition:b,setInitialAnimationState:S,cleanup:v}=uy(),{timerState:_,controls:C}=dy({autoStart:r,onCycleEnd:t,onMeasuringComplete:n,hasError:a,onPauseAnimation:u,onErrorAnimation:d,onClearErrorAnimation:h,onStartPulsating:f});return O.useEffect(()=>{const w=c.current;c.current!==void 0&&w!==_.currentState?(w==="measured"&&m(),w==="idle"&&x(),b()):S(),_.currentState==="idle"&&y(),c.current=_.currentState},[_.currentState,m,x,y,b,S]),O.useEffect(()=>{let w=!0;const E=setTimeout(()=>{w&&e(C)},0);return()=>{w=!1,clearTimeout(E)}},[e,C]),O.useEffect(()=>v,[v]),i==="small"?p.jsxRuntimeExports.jsx(cy,{timerState:_,animationState:l,hasError:a,compact:o,className:s}):p.jsxRuntimeExports.jsx(ly,{timerState:_,animationState:l,hasError:a,className:s})})),Ht=sd;process.env.NODE_ENV!=="production"&&(g.node,g.object.isRequired);function ps(e){return p.useDefaultProps(e)}function fy(e){return p.generateUtilityClass("MuiSvgIcon",e)}Fr("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const py=e=>{const{color:t,fontSize:n,classes:r}=e,i={root:["root",t!=="inherit"&&`color${p.capitalize(t)}`,`fontSize${p.capitalize(n)}`]};return zn(i,fy,r)},my=Ae("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${p.capitalize(n.color)}`],t[`fontSize${p.capitalize(n.fontSize)}`]]}})(Ht(({theme:e})=>{var t,n,r,i,o,s,a,c,l,u,d,h,f,m;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(i=(t=e.transitions)==null?void 0:t.create)==null?void 0:i.call(t,"fill",{duration:(r=(n=(e.vars??e).transitions)==null?void 0:n.duration)==null?void 0:r.shorter}),variants:[{props:y=>!y.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((s=(o=e.typography)==null?void 0:o.pxToRem)==null?void 0:s.call(o,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((c=(a=e.typography)==null?void 0:a.pxToRem)==null?void 0:c.call(a,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((u=(l=e.typography)==null?void 0:l.pxToRem)==null?void 0:u.call(l,35))||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,y])=>y&&y.main).map(([y])=>{var x,b;return{props:{color:y},style:{color:(b=(x=(e.vars??e).palette)==null?void 0:x[y])==null?void 0:b.main}}}),{props:{color:"action"},style:{color:(h=(d=(e.vars??e).palette)==null?void 0:d.action)==null?void 0:h.active}},{props:{color:"disabled"},style:{color:(m=(f=(e.vars??e).palette)==null?void 0:f.action)==null?void 0:m.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),Lr=R.forwardRef(function(t,n){const r=ps({props:t,name:"MuiSvgIcon"}),{children:i,className:o,color:s="inherit",component:a="svg",fontSize:c="medium",htmlColor:l,inheritViewBox:u=!1,titleAccess:d,viewBox:h="0 0 24 24",...f}=r,m=R.isValidElement(i)&&i.type==="svg",y={...r,color:s,component:a,fontSize:c,instanceFontSize:t.fontSize,inheritViewBox:u,viewBox:h,hasSvgAsChild:m},x={};u||(x.viewBox=h);const b=py(y);return p.jsxRuntimeExports.jsxs(my,{as:a,className:p.clsx(b.root,o),focusable:"false",color:l,"aria-hidden":d?void 0:!0,role:d?"img":void 0,ref:n,...x,...f,...m&&i.props,ownerState:y,children:[m?i.props.children:i,d?p.jsxRuntimeExports.jsx("title",{children:d}):null]})});process.env.NODE_ENV!=="production"&&(Lr.propTypes={children:g.node,classes:g.object,className:g.string,color:g.oneOfType([g.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),g.string]),component:g.elementType,fontSize:g.oneOfType([g.oneOf(["inherit","large","medium","small"]),g.string]),htmlColor:g.string,inheritViewBox:g.bool,shapeRendering:g.string,sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),titleAccess:g.string,viewBox:g.string});Lr.muiName="SvgIcon";function Mt(e,t){function n(r,i){return p.jsxRuntimeExports.jsx(Lr,{"data-testid":process.env.NODE_ENV!=="production"?`${t}Icon`:void 0,ref:i,...r,children:e})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=Lr.muiName,R.memo(R.forwardRef(n))}function gy(e){const{controlled:t,default:n,name:r,state:i="value"}=e,{current:o}=R.useRef(t!==void 0),[s,a]=R.useState(n),c=o?t:s;if(process.env.NODE_ENV!=="production"){R.useEffect(()=>{o!==(t!==void 0)&&console.error([`MUI: A component is changing the ${o?"":"un"}controlled ${i} state of ${r} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${r} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
73
- `))},[i,r,t]);const{current:u}=R.useRef(n);R.useEffect(()=>{!o&&JSON.stringify(n)!==JSON.stringify(u)&&console.error([`MUI: A component is changing the default ${i} state of an uncontrolled ${r} after being initialized. To suppress this warning opt to use a controlled ${r}.`].join(`
74
- `))},[JSON.stringify(n)])}const l=R.useCallback(u=>{o||a(u)},[]);return[c,l]}const xy=Mt(p.jsxRuntimeExports.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear"),yy=Mt(p.jsxRuntimeExports.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}),"FilterList"),Fa=Mt(p.jsxRuntimeExports.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search"),au=p.externalizeComponent(re.observer(({data:e,columns:t,getRowData:n,onRowClick:r,selectedItem:i,getItemId:o,title:s,showCount:a=!0,searchPlaceholder:c="Search programs",dataGridProps:l,CustomToolbar:u,selectFirstByDefault:d=!1,sx:h})=>{var M;const f=T.useTheme(),m=Ne.useGridApiRef(),y=O.useRef(null),[x,b]=O.useState(null),S=O.useMemo(()=>e.map(n),[e,n]);O.useEffect(()=>{m.current&&S.length>0&&m.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:t.map(j=>j.field)})},[S,t,m]),O.useEffect(()=>{if(!y.current||!m.current)return;const j=new ResizeObserver(()=>{setTimeout(()=>{m.current&&S.length>0&&m.current.autosizeColumns({includeOutliers:!0,includeHeaders:!0,expand:!0,columns:t.map(D=>D.field)})},100)});return j.observe(y.current),()=>{j.disconnect()}},[m,S.length,t]);const v=O.useMemo(()=>{if(i!==void 0)return i;if(x!==null)return x;if(d&&e.length>0){const j=e[0];return b(j),j}return null},[d,e,i,x]),_=j=>{const D=e.find(A=>n(A).id===j.id);D&&(i===void 0&&b(D),r&&r(D,j))},C=O.useMemo(()=>!v||!o?null:o(v),[v,o]);function w(){return p.jsxRuntimeExports.jsx(Ne.Toolbar,{children:p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",width:"100%",gap:1,p:.5,alignItems:"center"},children:[s&&p.jsxRuntimeExports.jsxs(T.Typography,{variant:"h6",sx:{fontWeight:500,color:"white"},children:[s,a&&` (${e.length})`]}),p.jsxRuntimeExports.jsxs(T.Box,{sx:{ml:"auto",display:"flex",gap:.5,alignItems:"center",pr:1},children:[p.jsxRuntimeExports.jsx(Ne.FilterPanelTrigger,{render:p.jsxRuntimeExports.jsx(Ne.ToolbarButton,{"aria-label":"Show filters",children:p.jsxRuntimeExports.jsx(yy,{fontSize:"small"})})}),p.jsxRuntimeExports.jsx(T.Divider,{orientation:"vertical",flexItem:!0,sx:{height:"24px",alignSelf:"center"}}),p.jsxRuntimeExports.jsx(Ne.QuickFilter,{render:(j,D)=>p.jsxRuntimeExports.jsxs(T.Box,{...j,sx:{display:"flex",overflow:"hidden"},children:[!D.expanded&&p.jsxRuntimeExports.jsx(Ne.QuickFilterTrigger,{render:p.jsxRuntimeExports.jsx(Ne.ToolbarButton,{"aria-label":"Search",children:p.jsxRuntimeExports.jsx(Fa,{fontSize:"small"})})}),p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",overflow:"hidden",transition:"all 0.3s ease-in-out",width:D.expanded?"200px":"0px",position:"relative"},children:[p.jsxRuntimeExports.jsxs(T.Box,{sx:{flex:1,position:"relative","& .MuiInputBase-root":{height:"32px",borderRadius:"16px",backgroundColor:"#171927",paddingLeft:"40px",paddingRight:D.expanded&&D.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:[D.expanded&&p.jsxRuntimeExports.jsx(Fa,{fontSize:"small",sx:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:"rgba(255, 255, 255, 0.6)",zIndex:1,pointerEvents:"none"}}),p.jsxRuntimeExports.jsx(Ne.QuickFilterControl,{placeholder:c})]}),D.expanded&&D.value!==""&&p.jsxRuntimeExports.jsx(Ne.QuickFilterClear,{render:p.jsxRuntimeExports.jsx(T.Box,{sx:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",zIndex:1},children:p.jsxRuntimeExports.jsx(T.Box,{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:p.jsxRuntimeExports.jsx(Ne.ToolbarButton,{"aria-label":"Clear",children:p.jsxRuntimeExports.jsx(xy,{fontSize:"small"})})})})})]})]})})]})]})})}const E=u||w;return p.jsxRuntimeExports.jsx(T.Box,{ref:y,sx:{height:"100%",display:"flex",flexDirection:"column","& *":{scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}},"&:hover *":{scrollbarWidth:"thin",scrollbarColor:`${f.palette.divider} transparent`,"&::-webkit-scrollbar":{display:"block",width:"8px",height:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:f.palette.divider,borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:f.palette.action.hover}},...h},children:p.jsxRuntimeExports.jsx(Ne.DataGrid,{apiRef:m,rows:S,columns:t,onRowClick:_,disableColumnMenu:!1,disableRowSelectionOnClick:!0,disableMultipleRowSelection:!0,hideFooterSelectedRowCount:!0,filterMode:"client",sortingOrder:["desc","asc"],hideFooter:!1,showToolbar:!0,slots:{toolbar:E},initialState:{sorting:{sortModel:[]},filter:{filterModel:{items:[]}},...l==null?void 0:l.initialState},...l,autosizeOnMount:!0,autosizeOptions:{...(l==null?void 0:l.autosizeOptions)||{},includeOutliers:!0,includeHeaders:!0,expand:!0,columns:((M=l==null?void 0:l.autosizeOptions)==null?void 0:M.columns)||t.map(j=>j.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:r?"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":{},...l==null?void 0:l.sx}})})}));au.displayName="WandelbotsDataGrid";const on=fd({createStyledComponent:Ae("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>ps({props:e,name:"MuiStack"})});process.env.NODE_ENV!=="production"&&(on.propTypes={children:g.node,component:g.elementType,direction:g.oneOfType([g.oneOf(["column-reverse","column","row-reverse","row"]),g.arrayOf(g.oneOf(["column-reverse","column","row-reverse","row"])),g.object]),divider:g.node,spacing:g.oneOfType([g.arrayOf(g.oneOfType([g.number,g.string])),g.number,g.object,g.string]),sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),useFlexGap:g.bool});const by=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("g",{id:"JogMinus"},R.createElement("path",{id:"Minus",d:"M0 13V8H21V13H0Z",fill:"white"}))),vy=O.forwardRef(by),wy=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:21,height:21,viewBox:"0 0 21 21",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("g",{id:"JogPlus"},R.createElement("g",{id:"Plus"},R.createElement("path",{d:"M0 13V8H8V13H0Z",fill:"white"}),R.createElement("path",{d:"M8 0L13 2.18557e-07L13 21H8L8 0Z",fill:"white"}),R.createElement("path",{d:"M13 13V8H21V13H13Z",fill:"white"})))),Ey=O.forwardRef(wy),lo=p.externalizeComponent(re.observer(({colors:e,label:t,getDisplayedValue:n,startJogging:r,stopJogging:i,disabled:o,activeJoggingDirection:s,...a})=>{var v,_,C,w,E,M,j;se.useAnimationFrame(()=>{const D=n(),A=h.current;A&&(A.textContent=D)});const c=T.useTheme(),[l,u]=O.useState(null);O.useEffect(()=>{o&&S()},[o]);const d=s||l,h=O.useRef(null);e||(e={color:"#fff",backgroundColor:"#000",borderColor:"#000",buttonBackgroundColor:{disabled:"#000",default:"#000",hovered:"#000",pressed:"#000"},labelColor:"#000"});const f=d?(v=e.buttonBackgroundColor)==null?void 0:v.pressed:e.borderColor,m={width:"55px",color:e.color,path:{fill:e.color},alignContent:"center",fontSize:"37px",svg:{pointerEvents:"none"}},y={...m,backgroundColor:(_=e.buttonBackgroundColor)==null?void 0:_.default,":hover":{backgroundColor:(C=e.buttonBackgroundColor)==null?void 0:C.hovered},":active":{backgroundColor:(w=e.buttonBackgroundColor)==null?void 0:w.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor}},":disabled":{backgroundColor:(E=e.buttonBackgroundColor)==null?void 0:E.disabled,"svg path":{fill:c.palette.action.disabled}}},x={...m,backgroundColor:(M=e.buttonBackgroundColor)==null?void 0:M.pressed,color:e.backgroundColor,path:{fill:e.backgroundColor},":disabled":{backgroundColor:(j=e.buttonBackgroundColor)==null?void 0:j.pressed,"svg path":{fill:c.palette.action.disabled}}};function b(D,A){o||D.button===0&&(u(A),r(A))}function S(){u(null),i()}return p.jsxRuntimeExports.jsxs(on,{height:"64px",direction:"row",justifyContent:"center",...a,children:[p.jsxRuntimeExports.jsx(T.IconButton,{disabled:o,disableRipple:!0,onPointerDown:D=>b(D,"-"),onPointerUp:S,onPointerOut:S,size:"large",sx:{...d==="-"?x:y,borderRadius:"16px 0px 0px 16px",borderLeft:`2px solid ${f??"#fff"}`,borderBottom:`2px solid ${f??"#fff"}`,borderTop:`2px solid ${f??"#fff"}`},children:p.jsxRuntimeExports.jsx(vy,{})}),p.jsxRuntimeExports.jsxs(on,{spacing:"6px",sx:{width:"150px",backgroundColor:e.backgroundColor,alignItems:"center",justifyContent:"center",opacity:"0.9",borderBottom:`2px solid ${f??"#fff"}`,borderTop:`2px solid ${f??"#fff"}`},children:[p.jsxRuntimeExports.jsx(on,{height:"22px",direction:"row",alignItems:"center",justifyItems:"center",spacing:1,sx:{userSelect:"none",color:e.color,".MuiTypography-root":{fontWeight:700,...o?{color:c.palette.action.disabled}:{}},...o?{"svg path":{fill:c.palette.action.disabled}}:{}},children:t}),p.jsxRuntimeExports.jsx(T.Typography,{height:"22px",sx:{fontSize:"15px",color:o?c.palette.action.disabled:e.color,fontWeight:700},ref:h,children:n()})]}),p.jsxRuntimeExports.jsx(T.IconButton,{disableRipple:!0,disabled:o,onPointerDown:D=>b(D,"+"),onPointerUp:S,onPointerOut:S,size:"large",sx:{...d==="+"?x:y,borderRadius:"0px 16px 16px 0px",borderRight:`2px solid ${f??"#fff"}`,borderBottom:`2px solid ${f??"#fff"}`,borderTop:`2px solid ${f??"#fff"}`},children:p.jsxRuntimeExports.jsx(Ey,{})})]})})),Sy=Mt(p.jsxRuntimeExports.jsx("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"ChevronLeft"),Ty=Mt(p.jsxRuntimeExports.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");function $t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var lu=typeof global=="object"&&global&&global.Object===Object&&global,Cy=typeof self=="object"&&self&&self.Object===Object&&self,Ze=lu||Cy||Function("return this")(),Gi=function(){return Ze.Date.now()},_y=/\s/;function My(e){for(var t=e.length;t--&&_y.test(e.charAt(t)););return t}var Ry=/^\s+/;function jy(e){return e&&e.slice(0,My(e)+1).replace(Ry,"")}var wt=Ze.Symbol,cu=Object.prototype,Iy=cu.hasOwnProperty,Ay=cu.toString,En=wt?wt.toStringTag:void 0;function ky(e){var t=Iy.call(e,En),n=e[En];try{e[En]=void 0;var r=!0}catch{}var i=Ay.call(e);return r&&(t?e[En]=n:delete e[En]),i}var Oy=Object.prototype,Py=Oy.toString;function Dy(e){return Py.call(e)}var Ly="[object Null]",$y="[object Undefined]",Ga=wt?wt.toStringTag:void 0;function Wt(e){return e==null?e===void 0?$y:Ly:Ga&&Ga in Object(e)?ky(e):Dy(e)}function zt(e){return e!=null&&typeof e=="object"}var zy="[object Symbol]";function si(e){return typeof e=="symbol"||zt(e)&&Wt(e)==zy}var Ba=NaN,Ny=/^[-+]0x[0-9a-f]+$/i,Fy=/^0b[01]+$/i,Gy=/^0o[0-7]+$/i,By=parseInt;function Ua(e){if(typeof e=="number")return e;if(si(e))return Ba;if($t(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$t(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=jy(e);var n=Fy.test(e);return n||Gy.test(e)?By(e.slice(2),n?2:8):Ny.test(e)?Ba:+e}var Uy="Expected a function",Vy=Math.max,Hy=Math.min;function Wy(e,t,n){var r,i,o,s,a,c,l=0,u=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(Uy);t=Ua(t)||0,$t(n)&&(u=!!n.leading,d="maxWait"in n,o=d?Vy(Ua(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h);function f(w){var E=r,M=i;return r=i=void 0,l=w,s=e.apply(M,E),s}function m(w){return l=w,a=setTimeout(b,t),u?f(w):s}function y(w){var E=w-c,M=w-l,j=t-E;return d?Hy(j,o-M):j}function x(w){var E=w-c,M=w-l;return c===void 0||E>=t||E<0||d&&M>=o}function b(){var w=Gi();if(x(w))return S(w);a=setTimeout(b,y(w))}function S(w){return a=void 0,h&&r?f(w):(r=i=void 0,s)}function v(){a!==void 0&&clearTimeout(a),l=0,r=c=i=a=void 0}function _(){return a===void 0?s:S(Gi())}function C(){var w=Gi(),E=x(w);if(r=arguments,i=this,c=w,E){if(a===void 0)return m(c);if(d)return clearTimeout(a),a=setTimeout(b,t),f(c)}return a===void 0&&(a=setTimeout(b,t)),s}return C.cancel=v,C.flush=_,C}var qy="Expected a function";function Yy(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(qy);return $t(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Wy(e,t,{leading:r,maxWait:t,trailing:i})}const uu=p.externalizeComponent(re.observer(({startJogging:e,stopJogging:t,lowerLimitDegs:n,upperLimitDegs:r,getValueDegs:i,disabled:o,...s})=>{var v,_,C,w,E,M,j,D,A,P,I,k,U,N,Y;const{t:a}=le.useTranslation(),[c,l]=O.useState(),u=T.useTheme(),d={background:(v=u.palette.backgroundPaperElevation)==null?void 0:v[4],color:(_=u.palette.backgroundPaperElevation)==null?void 0:_[11]},h=re.useLocalObservable(()=>({activeJoggingDir:null,startJogging(F){this.activeJoggingDir=F,e(F)},stopJogging(){this.activeJoggingDir=null,t()}})),f=Yy(()=>{l(i())},50);se.useAnimationFrame(f);function m(F){F.button===0&&h.startJogging("-")}function y(F){F.button===0&&h.startJogging("+")}function x(F){h.stopJogging()}function b(F){h.stopJogging()}function S(F,J=1){if(F===void 0||isNaN(F))return"";const ie=a("General.degree.variable",{amount:F.toFixed(J)});return F>0&&J===0?`+${ie}`:ie}return p.jsxRuntimeExports.jsxs(on,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...s,sx:{"& .MuiIconButton-root":{width:"52px",color:u.palette.text.primary,alignContent:"center",backgroundColor:(C=u.palette.backgroundPaperElevation)==null?void 0:C[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(w=u.palette.backgroundPaperElevation)==null?void 0:w[11],color:u.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(E=u.palette.backgroundPaperElevation)==null?void 0:E[9]},"&:active":{...d}}},children:[p.jsxRuntimeExports.jsx(T.IconButton,{onPointerDown:m,onPointerUp:x,onPointerOut:b,disabled:o,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...h.activeJoggingDir==="-"?d:{}},children:p.jsxRuntimeExports.jsx(Sy,{sx:{pointerEvents:"none",color:(A=(D=(j=(M=u.componentsExt)==null?void 0:M.JoggingPanel)==null?void 0:j.JoggingJoint)==null?void 0:D.Joint)==null?void 0:A.arrowColor}})}),p.jsxRuntimeExports.jsxs(on,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(P=u.palette.backgroundPaperElevation)==null?void 0:P[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[p.jsxRuntimeExports.jsx(T.Typography,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",color:o?u.palette.action.disabled:u.palette.text.primary},children:S(c)}),p.jsxRuntimeExports.jsx(T.Slider,{disabled:!0,"aria-label":"Joint position",min:n,max:r,value:c||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:o?u.palette.action.disabled:u.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:o?u.palette.action.disabled:u.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(I=u.palette.backgroundPaperElevation)==null?void 0:I[5],opacity:1}},marks:n!==void 0&&r!==void 0&&[{value:n,label:S(n,0)},{value:r,label:S(r,0)}]})]}),p.jsxRuntimeExports.jsx(T.IconButton,{onPointerDown:y,onPointerUp:x,onPointerOut:b,disabled:o,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...h.activeJoggingDir==="+"?d:{}},children:p.jsxRuntimeExports.jsx(Ty,{sx:{pointerEvents:"none",color:(Y=(N=(U=(k=u.componentsExt)==null?void 0:k.JoggingPanel)==null?void 0:U.JoggingJoint)==null?void 0:N.Joint)==null?void 0:Y.arrowColor}})})]})})),Jy=Mt(p.jsxRuntimeExports.jsx("path",{d:"M10 9h4V6h3l-5-5-5 5h3zm-1 1H6V7l-5 5 5 5v-3h3zm14 2-5-5v3h-3v4h3v3zm-9 3h-4v3H7l5 5 5-5h-3z"}),"OpenWith"),Xy=Mt(p.jsxRuntimeExports.jsx("path",{d:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92s2.92-1.31 2.92-2.92-1.31-2.92-2.92-2.92"}),"Share");function rt(e,t,n){return Math.max(t,Math.min(n,e))}class Ky{constructor(t=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=t,this._y=n,this._z=r,this._w=i}static slerpFlat(t,n,r,i,o,s,a){let c=r[i+0],l=r[i+1],u=r[i+2],d=r[i+3];const h=o[s+0],f=o[s+1],m=o[s+2],y=o[s+3];if(a===0){t[n+0]=c,t[n+1]=l,t[n+2]=u,t[n+3]=d;return}if(a===1){t[n+0]=h,t[n+1]=f,t[n+2]=m,t[n+3]=y;return}if(d!==y||c!==h||l!==f||u!==m){let x=1-a;const b=c*h+l*f+u*m+d*y,S=b>=0?1:-1,v=1-b*b;if(v>Number.EPSILON){const C=Math.sqrt(v),w=Math.atan2(C,b*S);x=Math.sin(x*w)/C,a=Math.sin(a*w)/C}const _=a*S;if(c=c*x+h*_,l=l*x+f*_,u=u*x+m*_,d=d*x+y*_,x===1-a){const C=1/Math.sqrt(c*c+l*l+u*u+d*d);c*=C,l*=C,u*=C,d*=C}}t[n]=c,t[n+1]=l,t[n+2]=u,t[n+3]=d}static multiplyQuaternionsFlat(t,n,r,i,o,s){const a=r[i],c=r[i+1],l=r[i+2],u=r[i+3],d=o[s],h=o[s+1],f=o[s+2],m=o[s+3];return t[n]=a*m+u*d+c*f-l*h,t[n+1]=c*m+u*h+l*d-a*f,t[n+2]=l*m+u*f+a*h-c*d,t[n+3]=u*m-a*d-c*h-l*f,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,n,r,i){return this._x=t,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,n=!0){const r=t._x,i=t._y,o=t._z,s=t._order,a=Math.cos,c=Math.sin,l=a(r/2),u=a(i/2),d=a(o/2),h=c(r/2),f=c(i/2),m=c(o/2);switch(s){case"XYZ":this._x=h*u*d+l*f*m,this._y=l*f*d-h*u*m,this._z=l*u*m+h*f*d,this._w=l*u*d-h*f*m;break;case"YXZ":this._x=h*u*d+l*f*m,this._y=l*f*d-h*u*m,this._z=l*u*m-h*f*d,this._w=l*u*d+h*f*m;break;case"ZXY":this._x=h*u*d-l*f*m,this._y=l*f*d+h*u*m,this._z=l*u*m+h*f*d,this._w=l*u*d-h*f*m;break;case"ZYX":this._x=h*u*d-l*f*m,this._y=l*f*d+h*u*m,this._z=l*u*m-h*f*d,this._w=l*u*d+h*f*m;break;case"YZX":this._x=h*u*d+l*f*m,this._y=l*f*d+h*u*m,this._z=l*u*m-h*f*d,this._w=l*u*d-h*f*m;break;case"XZY":this._x=h*u*d-l*f*m,this._y=l*f*d-h*u*m,this._z=l*u*m+h*f*d,this._w=l*u*d+h*f*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,n){const r=n/2,i=Math.sin(r);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(t){const n=t.elements,r=n[0],i=n[4],o=n[8],s=n[1],a=n[5],c=n[9],l=n[2],u=n[6],d=n[10],h=r+a+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-c)*f,this._y=(o-l)*f,this._z=(s-i)*f}else if(r>a&&r>d){const f=2*Math.sqrt(1+r-a-d);this._w=(u-c)/f,this._x=.25*f,this._y=(i+s)/f,this._z=(o+l)/f}else if(a>d){const f=2*Math.sqrt(1+a-r-d);this._w=(o-l)/f,this._x=(i+s)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+d-r-a);this._w=(s-i)/f,this._x=(o+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(t,n){let r=t.dot(n)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=r):(this._x=0,this._y=-t.z,this._z=t.y,this._w=r)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=r),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(rt(this.dot(t),-1,1)))}rotateTowards(t,n){const r=this.angleTo(t);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,n){const r=t._x,i=t._y,o=t._z,s=t._w,a=n._x,c=n._y,l=n._z,u=n._w;return this._x=r*u+s*a+i*l-o*c,this._y=i*u+s*c+o*a-r*l,this._z=o*u+s*l+r*c-i*a,this._w=s*u-r*a-i*c-o*l,this._onChangeCallback(),this}slerp(t,n){if(n===0)return this;if(n===1)return this.copy(t);const r=this._x,i=this._y,o=this._z,s=this._w;let a=s*t._w+r*t._x+i*t._y+o*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=r,this._y=i,this._z=o,this;const c=1-a*a;if(c<=Number.EPSILON){const f=1-n;return this._w=f*s+n*this._w,this._x=f*r+n*this._x,this._y=f*i+n*this._y,this._z=f*o+n*this._z,this.normalize(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),d=Math.sin((1-n)*u)/l,h=Math.sin(n*u)/l;return this._w=s*d+this._w*h,this._x=r*d+this._x*h,this._y=i*d+this._y*h,this._z=o*d+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,n,r){return this.copy(t).slerp(n,r)}random(){const t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),o=Math.sqrt(r);return this.set(i*Math.sin(t),i*Math.cos(t),o*Math.sin(n),o*Math.cos(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,n=0){return this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t}fromBufferAttribute(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class sn{constructor(t=0,n=0,r=0){sn.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(t,n,r){return r===void 0&&(r=this.z),this.x=t,this.y=n,this.z=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this}applyEuler(t){return this.applyQuaternion(Va.setFromEuler(t))}applyAxisAngle(t,n){return this.applyQuaternion(Va.setFromAxisAngle(t,n))}applyMatrix3(t){const n=this.x,r=this.y,i=this.z,o=t.elements;return this.x=o[0]*n+o[3]*r+o[6]*i,this.y=o[1]*n+o[4]*r+o[7]*i,this.z=o[2]*n+o[5]*r+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const n=this.x,r=this.y,i=this.z,o=t.elements,s=1/(o[3]*n+o[7]*r+o[11]*i+o[15]);return this.x=(o[0]*n+o[4]*r+o[8]*i+o[12])*s,this.y=(o[1]*n+o[5]*r+o[9]*i+o[13])*s,this.z=(o[2]*n+o[6]*r+o[10]*i+o[14])*s,this}applyQuaternion(t){const n=this.x,r=this.y,i=this.z,o=t.x,s=t.y,a=t.z,c=t.w,l=2*(s*i-a*r),u=2*(a*n-o*i),d=2*(o*r-s*n);return this.x=n+c*l+s*d-a*u,this.y=r+c*u+a*l-o*d,this.z=i+c*d+o*u-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const n=this.x,r=this.y,i=this.z,o=t.elements;return this.x=o[0]*n+o[4]*r+o[8]*i,this.y=o[1]*n+o[5]*r+o[9]*i,this.z=o[2]*n+o[6]*r+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,n){return this.x=rt(this.x,t.x,n.x),this.y=rt(this.y,t.y,n.y),this.z=rt(this.z,t.z,n.z),this}clampScalar(t,n){return this.x=rt(this.x,t,n),this.y=rt(this.y,t,n),this.z=rt(this.z,t,n),this}clampLength(t,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(rt(r,t,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this}lerpVectors(t,n,r){return this.x=t.x+(n.x-t.x)*r,this.y=t.y+(n.y-t.y)*r,this.z=t.z+(n.z-t.z)*r,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,n){const r=t.x,i=t.y,o=t.z,s=n.x,a=n.y,c=n.z;return this.x=i*c-o*a,this.y=o*s-r*c,this.z=r*a-i*s,this}projectOnVector(t){const n=t.lengthSq();if(n===0)return this.set(0,0,0);const r=t.dot(this)/n;return this.copy(t).multiplyScalar(r)}projectOnPlane(t){return Bi.copy(this).projectOnVector(t),this.sub(Bi)}reflect(t){return this.sub(Bi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(t)/n;return Math.acos(rt(r,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return n*n+r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,n,r){const i=Math.sin(n)*t;return this.x=i*Math.sin(r),this.y=Math.cos(n)*t,this.z=i*Math.cos(r),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,n,r){return this.x=t*Math.sin(n),this.y=r,this.z=t*Math.cos(n),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(t){const n=this.setFromMatrixColumn(t,0).length(),r=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(t,n){return this.fromArray(t.elements,n*4)}setFromMatrix3Column(t,n){return this.fromArray(t.elements,n*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(t),this.y=n,this.z=r*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Bi=new sn,Va=new Ky;function ms(e,t,n){if(t.length!==e.length)return!0;for(let r=0;r<t.length;r++)if(Math.abs(t[r]-e[r])>n)return!1;return!0}function du(e,t,n){if(e===void 0&&t||e&&t===void 0||(e==null?void 0:e.orientation)===void 0||(t==null?void 0:t.orientation)===void 0||(e==null?void 0:e.position)===void 0||(t==null?void 0:t.position)===void 0)return!1;if(e===void 0||t===void 0)return!0;let r=0;return r+=Math.abs(e.orientation[0]-t.orientation[0]),r+=Math.abs(e.orientation[1]-t.orientation[1]),r+=Math.abs(e.orientation[2]-t.orientation[2]),r+=Math.abs(e.position[0]-t.position[0]),r+=Math.abs(e.position[1]-t.position[1]),r+=Math.abs(e.position[2]-t.position[2]),r<=n}function gs(e,t,n){return e.coordinate_system===t.coordinate_system&&e.tcp===t.tcp&&du(e.tcp_pose,t.tcp_pose,n)}function hu(e,t){const n=new Wi.Vector3(t[0],t[1],t[2]),r=new Wi.Vector3(e[0],e[1],e[2]),i=n.length(),o=n.normalize();let s=r.length(),a=r.normalize();a.dot(o)<0&&(s=-s,a=a.multiplyScalar(-1));let c=s-i;return c-=2*Math.PI*Math.floor((c+Math.PI)/(2*Math.PI)),s=i+c,[...a.multiplyScalar(s)]}const Ha=1e-4;class ai{constructor(t,n,r,i,o,s){this.nova=t,this.controller=n,this.motionGroup=r,this.description=i,this.initialMotionState=o,this.motionStateSocket=s,this.rapidlyChangingMotionState=o,s.addEventListener("message",a=>{var l;const c=(l=me.tryParseJson(a.data))==null?void 0:l.result;if(!c)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${a.data}`);ms(this.rapidlyChangingMotionState.joint_position,c.joint_position,Ha)||ae.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=c.joint_position}),gs(this.rapidlyChangingMotionState,c,Ha)||ae.runInAction(()=>{var u,d,h;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=c.tcp_pose:(u=c.tcp_pose)!=null&&u.orientation&&((d=c.tcp_pose)!=null&&d.position)&&((h=this.rapidlyChangingMotionState.tcp_pose)!=null&&h.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:c.tcp_pose.position,orientation:hu(c.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:console.warn("Received incomplete tcp_pose, ignoring",c.tcp_pose)}),this.rapidlyChangingMotionState.standstill!==c.standstill&&ae.runInAction(()=>{this.rapidlyChangingMotionState.standstill=c.standstill})}),ae.makeAutoObservable(this)}static async open(t,n){var d;const[r,i]=n.split("@"),o=await t.api.controller.getCurrentRobotControllerState(i),s=o==null?void 0:o.motion_groups.find(h=>h.motion_group===n);if(!o||!s)throw new Error(`Controller ${i} or motion group ${n} not found`);const a=t.openReconnectingWebsocket(`/controllers/${i}/motion-groups/${n}/state-stream`),c=await a.firstMessage(),l=(d=me.tryParseJson(c.data))==null?void 0:d.result;if(!l)throw new Error(`Unable to parse initial motion state message ${c.data}`);console.log(`Connected motion state websocket to motion group ${s.motion_group}. Initial state:
75
- `,l);const u=await t.api.motionGroup.getMotionGroupDescription(i,s.motion_group);return new ai(t,o,s,u,l,a)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get wandelscriptIdentifier(){const t=this.motionGroupId.split("@")[0];return`${this.controllerId.replace(/-/g,"_")}_${t}`}get joints(){return this.initialMotionState.joint_position.map((t,n)=>({index:n}))}dispose(){this.motionStateSocket.close()}}const Wa="Movement request rejected. Another client is currently executing a 'Jogging' motion!";class li{constructor(t,n={}){this.motionStream=t,this.options=n,this.ENDPOINT_JOGGING="/execution/jogging",this.ENDPOINT_TRAJECTORY="/execution/trajectory",this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",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)||t.motionGroup.tcp||this.DEFAULT_TCP,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(t,n,r={}){const i=await ai.open(t,n),o=new li(i,r);return await o.setJoggingMode(o.mode),o}async setOptions(t){t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),t.timeout&&(this.timeout=t.timeout),t.mode&&(this.mode=t.mode),t.onError&&(this.onError=t.onError),this.setJoggingMode(this.mode,!1)}get motionGroupId(){return this.motionStream.motionGroupId}get nova(){return this.motionStream.nova}get numJoints(){return this.motionStream.joints.length}async stop(){if(this.joggingSocket){const t=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:t})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const t=[this.joggingSocket,this.trajectorySocket].filter(n=>n!==null);return t.forEach(n=>{n.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(t.map(n=>n.closed()))}async setJoggingMode(t,n=!0){if(!(this.mode===t&&n)&&(this.dispose(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,n)=>{const r=setTimeout(()=>{n(new Error(`Jogging initialization timeout after ${this.timeout} seconds`))},this.timeout);this.joggingSocket=this.nova.openReconnectingWebsocket(this.ENDPOINT_JOGGING),this.joggingSocket.addEventListener("message",i=>{var s,a,c,l;const o=me.tryParseJson(i.data);if(((s=o==null?void 0:o.result)==null?void 0:s.kind)==="INITIALIZE_RECEIVED"){clearTimeout(r),t();return}if(((a=o==null?void 0:o.result)==null?void 0:a.kind)==="MOTION_ERROR")if(clearTimeout(r),this.onBlocked&&((c=o==null?void 0:o.result)!=null&&c.message.includes(Wa))){(l=this.joggingSocket)==null||l.dispose(),this.onBlocked();return}else this.onError?this.onError(i.data):n(new Error(i.data))}),this.joggingSocket.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,tcp:this.tcp})})}async rotateJoints({joint:t,direction:n,velocityRadsPerSec: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[t]=n==="-"?-r:r,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:i})}async translateTCP({axis:t,direction:n,velocityMmPerSec:r}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const i=[0,0,0],o=[0,0,0];o[me.XYZ_TO_VECTOR[t]]=n==="-"?-r:r,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:o,rotation:i,use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:n,velocityRadsPerSec:r}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");const i=[0,0,0],o=[0,0,0];i[me.XYZ_TO_VECTOR[t]]=n==="-"?-r:r,this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:o,rotation:i})}async runIncrementalCartesianMotion({currentTcpPose:t,currentJoints:n,velocityInRelevantUnits:r,axis:i,direction:o,motion:s}){const a=[];if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(s.type==="translate"){if(!t.position)throw new Error("Current pose has no position, cannot perform translation");const x=[...t.position];x[me.XYZ_TO_VECTOR[i]]+=s.distanceMm*(o==="-"?-1:1),a.push({limits_override:{tcp_velocity_limit:r},path:{path_definition_name:"PathLine",target_pose:{position:x,orientation:t.orientation}}})}else if(s.type==="rotate"){if(!t.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const x=new sn(t.orientation[0],t.orientation[1],t.orientation[2]),b=x.length(),S=x.clone().normalize(),v=s.distanceRads*(o==="-"?-1:1),_=new sn(0,0,0);_[i]=1;const C=Math.cos(.5*v)*Math.cos(.5*b),w=Math.sin(.5*v)*Math.sin(.5*b),E=Math.sin(.5*v)*Math.cos(.5*b),M=Math.cos(.5*v)*Math.sin(.5*b),j=_.dot(S),D=_.clone().cross(S),A=2*Math.acos(C-w*j),P=A/Math.sin(.5*A),I=new sn().addScaledVector(D,w).addScaledVector(_,E).addScaledVector(S,M).multiplyScalar(P);a.push({limits_override:{tcp_orientation_velocity_limit:r},path:{path_definition_name:"PathLine",target_pose:{position:t.position,orientation:[...I]}}})}const c=this.motionStream.description;if(c.cycle_time===void 0){console.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const l={motion_group_model:c.motion_group_model,cycle_time:c.cycle_time,mounting:c.mounting,global:c.operation_limits.auto_limits},u=await this.nova.api.trajectoryPlanning.planTrajectory({motion_group_setup:l,start_joint_position:n,motion_commands:a}),d=u.response;if(!d)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(u)}`);this.trajectorySocket&&(console.warn("Trajectory jogging websocket already open; will close"),this.trajectorySocket.dispose()),this.trajectorySocket=this.nova.openReconnectingWebsocket(this.ENDPOINT_TRAJECTORY);const h=x=>{var b;if(!x||x.add_trajectory_error||x.message)if(this.onError)this.onError(x);else throw new Error(((b=x==null?void 0:x.add_trajectory_error)==null?void 0:b.message)||(x==null?void 0:x.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"})},f=async()=>{var x;await ae.when(()=>!this.motionStream.rapidlyChangingMotionState.standstill),await ae.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(x=this.trajectorySocket)==null||x.dispose(),this.trajectorySocket=null},m=async()=>{var x;await ae.when(()=>this.motionStream.rapidlyChangingMotionState.standstill),(x=this.trajectorySocket)==null||x.dispose(),this.trajectorySocket=null},y=async x=>{if(x!=null&&x.message)if(this.onError){this.onError(x);return}else throw new Error(x.message||"Failed to execute trajectory, unknown error");this.motionStream.rapidlyChangingMotionState.standstill?await f():await m()};this.trajectorySocket.addEventListener("message",x=>{var S,v;const b=me.tryParseJson(x.data);if(!((S=b==null?void 0:b.result)!=null&&S.kind))throw new Error(`Failed to execute trajectory: Received invalid message ${x.data}`);if(this.onBlocked&&((v=b.result.message)!=null&&v.includes(Wa))){this.onBlocked();return}if(b.result.kind==="INITIALIZE_RECEIVED")h(b.result);else if(b.result.kind==="START_RECEIVED")y(b);else if(b.result.kind!=="PAUSE_RECEIVED")if(b.result.kind==="MOTION_ERROR"&&b.result.message)if(this.onError){this.onError(b);return}else throw new Error(b.result.message);else throw new Error(`Failed to execute trajectory, cannot handle message type "${b.result.kind}"`)}),this.trajectorySocket.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:d,tcp:this.tcp}})}}var Zy="[object AsyncFunction]",Qy="[object Function]",e1="[object GeneratorFunction]",t1="[object Proxy]";function fu(e){if(!$t(e))return!1;var t=Wt(e);return t==Qy||t==e1||t==Zy||t==t1}var Ui=Ze["__core-js_shared__"],qa=(function(){var e=/[^.]+$/.exec(Ui&&Ui.keys&&Ui.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function n1(e){return!!qa&&qa in e}var r1=Function.prototype,i1=r1.toString;function qt(e){if(e!=null){try{return i1.call(e)}catch{}try{return e+""}catch{}}return""}var o1=/[\\^$.*+?()[\]{}|]/g,s1=/^\[object .+?Constructor\]$/,a1=Function.prototype,l1=Object.prototype,c1=a1.toString,u1=l1.hasOwnProperty,d1=RegExp("^"+c1.call(u1).replace(o1,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h1(e){if(!$t(e)||n1(e))return!1;var t=fu(e)?d1:s1;return t.test(qt(e))}function f1(e,t){return e==null?void 0:e[t]}function Yt(e,t){var n=f1(e,t);return h1(n)?n:void 0}var Ya=(function(){try{var e=Yt(Object,"defineProperty");return e({},"",{}),e}catch{}})();function p1(e,t,n){t=="__proto__"&&Ya?Ya(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function m1(e,t,n,r){for(var i=-1,o=e==null?0:e.length;++i<o;){var s=e[i];t(r,s,n(s),e)}return r}function g1(e){return function(t,n,r){for(var i=-1,o=Object(t),s=r(t),a=s.length;a--;){var c=s[++i];if(n(o[c],c,o)===!1)break}return t}}var x1=g1();function y1(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var b1="[object Arguments]";function Ja(e){return zt(e)&&Wt(e)==b1}var pu=Object.prototype,v1=pu.hasOwnProperty,w1=pu.propertyIsEnumerable,mu=Ja((function(){return arguments})())?Ja:function(e){return zt(e)&&v1.call(e,"callee")&&!w1.call(e,"callee")},Xe=Array.isArray;function E1(){return!1}var gu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xa=gu&&typeof module=="object"&&module&&!module.nodeType&&module,S1=Xa&&Xa.exports===gu,Ka=S1?Ze.Buffer:void 0,T1=Ka?Ka.isBuffer:void 0,co=T1||E1,C1=9007199254740991,_1=/^(?:0|[1-9]\d*)$/;function xu(e,t){var n=typeof e;return t=t??C1,!!t&&(n=="number"||n!="symbol"&&_1.test(e))&&e>-1&&e%1==0&&e<t}var M1=9007199254740991;function xs(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=M1}var R1="[object Arguments]",j1="[object Array]",I1="[object Boolean]",A1="[object Date]",k1="[object Error]",O1="[object Function]",P1="[object Map]",D1="[object Number]",L1="[object Object]",$1="[object RegExp]",z1="[object Set]",N1="[object String]",F1="[object WeakMap]",G1="[object ArrayBuffer]",B1="[object DataView]",U1="[object Float32Array]",V1="[object Float64Array]",H1="[object Int8Array]",W1="[object Int16Array]",q1="[object Int32Array]",Y1="[object Uint8Array]",J1="[object Uint8ClampedArray]",X1="[object Uint16Array]",K1="[object Uint32Array]",ce={};ce[U1]=ce[V1]=ce[H1]=ce[W1]=ce[q1]=ce[Y1]=ce[J1]=ce[X1]=ce[K1]=!0;ce[R1]=ce[j1]=ce[G1]=ce[I1]=ce[B1]=ce[A1]=ce[k1]=ce[O1]=ce[P1]=ce[D1]=ce[L1]=ce[$1]=ce[z1]=ce[N1]=ce[F1]=!1;function Z1(e){return zt(e)&&xs(e.length)&&!!ce[Wt(e)]}function Q1(e){return function(t){return e(t)}}var yu=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mn=yu&&typeof module=="object"&&module&&!module.nodeType&&module,eb=Mn&&Mn.exports===yu,Vi=eb&&lu.process,Za=(function(){try{var e=Mn&&Mn.require&&Mn.require("util").types;return e||Vi&&Vi.binding&&Vi.binding("util")}catch{}})(),Qa=Za&&Za.isTypedArray,bu=Qa?Q1(Qa):Z1,tb=Object.prototype,nb=tb.hasOwnProperty;function rb(e,t){var n=Xe(e),r=!n&&mu(e),i=!n&&!r&&co(e),o=!n&&!r&&!i&&bu(e),s=n||r||i||o,a=s?y1(e.length,String):[],c=a.length;for(var l in e)nb.call(e,l)&&!(s&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||xu(l,c)))&&a.push(l);return a}var ib=Object.prototype;function ob(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||ib;return e===n}function sb(e,t){return function(n){return e(t(n))}}var ab=sb(Object.keys,Object),lb=Object.prototype,cb=lb.hasOwnProperty;function ub(e){if(!ob(e))return ab(e);var t=[];for(var n in Object(e))cb.call(e,n)&&n!="constructor"&&t.push(n);return t}function vu(e){return e!=null&&xs(e.length)&&!fu(e)}function ys(e){return vu(e)?rb(e):ub(e)}function db(e,t){return e&&x1(e,t,ys)}function hb(e,t){return function(n,r){if(n==null)return n;if(!vu(n))return e(n,r);for(var i=n.length,o=-1,s=Object(n);++o<i&&r(s[o],o,s)!==!1;);return n}}var fb=hb(db);function pb(e,t,n,r){return fb(e,function(i,o,s){t(r,i,n(i),s)}),r}function mb(){this.__data__=[],this.size=0}function wu(e,t){return e===t||e!==e&&t!==t}function ci(e,t){for(var n=e.length;n--;)if(wu(e[n][0],t))return n;return-1}var gb=Array.prototype,xb=gb.splice;function yb(e){var t=this.__data__,n=ci(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():xb.call(t,n,1),--this.size,!0}function bb(e){var t=this.__data__,n=ci(t,e);return n<0?void 0:t[n][1]}function vb(e){return ci(this.__data__,e)>-1}function wb(e,t){var n=this.__data__,r=ci(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function pt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pt.prototype.clear=mb;pt.prototype.delete=yb;pt.prototype.get=bb;pt.prototype.has=vb;pt.prototype.set=wb;function Eb(){this.__data__=new pt,this.size=0}function Sb(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Tb(e){return this.__data__.get(e)}function Cb(e){return this.__data__.has(e)}var Ln=Yt(Ze,"Map"),$n=Yt(Object,"create");function _b(){this.__data__=$n?$n(null):{},this.size=0}function Mb(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Rb="__lodash_hash_undefined__",jb=Object.prototype,Ib=jb.hasOwnProperty;function Ab(e){var t=this.__data__;if($n){var n=t[e];return n===Rb?void 0:n}return Ib.call(t,e)?t[e]:void 0}var kb=Object.prototype,Ob=kb.hasOwnProperty;function Pb(e){var t=this.__data__;return $n?t[e]!==void 0:Ob.call(t,e)}var Db="__lodash_hash_undefined__";function Lb(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=$n&&t===void 0?Db:t,this}function Nt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nt.prototype.clear=_b;Nt.prototype.delete=Mb;Nt.prototype.get=Ab;Nt.prototype.has=Pb;Nt.prototype.set=Lb;function $b(){this.size=0,this.__data__={hash:new Nt,map:new(Ln||pt),string:new Nt}}function zb(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ui(e,t){var n=e.__data__;return zb(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Nb(e){var t=ui(this,e).delete(e);return this.size-=t?1:0,t}function Fb(e){return ui(this,e).get(e)}function Gb(e){return ui(this,e).has(e)}function Bb(e,t){var n=ui(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function mt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}mt.prototype.clear=$b;mt.prototype.delete=Nb;mt.prototype.get=Fb;mt.prototype.has=Gb;mt.prototype.set=Bb;var Ub=200;function Vb(e,t){var n=this.__data__;if(n instanceof pt){var r=n.__data__;if(!Ln||r.length<Ub-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new mt(r)}return n.set(e,t),this.size=n.size,this}function st(e){var t=this.__data__=new pt(e);this.size=t.size}st.prototype.clear=Eb;st.prototype.delete=Sb;st.prototype.get=Tb;st.prototype.has=Cb;st.prototype.set=Vb;var Hb="__lodash_hash_undefined__";function Wb(e){return this.__data__.set(e,Hb),this}function qb(e){return this.__data__.has(e)}function $r(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new mt;++t<n;)this.add(e[t])}$r.prototype.add=$r.prototype.push=Wb;$r.prototype.has=qb;function Yb(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function Jb(e,t){return e.has(t)}var Xb=1,Kb=2;function Eu(e,t,n,r,i,o){var s=n&Xb,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var d=-1,h=!0,f=n&Kb?new $r:void 0;for(o.set(e,t),o.set(t,e);++d<a;){var m=e[d],y=t[d];if(r)var x=s?r(y,m,d,t,e,o):r(m,y,d,e,t,o);if(x!==void 0){if(x)continue;h=!1;break}if(f){if(!Yb(t,function(b,S){if(!Jb(f,S)&&(m===b||i(m,b,n,r,o)))return f.push(S)})){h=!1;break}}else if(!(m===y||i(m,y,n,r,o))){h=!1;break}}return o.delete(e),o.delete(t),h}var el=Ze.Uint8Array;function Zb(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}function Qb(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var ev=1,tv=2,nv="[object Boolean]",rv="[object Date]",iv="[object Error]",ov="[object Map]",sv="[object Number]",av="[object RegExp]",lv="[object Set]",cv="[object String]",uv="[object Symbol]",dv="[object ArrayBuffer]",hv="[object DataView]",tl=wt?wt.prototype:void 0,Hi=tl?tl.valueOf:void 0;function fv(e,t,n,r,i,o,s){switch(n){case hv:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case dv:return!(e.byteLength!=t.byteLength||!o(new el(e),new el(t)));case nv:case rv:case sv:return wu(+e,+t);case iv:return e.name==t.name&&e.message==t.message;case av:case cv:return e==t+"";case ov:var a=Zb;case lv:var c=r&ev;if(a||(a=Qb),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=tv,s.set(e,t);var u=Eu(a(e),a(t),r,i,o,s);return s.delete(e),u;case uv:if(Hi)return Hi.call(e)==Hi.call(t)}return!1}function pv(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function mv(e,t,n){var r=t(e);return Xe(e)?r:pv(r,n(e))}function gv(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}function xv(){return[]}var yv=Object.prototype,bv=yv.propertyIsEnumerable,nl=Object.getOwnPropertySymbols,vv=nl?function(e){return e==null?[]:(e=Object(e),gv(nl(e),function(t){return bv.call(e,t)}))}:xv;function rl(e){return mv(e,ys,vv)}var wv=1,Ev=Object.prototype,Sv=Ev.hasOwnProperty;function Tv(e,t,n,r,i,o){var s=n&wv,a=rl(e),c=a.length,l=rl(t),u=l.length;if(c!=u&&!s)return!1;for(var d=c;d--;){var h=a[d];if(!(s?h in t:Sv.call(t,h)))return!1}var f=o.get(e),m=o.get(t);if(f&&m)return f==t&&m==e;var y=!0;o.set(e,t),o.set(t,e);for(var x=s;++d<c;){h=a[d];var b=e[h],S=t[h];if(r)var v=s?r(S,b,h,t,e,o):r(b,S,h,e,t,o);if(!(v===void 0?b===S||i(b,S,n,r,o):v)){y=!1;break}x||(x=h=="constructor")}if(y&&!x){var _=e.constructor,C=t.constructor;_!=C&&"constructor"in e&&"constructor"in t&&!(typeof _=="function"&&_ instanceof _&&typeof C=="function"&&C instanceof C)&&(y=!1)}return o.delete(e),o.delete(t),y}var uo=Yt(Ze,"DataView"),ho=Yt(Ze,"Promise"),fo=Yt(Ze,"Set"),po=Yt(Ze,"WeakMap"),il="[object Map]",Cv="[object Object]",ol="[object Promise]",sl="[object Set]",al="[object WeakMap]",ll="[object DataView]",_v=qt(uo),Mv=qt(Ln),Rv=qt(ho),jv=qt(fo),Iv=qt(po),vt=Wt;(uo&&vt(new uo(new ArrayBuffer(1)))!=ll||Ln&&vt(new Ln)!=il||ho&&vt(ho.resolve())!=ol||fo&&vt(new fo)!=sl||po&&vt(new po)!=al)&&(vt=function(e){var t=Wt(e),n=t==Cv?e.constructor:void 0,r=n?qt(n):"";if(r)switch(r){case _v:return ll;case Mv:return il;case Rv:return ol;case jv:return sl;case Iv:return al}return t});var Av=1,cl="[object Arguments]",ul="[object Array]",lr="[object Object]",kv=Object.prototype,dl=kv.hasOwnProperty;function Ov(e,t,n,r,i,o){var s=Xe(e),a=Xe(t),c=s?ul:vt(e),l=a?ul:vt(t);c=c==cl?lr:c,l=l==cl?lr:l;var u=c==lr,d=l==lr,h=c==l;if(h&&co(e)){if(!co(t))return!1;s=!0,u=!1}if(h&&!u)return o||(o=new st),s||bu(e)?Eu(e,t,n,r,i,o):fv(e,t,c,n,r,i,o);if(!(n&Av)){var f=u&&dl.call(e,"__wrapped__"),m=d&&dl.call(t,"__wrapped__");if(f||m){var y=f?e.value():e,x=m?t.value():t;return o||(o=new st),i(y,x,n,r,o)}}return h?(o||(o=new st),Tv(e,t,n,r,i,o)):!1}function di(e,t,n,r,i){return e===t?!0:e==null||t==null||!zt(e)&&!zt(t)?e!==e&&t!==t:Ov(e,t,n,r,di,i)}var Pv=1,Dv=2;function Lv(e,t,n,r){var i=n.length,o=i;if(e==null)return!o;for(e=Object(e);i--;){var s=n[i];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=n[i];var a=s[0],c=e[a],l=s[1];if(s[2]){if(c===void 0&&!(a in e))return!1}else{var u=new st,d;if(!(d===void 0?di(l,c,Pv|Dv,r,u):d))return!1}}return!0}function Su(e){return e===e&&!$t(e)}function $v(e){for(var t=ys(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Su(i)]}return t}function Tu(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}function zv(e){var t=$v(e);return t.length==1&&t[0][2]?Tu(t[0][0],t[0][1]):function(n){return n===e||Lv(n,e,t)}}var Nv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fv=/^\w*$/;function bs(e,t){if(Xe(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||si(e)?!0:Fv.test(e)||!Nv.test(e)||t!=null&&e in Object(t)}var Gv="Expected a function";function vs(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Gv);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(vs.Cache||mt),n}vs.Cache=mt;var Bv=500;function Uv(e){var t=vs(e,function(r){return n.size===Bv&&n.clear(),r}),n=t.cache;return t}var Vv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hv=/\\(\\)?/g,Wv=Uv(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Vv,function(n,r,i,o){t.push(i?o.replace(Hv,"$1"):r||n)}),t});function qv(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var hl=wt?wt.prototype:void 0,fl=hl?hl.toString:void 0;function Cu(e){if(typeof e=="string")return e;if(Xe(e))return qv(e,Cu)+"";if(si(e))return fl?fl.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function _u(e){return e==null?"":Cu(e)}function Mu(e,t){return Xe(e)?e:bs(e,t)?[e]:Wv(_u(e))}function hi(e){if(typeof e=="string"||si(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Ru(e,t){t=Mu(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[hi(t[n++])];return n&&n==r?e:void 0}function Yv(e,t,n){var r=e==null?void 0:Ru(e,t);return r===void 0?n:r}function Jv(e,t){return e!=null&&t in Object(e)}function Xv(e,t,n){t=Mu(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=hi(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&xs(i)&&xu(s,i)&&(Xe(e)||mu(e)))}function Kv(e,t){return e!=null&&Xv(e,t,Jv)}var Zv=1,Qv=2;function ew(e,t){return bs(e)&&Su(t)?Tu(hi(e),t):function(n){var r=Yv(n,e);return r===void 0&&r===t?Kv(n,e):di(t,r,Zv|Qv)}}function tw(e){return e}function nw(e){return function(t){return t==null?void 0:t[e]}}function rw(e){return function(t){return Ru(t,e)}}function iw(e){return bs(e)?nw(hi(e)):rw(e)}function ow(e){return typeof e=="function"?e:e==null?tw:typeof e=="object"?Xe(e)?ew(e[0],e[1]):zv(e):iw(e)}function sw(e,t){return function(n,r){var i=Xe(n)?m1:pb,o={};return i(n,e,ow(r),o)}}var cr=sw(function(e,t,n){p1(e,n,t)}),aw=0;function lw(e){var t=++aw;return _u(e)+t}const mo=[{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}],cw=[{id:"continuous"},...mo],uw=["coordsys","tool"];class fi{constructor(t,n,r,i){var o,s;this.jogger=t,this.coordSystems=n,this.motionGroupDescription=r,this.tcps=i,this.selectedTabId="cartesian",this.activationState="inactive",this.activationError=null,this.activationCounter=0,this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.selectedTcpId="",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=[];for(const a of n)if(a.coordinate_system===""){a.coordinate_system="world";break}this.selectedCoordSystemId=((o=n[0])==null?void 0:o.coordinate_system)||"world",this.selectedTcpId=((s=i[0])==null?void 0:s.id)||"",ae.makeAutoObservable(this,{},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()},this.loadFromLocalStorage(),this.disposers.push(ae.autorun(()=>this.saveToLocalStorage())),window.joggingStore=this}static async loadFor(t){const{nova:n}=t,[r,i]=await Promise.all([n.api.controller.listCoordinateSystems(t.motionStream.controllerId,"ROTATION_VECTOR"),n.api.motionGroup.getMotionGroupDescription(t.motionStream.controllerId,t.motionGroupId)]),o=Object.entries(i.tcps||{}).map(([s,a])=>({id:s,readable_name:a.name,position:a.pose.position,orientation:a.pose.orientation}));return new fi(t,r||[],i,o)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return Sl.countBy(this.coordSystems,t=>t.name)}async deactivate(){if(this.jogger.mode==="jogging")return this.jogger.stop()}async activate(){return this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&this.jogger.setOptions({tcp:this.selectedTcpId,orientation:this.selectedOrientation}),this.activeDiscreteIncrement?this.jogger.setJoggingMode("trajectory"):this.jogger.setJoggingMode("jogging")):this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){const t=me.tryParseJson(localStorage.getItem("joggingToolStore"));t&&(this.tabsById[t.selectedTabId]&&(this.selectedTabId=t.selectedTabId),this.coordSystemsById[t.selectedCoordSystemId]&&(this.selectedCoordSystemId=t.selectedCoordSystemId),this.tcpsById[t.selectedTcpId]&&(this.selectedTcpId=t.selectedTcpId),this.incrementOptionsById[t.selectedIncrementId]&&(this.selectedIncrementId=t.selectedIncrementId),["translate","rotate"].includes(t.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=t.selectedCartesianMotionType),["coordsys","tool"].includes(t.selectedOrientation)&&(this.selectedOrientation=t.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,selectedTcpId:this.selectedTcpId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get tabs(){return[{id:"cartesian",label:"cartesian"},{id:"joint",label:"joint"}]}get incrementOptions(){return cw}get discreteIncrementOptions(){return mo}get incrementOptionsById(){return cr(this.incrementOptions,t=>t.id)}get tabsById(){return cr(this.tabs,t=>t.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return cr(this.coordSystems,t=>t.coordinate_system)}get selectedCoordSystem(){return this.coordSystemsById[this.selectedCoordSystemId]}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return cr(this.tcps,t=>t.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:mo.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}get velocityInDisplayUnits(){return this.currentMotionType==="translate"?this.translationVelocityMmPerSec:this.rotationVelocityDegPerSec}get minVelocityInDisplayUnits(){return this.currentMotionType==="translate"?this.minTranslationVelocityMmPerSec:this.minRotationVelocityDegPerSec}get maxVelocityInDisplayUnits(){return this.currentMotionType==="translate"?this.maxTranslationVelocityMmPerSec:this.maxRotationVelocityDegPerSec}get currentMotionType(){return this.selectedTabId==="cartesian"&&this.selectedCartesianMotionType==="translate"?"translate":"rotate"}onTabChange(t,n){const r=this.tabs[n]||this.tabs[0];this.selectedTabId=r.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.selectedTcpId=t}setSelectedOrientation(t){this.selectedOrientation=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setVelocityFromSlider(t){this.currentMotionType==="translate"?this.translationVelocityMmPerSec=t:this.rotationVelocityDegPerSec=t}setSelectedCartesianMotionType(t){this.selectedCartesianMotionType=t}lock(t){this.locks.add(t)}unlock(t){this.locks.delete(t)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket()}async withMotionLock(t){const n=lw();this.lock(n);try{return await t()}finally{this.unlock(n)}}}const dw=re.observer(({store:e})=>{const{t}=le.useTranslation();return p.jsxRuntimeExports.jsx(T.Backdrop,{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:p.jsxRuntimeExports.jsxs(T.Stack,{sx:{m:2,width:"100%"},children:[p.jsxRuntimeExports.jsxs(T.Alert,{severity:"error",sx:{mb:2},children:[p.jsxRuntimeExports.jsx(T.AlertTitle,{children:t("Jogging.Blocked.ti")}),t("Jogging.Blocked.lb")]}),p.jsxRuntimeExports.jsx(T.Button,{variant:"contained",color:"secondary",onClick:()=>e.unblock(),children:t("Jogging.Blocked.Reenable.bt")})]})})}),hw=({title:e,titleId:t,...n},r)=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),fw=O.forwardRef(hw),pw=({title:e,titleId:t,...n},r)=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:19,height:10,fill:"none",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M5.131.312a.9.9 0 0 1 0 1.272L3.07 3.645h12.44l-2.06-2.061A.9.9 0 0 1 14.72.313l3.596 3.596a.9.9 0 0 1 0 1.271l-3.596 3.597a.9.9 0 0 1-1.271-1.272l2.061-2.062H3.07L5.13 7.505A.9.9 0 0 1 3.86 8.777L.263 5.18a.9.9 0 0 1 0-1.271L3.86.312a.9.9 0 0 1 1.271 0",clipRule:"evenodd"})),mw=O.forwardRef(pw),gw=({title:e,titleId:t,...n},r)=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:19,fill:"none",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M9.522 14.811A.899.899 0 1 0 8.25 13.54L6.19 15.601V3.16L8.25 5.221A.9.9 0 0 0 9.522 3.95L5.926.354a.9.9 0 0 0-1.272 0L1.058 3.95a.9.9 0 1 0 1.271 1.271L4.391 3.16v12.442L2.329 13.54a.899.899 0 1 0-1.271 1.271l3.596 3.597a.9.9 0 0 0 1.272 0z",clipRule:"evenodd"})),xw=O.forwardRef(gw),yw=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C11.0583 14.1 12.5083 12.1667 11.475 12.9L12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z",fill:"white"})),bw=O.forwardRef(yw);function vw(e,t){return di(e,t)}const ju=({store:e})=>{const{t}=le.useTranslation(),[n,r]=O.useState(e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),i=O.useRef(n);se.useAnimationFrame(()=>{const s=e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;vw(i.current,s)||(i.current=s,r(s))});const o=[];for(const[s,a]of n.entries())a&&o.push(s);return p.jsxRuntimeExports.jsx(T.Typography,{color:"error",sx:{margin:"0.5rem 1rem",textAlign:"center",minHeight:"1.5rem",visibility:o.length?"visible":"hidden"},children:t("Jogging.JointLimitsReached.lb",{jointNumbers:o.map(s=>s+1).join(", ")})})},ww=T.styled(T.FormControl)(({theme:e})=>({"&.MuiFormControl-root":{".MuiSelect-select":{paddingTop:"20px",paddingLeft:"12px"},label:{pointerEvents:"none",fontSize:"16px"},".MuiInputLabel-root":{"&.Mui-focused":{color:e.palette.text.primary}}}}));function ur({labelValue:e,...t}){return p.jsxRuntimeExports.jsxs(ww,{fullWidth:!0,variant:"filled",children:[p.jsxRuntimeExports.jsx(T.InputLabel,{id:t.labelId,children:e}),p.jsxRuntimeExports.jsx(T.Select,{...t})]})}const Ew=re.observer(({store:e})=>{var o;const{t}=le.useTranslation(),n=O.useId(),r=[];function i(s){switch(s){case"coordsys":return t("Jogging.Orientation.coordsys");case"tool":return t("Jogging.Orientation.tool");default:return s}}return e.showCoordSystemSelect&&r.push(p.jsxRuntimeExports.jsx(ur,{labelId:`jogging-coord-select-${n}`,labelValue:t("Jogging.CoordinateSystem.hlb"),value:e.selectedCoordSystemId,size:"small",variant:"filled",displayEmpty:!0,onChange:s=>e.setSelectedCoordSystemId(s.target.value),disabled:e.isLocked,children:e.coordSystems.map(s=>p.jsxRuntimeExports.jsx(T.MenuItem,{value:s.coordinate_system,children:s.name&&e.coordSystemCountByName[s.name]>1?`${s.name} / ${s.coordinate_system}`:s.name||s.coordinate_system},s.coordinate_system))},"coord")),e.showTcpSelect&&r.push(p.jsxRuntimeExports.jsx(ur,{labelId:`jogging-tcp-select-${n}`,labelValue:"TCP",value:e.selectedTcpId,size:"small",variant:"filled",onChange:s=>e.setSelectedTcpId(s.target.value),disabled:e.isLocked,children:e.tcps.map(s=>p.jsxRuntimeExports.jsx(T.MenuItem,{value:s.id,children:s.id},s.id))},"tcp")),e.showOrientationSelect&&r.push(p.jsxRuntimeExports.jsx(ur,{labelValue:t("Jogging.Cartesian.Orientation.lb"),labelId:`orientation-select-${n}`,value:e.selectedOrientation,onChange:s=>e.setSelectedOrientation(s.target.value),disabled:e.isLocked,children:uw.map(s=>p.jsxRuntimeExports.jsx(T.MenuItem,{value:s,children:i(s)},s))},"orientation")),e.showIncrementSelect&&r.push(p.jsxRuntimeExports.jsxs(ur,{labelValue:t("Jogging.Increment.hlb"),labelId:`jogging-increment-select-${n}`,size:"small",variant:"filled",value:((o=e.activeDiscreteIncrement)==null?void 0:o.id)||"continuous",onChange:s=>e.setSelectedIncrementId(s.target.value),disabled:e.isLocked,children:[p.jsxRuntimeExports.jsx(T.MenuItem,{value:"continuous",children:t("Jogging.Increment.Continuous.dd")},"continuous"),e.selectedOrientation==="tool"?null:e.discreteIncrementOptions.map(s=>p.jsxRuntimeExports.jsx(T.MenuItem,{value:s.id,children:e.currentMotionType==="translate"?`${s.mm}mm`:`${s.degrees}°`},s.id))]},"increment")),p.jsxRuntimeExports.jsx(T.Box,{component:"div",sx:{display:"grid",gap:"16px",gridTemplateColumns:"1fr 1fr",gridAutoRows:"min-content","& label":{opacity:.7,fontSize:"12px",marginBottom:"4px"}},children:r.map((s,a)=>p.jsxRuntimeExports.jsx(T.Box,{sx:{gridColumn:r.length%2===1&&a===r.length-1?"span 2":"auto"},children:s},a))})}),Sw=T.styled(T.ToggleButtonGroup)(({theme:e})=>{var t;return{"&.MuiToggleButtonGroup-root":{background:(t=e.palette.backgroundPaperElevation)==null?void 0:t[8],borderRadius:"8px",padding:"4px",gap:"4px",button:{border:"none",borderRadius:"4px",flex:"1 1 0px",minWidth:0,"&.MuiToggleButtonGroup-firstButton":{borderRadius:"8px 4px 4px 8px"},"&.MuiToggleButtonGroup-lastButton":{borderRadius:"4px 8px 8px 4px"}}}}});function pl(e,t){return process.env.NODE_ENV==="production"?()=>null:function(...r){return e(...r)||t(...r)}}function Rn(e){return typeof e=="string"}function Tw(e,t,n){return e===void 0||Rn(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function yr(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function ml(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function Cw(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:i,className:o}=e;if(!t){const f=p.clsx(n==null?void 0:n.className,o,i==null?void 0:i.className,r==null?void 0:r.className),m={...n==null?void 0:n.style,...i==null?void 0:i.style,...r==null?void 0:r.style},y={...n,...i,...r};return f.length>0&&(y.className=f),Object.keys(m).length>0&&(y.style=m),{props:y,internalRef:void 0}}const s=yr({...i,...r}),a=ml(r),c=ml(i),l=t(s),u=p.clsx(l==null?void 0:l.className,n==null?void 0:n.className,o,i==null?void 0:i.className,r==null?void 0:r.className),d={...l==null?void 0:l.style,...n==null?void 0:n.style,...i==null?void 0:i.style,...r==null?void 0:r.style},h={...l,...n,...c,...a};return u.length>0&&(h.className=u),Object.keys(d).length>0&&(h.style=d),{props:h,internalRef:l.ref}}function _w(e,t,n){return typeof e=="function"?e(t,n):e}function yt(e){var d;const{elementType:t,externalSlotProps:n,ownerState:r,skipResolvingSlotProps:i=!1,...o}=e,s=i?{}:_w(n,r),{props:a,internalRef:c}=Cw({...o,externalSlotProps:s}),l=Gr(c,s==null?void 0:s.ref,(d=e.additionalProps)==null?void 0:d.ref);return Tw(t,{...a,ref:l},r)}function gl(e){try{return e.matches(":focus-visible")}catch{process.env.NODE_ENV!=="production"&&!window.navigator.userAgent.includes("jsdom")&&console.warn(["MUI: The `:focus-visible` pseudo class is not supported in this browser.","Some components rely on this feature to work properly."].join(`
76
- `))}return!1}const Mw={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function Rw(e,t,n=(r,i)=>r===i){return e.length===t.length&&e.every((r,i)=>n(r,t[i]))}const jw=2;function Qt(e,t,n,r,i){return n===1?Math.min(e+t,i):Math.max(e-t,r)}function Iu(e,t){return e-t}function xl(e,t){const{index:n}=e.reduce((r,i,o)=>{const s=Math.abs(t-i);return r===null||s<r.distance||s===r.distance?{distance:s,index:o}:r},null)??{};return n}function dr(e,t){if(t.current!==void 0&&e.changedTouches){const n=e;for(let r=0;r<n.changedTouches.length;r+=1){const i=n.changedTouches[r];if(i.identifier===t.current)return{x:i.clientX,y:i.clientY}}return!1}return{x:e.clientX,y:e.clientY}}function zr(e,t,n){return(e-t)*100/(n-t)}function Iw(e,t,n){return(n-t)*e+t}function Aw(e){if(Math.abs(e)<1){const n=e.toExponential().split("e-"),r=n[0].split(".")[1];return(r?r.length:0)+parseInt(n[1],10)}const t=e.toString().split(".")[1];return t?t.length:0}function kw(e,t,n){const r=Math.round((e-n)/t)*t+n;return Number(r.toFixed(Aw(t)))}function yl({values:e,newValue:t,index:n}){const r=e.slice();return r[n]=t,r.sort(Iu)}function hr({sliderRef:e,activeIndex:t,setActive:n}){var i,o,s;const r=Cn(e.current);(!((i=e.current)!=null&&i.contains(r.activeElement))||Number((o=r==null?void 0:r.activeElement)==null?void 0:o.getAttribute("data-index"))!==t)&&((s=e.current)==null||s.querySelector(`[type="range"][data-index="${t}"]`).focus()),n&&n(t)}function fr(e,t){return typeof e=="number"&&typeof t=="number"?e===t:typeof e=="object"&&typeof t=="object"?Rw(e,t):!1}const Ow={horizontal:{offset:e=>({left:`${e}%`}),leap:e=>({width:`${e}%`})},"horizontal-reverse":{offset:e=>({right:`${e}%`}),leap:e=>({width:`${e}%`})},vertical:{offset:e=>({bottom:`${e}%`}),leap:e=>({height:`${e}%`})}},Pw=e=>e;let pr;function bl(){return pr===void 0&&(typeof CSS<"u"&&typeof CSS.supports=="function"?pr=CSS.supports("touch-action","none"):pr=!0),pr}function Dw(e){const{"aria-labelledby":t,defaultValue:n,disabled:r=!1,disableSwap:i=!1,isRtl:o=!1,marks:s=!1,max:a=100,min:c=0,name:l,onChange:u,onChangeCommitted:d,orientation:h="horizontal",rootRef:f,scale:m=Pw,step:y=1,shiftStep:x=10,tabIndex:b,value:S}=e,v=R.useRef(void 0),[_,C]=R.useState(-1),[w,E]=R.useState(-1),[M,j]=R.useState(!1),D=R.useRef(0),A=R.useRef(null),[P,I]=gy({controlled:S,default:n??c,name:"Slider"}),k=u&&(($,B,H)=>{const ee=$.nativeEvent||$,oe=new ee.constructor(ee.type,ee);Object.defineProperty(oe,"target",{writable:!0,value:{value:B,name:l}}),A.current=B,u(oe,B,H)}),U=Array.isArray(P);let N=U?P.slice().sort(Iu):[P];N=N.map($=>$==null?c:p.clamp($,c,a));const Y=s===!0&&y!==null?[...Array(Math.floor((a-c)/y)+1)].map(($,B)=>({value:c+y*B})):s||[],F=Y.map($=>$.value),[J,ie]=R.useState(-1),Z=R.useRef(null),_e=Gr(f,Z),Qe=$=>B=>{var ee;const H=Number(B.currentTarget.getAttribute("data-index"));gl(B.target)&&ie(H),E(H),(ee=$==null?void 0:$.onFocus)==null||ee.call($,B)},et=$=>B=>{var H;gl(B.target)||ie(-1),E(-1),(H=$==null?void 0:$.onBlur)==null||H.call($,B)},Se=($,B)=>{const H=Number($.currentTarget.getAttribute("data-index")),ee=N[H],oe=F.indexOf(ee);let q=B;if(Y&&y==null){const ye=F[F.length-1];q>=ye?q=ye:q<=F[0]?q=F[0]:q=q<ee?F[oe-1]:F[oe+1]}if(q=p.clamp(q,c,a),U){i&&(q=p.clamp(q,N[H-1]||-1/0,N[H+1]||1/0));const ye=q;q=yl({values:N,newValue:q,index:H});let Ce=H;i||(Ce=q.indexOf(ye)),hr({sliderRef:Z,activeIndex:Ce})}I(q),ie(H),k&&!fr(q,P)&&k($,q,H),d&&d($,A.current??q)},tt=$=>B=>{var H;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(B.key)){B.preventDefault();const ee=Number(B.currentTarget.getAttribute("data-index")),oe=N[ee];let q=null;if(y!=null){const ye=B.shiftKey?x:y;switch(B.key){case"ArrowUp":q=Qt(oe,ye,1,c,a);break;case"ArrowRight":q=Qt(oe,ye,o?-1:1,c,a);break;case"ArrowDown":q=Qt(oe,ye,-1,c,a);break;case"ArrowLeft":q=Qt(oe,ye,o?1:-1,c,a);break;case"PageUp":q=Qt(oe,x,1,c,a);break;case"PageDown":q=Qt(oe,x,-1,c,a);break;case"Home":q=c;break;case"End":q=a;break}}else if(Y){const ye=F[F.length-1],Ce=F.indexOf(oe),he=[o?"ArrowRight":"ArrowLeft","ArrowDown","PageDown","Home"],ke=[o?"ArrowLeft":"ArrowRight","ArrowUp","PageUp","End"];he.includes(B.key)?Ce===0?q=F[0]:q=F[Ce-1]:ke.includes(B.key)&&(Ce===F.length-1?q=ye:q=F[Ce+1])}q!=null&&Se(B,q)}(H=$==null?void 0:$.onKeyDown)==null||H.call($,B)};p.useEnhancedEffect(()=>{var $;r&&Z.current.contains(document.activeElement)&&(($=document.activeElement)==null||$.blur())},[r]),r&&_!==-1&&C(-1),r&&J!==-1&&ie(-1);const Ue=$=>B=>{var H;(H=$.onChange)==null||H.call($,B),Se(B,B.target.valueAsNumber)},Ie=R.useRef(void 0);let G=h;o&&h==="horizontal"&&(G+="-reverse");const W=({finger:$,move:B=!1})=>{const{current:H}=Z,{width:ee,height:oe,bottom:q,left:ye}=H.getBoundingClientRect();let Ce;G.startsWith("vertical")?Ce=(q-$.y)/oe:Ce=($.x-ye)/ee,G.includes("-reverse")&&(Ce=1-Ce);let he;if(he=Iw(Ce,c,a),y)he=kw(he,y,c);else{const xn=xl(F,he);he=F[xn]}he=p.clamp(he,c,a);let ke=0;if(U){B?ke=Ie.current:ke=xl(N,he),i&&(he=p.clamp(he,N[ke-1]||-1/0,N[ke+1]||1/0));const xn=he;he=yl({values:N,newValue:he,index:ke}),i&&B||(ke=he.indexOf(xn),Ie.current=ke)}return{newValue:he,activeIndex:ke}},K=Ye($=>{const B=dr($,v);if(!B)return;if(D.current+=1,$.type==="mousemove"&&$.buttons===0){L($);return}const{newValue:H,activeIndex:ee}=W({finger:B,move:!0});hr({sliderRef:Z,activeIndex:ee,setActive:C}),I(H),!M&&D.current>jw&&j(!0),k&&!fr(H,P)&&k($,H,ee)}),L=Ye($=>{const B=dr($,v);if(j(!1),!B)return;const{newValue:H}=W({finger:B,move:!0});C(-1),$.type==="touchend"&&E(-1),d&&d($,A.current??H),v.current=void 0,Q()}),ne=Ye($=>{if(r)return;bl()||$.preventDefault();const B=$.changedTouches[0];B!=null&&(v.current=B.identifier);const H=dr($,v);if(H!==!1){const{newValue:oe,activeIndex:q}=W({finger:H});hr({sliderRef:Z,activeIndex:q,setActive:C}),I(oe),k&&!fr(oe,P)&&k($,oe,q)}D.current=0;const ee=Cn(Z.current);ee.addEventListener("touchmove",K,{passive:!0}),ee.addEventListener("touchend",L,{passive:!0})}),Q=R.useCallback(()=>{const $=Cn(Z.current);$.removeEventListener("mousemove",K),$.removeEventListener("mouseup",L),$.removeEventListener("touchmove",K),$.removeEventListener("touchend",L)},[L,K]);R.useEffect(()=>{const{current:$}=Z;return $.addEventListener("touchstart",ne,{passive:bl()}),()=>{$.removeEventListener("touchstart",ne),Q()}},[Q,ne]),R.useEffect(()=>{r&&Q()},[r,Q]);const we=$=>B=>{var oe;if((oe=$.onMouseDown)==null||oe.call($,B),r||B.defaultPrevented||B.button!==0)return;B.preventDefault();const H=dr(B,v);if(H!==!1){const{newValue:q,activeIndex:ye}=W({finger:H});hr({sliderRef:Z,activeIndex:ye,setActive:C}),I(q),k&&!fr(q,P)&&k(B,q,ye)}D.current=0;const ee=Cn(Z.current);ee.addEventListener("mousemove",K,{passive:!0}),ee.addEventListener("mouseup",L)},xe=zr(U?N[0]:c,c,a),ue=zr(N[N.length-1],c,a)-xe,gt=($={})=>{const B=yr($),H={onMouseDown:we(B||{})},ee={...B,...H};return{...$,ref:_e,...ee}},Hn=$=>B=>{var ee;(ee=$.onMouseOver)==null||ee.call($,B);const H=Number(B.currentTarget.getAttribute("data-index"));E(H)},Wn=$=>B=>{var H;(H=$.onMouseLeave)==null||H.call($,B),E(-1)},qn=($={})=>{const B=yr($),H={onMouseOver:Hn(B||{}),onMouseLeave:Wn(B||{})};return{...$,...B,...H}},Yn=$=>({pointerEvents:_!==-1&&_!==$?"none":void 0});let Jt;return h==="vertical"&&(Jt=o?"vertical-rl":"vertical-lr"),{active:_,axis:G,axisProps:Ow,dragging:M,focusedThumbIndex:J,getHiddenInputProps:($={})=>{const B=yr($),H={onChange:Ue(B||{}),onFocus:Qe(B||{}),onBlur:et(B||{}),onKeyDown:tt(B||{})},ee={...B,...H};return{tabIndex:b,"aria-labelledby":t,"aria-orientation":h,"aria-valuemax":m(a),"aria-valuemin":m(c),name:l,type:"range",min:e.min,max:e.max,step:e.step===null&&e.marks?"any":e.step??void 0,disabled:r,...$,...ee,style:{...Mw,direction:o?"rtl":"ltr",width:"100%",height:"100%",writingMode:Jt}}},getRootProps:gt,getThumbProps:qn,marks:Y,open:w,range:U,rootRef:_e,trackLeap:ue,trackOffset:xe,values:N,getThumbStyle:Yn}}const Lw=e=>!e||!Rn(e);function $w(e){return typeof e.main=="string"}function zw(e,t=[]){if(!$w(e))return!1;for(const n of t)if(!e.hasOwnProperty(n)||typeof e[n]!="string")return!1;return!0}function ws(e=[]){return([,t])=>t&&zw(t,e)}function Nw(e){return p.generateUtilityClass("MuiSlider",e)}const $e=Fr("MuiSlider",["root","active","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","disabled","dragging","focusVisible","mark","markActive","marked","markLabel","markLabelActive","rail","sizeSmall","thumb","thumbColorPrimary","thumbColorSecondary","thumbColorError","thumbColorSuccess","thumbColorInfo","thumbColorWarning","track","trackInverted","trackFalse","thumbSizeSmall","valueLabel","valueLabelOpen","valueLabelCircle","valueLabelLabel","vertical"]),Fw=e=>{const{open:t}=e;return{offset:p.clsx(t&&$e.valueLabelOpen),circle:$e.valueLabelCircle,label:$e.valueLabelLabel}};function Au(e){const{children:t,className:n,value:r}=e,i=Fw(e);return t?R.cloneElement(t,{className:t.props.className},p.jsxRuntimeExports.jsxs(R.Fragment,{children:[t.props.children,p.jsxRuntimeExports.jsx("span",{className:p.clsx(i.offset,n),"aria-hidden":!0,children:p.jsxRuntimeExports.jsx("span",{className:i.circle,children:p.jsxRuntimeExports.jsx("span",{className:i.label,children:r})})})]})):null}process.env.NODE_ENV!=="production"&&(Au.propTypes={children:g.element.isRequired,className:g.string,value:g.node});function vl(e){return e}const Gw=Ae("span",{name:"MuiSlider",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`color${p.capitalize(n.color)}`],n.size!=="medium"&&t[`size${p.capitalize(n.size)}`],n.marked&&t.marked,n.orientation==="vertical"&&t.vertical,n.track==="inverted"&&t.trackInverted,n.track===!1&&t.trackFalse]}})(Ht(({theme:e})=>({borderRadius:12,boxSizing:"content-box",display:"inline-block",position:"relative",cursor:"pointer",touchAction:"none",WebkitTapHighlightColor:"transparent","@media print":{colorAdjust:"exact"},[`&.${$e.disabled}`]:{pointerEvents:"none",cursor:"default",color:(e.vars||e).palette.grey[400]},[`&.${$e.dragging}`]:{[`& .${$e.thumb}, & .${$e.track}`]:{transition:"none"}},variants:[...Object.entries(e.palette).filter(ws()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),{props:{orientation:"horizontal"},style:{height:4,width:"100%",padding:"13px 0","@media (pointer: coarse)":{padding:"20px 0"}}},{props:{orientation:"horizontal",size:"small"},style:{height:2}},{props:{orientation:"horizontal",marked:!0},style:{marginBottom:20}},{props:{orientation:"vertical"},style:{height:"100%",width:4,padding:"0 13px","@media (pointer: coarse)":{padding:"0 20px"}}},{props:{orientation:"vertical",size:"small"},style:{width:2}},{props:{orientation:"vertical",marked:!0},style:{marginRight:44}}]}))),Bw=Ae("span",{name:"MuiSlider",slot:"Rail"})({display:"block",position:"absolute",borderRadius:"inherit",backgroundColor:"currentColor",opacity:.38,variants:[{props:{orientation:"horizontal"},style:{width:"100%",height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{height:"100%",width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:"inverted"},style:{opacity:1}}]}),Uw=Ae("span",{name:"MuiSlider",slot:"Track"})(Ht(({theme:e})=>({display:"block",position:"absolute",borderRadius:"inherit",border:"1px solid currentColor",backgroundColor:"currentColor",transition:e.transitions.create(["left","width","bottom","height"],{duration:e.transitions.duration.shortest}),variants:[{props:{size:"small"},style:{border:"none"}},{props:{orientation:"horizontal"},style:{height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:!1},style:{display:"none"}},...Object.entries(e.palette).filter(ws()).map(([t])=>({props:{color:t,track:"inverted"},style:{...e.vars?{backgroundColor:e.vars.palette.Slider[`${t}Track`],borderColor:e.vars.palette.Slider[`${t}Track`]}:{backgroundColor:e.lighten(e.palette[t].main,.62),borderColor:e.lighten(e.palette[t].main,.62),...e.applyStyles("dark",{backgroundColor:e.darken(e.palette[t].main,.5)}),...e.applyStyles("dark",{borderColor:e.darken(e.palette[t].main,.5)})}}}))]}))),Vw=Ae("span",{name:"MuiSlider",slot:"Thumb",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.thumb,t[`thumbColor${p.capitalize(n.color)}`],n.size!=="medium"&&t[`thumbSize${p.capitalize(n.size)}`]]}})(Ht(({theme:e})=>({position:"absolute",width:20,height:20,boxSizing:"border-box",borderRadius:"50%",outline:0,backgroundColor:"currentColor",display:"flex",alignItems:"center",justifyContent:"center",transition:e.transitions.create(["box-shadow","left","bottom"],{duration:e.transitions.duration.shortest}),"&::before":{position:"absolute",content:'""',borderRadius:"inherit",width:"100%",height:"100%",boxShadow:(e.vars||e).shadows[2]},"&::after":{position:"absolute",content:'""',borderRadius:"50%",width:42,height:42,top:"50%",left:"50%",transform:"translate(-50%, -50%)"},[`&.${$e.disabled}`]:{"&:hover":{boxShadow:"none"}},variants:[{props:{size:"small"},style:{width:12,height:12,"&::before":{boxShadow:"none"}}},{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-50%, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 50%)"}},...Object.entries(e.palette).filter(ws()).map(([t])=>({props:{color:t},style:{[`&:hover, &.${$e.focusVisible}`]:{boxShadow:`0px 0px 0px 8px ${e.alpha((e.vars||e).palette[t].main,.16)}`,"@media (hover: none)":{boxShadow:"none"}},[`&.${$e.active}`]:{boxShadow:`0px 0px 0px 14px ${e.alpha((e.vars||e).palette[t].main,.16)}`}}}))]}))),ku=Ae(Au,{name:"MuiSlider",slot:"ValueLabel"})(Ht(({theme:e})=>({zIndex:1,whiteSpace:"nowrap",...e.typography.body2,fontWeight:500,transition:e.transitions.create(["transform"],{duration:e.transitions.duration.shortest}),position:"absolute",backgroundColor:(e.vars||e).palette.grey[600],borderRadius:2,color:(e.vars||e).palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",padding:"0.25rem 0.75rem",variants:[{props:{orientation:"horizontal"},style:{transform:"translateY(-100%) scale(0)",top:"-10px",transformOrigin:"bottom center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, 50%) rotate(45deg)",backgroundColor:"inherit",bottom:0,left:"50%"},[`&.${$e.valueLabelOpen}`]:{transform:"translateY(-100%) scale(1)"}}},{props:{orientation:"vertical"},style:{transform:"translateY(-50%) scale(0)",right:"30px",top:"50%",transformOrigin:"right center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, -50%) rotate(45deg)",backgroundColor:"inherit",right:-8,top:"50%"},[`&.${$e.valueLabelOpen}`]:{transform:"translateY(-50%) scale(1)"}}},{props:{size:"small"},style:{fontSize:e.typography.pxToRem(12),padding:"0.25rem 0.5rem"}},{props:{orientation:"vertical",size:"small"},style:{right:"20px"}}]})));process.env.NODE_ENV!=="production"&&(ku.propTypes={children:g.element.isRequired,index:g.number.isRequired,open:g.bool.isRequired,value:g.node});const Hw=Ae("span",{name:"MuiSlider",slot:"Mark",shouldForwardProp:e=>go(e)&&e!=="markActive",overridesResolver:(e,t)=>{const{markActive:n}=e;return[t.mark,n&&t.markActive]}})(Ht(({theme:e})=>({position:"absolute",width:2,height:2,borderRadius:1,backgroundColor:"currentColor",variants:[{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-1px, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 1px)"}},{props:{markActive:!0},style:{backgroundColor:(e.vars||e).palette.background.paper,opacity:.8}}]}))),Ww=Ae("span",{name:"MuiSlider",slot:"MarkLabel",shouldForwardProp:e=>go(e)&&e!=="markLabelActive"})(Ht(({theme:e})=>({...e.typography.body2,color:(e.vars||e).palette.text.secondary,position:"absolute",whiteSpace:"nowrap",variants:[{props:{orientation:"horizontal"},style:{top:30,transform:"translateX(-50%)","@media (pointer: coarse)":{top:40}}},{props:{orientation:"vertical"},style:{left:36,transform:"translateY(50%)","@media (pointer: coarse)":{left:44}}},{props:{markLabelActive:!0},style:{color:(e.vars||e).palette.text.primary}}]}))),qw=e=>{const{disabled:t,dragging:n,marked:r,orientation:i,track:o,classes:s,color:a,size:c}=e,l={root:["root",t&&"disabled",n&&"dragging",r&&"marked",i==="vertical"&&"vertical",o==="inverted"&&"trackInverted",o===!1&&"trackFalse",a&&`color${p.capitalize(a)}`,c&&`size${p.capitalize(c)}`],rail:["rail"],track:["track"],mark:["mark"],markActive:["markActive"],markLabel:["markLabel"],markLabelActive:["markLabelActive"],valueLabel:["valueLabel"],thumb:["thumb",t&&"disabled",c&&`thumbSize${p.capitalize(c)}`,a&&`thumbColor${p.capitalize(a)}`],active:["active"],disabled:["disabled"],focusVisible:["focusVisible"]};return zn(l,Nw,s)},Yw=({children:e})=>e,Ou=R.forwardRef(function(t,n){const r=ps({props:t,name:"MuiSlider"}),i=p.useRtl(),{"aria-label":o,"aria-valuetext":s,"aria-labelledby":a,component:c="span",components:l={},componentsProps:u={},color:d="primary",classes:h,className:f,disableSwap:m=!1,disabled:y=!1,getAriaLabel:x,getAriaValueText:b,marks:S=!1,max:v=100,min:_=0,name:C,onChange:w,onChangeCommitted:E,orientation:M="horizontal",shiftStep:j=10,size:D="medium",step:A=1,scale:P=vl,slotProps:I,slots:k,tabIndex:U,track:N="normal",value:Y,valueLabelDisplay:F="off",valueLabelFormat:J=vl,...ie}=r,Z={...r,isRtl:i,max:v,min:_,classes:h,disabled:y,disableSwap:m,orientation:M,marks:S,color:d,size:D,step:A,shiftStep:j,scale:P,track:N,valueLabelDisplay:F,valueLabelFormat:J},{axisProps:_e,getRootProps:Qe,getHiddenInputProps:et,getThumbProps:Se,open:tt,active:Ue,axis:Ie,focusedThumbIndex:G,range:W,dragging:K,marks:L,values:ne,trackOffset:Q,trackLeap:we,getThumbStyle:xe}=Dw({...Z,rootRef:n});Z.marked=L.length>0&&L.some(de=>de.label),Z.dragging=K,Z.focusedThumbIndex=G;const ue=qw(Z),gt=(k==null?void 0:k.root)??l.Root??Gw,Hn=(k==null?void 0:k.rail)??l.Rail??Bw,Wn=(k==null?void 0:k.track)??l.Track??Uw,qn=(k==null?void 0:k.thumb)??l.Thumb??Vw,Yn=(k==null?void 0:k.valueLabel)??l.ValueLabel??ku,Jt=(k==null?void 0:k.mark)??l.Mark??Hw,Jn=(k==null?void 0:k.markLabel)??l.MarkLabel??Ww,$=(k==null?void 0:k.input)??l.Input??"input",B=(I==null?void 0:I.root)??u.root,H=(I==null?void 0:I.rail)??u.rail,ee=(I==null?void 0:I.track)??u.track,oe=(I==null?void 0:I.thumb)??u.thumb,q=(I==null?void 0:I.valueLabel)??u.valueLabel,ye=(I==null?void 0:I.mark)??u.mark,Ce=(I==null?void 0:I.markLabel)??u.markLabel,he=(I==null?void 0:I.input)??u.input,ke=yt({elementType:gt,getSlotProps:Qe,externalSlotProps:B,externalForwardedProps:ie,additionalProps:{...Lw(gt)&&{as:c}},ownerState:{...Z,...B==null?void 0:B.ownerState},className:[ue.root,f]}),xn=yt({elementType:Hn,externalSlotProps:H,ownerState:Z,className:ue.rail}),Gu=yt({elementType:Wn,externalSlotProps:ee,additionalProps:{style:{..._e[Ie].offset(Q),..._e[Ie].leap(we)}},ownerState:{...Z,...ee==null?void 0:ee.ownerState},className:ue.track}),pi=yt({elementType:qn,getSlotProps:Se,externalSlotProps:oe,ownerState:{...Z,...oe==null?void 0:oe.ownerState},className:ue.thumb}),Bu=yt({elementType:Yn,externalSlotProps:q,ownerState:{...Z,...q==null?void 0:q.ownerState},className:ue.valueLabel}),mi=yt({elementType:Jt,externalSlotProps:ye,ownerState:Z,className:ue.mark}),gi=yt({elementType:Jn,externalSlotProps:Ce,ownerState:Z,className:ue.markLabel}),Uu=yt({elementType:$,getSlotProps:et,externalSlotProps:he,ownerState:Z});return p.jsxRuntimeExports.jsxs(gt,{...ke,children:[p.jsxRuntimeExports.jsx(Hn,{...xn}),p.jsxRuntimeExports.jsx(Wn,{...Gu}),L.filter(de=>de.value>=_&&de.value<=v).map((de,Ee)=>{const xi=zr(de.value,_,v),Xn=_e[Ie].offset(xi);let nt;return N===!1?nt=ne.includes(de.value):nt=N==="normal"&&(W?de.value>=ne[0]&&de.value<=ne[ne.length-1]:de.value<=ne[0])||N==="inverted"&&(W?de.value<=ne[0]||de.value>=ne[ne.length-1]:de.value>=ne[0]),p.jsxRuntimeExports.jsxs(R.Fragment,{children:[p.jsxRuntimeExports.jsx(Jt,{"data-index":Ee,...mi,...!Rn(Jt)&&{markActive:nt},style:{...Xn,...mi.style},className:p.clsx(mi.className,nt&&ue.markActive)}),de.label!=null?p.jsxRuntimeExports.jsx(Jn,{"aria-hidden":!0,"data-index":Ee,...gi,...!Rn(Jn)&&{markLabelActive:nt},style:{...Xn,...gi.style},className:p.clsx(ue.markLabel,gi.className,nt&&ue.markLabelActive),children:de.label}):null]},Ee)}),ne.map((de,Ee)=>{const xi=zr(de,_,v),Xn=_e[Ie].offset(xi),nt=F==="off"?Yw:Yn;return p.jsxRuntimeExports.jsx(nt,{...!Rn(nt)&&{valueLabelFormat:J,valueLabelDisplay:F,value:typeof J=="function"?J(P(de),Ee):J,index:Ee,open:tt===Ee||Ue===Ee||F==="on",disabled:y},...Bu,children:p.jsxRuntimeExports.jsx(qn,{"data-index":Ee,...pi,className:p.clsx(ue.thumb,pi.className,Ue===Ee&&ue.active,G===Ee&&ue.focusVisible),style:{...Xn,...xe(Ee),...pi.style},children:p.jsxRuntimeExports.jsx($,{"data-index":Ee,"aria-label":x?x(Ee):o,"aria-valuenow":P(de),"aria-labelledby":a,"aria-valuetext":b?b(P(de),Ee):s,value:ne[Ee],...Uu})})},Ee)})]})});process.env.NODE_ENV!=="production"&&(Ou.propTypes={"aria-label":pl(g.string,e=>Array.isArray(e.value||e.defaultValue)&&e["aria-label"]!=null?new Error("MUI: You need to use the `getAriaLabel` prop instead of `aria-label` when using a range slider."):null),"aria-labelledby":g.string,"aria-valuetext":pl(g.string,e=>Array.isArray(e.value||e.defaultValue)&&e["aria-valuetext"]!=null?new Error("MUI: You need to use the `getAriaValueText` prop instead of `aria-valuetext` when using a range slider."):null),children:g.node,classes:g.object,className:g.string,color:g.oneOfType([g.oneOf(["primary","secondary","error","info","success","warning"]),g.string]),components:g.shape({Input:g.elementType,Mark:g.elementType,MarkLabel:g.elementType,Rail:g.elementType,Root:g.elementType,Thumb:g.elementType,Track:g.elementType,ValueLabel:g.elementType}),componentsProps:g.shape({input:g.oneOfType([g.func,g.object]),mark:g.oneOfType([g.func,g.object]),markLabel:g.oneOfType([g.func,g.object]),rail:g.oneOfType([g.func,g.object]),root:g.oneOfType([g.func,g.object]),thumb:g.oneOfType([g.func,g.object]),track:g.oneOfType([g.func,g.object]),valueLabel:g.oneOfType([g.func,g.shape({children:g.element,className:g.string,open:g.bool,style:g.object,value:g.node,valueLabelDisplay:g.oneOf(["auto","off","on"])})])}),defaultValue:g.oneOfType([g.arrayOf(g.number),g.number]),disabled:g.bool,disableSwap:g.bool,getAriaLabel:g.func,getAriaValueText:g.func,marks:g.oneOfType([g.arrayOf(g.shape({label:g.node,value:g.number.isRequired})),g.bool]),max:g.number,min:g.number,name:g.string,onChange:g.func,onChangeCommitted:g.func,orientation:g.oneOf(["horizontal","vertical"]),scale:g.func,shiftStep:g.number,size:g.oneOfType([g.oneOf(["small","medium"]),g.string]),slotProps:g.shape({input:g.oneOfType([g.func,g.object]),mark:g.oneOfType([g.func,g.object]),markLabel:g.oneOfType([g.func,g.object]),rail:g.oneOfType([g.func,g.object]),root:g.oneOfType([g.func,g.object]),thumb:g.oneOfType([g.func,g.object]),track:g.oneOfType([g.func,g.object]),valueLabel:g.oneOfType([g.func,g.shape({children:g.element,className:g.string,open:g.bool,style:g.object,value:g.node,valueLabelDisplay:g.oneOf(["auto","off","on"])})])}),slots:g.shape({input:g.elementType,mark:g.elementType,markLabel:g.elementType,rail:g.elementType,root:g.elementType,thumb:g.elementType,track:g.elementType,valueLabel:g.elementType}),step:g.number,sx:g.oneOfType([g.arrayOf(g.oneOfType([g.func,g.object,g.bool])),g.func,g.object]),tabIndex:g.number,track:g.oneOf(["inverted","normal",!1]),value:g.oneOfType([g.arrayOf(g.number),g.number]),valueLabelDisplay:g.oneOf(["auto","off","on"]),valueLabelFormat:g.oneOfType([g.func,g.string])});var Jw="[object Number]";function Xw(e){return typeof e=="number"||zt(e)&&Wt(e)==Jw}const Pu=re.observer(e=>{var o,s,a;const t=T.useTheme(),{store:n}=e,{t:r}=le.useTranslation();function i(c,l){l===e.velocity||!Xw(l)||e.onVelocityChange(l)}return p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",gap:2,alignItems:"center",children:[n.showVelocityLegend&&p.jsxRuntimeExports.jsx(T.Typography,{sx:{color:(a=(s=(o=t.componentsExt)==null?void 0:o.JoggingPanel)==null?void 0:s.VelocitySlider)==null?void 0:a.sliderLegendColor,fontSize:"14px"},children:r("Jogging.Velocity.bt")}),p.jsxRuntimeExports.jsx(Ou,{value:e.velocity,color:"secondary",onChange:i,min:e.min,max:e.max,"aria-labelledby":"input-slider",disabled:e.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),n.showVelocitySliderLabel&&(e.renderValue?e.renderValue(e.velocity):p.jsxRuntimeExports.jsx(Es,{value:e.velocity.toString()}))]})});function Es({value:e,sx:t}){var r;const n=T.useTheme();return p.jsxRuntimeExports.jsx(T.Stack,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(r=n.palette.backgroundPaperElevation)==null?void 0:r[8],borderRadius:"10px",minWidth:"111px",...t},children:p.jsxRuntimeExports.jsx(T.Typography,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:n.palette.text.primary,whiteSpace:"nowrap"},children:e})})}const Du=re.observer(({store:e})=>{const{t}=le.useTranslation(),n=re.useLocalObservable(()=>({get valueLabelFormat(){return e.currentMotionType==="translate"?r=>`v = ${t("Jogging.Cartesian.Translation.velocityMmPerSec.lb",{amount:r})}`:r=>`ω = ${t("Jogging.Cartesian.Rotation.velocityDegPerSec.lb",{amount:r})}`}}));return p.jsxRuntimeExports.jsx(Pu,{store:e,velocity:e.velocityInDisplayUnits,min:e.minVelocityInDisplayUnits,max:e.maxVelocityInDisplayUnits,onVelocityChange:e.setVelocityFromSlider,disabled:e.isLocked,renderValue:r=>p.jsxRuntimeExports.jsx(Es,{value:n.valueLabelFormat(r),sx:{minWidth:"111px",span:{transform:"translateY(-1.5px)"}}})})}),Kw=re.observer(({store:e,children:t})=>{const{t:n}=le.useTranslation(),r=T.useTheme();function i(h,f){(f==="translate"||f==="rotate")&&e.setSelectedCartesianMotionType(f)}se.useReaction(()=>[e.selectedCoordSystemId,e.selectedTcpId],()=>{e.jogger.motionStream.motionStateSocket.changeUrl(e.jogger.nova.makeWebsocketURL(`/controllers/${e.jogger.motionStream.controllerId}/motion-groups/${e.jogger.motionGroupId}/state-stream?tcp=${e.selectedTcpId}`))},{fireImmediately:!0});async function o(h,f){const m=await e.activate(),y=m.motionStream.rapidlyChangingMotionState.tcp_pose,x=m.motionStream.rapidlyChangingMotionState.joint_position;y&&await e.withMotionLock(async()=>{try{e.setCurrentIncrementJog({axis:h.axis,direction:h.direction}),await e.jogger.runIncrementalCartesianMotion({currentTcpPose:y,currentJoints:x,coordSystemId:e.activeCoordSystemId,velocityInRelevantUnits:e.selectedCartesianMotionType==="translate"?e.translationVelocityMmPerSec:e.rotationVelocityRadsPerSec,axis:h.axis,direction:h.direction,motion:e.selectedCartesianMotionType==="translate"?{type:"translate",distanceMm:f.mm}:{type:"rotate",distanceRads:me.degreesToRadians(f.degrees)}})}finally{e.setCurrentIncrementJog(null),await e.deactivate()}})}async function s(h){if(!e.isLocked){if(await e.activate(),e.activeDiscreteIncrement)return o(h,e.activeDiscreteIncrement);h.motionType==="translate"?await e.jogger.translateTCP({axis:h.axis,direction:h.direction,velocityMmPerSec:e.translationVelocityMmPerSec}):await e.jogger.rotateTCP({axis:h.axis,direction:h.direction,velocityRadsPerSec:e.rotationVelocityRadsPerSec})}}async function a(){e.isLocked||e.activeDiscreteIncrement||await e.deactivate()}function c(h,f,m){var x,b,S;const y=(S=(b=(x=m.componentsExt)==null?void 0:x.JoggingPanel)==null?void 0:b.JoggingCartesian)==null?void 0:S.Axis;if(y)return f==="translate"?y[h]:y.CustomRotation??y[h]}const l=[{id:"x",icon:p.jsxRuntimeExports.jsx(fw,{}),colors:c("X",e.selectedCartesianMotionType,r)},{id:"y",icon:p.jsxRuntimeExports.jsx(mw,{}),colors:c("Y",e.selectedCartesianMotionType,r)},{id:"z",icon:p.jsxRuntimeExports.jsx(xw,{}),colors:c("Z",e.selectedCartesianMotionType,r)}];function u(h){return n("General.mm.variable",{amount:h.toFixed(1)})}function d(h){return n("General.degree.variable",{amount:me.radiansToDegrees(h).toFixed(1)})}return p.jsxRuntimeExports.jsxs(T.Stack,{flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[p.jsxRuntimeExports.jsxs(T.Stack,{gap:2,children:[p.jsxRuntimeExports.jsx(Ew,{store:e}),p.jsxRuntimeExports.jsx(Du,{store:e}),p.jsxRuntimeExports.jsx(T.Divider,{})]}),p.jsxRuntimeExports.jsx(T.Stack,{marginLeft:"auto",marginRight:"auto",gap:"24px",justifyContent:"center",sx:{flexGrow:"1"},children:p.jsxRuntimeExports.jsxs(T.Stack,{alignItems:"center",justifyContent:"center",gap:"24px",sx:{flexGrow:1},children:[p.jsxRuntimeExports.jsxs(Sw,{value:e.selectedCartesianMotionType,onChange:i,exclusive:!0,"aria-label":n("Jogging.Cartesian.MotionType.lb"),sx:{justifyContent:"center"},children:[p.jsxRuntimeExports.jsx(T.ToggleButton,{value:"translate",children:n("Jogging.Cartesian.Translation.bt")}),p.jsxRuntimeExports.jsx(T.ToggleButton,{value:"rotate",children:n("Jogging.Cartesian.Rotation.bt")})]}),e.selectedCartesianMotionType==="translate"&&l.map(h=>{var f,m;return p.jsxRuntimeExports.jsx(lo,{colors:h.colors,disabled:e.isLocked,activeJoggingDirection:((f=e.incrementJogInProgress)==null?void 0:f.axis)===h.id?e.incrementJogInProgress.direction:void 0,label:p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[h.icon,p.jsxRuntimeExports.jsx(T.Typography,{sx:{fontSize:"24px",color:((m=h.colors)==null?void 0:m.labelColor)??r.palette.text.primary},children:h.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,x;return u(((x=(y=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.position)==null?void 0:x[me.XYZ_TO_VECTOR[h.id]])||0)},startJogging:y=>s({axis:h.id,motionType:"translate",direction:y}),stopJogging:a},h.id)}),e.selectedCartesianMotionType==="rotate"&&l.map(h=>{var f,m;return p.jsxRuntimeExports.jsx(lo,{colors:h.colors,disabled:e.isLocked,activeJoggingDirection:((f=e.incrementJogInProgress)==null?void 0:f.axis)===h.id?e.incrementJogInProgress.direction:void 0,label:p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[p.jsxRuntimeExports.jsx(bw,{}),p.jsxRuntimeExports.jsx(T.Typography,{sx:{fontSize:"24px",color:((m=h.colors)==null?void 0:m.labelColor)??r.palette.text.primary},children:h.id.toUpperCase()})]}),getDisplayedValue:()=>{var y,x;return d(((x=(y=e.jogger.motionStream.rapidlyChangingMotionState.tcp_pose)==null?void 0:y.orientation)==null?void 0:x[me.XYZ_TO_VECTOR[h.id]])||0)},startJogging:y=>s({axis:h.id,motionType:"rotate",direction:y}),stopJogging:a},h.id)})]})}),p.jsxRuntimeExports.jsx(ju,{store:e}),t&&p.jsxRuntimeExports.jsx(T.Divider,{}),t]})}),Zw=re.observer(({store:e,children:t})=>{const n=T.useTheme();async function r(o){await e.activate(),await e.jogger.rotateJoints({joint:o.joint,direction:o.direction,velocityRadsPerSec:e.rotationVelocityRadsPerSec})}async function i(){await e.jogger.stop(),await e.deactivate()}return p.jsxRuntimeExports.jsxs(T.Stack,{flexGrow:1,gap:2,sx:{padding:"18px 24px"},children:[p.jsxRuntimeExports.jsx(Du,{store:e}),p.jsxRuntimeExports.jsx(T.Divider,{}),p.jsxRuntimeExports.jsx(T.Stack,{justifyContent:"center",alignItems:"stretch",sx:{flexGrow:"1"},children:p.jsxRuntimeExports.jsx(T.Stack,{alignItems:"center",gap:"24px",children:e.jogger.motionStream.joints.map(o=>{var l,u,d;const s=(d=(u=(l=e.motionGroupDescription.operation_limits.auto_limits)==null?void 0:l.joints)==null?void 0:u[o.index])==null?void 0:d.position,a=(s==null?void 0:s.lower_limit)!==void 0?me.radiansToDegrees(s.lower_limit):void 0,c=(s==null?void 0:s.upper_limit)!==void 0?me.radiansToDegrees(s.upper_limit):void 0;return p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",alignItems:"center",justifyContent:"center",spacing:1.5,width:"100%",children:[e.showJointsLegend&&p.jsxRuntimeExports.jsx(T.Typography,{color:e.isLocked?n.palette.text.disabled:n.palette.text.secondary,children:`G${o.index+1}`}),p.jsxRuntimeExports.jsx(uu,{disabled:e.isLocked,lowerLimitDegs:a,upperLimitDegs:c,getValueDegs:()=>{const h=e.jogger.motionStream.rapidlyChangingMotionState.joint_position[o.index];return h!==void 0?me.radiansToDegrees(h):void 0},startJogging:h=>r({joint:o.index,direction:h}),stopJogging:i})]},`joint-${o.index}`)})})}),p.jsxRuntimeExports.jsx(ju,{store:e}),t&&p.jsxRuntimeExports.jsx(T.Divider,{}),t]})}),Qw=p.externalizeComponent(re.observer(e=>{const t=Sl.isString(e.nova)?new Dd({instanceUrl:e.nova}):e.nova,n=re.useLocalObservable(()=>({joggingStore:null,loadingError:null}));async function r(){ae.runInAction(()=>{n.loadingError=null,n.joggingStore=null});try{let i=e.store;if(!i){const o=await li.open(t,e.motionGroupId);i=await fi.loadFor(o)}ae.runInAction(()=>{n.joggingStore=i}),e.onSetup&&e.onSetup(i)}catch(i){n.loadingError=i}}return O.useEffect(()=>(r(),e.store?()=>null:()=>{var i;(i=n.joggingStore)==null||i.dispose()}),[e.store,e.nova,e.motionGroupId]),O.useEffect(()=>{const i=n.joggingStore;i&&(e.locked?i.lock("external"):i.unlock("external"))},[n.joggingStore,e.locked]),p.jsxRuntimeExports.jsx(T.Stack,{sx:{maxWidth:"460px",minWidth:"320px",position:"relative",...e.sx},children:n.joggingStore?p.jsxRuntimeExports.jsx(eE,{store:n.joggingStore,children:e.children}):p.jsxRuntimeExports.jsx(Tl.LoadingCover,{message:"Loading jogging",error:n.loadingError})})})),eE=re.observer(({store:e,children:t})=>{const{t:n}=le.useTranslation();function r(){if(e.currentTab.id==="cartesian")return p.jsxRuntimeExports.jsx(p.jsxRuntimeExports.Fragment,{children:p.jsxRuntimeExports.jsx(Kw,{store:e,children:t})});if(e.currentTab.id==="joint")return p.jsxRuntimeExports.jsx(p.jsxRuntimeExports.Fragment,{children:p.jsxRuntimeExports.jsx(Zw,{store:e,children:t})})}return p.jsxRuntimeExports.jsxs(T.Stack,{flexGrow:1,sx:{overflow:"hidden"},children:[p.jsxRuntimeExports.jsx(T.Tabs,{value:e.tabIndex,onChange:e.onTabChange,variant:"fullWidth",children:e.tabs.map(i=>{const o=i.label==="cartesian"?n("Jogging.Cartesian.bt"):n("Jogging.Joints.bt"),s=i.label==="cartesian"?p.jsxRuntimeExports.jsx(Jy,{fontSize:"small",sx:{mr:1}}):p.jsxRuntimeExports.jsx(Xy,{fontSize:"small",sx:{mr:1}});return p.jsxRuntimeExports.jsx(T.Tab,{label:e.showTabIcons?p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",alignItems:"center",children:[s,o]}):o,id:`jogging-tab-${i.id}`,"aria-controls":`jogging-tab-${i.id}`},i.id)})}),p.jsxRuntimeExports.jsx(T.Stack,{flexGrow:1,position:"relative",sx:{overflowY:"auto",overflowX:"hidden"},children:r()}),e.blocked&&p.jsxRuntimeExports.jsx(dw,{store:e})]})}),Lu=e=>{var a;const{value:t,ref:n}=e,r=T.useTheme(),[i,o]=O.useState(!1);async function s(){if(!n||!("current"in n))return console.warn("No copy target found"),!1;try{return await navigator.clipboard.writeText(t),console.log("Copied!"),o(!0),!0}catch(c){console.error(c);const l=window.getSelection();if(l&&n&&"current"in n&&n.current){const u=document.createRange();u.selectNodeContents(n.current),l.removeAllRanges(),l.addRange(u)}}return!1}return O.useEffect(()=>{if(!i)return;const c=setTimeout(()=>o(!1),3e3);return()=>{c&&clearTimeout(c)}},[i]),p.jsxRuntimeExports.jsx(T.Tooltip,{open:i,title:"Copied!",children:p.jsxRuntimeExports.jsx(T.Stack,{justifyContent:"center",sx:{height:"100%",boxSizing:"border-box",padding:"6px 12px",background:(a=r.palette.backgroundPaperElevation)==null?void 0:a[8],borderRadius:"10px",minWidth:"0",cursor:"pointer"},onClick:()=>s(),children:p.jsxRuntimeExports.jsx(T.Typography,{ref:n,align:"center",sx:{pointerEvents:"none",fontSize:"12px",color:r.palette.text.primary,whiteSpace:"nowrap",minWidth:0,textOverflow:"ellipsis",width:"100%",overflow:"hidden"},children:t})})})},tE=p.externalizeComponent(re.observer(({tcpPose:e,showCopyButton:t=!1})=>{const[n,r]=O.useState(null),i=Ld(e),o=async()=>{try{await navigator.clipboard.writeText(i),r("Copied!"),setTimeout(()=>r(null),2e3)}catch{r("Copy failed"),setTimeout(()=>r(null),2e3)}};return p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-cartesian-values",children:[p.jsxRuntimeExports.jsx(Lu,{value:i}),t&&p.jsxRuntimeExports.jsx(T.Button,{variant:"contained",color:"secondary",size:"small",onClick:o,sx:{flexShrink:0},children:n||"Copy"})]})})),nE=p.externalizeComponent(re.observer(({joints:e,showCopyButton:t=!1})=>{const[n,r]=O.useState(null),i=`[${e.map(s=>parseFloat(s.toFixed(4))).join(", ")}]`,o=async()=>{try{await navigator.clipboard.writeText(i),r("Copied!"),setTimeout(()=>r(null),2e3)}catch{r("Copy failed"),setTimeout(()=>r(null),2e3)}};return p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{flexGrow:1,minWidth:0,overflow:"hidden"},"data-testid":"pose-joint-values",children:[p.jsxRuntimeExports.jsx(Lu,{value:i}),t&&p.jsxRuntimeExports.jsx(T.Button,{variant:"contained",color:"secondary",size:"small",onClick:o,sx:{flexShrink:0},children:n||"Copy"})]})}));class $u{constructor(){this.messages=[],this.addMessage=(t,n="info")=>{const r={id:Math.random().toString(36).substring(2,11),timestamp:new Date,message:t,level:n};this.messages.push(r)},this.clearMessages=()=>{this.messages=[]},this.addInfo=t=>{this.addMessage(t,"info")},this.addWarning=t=>{this.addMessage(t,"warning")},this.addError=t=>{this.addMessage(t,"error")},this.addDebug=t=>{this.addMessage(t,"debug")},ae.makeObservable(this,{messages:ae.observable,addMessage:ae.action,clearMessages:ae.action})}}const Vn=(e,t,n)=>({id:n||`${Date.now()}-${Math.random().toString(36).substring(2,11)}`,timestamp:new Date,message:e,level:t}),rE=(e,t)=>Vn(e,"debug",t),iE=(e,t)=>Vn(e,"info",t),oE=(e,t)=>Vn(e,"warning",t),sE=(e,t)=>Vn(e,"error",t),zu=p.externalizeComponent(re.observer(e=>{var u;const{messages:t=[],onClear:n,height:r=400,sx:i}=e,o=T.useTheme(),s=O.useRef(null);O.useEffect(()=>{if(t.length===0)return;const d=s.current;if(!d)return;const h=setTimeout(()=>{d.scrollTop=d.scrollHeight},10);return()=>clearTimeout(h)},[t.length]);const a=d=>d.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),c=d=>{switch(d){case"error":return o.palette.error.main;case"warning":return o.palette.warning.main;case"info":return o.palette.info.main;case"debug":return o.palette.text.disabled;default:return o.palette.text.secondary}},l=({message:d})=>{const[h,f]=O.useState(!1),[m,y]=O.useState(!1),[x,b]=O.useState(!1),S=d.message.length>150,v=async()=>{try{await navigator.clipboard.writeText(d.message),y(!0),setTimeout(()=>y(!1),2e3)}catch(C){console.error("Failed to copy message:",C)}},_=S&&!h?d.message.substring(0,150)+"...":d.message;return p.jsxRuntimeExports.jsx(T.Box,{onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),sx:{display:"flex",gap:1,fontFamily:"monospace",flexDirection:"column","&:hover":{backgroundColor:o.palette.action.hover},borderRadius:"4px",padding:"2px 4px",margin:"-2px -4px"},children:p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",gap:1},children:[p.jsxRuntimeExports.jsxs(T.Typography,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:o.palette.text.disabled,whiteSpace:"nowrap",flexShrink:0},children:["[",a(d.timestamp),"]"]}),p.jsxRuntimeExports.jsx(T.Typography,{component:"span",sx:{fontWeight:400,fontSize:"12px",lineHeight:"18px",letterSpacing:"0.4px",color:c(d.level),wordBreak:"break-word",overflowWrap:"anywhere",hyphens:"auto",flex:1,whiteSpace:"pre-wrap"},children:_}),p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"flex-start",gap:.5,opacity:x?1:0,transition:"opacity 0.2s ease-in-out",visibility:x?"visible":"hidden"},children:[p.jsxRuntimeExports.jsx(T.IconButton,{size:"small",onClick:v,sx:{padding:"2px",color:o.palette.text.secondary,"&:hover":{backgroundColor:o.palette.action.hover}},title:m?"Copied!":"Copy message",children:p.jsxRuntimeExports.jsx(Kn.ContentCopy,{sx:{fontSize:12}})}),S&&p.jsxRuntimeExports.jsx(T.IconButton,{size:"small",onClick:()=>f(!h),sx:{padding:"2px",color:o.palette.text.secondary,"&:hover":{backgroundColor:o.palette.action.hover}},title:h?"Collapse":"Expand",children:h?p.jsxRuntimeExports.jsx(Kn.ExpandLess,{sx:{fontSize:12}}):p.jsxRuntimeExports.jsx(Kn.ExpandMore,{sx:{fontSize:12}})})]})]})},d.id)};return p.jsxRuntimeExports.jsxs(T.Paper,{sx:{backgroundColor:((u=o.palette.backgroundPaperElevation)==null?void 0:u[2])||"#171927",backgroundImage:"none",height:r,display:"flex",flexDirection:"column",overflow:"hidden",...i},children:[p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px"},children:[p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.jsxRuntimeExports.jsx(Kn.DescriptionOutlined,{sx:{fontSize:16,color:o.palette.action.active,opacity:.56}}),p.jsxRuntimeExports.jsx(T.Typography,{sx:{fontWeight:500,fontSize:"14px",lineHeight:"143%",letterSpacing:"0.17px",color:o.palette.text.primary},children:"Log"})]}),p.jsxRuntimeExports.jsx(T.Button,{onClick:n,variant:"text",sx:{fontWeight:500,fontSize:"13px",lineHeight:"22px",letterSpacing:"0.46px",color:o.palette.primary.main,textTransform:"none",minWidth:"auto",padding:"4px 8px","&:hover":{backgroundColor:o.palette.primary.main+"14"}},children:"Clear"})]}),p.jsxRuntimeExports.jsx(T.Box,{ref:s,sx:{flex:1,overflow:"auto",padding:"8px 16px",display:"flex",flexDirection:"column",gap:"2px",scrollbarWidth:"thin",scrollbarColor:`${o.palette.divider} transparent`,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:o.palette.divider,borderRadius:"3px","&:hover":{backgroundColor:o.palette.divider}}},children:t.length===0?p.jsxRuntimeExports.jsx(T.Typography,{sx:{color:o.palette.text.disabled,fontSize:"12px",fontStyle:"italic",textAlign:"center",marginTop:2},children:"No log messages"}):t.map(d=>p.jsxRuntimeExports.jsx(l,{message:d},d.id))})]})})),aE=p.externalizeComponent(re.observer(e=>{const{store:t,onStoreReady:n,...r}=e,i=O.useRef(n);O.useEffect(()=>{i.current=n},[n]);const o=O.useMemo(()=>{var c;const a=t||new $u;return(c=i.current)==null||c.call(i,a),a},[t]),s=()=>{o.clearMessages()};return p.jsxRuntimeExports.jsx(zu,{...r,messages:o.messages,onClear:s})}));function lE(){const e=window.location.href;return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function cE({baseUrl:e=lE(),...t}){return p.jsxRuntimeExports.jsxs(T.Dialog,{"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:[p.jsxRuntimeExports.jsx(T.DialogTitle,{id:"no-motion-group-modal-title",children:"No motion group found"}),p.jsxRuntimeExports.jsxs(T.DialogContent,{sx:{marginTop:"3rem",marginBottom:"1.5rem",textAlign:"center"},children:[p.jsxRuntimeExports.jsx(T.Typography,{color:"#fff",children:"Found no devices to connect to."}),p.jsxRuntimeExports.jsx(T.Typography,{color:"#fff",children:"Please ensure a motion group has been created."})]}),p.jsxRuntimeExports.jsx(T.DialogActions,{children:p.jsxRuntimeExports.jsxs(T.Stack,{width:"100%",maxWidth:"300px",margin:"auto",marginBottom:"2rem",children:[p.jsxRuntimeExports.jsx(T.Button,{href:`${e}/settings`,variant:"contained",sx:{borderRadius:"8px",width:"100%"},children:"Go to settings app"}),p.jsxRuntimeExports.jsx(T.Button,{href:`${e}`,variant:"text",sx:{marginTop:"1rem",color:"#fff",textDecoration:"underline",fontSize:"0.75rem"},children:"Back to Homescreen"})]})})]})}const uE=Mt(p.jsxRuntimeExports.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),dE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{fill:"#38C6F4",fillRule:"evenodd",d:"M6.359 14.25v2.934h7.63v-3.521L10.196 9.87 9 8.674l.859-.859.337-.337.858-.858.565.565.631.63.565.565 1.196-1.195.543-.544 1.196-1.195-1.196-1.196-2.304-2.304L11.054.75 9.86 1.946 3.446 8.359 2.25 9.554l1.196 1.196 2.913 2.913zm1.69 0v1.244h4.249v-1.13L7.804 9.87 6.608 8.674l1.196-1.196L9.86 5.424l.007-.008-.543-.543-4.681 4.681 2.912 2.913.496.496v.113h2.124l1.174 1.174zm3.005-10.022-.294.294-.543-.543.837-.837 2.304 2.304-.543.543-.565-.565z",clipRule:"evenodd"})),hE=O.forwardRef(dE);var Ss=(e=>(e.PRECONDITION_NOT_FULFILLED="PRECONDITION_NOT_FULFILLED",e.ROBOT_DISCONNECTED="ROBOT_DISCONNECTED",e.CELL_OPEN="CELL_OPEN",e.E_STOP="E_STOP",e.MANUAL_MODE="MANUAL_MODE",e.READY="READY",e))(Ss||{});const Nu=p.externalizeComponent(re.observer(({setupState:e,className:t})=>{const n=T.useTheme(),{t:r}=le.useTranslation(),i=()=>{var l,u,d,h,f,m,y;switch(e){case"READY":return{label:r("RobotSetupReadinessIndicator.Ready.lb"),indicatorColor:((l=n.palette.tertiary)==null?void 0:l.main)||n.palette.primary.main,backgroundColor:((u=n.palette.backgroundPaperElevation)==null?void 0:u[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"ROBOT_DISCONNECTED":return{label:r("RobotSetupReadinessIndicator.RobotDisconnected.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"CELL_OPEN":return{label:r("RobotSetupReadinessIndicator.CellOpen.lb"),indicatorColor:n.palette.error.main,backgroundColor:((h=n.palette.backgroundPaperElevation)==null?void 0:h[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"E_STOP":return{label:r("RobotSetupReadinessIndicator.EStop.lb"),indicatorColor:n.palette.error.main,backgroundColor:((f=n.palette.backgroundPaperElevation)==null?void 0:f[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"MANUAL_MODE":return{label:r("RobotSetupReadinessIndicator.ManualMode.lb"),indicatorColor:n.palette.error.main,backgroundColor:((m=n.palette.backgroundPaperElevation)==null?void 0:m[11])||n.palette.background.paper,textColor:n.palette.secondary.contrastText};case"PRECONDITION_NOT_FULFILLED":default:return{label:r("RobotSetupReadinessIndicator.PreconditionNotFulfilled.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}}},{label:o,indicatorColor:s,backgroundColor:a,textColor:c}=i();return p.jsxRuntimeExports.jsx(T.Chip,{className:t,label:p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.jsxRuntimeExports.jsx(T.Box,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:s,flexShrink:0}}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:c,fontSize:"0.75rem",lineHeight:1.2},children:o})]}),variant:"filled",sx:{backgroundColor:a,color:n.palette.getContrastText(a),fontWeight:500,height:"auto","& .MuiChip-label":{paddingX:1.5,paddingY:.5}}})})),fE=p.externalizeComponent(re.observer(({robotName:e,robotType:t,setupState:n,PreconditionComponent:r=Nu,className:i})=>{var c;const o=T.useTheme(),s=t||"Robot",a=n===Ss.READY;return p.jsxRuntimeExports.jsxs(T.Box,{className:i,sx:{border:`1px solid ${o.palette.divider}`,background:((c=o.palette.backgroundPaperElevation)==null?void 0:c[8])||"#292B3F",borderRadius:"8px",padding:"20px",display:"flex",alignItems:"center",justifyContent:"space-between",opacity:1},children:[p.jsxRuntimeExports.jsxs(T.Box,{sx:{display:"flex",alignItems:"center",gap:2,flex:1},children:[a?p.jsxRuntimeExports.jsx(T.Box,{sx:{fontSize:24,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,"& svg":{fill:`${o.palette.primary.main} !important`},"& svg path":{fill:`${o.palette.primary.main} !important`}},children:p.jsxRuntimeExports.jsx(hE,{})}):p.jsxRuntimeExports.jsx(uE,{sx:{color:o.palette.error.main,fontSize:24}}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body1",sx:{fontWeight:500,color:o.palette.text.primary},children:e}),p.jsxRuntimeExports.jsx(T.Divider,{orientation:"vertical",flexItem:!0,sx:{backgroundColor:o.palette.text.secondary,opacity:.3,width:"1px"}}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:o.palette.text.secondary},children:s})]}),r&&p.jsxRuntimeExports.jsx(r,{setupState:n})]})})),pE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M5.248 21c-.334 0-.619-.116-.853-.35a1.153 1.153 0 0 1-.351-.848c0-.333.117-.616.351-.85.234-.233.519-.35.853-.35H7.24L4.558 9.87a2.881 2.881 0 0 1-1.126-1.042A2.77 2.77 0 0 1 3 7.317c0-.793.28-1.467.838-2.023a2.774 2.774 0 0 1 2.033-.834 2.71 2.71 0 0 1 1.728.585c.494.389.832.887 1.014 1.493h3.58V5.239c0-.22.076-.406.226-.555a.76.76 0 0 1 .558-.224c.136 0 .263.035.381.104.118.07.209.167.273.292v.14l1.835-1.702a.979.979 0 0 1 .52-.279.881.881 0 0 1 .58.091l4.01 1.85a.74.74 0 0 1 .36.364.537.537 0 0 1-.002.474.592.592 0 0 1-.366.323.657.657 0 0 1-.477-.039l-3.858-1.774L13.76 6.59v1.454l2.473 2.233 3.858-1.774a.648.648 0 0 1 .485-.03.571.571 0 0 1 .358.314.513.513 0 0 1 .01.482.79.79 0 0 1-.367.357l-4.011 1.882a.881.881 0 0 1-.58.09.979.979 0 0 1-.52-.278L13.63 9.638v.14a.92.92 0 0 1-.273.275.665.665 0 0 1-.381.12.76.76 0 0 1-.558-.224.752.752 0 0 1-.225-.555V8.096h-3.58a2.82 2.82 0 0 1-.215.54 2.552 2.552 0 0 1-.323.479l5.139 9.488h2.673c.335 0 .62.116.854.35.234.233.35.516.35.849 0 .332-.116.615-.35.849a1.167 1.167 0 0 1-.854.349H5.248Zm.623-12.385c.362 0 .67-.126.924-.378a1.25 1.25 0 0 0 .38-.92 1.25 1.25 0 0 0-.38-.92 1.261 1.261 0 0 0-.924-.379 1.26 1.26 0 0 0-.925.379 1.25 1.25 0 0 0-.38.92c0 .36.127.667.38.92.254.252.562.378.925.378Z"})),mE=O.forwardRef(pE),gE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"m13.37 9.12 1.69 1.69 2.99-2.99-3.73-3.73-.95-.95-7.66 7.66-.95.95 3.99 3.99v3.44h7.55v-3.55l-4.72-4.72 1.79-1.79Zm-.91-2.99.91-.91 2.6 2.6-.91.91-2.6-2.6Zm-2.25 10.24h3.74l-1.34-1.34-.04-.04h-2.5l-3.25-3.25 4.59-4.59.92.92L9.5 10.9l5.33 5.33v1.48H10.2v-1.35l.01.01ZM2 2v4.99h1.41V3.4h3.58V2H2ZM22.21 2h-4.98v1.41h3.59v3.58h1.4V2h-.01ZM20.81 20.65h-3.58v1.4h4.98v-4.99h-1.4v3.59ZM3.4 17.06H2v4.98h4.99v-1.4H3.4v-3.58Z"})),xE=O.forwardRef(gE),We=re.observer(({id:e,icon:t,color:n,title:r,name:i,label:o,explanation:s,literalValue:a,anchorOrigin:c,transformOrigin:l})=>{const u=re.useLocalObservable(()=>({anchorEl:null,get isPopoverOpen(){return!!u.anchorEl},openPopover(d){u.anchorEl=d.currentTarget},closePopover(){u.anchorEl=null}}));return p.jsxRuntimeExports.jsxs(p.jsxRuntimeExports.Fragment,{children:[p.jsxRuntimeExports.jsxs(T.Stack,{"aria-owns":u.isPopoverOpen?e:void 0,"aria-haspopup":"true",onMouseEnter:u.openPopover,onMouseLeave:u.closePopover,direction:"row",spacing:1,sx:{cursor:"pointer"},children:[p.jsxRuntimeExports.jsx(T.SvgIcon,{component:t,sx:{color:n}}),o&&p.jsxRuntimeExports.jsx("div",{style:{color:n},children:o})]}),p.jsxRuntimeExports.jsx(T.Popover,{id:e,sx:{pointerEvents:"none"},open:u.isPopoverOpen,anchorEl:u.anchorEl,anchorOrigin:c??{vertical:"bottom",horizontal:"left"},transformOrigin:l??{vertical:"top",horizontal:"left"},onClose:u.closePopover,disableRestoreFocus:!0,children:p.jsxRuntimeExports.jsxs(T.Stack,{gap:"1rem",padding:2,maxWidth:"450px",sx:{wordWrap:"break-word"},children:[p.jsxRuntimeExports.jsxs("div",{children:[r&&p.jsxRuntimeExports.jsx(T.Typography,{component:"span",fontSize:"14px",children:`${r}: `}),p.jsxRuntimeExports.jsx(T.Typography,{component:"span",color:n,fontWeight:"bold",fontSize:"14px",children:i})]}),p.jsxRuntimeExports.jsx(T.Typography,{fontSize:"14px",children:s}),a&&p.jsxRuntimeExports.jsx(T.Typography,{fontSize:"12px",children:a})]})})]})}),yE=re.observer(({isVirtual:e,motionGroupId:t,anchorOrigin:n,transformOrigin:r,compact:i})=>{const o=T.useTheme(),s=O.useId(),{t:a}=le.useTranslation();return e?p.jsxRuntimeExports.jsx(We,{id:`motion-group-virtual-${s}`,icon:xE,color:o.palette.tertiary.main,name:a("SafetyBar.ControllerType.Virtual.lb"),label:i?null:a("SafetyBar.ControllerType.Virtual.lb"),explanation:p.jsxRuntimeExports.jsxs(le.Trans,{i18nKey:"SafetyBar.MotionGroup.Virtual.Explanation.lb",values:{motionGroupId:t},children:["Motion group ",p.jsxRuntimeExports.jsx("code",{children:t})," refers to a virtual robot with no physical counterpart. It can be freely manipulated without special safety precautions."]}),anchorOrigin:n,transformOrigin:r}):p.jsxRuntimeExports.jsx(We,{id:`motion-group-physical-${s}`,icon:mE,color:o.palette.primary.main,name:a("SafetyBar.ControllerType.Physical.lb"),label:i?null:a("SafetyBar.ControllerType.Physical.lb"),explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.MotionGroup.Physical.Explanation.lb",values:{motionGroupId:t},components:{code:p.jsxRuntimeExports.jsx("code",{}),strong:p.jsxRuntimeExports.jsx("strong",{})}}),anchorOrigin:n,transformOrigin:r})}),bE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.306 2.768c0-.424.344-.768.768-.768h.406C19.53 2 22 4.551 22 7.699c0 3.237-2.51 5.587-5.31 5.703-.84 1.595-2.478 2.677-4.36 2.677a4.845 4.845 0 0 1-3.146-1.163c-.6 1.783 0 3.922 1.79 4.99 1.929 1.149 4.395.467 5.508-1.524l.212-.378a.75.75 0 1 1 1.308.732l-.231.414c-1.524 2.725-4.9 3.66-7.54 2.085-2.716-1.618-3.432-5.037-2.129-7.599a5.22 5.22 0 0 1-.73-2.677c0-2.192 1.335-4.063 3.212-4.793-1.195-1.427-3.29-1.96-5.08-.892-1.928 1.15-2.589 3.696-1.475 5.687l.231.413a.75.75 0 0 1-1.308.732l-.212-.377c-1.524-2.726-.62-6.211 2.02-7.785 2.716-1.619 5.943-.55 7.44 1.897l.13-.001c2.739 0 4.96 2.292 4.96 5.12 0 .284-.023.563-.066.834 1.795-.354 3.288-1.96 3.288-4.095 0-2.3-1.805-4.163-4.032-4.163h-.406a.768.768 0 0 1-.768-.768Zm.496 8.191c0 .286-.033.564-.094.831a3.62 3.62 0 0 1-.672 1.415 3.425 3.425 0 0 1-2.706 1.338 3.402 3.402 0 0 1-2.384-.98 3.598 3.598 0 0 1-.852-1.306 3.677 3.677 0 0 1-.235-1.298c0-1.623 1.046-2.994 2.48-3.435a3.37 3.37 0 0 1 1.522-.107c1.665.264 2.94 1.75 2.94 3.542Z"})),vE=O.forwardRef(bE),wE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z",fill:"#fff",fillOpacity:.56})),EE=O.forwardRef(wE),SE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M12.953 5.09a1.497 1.497 0 0 0-1.653-.518l-1.35.43a1.504 1.504 0 0 0-1.726-.376L2.858 6.97c-.736.321-1.06 1.155-.726 1.862.334.707 1.202 1.02 1.937.698l4.27-1.865 1.466 1.973v.402c0 .873-.627 1.63-1.512 1.827l-2.56.567c-1.329.295-2.27 1.431-2.27 2.74v.107c0 .26.22.469.489.469h11.117c1.329 0 2.618.435 3.656 1.233l1.665 1.28A1 1 0 0 0 22 17.47V11.062c0-.312-.108-.616-.308-.863l-3.415-4.218a1.5 1.5 0 0 0-1.618-.471l-.378.12-.866-.475a1.516 1.516 0 0 0-1.188-.114l-1.06.338-.214-.289Z"})),TE=O.forwardRef(SE),CE=re.observer(({operationMode:e,anchorOrigin:t,transformOrigin:n,compact:r})=>{const{t:i}=le.useTranslation(),o=T.useTheme(),s=O.useId();switch(e){case"OPERATION_MODE_AUTO":return p.jsxRuntimeExports.jsx(We,{id:`operation-mode-auto-${s}`,icon:vE,title:i("SafetyBar.OperationMode.ti"),name:i("SafetyBar.OperationMode.Automatic.ti"),label:r?null:i("SafetyBar.OperationMode.Automatic.ti"),color:o.palette.text.secondary,explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.OperationMode.Auto.Explanation.lb",children:"The robot controller is in automatic operation mode. Automated movement without manual confirmation is possible in this mode."}),anchorOrigin:t,transformOrigin:n});case"OPERATION_MODE_MANUAL":case"OPERATION_MODE_MANUAL_T1":case"OPERATION_MODE_MANUAL_T2":return p.jsxRuntimeExports.jsx(We,{id:`operation-mode-manual-${s}`,icon:TE,color:o.palette.warning.main,title:i("SafetyBar.OperationMode.ti"),name:i("SafetyBar.OperationMode.Manual.lb"),label:r?null:i("SafetyBar.OperationMode.Manual.lb"),explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.OperationMode.Manual.Explanation.lb",children:"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully."}),literalValue:e,anchorOrigin:t,transformOrigin:n});default:return p.jsxRuntimeExports.jsx(We,{id:`operation-mode-error-${s}`,icon:EE,color:o.palette.warning.main,title:i("SafetyBar.OperationMode.ti"),name:i("SafetyBar.OperationMode.Error.lb"),label:r?null:i("SafetyBar.OperationMode.Error.lb"),explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.OperationMode.Error.Explanation.lb",children:"The robot controller has entered an unexpected operation mode. Motion group movement may not be possible."}),literalValue:e,anchorOrigin:t,transformOrigin:n})}}),_E=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M19.763 16.432 13.516 5.864c-.674-1.152-2.358-1.152-3.049 0l-6.23 10.568C3.563 17.567 4.405 19 5.753 19H18.23c1.364 0 2.206-1.432 1.532-2.568ZM12 8.498c.539 0 .96.428.96.938v.066l-.32 4.708a.639.639 0 0 1-.64.592.639.639 0 0 1-.64-.592l-.32-4.708A.953.953 0 0 1 12 8.498Zm0 8.79c-.556 0-1.01-.444-1.01-.987 0-.544.454-.988 1.01-.988s1.01.444 1.01.988c0 .542-.454.987-1.01.987Z"})),ME=O.forwardRef(_E),RE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M10.24 10.636 12 13.764l1.76-3.128h-3.52Z"}),R.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.364 12a6.364 6.364 0 1 1-12.728 0 6.364 6.364 0 0 1 12.728 0ZM7.909 9.273 12 16.546l4.09-7.273H7.91Z"}),R.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-1.364 0a8.636 8.636 0 1 1-17.273 0 8.636 8.636 0 0 1 17.273 0Z"})),jE=O.forwardRef(RE),IE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M9.057 15.115c-1.681 0-3.111-.59-4.29-1.768C3.59 12.17 3 10.74 3 9.057c0-.29.021-.582.064-.876a4.1 4.1 0 0 1 .214-.844.78.78 0 0 1 .273-.36c.115-.077.244-.133.389-.168a.857.857 0 0 1 .437.008c.146.04.28.12.4.24l2.806 2.787 2.26-2.261-2.775-2.786a.903.903 0 0 1-.241-.405.875.875 0 0 1-.008-.442 1.13 1.13 0 0 1 .174-.389.82.82 0 0 1 .355-.273c.268-.107.548-.182.838-.224.29-.043.581-.064.871-.064 1.682 0 3.112.59 4.29 1.768 1.179 1.178 1.768 2.608 1.768 4.29 0 .444-.042.858-.126 1.241-.084.384-.21.755-.377 1.113l5.726 5.692A2.2 2.2 0 0 1 21 18.721a2.2 2.2 0 0 1-.662 1.617A2.2 2.2 0 0 1 18.72 21a2.173 2.173 0 0 1-1.617-.679l-5.692-5.709c-.372.161-.75.285-1.133.372-.383.087-.79.13-1.222.13Z",fill:"#fff",fillOpacity:.56})),AE=O.forwardRef(IE),kE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"m10.6 13.8-2.15-2.15a.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275.948.948 0 0 0-.275.7c0 .283.092.517.275.7L9.9 15.9c.2.2.433.3.7.3.267 0 .5-.1.7-.3l5.65-5.65a.948.948 0 0 0 .275-.7.948.948 0 0 0-.275-.7.948.948 0 0 0-.7-.275.948.948 0 0 0-.7.275L10.6 13.8ZM12 22a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),OE=O.forwardRef(kE),PE=({title:e,titleId:t,...n},r)=>R.createElement("svg",{width:24,height:24,xmlns:"http://www.w3.org/2000/svg",ref:r,"aria-labelledby":t,...n},e?R.createElement("title",{id:t},e):null,R.createElement("path",{d:"M9 16h6c.283 0 .52-.096.713-.287A.968.968 0 0 0 16 15V9a.967.967 0 0 0-.287-.713A.968.968 0 0 0 15 8H9a.968.968 0 0 0-.713.287A.968.968 0 0 0 8 9v6c0 .283.096.52.287.713.192.191.43.287.713.287Zm3 6a9.738 9.738 0 0 1-3.9-.788 10.099 10.099 0 0 1-3.175-2.137c-.9-.9-1.612-1.958-2.137-3.175A9.738 9.738 0 0 1 2 12c0-1.383.263-2.683.788-3.9a10.099 10.099 0 0 1 2.137-3.175c.9-.9 1.958-1.612 3.175-2.137A9.738 9.738 0 0 1 12 2c1.383 0 2.683.263 3.9.788a10.098 10.098 0 0 1 3.175 2.137c.9.9 1.613 1.958 2.137 3.175A9.738 9.738 0 0 1 22 12a9.738 9.738 0 0 1-.788 3.9 10.098 10.098 0 0 1-2.137 3.175c-.9.9-1.958 1.613-3.175 2.137A9.738 9.738 0 0 1 12 22Zm0-2c2.233 0 4.125-.775 5.675-2.325C19.225 16.125 20 14.233 20 12c0-2.233-.775-4.125-2.325-5.675C16.125 4.775 14.233 4 12 4c-2.233 0-4.125.775-5.675 2.325C4.775 7.875 4 9.767 4 12c0 2.233.775 4.125 2.325 5.675C7.875 19.225 9.767 20 12 20Z"})),DE=O.forwardRef(PE),LE=re.observer(({safetyState:e,anchorOrigin:t,transformOrigin:n,compact:r})=>{const{t:i}=le.useTranslation(),o=T.useTheme(),s=O.useId();switch(e){case"SAFETY_STATE_NORMAL":return p.jsxRuntimeExports.jsx(We,{id:`safety-state-normal-${s}`,title:i("SafetyBar.SafetyState.ti"),name:i("SafetyBar.SafetyState.Normal.lb"),label:r?null:i("SafetyBar.SafetyState.Normal.lb"),icon:OE,color:o.palette.text.secondary,explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.SafetyState.Normal.Explanation.lb",children:"The robot controller is in a normal safety state. Movement is not prevented by this state."}),anchorOrigin:t,transformOrigin:n});case"SAFETY_STATE_DEVICE_EMERGENCY_STOP":case"SAFETY_STATE_ROBOT_EMERGENCY_STOP":return p.jsxRuntimeExports.jsx(We,{id:`safety-state-estop-${s}`,title:i("SafetyBar.SafetyState.ti"),name:i("SafetyBar.SafetyState.Estop.lb"),label:r?null:i("SafetyBar.SafetyState.Estop.lb"),icon:jE,color:o.palette.error.main,explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.StopState.Estop.Explanation.lb",children:"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released."}),literalValue:e,anchorOrigin:t,transformOrigin:n});case"SAFETY_STATE_STOP_0":case"SAFETY_STATE_STOP_1":case"SAFETY_STATE_STOP_2":case"SAFETY_STATE_PROTECTIVE_STOP":case"SAFETY_STATE_STOP":return p.jsxRuntimeExports.jsx(We,{id:`safety-state-stop-${s}`,icon:DE,title:i("SafetyBar.SafetyState.ti"),name:i("SafetyBar.SafetyState.Stop.lb"),label:r?null:i("SafetyBar.SafetyState.Stop.lb"),color:o.palette.warning.main,explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.SafetyState.Stop.Explanation.lb",children:"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved."}),literalValue:e,anchorOrigin:t,transformOrigin:n});case"SAFETY_STATE_REDUCED":case"SAFETY_STATE_MASTERING":case"SAFETY_STATE_CONFIRM_SAFETY":case"SAFETY_STATE_OPERATOR_SAFETY":case"SAFETY_STATE_RECOVERY":case"SAFETY_STATE_VIOLATION":return p.jsxRuntimeExports.jsx(We,{id:`safety-state-manual-action-required-${s}`,icon:AE,color:o.palette.warning.main,title:i("SafetyBar.SafetyState.ti"),name:i("SafetyBar.SafetyState.ManualActionRequired.lb"),label:r?null:i("SafetyBar.SafetyState.ManualActionRequired.lb"),explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.SafetyState.ManualActionRequired.Explanation.lb",children:"The robot controller has entered a safety state requiring manual action to resolve."}),literalValue:e,anchorOrigin:t,transformOrigin:n});case"SAFETY_STATE_UNKNOWN":case"SAFETY_STATE_FAULT":return p.jsxRuntimeExports.jsx(We,{id:`safety-state-error-${s}`,icon:ME,color:o.palette.error.main,title:i("SafetyBar.SafetyState.ti"),name:i("SafetyBar.SafetyState.Error.lb"),label:r?null:i("SafetyBar.SafetyState.Error.lb"),explanation:p.jsxRuntimeExports.jsx(le.Trans,{i18nKey:"SafetyBar.SafetyState.Error.Explanation.lb",children:"The robot controller has entered an unexpected safety state."}),literalValue:e,anchorOrigin:t,transformOrigin:n});default:Tl.assertUnreachable(e,`Unknown safety state ${e}`)}}),$E=p.externalizeComponent(re.observer(({isVirtual:e,motionGroupId:t,operationMode:n,safetyState:r,anchorOrigin:i,transformOrigin:o,compact:s=!0})=>{const a=s?1:2;return p.jsxRuntimeExports.jsxs(T.Stack,{direction:"row",gap:a,alignItems:"center",sx:{height:"24px"},children:[p.jsxRuntimeExports.jsx(LE,{safetyState:r,anchorOrigin:i,transformOrigin:o,compact:s}),p.jsxRuntimeExports.jsx(T.Divider,{orientation:"vertical",flexItem:!0}),p.jsxRuntimeExports.jsx(CE,{operationMode:n,anchorOrigin:i,transformOrigin:o,compact:s}),p.jsxRuntimeExports.jsx(T.Divider,{orientation:"vertical",flexItem:!0}),p.jsxRuntimeExports.jsx(yE,{isVirtual:e,motionGroupId:t,anchorOrigin:i,transformOrigin:o,compact:s})]})})),zE=T.styled(T.Fab,{shouldForwardProp:e=>e!=="selected"})(({theme:e})=>{var t,n,r;return{borderRadius:"20px","&:hover":{background:(t=e.palette.backgroundPaperElevation)==null?void 0:t[7]},variants:[{props:({selected:i})=>!i,style:{background:(n=e.palette.backgroundPaperElevation)==null?void 0:n[0],color:e.palette.action.disabled,"> img":{opacity:.4}}},{props:({selected:i})=>i,style:{background:(r=e.palette.backgroundPaperElevation)==null?void 0:r[11],border:`1px solid ${e.palette.divider}`,color:e.palette.primary.contrastText}}]}}),NE=e=>{const{ref:t,...n}=e;return p.jsxRuntimeExports.jsx(zE,{ref:t,selected:e.selected,...n,color:"secondary",variant:"circular"})};function FE(e){const{children:t,value:n,index:r,...i}=e;return p.jsxRuntimeExports.jsx("div",{role:"tabpanel",hidden:n!==r,id:`tabpanel-${r}`,"aria-labelledby":`tab-${r}`,...i,children:n===r&&p.jsxRuntimeExports.jsx(T.Box,{children:t})})}function GE({children:e,...t}){const{fullWidth:n,indicator:r,onChange:i,orientation:o,scrollButtons:s,selectionFollowsFocus:a,textColor:c,value:l,variant:u,...d}=t;return p.jsxRuntimeExports.jsx(T.Box,{...d,children:e})}const BE=p.externalizeComponent(re.observer(e=>{const{items:t,activeTab:n,defaultActiveTab:r=0,onTabChange:i,sx:o,ref:s}=e,a=n!==void 0,[c,l]=O.useState(r),u=a?n:c;O.useEffect(()=>{a||t.length!==0&&(c<0||c>t.length-1)&&l(0)},[t.length,a,c]);const d=(h,f)=>{a||l(f),i==null||i(f)};return p.jsxRuntimeExports.jsxs(T.Box,{ref:s,sx:{height:"100%",display:"flex",flexDirection:"column",...o},children:[p.jsxRuntimeExports.jsx(T.Box,{sx:{px:0,py:0,overflow:"visible",position:"relative",paddingTop:h=>h.spacing(2),paddingRight:h=>h.spacing(2.5)},children:p.jsxRuntimeExports.jsx(T.Tabs,{value:u,onChange:d,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:t.map((h,f)=>{var _,C,w;const m=()=>{if(!h.badge)return;const E=h.badge.content,M=h.badge.max;return typeof E=="number"&&M&&E>M?`${M}+`:E},y=()=>{if(!h.badge)return!1;const E=h.badge.content,M=h.badge.showZero;return!(E===0&&!M)},x=m(),b=y(),S=()=>{a||l(f),i==null||i(f)},v=p.jsxRuntimeExports.jsx(T.Tab,{label:h.label,icon:h.icon,iconPosition:"start",disableRipple:!0,onClick:S,sx:{minHeight:"32px",height:"32px",padding:"0px 10px",borderRadius:"12px",backgroundColor:E=>{var M;return((M=E.palette.backgroundPaperElevation)==null?void 0:M[11])||"#32344B"},color:"text.primary",opacity:u===f?1:.38,fontSize:"13px",transition:"all 0.2s ease-in-out",position:"relative",overflow:"visible","&:hover":{opacity:u===f?1:.6},"&.Mui-selected":{opacity:1,backgroundColor:E=>{var M;return((M=E.palette.backgroundPaperElevation)==null?void 0:M[11])||"#32344B"},color:"text.primary"},"&:focus":{outline:"none"},"&:active":{transform:"none"}}},h.id);return b?p.jsxRuntimeExports.jsx(GE,{component:"span",sx:{display:"inline-flex"},children:p.jsxRuntimeExports.jsx(T.Badge,{badgeContent:x,color:((_=h.badge)==null?void 0:_.color)||"error",max:(C=h.badge)==null?void 0:C.max,showZero:(w=h.badge)==null?void 0:w.showZero,anchorOrigin:{vertical:"top",horizontal:"right"},overlap:"rectangular",sx:{"& .MuiBadge-badge":{opacity:"1 !important"}},children:v})},h.id):v})})}),p.jsxRuntimeExports.jsx(T.Box,{sx:{mt:h=>h.spacing(2),borderBottom:1,borderColor:"divider"}}),p.jsxRuntimeExports.jsx(T.Box,{sx:{flex:1,overflow:"auto"},children:t.map((h,f)=>p.jsxRuntimeExports.jsx(FE,{value:u,index:f,children:h.content},h.id))})]})})),UE=e=>{const t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=e%60,o=[];return t>0?(o.push(t.toString()),o.push(n.toString().padStart(2,"0")),o.push(r.toString().padStart(2,"0")),o.push(i.toString().padStart(2,"0"))):n>0?(o.push(n.toString()),o.push(r.toString().padStart(2,"0")),o.push(i.toString().padStart(2,"0"))):(o.push(r.toString()),o.push(i.toString().padStart(2,"0"))),o.join(":")},wl=(e,t)=>{const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60),o=e%60;if(typeof Intl<"u"&&"DurationFormat"in Intl)try{const a={};return n>0&&(a.days=n),r>0&&(a.hours=r),i>0&&(a.minutes=i),(o>0||Object.keys(a).length===0)&&(a.seconds=o),new Intl.DurationFormat(t,{style:"narrow"}).format(a)}catch{}const s=[];return n>0&&s.push(`${n}d`),r>0&&s.push(`${r}h`),i>0&&s.push(`${i}m`),(o>0||s.length===0)&&s.push(`${o}s`),s.join(" ")},VE=({timerState:e,animationState:t,hasError:n,className:r})=>{const{t:i}=le.useTranslation(),o=p.useTheme$1(),{elapsedTime:s,currentProgress:a}=e,{showErrorAnimation:c,showPauseAnimation:l,showMainText:u}=t;return p.jsxRuntimeExports.jsxs(T.Box,{className:r,sx:{position:"relative",width:264,height:264,display:"flex",alignItems:"center",justifyContent:"center"},children:[p.jsxRuntimeExports.jsx(Wu.Gauge,{width:264,height:264,value:a,valueMin:0,valueMax:100,innerRadius:"85%",outerRadius:"100%",margin:0,skipAnimation:!0,text:()=>"",sx:{opacity:l||c?.6:1,transition:"opacity 0.5s ease-out","& .MuiGauge-valueArc":{fill:n?o.palette.error.light:o.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"}}}),p.jsxRuntimeExports.jsx(T.Box,{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:p.jsxRuntimeExports.jsxs(T.Box,{sx:{position:"relative",height:"48px",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:.5},children:[p.jsxRuntimeExports.jsx(T.Fade,{in:u&&n,timeout:200,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"h6",sx:{position:"absolute",fontSize:"16px",fontWeight:500,color:o.palette.error.light},children:i("timer.error")})}),p.jsxRuntimeExports.jsx(T.Fade,{in:u&&!n,timeout:300,children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"h1",sx:{position:"absolute",fontSize:"48px",fontWeight:500,color:o.palette.text.primary,lineHeight:1,letterSpacing:"-0.5px"},children:UE(s)})})]})})]})},HE=({timerState:e,animationState:t,hasError:n,compact:r,className:i})=>{const{t:o,i18n:s}=le.useTranslation(),a=p.useTheme$1(),{elapsedTime:c,currentProgress:l}=e,{showErrorAnimation:u,showPauseAnimation:d}=t;return r?p.jsxRuntimeExports.jsx(T.Box,{className:i,sx:{display:"flex",alignItems:"center",m:0},children:p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:n?a.palette.error.light:a.palette.text.primary,fontSize:"14px",transition:"color 0.5s ease-out"},children:n?o("timer.error"):wl(c,s.language)})}):p.jsxRuntimeExports.jsxs(T.Box,{className:i,sx:{display:"flex",alignItems:"center",m:0,gap:1},children:[p.jsxRuntimeExports.jsx(T.Box,{sx:{width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",opacity:d||u?.6:1,transition:"opacity 0.5s ease-out"},children:p.jsxRuntimeExports.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",style:{transform:"rotate(-90deg)"},role:"img","aria-label":"Timer progress",children:[p.jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?a.palette.error.light:a.palette.success.main,strokeWidth:"2",opacity:.3,style:{transition:"stroke 0.8s ease-in-out, opacity 2s ease-in-out"}}),p.jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:n?a.palette.error.light:a.palette.success.main,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*8}`,strokeDashoffset:`${2*Math.PI*8*(1-l/100)}`,style:{transition:"stroke-dashoffset 0.1s ease-out, stroke 0.8s ease-in-out, opacity 2s ease-in-out"}})]})}),p.jsxRuntimeExports.jsx(T.Typography,{variant:"body2",sx:{color:n?a.palette.error.light:a.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?o("timer.error"):wl(c,s.language)})]})},WE=()=>{const[e,t]=O.useState({showPauseAnimation:!1,showErrorAnimation:!1,showMainText:!0}),n=O.useRef(null),r=O.useRef(null),i=O.useRef(null),o=O.useCallback(()=>{t(d=>({...d,showPauseAnimation:!0})),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{t(d=>({...d,showPauseAnimation:!1}))},800)},[]),s=O.useCallback(()=>{t(d=>({...d,showErrorAnimation:!0})),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{t(d=>({...d,showErrorAnimation:!1}))},600)},[]),a=O.useCallback(()=>{t(d=>({...d,showErrorAnimation:!1})),r.current&&clearTimeout(r.current)},[]),c=O.useCallback(()=>{t(d=>({...d,showMainText:!1})),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{t(d=>({...d,showMainText:!0}))},200)},[]),l=O.useCallback(()=>{t(d=>({...d,showMainText:!0}))},[]),u=O.useCallback(()=>{n.current&&clearTimeout(n.current),r.current&&clearTimeout(r.current),i.current&&clearTimeout(i.current)},[]);return{animationState:e,triggerPauseAnimation:o,triggerErrorAnimation:s,clearErrorAnimation:a,triggerFadeTransition:c,setInitialAnimationState:l,cleanup:u}},qE=({autoStart:e,hasError:t,onPauseAnimation:n,onErrorAnimation:r,onClearErrorAnimation:i})=>{const[o,s]=O.useState({elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0,wasRunningBeforeError:!1}),a=O.useRef(null),c=O.useRef(null),l=O.useRef(0),u=O.useRef(0),[d]=se.useInterpolation([0],{tension:80,friction:18,onChange:([b])=>{s(S=>({...S,currentProgress:b}))}}),h=O.useCallback((b=0)=>{const S=b/60%1*100;s(v=>({...v,elapsedTime:b,isPausedState:!1,currentProgress:S})),l.current=0,u.current=S,d.setImmediate([S]),e?(c.current=Date.now()-b*1e3,s(v=>({...v,isRunning:!0}))):c.current=null},[e,d]),f=O.useCallback(()=>{if(c.current&&o.isRunning){const S=(Date.now()-c.current)/1e3+l.current,v=S/60%1*100;d.setTarget([v]),s(_=>({..._,elapsedTime:Math.floor(S)}))}s(b=>({...b,isRunning:!1,isPausedState:!0})),n()},[o.isRunning,d,n]),m=O.useCallback(()=>{o.isPausedState&&(l.current=o.elapsedTime,c.current=Date.now(),s(b=>({...b,isRunning:!0,isPausedState:!1})))},[o.isPausedState,o.elapsedTime]),y=O.useCallback(()=>{s(b=>({...b,elapsedTime:0,isRunning:!1,isPausedState:!1,currentProgress:0})),l.current=0,c.current=null,u.current=0,d.setImmediate([0])},[d]),x=O.useCallback(()=>o.isPausedState,[o.isPausedState]);return O.useEffect(()=>{t?(o.isRunning&&(s(b=>({...b,wasRunningBeforeError:!0})),f()),r()):(o.wasRunningBeforeError&&!o.isRunning&&(s(b=>({...b,wasRunningBeforeError:!1})),m()),i())},[t,o.isRunning,o.wasRunningBeforeError,f,m,r,i]),O.useEffect(()=>{if(o.isRunning){const b=()=>{if(c.current){const v=(Date.now()-c.current)/1e3+l.current,_=v/60%1*100;s(w=>({...w,elapsedTime:Math.floor(v)})),Math.abs(_-u.current)>.1&&(d.setTarget([_]),u.current=_)}a.current=requestAnimationFrame(b)};a.current=requestAnimationFrame(b)}else a.current&&(cancelAnimationFrame(a.current),a.current=null);return()=>{a.current&&(cancelAnimationFrame(a.current),a.current=null)}},[o.isRunning,d]),O.useEffect(()=>{let b=null;const S=()=>{d.update(),b=requestAnimationFrame(S)};return b=requestAnimationFrame(S),()=>{b&&cancelAnimationFrame(b)}},[d]),{timerState:o,controls:{start:h,pause:f,resume:m,reset:y,isPaused:x}}},YE=p.externalizeComponent(re.observer(({onTimerReady:e,autoStart:t=!0,variant:n="default",compact:r=!1,className:i,hasError:o=!1})=>{const{animationState:s,triggerPauseAnimation:a,triggerErrorAnimation:c,clearErrorAnimation:l,setInitialAnimationState:u,cleanup:d}=WE(),{timerState:h,controls:f}=qE({autoStart:t,hasError:o,onPauseAnimation:a,onErrorAnimation:c,onClearErrorAnimation:l});return O.useEffect(()=>{u()},[u]),O.useEffect(()=>{let m=!0;const y=setTimeout(()=>{m&&e(f)},0);return()=>{m=!1,clearTimeout(y)}},[e,f]),O.useEffect(()=>d,[d]),n==="small"?p.jsxRuntimeExports.jsx(HE,{timerState:h,animationState:s,hasError:o,compact:r,className:i}):p.jsxRuntimeExports.jsx(VE,{timerState:h,animationState:s,hasError:o,className:i})})),El=1e-4,JE={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class Nr{constructor(t,n,r,i,o,s,a,c,l,u){this.nova=t,this.controller=n,this.motionGroup=r,this.initialMotionState=i,this.motionStateSocket=o,this.isVirtual=s,this.tcps=a,this.description=c,this.initialControllerState=l,this.controllerStateSocket=u,this.connectedJoggingSocket=null,this.joggingVelocity=10,this.activationState="inactive",this.rapidlyChangingMotionState=i,this.controllerState=l,u.addEventListener("message",d=>{var f;const h=(f=me.tryParseJson(d.data))==null?void 0:f.result;h&&ae.runInAction(()=>{this.controllerState=h})}),o.addEventListener("message",d=>{var f;const h=(f=me.tryParseJson(d.data))==null?void 0:f.result;if(!h)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${d.data}`);ms(this.rapidlyChangingMotionState.joint_position,h.joint_position,El)||ae.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=h.joint_position}),gs(this.rapidlyChangingMotionState,h,El)||ae.runInAction(()=>{this.rapidlyChangingMotionState.tcp_pose=h.tcp_pose}),this.rapidlyChangingMotionState.standstill!==h.standstill&&ae.runInAction(()=>{this.rapidlyChangingMotionState.standstill=h.standstill})}),ae.makeAutoObservable(this)}static async connectMultiple(t,n){return Promise.all(n.map(r=>Nr.connect(t,r)))}static async connect(t,n){var b,S;const[r,i]=n.split("@"),o=await t.api.controller.getCurrentRobotControllerState(i),s=o==null?void 0:o.motion_groups.find(v=>v.motion_group===n);if(!o||!s)throw new Error(`Controller ${i} or motion group ${n} not found`);const a=t.openReconnectingWebsocket(`/controllers/${i}/motion-groups/${n}/state-stream`),c=await a.firstMessage(),l=(b=me.tryParseJson(c.data))==null?void 0:b.result;if(!l)throw new Error(`Unable to parse initial motion state message ${c.data}`);console.log(`Connected motion state websocket to motion group ${s.motion_group}. Initial state:
77
- `,l);const d=(await t.api.controller.getRobotController(o.controller)).configuration.kind==="VirtualController",h=await t.api.motionGroup.getMotionGroupDescription(i,s.motion_group),f=Object.entries(h.tcps||{}).map(([v,_])=>({id:v,readable_name:_.name,position:_.pose.position,orientation:_.pose.orientation})),m=t.openReconnectingWebsocket(`/controllers/${o.controller}/state-stream?response_rate=1000`),y=await m.firstMessage(),x=(S=me.tryParseJson(y.data))==null?void 0:S.result;if(!x)throw new Error(`Unable to parse initial controller state message ${y.data}`);return console.log(`Connected controller state websocket to controller ${o.controller}. Initial state:
78
- `,x),new Nr(t,o,s,l,a,d,f,h,x,m)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get modelFromController(){return this.description.motion_group_model}get wandelscriptIdentifier(){const t=this.motionGroupId.split("@")[0];return`${this.controllerId.replace(/-/g,"_")}_${t}`}get joggingVelocityRads(){return this.joggingVelocity*Math.PI/180}get joints(){return this.initialMotionState.joint_position.map((t,n)=>({index:n}))}get dhParameters(){if(this.description.dh_parameters!==void 0)return this.description.dh_parameters.map(t=>({...JE,...t}))}get safetyZones(){return this.description.safety_zones}get mountingPosition(){var t,n,r;return this.description.mounting?[(((t=this.description.mounting.position)==null?void 0:t[0])||0)/1e3,(((n=this.description.mounting.position)==null?void 0:n[1])||0)/1e3,(((r=this.description.mounting.position)==null?void 0:r[2])||0)/1e3]:[0,0,0]}get mountingQuaternion(){var i,o,s,a,c,l;const t=new Ts.Vector3(((o=(i=this.description.mounting)==null?void 0:i.orientation)==null?void 0:o[0])||0,((a=(s=this.description.mounting)==null?void 0:s.orientation)==null?void 0:a[1])||0,((l=(c=this.description.mounting)==null?void 0:c.orientation)==null?void 0:l[2])||0),n=t.length(),r=t.normalize();return new Ts.Quaternion().setFromAxisAngle(r,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}ae.runInAction(()=>{this.activationState="deactivating"});try{await this.nova.api.controller.setDefaultMode(this.controllerId,"ROBOT_SYSTEM_MODE_MONITOR"),ae.runInAction(()=>{this.activationState="inactive"})}catch(t){throw ae.runInAction(()=>{this.activationState="active"}),t}}async activate(){if(this.activationState!=="inactive"){console.error("Tried to activate while already activating");return}ae.runInAction(()=>{this.activationState="activating"});try{await this.nova.api.controller.setDefaultMode(this.controllerId,"ROBOT_SYSTEM_MODE_CONTROL"),ae.runInAction(()=>{this.activationState="active"})}catch(t){throw ae.runInAction(()=>{this.activationState="inactive"}),t}}toggleActivation(){this.activationState==="inactive"?this.activate():this.activationState==="active"&&this.deactivate()}dispose(){this.motionStateSocket.close(),this.connectedJoggingSocket&&this.connectedJoggingSocket.close()}setJoggingVelocity(t){this.joggingVelocity=t}}function Fu(){var t,n,r,i,o,s,a;const e=T.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{...e,components:{MuiCssBaseline:{styleOverrides:{"html, body, *":{scrollbarWidth:"none",msOverflowStyle:"none"},"html:hover, body:hover, *:hover":{scrollbarWidth:"thin",scrollbarColor:`${e.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 ${e.palette.divider}`,background:(r=(n=(t=e.paletteExt)==null?void 0:t.secondary)==null?void 0:n.tonal)==null?void 0:r.toString()}},{props:{color:"secondary",variant:"outlined"},style:{border:`1px solid ${e.palette.divider}`}}]},MuiTab:{styleOverrides:{root:{textTransform:"none",color:e.palette.text.secondary,"&.Mui-selected":{color:e.palette.text.primary}}}},MuiTabs:{styleOverrides:{root:{background:(i=e.palette.backgroundPaperElevation)==null?void 0:i[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:(s=(o=e.paletteExt)==null?void 0:o.secondary)==null?void 0:s.tonal}},variants:[{props:{color:"primary"},style:{background:e.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:e.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:e.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:e.palette.text.primary}}},JoggingJoint:{Joint:{arrowColor:e.palette.text.primary}},VelocitySlider:{sliderLegendColor:e.palette.text.primary}},WandelscriptEditor:{monacoTheme:{base:"vs-dark",inherit:!0,rules:[{token:"keyword",foreground:"#b349a9ff"}],colors:{"editor.background":T.rgbToHex(((a=e.palette.backgroundPaperElevation)==null?void 0:a[5])??""),"editor.foreground":"#d4d4d4","editorLineNumber.foreground":"#797979","editorLineNumber.activeForeground":"#e9e9e9","editor.lineHighlightBorder":"#e9e9e911"}}}}}}function XE(){const e=Fu();return e.palette.mode="light",e}function KE(e){var r,i,o,s;let t=!0;((r=e.palette)==null?void 0:r.mode)==="light"?t=!1:((i=e.palette)==null?void 0:i.mode)!=="dark"&&(t=!(typeof window<"u"&&((s=(o=window.matchMedia)==null?void 0:o.call(window,"(prefers-color-scheme: light)"))==null?void 0:s.matches)));const n=t?Fu():XE();return p.createTheme$1(n,e)}exports.AppHeader=zd;exports.ConnectedMotionGroup=Nr;exports.CycleTimer=hy;exports.JoggerConnection=li;exports.JoggingCartesianAxisControl=lo;exports.JoggingJointRotationControl=uu;exports.JoggingPanel=Qw;exports.JoggingStore=fi;exports.LogPanel=aE;exports.LogStore=$u;exports.LogViewer=zu;exports.MotionStreamConnection=ai;exports.NoMotionGroupModal=cE;exports.PoseCartesianValues=tE;exports.PoseJointValues=nE;exports.RobotListItem=fE;exports.RobotSetupReadinessIndicator=Nu;exports.RobotSetupReadinessState=Ss;exports.SafetyBar=$E;exports.SelectableFab=NE;exports.TabBar=BE;exports.Timer=YE;exports.VelocitySlider=Pu;exports.VelocitySliderLabel=Es;exports.WandelbotsDataGrid=au;exports.createDebugMessage=rE;exports.createErrorMessage=sE;exports.createInfoMessage=iE;exports.createLogMessage=Vn;exports.createNovaMuiTheme=KE;exports.createWarningMessage=oE;exports.jointValuesEqual=ms;exports.poseEqual=du;exports.tcpMotionEqual=gs;exports.unwrapRotationVector=hu;
79
- //# sourceMappingURL=theming-neVGQ-FN.cjs.map