ocearo-ui 2.1.3 → 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 +22 -27
- package/README.md +22 -27
- package/__next.__PAGE__.txt +2 -2
- package/__next._full.txt +2 -2
- package/__next._tree.txt +1 -1
- package/_next/static/chunks/{21408p9d6c0sg.js → 01ij-cuy61l35.js} +1 -1
- package/_next/static/chunks/{0vhk5q54me91_.js → 047e3x_ahxnrl.js} +1 -1
- package/_next/static/chunks/{1quvj-861o57h.js → 0kdc_niwgmx_8.js} +1 -1
- package/_next/static/chunks/{3nv6p6vvu2zlg.js → 0ucob1nu_x8bl.js} +1 -1
- package/_next/static/chunks/{40b8ooaw6x7my.js → 18e6nw0w7akkb.js} +4 -4
- package/_next/static/chunks/{0glm63vhzbxk5.js → 20p1hr--2grl8.js} +2 -2
- package/_next/static/chunks/{0n5v9mjln3x9c.js → 290k3k__vbum2.js} +2 -2
- package/_next/static/chunks/{1442uc2w4y1ve.js → 2hm43avzk8_jb.js} +5 -5
- package/_next/static/chunks/{2qylgmdj-32um.js → 2q_bl16zedyyo.js} +4 -4
- package/_next/static/chunks/{3z29h80ysf4f1.js → 37g-wmrgbgd6h.js} +1 -1
- package/_next/static/chunks/{2gsiwp60towtx.js → 395ffa6t18601.js} +1 -1
- package/_next/static/chunks/3bai186_bv3i_.js +1 -0
- package/_not-found/__next._full.txt +1 -1
- package/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/_not-found/__next._tree.txt +1 -1
- package/_not-found.html +1 -1
- package/_not-found.txt +1 -1
- package/index.html +1 -1
- package/index.txt +2 -2
- package/package.json +26 -4
- package/settings/__next._full.txt +1 -1
- package/settings/__next._tree.txt +1 -1
- package/settings/__next.settings.__PAGE__.txt +1 -1
- package/settings.html +1 -1
- package/settings.txt +1 -1
- package/_next/static/chunks/2qch0at4eelx8.js +0 -1
- /package/_next/static/{RbyYYNpJGkiHnU7YTHoaU → 0nycI4RUzRHiehQwdbDCp}/_buildManifest.js +0 -0
- /package/_next/static/{RbyYYNpJGkiHnU7YTHoaU → 0nycI4RUzRHiehQwdbDCp}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{RbyYYNpJGkiHnU7YTHoaU → 0nycI4RUzRHiehQwdbDCp}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,30997,e=>{"use strict";var t=e.i(71645);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,30997,e=>{"use strict";var t=e.i(71645);let a=new Set,r=null,i=()=>{let e=[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()),t=[];a.forEach(a=>{let r=a.current;if(!r)return;let i=r.getBoundingClientRect(),o=e.some(e=>i.left<e.right&&i.right>e.left&&i.top<e.bottom&&i.bottom>e.top)?"hidden":"visible";r.style.visibility!==o&&t.push([r,o])}),t.forEach(([e,t])=>{e.style.visibility=t})};e.s(["default",0,e=>{(0,t.useEffect)(()=>(a.add(e),r||(r=setInterval(i,250)),i(),()=>{a.delete(e),a.size||(clearInterval(r),r=null)}),[e])}])},93116,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(95393),i=e.i(90072);let o=`
|
|
2
2
|
attribute vec3 aBase;
|
|
3
3
|
attribute vec2 aDir;
|
|
4
4
|
attribute vec3 aColor;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
gl_FragColor = vec4(col, clamp(alpha, 0.0, 1.0));
|
|
88
88
|
#include <colorspace_fragment>
|
|
89
89
|
}
|
|
90
|
-
`,x=(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:F=!0})=>{let S=u.default.get("windStyle")||"volume",T=F&&"volume"===S,A="volume"===S?150:1100,C=u.default.get("windColorMap")||"windy",E=(0,s.useSignalKPaths)(g),_=E["navigation.position"],{heading:L}=(0,c.default)(),P=(0,a.useSyncExternalStore)(m.subscribeForecast,m.getForecastHour,m.getForecastHour),[I,N]=(0,a.useState)(null),{id:j}=(0,M.default)(),W="day"===j?-.6:.45,k=(0,a.useRef)(),R=u.default.get("aisLengthScalingFactor")||.7,$=_?.latitude,B=_?.longitude,D=Number.isFinite($)?`${$.toFixed(1)},${B.toFixed(1)}`:null,G=E["environment.wind.speedTrue"],O=E["environment.wind.directionTrue"];(0,a.useEffect)(()=>{if(!D)return;let e=!1,[t,a]=D.split(",").map(Number);return(0,d.fetchWindField)(t,a).then(t=>{e||N(t)}).catch(()=>{!e&&Number.isFinite(G)&&Number.isFinite(O)&&N((0,d.uniformField)(t,a,G,O))}),()=>{e=!0}},[D]);let U=(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(!I||!F||T)return;let e=U.image.data;for(let t=0;t<128;t++)for(let a=0;a<128;a++){let r=(a/127*2-1)*d.HALF_EXTENT_M,i=(t/127*2-1)*d.HALF_EXTENT_M,o=(0,d.sampleWind)(I,r,i,P),[n,l,u]=y(C,Math.hypot(o.u,o.v)),s=(128*t+a)*4,c=Math.max(Math.abs(a/127*2-1),Math.abs(t/127*2-1));e[s]=n,e[s+1]=l,e[s+2]=u,e[s+3]=Math.round(255*Math.min(1,(1-c)*8))}U.needsUpdate=!0},[U,I,P,F,T,C]),(0,a.useEffect)(()=>()=>U.dispose(),[U]);let z=(0,a.useMemo)(()=>{let e=new n.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 o.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)(()=>()=>{z.geo.dispose(),z.material.dispose()},[z]);let H=(0,h.useFieldTexture)(T?I:null,P),X=(0,a.useMemo)(()=>new i.ShaderMaterial({uniforms:{uScale:{value:R},uTop:{value:0},uTime:{value:0},uMaxSpeed:{value:20},uOpacity:{value:Number(u.default.get("windOpacity"))||.7},uLength:{value:600},uFlow:{value:25},uMap:{value:null},uField:{value:null},uFieldHalf:{value:d.HALF_EXTENT_M},uFieldRange:{value:40}},vertexShader:w,fragmentShader:b,transparent:!0,depthWrite:!1}),[R]),V=(0,a.useMemo)(()=>"windy"===C?(()=>{let e=new Uint8Array(1024);for(let t=0;t<256;t++){let[a,r,i]=(0,d.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,f.colorMapTexture)(C),[C]);(0,a.useEffect)(()=>{X.uniforms.uMap.value=V,X.uniforms.uField.value=H},[X,V,H]),(0,a.useEffect)(()=>()=>{X.dispose(),V.dispose()},[X,V]),(0,a.useEffect)(()=>{z.geo.instanceCount=7*A},[z,A]);let[q,K]=(0,a.useState)([]),Y=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!I||!Number.isFinite($))return;let e=x(I.origin,{latitude:$,longitude:B}),t=Array.from({length:I.hours},(t,a)=>{let r=(0,d.sampleWind)(I,e.east,e.north,a);return Math.hypot(r.u,r.v)});return(0,m.setSeries)("wind",{start:I.start,values:t,top:Math.max(...t)}),()=>(0,m.setSeries)("wind",null)},[I,Math.round(100*$),Math.round(100*B)]);let Z=(0,a.useRef)({east:0,north:0});(0,a.useEffect)(()=>{I&&Number.isFinite($)&&(Z.current=x(I.origin,{latitude:$,longitude:B}))},[I,$,B]);let J=(0,a.useRef)();if((0,r.useFrame)(({camera:t,size:a,clock:r,gl:o},n)=>{if(!I)return;if(T&&(X.uniforms.uTime.value=r.elapsedTime,X.uniforms.uTop.value=e+150*R),J.current){let e=t.position.length()/R;J.current&&(J.current.opacity=i.MathUtils.clamp(.3+(e-300)/3e3*.3,.3,.6))}let l=Math.min(n,.1),u=Math.min(d.HALF_EXTENT_M,Math.max(800,t.position.length()/R*2.5)),s=u/120,c=u/140,{east:f,north:h}=Z.current;z.material.resolution.set(a.width,a.height);let m=z.geo.attributes.instanceStart.data.array,p=z.geo.attributes.instanceColorStart.data.array;if(z.state.forEach((e,t)=>{if(t>=A)return;e.age+=l,(e.age>e.life||Math.abs(e.x)>u||Math.abs(e.y)>u)&&(e.x=(2*Math.random()-1)*u,e.y=(2*Math.random()-1)*u,e.age=0,e.life=2+3*Math.random());let a=(0,d.sampleWind)(I,f+e.x,h+e.y,P),r=Math.hypot(a.u,a.v);e.x+=a.u*s*l/10,e.y+=a.v*s*l/10;let i=Math.min(1,e.age/.5,(e.life-e.age)/.7),[o,n,v]=y(C,r),M=e=>W>=0?e/255*(1-W)+W:e/255*(1+W),g=M(o),w=M(n),b=M(v),x=o/255,F=n/255,S=v/255,T=c*Math.min(1.6,.5+r/10),E=e.x,_=e.y;for(let e=0;e<7;e++){let r=0===e?a:(0,d.sampleWind)(I,f+E,h+_,P),o=Math.hypot(r.u,r.v)||1,n=E-r.u/o*T,l=_-r.v/o*T,u=(7*t+e)*6;m[u]=E*R,m[u+1]=_*R,m[u+2]=.2,m[u+3]=n*R,m[u+4]=l*R,m[u+5]=.2;let s=i*(1-e/7)**1.6,c=i*(1-(e+1)/7)**1.6,v=(7*t+e)*6;p[v]=x+(g-x)*s,p[v+1]=F+(w-F)*s,p[v+2]=S+(b-S)*s,p[v+3]=x+(g-x)*c,p[v+4]=F+(w-F)*c,p[v+5]=S+(b-S)*c,E=n,_=l}}),z.geo.attributes.instanceStart.data.needsUpdate=!0,z.geo.attributes.instanceColorStart.data.needsUpdate=!0,Y.current+=n,Y.current<1)return;Y.current=0;let M=k.current;if(!M)return;let g=M.worldToLocal(new i.Vector3().copy(t.position)),w=f+g.x/R,b=h+g.y/R,x=Math.max(5,g.z/R),F=i.MathUtils.clamp(10*Math.round(3*x/10),60,4e3),S=Math.min(.9*u,Math.max(800,60*x)),E=(0,v.markerLattice)({cx:w,cy:b,radius:S,step:F,near:3*F,originE:w,originN:b,max:400}),_=[],L=(0,v.onScreenTest)(M,t,o.domElement);E.forEach(({e,n:t,d:a})=>{if(_.length>=10||20>Math.hypot(e-f,t-h)||!L((e-f)*R,(t-h)*R,4*R))return;let r=(0,d.sampleWind)(I,e,t,P),i=(0,d.sampleWind)(I,e,t,P+1),o=Math.hypot(r.u,r.v),[n,l,u]=y(C,o),s=e=>W>=0?e/255*(1-W)+W:e/255*(1+W);_.push({key:`${e},${t}`,x:(e-f)*R,y:(t-h)*R,z:4*R,u:r.u,v:r.v,speed:o,trend:Math.hypot(i.u,i.v)-o,color:[s(n),s(l),s(u)],len:.14*(.4+.6*Math.min(1,o/15)),d:a})}),_.sort((e,t)=>e.d-t.d).splice(10),K(e=>(0,v.sameMarkers)(e,_)?e:_)}),!I)return null;let{east:Q,north:ee}=Z.current,et=2*d.HALF_EXTENT_M*R;return(0,t.jsx)("group",{rotation:[0,L,0],position:[0,e,0],children:(0,t.jsxs)("group",{ref:k,rotation:[-Math.PI/2,0,0],children:[F&&(0,t.jsxs)("mesh",{position:[-Q*R,-ee*R,0],renderOrder:1,children:[(0,t.jsx)("planeGeometry",{args:[et,et]}),T?(0,t.jsx)("primitive",{object:X,attach:"material"}):(0,t.jsx)("meshBasicMaterial",{ref:J,map:U,transparent:!0,opacity:.6,depthWrite:!1,toneMapped:!1})]}),(0,t.jsx)("primitive",{object:z.object}),(0,t.jsx)(p.default,{items:q,width:.025,screen:1,format:e=>String(Math.round(e)),slackLabel:"calm",maxLabels:6})]})})}])},54983,e=>{"use strict";var t=e.i(90072);let a={thermal:.28,magma:.3,dense:.15,deep:0,haline:.1,turbo:.08},r=e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)],i=Object.fromEntries(Object.entries({speed:["#fffdcd","#f4eaab","#e9d889","#dbc866","#c9ba45","#b2af28","#98a512","#7c9c06","#5f920c","#448818","#287c23","#126e2a","#0b602d","#11512c","#174127","#19321e","#172313"],thermal:["#042333","#082e54","#19337c","#39339e","#563b9c","#6d4694","#83508f","#995889","#b15f82","#c76676","#de7065","#ef7e52","#f99242","#fcaa3c","#f9c441","#f3df4c","#e8fa5b"],haline:["#2a186c","#2e1d93","#2034a2","#0f4a98","#0f5b90","#1c6a8c","#297789","#338588","#3c9387","#44a184","#4faf7e","#5fbe75","#78cb68","#9bd55c","#c1dd64","#e1e57c","#fdef9a"],deep:["#fdfecc","#ddf2ba","#bbe6ac","#98daa4","#78cea3","#62bfa4","#55aea3","#4e9ea1","#488e9e","#437f9a","#3f6f97","#3e5f93","#404d8c","#413e76","#3b325c","#322643","#281a2c"],ice:["#040613","#13132a","#212041","#2e2c5a","#383975","#3e478f","#3f57a3","#3e69b0","#427bb7","#4b8bbd","#579cc3","#67adc9","#79bed0","#92ced7","#afdde1","#cdecef","#eafdfd"],dense:["#e6f1f1","#cbe4e8","#b1d6e3","#9ac8e2","#86b9e3","#79a9e4","#7397e4","#7584df","#7871d5","#7960c7","#784eb3","#753d9d","#6f2e85","#66216c","#5a1851","#491238","#360e24"],magma:["#000004","#0a0822","#1d1147","#36106b","#51127c","#6a1c81","#832681","#9c2e7f","#b73779","#cf4070","#e55064","#f4695c","#fb8761","#fea571","#fec287","#fde0a1","#fcfdbf"],viridis:["#440154","#48186a","#472d7b","#424086","#3b528b","#33638d","#2c728e","#26828e","#21918c","#1f9f88","#27ad81","#3dbc74","#5cc863","#81d34d","#aadc32","#d5e21a","#fde725"],turbo:["#30123b","#4040a2","#466be3","#4294ff","#28bceb","#18ddc2","#32f298","#6dfe62","#a4fc3c","#cbed34","#ecd13a","#fdae35","#fb8122","#ec530f","#d23105","#ac1701","#7a0403"]}).map(([e,t])=>[e,t.map(r)])),o=(e,t)=>{let a=i[e]||i.speed,r=Math.min(1,Math.max(0,Number.isFinite(t)?t:0))*(a.length-1),o=Math.min(a.length-2,Math.floor(r)),n=r-o;return a[o].map((e,t)=>e+(a[o+1][t]-e)*n)};e.s(["colorAt",0,o,"colorMapTexture",0,e=>{let r=new Uint8Array(1024),i=a[e]||0;for(let t=0;t<256;t++){let[a,n,l]=o(e,i+(1-i)*t/255);r.set([Math.round(a),Math.round(n),Math.round(l),255],4*t)}let n=new t.DataTexture(r,256,1,t.RGBAFormat);return n.magFilter=t.LinearFilter,n.minFilter=t.LinearFilter,n.colorSpace=t.SRGBColorSpace,n.needsUpdate=!0,n},"cssGradient",0,e=>{let t=a[e]||0,r=Array.from({length:9},(a,r)=>{let[i,n,l]=o(e,t+(1-t)*r/8);return`rgb(${Math.round(i)},${Math.round(n)},${Math.round(l)})`});return`linear-gradient(to right, ${r.join(", ")})`}])},33227,e=>{"use strict";var t=e.i(3950);let a={key:null,at:0,field:null},r=.5/1.943844,i=null,o=new Set,n=(e,t,a,r)=>({lat:e+(r/8*2-1)*12e3/6371e3*180/Math.PI,lon:t+(a/8*2-1)*12e3/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),l=(e,t)=>{let a=[],r=[];for(let i=0;i<9;i++)for(let o=0;o<9;o++){let l=n(e,t,o,i);a.push(l.lat.toFixed(4)),r.push(l.lon.toFixed(4))}return`https://marine-api.open-meteo.com/v1/marine?latitude=${a.join(",")}&longitude=${r.join(",")}&hourly=ocean_current_velocity,ocean_current_direction&forecast_hours=48&timezone=GMT`},u=async(e,r)=>{let i=`${e.toFixed(1)},${r.toFixed(1)}`;if(a.field&&a.key===i&&Date.now()-a.at<18e5)return a.field;let o=await (0,t.cachedFetch)(l(e,r),{kind:"forecast"});if(!o.ok)throw Error(`Open-Meteo marine ${o.status}`);let n=await o.json(),u=Array.isArray(n)?n:[n],s=u[0]?.hourly?.time||[],c=s.length,d=[],f=[];for(let e=0;e<c;e++){let t=new Float32Array(81),a=new Float32Array(81);u.forEach((r,i)=>{let o=(r.hourly.ocean_current_velocity[e]??0)/3.6,n=(r.hourly.ocean_current_direction[e]??0)*Math.PI/180;t[i]=o*Math.sin(n),a[i]=o*Math.cos(n)}),d.push(t),f.push(a)}let h=0;d.forEach((e,t)=>e.forEach((e,a)=>{h=Math.max(h,Math.hypot(e,f[t][a]))}));let m={origin:{lat:e,lon:r},start:Date.parse(`${s[0]}Z`),hours:c,grid:9,half:12e3,u:d,v:f,max:h,source:"open-meteo"};return a={key:i,at:Date.now(),field:m},m};e.s(["currentFieldUrl",0,l,"fetchCurrentField",0,u,"getCurrentScale",0,()=>i,"setCurrentScale",0,e=>{let t=1.943844*Math.max(r,e?.max||0);return i=e?Math.ceil(4*t)/4/1.943844:null,o.forEach(e=>e(i)),i},"subscribeCurrentScale",0,e=>(o.add(e),()=>o.delete(e)),"uniformCurrent",0,(e,t,a,r)=>{let i=new Float32Array(81).fill(a*Math.sin(r)),o=new Float32Array(81).fill(a*Math.cos(r));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,grid:9,half:12e3,u:[i],v:[o],max:a,source:"boat"}}])},69435,e=>{"use strict";var t=e.i(71645),a=e.i(90072),r=e.i(3666);let i=40,o=`
|
|
90
|
+
`,x=(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:F=!0})=>{let S=u.default.get("windStyle")||"volume",T=F&&"volume"===S,A="volume"===S?150:1100,E=u.default.get("windColorMap")||"windy",C=(0,s.useSignalKPaths)(g),_=C["navigation.position"],{heading:L}=(0,c.default)(),P=(0,a.useSyncExternalStore)(m.subscribeForecast,m.getForecastHour,m.getForecastHour),[I,N]=(0,a.useState)(null),{id:j}=(0,M.default)(),W="day"===j?-.6:.45,k=(0,a.useRef)(),R=u.default.get("aisLengthScalingFactor")||.7,$=_?.latitude,B=_?.longitude,D=Number.isFinite($)?`${$.toFixed(1)},${B.toFixed(1)}`:null,G=C["environment.wind.speedTrue"],O=C["environment.wind.directionTrue"];(0,a.useEffect)(()=>{if(!D)return;let e=!1,[t,a]=D.split(",").map(Number);return(0,d.fetchWindField)(t,a).then(t=>{e||N(t)}).catch(()=>{!e&&Number.isFinite(G)&&Number.isFinite(O)&&N((0,d.uniformField)(t,a,G,O))}),()=>{e=!0}},[D]);let z=(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(!I||!F||T)return;let e=z.image.data;for(let t=0;t<128;t++)for(let a=0;a<128;a++){let r=(a/127*2-1)*d.HALF_EXTENT_M,i=(t/127*2-1)*d.HALF_EXTENT_M,o=(0,d.sampleWind)(I,r,i,P),[n,l,u]=y(E,Math.hypot(o.u,o.v)),s=(128*t+a)*4,c=Math.max(Math.abs(a/127*2-1),Math.abs(t/127*2-1));e[s]=n,e[s+1]=l,e[s+2]=u,e[s+3]=Math.round(255*Math.min(1,(1-c)*8))}z.needsUpdate=!0},[z,I,P,F,T,E]),(0,a.useEffect)(()=>()=>z.dispose(),[z]);let U=(0,a.useMemo)(()=>{let e=new n.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 o.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)(()=>()=>{U.geo.dispose(),U.material.dispose()},[U]);let H=(0,h.useFieldTexture)(T?I:null,P),X=(0,a.useMemo)(()=>new i.ShaderMaterial({uniforms:{uScale:{value:R},uTop:{value:0},uTime:{value:0},uMaxSpeed:{value:20},uOpacity:{value:Number(u.default.get("windOpacity"))||.7},uLength:{value:600},uFlow:{value:25},uMap:{value:null},uField:{value:null},uFieldHalf:{value:d.HALF_EXTENT_M},uFieldRange:{value:40}},vertexShader:w,fragmentShader:b,transparent:!0,depthWrite:!1}),[R]),V=(0,a.useMemo)(()=>"windy"===E?(()=>{let e=new Uint8Array(1024);for(let t=0;t<256;t++){let[a,r,i]=(0,d.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,f.colorMapTexture)(E),[E]);(0,a.useEffect)(()=>{X.uniforms.uMap.value=V,X.uniforms.uField.value=H},[X,V,H]),(0,a.useEffect)(()=>()=>{X.dispose(),V.dispose()},[X,V]),(0,a.useEffect)(()=>{U.geo.instanceCount=7*A},[U,A]);let[q,K]=(0,a.useState)([]),Y=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!I||!Number.isFinite($))return;let e=x(I.origin,{latitude:$,longitude:B}),t=Array.from({length:I.hours},(t,a)=>{let r=(0,d.sampleWind)(I,e.east,e.north,a);return Math.hypot(r.u,r.v)});return(0,m.setSeries)("wind",{start:I.start,values:t,top:Math.max(...t)}),()=>(0,m.setSeries)("wind",null)},[I,Math.round(100*$),Math.round(100*B)]);let Z=(0,a.useRef)({east:0,north:0});(0,a.useEffect)(()=>{I&&Number.isFinite($)&&(Z.current=x(I.origin,{latitude:$,longitude:B}))},[I,$,B]);let J=(0,a.useRef)();if((0,r.useFrame)(({camera:t,size:a,clock:r,gl:o},n)=>{if(!I)return;if(T&&(X.uniforms.uTime.value=r.elapsedTime,X.uniforms.uTop.value=e+150*R),J.current){let e=t.position.length()/R;J.current&&(J.current.opacity=i.MathUtils.clamp(.3+(e-300)/3e3*.3,.3,.6))}let l=Math.min(n,.1),u=Math.min(d.HALF_EXTENT_M,Math.max(800,t.position.length()/R*2.5)),s=u/120,c=u/140,{east:f,north:h}=Z.current;U.material.resolution.set(a.width,a.height);let m=U.geo.attributes.instanceStart.data.array,p=U.geo.attributes.instanceColorStart.data.array;if(U.state.forEach((e,t)=>{if(t>=A)return;e.age+=l,(e.age>e.life||Math.abs(e.x)>u||Math.abs(e.y)>u)&&(e.x=(2*Math.random()-1)*u,e.y=(2*Math.random()-1)*u,e.age=0,e.life=2+3*Math.random());let a=(0,d.sampleWind)(I,f+e.x,h+e.y,P),r=Math.hypot(a.u,a.v);e.x+=a.u*s*l/10,e.y+=a.v*s*l/10;let i=Math.min(1,e.age/.5,(e.life-e.age)/.7),[o,n,v]=y(E,r),M=e=>W>=0?e/255*(1-W)+W:e/255*(1+W),g=M(o),w=M(n),b=M(v),x=o/255,F=n/255,S=v/255,T=c*Math.min(1.6,.5+r/10),C=e.x,_=e.y;for(let e=0;e<7;e++){let r=0===e?a:(0,d.sampleWind)(I,f+C,h+_,P),o=Math.hypot(r.u,r.v)||1,n=C-r.u/o*T,l=_-r.v/o*T,u=(7*t+e)*6;m[u]=C*R,m[u+1]=_*R,m[u+2]=.2,m[u+3]=n*R,m[u+4]=l*R,m[u+5]=.2;let s=i*(1-e/7)**1.6,c=i*(1-(e+1)/7)**1.6,v=(7*t+e)*6;p[v]=x+(g-x)*s,p[v+1]=F+(w-F)*s,p[v+2]=S+(b-S)*s,p[v+3]=x+(g-x)*c,p[v+4]=F+(w-F)*c,p[v+5]=S+(b-S)*c,C=n,_=l}}),U.geo.attributes.instanceStart.data.needsUpdate=!0,U.geo.attributes.instanceColorStart.data.needsUpdate=!0,Y.current+=n,Y.current<1)return;Y.current=0;let M=k.current;if(!M)return;let g=M.worldToLocal(new i.Vector3().copy(t.position)),w=f+g.x/R,b=h+g.y/R,x=Math.max(5,g.z/R),F=i.MathUtils.clamp(10*Math.round(3*x/10),60,4e3),S=Math.min(.9*u,Math.max(800,60*x)),C=(0,v.markerLattice)({cx:w,cy:b,radius:S,step:F,near:3*F,originE:w,originN:b,max:400}),_=[],L=(0,v.onScreenTest)(M,t,o.domElement);C.forEach(({e,n:t,d:a})=>{if(_.length>=10||20>Math.hypot(e-f,t-h)||!L((e-f)*R,(t-h)*R,4*R))return;let r=(0,d.sampleWind)(I,e,t,P),i=(0,d.sampleWind)(I,e,t,P+1),o=Math.hypot(r.u,r.v),[n,l,u]=y(E,o),s=e=>W>=0?e/255*(1-W)+W:e/255*(1+W);_.push({key:`${e},${t}`,x:(e-f)*R,y:(t-h)*R,z:4*R,u:r.u,v:r.v,speed:o,trend:Math.hypot(i.u,i.v)-o,color:[s(n),s(l),s(u)],len:.14*(.4+.6*Math.min(1,o/15)),d:a})}),_.sort((e,t)=>e.d-t.d).splice(10),K(e=>(0,v.sameMarkers)(e,_)?e:_)}),!I)return null;let{east:Q,north:ee}=Z.current,et=2*d.HALF_EXTENT_M*R;return(0,t.jsx)("group",{rotation:[0,L,0],position:[0,e,0],children:(0,t.jsxs)("group",{ref:k,rotation:[-Math.PI/2,0,0],children:[F&&(0,t.jsxs)("mesh",{position:[-Q*R,-ee*R,0],renderOrder:1,children:[(0,t.jsx)("planeGeometry",{args:[et,et]}),T?(0,t.jsx)("primitive",{object:X,attach:"material"}):(0,t.jsx)("meshBasicMaterial",{ref:J,map:z,transparent:!0,opacity:.6,depthWrite:!1,toneMapped:!1})]}),(0,t.jsx)("primitive",{object:U.object}),(0,t.jsx)(p.default,{items:q,width:.025,screen:1,format:e=>String(Math.round(e)),slackLabel:"calm",maxLabels:6})]})})}])},54983,e=>{"use strict";var t=e.i(90072);let a={thermal:.28,magma:.3,dense:.15,deep:0,haline:.1,turbo:.08},r=e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)],i=Object.fromEntries(Object.entries({speed:["#fffdcd","#f4eaab","#e9d889","#dbc866","#c9ba45","#b2af28","#98a512","#7c9c06","#5f920c","#448818","#287c23","#126e2a","#0b602d","#11512c","#174127","#19321e","#172313"],thermal:["#042333","#082e54","#19337c","#39339e","#563b9c","#6d4694","#83508f","#995889","#b15f82","#c76676","#de7065","#ef7e52","#f99242","#fcaa3c","#f9c441","#f3df4c","#e8fa5b"],haline:["#2a186c","#2e1d93","#2034a2","#0f4a98","#0f5b90","#1c6a8c","#297789","#338588","#3c9387","#44a184","#4faf7e","#5fbe75","#78cb68","#9bd55c","#c1dd64","#e1e57c","#fdef9a"],deep:["#fdfecc","#ddf2ba","#bbe6ac","#98daa4","#78cea3","#62bfa4","#55aea3","#4e9ea1","#488e9e","#437f9a","#3f6f97","#3e5f93","#404d8c","#413e76","#3b325c","#322643","#281a2c"],ice:["#040613","#13132a","#212041","#2e2c5a","#383975","#3e478f","#3f57a3","#3e69b0","#427bb7","#4b8bbd","#579cc3","#67adc9","#79bed0","#92ced7","#afdde1","#cdecef","#eafdfd"],dense:["#e6f1f1","#cbe4e8","#b1d6e3","#9ac8e2","#86b9e3","#79a9e4","#7397e4","#7584df","#7871d5","#7960c7","#784eb3","#753d9d","#6f2e85","#66216c","#5a1851","#491238","#360e24"],magma:["#000004","#0a0822","#1d1147","#36106b","#51127c","#6a1c81","#832681","#9c2e7f","#b73779","#cf4070","#e55064","#f4695c","#fb8761","#fea571","#fec287","#fde0a1","#fcfdbf"],viridis:["#440154","#48186a","#472d7b","#424086","#3b528b","#33638d","#2c728e","#26828e","#21918c","#1f9f88","#27ad81","#3dbc74","#5cc863","#81d34d","#aadc32","#d5e21a","#fde725"],turbo:["#30123b","#4040a2","#466be3","#4294ff","#28bceb","#18ddc2","#32f298","#6dfe62","#a4fc3c","#cbed34","#ecd13a","#fdae35","#fb8122","#ec530f","#d23105","#ac1701","#7a0403"]}).map(([e,t])=>[e,t.map(r)])),o=(e,t)=>{let a=i[e]||i.speed,r=Math.min(1,Math.max(0,Number.isFinite(t)?t:0))*(a.length-1),o=Math.min(a.length-2,Math.floor(r)),n=r-o;return a[o].map((e,t)=>e+(a[o+1][t]-e)*n)};e.s(["colorAt",0,o,"colorMapTexture",0,e=>{let r=new Uint8Array(1024),i=a[e]||0;for(let t=0;t<256;t++){let[a,n,l]=o(e,i+(1-i)*t/255);r.set([Math.round(a),Math.round(n),Math.round(l),255],4*t)}let n=new t.DataTexture(r,256,1,t.RGBAFormat);return n.magFilter=t.LinearFilter,n.minFilter=t.LinearFilter,n.colorSpace=t.SRGBColorSpace,n.needsUpdate=!0,n},"cssGradient",0,e=>{let t=a[e]||0,r=Array.from({length:9},(a,r)=>{let[i,n,l]=o(e,t+(1-t)*r/8);return`rgb(${Math.round(i)},${Math.round(n)},${Math.round(l)})`});return`linear-gradient(to right, ${r.join(", ")})`}])},33227,e=>{"use strict";var t=e.i(3950);let a={key:null,at:0,field:null},r=.5/1.943844,i=null,o=new Set,n=(e,t,a,r)=>({lat:e+(r/8*2-1)*12e3/6371e3*180/Math.PI,lon:t+(a/8*2-1)*12e3/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),l=(e,t)=>{let a=[],r=[];for(let i=0;i<9;i++)for(let o=0;o<9;o++){let l=n(e,t,o,i);a.push(l.lat.toFixed(4)),r.push(l.lon.toFixed(4))}return`https://marine-api.open-meteo.com/v1/marine?latitude=${a.join(",")}&longitude=${r.join(",")}&hourly=ocean_current_velocity,ocean_current_direction&forecast_hours=48&timezone=GMT`},u=async(e,r)=>{let i=`${e.toFixed(1)},${r.toFixed(1)}`;if(a.field&&a.key===i&&Date.now()-a.at<18e5)return a.field;let o=await (0,t.cachedFetch)(l(e,r),{kind:"forecast"});if(!o.ok)throw Error(`Open-Meteo marine ${o.status}`);let n=await o.json(),u=Array.isArray(n)?n:[n],s=u[0]?.hourly?.time||[],c=s.length,d=[],f=[];for(let e=0;e<c;e++){let t=new Float32Array(81),a=new Float32Array(81);u.forEach((r,i)=>{let o=(r.hourly.ocean_current_velocity[e]??0)/3.6,n=(r.hourly.ocean_current_direction[e]??0)*Math.PI/180;t[i]=o*Math.sin(n),a[i]=o*Math.cos(n)}),d.push(t),f.push(a)}let h=0;d.forEach((e,t)=>e.forEach((e,a)=>{h=Math.max(h,Math.hypot(e,f[t][a]))}));let m={origin:{lat:e,lon:r},start:Date.parse(`${s[0]}Z`),hours:c,grid:9,half:12e3,u:d,v:f,max:h,source:"open-meteo"};return a={key:i,at:Date.now(),field:m},m};e.s(["currentFieldUrl",0,l,"fetchCurrentField",0,u,"getCurrentScale",0,()=>i,"setCurrentScale",0,e=>{let t=1.943844*Math.max(r,e?.max||0);return i=e?Math.ceil(4*t)/4/1.943844:null,o.forEach(e=>e(i)),i},"subscribeCurrentScale",0,e=>(o.add(e),()=>o.delete(e)),"uniformCurrent",0,(e,t,a,r)=>{let i=new Float32Array(81).fill(a*Math.sin(r)),o=new Float32Array(81).fill(a*Math.cos(r));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,grid:9,half:12e3,u:[i],v:[o],max:a,source:"boat"}}])},69435,e=>{"use strict";var t=e.i(71645),a=e.i(90072),r=e.i(3666);let i=40,o=`
|
|
91
91
|
float hash13(vec3 p) {
|
|
92
92
|
p = fract(p * 0.1031);
|
|
93
93
|
p += dot(p, p.zyx + 31.32);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43758,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(90072),a=e.i(90874),n=e.i(92923),o=n,s=e.i(30728);class l extends s.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setColors(r),this}setFromPoints(e){let t=e.length-1,r=new Float32Array(6*t);for(let i=0;i<t;i++)r[6*i]=e[i].x,r[6*i+1]=e[i].y,r[6*i+2]=e[i].z||0,r[6*i+3]=e[i+1].x,r[6*i+4]=e[i+1].y,r[6*i+5]=e[i+1].z||0;return super.setPositions(r),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}var c=e.i(27530);class u extends o.LineSegments2{constructor(e=new l,t=new c.LineMaterial({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let d=e=>e instanceof i.Vector3||e instanceof i.Vector4?[e.x,e.y,e.z]:e instanceof i.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],f=e=>e instanceof i.Color?e.toArray():e,h=(0,r.forwardRef)(function({points:e,color:i=0xffffff,vertexColors:o,linewidth:h,lineWidth:p,segments:m,dashed:v,...
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43758,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(90072),a=e.i(90874),n=e.i(92923),o=n,s=e.i(30728);class l extends s.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setColors(r),this}setFromPoints(e){let t=e.length-1,r=new Float32Array(6*t);for(let i=0;i<t;i++)r[6*i]=e[i].x,r[6*i+1]=e[i].y,r[6*i+2]=e[i].z||0,r[6*i+3]=e[i+1].x,r[6*i+4]=e[i+1].y,r[6*i+5]=e[i+1].z||0;return super.setPositions(r),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}var c=e.i(27530);class u extends o.LineSegments2{constructor(e=new l,t=new c.LineMaterial({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let d=e=>e instanceof i.Vector3||e instanceof i.Vector4?[e.x,e.y,e.z]:e instanceof i.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],f=e=>e instanceof i.Color?e.toArray():e,h=(0,r.forwardRef)(function({points:e,color:i=0xffffff,vertexColors:o,linewidth:h,lineWidth:p,segments:m,dashed:v,...y},g){let x=(0,a.useThree)(e=>e.size),w=(0,r.useMemo)(()=>m?new n.LineSegments2:new u,[m]),[b]=(0,r.useState)(()=>new c.LineMaterial),S=o?.[0]?.length===4?4:3,M=e.flatMap(d),E=M.join(","),A=o?o.flatMap(f):null,_=A?A.join(","):"",F=(0,r.useMemo)(()=>{let e=m?new s.LineSegmentsGeometry:new l;return e.setPositions(M),A&&e.setColors(A,S),e},[E,_,m,S]);return(0,r.useLayoutEffect)(()=>{w.computeLineDistances()},[F,w]),(0,r.useLayoutEffect)(()=>{v?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[v,b]),(0,r.useEffect)(()=>()=>F.dispose(),[F]),(0,r.useEffect)(()=>()=>b.dispose(),[b]),(0,t.jsxs)("primitive",{object:w,ref:g,...y,children:[(0,t.jsx)("primitive",{object:F,attach:"geometry"}),(0,t.jsx)("primitive",{object:b,attach:"material",color:o?0xffffff:i,vertexColors:!!o,resolution:[x.width,x.height],linewidth:h??p??1,dashed:v,transparent:4===S,...y})]})});e.s(["default",0,h],43758)},78461,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(67561);let a=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],n=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,i.useOcearoContext)(),o=(0,r.useSignalKPaths)(a),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),c=o["navigation.position"],u=Number.isFinite(c?.latitude)&&Number.isFinite(c?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!u)return{x:0,y:0};let t={lat:c.latitude,lon:c.longitude};return e(t,(n||(n=t),n))},[c,u,e]),hasFix:u,hasHeading:l}},"getSessionOrigin",0,()=>n])},30997,e=>{"use strict";var t=e.i(71645);let r=new Set,i=null,a=()=>{let e=[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()),t=[];r.forEach(r=>{let i=r.current;if(!i)return;let a=i.getBoundingClientRect(),n=e.some(e=>a.left<e.right&&a.right>e.left&&a.top<e.bottom&&a.bottom>e.top)?"hidden":"visible";i.style.visibility!==n&&t.push([i,n])}),t.forEach(([e,t])=>{e.style.visibility=t})};e.s(["default",0,e=>{(0,t.useEffect)(()=>(r.add(e),i||(i=setInterval(a,250)),a(),()=>{r.delete(e),r.size||(clearInterval(i),i=null)}),[e])}])},93116,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(95393),a=e.i(90072);let n=`
|
|
2
2
|
attribute vec3 aBase;
|
|
3
3
|
attribute vec2 aDir;
|
|
4
4
|
attribute vec3 aColor;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
gl_FragColor = vec4(vColor, vAlpha * uOpacity);
|
|
41
41
|
#include <colorspace_fragment>
|
|
42
42
|
}
|
|
43
|
-
`;e.s(["default",0,({items:e,width:s,travel:l=0,pace:c=0,opacity:u=.9,fadeNear:d=0,still:f=!1,screen:h=0,renderOrder:p=3})=>{let{geometry:m,material:v}=(0,r.useMemo)(()=>{let e,t=((e=new a.Shape).moveTo(-.16,-.5),e.lineTo(.16,-.5),e.lineTo(.16,.08),e.lineTo(.5,.08),e.lineTo(0,.5),e.lineTo(-.5,.08),e.lineTo(-.16,.08),e.closePath(),new a.ShapeGeometry(e)),r=new a.InstancedBufferGeometry;r.index=t.index,r.setAttribute("position",t.attributes.position),r.setAttribute("aBase",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aDir",new a.InstancedBufferAttribute(new Float32Array(800),2)),r.setAttribute("aColor",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aLenSpeed",new a.InstancedBufferAttribute(new Float32Array(800),2));let i=new Float32Array(400);for(let e=0;e<400;e++)i[e]=.618034*e%1;return r.setAttribute("aSeed",new a.InstancedBufferAttribute(i,1)),r.instanceCount=0,{geometry:r,material:new a.ShaderMaterial({uniforms:{uCam:{value:new a.Vector3},uTime:{value:0},uWidth:{value:1},uTravel:{value:1},uPace:{value:1},uOpacity:{value:u},uFadeNear:{value:0},uStill:{value:0},uScreen:{value:0}},vertexShader:n,fragmentShader:o,transparent:!0,depthWrite:!1,side:a.DoubleSide})}},[]);(0,r.useEffect)(()=>()=>{m.dispose(),v.dispose()},[m,v]),(0,r.useEffect)(()=>{let t=Math.min(e.length,400),r=m.attributes;for(let i=0;i<t;i++){let t=e[i];r.aBase.array.set([t.x,t.y,t.z],3*i),r.aDir.array.set([t.u,t.v],2*i),r.aColor.array.set(t.color,3*i),r.aLenSpeed.array.set([t.len,t.speed],2*i)}["aBase","aDir","aColor","aLenSpeed"].forEach(e=>{r[e].needsUpdate=!0}),m.instanceCount=t},[m,e]),(0,r.useEffect)(()=>{let e=v.uniforms;e.uWidth.value=s,e.uTravel.value=l,e.uPace.value=c,e.uOpacity.value=u,e.uFadeNear.value=d,e.uStill.value=+!!f,e.uScreen.value=h},[v,s,l,c,u,d,f,h]);let
|
|
43
|
+
`;e.s(["default",0,({items:e,width:s,travel:l=0,pace:c=0,opacity:u=.9,fadeNear:d=0,still:f=!1,screen:h=0,renderOrder:p=3})=>{let{geometry:m,material:v}=(0,r.useMemo)(()=>{let e,t=((e=new a.Shape).moveTo(-.16,-.5),e.lineTo(.16,-.5),e.lineTo(.16,.08),e.lineTo(.5,.08),e.lineTo(0,.5),e.lineTo(-.5,.08),e.lineTo(-.16,.08),e.closePath(),new a.ShapeGeometry(e)),r=new a.InstancedBufferGeometry;r.index=t.index,r.setAttribute("position",t.attributes.position),r.setAttribute("aBase",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aDir",new a.InstancedBufferAttribute(new Float32Array(800),2)),r.setAttribute("aColor",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aLenSpeed",new a.InstancedBufferAttribute(new Float32Array(800),2));let i=new Float32Array(400);for(let e=0;e<400;e++)i[e]=.618034*e%1;return r.setAttribute("aSeed",new a.InstancedBufferAttribute(i,1)),r.instanceCount=0,{geometry:r,material:new a.ShaderMaterial({uniforms:{uCam:{value:new a.Vector3},uTime:{value:0},uWidth:{value:1},uTravel:{value:1},uPace:{value:1},uOpacity:{value:u},uFadeNear:{value:0},uStill:{value:0},uScreen:{value:0}},vertexShader:n,fragmentShader:o,transparent:!0,depthWrite:!1,side:a.DoubleSide})}},[]);(0,r.useEffect)(()=>()=>{m.dispose(),v.dispose()},[m,v]),(0,r.useEffect)(()=>{let t=Math.min(e.length,400),r=m.attributes;for(let i=0;i<t;i++){let t=e[i];r.aBase.array.set([t.x,t.y,t.z],3*i),r.aDir.array.set([t.u,t.v],2*i),r.aColor.array.set(t.color,3*i),r.aLenSpeed.array.set([t.len,t.speed],2*i)}["aBase","aDir","aColor","aLenSpeed"].forEach(e=>{r[e].needsUpdate=!0}),m.instanceCount=t},[m,e]),(0,r.useEffect)(()=>{let e=v.uniforms;e.uWidth.value=s,e.uTravel.value=l,e.uPace.value=c,e.uOpacity.value=u,e.uFadeNear.value=d,e.uStill.value=+!!f,e.uScreen.value=h},[v,s,l,c,u,d,f,h]);let y=(0,r.useRef)(),g=(0,r.useMemo)(()=>new a.Vector3,[]);return(0,i.useFrame)(({camera:e,clock:t})=>{y.current&&(y.current.updateWorldMatrix(!0,!1),v.uniforms.uCam.value.copy(y.current.worldToLocal(g.copy(e.position))),v.uniforms.uTime.value=t.elapsedTime)}),(0,t.jsx)("mesh",{ref:y,geometry:m,material:v,frustumCulled:!1,renderOrder:p})}])},78311,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(60099);e.i(85269);var a=e.i(22831),n=e.i(93116),o=e.i(30997);let s=[.86,.22,.2],l=[.16,.48,.86],c=({children:e})=>{let i=(0,r.useRef)(null);return(0,o.default)(i),(0,t.jsx)("div",{ref:i,style:{transform:"translateY(-1.1rem)"},children:e})};e.s(["default",0,({items:e,width:o,screen:u=0,fadeNear:d=0,format:f=e=>e.toFixed(1),slackLabel:h="slack",maxLabels:p=12,renderOrder:m=3})=>{let{t:v}=(0,a.useTranslation)(),{borders:y,fills:g}=(0,r.useMemo)(()=>{let t=e.filter(e=>e.speed>=.051444457477040344);return{borders:t.map(e=>({...e,len:e.len+.5*o,color:e.trend>.05?s:e.trend<-.05?l:[.06,.09,.12]})),fills:t}},[e,o]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.default,{items:y,width:1.35*o,screen:u,still:!0,fadeNear:d,opacity:.95,renderOrder:m}),(0,t.jsx)(n.default,{items:g,width:o,screen:u,still:!0,fadeNear:d,opacity:.95,renderOrder:m+1}),e.slice(0,p).map(e=>{let r=e.speed<.051444457477040344;return(0,t.jsx)(i.Html,{position:[e.x,e.y,e.z],center:!0,zIndexRange:[4,0],style:{pointerEvents:"none"},children:(0,t.jsx)(c,{children:r?(0,t.jsx)("div",{className:"rounded-md border-2 border-oBlue bg-hud-bg/80 px-1.5 text-caption font-semibold uppercase tracking-wide text-hud-main whitespace-nowrap",children:v(`meteo.${h}`)}):(0,t.jsx)("div",{className:"rounded px-1 text-caption font-bold tabular-nums leading-tight whitespace-nowrap",style:{color:"#fff",background:"rgba(10, 16, 22, 0.72)"},children:f(1.943844*e.speed)})})},e.key)})]})}])},54983,e=>{"use strict";var t=e.i(90072);let r={thermal:.28,magma:.3,dense:.15,deep:0,haline:.1,turbo:.08},i=e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)],a=Object.fromEntries(Object.entries({speed:["#fffdcd","#f4eaab","#e9d889","#dbc866","#c9ba45","#b2af28","#98a512","#7c9c06","#5f920c","#448818","#287c23","#126e2a","#0b602d","#11512c","#174127","#19321e","#172313"],thermal:["#042333","#082e54","#19337c","#39339e","#563b9c","#6d4694","#83508f","#995889","#b15f82","#c76676","#de7065","#ef7e52","#f99242","#fcaa3c","#f9c441","#f3df4c","#e8fa5b"],haline:["#2a186c","#2e1d93","#2034a2","#0f4a98","#0f5b90","#1c6a8c","#297789","#338588","#3c9387","#44a184","#4faf7e","#5fbe75","#78cb68","#9bd55c","#c1dd64","#e1e57c","#fdef9a"],deep:["#fdfecc","#ddf2ba","#bbe6ac","#98daa4","#78cea3","#62bfa4","#55aea3","#4e9ea1","#488e9e","#437f9a","#3f6f97","#3e5f93","#404d8c","#413e76","#3b325c","#322643","#281a2c"],ice:["#040613","#13132a","#212041","#2e2c5a","#383975","#3e478f","#3f57a3","#3e69b0","#427bb7","#4b8bbd","#579cc3","#67adc9","#79bed0","#92ced7","#afdde1","#cdecef","#eafdfd"],dense:["#e6f1f1","#cbe4e8","#b1d6e3","#9ac8e2","#86b9e3","#79a9e4","#7397e4","#7584df","#7871d5","#7960c7","#784eb3","#753d9d","#6f2e85","#66216c","#5a1851","#491238","#360e24"],magma:["#000004","#0a0822","#1d1147","#36106b","#51127c","#6a1c81","#832681","#9c2e7f","#b73779","#cf4070","#e55064","#f4695c","#fb8761","#fea571","#fec287","#fde0a1","#fcfdbf"],viridis:["#440154","#48186a","#472d7b","#424086","#3b528b","#33638d","#2c728e","#26828e","#21918c","#1f9f88","#27ad81","#3dbc74","#5cc863","#81d34d","#aadc32","#d5e21a","#fde725"],turbo:["#30123b","#4040a2","#466be3","#4294ff","#28bceb","#18ddc2","#32f298","#6dfe62","#a4fc3c","#cbed34","#ecd13a","#fdae35","#fb8122","#ec530f","#d23105","#ac1701","#7a0403"]}).map(([e,t])=>[e,t.map(i)])),n=(e,t)=>{let r=a[e]||a.speed,i=Math.min(1,Math.max(0,Number.isFinite(t)?t:0))*(r.length-1),n=Math.min(r.length-2,Math.floor(i)),o=i-n;return r[n].map((e,t)=>e+(r[n+1][t]-e)*o)};e.s(["colorAt",0,n,"colorMapTexture",0,e=>{let i=new Uint8Array(1024),a=r[e]||0;for(let t=0;t<256;t++){let[r,o,s]=n(e,a+(1-a)*t/255);i.set([Math.round(r),Math.round(o),Math.round(s),255],4*t)}let o=new t.DataTexture(i,256,1,t.RGBAFormat);return o.magFilter=t.LinearFilter,o.minFilter=t.LinearFilter,o.colorSpace=t.SRGBColorSpace,o.needsUpdate=!0,o},"cssGradient",0,e=>{let t=r[e]||0,i=Array.from({length:9},(r,i)=>{let[a,o,s]=n(e,t+(1-t)*i/8);return`rgb(${Math.round(a)},${Math.round(o)},${Math.round(s)})`});return`linear-gradient(to right, ${i.join(", ")})`}])},33227,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=.5/1.943844,a=null,n=new Set,o=(e,t,r,i)=>({lat:e+(i/8*2-1)*12e3/6371e3*180/Math.PI,lon:t+(r/8*2-1)*12e3/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),s=(e,t)=>{let r=[],i=[];for(let a=0;a<9;a++)for(let n=0;n<9;n++){let s=o(e,t,n,a);r.push(s.lat.toFixed(4)),i.push(s.lon.toFixed(4))}return`https://marine-api.open-meteo.com/v1/marine?latitude=${r.join(",")}&longitude=${i.join(",")}&hourly=ocean_current_velocity,ocean_current_direction&forecast_hours=48&timezone=GMT`},l=async(e,i)=>{let a=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===a&&Date.now()-r.at<18e5)return r.field;let n=await (0,t.cachedFetch)(s(e,i),{kind:"forecast"});if(!n.ok)throw Error(`Open-Meteo marine ${n.status}`);let o=await n.json(),l=Array.isArray(o)?o:[o],c=l[0]?.hourly?.time||[],u=c.length,d=[],f=[];for(let e=0;e<u;e++){let t=new Float32Array(81),r=new Float32Array(81);l.forEach((i,a)=>{let n=(i.hourly.ocean_current_velocity[e]??0)/3.6,o=(i.hourly.ocean_current_direction[e]??0)*Math.PI/180;t[a]=n*Math.sin(o),r[a]=n*Math.cos(o)}),d.push(t),f.push(r)}let h=0;d.forEach((e,t)=>e.forEach((e,r)=>{h=Math.max(h,Math.hypot(e,f[t][r]))}));let p={origin:{lat:e,lon:i},start:Date.parse(`${c[0]}Z`),hours:u,grid:9,half:12e3,u:d,v:f,max:h,source:"open-meteo"};return r={key:a,at:Date.now(),field:p},p};e.s(["currentFieldUrl",0,s,"fetchCurrentField",0,l,"getCurrentScale",0,()=>a,"setCurrentScale",0,e=>{let t=1.943844*Math.max(i,e?.max||0);return a=e?Math.ceil(4*t)/4/1.943844:null,n.forEach(e=>e(a)),a},"subscribeCurrentScale",0,e=>(n.add(e),()=>n.delete(e)),"uniformCurrent",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(r*Math.sin(i)),n=new Float32Array(81).fill(r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,grid:9,half:12e3,u:[a],v:[n],max:r,source:"boat"}}])},69435,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(3666);let a=40,n=`
|
|
44
44
|
float hash13(vec3 p) {
|
|
45
45
|
p = fract(p * 0.1031);
|
|
46
46
|
p += dot(p, p.zyx + 31.32);
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
vec2 a = abs(g) / uFieldHalf;
|
|
72
72
|
return 1.0 - smoothstep(0.85, 1.0, max(a.x, a.y));
|
|
73
73
|
}
|
|
74
|
-
`;e.s(["FIELD_GLSL",0,o,"NOISE_GLSL",0,n,"useFieldTexture",0,(e,n,o=a)=>{let s=(0,t.useMemo)(()=>{let e=new r.DataTexture(new Uint8Array(16384),64,64,r.RGBAFormat);return e.magFilter=r.LinearFilter,e.minFilter=r.LinearFilter,e.wrapS=r.ClampToEdgeWrapping,e.wrapT=r.ClampToEdgeWrapping,e},[]);return(0,t.useEffect)(()=>{if(!e)return;let t=s.image.data,r=e.half??i.HALF_EXTENT_M;for(let a=0;a<64;a++)for(let s=0;s<64;s++){let l=(0,i.sampleWind)(e,(s/63*2-1)*r,(a/63*2-1)*r,n),c=(64*a+s)*4;t[c]=Math.round(255*Math.min(1,Math.max(0,.5+l.u/(2*o)))),t[c+1]=Math.round(255*Math.min(1,Math.max(0,.5+l.v/(2*o)))),t[c+2]=0,t[c+3]=255}s.needsUpdate=!0},[s,e,n,o]),(0,t.useEffect)(()=>()=>s.dispose(),[s]),s}])},88608,e=>{"use strict";let t=0,r=new Set,i={},a=new Set;e.s(["getForecastHour",0,()=>t,"getSeries",0,()=>i,"setForecastHour",0,e=>{t=Math.max(0,e),r.forEach(e=>e(t))},"setSeries",0,(e,t)=>{i={...i,[e]:t},a.forEach(e=>e(i))},"subscribeForecast",0,e=>(r.add(e),()=>r.delete(e)),"subscribeSeries",0,e=>(a.add(e),()=>a.delete(e))])},18032,e=>{"use strict";var t=e.i(90072);e.s(["markerLattice",0,({cx:e,cy:t,radius:r,step:i,near:a,originE:n=0,originN:o=0,max:s=60})=>{let l=[],c=Math.ceil((n-r)/i),u=Math.floor((n+r)/i),d=Math.ceil((o-r)/i),f=Math.floor((o+r)/i);for(let s=c;s<=u;s++)for(let c=d;c<=f;c++){let u=s*i,d=c*i;if(Math.hypot(u-n,d-o)>r)continue;let f=Math.hypot(u-e,d-t),h=f<=a?0:Math.ceil(Math.log2(f/a)),p=2**h;s%p==0&&c%p==0&&l.push({e:u,n:d,d:f})}return l.sort((e,t)=>e.d-t.d).slice(0,s)},"onScreenTest",0,(e,r,i,a=.9,n=60)=>{let o=new t.Vector3;e.updateWorldMatrix(!0,!1);let s=i.getBoundingClientRect(),l="u"<typeof document?[]:[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);return(t,i,c)=>{if(o.set(t,i,c),e.localToWorld(o).project(r),o.z>=1||Math.abs(o.x)>a||Math.abs(o.y)>a)return!1;let u=s.left+(o.x+1)/2*s.width,d=s.top+(1-o.y)/2*s.height;return!l.some(e=>u>e.left-n&&u<e.right+n&&d>e.top-n&&d<e.bottom+n)}},"sameMarkers",0,(e,t)=>e.length===t.length&&e.every((e,r)=>{let i=t[r];return e.key===i.key&&.005>Math.abs(e.speed-i.speed)&&Math.sign(Math.round(20*e.trend))===Math.sign(Math.round(20*i.trend))&&.001>Math.abs(e.len-i.len)&&e.x===i.x&&e.y===i.y})])},54735,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(33227),a=e.i(88608),n=e.i(3666),o=e.i(54983),s=e.i(18032),l=e.i(58567);let c=["navigation.position","environment.current"];e.s(["CURRENT_ARROW_WIDTH",0,.028,"DEFAULT_CURRENT_MAP",0,"thermal","currentMarkers",0,({field:e,hour:t,top:r,mapName:i,refE:a,refN:c,cx:u,cy:d,heightM:f,scale:h,radius:p,z:m,isWater:v=()=>!0,onScreen:g=()=>!0})=>{let y=Math.min(400,Math.max(25,5*Math.round(.9*f/5))),x="pi"===(0,l.getRenderProfile)().id?20:40,w=(0,s.markerLattice)({cx:u,cy:d,radius:p,step:y,near:3*y,originE:a,originN:c,max:400}),b=[];return w.forEach(({e:s,n:l})=>{if(b.length>=x||15>Math.hypot(s-a,l-c))return;let u=(s-a)*h,d=(l-c)*h;if(!g(u,d,m)||!v(u,d))return;let f=(0,n.sampleWind)(e,s,l,t),p=Math.hypot(f.u,f.v);if(p<.005)return;let y=(0,n.sampleWind)(e,s,l,t+1),w=Math.min(1,p/r),[S,M,E]=(0,o.colorAt)(i,.28+.72*w);b.push({key:`${s},${l}`,x:u,y:d,z:m,u:f.u,v:f.v,speed:p,trend:Math.hypot(y.u,y.v)-p,color:[S/255,M/255,E/255],len:.16*(.4+.6*w)})}),b},"useCurrentField",0,()=>{let e=(0,r.useSignalKPaths)(c),o=e["navigation.position"],s=e["environment.current"],l=(0,t.useSyncExternalStore)(a.subscribeForecast,a.getForecastHour,a.getForecastHour),[u,d]=(0,t.useState)(null),[f,h]=(0,t.useState)(1),p=o?.latitude,m=o?.longitude,v=Number.isFinite(p)?`${p.toFixed(1)},${m.toFixed(1)}`:null;(0,t.useEffect)(()=>{if(!v)return;let e=!1,[t,r]=v.split(",").map(Number);return(0,i.fetchCurrentField)(t,r).then(t=>{e||d(t)}).catch(()=>{!e&&Number.isFinite(s?.drift)&&Number.isFinite(s?.setTrue)&&d((0,i.uniformCurrent)(t,r,s.drift,s.setTrue))}),()=>{e=!0}},[v]),(0,t.useEffect)(()=>{h((0,i.setCurrentScale)(u)??1)},[u]),(0,t.useEffect)(()=>()=>(0,i.setCurrentScale)(null),[]);let g=Number.isFinite(p)?Math.round(100*p):null,y=Number.isFinite(m)?Math.round(100*m):null;return(0,t.useEffect)(()=>{if(!u||null===g)return;let e=(m-u.origin.lon)*Math.PI/180*6371e3*Math.cos(u.origin.lat*Math.PI/180),t=(p-u.origin.lat)*Math.PI/180*6371e3,r=Array.from({length:u.hours},(r,i)=>{let a=(0,n.sampleWind)(u,e,t,i);return Math.hypot(a.u,a.v)});return(0,a.setSeries)("current",{start:u.start,values:r,top:u.max}),()=>(0,a.setSeries)("current",null)},[u,g,y]),{field:u,hour:l,top:f,lat:p,lon:m}}])},3666,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=(e,t,r,i)=>({lat:e+(i/8*2-1)*4e4/6371e3*180/Math.PI,lon:t+(r/8*2-1)*4e4/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),a=(e,t)=>{let r=[],a=[];for(let n=0;n<9;n++)for(let o=0;o<9;o++){let s=i(e,t,o,n);r.push(s.lat.toFixed(4)),a.push(s.lon.toFixed(4))}return`https://api.open-meteo.com/v1/forecast?latitude=${r.join(",")}&longitude=${a.join(",")}&hourly=wind_speed_10m,wind_direction_10m&wind_speed_unit=ms&forecast_hours=48&timezone=GMT`},n=async(e,i)=>{let n=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===n&&Date.now()-r.at<18e5)return r.field;let o=a(e,i),s=await (0,t.cachedFetch)(o,{kind:"forecast"});if(!s.ok)throw Error(`Open-Meteo ${s.status}`);let l=await s.json(),c=Array.isArray(l)?l:[l],u=c[0]?.hourly?.time||[],d=u.length,f=[],h=[];for(let e=0;e<d;e++){let t=new Float32Array(81),r=new Float32Array(81);c.forEach((i,a)=>{let n=i.hourly.wind_speed_10m[e]??0,o=(i.hourly.wind_direction_10m[e]??0)*Math.PI/180;t[a]=-n*Math.sin(o),r[a]=-n*Math.cos(o)}),f.push(t),h.push(r)}let p={origin:{lat:e,lon:i},start:Date.parse(`${u[0]}Z`),hours:d,u:f,v:h,source:"open-meteo"};return r={key:n,at:Date.now(),field:p},p},o=[[0,[98,113,183]],[1,[57,97,159]],[3,[74,148,169]],[5,[77,141,123]],[7,[83,165,83]],[9,[53,159,53]],[11,[167,157,81]],[13,[159,127,58]],[15,[161,108,92]],[17,[129,58,78]],[19,[175,80,136]],[21,[117,74,147]],[24,[109,97,163]],[27,[68,105,141]],[29,[92,144,152]],[36,[125,68,165]]];e.s(["HALF_EXTENT_M",0,4e4,"WINDY_SCALE",0,o,"fetchWindField",0,n,"sampleWind",0,(e,t,r,i=0)=>{let a=e.grid??9,n=e.half??4e4,o=Math.min(a-1.001,Math.max(0,(t/n+1)/2*(a-1))),s=Math.min(a-1.001,Math.max(0,(r/n+1)/2*(a-1))),l=Math.floor(o),c=Math.floor(s),u=o-l,d=s-c,f=Math.min(e.hours-1,Math.max(0,Math.floor(i))),h=Math.min(e.hours-1,f+1),p=Math.min(1,Math.max(0,i-f)),m=(e,t)=>{let r=e[t],i=c*a+l;return(r[i]*(1-u)+r[i+1]*u)*(1-d)+(r[i+a]*(1-u)+r[i+a+1]*u)*d};return{u:m(e.u,f)*(1-p)+m(e.u,h)*p,v:m(e.v,f)*(1-p)+m(e.v,h)*p}},"uniformField",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(-r*Math.sin(i)),n=new Float32Array(81).fill(-r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,u:[a],v:[n],source:"boat"}},"windColor",0,e=>{if(e<=o[0][0])return o[0][1];for(let t=1;t<o.length;t++)if(e<=o[t][0]){let[r,i]=o[t-1],[a,n]=o[t],s=(e-r)/(a-r);return i.map((e,t)=>e+(n[t]-e)*s)}return o[o.length-1][1]},"windFieldUrl",0,a])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},58567,e=>{"use strict";let t;var r=e.i(83402);let i=/v3d|videocore|llvmpipe|swiftshader/i,a=/android|iphone|ipad|ipod|mobile/i;e.s(["RENDER_QUALITIES",0,["auto","high","pi"],"getRenderProfile",0,()=>{let e=r.default.get("renderQuality")||"auto";return"pi"===e||"auto"===e&&(()=>{if("u"<typeof navigator)return!1;if(i.test((()=>{if(void 0!==t)return t;t="";try{let e=document.createElement("canvas").getContext("webgl"),r=e?.getExtension("WEBGL_debug_renderer_info");t=String(e?.getParameter(r?r.UNMASKED_RENDERER_WEBGL:e.RENDERER)||""),e?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}return t})()))return!0;if(a.test(navigator.userAgent)||navigator.maxTouchPoints>1&&/Macintosh/.test(navigator.userAgent))return!1;if(/aarch64|armv7|armv8|arm64|raspbian|raspberry/i.test(navigator.userAgent))return!0;let e=navigator.hardwareConcurrency||8,r=navigator.deviceMemory||8;return e<=4&&r<=4})()?{id:"pi",fps:30,dpr:.75,antialias:!1}:{id:"high",fps:60,dpr:Math.min(window.devicePixelRatio||1,2.5),antialias:!0}}])},3950,e=>{"use strict";let t="ocearo-offline-v2",r=["ocearo-offline-v1"],i=!1,a=async(e,{kind:a="tile"}={})=>{if(!("u">typeof caches))return fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"});i||(i=!0,r.forEach(e=>caches.delete(e).catch(()=>{})));let n=await caches.open(t);if("tile"===a){let t=await n.match(e);if(t)return t}try{let t=await fetch(e,{mode:"cors",referrerPolicy:"strict-origin-when-cross-origin"});if(t.ok)await n.put(e,t.clone());else{let t=await n.match(e);if(t)return t}return t}catch(r){let t=await n.match(e);if(t)return t;throw r}},n=async e=>{let t=await a(e,{kind:"tile"});if(!t.ok)throw Error(`${t.status} ${e}`);return createImageBitmap(await t.blob())},o=(e,t,r,i)=>{if(e.includes("{bbox}")){let a=40075016.68557849/2**t,n=-20037508.342789244+r*a,o=20037508.342789244-i*a,s=[n,o-a,n+a,o].map(e=>e.toFixed(2)).join(",");return e.replace("{bbox}",s)}return e.replace("{z}",t).replace("{x}",r).replace("{y}",i)},s=(e,t,r,i)=>{let a=2**i,n=(e,t)=>({x:Math.floor((t+180)/360*a),y:Math.floor((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*a)}),o=r/111320,s=r/(111320*Math.cos(e*Math.PI/180)),l=n(e+o,t-s),c=n(e-o,t+s),u=[];for(let e=l.x;e<=c.x;e++)for(let t=l.y;t<=c.y;t++)u.push({z:i,x:e,y:t});return u},l=async({lat:e,lon:t,radiusM:r,layers:i,urls:n=[],onProgress:l})=>{let c=[];for(let{template:a,zooms:n}of i)for(let i of n)for(let n of s(e,t,r,i))c.push(o(a,n.z,n.x,n.y));c.push(...n);let u=0,d=0,f=[...c],h=async()=>{for(;f.length;){let e=f.shift();try{!(await a(e,{kind:e.includes("forecast")?"forecast":"tile"})).ok&&d++}catch{d++}u++,l?.(u,c.length,d)}};return await Promise.all(Array.from({length:4},h)),{done:u,failed:d,total:c.length}},c=async()=>{if(navigator.storage?.estimate){let{usage:e}=await navigator.storage.estimate();return e}return null},u=async(e,r)=>{if(!("u">typeof caches))return!1;let i=await caches.open(t);return await i.put(e,r),!0},d=async e=>{if(!("u">typeof caches))return null;let r=await caches.open(t);return await r.match(e)||null};e.s(["cachedFetch",0,a,"cachedImage",0,n,"clearOfflineCache",0,()=>"u">typeof caches?caches.delete(t):Promise.resolve(!1),"offlineCacheSize",0,c,"prefetchArea",0,l,"readCached",0,d,"storeCached",0,u,"tileUrl",0,o])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,r;var i=e.i(31067),a=e.i(71645),n=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let c=new o.Vector3,u=new o.Vector3,d=new o.Vector3,f=new o.Vector2;function h(e,t,r){let i=c.setFromMatrixPosition(e.matrixWorld);i.project(t);let a=r.width/2,n=r.height/2;return[i.x*a+a,-(i.y*n)+n]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),g=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,r(t),"translate(-50%,-50%)")),y=a.forwardRef(({children:e,eps:t=.001,style:r,className:m,prepend:y,center:x,fullscreen:w,portal:b,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:A,onOcclude:_,castShadow:F,receiveShadow:P,material:z,geometry:T,zIndexRange:L=[0x1000037,0],calculatePosition:C=h,as:U="div",wrapperClass:D,pointerEvents:B="auto",...I},R)=>{let{gl:W,camera:j,scene:O,size:N,raycaster:V,events:H,viewport:$}=(0,s.useThree)(),[k]=a.useState(()=>document.createElement(U)),G=a.useRef(null),q=a.useRef(null),K=a.useRef(0),X=a.useRef([0,0]),Z=a.useRef(null),Q=a.useRef(null),Y=(null==b?void 0:b.current)||H.connected||W.domElement.parentNode,J=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return A&&"blending"!==A||Array.isArray(A)&&A.length&&(e=A[0])&&"object"==typeof e&&"current"in e},[A]);a.useLayoutEffect(()=>{let e=W.domElement;A&&"blending"===A?(e.style.zIndex=`${Math.floor(L[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[A]),a.useLayoutEffect(()=>{if(q.current){let e=G.current=n.createRoot(k);if(O.updateMatrixWorld(),E)k.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=C(q.current,j,N);k.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Y&&(y?Y.prepend(k):Y.appendChild(k)),()=>{Y&&Y.removeChild(k),e.unmount()}}},[Y,E]),a.useLayoutEffect(()=>{D&&(k.className=D)},[D]);let er=a.useMemo(()=>E?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...w&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...r},[r,x,w,N,E]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:B}),[B]);a.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=G.current)||t.render(a.createElement("div",{ref:Z,style:er},a.createElement("div",{ref:Q,style:ei},a.createElement("div",{ref:R,className:m,style:r,children:e})))):null==(i=G.current)||i.render(a.createElement("div",{ref:R,style:er,className:m,children:e}))});let ea=a.useRef(!0);(0,l.useFrame)(e=>{if(q.current){j.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:C(q.current,j,N);if(E||Math.abs(K.current-j.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var r;let t,i,a,n,s=(r=q.current,t=c.setFromMatrixPosition(r.matrixWorld),i=u.setFromMatrixPosition(j.matrixWorld),a=t.sub(i),n=j.getWorldDirection(d),a.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(A)?l=A.map(e=>e.current):"blending"!==A&&(l=[O]));let h=ea.current;l?ea.current=function(e,t,r,i){let a=c.setFromMatrixPosition(e.matrixWorld),n=a.clone();n.project(t),f.set(n.x,n.y),r.setFromCamera(f,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return a.distanceTo(r.ray.origin)<e}return!0}(q.current,j,V,l)&&!s:ea.current=!s,h!==ea.current&&(_?_(!ea.current):k.style.display=ea.current?"block":"none");let m=Math.floor(L[0]/2),y=A?et?[L[0],m]:[m-1,0]:L;if(k.style.zIndex=`${function(e,t,r){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=c.setFromMatrixPosition(e.matrixWorld),a=u.setFromMatrixPosition(t.matrixWorld),n=i.distanceTo(a),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*n+s)}}(q.current,j,y)}`,E){let[e,t]=[N.width/2,N.height/2],r=j.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:a,left:n,bottom:o,right:s}=j,l=v(j.matrixWorldInverse),c=i?`scale(${r})translate(${p(-(s+n)/2)}px,${p((a+o)/2)}px)`:`translateZ(${r}px)`,u=q.current.matrixWorld;M&&((u=j.matrixWorldInverse.clone().transpose().copyPosition(u).scale(q.current.scale)).elements[3]=u.elements[7]=u.elements[11]=0,u.elements[15]=1),k.style.width=N.width+"px",k.style.height=N.height+"px",k.style.perspective=i?"":`${r}px`,Z.current&&Q.current&&(Z.current.style.transform=`${c}${l}translate(${e}px,${t}px)`,Q.current.style.transform=g(u,1/((S||10)/400)))}else{let t=void 0===S?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let r=c.setFromMatrixPosition(e.matrixWorld),i=u.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(q.current,j)*S;k.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=j.zoom}}if(!et&&J.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=j;if(t||T)I.scale&&(Array.isArray(I.scale)?I.scale instanceof o.Vector3?J.current.scale.copy(I.scale.clone().divideScalar(1)):J.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):J.current.scale.setScalar(1/I.scale));else{let t=(S||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;J.current.scale.set(r,i,1)}ee.current=!0}}}else{let t=k.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/$.factor,r=t.clientWidth*e,i=t.clientHeight*e;J.current.scale.set(r,i,1),ee.current=!0}J.current.lookAt(e.camera.position)}});let en=a.useMemo(()=>({vertexShader:E?void 0:`
|
|
74
|
+
`;e.s(["FIELD_GLSL",0,o,"NOISE_GLSL",0,n,"useFieldTexture",0,(e,n,o=a)=>{let s=(0,t.useMemo)(()=>{let e=new r.DataTexture(new Uint8Array(16384),64,64,r.RGBAFormat);return e.magFilter=r.LinearFilter,e.minFilter=r.LinearFilter,e.wrapS=r.ClampToEdgeWrapping,e.wrapT=r.ClampToEdgeWrapping,e},[]);return(0,t.useEffect)(()=>{if(!e)return;let t=s.image.data,r=e.half??i.HALF_EXTENT_M;for(let a=0;a<64;a++)for(let s=0;s<64;s++){let l=(0,i.sampleWind)(e,(s/63*2-1)*r,(a/63*2-1)*r,n),c=(64*a+s)*4;t[c]=Math.round(255*Math.min(1,Math.max(0,.5+l.u/(2*o)))),t[c+1]=Math.round(255*Math.min(1,Math.max(0,.5+l.v/(2*o)))),t[c+2]=0,t[c+3]=255}s.needsUpdate=!0},[s,e,n,o]),(0,t.useEffect)(()=>()=>s.dispose(),[s]),s}])},88608,e=>{"use strict";let t=0,r=new Set,i={},a=new Set;e.s(["getForecastHour",0,()=>t,"getSeries",0,()=>i,"setForecastHour",0,e=>{t=Math.max(0,e),r.forEach(e=>e(t))},"setSeries",0,(e,t)=>{i={...i,[e]:t},a.forEach(e=>e(i))},"subscribeForecast",0,e=>(r.add(e),()=>r.delete(e)),"subscribeSeries",0,e=>(a.add(e),()=>a.delete(e))])},18032,e=>{"use strict";var t=e.i(90072);e.s(["markerLattice",0,({cx:e,cy:t,radius:r,step:i,near:a,originE:n=0,originN:o=0,max:s=60})=>{let l=[],c=Math.ceil((n-r)/i),u=Math.floor((n+r)/i),d=Math.ceil((o-r)/i),f=Math.floor((o+r)/i);for(let s=c;s<=u;s++)for(let c=d;c<=f;c++){let u=s*i,d=c*i;if(Math.hypot(u-n,d-o)>r)continue;let f=Math.hypot(u-e,d-t),h=f<=a?0:Math.ceil(Math.log2(f/a)),p=2**h;s%p==0&&c%p==0&&l.push({e:u,n:d,d:f})}return l.sort((e,t)=>e.d-t.d).slice(0,s)},"onScreenTest",0,(e,r,i,a=.9,n=60)=>{let o=new t.Vector3;e.updateWorldMatrix(!0,!1);let s=i.getBoundingClientRect(),l="u"<typeof document?[]:[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);return(t,i,c)=>{if(o.set(t,i,c),e.localToWorld(o).project(r),o.z>=1||Math.abs(o.x)>a||Math.abs(o.y)>a)return!1;let u=s.left+(o.x+1)/2*s.width,d=s.top+(1-o.y)/2*s.height;return!l.some(e=>u>e.left-n&&u<e.right+n&&d>e.top-n&&d<e.bottom+n)}},"sameMarkers",0,(e,t)=>e.length===t.length&&e.every((e,r)=>{let i=t[r];return e.key===i.key&&.005>Math.abs(e.speed-i.speed)&&Math.sign(Math.round(20*e.trend))===Math.sign(Math.round(20*i.trend))&&.001>Math.abs(e.len-i.len)&&e.x===i.x&&e.y===i.y})])},54735,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(33227),a=e.i(88608),n=e.i(3666),o=e.i(54983),s=e.i(18032),l=e.i(58567);let c=["navigation.position","environment.current"];e.s(["CURRENT_ARROW_WIDTH",0,.028,"DEFAULT_CURRENT_MAP",0,"thermal","currentMarkers",0,({field:e,hour:t,top:r,mapName:i,refE:a,refN:c,cx:u,cy:d,heightM:f,scale:h,radius:p,z:m,isWater:v=()=>!0,onScreen:y=()=>!0})=>{let g=Math.min(400,Math.max(25,5*Math.round(.9*f/5))),x="pi"===(0,l.getRenderProfile)().id?20:40,w=(0,s.markerLattice)({cx:u,cy:d,radius:p,step:g,near:3*g,originE:a,originN:c,max:400}),b=[];return w.forEach(({e:s,n:l})=>{if(b.length>=x||15>Math.hypot(s-a,l-c))return;let u=(s-a)*h,d=(l-c)*h;if(!y(u,d,m)||!v(u,d))return;let f=(0,n.sampleWind)(e,s,l,t),p=Math.hypot(f.u,f.v);if(p<.005)return;let g=(0,n.sampleWind)(e,s,l,t+1),w=Math.min(1,p/r),[S,M,E]=(0,o.colorAt)(i,.28+.72*w);b.push({key:`${s},${l}`,x:u,y:d,z:m,u:f.u,v:f.v,speed:p,trend:Math.hypot(g.u,g.v)-p,color:[S/255,M/255,E/255],len:.16*(.4+.6*w)})}),b},"useCurrentField",0,()=>{let e=(0,r.useSignalKPaths)(c),o=e["navigation.position"],s=e["environment.current"],l=(0,t.useSyncExternalStore)(a.subscribeForecast,a.getForecastHour,a.getForecastHour),[u,d]=(0,t.useState)(null),[f,h]=(0,t.useState)(1),p=o?.latitude,m=o?.longitude,v=Number.isFinite(p)?`${p.toFixed(1)},${m.toFixed(1)}`:null;(0,t.useEffect)(()=>{if(!v)return;let e=!1,[t,r]=v.split(",").map(Number);return(0,i.fetchCurrentField)(t,r).then(t=>{e||d(t)}).catch(()=>{!e&&Number.isFinite(s?.drift)&&Number.isFinite(s?.setTrue)&&d((0,i.uniformCurrent)(t,r,s.drift,s.setTrue))}),()=>{e=!0}},[v]),(0,t.useEffect)(()=>{h((0,i.setCurrentScale)(u)??1)},[u]),(0,t.useEffect)(()=>()=>(0,i.setCurrentScale)(null),[]);let y=Number.isFinite(p)?Math.round(100*p):null,g=Number.isFinite(m)?Math.round(100*m):null;return(0,t.useEffect)(()=>{if(!u||null===y)return;let e=(m-u.origin.lon)*Math.PI/180*6371e3*Math.cos(u.origin.lat*Math.PI/180),t=(p-u.origin.lat)*Math.PI/180*6371e3,r=Array.from({length:u.hours},(r,i)=>{let a=(0,n.sampleWind)(u,e,t,i);return Math.hypot(a.u,a.v)});return(0,a.setSeries)("current",{start:u.start,values:r,top:u.max}),()=>(0,a.setSeries)("current",null)},[u,y,g]),{field:u,hour:l,top:f,lat:p,lon:m}}])},3666,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=(e,t,r,i)=>({lat:e+(i/8*2-1)*4e4/6371e3*180/Math.PI,lon:t+(r/8*2-1)*4e4/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),a=(e,t)=>{let r=[],a=[];for(let n=0;n<9;n++)for(let o=0;o<9;o++){let s=i(e,t,o,n);r.push(s.lat.toFixed(4)),a.push(s.lon.toFixed(4))}return`https://api.open-meteo.com/v1/forecast?latitude=${r.join(",")}&longitude=${a.join(",")}&hourly=wind_speed_10m,wind_direction_10m&wind_speed_unit=ms&forecast_hours=48&timezone=GMT`},n=async(e,i)=>{let n=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===n&&Date.now()-r.at<18e5)return r.field;let o=a(e,i),s=await (0,t.cachedFetch)(o,{kind:"forecast"});if(!s.ok)throw Error(`Open-Meteo ${s.status}`);let l=await s.json(),c=Array.isArray(l)?l:[l],u=c[0]?.hourly?.time||[],d=u.length,f=[],h=[];for(let e=0;e<d;e++){let t=new Float32Array(81),r=new Float32Array(81);c.forEach((i,a)=>{let n=i.hourly.wind_speed_10m[e]??0,o=(i.hourly.wind_direction_10m[e]??0)*Math.PI/180;t[a]=-n*Math.sin(o),r[a]=-n*Math.cos(o)}),f.push(t),h.push(r)}let p={origin:{lat:e,lon:i},start:Date.parse(`${u[0]}Z`),hours:d,u:f,v:h,source:"open-meteo"};return r={key:n,at:Date.now(),field:p},p},o=[[0,[98,113,183]],[1,[57,97,159]],[3,[74,148,169]],[5,[77,141,123]],[7,[83,165,83]],[9,[53,159,53]],[11,[167,157,81]],[13,[159,127,58]],[15,[161,108,92]],[17,[129,58,78]],[19,[175,80,136]],[21,[117,74,147]],[24,[109,97,163]],[27,[68,105,141]],[29,[92,144,152]],[36,[125,68,165]]];e.s(["HALF_EXTENT_M",0,4e4,"WINDY_SCALE",0,o,"fetchWindField",0,n,"sampleWind",0,(e,t,r,i=0)=>{let a=e.grid??9,n=e.half??4e4,o=Math.min(a-1.001,Math.max(0,(t/n+1)/2*(a-1))),s=Math.min(a-1.001,Math.max(0,(r/n+1)/2*(a-1))),l=Math.floor(o),c=Math.floor(s),u=o-l,d=s-c,f=Math.min(e.hours-1,Math.max(0,Math.floor(i))),h=Math.min(e.hours-1,f+1),p=Math.min(1,Math.max(0,i-f)),m=(e,t)=>{let r=e[t],i=c*a+l;return(r[i]*(1-u)+r[i+1]*u)*(1-d)+(r[i+a]*(1-u)+r[i+a+1]*u)*d};return{u:m(e.u,f)*(1-p)+m(e.u,h)*p,v:m(e.v,f)*(1-p)+m(e.v,h)*p}},"uniformField",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(-r*Math.sin(i)),n=new Float32Array(81).fill(-r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,u:[a],v:[n],source:"boat"}},"windColor",0,e=>{if(e<=o[0][0])return o[0][1];for(let t=1;t<o.length;t++)if(e<=o[t][0]){let[r,i]=o[t-1],[a,n]=o[t],s=(e-r)/(a-r);return i.map((e,t)=>e+(n[t]-e)*s)}return o[o.length-1][1]},"windFieldUrl",0,a])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},58567,e=>{"use strict";let t;var r=e.i(83402);let i=/v3d|videocore|llvmpipe|swiftshader/i,a=/android|iphone|ipad|ipod|mobile/i;e.s(["RENDER_QUALITIES",0,["auto","high","pi"],"getRenderProfile",0,()=>{let e=r.default.get("renderQuality")||"auto";return"pi"===e||"auto"===e&&(()=>{if("u"<typeof navigator)return!1;if(i.test((()=>{if(void 0!==t)return t;t="";try{let e=document.createElement("canvas").getContext("webgl"),r=e?.getExtension("WEBGL_debug_renderer_info");t=String(e?.getParameter(r?r.UNMASKED_RENDERER_WEBGL:e.RENDERER)||""),e?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}return t})()))return!0;if(a.test(navigator.userAgent)||navigator.maxTouchPoints>1&&/Macintosh/.test(navigator.userAgent))return!1;if(/aarch64|armv7|armv8|arm64|raspbian|raspberry/i.test(navigator.userAgent))return!0;let e=navigator.hardwareConcurrency||8,r=navigator.deviceMemory||8;return e<=4&&r<=4})()?{id:"pi",fps:30,dpr:.75,antialias:!1}:{id:"high",fps:60,dpr:Math.min(window.devicePixelRatio||1,2.5),antialias:!0}}])},3950,e=>{"use strict";let t="ocearo-offline-v2",r=["ocearo-offline-v1"],i=!1,a=async(e,{kind:a="tile"}={})=>{if(!("u">typeof caches))return fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"});i||(i=!0,r.forEach(e=>caches.delete(e).catch(()=>{})));let n=await caches.open(t);if("tile"===a){let t=await n.match(e);if(t)return t}try{let t=await fetch(e,{mode:"cors",referrerPolicy:"strict-origin-when-cross-origin"});if(t.ok)await n.put(e,t.clone());else{let t=await n.match(e);if(t)return t}return t}catch(r){let t=await n.match(e);if(t)return t;throw r}},n=async e=>{let t=await a(e,{kind:"tile"});if(!t.ok)throw Error(`${t.status} ${e}`);return createImageBitmap(await t.blob())},o=(e,t,r,i)=>{if(e.includes("{bbox}")){let a=40075016.68557849/2**t,n=-20037508.342789244+r*a,o=20037508.342789244-i*a,s=[n,o-a,n+a,o].map(e=>e.toFixed(2)).join(",");return e.replace("{bbox}",s)}return e.replace("{z}",t).replace("{x}",r).replace("{y}",i)},s=(e,t,r,i)=>{let a=2**i,n=(e,t)=>({x:Math.floor((t+180)/360*a),y:Math.floor((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*a)}),o=r/111320,s=r/(111320*Math.cos(e*Math.PI/180)),l=n(e+o,t-s),c=n(e-o,t+s),u=[];for(let e=l.x;e<=c.x;e++)for(let t=l.y;t<=c.y;t++)u.push({z:i,x:e,y:t});return u},l=async({lat:e,lon:t,radiusM:r,layers:i,urls:n=[],onProgress:l})=>{let c=[];for(let{template:a,zooms:n}of i)for(let i of n)for(let n of s(e,t,r,i))c.push(o(a,n.z,n.x,n.y));c.push(...n);let u=0,d=0,f=[...c],h=async()=>{for(;f.length;){let e=f.shift();try{!(await a(e,{kind:e.includes("forecast")?"forecast":"tile"})).ok&&d++}catch{d++}u++,l?.(u,c.length,d)}};return await Promise.all(Array.from({length:4},h)),{done:u,failed:d,total:c.length}},c=async()=>{if(navigator.storage?.estimate){let{usage:e}=await navigator.storage.estimate();return e}return null},u=async(e,r)=>{if(!("u">typeof caches))return!1;let i=await caches.open(t);return await i.put(e,r),!0},d=async e=>{if(!("u">typeof caches))return null;let r=await caches.open(t);return await r.match(e)||null};e.s(["cachedFetch",0,a,"cachedImage",0,n,"clearOfflineCache",0,()=>"u">typeof caches?caches.delete(t):Promise.resolve(!1),"offlineCacheSize",0,c,"prefetchArea",0,l,"readCached",0,d,"storeCached",0,u,"tileUrl",0,o])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,r;var i=e.i(31067),a=e.i(71645),n=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let c=new o.Vector3,u=new o.Vector3,d=new o.Vector3,f=new o.Vector2;function h(e,t,r){let i=c.setFromMatrixPosition(e.matrixWorld);i.project(t);let a=r.width/2,n=r.height/2;return[i.x*a+a,-(i.y*n)+n]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),y=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,r(t),"translate(-50%,-50%)")),g=a.forwardRef(({children:e,eps:t=.001,style:r,className:m,prepend:g,center:x,fullscreen:w,portal:b,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:A,onOcclude:_,castShadow:F,receiveShadow:P,material:z,geometry:T,zIndexRange:L=[0x1000037,0],calculatePosition:C=h,as:U="div",wrapperClass:D,pointerEvents:B="auto",...I},R)=>{let{gl:W,camera:j,scene:O,size:N,raycaster:V,events:H,viewport:$}=(0,s.useThree)(),[k]=a.useState(()=>document.createElement(U)),G=a.useRef(null),q=a.useRef(null),K=a.useRef(0),X=a.useRef([0,0]),Z=a.useRef(null),Q=a.useRef(null),Y=(null==b?void 0:b.current)||H.connected||W.domElement.parentNode,J=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return A&&"blending"!==A||Array.isArray(A)&&A.length&&(e=A[0])&&"object"==typeof e&&"current"in e},[A]);a.useLayoutEffect(()=>{let e=W.domElement;A&&"blending"===A?(e.style.zIndex=`${Math.floor(L[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[A]),a.useLayoutEffect(()=>{if(q.current){let e=G.current=n.createRoot(k);if(O.updateMatrixWorld(),E)k.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=C(q.current,j,N);k.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Y&&(g?Y.prepend(k):Y.appendChild(k)),()=>{Y&&Y.removeChild(k),e.unmount()}}},[Y,E]),a.useLayoutEffect(()=>{D&&(k.className=D)},[D]);let er=a.useMemo(()=>E?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...w&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...r},[r,x,w,N,E]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:B}),[B]);a.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=G.current)||t.render(a.createElement("div",{ref:Z,style:er},a.createElement("div",{ref:Q,style:ei},a.createElement("div",{ref:R,className:m,style:r,children:e})))):null==(i=G.current)||i.render(a.createElement("div",{ref:R,style:er,className:m,children:e}))});let ea=a.useRef(!0);(0,l.useFrame)(e=>{if(q.current){j.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:C(q.current,j,N);if(E||Math.abs(K.current-j.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var r;let t,i,a,n,s=(r=q.current,t=c.setFromMatrixPosition(r.matrixWorld),i=u.setFromMatrixPosition(j.matrixWorld),a=t.sub(i),n=j.getWorldDirection(d),a.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(A)?l=A.map(e=>e.current):"blending"!==A&&(l=[O]));let h=ea.current;l?ea.current=function(e,t,r,i){let a=c.setFromMatrixPosition(e.matrixWorld),n=a.clone();n.project(t),f.set(n.x,n.y),r.setFromCamera(f,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return a.distanceTo(r.ray.origin)<e}return!0}(q.current,j,V,l)&&!s:ea.current=!s,h!==ea.current&&(_?_(!ea.current):k.style.display=ea.current?"block":"none");let m=Math.floor(L[0]/2),g=A?et?[L[0],m]:[m-1,0]:L;if(k.style.zIndex=`${function(e,t,r){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=c.setFromMatrixPosition(e.matrixWorld),a=u.setFromMatrixPosition(t.matrixWorld),n=i.distanceTo(a),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*n+s)}}(q.current,j,g)}`,E){let[e,t]=[N.width/2,N.height/2],r=j.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:a,left:n,bottom:o,right:s}=j,l=v(j.matrixWorldInverse),c=i?`scale(${r})translate(${p(-(s+n)/2)}px,${p((a+o)/2)}px)`:`translateZ(${r}px)`,u=q.current.matrixWorld;M&&((u=j.matrixWorldInverse.clone().transpose().copyPosition(u).scale(q.current.scale)).elements[3]=u.elements[7]=u.elements[11]=0,u.elements[15]=1),k.style.width=N.width+"px",k.style.height=N.height+"px",k.style.perspective=i?"":`${r}px`,Z.current&&Q.current&&(Z.current.style.transform=`${c}${l}translate(${e}px,${t}px)`,Q.current.style.transform=y(u,1/((S||10)/400)))}else{let t=void 0===S?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let r=c.setFromMatrixPosition(e.matrixWorld),i=u.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(q.current,j)*S;k.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=j.zoom}}if(!et&&J.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=j;if(t||T)I.scale&&(Array.isArray(I.scale)?I.scale instanceof o.Vector3?J.current.scale.copy(I.scale.clone().divideScalar(1)):J.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):J.current.scale.setScalar(1/I.scale));else{let t=(S||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;J.current.scale.set(r,i,1)}ee.current=!0}}}else{let t=k.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/$.factor,r=t.clientWidth*e,i=t.clientHeight*e;J.current.scale.set(r,i,1),ee.current=!0}J.current.lookAt(e.camera.position)}});let en=a.useMemo(()=>({vertexShader:E?void 0:`
|
|
75
75
|
/*
|
|
76
76
|
This shader is from the THREE's SpriteMaterial.
|
|
77
77
|
We need to turn the backing plane into a Sprite
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
void main() {
|
|
109
109
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
110
110
|
}
|
|
111
|
-
`}),[E]);return a.createElement("group",(0,i.default)({},I,{ref:q}),A&&!et&&a.createElement("mesh",{castShadow:F,receiveShadow:P,ref:J},T||a.createElement("planeGeometry",null),z||a.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",0,
|
|
111
|
+
`}),[E]);return a.createElement("group",(0,i.default)({},I,{ref:q}),A&&!et&&a.createElement("mesh",{castShadow:F,receiveShadow:P,ref:J},T||a.createElement("planeGeometry",null),z||a.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:en.vertexShader,fragmentShader:en.fragmentShader})))});e.s(["Html",0,g])},95393,e=>{"use strict";var t=e.i(61949);e.s(["useFrame",()=>t.F])},92923,30728,27530,e=>{"use strict";let t,r;var i=e.i(90072),a=i;let n=new a.Box3,o=new a.Vector3;class s extends a.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 a.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 a.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,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.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 r=new a.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new a.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new a.InterleavedBufferAttribute(r,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 r=new a.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new a.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new a.InterleavedBufferAttribute(r,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 a.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 a.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let a=0,n=e.count;a<n;a++)o.fromBufferAttribute(e,a),i=Math.max(i,r.distanceToSquared(o)),o.fromBufferAttribute(t,a),i=Math.max(i,r.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(i),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,s],30728);var l=e.i(8560),c=i;l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:c.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
112
112
|
#include <common>
|
|
113
113
|
#include <color_pars_vertex>
|
|
114
114
|
#include <fog_pars_vertex>
|
|
@@ -500,4 +500,4 @@
|
|
|
500
500
|
#include <premultiplied_alpha_fragment>
|
|
501
501
|
|
|
502
502
|
}
|
|
503
|
-
`};class u extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.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 d=new i.Vector4,f=new i.Vector3,h=new i.Vector3,p=new i.Vector4,m=new i.Vector4,v=new i.Vector4,
|
|
503
|
+
`};class u extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.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 d=new i.Vector4,f=new i.Vector3,h=new i.Vector3,p=new i.Vector4,m=new i.Vector4,v=new i.Vector4,y=new i.Vector3,g=new i.Matrix4,x=new i.Line3,w=new i.Vector3,b=new i.Box3,S=new i.Sphere,M=new i.Vector4;function E(e,t,i){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=r/i.width,M.y=r/i.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class A extends i.Mesh{constructor(e=new s,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,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count);for(let e=0,i=0,n=t.count;e<n;e++,i+=2)f.fromBufferAttribute(t,e),h.fromBufferAttribute(r,e),a[i]=0===i?0:a[i-1],a[i+1]=a[i]+f.distanceTo(h);let n=new i.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(n,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(n,1,1)),this}raycast(e,a){let n,o,s=this.material.worldUnits,l=e.camera;if(null!==l||s||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===s&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let c=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let u=this.matrixWorld,d=this.geometry,f=this.material;if(r=f.linewidth+c,null===d.boundingSphere&&d.computeBoundingSphere(),S.copy(d.boundingSphere).applyMatrix4(u),s)n=.5*r;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));n=E(l,e,f.resolution)}if(S.radius+=n,!1!==t.intersectsSphere(S)){if(null===d.boundingBox&&d.computeBoundingBox(),b.copy(d.boundingBox).applyMatrix4(u),s)o=.5*r;else{let e=Math.max(l.near,b.distanceToPoint(t.origin));o=E(l,e,f.resolution)}b.expandByScalar(o),!1!==t.intersectsBox(b)&&(s?function(e,a){let n=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,l=o.attributes.instanceEnd,c=Math.min(o.instanceCount,s.count);for(let o=0;o<c;o++){x.start.fromBufferAttribute(s,o),x.end.fromBufferAttribute(l,o),x.applyMatrix4(n);let c=new i.Vector3,u=new i.Vector3;t.distanceSqToSegment(x.start,x.end,u,c),u.distanceTo(c)<.5*r&&a.push({point:u,pointOnLine:c,distance:t.origin.distanceTo(u),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,a):function(e,a,n){let o=a.projectionMatrix,s=e.material.resolution,l=e.matrixWorld,c=e.geometry,u=c.attributes.instanceStart,d=c.attributes.instanceEnd,f=Math.min(c.instanceCount,u.count),h=-a.near;t.at(1,v),v.w=1,v.applyMatrix4(a.matrixWorldInverse),v.applyMatrix4(o),v.multiplyScalar(1/v.w),v.x*=s.x/2,v.y*=s.y/2,v.z=0,y.copy(v),g.multiplyMatrices(a.matrixWorldInverse,l);for(let a=0;a<f;a++){if(p.fromBufferAttribute(u,a),m.fromBufferAttribute(d,a),p.w=1,m.w=1,p.applyMatrix4(g),m.applyMatrix4(g),p.z>h&&m.z>h)continue;if(p.z>h){let e=p.z-m.z,t=(p.z-h)/e;p.lerp(m,t)}else if(m.z>h){let e=m.z-p.z,t=(m.z-h)/e;m.lerp(p,t)}p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w),p.x*=s.x/2,p.y*=s.y/2,m.x*=s.x/2,m.y*=s.y/2,x.start.copy(p),x.start.z=0,x.end.copy(m),x.end.z=0;let c=x.closestPointToPointParameter(y,!0);x.at(c,w);let f=i.MathUtils.lerp(p.z,m.z,c),v=f>=-1&&f<=1,b=y.distanceTo(w)<.5*r;if(v&&b){x.start.fromBufferAttribute(u,a),x.end.fromBufferAttribute(d,a),x.start.applyMatrix4(l),x.end.applyMatrix4(l);let r=new i.Vector3,o=new i.Vector3;t.distanceSqToSegment(x.start,x.end,o,r),n.push({point:o,pointOnLine:r,distance:t.origin.distanceTo(o),object:e,face:null,faceIndex:a,uv:null,uv1:null})}}}(this,l,a))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(d),this.material.uniforms.resolution.value.set(d.z,d.w))}}e.s(["LineSegments2",0,A],92923)},52822,(e,t,r)=>{"use strict";var i=e.r(71645),a=e.r(2239),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=a.useSyncExternalStore,s=i.useRef,l=i.useEffect,c=i.useMemo,u=i.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,i,a){var d=s(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var h=o(e,(d=c(function(){function e(e){if(!l){if(l=!0,o=e,e=i(e),void 0!==a&&f.hasValue){var t=f.value;if(a(t,e))return s=t}return s=e}if(t=s,n(o,e))return t;var r=i(e);return void 0!==a&&a(t,r)?(o=e,t):(o=e,s=r)}var o,s,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,i,a]))[0],d[1]);return l(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}},30224,(e,t,r)=>{"use strict";e.i(47167),t.exports=e.r(52822)}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78461,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(67561);let a=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],n=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,i.useOcearoContext)(),o=(0,r.useSignalKPaths)(a),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),c=o["navigation.position"],
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78461,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(67561);let a=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],n=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,i.useOcearoContext)(),o=(0,r.useSignalKPaths)(a),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),c=o["navigation.position"],d=Number.isFinite(c?.latitude)&&Number.isFinite(c?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!d)return{x:0,y:0};let t={lat:c.latitude,lon:c.longitude};return e(t,(n||(n=t),n))},[c,d,e]),hasFix:d,hasHeading:l}},"getSessionOrigin",0,()=>n])},30997,e=>{"use strict";var t=e.i(71645);let r=new Set,i=null,a=()=>{let e=[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()),t=[];r.forEach(r=>{let i=r.current;if(!i)return;let a=i.getBoundingClientRect(),n=e.some(e=>a.left<e.right&&a.right>e.left&&a.top<e.bottom&&a.bottom>e.top)?"hidden":"visible";i.style.visibility!==n&&t.push([i,n])}),t.forEach(([e,t])=>{e.style.visibility=t})};e.s(["default",0,e=>{(0,t.useEffect)(()=>(r.add(e),i||(i=setInterval(a,250)),a(),()=>{r.delete(e),r.size||(clearInterval(i),i=null)}),[e])}])},93116,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(95393),a=e.i(90072);let n=`
|
|
2
2
|
attribute vec3 aBase;
|
|
3
3
|
attribute vec2 aDir;
|
|
4
4
|
attribute vec3 aColor;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
gl_FragColor = vec4(vColor, vAlpha * uOpacity);
|
|
41
41
|
#include <colorspace_fragment>
|
|
42
42
|
}
|
|
43
|
-
`;e.s(["default",0,({items:e,width:s,travel:l=0,pace:c=0,opacity:
|
|
43
|
+
`;e.s(["default",0,({items:e,width:s,travel:l=0,pace:c=0,opacity:d=.9,fadeNear:u=0,still:f=!1,screen:h=0,renderOrder:p=3})=>{let{geometry:m,material:v}=(0,r.useMemo)(()=>{let e,t=((e=new a.Shape).moveTo(-.16,-.5),e.lineTo(.16,-.5),e.lineTo(.16,.08),e.lineTo(.5,.08),e.lineTo(0,.5),e.lineTo(-.5,.08),e.lineTo(-.16,.08),e.closePath(),new a.ShapeGeometry(e)),r=new a.InstancedBufferGeometry;r.index=t.index,r.setAttribute("position",t.attributes.position),r.setAttribute("aBase",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aDir",new a.InstancedBufferAttribute(new Float32Array(800),2)),r.setAttribute("aColor",new a.InstancedBufferAttribute(new Float32Array(1200),3)),r.setAttribute("aLenSpeed",new a.InstancedBufferAttribute(new Float32Array(800),2));let i=new Float32Array(400);for(let e=0;e<400;e++)i[e]=.618034*e%1;return r.setAttribute("aSeed",new a.InstancedBufferAttribute(i,1)),r.instanceCount=0,{geometry:r,material:new a.ShaderMaterial({uniforms:{uCam:{value:new a.Vector3},uTime:{value:0},uWidth:{value:1},uTravel:{value:1},uPace:{value:1},uOpacity:{value:d},uFadeNear:{value:0},uStill:{value:0},uScreen:{value:0}},vertexShader:n,fragmentShader:o,transparent:!0,depthWrite:!1,side:a.DoubleSide})}},[]);(0,r.useEffect)(()=>()=>{m.dispose(),v.dispose()},[m,v]),(0,r.useEffect)(()=>{let t=Math.min(e.length,400),r=m.attributes;for(let i=0;i<t;i++){let t=e[i];r.aBase.array.set([t.x,t.y,t.z],3*i),r.aDir.array.set([t.u,t.v],2*i),r.aColor.array.set(t.color,3*i),r.aLenSpeed.array.set([t.len,t.speed],2*i)}["aBase","aDir","aColor","aLenSpeed"].forEach(e=>{r[e].needsUpdate=!0}),m.instanceCount=t},[m,e]),(0,r.useEffect)(()=>{let e=v.uniforms;e.uWidth.value=s,e.uTravel.value=l,e.uPace.value=c,e.uOpacity.value=d,e.uFadeNear.value=u,e.uStill.value=+!!f,e.uScreen.value=h},[v,s,l,c,d,u,f,h]);let y=(0,r.useRef)(),g=(0,r.useMemo)(()=>new a.Vector3,[]);return(0,i.useFrame)(({camera:e,clock:t})=>{y.current&&(y.current.updateWorldMatrix(!0,!1),v.uniforms.uCam.value.copy(y.current.worldToLocal(g.copy(e.position))),v.uniforms.uTime.value=t.elapsedTime)}),(0,t.jsx)("mesh",{ref:y,geometry:m,material:v,frustumCulled:!1,renderOrder:p})}])},78311,e=>{"use strict";var t=e.i(43476),r=e.i(71645),i=e.i(60099);e.i(85269);var a=e.i(22831),n=e.i(93116),o=e.i(30997);let s=[.86,.22,.2],l=[.16,.48,.86],c=({children:e})=>{let i=(0,r.useRef)(null);return(0,o.default)(i),(0,t.jsx)("div",{ref:i,style:{transform:"translateY(-1.1rem)"},children:e})};e.s(["default",0,({items:e,width:o,screen:d=0,fadeNear:u=0,format:f=e=>e.toFixed(1),slackLabel:h="slack",maxLabels:p=12,renderOrder:m=3})=>{let{t:v}=(0,a.useTranslation)(),{borders:y,fills:g}=(0,r.useMemo)(()=>{let t=e.filter(e=>e.speed>=.051444457477040344);return{borders:t.map(e=>({...e,len:e.len+.5*o,color:e.trend>.05?s:e.trend<-.05?l:[.06,.09,.12]})),fills:t}},[e,o]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.default,{items:y,width:1.35*o,screen:d,still:!0,fadeNear:u,opacity:.95,renderOrder:m}),(0,t.jsx)(n.default,{items:g,width:o,screen:d,still:!0,fadeNear:u,opacity:.95,renderOrder:m+1}),e.slice(0,p).map(e=>{let r=e.speed<.051444457477040344;return(0,t.jsx)(i.Html,{position:[e.x,e.y,e.z],center:!0,zIndexRange:[4,0],style:{pointerEvents:"none"},children:(0,t.jsx)(c,{children:r?(0,t.jsx)("div",{className:"rounded-md border-2 border-oBlue bg-hud-bg/80 px-1.5 text-caption font-semibold uppercase tracking-wide text-hud-main whitespace-nowrap",children:v(`meteo.${h}`)}):(0,t.jsx)("div",{className:"rounded px-1 text-caption font-bold tabular-nums leading-tight whitespace-nowrap",style:{color:"#fff",background:"rgba(10, 16, 22, 0.72)"},children:f(1.943844*e.speed)})})},e.key)})]})}])},54983,e=>{"use strict";var t=e.i(90072);let r={thermal:.28,magma:.3,dense:.15,deep:0,haline:.1,turbo:.08},i=e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)],a=Object.fromEntries(Object.entries({speed:["#fffdcd","#f4eaab","#e9d889","#dbc866","#c9ba45","#b2af28","#98a512","#7c9c06","#5f920c","#448818","#287c23","#126e2a","#0b602d","#11512c","#174127","#19321e","#172313"],thermal:["#042333","#082e54","#19337c","#39339e","#563b9c","#6d4694","#83508f","#995889","#b15f82","#c76676","#de7065","#ef7e52","#f99242","#fcaa3c","#f9c441","#f3df4c","#e8fa5b"],haline:["#2a186c","#2e1d93","#2034a2","#0f4a98","#0f5b90","#1c6a8c","#297789","#338588","#3c9387","#44a184","#4faf7e","#5fbe75","#78cb68","#9bd55c","#c1dd64","#e1e57c","#fdef9a"],deep:["#fdfecc","#ddf2ba","#bbe6ac","#98daa4","#78cea3","#62bfa4","#55aea3","#4e9ea1","#488e9e","#437f9a","#3f6f97","#3e5f93","#404d8c","#413e76","#3b325c","#322643","#281a2c"],ice:["#040613","#13132a","#212041","#2e2c5a","#383975","#3e478f","#3f57a3","#3e69b0","#427bb7","#4b8bbd","#579cc3","#67adc9","#79bed0","#92ced7","#afdde1","#cdecef","#eafdfd"],dense:["#e6f1f1","#cbe4e8","#b1d6e3","#9ac8e2","#86b9e3","#79a9e4","#7397e4","#7584df","#7871d5","#7960c7","#784eb3","#753d9d","#6f2e85","#66216c","#5a1851","#491238","#360e24"],magma:["#000004","#0a0822","#1d1147","#36106b","#51127c","#6a1c81","#832681","#9c2e7f","#b73779","#cf4070","#e55064","#f4695c","#fb8761","#fea571","#fec287","#fde0a1","#fcfdbf"],viridis:["#440154","#48186a","#472d7b","#424086","#3b528b","#33638d","#2c728e","#26828e","#21918c","#1f9f88","#27ad81","#3dbc74","#5cc863","#81d34d","#aadc32","#d5e21a","#fde725"],turbo:["#30123b","#4040a2","#466be3","#4294ff","#28bceb","#18ddc2","#32f298","#6dfe62","#a4fc3c","#cbed34","#ecd13a","#fdae35","#fb8122","#ec530f","#d23105","#ac1701","#7a0403"]}).map(([e,t])=>[e,t.map(i)])),n=(e,t)=>{let r=a[e]||a.speed,i=Math.min(1,Math.max(0,Number.isFinite(t)?t:0))*(r.length-1),n=Math.min(r.length-2,Math.floor(i)),o=i-n;return r[n].map((e,t)=>e+(r[n+1][t]-e)*o)};e.s(["colorAt",0,n,"colorMapTexture",0,e=>{let i=new Uint8Array(1024),a=r[e]||0;for(let t=0;t<256;t++){let[r,o,s]=n(e,a+(1-a)*t/255);i.set([Math.round(r),Math.round(o),Math.round(s),255],4*t)}let o=new t.DataTexture(i,256,1,t.RGBAFormat);return o.magFilter=t.LinearFilter,o.minFilter=t.LinearFilter,o.colorSpace=t.SRGBColorSpace,o.needsUpdate=!0,o},"cssGradient",0,e=>{let t=r[e]||0,i=Array.from({length:9},(r,i)=>{let[a,o,s]=n(e,t+(1-t)*i/8);return`rgb(${Math.round(a)},${Math.round(o)},${Math.round(s)})`});return`linear-gradient(to right, ${i.join(", ")})`}])},33227,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=.5/1.943844,a=null,n=new Set,o=(e,t,r,i)=>({lat:e+(i/8*2-1)*12e3/6371e3*180/Math.PI,lon:t+(r/8*2-1)*12e3/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),s=(e,t)=>{let r=[],i=[];for(let a=0;a<9;a++)for(let n=0;n<9;n++){let s=o(e,t,n,a);r.push(s.lat.toFixed(4)),i.push(s.lon.toFixed(4))}return`https://marine-api.open-meteo.com/v1/marine?latitude=${r.join(",")}&longitude=${i.join(",")}&hourly=ocean_current_velocity,ocean_current_direction&forecast_hours=48&timezone=GMT`},l=async(e,i)=>{let a=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===a&&Date.now()-r.at<18e5)return r.field;let n=await (0,t.cachedFetch)(s(e,i),{kind:"forecast"});if(!n.ok)throw Error(`Open-Meteo marine ${n.status}`);let o=await n.json(),l=Array.isArray(o)?o:[o],c=l[0]?.hourly?.time||[],d=c.length,u=[],f=[];for(let e=0;e<d;e++){let t=new Float32Array(81),r=new Float32Array(81);l.forEach((i,a)=>{let n=(i.hourly.ocean_current_velocity[e]??0)/3.6,o=(i.hourly.ocean_current_direction[e]??0)*Math.PI/180;t[a]=n*Math.sin(o),r[a]=n*Math.cos(o)}),u.push(t),f.push(r)}let h=0;u.forEach((e,t)=>e.forEach((e,r)=>{h=Math.max(h,Math.hypot(e,f[t][r]))}));let p={origin:{lat:e,lon:i},start:Date.parse(`${c[0]}Z`),hours:d,grid:9,half:12e3,u,v:f,max:h,source:"open-meteo"};return r={key:a,at:Date.now(),field:p},p};e.s(["currentFieldUrl",0,s,"fetchCurrentField",0,l,"getCurrentScale",0,()=>a,"setCurrentScale",0,e=>{let t=1.943844*Math.max(i,e?.max||0);return a=e?Math.ceil(4*t)/4/1.943844:null,n.forEach(e=>e(a)),a},"subscribeCurrentScale",0,e=>(n.add(e),()=>n.delete(e)),"uniformCurrent",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(r*Math.sin(i)),n=new Float32Array(81).fill(r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,grid:9,half:12e3,u:[a],v:[n],max:r,source:"boat"}}])},69435,e=>{"use strict";var t=e.i(71645),r=e.i(90072),i=e.i(3666);let a=40,n=`
|
|
44
44
|
float hash13(vec3 p) {
|
|
45
45
|
p = fract(p * 0.1031);
|
|
46
46
|
p += dot(p, p.zyx + 31.32);
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
vec2 a = abs(g) / uFieldHalf;
|
|
72
72
|
return 1.0 - smoothstep(0.85, 1.0, max(a.x, a.y));
|
|
73
73
|
}
|
|
74
|
-
`;e.s(["FIELD_GLSL",0,o,"NOISE_GLSL",0,n,"useFieldTexture",0,(e,n,o=a)=>{let s=(0,t.useMemo)(()=>{let e=new r.DataTexture(new Uint8Array(16384),64,64,r.RGBAFormat);return e.magFilter=r.LinearFilter,e.minFilter=r.LinearFilter,e.wrapS=r.ClampToEdgeWrapping,e.wrapT=r.ClampToEdgeWrapping,e},[]);return(0,t.useEffect)(()=>{if(!e)return;let t=s.image.data,r=e.half??i.HALF_EXTENT_M;for(let a=0;a<64;a++)for(let s=0;s<64;s++){let l=(0,i.sampleWind)(e,(s/63*2-1)*r,(a/63*2-1)*r,n),c=(64*a+s)*4;t[c]=Math.round(255*Math.min(1,Math.max(0,.5+l.u/(2*o)))),t[c+1]=Math.round(255*Math.min(1,Math.max(0,.5+l.v/(2*o)))),t[c+2]=0,t[c+3]=255}s.needsUpdate=!0},[s,e,n,o]),(0,t.useEffect)(()=>()=>s.dispose(),[s]),s}])},88608,e=>{"use strict";let t=0,r=new Set,i={},a=new Set;e.s(["getForecastHour",0,()=>t,"getSeries",0,()=>i,"setForecastHour",0,e=>{t=Math.max(0,e),r.forEach(e=>e(t))},"setSeries",0,(e,t)=>{i={...i,[e]:t},a.forEach(e=>e(i))},"subscribeForecast",0,e=>(r.add(e),()=>r.delete(e)),"subscribeSeries",0,e=>(a.add(e),()=>a.delete(e))])},18032,e=>{"use strict";var t=e.i(90072);e.s(["markerLattice",0,({cx:e,cy:t,radius:r,step:i,near:a,originE:n=0,originN:o=0,max:s=60})=>{let l=[],c=Math.ceil((n-r)/i),u=Math.floor((n+r)/i),d=Math.ceil((o-r)/i),f=Math.floor((o+r)/i);for(let s=c;s<=u;s++)for(let c=d;c<=f;c++){let u=s*i,d=c*i;if(Math.hypot(u-n,d-o)>r)continue;let f=Math.hypot(u-e,d-t),h=f<=a?0:Math.ceil(Math.log2(f/a)),p=2**h;s%p==0&&c%p==0&&l.push({e:u,n:d,d:f})}return l.sort((e,t)=>e.d-t.d).slice(0,s)},"onScreenTest",0,(e,r,i,a=.9,n=60)=>{let o=new t.Vector3;e.updateWorldMatrix(!0,!1);let s=i.getBoundingClientRect(),l="u"<typeof document?[]:[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);return(t,i,c)=>{if(o.set(t,i,c),e.localToWorld(o).project(r),o.z>=1||Math.abs(o.x)>a||Math.abs(o.y)>a)return!1;let u=s.left+(o.x+1)/2*s.width,d=s.top+(1-o.y)/2*s.height;return!l.some(e=>u>e.left-n&&u<e.right+n&&d>e.top-n&&d<e.bottom+n)}},"sameMarkers",0,(e,t)=>e.length===t.length&&e.every((e,r)=>{let i=t[r];return e.key===i.key&&.005>Math.abs(e.speed-i.speed)&&Math.sign(Math.round(20*e.trend))===Math.sign(Math.round(20*i.trend))&&.001>Math.abs(e.len-i.len)&&e.x===i.x&&e.y===i.y})])},54735,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(33227),a=e.i(88608),n=e.i(3666),o=e.i(54983),s=e.i(18032),l=e.i(58567);let c=["navigation.position","environment.current"];e.s(["CURRENT_ARROW_WIDTH",0,.028,"DEFAULT_CURRENT_MAP",0,"thermal","currentMarkers",0,({field:e,hour:t,top:r,mapName:i,refE:a,refN:c,cx:u,cy:d,heightM:f,scale:h,radius:p,z:m,isWater:v=()=>!0,onScreen:y=()=>!0})=>{let g=Math.min(400,Math.max(25,5*Math.round(.9*f/5))),x="pi"===(0,l.getRenderProfile)().id?20:40,b=(0,s.markerLattice)({cx:u,cy:d,radius:p,step:g,near:3*g,originE:a,originN:c,max:400}),w=[];return b.forEach(({e:s,n:l})=>{if(w.length>=x||15>Math.hypot(s-a,l-c))return;let u=(s-a)*h,d=(l-c)*h;if(!y(u,d,m)||!v(u,d))return;let f=(0,n.sampleWind)(e,s,l,t),p=Math.hypot(f.u,f.v);if(p<.005)return;let g=(0,n.sampleWind)(e,s,l,t+1),b=Math.min(1,p/r),[S,M,E]=(0,o.colorAt)(i,.28+.72*b);w.push({key:`${s},${l}`,x:u,y:d,z:m,u:f.u,v:f.v,speed:p,trend:Math.hypot(g.u,g.v)-p,color:[S/255,M/255,E/255],len:.16*(.4+.6*b)})}),w},"useCurrentField",0,()=>{let e=(0,r.useSignalKPaths)(c),o=e["navigation.position"],s=e["environment.current"],l=(0,t.useSyncExternalStore)(a.subscribeForecast,a.getForecastHour,a.getForecastHour),[u,d]=(0,t.useState)(null),[f,h]=(0,t.useState)(1),p=o?.latitude,m=o?.longitude,v=Number.isFinite(p)?`${p.toFixed(1)},${m.toFixed(1)}`:null;(0,t.useEffect)(()=>{if(!v)return;let e=!1,[t,r]=v.split(",").map(Number);return(0,i.fetchCurrentField)(t,r).then(t=>{e||d(t)}).catch(()=>{!e&&Number.isFinite(s?.drift)&&Number.isFinite(s?.setTrue)&&d((0,i.uniformCurrent)(t,r,s.drift,s.setTrue))}),()=>{e=!0}},[v]),(0,t.useEffect)(()=>{h((0,i.setCurrentScale)(u)??1)},[u]),(0,t.useEffect)(()=>()=>(0,i.setCurrentScale)(null),[]);let y=Number.isFinite(p)?Math.round(100*p):null,g=Number.isFinite(m)?Math.round(100*m):null;return(0,t.useEffect)(()=>{if(!u||null===y)return;let e=(m-u.origin.lon)*Math.PI/180*6371e3*Math.cos(u.origin.lat*Math.PI/180),t=(p-u.origin.lat)*Math.PI/180*6371e3,r=Array.from({length:u.hours},(r,i)=>{let a=(0,n.sampleWind)(u,e,t,i);return Math.hypot(a.u,a.v)});return(0,a.setSeries)("current",{start:u.start,values:r,top:u.max}),()=>(0,a.setSeries)("current",null)},[u,y,g]),{field:u,hour:l,top:f,lat:p,lon:m}}])},3666,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=(e,t,r,i)=>({lat:e+(i/8*2-1)*4e4/6371e3*180/Math.PI,lon:t+(r/8*2-1)*4e4/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),a=(e,t)=>{let r=[],a=[];for(let n=0;n<9;n++)for(let o=0;o<9;o++){let s=i(e,t,o,n);r.push(s.lat.toFixed(4)),a.push(s.lon.toFixed(4))}return`https://api.open-meteo.com/v1/forecast?latitude=${r.join(",")}&longitude=${a.join(",")}&hourly=wind_speed_10m,wind_direction_10m&wind_speed_unit=ms&forecast_hours=48&timezone=GMT`},n=async(e,i)=>{let n=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===n&&Date.now()-r.at<18e5)return r.field;let o=a(e,i),s=await (0,t.cachedFetch)(o,{kind:"forecast"});if(!s.ok)throw Error(`Open-Meteo ${s.status}`);let l=await s.json(),c=Array.isArray(l)?l:[l],u=c[0]?.hourly?.time||[],d=u.length,f=[],h=[];for(let e=0;e<d;e++){let t=new Float32Array(81),r=new Float32Array(81);c.forEach((i,a)=>{let n=i.hourly.wind_speed_10m[e]??0,o=(i.hourly.wind_direction_10m[e]??0)*Math.PI/180;t[a]=-n*Math.sin(o),r[a]=-n*Math.cos(o)}),f.push(t),h.push(r)}let p={origin:{lat:e,lon:i},start:Date.parse(`${u[0]}Z`),hours:d,u:f,v:h,source:"open-meteo"};return r={key:n,at:Date.now(),field:p},p},o=[[0,[98,113,183]],[1,[57,97,159]],[3,[74,148,169]],[5,[77,141,123]],[7,[83,165,83]],[9,[53,159,53]],[11,[167,157,81]],[13,[159,127,58]],[15,[161,108,92]],[17,[129,58,78]],[19,[175,80,136]],[21,[117,74,147]],[24,[109,97,163]],[27,[68,105,141]],[29,[92,144,152]],[36,[125,68,165]]];e.s(["HALF_EXTENT_M",0,4e4,"WINDY_SCALE",0,o,"fetchWindField",0,n,"sampleWind",0,(e,t,r,i=0)=>{let a=e.grid??9,n=e.half??4e4,o=Math.min(a-1.001,Math.max(0,(t/n+1)/2*(a-1))),s=Math.min(a-1.001,Math.max(0,(r/n+1)/2*(a-1))),l=Math.floor(o),c=Math.floor(s),u=o-l,d=s-c,f=Math.min(e.hours-1,Math.max(0,Math.floor(i))),h=Math.min(e.hours-1,f+1),p=Math.min(1,Math.max(0,i-f)),m=(e,t)=>{let r=e[t],i=c*a+l;return(r[i]*(1-u)+r[i+1]*u)*(1-d)+(r[i+a]*(1-u)+r[i+a+1]*u)*d};return{u:m(e.u,f)*(1-p)+m(e.u,h)*p,v:m(e.v,f)*(1-p)+m(e.v,h)*p}},"uniformField",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(-r*Math.sin(i)),n=new Float32Array(81).fill(-r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,u:[a],v:[n],source:"boat"}},"windColor",0,e=>{if(e<=o[0][0])return o[0][1];for(let t=1;t<o.length;t++)if(e<=o[t][0]){let[r,i]=o[t-1],[a,n]=o[t],s=(e-r)/(a-r);return i.map((e,t)=>e+(n[t]-e)*s)}return o[o.length-1][1]},"windFieldUrl",0,a])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},3950,e=>{"use strict";let t="ocearo-offline-v2",r=["ocearo-offline-v1"],i=!1,a=async(e,{kind:a="tile"}={})=>{if(!("u">typeof caches))return fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"});i||(i=!0,r.forEach(e=>caches.delete(e).catch(()=>{})));let n=await caches.open(t);if("tile"===a){let t=await n.match(e);if(t)return t}try{let t=await fetch(e,{mode:"cors",referrerPolicy:"strict-origin-when-cross-origin"});if(t.ok)await n.put(e,t.clone());else{let t=await n.match(e);if(t)return t}return t}catch(r){let t=await n.match(e);if(t)return t;throw r}},n=async e=>{let t=await a(e,{kind:"tile"});if(!t.ok)throw Error(`${t.status} ${e}`);return createImageBitmap(await t.blob())},o=(e,t,r,i)=>{if(e.includes("{bbox}")){let a=40075016.68557849/2**t,n=-20037508.342789244+r*a,o=20037508.342789244-i*a,s=[n,o-a,n+a,o].map(e=>e.toFixed(2)).join(",");return e.replace("{bbox}",s)}return e.replace("{z}",t).replace("{x}",r).replace("{y}",i)},s=(e,t,r,i)=>{let a=2**i,n=(e,t)=>({x:Math.floor((t+180)/360*a),y:Math.floor((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*a)}),o=r/111320,s=r/(111320*Math.cos(e*Math.PI/180)),l=n(e+o,t-s),c=n(e-o,t+s),u=[];for(let e=l.x;e<=c.x;e++)for(let t=l.y;t<=c.y;t++)u.push({z:i,x:e,y:t});return u},l=async({lat:e,lon:t,radiusM:r,layers:i,urls:n=[],onProgress:l})=>{let c=[];for(let{template:a,zooms:n}of i)for(let i of n)for(let n of s(e,t,r,i))c.push(o(a,n.z,n.x,n.y));c.push(...n);let u=0,d=0,f=[...c],h=async()=>{for(;f.length;){let e=f.shift();try{!(await a(e,{kind:e.includes("forecast")?"forecast":"tile"})).ok&&d++}catch{d++}u++,l?.(u,c.length,d)}};return await Promise.all(Array.from({length:4},h)),{done:u,failed:d,total:c.length}},c=async()=>{if(navigator.storage?.estimate){let{usage:e}=await navigator.storage.estimate();return e}return null},u=async(e,r)=>{if(!("u">typeof caches))return!1;let i=await caches.open(t);return await i.put(e,r),!0},d=async e=>{if(!("u">typeof caches))return null;let r=await caches.open(t);return await r.match(e)||null};e.s(["cachedFetch",0,a,"cachedImage",0,n,"clearOfflineCache",0,()=>"u">typeof caches?caches.delete(t):Promise.resolve(!1),"offlineCacheSize",0,c,"prefetchArea",0,l,"readCached",0,d,"storeCached",0,u,"tileUrl",0,o])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,r;var i=e.i(31067),a=e.i(71645),n=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let c=new o.Vector3,u=new o.Vector3,d=new o.Vector3,f=new o.Vector2;function h(e,t,r){let i=c.setFromMatrixPosition(e.matrixWorld);i.project(t);let a=r.width/2,n=r.height/2;return[i.x*a+a,-(i.y*n)+n]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),y=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,r(t),"translate(-50%,-50%)")),g=a.forwardRef(({children:e,eps:t=.001,style:r,className:m,prepend:g,center:x,fullscreen:b,portal:w,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:A,onOcclude:F,castShadow:_,receiveShadow:z,material:T,geometry:P,zIndexRange:C=[0x1000037,0],calculatePosition:U=h,as:B="div",wrapperClass:L,pointerEvents:D="auto",...I},O)=>{let{gl:W,camera:R,scene:j,size:N,raycaster:$,events:k,viewport:H}=(0,s.useThree)(),[V]=a.useState(()=>document.createElement(B)),G=a.useRef(null),q=a.useRef(null),K=a.useRef(0),X=a.useRef([0,0]),Z=a.useRef(null),Y=a.useRef(null),J=(null==w?void 0:w.current)||k.connected||W.domElement.parentNode,Q=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return A&&"blending"!==A||Array.isArray(A)&&A.length&&(e=A[0])&&"object"==typeof e&&"current"in e},[A]);a.useLayoutEffect(()=>{let e=W.domElement;A&&"blending"===A?(e.style.zIndex=`${Math.floor(C[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[A]),a.useLayoutEffect(()=>{if(q.current){let e=G.current=n.createRoot(V);if(j.updateMatrixWorld(),E)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=U(q.current,R,N);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return J&&(g?J.prepend(V):J.appendChild(V)),()=>{J&&J.removeChild(V),e.unmount()}}},[J,E]),a.useLayoutEffect(()=>{L&&(V.className=L)},[L]);let er=a.useMemo(()=>E?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...b&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...r},[r,x,b,N,E]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);a.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=G.current)||t.render(a.createElement("div",{ref:Z,style:er},a.createElement("div",{ref:Y,style:ei},a.createElement("div",{ref:O,className:m,style:r,children:e})))):null==(i=G.current)||i.render(a.createElement("div",{ref:O,style:er,className:m,children:e}))});let ea=a.useRef(!0);(0,l.useFrame)(e=>{if(q.current){R.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:U(q.current,R,N);if(E||Math.abs(K.current-R.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var r;let t,i,a,n,s=(r=q.current,t=c.setFromMatrixPosition(r.matrixWorld),i=u.setFromMatrixPosition(R.matrixWorld),a=t.sub(i),n=R.getWorldDirection(d),a.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(A)?l=A.map(e=>e.current):"blending"!==A&&(l=[j]));let h=ea.current;l?ea.current=function(e,t,r,i){let a=c.setFromMatrixPosition(e.matrixWorld),n=a.clone();n.project(t),f.set(n.x,n.y),r.setFromCamera(f,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return a.distanceTo(r.ray.origin)<e}return!0}(q.current,R,$,l)&&!s:ea.current=!s,h!==ea.current&&(F?F(!ea.current):V.style.display=ea.current?"block":"none");let m=Math.floor(C[0]/2),g=A?et?[C[0],m]:[m-1,0]:C;if(V.style.zIndex=`${function(e,t,r){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=c.setFromMatrixPosition(e.matrixWorld),a=u.setFromMatrixPosition(t.matrixWorld),n=i.distanceTo(a),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*n+s)}}(q.current,R,g)}`,E){let[e,t]=[N.width/2,N.height/2],r=R.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:a,left:n,bottom:o,right:s}=R,l=v(R.matrixWorldInverse),c=i?`scale(${r})translate(${p(-(s+n)/2)}px,${p((a+o)/2)}px)`:`translateZ(${r}px)`,u=q.current.matrixWorld;M&&((u=R.matrixWorldInverse.clone().transpose().copyPosition(u).scale(q.current.scale)).elements[3]=u.elements[7]=u.elements[11]=0,u.elements[15]=1),V.style.width=N.width+"px",V.style.height=N.height+"px",V.style.perspective=i?"":`${r}px`,Z.current&&Y.current&&(Z.current.style.transform=`${c}${l}translate(${e}px,${t}px)`,Y.current.style.transform=y(u,1/((S||10)/400)))}else{let t=void 0===S?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let r=c.setFromMatrixPosition(e.matrixWorld),i=u.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(q.current,R)*S;V.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=R.zoom}}if(!et&&Q.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=R;if(t||P)I.scale&&(Array.isArray(I.scale)?I.scale instanceof o.Vector3?Q.current.scale.copy(I.scale.clone().divideScalar(1)):Q.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):Q.current.scale.setScalar(1/I.scale));else{let t=(S||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;Q.current.scale.set(r,i,1)}ee.current=!0}}}else{let t=V.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/H.factor,r=t.clientWidth*e,i=t.clientHeight*e;Q.current.scale.set(r,i,1),ee.current=!0}Q.current.lookAt(e.camera.position)}});let en=a.useMemo(()=>({vertexShader:E?void 0:`
|
|
74
|
+
`;e.s(["FIELD_GLSL",0,o,"NOISE_GLSL",0,n,"useFieldTexture",0,(e,n,o=a)=>{let s=(0,t.useMemo)(()=>{let e=new r.DataTexture(new Uint8Array(16384),64,64,r.RGBAFormat);return e.magFilter=r.LinearFilter,e.minFilter=r.LinearFilter,e.wrapS=r.ClampToEdgeWrapping,e.wrapT=r.ClampToEdgeWrapping,e},[]);return(0,t.useEffect)(()=>{if(!e)return;let t=s.image.data,r=e.half??i.HALF_EXTENT_M;for(let a=0;a<64;a++)for(let s=0;s<64;s++){let l=(0,i.sampleWind)(e,(s/63*2-1)*r,(a/63*2-1)*r,n),c=(64*a+s)*4;t[c]=Math.round(255*Math.min(1,Math.max(0,.5+l.u/(2*o)))),t[c+1]=Math.round(255*Math.min(1,Math.max(0,.5+l.v/(2*o)))),t[c+2]=0,t[c+3]=255}s.needsUpdate=!0},[s,e,n,o]),(0,t.useEffect)(()=>()=>s.dispose(),[s]),s}])},88608,e=>{"use strict";let t=0,r=new Set,i={},a=new Set;e.s(["getForecastHour",0,()=>t,"getSeries",0,()=>i,"setForecastHour",0,e=>{t=Math.max(0,e),r.forEach(e=>e(t))},"setSeries",0,(e,t)=>{i={...i,[e]:t},a.forEach(e=>e(i))},"subscribeForecast",0,e=>(r.add(e),()=>r.delete(e)),"subscribeSeries",0,e=>(a.add(e),()=>a.delete(e))])},18032,e=>{"use strict";var t=e.i(90072);e.s(["markerLattice",0,({cx:e,cy:t,radius:r,step:i,near:a,originE:n=0,originN:o=0,max:s=60})=>{let l=[],c=Math.ceil((n-r)/i),d=Math.floor((n+r)/i),u=Math.ceil((o-r)/i),f=Math.floor((o+r)/i);for(let s=c;s<=d;s++)for(let c=u;c<=f;c++){let d=s*i,u=c*i;if(Math.hypot(d-n,u-o)>r)continue;let f=Math.hypot(d-e,u-t),h=f<=a?0:Math.ceil(Math.log2(f/a)),p=2**h;s%p==0&&c%p==0&&l.push({e:d,n:u,d:f})}return l.sort((e,t)=>e.d-t.d).slice(0,s)},"onScreenTest",0,(e,r,i,a=.9,n=60)=>{let o=new t.Vector3;e.updateWorldMatrix(!0,!1);let s=i.getBoundingClientRect(),l="u"<typeof document?[]:[...document.querySelectorAll("[data-hud-solid]")].filter(e=>null!==e.offsetParent).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0);return(t,i,c)=>{if(o.set(t,i,c),e.localToWorld(o).project(r),o.z>=1||Math.abs(o.x)>a||Math.abs(o.y)>a)return!1;let d=s.left+(o.x+1)/2*s.width,u=s.top+(1-o.y)/2*s.height;return!l.some(e=>d>e.left-n&&d<e.right+n&&u>e.top-n&&u<e.bottom+n)}},"sameMarkers",0,(e,t)=>e.length===t.length&&e.every((e,r)=>{let i=t[r];return e.key===i.key&&.005>Math.abs(e.speed-i.speed)&&Math.sign(Math.round(20*e.trend))===Math.sign(Math.round(20*i.trend))&&.001>Math.abs(e.len-i.len)&&e.x===i.x&&e.y===i.y})])},54735,e=>{"use strict";var t=e.i(71645),r=e.i(85709),i=e.i(33227),a=e.i(88608),n=e.i(3666),o=e.i(54983),s=e.i(18032),l=e.i(58567);let c=["navigation.position","environment.current"];e.s(["CURRENT_ARROW_WIDTH",0,.028,"DEFAULT_CURRENT_MAP",0,"thermal","currentMarkers",0,({field:e,hour:t,top:r,mapName:i,refE:a,refN:c,cx:d,cy:u,heightM:f,scale:h,radius:p,z:m,isWater:v=()=>!0,onScreen:y=()=>!0})=>{let g=Math.min(400,Math.max(25,5*Math.round(.9*f/5))),x="pi"===(0,l.getRenderProfile)().id?20:40,b=(0,s.markerLattice)({cx:d,cy:u,radius:p,step:g,near:3*g,originE:a,originN:c,max:400}),w=[];return b.forEach(({e:s,n:l})=>{if(w.length>=x||15>Math.hypot(s-a,l-c))return;let d=(s-a)*h,u=(l-c)*h;if(!y(d,u,m)||!v(d,u))return;let f=(0,n.sampleWind)(e,s,l,t),p=Math.hypot(f.u,f.v);if(p<.005)return;let g=(0,n.sampleWind)(e,s,l,t+1),b=Math.min(1,p/r),[S,M,E]=(0,o.colorAt)(i,.28+.72*b);w.push({key:`${s},${l}`,x:d,y:u,z:m,u:f.u,v:f.v,speed:p,trend:Math.hypot(g.u,g.v)-p,color:[S/255,M/255,E/255],len:.16*(.4+.6*b)})}),w},"useCurrentField",0,()=>{let e=(0,r.useSignalKPaths)(c),o=e["navigation.position"],s=e["environment.current"],l=(0,t.useSyncExternalStore)(a.subscribeForecast,a.getForecastHour,a.getForecastHour),[d,u]=(0,t.useState)(null),[f,h]=(0,t.useState)(1),p=o?.latitude,m=o?.longitude,v=Number.isFinite(p)?`${p.toFixed(1)},${m.toFixed(1)}`:null;(0,t.useEffect)(()=>{if(!v)return;let e=!1,[t,r]=v.split(",").map(Number);return(0,i.fetchCurrentField)(t,r).then(t=>{e||u(t)}).catch(()=>{!e&&Number.isFinite(s?.drift)&&Number.isFinite(s?.setTrue)&&u((0,i.uniformCurrent)(t,r,s.drift,s.setTrue))}),()=>{e=!0}},[v]),(0,t.useEffect)(()=>{h((0,i.setCurrentScale)(d)??1)},[d]),(0,t.useEffect)(()=>()=>(0,i.setCurrentScale)(null),[]);let y=Number.isFinite(p)?Math.round(100*p):null,g=Number.isFinite(m)?Math.round(100*m):null;return(0,t.useEffect)(()=>{if(!d||null===y)return;let e=(m-d.origin.lon)*Math.PI/180*6371e3*Math.cos(d.origin.lat*Math.PI/180),t=(p-d.origin.lat)*Math.PI/180*6371e3,r=Array.from({length:d.hours},(r,i)=>{let a=(0,n.sampleWind)(d,e,t,i);return Math.hypot(a.u,a.v)});return(0,a.setSeries)("current",{start:d.start,values:r,top:d.max}),()=>(0,a.setSeries)("current",null)},[d,y,g]),{field:d,hour:l,top:f,lat:p,lon:m}}])},3666,e=>{"use strict";var t=e.i(3950);let r={key:null,at:0,field:null},i=(e,t,r,i)=>({lat:e+(i/8*2-1)*4e4/6371e3*180/Math.PI,lon:t+(r/8*2-1)*4e4/(6371e3*Math.cos(e*Math.PI/180))*180/Math.PI}),a=(e,t)=>{let r=[],a=[];for(let n=0;n<9;n++)for(let o=0;o<9;o++){let s=i(e,t,o,n);r.push(s.lat.toFixed(4)),a.push(s.lon.toFixed(4))}return`https://api.open-meteo.com/v1/forecast?latitude=${r.join(",")}&longitude=${a.join(",")}&hourly=wind_speed_10m,wind_direction_10m&wind_speed_unit=ms&forecast_hours=48&timezone=GMT`},n=async(e,i)=>{let n=`${e.toFixed(1)},${i.toFixed(1)}`;if(r.field&&r.key===n&&Date.now()-r.at<18e5)return r.field;let o=a(e,i),s=await (0,t.cachedFetch)(o,{kind:"forecast"});if(!s.ok)throw Error(`Open-Meteo ${s.status}`);let l=await s.json(),c=Array.isArray(l)?l:[l],d=c[0]?.hourly?.time||[],u=d.length,f=[],h=[];for(let e=0;e<u;e++){let t=new Float32Array(81),r=new Float32Array(81);c.forEach((i,a)=>{let n=i.hourly.wind_speed_10m[e]??0,o=(i.hourly.wind_direction_10m[e]??0)*Math.PI/180;t[a]=-n*Math.sin(o),r[a]=-n*Math.cos(o)}),f.push(t),h.push(r)}let p={origin:{lat:e,lon:i},start:Date.parse(`${d[0]}Z`),hours:u,u:f,v:h,source:"open-meteo"};return r={key:n,at:Date.now(),field:p},p},o=[[0,[98,113,183]],[1,[57,97,159]],[3,[74,148,169]],[5,[77,141,123]],[7,[83,165,83]],[9,[53,159,53]],[11,[167,157,81]],[13,[159,127,58]],[15,[161,108,92]],[17,[129,58,78]],[19,[175,80,136]],[21,[117,74,147]],[24,[109,97,163]],[27,[68,105,141]],[29,[92,144,152]],[36,[125,68,165]]];e.s(["HALF_EXTENT_M",0,4e4,"WINDY_SCALE",0,o,"fetchWindField",0,n,"sampleWind",0,(e,t,r,i=0)=>{let a=e.grid??9,n=e.half??4e4,o=Math.min(a-1.001,Math.max(0,(t/n+1)/2*(a-1))),s=Math.min(a-1.001,Math.max(0,(r/n+1)/2*(a-1))),l=Math.floor(o),c=Math.floor(s),d=o-l,u=s-c,f=Math.min(e.hours-1,Math.max(0,Math.floor(i))),h=Math.min(e.hours-1,f+1),p=Math.min(1,Math.max(0,i-f)),m=(e,t)=>{let r=e[t],i=c*a+l;return(r[i]*(1-d)+r[i+1]*d)*(1-u)+(r[i+a]*(1-d)+r[i+a+1]*d)*u};return{u:m(e.u,f)*(1-p)+m(e.u,h)*p,v:m(e.v,f)*(1-p)+m(e.v,h)*p}},"uniformField",0,(e,t,r,i)=>{let a=new Float32Array(81).fill(-r*Math.sin(i)),n=new Float32Array(81).fill(-r*Math.cos(i));return{origin:{lat:e,lon:t},start:Date.now(),hours:1,u:[a],v:[n],source:"boat"}},"windColor",0,e=>{if(e<=o[0][0])return o[0][1];for(let t=1;t<o.length;t++)if(e<=o[t][0]){let[r,i]=o[t-1],[a,n]=o[t],s=(e-r)/(a-r);return i.map((e,t)=>e+(n[t]-e)*s)}return o[o.length-1][1]},"windFieldUrl",0,a])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},3950,e=>{"use strict";let t="ocearo-offline-v2",r=["ocearo-offline-v1"],i=!1,a=async(e,{kind:a="tile"}={})=>{if(!("u">typeof caches))return fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"});i||(i=!0,r.forEach(e=>caches.delete(e).catch(()=>{})));let n=await caches.open(t);if("tile"===a){let t=await n.match(e);if(t)return t}try{let t=await fetch(e,{mode:"cors",referrerPolicy:"strict-origin-when-cross-origin"});if(t.ok)await n.put(e,t.clone());else{let t=await n.match(e);if(t)return t}return t}catch(r){let t=await n.match(e);if(t)return t;throw r}},n=async e=>{let t=await a(e,{kind:"tile"});if(!t.ok)throw Error(`${t.status} ${e}`);return createImageBitmap(await t.blob())},o=(e,t,r,i)=>{if(e.includes("{bbox}")){let a=40075016.68557849/2**t,n=-20037508.342789244+r*a,o=20037508.342789244-i*a,s=[n,o-a,n+a,o].map(e=>e.toFixed(2)).join(",");return e.replace("{bbox}",s)}return e.replace("{z}",t).replace("{x}",r).replace("{y}",i)},s=(e,t,r,i)=>{let a=2**i,n=(e,t)=>({x:Math.floor((t+180)/360*a),y:Math.floor((1-Math.log(Math.tan(e*Math.PI/180)+1/Math.cos(e*Math.PI/180))/Math.PI)/2*a)}),o=r/111320,s=r/(111320*Math.cos(e*Math.PI/180)),l=n(e+o,t-s),c=n(e-o,t+s),d=[];for(let e=l.x;e<=c.x;e++)for(let t=l.y;t<=c.y;t++)d.push({z:i,x:e,y:t});return d},l=async({lat:e,lon:t,radiusM:r,layers:i,urls:n=[],onProgress:l})=>{let c=[];for(let{template:a,zooms:n}of i)for(let i of n)for(let n of s(e,t,r,i))c.push(o(a,n.z,n.x,n.y));c.push(...n);let d=0,u=0,f=[...c],h=async()=>{for(;f.length;){let e=f.shift();try{!(await a(e,{kind:e.includes("forecast")?"forecast":"tile"})).ok&&u++}catch{u++}d++,l?.(d,c.length,u)}};return await Promise.all(Array.from({length:4},h)),{done:d,failed:u,total:c.length}},c=async()=>{if(navigator.storage?.estimate){let{usage:e}=await navigator.storage.estimate();return e}return null},d=async(e,r)=>{if(!("u">typeof caches))return!1;let i=await caches.open(t);return await i.put(e,r),!0},u=async e=>{if(!("u">typeof caches))return null;let r=await caches.open(t);return await r.match(e)||null};e.s(["cachedFetch",0,a,"cachedImage",0,n,"clearOfflineCache",0,()=>"u">typeof caches?caches.delete(t):Promise.resolve(!1),"offlineCacheSize",0,c,"prefetchArea",0,l,"readCached",0,u,"storeCached",0,d,"tileUrl",0,o])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,r;var i=e.i(31067),a=e.i(71645),n=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let c=new o.Vector3,d=new o.Vector3,u=new o.Vector3,f=new o.Vector2;function h(e,t,r){let i=c.setFromMatrixPosition(e.matrixWorld);i.project(t);let a=r.width/2,n=r.height/2;return[i.x*a+a,-(i.y*n)+n]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,r=""){let i="matrix3d(";for(let r=0;16!==r;r++)i+=p(t[r]*e.elements[r])+(15!==r?",":")");return r+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),y=(r=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,r(t),"translate(-50%,-50%)")),g=a.forwardRef(({children:e,eps:t=.001,style:r,className:m,prepend:g,center:x,fullscreen:b,portal:w,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:A,onOcclude:F,castShadow:_,receiveShadow:z,material:T,geometry:P,zIndexRange:C=[0x1000037,0],calculatePosition:U=h,as:B="div",wrapperClass:L,pointerEvents:D="auto",...I},O)=>{let{gl:W,camera:R,scene:j,size:N,raycaster:$,events:k,viewport:H}=(0,s.useThree)(),[V]=a.useState(()=>document.createElement(B)),G=a.useRef(null),q=a.useRef(null),K=a.useRef(0),X=a.useRef([0,0]),Z=a.useRef(null),Y=a.useRef(null),J=(null==w?void 0:w.current)||k.connected||W.domElement.parentNode,Q=a.useRef(null),ee=a.useRef(!1),et=a.useMemo(()=>{var e;return A&&"blending"!==A||Array.isArray(A)&&A.length&&(e=A[0])&&"object"==typeof e&&"current"in e},[A]);a.useLayoutEffect(()=>{let e=W.domElement;A&&"blending"===A?(e.style.zIndex=`${Math.floor(C[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[A]),a.useLayoutEffect(()=>{if(q.current){let e=G.current=n.createRoot(V);if(j.updateMatrixWorld(),E)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=U(q.current,R,N);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return J&&(g?J.prepend(V):J.appendChild(V)),()=>{J&&J.removeChild(V),e.unmount()}}},[J,E]),a.useLayoutEffect(()=>{L&&(V.className=L)},[L]);let er=a.useMemo(()=>E?{position:"absolute",top:0,left:0,width:N.width,height:N.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:x?"translate3d(-50%,-50%,0)":"none",...b&&{top:-N.height/2,left:-N.width/2,width:N.width,height:N.height},...r},[r,x,b,N,E]),ei=a.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);a.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=G.current)||t.render(a.createElement("div",{ref:Z,style:er},a.createElement("div",{ref:Y,style:ei},a.createElement("div",{ref:O,className:m,style:r,children:e})))):null==(i=G.current)||i.render(a.createElement("div",{ref:O,style:er,className:m,children:e}))});let ea=a.useRef(!0);(0,l.useFrame)(e=>{if(q.current){R.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:U(q.current,R,N);if(E||Math.abs(K.current-R.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var r;let t,i,a,n,s=(r=q.current,t=c.setFromMatrixPosition(r.matrixWorld),i=d.setFromMatrixPosition(R.matrixWorld),a=t.sub(i),n=R.getWorldDirection(u),a.angleTo(n)>Math.PI/2),l=!1;et&&(Array.isArray(A)?l=A.map(e=>e.current):"blending"!==A&&(l=[j]));let h=ea.current;l?ea.current=function(e,t,r,i){let a=c.setFromMatrixPosition(e.matrixWorld),n=a.clone();n.project(t),f.set(n.x,n.y),r.setFromCamera(f,t);let o=r.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return a.distanceTo(r.ray.origin)<e}return!0}(q.current,R,$,l)&&!s:ea.current=!s,h!==ea.current&&(F?F(!ea.current):V.style.display=ea.current?"block":"none");let m=Math.floor(C[0]/2),g=A?et?[C[0],m]:[m-1,0]:C;if(V.style.zIndex=`${function(e,t,r){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=c.setFromMatrixPosition(e.matrixWorld),a=d.setFromMatrixPosition(t.matrixWorld),n=i.distanceTo(a),o=(r[1]-r[0])/(t.far-t.near),s=r[1]-o*t.far;return Math.round(o*n+s)}}(q.current,R,g)}`,E){let[e,t]=[N.width/2,N.height/2],r=R.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:a,left:n,bottom:o,right:s}=R,l=v(R.matrixWorldInverse),c=i?`scale(${r})translate(${p(-(s+n)/2)}px,${p((a+o)/2)}px)`:`translateZ(${r}px)`,d=q.current.matrixWorld;M&&((d=R.matrixWorldInverse.clone().transpose().copyPosition(d).scale(q.current.scale)).elements[3]=d.elements[7]=d.elements[11]=0,d.elements[15]=1),V.style.width=N.width+"px",V.style.height=N.height+"px",V.style.perspective=i?"":`${r}px`,Z.current&&Y.current&&(Z.current.style.transform=`${c}${l}translate(${e}px,${t}px)`,Y.current.style.transform=y(d,1/((S||10)/400)))}else{let t=void 0===S?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let r=c.setFromMatrixPosition(e.matrixWorld),i=d.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*r.distanceTo(i))}}(q.current,R)*S;V.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=R.zoom}}if(!et&&Q.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=R;if(t||P)I.scale&&(Array.isArray(I.scale)?I.scale instanceof o.Vector3?Q.current.scale.copy(I.scale.clone().divideScalar(1)):Q.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):Q.current.scale.setScalar(1/I.scale));else{let t=(S||10)/400,r=e.clientWidth*t,i=e.clientHeight*t;Q.current.scale.set(r,i,1)}ee.current=!0}}}else{let t=V.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/H.factor,r=t.clientWidth*e,i=t.clientHeight*e;Q.current.scale.set(r,i,1),ee.current=!0}Q.current.lookAt(e.camera.position)}});let en=a.useMemo(()=>({vertexShader:E?void 0:`
|
|
75
75
|
/*
|
|
76
76
|
This shader is from the THREE's SpriteMaterial.
|
|
77
77
|
We need to turn the backing plane into a Sprite
|
|
@@ -500,4 +500,4 @@
|
|
|
500
500
|
#include <premultiplied_alpha_fragment>
|
|
501
501
|
|
|
502
502
|
}
|
|
503
|
-
`};class
|
|
503
|
+
`};class d extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.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,d],27530);let u=new i.Vector4,f=new i.Vector3,h=new i.Vector3,p=new i.Vector4,m=new i.Vector4,v=new i.Vector4,y=new i.Vector3,g=new i.Matrix4,x=new i.Line3,b=new i.Vector3,w=new i.Box3,S=new i.Sphere,M=new i.Vector4;function E(e,t,i){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=r/i.width,M.y=r/i.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class A extends i.Mesh{constructor(e=new s,t=new d({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count);for(let e=0,i=0,n=t.count;e<n;e++,i+=2)f.fromBufferAttribute(t,e),h.fromBufferAttribute(r,e),a[i]=0===i?0:a[i-1],a[i+1]=a[i]+f.distanceTo(h);let n=new i.InstancedInterleavedBuffer(a,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(n,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(n,1,1)),this}raycast(e,a){let n,o,s=this.material.worldUnits,l=e.camera;if(null!==l||s||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===s&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let c=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let d=this.matrixWorld,u=this.geometry,f=this.material;if(r=f.linewidth+c,null===u.boundingSphere&&u.computeBoundingSphere(),S.copy(u.boundingSphere).applyMatrix4(d),s)n=.5*r;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));n=E(l,e,f.resolution)}if(S.radius+=n,!1!==t.intersectsSphere(S)){if(null===u.boundingBox&&u.computeBoundingBox(),w.copy(u.boundingBox).applyMatrix4(d),s)o=.5*r;else{let e=Math.max(l.near,w.distanceToPoint(t.origin));o=E(l,e,f.resolution)}w.expandByScalar(o),!1!==t.intersectsBox(w)&&(s?function(e,a){let n=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,l=o.attributes.instanceEnd,c=Math.min(o.instanceCount,s.count);for(let o=0;o<c;o++){x.start.fromBufferAttribute(s,o),x.end.fromBufferAttribute(l,o),x.applyMatrix4(n);let c=new i.Vector3,d=new i.Vector3;t.distanceSqToSegment(x.start,x.end,d,c),d.distanceTo(c)<.5*r&&a.push({point:d,pointOnLine:c,distance:t.origin.distanceTo(d),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,a):function(e,a,n){let o=a.projectionMatrix,s=e.material.resolution,l=e.matrixWorld,c=e.geometry,d=c.attributes.instanceStart,u=c.attributes.instanceEnd,f=Math.min(c.instanceCount,d.count),h=-a.near;t.at(1,v),v.w=1,v.applyMatrix4(a.matrixWorldInverse),v.applyMatrix4(o),v.multiplyScalar(1/v.w),v.x*=s.x/2,v.y*=s.y/2,v.z=0,y.copy(v),g.multiplyMatrices(a.matrixWorldInverse,l);for(let a=0;a<f;a++){if(p.fromBufferAttribute(d,a),m.fromBufferAttribute(u,a),p.w=1,m.w=1,p.applyMatrix4(g),m.applyMatrix4(g),p.z>h&&m.z>h)continue;if(p.z>h){let e=p.z-m.z,t=(p.z-h)/e;p.lerp(m,t)}else if(m.z>h){let e=m.z-p.z,t=(m.z-h)/e;m.lerp(p,t)}p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w),p.x*=s.x/2,p.y*=s.y/2,m.x*=s.x/2,m.y*=s.y/2,x.start.copy(p),x.start.z=0,x.end.copy(m),x.end.z=0;let c=x.closestPointToPointParameter(y,!0);x.at(c,b);let f=i.MathUtils.lerp(p.z,m.z,c),v=f>=-1&&f<=1,w=y.distanceTo(b)<.5*r;if(v&&w){x.start.fromBufferAttribute(d,a),x.end.fromBufferAttribute(u,a),x.start.applyMatrix4(l),x.end.applyMatrix4(l);let r=new i.Vector3,o=new i.Vector3;t.distanceSqToSegment(x.start,x.end,o,r),n.push({point:o,pointOnLine:r,distance:t.origin.distanceTo(o),object:e,face:null,faceIndex:a,uv:null,uv1:null})}}}(this,l,a))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(u),this.material.uniforms.resolution.value.set(u.z,u.w))}}e.s(["LineSegments2",0,A],92923)}]);
|
|
@@ -393,7 +393,7 @@
|
|
|
393
393
|
gl_FragColor = vec4(uColor, (body * uOpacity + rim * uOpacity * 1.4) * fade);
|
|
394
394
|
#include <colorspace_fragment>
|
|
395
395
|
}
|
|
396
|
-
`,to=({from:e,to:r,width:o=2.4,color:i,opacity:l=.22,fadeFrom:s=!1,fadeTo:u=!1,y:c=0})=>{let d=r[0]-e[0],h=r[1]-e[1],m=Math.hypot(d,h),f=(0,a.useMemo)(()=>new n.ShaderMaterial({uniforms:{uColor:{value:new n.Color},uOpacity:{value:l},uFadeFrom:{value:0},uFadeTo:{value:0}},vertexShader:ta,fragmentShader:tr,transparent:!0,depthWrite:!1,side:n.DoubleSide}),[]);if((0,a.useEffect)(()=>{f.uniforms.uColor.value.set(i),f.uniforms.uOpacity.value=l,f.uniforms.uFadeFrom.value=+!!s,f.uniforms.uFadeTo.value=+!!u},[f,i,l,s,u]),(0,a.useEffect)(()=>()=>f.dispose(),[f]),m<.01)return null;let p=Math.atan2(d,-h);return(0,t.jsx)("group",{position:[(e[0]+r[0])/2,c,(e[1]+r[1])/2],rotation:[0,-p,0],children:(0,t.jsx)("mesh",{rotation:[-Math.PI/2,0,0],material:f,renderOrder:1,children:(0,t.jsx)("planeGeometry",{args:[o,m]})})})};var ti=e.i(46991);let tn=(e,t)=>[e.x*t,-e.y*t],tl=e=>{if(!Number.isFinite(e))return null;let t=Math.round(e/60);return t>=60?`${Math.floor(t/60)}h${String(t%60).padStart(2,"0")}`:`${t} min`},ts=()=>{let e,r,o,{t:i}=(0,l.useTranslation)(),{scene:n}=(0,ey.default)(),{heading:h}=(0,d.default)(),m=(e=(0,c.useSignalKPaths)(te),r=(0,e6.default)(),o=(()=>{let e=(0,c.useSignalKPath)("navigation.position"),t=e?.latitude,r=e?.longitude,o=Number.isFinite(t)?`${t.toFixed(1)},${r.toFixed(1)}`:null,[i,n]=(0,a.useState)(null),[l,s]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!o)return;let e=!1,[t,a]=o.split(",").map(Number);return(0,e9.fetchWindField)(t,a).then(t=>{e||n(t)}).catch(()=>{u.default.apiCall(`/signalk/v2/api/weather/observations?lat=${t}&lon=${a}`).then(t=>{let a=(Array.isArray(t)?t[0]:t)?.wind;!e&&a&&Number.isFinite(a.speedTrue)&&Number.isFinite(a.directionTrue)&&s({tws:a.speedTrue,twd:a.directionTrue})}).catch(()=>{})}),()=>{e=!0}},[o]);let d=Math.floor(Date.now()/6e5);return(0,a.useMemo)(()=>{if(!i||"open-meteo"!==i.source||!Number.isFinite(t))return l&&l.tws>0?l:null;let e=(r-i.origin.lon)*Math.PI/180*6371e3*Math.cos(i.origin.lat*Math.PI/180),a=(t-i.origin.lat)*Math.PI/180*6371e3,o=Math.max(0,(Date.now()-i.start)/36e5),{u:n,v:s}=(0,e9.sampleWind)(i,e,a,o),u=Math.hypot(n,s);return u>0?{tws:u,twd:(Math.atan2(-n,-s)+2*Math.PI)%(2*Math.PI)}:null},[i,l,t,r,d])})(),(0,a.useMemo)(()=>{let t=(0,e7.courseValue)(e,"bearingTrue"),a=(0,e7.courseValue)(e,"distance"),{heading:i}=r,n=Number.isFinite(r.tws)&&r.tws>0&&Number.isFinite(r.twd),l=!n&&null!==o,s=n?r.twd:o?.twd,u=n?r.tws:o?.tws,c=n?r.twa:Number.isFinite(i)&&Number.isFinite(s)?(0,e8.wrapPi)(s-i):void 0;if(![t,a,s,u].every(Number.isFinite)||u<=0)return null;let d={x:a*Math.sin(t),y:a*Math.cos(t)},h=Math.abs((0,e8.wrapPi)(s-t))<Math.PI/2,m=(h?(0,e8.optimalUpwind)(1.943844*u):(0,e8.optimalDownwind)(1.943844*u)).twa*Math.PI/180,f={heading:(0,e8.wrapPi)(s-m)},p={heading:(0,e8.wrapPi)(s+m)},v=null;if(Number.isFinite(i)&&Number.isFinite(c)){let t=c>=0?"starboard":"port",a=tt(i),r=tt(("starboard"===t?p:f).heading),o=-(a.x*r.y)- -(a.y*r.x);if(Math.abs(o)>1e-6){let i=(-(d.x*r.y)- -(d.y*r.x))/o,n=(a.x*d.y-a.y*d.x)/o;if(i>0&&n<0){let r=e["navigation.speedOverGround"];v={point:{x:a.x*i,y:a.y*i},distance:i,time:Number.isFinite(r)&&r>.2?i/r:null,onTack:t}}}}return{waypoint:d,upwind:h,port:p,starboard:f,tack:v,forecastWind:l}},[e,r,o])),f=s.default.get("aisLengthScalingFactor")||.7;if(!m)return null;let{waypoint:p,port:v,starboard:g,tack:x,upwind:y,forecastWind:M}=m,b=tn(p,f),w=Math.min(1.3*Math.hypot(b[0],b[1])+200,1500),S=e=>[b[0]-Math.sin(e)*w,b[1]+Math.cos(e)*w],C=x?tn(x.point,f):null,j=Math.min(25,Math.max(3,.015*Math.hypot(b[0],b[1]))),P=e=>[160*Math.sin(e),-(160*Math.cos(e))],k=x?`${i(y?"laylines.tack":"laylines.gybe")} ${(0,ti.convertDistanceUnit)(x.distance)} ${(0,ti.getDistanceUnitLabel)()}${tl(x.time)?` \xb7 ${tl(x.time)}`:""}${M?` \xb7 ${i("laylines.forecastWind")}`:""}`:null;return(0,t.jsxs)("group",{rotation:[0,h,0],children:[(0,t.jsx)(to,{from:S(v.heading),to:b,color:n.laylinePort,y:-.15,width:j,opacity:.3,fadeFrom:!0}),(0,t.jsx)(to,{from:S(g.heading),to:b,color:n.laylineStarboard,y:-.15,width:j,opacity:.3,fadeFrom:!0}),(0,t.jsx)(to,{from:[0,0],to:P(v.heading),color:n.laylinePort,y:-.15,width:2.2,opacity:.35,fadeTo:!0}),(0,t.jsx)(to,{from:[0,0],to:P(g.heading),color:n.laylineStarboard,y:-.15,width:2.2,opacity:.35,fadeTo:!0}),C&&(0,t.jsxs)("group",{children:[(0,t.jsx)(L.default,{points:[[0,-.15+.05,0],[C[0],-.15+.05,C[1]]],color:n.target,lineWidth:2,dashed:!0,dashSize:2.5,gapSize:2}),(0,t.jsxs)("mesh",{position:[C[0],-.09,C[1]],rotation:[-Math.PI/2,0,0],children:[(0,t.jsx)("ringGeometry",{args:[1.8,2.6,32]}),(0,t.jsx)("meshBasicMaterial",{color:n.target,transparent:!0,opacity:.9,depthWrite:!1})]}),(0,t.jsx)(ez.Billboard,{position:[C[0],5,C[1]],children:(0,t.jsx)(eI.Text,{fontSize:1.6,color:n.target,anchorX:"center",anchorY:"bottom",font:"fonts/Roboto-Bold.ttf",outlineWidth:.04,outlineColor:n.background,children:k})})]})]})},tu=Math.PI/180,tc=2*tu,td=[5,10,15],th=["environment.wind.speedTrue","environment.wind.angleTrueWater","environment.current","navigation.headingTrue"],tm=(e,t,a)=>{let r=Math.max(0,Math.min(1,(a-e)/(t-e)));return r*r*(3-2*r)},tf=({unitArc:e,outerSeconds:r,color:o})=>{let i=(0,a.useRef)([]),n=(0,a.useRef)([]);return(0,y.useFrame)(({clock:e})=>{let t=e.elapsedTime/3%1;for(let e=0;e<6;e++){let a=(e+1-t)/6,o=i.current[e],l=n.current[e];if(!o||!l)continue;let s=Math.max(1,a*r);o.scale.set(s,1,s),l.material.opacity=.35*tm(.05,.25,a)*(1-tm(.85,1,a))}}),Array.from({length:6},(a,r)=>(0,t.jsx)("group",{ref:e=>{i.current[r]=e},position:[0,.04,0],children:(0,t.jsx)(L.default,{ref:e=>{n.current[r]=e},points:e,color:o,lineWidth:1,transparent:!0,opacity:0})},r))};function tp({rings:e}){let r=(0,a.useRef)([]),i=(0,a.useRef)(0);return(0,y.useFrame)(()=>{if(i.current++%6)return;let e=[];r.current.forEach(t=>{if(!t)return;t.style.visibility="visible";let a=t.getBoundingClientRect();e.some(e=>a.left<e.right+4&&a.right>e.left-4&&a.top<e.bottom+2&&a.bottom>e.top-2)?t.style.visibility="hidden":e.push(a)})}),e.map((e,a)=>(0,t.jsx)(o.Html,{position:e.label,zIndexRange:[5,0],style:{pointerEvents:"none"},children:(0,t.jsxs)("div",{ref:e=>{r.current[a]=e},className:"ml-2 -translate-y-1/2 whitespace-nowrap px-1.5 py-px rounded-md text-caption font-semibold tabular-nums text-hud-main bg-hud-bg/70 backdrop-blur-sm",children:[e.min," min",null!=e.nm&&(0,t.jsxs)("span",{className:"text-hud-secondary",children:[" · ",e.nm.toFixed(2)," NM"]})]})},e.min))}let tv=function(){let{scene:e,accent:r}=(0,ey.default)(),o=(0,c.useSignalKPaths)(th),i=(o["environment.wind.speedTrue"]??0)*1.943844,n=o["environment.wind.angleTrueWater"],l=o["environment.current"],s=o["navigation.headingTrue"],u=(0,a.useMemo)(()=>{if(!(i>.5)||!Number.isFinite(n))return null;let e=((0,e8.optimalUpwind)(i)?.twa??42)*tu,t=0;for(let e=40;e<=180;e+=10)t=Math.max(t,(0,e8.polarSpeed)(i,e)??0);let a=60*td[td.length-1],r=45/Math.max(1,t/1.943844*a),o=0,u=0;if(l&&Number.isFinite(l.drift)&&Number.isFinite(l.setTrue)&&Number.isFinite(s)){let e=(0,e8.wrapPi)(l.setTrue-s);o=l.drift*Math.sin(e),u=-l.drift*Math.cos(e)}let c=(e,t)=>{let a=((0,e8.polarSpeed)(i,(0,e8.wrapPi)(n-e)/tu)??0)/1.943844*t;return[(Math.sin(e)*a+o*t)*r,.08,(-Math.cos(e)*a+u*t)*r]},d=[];for(let t=n+e;t<=n+2*Math.PI-e+1e-6;t+=tc)d.push(c(t,1).map((e,t)=>1===t?0:e));return d.push(c(n+2*Math.PI-e,1).map((e,t)=>1===t?0:e)),{fixed:td.map((t,a)=>{let r=60*t,o=[];for(let t=n+e;t<=n+2*Math.PI-e+1e-6;t+=tc)o.push(c(t,r));o.push(c(n+2*Math.PI-e,r));let l=Math.abs((0,e8.wrapPi)(n))<e,s=l?null:c(0,r),u=l?null:((0,e8.polarSpeed)(i,(0,e8.wrapPi)(n)/tu)??0)/1.943844*r/1852,d=s??o[0];return{min:t,nm:u,arc:o,chord:[o[0],o[o.length-1]],here:s,label:[d[0],.6,d[2]],opacity:.8-.15*a}}),unitArc:d,outerSeconds:a}},[i,n,l,s]);return u?(0,t.jsxs)("group",{children:[(0,t.jsx)(tf,{unitArc:u.unitArc,outerSeconds:u.outerSeconds,color:e.compass}),u.fixed.map(a=>(0,t.jsxs)("group",{children:[(0,t.jsx)(L.default,{points:a.arc,color:e.compass,lineWidth:2,transparent:!0,opacity:a.opacity}),(0,t.jsx)(L.default,{points:a.chord,color:e.compassDim,lineWidth:1.5,dashed:!0,dashSize:1,gapSize:1,transparent:!0,opacity:.8*a.opacity}),a.here&&(0,t.jsxs)("mesh",{position:a.here,children:[(0,t.jsx)("sphereGeometry",{args:[.5,16,12]}),(0,t.jsx)("meshBasicMaterial",{color:r})]})]},a.min)),(0,t.jsx)(tp,{rings:u.fixed})]}):null};var tg=e.i(58567);let tx=Math.PI/180,ty=[[1,"Alpheratz",0,8,23.3,1,29,5,26,2.06],[2,"Ankaa",0,26,17,-1,42,18,22,2.4],[3,"Schedar",0,40,30.4,1,56,32,14,2.24],[4,"Diphda",0,43,35.4,-1,17,59,12,2.04],[5,"Achernar",1,37,42.8,-1,57,14,12,.46],[6,"Hamal",2,7,10.4,1,23,27,45,2],[7,"Acamar",2,58,15.7,-1,40,18,17,2.88],[8,"Menkar",3,2,16.8,1,4,5,23,2.54],[9,"Mirfak",3,24,19.4,1,49,51,40,1.79],[10,"Aldebaran",4,35,55.2,1,16,30,33,.86],[11,"Rigel",5,14,32.3,-1,8,12,6,.13],[12,"Capella",5,16,41.4,1,45,59,53,.08],[13,"Bellatrix",5,25,7.9,1,6,20,59,1.64],[14,"Elnath",5,26,17.5,1,28,36,27,1.65],[15,"Alnilam",5,36,12.8,-1,1,12,7,1.69],[16,"Betelgeuse",5,55,10.3,1,7,24,25,.5],[17,"Canopus",6,23,57.1,-1,52,41,45,-.74],[18,"Sirius",6,45,8.9,-1,16,42,58,-1.46],[19,"Adhara",6,58,37.5,-1,28,58,20,1.5],[20,"Procyon",7,39,18.1,1,5,13,30,.34],[21,"Pollux",7,45,18.9,1,28,1,34,1.14],[22,"Avior",8,22,30.8,-1,59,30,35,1.86],[23,"Suhail",9,7,59.8,-1,43,25,57,2.21],[24,"Miaplacidus",9,13,12,-1,69,43,2,1.67],[25,"Alphard",9,27,35.2,-1,8,39,31,1.98],[26,"Regulus",10,8,22.3,1,11,58,2,1.4],[27,"Dubhe",11,3,43.7,1,61,45,3,1.79],[28,"Denebola",11,49,3.6,1,14,34,19,2.14],[29,"Gienah",12,15,48.4,-1,17,32,31,2.59],[30,"Acrux",12,26,35.9,-1,63,5,57,.76],[31,"Gacrux",12,31,10,-1,57,6,48,1.64],[32,"Alioth",12,54,1.7,1,55,57,35,1.77],[33,"Spica",13,25,11.6,-1,11,9,41,.97],[34,"Alkaid",13,47,32.4,1,49,18,48,1.86],[35,"Hadar",14,3,49.4,-1,60,22,23,.61],[36,"Menkent",14,6,40.9,-1,36,22,12,2.06],[37,"Arcturus",14,15,39.7,1,19,10,57,-.05],[38,"Rigil Kentaurus",14,39,36.5,-1,60,50,2,-.27],[39,"Zubenelgenubi",14,50,52.7,-1,16,2,30,2.75],[40,"Kochab",14,50,42.3,1,74,9,20,2.08],[41,"Alphecca",15,34,41.3,1,26,42,53,2.23],[42,"Antares",16,29,24.5,-1,26,25,55,1.09],[43,"Atria",16,48,39.9,-1,69,1,40,1.91],[44,"Sabik",17,10,22.7,-1,15,43,29,2.43],[45,"Shaula",17,33,36.5,-1,37,6,14,1.62],[46,"Rasalhague",17,34,56.1,1,12,33,36,2.07],[47,"Eltanin",17,56,36.4,1,51,29,20,2.23],[48,"Kaus Australis",18,24,10.3,-1,34,23,5,1.85],[49,"Vega",18,36,56.3,1,38,47,1,.03],[50,"Nunki",18,55,15.9,-1,26,17,48,2.05],[51,"Altair",19,50,47,1,8,52,6,.77],[52,"Peacock",20,25,38.9,-1,56,44,6,1.94],[53,"Deneb",20,41,25.9,1,45,16,49,1.25],[54,"Enif",21,44,11.2,1,9,52,30,2.39],[55,"Al Na'ir",22,8,14,-1,46,57,40,1.73],[56,"Fomalhaut",22,57,39,-1,29,37,20,1.16],[57,"Markab",23,4,45.7,1,15,12,19,2.48],[0,"Polaris",2,31,49.1,1,89,15,51,1.98]].map(([e,t,a,r,o,i,n,l,s,u])=>{let c=(a+r/60+o/3600)*15*tx,d=i*(n+l/60+s/3600)*tx;return{number:e,name:t,magnitude:u,j2000:[Math.cos(d)*Math.cos(c),Math.cos(d)*Math.sin(c),Math.sin(d)]}}),tM=(e,t,a)=>{let r,o;if(!Number.isFinite(e)||!Number.isFinite(t)||!(a instanceof Date))return null;let i=e*tx;return{lst:(o=(r=a.getTime()/864e5+2440587.5-2451545)/36525,((280.46061837+360.98564736629*r+387933e-9*o*o)%360+360)%360*tx+t*tx),sinLat:Math.sin(i),cosLat:Math.cos(i)}},tb=(e,t,a,{lst:r,sinLat:o,cosLat:i})=>{let n=Math.hypot(e,t,a)||1,l=r-Math.atan2(t,e),s=Math.hypot(e,t)/n,u=a/n,c=-s*Math.sin(l),d=u*i-s*Math.cos(l)*o,h=u*o+s*Math.cos(l)*i;return{altitude:Math.asin(Math.max(-1,Math.min(1,h)))/tx,azimuth:(Math.atan2(c,d)/tx+360)%360,enu:[c,d,h]}},tw=Math.PI/180,tS=e=>Math.sin(e*tw),tC=e=>Math.cos(e*tw),tj={sun:e=>({N:0,i:0,w:282.9404+470935e-10*e,a:1,e:.016709-1151e-12*e,M:356.047+.9856002585*e}),moon:e=>({N:125.1228-.0529538083*e,i:5.1454,w:318.0634+.1643573223*e,a:60.2666,e:.0549,M:115.3654+13.0649929509*e}),venus:e=>({N:76.6799+24659e-9*e,i:3.3946+275e-10*e,w:54.891+138374e-10*e,a:.72333,e:.006773-1302e-12*e,M:48.0052+1.6021302244*e}),mars:e=>({N:49.5574+211081e-10*e,i:1.8497-178e-10*e,w:286.5016+292961e-10*e,a:1.523688,e:.093405+2516e-12*e,M:18.6021+.5240207766*e}),jupiter:e=>({N:100.4542+276854e-10*e,i:1.303-1557e-10*e,w:273.8777+164505e-10*e,a:5.20256,e:.048498+4469e-12*e,M:19.895+.0830853001*e}),saturn:e=>({N:113.6634+23898e-9*e,i:2.4886-1081e-10*e,w:339.3939+297661e-10*e,a:9.55475,e:.055546-9499e-12*e,M:316.967+.0334442282*e})},tP={venus:e=>-4.34+.013*e+42e-8*e*e*e,mars:e=>-1.51+.016*e,jupiter:e=>-9.25+.014*e,saturn:e=>-9+.044*e},tk=["venus","mars","jupiter","saturn"],tT=({N:e,i:t,w:a,a:r,e:o,M:i})=>{let n=(i%360+360)%360,l=n+o/tw*tS(n)*(1+o*tC(n));for(let e=0;e<8;e++){let e=(l-o/tw*tS(l)-n)/(1-o*tC(l));if(l-=e,1e-6>Math.abs(e))break}let s=r*(tC(l)-o),u=r*Math.sqrt(1-o*o)*tS(l),c=Math.atan2(u,s)/tw,d=Math.hypot(s,u),h=c+a;return[d*(tC(e)*tC(h)-tS(e)*tS(h)*tC(t)),d*(tS(e)*tC(h)+tC(e)*tS(h)*tC(t)),d*tS(h)*tS(t)]},tD=(e,t,a)=>[a*tC(e)*tC(t),a*tS(e)*tC(t),a*tS(t)],tF=([e,t,a])=>{let r=Math.hypot(e,t,a);return{lon:Math.atan2(t,e)/tw,lat:Math.asin(a/r)/tw,r}},tR=([e,t,a],r)=>[e,t*tC(r)-a*tS(r),t*tS(r)+a*tC(r)],tA=3600,tz=56,tI=tA*Math.tan(.7*Math.PI/180),tE=`
|
|
396
|
+
`,to=({from:e,to:r,width:o=2.4,color:i,opacity:l=.22,fadeFrom:s=!1,fadeTo:u=!1,y:c=0})=>{let d=r[0]-e[0],h=r[1]-e[1],m=Math.hypot(d,h),f=(0,a.useMemo)(()=>new n.ShaderMaterial({uniforms:{uColor:{value:new n.Color},uOpacity:{value:l},uFadeFrom:{value:0},uFadeTo:{value:0}},vertexShader:ta,fragmentShader:tr,transparent:!0,depthWrite:!1,side:n.DoubleSide}),[]);if((0,a.useEffect)(()=>{f.uniforms.uColor.value.set(i),f.uniforms.uOpacity.value=l,f.uniforms.uFadeFrom.value=+!!s,f.uniforms.uFadeTo.value=+!!u},[f,i,l,s,u]),(0,a.useEffect)(()=>()=>f.dispose(),[f]),m<.01)return null;let p=Math.atan2(d,-h);return(0,t.jsx)("group",{position:[(e[0]+r[0])/2,c,(e[1]+r[1])/2],rotation:[0,-p,0],children:(0,t.jsx)("mesh",{rotation:[-Math.PI/2,0,0],material:f,renderOrder:1,children:(0,t.jsx)("planeGeometry",{args:[o,m]})})})};var ti=e.i(46991);let tn=(e,t)=>[e.x*t,-e.y*t],tl=e=>{if(!Number.isFinite(e))return null;let t=Math.round(e/60);return t>=60?`${Math.floor(t/60)}h${String(t%60).padStart(2,"0")}`:`${t} min`},ts=()=>{let e,r,o,{t:i}=(0,l.useTranslation)(),{scene:n}=(0,ey.default)(),{heading:h}=(0,d.default)(),m=(e=(0,c.useSignalKPaths)(te),r=(0,e6.default)(),o=(()=>{let e=(0,c.useSignalKPath)("navigation.position"),t=e?.latitude,r=e?.longitude,o=Number.isFinite(t)?`${t.toFixed(1)},${r.toFixed(1)}`:null,[i,n]=(0,a.useState)(null),[l,s]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!o)return;let e=!1,[t,a]=o.split(",").map(Number);return(0,e9.fetchWindField)(t,a).then(t=>{e||n(t)}).catch(()=>{u.default.apiCall(`/signalk/v2/api/weather/observations?lat=${t}&lon=${a}`).then(t=>{let a=(Array.isArray(t)?t[0]:t)?.wind;!e&&a&&Number.isFinite(a.speedTrue)&&Number.isFinite(a.directionTrue)&&s({tws:a.speedTrue,twd:a.directionTrue})}).catch(()=>{})}),()=>{e=!0}},[o]);let d=Math.floor(Date.now()/6e5);return(0,a.useMemo)(()=>{if(!i||"open-meteo"!==i.source||!Number.isFinite(t))return l&&l.tws>0?l:null;let e=(r-i.origin.lon)*Math.PI/180*6371e3*Math.cos(i.origin.lat*Math.PI/180),a=(t-i.origin.lat)*Math.PI/180*6371e3,o=Math.max(0,(Date.now()-i.start)/36e5),{u:n,v:s}=(0,e9.sampleWind)(i,e,a,o),u=Math.hypot(n,s);return u>0?{tws:u,twd:(Math.atan2(-n,-s)+2*Math.PI)%(2*Math.PI)}:null},[i,l,t,r,d])})(),(0,a.useMemo)(()=>{let t=(0,e7.courseValue)(e,"bearingTrue"),a=(0,e7.courseValue)(e,"distance"),{heading:i}=r,n=Number.isFinite(r.tws)&&r.tws>0&&Number.isFinite(r.twd),l=!n&&null!==o,s=n?r.twd:o?.twd,u=n?r.tws:o?.tws,c=n?r.twa:Number.isFinite(i)&&Number.isFinite(s)?(0,e8.wrapPi)(s-i):void 0;if(![t,a,s,u].every(Number.isFinite)||u<=0)return null;let d={x:a*Math.sin(t),y:a*Math.cos(t)},h=Math.abs((0,e8.wrapPi)(s-t))<Math.PI/2,m=(h?(0,e8.optimalUpwind)(1.943844*u):(0,e8.optimalDownwind)(1.943844*u)).twa*Math.PI/180,f={heading:(0,e8.wrapPi)(s-m)},p={heading:(0,e8.wrapPi)(s+m)},v=null;if(Number.isFinite(i)&&Number.isFinite(c)){let t=c>=0?"starboard":"port",a=tt(i),r=tt(("starboard"===t?p:f).heading),o=-(a.x*r.y)- -(a.y*r.x);if(Math.abs(o)>1e-6){let i=(-(d.x*r.y)- -(d.y*r.x))/o,n=(a.x*d.y-a.y*d.x)/o;if(i>0&&n<0){let r=e["navigation.speedOverGround"];v={point:{x:a.x*i,y:a.y*i},distance:i,time:Number.isFinite(r)&&r>.2?i/r:null,onTack:t}}}}return{waypoint:d,upwind:h,port:p,starboard:f,tack:v,forecastWind:l}},[e,r,o])),f=s.default.get("aisLengthScalingFactor")||.7;if(!m)return null;let{waypoint:p,port:v,starboard:g,tack:x,upwind:y,forecastWind:M}=m,b=tn(p,f),w=Math.min(1.3*Math.hypot(b[0],b[1])+200,1500),S=e=>[b[0]-Math.sin(e)*w,b[1]+Math.cos(e)*w],C=x?tn(x.point,f):null,j=Math.min(25,Math.max(3,.015*Math.hypot(b[0],b[1]))),P=e=>[160*Math.sin(e),-(160*Math.cos(e))],k=x?`${i(y?"laylines.tack":"laylines.gybe")} ${(0,ti.convertDistanceUnit)(x.distance)} ${(0,ti.getDistanceUnitLabel)()}${tl(x.time)?` \xb7 ${tl(x.time)}`:""}${M?` \xb7 ${i("laylines.forecastWind")}`:""}`:null;return(0,t.jsxs)("group",{rotation:[0,h,0],children:[(0,t.jsx)(to,{from:S(v.heading),to:b,color:n.laylinePort,y:-.15,width:j,opacity:.3,fadeFrom:!0}),(0,t.jsx)(to,{from:S(g.heading),to:b,color:n.laylineStarboard,y:-.15,width:j,opacity:.3,fadeFrom:!0}),(0,t.jsx)(to,{from:[0,0],to:P(v.heading),color:n.laylinePort,y:-.15,width:2.2,opacity:.35,fadeTo:!0}),(0,t.jsx)(to,{from:[0,0],to:P(g.heading),color:n.laylineStarboard,y:-.15,width:2.2,opacity:.35,fadeTo:!0}),C&&(0,t.jsxs)("group",{children:[(0,t.jsx)(L.default,{points:[[0,-.15+.05,0],[C[0],-.15+.05,C[1]]],color:n.target,lineWidth:2,dashed:!0,dashSize:2.5,gapSize:2}),(0,t.jsxs)("mesh",{position:[C[0],-.09,C[1]],rotation:[-Math.PI/2,0,0],children:[(0,t.jsx)("ringGeometry",{args:[1.8,2.6,32]}),(0,t.jsx)("meshBasicMaterial",{color:n.target,transparent:!0,opacity:.9,depthWrite:!1})]}),(0,t.jsx)(ez.Billboard,{position:[C[0],5,C[1]],children:(0,t.jsx)(eI.Text,{fontSize:1.6,color:n.target,anchorX:"center",anchorY:"bottom",font:"fonts/Roboto-Bold.ttf",outlineWidth:.04,outlineColor:n.background,children:k})})]})]})},tu=Math.PI/180,tc=2*tu,td=[5,10,15],th=["environment.wind.speedTrue","environment.wind.angleTrueWater","environment.current","navigation.headingTrue"],tm=(e,t,a)=>{let r=Math.max(0,Math.min(1,(a-e)/(t-e)));return r*r*(3-2*r)},tf=({unitArc:e,outerSeconds:r,color:o})=>{let i=(0,a.useRef)([]),n=(0,a.useRef)([]);return(0,y.useFrame)(({clock:e})=>{let t=e.elapsedTime/3%1;for(let e=0;e<6;e++){let a=(e+1-t)/6,o=i.current[e],l=n.current[e];if(!o||!l)continue;let s=Math.max(1,a*r);o.scale.set(s,1,s),l.material.opacity=.35*tm(.05,.25,a)*(1-tm(.85,1,a))}}),Array.from({length:6},(a,r)=>(0,t.jsx)("group",{ref:e=>{i.current[r]=e},position:[0,.04,0],children:(0,t.jsx)(L.default,{ref:e=>{n.current[r]=e},points:e,color:o,lineWidth:1,transparent:!0,opacity:0})},r))};function tp({rings:e}){let r=(0,a.useRef)([]),i=(0,a.useRef)(0);return(0,y.useFrame)(()=>{if(i.current++%6)return;let e=r.current.filter(Boolean),t=e.map(e=>e.getBoundingClientRect()),a=[];e.forEach((e,r)=>{let o=t[r],i=a.some(e=>o.left<e.right+4&&o.right>e.left-4&&o.top<e.bottom+2&&o.bottom>e.top-2);i||a.push(o);let n=i?"hidden":"visible";e.style.visibility!==n&&(e.style.visibility=n)})}),e.map((e,a)=>(0,t.jsx)(o.Html,{position:e.label,zIndexRange:[5,0],style:{pointerEvents:"none"},children:(0,t.jsxs)("div",{ref:e=>{r.current[a]=e},className:"ml-2 -translate-y-1/2 whitespace-nowrap px-1.5 py-px rounded-md text-caption font-semibold tabular-nums text-hud-main bg-hud-bg/70 backdrop-blur-sm",children:[e.min," min",null!=e.nm&&(0,t.jsxs)("span",{className:"text-hud-secondary",children:[" · ",e.nm.toFixed(2)," NM"]})]})},e.min))}let tv=function(){let{scene:e,accent:r}=(0,ey.default)(),o=(0,c.useSignalKPaths)(th),i=(o["environment.wind.speedTrue"]??0)*1.943844,n=o["environment.wind.angleTrueWater"],l=o["environment.current"],s=o["navigation.headingTrue"],u=(0,a.useMemo)(()=>{if(!(i>.5)||!Number.isFinite(n))return null;let e=((0,e8.optimalUpwind)(i)?.twa??42)*tu,t=0;for(let e=40;e<=180;e+=10)t=Math.max(t,(0,e8.polarSpeed)(i,e)??0);let a=60*td[td.length-1],r=45/Math.max(1,t/1.943844*a),o=0,u=0;if(l&&Number.isFinite(l.drift)&&Number.isFinite(l.setTrue)&&Number.isFinite(s)){let e=(0,e8.wrapPi)(l.setTrue-s);o=l.drift*Math.sin(e),u=-l.drift*Math.cos(e)}let c=(e,t)=>{let a=((0,e8.polarSpeed)(i,(0,e8.wrapPi)(n-e)/tu)??0)/1.943844*t;return[(Math.sin(e)*a+o*t)*r,.08,(-Math.cos(e)*a+u*t)*r]},d=[];for(let t=n+e;t<=n+2*Math.PI-e+1e-6;t+=tc)d.push(c(t,1).map((e,t)=>1===t?0:e));return d.push(c(n+2*Math.PI-e,1).map((e,t)=>1===t?0:e)),{fixed:td.map((t,a)=>{let r=60*t,o=[];for(let t=n+e;t<=n+2*Math.PI-e+1e-6;t+=tc)o.push(c(t,r));o.push(c(n+2*Math.PI-e,r));let l=Math.abs((0,e8.wrapPi)(n))<e,s=l?null:c(0,r),u=l?null:((0,e8.polarSpeed)(i,(0,e8.wrapPi)(n)/tu)??0)/1.943844*r/1852,d=s??o[0];return{min:t,nm:u,arc:o,chord:[o[0],o[o.length-1]],here:s,label:[d[0],.6,d[2]],opacity:.8-.15*a}}),unitArc:d,outerSeconds:a}},[i,n,l,s]);return u?(0,t.jsxs)("group",{children:[(0,t.jsx)(tf,{unitArc:u.unitArc,outerSeconds:u.outerSeconds,color:e.compass}),u.fixed.map(a=>(0,t.jsxs)("group",{children:[(0,t.jsx)(L.default,{points:a.arc,color:e.compass,lineWidth:2,transparent:!0,opacity:a.opacity}),(0,t.jsx)(L.default,{points:a.chord,color:e.compassDim,lineWidth:1.5,dashed:!0,dashSize:1,gapSize:1,transparent:!0,opacity:.8*a.opacity}),a.here&&(0,t.jsxs)("mesh",{position:a.here,children:[(0,t.jsx)("sphereGeometry",{args:[.5,16,12]}),(0,t.jsx)("meshBasicMaterial",{color:r})]})]},a.min)),(0,t.jsx)(tp,{rings:u.fixed})]}):null};var tg=e.i(58567);let tx=Math.PI/180,ty=[[1,"Alpheratz",0,8,23.3,1,29,5,26,2.06],[2,"Ankaa",0,26,17,-1,42,18,22,2.4],[3,"Schedar",0,40,30.4,1,56,32,14,2.24],[4,"Diphda",0,43,35.4,-1,17,59,12,2.04],[5,"Achernar",1,37,42.8,-1,57,14,12,.46],[6,"Hamal",2,7,10.4,1,23,27,45,2],[7,"Acamar",2,58,15.7,-1,40,18,17,2.88],[8,"Menkar",3,2,16.8,1,4,5,23,2.54],[9,"Mirfak",3,24,19.4,1,49,51,40,1.79],[10,"Aldebaran",4,35,55.2,1,16,30,33,.86],[11,"Rigel",5,14,32.3,-1,8,12,6,.13],[12,"Capella",5,16,41.4,1,45,59,53,.08],[13,"Bellatrix",5,25,7.9,1,6,20,59,1.64],[14,"Elnath",5,26,17.5,1,28,36,27,1.65],[15,"Alnilam",5,36,12.8,-1,1,12,7,1.69],[16,"Betelgeuse",5,55,10.3,1,7,24,25,.5],[17,"Canopus",6,23,57.1,-1,52,41,45,-.74],[18,"Sirius",6,45,8.9,-1,16,42,58,-1.46],[19,"Adhara",6,58,37.5,-1,28,58,20,1.5],[20,"Procyon",7,39,18.1,1,5,13,30,.34],[21,"Pollux",7,45,18.9,1,28,1,34,1.14],[22,"Avior",8,22,30.8,-1,59,30,35,1.86],[23,"Suhail",9,7,59.8,-1,43,25,57,2.21],[24,"Miaplacidus",9,13,12,-1,69,43,2,1.67],[25,"Alphard",9,27,35.2,-1,8,39,31,1.98],[26,"Regulus",10,8,22.3,1,11,58,2,1.4],[27,"Dubhe",11,3,43.7,1,61,45,3,1.79],[28,"Denebola",11,49,3.6,1,14,34,19,2.14],[29,"Gienah",12,15,48.4,-1,17,32,31,2.59],[30,"Acrux",12,26,35.9,-1,63,5,57,.76],[31,"Gacrux",12,31,10,-1,57,6,48,1.64],[32,"Alioth",12,54,1.7,1,55,57,35,1.77],[33,"Spica",13,25,11.6,-1,11,9,41,.97],[34,"Alkaid",13,47,32.4,1,49,18,48,1.86],[35,"Hadar",14,3,49.4,-1,60,22,23,.61],[36,"Menkent",14,6,40.9,-1,36,22,12,2.06],[37,"Arcturus",14,15,39.7,1,19,10,57,-.05],[38,"Rigil Kentaurus",14,39,36.5,-1,60,50,2,-.27],[39,"Zubenelgenubi",14,50,52.7,-1,16,2,30,2.75],[40,"Kochab",14,50,42.3,1,74,9,20,2.08],[41,"Alphecca",15,34,41.3,1,26,42,53,2.23],[42,"Antares",16,29,24.5,-1,26,25,55,1.09],[43,"Atria",16,48,39.9,-1,69,1,40,1.91],[44,"Sabik",17,10,22.7,-1,15,43,29,2.43],[45,"Shaula",17,33,36.5,-1,37,6,14,1.62],[46,"Rasalhague",17,34,56.1,1,12,33,36,2.07],[47,"Eltanin",17,56,36.4,1,51,29,20,2.23],[48,"Kaus Australis",18,24,10.3,-1,34,23,5,1.85],[49,"Vega",18,36,56.3,1,38,47,1,.03],[50,"Nunki",18,55,15.9,-1,26,17,48,2.05],[51,"Altair",19,50,47,1,8,52,6,.77],[52,"Peacock",20,25,38.9,-1,56,44,6,1.94],[53,"Deneb",20,41,25.9,1,45,16,49,1.25],[54,"Enif",21,44,11.2,1,9,52,30,2.39],[55,"Al Na'ir",22,8,14,-1,46,57,40,1.73],[56,"Fomalhaut",22,57,39,-1,29,37,20,1.16],[57,"Markab",23,4,45.7,1,15,12,19,2.48],[0,"Polaris",2,31,49.1,1,89,15,51,1.98]].map(([e,t,a,r,o,i,n,l,s,u])=>{let c=(a+r/60+o/3600)*15*tx,d=i*(n+l/60+s/3600)*tx;return{number:e,name:t,magnitude:u,j2000:[Math.cos(d)*Math.cos(c),Math.cos(d)*Math.sin(c),Math.sin(d)]}}),tM=(e,t,a)=>{let r,o;if(!Number.isFinite(e)||!Number.isFinite(t)||!(a instanceof Date))return null;let i=e*tx;return{lst:(o=(r=a.getTime()/864e5+2440587.5-2451545)/36525,((280.46061837+360.98564736629*r+387933e-9*o*o)%360+360)%360*tx+t*tx),sinLat:Math.sin(i),cosLat:Math.cos(i)}},tb=(e,t,a,{lst:r,sinLat:o,cosLat:i})=>{let n=Math.hypot(e,t,a)||1,l=r-Math.atan2(t,e),s=Math.hypot(e,t)/n,u=a/n,c=-s*Math.sin(l),d=u*i-s*Math.cos(l)*o,h=u*o+s*Math.cos(l)*i;return{altitude:Math.asin(Math.max(-1,Math.min(1,h)))/tx,azimuth:(Math.atan2(c,d)/tx+360)%360,enu:[c,d,h]}},tw=Math.PI/180,tS=e=>Math.sin(e*tw),tC=e=>Math.cos(e*tw),tj={sun:e=>({N:0,i:0,w:282.9404+470935e-10*e,a:1,e:.016709-1151e-12*e,M:356.047+.9856002585*e}),moon:e=>({N:125.1228-.0529538083*e,i:5.1454,w:318.0634+.1643573223*e,a:60.2666,e:.0549,M:115.3654+13.0649929509*e}),venus:e=>({N:76.6799+24659e-9*e,i:3.3946+275e-10*e,w:54.891+138374e-10*e,a:.72333,e:.006773-1302e-12*e,M:48.0052+1.6021302244*e}),mars:e=>({N:49.5574+211081e-10*e,i:1.8497-178e-10*e,w:286.5016+292961e-10*e,a:1.523688,e:.093405+2516e-12*e,M:18.6021+.5240207766*e}),jupiter:e=>({N:100.4542+276854e-10*e,i:1.303-1557e-10*e,w:273.8777+164505e-10*e,a:5.20256,e:.048498+4469e-12*e,M:19.895+.0830853001*e}),saturn:e=>({N:113.6634+23898e-9*e,i:2.4886-1081e-10*e,w:339.3939+297661e-10*e,a:9.55475,e:.055546-9499e-12*e,M:316.967+.0334442282*e})},tP={venus:e=>-4.34+.013*e+42e-8*e*e*e,mars:e=>-1.51+.016*e,jupiter:e=>-9.25+.014*e,saturn:e=>-9+.044*e},tk=["venus","mars","jupiter","saturn"],tT=({N:e,i:t,w:a,a:r,e:o,M:i})=>{let n=(i%360+360)%360,l=n+o/tw*tS(n)*(1+o*tC(n));for(let e=0;e<8;e++){let e=(l-o/tw*tS(l)-n)/(1-o*tC(l));if(l-=e,1e-6>Math.abs(e))break}let s=r*(tC(l)-o),u=r*Math.sqrt(1-o*o)*tS(l),c=Math.atan2(u,s)/tw,d=Math.hypot(s,u),h=c+a;return[d*(tC(e)*tC(h)-tS(e)*tS(h)*tC(t)),d*(tS(e)*tC(h)+tC(e)*tS(h)*tC(t)),d*tS(h)*tS(t)]},tD=(e,t,a)=>[a*tC(e)*tC(t),a*tS(e)*tC(t),a*tS(t)],tF=([e,t,a])=>{let r=Math.hypot(e,t,a);return{lon:Math.atan2(t,e)/tw,lat:Math.asin(a/r)/tw,r}},tR=([e,t,a],r)=>[e,t*tC(r)-a*tS(r),t*tS(r)+a*tC(r)],tA=3600,tz=56,tI=tA*Math.tan(.7*Math.PI/180),tE=`
|
|
397
397
|
attribute float aSize;
|
|
398
398
|
attribute float aAlpha;
|
|
399
399
|
varying float vAlpha;
|