UNPKG

ocearo-ui

Version:

Ocean Robot UI: 3D visualization dashboard for signalk

1 lines 97.4 kB
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54784,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(46932),l=e.i(88653),n=e.i(49721),i=e.i(68757);e.i(85269);var r=e.i(22831),o=e.i(85709),c=e.i(67561);let d=({title:e,icon:a,iconColorClass:s="text-oBlue",hasData:l=!0,noDataMessage:i="No data available",children:r,className:o=""})=>{let{nightMode:d}=(0,c.useOcearoContext)(),u=d?"text-oNight":"text-hud-main",x=d?"text-oNight":s,h=()=>"function"==typeof a?a():(0,t.jsx)(n.FontAwesomeIcon,{icon:a,className:`${x} text-sm opacity-80`});return l?(0,t.jsxs)("div",{className:`tesla-card p-4 h-full flex flex-col tesla-hover overflow-hidden ${o}`,children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 mb-3 shrink-0",children:[h(),(0,t.jsx)("span",{className:`${u} text-xs font-black uppercase tracking-widest`,children:e})]}),(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center min-h-0 overflow-hidden",children:r})]}):(0,t.jsxs)("div",{className:`tesla-card p-4 h-full flex flex-col tesla-hover overflow-hidden ${o}`,children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 mb-3 shrink-0",children:[h(),(0,t.jsx)("span",{className:`${u} text-xs font-black uppercase tracking-widest`,children:e})]}),(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center min-h-0",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-4xl font-black text-hud-dim mb-2 gliding-value",children:"N/A"}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-tighter ${d?"text-oNight":"text-hud-muted"}`,children:i})]})})]})};var u=e.i(83402);let x="environment.sun.sunrise",h=e=>e||"07:25",m="environment.sun.sunset",g=e=>e||"18:06",p=e=>Math.PI/180*e,f=e=>180/Math.PI*e,v=e=>{let t=e%360;return t<0?t+360:t},b=e=>{let t=e%24;return t<0?t+24:t},w=(e,t,a,s)=>{let l;if(null==e||null==t)return null;let n=(l=Date.UTC(a.getUTCFullYear(),0,1),Math.floor((Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate())-l)/864e5)+1),i=t/15,r=n+((s?6:18)-i)/24,o=.9856*r-3.289,c=v(o+1.916*Math.sin(p(o))+.02*Math.sin(2*p(o))+282.634),d=v(f(Math.atan(.91764*Math.tan(p(c))))),u=90*Math.floor(d/90);d=(d+(90*Math.floor(c/90)-u))/15;let x=.39782*Math.sin(p(c)),h=Math.cos(Math.asin(x)),m=(Math.cos(p(90.833))-x*Math.sin(p(e)))/(h*Math.cos(p(e)));if(m>1||m<-1)return null;let g=s?360-f(Math.acos(m)):f(Math.acos(m)),w=b((g/=15)+d-.06571*r-6.622-i);return b(w+Math.round(t/15))},j=e=>{if(null==e)return null;let t=b(e),a=Math.floor(t),s=Math.round((t-a)*60),l=a;return 60===s&&(s=0,l=(l+1)%24),`${l.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`};function N(){let{t:e}=(0,r.useTranslation)(),s=u.default.get("debugMode"),l=(0,o.useSignalKPaths)([x,m,"navigation.position.latitude","navigation.position.longitude"]),c=l[x],p=l[m],f=l["navigation.position.latitude"],v=l["navigation.position.longitude"],b=(0,a.useMemo)(()=>{let e=null!==c?h(c):null,t=null!==p?g(p):null,a=((e,t,a)=>{if(null==e||null==t)return null;let s=180/Math.PI*e,l=180/Math.PI*t,n=w(s,l,a,!0),i=w(s,l,a,!1),r=null!==n?j(n):null,o=null!==i?j(i):null;return null===r&&null===o?null:{sunrise:r,sunset:o}})(f,v,new Date),l=s?h(null):null,n=s?g(null):null,i=e??(a?a.sunrise:null)??l,r=t??(a?a.sunset:null)??n;return null===i&&null===r?{hasData:!1}:{hasData:!0,sunrise:i,sunset:r}},[c,p,f,v,s]),{hasData:N,sunrise:y,sunset:k}=b;return(0,t.jsx)(d,{title:e("widgets.solarCycle"),icon:i.faSun,hasData:b.hasData,noDataMessage:e("widgets.signalLossCelestial"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col justify-center py-4",children:[(0,t.jsx)("div",{className:"relative mb-8 group",children:(0,t.jsxs)("div",{className:"w-full h-16 relative overflow-hidden rounded-sm bg-gradient-to-r from-orange-950 via-orange-600/20 to-yellow-900/40 shadow-inner border border-hud transition-all duration-700 group-hover:scale-[1.02]",children:[(0,t.jsx)("div",{className:"absolute bottom-4 w-full h-px bg-hud-muted opacity-20 shadow-[0_-4px_10px_var(--hud-text-main)] shadow-opacity-10"}),(0,t.jsx)("div",{className:"absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2",children:(0,t.jsx)("div",{className:"w-10 h-10 bg-oYellow rounded-full shadow-[0_0_25px_var(--color-oYellow)] shadow-opacity-40 flex items-center justify-center border border-hud animate-soft-pulse",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faSun,className:"text-orange-900 text-sm"})})}),(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-transparent to-orange-500/5 pointer-events-none"})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"text-center tesla-card bg-hud-bg p-4 tesla-hover border border-hud",children:[(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase mb-3 font-black tracking-widest",children:e("widgets.solarIngress")}),(0,t.jsx)("div",{className:"text-3xl font-black text-oYellow leading-none gliding-value tracking-tighter",children:null!==y?y:e("common.na")}),(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase mt-3 font-black tracking-widest opacity-60",children:e("widgets.localMeridian")})]}),(0,t.jsxs)("div",{className:"text-center tesla-card bg-hud-bg p-4 tesla-hover border border-hud",children:[(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase mb-3 font-black tracking-widest",children:e("widgets.solarEgress")}),(0,t.jsx)("div",{className:"text-3xl font-black text-orange-500 leading-none gliding-value tracking-tighter",children:null!==k?k:e("common.na")}),(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase mt-3 font-black tracking-widest opacity-60",children:e("widgets.localMeridian")})]})]})]})})}function y(){let{t:e}=(0,r.useTranslation)(),s=u.default.get("debugMode"),l=(0,o.useSignalKPath)("environment.outside.uvIndex"),n=(0,a.useMemo)(()=>null!==l||s?{hasData:!0,uvIndex:null!==l?(l||0).toFixed(1):s?4:null}:{hasData:!1},[l,s]),{hasData:c,uvIndex:x}=n,h=t=>{let a=parseFloat(t);return a<=2?{level:e("widgets.uvLow"),color:"text-oGreen",bg:"bg-oGreen/10 border-oGreen/20"}:a<=5?{level:e("widgets.uvModerate"),color:"text-oYellow",bg:"bg-oYellow/10 border-oYellow/20"}:a<=7?{level:e("widgets.uvHigh"),color:"text-orange-400",bg:"bg-orange-400/10 border-orange-400/20"}:a<=10?{level:e("widgets.uvVeryHigh"),color:"text-oRed",bg:"bg-oRed/10 border-oRed/20"}:{level:e("widgets.uvExtreme"),color:"text-purple-400",bg:"bg-purple-400/10 border-purple-400/20"}},m=c?h(x):null;return(0,t.jsx)(d,{title:e("widgets.solarRadiation"),icon:i.faSun,hasData:n.hasData,noDataMessage:e("widgets.signalLossUV"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col justify-center py-4 space-y-8",children:[(0,t.jsxs)("div",{className:"text-center group",children:[(0,t.jsx)("div",{className:`text-6xl font-black mb-4 leading-none gliding-value tracking-tighter ${null!==x?h(x).color:"text-hud-muted"} ${parseFloat(x)>=6?"animate-soft-pulse":""}`,children:null!==x?x:e("common.na")}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.3em] mt-4 ${null!==x?h(x).color:"text-hud-muted"}`,children:null!==x?h(x).level:e("widgets.offline")})]}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)("div",{className:`inline-block px-4 py-1.5 rounded-sm uppercase text-xs font-black tracking-[0.2em] shadow-soft ${m?.bg||"bg-hud-bg border-hud"} border border-hud`,children:(0,t.jsxs)("span",{className:m?.color||"text-hud-muted",children:[m?.level||e("widgets.uvUnknown")," ",e("widgets.riskThreshold")]})})}),(0,t.jsxs)("div",{className:"w-full px-2",children:[(0,t.jsxs)("div",{className:"flex h-1 rounded-full overflow-hidden shadow-inner bg-hud-elevated",children:[(0,t.jsx)("div",{className:"flex-1 bg-oGreen/40"}),(0,t.jsx)("div",{className:"flex-1 bg-oYellow/40"}),(0,t.jsx)("div",{className:"flex-1 bg-orange-500/40"}),(0,t.jsx)("div",{className:"flex-1 bg-oRed/40"}),(0,t.jsx)("div",{className:"flex-1 bg-purple-500/40"})]}),null!==x&&m&&(0,t.jsx)("div",{className:"relative h-1 w-full",style:{top:"-4px"},children:(0,t.jsx)("div",{className:`absolute w-2 h-2 rounded-full border border-hud-main shadow-soft transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${m.color.replace("text-","bg-")} shadow-[0_0_8px_currentColor]`,style:{left:`${Math.min(100,parseFloat(x)/11*100)}%`,transform:"translateX(-50%)"}})}),(0,t.jsxs)("div",{className:"flex justify-between text-xs font-black text-hud-muted mt-4 uppercase tracking-widest px-0.5",children:[(0,t.jsx)("span",{children:"0"}),(0,t.jsx)("span",{children:"2"}),(0,t.jsx)("span",{children:"5"}),(0,t.jsx)("span",{children:"7"}),(0,t.jsx)("span",{children:"11+"})]})]})]})})}let k="environment.inside.relativeHumidity",M=e=>(100*(e||0)).toFixed(0),S="environment.inside.dewPoint",D=e=>((e||0)-273.15).toFixed(1);function $(){let e,s,{t:l}=(0,r.useTranslation)(),c=u.default.get("debugMode"),x=(0,o.useSignalKPath)(k),h=(0,o.useSignalKPath)(S),m=(0,a.useMemo)(()=>{if(!(null!==x||null!==h||c))return{hasData:!1};let e=null!==x?M(x):c?"65":null;return{hasData:!0,humidity:e,humidityPercentage:e,dewPointCelsius:null!==h?D(h):c?"18.5":null}},[x,h,c]),{humidity:g,humidityPercentage:p,dewPointCelsius:f}=m;return(0,t.jsx)(d,{title:l("widgets.humidityAnalysis"),icon:i.faTint,hasData:m.hasData,noDataMessage:l("widgets.signalLossHygrometer"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col justify-center py-4 space-y-8",children:[(0,t.jsxs)("div",{className:"text-center group",children:[(0,t.jsxs)("div",{className:`text-6xl font-black mb-4 leading-none gliding-value tracking-tighter text-hud-main ${parseInt(g)>70||30>parseInt(g)?"animate-soft-pulse":""}`,children:[null!==g?g:l("common.na"),(0,t.jsx)("span",{className:"text-xl text-hud-muted ml-2 uppercase font-black tracking-widest",children:"%"})]}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.3em] mt-4 ${null!==g?(e=parseInt(g))<30||e>70?"text-oYellow":e<40||e>60?"text-oBlue":"text-oGreen":"text-hud-muted"}`,children:l(null!==g?(s=parseInt(g))<30?"widgets.tooDry":s>70?"widgets.tooHumid":s<40||s>60?"widgets.moderate":"widgets.optimal":"widgets.offline")})]}),(0,t.jsxs)("div",{className:"px-2",children:[(0,t.jsx)("div",{className:"w-full bg-hud-elevated rounded-full h-1 overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${30>parseInt(g)||parseInt(g)>70?"bg-oYellow":"bg-oBlue shadow-[0_0_8px_var(--color-oBlue)] shadow-opacity-40"}`,style:{width:`${null!==p?p:0}%`}})}),(0,t.jsxs)("div",{className:"flex justify-between text-xs font-black text-hud-muted mt-4 uppercase tracking-widest px-0.5",children:[(0,t.jsx)("span",{children:l("widgets.arid")}),(0,t.jsx)("span",{children:l("widgets.balanced")}),(0,t.jsx)("span",{children:l("widgets.saturated")})]})]}),(0,t.jsx)("div",{className:"tesla-card p-4 bg-hud-bg tesla-hover border border-hud",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faThermometerHalf,className:"text-oBlue text-xs opacity-50"}),(0,t.jsx)("span",{className:"text-hud-secondary text-xs uppercase font-black tracking-widest",children:l("widgets.dewPoint")})]}),(0,t.jsx)("div",{className:"text-hud-main font-black text-lg gliding-value",children:null!==f?`${f}\xb0`:l("common.na")})]})})]})})}var C=e.i(46991);function P(){let{t:e}=(0,r.useTranslation)(),s=u.default.get("debugMode"),l=(0,o.useSignalKPath)("environment.outside.pressure"),n=(0,a.useMemo)(()=>{let e;return null!==l||s?{hasData:!0,pressureMbar:null!==l?(e=l,(0,C.convertPressure)(e||0)):s?1013:null}:{hasData:!1}},[l,s]),{hasData:c,pressureMbar:x}=n;return(0,t.jsx)(d,{title:e("widgets.pressureTelemetry"),icon:i.faGaugeHigh,hasData:n.hasData,noDataMessage:e("widgets.signalLossPressure"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center min-h-0",children:[(0,t.jsxs)("div",{className:"relative flex-1 flex items-center justify-center min-h-0 w-full",children:[(0,t.jsxs)("svg",{className:"w-full h-full max-w-[12rem] max-h-[12rem] transform -rotate-90 filter drop-shadow-[0_0_15px_var(--color-oBlue)] shadow-opacity-10",viewBox:"0 0 100 100",children:[(0,t.jsx)("circle",{cx:"50",cy:"50",r:"44",fill:"none",stroke:"var(--hud-border)",strokeWidth:"4",opacity:"0.2"}),(0,t.jsx)("circle",{cx:"50",cy:"50",r:"44",fill:"none",stroke:"var(--color-oBlue)",strokeWidth:"4",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*44}`,strokeDashoffset:`${null!==x?2*Math.PI*44*(1-(Math.min(Math.max(x,950),1050)-950)/100):2*Math.PI*44}`,className:"transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1)"})]}),(0,t.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,t.jsx)("div",{className:"text-4xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:null!==x?x:e("common.na")}),(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase font-black mt-1 tracking-[0.2em] opacity-60",children:"mbar"})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between w-full shrink-0",children:[(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.2em] ${null!==x?x<1e3?"text-oRed":x>1025?"text-oBlue":"text-oGreen":"text-hud-muted"} ${null!==x&&(x<1e3||x>1025)?"animate-soft-pulse":""}`,children:e(null!==x?x<1e3?"widgets.pressureLow":x>1025?"widgets.pressureHigh":"widgets.pressureNormal":"widgets.offline")}),(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase font-black tracking-widest opacity-40",children:"950 — 1050"})]})]})})}let T="environment.inside.co2",F=e=>Math.round(e||0),A="environment.inside.pm25",I=e=>Math.round(e||0);function W(){var e;let{t:s}=(0,r.useTranslation)(),l=u.default.get("debugMode"),n=(0,o.useSignalKPath)(T),c=(0,o.useSignalKPath)(A),x=(0,a.useMemo)(()=>null!==n||null!==c||l?{hasData:!0,co2:null!==n?F(n):l?420:null,pm25:null!==c?I(c):l?12:null}:{hasData:!1},[n,c,l]),{hasData:h,co2:m,pm25:g}=x,p=(e=m||400)<=800?{level:s("widgets.aqGood"),color:"text-oGreen",bg:"bg-oGreen/10 border-oGreen/20"}:e<=1e3?{level:s("widgets.aqModerate"),color:"text-oYellow",bg:"bg-oYellow/10 border-oYellow/20"}:e<=1500?{level:s("widgets.aqPoor"),color:"text-orange-400",bg:"bg-orange-400/10 border-orange-400/20"}:e<=2e3?{level:s("widgets.aqUnhealthy"),color:"text-oRed",bg:"bg-oRed/10 border-oRed/20"}:{level:s("widgets.aqHazardous"),color:"text-oRed",bg:"bg-oRed/20 border-oRed/30"};return(0,t.jsx)(d,{title:s("widgets.airQualityMonitoring"),icon:i.faWind,hasData:x.hasData,noDataMessage:s("widgets.signalLossAir"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center",children:[(0,t.jsx)("div",{className:`text-6xl font-black mb-3 leading-none gliding-value tracking-tighter ${p.color} ${m>1500?"animate-soft-pulse":""}`,children:null!==m?m:s("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-xs uppercase font-black tracking-[0.3em] opacity-60",children:s("widgets.co2Concentration")}),(0,t.jsx)("div",{className:"w-full bg-hud-elevated rounded-full h-1 mt-4 overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${m<=800?"bg-oGreen":m<=1e3?"bg-oYellow":"bg-oRed"}`,style:{width:`${null!==m?Math.min(m/2e3*100,100):0}%`}})}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)("div",{className:`inline-block px-4 py-1.5 rounded-sm uppercase text-xs font-black tracking-[0.2em] shadow-soft ${p.bg} border border-hud`,children:(0,t.jsxs)("span",{className:p.color,children:[p.level," ",s("widgets.atmosphere")]})})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 shrink-0",children:[(0,t.jsxs)("div",{className:"tesla-card p-3 text-center tesla-hover bg-hud-bg",children:[(0,t.jsx)("div",{className:`text-2xl font-black mb-1 gliding-value ${g>25?"text-oRed":"text-hud-main"}`,children:null!==g?g:s("common.na")}),(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase font-black tracking-widest opacity-60",children:s("widgets.pm25Particulate")})]}),(0,t.jsxs)("div",{className:"tesla-card p-3 bg-hud-bg tesla-hover flex flex-col justify-center space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs font-black uppercase tracking-widest",children:[(0,t.jsx)("span",{className:"text-hud-muted",children:s("widgets.nominal")}),(0,t.jsx)("span",{className:"text-oGreen",children:"< 800"})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs font-black uppercase tracking-widest",children:[(0,t.jsx)("span",{className:"text-hud-muted",children:s("widgets.critical")}),(0,t.jsx)("span",{className:"text-oRed",children:"> 1500"})]})]})]})]})})}var G=e.i(1725),L=e.i(237),R=e.i(85183),B=e.i(93230),K=e.i(72526),O=e.i(34239),E=e.i(31195),Y=e.i(7670),U=e.i(97865),H=e.i(494),z=e.i(94395),_=e.i(44171),q=e.i(46710),V=e.i(31725),X=e.i(27241),Z=e.i(61764),Q=e.i(75337),J=e.i(89763),ee=e.i(43404),et=e.i(51883),ea=e.i(29601),es=e.i(18457),el=e.i(22075);class en{constructor(e){var{x:t,y:a}=e;this.xAxisScale=t,this.yAxisScale=a}map(e,t){var a,s,{position:l}=t;return{x:null!=(a=this.xAxisScale.map(e.x,{position:l}))?a:0,y:null!=(s=this.yAxisScale.map(e.y,{position:l}))?s:0}}mapWithFallback(e,t){var a,s,l,n,{position:i,fallback:r}=t;return l="rangeMin"===r?this.yAxisScale.rangeMin():"rangeMax"===r?this.yAxisScale.rangeMax():0,n="rangeMin"===r?this.xAxisScale.rangeMin():"rangeMax"===r?this.xAxisScale.rangeMax():0,{x:null!=(a=this.xAxisScale.map(e.x,{position:i}))?a:n,y:null!=(s=this.yAxisScale.map(e.y,{position:i}))?s:l}}isInRange(e){var{x:t,y:a}=e,s=null==t||this.xAxisScale.isInRange(t),l=null==a||this.yAxisScale.isInRange(a);return s&&l}}function ei(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,s)}return a}function er(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?ei(Object(a),!0).forEach(function(t){var s,l,n;s=e,l=t,n=a[t],(l=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var s=a.call(e,t||"default");if("object"!=typeof s)return s;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(l))in s?Object.defineProperty(s,l,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[l]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):ei(Object(a)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}function eo(){return(eo=Object.assign.bind()).apply(null,arguments)}function ec(e){var t=(0,X.useAppDispatch)();return(0,a.useEffect)(()=>(t((0,V.addLine)(e)),()=>{t((0,V.removeLine)(e))})),null}function ed(e){var{xAxisId:t,yAxisId:s,shape:l,className:n,ifOverflow:i}=e,r=(0,Q.useIsPanorama)(),o=(0,J.useClipPathId)(),c=(0,X.useAppSelector)(e=>(0,Z.selectXAxisSettings)(e,t)),d=(0,X.useAppSelector)(e=>(0,Z.selectYAxisSettings)(e,s)),u=(0,X.useAppSelector)(e=>(0,Z.selectAxisScale)(e,"xAxis",t,r)),x=(0,X.useAppSelector)(e=>(0,Z.selectAxisScale)(e,"yAxis",s,r)),h=(0,q.useViewBox)();if(!o||!h||null==c||null==d||null==u||null==x)return null;var m=((e,t,a,s,l,n,i)=>{var r,o,{x:c,y:d,segment:u,ifOverflow:x}=i,h=(0,z.isNumOrStr)(c);return(0,z.isNumOrStr)(d)?((e,t,a,s,l,n)=>{var{x:i,width:r}=n,o=l.map(e,{position:a});if(!(0,el.isWellBehavedNumber)(o)||"discard"===t&&!l.isInRange(o))return null;var c=[{x:i+r,y:o},{x:i,y:o}];return"left"===s?c.reverse():c})(d,x,s,n,t,a):h?((e,t,a,s,l,n)=>{var{y:i,height:r}=n,o=l.map(e,{position:a});if(!(0,el.isWellBehavedNumber)(o)||"discard"===t&&!l.isInRange(o))return null;var c=[{x:o,y:i+r},{x:o,y:i}];return"top"===s?c.reverse():c})(c,x,s,l,e,a):null!=u&&2===u.length?(o=[(r=new en({x:e,y:t})).mapWithFallback(u[0],{position:s,fallback:"rangeMin"}),r.mapWithFallback(u[1],{position:s,fallback:"rangeMax"})],"discard"===x&&o.some(e=>!r.isInRange(e))?null:o):null})(u,x,h,e.position,c.orientation,d.orientation,e);if(!m)return null;var g=m[0],p=m[1];if(null==g||null==p)return null;var{x:f,y:v}=g,{x:b,y:w}=p,j=er(er({clipPath:"hidden"===i?"url(#".concat(o,")"):void 0},(0,ee.svgPropertiesAndEvents)(e)),{},{x1:f,y1:v,x2:b,y2:w}),N=(0,_.rectWithCoords)({x1:f,y1:v,x2:b,y2:w});return a.createElement(ea.ZIndexLayer,{zIndex:e.zIndex},a.createElement(U.Layer,{className:(0,Y.clsx)("recharts-reference-line",n)},((e,t)=>{var s;if(a.isValidElement(e))s=a.cloneElement(e,t);else if("function"==typeof e)s=e(t);else{if(!(0,el.isWellBehavedNumber)(t.x1)||!(0,el.isWellBehavedNumber)(t.y1)||!(0,el.isWellBehavedNumber)(t.x2)||!(0,el.isWellBehavedNumber)(t.y2))return null;s=a.createElement("line",eo({},t,{className:"recharts-reference-line-line"}))}return s})(l,j),a.createElement(H.CartesianLabelContextProvider,eo({},N,{lowerWidth:N.width,upperWidth:N.width}),a.createElement(H.CartesianLabelFromLabelProp,{label:e.label}),e.children)))}var eu={ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",label:!1,stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle",zIndex:es.DefaultZIndexes.line};function ex(e){var t=(0,et.resolveDefaultProps)(e,eu);return a.createElement(a.Fragment,null,a.createElement(ec,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),a.createElement(ed,t))}ex.displayName="ReferenceLine";let eh=(e,t,a,s,l)=>{let n,i,r,o=a.getTime(),c=(n=s.getTime(),i=l.getTime(),r=[],n<i?r.push({time:n-67068e3,height:t,type:"low"},{time:n-44712e3,height:e,type:"high"},{time:n-22356e3,height:t,type:"low"},{time:n,height:e,type:"high"},{time:i,height:t,type:"low"},{time:i+22356e3,height:e,type:"high"},{time:i+44712e3,height:t,type:"low"},{time:i+67068e3,height:e,type:"high"}):r.push({time:i-67068e3,height:e,type:"high"},{time:i-44712e3,height:t,type:"low"},{time:i-22356e3,height:e,type:"high"},{time:i,height:t,type:"low"},{time:n,height:e,type:"high"},{time:n+22356e3,height:t,type:"low"},{time:n+44712e3,height:e,type:"high"},{time:n+67068e3,height:t,type:"low"}),r);for(let a=0;a<c.length-1;a++)if(o>=c[a].time&&o<=c[a+1].time){let s=c[a].height,l=c[a+1].height,n=c[a+1].time-c[a].time;if(n<=0)return(e+t)/2;return parseFloat((s+(l-s)*((1-Math.cos((o-c[a].time)/n*Math.PI))/2)).toFixed(2))}return(e+t)/2},em=e=>{if(!e)return null;if(e.includes("T")||e.includes("-")){let t=new Date(e);if(!isNaN(t.getTime()))return t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}return e},eg=e=>{if(!e)return null;if(e.includes("T")||e.includes("-")){let t=new Date(e);return isNaN(t.getTime())?null:t}let t=e.split(":").map(Number);if(t.length<2)return null;let a=new Date;return a.setHours(t[0],t[1],0,0),a};function ep(){let{t:e}=(0,r.useTranslation)(),s=u.default.get("debugMode"),l=(0,a.useMemo)(()=>["environment.tide.heightNow","environment.tide.heightHigh","environment.tide.heightLow","environment.tide.timeLow","environment.tide.timeHigh","environment.tide.coeffNow"],[]),n=(0,o.useSignalKPaths)(l),i=n["environment.tide.heightNow"],x=n["environment.tide.heightHigh"],h=n["environment.tide.heightLow"],m=n["environment.tide.timeLow"],g=n["environment.tide.timeHigh"],p=n["environment.tide.coeffNow"],f=null!==i||null!==x||null!==h||s,v=(0,a.useMemo)(()=>eg(g),[g]),b=(0,a.useMemo)(()=>eg(m),[m]),w=(0,a.useMemo)(()=>!!v&&!!b&&v.getTime()<b.getTime(),[v,b]),j=(0,a.useMemo)(()=>{let e,t,a=x||4.2,s=h||.8,l=v||((e=new Date).setHours(14,0,0,0),e),n=b||((t=new Date).setHours(8,0,0,0),t),i=[],r=new Date,o=new Date(r);o.setHours(0,0,0,0);for(let e=0;e<=48;e++){let t=new Date(o.getTime()+30*e*6e4),c=eh(a,s,t,l,n);i.push({time:t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1}),height:c,isNow:9e5>Math.abs(t.getTime()-r.getTime())})}return i},[x,h,v,b]);return(0,t.jsx)(d,{title:e("widgets.tidalTelemetry"),icon:()=>(0,t.jsx)("svg",{className:"w-5 h-5 opacity-50",viewBox:"0 0 24 24",fill:"none",children:(0,t.jsx)("path",{d:"M3 11h18M3 6h18M3 16h18M3 21h18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),hasData:f,noDataMessage:e("widgets.signalLossTidal"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-baseline space-x-3",children:[(0,t.jsxs)("span",{className:"text-4xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:[(i||2.1).toFixed(1),(0,t.jsx)("span",{className:"text-lg text-hud-muted ml-1",children:"m"})]}),(0,t.jsx)("span",{className:`text-xs font-black uppercase tracking-[0.2em] ${w?"text-oGreen":"text-oBlue"}`,children:e(w?"widgets.rising":"widgets.ebb")})]}),p&&(0,t.jsxs)("span",{className:"text-hud-muted text-xs font-black",children:["C",p]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 mb-3 overflow-hidden",children:(0,t.jsx)(E.ResponsiveContainer,{width:"100%",height:"100%",minWidth:0,minHeight:0,children:(0,t.jsxs)(G.AreaChart,{data:j,margin:{top:5,right:5,left:-25,bottom:0},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("linearGradient",{id:"colorTide",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,t.jsx)("stop",{offset:"5%",stopColor:w?c.oGreen:c.oBlue,stopOpacity:.3}),(0,t.jsx)("stop",{offset:"95%",stopColor:w?c.oGreen:c.oBlue,stopOpacity:0})]})}),(0,t.jsx)(K.CartesianGrid,{strokeDasharray:"3 3",stroke:"var(--hud-border)",vertical:!1}),(0,t.jsx)(R.XAxis,{dataKey:"time",tick:{fill:"var(--hud-text-muted)",fontSize:10,fontWeight:900},axisLine:!1,tickLine:!1,interval:6}),(0,t.jsx)(B.YAxis,{tick:{fill:"var(--hud-text-muted)",fontSize:10,fontWeight:900},axisLine:!1,tickLine:!1,domain:["dataMin - 0.5","dataMax + 0.5"]}),(0,t.jsx)(O.Tooltip,{contentStyle:{backgroundColor:"var(--hud-bg)",border:"1px solid var(--hud-border)",borderRadius:"4px",fontSize:"11px",fontWeight:900,textTransform:"uppercase"},itemStyle:{color:w?c.oGreen:c.oBlue}}),(0,t.jsx)(L.Area,{type:"monotone",dataKey:"height",stroke:w?c.oGreen:c.oBlue,strokeWidth:2,fillOpacity:1,fill:"url(#colorTide)",isAnimationActive:!0,animationDuration:2e3}),i&&(0,t.jsx)(ex,{y:i,stroke:"var(--hud-border)",strokeDasharray:"4 4"})]})})}),(0,t.jsxs)("div",{className:"flex items-center justify-between shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("span",{className:"text-hud-muted text-xs font-black uppercase tracking-widest",children:e("widgets.high")}),(0,t.jsx)("span",{className:"text-hud-main font-black text-sm gliding-value",children:em(g)||"--:--"}),(0,t.jsxs)("span",{className:"text-oGreen text-xs font-black",children:[(x||0).toFixed(1),"m"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("span",{className:"text-hud-muted text-xs font-black uppercase tracking-widest",children:e("widgets.low")}),(0,t.jsx)("span",{className:"text-hud-main font-black text-sm gliding-value",children:em(m)||"--:--"}),(0,t.jsxs)("span",{className:"text-oBlue text-xs font-black",children:[(h||0).toFixed(1),"m"]})]})]})]})})}let ef=e=>null!=e?(0,C.convertTemperatureUnit)(e):null,ev=a.default.memo(()=>{var e;let s,{t:l}=(0,r.useTranslation)(),n=u.default.get("debugMode"),c=(0,a.useRef)({airTemp:null,seaTemp:null}),x=(0,o.useSignalKPath)("environment.outside.temperature"),h=(0,o.useSignalKPath)("environment.water.temperature"),{hasData:m,airTemp:g,seaTemp:p}=(0,a.useMemo)(()=>{if(!(null!==x||null!==h||n))return{hasData:!1};let e=null!==x?ef(x):n?21:null,t=null!==h?ef(h):n?17:null;return null!==e&&(c.current.airTemp=e),null!==t&&(c.current.seaTemp=t),{hasData:!0,airTemp:null!==e?e:c.current.airTemp,seaTemp:null!==t?t:c.current.seaTemp}},[x,h,n]);return(0,t.jsx)(d,{title:l("widgets.temperatureMonitoring"),icon:i.faThermometerHalf,hasData:m,noDataMessage:l("widgets.signalLossThermal"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-6 w-full",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-hud-secondary text-xs uppercase font-black tracking-[0.2em] mb-3 opacity-60",children:l("widgets.atmosphereLabel")}),(0,t.jsx)("div",{className:"text-5xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:null!==g?`${g}\xb0`:l("common.na")})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-hud-secondary text-xs uppercase font-black tracking-[0.2em] mb-3 opacity-60",children:l("widgets.hydrosphere")}),(0,t.jsx)("div",{className:"text-5xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:null!==p?`${p}\xb0`:l("common.na")})]})]})}),(0,t.jsx)("div",{className:"space-y-4 shrink-0",children:[{label:l("widgets.airSystem"),value:g},{label:l("widgets.seaSystem"),value:p}].map((e,a)=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs font-black uppercase tracking-widest text-hud-muted",children:[(0,t.jsx)("span",{children:e.label}),(0,t.jsx)("span",{className:"text-hud-main opacity-80",children:null!==e.value?`${e.value}${(0,C.getTemperatureUnitLabel)()}`:l("widgets.offline")})]}),(0,t.jsx)("div",{className:"h-1 bg-hud-elevated rounded-full overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${null!==e.value&&e.value<10?"bg-oBlue":null!==e.value&&e.value>25?"bg-oRed":"bg-oGreen"}`,style:{width:`${null!==e.value?Math.min(100,Math.max(0,(e.value+10)*2)):0}%`}})})]},a))}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-4 shrink-0",children:[(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.2em] ${null!==g&&null!==p?(e=(g+p)/2)<10?"text-oBlue":e>25?"text-oRed":"text-oGreen":"text-hud-muted"}`,children:null!==g&&null!==p?(s=(g+p)/2)<15?l("widgets.cold"):s>25?l("widgets.warm"):l("widgets.moderate"):l("widgets.systemStandby")}),(0,t.jsxs)("div",{className:"text-xs text-hud-secondary uppercase font-black tracking-widest",children:[l("widgets.delta")," ",(0,t.jsx)("span",{className:"text-hud-main gliding-value",children:null!==g&&null!==p?`${Math.abs(g-p).toFixed(1)}\xb0`:l("common.na")})]})]})]})})});ev.displayName="TemperatureWidget";var eb=e.i(75056),ew=e.i(43257),ej=e.i(30297),eN=e.i(66326),ey=e.i(32615);function ek(){let{t:e}=(0,r.useTranslation)(),{nightMode:s}=(0,c.useOcearoContext)(),[l,u]=(0,a.useState)(!0),x=(0,o.useSignalKPath)("navigation.headingTrue"),h=(0,o.useSignalKPath)("navigation.speedOverGround"),m=(0,o.useSignalKPath)("environment.wind.speedApparent"),g=(0,o.useSignalKPath)("environment.wind.angleApparent"),p=(0,o.useSignalKPath)("navigation.attitude.heel"),f=(0,o.useSignalKPath)("navigation.attitude.pitch"),v=(0,a.useMemo)(()=>({heading:Math.round((0,C.toDegrees)(x)||0),speed:null!==h?h:0,windSpeed:null!==m?m:0,windAngle:Math.round((0,C.toDegrees)(g)||0),heel:Math.round((0,C.toDegrees)(p)||0),pitch:Math.round((0,C.toDegrees)(f)||0)}),[x,h,m,g,p,f]);return(0,t.jsxs)(d,{title:e("widgets.boatView3D"),icon:i.faShip,hasData:!0,children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCompass,className:`${s?"text-oNight":"text-oYellow"} text-xs opacity-50`}),(0,t.jsxs)("span",{className:"text-hud-main text-xs font-black uppercase tracking-widest gliding-value",children:[Math.round(v.heading),"°"]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 border-l border-hud pl-4",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faWater,className:`${s?"text-oNight":"text-oBlue"} text-xs opacity-50`}),(0,t.jsxs)("span",{className:"text-hud-main text-xs font-black uppercase tracking-widest gliding-value",children:[(v.speed*C.MS_TO_KNOTS).toFixed(1)," kts"]})]})]}),(0,t.jsxs)("div",{className:"flex-1 relative rounded-sm overflow-hidden bg-hud-bg shadow-inner mt-2",children:[(0,t.jsx)(eb.Canvas,{camera:{position:[3,2,3],fov:45},className:"w-full h-full",dpr:[1,1.5],performance:{min:.5},onCreated:()=>u(!1),children:(0,t.jsxs)(a.Suspense,{fallback:null,children:[(0,t.jsx)(ej.OrbitControls,{enablePan:!1,minDistance:2,maxDistance:8,maxPolarAngle:Math.PI/2,target:[0,0,0]}),(0,t.jsx)(ew.Environment,{files:"./assets/ocearo_env.hdr",background:!1,intensity:.6,resolution:128}),(0,t.jsx)("ambientLight",{intensity:.8}),(0,t.jsx)("directionalLight",{position:[5,5,5],intensity:.6}),(0,t.jsxs)("group",{position:[0,-.5,0],scale:[.3,.3,.3],children:[(0,t.jsx)(eN.default,{position:[0,0,0],scale:[.7,.7,.7],showSail:!0,heel:v.heel,pitch:v.pitch}),(0,t.jsx)(ey.default,{visible:!0,position:[3,1,-1],scale:[.3,.3,.3]})]})]})}),(0,t.jsxs)("div",{className:"absolute top-2 left-2 flex flex-col space-y-1.5",children:[(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-md border border-hud rounded-sm px-2 py-1 text-xs font-black uppercase text-hud-main tracking-widest shadow-soft",children:[(0,t.jsx)("span",{className:`${s?"text-oNight":"text-oRed"} mr-2 opacity-60`,children:"HEEL:"}),(0,t.jsxs)("span",{className:"gliding-value",children:[Math.round(v.heel),"°"]})]}),(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-md border border-hud rounded-sm px-2 py-1 text-xs font-black uppercase text-hud-main tracking-widest shadow-soft",children:[(0,t.jsx)("span",{className:`${s?"text-oNight":"text-oBlue"} mr-2 opacity-60`,children:"PITCH:"}),(0,t.jsxs)("span",{className:"gliding-value",children:[Math.round(v.pitch),"°"]})]})]}),(0,t.jsxs)("div",{className:"absolute top-2 right-2 flex flex-col space-y-1.5 items-end",children:[(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-md border border-hud rounded-sm px-2 py-1 text-xs font-black uppercase text-hud-main tracking-widest shadow-soft",children:[(0,t.jsx)("span",{className:`${s?"text-oNight":"text-oYellow"} mr-2 opacity-60`,children:"WIND:"}),(0,t.jsxs)("span",{className:"gliding-value",children:[Math.round(v.windSpeed*C.MS_TO_KNOTS)," kts"]})]}),(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-md border border-hud rounded-sm px-2 py-1 text-xs font-black uppercase text-hud-main tracking-widest shadow-soft",children:[(0,t.jsx)("span",{className:"text-hud-muted mr-2 opacity-60",children:"ANGLE:"}),(0,t.jsxs)("span",{className:"gliding-value",children:[Math.round(v.windAngle),"°"]})]})]}),l&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-hud-bg text-hud-main backdrop-blur-xl",children:(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faShip,className:"text-3xl text-oBlue animate-soft-pulse"}),(0,t.jsx)("span",{className:"font-black uppercase tracking-[0.4em] text-xs text-hud-muted",children:e("widgets.initializingNode")})]})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center mt-2 shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 text-xs font-black uppercase tracking-widest",children:[(0,t.jsxs)("span",{className:"text-hud-main gliding-value",children:[Math.round(v.heading),"° ",(0,t.jsx)("span",{className:"text-hud-secondary",children:"HDG"})]}),(0,t.jsxs)("span",{className:"text-hud-main gliding-value",children:[(v.speed*C.MS_TO_KNOTS).toFixed(1)," ",(0,t.jsx)("span",{className:"text-hud-secondary",children:"KTS"})]})]}),(0,t.jsxs)("div",{className:`flex items-center space-x-1 ${s?"text-oNight":"text-oBlue"}`,children:[(0,t.jsx)("div",{className:`w-1 h-1 rounded-full ${s?"bg-oNight":"bg-oBlue"} animate-soft-pulse`}),(0,t.jsx)("span",{className:"text-xs font-black uppercase tracking-[0.2em]",children:e("widgets.telemetryLive")})]})]})]})}var eM=e.i(35637);function eS(){let{t:e}=(0,r.useTranslation)(),{nightMode:s}=(0,c.useOcearoContext)(),l=(0,a.useRef)(null),x=u.default.get("debugMode"),h=(0,o.useSignalKPath)("navigation.attitude"),m=(0,o.useSignalKPath)("navigation.headingTrue"),g=(0,a.useMemo)(()=>{if(null===h&&null===m&&!x)return{hasData:!1};let e=h||{roll:0,pitch:0,yaw:0},t=m||0;return{hasData:!0,roll:void 0!==e.roll&&(0,C.toDegrees)(e.roll)||0,pitch:void 0!==e.pitch&&(0,C.toDegrees)(e.pitch)||0,yaw:void 0!==e.yaw&&(0,C.toDegrees)(e.yaw)||0,heading:null!==t&&(0,C.toDegrees)(t)||0}},[h,m,x]);return(0,a.useEffect)(()=>{var e,t,a;let n=l.current;if(!n)return;let i=n.getContext("2d"),r=n.width,o=n.height,d=(()=>{if("u">typeof document){let e=getComputedStyle(document.documentElement);return{leftPaneBg:e.getPropertyValue("--color-leftPaneBg").trim()||"#0e0e0e",rightPaneBg:e.getPropertyValue("--color-rightPaneBg").trim()||"#1e1e1e"}}return{leftPaneBg:"#0e0e0e",rightPaneBg:"#1e1e1e"}})();e=g.roll,t=g.pitch,a=g.yaw,(0,eM.drawAttitudeInstrument)(i,{w:r,h:o,roll:e,pitch:t,yaw:a,nightMode:s,showBezel:!0,colors:{oBlue:c.oBlue,oRed:c.oRed,oYellow:c.oYellow,oGreen:c.oGreen,oNight:c.oNight,rightPaneBg:d.rightPaneBg}})},[g,s]),(0,t.jsxs)(d,{title:e("widgets.attitudeInertial"),icon:i.faCompass,hasData:g.hasData,noDataMessage:e("widgets.signalLossIMU"),children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCompass,className:`${s?"text-oNight":"text-oYellow"} text-xs opacity-50`}),(0,t.jsxs)("span",{className:`${s?"text-oNight":"text-hud-main"} text-xs font-black uppercase tracking-widest gliding-value`,children:[Math.round(g.heading),"°"]})]}),(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center min-h-0 scale-95 group transition-transform duration-700",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("canvas",{ref:l,width:220,height:220,className:`${s?"brightness-75 contrast-125":""} transition-all duration-700 group-hover:scale-105`}),(0,t.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:[(0,t.jsx)("div",{className:`w-8 h-px ${s?"bg-oNight":"bg-oYellow/40"}`}),(0,t.jsx)("div",{className:`w-px h-8 ${s?"bg-oNight":"bg-oYellow/40"}`})]})]})}),(0,t.jsx)("div",{className:"grid grid-cols-3 gap-4 mt-4 text-center",children:[{label:"ROLL",value:g.roll,color:"text-oRed",icon:i.faPlane,rotate:90},{label:"PITCH",value:g.pitch,color:"text-oBlue",icon:i.faPlane,rotate:0},{label:"HDG",value:g.heading,color:"text-oYellow",icon:i.faCompass,rotate:0}].map((e,a)=>(0,t.jsxs)("div",{className:"tesla-card p-2 tesla-hover bg-hud-bg border border-hud",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center space-x-2 mb-1 opacity-60",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:e.icon,className:`${s?"text-oNight":e.color} text-xs ${e.rotate?`transform rotate-${e.rotate}`:""}`}),(0,t.jsx)("span",{className:`${s?"text-oNight/60":"text-hud-muted"} uppercase text-xs font-black tracking-widest`,children:e.label})]}),(0,t.jsxs)("div",{className:`${s?"text-oNight":"text-hud-main"} font-black text-lg gliding-value tracking-tighter`,children:[Math.round(e.value),"°"]})]},a))})]})}function eD(){var e;let{t:s}=(0,r.useTranslation)(),{nightMode:l}=(0,c.useOcearoContext)(),x=u.default.get("debugMode"),h=(0,o.useSignalKPath)("environment.depth.belowKeel"),m=(0,o.useSignalKPath)("environment.depth.belowSurface"),g=(0,o.useSignalKPath)("environment.depth.belowTransducer"),p=(0,a.useMemo)(()=>{let e=h??g??(x?5.2:null),t=m??(null!==g?g+1.5:x?6.8:null);return null!==e||null!==t||x?{hasData:!0,belowKeel:null!==e?(0,C.convertDepthUnit)(e):null,belowSurface:null!==t?(0,C.convertDepthUnit)(t):null,depthUnitLabel:(0,C.getDepthUnitLabel)()}:{hasData:!1}},[h,m,g,x]),f=e=>e<2?"text-oRed":e<5?"text-oYellow":"text-oBlue";return(0,t.jsx)(d,{title:s("widgets.depth"),icon:i.faWater,hasData:p.hasData,noDataMessage:s("widgets.noDepthData"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"text-center mb-6",children:[(0,t.jsxs)("div",{className:"text-5xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:[null!==p.belowKeel?p.belowKeel:s("common.na"),null!==p.belowKeel&&(0,t.jsx)("span",{className:"text-xl text-hud-secondary ml-2 uppercase font-black tracking-widest",children:p.depthUnitLabel})]}),(0,t.jsx)("div",{className:`text-xs font-black uppercase tracking-[0.3em] mt-3 ${null!==p.belowKeel?f(p.belowKeel):"text-hud-muted"} ${null!==p.belowKeel&&p.belowKeel<5?"animate-soft-pulse":""}`,children:s(null!==p.belowKeel?(e=p.belowKeel)<2?"widgets.shallow":e<5?"widgets.caution":e<10?"widgets.safe":"widgets.deep":"widgets.offline")})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[(0,t.jsxs)("div",{className:"tesla-card p-3 text-center tesla-hover bg-hud-bg",children:[(0,t.jsx)("div",{className:"text-hud-secondary text-xs uppercase font-black tracking-widest mb-1 opacity-60",children:s("widgets.belowKeel")}),(0,t.jsx)("div",{className:`text-xl font-black gliding-value ${null!==p.belowKeel?f(p.belowKeel):"text-hud-muted"}`,children:null!==p.belowKeel?`${p.belowKeel} ${p.depthUnitLabel}`:s("common.na")})]}),(0,t.jsxs)("div",{className:"tesla-card p-3 text-center tesla-hover bg-hud-bg",children:[(0,t.jsx)("div",{className:"text-hud-secondary text-xs uppercase font-black tracking-widest mb-1 opacity-60",children:s("widgets.surface")}),(0,t.jsx)("div",{className:`text-xl font-black gliding-value ${null!==p.belowSurface?f(p.belowSurface):"text-hud-muted"}`,children:null!==p.belowSurface?`${p.belowSurface} ${p.depthUnitLabel}`:s("common.na")})]})]}),(0,t.jsx)("div",{className:"mb-6 px-2",children:(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faAnchor,className:"text-hud-muted text-xs opacity-50"}),(0,t.jsx)("div",{className:"flex-1 bg-hud-elevated rounded-full h-1 overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${null!==p.belowKeel?f(p.belowKeel).replace("text-","bg-"):"bg-hud-bg"}`,style:{width:`${null!==p.belowKeel?Math.min(100,p.belowKeel/50*100):0}%`}})}),(0,t.jsxs)("div",{className:"text-hud-muted text-xs font-black tracking-tighter",children:["50",p.depthUnitLabel]})]})}),(0,t.jsxs)("div",{className:"tesla-card p-3 bg-hud-bg space-y-2",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs font-black uppercase tracking-widest",children:[(0,t.jsx)("span",{className:"text-hud-secondary",children:s("widgets.hullClearance")}),(0,t.jsx)("span",{className:`gliding-value font-mono ${null!==p.belowKeel&&p.belowKeel<2?"text-oRed":"text-hud-main"}`,children:null!==p.belowKeel?`${Math.max(0,p.belowKeel-(0,C.convertDepthUnit)(1.5)).toFixed(1)} ${p.depthUnitLabel}`:s("common.na")})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center text-xs font-black uppercase tracking-widest",children:[(0,t.jsx)("span",{className:"text-hud-secondary",children:s("widgets.transducerOffset")}),(0,t.jsx)("span",{className:"text-hud-dim font-mono opacity-60",children:"1.5m"})]})]})]})})}var e$=e.i(62588);let eC=[1,2,5,10,20],eP=a.default.memo(()=>{let{t:e}=(0,r.useTranslation)(),{aisData:s,vesselIds:l}=(0,e$.useAIS)(),[c,x]=(0,a.useState)(5),[h,m]=(0,a.useState)(0),g=u.default.get("debugMode"),p=(0,a.useCallback)(e=>{e.preventDefault(),x(t=>{let a=eC.indexOf(t);return -1===a?t:e.deltaY<0&&a>0?eC[a-1]:e.deltaY>0&&a<eC.length-1?eC[a+1]:t})},[]),f=(0,o.useSignalKPath)("navigation.position"),v=(0,o.useSignalKPath)("navigation.headingTrue"),b=(0,o.useSignalKPath)("navigation.headingMagnetic"),w=v||b||0;(0,a.useEffect)(()=>{let e,t=()=>{m(e=>(e+2)%360),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>{e&&cancelAnimationFrame(e)}},[]);let j=(0,a.useMemo)(()=>s&&0!==Object.keys(s).length&&f?l.filter(e=>e.distanceMeters&&e.distanceMeters<=1852*c).map(e=>{let t=e.distanceMeters/1852,a=(180*Math.atan2(e.sceneX,-e.sceneZ)/Math.PI+180+360)%360,s=t*Math.abs(Math.sin((a-w)*Math.PI/180));return{id:e.mmsi,name:e.name||`MMSI ${e.mmsi}`,distance:Math.round(10*t)/10,bearing:Math.round(a),type:e.shipType||"unknown",cpa:Math.round(10*s)/10}}).sort((e,t)=>e.distance-t.distance).slice(0,10):[],[s,l,c,f,w]),N=e=>e.cpa<.5?"text-oRed":e.cpa<1?"text-oYellow":"text-oGreen",y=g||j.length>0;return(0,t.jsxs)(d,{title:e("widgets.aisTacticalRadar"),icon:i.faTowerBroadcast,hasData:y,noDataMessage:e("widgets.signalLossAIS"),children:[(0,t.jsx)("div",{className:"absolute top-4 right-4 z-10",children:(0,t.jsxs)("select",{value:c,onChange:e=>x(Number(e.target.value)),className:"bg-hud-elevated text-hud-secondary text-xs font-black uppercase tracking-widest rounded-sm px-3 py-1 border border-hud shadow-soft focus:outline-none focus:ring-1 focus:ring-oBlue/50 hover:bg-hud-bg hover:text-hud-main transition-all duration-500",children:[(0,t.jsx)("option",{value:1,children:"1 NM"}),(0,t.jsx)("option",{value:2,children:"2 NM"}),(0,t.jsx)("option",{value:5,children:"5 NM"}),(0,t.jsx)("option",{value:10,children:"10 NM"}),(0,t.jsx)("option",{value:20,children:"20 NM"})]})}),(0,t.jsxs)("div",{className:"flex-1 relative min-h-0 bg-hud-bg rounded-sm overflow-hidden border border-hud shadow-inner group mt-2",onWheel:p,children:[(0,t.jsxs)("svg",{className:"w-full h-full p-2 transition-transform duration-700 group-hover:scale-[1.02]",viewBox:"0 0 200 200",children:[[1,2,3,4].map(e=>(0,t.jsx)("circle",{cx:"100",cy:"100",r:20*e,fill:"none",stroke:"var(--color-oBlue)",strokeOpacity:"0.1",strokeWidth:"0.5"},e)),(0,t.jsx)("line",{x1:"100",y1:"20",x2:"100",y2:"180",stroke:"var(--color-oBlue)",strokeOpacity:"0.05",strokeWidth:"0.5"}),(0,t.jsx)("line",{x1:"20",y1:"100",x2:"180",y2:"100",stroke:"var(--color-oBlue)",strokeOpacity:"0.05",strokeWidth:"0.5"}),(0,t.jsx)("line",{x1:"100",y1:"100",x2:100+80*Math.cos((h-90)*Math.PI/180),y2:100+80*Math.sin((h-90)*Math.PI/180),stroke:"var(--color-oGreen)",strokeWidth:"1",strokeOpacity:"0.4"}),j.map(e=>{let a=e.distance/c*80,s=100+a*Math.cos((e.bearing-90)*Math.PI/180),l=100+a*Math.sin((e.bearing-90)*Math.PI/180),n=e.cpa<.5;return(0,t.jsxs)("g",{className:n?"animate-soft-pulse":"",children:[(0,t.jsx)("circle",{cx:s,cy:l,r:n?"3":"2",fill:n?"var(--color-oRed)":e.cpa<1?"var(--color-oYellow)":"var(--color-oGreen)",className:"transition-all duration-1000"}),(0,t.jsx)("text",{x:s+5,y:l-5,fill:"currentColor",fontSize:"5",className:"font-black pointer-events-none uppercase tracking-tighter opacity-60 text-hud-main",children:e.name.substring(0,8)})]},e.id)}),(0,t.jsx)("polygon",{points:"100,95 105,105 100,102 95,105",fill:"var(--color-oBlue)",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.8",className:"text-hud-main"})]}),(0,t.jsxs)("div",{className:"absolute top-2 left-2 text-xs text-hud-muted font-black pointer-events-none uppercase tracking-widest space-y-1",children:[(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[e("widgets.range")," ",c," NM"]}),(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[e("widgets.targets")," ",j.length]})]})]}),j.length>0&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs text-hud-muted font-black uppercase tracking-[0.2em] px-1",children:e("widgets.tacticalAnalysis")}),j.slice(0,2).map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs tesla-card bg-hud-bg px-3 py-2 border border-hud tesla-hover",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 min-w-0",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:(e=>{switch(e){case"cargo":case"fishing":return i.faShip;default:return i.faLocationDot}})(e.type),className:`${N(e)} text-xs opacity-80 ${e.cpa<.5?"animate-soft-pulse":""}`}),(0,t.jsx)("span",{className:"text-hud-main truncate font-black uppercase tracking-tight",children:e.name})]}),(0,t.jsxs)("div",{className:"flex space-x-4 text-hud-secondary font-black tracking-tighter",children:[(0,t.jsxs)("span",{className:"gliding-value",children:[e.distance.toFixed(1)," NM"]}),(0,t.jsxs)("span",{className:`${N(e)} gliding-value`,children:["CPA: ",e.cpa.toFixed(1)]})]})]},e.id))]})]})});function eT(){var e;let{t:s}=(0,r.useTranslation)(),l=u.default.get("debugMode"),c=(0,o.useSignalKPaths)(["electrical.batteries.1.voltage","electrical.batteries.0.voltage","electrical.batteries.1.current","electrical.batteries.0.current"]),x=(0,a.useMemo)(()=>{let e=c["electrical.batteries.1.voltage"],t=c["electrical.batteries.0.voltage"],a=c["electrical.batteries.1.current"],s=c["electrical.batteries.0.current"],n={voltage:null,current:null,percentage:null};if(!(null!==e||null!==t||l))return{hasData:!1,house:n,starter:n};let i=e||(l?12.6:null),r=t||(l?12.4:null),o=a||(l?-2.3:null),d=s||(l?.1:null);return{hasData:!0,house:{voltage:i?Math.round(10*i)/10:null,current:o?Math.round(10*o)/10:null,percentage:i?Math.min(100,Math.max(0,(i-11.8)/1*100)):null},starter:{voltage:r?Math.round(10*r)/10:null,current:d?Math.round(10*d)/10:null,percentage:r?Math.min(100,Math.max(0,(r-11.8)/1*100)):null}}},[c,l]),h=e=>e>75?i.faBatteryFull:e>25?i.faBatteryHalf:i.faBatteryQuarter,m=e=>e<20?"text-oRed":e<50?"text-oYellow":"text-oGreen";return(0,t.jsx)(d,{title:s("widgets.energyStorage"),icon:i.faBolt,hasData:x.hasData,noDataMessage:s("widgets.signalLossPowerGrid"),children:(0,t.jsxs)("div",{className:"flex-1 flex flex-col justify-center py-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 mb-8",children:[(0,t.jsxs)("div",{className:"text-center tesla-card p-3 tesla-hover bg-hud-bg",children:[(0,t.jsx)("div",{className:"text-hud-muted text-xs uppercase mb-2 font-black tracking-widest",children:s("widgets.serviceBank")}),(0,t.jsxs)("div",{className:"flex items-center justify-center space-x-3 mb-2",children:[(0,t.jsx