ocearo-ui
Version:
Ocean Robot UI: 3D visualization dashboard for signalk
1 lines • 37.3 kB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,73064,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(88653),l=e.i(46932);e.i(67561);var r=e.i(85709),i=e.i(83402),n=e.i(49721),o=e.i(68757),c=e.i(46991);let d=e=>null==e?null:(e/1e5).toFixed(1),u=e=>null==e?null:Math.round(100*e),m=({label:e,value:s,unit:a,min:l=0,max:r=100,icon:i,warningThreshold:o,criticalThreshold:c,size:d=120,showValue:u=!0})=>{let m=null==s||isNaN(s)?"N/A":s,x="N/A"!==m,h=x?Math.min(100,Math.max(0,(s-l)/(r-l)*100)):0,p=x?void 0!==c&&s>=c?"var(--color-oRed)":void 0!==o&&s>=o?"var(--color-oYellow)":"var(--color-oGreen)":"var(--color-oGray)";return(0,t.jsxs)("div",{className:"tesla-card p-2 tesla-hover flex flex-col items-center justify-center",children:[(0,t.jsxs)("div",{className:"relative",style:{width:d,height:d},children:[(0,t.jsxs)("svg",{style:{width:d,height:d},className:"transform -rotate-90",viewBox:"0 0 100 100",children:[(0,t.jsx)("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:"var(--hud-border)",strokeWidth:"6"}),(0,t.jsx)("circle",{cx:"50",cy:"50",r:"40",fill:"none",stroke:p,strokeWidth:"6",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*40}`,strokeDashoffset:`${x?2*Math.PI*40*(1-h/100):2*Math.PI*40}`,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:[i&&(0,t.jsx)(n.FontAwesomeIcon,{icon:i,className:"text-hud-muted text-sm mb-1"}),u&&(0,t.jsx)("div",{className:`text-2xl font-black tracking-tighter gliding-value ${x?"text-hud-main":"text-hud-muted"} ${h>=90||c&&s>=c?"animate-soft-pulse":""}`,children:m}),u&&x&&a&&(0,t.jsx)("div",{className:"text-xs font-black text-hud-secondary uppercase tracking-widest",children:a})]})]}),(0,t.jsx)("div",{className:"text-hud-muted text-xs font-black mt-1 text-center uppercase tracking-widest",children:e})]})},x=({label:e,value:s,unit:a,min:l=0,max:r=100,icon:i,warningThreshold:o,criticalThreshold:c,showMinMax:d=!1})=>{let u=null==s||isNaN(s)?"N/A":`${s}${a?` ${a}`:""}`,m="N/A"!==u,x=m?Math.min(100,Math.max(0,(s-l)/(r-l)*100)):0;return(0,t.jsxs)("div",{className:"tesla-card p-3 tesla-hover",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center text-hud-muted text-xs font-black uppercase tracking-widest",children:[i&&(0,t.jsx)(n.FontAwesomeIcon,{icon:i,className:"mr-2 fa-fw opacity-50"}),e]}),(0,t.jsx)("div",{className:`font-black text-lg gliding-value ${m?"text-hud-main":"text-hud-dim"} ${x>=90||c&&s>=c?"animate-soft-pulse":""}`,children:u})]}),(0,t.jsx)("div",{className:"relative w-full bg-hud-elevated rounded-full h-1.5 overflow-hidden",children:(0,t.jsx)("div",{className:`h-full rounded-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${!m?"bg-hud-elevated":void 0!==c&&s>=c?"bg-oRed":void 0!==o&&s>=o?"bg-oYellow":"bg-oGreen"}`,style:{width:`${x}%`}})}),d&&(0,t.jsxs)("div",{className:"flex justify-between text-xs font-black text-hud-dim mt-2 uppercase tracking-tighter",children:[(0,t.jsx)("span",{children:l}),(0,t.jsx)("span",{children:r})]})]})},h=({label:e,value:s,unit:a,icon:l,warningThreshold:r,criticalThreshold:i,reversed:o=!1})=>{let c=null==s||isNaN(s)?"N/A":s,d="N/A"!==c;return(0,t.jsxs)("div",{className:"tesla-card p-3 tesla-hover flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center text-hud-muted text-xs font-black uppercase tracking-widest",children:[l&&(0,t.jsx)(n.FontAwesomeIcon,{icon:l,className:"mr-2 fa-fw opacity-50"}),e]}),(0,t.jsx)("div",{className:`font-black text-lg gliding-value ${(()=>{if(!d)return"text-hud-dim";if(o){if(void 0!==i&&s<=i)return"text-oRed";if(void 0!==r&&s<=r)return"text-oYellow"}else{if(void 0!==i&&s>=i)return"text-oRed";if(void 0!==r&&s>=r)return"text-oYellow"}return"text-oGreen"})()} ${i&&(o?s<=i:s>=i)?"animate-soft-pulse":""}`,children:"N/A"!==c?`${c}${a?` ${a}`:""}`:"N/A"})]})},p=({label:e,value:s,unit:a,icon:l,max:r=100,warningThreshold:i,criticalThreshold:o})=>{let c=null==s||isNaN(s)?"N/A":Math.round(s),d="N/A"!==c,u=d?Math.min(100,s/r*100):0;return(0,t.jsxs)("div",{className:"tesla-card p-4 text-center tesla-hover",children:[l&&(0,t.jsx)(n.FontAwesomeIcon,{icon:l,className:"text-lg text-hud-muted mb-2 opacity-50"}),(0,t.jsx)("div",{className:`text-4xl font-black mb-1 tracking-tighter gliding-value ${!d?"text-hud-muted":void 0!==o&&s>=o?"text-oRed":void 0!==i&&s>=i?"text-oYellow":"text-oGreen"} ${u>=90||o&&s>=o?"animate-soft-pulse":""}`,children:c}),d&&a&&(0,t.jsx)("div",{className:"text-hud-secondary text-xs font-black uppercase tracking-widest mb-2",children:a}),(0,t.jsx)("div",{className:"text-hud-muted text-xs font-black uppercase tracking-widest mb-3",children:e}),(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 rounded-full transition-all duration-1000 cubic-bezier(0.4, 0, 0.2, 1) ${d?o&&s>=o?"bg-oRed":i&&s>=i?"bg-oYellow":"bg-oGreen":"bg-hud-elevated"}`,style:{width:`${u}%`}})})]})};e.i(85269);var g=e.i(22831);let f=({isOpen:e,onClose:a,onSave:l,currentEngineHours:r=null,lastRefillEngineHours:i=null,loading:c=!1})=>{let{t:d}=(0,g.useTranslation)(),[u,m]=(0,s.useState)({liters:"",cost:"",additive:!1,engineHours:"",hoursSinceLastRefill:""}),[x,h]=(0,s.useState)({});(0,s.useEffect)(()=>{if(e){let e=null!==r?Math.round(10*r)/10:"",t="";null!==r&&null!==i&&(t=Math.round((r-i)*10)/10),m({liters:"",cost:"",additive:!1,engineHours:e,hoursSinceLastRefill:t}),h({})}},[e,r,i]);let p=(e,t)=>{m(s=>({...s,[e]:t})),x[e]&&h(t=>({...t,[e]:null}))};return e?(0,t.jsx)("div",{className:"fixed inset-0 bg-hud-bg/60 backdrop-blur-sm flex items-center justify-center z-50",onClick:a,children:(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-xl rounded-3xl p-6 sm:p-8 max-w-md w-full mx-4 shadow-2xl border border-hud max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,t.jsxs)("h3",{className:"text-xl font-black text-hud-main flex items-center tracking-tight",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faGasPump,className:"mr-3 text-oYellow"}),d("fuelLog.logFuelRefill")]}),(0,t.jsx)("button",{onClick:a,className:"w-10 h-10 rounded-full flex items-center justify-center text-hud-secondary hover:text-hud-main hover:bg-hud-elevated transition-all duration-300",disabled:c,children:(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faTimes,size:"lg"})})]}),(0,t.jsxs)("form",{onSubmit:e=>{let t;if(e.preventDefault(),t={},(!u.liters||0>=parseFloat(u.liters))&&(t.liters=d("fuelLog.errorLiters")),""!==u.cost&&0>parseFloat(u.cost)&&(t.cost=d("fuelLog.errorCost")),(!u.engineHours||0>parseFloat(u.engineHours))&&(t.engineHours=d("fuelLog.errorEngineHours")),h(t),0!==Object.keys(t).length)return;let s=""!==u.cost?parseFloat(u.cost):null;l({liters:parseFloat(u.liters),cost:s,additive:u.additive,engineHours:parseFloat(u.engineHours),hoursSinceLastRefill:u.hoursSinceLastRefill?parseFloat(u.hoursSinceLastRefill):null,previousEngineHours:i})},className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs font-black uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faGasPump,className:"mr-2 text-oBlue"}),d("fuelLog.litersAdded")]}),(0,t.jsx)("input",{type:"number",step:"0.1",min:"0",value:u.liters,onChange:e=>p("liters",e.target.value),className:`w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border ${x.liters?"border-red-500":"border-hud"} focus:border-oBlue focus:outline-none transition-all duration-300`,placeholder:"Ex: 50",disabled:c}),x.liters&&(0,t.jsx)("p",{className:"text-red-400 text-xs mt-2 font-medium",children:x.liters})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs font-black uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faEuroSign,className:"mr-2 text-oGreen"}),d("fuelLog.cost")," ",(0,t.jsxs)("span",{className:"text-hud-dim font-normal normal-case ml-1",children:["(",d("fuelLog.optional"),")"]})]}),(0,t.jsx)("input",{type:"number",step:"0.01",min:"0",value:u.cost,onChange:e=>p("cost",e.target.value),className:`w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border ${x.cost?"border-red-500":"border-hud"} focus:border-oBlue focus:outline-none transition-all duration-300`,placeholder:"Ex: 85.50",disabled:c}),x.cost&&(0,t.jsx)("p",{className:"text-red-400 text-xs mt-2 font-medium",children:x.cost})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs font-black uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faClock,className:"mr-2 text-oYellow"}),d("fuelLog.currentEngineHours")]}),(0,t.jsx)("input",{type:"number",step:"0.1",min:"0",value:u.engineHours,onChange:e=>(e=>{let t=parseFloat(e),s=u.hoursSinceLastRefill;if(!isNaN(t)&&null!==i){let e=Math.round((t-i)*10)/10;e>=0&&(s=e)}m(t=>({...t,engineHours:e,hoursSinceLastRefill:s})),x.engineHours&&h(e=>({...e,engineHours:null}))})(e.target.value),className:`w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border ${x.engineHours?"border-red-500":"border-hud"} focus:border-oBlue focus:outline-none transition-all duration-300`,placeholder:"Ex: 245.5",disabled:c}),x.engineHours&&(0,t.jsx)("p",{className:"text-red-400 text-xs mt-2 font-medium",children:x.engineHours}),null!==r&&(0,t.jsxs)("p",{className:"text-hud-dim text-xs mt-2 font-medium",children:[d("fuelLog.signalkValue")," ",Math.round(10*r)/10," h"]}),null===r&&(0,t.jsx)("p",{className:"text-hud-dim text-xs mt-2 font-medium",children:d("fuelLog.noSignalkHours")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-xs font-black uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faClock,className:"mr-2 text-hud-dim"}),d("fuelLog.hoursSinceLastRefill")]}),(0,t.jsx)("input",{type:"number",step:"0.1",min:"0",value:u.hoursSinceLastRefill,onChange:e=>p("hoursSinceLastRefill",e.target.value),className:"w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border border-hud focus:border-oBlue focus:outline-none transition-all duration-300 disabled:opacity-60",placeholder:"Ex: 25.5",disabled:c||null!==i&&""!==u.hoursSinceLastRefill}),null!==i&&(0,t.jsxs)("p",{className:"text-hud-dim text-xs mt-2 font-medium",children:[d("fuelLog.lastRefillAt")," ",Math.round(10*i)/10," h"]})]}),(0,t.jsxs)("div",{className:"flex items-center p-1",children:[(0,t.jsx)("input",{type:"checkbox",id:"additive",checked:u.additive,onChange:e=>p("additive",e.target.checked),className:"w-5 h-5 rounded border-hud bg-hud-elevated text-oBlue focus:ring-oBlue transition-all duration-300",disabled:c}),(0,t.jsxs)("label",{htmlFor:"additive",className:"ml-3 text-sm font-bold text-hud-secondary flex items-center cursor-pointer hover:text-hud-main transition-colors duration-300",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faFlask,className:"mr-2 text-purple-400 opacity-70"}),d("fuelLog.additiveAdded")]})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-4 pt-6 border-t border-hud",children:[(0,t.jsx)("button",{type:"button",onClick:a,className:"px-6 py-3 bg-hud-elevated hover:bg-hud-bg text-hud-main font-bold rounded-xl transition-all duration-300",disabled:c,children:d("fuelLog.cancel")}),(0,t.jsx)("button",{type:"submit",className:"px-8 py-3 bg-oBlue hover:bg-blue-600 text-hud-main font-bold rounded-xl transition-all duration-300 flex items-center disabled:opacity-50 shadow-lg shadow-oBlue/20",disabled:c,children:c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"animate-spin mr-3 font-normal",children:"⏳"}),d("fuelLog.saving")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faSave,className:"mr-2"}),d("fuelLog.save")]})})]})]})]})}):null};var b=e.i(48390);e.s(["default",0,()=>{let e,v,j,{t:N}=(0,g.useTranslation)(),w=i.default.get("debugMode"),[k,y]=(0,s.useState)("0"),[T,L]=(0,s.useState)("engine"),[C,R]=(0,s.useState)([]),[A,F]=(0,s.useState)(!1),M=(0,s.useMemo)(()=>{let e=[],t=["revolutions","runTime","coolantTemperature","temperature","exhaustTemperature","coolantPressure","boostPressure","oilPressure","oilTemperature","fuel.rate","fuel.pressure","load","torque","intakeManifoldTemperature","tilt","state","transmission.gear","transmission.oilPressure","transmission.oilTemperature"];return["0","1","port","main","starboard"].forEach(s=>{t.forEach(t=>{e.push(`propulsion.${s}.${t}`)})}),e.push("electrical.batteries.0.voltage","electrical.batteries.0.current","electrical.batteries.1.voltage","electrical.batteries.1.current","electrical.alternators.0.voltage","electrical.alternators.1.voltage","electrical.alternators.0.current","electrical.alternators.1.current","tanks.fuel.0.currentLevel","tanks.fuel.0.capacity"),e},[]),S=(0,r.useSignalKPaths)(M),P=(0,r.useSignalKPath)("navigation.position"),E=(0,s.useCallback)(e=>S[e]??null,[S]),$=(0,s.useCallback)(()=>{let e=[];for(let t=0;t<=1;t++){let s=E(`propulsion.${t}.revolutions`),a=E(`propulsion.${t}.runTime`);0===t&&null===s&&null===a?(s=E("propulsion.port.revolutions")??E("propulsion.main.revolutions"),a=E("propulsion.port.runTime")??E("propulsion.main.runTime")):1===t&&null===s&&null===a&&(s=E("propulsion.starboard.revolutions"),a=E("propulsion.starboard.runTime")),(null!==s||null!==a||w)&&e.push({id:t.toString(),name:0===t?N("motor.portMainEngine"):N("motor.starboardEngine"),hasData:null!==s||null!==a})}return e.length>0?e:[{id:"0",name:N("motor.mainEngine"),hasData:!1}]},[E,w]);(0,s.useEffect)(()=>{R($())},[$]);let I=(0,s.useCallback)(e=>{let t=E(`propulsion.${k}.${e}`);return null===t&&"0"===k?t=E(`propulsion.port.${e}`)??E(`propulsion.main.${e}`):null===t&&"1"===k&&(t=E(`propulsion.starboard.${e}`)),t},[k,E]),H=(0,s.useMemo)(()=>{var e,t;let s=I("coolantTemperature")??I("temperature")??E("propulsion.port.temperature"),a=I("exhaustTemperature")??E("propulsion.main.exhaustTemperature");return{rpm:null==(e=I("revolutions"))?null:60*e,runTime:(e=>{if(null==e)return null;let t=(e/3600).toFixed(1);return`${t} h`})(I("runTime")),coolantTemp:c.kelvinToCelsius(s),coolantPressure:d(I("coolantPressure")),boostPressure:d(I("boostPressure")),oilPressure:d(I("oilPressure")),oilTemp:c.kelvinToCelsius(I("oilTemperature")),fuelRate:null==(t=I("fuel.rate"))?null:Math.round(1e3*t*3600),fuelPressure:d(I("fuel.pressure")),load:u(I("load")),torque:u(I("torque")),exhaustTemp:c.kelvinToCelsius(a),intakeTemp:c.kelvinToCelsius(I("intakeManifoldTemperature")),tilt:c.radiansToDegrees(I("tilt")),state:I("state"),gear:I("transmission.gear"),transOilPressure:d(I("transmission.oilPressure")),transOilTemp:c.kelvinToCelsius(I("transmission.oilTemperature")),batteryVoltage:E("electrical.batteries.0.voltage"),batteryCurrent:E("electrical.batteries.0.current"),alternatorVoltage:E(`electrical.alternators.${k}.voltage`)??E("propulsion.port.alternatorVoltage"),alternatorCurrent:E(`electrical.alternators.${k}.current`)??E("propulsion.port.alternatorCurrent"),fuelLevel:u(E("tanks.fuel.0.currentLevel")),fuelCapacity:E("tanks.fuel.0.capacity")}},[k,I,E]),B=E("electrical.batteries.1.current"),G="number"==typeof B?Math.round(10*B)/10:B,O=I("runTime"),Y=null!==O?O/3600:null,[z,V]=(0,s.useState)(!1),[D,U]=(0,s.useState)([]),[q,W]=(0,s.useState)(null),[K,Z]=(0,s.useState)(!1),[J,Q]=(0,s.useState)(null),X=(0,s.useCallback)(async()=>{Z(!0),Q(null);try{let e=await (0,b.fetchFuelLogEntries)();U(e);let t=(0,b.calculateFuelStats)(e,H.fuelCapacity);W(t)}catch(e){Q((0,b.handleOcearoCoreError)(e,"Fuel log fetch")),U([]),W(null)}finally{Z(!1)}},[H.fuelCapacity]);(0,s.useEffect)(()=>{"fuel"===T&&X()},[T,X]);let _=(0,s.useCallback)(async e=>{Z(!0),Q(null);try{await (0,b.addFuelLogEntry)(e,P),V(!1),await X()}catch(e){Q((0,b.handleOcearoCoreError)(e,"Fuel log save"))}finally{Z(!1)}},[P,X]),ee=q?.lastRefill?.engineHours||null,et=(0,b.estimateTankLevel)(D,Y,H.fuelCapacity,null!==H.fuelLevel?H.fuelLevel/100:null);return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-rightPaneBg overflow-hidden",children:[(0,t.jsx)("div",{className:"flex border-b border-hud bg-hud-bg",children:[{id:"engine",label:N("motor.engine"),icon:o.faCar},{id:"transmission",label:N("motor.transmission"),icon:o.faCogs},{id:"electrical",label:N("motor.electrical"),icon:o.faBolt},{id:"fuel",label:N("motor.fuel"),icon:o.faGasPump},{id:"warnings",label:N("motor.warnings"),icon:o.faExclamationTriangle}].map(e=>(0,t.jsxs)("button",{onClick:()=>L(e.id),className:`flex-1 py-3 px-2 text-xs font-black uppercase flex items-center justify-center transition-all duration-500 ${T===e.id?"text-oGreen border-b-2 border-oGreen bg-hud-bg":"text-hud-secondary hover:text-hud-main tesla-hover"}`,children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:e.icon,className:"mr-2"}),e.label]},e.id))}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-auto scrollbar-hide",children:(0,t.jsx)(a.AnimatePresence,{mode:"wait",children:(0,t.jsxs)(l.motion.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.4,ease:"easeOut"},className:"p-3",children:["engine"===T&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsxs)("h2",{className:"text-sm font-black text-hud-main uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-2 h-2 rounded-full bg-oBlue mr-3 animate-soft-pulse"}),N("motor.propulsionSystems")]}),(0,t.jsx)("select",{value:k,onChange:e=>y(e.target.value),className:"bg-hud-elevated px-4 py-1.5 rounded-sm text-hud-main text-xs font-black uppercase border border-hud focus:outline-none tesla-hover transition-all duration-500 shadow-soft",children:C.map(e=>(0,t.jsx)("option",{value:e.id,className:"bg-oNight",children:e.name},e.id))})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2",children:[(0,t.jsx)(p,{label:N("motor.propulsionSpeed"),value:H.rpm,unit:"RPM",icon:o.faTachometerAlt,max:4e3,warningThreshold:3e3,criticalThreshold:3500}),(0,t.jsxs)("div",{className:"tesla-card p-4 text-center tesla-hover flex flex-col justify-center bg-hud-bg border border-hud",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faClock,className:"text-lg text-hud-dim mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-3xl font-black text-hud-main leading-none gliding-value tracking-tighter",children:H.runTime||N("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-xs font-black uppercase mt-2 tracking-[0.2em]",children:N("motor.serviceHours")})]}),(0,t.jsx)(m,{label:N("motor.load"),value:H.load,unit:"%",min:0,max:100,icon:o.faChartLine,warningThreshold:70,criticalThreshold:85,size:100}),(0,t.jsx)(m,{label:N("motor.torque"),value:H.torque,unit:"%",min:0,max:100,icon:o.faRotate,warningThreshold:75,criticalThreshold:90,size:100})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-1 uppercase tracking-widest flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faTemperatureHalf,className:"mr-2 text-orange-500 text-xs"}),N("motor.temperatureSection")]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[(0,t.jsx)(m,{label:N("motor.coolant"),value:H.coolantTemp,unit:"°C",min:0,max:120,icon:o.faSnowflake,warningThreshold:85,criticalThreshold:95,size:90}),(0,t.jsx)(m,{label:N("motor.oil"),value:H.oilTemp,unit:"°C",min:0,max:150,icon:o.faOilCan,warningThreshold:110,criticalThreshold:130,size:90}),(0,t.jsx)(m,{label:N("motor.exhaust"),value:H.exhaustTemp,unit:"°C",min:0,max:600,icon:o.faFire,warningThreshold:450,criticalThreshold:550,size:90}),(0,t.jsx)(m,{label:N("motor.intake"),value:H.intakeTemp,unit:"°C",min:0,max:100,icon:o.faArrowDown,warningThreshold:60,criticalThreshold:80,size:90})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-1 uppercase tracking-widest flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faGaugeHigh,className:"mr-2 text-oBlue text-xs"}),N("motor.pressures")]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[(0,t.jsx)(x,{label:N("motor.oil"),value:H.oilPressure,unit:"bar",min:0,max:6,icon:o.faOilCan,warningThreshold:2.5,criticalThreshold:2,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.coolant"),value:H.coolantPressure,unit:"bar",min:0,max:3,icon:o.faWater,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.boost"),value:H.boostPressure,unit:"bar",min:0,max:2.5,icon:o.faArrowUp,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.fuel"),value:H.fuelPressure,unit:"bar",min:0,max:5,icon:o.faGasPump,warningThreshold:2.5,criticalThreshold:2,showMinMax:!0})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,t.jsx)(h,{label:N("motor.state"),value:H.state||N("motor.unknown"),icon:o.faCar}),(0,t.jsx)(h,{label:N("motor.tilt"),value:H.tilt,unit:"°",icon:o.faRuler}),(0,t.jsx)(h,{label:N("motor.fuelRate"),value:H.fuelRate,unit:"L/h",icon:o.faGasPump})]})]}),"transmission"===T&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{className:"tesla-card p-4 text-center tesla-hover flex flex-col justify-center bg-hud-bg border border-hud",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faCogs,className:"text-xl text-hud-dim mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-secondary text-xs font-black uppercase mb-2 tracking-[0.2em]",children:N("motor.transmissionGear")}),(0,t.jsx)("div",{className:"text-3xl font-black text-hud-main uppercase gliding-value tracking-tighter",children:-1===H.gear?N("motor.reverse"):0===H.gear?N("motor.neutral"):H.gear?`${N("motor.forward")} ${H.gear}`:N("common.na")})]}),(0,t.jsx)(m,{label:N("motor.oilPressure"),value:H.transOilPressure,unit:"bar",min:0,max:6,icon:o.faOilCan,warningThreshold:2.5,criticalThreshold:2,size:120}),(0,t.jsx)(m,{label:N("motor.oilTemperature"),value:H.transOilTemp,unit:"°C",min:0,max:120,icon:o.faTemperatureHalf,warningThreshold:85,criticalThreshold:95,size:120})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsx)(x,{label:N("motor.hydraulicPressure"),value:H.transOilPressure,unit:"bar",min:0,max:6,icon:o.faOilCan,warningThreshold:2.5,criticalThreshold:2,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.thermalAnalysis"),value:H.transOilTemp,unit:"°C",min:0,max:120,icon:o.faTemperatureHalf,warningThreshold:85,criticalThreshold:95,showMinMax:!0})]})]}),"electrical"===T&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-2 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oBlue mr-3"}),N("motor.energyDistribution")]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h4",{className:"text-xs font-black text-hud-muted uppercase tracking-widest px-1",children:N("motor.ignitionBank")}),(0,t.jsx)(x,{label:N("motor.voltageNode"),value:H.batteryVoltage,unit:"V",min:10,max:15,icon:o.faBatteryFull,warningThreshold:11.8,criticalThreshold:11.5,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.amperageLoad"),value:H.batteryCurrent,unit:"A",min:-50,max:50,icon:o.faBolt,showMinMax:!0})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h4",{className:"text-xs font-black text-hud-muted uppercase tracking-widest px-1",children:N("motor.serviceBank")}),(0,t.jsx)(x,{label:N("motor.voltageNode"),value:E("electrical.batteries.1.voltage"),unit:"V",min:10,max:15,icon:o.faBatteryFull,warningThreshold:11.8,criticalThreshold:11.5,showMinMax:!0}),(0,t.jsx)(x,{label:N("motor.amperageLoad"),value:G,unit:"A",min:-50,max:50,icon:o.faBolt,showMinMax:!0})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-2 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oYellow mr-3"}),N("motor.chargingSystems")]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsx)(m,{label:N("motor.alternatorOutput"),value:H.alternatorVoltage,unit:"V",min:10,max:16,icon:o.faBolt,warningThreshold:15,criticalThreshold:15.5,size:120}),(0,t.jsx)(m,{label:N("motor.chargeIntensity"),value:H.alternatorCurrent,unit:"A",min:0,max:100,icon:o.faBolt,size:120})]})]})]}),"fuel"===T&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,t.jsxs)("h3",{className:"text-sm font-black text-hud-main uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-2 h-2 rounded-full bg-oYellow mr-3 animate-soft-pulse"}),N("motor.resourceManagement")]}),(0,t.jsxs)("button",{onClick:()=>V(!0),className:"bg-oBlue hover:bg-blue-600 text-hud-main px-4 py-1.5 rounded-sm text-xs font-black uppercase tracking-widest transition-all duration-500 flex items-center shadow-lg shadow-oBlue/20",disabled:K,children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faPlus,className:"mr-2 text-xs"}),N("motor.registerRefill")]})]}),J&&(0,t.jsxs)("div",{className:"tesla-card bg-oRed/10 border border-oRed/20 text-oRed p-4 rounded-sm text-xs font-black uppercase tracking-widest animate-soft-pulse",children:[N("motor.nodeError")," ",J]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,t.jsx)(m,{label:N("motor.consumptionRate"),value:H.fuelRate,unit:"L/h",min:0,max:50,icon:o.faGasPump,size:100}),(0,t.jsx)(m,{label:N("motor.injectionPressure"),value:H.fuelPressure,unit:"bar",min:0,max:5,icon:o.faGaugeHigh,warningThreshold:2.5,criticalThreshold:2,size:100}),(0,t.jsx)(m,{label:N("motor.primaryReservoir"),value:H.fuelLevel,unit:"%",min:0,max:100,icon:o.faFlask,warningThreshold:30,criticalThreshold:15,size:100})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-1 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oBlue mr-3"}),N("motor.telemetryDetails")]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsx)(x,{label:N("motor.levelPercentage"),value:H.fuelLevel,unit:"%",min:0,max:100,icon:o.faFlask,warningThreshold:30,criticalThreshold:15,showMinMax:!0}),(0,t.jsx)(h,{label:N("motor.totalCapacity"),value:H.fuelCapacity?.toFixed(0),unit:"L",icon:o.faFlask})]}),null!==H.fuelLevel&&null!==H.fuelCapacity&&(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[(0,t.jsx)(h,{label:N("motor.currentVolume"),value:(H.fuelLevel/100*H.fuelCapacity).toFixed(0),unit:"L",icon:o.faFlask}),(0,t.jsx)(h,{label:N("motor.enduranceEst"),value:H.fuelRate>0&&null!==H.fuelLevel&&null!==H.fuelCapacity?(H.fuelLevel/100*H.fuelCapacity/H.fuelRate).toFixed(1):"N/A",unit:H.fuelRate>0?"h":"",icon:o.faClock})]})]}),et&&(0,t.jsxs)("div",{className:"tesla-card p-4 bg-hud-bg border border-hud",children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-3 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oGreen mr-3"}),N("motor.predictiveAnalysis")]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[null!==et.litersRemaining&&(0,t.jsx)(h,{label:N("motor.estimatedVolume"),value:et.litersRemaining,unit:"L",icon:o.faGasPump}),null!==et.levelPercentage&&(0,t.jsx)(x,{label:N("motor.computedLevel"),value:et.levelPercentage,unit:"%",min:0,max:100,icon:o.faFlask,warningThreshold:30,criticalThreshold:15,reversed:!0}),null!==et.hoursRemaining&&(0,t.jsx)(h,{label:N("motor.timeToExhaustion"),value:et.hoursRemaining,unit:"h",icon:o.faClock,warningThreshold:10,criticalThreshold:5,reversed:!0})]})]}),D.length>0&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-hud-main mb-1 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-hud-muted mr-3"}),N("motor.logHistory")]}),(0,t.jsx)("div",{className:"tesla-card overflow-hidden shadow-soft transition-all duration-500 border border-hud bg-hud-bg",children:(0,t.jsxs)("table",{className:"w-full text-xs font-black uppercase tracking-widest",children:[(0,t.jsx)("thead",{className:"bg-hud-elevated",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.meridianDate")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.liters")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.refillCost")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.hmr")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.avgConsumption")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-left font-black",children:N("motor.fuelAutonomy")}),(0,t.jsx)("th",{className:"text-hud-muted p-4 text-center font-black",children:N("motor.additive")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-hud",children:D.slice(-5).reverse().map((e,s)=>{let a=e.fuel||{},l=a.liters&&a.hoursSinceLastRefill&&a.hoursSinceLastRefill>0?Math.round(a.liters/a.hoursSinceLastRefill*10)/10:null,r=l&&H.fuelCapacity&&a.liters?Math.round(a.liters/l*10)/10:null;return(0,t.jsxs)("tr",{className:"text-hud-main tesla-hover group",children:[(0,t.jsx)("td",{className:"p-4 opacity-60 group-hover:opacity-100 transition-opacity",children:new Date(e.datetime).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"})}),(0,t.jsxs)("td",{className:"p-4 gliding-value text-oBlue",children:[a.liters," L"]}),(0,t.jsx)("td",{className:"p-4 gliding-value",children:null!=a.cost?`${a.cost} €`:"—"}),(0,t.jsxs)("td",{className:"p-4 gliding-value opacity-60",children:[a.engineHoursAtRefill," h"]}),(0,t.jsx)("td",{className:"p-4 gliding-value text-oYellow",children:null!=l?`${l} L/h`:"—"}),(0,t.jsx)("td",{className:"p-4 gliding-value text-oGreen",children:null!=r?`${r} h`:"—"}),(0,t.jsx)("td",{className:"p-4 text-center",children:a.additive?(0,t.jsx)("span",{className:"text-purple-400 animate-soft-pulse",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faFlask,className:"text-xs"})}):(0,t.jsx)("span",{className:"text-hud-dim font-black",children:"—"})})]},e.datetime||s)})})]})})]})]}),"warnings"===T&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"tesla-card p-4 bg-hud-bg border border-hud",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsxs)("h3",{className:"text-sm font-black text-hud-main uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-2 h-2 rounded-full bg-oRed mr-3 animate-soft-pulse"}),N("motor.warningsSummary")]}),(0,t.jsx)("button",{onClick:()=>F(!A),className:"px-4 py-1.5 text-xs bg-hud-elevated text-hud-secondary rounded-sm font-black uppercase tracking-widest tesla-hover border border-hud transition-all duration-500 shadow-soft",children:N("motor.notificationLog")})]}),(e=[],["chargeIndicator","checkEngine","commError","eGRSystem","emergencyStopMode","highBoostPressure","lowCoolantLevel","lowFuelPressure","lowOilLevel","lowOilPressure","lowSystemVoltage","maintenanceNeeded","neutralStartProtect","overTemperature","powerReduction","preheatIndicator","revLimitExceeded","shuttingDown","subOrSecondaryThrottle","throttlePositionSensor","warningLevel1","warningLevel2","waterFlow","waterInFuel"].forEach(t=>{let s=E(`notifications.propulsion.${k}.${t}`);s||"0"!==k?s||"1"!==k||(s=E(`notifications.propulsion.starboard.${t}`)):s=E(`notifications.propulsion.port.${t}`)??E(`notifications.propulsion.main.${t}`),s&&"object"==typeof s&&e.push({type:t,...s})}),v=e.some(e=>"alert"===e.state||"warn"===e.state),j=e.some(e=>"alarm"===e.state||"emergency"===e.state),0===e.filter(e=>"normal"!==e.state).length?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"text-center text-hud-secondary py-8 tesla-card bg-hud-bg border border-hud",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faCheckCircle,className:"text-4xl mb-4 text-oGreen/40 animate-soft-pulse"}),(0,t.jsx)("h4",{className:"text-sm font-black text-hud-main uppercase tracking-[0.2em]",children:N("motor.allSystemsNominal")}),(0,t.jsx)("p",{className:"text-xs font-black mt-2 uppercase text-hud-muted tracking-widest opacity-60",children:N("motor.noActiveWarnings")})]}),A&&e.length>0&&(0,t.jsxs)("div",{className:"tesla-card p-4 bg-oGreen/5 border border-oGreen/10 shadow-soft",children:[(0,t.jsxs)("h4",{className:"text-xs font-black text-oGreen mb-3 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oGreen mr-3"}),"HEALTHY TELEMETRY NODES (",e.length,")"]}),(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3 text-xs font-black uppercase tracking-tight",children:e.map((e,s)=>(0,t.jsxs)("div",{className:"text-hud-secondary flex items-center bg-hud-elevated p-3 rounded-sm tesla-hover border border-hud",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:o.faCheckCircle,className:"text-oGreen mr-3 text-xs opacity-40"}),(0,t.jsx)("span",{className:"truncate opacity-60",children:e.type.replace(/([A-Z])/g," $1").trim()})]},s))})]})]}):(0,t.jsxs)("div",{className:"space-y-8",children:[j&&(0,t.jsxs)("div",{className:"bg-oRed/5 border border-oRed/20 p-6 rounded-sm shadow-soft animate-soft-pulse",children:[(0,t.jsxs)("h4",{className:"text-xs font-black text-oRed mb-6 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oRed mr-3"}),"CRITICAL NODE ALARMS"]}),(0,t.jsx)("div",{className:"space-y-4",children:e.filter(e=>"alarm"===e.state||"emergency"===e.state).map((e,s)=>(0,t.jsxs)("div",{className:"text-hud-main text-xs font-black uppercase tracking-widest bg-oRed/10 p-4 rounded-sm tesla-hover border border-oRed/20",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs",children:e.type.replace(/([A-Z])/g," $1").trim()}),(0,t.jsx)("span",{className:"text-oRed text-xs font-black tracking-tighter",children:"ALERT LEVEL 3"})]}),(0,t.jsx)("div",{className:"text-hud-secondary text-xs mt-3 normal-case font-black tracking-normal opacity-80",children:e.message})]},s))})]}),v&&(0,t.jsxs)("div",{className:"bg-oYellow/5 border border-oYellow/20 p-6 rounded-sm shadow-soft",children:[(0,t.jsxs)("h4",{className:"text-xs font-black text-oYellow mb-6 uppercase tracking-[0.2em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oYellow mr-3"}),"SYSTEM ANOMALIES"]}),(0,t.jsx)("div",{className:"space-y-4",children:e.filter(e=>"alert"===e.state||"warn"===e.state).map((e,s)=>(0,t.jsxs)("div",{className:"text-hud-main text-xs font-black uppercase tracking-widest bg-oYellow/10 p-4 rounded-sm tesla-hover border border-oYellow/20",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-xs",children:e.type.replace(/([A-Z])/g," $1").trim()}),(0,t.jsx)("span",{className:"text-oYellow text-xs font-black tracking-tighter",children:"WARN LEVEL 2"})]}),(0,t.jsx)("div",{className:"text-hud-secondary text-xs mt-3 normal-case font-black tracking-normal opacity-80",children:e.message})]},s))})]})]}))]}),w&&(0,t.jsxs)("div",{className:"tesla-card p-8 bg-hud-bg border border-hud",children:[(0,t.jsxs)("h3",{className:"text-xs font-black text-oBlue mb-6 uppercase tracking-[0.3em] flex items-center",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-oBlue mr-3"}),"Internal Debug Telemetry"]}),(0,t.jsx)("div",{className:"space-y-4 text-xs font-black font-mono text-hud-secondary uppercase tracking-widest",children:(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2",children:[(0,t.jsx)("span",{className:"text-hud-muted",children:"PATH.REVOLUTIONS:"}),(0,t.jsxs)("span",{className:"text-oGreen opacity-80",children:["propulsion.",k,".revs"]}),(0,t.jsx)("span",{className:"text-hud-muted",children:"VALUE.REVOLUTIONS:"}),(0,t.jsx)("span",{className:"text-hud-main gliding-value",children:E(`propulsion.${k}.revolutions`)??"NULL"}),(0,t.jsx)("div",{className:"col-span-2 my-4 border-t border-hud"}),(0,t.jsx)("span",{className:"text-hud-muted",children:"PATH.TEMPERATURE:"}),(0,t.jsxs)("span",{className:"text-oGreen opacity-80",children:["propulsion.",k,".temp"]}),(0,t.jsx)("span",{className:"text-hud-muted",children:"VALUE.TEMPERATURE:"}),(0,t.jsx)("span",{className:"text-hud-main gliding-value",children:E(`propulsion.${k}.coolantTemperature`)??"NULL"})]})})]})]})]},T)})}),(0,t.jsx)(f,{isOpen:z,onClose:()=>V(!1),onSave:_,currentEngineHours:Y,lastRefillEngineHours:ee,loading:K})]})}],73064)},8161,e=>{e.n(e.i(73064))}]);