ocearo-ui 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/404.html +1 -1
- package/CHANGELOG.md +364 -0
- package/README.fr.md +28 -31
- package/README.md +28 -31
- package/__next.__PAGE__.txt +3 -3
- package/__next._full.txt +3 -3
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/01ij-cuy61l35.js +1 -0
- package/_next/static/chunks/047e3x_ahxnrl.js +1 -0
- package/_next/static/chunks/0ath9h2eo-m4-.js +1 -0
- package/_next/static/chunks/0bxzs0khjn1uj.js +1 -0
- package/_next/static/chunks/0ejjon45nq_-h.js +9 -0
- package/_next/static/chunks/{1quvj-861o57h.js → 0kdc_niwgmx_8.js} +1 -1
- package/_next/static/chunks/{1bvrvkcwf3ge-.js → 0ngl63fz0a-bo.js} +1 -1
- package/_next/static/chunks/0ucob1nu_x8bl.js +1 -0
- package/_next/static/chunks/0wi5jop1ihbm6.js +2 -0
- package/_next/static/chunks/18e6nw0w7akkb.js +180 -0
- package/_next/static/chunks/18vlmqe7txbmt.js +1 -0
- package/_next/static/chunks/{3utjjgdhnlx86.js → 192c42s2wc7qe.js} +1 -1
- package/_next/static/chunks/1_twx50ejqan5.js +1 -0
- package/_next/static/chunks/1na56snuhu-pc.js +346 -0
- package/_next/static/chunks/1vchkqgn-xw-o.js +1 -0
- package/_next/static/chunks/20p1hr--2grl8.js +9 -0
- package/_next/static/chunks/2393lwi8kee3m.js +48 -0
- package/_next/static/chunks/25v2cwta2fy-7.js +393 -0
- package/_next/static/chunks/28wfa6j-9g_qc.js +1 -0
- package/_next/static/chunks/290k3k__vbum2.js +121 -0
- package/_next/static/chunks/2cecf_xnd_9em.js +1 -0
- package/_next/static/chunks/2die6btm3_mhq.js +1 -0
- package/_next/static/chunks/2hm43avzk8_jb.js +503 -0
- package/_next/static/chunks/2ijx7rln4jshb.css +3 -0
- package/_next/static/chunks/2q_bl16zedyyo.js +503 -0
- package/_next/static/chunks/2xntuu6mzh41s.js +1 -0
- package/_next/static/chunks/30p1dpgmonstj.js +1 -0
- package/_next/static/chunks/31p7nz0hfuym7.js +1 -0
- package/_next/static/chunks/{1e-w_-usen7fy.js → 34nhy77liurum.js} +2 -2
- package/_next/static/chunks/37g-wmrgbgd6h.js +739 -0
- package/_next/static/chunks/{18_i6mf6hb_c7.js → 395ffa6t18601.js} +1 -1
- package/_next/static/chunks/3bai186_bv3i_.js +1 -0
- package/_next/static/chunks/3h_m2s30sr9mt.js +430 -0
- package/_next/static/chunks/3j453-2u58qbv.js +1 -0
- package/_next/static/chunks/3k-r-4veivdjr.js +1 -0
- package/_next/static/chunks/3yz0mxxv4vrfg.js +1 -0
- package/_not-found/__next._full.txt +2 -2
- package/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +2 -2
- package/boats/boats.json +11 -19
- package/boats/windsurf/assets/license.txt +6 -8
- package/boats/windsurf/assets/rider.glb +0 -0
- package/boats/wingfoil/assets/license.txt +9 -0
- package/boats/wingfoil/assets/rider.glb +0 -0
- package/guide/bathymetry.jpg +0 -0
- package/guide/weather.jpg +0 -0
- package/index.html +1 -1
- package/index.txt +3 -3
- package/package.json +27 -5
- package/settings/__next._full.txt +3 -3
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +3 -3
- package/settings.html +1 -1
- package/settings.txt +3 -3
- package/_next/static/chunks/0-19-ljntm5ig.js +0 -1
- package/_next/static/chunks/0-g-ujyrfgutp.js +0 -2
- package/_next/static/chunks/0-jqvc-r0kh0c.js +0 -1
- package/_next/static/chunks/05do10p9ldt1p.js +0 -409
- package/_next/static/chunks/0c91q-13wh8hk.js +0 -1
- package/_next/static/chunks/0fv1wwxeyagln.js +0 -446
- package/_next/static/chunks/0jucaltuccn03.js +0 -1
- package/_next/static/chunks/0m7wbuocx-b4_.js +0 -9
- package/_next/static/chunks/0o7hu-sypv2u9.js +0 -1
- package/_next/static/chunks/0ujzg6ofy2r73.js +0 -1
- package/_next/static/chunks/162bfkgcudvew.js +0 -9
- package/_next/static/chunks/1bo0ke8gjc1c2.js +0 -1
- package/_next/static/chunks/1do-2zwq3ws0f.js +0 -346
- package/_next/static/chunks/1ho2ekxa9io1_.js +0 -1
- package/_next/static/chunks/1m3-nchdgcxy1.css +0 -3
- package/_next/static/chunks/271ys-u920uqd.js +0 -564
- package/_next/static/chunks/2_iau6x7s0vil.js +0 -1131
- package/_next/static/chunks/2ab6q6u6uo_bf.js +0 -1
- package/_next/static/chunks/2pt-apz8_pa4j.js +0 -1
- package/_next/static/chunks/2rnpgrmuyhpkd.js +0 -119
- package/_next/static/chunks/2w71oj1brox5z.js +0 -1
- package/_next/static/chunks/3e5jmzthktu9w.js +0 -1
- package/_next/static/chunks/3r8nellt-dsed.js +0 -1
- package/_next/static/chunks/3wwn1rti8oc_r.js +0 -1
- package/_next/static/chunks/41odv061mfm6t.js +0 -1
- package/boats/optimist/Scene.jsx +0 -28
- package/boats/optimist/assets/license.txt +0 -11
- package/boats/optimist/assets/scene-transformed.glb +0 -0
- package/boats/sailboat/Scene.jsx +0 -21
- package/boats/sailboat/assets/license.txt +0 -10
- package/boats/sailboat/assets/scene-transformed.glb +0 -0
- package/boats/windsurf/Scene.jsx +0 -22
- package/boats/windsurf/assets/scene-transformed.glb +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_buildManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,4875,e=>{"use strict";var t=e.i(43476);e.i(67561);var i=e.i(46991),a=e.i(71645),n=e.i(85709);e.i(85269);var s=e.i(22831);let l={SOG:"navigation.speedOverGround",VMG:"performance.velocityMadeGood",STW:"navigation.speedThroughWater",POL:"performance.polarSpeedRatio"};e.s(["default",0,()=>{let{t:e}=(0,s.useTranslation)(),[r,d]=(0,a.useState)("SOG"),o=(0,a.useMemo)(()=>Object.values(l),[]),c=(0,n.useSignalKPaths)(o),m=(0,a.useMemo)(()=>{let e={};for(let[t,a]of Object.entries(l)){let n=c[a];null!=n&&(e[t]="POL"===t?100*n:(0,i.convertSpeedUnit)(n))}return e},[c]),u=Object.keys(m),h=void 0!==m[r]?r:u[0],x=m[h],p=(0,a.useCallback)(()=>{if(0===u.length)return;let e=(u.indexOf(h)+1)%u.length;d(u[e])},[u,h]);return 0===u.length?(0,t.jsxs)("div",{className:"mt-6 [@media(max-height:500px)]:mt-1.5 ml-2",children:[(0,t.jsx)("div",{className:"text-hero [@media(max-height:500px)]:text-[2.5rem] font-medium text-hud-dim tracking-tight",children:"--"}),(0,t.jsx)("div",{className:"text-caption font-semibold uppercase tracking-[0.2em] text-hud-muted ml-1",children:e("common.na")})]}):(0,t.jsxs)("div",{className:"mt-6 [@media(max-height:500px)]:mt-1.5 ml-2 select-none group",children:[(0,t.jsx)("div",{className:"text-hero [@media(max-height:500px)]:text-[2.5rem] font-medium cursor-pointer tracking-tight drop-shadow-2xl transition-all duration-300 group-hover:scale-105 active:scale-95 text-hud-main",onClick:p,role:"button",tabIndex:0,"aria-label":`Current speed: ${x} ${h}. Click to change speed type.`,children:Number.isFinite(x)?x.toFixed(1):"--"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 ml-1",children:[(0,t.jsx)("div",{className:"text-caption font-semibold uppercase tracking-[0.3em] text-hud-secondary",children:h}),(0,t.jsx)("div",{className:"h-[2px] w-4 bg-oBlue/40 rounded-full"}),(0,t.jsx)("div",{className:"text-caption font-bold uppercase tracking-widest text-hud-muted",children:"POL"===h?"%":(0,i.getSpeedUnitLabel)()})]})]})}])},56665,function(e){e.n(e.i(4875))}]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68192,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(70703),l=e.i(46932),o=e.i(88653);e.i(85269);var a=e.i(22831),r=e.i(85709),i=e.i(83402);let u=({messageKey:e})=>{let{t:s}=(0,a.useTranslation)();return(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center text-hud-main",children:s(e)})},c=(0,n.default)(()=>e.A(26949),{loadableGenerated:{modules:[23298]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingDocuments"})}),d=(0,n.default)(()=>e.A(22155),{loadableGenerated:{modules:[34900]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingSettings"})}),m=(0,n.default)(()=>e.A(30455),{loadableGenerated:{modules:[13268]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingMediaPlayer"})}),h=(0,n.default)(()=>e.A(71074),{loadableGenerated:{modules:[65862]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingBatteryMonitor"})}),f=(0,n.default)(()=>e.A(3523),{loadableGenerated:{modules:[8161]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingEngineMonitor"})}),p=(0,n.default)(()=>e.A(88913),{loadableGenerated:{modules:[25294]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingDashboard"})}),g=(0,n.default)(()=>e.A(26371),{loadableGenerated:{modules:[70127]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingLogbook"})}),x=(0,n.default)(()=>e.A(58293),{loadableGenerated:{modules:[33946]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingAutopilot"})}),j=(0,n.default)(()=>e.A(47853),{loadableGenerated:{modules:[58652]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loading"})}),b={latitude:46.1591,longitude:-1.1522},y={navigation:e=>!e||e.includes("localhost:3000")?null:`${e}/@signalk/freeboard-sk/`,instrument:e=>`${e}/@mxtommy/kip/`,dashboard:e=>e.replace(":3000",":3001")+"/grafana",webcam1:()=>"https://pv.viewsurf.com/2080/Chatelaillon-Port?i=NzU4Mjp1bmRlZmluZWQ",webcam2:()=>"https://pv.viewsurf.com/1478/Chatelaillon-Plage?i=NTkyMDp1bmRlZmluZWQ",weather:(e,t)=>t&&`https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=mm&metricTemp=\xb0C&metricWind=kt&zoom=10&overlay=wind&product=ecmwf&level=surface&lat=${t.latitude}&lon=${t.longitude}&message=true`};e.s(["default",0,({view:e})=>{let{t:n}=(0,a.useTranslation)(),[u,v]=(0,s.useState)(b),[k,w]=(0,s.useState)(null);i.default.getAll();let P=i.default.getSignalKUrl(),E=(0,r.useSignalKPath)("navigation.position");(0,s.useEffect)(()=>{w(null)},[e]),(0,s.useEffect)(()=>{E&&v(e=>e?Math.abs(e.latitude-E.latitude)>.01||Math.abs(e.longitude-E.longitude)>.01?E:e:E)},[E]);let C=(0,s.useMemo)(()=>{let t=i.default.getAll(),s=t.customExternalUrls||{};if(t.showCustomUrls&&s[e])try{if("string"==typeof s[e]&&s[e].includes("${signalkUrl}"))return s[e].replace("${signalkUrl}",P).replace("${latitude}",u?.latitude||b.latitude).replace("${longitude}",u?.longitude||b.longitude);return s[e]}catch(e){console.error("Error using custom URL:",e)}let n=y[e];if(!n)return null;try{return n(P,u)}catch(e){return console.error("Error generating URL:",e),null}},[e,u,P]),$=["motor","logbook","autopilot","battery","dashboard","debug"].includes(e);return(0,t.jsx)("div",{className:"flex flex-col w-full h-full overflow-hidden bg-hud-bg backdrop-blur-sm relative z-0",children:(0,t.jsx)(o.AnimatePresence,{mode:"wait",children:(0,t.jsx)(l.motion.div,{initial:{opacity:0,x:10,scale:.99},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:-10,scale:.99},transition:{duration:.4,ease:[.16,1,.3,1]},style:{flex:"1 1 0%",minHeight:0},className:`flex flex-col w-full absolute inset-0 ${$?"overflow-hidden":"overflow-auto"}`,children:(()=>{if(k)return(0,t.jsx)("div",{className:"text-oRed p-4 font-semibold uppercase text-caption",children:k});switch(e){case"manual":return(0,t.jsx)(c,{path:"./docs"});case"settings":return(0,t.jsx)(d,{});case"mediaplayer":return(0,t.jsx)(m,{});case"battery":return(0,t.jsx)(h,{});case"motor":return(0,t.jsx)(f,{});case"dashboard":return(0,t.jsx)(p,{});case"logbook":return(0,t.jsx)(g,{});case"autopilot":return(0,t.jsx)(x,{});case"debug":return(0,t.jsx)(j,{});default:if(!C)return(0,t.jsx)("div",{className:"text-hud-muted p-4 text-label",children:n("errors.failedToLoadExternal")});return(0,t.jsx)("iframe",{className:"flex-grow border-none",src:C,title:"External Application",onError:()=>w(n("errors.failedToLoadExternal"))})}})()},e)})})}])},42602,function(e){e.n(e.i(68192))},58293,e=>{e.v(t=>Promise.all(["static/chunks/2dvwb-mfasp68.js","static/chunks/192c42s2wc7qe.js"].map(t=>e.l(t))).then(()=>t(33946)))},71074,e=>{e.v(t=>Promise.all(["static/chunks/1xekc18cyi4sx.js","static/chunks/192c42s2wc7qe.js","static/chunks/2s6w3x5jnc2tg.js"].map(t=>e.l(t))).then(()=>t(65862)))},88913,e=>{e.v(t=>Promise.all(["static/chunks/0nq1o9-m7bhjg.js","static/chunks/192c42s2wc7qe.js","static/chunks/0kdc_niwgmx_8.js"].map(t=>e.l(t))).then(()=>t(25294)))},47853,e=>{e.v(t=>Promise.all(["static/chunks/2fdpvhx4oo81h.js"].map(t=>e.l(t))).then(()=>t(58652)))},26949,e=>{e.v(t=>Promise.all(["static/chunks/34nhy77liurum.js","static/chunks/192c42s2wc7qe.js"].map(t=>e.l(t))).then(()=>t(23298)))},3523,e=>{e.v(t=>Promise.all(["static/chunks/1pa1cfmfts0i9.js","static/chunks/192c42s2wc7qe.js"].map(t=>e.l(t))).then(()=>t(8161)))},26371,e=>{e.v(t=>Promise.all(["static/chunks/3j453-2u58qbv.js","static/chunks/192c42s2wc7qe.js"].map(t=>e.l(t))).then(()=>t(70127)))},30455,e=>{e.v(t=>Promise.all(["static/chunks/0n95joti2n2py.js","static/chunks/192c42s2wc7qe.js"].map(t=>e.l(t))).then(()=>t(13268)))},22155,e=>{e.v(t=>Promise.all(["static/chunks/2die6btm3_mhq.js","static/chunks/18e6nw0w7akkb.js","static/chunks/192c42s2wc7qe.js","static/chunks/0ohleay4roayh.js","static/chunks/2hm43avzk8_jb.js"].map(t=>e.l(t))).then(()=>t(34900)))},88653,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(31178),l=e.i(47414),o=e.i(74008),a=e.i(21476),r=e.i(72846),i=s,u=e.i(37806);function c(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class d extends i.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if((0,r.isHTMLElement)(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let e=t.offsetParent,s=(0,r.isHTMLElement)(e)&&e.offsetWidth||0,n=(0,r.isHTMLElement)(e)&&e.offsetHeight||0,l=getComputedStyle(t),o=this.props.sizeRef.current;o.height=parseFloat(l.height),o.width=parseFloat(l.width),o.top=t.offsetTop,o.left=t.offsetLeft,o.right=s-o.width-o.left,o.bottom=n-o.height-o.top,o.direction=l.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function m({children:e,isPresent:n,anchorX:l,anchorY:o,root:a,pop:r}){let h=(0,i.useId)(),f=(0,i.useRef)(null),p=(0,i.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:g}=(0,i.useContext)(u.MotionConfigContext),x=function(...e){return s.useCallback(function(...e){return t=>{let s=!1,n=e.map(e=>{let n=c(e,t);return s||"function"!=typeof n||(s=!0),n});if(s)return()=>{for(let t=0;t<n.length;t++){let s=n[t];"function"==typeof s?s():c(e[t],null)}}}}(...e),e)}(f,!1!==r?e.props?.ref??e?.ref:void 0);return(0,i.useInsertionEffect)(()=>{let{width:e,height:t,top:s,left:i,right:u,bottom:c,direction:d}=p.current;if(n||!1===r||!f.current||!e||!t)return;let m="rtl"===d,x="left"===l?m?`right: ${u}`:`left: ${i}`:m?`left: ${i}`:`right: ${u}`,j="bottom"===o?`bottom: ${c}`:`top: ${s}`;f.current.dataset.motionPopId=h;let b=document.createElement("style");g&&(b.nonce=g);let y=a??document.head;return y.appendChild(b),b.sheet&&b.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${h}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${e}px !important;
|
|
5
|
+
height: ${t}px !important;
|
|
6
|
+
${x}px !important;
|
|
7
|
+
${j}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{f.current?.removeAttribute("data-motion-pop-id"),y.contains(b)&&y.removeChild(b)}},[n]),(0,t.jsx)(d,{isPresent:n,childRef:f,sizeRef:p,pop:r,children:!1===r?e:i.cloneElement(e,{ref:x})})}let h=({children:e,initial:n,isPresent:r,onExitComplete:i,custom:u,presenceAffectsLayout:c,mode:d,anchorX:h,anchorY:p,root:g})=>{let x=(0,l.useConstant)(f),j=(0,s.useId)(),b=(0,s.useRef)(r),y=(0,s.useRef)(i);(0,o.useIsomorphicLayoutEffect)(()=>{b.current=r,y.current=i});let v=!0,k=(0,s.useMemo)(()=>(v=!1,{id:j,initial:n,isPresent:r,custom:u,onExitComplete:e=>{for(let t of(x.set(e,!0),x.values()))if(!t)return;i&&i()},register:e=>(x.set(e,!1),()=>{x.delete(e),b.current||x.size||y.current?.()})}),[r,x,i]);return c&&v&&(k={...k}),(0,s.useMemo)(()=>{x.forEach((e,t)=>x.set(t,!1))},[r]),s.useEffect(()=>{r||x.size||!i||i()},[r]),e=(0,t.jsx)(m,{pop:"popLayout"===d,isPresent:r,anchorX:h,anchorY:p,root:g,children:e}),(0,t.jsx)(a.PresenceContext.Provider,{value:k,children:e})};function f(){return new Map}var p=e.i(64978);let g=e=>e.key||"";function x(e){let t=[];return s.Children.forEach(e,e=>{(0,s.isValidElement)(e)&&t.push(e)}),t}e.s(["AnimatePresence",0,({children:e,custom:a,initial:r=!0,onExitComplete:i,presenceAffectsLayout:u=!0,mode:c="sync",propagate:d=!1,anchorX:m="left",anchorY:f="top",root:j})=>{let[b,y]=(0,p.usePresence)(d),v=(0,s.useMemo)(()=>x(e),[e]),k=d&&!b?[]:v.map(g),w=(0,s.useRef)(!0),P=(0,l.useConstant)(()=>new Map),E=(0,s.useRef)(new Set),[C,$]=(0,s.useState)(v),[A,R]=(0,s.useState)(v);(0,o.useIsomorphicLayoutEffect)(()=>{!d||b||A.length||y?.()},[b,d,A.length,y]),(0,o.useIsomorphicLayoutEffect)(()=>{w.current=!1;for(let e=0;e<A.length;e++){let t=g(A[e]);k.includes(t)?(P.delete(t),E.current.delete(t)):!0!==P.get(t)&&P.set(t,!1)}},[A,k.length,k.join("-")]);let M=[];if(v!==C){let e=[...v],t=0;for(let s of A){let n=k.indexOf(g(s));-1===n?(e.splice(t++,0,s),M.push(s)):t=n+M.length+1}return M.every(e=>P.get(g(e)))?e=v:"wait"===c&&(e=M),R(x(e)),$(v),null}let{forceRender:L}=(0,s.useContext)(n.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:A.map(e=>{let s=g(e),n=(!d||!!b)&&(v===A||k.includes(s));return(0,t.jsx)(h,{isPresent:n,initial:(!w.current||!!r)&&void 0,custom:a,presenceAffectsLayout:u,mode:c,root:j,onExitComplete:n?void 0:()=>{if(E.current.has(s)||!P.has(s))return;E.current.add(s),P.set(s,!0);let e=!0;P.forEach(t=>{t||(e=!1)}),e&&(L?.(),$([]),d&&y?.(),i&&i())},anchorX:m,anchorY:f,children:e},s)})})}],88653)}]);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23320,e=>{"use strict";var t=e.i(43476),a=e.i(71645);e.i(85269);var r=e.i(22831),i=e.i(88608),n=e.i(3666),o=e.i(54983),l=e.i(83402),s=e.i(54735),u=e.i(15126),d=e.i(33227);let c=(e,t)=>e.slice(0,48).map((e,a)=>`${a},${(1-.9*Math.min(1,e/(t||1))).toFixed(3)}`).join(" ");e.s(["default",0,({wind:e=!0,current:m=!1,compact:h=!1})=>{let{t:p}=(0,r.useTranslation)(),f=(0,a.useSyncExternalStore)(i.subscribeForecast,i.getForecastHour,i.getForecastHour),x=(0,a.useSyncExternalStore)(d.subscribeCurrentScale,d.getCurrentScale,d.getCurrentScale),g=(0,a.useSyncExternalStore)(i.subscribeSeries,i.getSeries,i.getSeries),v=e&&g.wind?.values.length>1?g.wind:null,y=m&&g.current?.values.length>1?g.current:null,M=new Date(Date.now()+36e5*f),w=l.default.get("windColorMap")||"windy",b="windy"===w?25:u.WIND_MAP_TOP,S="windy"===w?`linear-gradient(to right, ${n.WINDY_SCALE.filter(([e])=>e<=25).map(([e,[t,a,r]])=>`rgb(${t},${a},${r}) ${e/25*100}%`).join(", ")})`:(0,o.cssGradient)(w);return(0,t.jsxs)("div",{className:`flex flex-col gap-1 px-3 rounded-2xl backdrop-blur select-none w-full ${h?"py-1":"py-2"}`,style:{background:"color-mix(in srgb, var(--background) 88%, transparent)"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted shrink-0",children:p("meteo.forecast")}),(0,t.jsx)("input",{type:"range",min:0,max:47,step:1,value:f,onChange:e=>(0,i.setForecastHour)(Number(e.target.value)),"aria-label":p("meteo.forecast"),className:"flex-1 min-w-0 accent-oBlue"}),(0,t.jsx)("span",{className:"text-label font-semibold tabular-nums text-hud-main shrink-0",children:0===f?p("meteo.now"):`+${f} h \xb7 ${M.toLocaleTimeString([],{weekday:"short",hour:"2-digit",minute:"2-digit"})}`})]}),(v||y)&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("svg",{viewBox:"0 0 47 1",preserveAspectRatio:"none",className:`flex-1 min-w-0 ${h?"h-5":"h-8"}`,"aria-hidden":"true",children:[v&&(0,t.jsx)("polyline",{points:c(v.values,v.top),fill:"none",className:"stroke-oGreen",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),y&&(0,t.jsx)("polyline",{points:c(y.values,y.top),fill:"none",className:"stroke-oYellow",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),(0,t.jsx)("line",{x1:f,x2:f,y1:"0",y2:"1",className:"stroke-hud-main",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end shrink-0 text-caption font-semibold tabular-nums leading-tight",children:[v&&(0,t.jsxs)("span",{className:"text-oGreen",children:[p("toolbar.layerWind")," ",Math.round((v.values[f]??0)*1.943844)," kn"]}),y&&(0,t.jsxs)("span",{className:"text-oYellow",children:[p("toolbar.layerCurrent")," ",((y.values[f]??0)*1.943844).toFixed(1)," kn"]})]})]}),e&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[m&&(0,t.jsx)("span",{className:"text-caption text-hud-muted w-14 shrink-0",children:p("toolbar.layerWind")}),(0,t.jsx)("div",{className:"flex-1 h-2 rounded-full",style:{background:S}}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted tabular-nums shrink-0 w-14 text-right",children:["0 – ",Math.round(1.943844*b)," kn"]})]}),m&&x&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,t.jsx)("span",{className:"text-caption text-hud-muted w-14 shrink-0",children:p("toolbar.layerCurrent")}),(0,t.jsx)("div",{className:"flex-1 h-2 rounded-full",style:{background:(0,o.cssGradient)(l.default.get("currentColorMap")||s.DEFAULT_CURRENT_MAP)}}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted tabular-nums shrink-0 w-14 text-right",children:["0 – ",Number((1.943844*x).toFixed(2))," kn"]})]})]})}])},79224,function(e){e.n(e.i(23320))},15126,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(95393),i=e.i(90072),n=e.i(92923),o=e.i(30728),l=e.i(27530),s=e.i(83402),u=e.i(85709),d=e.i(78461),c=e.i(3666),m=e.i(54983),h=e.i(69435),p=e.i(88608),f=e.i(78311),x=e.i(18032),g=e.i(83646);let v=["navigation.position","environment.wind.speedTrue","environment.wind.directionTrue"],y=(e,t)=>e&&"windy"!==e?(0,m.colorAt)(e,t/20):(0,c.windColor)(t),M=`
|
|
2
|
+
uniform float uScale;
|
|
3
|
+
varying vec2 vGround;
|
|
4
|
+
varying vec3 vWorld;
|
|
5
|
+
void main() {
|
|
6
|
+
vGround = position.xy / uScale;
|
|
7
|
+
vec4 w = modelMatrix * vec4(position, 1.0);
|
|
8
|
+
vWorld = w.xyz;
|
|
9
|
+
gl_Position = projectionMatrix * viewMatrix * w;
|
|
10
|
+
}
|
|
11
|
+
`,w=`
|
|
12
|
+
uniform float uScale;
|
|
13
|
+
uniform float uTop; // top of the air layer, world y
|
|
14
|
+
uniform float uTime;
|
|
15
|
+
uniform float uMaxSpeed; // top of the colour scale, m/s
|
|
16
|
+
uniform float uOpacity;
|
|
17
|
+
uniform float uLength; // metres of air for ~63 % of the opacity
|
|
18
|
+
uniform float uFlow;
|
|
19
|
+
uniform sampler2D uMap;
|
|
20
|
+
varying vec2 vGround;
|
|
21
|
+
varying vec3 vWorld;
|
|
22
|
+
${h.NOISE_GLSL}
|
|
23
|
+
${h.FIELD_GLSL}
|
|
24
|
+
void main() {
|
|
25
|
+
// Air the view ray crosses from the top of the layer down to the water
|
|
26
|
+
vec3 P = vWorld;
|
|
27
|
+
vec3 C = cameraPosition;
|
|
28
|
+
vec3 E = C.y > uTop ? C + (P - C) * ((C.y - uTop) / max(C.y - P.y, 1e-3)) : C;
|
|
29
|
+
float L = length(P - E) / uScale;
|
|
30
|
+
vec2 flow = flowAt(vGround);
|
|
31
|
+
float speed = length(flow);
|
|
32
|
+
float t = clamp(speed / uMaxSpeed, 0.0, 1.0);
|
|
33
|
+
vec3 col = texture2D(uMap, vec2(t, 0.5)).rgb;
|
|
34
|
+
// Gusty wisps carried by the wind, stretched along it
|
|
35
|
+
vec2 dir = speed > 1e-3 ? flow / speed : vec2(0.0, 1.0);
|
|
36
|
+
vec2 drift = vGround - flow * uTime * uFlow;
|
|
37
|
+
vec2 q = vec2(dot(drift, dir) / 1400.0, dot(drift, vec2(-dir.y, dir.x)) / 220.0);
|
|
38
|
+
float n = fbm(vec3(q, uTime * 0.05));
|
|
39
|
+
col *= 0.88 + 0.28 * n;
|
|
40
|
+
// A floor so the air right around the boat shows its colour, more
|
|
41
|
+
// with the depth of air crossed towards the horizon
|
|
42
|
+
float alpha = uOpacity * (0.3 + 0.7 * (1.0 - exp(-L / uLength))) * (0.25 + 1.5 * n * n);
|
|
43
|
+
alpha *= fieldMask(vGround);
|
|
44
|
+
if (alpha < 0.004) discard;
|
|
45
|
+
gl_FragColor = vec4(col, clamp(alpha, 0.0, 1.0));
|
|
46
|
+
#include <colorspace_fragment>
|
|
47
|
+
}
|
|
48
|
+
`,b=(e,t)=>({east:(t.longitude-e.lon)*Math.PI/180*6371e3*Math.cos(e.lat*Math.PI/180),north:(t.latitude-e.lat)*Math.PI/180*6371e3});e.s(["WIND_MAP_TOP",0,20,"default",0,({y:e=.05,sheet:S=!0})=>{let F=s.default.get("windStyle")||"volume",N=S&&"volume"===F,T="volume"===F?150:1100,E=s.default.get("windColorMap")||"windy",j=(0,u.useSignalKPaths)(v),k=j["navigation.position"],{heading:C}=(0,d.default)(),L=(0,a.useSyncExternalStore)(p.subscribeForecast,p.getForecastHour,p.getForecastHour),[A,W]=(0,a.useState)(null),{id:_}=(0,g.default)(),G="day"===_?-.6:.45,P=(0,a.useRef)(),$=s.default.get("aisLengthScalingFactor")||.7,R=k?.latitude,U=k?.longitude,D=Number.isFinite(R)?`${R.toFixed(1)},${U.toFixed(1)}`:null,H=j["environment.wind.speedTrue"],O=j["environment.wind.directionTrue"];(0,a.useEffect)(()=>{if(!D)return;let e=!1,[t,a]=D.split(",").map(Number);return(0,c.fetchWindField)(t,a).then(t=>{e||W(t)}).catch(()=>{!e&&Number.isFinite(H)&&Number.isFinite(O)&&W((0,c.uniformField)(t,a,H,O))}),()=>{e=!0}},[D]);let B=(0,a.useMemo)(()=>{let e=new Uint8Array(65536),t=new i.DataTexture(e,128,128,i.RGBAFormat);return t.magFilter=i.LinearFilter,t.minFilter=i.LinearFilter,t.colorSpace=i.SRGBColorSpace,t},[]);(0,a.useEffect)(()=>{if(!A||!S||N)return;let e=B.image.data;for(let t=0;t<128;t++)for(let a=0;a<128;a++){let r=(a/127*2-1)*c.HALF_EXTENT_M,i=(t/127*2-1)*c.HALF_EXTENT_M,n=(0,c.sampleWind)(A,r,i,L),[o,l,s]=y(E,Math.hypot(n.u,n.v)),u=(128*t+a)*4,d=Math.max(Math.abs(a/127*2-1),Math.abs(t/127*2-1));e[u]=o,e[u+1]=l,e[u+2]=s,e[u+3]=Math.round(255*Math.min(1,(1-d)*8))}B.needsUpdate=!0},[B,A,L,S,N,E]),(0,a.useEffect)(()=>()=>B.dispose(),[B]);let I=(0,a.useMemo)(()=>{let e=new o.LineSegmentsGeometry;e.setPositions(new Float32Array(46200)),e.setColors(new Float32Array(46200));let t=new l.LineMaterial({linewidth:3,vertexColors:!0,transparent:!0,opacity:.9,depthWrite:!1}),a=new n.LineSegments2(e,t);return a.frustumCulled=!1,a.renderOrder=2,{geo:e,material:t,object:a,state:Array.from({length:1100},()=>({x:0,y:0,age:4*Math.random(),life:2+3*Math.random()}))}},[]);(0,a.useEffect)(()=>()=>{I.geo.dispose(),I.material.dispose()},[I]);let X=(0,h.useFieldTexture)(N?A:null,L),z=(0,a.useMemo)(()=>new i.ShaderMaterial({uniforms:{uScale:{value:$},uTop:{value:0},uTime:{value:0},uMaxSpeed:{value:20},uOpacity:{value:Number(s.default.get("windOpacity"))||.7},uLength:{value:600},uFlow:{value:25},uMap:{value:null},uField:{value:null},uFieldHalf:{value:c.HALF_EXTENT_M},uFieldRange:{value:40}},vertexShader:M,fragmentShader:w,transparent:!0,depthWrite:!1}),[$]),K=(0,a.useMemo)(()=>"windy"===E?(()=>{let e=new Uint8Array(1024);for(let t=0;t<256;t++){let[a,r,i]=(0,c.windColor)(t/255*20);e.set([Math.round(a),Math.round(r),Math.round(i),255],4*t)}let t=new i.DataTexture(e,256,1,i.RGBAFormat);return t.magFilter=i.LinearFilter,t.colorSpace=i.SRGBColorSpace,t.needsUpdate=!0,t})():(0,m.colorMapTexture)(E),[E]);(0,a.useEffect)(()=>{z.uniforms.uMap.value=K,z.uniforms.uField.value=X},[z,K,X]),(0,a.useEffect)(()=>()=>{z.dispose(),K.dispose()},[z,K]),(0,a.useEffect)(()=>{I.geo.instanceCount=7*T},[I,T]);let[Y,q]=(0,a.useState)([]),V=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!A||!Number.isFinite(R))return;let e=b(A.origin,{latitude:R,longitude:U}),t=Array.from({length:A.hours},(t,a)=>{let r=(0,c.sampleWind)(A,e.east,e.north,a);return Math.hypot(r.u,r.v)});return(0,p.setSeries)("wind",{start:A.start,values:t,top:Math.max(...t)}),()=>(0,p.setSeries)("wind",null)},[A,Math.round(100*R),Math.round(100*U)]);let J=(0,a.useRef)({east:0,north:0});(0,a.useEffect)(()=>{A&&Number.isFinite(R)&&(J.current=b(A.origin,{latitude:R,longitude:U}))},[A,R,U]);let Q=(0,a.useRef)();if((0,r.useFrame)(({camera:t,size:a,clock:r,gl:n},o)=>{if(!A)return;if(N&&(z.uniforms.uTime.value=r.elapsedTime,z.uniforms.uTop.value=e+150*$),Q.current){let e=t.position.length()/$;Q.current&&(Q.current.opacity=i.MathUtils.clamp(.3+(e-300)/3e3*.3,.3,.6))}let l=Math.min(o,.1),s=Math.min(c.HALF_EXTENT_M,Math.max(800,t.position.length()/$*2.5)),u=s/120,d=s/140,{east:m,north:h}=J.current;I.material.resolution.set(a.width,a.height);let p=I.geo.attributes.instanceStart.data.array,f=I.geo.attributes.instanceColorStart.data.array;if(I.state.forEach((e,t)=>{if(t>=T)return;e.age+=l,(e.age>e.life||Math.abs(e.x)>s||Math.abs(e.y)>s)&&(e.x=(2*Math.random()-1)*s,e.y=(2*Math.random()-1)*s,e.age=0,e.life=2+3*Math.random());let a=(0,c.sampleWind)(A,m+e.x,h+e.y,L),r=Math.hypot(a.u,a.v);e.x+=a.u*u*l/10,e.y+=a.v*u*l/10;let i=Math.min(1,e.age/.5,(e.life-e.age)/.7),[n,o,x]=y(E,r),g=e=>G>=0?e/255*(1-G)+G:e/255*(1+G),v=g(n),M=g(o),w=g(x),b=n/255,S=o/255,F=x/255,N=d*Math.min(1.6,.5+r/10),j=e.x,k=e.y;for(let e=0;e<7;e++){let r=0===e?a:(0,c.sampleWind)(A,m+j,h+k,L),n=Math.hypot(r.u,r.v)||1,o=j-r.u/n*N,l=k-r.v/n*N,s=(7*t+e)*6;p[s]=j*$,p[s+1]=k*$,p[s+2]=.2,p[s+3]=o*$,p[s+4]=l*$,p[s+5]=.2;let u=i*(1-e/7)**1.6,d=i*(1-(e+1)/7)**1.6,x=(7*t+e)*6;f[x]=b+(v-b)*u,f[x+1]=S+(M-S)*u,f[x+2]=F+(w-F)*u,f[x+3]=b+(v-b)*d,f[x+4]=S+(M-S)*d,f[x+5]=F+(w-F)*d,j=o,k=l}}),I.geo.attributes.instanceStart.data.needsUpdate=!0,I.geo.attributes.instanceColorStart.data.needsUpdate=!0,V.current+=o,V.current<1)return;V.current=0;let g=P.current;if(!g)return;let v=g.worldToLocal(new i.Vector3().copy(t.position)),M=m+v.x/$,w=h+v.y/$,b=Math.max(5,v.z/$),S=i.MathUtils.clamp(10*Math.round(3*b/10),60,4e3),F=Math.min(.9*s,Math.max(800,60*b)),j=(0,x.markerLattice)({cx:M,cy:w,radius:F,step:S,near:3*S,originE:M,originN:w,max:400}),k=[],C=(0,x.onScreenTest)(g,t,n.domElement);j.forEach(({e,n:t,d:a})=>{if(k.length>=10||20>Math.hypot(e-m,t-h)||!C((e-m)*$,(t-h)*$,4*$))return;let r=(0,c.sampleWind)(A,e,t,L),i=(0,c.sampleWind)(A,e,t,L+1),n=Math.hypot(r.u,r.v),[o,l,s]=y(E,n),u=e=>G>=0?e/255*(1-G)+G:e/255*(1+G);k.push({key:`${e},${t}`,x:(e-m)*$,y:(t-h)*$,z:4*$,u:r.u,v:r.v,speed:n,trend:Math.hypot(i.u,i.v)-n,color:[u(o),u(l),u(s)],len:.14*(.4+.6*Math.min(1,n/15)),d:a})}),k.sort((e,t)=>e.d-t.d).splice(10),q(e=>(0,x.sameMarkers)(e,k)?e:k)}),!A)return null;let{east:Z,north:ee}=J.current,et=2*c.HALF_EXTENT_M*$;return(0,t.jsx)("group",{rotation:[0,C,0],position:[0,e,0],children:(0,t.jsxs)("group",{ref:P,rotation:[-Math.PI/2,0,0],children:[S&&(0,t.jsxs)("mesh",{position:[-Z*$,-ee*$,0],renderOrder:1,children:[(0,t.jsx)("planeGeometry",{args:[et,et]}),N?(0,t.jsx)("primitive",{object:z,attach:"material"}):(0,t.jsx)("meshBasicMaterial",{ref:Q,map:B,transparent:!0,opacity:.6,depthWrite:!1,toneMapped:!1})]}),(0,t.jsx)("primitive",{object:I.object}),(0,t.jsx)(f.default,{items:Y,width:.025,screen:1,format:e=>String(Math.round(e)),slackLabel:"calm",maxLabels:6})]})})}])}]);
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43758,e=>{"use strict";var t=e.i(43476),i=e.i(71645),n=e.i(90072),r=e.i(90874),a=e.i(92923),s=a,o=e.i(30728);class l extends o.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setPositions(i),this}setColors(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setColors(i),this}setFromPoints(e){let t=e.length-1,i=new Float32Array(6*t);for(let n=0;n<t;n++)i[6*n]=e[n].x,i[6*n+1]=e[n].y,i[6*n+2]=e[n].z||0,i[6*n+3]=e[n+1].x,i[6*n+4]=e[n+1].y,i[6*n+5]=e[n+1].z||0;return super.setPositions(i),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}var d=e.i(27530);class u extends s.LineSegments2{constructor(e=new l,t=new d.LineMaterial({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let c=e=>e instanceof n.Vector3||e instanceof n.Vector4?[e.x,e.y,e.z]:e instanceof n.Vector2?[e.x,e.y,0]:Array.isArray(e)?2===e.length?[e[0],e[1],0]:[e[0],e[1],e[2]]:[e,0,0],p=e=>e instanceof n.Color?e.toArray():e,f=(0,i.forwardRef)(function({points:e,color:n=0xffffff,vertexColors:s,linewidth:f,lineWidth:h,segments:m,dashed:g,...v},y){let x=(0,r.useThree)(e=>e.size),b=(0,i.useMemo)(()=>m?new a.LineSegments2:new u,[m]),[S]=(0,i.useState)(()=>new d.LineMaterial),w=s?.[0]?.length===4?4:3,M=e.flatMap(c),_=M.join(","),E=s?s.flatMap(p):null,A=E?E.join(","):"",B=(0,i.useMemo)(()=>{let e=m?new o.LineSegmentsGeometry:new l;return e.setPositions(M),E&&e.setColors(E,w),e},[_,A,m,w]);return(0,i.useLayoutEffect)(()=>{b.computeLineDistances()},[B,b]),(0,i.useLayoutEffect)(()=>{g?S.defines.USE_DASH="":delete S.defines.USE_DASH,S.needsUpdate=!0},[g,S]),(0,i.useEffect)(()=>()=>B.dispose(),[B]),(0,i.useEffect)(()=>()=>S.dispose(),[S]),(0,t.jsxs)("primitive",{object:b,ref:y,...v,children:[(0,t.jsx)("primitive",{object:B,attach:"geometry"}),(0,t.jsx)("primitive",{object:S,attach:"material",color:s?0xffffff:n,vertexColors:!!s,resolution:[x.width,x.height],linewidth:f??h??1,dashed:g,transparent:4===w,...v})]})});e.s(["default",0,f],43758)},78461,e=>{"use strict";var t=e.i(71645),i=e.i(85709),n=e.i(67561);let r=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],a=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,n.useOcearoContext)(),s=(0,i.useSignalKPaths)(r),o=s["navigation.headingTrue"]??s["navigation.headingMagnetic"]??s["navigation.courseOverGroundTrue"]??s["navigation.courseOverGroundMagnetic"],l=Number.isFinite(o),d=s["navigation.position"],u=Number.isFinite(d?.latitude)&&Number.isFinite(d?.longitude);return{heading:l?o:0,offset:(0,t.useMemo)(()=>{if(!u)return{x:0,y:0};let t={lat:d.latitude,lon:d.longitude};return e(t,(a||(a=t),a))},[d,u,e]),hasFix:u,hasHeading:l}},"getSessionOrigin",0,()=>a])},23549,e=>{"use strict";var t=e.i(43476),i=e.i(71645);e.i(85269);var n=e.i(22831),r=e.i(78461),a=e.i(37369),s=e.i(539),o=e.i(76247);let l=180/Math.PI;e.s(["default",0,()=>{let{t:e}=(0,n.useTranslation)(),d=(0,a.useBerth)(),u=(()=>{let{heading:e,offset:t}=(0,r.default)(),n=(0,a.useBerth)();return(0,i.useMemo)(()=>{if(!n.pose)return null;let{x:i,y:r,heading:a}=n.pose,l="stern"===n.type,d=l?1:-1,u={x:i+d*Math.sin(a)*o.BOAT.length*.5,y:r+d*Math.cos(a)*o.BOAT.length*.5},c=u.x-t.x,p=u.y-t.y,f=Math.hypot(c,p),h=(0,s.wrapPi)(Math.atan2(c,p)-e),m=-(c*Math.cos(a)-p*Math.sin(a));return{distance:f,bearing:h,headingError:(0,s.wrapPi)(a-e),lateral:m,astern:l}},[n,e,t])})(),{heading:c,offset:p}=(0,r.default)(),f=e=>`px-3 py-1.5 rounded-full text-caption font-semibold uppercase tracking-wider border transition-colors ${e?"bg-oBlue text-white border-oBlue":"border-hud text-hud-secondary hover:text-hud-main"}`,h=null;if(u){let t=Math.round(u.headingError*l),i=u.lateral,n=t=>e(t>=0?"parking.starboard":"parking.port");h=Math.abs(u.bearing)>.6*Math.PI?e("parking.behind"):Math.abs(i)>.4?e("parking.moveAcross",{metres:Math.abs(i).toFixed(1),side:n(-i)}):Math.abs(t)>4?e("parking.turn",{deg:Math.abs(t),side:n(t)}):e(u.astern?"parking.alignedAstern":"parking.aligned")}return(0,t.jsxs)("div",{className:"hud-halo flex flex-col items-center gap-2 select-none",children:[u&&(0,t.jsxs)("div",{className:"text-center leading-tight",children:[(0,t.jsx)("div",{className:"text-value font-semibold text-hud-main",children:h}),(0,t.jsxs)("div",{className:"text-caption text-hud-secondary",children:[e("parking.entry",{metres:u.distance.toFixed(0)}),u.astern?` \xb7 ${e("parking.astern")}`:"","virtual"===d.source?` \xb7 ${e("parking.virtual")}`:""]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap justify-center gap-2",children:[a.BERTH_TYPES.map(i=>(0,t.jsx)("button",{type:"button",className:f(d.type===i),onClick:()=>"virtual"===d.source?(0,a.placeVirtualBerth)(p,c,i):(0,a.setBerth)({type:i}),children:e(`parking.type_${i}`)},i)),"side"===d.type&&(0,t.jsx)("button",{type:"button",className:f(!1),onClick:()=>(0,a.setBerth)({side:"port"===d.side?"starboard":"port"}),children:e("port"===d.side?"parking.portSide":"parking.starboardSide")}),(0,t.jsx)("button",{type:"button",className:f(!1),onClick:()=>(0,a.placeVirtualBerth)(p,c),children:e("parking.placeAhead")})]})]})}],23549)},36540,function(e){e.n(e.i(23549))},76247,37369,e=>{"use strict";var t=e.i(43476),i=e.i(71645),n=e.i(43758),r=e.i(83646),a=e.i(78461);let s={type:"bow",side:"starboard",pose:null,source:"virtual"},o=new Set,l=()=>s,d=e=>{s={...s,...e},o.forEach(e=>e())},u=e=>(o.add(e),()=>o.delete(e)),c=()=>(0,i.useSyncExternalStore)(u,l,l),p=(e,t,i=s.type,n=22)=>{d({type:i,pose:{x:e.x+Math.sin(t)*n,y:e.y+Math.cos(t)*n,heading:"stern"===i?t+Math.PI:t},source:"virtual"})};e.s(["BERTH_TYPES",0,["bow","stern","side","buoy"],"getBerth",0,l,"placeVirtualBerth",0,p,"setBerth",0,d,"useBerth",0,c],37369);let f={length:10.8,beam:3.9},h=f.length/2,m=f.beam/2,g=({size:e,position:i,color:n,opacity:r=1})=>(0,t.jsxs)("mesh",{position:i,children:[(0,t.jsx)("boxGeometry",{args:e}),(0,t.jsx)("meshLambertMaterial",{color:n,transparent:r<1,opacity:r})]}),v=({position:e,rotation:i=0,color:n,length:r=4})=>(0,t.jsxs)("group",{position:e,rotation:[0,i,0],children:[(0,t.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.07,r/2-.6],children:[(0,t.jsx)("planeGeometry",{args:[.7,r-1.2]}),(0,t.jsx)("meshBasicMaterial",{color:n,transparent:!0,opacity:.85,depthWrite:!1})]}),(0,t.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.07,-.6],children:[(0,t.jsx)("circleGeometry",{args:[1.2,3,Math.PI/2]}),(0,t.jsx)("meshBasicMaterial",{color:n,transparent:!0,opacity:.85,depthWrite:!1})]})]}),y=({type:e,side:r,colors:a})=>{let s,o=(0,i.useMemo)(()=>(()=>{let e=-h+3.5,t=[[-m,h],[m,h],[m,e]];for(let i=1;i<=8;i++){let n=i/8;t.push([m*(1-n)**1.6,e-(e+h)*Math.sin(n*Math.PI/2)])}for(let i=7;i>=0;i--){let n=i/8;t.push([-m*(1-n)**1.6,e-(e+h)*Math.sin(n*Math.PI/2)])}return t.push([-m,h]),t.map(([e,t])=>[e,.06,t])})(),[]),l="port"===r?-1:1;return(0,t.jsxs)("group",{children:[(0,t.jsx)(n.default,{points:o,color:a.target,lineWidth:2.5,dashed:!0,dashSize:.8,gapSize:.5}),(0,t.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.04,.3],children:[(0,t.jsx)("planeGeometry",{args:[.9*f.beam,f.length-1.6]}),(0,t.jsx)("meshBasicMaterial",{color:a.target,transparent:!0,opacity:.12,depthWrite:!1})]}),("bow"===e||"stern"===e)&&(s="bow"===e?-1:1,(0,t.jsxs)("group",{children:[(0,t.jsx)(g,{size:[32,.35,2.2],position:[0,.17,s*(h+.45+1.1)],color:a.pontoon}),(0,t.jsx)(g,{size:[.8,.3,9],position:[m+.45+.4,.15,s*(h-4.5+.45)],color:a.pontoon}),(0,t.jsx)(g,{size:[.95*f.beam,1,.95*f.length],position:[-(f.beam+.9),.5,0],color:a.neighbour,opacity:.45}),(0,t.jsx)(v,{position:[0,0,-s*(h+7)],rotation:"bow"===e?0:Math.PI,color:a.target})]})),"side"===e&&(0,t.jsxs)("group",{children:[(0,t.jsx)(g,{size:[2.4,.35,26],position:[l*(m+.45+1.2),.17,0],color:a.pontoon}),(0,t.jsx)(v,{position:[-(2.5*l),0,h+6],rotation:.25*l,color:a.target})]}),"buoy"===e&&(0,t.jsxs)("group",{children:[(0,t.jsxs)("mesh",{position:[0,.5,-(h+2.5)],children:[(0,t.jsx)("sphereGeometry",{args:[.6,20,14]}),(0,t.jsx)("meshLambertMaterial",{color:a.buoy})]}),(0,t.jsx)(n.default,{points:[[0,.3,-(h+2.5)],[0,.3,-h]],color:a.pontoon,lineWidth:2}),(0,t.jsx)(v,{position:[0,0,h+6],color:a.target})]})]})};e.s(["BOAT",0,f,"default",0,({scale:e=.5})=>{let{scene:n,accent:s}=(0,r.default)(),{heading:o,offset:d,hasFix:u,hasHeading:f}=(0,a.default)(),h=c();(0,i.useEffect)(()=>{u&&f&&!l().pose&&p(d,o)},[d,o,u,f]);let m=(0,i.useMemo)(()=>({target:s,pontoon:n.rigging,neighbour:n.vessel,buoy:n.target}),[n,s]);if(!h.pose)return null;let{x:g,y:v,heading:x}=h.pose;return(0,t.jsx)("group",{rotation:[0,o,0],children:(0,t.jsx)("group",{position:[(g-d.x)*e,0,-(v-d.y)*e],rotation:[0,-x,0],scale:[e,e,e],children:(0,t.jsx)(y,{type:h.type,side:h.side,colors:m})})})}],76247)},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},92923,30728,27530,e=>{"use strict";let t,i;var n=e.i(90072),r=n;let a=new r.Box3,s=new r.Vector3;class o extends r.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new r.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),a.setFromBufferAttribute(t),this.boundingBox.union(a))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,a=e.count;r<a;r++)s.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(s)),s.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(s));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}e.s(["LineSegmentsGeometry",0,o],30728);var l=e.i(8560),d=n;l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new d.Vector2},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:d.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
2
|
+
#include <common>
|
|
3
|
+
#include <color_pars_vertex>
|
|
4
|
+
#include <fog_pars_vertex>
|
|
5
|
+
#include <logdepthbuf_pars_vertex>
|
|
6
|
+
#include <clipping_planes_pars_vertex>
|
|
7
|
+
|
|
8
|
+
uniform float linewidth;
|
|
9
|
+
uniform vec2 resolution;
|
|
10
|
+
|
|
11
|
+
attribute vec3 instanceStart;
|
|
12
|
+
attribute vec3 instanceEnd;
|
|
13
|
+
|
|
14
|
+
attribute vec3 instanceColorStart;
|
|
15
|
+
attribute vec3 instanceColorEnd;
|
|
16
|
+
|
|
17
|
+
#ifdef WORLD_UNITS
|
|
18
|
+
|
|
19
|
+
varying vec4 worldPos;
|
|
20
|
+
varying vec3 worldStart;
|
|
21
|
+
varying vec3 worldEnd;
|
|
22
|
+
|
|
23
|
+
#ifdef USE_DASH
|
|
24
|
+
|
|
25
|
+
varying vec2 vUv;
|
|
26
|
+
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#else
|
|
30
|
+
|
|
31
|
+
varying vec2 vUv;
|
|
32
|
+
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#ifdef USE_DASH
|
|
36
|
+
|
|
37
|
+
uniform float dashScale;
|
|
38
|
+
attribute float instanceDistanceStart;
|
|
39
|
+
attribute float instanceDistanceEnd;
|
|
40
|
+
varying float vLineDistance;
|
|
41
|
+
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {
|
|
45
|
+
|
|
46
|
+
// compute the interpolation factor needed to trim the segment so it terminates
|
|
47
|
+
// between the camera plane and the near plane
|
|
48
|
+
|
|
49
|
+
// conservative estimate of the near plane
|
|
50
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
51
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
52
|
+
|
|
53
|
+
// we need different nearEstimate formula for reversed and default depth buffer
|
|
54
|
+
// a is positive with a reversed depth buffer so it can be used for controlling the code flow
|
|
55
|
+
float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );
|
|
56
|
+
|
|
57
|
+
return ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void main() {
|
|
62
|
+
|
|
63
|
+
#ifdef USE_COLOR
|
|
64
|
+
|
|
65
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
66
|
+
|
|
67
|
+
#endif
|
|
68
|
+
|
|
69
|
+
float aspect = resolution.x / resolution.y;
|
|
70
|
+
|
|
71
|
+
// camera space
|
|
72
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
73
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
74
|
+
|
|
75
|
+
#ifdef USE_DASH
|
|
76
|
+
|
|
77
|
+
float lineDistanceStart = dashScale * instanceDistanceStart;
|
|
78
|
+
float lineDistanceEnd = dashScale * instanceDistanceEnd;
|
|
79
|
+
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
#ifdef WORLD_UNITS
|
|
83
|
+
|
|
84
|
+
worldStart = start.xyz;
|
|
85
|
+
worldEnd = end.xyz;
|
|
86
|
+
|
|
87
|
+
#else
|
|
88
|
+
|
|
89
|
+
vUv = uv;
|
|
90
|
+
|
|
91
|
+
#endif
|
|
92
|
+
|
|
93
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
94
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
95
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
96
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
97
|
+
|
|
98
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
99
|
+
|
|
100
|
+
if ( perspective ) {
|
|
101
|
+
|
|
102
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
103
|
+
|
|
104
|
+
float alpha = trimSegmentAlpha( start, end );
|
|
105
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
106
|
+
|
|
107
|
+
#ifdef USE_DASH
|
|
108
|
+
|
|
109
|
+
lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );
|
|
110
|
+
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
114
|
+
|
|
115
|
+
float alpha = trimSegmentAlpha( end, start );
|
|
116
|
+
start.xyz = mix( end.xyz, start.xyz, alpha );
|
|
117
|
+
|
|
118
|
+
#ifdef USE_DASH
|
|
119
|
+
|
|
120
|
+
lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );
|
|
121
|
+
|
|
122
|
+
#endif
|
|
123
|
+
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#ifdef USE_DASH
|
|
129
|
+
|
|
130
|
+
vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;
|
|
131
|
+
vUv = uv;
|
|
132
|
+
|
|
133
|
+
#endif
|
|
134
|
+
|
|
135
|
+
// clip space
|
|
136
|
+
vec4 clipStart = projectionMatrix * start;
|
|
137
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
138
|
+
|
|
139
|
+
// ndc space
|
|
140
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
141
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
142
|
+
|
|
143
|
+
// direction
|
|
144
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
145
|
+
|
|
146
|
+
// account for clip-space aspect ratio
|
|
147
|
+
dir.x *= aspect;
|
|
148
|
+
dir = normalize( dir );
|
|
149
|
+
|
|
150
|
+
#ifdef WORLD_UNITS
|
|
151
|
+
|
|
152
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
153
|
+
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
154
|
+
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
155
|
+
vec3 worldFwd = cross( worldDir, worldUp );
|
|
156
|
+
worldPos = position.y < 0.5 ? start: end;
|
|
157
|
+
|
|
158
|
+
// height offset
|
|
159
|
+
float hw = linewidth * 0.5;
|
|
160
|
+
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
161
|
+
|
|
162
|
+
// don't extend the line if we're rendering dashes because we
|
|
163
|
+
// won't be rendering the endcaps
|
|
164
|
+
#ifndef USE_DASH
|
|
165
|
+
|
|
166
|
+
// cap extension
|
|
167
|
+
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
168
|
+
|
|
169
|
+
// add width to the box
|
|
170
|
+
worldPos.xyz += worldFwd * hw;
|
|
171
|
+
|
|
172
|
+
// endcaps
|
|
173
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
174
|
+
|
|
175
|
+
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#endif
|
|
180
|
+
|
|
181
|
+
// project the worldpos
|
|
182
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
183
|
+
|
|
184
|
+
// shift the depth of the projected points so the line
|
|
185
|
+
// segments overlap neatly
|
|
186
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
187
|
+
clip.z = clipPose.z * clip.w;
|
|
188
|
+
|
|
189
|
+
#else
|
|
190
|
+
|
|
191
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
192
|
+
// undo aspect ratio adjustment
|
|
193
|
+
dir.x /= aspect;
|
|
194
|
+
offset.x /= aspect;
|
|
195
|
+
|
|
196
|
+
// sign flip
|
|
197
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
198
|
+
|
|
199
|
+
// endcaps
|
|
200
|
+
if ( position.y < 0.0 ) {
|
|
201
|
+
|
|
202
|
+
offset += - dir;
|
|
203
|
+
|
|
204
|
+
} else if ( position.y > 1.0 ) {
|
|
205
|
+
|
|
206
|
+
offset += dir;
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// adjust for linewidth
|
|
211
|
+
offset *= linewidth;
|
|
212
|
+
|
|
213
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
214
|
+
offset /= resolution.y;
|
|
215
|
+
|
|
216
|
+
// select end
|
|
217
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
218
|
+
|
|
219
|
+
// back to clip space
|
|
220
|
+
offset *= clip.w;
|
|
221
|
+
|
|
222
|
+
clip.xy += offset;
|
|
223
|
+
|
|
224
|
+
#endif
|
|
225
|
+
|
|
226
|
+
gl_Position = clip;
|
|
227
|
+
|
|
228
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
229
|
+
|
|
230
|
+
#include <logdepthbuf_vertex>
|
|
231
|
+
#include <clipping_planes_vertex>
|
|
232
|
+
#include <fog_vertex>
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
`,fragmentShader:`
|
|
236
|
+
uniform vec3 diffuse;
|
|
237
|
+
uniform float opacity;
|
|
238
|
+
uniform float linewidth;
|
|
239
|
+
|
|
240
|
+
#ifdef USE_DASH
|
|
241
|
+
|
|
242
|
+
uniform float dashOffset;
|
|
243
|
+
uniform float dashSize;
|
|
244
|
+
uniform float gapSize;
|
|
245
|
+
|
|
246
|
+
#endif
|
|
247
|
+
|
|
248
|
+
varying float vLineDistance;
|
|
249
|
+
|
|
250
|
+
#ifdef WORLD_UNITS
|
|
251
|
+
|
|
252
|
+
varying vec4 worldPos;
|
|
253
|
+
varying vec3 worldStart;
|
|
254
|
+
varying vec3 worldEnd;
|
|
255
|
+
|
|
256
|
+
#ifdef USE_DASH
|
|
257
|
+
|
|
258
|
+
varying vec2 vUv;
|
|
259
|
+
|
|
260
|
+
#endif
|
|
261
|
+
|
|
262
|
+
#else
|
|
263
|
+
|
|
264
|
+
varying vec2 vUv;
|
|
265
|
+
|
|
266
|
+
#endif
|
|
267
|
+
|
|
268
|
+
#include <common>
|
|
269
|
+
#include <color_pars_fragment>
|
|
270
|
+
#include <fog_pars_fragment>
|
|
271
|
+
#include <logdepthbuf_pars_fragment>
|
|
272
|
+
#include <clipping_planes_pars_fragment>
|
|
273
|
+
|
|
274
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
275
|
+
|
|
276
|
+
float mua;
|
|
277
|
+
float mub;
|
|
278
|
+
|
|
279
|
+
vec3 p13 = p1 - p3;
|
|
280
|
+
vec3 p43 = p4 - p3;
|
|
281
|
+
|
|
282
|
+
vec3 p21 = p2 - p1;
|
|
283
|
+
|
|
284
|
+
float d1343 = dot( p13, p43 );
|
|
285
|
+
float d4321 = dot( p43, p21 );
|
|
286
|
+
float d1321 = dot( p13, p21 );
|
|
287
|
+
float d4343 = dot( p43, p43 );
|
|
288
|
+
float d2121 = dot( p21, p21 );
|
|
289
|
+
|
|
290
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
291
|
+
|
|
292
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
293
|
+
|
|
294
|
+
mua = numer / denom;
|
|
295
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
296
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
297
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
298
|
+
|
|
299
|
+
return vec2( mua, mub );
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
void main() {
|
|
304
|
+
|
|
305
|
+
float alpha = opacity;
|
|
306
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
307
|
+
|
|
308
|
+
#include <clipping_planes_fragment>
|
|
309
|
+
|
|
310
|
+
#ifdef USE_DASH
|
|
311
|
+
|
|
312
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
313
|
+
|
|
314
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
315
|
+
|
|
316
|
+
#endif
|
|
317
|
+
|
|
318
|
+
#ifdef WORLD_UNITS
|
|
319
|
+
|
|
320
|
+
// Find the closest points on the view ray and the line segment
|
|
321
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
322
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
323
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
324
|
+
|
|
325
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
326
|
+
vec3 p2 = rayEnd * params.y;
|
|
327
|
+
vec3 delta = p1 - p2;
|
|
328
|
+
float len = length( delta );
|
|
329
|
+
float norm = len / linewidth;
|
|
330
|
+
|
|
331
|
+
#ifndef USE_DASH
|
|
332
|
+
|
|
333
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
334
|
+
|
|
335
|
+
float dnorm = fwidth( norm );
|
|
336
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
337
|
+
|
|
338
|
+
#else
|
|
339
|
+
|
|
340
|
+
if ( norm > 0.5 ) {
|
|
341
|
+
|
|
342
|
+
discard;
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
#endif
|
|
347
|
+
|
|
348
|
+
#endif
|
|
349
|
+
|
|
350
|
+
#else
|
|
351
|
+
|
|
352
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
353
|
+
|
|
354
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
355
|
+
float a = vUv.x;
|
|
356
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
357
|
+
float len2 = a * a + b * b;
|
|
358
|
+
float dlen = fwidth( len2 );
|
|
359
|
+
|
|
360
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
361
|
+
|
|
362
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
363
|
+
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
#else
|
|
367
|
+
|
|
368
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
369
|
+
|
|
370
|
+
float a = vUv.x;
|
|
371
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
372
|
+
float len2 = a * a + b * b;
|
|
373
|
+
|
|
374
|
+
if ( len2 > 1.0 ) discard;
|
|
375
|
+
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
#endif
|
|
379
|
+
|
|
380
|
+
#endif
|
|
381
|
+
|
|
382
|
+
#include <logdepthbuf_fragment>
|
|
383
|
+
#include <color_fragment>
|
|
384
|
+
|
|
385
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
386
|
+
|
|
387
|
+
#include <tonemapping_fragment>
|
|
388
|
+
#include <colorspace_fragment>
|
|
389
|
+
#include <fog_fragment>
|
|
390
|
+
#include <premultiplied_alpha_fragment>
|
|
391
|
+
|
|
392
|
+
}
|
|
393
|
+
`};class u extends d.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:d.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e!==this.worldUnits&&(this.needsUpdate=!0),!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}e.s(["LineMaterial",0,u],27530);let c=new n.Vector4,p=new n.Vector3,f=new n.Vector3,h=new n.Vector4,m=new n.Vector4,g=new n.Vector4,v=new n.Vector3,y=new n.Matrix4,x=new n.Line3,b=new n.Vector3,S=new n.Box3,w=new n.Sphere,M=new n.Vector4;function _(e,t,n){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=i/n.width,M.y=i/n.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class E extends n.Mesh{constructor(e=new o,t=new u({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,n=0,a=t.count;e<a;e++,n+=2)p.fromBufferAttribute(t,e),f.fromBufferAttribute(i,e),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+p.distanceTo(f);let a=new n.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(a,1,1)),this}raycast(e,r){let a,s,o=this.material.worldUnits,l=e.camera;if(null!==l||o||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===o&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let d=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let u=this.matrixWorld,c=this.geometry,p=this.material;if(i=p.linewidth+d,null===c.boundingSphere&&c.computeBoundingSphere(),w.copy(c.boundingSphere).applyMatrix4(u),o)a=.5*i;else{let e=Math.max(l.near,w.distanceToPoint(t.origin));a=_(l,e,p.resolution)}if(w.radius+=a,!1!==t.intersectsSphere(w)){if(null===c.boundingBox&&c.computeBoundingBox(),S.copy(c.boundingBox).applyMatrix4(u),o)s=.5*i;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));s=_(l,e,p.resolution)}S.expandByScalar(s),!1!==t.intersectsBox(S)&&(o?function(e,r){let a=e.matrixWorld,s=e.geometry,o=s.attributes.instanceStart,l=s.attributes.instanceEnd,d=Math.min(s.instanceCount,o.count);for(let s=0;s<d;s++){x.start.fromBufferAttribute(o,s),x.end.fromBufferAttribute(l,s),x.applyMatrix4(a);let d=new n.Vector3,u=new n.Vector3;t.distanceSqToSegment(x.start,x.end,u,d),u.distanceTo(d)<.5*i&&r.push({point:u,pointOnLine:d,distance:t.origin.distanceTo(u),object:e,face:null,faceIndex:s,uv:null,uv1:null})}}(this,r):function(e,r,a){let s=r.projectionMatrix,o=e.material.resolution,l=e.matrixWorld,d=e.geometry,u=d.attributes.instanceStart,c=d.attributes.instanceEnd,p=Math.min(d.instanceCount,u.count),f=-r.near;t.at(1,g),g.w=1,g.applyMatrix4(r.matrixWorldInverse),g.applyMatrix4(s),g.multiplyScalar(1/g.w),g.x*=o.x/2,g.y*=o.y/2,g.z=0,v.copy(g),y.multiplyMatrices(r.matrixWorldInverse,l);for(let r=0;r<p;r++){if(h.fromBufferAttribute(u,r),m.fromBufferAttribute(c,r),h.w=1,m.w=1,h.applyMatrix4(y),m.applyMatrix4(y),h.z>f&&m.z>f)continue;if(h.z>f){let e=h.z-m.z,t=(h.z-f)/e;h.lerp(m,t)}else if(m.z>f){let e=m.z-h.z,t=(m.z-f)/e;m.lerp(h,t)}h.applyMatrix4(s),m.applyMatrix4(s),h.multiplyScalar(1/h.w),m.multiplyScalar(1/m.w),h.x*=o.x/2,h.y*=o.y/2,m.x*=o.x/2,m.y*=o.y/2,x.start.copy(h),x.start.z=0,x.end.copy(m),x.end.z=0;let d=x.closestPointToPointParameter(v,!0);x.at(d,b);let p=n.MathUtils.lerp(h.z,m.z,d),g=p>=-1&&p<=1,S=v.distanceTo(b)<.5*i;if(g&&S){x.start.fromBufferAttribute(u,r),x.end.fromBufferAttribute(c,r),x.start.applyMatrix4(l),x.end.applyMatrix4(l);let i=new n.Vector3,s=new n.Vector3;t.distanceSqToSegment(x.start,x.end,s,i),a.push({point:s,pointOnLine:i,distance:t.origin.distanceTo(s),object:e,face:null,faceIndex:r,uv:null,uv1:null})}}}(this,l,r))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(c),this.material.uniforms.resolution.value.set(c.z,c.w))}}e.s(["LineSegments2",0,E],92923)},74452,(e,t,i)=>{t.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var t=e.i(74452);let i=180/Math.PI,n=t.default.vpp,r=(e,t,i)=>e+(t-e)*i,a=(e,t)=>{if(t<=e[0])return[0,0];let i=e.length-1;if(t>=e[i])return[i-1,1];let n=0;for(;t>e[n+1];)n++;return[n,(t-e[n])/(e[n+1]-e[n])]},s=n.speeds.map((e,t)=>(e=>{let t=n.beat_angle[e],r=n.run_angle[e],a=n.beat_vmg[e]/Math.cos(t/i),s=n.run_vmg[e]/Math.abs(Math.cos(r/i)),o=[[0,0],[.7*t,.55*a],[t,a]];for(let i of n.angles)i>t&&i<r&&o.push([i,n[String(i)][e]]);return o.push([r,s]),r<180&&o.push([180,n.run_vmg[e]]),o})(t)),o=(e,t)=>{let[i,n]=a(e.map(e=>e[0]),t);return r(e[i][1],e[i+1][1],n)},l=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let i=Math.min(180,Math.abs((t+540)%360-180)),l=n.speeds;if(e<l[0])return o(s[0],i)*(e/l[0]);let[d,u]=a(l,e);return r(o(s[d],i),o(s[d+1],i),u)},d=(e,t)=>{let[i,s]=a(n.speeds,t);return r(e[i],e[i+1],s)},u=(e,t)=>{let n=l(1.943844*e,t*i);return null===n?null:n/1.943844},c=e=>{let t=(e+Math.PI)%(2*Math.PI);return t<0&&(t+=2*Math.PI),t-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:t,bearing:n})=>{if(![e,t,n].every(Number.isFinite)||t<=0)return null;let r=null;for(let a=-100;a<=100;a++){let s=n+a/i,o=u(t,c(e-s));if(null===o)continue;let l=o*Math.cos(s-n);(!r||l>r.vmc)&&(r={heading:c(s),speed:o,vmc:l})}return r},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=d(n.run_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:-r*Math.cos(t/i)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=d(n.beat_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:r*Math.cos(t/i)}},"polarSpeed",0,l,"polarSpeedSi",0,u,"vmcForHeading",0,({twd:e,tws:t,bearing:i,heading:n})=>{if(![e,t,i,n].every(Number.isFinite))return null;let r=u(t,c(e-n));return null===r?null:r*Math.cos(n-i)},"wrapPi",0,c])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71311,e=>{"use strict";var n=e.i(43476),t=e.i(71645);e.i(85269);var i=e.i(22831),r=e.i(67561),a=e.i(85709),u=e.i(61969),l=e.i(37256),o=e.i(46991);let s=["navigation.headingTrue","navigation.courseOverGroundTrue","navigation.speedThroughWater","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.speedApparent","environment.wind.angleApparent","environment.depth.belowKeel","environment.depth.belowTransducer","environment.depth.belowSurface",...(0,l.coursePaths)("distance","timeToGo"),"performance.velocityMadeGood","performance.polarSpeedRatio","environment.current","navigation.anchor.currentRadius","navigation.anchor.maxRadius"],d=(e,n=1)=>Number.isFinite(e)?e.toFixed(n):"--",m=e=>Number.isFinite(e)?`${String((0,o.toDegrees)(e)).padStart(3,"0")}\xb0`:"--",p=(e,n)=>{if(!Number.isFinite(e))return"--";let t=Math.round(Math.abs((0,o.radToDeg)(e)));return`${t}\xb0${n(e>=0?"hud.starboardShort":"hud.portShort")}`},h=e=>e.anchorWatch?"anchor":e.parkingMode?"harbour":e.racing?"racing":"route";e.s(["default",0,({omitDepth:e=!1,maxItems:c=4})=>{let{t:v}=(0,i.useTranslation)(),{states:b}=(0,r.useOcearoContext)(),g=(0,a.useSignalKPaths)(s),w=(0,u.default)(),f=h(b),N=(0,t.useMemo)(()=>{let e=g["environment.depth.belowKeel"]??g["environment.depth.belowTransducer"]??g["environment.depth.belowSurface"],n={id:"depth",label:v("hud.depth"),value:d((0,o.convertDepthUnit)(e)),unit:(0,o.getDepthUnitLabel)(),warn:Number.isFinite(e)&&e<3},t={label:v("hud.tws"),value:d((0,o.convertSpeedUnit)(g["environment.wind.speedTrue"])),unit:(0,o.getSpeedUnitLabel)()},i=g["navigation.headingTrue"]??g["navigation.courseOverGroundTrue"];switch(f){case"racing":return[{label:v("hud.polar"),value:Number.isFinite(w.ratio)?Math.round(100*w.ratio):"--",unit:"%",sub:Number.isFinite(w.deltaKn)?`${w.deltaKn>=0?"+":"−"}${Math.abs(w.deltaKn).toFixed(1)} kn`:null,warn:Number.isFinite(w.ratio)&&w.ratio<.8},{label:v("hud.vmg"),value:d((0,o.convertSpeedUnit)(g["performance.velocityMadeGood"])),unit:(0,o.getSpeedUnitLabel)()},{label:v("hud.twa"),value:p(g["environment.wind.angleTrueWater"],v)},t];case"harbour":return[n,{label:v("hud.heading"),value:m(i)},{label:v("hud.stw"),value:d((0,o.convertSpeedUnit)(g["navigation.speedThroughWater"])),unit:(0,o.getSpeedUnitLabel)()},{label:v("hud.aws"),value:d((0,o.convertSpeedUnit)(g["environment.wind.speedApparent"])),unit:(0,o.getSpeedUnitLabel)()},{label:v("hud.awa"),value:p(g["environment.wind.angleApparent"],v)}];case"anchor":return[n,t,{label:v("hud.swing"),value:d(g["navigation.anchor.currentRadius"],0),unit:"m"},{label:v("hud.alarmRadius"),value:d(g["navigation.anchor.maxRadius"],0),unit:"m"}];default:{let e=(0,l.courseValue)(g,"distance");return[{label:v("hud.heading"),value:m(i)},t,{label:v("hud.awa"),value:p(g["environment.wind.angleApparent"],v)},n,Number.isFinite(e)&&{label:v("hud.waypoint"),value:d((0,o.convertDistanceUnit)(e)),unit:(0,o.getDistanceUnitLabel)(),sub:(e=>{if(!Number.isFinite(e)||e<0)return"--";let n=Math.floor(e/3600),t=Math.round(e%3600/60);return n>0?`${n}h${String(t).padStart(2,"0")}`:`${t} min`})((0,l.courseValue)(g,"timeToGo"))}].filter(Boolean)}}},[g,w,f,v]),F=(e?N.filter(e=>"depth"!==e.id):N).slice(0,c);return(0,n.jsx)("div",{className:"ml-3 mt-4 flex flex-col gap-3 select-none [@media(max-height:500px)]:mt-2 [@media(max-height:500px)]:gap-1.5",children:F.map(e=>(0,n.jsxs)("div",{className:"leading-none",children:[(0,n.jsx)("div",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted",children:e.label}),(0,n.jsxs)("div",{className:"flex items-baseline gap-1 mt-1",children:[(0,n.jsx)("span",{className:`text-value font-semibold ${e.warn?"text-oRed":"text-hud-main"}`,children:e.value}),e.unit&&(0,n.jsx)("span",{className:"text-caption font-semibold text-hud-secondary",children:e.unit}),e.sub&&"--"!==e.sub&&(0,n.jsx)("span",{className:"text-caption text-hud-muted ml-1",children:e.sub})]})]},e.label))})},"hudMode",0,h])},85003,function(e){e.n(e.i(71311))},61969,e=>{"use strict";var n=e.i(71645),t=e.i(85709),i=e.i(539),r=e.i(37256);let a=180/Math.PI,u=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio",...(0,r.coursePaths)("bearingTrue")];e.s(["default",0,()=>{let e=(0,t.useSignalKPaths)(u);return(0,n.useMemo)(()=>{let n=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,t=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,u=e["environment.wind.speedTrue"]??null,l=e["environment.wind.angleTrueWater"]??null,o=e["environment.wind.directionTrue"]??null;null===o&&Number.isFinite(l)&&Number.isFinite(t)&&(o=(0,i.wrapPi)(t+l));let s=e["performance.polarSpeed"]??(Number.isFinite(u)&&Number.isFinite(l)?(0,i.polarSpeedSi)(u,l):null),d=e["performance.polarSpeedRatio"]??null;null===d&&Number.isFinite(n)&&Number.isFinite(s)&&s>.2&&(d=n/s);let m=Number.isFinite(n)&&Number.isFinite(s)?(n-s)*1.943844:null,p=null,h=null,c=!Number.isFinite(l)||Math.abs(l)<Math.PI/2;if(Number.isFinite(u)){let e=c?(0,i.optimalUpwind)(1.943844*u):(0,i.optimalDownwind)(1.943844*u);e&&(p=e.twa/a,Number.isFinite(o)&&Number.isFinite(l)&&(h=(0,i.wrapPi)(o-Math.sign(l||1)*p)))}let v=(0,r.courseValue)(e,"bearingTrue"),b=null;if(Number.isFinite(v)&&Number.isFinite(o)&&Number.isFinite(u)){let e=(0,i.bestVmcHeading)({twd:o,tws:u,bearing:v}),n=Number.isFinite(t)?(0,i.vmcForHeading)({twd:o,tws:u,bearing:v,heading:t}):null;b=e?{bearing:v,best:e,current:n}:null}return{ratio:d,polarSpeed:s,boatSpeed:n,deltaKn:m,heading:t,twd:o,tws:u,twa:l,targetTwa:p,targetHeading:h,upwind:c,vmc:b}},[e])}])},74452,(e,n,t)=>{n.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var n=e.i(74452);let t=180/Math.PI,i=n.default.vpp,r=(e,n,t)=>e+(n-e)*t,a=(e,n)=>{if(n<=e[0])return[0,0];let t=e.length-1;if(n>=e[t])return[t-1,1];let i=0;for(;n>e[i+1];)i++;return[i,(n-e[i])/(e[i+1]-e[i])]},u=i.speeds.map((e,n)=>(e=>{let n=i.beat_angle[e],r=i.run_angle[e],a=i.beat_vmg[e]/Math.cos(n/t),u=i.run_vmg[e]/Math.abs(Math.cos(r/t)),l=[[0,0],[.7*n,.55*a],[n,a]];for(let t of i.angles)t>n&&t<r&&l.push([t,i[String(t)][e]]);return l.push([r,u]),r<180&&l.push([180,i.run_vmg[e]]),l})(n)),l=(e,n)=>{let[t,i]=a(e.map(e=>e[0]),n);return r(e[t][1],e[t+1][1],i)},o=(e,n)=>{if(!Number.isFinite(e)||!Number.isFinite(n)||e<=0)return null;let t=Math.min(180,Math.abs((n+540)%360-180)),o=i.speeds;if(e<o[0])return l(u[0],t)*(e/o[0]);let[s,d]=a(o,e);return r(l(u[s],t),l(u[s+1],t),d)},s=(e,n)=>{let[t,u]=a(i.speeds,n);return r(e[t],e[t+1],u)},d=(e,n)=>{let i=o(1.943844*e,n*t);return null===i?null:i/1.943844},m=e=>{let n=(e+Math.PI)%(2*Math.PI);return n<0&&(n+=2*Math.PI),n-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:n,bearing:i})=>{if(![e,n,i].every(Number.isFinite)||n<=0)return null;let r=null;for(let a=-100;a<=100;a++){let u=i+a/t,l=d(n,m(e-u));if(null===l)continue;let o=l*Math.cos(u-i);(!r||o>r.vmc)&&(r={heading:m(u),speed:l,vmc:o})}return r},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let n=s(i.run_angle,e),r=o(e,n);return{twa:n,speed:r,vmg:-r*Math.cos(n/t)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let n=s(i.beat_angle,e),r=o(e,n);return{twa:n,speed:r,vmg:r*Math.cos(n/t)}},"polarSpeed",0,o,"polarSpeedSi",0,d,"vmcForHeading",0,({twd:e,tws:n,bearing:t,heading:i})=>{if(![e,n,t,i].every(Number.isFinite))return null;let r=d(n,m(e-i));return null===r?null:r*Math.cos(i-t)},"wrapPi",0,m])}]);
|