ocearo-ui 0.1.21 → 2.0.0
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/README.fr.md +123 -133
- package/README.md +120 -134
- package/__next.__PAGE__.txt +19 -5
- package/__next._full.txt +11 -11
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/0-c2-u5p6bxzo.js +1 -0
- package/_next/static/chunks/01atsfq_4opab.js +1 -0
- package/_next/static/chunks/0cx639tthxlz4.js +1 -0
- package/_next/static/chunks/0h2qsuyze9ds1.js +1 -0
- package/_next/static/chunks/0iqdztntvxh3c.js +119 -0
- package/_next/static/chunks/0iztd835j5p1n.js +700 -0
- package/_next/static/chunks/{2nxsyowmuwpjy.js → 0jfox92up1jvy.js} +1 -1
- package/_next/static/chunks/0jpa5m78l0ib0.js +1 -0
- package/_next/static/chunks/0kpstejrka-7k.js +1 -0
- package/_next/static/chunks/0n95joti2n2py.js +3 -0
- package/_next/static/chunks/0oaqe70syw_b5.js +1 -0
- package/_next/static/chunks/0ohleay4roayh.js +353 -0
- package/_next/static/chunks/0on1skx9l54-9.js +1 -0
- package/_next/static/chunks/0w_skktmh3e48.js +1 -0
- package/_next/static/chunks/0y-dctk-kmqss.js +1 -0
- package/_next/static/chunks/0yiqocv54ogoq.js +1 -0
- package/_next/static/chunks/0zlk2mlkvbtj1.js +1 -0
- package/_next/static/chunks/0zwc9m4qgtwle.js +1 -0
- package/_next/static/chunks/11awvgcou7v4r.js +1 -0
- package/_next/static/chunks/144mjqdrx42lq.js +1 -0
- package/_next/static/chunks/1d81m3g9jqkob.js +1 -0
- package/_next/static/chunks/1ed7ayfg19cjb.js +1 -0
- package/_next/static/chunks/1epya-yh2wvj2.js +1 -0
- package/_next/static/chunks/1exvcc71cgr4t.js +446 -0
- package/_next/static/chunks/1fzzb4jtgv5gg.js +9 -0
- package/_next/static/chunks/1g8fbzv0hu0i2.js +1 -0
- package/_next/static/chunks/1gaiqhzy_0d7s.js +1 -0
- package/_next/static/chunks/1gq4t2dyr7rq3.js +1 -0
- package/_next/static/chunks/1l-jew0-1-3eq.js +30 -0
- package/_next/static/chunks/1ptj3mv8b_tzs.js +1 -0
- package/_next/static/chunks/1w1xks0hp_tlr.js +346 -0
- package/_next/static/chunks/1xekc18cyi4sx.js +1 -0
- package/_next/static/chunks/1y35unwvy8p98.js +1 -0
- package/_next/static/chunks/2aq8orcir5h03.js +1 -0
- package/_next/static/chunks/2fdpvhx4oo81h.js +1 -0
- package/_next/static/chunks/2g-xpe7xnropn.js +409 -0
- package/_next/static/chunks/2kmptoy43h0mx.js +1 -0
- package/_next/static/chunks/2n86yq1wz1yx7.js +1 -0
- package/_next/static/chunks/2r_h93rt76vka.js +1 -0
- package/_next/static/chunks/2rebcvig176xk.js +564 -0
- package/_next/static/chunks/2w71oj1brox5z.js +1 -0
- package/_next/static/chunks/2wayx8t5r5fi9.js +1 -0
- package/_next/static/chunks/2y3d8zopa8r5r.css +3 -0
- package/_next/static/chunks/3--qzv1u6c7_7.js +1 -0
- package/_next/static/chunks/31lugryguappr.js +1 -0
- package/_next/static/chunks/32j_j396qs7be.js +1 -0
- package/_next/static/chunks/32yn_fc-es66m.js +22 -0
- package/_next/static/chunks/34_oyzp8_pi_m.js +1 -0
- package/_next/static/chunks/34wvn5zw0a69w.js +1 -0
- package/_next/static/chunks/37t6vg8fb1-z8.js +1 -0
- package/_next/static/chunks/3k5itcabq5oqs.js +9 -0
- package/_next/static/chunks/3ktj0iemsr1m-.js +1 -0
- package/_next/static/chunks/3nm7o0eq5abhg.js +1 -0
- package/_next/static/chunks/3s6nzrbk-8mnv.js +31 -0
- package/_next/static/chunks/3td9mnhvcj9cq.js +1 -0
- package/_next/static/chunks/3xjnsskh0tayo.js +1 -0
- package/_next/static/chunks/3zqx8h9yg5-ch.js +1 -0
- package/_next/static/chunks/turbopack-1h111qg8l92rw.js +1 -0
- package/_not-found/__next._full.txt +12 -12
- package/_not-found/__next._not-found.__PAGE__.txt +19 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +12 -12
- package/boats/boats.json +40 -5
- package/index.html +1 -1
- package/index.txt +11 -11
- package/package.json +14 -14
- package/settings/__next._full.txt +14 -14
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +22 -5
- package/settings.html +1 -1
- package/settings.txt +14 -14
- package/__next._head.txt +0 -6
- package/__next._index.txt +0 -5
- package/_next/static/chunks/009rlietvsaq2.js +0 -1
- package/_next/static/chunks/070stlm97b9a2.js +0 -1
- package/_next/static/chunks/08gn5_gd6amkq.js +0 -1
- package/_next/static/chunks/0abo2oxxw3hpi.js +0 -1
- package/_next/static/chunks/0jzbiie0nzar2.js +0 -1
- package/_next/static/chunks/0l9s4rhr00adq.js +0 -1
- package/_next/static/chunks/0ri_um14-5x7u.js +0 -1
- package/_next/static/chunks/0utifqhyv2cuc.js +0 -1
- package/_next/static/chunks/0uvr7xkt_5uno.js +0 -1
- package/_next/static/chunks/0wzr1__so6xme.js +0 -1
- package/_next/static/chunks/0zjxnzbxh76mt.js +0 -1
- package/_next/static/chunks/11ln9lzzbo35q.js +0 -1
- package/_next/static/chunks/1bz0tcmhjmjgh.js +0 -1
- package/_next/static/chunks/1d4h-sglyo8ft.js +0 -1
- package/_next/static/chunks/1gizigk3w6q7j.js +0 -31
- package/_next/static/chunks/1porlo35ga4zu.js +0 -1
- package/_next/static/chunks/1ptwltjb3h6jf.js +0 -4
- package/_next/static/chunks/1sq_733weprvs.js +0 -1
- package/_next/static/chunks/1w1ua0-p5lk1e.js +0 -38
- package/_next/static/chunks/1wv5e5qomv-7g.css +0 -3
- package/_next/static/chunks/27hn45pv56pv7.js +0 -393
- package/_next/static/chunks/28y-j215vt42m.js +0 -1
- package/_next/static/chunks/29-ag86gvlc40.js +0 -9
- package/_next/static/chunks/2a0yjir_3mk1m.js +0 -1
- package/_next/static/chunks/2atijj_pkc4uc.js +0 -2
- package/_next/static/chunks/2baz6j1q913qw.js +0 -1
- package/_next/static/chunks/2ccpehidlaq88.js +0 -1
- package/_next/static/chunks/2lez3uww9j4t0.js +0 -135
- package/_next/static/chunks/2lvvt2f1l5sfu.js +0 -1
- package/_next/static/chunks/2nd5amcst4lhp.js +0 -1
- package/_next/static/chunks/2pwmb4pkqygy_.js +0 -1
- package/_next/static/chunks/2rsdqsatgq9ta.js +0 -1
- package/_next/static/chunks/2uao1hfsz-oy8.js +0 -1
- package/_next/static/chunks/2urimbxg5bqv3.js +0 -1
- package/_next/static/chunks/2yghvponatk1x.js +0 -135
- package/_next/static/chunks/31i14-jemhnic.js +0 -863
- package/_next/static/chunks/32cbrrsp-x35l.js +0 -1
- package/_next/static/chunks/36ra6xjie0dsv.js +0 -9
- package/_next/static/chunks/3dt63tw_9r0jt.js +0 -38
- package/_next/static/chunks/3iuz3f0429awx.js +0 -1
- package/_next/static/chunks/3jh1u-s3k0bkk.js +0 -1
- package/_next/static/chunks/3jupxlga7r_do.js +0 -1
- package/_next/static/chunks/3m57lnggu30tr.js +0 -243
- package/_next/static/chunks/3rhgquok36e79.js +0 -1
- package/_next/static/chunks/3sgrkzk20mxs6.js +0 -54
- package/_next/static/chunks/42dfiu6iby3fq.js +0 -1
- package/_next/static/chunks/43ps2cu5ahf8n.js +0 -3
- package/_next/static/chunks/turbopack-0pirmko-w-775.js +0 -1
- package/_not-found/__next._head.txt +0 -6
- package/_not-found/__next._index.txt +0 -5
- package/_not-found/__next._not-found.txt +0 -5
- package/boats/ais/ais-30.glb +0 -0
- package/boats/ais/ais-31.glb +0 -0
- package/boats/ais/ais-35.glb +0 -0
- package/boats/ais/ais-36.glb +0 -0
- package/boats/ais/ais-37.glb +0 -0
- package/boats/ais/ais-40.glb +0 -0
- package/boats/ais/ais-50.glb +0 -0
- package/boats/ais/ais-60.glb +0 -0
- package/boats/ais/ais-70.glb +0 -0
- package/boats/ais/ais-80.glb +0 -0
- package/settings/__next._head.txt +0 -6
- package/settings/__next._index.txt +0 -5
- package/settings/__next.settings.txt +0 -5
- /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → baa0rBM5TIECz8JV_tLT6}/_buildManifest.js +0 -0
- /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → baa0rBM5TIECz8JV_tLT6}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → baa0rBM5TIECz8JV_tLT6}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,78461,e=>{"use strict";var t=e.i(71645),n=e.i(85709),i=e.i(67561);let r=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],a=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,i.useOcearoContext)(),o=(0,n.useSignalKPaths)(r),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),u=o["navigation.position"],c=Number.isFinite(u?.latitude)&&Number.isFinite(u?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!c)return{x:0,y:0};let t={lat:u.latitude,lon:u.longitude};return e(t,(a||(a=t),a))},[u,c,e]),hasFix:c,hasHeading:l}}])},5941,e=>{"use strict";let t=[1,.8,.6];function n(e){return t[Math.min(Math.max(e,0),2)]}function i(e,t){return Math.max(.05,Math.min(1,1-.6*e-.3*t))}function r(e,t){return Math.PI/6*Math.max(0,1-1.9438444924574*t/30)*(1-e)}function a(e,t,n){let i=Math.min(1,1.9438444924574*(e.tws||0)/30),r=t.tension||.5;switch(n){case"mainSheet":return Math.min(1,.5*i+.3*r+.3*t.mainCar);case"jibSheet":return Math.min(1,.5*i+.3*r+.3*t.jibCar);case"vang":return Math.min(1,.6*i+.4*r);case"cunningham":return Math.min(1,.4*i+.6*r);case"backstay":return Math.min(1,Math.max(0,1-Math.abs(Math.atan2(Math.sin(e.awa||0),Math.cos(e.awa||0)))/Math.PI)*i*.9+.3*r);default:return r}}function o(e){let t=Math.max(0,Math.min(1,e));if(t<=.5){let e=2*t;return{r:e,g:1-.3*e,b:0}}return{r:1,g:.7*(1-(t-.5)*2),b:0}}e.s(["getReefHeightFactor",0,n,"tensionToColor",0,o,"updateSailTrim",0,function({tws:e=0,twa:t=0,awa:s=0,mainCar:l=.5,jibCar:u=.5,tension:c=.5}){let d,f=(d=1.9438444924574*e)>25?2:+(d>18),p=n(f),m=i(l,c),h=i(u,c),v=r(l,e),g=r(u,e),y={tws:e,twa:t,awa:s},b={mainCar:l,jibCar:u,tension:c},x={mainSheet:a(y,b,"mainSheet"),jibSheet:a(y,b,"jibSheet"),vang:a(y,b,"vang"),cunningham:a(y,b,"cunningham"),backstay:a(y,b,"backstay")},w={mainSheet:o(x.mainSheet),jibSheet:o(x.jibSheet),vang:o(x.vang),cunningham:o(x.cunningham),backstay:o(x.backstay)};return{reefLevel:f,reefHeightFactor:p,mainCamber:m,jibCamber:h,mainTwist:v,jibTwist:g,tensions:x,tensionColors:w}}])},77291,e=>{"use strict";var t=e.i(71645),n=e.i(62588),i=e.i(85709),r=e.i(61969),a=e.i(539);let o=Math.PI/180,s={power:1,sail:2,fishing:3,restricted:4},l=e=>{let t=String(e.navState||"").toLowerCase();if(/not under command|restricted|constrained/.test(t))return"restricted";if(/fishing/.test(t))return"fishing";if(/sailing/.test(t))return"sail";if(/motoring|engine/.test(t))return"power";let n=Number(e.shipType);return 36===n?"sail":30===n?"fishing":33===n?"restricted":"power"},u=(e,t,n)=>(0,a.wrapPi)(Math.atan2(t.x-e.x,t.y-e.y)-n),c=(e,t,n)=>{let i={x:0,y:0},r=u(i,t,e.course),l=u(t,i,t.course),c=Math.sign(l)||1,d=e=>Math.abs(e)>112.5*o;if(d(r)&&t.speed>e.speed)return{ownRole:"stand-on",rule:"13",reason:"overtakenByTarget",targetTurn:0};if(d(l)&&e.speed>t.speed)return{ownRole:"give-way",rule:"13",reason:"overtaking",targetTurn:0};let f=s[e.category]??1,p=s[t.category]??1;if(f!==p)return f<p?{ownRole:"give-way",rule:"18",reason:`giveWayTo_${t.category}`,targetTurn:0}:{ownRole:"stand-on",rule:"18",reason:`standOnFrom_${t.category}`,targetTurn:c};if("sail"===e.category&&Number.isFinite(n)){let i=(0,a.wrapPi)(n-e.course)>=0?"starboard":"port";return i!==((0,a.wrapPi)(n-t.course)>=0?"starboard":"port")?"port"===i?{ownRole:"give-way",rule:"12a-i",reason:"portTack",targetTurn:0}:{ownRole:"stand-on",rule:"12a-i",reason:"targetPortTack",targetTurn:c}:t.x*Math.sin(n)+t.y*Math.cos(n)>0?{ownRole:"stand-on",rule:"12a-ii",reason:"targetWindward",targetTurn:c}:{ownRole:"give-way",rule:"12a-ii",reason:"ownWindward",targetTurn:0}}return Math.abs((0,a.wrapPi)(t.course-e.course-Math.PI))<10*o&&Math.abs(r)<6*o?{ownRole:"both",rule:"14",reason:"headOn",targetTurn:1}:r>0?{ownRole:"give-way",rule:"15",reason:"crossingStarboard",targetTurn:0}:{ownRole:"stand-on",rule:"15",reason:"crossingPort",targetTurn:c}};var d=e.i(83402),f=e.i(67561);let p=[],m=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,({always:e=!1}={})=>{let a,o,{targets:s}=(0,n.useAIS)({passive:!0}),{states:u}=(0,f.useOcearoContext)(),h=e||u.ais?s:p,{twd:v,heading:g}=(0,r.default)(),y=(0,i.useSignalKPaths)(m),b=(a=(0,i.useSignalKPrefix)("propulsion."),o=d.default.get("ownVesselCategory"),(0,t.useMemo)(()=>"sail"===o||"power"===o?o:Object.entries(a).some(([e,t])=>e.endsWith(".revolutions")&&Number(t)>.5||e.endsWith(".state")&&"started"===t)?"power":"sail",[a,o])),x=d.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let e=y["navigation.courseOverGroundTrue"]??g,t=y["navigation.speedOverGround"]??0,n=[];if(Number.isFinite(e))for(let i of h){if("danger"!==i.risk)continue;let r=i.cog??i.cogMagnetic??i.heading;if(!Number.isFinite(r)||null===i.sceneX)continue;let a=c({course:e,speed:t,category:b},{x:i.sceneX/x,y:-i.sceneZ/x,course:r,speed:i.sog??0,category:l(i)},v);n.push({target:{...i},role:a})}n.sort((e,t)=>(e.target.tcpaSeconds??1/0)-(t.target.tcpaSeconds??1/0));let i={};for(let e of h)"close"===e.risk?i[e.mmsi]="close":"danger"===e.risk&&(i[e.mmsi]="giveWay");for(let e of n)i[e.target.mmsi]="stand-on"===e.role.ownRole?"yields":"giveWay";let r=n.filter(e=>"stand-on"!==e.role.ownRole);return{ownCategory:b,encounters:n,statuses:i,giveWay:r.length>0,giveWayTo:r[0]||null,primary:n[0]||null}},[h,v,g,y,b,x])}],77291)},61969,e=>{"use strict";var t=e.i(71645),n=e.i(85709),i=e.i(539);let r=180/Math.PI,a=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio","navigation.courseGreatCircle.nextPoint.bearingTrue"];e.s(["default",0,()=>{let e=(0,n.useSignalKPaths)(a);return(0,t.useMemo)(()=>{let t=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,n=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,a=e["environment.wind.speedTrue"]??null,o=e["environment.wind.angleTrueWater"]??null,s=e["environment.wind.directionTrue"]??null;null===s&&Number.isFinite(o)&&Number.isFinite(n)&&(s=(0,i.wrapPi)(n+o));let l=e["performance.polarSpeed"]??(Number.isFinite(a)&&Number.isFinite(o)?(0,i.polarSpeedSi)(a,o):null),u=e["performance.polarSpeedRatio"]??null;null===u&&Number.isFinite(t)&&Number.isFinite(l)&&l>.2&&(u=t/l);let c=Number.isFinite(t)&&Number.isFinite(l)?(t-l)*1.943844:null,d=null,f=null,p=!Number.isFinite(o)||Math.abs(o)<Math.PI/2;if(Number.isFinite(a)){let e=p?(0,i.optimalUpwind)(1.943844*a):(0,i.optimalDownwind)(1.943844*a);e&&(d=e.twa/r,Number.isFinite(s)&&Number.isFinite(o)&&(f=(0,i.wrapPi)(s-Math.sign(o||1)*d)))}let m=e["navigation.courseGreatCircle.nextPoint.bearingTrue"],h=null;if(Number.isFinite(m)&&Number.isFinite(s)&&Number.isFinite(a)){let e=(0,i.bestVmcHeading)({twd:s,tws:a,bearing:m}),t=Number.isFinite(n)?(0,i.vmcForHeading)({twd:s,tws:a,bearing:m,heading:n}):null;h=e?{bearing:m,best:e,current:t}:null}return{ratio:u,polarSpeed:l,boatSpeed:t,deltaKn:c,heading:n,twd:s,tws:a,twa:o,targetTwa:d,targetHeading:f,upwind:p,vmc:h}},[e])}])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},43216,e=>{"use strict";let t,n;var i=e.i(31067),r=e.i(71645),a=e.i(90072),o=e.i(90874),s=a,l=e.i(32533),u=a,c=e.i(8560),d=e.i(31497);class f extends u.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:u.UniformsUtils.clone(u.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new u.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
|
|
2
|
+
#include <common>
|
|
3
|
+
#include <fog_pars_vertex>
|
|
4
|
+
#include <logdepthbuf_pars_vertex>
|
|
5
|
+
#include <clipping_planes_pars_vertex>
|
|
6
|
+
|
|
7
|
+
uniform float linewidth;
|
|
8
|
+
uniform vec2 resolution;
|
|
9
|
+
|
|
10
|
+
attribute vec3 instanceStart;
|
|
11
|
+
attribute vec3 instanceEnd;
|
|
12
|
+
|
|
13
|
+
#ifdef USE_COLOR
|
|
14
|
+
#ifdef USE_LINE_COLOR_ALPHA
|
|
15
|
+
varying vec4 vLineColor;
|
|
16
|
+
attribute vec4 instanceColorStart;
|
|
17
|
+
attribute vec4 instanceColorEnd;
|
|
18
|
+
#else
|
|
19
|
+
varying vec3 vLineColor;
|
|
20
|
+
attribute vec3 instanceColorStart;
|
|
21
|
+
attribute vec3 instanceColorEnd;
|
|
22
|
+
#endif
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#ifdef WORLD_UNITS
|
|
26
|
+
|
|
27
|
+
varying vec4 worldPos;
|
|
28
|
+
varying vec3 worldStart;
|
|
29
|
+
varying vec3 worldEnd;
|
|
30
|
+
|
|
31
|
+
#ifdef USE_DASH
|
|
32
|
+
|
|
33
|
+
varying vec2 vUv;
|
|
34
|
+
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#else
|
|
38
|
+
|
|
39
|
+
varying vec2 vUv;
|
|
40
|
+
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifdef USE_DASH
|
|
44
|
+
|
|
45
|
+
uniform float dashScale;
|
|
46
|
+
attribute float instanceDistanceStart;
|
|
47
|
+
attribute float instanceDistanceEnd;
|
|
48
|
+
varying float vLineDistance;
|
|
49
|
+
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
53
|
+
|
|
54
|
+
// trim end segment so it terminates between the camera plane and the near plane
|
|
55
|
+
|
|
56
|
+
// conservative estimate of the near plane
|
|
57
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
58
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
59
|
+
float nearEstimate = - 0.5 * b / a;
|
|
60
|
+
|
|
61
|
+
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
62
|
+
|
|
63
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void main() {
|
|
68
|
+
|
|
69
|
+
#ifdef USE_COLOR
|
|
70
|
+
|
|
71
|
+
vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
72
|
+
|
|
73
|
+
#endif
|
|
74
|
+
|
|
75
|
+
#ifdef USE_DASH
|
|
76
|
+
|
|
77
|
+
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
78
|
+
vUv = uv;
|
|
79
|
+
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
float aspect = resolution.x / resolution.y;
|
|
83
|
+
|
|
84
|
+
// camera space
|
|
85
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
86
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
87
|
+
|
|
88
|
+
#ifdef WORLD_UNITS
|
|
89
|
+
|
|
90
|
+
worldStart = start.xyz;
|
|
91
|
+
worldEnd = end.xyz;
|
|
92
|
+
|
|
93
|
+
#else
|
|
94
|
+
|
|
95
|
+
vUv = uv;
|
|
96
|
+
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
100
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
101
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
102
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
103
|
+
|
|
104
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
105
|
+
|
|
106
|
+
if ( perspective ) {
|
|
107
|
+
|
|
108
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
109
|
+
|
|
110
|
+
trimSegment( start, end );
|
|
111
|
+
|
|
112
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
113
|
+
|
|
114
|
+
trimSegment( end, start );
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// clip space
|
|
121
|
+
vec4 clipStart = projectionMatrix * start;
|
|
122
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
123
|
+
|
|
124
|
+
// ndc space
|
|
125
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
126
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
127
|
+
|
|
128
|
+
// direction
|
|
129
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
130
|
+
|
|
131
|
+
// account for clip-space aspect ratio
|
|
132
|
+
dir.x *= aspect;
|
|
133
|
+
dir = normalize( dir );
|
|
134
|
+
|
|
135
|
+
#ifdef WORLD_UNITS
|
|
136
|
+
|
|
137
|
+
// get the offset direction as perpendicular to the view vector
|
|
138
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
139
|
+
vec3 offset;
|
|
140
|
+
if ( position.y < 0.5 ) {
|
|
141
|
+
|
|
142
|
+
offset = normalize( cross( start.xyz, worldDir ) );
|
|
143
|
+
|
|
144
|
+
} else {
|
|
145
|
+
|
|
146
|
+
offset = normalize( cross( end.xyz, worldDir ) );
|
|
147
|
+
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// sign flip
|
|
151
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
152
|
+
|
|
153
|
+
float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
|
|
154
|
+
|
|
155
|
+
// don't extend the line if we're rendering dashes because we
|
|
156
|
+
// won't be rendering the endcaps
|
|
157
|
+
#ifndef USE_DASH
|
|
158
|
+
|
|
159
|
+
// extend the line bounds to encompass endcaps
|
|
160
|
+
start.xyz += - worldDir * linewidth * 0.5;
|
|
161
|
+
end.xyz += worldDir * linewidth * 0.5;
|
|
162
|
+
|
|
163
|
+
// shift the position of the quad so it hugs the forward edge of the line
|
|
164
|
+
offset.xy -= dir * forwardOffset;
|
|
165
|
+
offset.z += 0.5;
|
|
166
|
+
|
|
167
|
+
#endif
|
|
168
|
+
|
|
169
|
+
// endcaps
|
|
170
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
171
|
+
|
|
172
|
+
offset.xy += dir * 2.0 * forwardOffset;
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// adjust for linewidth
|
|
177
|
+
offset *= linewidth * 0.5;
|
|
178
|
+
|
|
179
|
+
// set the world position
|
|
180
|
+
worldPos = ( position.y < 0.5 ) ? start : end;
|
|
181
|
+
worldPos.xyz += offset;
|
|
182
|
+
|
|
183
|
+
// project the worldpos
|
|
184
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
185
|
+
|
|
186
|
+
// shift the depth of the projected points so the line
|
|
187
|
+
// segments overlap neatly
|
|
188
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
189
|
+
clip.z = clipPose.z * clip.w;
|
|
190
|
+
|
|
191
|
+
#else
|
|
192
|
+
|
|
193
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
194
|
+
// undo aspect ratio adjustment
|
|
195
|
+
dir.x /= aspect;
|
|
196
|
+
offset.x /= aspect;
|
|
197
|
+
|
|
198
|
+
// sign flip
|
|
199
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
200
|
+
|
|
201
|
+
// endcaps
|
|
202
|
+
if ( position.y < 0.0 ) {
|
|
203
|
+
|
|
204
|
+
offset += - dir;
|
|
205
|
+
|
|
206
|
+
} else if ( position.y > 1.0 ) {
|
|
207
|
+
|
|
208
|
+
offset += dir;
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// adjust for linewidth
|
|
213
|
+
offset *= linewidth;
|
|
214
|
+
|
|
215
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
216
|
+
offset /= resolution.y;
|
|
217
|
+
|
|
218
|
+
// select end
|
|
219
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
220
|
+
|
|
221
|
+
// back to clip space
|
|
222
|
+
offset *= clip.w;
|
|
223
|
+
|
|
224
|
+
clip.xy += offset;
|
|
225
|
+
|
|
226
|
+
#endif
|
|
227
|
+
|
|
228
|
+
gl_Position = clip;
|
|
229
|
+
|
|
230
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
231
|
+
|
|
232
|
+
#include <logdepthbuf_vertex>
|
|
233
|
+
#include <clipping_planes_vertex>
|
|
234
|
+
#include <fog_vertex>
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
`,fragmentShader:`
|
|
238
|
+
uniform vec3 diffuse;
|
|
239
|
+
uniform float opacity;
|
|
240
|
+
uniform float linewidth;
|
|
241
|
+
|
|
242
|
+
#ifdef USE_DASH
|
|
243
|
+
|
|
244
|
+
uniform float dashOffset;
|
|
245
|
+
uniform float dashSize;
|
|
246
|
+
uniform float gapSize;
|
|
247
|
+
|
|
248
|
+
#endif
|
|
249
|
+
|
|
250
|
+
varying float vLineDistance;
|
|
251
|
+
|
|
252
|
+
#ifdef WORLD_UNITS
|
|
253
|
+
|
|
254
|
+
varying vec4 worldPos;
|
|
255
|
+
varying vec3 worldStart;
|
|
256
|
+
varying vec3 worldEnd;
|
|
257
|
+
|
|
258
|
+
#ifdef USE_DASH
|
|
259
|
+
|
|
260
|
+
varying vec2 vUv;
|
|
261
|
+
|
|
262
|
+
#endif
|
|
263
|
+
|
|
264
|
+
#else
|
|
265
|
+
|
|
266
|
+
varying vec2 vUv;
|
|
267
|
+
|
|
268
|
+
#endif
|
|
269
|
+
|
|
270
|
+
#include <common>
|
|
271
|
+
#include <fog_pars_fragment>
|
|
272
|
+
#include <logdepthbuf_pars_fragment>
|
|
273
|
+
#include <clipping_planes_pars_fragment>
|
|
274
|
+
|
|
275
|
+
#ifdef USE_COLOR
|
|
276
|
+
#ifdef USE_LINE_COLOR_ALPHA
|
|
277
|
+
varying vec4 vLineColor;
|
|
278
|
+
#else
|
|
279
|
+
varying vec3 vLineColor;
|
|
280
|
+
#endif
|
|
281
|
+
#endif
|
|
282
|
+
|
|
283
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
284
|
+
|
|
285
|
+
float mua;
|
|
286
|
+
float mub;
|
|
287
|
+
|
|
288
|
+
vec3 p13 = p1 - p3;
|
|
289
|
+
vec3 p43 = p4 - p3;
|
|
290
|
+
|
|
291
|
+
vec3 p21 = p2 - p1;
|
|
292
|
+
|
|
293
|
+
float d1343 = dot( p13, p43 );
|
|
294
|
+
float d4321 = dot( p43, p21 );
|
|
295
|
+
float d1321 = dot( p13, p21 );
|
|
296
|
+
float d4343 = dot( p43, p43 );
|
|
297
|
+
float d2121 = dot( p21, p21 );
|
|
298
|
+
|
|
299
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
300
|
+
|
|
301
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
302
|
+
|
|
303
|
+
mua = numer / denom;
|
|
304
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
305
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
306
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
307
|
+
|
|
308
|
+
return vec2( mua, mub );
|
|
309
|
+
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
void main() {
|
|
313
|
+
|
|
314
|
+
#include <clipping_planes_fragment>
|
|
315
|
+
|
|
316
|
+
#ifdef USE_DASH
|
|
317
|
+
|
|
318
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
319
|
+
|
|
320
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
321
|
+
|
|
322
|
+
#endif
|
|
323
|
+
|
|
324
|
+
float alpha = opacity;
|
|
325
|
+
|
|
326
|
+
#ifdef WORLD_UNITS
|
|
327
|
+
|
|
328
|
+
// Find the closest points on the view ray and the line segment
|
|
329
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
330
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
331
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
332
|
+
|
|
333
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
334
|
+
vec3 p2 = rayEnd * params.y;
|
|
335
|
+
vec3 delta = p1 - p2;
|
|
336
|
+
float len = length( delta );
|
|
337
|
+
float norm = len / linewidth;
|
|
338
|
+
|
|
339
|
+
#ifndef USE_DASH
|
|
340
|
+
|
|
341
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
342
|
+
|
|
343
|
+
float dnorm = fwidth( norm );
|
|
344
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
345
|
+
|
|
346
|
+
#else
|
|
347
|
+
|
|
348
|
+
if ( norm > 0.5 ) {
|
|
349
|
+
|
|
350
|
+
discard;
|
|
351
|
+
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
#endif
|
|
355
|
+
|
|
356
|
+
#endif
|
|
357
|
+
|
|
358
|
+
#else
|
|
359
|
+
|
|
360
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
361
|
+
|
|
362
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
363
|
+
float a = vUv.x;
|
|
364
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
365
|
+
float len2 = a * a + b * b;
|
|
366
|
+
float dlen = fwidth( len2 );
|
|
367
|
+
|
|
368
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
369
|
+
|
|
370
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
#else
|
|
375
|
+
|
|
376
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
377
|
+
|
|
378
|
+
float a = vUv.x;
|
|
379
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
380
|
+
float len2 = a * a + b * b;
|
|
381
|
+
|
|
382
|
+
if ( len2 > 1.0 ) discard;
|
|
383
|
+
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
#endif
|
|
387
|
+
|
|
388
|
+
#endif
|
|
389
|
+
|
|
390
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
391
|
+
#ifdef USE_COLOR
|
|
392
|
+
#ifdef USE_LINE_COLOR_ALPHA
|
|
393
|
+
diffuseColor *= vLineColor;
|
|
394
|
+
#else
|
|
395
|
+
diffuseColor.rgb *= vLineColor;
|
|
396
|
+
#endif
|
|
397
|
+
#endif
|
|
398
|
+
|
|
399
|
+
#include <logdepthbuf_fragment>
|
|
400
|
+
|
|
401
|
+
gl_FragColor = diffuseColor;
|
|
402
|
+
|
|
403
|
+
#include <tonemapping_fragment>
|
|
404
|
+
#include <${d.version>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
405
|
+
#include <fog_fragment>
|
|
406
|
+
#include <premultiplied_alpha_fragment>
|
|
407
|
+
|
|
408
|
+
}
|
|
409
|
+
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}let p=d.version>=125?"uv1":"uv2",m=new s.Vector4,h=new s.Vector3,v=new s.Vector3,g=new s.Vector4,y=new s.Vector4,b=new s.Vector4,x=new s.Vector3,w=new s.Matrix4,S=new s.Line3,M=new s.Vector3,E=new s.Box3,_=new s.Sphere,A=new s.Vector4;function P(e,t,i){return A.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),A.multiplyScalar(1/A.w),A.x=n/i.width,A.y=n/i.height,A.applyMatrix4(e.projectionMatrixInverse),A.multiplyScalar(1/A.w),Math.abs(Math.max(A.x,A.y))}class T extends s.Mesh{constructor(e=new l.LineSegmentsGeometry,t=new f({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let e=0,r=0,a=t.count;e<a;e++,r+=2)h.fromBufferAttribute(t,e),v.fromBufferAttribute(n,e),i[r]=0===r?0:i[r-1],i[r+1]=i[r]+h.distanceTo(v);let r=new s.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new s.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new s.InterleavedBufferAttribute(r,1,1)),this}raycast(e,i){let r,a,o=this.material.worldUnits,l=e.camera;null!==l||o||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');let u=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let c=this.matrixWorld,d=this.geometry,f=this.material;if(n=f.linewidth+u,null===d.boundingSphere&&d.computeBoundingSphere(),_.copy(d.boundingSphere).applyMatrix4(c),o)r=.5*n;else{let e=Math.max(l.near,_.distanceToPoint(t.origin));r=P(l,e,f.resolution)}if(_.radius+=r,!1!==t.intersectsSphere(_)){if(null===d.boundingBox&&d.computeBoundingBox(),E.copy(d.boundingBox).applyMatrix4(c),o)a=.5*n;else{let e=Math.max(l.near,E.distanceToPoint(t.origin));a=P(l,e,f.resolution)}E.expandByScalar(a),!1!==t.intersectsBox(E)&&(o?function(e,i){let r=e.matrixWorld,a=e.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,u=Math.min(a.instanceCount,o.count);for(let a=0;a<u;a++){S.start.fromBufferAttribute(o,a),S.end.fromBufferAttribute(l,a),S.applyMatrix4(r);let u=new s.Vector3,c=new s.Vector3;t.distanceSqToSegment(S.start,S.end,c,u),c.distanceTo(u)<.5*n&&i.push({point:c,pointOnLine:u,distance:t.origin.distanceTo(c),object:e,face:null,faceIndex:a,uv:null,[p]:null})}}(this,i):function(e,i,r){let a=i.projectionMatrix,o=e.material.resolution,l=e.matrixWorld,u=e.geometry,c=u.attributes.instanceStart,d=u.attributes.instanceEnd,f=Math.min(u.instanceCount,c.count),m=-i.near;t.at(1,b),b.w=1,b.applyMatrix4(i.matrixWorldInverse),b.applyMatrix4(a),b.multiplyScalar(1/b.w),b.x*=o.x/2,b.y*=o.y/2,b.z=0,x.copy(b),w.multiplyMatrices(i.matrixWorldInverse,l);for(let i=0;i<f;i++){if(g.fromBufferAttribute(c,i),y.fromBufferAttribute(d,i),g.w=1,y.w=1,g.applyMatrix4(w),y.applyMatrix4(w),g.z>m&&y.z>m)continue;if(g.z>m){let e=g.z-y.z,t=(g.z-m)/e;g.lerp(y,t)}else if(y.z>m){let e=y.z-g.z,t=(y.z-m)/e;y.lerp(g,t)}g.applyMatrix4(a),y.applyMatrix4(a),g.multiplyScalar(1/g.w),y.multiplyScalar(1/y.w),g.x*=o.x/2,g.y*=o.y/2,y.x*=o.x/2,y.y*=o.y/2,S.start.copy(g),S.start.z=0,S.end.copy(y),S.end.z=0;let u=S.closestPointToPointParameter(x,!0);S.at(u,M);let f=s.MathUtils.lerp(g.z,y.z,u),h=f>=-1&&f<=1,v=x.distanceTo(M)<.5*n;if(h&&v){S.start.fromBufferAttribute(c,i),S.end.fromBufferAttribute(d,i),S.start.applyMatrix4(l),S.end.applyMatrix4(l);let n=new s.Vector3,a=new s.Vector3;t.distanceSqToSegment(S.start,S.end,a,n),r.push({point:a,pointOnLine:n,distance:t.origin.distanceTo(a),object:e,face:null,faceIndex:i,uv:null,[p]:null})}}}(this,l,i))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(m),this.material.uniforms.resolution.value.set(m.z,m.w))}}var L=l;class O extends L.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){let n=e.length-t,i=new Float32Array(2*n);if(3===t)for(let r=0;r<n;r+=t)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];else for(let r=0;r<n;r+=t)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5],i[2*r+6]=e[r+6],i[2*r+7]=e[r+7];return super.setColors(i,t),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class U extends T{constructor(e=new O,t=new f({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let z=r.forwardRef(function({points:e,color:t=0xffffff,vertexColors:n,linewidth:s,lineWidth:u,segments:c,dashed:d,...p},m){var h,v;let g=(0,o.useThree)(e=>e.size),y=r.useMemo(()=>c?new T:new U,[c]),[b]=r.useState(()=>new f),x=(null==n||null==(h=n[0])?void 0:h.length)===4?4:3,w=r.useMemo(()=>{let i=c?new l.LineSegmentsGeometry:new O,r=e.map(e=>{let t=Array.isArray(e);return e instanceof a.Vector3||e instanceof a.Vector4?[e.x,e.y,e.z]:e instanceof a.Vector2?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e});if(i.setPositions(r.flat()),n){t=0xffffff;let e=n.map(e=>e instanceof a.Color?e.toArray():e);i.setColors(e.flat(),x)}return i},[e,c,n,x]);return r.useLayoutEffect(()=>{y.computeLineDistances()},[e,y]),r.useLayoutEffect(()=>{d?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[d,b]),r.useEffect(()=>()=>{w.dispose(),b.dispose()},[w]),r.createElement("primitive",(0,i.default)({object:y,ref:m},p),r.createElement("primitive",{object:w,attach:"geometry"}),r.createElement("primitive",(0,i.default)({object:b,attach:"material",color:t,vertexColors:!!n,resolution:[g.width,g.height],linewidth:null!=(v=null!=s?s:u)?v:1,dashed:d,transparent:4===x},p)))});e.s(["Line",0,z],43216)},60099,95393,e=>{"use strict";let t,n;var i=e.i(31067),r=e.i(71645),a=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(61949);e.s(["useFrame",()=>l.F],95393);var l=l;let u=new o.Vector3,c=new o.Vector3,d=new o.Vector3,f=new o.Vector2;function p(e,t,n){let i=u.setFromMatrixPosition(e.matrixWorld);i.project(t);let r=n.width/2,a=n.height/2;return[i.x*r+r,-(i.y*a)+a]}let m=e=>1e-10>Math.abs(e)?0:e;function h(e,t,n=""){let i="matrix3d(";for(let n=0;16!==n;n++)i+=m(t[n]*e.elements[n])+(15!==n?",":")");return n+i}let v=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>h(e,t)),g=(n=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)=>h(e,n(t),"translate(-50%,-50%)")),y=r.forwardRef(({children:e,eps:t=.001,style:n,className:h,prepend:y,center:b,fullscreen:x,portal:w,distanceFactor:S,sprite:M=!1,transform:E=!1,occlude:_,onOcclude:A,castShadow:P,receiveShadow:T,material:L,geometry:O,zIndexRange:U=[0x1000037,0],calculatePosition:z=p,as:C="div",wrapperClass:F,pointerEvents:R="auto",...B},N)=>{let{gl:I,camera:W,scene:D,size:j,raycaster:H,events:V,viewport:G}=(0,s.useThree)(),[k]=r.useState(()=>document.createElement(C)),$=r.useRef(null),q=r.useRef(null),K=r.useRef(0),X=r.useRef([0,0]),Z=r.useRef(null),J=r.useRef(null),Q=(null==w?void 0:w.current)||V.connected||I.domElement.parentNode,Y=r.useRef(null),ee=r.useRef(!1),et=r.useMemo(()=>{var e;return _&&"blending"!==_||Array.isArray(_)&&_.length&&(e=_[0])&&"object"==typeof e&&"current"in e},[_]);r.useLayoutEffect(()=>{let e=I.domElement;_&&"blending"===_?(e.style.zIndex=`${Math.floor(U[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[_]),r.useLayoutEffect(()=>{if(q.current){let e=$.current=a.createRoot(k);if(D.updateMatrixWorld(),E)k.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=z(q.current,W,j);k.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Q&&(y?Q.prepend(k):Q.appendChild(k)),()=>{Q&&Q.removeChild(k),e.unmount()}}},[Q,E]),r.useLayoutEffect(()=>{F&&(k.className=F)},[F]);let en=r.useMemo(()=>E?{position:"absolute",top:0,left:0,width:j.width,height:j.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:b?"translate3d(-50%,-50%,0)":"none",...x&&{top:-j.height/2,left:-j.width/2,width:j.width,height:j.height},...n},[n,b,x,j,E]),ei=r.useMemo(()=>({position:"absolute",pointerEvents:R}),[R]);r.useLayoutEffect(()=>{var t,i;ee.current=!1,E?null==(t=$.current)||t.render(r.createElement("div",{ref:Z,style:en},r.createElement("div",{ref:J,style:ei},r.createElement("div",{ref:N,className:h,style:n,children:e})))):null==(i=$.current)||i.render(r.createElement("div",{ref:N,style:en,className:h,children:e}))});let er=r.useRef(!0);(0,l.F)(e=>{if(q.current){W.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);let e=E?X.current:z(q.current,W,j);if(E||Math.abs(K.current-W.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var n;let t,i,r,a,s=(n=q.current,t=u.setFromMatrixPosition(n.matrixWorld),i=c.setFromMatrixPosition(W.matrixWorld),r=t.sub(i),a=W.getWorldDirection(d),r.angleTo(a)>Math.PI/2),l=!1;et&&(Array.isArray(_)?l=_.map(e=>e.current):"blending"!==_&&(l=[D]));let p=er.current;l?er.current=function(e,t,n,i){let r=u.setFromMatrixPosition(e.matrixWorld),a=r.clone();a.project(t),f.set(a.x,a.y),n.setFromCamera(f,t);let o=n.intersectObjects(i,!0);if(o.length){let e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}(q.current,W,H,l)&&!s:er.current=!s,p!==er.current&&(A?A(!er.current):k.style.display=er.current?"block":"none");let h=Math.floor(U[0]/2),y=_?et?[U[0],h]:[h-1,0]:U;if(k.style.zIndex=`${function(e,t,n){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let i=u.setFromMatrixPosition(e.matrixWorld),r=c.setFromMatrixPosition(t.matrixWorld),a=i.distanceTo(r),o=(n[1]-n[0])/(t.far-t.near),s=n[1]-o*t.far;return Math.round(o*a+s)}}(q.current,W,y)}`,E){let[e,t]=[j.width/2,j.height/2],n=W.projectionMatrix.elements[5]*t,{isOrthographicCamera:i,top:r,left:a,bottom:o,right:s}=W,l=v(W.matrixWorldInverse),u=i?`scale(${n})translate(${m(-(s+a)/2)}px,${m((r+o)/2)}px)`:`translateZ(${n}px)`,c=q.current.matrixWorld;M&&((c=W.matrixWorldInverse.clone().transpose().copyPosition(c).scale(q.current.scale)).elements[3]=c.elements[7]=c.elements[11]=0,c.elements[15]=1),k.style.width=j.width+"px",k.style.height=j.height+"px",k.style.perspective=i?"":`${n}px`,Z.current&&J.current&&(Z.current.style.transform=`${u}${l}translate(${e}px,${t}px)`,J.current.style.transform=g(c,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 n=u.setFromMatrixPosition(e.matrixWorld),i=c.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*n.distanceTo(i))}}(q.current,W)*S;k.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,K.current=W.zoom}}if(!et&&Y.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}=W;if(t||O)B.scale&&(Array.isArray(B.scale)?B.scale instanceof o.Vector3?Y.current.scale.copy(B.scale.clone().divideScalar(1)):Y.current.scale.set(1/B.scale[0],1/B.scale[1],1/B.scale[2]):Y.current.scale.setScalar(1/B.scale));else{let t=(S||10)/400,n=e.clientWidth*t,i=e.clientHeight*t;Y.current.scale.set(n,i,1)}ee.current=!0}}}else{let t=k.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/G.factor,n=t.clientWidth*e,i=t.clientHeight*e;Y.current.scale.set(n,i,1),ee.current=!0}Y.current.lookAt(e.camera.position)}});let ea=r.useMemo(()=>({vertexShader:E?void 0:`
|
|
410
|
+
/*
|
|
411
|
+
This shader is from the THREE's SpriteMaterial.
|
|
412
|
+
We need to turn the backing plane into a Sprite
|
|
413
|
+
(make it always face the camera) if "transfrom"
|
|
414
|
+
is false.
|
|
415
|
+
*/
|
|
416
|
+
#include <common>
|
|
417
|
+
|
|
418
|
+
void main() {
|
|
419
|
+
vec2 center = vec2(0., 1.);
|
|
420
|
+
float rotation = 0.0;
|
|
421
|
+
|
|
422
|
+
// This is somewhat arbitrary, but it seems to work well
|
|
423
|
+
// Need to figure out how to derive this dynamically if it even matters
|
|
424
|
+
float size = 0.03;
|
|
425
|
+
|
|
426
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
427
|
+
vec2 scale;
|
|
428
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
429
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
430
|
+
|
|
431
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
432
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
433
|
+
|
|
434
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
435
|
+
vec2 rotatedPosition;
|
|
436
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
437
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
438
|
+
mvPosition.xy += rotatedPosition;
|
|
439
|
+
|
|
440
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
441
|
+
}
|
|
442
|
+
`,fragmentShader:`
|
|
443
|
+
void main() {
|
|
444
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
445
|
+
}
|
|
446
|
+
`}),[E]);return r.createElement("group",(0,i.default)({},B,{ref:q}),_&&!et&&r.createElement("mesh",{castShadow:P,receiveShadow:T,ref:Y},O||r.createElement("planeGeometry",null),L||r.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",0,y],60099)},31497,e=>{"use strict";let t=parseInt(e.i(90072).REVISION.replace(/\D+/g,""));e.s(["version",0,t])},32533,e=>{"use strict";var t=e.i(90072);let n=new t.Box3,i=new t.Vector3;class r extends t.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 t.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 t.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,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));let i=new t.InstancedInterleavedBuffer(n,6,1);return this.setAttribute("instanceStart",new t.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new t.InterleavedBufferAttribute(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,n=3){let i;e instanceof Float32Array?i=e:Array.isArray(e)&&(i=new Float32Array(e));let r=new t.InstancedInterleavedBuffer(i,2*n,1);return this.setAttribute("instanceColorStart",new t.InterleavedBufferAttribute(r,n,0)),this.setAttribute("instanceColorEnd",new t.InterleavedBufferAttribute(r,n,n)),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 t.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 t.Box3);let e=this.attributes.instanceStart,i=this.attributes.instanceEnd;void 0!==e&&void 0!==i&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(i),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new t.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(void 0!==e&&void 0!==n){let t=this.boundingSphere.center;this.boundingBox.getCenter(t);let r=0;for(let a=0,o=e.count;a<o;a++)i.fromBufferAttribute(e,a),r=Math.max(r,t.distanceToSquared(i)),i.fromBufferAttribute(n,a),r=Math.max(r,t.distanceToSquared(i));this.boundingSphere.radius=Math.sqrt(r),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(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}e.s(["LineSegmentsGeometry",0,r])},74452,(e,t,n)=>{t.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var t=e.i(74452);let n=180/Math.PI,i=t.default.vpp,r=(e,t,n)=>e+(t-e)*n,a=(e,t)=>{if(t<=e[0])return[0,0];let n=e.length-1;if(t>=e[n])return[n-1,1];let i=0;for(;t>e[i+1];)i++;return[i,(t-e[i])/(e[i+1]-e[i])]},o=i.speeds.map((e,t)=>(e=>{let t=i.beat_angle[e],r=i.run_angle[e],a=i.beat_vmg[e]/Math.cos(t/n),o=i.run_vmg[e]/Math.abs(Math.cos(r/n)),s=[[0,0],[.7*t,.55*a],[t,a]];for(let n of i.angles)n>t&&n<r&&s.push([n,i[String(n)][e]]);return s.push([r,o]),r<180&&s.push([180,i.run_vmg[e]]),s})(t)),s=(e,t)=>{let[n,i]=a(e.map(e=>e[0]),t);return r(e[n][1],e[n+1][1],i)},l=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let n=Math.min(180,Math.abs((t+540)%360-180)),l=i.speeds;if(e<l[0])return s(o[0],n)*(e/l[0]);let[u,c]=a(l,e);return r(s(o[u],n),s(o[u+1],n),c)},u=(e,t)=>{let[n,o]=a(i.speeds,t);return r(e[n],e[n+1],o)},c=(e,t)=>{let i=l(1.943844*e,t*n);return null===i?null:i/1.943844},d=e=>{let t=(e+Math.PI)%(2*Math.PI);return t<0&&(t+=2*Math.PI),t-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:t,bearing:i})=>{if(![e,t,i].every(Number.isFinite)||t<=0)return null;let r=null;for(let a=-100;a<=100;a++){let o=i+a/n,s=c(t,d(e-o));if(null===s)continue;let l=s*Math.cos(o-i);(!r||l>r.vmc)&&(r={heading:d(o),speed:s,vmc:l})}return r},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(i.run_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:-r*Math.cos(t/n)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(i.beat_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:r*Math.cos(t/n)}},"polarSpeed",0,l,"polarSpeedSi",0,c,"vmcForHeading",0,({twd:e,tws:t,bearing:n,heading:i})=>{if(![e,t,n,i].every(Number.isFinite))return null;let r=c(t,d(e-i));return null===r?null:r*Math.cos(i-n)},"wrapPi",0,d])}]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,68192,e=>{"use strict";var t=e.i(43476),s=e.i(71645),o=e.i(70703),l=e.i(46932),n=e.i(88653);e.i(85269);var r=e.i(22831),a=e.i(85709),i=e.i(83402);let u=({messageKey:e})=>{let{t:s}=(0,r.useTranslation)();return(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center text-hud-main",children:s(e)})},c=(0,o.default)(()=>e.A(56489),{loadableGenerated:{modules:[92094]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingDocuments"})}),d=(0,o.default)(()=>e.A(22155),{loadableGenerated:{modules:[34900]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingSettings"})}),m=(0,o.default)(()=>e.A(30455),{loadableGenerated:{modules:[13268]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingMediaPlayer"})}),f=(0,o.default)(()=>e.A(71074),{loadableGenerated:{modules:[65862]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingBatteryMonitor"})}),h=(0,o.default)(()=>e.A(3523),{loadableGenerated:{modules:[8161]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingEngineMonitor"})}),p=(0,o.default)(()=>e.A(88913),{loadableGenerated:{modules:[25294]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingDashboard"})}),g=(0,o.default)(()=>e.A(26371),{loadableGenerated:{modules:[70127]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingLogbook"})}),x=(0,o.default)(()=>e.A(58293),{loadableGenerated:{modules:[33946]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loadingAutopilot"})}),j=(0,o.default)(()=>e.A(47853),{loadableGenerated:{modules:[58652]},loading:()=>(0,t.jsx)(u,{messageKey:"common.loading"})}),y={latitude:46.1591,longitude:-1.1522},b={navigation:e=>!e||e.includes("localhost:3000")?null:`${e}/@signalk/freeboard-sk/`,instrument:e=>`${e}/@mxtommy/kip/`,dashboard:e=>e.replace(":3000",":3001")+"/grafana",webcam1:()=>"https://pv.viewsurf.com/2080/Chatelaillon-Port?i=NzU4Mjp1bmRlZmluZWQ",webcam2:()=>"https://pv.viewsurf.com/1478/Chatelaillon-Plage?i=NTkyMDp1bmRlZmluZWQ",weather:(e,t)=>t&&`https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=mm&metricTemp=\xb0C&metricWind=kt&zoom=10&overlay=wind&product=ecmwf&level=surface&lat=${t.latitude}&lon=${t.longitude}&message=true`};e.s(["default",0,({view:e})=>{let{t:o}=(0,r.useTranslation)(),[u,v]=(0,s.useState)(y),[k,w]=(0,s.useState)(null);i.default.getAll();let P=i.default.getSignalKUrl(),E=(0,a.useSignalKPath)("navigation.position");(0,s.useEffect)(()=>{w(null)},[e]),(0,s.useEffect)(()=>{E&&v(e=>e?Math.abs(e.latitude-E.latitude)>.01||Math.abs(e.longitude-E.longitude)>.01?E:e:E)},[E]);let C=(0,s.useMemo)(()=>{let t=i.default.getAll(),s=t.customExternalUrls||{};if(t.showCustomUrls&&s[e])try{if("string"==typeof s[e]&&s[e].includes("${signalkUrl}"))return s[e].replace("${signalkUrl}",P).replace("${latitude}",u?.latitude||y.latitude).replace("${longitude}",u?.longitude||y.longitude);return s[e]}catch(e){console.error("Error using custom URL:",e)}let o=b[e];if(!o)return null;try{return o(P,u)}catch(e){return console.error("Error generating URL:",e),null}},[e,u,P]),$=["motor","logbook","autopilot","battery","dashboard","debug"].includes(e);return(0,t.jsx)("div",{className:"flex flex-col w-full h-full overflow-hidden bg-hud-bg backdrop-blur-sm relative z-0",children:(0,t.jsx)(n.AnimatePresence,{mode:"wait",children:(0,t.jsx)(l.motion.div,{initial:{opacity:0,x:10,scale:.99},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:-10,scale:.99},transition:{duration:.4,ease:[.16,1,.3,1]},style:{flex:"1 1 0%",minHeight:0},className:`flex flex-col w-full absolute inset-0 ${$?"overflow-hidden":"overflow-auto"}`,children:(()=>{if(k)return(0,t.jsx)("div",{className:"text-oRed p-4 font-semibold uppercase text-caption",children:k});switch(e){case"manual":return(0,t.jsx)(c,{path:"./docs"});case"settings":return(0,t.jsx)(d,{});case"mediaplayer":return(0,t.jsx)(m,{});case"battery":return(0,t.jsx)(f,{});case"motor":return(0,t.jsx)(h,{});case"dashboard":return(0,t.jsx)(p,{});case"logbook":return(0,t.jsx)(g,{});case"autopilot":return(0,t.jsx)(x,{});case"debug":return(0,t.jsx)(j,{});default:if(!C)return(0,t.jsx)("div",{className:"text-hud-muted p-4 text-label",children:o("errors.failedToLoadExternal")});return(0,t.jsx)("iframe",{className:"flex-grow border-none",src:C,title:"External Application",onError:()=>w(o("errors.failedToLoadExternal"))})}})()},e)})})}])},42602,function(e){e.n(e.i(68192))},58293,e=>{e.v(t=>Promise.all(["static/chunks/0cx639tthxlz4.js","static/chunks/0jfox92up1jvy.js"].map(t=>e.l(t))).then(()=>t(33946)))},71074,e=>{e.v(t=>Promise.all(["static/chunks/1xekc18cyi4sx.js","static/chunks/0jfox92up1jvy.js","static/chunks/0oaqe70syw_b5.js"].map(t=>e.l(t))).then(()=>t(65862)))},88913,e=>{e.v(t=>Promise.all(["static/chunks/2aq8orcir5h03.js","static/chunks/0jfox92up1jvy.js","static/chunks/01atsfq_4opab.js"].map(t=>e.l(t))).then(()=>t(25294)))},47853,e=>{e.v(t=>Promise.all(["static/chunks/2fdpvhx4oo81h.js"].map(t=>e.l(t))).then(()=>t(58652)))},56489,e=>{e.v(t=>Promise.all(["static/chunks/37t6vg8fb1-z8.js","static/chunks/0jfox92up1jvy.js"].map(t=>e.l(t))).then(()=>t(92094)))},3523,e=>{e.v(t=>Promise.all(["static/chunks/3ktj0iemsr1m-.js","static/chunks/0jfox92up1jvy.js"].map(t=>e.l(t))).then(()=>t(8161)))},26371,e=>{e.v(t=>Promise.all(["static/chunks/0zlk2mlkvbtj1.js","static/chunks/0jfox92up1jvy.js"].map(t=>e.l(t))).then(()=>t(70127)))},30455,e=>{e.v(t=>Promise.all(["static/chunks/0n95joti2n2py.js","static/chunks/0jfox92up1jvy.js"].map(t=>e.l(t))).then(()=>t(13268)))},22155,e=>{e.v(t=>Promise.all(["static/chunks/0zwc9m4qgtwle.js","static/chunks/2rebcvig176xk.js","static/chunks/0jfox92up1jvy.js","static/chunks/0ohleay4roayh.js"].map(t=>e.l(t))).then(()=>t(34900)))},88653,e=>{"use strict";var t=e.i(43476),s=e.i(71645),o=e.i(31178),l=e.i(47414),n=e.i(74008),r=e.i(21476),a=e.i(72846),i=s,u=e.i(37806);function c(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class d extends i.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if((0,a.isHTMLElement)(t)&&e.isPresent&&!this.props.isPresent&&!1!==this.props.pop){let e=t.offsetParent,s=(0,a.isHTMLElement)(e)&&e.offsetWidth||0,o=(0,a.isHTMLElement)(e)&&e.offsetHeight||0,l=getComputedStyle(t),n=this.props.sizeRef.current;n.height=parseFloat(l.height),n.width=parseFloat(l.width),n.top=t.offsetTop,n.left=t.offsetLeft,n.right=s-n.width-n.left,n.bottom=o-n.height-n.top,n.direction=l.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function m({children:e,isPresent:o,anchorX:l,anchorY:n,root:r,pop:a}){let f=(0,i.useId)(),h=(0,i.useRef)(null),p=(0,i.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:g}=(0,i.useContext)(u.MotionConfigContext),x=function(...e){return s.useCallback(function(...e){return t=>{let s=!1,o=e.map(e=>{let o=c(e,t);return s||"function"!=typeof o||(s=!0),o});if(s)return()=>{for(let t=0;t<o.length;t++){let s=o[t];"function"==typeof s?s():c(e[t],null)}}}}(...e),e)}(h,!1!==a?e.props?.ref??e?.ref:void 0);return(0,i.useInsertionEffect)(()=>{let{width:e,height:t,top:s,left:i,right:u,bottom:c,direction:d}=p.current;if(o||!1===a||!h.current||!e||!t)return;let m="rtl"===d,x="left"===l?m?`right: ${u}`:`left: ${i}`:m?`left: ${i}`:`right: ${u}`,j="bottom"===n?`bottom: ${c}`:`top: ${s}`;h.current.dataset.motionPopId=f;let y=document.createElement("style");g&&(y.nonce=g);let b=r??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${f}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${e}px !important;
|
|
5
|
+
height: ${t}px !important;
|
|
6
|
+
${x}px !important;
|
|
7
|
+
${j}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{h.current?.removeAttribute("data-motion-pop-id"),b.contains(y)&&b.removeChild(y)}},[o]),(0,t.jsx)(d,{isPresent:o,childRef:h,sizeRef:p,pop:a,children:!1===a?e:i.cloneElement(e,{ref:x})})}let f=({children:e,initial:o,isPresent:a,onExitComplete:i,custom:u,presenceAffectsLayout:c,mode:d,anchorX:f,anchorY:p,root:g})=>{let x=(0,l.useConstant)(h),j=(0,s.useId)(),y=(0,s.useRef)(a),b=(0,s.useRef)(i);(0,n.useIsomorphicLayoutEffect)(()=>{y.current=a,b.current=i});let v=!0,k=(0,s.useMemo)(()=>(v=!1,{id:j,initial:o,isPresent:a,custom:u,onExitComplete:e=>{for(let t of(x.set(e,!0),x.values()))if(!t)return;i&&i()},register:e=>(x.set(e,!1),()=>{x.delete(e),y.current||x.size||b.current?.()})}),[a,x,i]);return c&&v&&(k={...k}),(0,s.useMemo)(()=>{x.forEach((e,t)=>x.set(t,!1))},[a]),s.useEffect(()=>{a||x.size||!i||i()},[a]),e=(0,t.jsx)(m,{pop:"popLayout"===d,isPresent:a,anchorX:f,anchorY:p,root:g,children:e}),(0,t.jsx)(r.PresenceContext.Provider,{value:k,children:e})};function h(){return new Map}var p=e.i(64978);let g=e=>e.key||"";function x(e){let t=[];return s.Children.forEach(e,e=>{(0,s.isValidElement)(e)&&t.push(e)}),t}e.s(["AnimatePresence",0,({children:e,custom:r,initial:a=!0,onExitComplete:i,presenceAffectsLayout:u=!0,mode:c="sync",propagate:d=!1,anchorX:m="left",anchorY:h="top",root:j})=>{let[y,b]=(0,p.usePresence)(d),v=(0,s.useMemo)(()=>x(e),[e]),k=d&&!y?[]:v.map(g),w=(0,s.useRef)(!0),P=(0,l.useConstant)(()=>new Map),E=(0,s.useRef)(new Set),[C,$]=(0,s.useState)(v),[A,R]=(0,s.useState)(v);(0,n.useIsomorphicLayoutEffect)(()=>{!d||y||A.length||b?.()},[y,d,A.length,b]),(0,n.useIsomorphicLayoutEffect)(()=>{w.current=!1;for(let e=0;e<A.length;e++){let t=g(A[e]);k.includes(t)?(P.delete(t),E.current.delete(t)):!0!==P.get(t)&&P.set(t,!1)}},[A,k.length,k.join("-")]);let M=[];if(v!==C){let e=[...v],t=0;for(let s of A){let o=k.indexOf(g(s));-1===o?(e.splice(t++,0,s),M.push(s)):t=o+M.length+1}return M.every(e=>P.get(g(e)))?e=v:"wait"===c&&(e=M),R(x(e)),$(v),null}let{forceRender:L}=(0,s.useContext)(o.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:A.map(e=>{let s=g(e),o=(!d||!!y)&&(v===A||k.includes(s));return(0,t.jsx)(f,{isPresent:o,initial:(!w.current||!!a)&&void 0,custom:r,presenceAffectsLayout:u,mode:c,root:j,onExitComplete:o?void 0:()=>{if(E.current.has(s)||!P.has(s))return;E.current.add(s),P.set(s,!0);let e=!0;P.forEach(t=>{t||(e=!1)}),e&&(L?.(),$([]),d&&b?.(),i&&i())},anchorX:m,anchorY:h,children:e},s)})})}],88653)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3925,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.i(85269);var s=e.i(22831),i=e.i(49721),a=e.i(68757),o=e.i(85709),r=e.i(14421),l=e.i(95430);let u=["navigation.position","environment.sun.sunrise","environment.sun.sunset","environment.outside.uvIndex"];e.s(["default",0,({compact:e=!1})=>{let{t:c}=(0,s.useTranslation)(),m=(0,o.useSignalKPaths)(u),[d,v]=(0,n.useState)(()=>(0,l.vesselNow)());(0,n.useEffect)(()=>{let e=setInterval(()=>v((0,l.vesselNow)()),3e4);return()=>clearInterval(e)},[]);let x=m["navigation.position"],p=(0,r.computeSunEvents)(x?.latitude,x?.longitude,d),g=[{at:(0,r.parseSunTime)(m["environment.sun.sunrise"],d)??p?.sunrise,rise:!0},{at:(0,r.parseSunTime)(m["environment.sun.sunset"],d)??p?.sunset,rise:!1}].filter(e=>e.at&&e.at>d).sort((e,t)=>e.at-t.at)[0],f=m["environment.outside.uvIndex"];return(0,t.jsxs)("div",{className:"flex items-center gap-3 text-label font-semibold tracking-[0.15em] text-hud-muted",children:[g&&!e&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",title:c(g.rise?"hud.sunrise":"hud.sunset"),children:[(0,t.jsx)(i.FontAwesomeIcon,{icon:g.rise?a.faSun:a.faMoon,className:"text-oYellow text-sm"}),(0,r.formatClockTime)(g.at)]}),Number.isFinite(f)&&!e&&(0,t.jsxs)("span",{className:"flex items-center gap-1",title:c("environmental.uvIndex"),children:[(0,t.jsx)("span",{className:`text-caption ${f<3?"text-oGreen":f<6?"text-oYellow":"text-oRed"}`,children:"UV"}),f.toFixed(0)]}),(0,t.jsx)("span",{className:"uppercase tracking-[0.2em]",children:d.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})}])},84809,function(e){e.n(e.i(3925))}]);
|